diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/FrontDoor.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/FrontDoor.java index f967d164..4922d682 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/FrontDoor.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/FrontDoor.java @@ -17,7 +17,7 @@ import java.util.Random; import java.util.function.Consumer; import me.totalfreedom.totalfreedommod.admin.Admin; import me.totalfreedom.totalfreedommod.banning.Ban; -import me.totalfreedom.totalfreedommod.command.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.fun.Jumppads; import me.totalfreedom.totalfreedommod.player.FPlayer; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java index 97c65713..041a426b 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java @@ -10,7 +10,7 @@ import me.totalfreedom.totalfreedommod.blocking.*; import me.totalfreedom.totalfreedommod.blocking.command.CommandBlocker; import me.totalfreedom.totalfreedommod.bridge.*; import me.totalfreedom.totalfreedommod.caging.Cager; -import me.totalfreedom.totalfreedommod.command.CommandLoader; +import me.totalfreedom.totalfreedommod.command.handling.CommandLoader; import me.totalfreedom.totalfreedommod.config.MainConfig; import me.totalfreedom.totalfreedommod.freeze.Freezer; import me.totalfreedom.totalfreedommod.fun.*; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/blocking/command/CommandBlocker.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/blocking/command/CommandBlocker.java index 46b2e4d6..adc6bf52 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/blocking/command/CommandBlocker.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/blocking/command/CommandBlocker.java @@ -30,24 +30,6 @@ public class CommandBlocker extends FreedomService private final Map entryList = Maps.newHashMap(); private final List unknownCommands = Lists.newArrayList(); - public static CommandMap getCommandMap() - { - try - { - SimplePluginManager simplePluginManager = (SimplePluginManager)Bukkit.getServer().getPluginManager(); - - Field commandMapField = SimplePluginManager.class.getDeclaredField("commandMap"); - commandMapField.setAccessible(true); - - return (SimpleCommandMap)commandMapField.get(simplePluginManager); - } - catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException e) - { - FLog.severe("Failed to get command map field (" + e.getMessage() + ")"); - } - return null; - } - @Override public void onStart() { @@ -65,7 +47,7 @@ public class CommandBlocker extends FreedomService entryList.clear(); unknownCommands.clear(); - final CommandMap commandMap = getCommandMap(); + final CommandMap commandMap = Bukkit.getCommandMap(); @SuppressWarnings("unchecked") List blockedCommands = (List)ConfigEntry.BLOCKED_COMMANDS.getList(); diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/CommandLoader.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/CommandLoader.java deleted file mode 100644 index d7cb4b94..00000000 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/CommandLoader.java +++ /dev/null @@ -1,100 +0,0 @@ -package me.totalfreedom.totalfreedommod.command; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Set; -import me.totalfreedom.totalfreedommod.FreedomService; -import me.totalfreedom.totalfreedommod.util.FLog; -import org.reflections.Reflections; - -public class CommandLoader extends FreedomService -{ - private final List commands; - - public CommandLoader() - { - commands = new ArrayList<>(); - } - - @Override - public void onStart() - { - } - - @Override - public void onStop() - { - } - - public void add(FreedomCommand command) - { - commands.add(command); - command.register(); - } - - public FreedomCommand getByName(String name) - { - for (FreedomCommand command : commands) - { - if (name.equals(command.getName())) - { - return command; - } - } - return null; - } - - public boolean isAlias(String alias) - { - for (FreedomCommand command : commands) - { - if (Arrays.asList(command.getAliases().split(",")).contains(alias)) - { - return true; - } - } - return false; - } - - public void loadCommands() - { - Reflections commandDir = new Reflections("me.totalfreedom.totalfreedommod.command"); - - Set> commandClasses = commandDir.getSubTypesOf(FreedomCommand.class); - - commandLoading: - for (Class commandClass : commandClasses) - { - try - { - if (commandClass.isAnnotationPresent(CommandDependencies.class)) - { - String[] dependencies = commandClass.getAnnotation(CommandDependencies.class).value(); - - for (String plugin : dependencies) - { - if (!server.getPluginManager().isPluginEnabled(plugin)) - { - FLog.warning("Not loading command due to missing dependency (" + plugin + "): /" + commandClass.getSimpleName().replace("Command_", "")); - continue commandLoading; - } - } - } - - add(commandClass.newInstance()); - } - catch (InstantiationException | IllegalAccessException | ExceptionInInitializerError ex) - { - FLog.warning("Failed to register command: /" + commandClass.getSimpleName().replace("Command_", "")); - } - } - - FLog.info("Loaded " + commands.size() + " commands"); - } - - public List getCommands() - { - return commands; - } -} \ No newline at end of file diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_adminchat.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_adminchat.java index cb7f9b31..ef7e5d02 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_adminchat.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_adminchat.java @@ -1,5 +1,10 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.api.event.AdminChatEvent; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.player.FPlayer; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import org.apache.commons.lang.StringUtils; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_admininfo.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_admininfo.java index 25821da4..ef144dc9 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_admininfo.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_admininfo.java @@ -1,6 +1,11 @@ package me.totalfreedom.totalfreedommod.command; import java.util.List; + +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_adminmode.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_adminmode.java index f1ac034c..d3782200 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_adminmode.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_adminmode.java @@ -3,6 +3,11 @@ package me.totalfreedom.totalfreedommod.command; import java.util.Arrays; import java.util.Collections; import java.util.List; + +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.util.FUtil; import net.kyori.adventure.text.Component; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_adminworld.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_adminworld.java index fe4c08bd..de9fb943 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_adminworld.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_adminworld.java @@ -4,6 +4,11 @@ import io.papermc.lib.PaperLib; import java.util.Arrays; import java.util.Collections; import java.util.List; + +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.world.WorldTime; import me.totalfreedom.totalfreedommod.world.WorldWeather; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_announce.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_announce.java index 694c7e11..d6e78ace 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_announce.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_announce.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import org.apache.commons.lang.StringUtils; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_autoclear.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_autoclear.java index 3723b227..cb953023 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_autoclear.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_autoclear.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_autotp.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_autotp.java index 908330ba..293064a2 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_autotp.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_autotp.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_ban.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_ban.java index 5042f1d9..03782cc4 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_ban.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_ban.java @@ -4,6 +4,7 @@ import java.util.Objects; import com.earth2me.essentials.User; import me.totalfreedom.totalfreedommod.banning.Ban; +import me.totalfreedom.totalfreedommod.command.handling.*; import me.totalfreedom.totalfreedommod.player.PlayerData; import me.totalfreedom.totalfreedommod.punishments.Punishment; import me.totalfreedom.totalfreedommod.punishments.PunishmentType; @@ -18,6 +19,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; +@Intercept("ban") @CommandPermissions(permission = "ban", source = SourceType.BOTH, blockHostConsole = true) @CommandParameters(description = "Bans the specified player.", usage = "/ [reason] [-nrb | -q]", aliases = "gtfo") public class Command_ban extends FreedomCommand diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_banip.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_banip.java index c2e61635..240aea46 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_banip.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_banip.java @@ -1,6 +1,7 @@ package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.banning.Ban; +import me.totalfreedom.totalfreedommod.command.handling.*; import me.totalfreedom.totalfreedommod.util.FUtil; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import org.apache.commons.lang.ArrayUtils; @@ -9,6 +10,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; +@Intercept("banip") @CommandPermissions(permission = "banip", source = SourceType.BOTH, blockHostConsole = true) @CommandParameters(description = "Bans the specified ip.", usage = "/ [reason] [-q]") public class Command_banip extends FreedomCommand diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_banlist.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_banlist.java index 7645c03a..6b674bce 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_banlist.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_banlist.java @@ -1,5 +1,6 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.*; import me.totalfreedom.totalfreedommod.util.FUtil; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import org.bukkit.command.Command; @@ -9,6 +10,7 @@ import org.bukkit.entity.Player; import java.util.Collections; import java.util.List; +@Intercept("banlist") @CommandPermissions(permission = "banlist", source = SourceType.BOTH) @CommandParameters(description = "Shows all banned player names. Admins may optionally use 'purge' to clear the list.", usage = "/ [purge]") public class Command_banlist extends FreedomCommand diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_banname.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_banname.java index a37a1df8..1808a483 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_banname.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_banname.java @@ -1,6 +1,10 @@ package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.banning.Ban; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.util.FUtil; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import org.apache.commons.lang.ArrayUtils; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_bird.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_bird.java index 6f49efc6..ecb5a451 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_bird.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_bird.java @@ -3,6 +3,11 @@ package me.totalfreedom.totalfreedommod.command; import java.util.Arrays; import java.util.List; import java.util.SplittableRandom; + +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import org.bukkit.Location; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockcmd.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockcmd.java index ddb4e3a5..b5dab640 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockcmd.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockcmd.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.player.FPlayer; import me.totalfreedom.totalfreedommod.punishments.Punishment; import me.totalfreedom.totalfreedommod.punishments.PunishmentType; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockedit.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockedit.java index 1023f737..73d12d01 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockedit.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockedit.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.player.FPlayer; import me.totalfreedom.totalfreedommod.punishments.Punishment; import me.totalfreedom.totalfreedommod.punishments.PunishmentType; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockpvp.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockpvp.java index 16253f0b..c1969f4c 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockpvp.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockpvp.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.player.FPlayer; import me.totalfreedom.totalfreedommod.punishments.Punishment; import me.totalfreedom.totalfreedommod.punishments.PunishmentType; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockredstone.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockredstone.java index 9372eab8..51d336f4 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockredstone.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockredstone.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.util.FUtil; import org.bukkit.command.Command; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cage.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cage.java index 7e12b63c..5d2360dd 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cage.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cage.java @@ -4,6 +4,11 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; + +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.player.FPlayer; import me.totalfreedom.totalfreedommod.punishments.Punishment; import me.totalfreedom.totalfreedommod.punishments.PunishmentType; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cake.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cake.java index 0bd5e793..64915aab 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cake.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cake.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.util.FUtil; import org.bukkit.Material; import org.bukkit.command.Command; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cleanchat.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cleanchat.java index 1ff6f0bc..565feaef 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cleanchat.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cleanchat.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.util.FUtil; import net.kyori.adventure.text.Component; import org.bukkit.command.Command; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cleardiscordqueue.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cleardiscordqueue.java index bd08aece..d3a2cfb9 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cleardiscordqueue.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cleardiscordqueue.java @@ -1,5 +1,6 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.*; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_clownfish.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_clownfish.java index 2dcf3f20..74f905b3 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_clownfish.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_clownfish.java @@ -1,6 +1,7 @@ package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.api.ShopItem; +import me.totalfreedom.totalfreedommod.command.handling.*; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cmdspy.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cmdspy.java index 12cf18d6..4e311e21 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cmdspy.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cmdspy.java @@ -1,6 +1,10 @@ package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.admin.Admin; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_coins.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_coins.java index c9abb49f..453c4a03 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_coins.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_coins.java @@ -1,5 +1,6 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.*; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.player.PlayerData; import me.totalfreedom.totalfreedommod.util.FUtil; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_consolesay.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_consolesay.java index 4ace67b3..347ebb80 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_consolesay.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_consolesay.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.util.FUtil; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import org.apache.commons.lang.StringUtils; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cookie.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cookie.java index 97515431..b771c15a 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cookie.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cookie.java @@ -3,6 +3,10 @@ package me.totalfreedom.totalfreedommod.command; import java.util.Collections; import java.util.Random; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.util.FUtil; import org.bukkit.Material; import org.bukkit.command.Command; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_deafen.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_deafen.java index 9f9736f2..6ee703a1 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_deafen.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_deafen.java @@ -1,6 +1,11 @@ package me.totalfreedom.totalfreedommod.command; import java.util.SplittableRandom; + +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import org.bukkit.Location; import org.bukkit.Sound; import org.bukkit.command.Command; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_debugstick.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_debugstick.java index c5002aaf..8dcd59a2 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_debugstick.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_debugstick.java @@ -1,6 +1,11 @@ package me.totalfreedom.totalfreedommod.command; import java.util.Arrays; + +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.format.NamedTextColor; import net.kyori.adventure.text.format.TextDecoration; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_denick.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_denick.java index d6867b51..6a2dfbd5 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_denick.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_denick.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.util.FUtil; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_deop.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_deop.java index 717bf45b..f86aab32 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_deop.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_deop.java @@ -1,5 +1,6 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.*; import me.totalfreedom.totalfreedommod.rank.Hierarchy; import me.totalfreedom.totalfreedommod.util.FLog; import me.totalfreedom.totalfreedommod.util.FUtil; @@ -11,6 +12,7 @@ import org.bukkit.entity.Player; import java.util.concurrent.atomic.AtomicBoolean; +@Intercept("deop") @CommandPermissions(permission = "deop", source = SourceType.BOTH) @CommandParameters(description = "Deop a player", usage = "/ ") public class Command_deop extends FreedomCommand diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_deopall.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_deopall.java index 16aa6129..b903520d 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_deopall.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_deopall.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.rank.Hierarchy; import me.totalfreedom.totalfreedommod.util.FLog; import me.totalfreedom.totalfreedommod.util.FUtil; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_dispfill.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_dispfill.java index 51d24747..07d7350f 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_dispfill.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_dispfill.java @@ -2,6 +2,11 @@ package me.totalfreedom.totalfreedommod.command; import java.util.ArrayList; import java.util.List; + +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.util.FUtil; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import org.apache.commons.lang.StringUtils; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_doom.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_doom.java index c6f71146..f72edc27 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_doom.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_doom.java @@ -2,6 +2,10 @@ package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.admin.Admin; import me.totalfreedom.totalfreedommod.banning.Ban; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.punishments.Punishment; import me.totalfreedom.totalfreedommod.punishments.PunishmentType; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_eject.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_eject.java index 833dd10c..bd8a6fb9 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_eject.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_eject.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_enchant.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_enchant.java index 9661d8d7..9952356d 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_enchant.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_enchant.java @@ -7,6 +7,10 @@ import java.util.List; import java.util.Objects; import java.util.stream.IntStream; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.util.FUtil; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_end.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_end.java index 435648b9..596346bb 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_end.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_end.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_entitywipe.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_entitywipe.java index ab33c848..28c07fbd 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_entitywipe.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_entitywipe.java @@ -3,6 +3,11 @@ package me.totalfreedom.totalfreedommod.command; import java.util.ArrayList; import java.util.Collections; import java.util.List; + +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.util.FUtil; import me.totalfreedom.totalfreedommod.util.Groups; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_expel.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_expel.java index aaeb84bd..7ef8dae4 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_expel.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_expel.java @@ -2,6 +2,11 @@ package me.totalfreedom.totalfreedommod.command; import java.util.ArrayList; import java.util.List; + +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.util.FUtil; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import org.apache.commons.lang.StringUtils; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_explode.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_explode.java index 53dedc52..ffbbed9f 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_explode.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_explode.java @@ -2,6 +2,11 @@ package me.totalfreedom.totalfreedommod.command; import java.util.Collections; import java.util.List; + +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.util.FUtil; import net.kyori.adventure.text.Component; import org.bukkit.command.Command; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_explosivearrows.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_explosivearrows.java index 70af7344..06b50777 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_explosivearrows.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_explosivearrows.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.player.FPlayer; import net.kyori.adventure.text.format.NamedTextColor; import net.kyori.adventure.text.minimessage.tag.Tag; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_findip.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_findip.java index b553ac1c..27fe1b54 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_findip.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_findip.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import org.apache.commons.lang.StringUtils; import org.bukkit.command.Command; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_fireball.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_fireball.java index bca7675b..03649300 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_fireball.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_fireball.java @@ -1,6 +1,7 @@ package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.api.ShopItem; +import me.totalfreedom.totalfreedommod.command.handling.*; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_flatlands.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_flatlands.java index 01eb27c7..7e0c08ed 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_flatlands.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_flatlands.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_forcekill.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_forcekill.java index c8fafc38..9e6f158f 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_forcekill.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_forcekill.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_freeze.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_freeze.java index 79480e0e..67dc6b6e 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_freeze.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_freeze.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.freeze.FreezeData; import me.totalfreedom.totalfreedommod.util.FUtil; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_fuckoff.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_fuckoff.java index ebed8bff..75432fe3 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_fuckoff.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_fuckoff.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.player.FPlayer; import net.kyori.adventure.text.Component; import org.bukkit.command.Command; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_gcmd.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_gcmd.java index 0a1997be..b256f79b 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_gcmd.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_gcmd.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.format.NamedTextColor; import org.apache.commons.lang3.StringUtils; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_glow.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_glow.java index ed8d582d..1f23ea1a 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_glow.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_glow.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_grapplinghook.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_grapplinghook.java index bd3b0ea5..5051451d 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_grapplinghook.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_grapplinghook.java @@ -1,6 +1,7 @@ package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.api.ShopItem; +import me.totalfreedom.totalfreedommod.command.handling.*; import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_gravity.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_gravity.java index 8d380980..082ce65b 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_gravity.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_gravity.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_health.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_health.java index d5009c28..69cbee39 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_health.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_health.java @@ -3,6 +3,10 @@ package me.totalfreedom.totalfreedommod.command; import java.text.DecimalFormat; import java.util.concurrent.atomic.AtomicInteger; import me.totalfreedom.totalfreedommod.TotalFreedomMod; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.util.FLog; import org.apache.commons.lang.math.DoubleRange; import org.bukkit.ChatColor; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_indefban.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_indefban.java index 02d92bde..9385d8b8 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_indefban.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_indefban.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_inspect.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_inspect.java index 01cede9b..3240b0d1 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_inspect.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_inspect.java @@ -5,9 +5,12 @@ import java.util.List; import java.util.Optional; import java.util.stream.IntStream; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.player.PlayerData; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; -import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_invis.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_invis.java index d8e7cb48..a4eaa3d7 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_invis.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_invis.java @@ -3,6 +3,11 @@ package me.totalfreedom.totalfreedommod.command; import java.util.ArrayList; import java.util.Collections; import java.util.List; + +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.util.FUtil; import org.apache.commons.lang.StringUtils; import org.bukkit.command.Command; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_invsee.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_invsee.java index 0762a62a..c7cd3dca 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_invsee.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_invsee.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.player.FPlayer; import org.bukkit.ChatColor; import org.bukkit.command.Command; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_jumppads.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_jumppads.java index fdb3e172..2caf8c46 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_jumppads.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_jumppads.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.fun.Jumppads; import org.bukkit.ChatColor; import org.bukkit.command.Command; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_kick.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_kick.java index 38dc826c..c818dd46 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_kick.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_kick.java @@ -1,8 +1,8 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.*; import me.totalfreedom.totalfreedommod.punishments.Punishment; import me.totalfreedom.totalfreedommod.punishments.PunishmentType; -import me.totalfreedom.totalfreedommod.util.FLog; import me.totalfreedom.totalfreedommod.util.FUtil; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import org.apache.commons.lang.ArrayUtils; @@ -12,6 +12,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; +@Intercept("kick") @CommandPermissions(permission = "kick", source = SourceType.BOTH) @CommandParameters(description = "Kick the specified player.", usage = "/ [reason] [-q]") public class Command_kick extends FreedomCommand diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_kicknoob.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_kicknoob.java index 05db1b2a..c414cdf0 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_kicknoob.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_kicknoob.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.util.FUtil; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.format.NamedTextColor; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_landmine.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_landmine.java index dadc9f2e..776661f9 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_landmine.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_landmine.java @@ -1,6 +1,11 @@ package me.totalfreedom.totalfreedommod.command; import java.util.Iterator; + +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.fun.Landminer.Landmine; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_lightningrod.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_lightningrod.java index 65d3f686..f0e0960a 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_lightningrod.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_lightningrod.java @@ -1,6 +1,7 @@ package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.api.ShopItem; +import me.totalfreedom.totalfreedommod.command.handling.*; import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_linkdiscord.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_linkdiscord.java index 7c37f8d8..bafdbd54 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_linkdiscord.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_linkdiscord.java @@ -1,5 +1,6 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.*; import me.totalfreedom.totalfreedommod.player.PlayerData; import org.bukkit.ChatColor; import org.bukkit.command.Command; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_links.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_links.java index 54bbf74a..aff8f87e 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_links.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_links.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_list.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_list.java index 254bbbc3..1ad27837 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_list.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_list.java @@ -1,19 +1,18 @@ package me.totalfreedom.totalfreedommod.command; -import me.totalfreedom.totalfreedommod.admin.Admin; +import me.totalfreedom.totalfreedommod.command.handling.*; import me.totalfreedom.totalfreedommod.util.FUtil; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.JoinConfiguration; import net.kyori.adventure.text.TextComponent; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; -import net.md_5.bungee.api.ChatColor; -import org.apache.commons.lang.StringUtils; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import java.util.List; +@Intercept("list") @CommandPermissions(permission = "list", source = SourceType.BOTH) @CommandParameters(description = "Lists the real names of all online players.", usage = "/ [-a | -v]", aliases = "who,lsit") public class Command_list extends FreedomCommand diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_localspawn.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_localspawn.java index 3bfae9c9..458b5d0e 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_localspawn.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_localspawn.java @@ -1,6 +1,10 @@ package me.totalfreedom.totalfreedommod.command; import io.papermc.lib.PaperLib; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_lockup.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_lockup.java index 266a6dea..5ab1ba64 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_lockup.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_lockup.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.player.FPlayer; import me.totalfreedom.totalfreedommod.util.FUtil; import net.kyori.adventure.text.Component; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_loginmessage.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_loginmessage.java index 3f35590e..123845f5 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_loginmessage.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_loginmessage.java @@ -1,6 +1,10 @@ package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.api.ShopItem; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.player.PlayerData; import me.totalfreedom.totalfreedommod.util.FUtil; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_manageshop.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_manageshop.java index 5e5e4ef8..c2a5f16b 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_manageshop.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_manageshop.java @@ -1,6 +1,7 @@ package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.api.ShopItem; +import me.totalfreedom.totalfreedommod.command.handling.*; import me.totalfreedom.totalfreedommod.player.PlayerData; import me.totalfreedom.totalfreedommod.util.FUtil; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_masterbuilderinfo.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_masterbuilderinfo.java index 23cb2bf8..7858b3e6 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_masterbuilderinfo.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_masterbuilderinfo.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.util.FUtil; import org.apache.commons.lang.StringUtils; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_masterbuilderworld.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_masterbuilderworld.java index c54972bb..d6d8e65a 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_masterbuilderworld.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_masterbuilderworld.java @@ -1,6 +1,10 @@ package me.totalfreedom.totalfreedommod.command; import io.papermc.lib.PaperLib; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.world.WorldTime; import me.totalfreedom.totalfreedommod.world.WorldWeather; import org.bukkit.World; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mbconfig.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mbconfig.java index 4ca3d72e..eae9388e 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mbconfig.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mbconfig.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.player.PlayerData; import me.totalfreedom.totalfreedommod.rank.GroupProvider; import me.totalfreedom.totalfreedommod.rank.Hierarchy; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_moblimiter.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_moblimiter.java index 980d0e31..e9b66963 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_moblimiter.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_moblimiter.java @@ -1,6 +1,10 @@ package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.GameRuleHandler; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import org.bukkit.ChatColor; import org.bukkit.command.Command; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mobpurge.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mobpurge.java index 0f64ecc2..eb2b4ee0 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mobpurge.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mobpurge.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.util.FUtil; import me.totalfreedom.totalfreedommod.util.Groups; import org.bukkit.ChatColor; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mp44.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mp44.java index 42510b37..44221e99 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mp44.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mp44.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.player.FPlayer; import org.bukkit.ChatColor; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mute.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mute.java index 0bbffaae..54492a5a 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mute.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mute.java @@ -1,5 +1,6 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.*; import me.totalfreedom.totalfreedommod.punishments.Punishment; import me.totalfreedom.totalfreedommod.punishments.PunishmentType; import me.totalfreedom.totalfreedommod.util.FUtil; @@ -12,6 +13,7 @@ import org.bukkit.entity.Player; import java.util.*; +@Intercept("mute") @CommandPermissions(permission = "mute", source = SourceType.BOTH) @CommandParameters(description = "Mutes a player with brute force.", usage = "/ <[-q] [reason] | list | purge | all>", aliases = "stfu") public class Command_mute extends FreedomCommand diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_myadmin.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_myadmin.java index 449af1a1..23416f6b 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_myadmin.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_myadmin.java @@ -1,12 +1,15 @@ package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.admin.Admin; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.player.PlayerData; import me.totalfreedom.totalfreedommod.rank.GroupProvider; import me.totalfreedom.totalfreedommod.util.FConverter; import me.totalfreedom.totalfreedommod.util.FUtil; -import net.kyori.adventure.text.format.TextColor; import net.kyori.adventure.text.minimessage.tag.Tag; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_myinfo.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_myinfo.java index b40f4d1a..ecd3546d 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_myinfo.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_myinfo.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_nether.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_nether.java index 0fc4ff13..c072a9a9 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_nether.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_nether.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_nickclean.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_nickclean.java index 1b06d97a..de30205a 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_nickclean.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_nickclean.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.util.FUtil; import org.apache.commons.lang.StringUtils; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_nickmm.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_nickmm.java index 6d357691..044f6336 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_nickmm.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_nickmm.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.util.FUtil; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_notes.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_notes.java index ed0431c5..17e67bb0 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_notes.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_notes.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.player.PlayerData; import me.totalfreedom.totalfreedommod.util.FUtil; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_op.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_op.java index 07f4a320..443792cc 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_op.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_op.java @@ -1,5 +1,6 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.*; import me.totalfreedom.totalfreedommod.rank.Hierarchy; import me.totalfreedom.totalfreedommod.util.FLog; import me.totalfreedom.totalfreedommod.util.FUtil; @@ -10,6 +11,7 @@ import org.bukkit.entity.Player; import java.util.concurrent.atomic.AtomicBoolean; +@Intercept("op") @CommandPermissions(permission = "op", source = SourceType.BOTH, cooldown = 5) @CommandParameters(description = "OP a player", usage = "/ ") public class Command_op extends FreedomCommand diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_opall.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_opall.java index 457687db..cee23de6 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_opall.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_opall.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.rank.Hierarchy; import me.totalfreedom.totalfreedommod.util.FLog; import me.totalfreedom.totalfreedommod.util.FUtil; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_opme.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_opme.java index 9e755371..a9c1c660 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_opme.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_opme.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.rank.Hierarchy; import me.totalfreedom.totalfreedommod.util.FLog; import me.totalfreedom.totalfreedommod.util.FUtil; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_orbit.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_orbit.java index cd63bfe1..224a9cee 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_orbit.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_orbit.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.player.FPlayer; import me.totalfreedom.totalfreedommod.punishments.Punishment; import me.totalfreedom.totalfreedommod.punishments.PunishmentType; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_plotworld.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_plotworld.java index 2bfe28f3..4d768730 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_plotworld.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_plotworld.java @@ -1,6 +1,7 @@ package me.totalfreedom.totalfreedommod.command; import io.papermc.lib.PaperLib; +import me.totalfreedom.totalfreedommod.command.handling.*; import org.bukkit.World; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_plugincontrol.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_plugincontrol.java index 43d685fb..a2cd7ee8 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_plugincontrol.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_plugincontrol.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import net.kyori.adventure.text.format.NamedTextColor; import net.kyori.adventure.text.minimessage.tag.Tag; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_potion.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_potion.java index ad9adaf5..d48acd08 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_potion.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_potion.java @@ -1,5 +1,6 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.*; import me.totalfreedom.totalfreedommod.util.FUtil; import org.bukkit.ChatColor; import org.bukkit.command.Command; @@ -13,6 +14,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; +@Intercept("potion") @CommandPermissions(permission = "potion", source = SourceType.BOTH) @CommandParameters( description = "Manipulate your potion effects. Duration is measured in server ticks (~20 ticks per second).", diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_potionspy.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_potionspy.java index f6f5d759..636538a3 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_potionspy.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_potionspy.java @@ -1,6 +1,10 @@ package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.admin.Admin; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.util.FUtil; import org.apache.commons.lang.math.NumberUtils; import org.bukkit.Bukkit; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_purgeall.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_purgeall.java index f73fe9fb..6402dfed 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_purgeall.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_purgeall.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.player.FPlayer; import me.totalfreedom.totalfreedommod.util.FUtil; import org.bukkit.Bukkit; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_rank.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_rank.java index b5fc7b4a..5f13fd90 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_rank.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_rank.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.rank.Displayable; import me.totalfreedom.totalfreedommod.rank.DisplayableGroup; import org.bukkit.ChatColor; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_rawsay.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_rawsay.java index 48867633..b6256a80 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_rawsay.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_rawsay.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.util.FUtil; import org.apache.commons.lang.StringUtils; import org.bukkit.command.Command; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_report.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_report.java index 6eff57d2..311a984f 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_report.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_report.java @@ -1,5 +1,6 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.*; import org.apache.commons.lang.ArrayUtils; import org.apache.commons.lang.StringUtils; import org.bukkit.Bukkit; @@ -8,6 +9,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; +@Intercept("report") @CommandPermissions(permission = "report", source = SourceType.ONLY_IN_GAME, blockHostConsole = true) @CommandParameters(description = "Report a player for all admins to see.", usage = "/ ") public class Command_report extends FreedomCommand diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_ride.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_ride.java index 46f55f63..d9f1ead8 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_ride.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_ride.java @@ -1,6 +1,10 @@ package me.totalfreedom.totalfreedommod.command; import io.papermc.lib.PaperLib; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.player.FPlayer; import me.totalfreedom.totalfreedommod.player.PlayerData; import me.totalfreedom.totalfreedommod.util.FUtil; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_rideablepearl.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_rideablepearl.java index 6d82e39e..c602e8da 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_rideablepearl.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_rideablepearl.java @@ -1,6 +1,7 @@ package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.api.ShopItem; +import me.totalfreedom.totalfreedommod.command.handling.*; import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_ro.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_ro.java index 2be0fef5..16a81931 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_ro.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_ro.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.util.FUtil; import me.totalfreedom.totalfreedommod.util.Groups; import net.coreprotect.CoreProtectAPI; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_rock.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_rock.java index 6d78624c..f307c9f2 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_rock.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_rock.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.util.FUtil; import org.bukkit.ChatColor; import org.bukkit.Material; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_saconfig.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_saconfig.java index 447b8946..bead9b55 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_saconfig.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_saconfig.java @@ -1,6 +1,10 @@ package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.admin.Admin; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.player.FPlayer; import me.totalfreedom.totalfreedommod.rank.DisplayableGroup; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_say.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_say.java index c11db548..3d1285e4 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_say.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_say.java @@ -1,5 +1,6 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.*; import me.totalfreedom.totalfreedommod.util.FUtil; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import org.apache.commons.lang.StringUtils; @@ -7,6 +8,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; +@Intercept("say") @CommandPermissions(permission = "say", source = SourceType.BOTH) @CommandParameters(description = "Broadcasts the given message as the server, includes sender name.", usage = "/ ") public class Command_say extends FreedomCommand diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_scare.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_scare.java index fe31b0ad..402333f7 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_scare.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_scare.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import org.bukkit.Particle; import org.bukkit.Sound; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_seed.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_seed.java index 83f52f15..03951ac3 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_seed.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_seed.java @@ -1,5 +1,6 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.*; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.event.ClickEvent; import net.kyori.adventure.text.event.HoverEvent; @@ -13,6 +14,7 @@ import org.bukkit.generator.WorldInfo; import java.util.List; +@Intercept("seed") @CommandPermissions(permission = "seed", source = SourceType.BOTH) @CommandParameters(description = "Get the seed of the world you are currently in.", usage = "/seed [world]") public class Command_seed extends FreedomCommand diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_serverstats.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_serverstats.java index a7c0172e..50c0adb5 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_serverstats.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_serverstats.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import org.bukkit.ChatColor; import org.bukkit.command.Command; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_setcompass.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_setcompass.java index 9e092c3d..eb91b646 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_setcompass.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_setcompass.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.command.Command; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_setlimit.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_setlimit.java index 39f3bb41..08c51d99 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_setlimit.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_setlimit.java @@ -1,5 +1,6 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.*; import me.totalfreedom.totalfreedommod.util.FUtil; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import org.bukkit.command.Command; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_setplayerlimit.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_setplayerlimit.java index 49e74903..f8c84338 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_setplayerlimit.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_setplayerlimit.java @@ -1,5 +1,6 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.*; import me.totalfreedom.totalfreedommod.util.FUtil; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import org.bukkit.Bukkit; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_setspawnworld.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_setspawnworld.java index 9921cc62..2e84aed4 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_setspawnworld.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_setspawnworld.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.util.FUtil; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import org.bukkit.Location; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_shop.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_shop.java index 93621dc5..8b5c389a 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_shop.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_shop.java @@ -1,5 +1,6 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.*; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_smite.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_smite.java index 7aed7271..5c25bb44 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_smite.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_smite.java @@ -1,5 +1,6 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.*; import me.totalfreedom.totalfreedommod.punishments.Punishment; import me.totalfreedom.totalfreedommod.punishments.PunishmentType; import me.totalfreedom.totalfreedommod.util.FUtil; @@ -13,6 +14,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; +@Intercept("smite") @CommandPermissions(permission = "smite", source = SourceType.BOTH) @CommandParameters(description = "Someone being a little bitch? Smite them down...", usage = "/ [reason] [-ci | -q]") public class Command_smite extends FreedomCommand diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_spawnmob.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_spawnmob.java index 46bad22f..87d84be4 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_spawnmob.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_spawnmob.java @@ -1,5 +1,6 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.*; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import org.apache.commons.lang.StringUtils; import org.bukkit.ChatColor; @@ -13,6 +14,7 @@ import org.bukkit.entity.Player; import java.util.Arrays; import java.util.List; +@Intercept("spawnmob") @CommandPermissions(permission = "spawnmob", source = SourceType.ONLY_IN_GAME) @CommandParameters(description = "Spawns the specified entity.", usage = "/ [amount]", aliases = "spawnentity") public class Command_spawnmob extends FreedomCommand diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_spectate.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_spectate.java index fccea416..725e5760 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_spectate.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_spectate.java @@ -1,6 +1,10 @@ package me.totalfreedom.totalfreedommod.command; import io.papermc.lib.PaperLib; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import org.bukkit.GameMode; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_stackingpotato.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_stackingpotato.java index 9e539afe..4c0f171f 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_stackingpotato.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_stackingpotato.java @@ -1,6 +1,7 @@ package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.api.ShopItem; +import me.totalfreedom.totalfreedommod.command.handling.*; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_stop.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_stop.java index 1be16656..de1966cb 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_stop.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_stop.java @@ -1,5 +1,6 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.*; import me.totalfreedom.totalfreedommod.util.FUtil; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import org.apache.commons.lang.StringUtils; @@ -11,6 +12,7 @@ import org.bukkit.scheduler.BukkitRunnable; import java.util.HashMap; import java.util.Map; +@Intercept("stop") @CommandPermissions(permission = "stop", source = SourceType.BOTH) @CommandParameters(description = "Kicks everyone and stops the server.", usage = "/ [reason]") public class Command_stop extends FreedomCommand diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_stopsound.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_stopsound.java index 85df5c7b..8799c273 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_stopsound.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_stopsound.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import org.bukkit.Sound; import org.bukkit.command.Command; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tag.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tag.java index 4b495636..a5100f55 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tag.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tag.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.player.FPlayer; import me.totalfreedom.totalfreedommod.player.PlayerData; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tempban.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tempban.java index aac022a0..b877395a 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tempban.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tempban.java @@ -2,6 +2,7 @@ package me.totalfreedom.totalfreedommod.command; import com.earth2me.essentials.User; import me.totalfreedom.totalfreedommod.banning.Ban; +import me.totalfreedom.totalfreedommod.command.handling.*; import me.totalfreedom.totalfreedommod.player.PlayerData; import me.totalfreedom.totalfreedommod.punishments.Punishment; import me.totalfreedom.totalfreedommod.punishments.PunishmentType; @@ -19,6 +20,7 @@ import java.text.SimpleDateFormat; import java.util.Date; import java.util.Objects; +@Intercept("tempban") @CommandPermissions(permission = "tempban", source = SourceType.BOTH) @CommandParameters(description = "Temporarily ban someone.", usage = "/ [-q] [duration] [reason]", aliases = "tban,noob") public class Command_tempban extends FreedomCommand diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_toggle.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_toggle.java index 02767f3a..a176ba36 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_toggle.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_toggle.java @@ -2,6 +2,10 @@ package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.GameRuleHandler; import me.totalfreedom.totalfreedommod.LoginProcess; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.util.FUtil; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_toggleclownfish.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_toggleclownfish.java index bd3387e6..496e7e35 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_toggleclownfish.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_toggleclownfish.java @@ -1,5 +1,6 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.*; import me.totalfreedom.totalfreedommod.player.FPlayer; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import org.bukkit.command.Command; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_togglediscord.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_togglediscord.java index b07452cd..17ddf4f4 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_togglediscord.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_togglediscord.java @@ -1,5 +1,6 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.*; import me.totalfreedom.totalfreedommod.player.PlayerData; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import org.bukkit.command.Command; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_togglepickup.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_togglepickup.java index e4d760f6..a641e929 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_togglepickup.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_togglepickup.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tossmob.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tossmob.java index 3e9abd58..38e139fd 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tossmob.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tossmob.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.player.FPlayer; import me.totalfreedom.totalfreedommod.util.FUtil; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_totalfreedommod.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_totalfreedommod.java index c15cba5d..af9f2387 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_totalfreedommod.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_totalfreedommod.java @@ -1,6 +1,10 @@ package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.TotalFreedomMod; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.util.FLog; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tprandom.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tprandom.java index 34b41a48..6153c7a9 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tprandom.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tprandom.java @@ -1,6 +1,7 @@ package me.totalfreedom.totalfreedommod.command; import io.papermc.lib.PaperLib; +import me.totalfreedom.totalfreedommod.command.handling.*; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.util.FUtil; import org.bukkit.Location; @@ -8,6 +9,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; +@Intercept("tprandom") @CommandPermissions(permission = "tprandom", source = SourceType.ONLY_IN_GAME) @CommandParameters(description = "Go to a random location in the current world you are in", usage = "/", aliases = "tpr,rtp") public class Command_tprandom extends FreedomCommand diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_trail.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_trail.java index 41ab266f..456be286 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_trail.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_trail.java @@ -1,6 +1,7 @@ package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.api.ShopItem; +import me.totalfreedom.totalfreedommod.command.handling.*; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_unban.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_unban.java index 62c523a4..d2f4cccf 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_unban.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_unban.java @@ -1,6 +1,7 @@ package me.totalfreedom.totalfreedommod.command; import com.earth2me.essentials.User; +import me.totalfreedom.totalfreedommod.command.handling.*; import me.totalfreedom.totalfreedommod.player.PlayerData; import me.totalfreedom.totalfreedommod.util.FUtil; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; @@ -8,6 +9,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; +@Intercept("unban") @CommandPermissions(permission = "unban", source = SourceType.BOTH) @CommandParameters(description = "Unbans the specified player.", usage = "/ [-r]") public class Command_unban extends FreedomCommand diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_unbanip.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_unbanip.java index 16dc3bef..6dd7d778 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_unbanip.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_unbanip.java @@ -1,13 +1,14 @@ package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.banning.Ban; +import me.totalfreedom.totalfreedommod.command.handling.*; import me.totalfreedom.totalfreedommod.util.FUtil; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -// TODO: Merge with /unban. +@Intercept("unbanip") @CommandPermissions(permission = "unbanip", source = SourceType.BOTH) @CommandParameters(description = "Unbans the specified IP.", usage = "/ [-q]") public class Command_unbanip extends FreedomCommand diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_unbanname.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_unbanname.java index 1f52f295..bc167eb9 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_unbanname.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_unbanname.java @@ -1,6 +1,10 @@ package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.banning.Ban; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.util.FUtil; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import org.bukkit.command.Command; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_unblockcmd.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_unblockcmd.java index ddda0577..3ad355a5 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_unblockcmd.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_unblockcmd.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.player.FPlayer; import me.totalfreedom.totalfreedommod.util.FUtil; import org.bukkit.command.Command; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_uncage.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_uncage.java index a22e039c..2a8c7ea5 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_uncage.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_uncage.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.player.FPlayer; import me.totalfreedom.totalfreedommod.util.FUtil; import org.bukkit.command.Command; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_undisguiseall.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_undisguiseall.java index 87739ee3..80cd86af 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_undisguiseall.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_undisguiseall.java @@ -1,5 +1,6 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.*; import me.totalfreedom.totalfreedommod.util.FUtil; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_unlinkdiscord.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_unlinkdiscord.java index 4549f614..4fbab36a 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_unlinkdiscord.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_unlinkdiscord.java @@ -1,5 +1,6 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.*; import me.totalfreedom.totalfreedommod.player.PlayerData; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import org.bukkit.command.Command; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_unmute.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_unmute.java index 5773c167..886f8248 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_unmute.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_unmute.java @@ -1,5 +1,6 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.*; import me.totalfreedom.totalfreedommod.player.FPlayer; import me.totalfreedom.totalfreedommod.util.FUtil; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; @@ -8,6 +9,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; +@Intercept("unmute") @CommandPermissions(permission = "unmute", source = SourceType.BOTH) @CommandParameters(description = "Unmutes a player", usage = "/ [-q] ") public class Command_unmute extends FreedomCommand diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_vanish.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_vanish.java index 742f4246..9b46f157 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_vanish.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_vanish.java @@ -1,9 +1,9 @@ package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.admin.AdminList; +import me.totalfreedom.totalfreedommod.command.handling.*; import me.totalfreedom.totalfreedommod.player.PlayerData; import me.totalfreedom.totalfreedommod.rank.Displayable; -import me.totalfreedom.totalfreedommod.util.FUtil; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.format.NamedTextColor; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; @@ -13,6 +13,7 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitRunnable; +@Intercept("vanish") @CommandPermissions(permission = "vanish", source = SourceType.ONLY_IN_GAME) @CommandParameters(description = "Vanish/unvanish yourself.", usage = "/ [-s[ilent]]", aliases = "v") public class Command_vanish extends FreedomCommand diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_vote.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_vote.java index a317ab41..1c5d6b0d 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_vote.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_vote.java @@ -1,6 +1,11 @@ package me.totalfreedom.totalfreedommod.command; import java.util.List; + +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.util.FUtil; import org.apache.commons.lang.StringUtils; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_warn.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_warn.java index 6b82e64d..8563f1ae 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_warn.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_warn.java @@ -1,5 +1,6 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.*; import me.totalfreedom.totalfreedommod.punishments.Punishment; import me.totalfreedom.totalfreedommod.punishments.PunishmentType; import me.totalfreedom.totalfreedommod.util.FUtil; @@ -10,6 +11,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; +@Intercept("warn") @CommandPermissions(permission = "warn", source = SourceType.BOTH) @CommandParameters(description = "Warns the specified player.", usage = "/ [-q] ") public class Command_warn extends FreedomCommand diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_whitelist.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_whitelist.java index d09de5ef..34905341 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_whitelist.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_whitelist.java @@ -1,5 +1,6 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.*; import me.totalfreedom.totalfreedommod.util.FUtil; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import org.bukkit.OfflinePlayer; @@ -9,6 +10,7 @@ import org.bukkit.entity.Player; import java.util.*; +@Intercept("whitelist") @CommandPermissions(permission = "whitelist", source = SourceType.BOTH) @CommandParameters(description = "Manage the whitelist.", usage = "/ | remove | addall | purge>") public class Command_whitelist extends FreedomCommand diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_whohas.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_whohas.java index 5587af14..999223f2 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_whohas.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_whohas.java @@ -1,5 +1,9 @@ package me.totalfreedom.totalfreedommod.command; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import org.apache.commons.lang.StringUtils; import org.bukkit.Material; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wildcard.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wildcard.java index 829ecdf6..f3f4f10a 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wildcard.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wildcard.java @@ -4,6 +4,10 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import me.totalfreedom.totalfreedommod.command.handling.CommandParameters; +import me.totalfreedom.totalfreedommod.command.handling.CommandPermissions; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.SourceType; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import org.apache.commons.lang.StringUtils; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/CommandDependencies.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/handling/CommandDependencies.java similarity index 76% rename from commons/src/main/java/me/totalfreedom/totalfreedommod/command/CommandDependencies.java rename to commons/src/main/java/me/totalfreedom/totalfreedommod/command/handling/CommandDependencies.java index 349759e6..508d2f57 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/CommandDependencies.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/handling/CommandDependencies.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.command; +package me.totalfreedom.totalfreedommod.command.handling; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/CommandFailException.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/handling/CommandFailException.java similarity index 78% rename from commons/src/main/java/me/totalfreedom/totalfreedommod/command/CommandFailException.java rename to commons/src/main/java/me/totalfreedom/totalfreedommod/command/handling/CommandFailException.java index 9792fd48..673f1542 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/CommandFailException.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/handling/CommandFailException.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.command; +package me.totalfreedom.totalfreedommod.command.handling; public class CommandFailException extends RuntimeException { diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/handling/CommandLoader.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/handling/CommandLoader.java new file mode 100644 index 00000000..4979cfd6 --- /dev/null +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/handling/CommandLoader.java @@ -0,0 +1,145 @@ +package me.totalfreedom.totalfreedommod.command.handling; + +import me.totalfreedom.totalfreedommod.FreedomService; +import me.totalfreedom.totalfreedommod.util.FLog; +import org.bukkit.Bukkit; +import org.reflections.Reflections; + +import java.util.*; +import java.util.concurrent.CompletableFuture; + +public class CommandLoader extends FreedomService +{ + private final List commands; + + public CommandLoader() + { + commands = new ArrayList<>(); + } + + @Override + public void onStart() + { + } + + @Override + public void onStop() + { + } + + public void add(FreedomCommand command) + { + commands.add(command); + command.register(); + } + + public FreedomCommand getByName(String name) + { + for (FreedomCommand command : commands) + { + if (name.equals(command.getName())) + { + return command; + } + } + return null; + } + + public boolean isAlias(String alias) + { + for (FreedomCommand command : commands) + { + if (Arrays.asList(command.getAliases().split(",")).contains(alias)) + { + return true; + } + } + return false; + } + + public void loadCommands() + { + Reflections commandDir = new Reflections("me.totalfreedom.totalfreedommod.command"); + + Interceptor interceptor = new Interceptor(plugin); + + Set> commandClasses = commandDir.getSubTypesOf(FreedomCommand.class); + + Set> postLoadCommands = new HashSet<>(); + + for (Class commandClass : commandClasses) + { + if (commandClass.isAnnotationPresent(CommandDependencies.class)) + { + postLoadCommands.add(commandClass); + } + + if (commandClass.isAnnotationPresent(Intercept.class)) + { + Intercept intercept = commandClass.getAnnotation(Intercept.class); + interceptor.intercept(intercept.value()); + postLoadCommands.add(commandClass); + } + + addClass(commandClass); + } + + doPostLoading(interceptor, postLoadCommands); + + FLog.info("Loaded " + commands.size() + " commands"); + } + + private void doPostLoading(Interceptor interceptor, Set> postLoadCommands) + { + Bukkit.getScheduler().runTaskLater(plugin, () -> + CompletableFuture.runAsync(interceptor::setOverrides) + .whenComplete((v, th) -> + { + if (th != null) + { + FLog.severe("Failed to set command overrides"); + th.printStackTrace(); + return; + } + + for (Class commandClass : postLoadCommands) + { + if (checkDependencies(commandClass)) return; + + addClass(commandClass); + } + }), 1); + } + + private boolean checkDependencies(Class commandClass) + { + if (commandClass.isAnnotationPresent(CommandDependencies.class)) + { + for (String dependency : commandClass.getAnnotation(CommandDependencies.class).value()) + { + if (Bukkit.getPluginManager().getPlugin(dependency) == null) + { + FLog.warning("Failed to register command: /" + commandClass.getSimpleName().replace("Command_", "") + " (Missing dependency: " + dependency + ")"); + return true; + } + } + } + return false; + } + + private void addClass(Class commandClass) + { + try + { + add(commandClass.newInstance()); + } catch (InstantiationException | IllegalAccessException ex) + { + FLog.warning("Failed to register command: /" + commandClass.getSimpleName().replace("Command_", "")); + } + } + + public List getCommands() + { + return commands; + } +} \ No newline at end of file diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/CommandParameters.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/handling/CommandParameters.java similarity index 82% rename from commons/src/main/java/me/totalfreedom/totalfreedommod/command/CommandParameters.java rename to commons/src/main/java/me/totalfreedom/totalfreedommod/command/handling/CommandParameters.java index bae0e188..8131df18 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/CommandParameters.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/handling/CommandParameters.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.command; +package me.totalfreedom.totalfreedommod.command.handling; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/CommandPermissions.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/handling/CommandPermissions.java similarity index 84% rename from commons/src/main/java/me/totalfreedom/totalfreedommod/command/CommandPermissions.java rename to commons/src/main/java/me/totalfreedom/totalfreedommod/command/handling/CommandPermissions.java index e4a17030..0fac3c9b 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/CommandPermissions.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/handling/CommandPermissions.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.command; +package me.totalfreedom.totalfreedommod.command.handling; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/FreedomCommand.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/handling/FreedomCommand.java similarity index 94% rename from commons/src/main/java/me/totalfreedom/totalfreedommod/command/FreedomCommand.java rename to commons/src/main/java/me/totalfreedom/totalfreedommod/command/handling/FreedomCommand.java index f59d82e7..c34f8714 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/FreedomCommand.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/handling/FreedomCommand.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.command; +package me.totalfreedom.totalfreedommod.command.handling; import com.earth2me.essentials.commands.PlayerNotFoundException; import com.google.common.collect.Lists; @@ -26,6 +26,7 @@ import org.jetbrains.annotations.NotNull; import java.lang.annotation.AnnotationFormatError; import java.util.*; +import java.util.concurrent.CompletableFuture; public abstract class FreedomCommand implements CommandExecutor, TabCompleter { @@ -52,7 +53,7 @@ public abstract class FreedomCommand implements CommandExecutor, TabCompleter private final CommandPermissions perms; protected CommandSender sender; - FreedomCommand() + protected FreedomCommand() { if (getClass().getAnnotation(CommandParameters.class) == null || getClass().getAnnotation(CommandPermissions.class) == null) @@ -109,7 +110,23 @@ public abstract class FreedomCommand implements CommandExecutor, TabCompleter cmd.setPermission(this.permission); } server.getCommandMap().register("totalfreedommod", cmd); - cmd.setExecutor(this); + CompletableFuture.runAsync(() -> server.getCommandMap().register("totalfreedommod", cmd)) + .whenComplete((v, th) -> + { + if (th != null) + { + FLog.severe(th); + return; + } + + PluginCommand pluginCommand = server.getPluginCommand(cmd.getName()); + if (pluginCommand != null) + { + pluginCommand.setExecutor(this); + pluginCommand.setTabCompleter(this); + } + cmd.setExecutor(this); + }); } protected void msg(CommandSender sender, Component message) @@ -221,6 +238,7 @@ public abstract class FreedomCommand implements CommandExecutor, TabCompleter } } + @Override public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @NotNull String commandLabel, @NotNull String[] args) { try @@ -239,6 +257,7 @@ public abstract class FreedomCommand implements CommandExecutor, TabCompleter } @NotNull + @Override public List onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, @NotNull String[] args) { List options = getTabCompleteOptions(sender, command, alias, args); diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/handling/Intercept.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/handling/Intercept.java new file mode 100644 index 00000000..bebd1764 --- /dev/null +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/handling/Intercept.java @@ -0,0 +1,13 @@ +package me.totalfreedom.totalfreedommod.command.handling; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) +public @interface Intercept +{ + String value(); +} diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/handling/Interceptor.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/handling/Interceptor.java new file mode 100644 index 00000000..fbdd2c47 --- /dev/null +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/handling/Interceptor.java @@ -0,0 +1,57 @@ +package me.totalfreedom.totalfreedommod.command.handling; + +import me.totalfreedom.totalfreedommod.TotalFreedomMod; +import me.totalfreedom.totalfreedommod.util.FLog; +import org.bukkit.Bukkit; +import org.bukkit.command.Command; +import org.bukkit.command.PluginIdentifiableCommand; + +import java.util.HashMap; +import java.util.Map; + +public class Interceptor +{ + private final TotalFreedomMod plugin; + private final Map overrides = new HashMap<>(); + + public Interceptor(TotalFreedomMod plugin) + { + this.plugin = plugin; + } + + public void intercept(String command) + { + getPluginCommands().entrySet() + .stream() + .filter(entry -> !((PluginIdentifiableCommand) entry.getValue()) // Check that it isn't a tfm command + .getPlugin() + .getName() + .equalsIgnoreCase(plugin.getName())) + .filter(entry -> entry.getValue() // Check that the command is the one we want to intercept + .getName() + .equalsIgnoreCase(command)) + .forEach(entry -> overrides.put(entry.getKey(), entry.getValue())); // Intercept. + } + + public void setOverrides() + { + overrides.forEach((key, value) -> + { + Bukkit.getCommandMap().getKnownCommands().remove(key, value); + FLog.info("Overriding command: " + key); + }); + } + + private Map getPluginCommands() + { + final Map pluginCommands = new HashMap<>(); + for (final Map.Entry entry : Bukkit.getCommandMap().getKnownCommands().entrySet()) + { + if (entry.getValue() instanceof PluginIdentifiableCommand) + { + pluginCommands.put(entry.getKey(), entry.getValue()); + } + } + return pluginCommands; + } +} diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/SourceType.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/handling/SourceType.java similarity index 87% rename from commons/src/main/java/me/totalfreedom/totalfreedommod/command/SourceType.java rename to commons/src/main/java/me/totalfreedom/totalfreedommod/command/handling/SourceType.java index 7a678bd3..73d775fe 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/SourceType.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/handling/SourceType.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.command; +package me.totalfreedom.totalfreedommod.command.handling; import org.bukkit.command.CommandSender; import org.bukkit.command.ConsoleCommandSender; diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/httpd/module/Module_help.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/httpd/module/Module_help.java index c41e6b62..4f55e001 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/httpd/module/Module_help.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/httpd/module/Module_help.java @@ -4,9 +4,8 @@ import com.google.common.collect.Lists; import java.util.*; -import me.totalfreedom.totalfreedommod.command.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.handling.FreedomCommand; import me.totalfreedom.totalfreedommod.httpd.NanoHTTPD; -import me.totalfreedom.totalfreedommod.rank.DisplayableGroup; import org.apache.commons.lang.StringUtils; import org.bukkit.Bukkit; import org.bukkit.command.Command;