Compare commits

..

No commits in common. "864839a96b3d42de631e42dec1cf4ae6af42a32f" and "2727b7cced2ddf8e5bba6956baed0f8702c8db7e" have entirely different histories.

21 changed files with 105 additions and 254 deletions

View file

@ -25,7 +25,7 @@ jobs:
- name: Upload artififacts
uses: actions/upload-artifact@v2.2.1
with:
name: Bukman
name: ServerUtils
path: jars/*.jar
- name: Publish
if: ${{ github.event_name == 'push' }}

View file

@ -9,11 +9,11 @@ val rootDependencyDir = "${rootProject.group}.dependencies"
val dependencyDir = "${group}.bukkit.dependencies"
version = rootProject.version
base {
archivesName.set("${rootProject.name}-bukkit")
archivesName.set("${rootProject.name}-Bukkit")
}
dependencies {
implementation("org.zhdev.oblak:cloud-paper:${VersionConstants.cloudVersion}")
implementation("cloud.commandframework:cloud-paper:${VersionConstants.cloudVersion}")
implementation("net.kyori:adventure-api:${VersionConstants.adventureVersion}") {
exclude("net.kyori", "adventure-text-minimessage")
}
@ -36,11 +36,11 @@ tasks.withType<ShadowJar> {
}
bukkit {
name = "Bukman"
name = "ServerUtils"
main = "net.frankheijden.serverutils.bukkit.ServerUtils"
description = "A server utility"
apiVersion = "1.13"
website = "https://git.zhira.net/zhdev/bukman"
website = "https://github.com/FrankHeijden/ServerUtils"
softDepend = listOf("ServerUtilsUpdater")
authors = listOf("FrankHeijden", "ZhDev")
authors = listOf("FrankHeijden")
}

View file

@ -2,9 +2,6 @@ package net.frankheijden.serverutils.bukkit.managers;
import java.io.Closeable;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@ -15,8 +12,8 @@ import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import net.frankheijden.serverutils.bukkit.entities.BukkitPluginDescription;
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.InvalidPluginException;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.PluginLoader;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.UnknownDependencyException;
import org.yaml.snakeyaml.error.YAMLException;
public class BukkitPluginManager extends AbstractPluginManager<Plugin, BukkitPluginDescription> {
@ -353,43 +348,45 @@ public class BukkitPluginManager extends AbstractPluginManager<Plugin, BukkitPlu
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
public Optional<BukkitPluginDescription> getPluginDescription(File file) throws InvalidPluginDescriptionException {
if (!file.exists()) return Optional.empty();
Optional<PluginLoader> loader = getPluginLoader(file);
if (!loader.isPresent()) throw new InvalidPluginDescriptionException("Plugin loader is not present!");
try {
JarFile jar = null;
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
}
}
}
return Optional.of(new BukkitPluginDescription(loader.get().getPluginDescription(file), file));
} catch (InvalidDescriptionException ex) {
throw new InvalidPluginDescriptionException(ex);
}

View file

@ -3,7 +3,6 @@ package net.frankheijden.serverutils.bukkit.reflection;
import dev.frankheijden.minecraftreflection.MinecraftReflection;
import dev.frankheijden.minecraftreflection.MinecraftReflectionVersion;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
@ -52,7 +51,7 @@ public class RCraftServer {
public static void syncCommands(Set<String> removedCommands) {
if (MinecraftReflectionVersion.MINOR < 13) return;
Collection children = new ArrayList<>(RCommandDispatcher.getDispatcher().getRoot().getChildren());
Collection children = RCommandDispatcher.getDispatcher().getRoot().getChildren();
reflection.invoke(Bukkit.getServer(), "syncCommands");
Object root = RCommandDispatcher.getDispatcher().getRoot();

View file

@ -4,46 +4,25 @@ import dev.frankheijden.minecraftreflection.MinecraftReflection;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import dev.frankheijden.minecraftreflection.exceptions.MinecraftReflectionException;
import net.frankheijden.serverutils.bukkit.ServerUtils;
import org.bukkit.Bukkit;
import java.util.regex.Pattern;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginLoader;
import org.bukkit.plugin.SimplePluginManager;
public class RSimplePluginManager {
private static final MinecraftReflection reflection = MinecraftReflection.of(Bukkit.getPluginManager().getClass());
private static final MinecraftReflection paperPluginManagerReflection;
private static final MinecraftReflection paperInstanceManagerReflection;
static {
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;
}
private static final MinecraftReflection reflection = MinecraftReflection.of(SimplePluginManager.class);
public static MinecraftReflection getReflection() {
return reflection;
}
/**
* Gets a list of plugins.
* @param manager The SimplePluginManager instance to get plugins from.
* @return list of plugins.
*/
public static List<Plugin> getPlugins(Object manager) {
if (paperPluginManagerReflection == null) {
return reflection.get(manager, "plugins");
public static Map<Pattern, PluginLoader> getFileAssociations(Object manager) throws IllegalAccessException {
return reflection.get(manager, "fileAssociations");
}
return paperInstanceManagerReflection.get(getInstanceManager(manager), "plugins");
public static List<Plugin> getPlugins(Object manager) {
return reflection.get(manager, "plugins");
}
/**
@ -53,23 +32,9 @@ public class RSimplePluginManager {
* @param name The name of the plugin to remove.
*/
public static void removeLookupName(Object manager, String name) {
Map<String, Plugin> lookupNames;
if (paperPluginManagerReflection == null) {
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;
}
Map<String, Plugin> lookupNames = reflection.get(manager, "lookupNames");
if (lookupNames == null) return;
lookupNames.remove(name.replace(' ', '_'));
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");
}
}

View file

@ -9,7 +9,7 @@ val rootDependencyDir = "${group}.dependencies"
val dependencyDir = "${group}.bungee.dependencies"
version = rootProject.version
base {
archivesName.set("${rootProject.name}-bungee")
archivesName.set("${rootProject.name}-Bungee")
}
repositories {
@ -17,7 +17,7 @@ repositories {
}
dependencies {
implementation("org.zhdev.oblak:cloud-bungee:${VersionConstants.cloudVersion}")
implementation("cloud.commandframework:cloud-bungee:${VersionConstants.cloudVersion}")
implementation("net.kyori:adventure-api:${VersionConstants.adventureVersion}") {
exclude("net.kyori", "adventure-text-minimessage")
}
@ -38,7 +38,7 @@ tasks.withType<ShadowJar> {
}
bungee {
name = "Bukman"
name = "ServerUtils"
main = "net.frankheijden.serverutils.bungee.ServerUtils"
description = "A server utility"
softDepends = setOf("ServerUtilsUpdater")

View file

@ -7,7 +7,7 @@ plugins {
group = rootProject.group
version = "${rootProject.version}"
base {
archivesName.set("${rootProject.name}-common")
archivesName.set("${rootProject.name}-Common")
}
repositories {

View file

@ -10,7 +10,6 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Optional;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.IntFunction;
@ -208,13 +207,8 @@ public abstract class CommandServerUtils<U extends ServerUtilsPlugin<P, ?, C, ?,
return;
}
boolean recursive = context.flags().contains("recursive");
List<P> dependingPlugins = getDependingPlugins(context, sender, plugins, "unloadplugin");
if (!recursive) {
if (!dependingPlugins.isEmpty()) return;
} else {
plugins.addAll(0, dependingPlugins);
if (checkDependingPlugins(context, sender, plugins, "unloadplugin")) {
return;
}
PluginResults<P> disableResults = plugin.getPluginManager().disablePlugins(plugins);
@ -238,10 +232,7 @@ public abstract class CommandServerUtils<U extends ServerUtilsPlugin<P, ?, C, ?,
return;
}
boolean recursive = context.flags().contains("recursive");
List<P> dependingPlugins = getDependingPlugins(context, sender, plugins, "reloadplugin");
if (!recursive && !dependingPlugins.isEmpty()) {
if (checkDependingPlugins(context, sender, plugins, "reloadplugin")) {
return;
}
@ -249,70 +240,22 @@ public abstract class CommandServerUtils<U extends ServerUtilsPlugin<P, ?, C, ?,
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);
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) {
return !getDependingPlugins(context, sender, plugins, subcommand).isEmpty();
}
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");
if (context.flags().contains("force")) return false;
AbstractPluginManager<P, ?> pluginManager = plugin.getPluginManager();
MessagesResource messages = plugin.getMessagesResource();
List<P> dependingPluginsAll = new ArrayList<>();
boolean hasDependingPlugins = false;
for (P plugin : plugins) {
String pluginId = pluginManager.getPluginId(plugin);
List<P> dependingPlugins = pluginManager.getPluginsDependingOn(pluginId);
if (!dependingPlugins.isEmpty()) {
if (!recursive) {
TextComponent.Builder builder = Component.text();
builder.append(messages.get(MessageKey.DEPENDING_PLUGINS_PREFIX).toComponent(
Template.of("plugin", pluginId)
@ -325,32 +268,22 @@ public abstract class CommandServerUtils<U extends ServerUtilsPlugin<P, ?, C, ?,
.lastSeparator(messages.get(MessageKey.DEPENDING_PLUGINS_LAST_SEPARATOR).toComponent())
.build());
sender.sendMessage(builder.build());
}
hasDependingPlugins = true;
dependingPluginsAll.addAll(dependingPlugins);
}
}
if (!recursive && hasDependingPlugins) {
String forceFlagPath = getRawPath(subcommand) + ".flags.force";
String forceFlag = plugin.getCommandsResource().getAllFlagAliases(forceFlagPath).stream()
if (hasDependingPlugins) {
String flagPath = getRawPath(subcommand) + ".flags.force";
String forceFlag = plugin.getCommandsResource().getAllFlagAliases(flagPath).stream()
.min(Comparator.comparingInt(String::length))
.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(
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) {

View file

@ -7,7 +7,6 @@ import cloud.commandframework.context.CommandContext;
import cloud.commandframework.exceptions.parsing.NoInputProvidedException;
import io.leangen.geantyref.TypeToken;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Optional;
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));
}
Set<String> flags = new HashSet<>();
flags.addAll(plugin.getCommandsResource().getAllFlagAliases(commandConfigPath + ".flags.force"));
flags.addAll(plugin.getCommandsResource().getAllFlagAliases(commandConfigPath + ".flags.recursive"));
Set<String> flags = plugin.getCommandsResource().getAllFlagAliases(commandConfigPath + ".flags.force");
int queueSize = inputQueue.size();
List<P> plugins = new ArrayList<>(queueSize);

View file

@ -6,9 +6,7 @@ public enum MessageKey implements PlaceholderConfigKey {
RELOAD("reload", false),
LOADPLUGIN("loadplugin"),
LOADPLUGIN_RECURSIVELY("loadplugin-recursively"),
UNLOADPLUGIN("unloadplugin"),
UNLOADPLUGIN_RECURSIVELY("unloadplugin-recursively"),
SERVERUTILS_UPDATER("serverutils-updater", false),
RELOADPLUGIN_SUCCESS("reloadplugin.success"),
RELOADPLUGIN_SERVERUTILS("reloadplugin.serverutils"),
@ -29,7 +27,6 @@ public enum MessageKey implements PlaceholderConfigKey {
DEPENDING_PLUGINS_SEPARATOR("depending-plugins.separator", false),
DEPENDING_PLUGINS_LAST_SEPARATOR("depending-plugins.last-separator", false),
DEPENDING_PLUGINS_OVERRIDE("depending-plugins.override"),
DEPENDING_PLUGINS_RECURSIVELY("depending-plugins.recursively"),
WATCHPLUGIN_START("watchplugin.start"),
WATCHPLUGIN_CHANGE("watchplugin.change", false),
WATCHPLUGIN_STOPPED("watchplugin.stopped"),

View file

@ -37,7 +37,6 @@ public interface PluginProvider<P, D extends ServerUtilsPluginDescription> {
try {
pluginDescriptionOptional = getPluginDescription(file);
} catch (InvalidPluginDescriptionException ex) {
ex.printStackTrace();
continue;
}
@ -58,7 +57,6 @@ public interface PluginProvider<P, D extends ServerUtilsPluginDescription> {
ServerUtilsPluginDescription description = getLoadedPluginDescription(loadedPlugin);
if (description.getDependencies().contains(pluginId)) {
plugins.add(loadedPlugin);
plugins.addAll(getPluginsDependingOn(description.getId()));
}
}

View file

@ -34,7 +34,7 @@ public class UpdateCheckerTask<U extends ServerUtilsPlugin<P, ?, ?, ?, ?>, P> im
private final boolean download;
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"
+ "/releases/latest";
@ -163,7 +163,7 @@ public class UpdateCheckerTask<U extends ServerUtilsPlugin<P, ?, ?, ?, ?>, P> im
if (sender.isPlayer()) {
broadcastDownloadStatus(githubVersion, false);
} else {
plugin.getLogger().log(Level.INFO, DOWNLOADED, new Object[]{ "Bukman", githubVersion });
plugin.getLogger().log(Level.INFO, DOWNLOADED, new Object[]{ "ServerUtils", githubVersion });
}
return;
}

View file

@ -73,13 +73,6 @@
"permission": "serverutils.unloadplugin",
"description": "Force disable and unload the specified plugin(s).",
"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",
"description": "Force reloads the specified plugin(s).",
"display-in-help": false
},
"recursive": {
"main": "recursive",
"aliases": ["r"],
"permission": "serverutils.reloadplugin",
"description": "Recursively reloads the specified plugin(s).",
"display-in-help": false
}
}
},

View file

@ -18,9 +18,7 @@
"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...",
"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-recursively": "<dark_aqua>Successfully recursively unloaded <aqua><plugin></aqua>!",
"reloadplugin": {
"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>."
@ -30,8 +28,7 @@
"format": "<dark_red><plugin>",
"separator": "<red>, ",
"last-separator": " <red>and ",
"override": "<red>Use \"<dark_red>/<command></dark_red>\" to force command execution.",
"recursively": "<red>Use \"<dark_red>/<command></dark_red>\" to recursively command execution."
"override": "<red>Use \"<dark_red>/<command></dark_red>\" to force command execution."
},
"watchplugin": {
"start": "<dark_aqua>Started watching <aqua><plugin></aqua>!",

View file

@ -8,7 +8,7 @@ group = "${rootProject.group}"
val dependencyDir = "${group}.velocity.dependencies"
version = rootProject.version
base {
archivesName.set("${rootProject.name}-velocity")
archivesName.set("${rootProject.name}-Velocity")
}
repositories {
@ -17,7 +17,7 @@ repositories {
}
dependencies {
implementation("org.zhdev.oblak:cloud-velocity:${VersionConstants.cloudVersion}")
implementation("cloud.commandframework:cloud-velocity:${VersionConstants.cloudVersion}")
implementation("org.bstats:bstats-velocity:${VersionConstants.bstatsVersion}")
implementation(project(":Common"))
implementation("net.kyori:adventure-text-minimessage:${VersionConstants.adventureMinimessageVersion}") {

View file

@ -19,12 +19,12 @@ import org.bstats.velocity.Metrics;
import org.slf4j.Logger;
@Plugin(
id = "bukman",
name = "Bukman",
id = "serverutils",
name = "ServerUtils",
version = "{version}",
description = "A server utility",
url = "https://git.zhira.net/zhdev/bukman",
authors = {"FrankHeijden", "ZhDev"}
url = "https://github.com/FrankHeijden/ServerUtils",
authors = "FrankHeijden"
)
public class ServerUtils {
@ -47,7 +47,7 @@ public class ServerUtils {
private Metrics.Factory metricsFactory;
@Inject
@Named("bukman")
@Named("serverutils")
private PluginContainer pluginContainer;
private final VelocityPluginCommandManager pluginCommandManager;

View file

@ -24,16 +24,9 @@ public class VelocityPluginDescription implements ServerUtilsPluginDescription {
this.description = description;
Optional<Path> sourceOptional = description.getSource();
if (!sourceOptional.isPresent()) {
if (description.getId().equals("velocity")) {
this.file = null;
} else {
throw new InvalidPluginDescriptionException("Source path is null");
}
} else {
this.file = sourceOptional.get().toFile();
}
if (!sourceOptional.isPresent()) throw new InvalidPluginDescriptionException("Source path is null");
this.file = sourceOptional.get().toFile();
this.author = String.join(", ", description.getAuthors());
this.dependencies = description.getDependencies().stream()
.map(PluginDependency::getId)

View file

@ -9,6 +9,7 @@ import dev.frankheijden.minecraftreflection.MinecraftReflection;
import java.lang.reflect.Array;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutorService;
import java.util.stream.Collectors;
public class RVelocityEventManager {
@ -64,7 +65,7 @@ public class RVelocityEventManager {
Object registrationsEmptyArray = Array.newInstance(RHandlerRegistration.reflection.getClazz(), 0);
Class<?> registrationsArrayClass = registrationsEmptyArray.getClass();
/*ExecutorService executor = reflection.invoke(manager, "getAsyncExecutor");
ExecutorService executor = reflection.invoke(manager, "getAsyncExecutor");
executor.execute(() -> reflection.invoke(
manager,
"fire",
@ -73,16 +74,7 @@ public class RVelocityEventManager {
ClassObject.of(int.class, 0),
ClassObject.of(boolean.class, true),
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;
}

View file

@ -8,7 +8,7 @@ plugins {
group = "net.frankheijden.serverutils"
val dependencyDir = "${group}.dependencies"
version = "3.5.6-SNAPSHOT"
version = "3.5.5-SNAPSHOT"
java {
sourceCompatibility = JavaVersion.VERSION_1_8
@ -27,19 +27,17 @@ subprojects {
}
repositories {
mavenLocal()
mavenCentral()
maven("https://jitpack.io")
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://maven.zhira.net/repository/zhdev/")
}
dependencies {
implementation("org.zhdev.oblak:cloud-core:${VersionConstants.cloudVersion}")
implementation("org.zhdev.oblak:cloud-brigadier:${VersionConstants.cloudVersion}")
implementation("org.zhdev:megareflection:1.0.2-SNAPSHOT")
implementation("cloud.commandframework:cloud-core:${VersionConstants.cloudVersion}")
implementation("cloud.commandframework:cloud-brigadier:${VersionConstants.cloudVersion}")
implementation("com.github.FrankHeijden:MinecraftReflection:1.0.0")
implementation("com.google.code.gson:gson:2.8.6")
implementation("me.lucko:commodore:2.2")
compileOnly("com.mojang:brigadier:1.0.18")
@ -95,7 +93,6 @@ subprojects {
}
relocate("net.kyori.adventure.text.minimessage", "${dependencyDir}.adventure.text.minimessage")
relocate("dev.frankheijden.minecraftreflection", "${dependencyDir}.minecraftreflection")
relocate("org.zhdev", "${dependencyDir}.zhdev")
}
publishing {
@ -116,11 +113,11 @@ subprojects {
}
publications {
create<MavenPublication>("bukman") {
create<MavenPublication>("ServerUtils") {
artifact(tasks["shadowJar"]) {
classifier = ""
}
artifactId = "bukman-$artifactId"
artifactId = "ServerUtils-$artifactId"
}
}
}
@ -195,11 +192,11 @@ publishing {
}
publications {
create<MavenPublication>("bukman") {
create<MavenPublication>("ServerUtils") {
artifact(tasks["shadowJar"]) {
classifier = ""
}
artifactId = "bukman"
artifactId = "ServerUtils"
}
}
}

View file

@ -1,5 +1,5 @@
object VersionConstants {
const val cloudVersion = "1.8.5-SNAPSHOT"
const val cloudVersion = "1.8.0"
const val adventureVersion = "4.11.0"
const val adventurePlatformVersion = "4.1.2"
const val adventureMinimessageVersion = "4.2.0-SNAPSHOT"

View file

@ -1,4 +1,4 @@
rootProject.name = "bukman"
rootProject.name = "ServerUtils"
include("Common")
include("Bukkit")
include("Bungee")