Compare commits
No commits in common. "864839a96b3d42de631e42dec1cf4ae6af42a32f" and "2727b7cced2ddf8e5bba6956baed0f8702c8db7e" have entirely different histories.
864839a96b
...
2727b7cced
21 changed files with 105 additions and 254 deletions
2
.github/workflows/gradle.yml
vendored
2
.github/workflows/gradle.yml
vendored
|
|
@ -25,7 +25,7 @@ jobs:
|
||||||
- name: Upload artififacts
|
- name: Upload artififacts
|
||||||
uses: actions/upload-artifact@v2.2.1
|
uses: actions/upload-artifact@v2.2.1
|
||||||
with:
|
with:
|
||||||
name: Bukman
|
name: ServerUtils
|
||||||
path: jars/*.jar
|
path: jars/*.jar
|
||||||
- name: Publish
|
- name: Publish
|
||||||
if: ${{ github.event_name == 'push' }}
|
if: ${{ github.event_name == 'push' }}
|
||||||
|
|
|
||||||
|
|
@ -9,11 +9,11 @@ val rootDependencyDir = "${rootProject.group}.dependencies"
|
||||||
val dependencyDir = "${group}.bukkit.dependencies"
|
val dependencyDir = "${group}.bukkit.dependencies"
|
||||||
version = rootProject.version
|
version = rootProject.version
|
||||||
base {
|
base {
|
||||||
archivesName.set("${rootProject.name}-bukkit")
|
archivesName.set("${rootProject.name}-Bukkit")
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation("org.zhdev.oblak:cloud-paper:${VersionConstants.cloudVersion}")
|
implementation("cloud.commandframework:cloud-paper:${VersionConstants.cloudVersion}")
|
||||||
implementation("net.kyori:adventure-api:${VersionConstants.adventureVersion}") {
|
implementation("net.kyori:adventure-api:${VersionConstants.adventureVersion}") {
|
||||||
exclude("net.kyori", "adventure-text-minimessage")
|
exclude("net.kyori", "adventure-text-minimessage")
|
||||||
}
|
}
|
||||||
|
|
@ -36,11 +36,11 @@ tasks.withType<ShadowJar> {
|
||||||
}
|
}
|
||||||
|
|
||||||
bukkit {
|
bukkit {
|
||||||
name = "Bukman"
|
name = "ServerUtils"
|
||||||
main = "net.frankheijden.serverutils.bukkit.ServerUtils"
|
main = "net.frankheijden.serverutils.bukkit.ServerUtils"
|
||||||
description = "A server utility"
|
description = "A server utility"
|
||||||
apiVersion = "1.13"
|
apiVersion = "1.13"
|
||||||
website = "https://git.zhira.net/zhdev/bukman"
|
website = "https://github.com/FrankHeijden/ServerUtils"
|
||||||
softDepend = listOf("ServerUtilsUpdater")
|
softDepend = listOf("ServerUtilsUpdater")
|
||||||
authors = listOf("FrankHeijden", "ZhDev")
|
authors = listOf("FrankHeijden")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,6 @@ package net.frankheijden.serverutils.bukkit.managers;
|
||||||
|
|
||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
@ -15,8 +12,8 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.jar.JarEntry;
|
import java.util.regex.Matcher;
|
||||||
import java.util.jar.JarFile;
|
import java.util.regex.Pattern;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import net.frankheijden.serverutils.bukkit.entities.BukkitPluginDescription;
|
import net.frankheijden.serverutils.bukkit.entities.BukkitPluginDescription;
|
||||||
import net.frankheijden.serverutils.bukkit.events.BukkitPluginDisableEvent;
|
import net.frankheijden.serverutils.bukkit.events.BukkitPluginDisableEvent;
|
||||||
|
|
@ -44,11 +41,9 @@ import org.bukkit.command.PluginIdentifiableCommand;
|
||||||
import org.bukkit.plugin.InvalidDescriptionException;
|
import org.bukkit.plugin.InvalidDescriptionException;
|
||||||
import org.bukkit.plugin.InvalidPluginException;
|
import org.bukkit.plugin.InvalidPluginException;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.plugin.PluginDescriptionFile;
|
|
||||||
import org.bukkit.plugin.PluginLoader;
|
import org.bukkit.plugin.PluginLoader;
|
||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
import org.bukkit.plugin.UnknownDependencyException;
|
import org.bukkit.plugin.UnknownDependencyException;
|
||||||
import org.yaml.snakeyaml.error.YAMLException;
|
|
||||||
|
|
||||||
public class BukkitPluginManager extends AbstractPluginManager<Plugin, BukkitPluginDescription> {
|
public class BukkitPluginManager extends AbstractPluginManager<Plugin, BukkitPluginDescription> {
|
||||||
|
|
||||||
|
|
@ -353,43 +348,45 @@ public class BukkitPluginManager extends AbstractPluginManager<Plugin, BukkitPlu
|
||||||
return knownCommands.get(command);
|
return knownCommands.get(command);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves all file associations, i.e. all plugin loaders.
|
||||||
|
* @return A map with all pluginloaders.
|
||||||
|
*/
|
||||||
|
public static Map<Pattern, PluginLoader> getFileAssociations() {
|
||||||
|
try {
|
||||||
|
return RSimplePluginManager.getFileAssociations(Bukkit.getPluginManager());
|
||||||
|
} catch (IllegalAccessException ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the PluginLoader for the input file.
|
||||||
|
* @param file The file.
|
||||||
|
* @return The appropiate PluginLoader.
|
||||||
|
*/
|
||||||
|
public static Optional<PluginLoader> getPluginLoader(File file) {
|
||||||
|
Map<Pattern, PluginLoader> fileAssociations = getFileAssociations();
|
||||||
|
if (fileAssociations != null) {
|
||||||
|
for (Map.Entry<Pattern, PluginLoader> entry : fileAssociations.entrySet()) {
|
||||||
|
Matcher match = entry.getKey().matcher(file.getName());
|
||||||
|
if (match.find()) {
|
||||||
|
return Optional.ofNullable(entry.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Optional<BukkitPluginDescription> getPluginDescription(File file) throws InvalidPluginDescriptionException {
|
public Optional<BukkitPluginDescription> getPluginDescription(File file) throws InvalidPluginDescriptionException {
|
||||||
if (!file.exists()) return Optional.empty();
|
if (!file.exists()) return Optional.empty();
|
||||||
|
|
||||||
|
Optional<PluginLoader> loader = getPluginLoader(file);
|
||||||
|
if (!loader.isPresent()) throw new InvalidPluginDescriptionException("Plugin loader is not present!");
|
||||||
try {
|
try {
|
||||||
JarFile jar = null;
|
return Optional.of(new BukkitPluginDescription(loader.get().getPluginDescription(file), file));
|
||||||
InputStream stream = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
jar = new JarFile(file);
|
|
||||||
JarEntry entry = jar.getJarEntry("plugin.yml");
|
|
||||||
|
|
||||||
if (entry == null) {
|
|
||||||
throw new InvalidDescriptionException(new FileNotFoundException("Jar does not contain plugin.yml"));
|
|
||||||
}
|
|
||||||
|
|
||||||
stream = jar.getInputStream(entry);
|
|
||||||
|
|
||||||
return Optional.of(new BukkitPluginDescription(new PluginDescriptionFile(stream), file));
|
|
||||||
} catch (IOException | YAMLException ex) {
|
|
||||||
throw new InvalidDescriptionException(ex);
|
|
||||||
} finally {
|
|
||||||
if (jar != null) {
|
|
||||||
try {
|
|
||||||
jar.close();
|
|
||||||
} catch (IOException ignored) {
|
|
||||||
// we do nothing
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (stream != null) {
|
|
||||||
try {
|
|
||||||
stream.close();
|
|
||||||
} catch (IOException ignored) {
|
|
||||||
// we do nothing
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (InvalidDescriptionException ex) {
|
} catch (InvalidDescriptionException ex) {
|
||||||
throw new InvalidPluginDescriptionException(ex);
|
throw new InvalidPluginDescriptionException(ex);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ package net.frankheijden.serverutils.bukkit.reflection;
|
||||||
import dev.frankheijden.minecraftreflection.MinecraftReflection;
|
import dev.frankheijden.minecraftreflection.MinecraftReflection;
|
||||||
import dev.frankheijden.minecraftreflection.MinecraftReflectionVersion;
|
import dev.frankheijden.minecraftreflection.MinecraftReflectionVersion;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
@ -52,7 +51,7 @@ public class RCraftServer {
|
||||||
public static void syncCommands(Set<String> removedCommands) {
|
public static void syncCommands(Set<String> removedCommands) {
|
||||||
if (MinecraftReflectionVersion.MINOR < 13) return;
|
if (MinecraftReflectionVersion.MINOR < 13) return;
|
||||||
|
|
||||||
Collection children = new ArrayList<>(RCommandDispatcher.getDispatcher().getRoot().getChildren());
|
Collection children = RCommandDispatcher.getDispatcher().getRoot().getChildren();
|
||||||
reflection.invoke(Bukkit.getServer(), "syncCommands");
|
reflection.invoke(Bukkit.getServer(), "syncCommands");
|
||||||
Object root = RCommandDispatcher.getDispatcher().getRoot();
|
Object root = RCommandDispatcher.getDispatcher().getRoot();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,46 +4,25 @@ import dev.frankheijden.minecraftreflection.MinecraftReflection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import dev.frankheijden.minecraftreflection.exceptions.MinecraftReflectionException;
|
import java.util.regex.Pattern;
|
||||||
import net.frankheijden.serverutils.bukkit.ServerUtils;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
import org.bukkit.plugin.PluginLoader;
|
||||||
|
import org.bukkit.plugin.SimplePluginManager;
|
||||||
|
|
||||||
public class RSimplePluginManager {
|
public class RSimplePluginManager {
|
||||||
private static final MinecraftReflection reflection = MinecraftReflection.of(Bukkit.getPluginManager().getClass());
|
|
||||||
private static final MinecraftReflection paperPluginManagerReflection;
|
|
||||||
private static final MinecraftReflection paperInstanceManagerReflection;
|
|
||||||
|
|
||||||
static {
|
private static final MinecraftReflection reflection = MinecraftReflection.of(SimplePluginManager.class);
|
||||||
MinecraftReflection pluginManagerReflection;
|
|
||||||
MinecraftReflection instanceManagerReflection;
|
|
||||||
try {
|
|
||||||
pluginManagerReflection =
|
|
||||||
MinecraftReflection.of("io.papermc.paper.plugin.manager.PaperPluginManagerImpl");
|
|
||||||
instanceManagerReflection =
|
|
||||||
MinecraftReflection.of("io.papermc.paper.plugin.manager.PaperPluginInstanceManager");
|
|
||||||
} catch (MinecraftReflectionException e) {
|
|
||||||
pluginManagerReflection = null;
|
|
||||||
instanceManagerReflection = null;
|
|
||||||
}
|
|
||||||
paperPluginManagerReflection = pluginManagerReflection;
|
|
||||||
paperInstanceManagerReflection = instanceManagerReflection;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static MinecraftReflection getReflection() {
|
public static MinecraftReflection getReflection() {
|
||||||
return reflection;
|
return reflection;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public static Map<Pattern, PluginLoader> getFileAssociations(Object manager) throws IllegalAccessException {
|
||||||
* Gets a list of plugins.
|
return reflection.get(manager, "fileAssociations");
|
||||||
* @param manager The SimplePluginManager instance to get plugins from.
|
}
|
||||||
* @return list of plugins.
|
|
||||||
*/
|
|
||||||
public static List<Plugin> getPlugins(Object manager) {
|
public static List<Plugin> getPlugins(Object manager) {
|
||||||
if (paperPluginManagerReflection == null) {
|
return reflection.get(manager, "plugins");
|
||||||
return reflection.get(manager, "plugins");
|
|
||||||
}
|
|
||||||
return paperInstanceManagerReflection.get(getInstanceManager(manager), "plugins");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -53,23 +32,9 @@ public class RSimplePluginManager {
|
||||||
* @param name The name of the plugin to remove.
|
* @param name The name of the plugin to remove.
|
||||||
*/
|
*/
|
||||||
public static void removeLookupName(Object manager, String name) {
|
public static void removeLookupName(Object manager, String name) {
|
||||||
Map<String, Plugin> lookupNames;
|
Map<String, Plugin> lookupNames = reflection.get(manager, "lookupNames");
|
||||||
if (paperPluginManagerReflection == null) {
|
if (lookupNames == null) return;
|
||||||
lookupNames = reflection.get(manager, "lookupNames");
|
|
||||||
} else {
|
|
||||||
lookupNames = paperInstanceManagerReflection.get(getInstanceManager(manager), "lookupNames");
|
|
||||||
}
|
|
||||||
if (lookupNames == null) {
|
|
||||||
ServerUtils.getInstance().getLogger()
|
|
||||||
.warning("Cannot remove lookup name '" + name + "' because lookupNames is null");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
lookupNames.remove(name.replace(' ', '_'));
|
lookupNames.remove(name.replace(' ', '_'));
|
||||||
lookupNames.remove(name.replace(' ', '_').toLowerCase(Locale.ENGLISH)); // Paper
|
lookupNames.remove(name.replace(' ', '_').toLowerCase(Locale.ENGLISH)); // Paper
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Object getInstanceManager(Object manager) {
|
|
||||||
Object paperPluginManager = reflection.get(manager, "paperPluginManager");
|
|
||||||
return paperPluginManagerReflection.get(paperPluginManager, "instanceManager");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ val rootDependencyDir = "${group}.dependencies"
|
||||||
val dependencyDir = "${group}.bungee.dependencies"
|
val dependencyDir = "${group}.bungee.dependencies"
|
||||||
version = rootProject.version
|
version = rootProject.version
|
||||||
base {
|
base {
|
||||||
archivesName.set("${rootProject.name}-bungee")
|
archivesName.set("${rootProject.name}-Bungee")
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
|
|
@ -17,7 +17,7 @@ repositories {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation("org.zhdev.oblak:cloud-bungee:${VersionConstants.cloudVersion}")
|
implementation("cloud.commandframework:cloud-bungee:${VersionConstants.cloudVersion}")
|
||||||
implementation("net.kyori:adventure-api:${VersionConstants.adventureVersion}") {
|
implementation("net.kyori:adventure-api:${VersionConstants.adventureVersion}") {
|
||||||
exclude("net.kyori", "adventure-text-minimessage")
|
exclude("net.kyori", "adventure-text-minimessage")
|
||||||
}
|
}
|
||||||
|
|
@ -38,7 +38,7 @@ tasks.withType<ShadowJar> {
|
||||||
}
|
}
|
||||||
|
|
||||||
bungee {
|
bungee {
|
||||||
name = "Bukman"
|
name = "ServerUtils"
|
||||||
main = "net.frankheijden.serverutils.bungee.ServerUtils"
|
main = "net.frankheijden.serverutils.bungee.ServerUtils"
|
||||||
description = "A server utility"
|
description = "A server utility"
|
||||||
softDepends = setOf("ServerUtilsUpdater")
|
softDepends = setOf("ServerUtilsUpdater")
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ plugins {
|
||||||
group = rootProject.group
|
group = rootProject.group
|
||||||
version = "${rootProject.version}"
|
version = "${rootProject.version}"
|
||||||
base {
|
base {
|
||||||
archivesName.set("${rootProject.name}-common")
|
archivesName.set("${rootProject.name}-Common")
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.function.IntFunction;
|
import java.util.function.IntFunction;
|
||||||
|
|
@ -208,13 +207,8 @@ public abstract class CommandServerUtils<U extends ServerUtilsPlugin<P, ?, C, ?,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean recursive = context.flags().contains("recursive");
|
if (checkDependingPlugins(context, sender, plugins, "unloadplugin")) {
|
||||||
|
return;
|
||||||
List<P> dependingPlugins = getDependingPlugins(context, sender, plugins, "unloadplugin");
|
|
||||||
if (!recursive) {
|
|
||||||
if (!dependingPlugins.isEmpty()) return;
|
|
||||||
} else {
|
|
||||||
plugins.addAll(0, dependingPlugins);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginResults<P> disableResults = plugin.getPluginManager().disablePlugins(plugins);
|
PluginResults<P> disableResults = plugin.getPluginManager().disablePlugins(plugins);
|
||||||
|
|
@ -238,10 +232,7 @@ public abstract class CommandServerUtils<U extends ServerUtilsPlugin<P, ?, C, ?,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean recursive = context.flags().contains("recursive");
|
if (checkDependingPlugins(context, sender, plugins, "reloadplugin")) {
|
||||||
|
|
||||||
List<P> dependingPlugins = getDependingPlugins(context, sender, plugins, "reloadplugin");
|
|
||||||
if (!recursive && !dependingPlugins.isEmpty()) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -249,108 +240,50 @@ public abstract class CommandServerUtils<U extends ServerUtilsPlugin<P, ?, C, ?,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (recursive && !dependingPlugins.isEmpty()) {
|
|
||||||
PluginResults<P> disableDependingResults = plugin.getPluginManager().disablePlugins(dependingPlugins);
|
|
||||||
for (PluginResult<P> disableResult : disableDependingResults.getResults()) {
|
|
||||||
if (!disableResult.isSuccess() && disableResult.getResult() != Result.ALREADY_DISABLED) {
|
|
||||||
disableResult.sendTo(sender, null);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CloseablePluginResults<P> unloadDependingResults = plugin.getPluginManager()
|
|
||||||
.unloadPlugins(dependingPlugins);
|
|
||||||
unloadDependingResults.tryClose();
|
|
||||||
unloadDependingResults.sendTo(sender, MessageKey.UNLOADPLUGIN_RECURSIVELY);
|
|
||||||
}
|
|
||||||
|
|
||||||
PluginResults<P> reloadResults = plugin.getPluginManager().reloadPlugins(plugins);
|
PluginResults<P> reloadResults = plugin.getPluginManager().reloadPlugins(plugins);
|
||||||
reloadResults.sendTo(sender, MessageKey.RELOADPLUGIN_SUCCESS);
|
reloadResults.sendTo(sender, MessageKey.RELOADPLUGIN_SUCCESS);
|
||||||
|
|
||||||
if (recursive && !dependingPlugins.isEmpty()) {
|
|
||||||
List<String> pluginIds = new ArrayList<>(dependingPlugins.size());
|
|
||||||
for (P p : dependingPlugins) {
|
|
||||||
pluginIds.add(plugin.getPluginManager().getPluginId(p));
|
|
||||||
}
|
|
||||||
List<File> pluginFiles = new ArrayList<>(dependingPlugins.size());
|
|
||||||
for (String pluginId : pluginIds) {
|
|
||||||
Optional<File> pluginFile = plugin.getPluginManager().getPluginFile(pluginId);
|
|
||||||
if (!pluginFile.isPresent()) {
|
|
||||||
new PluginResults<P>().addResult(pluginId, Result.FILE_DELETED).sendTo(sender, null);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
pluginFiles.add(pluginFile.get());
|
|
||||||
}
|
|
||||||
|
|
||||||
PluginResults<P> loadDependingResults = plugin.getPluginManager().loadPlugins(pluginFiles);
|
|
||||||
if (!loadDependingResults.isSuccess()) {
|
|
||||||
PluginResult<P> failedResult = loadDependingResults.last();
|
|
||||||
failedResult.sendTo(sender, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
PluginResults<P> enableResults = plugin.getPluginManager().enablePlugins(loadDependingResults.getPlugins());
|
|
||||||
enableResults.sendTo(sender, MessageKey.LOADPLUGIN_RECURSIVELY);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean checkDependingPlugins(CommandContext<C> context, C sender, List<P> plugins, String subcommand) {
|
protected boolean checkDependingPlugins(CommandContext<C> context, C sender, List<P> plugins, String subcommand) {
|
||||||
return !getDependingPlugins(context, sender, plugins, subcommand).isEmpty();
|
if (context.flags().contains("force")) return false;
|
||||||
}
|
|
||||||
|
|
||||||
protected List<P> getDependingPlugins(CommandContext<C> context, C sender, List<P> plugins, String subcommand) {
|
|
||||||
if (context.flags().contains("force")) return Collections.emptyList();
|
|
||||||
|
|
||||||
boolean recursive = context.flags().contains("recursive");
|
|
||||||
|
|
||||||
AbstractPluginManager<P, ?> pluginManager = plugin.getPluginManager();
|
AbstractPluginManager<P, ?> pluginManager = plugin.getPluginManager();
|
||||||
MessagesResource messages = plugin.getMessagesResource();
|
MessagesResource messages = plugin.getMessagesResource();
|
||||||
|
|
||||||
List<P> dependingPluginsAll = new ArrayList<>();
|
|
||||||
boolean hasDependingPlugins = false;
|
boolean hasDependingPlugins = false;
|
||||||
for (P plugin : plugins) {
|
for (P plugin : plugins) {
|
||||||
String pluginId = pluginManager.getPluginId(plugin);
|
String pluginId = pluginManager.getPluginId(plugin);
|
||||||
|
|
||||||
List<P> dependingPlugins = pluginManager.getPluginsDependingOn(pluginId);
|
List<P> dependingPlugins = pluginManager.getPluginsDependingOn(pluginId);
|
||||||
if (!dependingPlugins.isEmpty()) {
|
if (!dependingPlugins.isEmpty()) {
|
||||||
if (!recursive) {
|
TextComponent.Builder builder = Component.text();
|
||||||
TextComponent.Builder builder = Component.text();
|
builder.append(messages.get(MessageKey.DEPENDING_PLUGINS_PREFIX).toComponent(
|
||||||
builder.append(messages.get(MessageKey.DEPENDING_PLUGINS_PREFIX).toComponent(
|
Template.of("plugin", pluginId)
|
||||||
Template.of("plugin", pluginId)
|
));
|
||||||
));
|
builder.append(ListComponentBuilder.create(dependingPlugins)
|
||||||
builder.append(ListComponentBuilder.create(dependingPlugins)
|
.format(p -> messages.get(MessageKey.DEPENDING_PLUGINS_FORMAT).toComponent(
|
||||||
.format(p -> messages.get(MessageKey.DEPENDING_PLUGINS_FORMAT).toComponent(
|
Template.of("plugin", pluginManager.getPluginId(p))
|
||||||
Template.of("plugin", pluginManager.getPluginId(p))
|
))
|
||||||
))
|
.separator(messages.get(MessageKey.DEPENDING_PLUGINS_SEPARATOR).toComponent())
|
||||||
.separator(messages.get(MessageKey.DEPENDING_PLUGINS_SEPARATOR).toComponent())
|
.lastSeparator(messages.get(MessageKey.DEPENDING_PLUGINS_LAST_SEPARATOR).toComponent())
|
||||||
.lastSeparator(messages.get(MessageKey.DEPENDING_PLUGINS_LAST_SEPARATOR).toComponent())
|
.build());
|
||||||
.build());
|
sender.sendMessage(builder.build());
|
||||||
sender.sendMessage(builder.build());
|
|
||||||
}
|
|
||||||
|
|
||||||
hasDependingPlugins = true;
|
hasDependingPlugins = true;
|
||||||
dependingPluginsAll.addAll(dependingPlugins);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!recursive && hasDependingPlugins) {
|
if (hasDependingPlugins) {
|
||||||
String forceFlagPath = getRawPath(subcommand) + ".flags.force";
|
String flagPath = getRawPath(subcommand) + ".flags.force";
|
||||||
String forceFlag = plugin.getCommandsResource().getAllFlagAliases(forceFlagPath).stream()
|
String forceFlag = plugin.getCommandsResource().getAllFlagAliases(flagPath).stream()
|
||||||
.min(Comparator.comparingInt(String::length))
|
.min(Comparator.comparingInt(String::length))
|
||||||
.orElse("-f");
|
.orElse("-f");
|
||||||
String recursiveFlagPath = getRawPath(subcommand) + ".flags.recursive";
|
|
||||||
String rescuriveFlag = plugin.getCommandsResource().getAllFlagAliases(recursiveFlagPath).stream()
|
|
||||||
.min(Comparator.comparingInt(String::length))
|
|
||||||
.orElse("-r");
|
|
||||||
|
|
||||||
sender.sendMessage(messages.get(MessageKey.DEPENDING_PLUGINS_OVERRIDE).toComponent(
|
sender.sendMessage(messages.get(MessageKey.DEPENDING_PLUGINS_OVERRIDE).toComponent(
|
||||||
Template.of("command", context.getRawInputJoined() + " " + forceFlag)
|
Template.of("command", context.getRawInputJoined() + " " + forceFlag)
|
||||||
));
|
));
|
||||||
sender.sendMessage(messages.get(MessageKey.DEPENDING_PLUGINS_RECURSIVELY).toComponent(
|
|
||||||
Template.of("command", context.getRawInputJoined() + " " + rescuriveFlag)
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return dependingPluginsAll;
|
return hasDependingPlugins;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean checkServerUtils(CommandContext<C> context, C sender, List<P> plugins) {
|
protected boolean checkServerUtils(CommandContext<C> context, C sender, List<P> plugins) {
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ import cloud.commandframework.context.CommandContext;
|
||||||
import cloud.commandframework.exceptions.parsing.NoInputProvidedException;
|
import cloud.commandframework.exceptions.parsing.NoInputProvidedException;
|
||||||
import io.leangen.geantyref.TypeToken;
|
import io.leangen.geantyref.TypeToken;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Queue;
|
import java.util.Queue;
|
||||||
|
|
@ -65,9 +64,7 @@ public class PluginsArgument<C extends ServerUtilsAudience<?>, P> extends Comman
|
||||||
return ArgumentParseResult.failure(new NoInputProvidedException(PluginsParser.class, context));
|
return ArgumentParseResult.failure(new NoInputProvidedException(PluginsParser.class, context));
|
||||||
}
|
}
|
||||||
|
|
||||||
Set<String> flags = new HashSet<>();
|
Set<String> flags = plugin.getCommandsResource().getAllFlagAliases(commandConfigPath + ".flags.force");
|
||||||
flags.addAll(plugin.getCommandsResource().getAllFlagAliases(commandConfigPath + ".flags.force"));
|
|
||||||
flags.addAll(plugin.getCommandsResource().getAllFlagAliases(commandConfigPath + ".flags.recursive"));
|
|
||||||
|
|
||||||
int queueSize = inputQueue.size();
|
int queueSize = inputQueue.size();
|
||||||
List<P> plugins = new ArrayList<>(queueSize);
|
List<P> plugins = new ArrayList<>(queueSize);
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,7 @@ public enum MessageKey implements PlaceholderConfigKey {
|
||||||
|
|
||||||
RELOAD("reload", false),
|
RELOAD("reload", false),
|
||||||
LOADPLUGIN("loadplugin"),
|
LOADPLUGIN("loadplugin"),
|
||||||
LOADPLUGIN_RECURSIVELY("loadplugin-recursively"),
|
|
||||||
UNLOADPLUGIN("unloadplugin"),
|
UNLOADPLUGIN("unloadplugin"),
|
||||||
UNLOADPLUGIN_RECURSIVELY("unloadplugin-recursively"),
|
|
||||||
SERVERUTILS_UPDATER("serverutils-updater", false),
|
SERVERUTILS_UPDATER("serverutils-updater", false),
|
||||||
RELOADPLUGIN_SUCCESS("reloadplugin.success"),
|
RELOADPLUGIN_SUCCESS("reloadplugin.success"),
|
||||||
RELOADPLUGIN_SERVERUTILS("reloadplugin.serverutils"),
|
RELOADPLUGIN_SERVERUTILS("reloadplugin.serverutils"),
|
||||||
|
|
@ -29,7 +27,6 @@ public enum MessageKey implements PlaceholderConfigKey {
|
||||||
DEPENDING_PLUGINS_SEPARATOR("depending-plugins.separator", false),
|
DEPENDING_PLUGINS_SEPARATOR("depending-plugins.separator", false),
|
||||||
DEPENDING_PLUGINS_LAST_SEPARATOR("depending-plugins.last-separator", false),
|
DEPENDING_PLUGINS_LAST_SEPARATOR("depending-plugins.last-separator", false),
|
||||||
DEPENDING_PLUGINS_OVERRIDE("depending-plugins.override"),
|
DEPENDING_PLUGINS_OVERRIDE("depending-plugins.override"),
|
||||||
DEPENDING_PLUGINS_RECURSIVELY("depending-plugins.recursively"),
|
|
||||||
WATCHPLUGIN_START("watchplugin.start"),
|
WATCHPLUGIN_START("watchplugin.start"),
|
||||||
WATCHPLUGIN_CHANGE("watchplugin.change", false),
|
WATCHPLUGIN_CHANGE("watchplugin.change", false),
|
||||||
WATCHPLUGIN_STOPPED("watchplugin.stopped"),
|
WATCHPLUGIN_STOPPED("watchplugin.stopped"),
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,6 @@ public interface PluginProvider<P, D extends ServerUtilsPluginDescription> {
|
||||||
try {
|
try {
|
||||||
pluginDescriptionOptional = getPluginDescription(file);
|
pluginDescriptionOptional = getPluginDescription(file);
|
||||||
} catch (InvalidPluginDescriptionException ex) {
|
} catch (InvalidPluginDescriptionException ex) {
|
||||||
ex.printStackTrace();
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -58,7 +57,6 @@ public interface PluginProvider<P, D extends ServerUtilsPluginDescription> {
|
||||||
ServerUtilsPluginDescription description = getLoadedPluginDescription(loadedPlugin);
|
ServerUtilsPluginDescription description = getLoadedPluginDescription(loadedPlugin);
|
||||||
if (description.getDependencies().contains(pluginId)) {
|
if (description.getDependencies().contains(pluginId)) {
|
||||||
plugins.add(loadedPlugin);
|
plugins.add(loadedPlugin);
|
||||||
plugins.addAll(getPluginsDependingOn(description.getId()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ public class UpdateCheckerTask<U extends ServerUtilsPlugin<P, ?, ?, ?, ?>, P> im
|
||||||
private final boolean download;
|
private final boolean download;
|
||||||
private final boolean install;
|
private final boolean install;
|
||||||
|
|
||||||
private static final String GITHUB_LINK = "https://git.zhira.net/api/v1/repos/zhdev/bukman/releases/latest";
|
private static final String GITHUB_LINK = "https://api.github.com/repos/FrankHeijden/ServerUtils/releases/latest";
|
||||||
private static final String GITHUB_UPDATER_LINK = "https://api.github.com/repos/FrankHeijden/ServerUtilsUpdater"
|
private static final String GITHUB_UPDATER_LINK = "https://api.github.com/repos/FrankHeijden/ServerUtilsUpdater"
|
||||||
+ "/releases/latest";
|
+ "/releases/latest";
|
||||||
|
|
||||||
|
|
@ -163,7 +163,7 @@ public class UpdateCheckerTask<U extends ServerUtilsPlugin<P, ?, ?, ?, ?>, P> im
|
||||||
if (sender.isPlayer()) {
|
if (sender.isPlayer()) {
|
||||||
broadcastDownloadStatus(githubVersion, false);
|
broadcastDownloadStatus(githubVersion, false);
|
||||||
} else {
|
} else {
|
||||||
plugin.getLogger().log(Level.INFO, DOWNLOADED, new Object[]{ "Bukman", githubVersion });
|
plugin.getLogger().log(Level.INFO, DOWNLOADED, new Object[]{ "ServerUtils", githubVersion });
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -73,13 +73,6 @@
|
||||||
"permission": "serverutils.unloadplugin",
|
"permission": "serverutils.unloadplugin",
|
||||||
"description": "Force disable and unload the specified plugin(s).",
|
"description": "Force disable and unload the specified plugin(s).",
|
||||||
"display-in-help": false
|
"display-in-help": false
|
||||||
},
|
|
||||||
"recursive": {
|
|
||||||
"main": "recursive",
|
|
||||||
"aliases": ["r"],
|
|
||||||
"permission": "serverutils.unloadplugin",
|
|
||||||
"description": "Recursively disable and unload the specified plugin(s).",
|
|
||||||
"display-in-help": false
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -96,13 +89,6 @@
|
||||||
"permission": "serverutils.reloadplugin",
|
"permission": "serverutils.reloadplugin",
|
||||||
"description": "Force reloads the specified plugin(s).",
|
"description": "Force reloads the specified plugin(s).",
|
||||||
"display-in-help": false
|
"display-in-help": false
|
||||||
},
|
|
||||||
"recursive": {
|
|
||||||
"main": "recursive",
|
|
||||||
"aliases": ["r"],
|
|
||||||
"permission": "serverutils.reloadplugin",
|
|
||||||
"description": "Recursively reloads the specified plugin(s).",
|
|
||||||
"display-in-help": false
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,7 @@
|
||||||
"reload": "<dark_aqua>Successfully reloaded <aqua>ServerUtils configurations</aqua>!",
|
"reload": "<dark_aqua>Successfully reloaded <aqua>ServerUtils configurations</aqua>!",
|
||||||
"serverutils-updater": "<dark_aqua>Loaded and enabled ServerUtilsUpdater. Completion can be monitored from the console, attempting restart now...",
|
"serverutils-updater": "<dark_aqua>Loaded and enabled ServerUtilsUpdater. Completion can be monitored from the console, attempting restart now...",
|
||||||
"loadplugin": "<dark_aqua>Successfully loaded <aqua><plugin></aqua>!",
|
"loadplugin": "<dark_aqua>Successfully loaded <aqua><plugin></aqua>!",
|
||||||
"loadplugin-recursively": "<dark_aqua>Successfully recursively loaded <aqua><plugin></aqua>!",
|
|
||||||
"unloadplugin": "<dark_aqua>Successfully unloaded <aqua><plugin></aqua>!",
|
"unloadplugin": "<dark_aqua>Successfully unloaded <aqua><plugin></aqua>!",
|
||||||
"unloadplugin-recursively": "<dark_aqua>Successfully recursively unloaded <aqua><plugin></aqua>!",
|
|
||||||
"reloadplugin": {
|
"reloadplugin": {
|
||||||
"success": "<dark_aqua>Successfully reloaded <aqua><plugin></aqua>!",
|
"success": "<dark_aqua>Successfully reloaded <aqua><plugin></aqua>!",
|
||||||
"serverutils": "<red>Sorry, but you can't reload ServerUtils this way. Please restart using <dark_red>/<command></dark_red>."
|
"serverutils": "<red>Sorry, but you can't reload ServerUtils this way. Please restart using <dark_red>/<command></dark_red>."
|
||||||
|
|
@ -30,8 +28,7 @@
|
||||||
"format": "<dark_red><plugin>",
|
"format": "<dark_red><plugin>",
|
||||||
"separator": "<red>, ",
|
"separator": "<red>, ",
|
||||||
"last-separator": " <red>and ",
|
"last-separator": " <red>and ",
|
||||||
"override": "<red>Use \"<dark_red>/<command></dark_red>\" to force command execution.",
|
"override": "<red>Use \"<dark_red>/<command></dark_red>\" to force command execution."
|
||||||
"recursively": "<red>Use \"<dark_red>/<command></dark_red>\" to recursively command execution."
|
|
||||||
},
|
},
|
||||||
"watchplugin": {
|
"watchplugin": {
|
||||||
"start": "<dark_aqua>Started watching <aqua><plugin></aqua>!",
|
"start": "<dark_aqua>Started watching <aqua><plugin></aqua>!",
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ group = "${rootProject.group}"
|
||||||
val dependencyDir = "${group}.velocity.dependencies"
|
val dependencyDir = "${group}.velocity.dependencies"
|
||||||
version = rootProject.version
|
version = rootProject.version
|
||||||
base {
|
base {
|
||||||
archivesName.set("${rootProject.name}-velocity")
|
archivesName.set("${rootProject.name}-Velocity")
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
|
|
@ -17,7 +17,7 @@ repositories {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation("org.zhdev.oblak:cloud-velocity:${VersionConstants.cloudVersion}")
|
implementation("cloud.commandframework:cloud-velocity:${VersionConstants.cloudVersion}")
|
||||||
implementation("org.bstats:bstats-velocity:${VersionConstants.bstatsVersion}")
|
implementation("org.bstats:bstats-velocity:${VersionConstants.bstatsVersion}")
|
||||||
implementation(project(":Common"))
|
implementation(project(":Common"))
|
||||||
implementation("net.kyori:adventure-text-minimessage:${VersionConstants.adventureMinimessageVersion}") {
|
implementation("net.kyori:adventure-text-minimessage:${VersionConstants.adventureMinimessageVersion}") {
|
||||||
|
|
|
||||||
|
|
@ -19,12 +19,12 @@ import org.bstats.velocity.Metrics;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
@Plugin(
|
@Plugin(
|
||||||
id = "bukman",
|
id = "serverutils",
|
||||||
name = "Bukman",
|
name = "ServerUtils",
|
||||||
version = "{version}",
|
version = "{version}",
|
||||||
description = "A server utility",
|
description = "A server utility",
|
||||||
url = "https://git.zhira.net/zhdev/bukman",
|
url = "https://github.com/FrankHeijden/ServerUtils",
|
||||||
authors = {"FrankHeijden", "ZhDev"}
|
authors = "FrankHeijden"
|
||||||
)
|
)
|
||||||
public class ServerUtils {
|
public class ServerUtils {
|
||||||
|
|
||||||
|
|
@ -47,7 +47,7 @@ public class ServerUtils {
|
||||||
private Metrics.Factory metricsFactory;
|
private Metrics.Factory metricsFactory;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@Named("bukman")
|
@Named("serverutils")
|
||||||
private PluginContainer pluginContainer;
|
private PluginContainer pluginContainer;
|
||||||
|
|
||||||
private final VelocityPluginCommandManager pluginCommandManager;
|
private final VelocityPluginCommandManager pluginCommandManager;
|
||||||
|
|
|
||||||
|
|
@ -24,16 +24,9 @@ public class VelocityPluginDescription implements ServerUtilsPluginDescription {
|
||||||
this.description = description;
|
this.description = description;
|
||||||
|
|
||||||
Optional<Path> sourceOptional = description.getSource();
|
Optional<Path> sourceOptional = description.getSource();
|
||||||
if (!sourceOptional.isPresent()) {
|
if (!sourceOptional.isPresent()) throw new InvalidPluginDescriptionException("Source path is null");
|
||||||
if (description.getId().equals("velocity")) {
|
|
||||||
this.file = null;
|
|
||||||
} else {
|
|
||||||
throw new InvalidPluginDescriptionException("Source path is null");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.file = sourceOptional.get().toFile();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
this.file = sourceOptional.get().toFile();
|
||||||
this.author = String.join(", ", description.getAuthors());
|
this.author = String.join(", ", description.getAuthors());
|
||||||
this.dependencies = description.getDependencies().stream()
|
this.dependencies = description.getDependencies().stream()
|
||||||
.map(PluginDependency::getId)
|
.map(PluginDependency::getId)
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import dev.frankheijden.minecraftreflection.MinecraftReflection;
|
||||||
import java.lang.reflect.Array;
|
import java.lang.reflect.Array;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class RVelocityEventManager {
|
public class RVelocityEventManager {
|
||||||
|
|
@ -64,7 +65,7 @@ public class RVelocityEventManager {
|
||||||
Object registrationsEmptyArray = Array.newInstance(RHandlerRegistration.reflection.getClazz(), 0);
|
Object registrationsEmptyArray = Array.newInstance(RHandlerRegistration.reflection.getClazz(), 0);
|
||||||
Class<?> registrationsArrayClass = registrationsEmptyArray.getClass();
|
Class<?> registrationsArrayClass = registrationsEmptyArray.getClass();
|
||||||
|
|
||||||
/*ExecutorService executor = reflection.invoke(manager, "getAsyncExecutor");
|
ExecutorService executor = reflection.invoke(manager, "getAsyncExecutor");
|
||||||
executor.execute(() -> reflection.invoke(
|
executor.execute(() -> reflection.invoke(
|
||||||
manager,
|
manager,
|
||||||
"fire",
|
"fire",
|
||||||
|
|
@ -73,16 +74,7 @@ public class RVelocityEventManager {
|
||||||
ClassObject.of(int.class, 0),
|
ClassObject.of(int.class, 0),
|
||||||
ClassObject.of(boolean.class, true),
|
ClassObject.of(boolean.class, true),
|
||||||
ClassObject.of(registrationsArrayClass, registrations.toArray((Object[]) registrationsEmptyArray))
|
ClassObject.of(registrationsArrayClass, registrations.toArray((Object[]) registrationsEmptyArray))
|
||||||
));*/
|
));
|
||||||
reflection.invoke(
|
|
||||||
manager,
|
|
||||||
"fire",
|
|
||||||
ClassObject.of(CompletableFuture.class, future),
|
|
||||||
ClassObject.of(Object.class, event),
|
|
||||||
ClassObject.of(int.class, 0),
|
|
||||||
ClassObject.of(boolean.class, true),
|
|
||||||
ClassObject.of(registrationsArrayClass, registrations.toArray((Object[]) registrationsEmptyArray))
|
|
||||||
);
|
|
||||||
|
|
||||||
return future;
|
return future;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ plugins {
|
||||||
|
|
||||||
group = "net.frankheijden.serverutils"
|
group = "net.frankheijden.serverutils"
|
||||||
val dependencyDir = "${group}.dependencies"
|
val dependencyDir = "${group}.dependencies"
|
||||||
version = "3.5.6-SNAPSHOT"
|
version = "3.5.5-SNAPSHOT"
|
||||||
|
|
||||||
java {
|
java {
|
||||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
|
@ -27,19 +27,17 @@ subprojects {
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
maven("https://jitpack.io")
|
maven("https://jitpack.io")
|
||||||
maven("https://oss.sonatype.org/content/repositories/snapshots")
|
maven("https://oss.sonatype.org/content/repositories/snapshots")
|
||||||
maven("https://repo.papermc.io/repository/maven-public/")
|
maven("https://papermc.io/repo/repository/maven-public/")
|
||||||
maven("https://libraries.minecraft.net")
|
maven("https://libraries.minecraft.net")
|
||||||
maven("https://maven.zhira.net/repository/zhdev/")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation("org.zhdev.oblak:cloud-core:${VersionConstants.cloudVersion}")
|
implementation("cloud.commandframework:cloud-core:${VersionConstants.cloudVersion}")
|
||||||
implementation("org.zhdev.oblak:cloud-brigadier:${VersionConstants.cloudVersion}")
|
implementation("cloud.commandframework:cloud-brigadier:${VersionConstants.cloudVersion}")
|
||||||
implementation("org.zhdev:megareflection:1.0.2-SNAPSHOT")
|
implementation("com.github.FrankHeijden:MinecraftReflection:1.0.0")
|
||||||
implementation("com.google.code.gson:gson:2.8.6")
|
implementation("com.google.code.gson:gson:2.8.6")
|
||||||
implementation("me.lucko:commodore:2.2")
|
implementation("me.lucko:commodore:2.2")
|
||||||
compileOnly("com.mojang:brigadier:1.0.18")
|
compileOnly("com.mojang:brigadier:1.0.18")
|
||||||
|
|
@ -95,7 +93,6 @@ subprojects {
|
||||||
}
|
}
|
||||||
relocate("net.kyori.adventure.text.minimessage", "${dependencyDir}.adventure.text.minimessage")
|
relocate("net.kyori.adventure.text.minimessage", "${dependencyDir}.adventure.text.minimessage")
|
||||||
relocate("dev.frankheijden.minecraftreflection", "${dependencyDir}.minecraftreflection")
|
relocate("dev.frankheijden.minecraftreflection", "${dependencyDir}.minecraftreflection")
|
||||||
relocate("org.zhdev", "${dependencyDir}.zhdev")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
publishing {
|
publishing {
|
||||||
|
|
@ -116,11 +113,11 @@ subprojects {
|
||||||
}
|
}
|
||||||
|
|
||||||
publications {
|
publications {
|
||||||
create<MavenPublication>("bukman") {
|
create<MavenPublication>("ServerUtils") {
|
||||||
artifact(tasks["shadowJar"]) {
|
artifact(tasks["shadowJar"]) {
|
||||||
classifier = ""
|
classifier = ""
|
||||||
}
|
}
|
||||||
artifactId = "bukman-$artifactId"
|
artifactId = "ServerUtils-$artifactId"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -195,11 +192,11 @@ publishing {
|
||||||
}
|
}
|
||||||
|
|
||||||
publications {
|
publications {
|
||||||
create<MavenPublication>("bukman") {
|
create<MavenPublication>("ServerUtils") {
|
||||||
artifact(tasks["shadowJar"]) {
|
artifact(tasks["shadowJar"]) {
|
||||||
classifier = ""
|
classifier = ""
|
||||||
}
|
}
|
||||||
artifactId = "bukman"
|
artifactId = "ServerUtils"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
object VersionConstants {
|
object VersionConstants {
|
||||||
const val cloudVersion = "1.8.5-SNAPSHOT"
|
const val cloudVersion = "1.8.0"
|
||||||
const val adventureVersion = "4.11.0"
|
const val adventureVersion = "4.11.0"
|
||||||
const val adventurePlatformVersion = "4.1.2"
|
const val adventurePlatformVersion = "4.1.2"
|
||||||
const val adventureMinimessageVersion = "4.2.0-SNAPSHOT"
|
const val adventureMinimessageVersion = "4.2.0-SNAPSHOT"
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
rootProject.name = "bukman"
|
rootProject.name = "ServerUtils"
|
||||||
include("Common")
|
include("Common")
|
||||||
include("Bukkit")
|
include("Bukkit")
|
||||||
include("Bungee")
|
include("Bungee")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue