Slow down on generic usage
This commit is contained in:
parent
6545d7ffac
commit
779f4785e0
9 changed files with 14 additions and 80 deletions
|
|
@ -6,18 +6,10 @@ import cloud.commandframework.context.CommandContext;
|
||||||
import net.frankheijden.serverutils.bukkit.entities.BukkitCommandSender;
|
import net.frankheijden.serverutils.bukkit.entities.BukkitCommandSender;
|
||||||
import net.frankheijden.serverutils.bukkit.entities.BukkitPlugin;
|
import net.frankheijden.serverutils.bukkit.entities.BukkitPlugin;
|
||||||
import net.frankheijden.serverutils.common.commands.CommandPlugins;
|
import net.frankheijden.serverutils.common.commands.CommandPlugins;
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.plugin.PluginDescriptionFile;
|
import org.bukkit.plugin.PluginDescriptionFile;
|
||||||
import org.bukkit.scheduler.BukkitTask;
|
|
||||||
|
|
||||||
public class BukkitCommandPlugins extends CommandPlugins<
|
public class BukkitCommandPlugins extends CommandPlugins<BukkitPlugin, Plugin, BukkitCommandSender> {
|
||||||
BukkitPlugin,
|
|
||||||
Plugin,
|
|
||||||
BukkitTask,
|
|
||||||
BukkitCommandSender,
|
|
||||||
CommandSender
|
|
||||||
> {
|
|
||||||
|
|
||||||
public BukkitCommandPlugins(BukkitPlugin plugin) {
|
public BukkitCommandPlugins(BukkitPlugin plugin) {
|
||||||
super(plugin);
|
super(plugin);
|
||||||
|
|
|
||||||
|
|
@ -24,19 +24,11 @@ import net.frankheijden.serverutils.common.utils.ForwardFilter;
|
||||||
import net.frankheijden.serverutils.common.utils.ListBuilder;
|
import net.frankheijden.serverutils.common.utils.ListBuilder;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.command.PluginIdentifiableCommand;
|
import org.bukkit.command.PluginIdentifiableCommand;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.plugin.PluginDescriptionFile;
|
import org.bukkit.plugin.PluginDescriptionFile;
|
||||||
import org.bukkit.scheduler.BukkitTask;
|
|
||||||
|
|
||||||
public class BukkitCommandServerUtils extends CommandServerUtils<
|
public class BukkitCommandServerUtils extends CommandServerUtils<BukkitPlugin, Plugin, BukkitCommandSender> {
|
||||||
BukkitPlugin,
|
|
||||||
Plugin,
|
|
||||||
BukkitTask,
|
|
||||||
BukkitCommandSender,
|
|
||||||
CommandSender
|
|
||||||
> {
|
|
||||||
|
|
||||||
private static final Map<String, ReloadHandler> supportedConfigs;
|
private static final Map<String, ReloadHandler> supportedConfigs;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,18 +6,10 @@ import cloud.commandframework.context.CommandContext;
|
||||||
import net.frankheijden.serverutils.bungee.entities.BungeeCommandSender;
|
import net.frankheijden.serverutils.bungee.entities.BungeeCommandSender;
|
||||||
import net.frankheijden.serverutils.bungee.entities.BungeePlugin;
|
import net.frankheijden.serverutils.bungee.entities.BungeePlugin;
|
||||||
import net.frankheijden.serverutils.common.commands.CommandPlugins;
|
import net.frankheijden.serverutils.common.commands.CommandPlugins;
|
||||||
import net.md_5.bungee.api.CommandSender;
|
|
||||||
import net.md_5.bungee.api.plugin.Plugin;
|
import net.md_5.bungee.api.plugin.Plugin;
|
||||||
import net.md_5.bungee.api.plugin.PluginDescription;
|
import net.md_5.bungee.api.plugin.PluginDescription;
|
||||||
import net.md_5.bungee.api.scheduler.ScheduledTask;
|
|
||||||
|
|
||||||
public class BungeeCommandPlugins extends CommandPlugins<
|
public class BungeeCommandPlugins extends CommandPlugins<BungeePlugin, Plugin, BungeeCommandSender> {
|
||||||
BungeePlugin,
|
|
||||||
Plugin,
|
|
||||||
ScheduledTask,
|
|
||||||
BungeeCommandSender,
|
|
||||||
CommandSender
|
|
||||||
> {
|
|
||||||
|
|
||||||
public BungeeCommandPlugins(BungeePlugin plugin) {
|
public BungeeCommandPlugins(BungeePlugin plugin) {
|
||||||
super(plugin);
|
super(plugin);
|
||||||
|
|
|
||||||
|
|
@ -11,20 +11,12 @@ import net.frankheijden.serverutils.bungee.reflection.RPluginManager;
|
||||||
import net.frankheijden.serverutils.common.commands.CommandServerUtils;
|
import net.frankheijden.serverutils.common.commands.CommandServerUtils;
|
||||||
import net.frankheijden.serverutils.common.utils.FormatBuilder;
|
import net.frankheijden.serverutils.common.utils.FormatBuilder;
|
||||||
import net.frankheijden.serverutils.common.utils.ListBuilder;
|
import net.frankheijden.serverutils.common.utils.ListBuilder;
|
||||||
import net.md_5.bungee.api.CommandSender;
|
|
||||||
import net.md_5.bungee.api.plugin.Command;
|
import net.md_5.bungee.api.plugin.Command;
|
||||||
import net.md_5.bungee.api.plugin.Plugin;
|
import net.md_5.bungee.api.plugin.Plugin;
|
||||||
import net.md_5.bungee.api.plugin.PluginDescription;
|
import net.md_5.bungee.api.plugin.PluginDescription;
|
||||||
import net.md_5.bungee.api.plugin.PluginManager;
|
import net.md_5.bungee.api.plugin.PluginManager;
|
||||||
import net.md_5.bungee.api.scheduler.ScheduledTask;
|
|
||||||
|
|
||||||
public class BungeeCommandServerUtils extends CommandServerUtils<
|
public class BungeeCommandServerUtils extends CommandServerUtils<BungeePlugin, Plugin, BungeeCommandSender> {
|
||||||
BungeePlugin,
|
|
||||||
Plugin,
|
|
||||||
ScheduledTask,
|
|
||||||
BungeeCommandSender,
|
|
||||||
CommandSender
|
|
||||||
> {
|
|
||||||
|
|
||||||
public BungeeCommandServerUtils(BungeePlugin plugin) {
|
public BungeeCommandServerUtils(BungeePlugin plugin) {
|
||||||
super(plugin);
|
super(plugin);
|
||||||
|
|
|
||||||
|
|
@ -7,13 +7,8 @@ import net.frankheijden.serverutils.common.entities.ServerUtilsPlugin;
|
||||||
import net.frankheijden.serverutils.common.utils.ListBuilder;
|
import net.frankheijden.serverutils.common.utils.ListBuilder;
|
||||||
import net.frankheijden.serverutils.common.utils.ListFormat;
|
import net.frankheijden.serverutils.common.utils.ListFormat;
|
||||||
|
|
||||||
public abstract class CommandPlugins<
|
public abstract class CommandPlugins<U extends ServerUtilsPlugin<P, ?, C, ?>, P, C extends ServerCommandSender<?>>
|
||||||
U extends ServerUtilsPlugin<P, T, C, S>,
|
extends ServerUtilsCommand<U, C> {
|
||||||
P,
|
|
||||||
T,
|
|
||||||
C extends ServerCommandSender<S>,
|
|
||||||
S
|
|
||||||
> extends ServerUtilsCommand<U, P, T, C, S> {
|
|
||||||
|
|
||||||
protected CommandPlugins(U plugin) {
|
protected CommandPlugins(U plugin) {
|
||||||
super(plugin, "plugins");
|
super(plugin, "plugins");
|
||||||
|
|
|
||||||
|
|
@ -19,17 +19,10 @@ import net.frankheijden.serverutils.common.utils.FormatBuilder;
|
||||||
import net.frankheijden.serverutils.common.utils.ListBuilder;
|
import net.frankheijden.serverutils.common.utils.ListBuilder;
|
||||||
import net.frankheijden.serverutils.common.utils.ListFormat;
|
import net.frankheijden.serverutils.common.utils.ListFormat;
|
||||||
|
|
||||||
public abstract class CommandServerUtils<
|
public abstract class CommandServerUtils<U extends ServerUtilsPlugin<P, ?, C, ?>, P, C extends ServerCommandSender<?>>
|
||||||
U extends ServerUtilsPlugin<P, T, C, S>,
|
extends ServerUtilsCommand<U, C> {
|
||||||
P,
|
|
||||||
T,
|
|
||||||
C extends ServerCommandSender<S>,
|
|
||||||
S
|
|
||||||
> extends ServerUtilsCommand<U, P, T, C, S> {
|
|
||||||
|
|
||||||
protected CommandServerUtils(
|
protected CommandServerUtils(U plugin) {
|
||||||
U plugin
|
|
||||||
) {
|
|
||||||
super(plugin, "serverutils");
|
super(plugin, "serverutils");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,22 +12,14 @@ import net.frankheijden.serverutils.common.config.ServerUtilsConfig;
|
||||||
import net.frankheijden.serverutils.common.entities.ServerCommandSender;
|
import net.frankheijden.serverutils.common.entities.ServerCommandSender;
|
||||||
import net.frankheijden.serverutils.common.entities.ServerUtilsPlugin;
|
import net.frankheijden.serverutils.common.entities.ServerUtilsPlugin;
|
||||||
|
|
||||||
public abstract class ServerUtilsCommand<U extends ServerUtilsPlugin<P, T, C, S>,
|
public abstract class ServerUtilsCommand<U extends ServerUtilsPlugin<?, ?, C, ?>, C extends ServerCommandSender<?>> {
|
||||||
P,
|
|
||||||
T,
|
|
||||||
C extends ServerCommandSender<S>,
|
|
||||||
S
|
|
||||||
> {
|
|
||||||
|
|
||||||
protected final U plugin;
|
protected final U plugin;
|
||||||
protected final String commandName;
|
protected final String commandName;
|
||||||
protected final ServerUtilsConfig commandConfig;
|
protected final ServerUtilsConfig commandConfig;
|
||||||
protected final Map<String, CommandArgument<C, ?>> arguments;
|
protected final Map<String, CommandArgument<C, ?>> arguments;
|
||||||
|
|
||||||
protected ServerUtilsCommand(
|
protected ServerUtilsCommand(U plugin, String commandName) {
|
||||||
U plugin,
|
|
||||||
String commandName
|
|
||||||
) {
|
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.commandName = commandName;
|
this.commandName = commandName;
|
||||||
this.commandConfig = (ServerUtilsConfig) plugin.getCommandsResource().getConfig().get(commandName);
|
this.commandConfig = (ServerUtilsConfig) plugin.getCommandsResource().getConfig().get(commandName);
|
||||||
|
|
|
||||||
|
|
@ -3,21 +3,13 @@ package net.frankheijden.serverutils.velocity.commands;
|
||||||
import cloud.commandframework.Command;
|
import cloud.commandframework.Command;
|
||||||
import cloud.commandframework.CommandManager;
|
import cloud.commandframework.CommandManager;
|
||||||
import cloud.commandframework.context.CommandContext;
|
import cloud.commandframework.context.CommandContext;
|
||||||
import com.velocitypowered.api.command.CommandSource;
|
|
||||||
import com.velocitypowered.api.plugin.PluginContainer;
|
import com.velocitypowered.api.plugin.PluginContainer;
|
||||||
import com.velocitypowered.api.plugin.PluginDescription;
|
import com.velocitypowered.api.plugin.PluginDescription;
|
||||||
import com.velocitypowered.api.scheduler.ScheduledTask;
|
|
||||||
import net.frankheijden.serverutils.common.commands.CommandPlugins;
|
import net.frankheijden.serverutils.common.commands.CommandPlugins;
|
||||||
import net.frankheijden.serverutils.velocity.entities.VelocityCommandSender;
|
import net.frankheijden.serverutils.velocity.entities.VelocityCommandSender;
|
||||||
import net.frankheijden.serverutils.velocity.entities.VelocityPlugin;
|
import net.frankheijden.serverutils.velocity.entities.VelocityPlugin;
|
||||||
|
|
||||||
public class VelocityCommandPlugins extends CommandPlugins<
|
public class VelocityCommandPlugins extends CommandPlugins<VelocityPlugin, PluginContainer, VelocityCommandSender> {
|
||||||
VelocityPlugin,
|
|
||||||
PluginContainer,
|
|
||||||
ScheduledTask,
|
|
||||||
VelocityCommandSender,
|
|
||||||
CommandSource
|
|
||||||
> {
|
|
||||||
|
|
||||||
public VelocityCommandPlugins(VelocityPlugin plugin) {
|
public VelocityCommandPlugins(VelocityPlugin plugin) {
|
||||||
super(plugin);
|
super(plugin);
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ import com.velocitypowered.api.command.CommandSource;
|
||||||
import com.velocitypowered.api.plugin.PluginContainer;
|
import com.velocitypowered.api.plugin.PluginContainer;
|
||||||
import com.velocitypowered.api.plugin.PluginDescription;
|
import com.velocitypowered.api.plugin.PluginDescription;
|
||||||
import com.velocitypowered.api.plugin.meta.PluginDependency;
|
import com.velocitypowered.api.plugin.meta.PluginDependency;
|
||||||
import com.velocitypowered.api.scheduler.ScheduledTask;
|
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
@ -18,13 +17,8 @@ import net.frankheijden.serverutils.velocity.entities.VelocityCommandSender;
|
||||||
import net.frankheijden.serverutils.velocity.entities.VelocityPlugin;
|
import net.frankheijden.serverutils.velocity.entities.VelocityPlugin;
|
||||||
import net.frankheijden.serverutils.velocity.reflection.RVelocityCommandManager;
|
import net.frankheijden.serverutils.velocity.reflection.RVelocityCommandManager;
|
||||||
|
|
||||||
public class VelocityCommandServerUtils extends CommandServerUtils<
|
public class VelocityCommandServerUtils
|
||||||
VelocityPlugin,
|
extends CommandServerUtils<VelocityPlugin, PluginContainer, VelocityCommandSender> {
|
||||||
PluginContainer,
|
|
||||||
ScheduledTask,
|
|
||||||
VelocityCommandSender,
|
|
||||||
CommandSource
|
|
||||||
> {
|
|
||||||
|
|
||||||
public VelocityCommandServerUtils(VelocityPlugin plugin) {
|
public VelocityCommandServerUtils(VelocityPlugin plugin) {
|
||||||
super(plugin);
|
super(plugin);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue