From d333027a031a66900267631e659ee67fd8433875 Mon Sep 17 00:00:00 2001 From: Telesphoreo Date: Tue, 19 May 2026 21:42:07 -0400 Subject: [PATCH] Brigadier --- src/main/java/dev/plex/extras/TFMExtras.java | 76 +++++++++---------- .../plex/extras/command/AdminInfoCommand.java | 18 +++-- .../plex/extras/command/AutoClearCommand.java | 19 +++-- .../extras/command/AutoTeleportCommand.java | 19 +++-- .../dev/plex/extras/command/CakeCommand.java | 17 +++-- .../plex/extras/command/CartSitCommand.java | 19 +++-- .../plex/extras/command/ClearChatCommand.java | 18 +++-- .../extras/command/CloudClearCommand.java | 18 +++-- .../plex/extras/command/ClownfishCommand.java | 18 +++-- .../dev/plex/extras/command/EjectCommand.java | 18 +++-- .../plex/extras/command/EnchantCommand.java | 20 +++-- .../plex/extras/command/EnglishMfCommand.java | 18 +++-- .../dev/plex/extras/command/ExpelCommand.java | 19 +++-- .../plex/extras/command/JumpPadsCommand.java | 20 +++-- .../dev/plex/extras/command/OrbitCommand.java | 18 +++-- .../extras/command/RandomFishCommand.java | 19 +++-- src/main/resources/tfmextras/messages.yml | 22 ++++++ 17 files changed, 228 insertions(+), 148 deletions(-) create mode 100644 src/main/resources/tfmextras/messages.yml diff --git a/src/main/java/dev/plex/extras/TFMExtras.java b/src/main/java/dev/plex/extras/TFMExtras.java index 469d5c5..766ac3a 100755 --- a/src/main/java/dev/plex/extras/TFMExtras.java +++ b/src/main/java/dev/plex/extras/TFMExtras.java @@ -3,10 +3,22 @@ package dev.plex.extras; import com.google.common.collect.ImmutableSet; import com.google.common.reflect.ClassPath; import dev.plex.api.PlexApi; -import dev.plex.command.PlexCommand; -import dev.plex.command.annotation.CommandParameters; -import dev.plex.command.annotation.CommandPermissions; import dev.plex.config.ModuleConfig; +import dev.plex.extras.command.AdminInfoCommand; +import dev.plex.extras.command.AutoClearCommand; +import dev.plex.extras.command.AutoTeleportCommand; +import dev.plex.extras.command.CakeCommand; +import dev.plex.extras.command.CartSitCommand; +import dev.plex.extras.command.ClearChatCommand; +import dev.plex.extras.command.ClownfishCommand; +import dev.plex.extras.command.CloudClearCommand; +import dev.plex.extras.command.EjectCommand; +import dev.plex.extras.command.EnchantCommand; +import dev.plex.extras.command.EnglishMfCommand; +import dev.plex.extras.command.ExpelCommand; +import dev.plex.extras.command.JumpPadsCommand; +import dev.plex.extras.command.OrbitCommand; +import dev.plex.extras.command.RandomFishCommand; import dev.plex.extras.jumppads.JumpPads; import dev.plex.listener.PlexListener; import dev.plex.module.PlexModule; @@ -14,6 +26,7 @@ import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.util.Collections; import java.util.HashSet; +import java.util.List; import java.util.Set; import java.util.concurrent.ThreadLocalRandom; import lombok.Getter; @@ -41,28 +54,30 @@ public class TFMExtras extends PlexModule module = this; config = new ModuleConfig(this, "tfmextras/config.yml", "config.yml"); config.load(); + loadMessages("tfmextras/messages.yml"); jumpPads = new JumpPads(); -// plexApi().logging().debug(String.valueOf(config.getInt("server.jumppad_strength"))); } @Override public void enable() { - getClassesFrom("dev.plex.extras.command").forEach(aClass -> - { - if (PlexCommand.class.isAssignableFrom(aClass) && aClass.isAnnotationPresent(CommandParameters.class) && aClass.isAnnotationPresent(CommandPermissions.class)) - { - try - { - PlexCommand plexCommand = (PlexCommand)aClass.getConstructors()[0].newInstance(); - registerCommand(plexCommand); - } - catch (InstantiationException | IllegalAccessException | InvocationTargetException e) - { - throw new RuntimeException(e); - } - } - }); + List.of( + new AdminInfoCommand(), + new AutoClearCommand(), + new AutoTeleportCommand(), + new CakeCommand(), + new CartSitCommand(), + new ClearChatCommand(), + new ClownfishCommand(), + new CloudClearCommand(), + new EjectCommand(), + new EnchantCommand(), + new EnglishMfCommand(), + new ExpelCommand(), + new JumpPadsCommand(), + new OrbitCommand(), + new RandomFishCommand() + ).forEach(this::registerCommand); getClassesFrom("dev.plex.extras.listener").forEach(aClass -> { @@ -80,28 +95,6 @@ public class TFMExtras extends PlexModule } }); - addDefaultMessage("playerOrbited", "{0} - Orbiting {1}", "0 - The command sender", "1 - The person being orbited"); - addDefaultMessage("stoppedOrbiting", "No longer orbiting {0}", "0 - The person no longer being orbited"); - addDefaultMessage("alreadyOrbited", "{0} is already being orbited!", "0 - The person that is already orbited"); - addDefaultMessage("restrictClownfish", "{0} will {1} be able to use the clownfish.", "0 - The player who will be restricted", "1 - Whether they had this option toggled (returns: 'no longer', 'now')"); - addDefaultMessage("toggleClownfish", "You will {0} be affected by the clownfish.", "0 - Whether they had this option toggled (returns: 'no longer', 'now')"); - addDefaultMessage("emptyAdminInfo", "The admin information section of the config.yml file has not been configured."); - addDefaultMessage("cakeLyrics", "But there's no sense crying over every mistake. You just keep on trying till you run out of cake."); - addDefaultMessage("areaEffectCloudClear", "{0} - Removing all area effect clouds", "0 - The command sender"); - addDefaultMessage("chatCleared", "{0} - Cleared the chat", "0 - The command sender"); - addDefaultMessage("attributeList", "All possible attributes: {0}", "0 - The attribute list, each split by a new line"); - addDefaultMessage("modifiedAutoClear", "{0} will {1} have their inventory cleared when they join.", "0 - The player who will have their inventory cleared on join", "1 - Whether they had this option toggled (returns: 'no longer', 'now')"); - addDefaultMessage("modifiedAutoTeleport", "{0} will {1} be teleported automatically when they join.", "0 - The player to be teleported automatically", "1 - Whether they had this option toggled (returns: 'no longer', 'now')"); - addDefaultMessage("playersExpelled", "Pushed away players: {0}", "0 - The list of players"); - addDefaultMessage("enchantList", "All possible enchantments are for this item are: {0}", "0 - A comma-separated list of enchantment names"); - addDefaultMessage("enchantAddAll", "Added all possible enchantments for this item."); - addDefaultMessage("enchantReset", "Removed every enchantment from this item."); - addDefaultMessage("enchantMustHoldItem", "You must be holding an enchantable item."); - addDefaultMessage("enchantSpecify", "Please specify an enchantment."); - addDefaultMessage("enchantInvalid", "Invalid enchantment for this item."); - addDefaultMessage("enchantAdd", "Added {0} {1}", "0 - The enchantment name", "1 - The enchantment level"); - addDefaultMessage("enchantRemove", "Removed {0}", "0 - The enchantment name"); - addDefaultMessage("enchantInvalidLevel", "Invalid enchantment level."); } @Override @@ -148,5 +141,4 @@ public class TFMExtras extends PlexModule return Collections.unmodifiableSet(classes); } - } diff --git a/src/main/java/dev/plex/extras/command/AdminInfoCommand.java b/src/main/java/dev/plex/extras/command/AdminInfoCommand.java index f46220b..b5e4e06 100755 --- a/src/main/java/dev/plex/extras/command/AdminInfoCommand.java +++ b/src/main/java/dev/plex/extras/command/AdminInfoCommand.java @@ -1,8 +1,6 @@ package dev.plex.extras.command; -import dev.plex.command.PlexCommand; -import dev.plex.command.annotation.CommandParameters; -import dev.plex.command.annotation.CommandPermissions; +import dev.plex.command.SimplePlexCommand; import dev.plex.extras.TFMExtras; import java.util.Collections; import java.util.List; @@ -13,10 +11,16 @@ import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -@CommandParameters(name = "admininfo", description = "Information on how to apply for admin", aliases = "ai,si,staffinfo") -@CommandPermissions(permission = "plex.tfmextras.admininfo") -public class AdminInfoCommand extends PlexCommand +public class AdminInfoCommand extends SimplePlexCommand { + public AdminInfoCommand() + { + super(command("admininfo") + .description("Information on how to apply for admin") + .aliases("ai,si,staffinfo") + .permission("plex.tfmextras.admininfo") + .build()); + } private static final List ADMIN_INFO = TFMExtras.getModule().getConfig().getStringList("server.admininfo") .stream().map(info -> MiniMessage.miniMessage().deserialize(info)).toList(); @@ -32,7 +36,7 @@ public class AdminInfoCommand extends PlexCommand } @Override - public @NotNull List smartTabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException + protected @NotNull List suggestions(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException { return Collections.emptyList(); } diff --git a/src/main/java/dev/plex/extras/command/AutoClearCommand.java b/src/main/java/dev/plex/extras/command/AutoClearCommand.java index 8f27970..bb91647 100755 --- a/src/main/java/dev/plex/extras/command/AutoClearCommand.java +++ b/src/main/java/dev/plex/extras/command/AutoClearCommand.java @@ -2,9 +2,7 @@ package dev.plex.extras.command; import com.google.common.collect.ImmutableList; import dev.plex.api.player.PlexPlayerView; -import dev.plex.command.PlexCommand; -import dev.plex.command.annotation.CommandParameters; -import dev.plex.command.annotation.CommandPermissions; +import dev.plex.command.SimplePlexCommand; import dev.plex.command.exception.PlayerNotFoundException; import dev.plex.extras.TFMExtras; import java.util.List; @@ -14,10 +12,17 @@ import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -@CommandParameters(name = "autoclear", description = "Toggle whether or not a player has their inventory automatically cleared when they join", usage = "/ ", aliases = "aclear,ac") -@CommandPermissions(permission = "plex.tfmextras.autoclear") -public class AutoClearCommand extends PlexCommand +public class AutoClearCommand extends SimplePlexCommand { + public AutoClearCommand() + { + super(command("autoclear") + .description("Toggle whether or not a player has their inventory automatically cleared when they join") + .usage("/ ") + .aliases("aclear,ac") + .permission("plex.tfmextras.autoclear") + .build()); + } @Override protected Component execute(@NotNull CommandSender sender, @Nullable Player player, @NotNull String[] args) { @@ -44,7 +49,7 @@ public class AutoClearCommand extends PlexCommand @Override - public @NotNull List smartTabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException + protected @NotNull List suggestions(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException { return args.length == 1 && silentCheckPermission(sender, this.getPermission()) ? onlinePlayerNames() : ImmutableList.of(); } diff --git a/src/main/java/dev/plex/extras/command/AutoTeleportCommand.java b/src/main/java/dev/plex/extras/command/AutoTeleportCommand.java index dcc5090..5be275b 100755 --- a/src/main/java/dev/plex/extras/command/AutoTeleportCommand.java +++ b/src/main/java/dev/plex/extras/command/AutoTeleportCommand.java @@ -2,9 +2,7 @@ package dev.plex.extras.command; import com.google.common.collect.ImmutableList; import dev.plex.api.player.PlexPlayerView; -import dev.plex.command.PlexCommand; -import dev.plex.command.annotation.CommandParameters; -import dev.plex.command.annotation.CommandPermissions; +import dev.plex.command.SimplePlexCommand; import dev.plex.command.exception.PlayerNotFoundException; import dev.plex.extras.TFMExtras; import java.util.List; @@ -15,10 +13,17 @@ import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -@CommandParameters(name = "autoteleport", description = "If a player is specified, it will toggle whether or not the player is automatically teleported when they join. If no player is specified, you will be randomly teleported", usage = "/ [player]", aliases = "autotp,rtp,randomtp,tpr") -@CommandPermissions(permission = "plex.tfmextras.autotp") -public class AutoTeleportCommand extends PlexCommand +public class AutoTeleportCommand extends SimplePlexCommand { + public AutoTeleportCommand() + { + super(command("autoteleport") + .description("If a player is specified, it will toggle whether or not the player is automatically teleported when they join. If no player is specified, you will be randomly teleported") + .usage("/ [player]") + .aliases("autotp,rtp,randomtp,tpr") + .permission("plex.tfmextras.autotp") + .build()); + } @Override protected Component execute(@NotNull CommandSender sender, @Nullable Player player, @NotNull String[] args) { @@ -50,7 +55,7 @@ public class AutoTeleportCommand extends PlexCommand } @Override - public @NotNull List smartTabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException + protected @NotNull List suggestions(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException { return args.length == 1 && silentCheckPermission(sender, this.getPermission()) ? onlinePlayerNames() : ImmutableList.of(); } diff --git a/src/main/java/dev/plex/extras/command/CakeCommand.java b/src/main/java/dev/plex/extras/command/CakeCommand.java index db1c193..bdae380 100755 --- a/src/main/java/dev/plex/extras/command/CakeCommand.java +++ b/src/main/java/dev/plex/extras/command/CakeCommand.java @@ -1,8 +1,6 @@ package dev.plex.extras.command; -import dev.plex.command.PlexCommand; -import dev.plex.command.annotation.CommandParameters; -import dev.plex.command.annotation.CommandPermissions; +import dev.plex.command.SimplePlexCommand; import dev.plex.extras.TFMExtras; import java.util.Collections; import java.util.List; @@ -17,10 +15,15 @@ import org.bukkit.inventory.meta.ItemMeta; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -@CommandParameters(name = "cake", description = "For the people that are still alive - gives a cake to everyone on the server") -@CommandPermissions(permission = "plex.tfmextras.cake") -public class CakeCommand extends PlexCommand +public class CakeCommand extends SimplePlexCommand { + public CakeCommand() + { + super(command("cake") + .description("For the people that are still alive - gives a cake to everyone on the server") + .permission("plex.tfmextras.cake") + .build()); + } private static final ItemStack CAKE = cake(); @Override @@ -41,7 +44,7 @@ public class CakeCommand extends PlexCommand } @Override - public @NotNull List smartTabComplete(@NotNull CommandSender commandSender, @NotNull String s, @NotNull String[] strings) throws IllegalArgumentException + protected @NotNull List suggestions(@NotNull CommandSender commandSender, @NotNull String s, @NotNull String[] strings) throws IllegalArgumentException { return Collections.emptyList(); } diff --git a/src/main/java/dev/plex/extras/command/CartSitCommand.java b/src/main/java/dev/plex/extras/command/CartSitCommand.java index 2666988..d62a8b7 100755 --- a/src/main/java/dev/plex/extras/command/CartSitCommand.java +++ b/src/main/java/dev/plex/extras/command/CartSitCommand.java @@ -1,9 +1,7 @@ package dev.plex.extras.command; import com.google.common.collect.ImmutableList; -import dev.plex.command.PlexCommand; -import dev.plex.command.annotation.CommandParameters; -import dev.plex.command.annotation.CommandPermissions; +import dev.plex.command.SimplePlexCommand; import dev.plex.extras.TFMExtras; import java.util.Comparator; import java.util.List; @@ -17,10 +15,17 @@ import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -@CommandParameters(name = "cartsit", usage = "/ ", description = "Sit in nearest minecart. If target is in a minecart already, they will be ejected", aliases = "minecartsit") -@CommandPermissions(permission = "plex.tfmextras.cartsit") -public class CartSitCommand extends PlexCommand +public class CartSitCommand extends SimplePlexCommand { + public CartSitCommand() + { + super(command("cartsit") + .description("Sit in nearest minecart. If target is in a minecart already, they will be ejected") + .usage("/ ") + .aliases("minecartsit") + .permission("plex.tfmextras.cartsit") + .build()); + } @Override protected Component execute(@NotNull CommandSender sender, @Nullable Player player, @NotNull String[] args) { @@ -68,7 +73,7 @@ public class CartSitCommand extends PlexCommand } @Override - public @NotNull List smartTabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException + protected @NotNull List suggestions(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException { return args.length == 1 && silentCheckPermission(sender, this.getPermission()) ? onlinePlayerNames() : ImmutableList.of(); } diff --git a/src/main/java/dev/plex/extras/command/ClearChatCommand.java b/src/main/java/dev/plex/extras/command/ClearChatCommand.java index 69dd0f7..9ee54da 100755 --- a/src/main/java/dev/plex/extras/command/ClearChatCommand.java +++ b/src/main/java/dev/plex/extras/command/ClearChatCommand.java @@ -1,8 +1,6 @@ package dev.plex.extras.command; -import dev.plex.command.PlexCommand; -import dev.plex.command.annotation.CommandParameters; -import dev.plex.command.annotation.CommandPermissions; +import dev.plex.command.SimplePlexCommand; import dev.plex.extras.TFMExtras; import java.util.Collections; import java.util.List; @@ -13,10 +11,16 @@ import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -@CommandParameters(name = "clearchat", description = "Clears the chat", aliases = "cc,cleanchat,chatclear") -@CommandPermissions(permission = "plex.tfmextras.clearchat") -public class ClearChatCommand extends PlexCommand +public class ClearChatCommand extends SimplePlexCommand { + public ClearChatCommand() + { + super(command("clearchat") + .description("Clears the chat") + .aliases("cc,cleanchat,chatclear") + .permission("plex.tfmextras.clearchat") + .build()); + } @Override protected Component execute(@NotNull CommandSender sender, @Nullable Player player, @NotNull String[] args) { @@ -36,7 +40,7 @@ public class ClearChatCommand extends PlexCommand } @Override - public @NotNull List smartTabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException + protected @NotNull List suggestions(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException { return Collections.emptyList(); } diff --git a/src/main/java/dev/plex/extras/command/CloudClearCommand.java b/src/main/java/dev/plex/extras/command/CloudClearCommand.java index 29b1029..b44abf3 100755 --- a/src/main/java/dev/plex/extras/command/CloudClearCommand.java +++ b/src/main/java/dev/plex/extras/command/CloudClearCommand.java @@ -1,8 +1,6 @@ package dev.plex.extras.command; -import dev.plex.command.PlexCommand; -import dev.plex.command.annotation.CommandParameters; -import dev.plex.command.annotation.CommandPermissions; +import dev.plex.command.SimplePlexCommand; import dev.plex.extras.TFMExtras; import java.util.Collection; import java.util.Collections; @@ -18,10 +16,16 @@ import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -@CommandParameters(name = "cloudclear", description = "Clears lingering potion area effect clouds", aliases = "clearcloud,aeclear") -@CommandPermissions(permission = "plex.tfmextras.cloudclear") -public class CloudClearCommand extends PlexCommand +public class CloudClearCommand extends SimplePlexCommand { + public CloudClearCommand() + { + super(command("cloudclear") + .description("Clears lingering potion area effect clouds") + .aliases("clearcloud,aeclear") + .permission("plex.tfmextras.cloudclear") + .build()); + } @Override protected Component execute(@NotNull CommandSender sender, @Nullable Player player, @NotNull String[] args) { @@ -36,7 +40,7 @@ public class CloudClearCommand extends PlexCommand } @Override - public @NotNull List smartTabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException + protected @NotNull List suggestions(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException { return Collections.emptyList(); } diff --git a/src/main/java/dev/plex/extras/command/ClownfishCommand.java b/src/main/java/dev/plex/extras/command/ClownfishCommand.java index 031e83d..8c4a646 100644 --- a/src/main/java/dev/plex/extras/command/ClownfishCommand.java +++ b/src/main/java/dev/plex/extras/command/ClownfishCommand.java @@ -1,9 +1,7 @@ package dev.plex.extras.command; import dev.plex.api.player.PlexPlayerView; -import dev.plex.command.PlexCommand; -import dev.plex.command.annotation.CommandParameters; -import dev.plex.command.annotation.CommandPermissions; +import dev.plex.command.SimplePlexCommand; import dev.plex.command.exception.PlayerNotFoundException; import dev.plex.extras.TFMExtras; import net.kyori.adventure.text.Component; @@ -20,10 +18,16 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; -@CommandParameters(name = "clownfish", description = "Gives a player a clownfish capable of knocking people back", usage = "/ []") -@CommandPermissions(permission = "plex.tfmextras.clownfish") -public class ClownfishCommand extends PlexCommand +public class ClownfishCommand extends SimplePlexCommand { + public ClownfishCommand() + { + super(command("clownfish") + .description("Gives a player a clownfish capable of knocking people back") + .usage("/ []") + .permission("plex.tfmextras.clownfish") + .build()); + } @Override protected Component execute(@NotNull CommandSender commandSender, @Nullable Player player, @NotNull String[] args) { @@ -92,7 +96,7 @@ public class ClownfishCommand extends PlexCommand } @Override - public @NotNull List smartTabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException { + protected @NotNull List suggestions(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException { if (silentCheckPermission(sender, "plex.tfmextras.clownfish.restrict")) { if (args.length == 1) diff --git a/src/main/java/dev/plex/extras/command/EjectCommand.java b/src/main/java/dev/plex/extras/command/EjectCommand.java index ab7d353..509beb3 100755 --- a/src/main/java/dev/plex/extras/command/EjectCommand.java +++ b/src/main/java/dev/plex/extras/command/EjectCommand.java @@ -1,8 +1,6 @@ package dev.plex.extras.command; -import dev.plex.command.PlexCommand; -import dev.plex.command.annotation.CommandParameters; -import dev.plex.command.annotation.CommandPermissions; +import dev.plex.command.SimplePlexCommand; import dev.plex.command.source.RequiredCommandSource; import dev.plex.extras.TFMExtras; import java.util.Collections; @@ -14,10 +12,16 @@ import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -@CommandParameters(name = "eject", description = "Removes all passengers from a player") -@CommandPermissions(permission = "plex.tfmextras.eject", source = RequiredCommandSource.IN_GAME) -public class EjectCommand extends PlexCommand +public class EjectCommand extends SimplePlexCommand { + public EjectCommand() + { + super(command("eject") + .description("Removes all passengers from a player") + .permission("plex.tfmextras.eject") + .source(RequiredCommandSource.IN_GAME) + .build()); + } @Override protected Component execute(@NotNull CommandSender sender, @Nullable Player player, @NotNull String[] args) { @@ -27,7 +31,7 @@ public class EjectCommand extends PlexCommand } @Override - public @NotNull List smartTabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException + protected @NotNull List suggestions(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException { return Collections.emptyList(); } diff --git a/src/main/java/dev/plex/extras/command/EnchantCommand.java b/src/main/java/dev/plex/extras/command/EnchantCommand.java index 67601da..a17aabb 100755 --- a/src/main/java/dev/plex/extras/command/EnchantCommand.java +++ b/src/main/java/dev/plex/extras/command/EnchantCommand.java @@ -1,9 +1,7 @@ package dev.plex.extras.command; import com.google.common.collect.Lists; -import dev.plex.command.PlexCommand; -import dev.plex.command.annotation.CommandParameters; -import dev.plex.command.annotation.CommandPermissions; +import dev.plex.command.SimplePlexCommand; import dev.plex.command.source.RequiredCommandSource; import io.papermc.paper.registry.RegistryAccess; @@ -22,10 +20,18 @@ import org.bukkit.inventory.ItemStack; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -@CommandParameters(name = "enchant", description = "Enchants an item", usage = "/ ", aliases = "enchantment") -@CommandPermissions(permission = "plex.tfmextras.enchant", source = RequiredCommandSource.IN_GAME) -public class EnchantCommand extends PlexCommand +public class EnchantCommand extends SimplePlexCommand { + public EnchantCommand() + { + super(command("enchant") + .description("Enchants an item") + .usage("/ ") + .aliases("enchantment") + .permission("plex.tfmextras.enchant") + .source(RequiredCommandSource.IN_GAME) + .build()); + } @Override protected Component execute(@NotNull CommandSender sender, @Nullable Player player, @NotNull String[] args) { @@ -120,7 +126,7 @@ public class EnchantCommand extends PlexCommand } @Override - public @NotNull List smartTabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException + protected @NotNull List suggestions(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException { if (silentCheckPermission(sender, this.getPermission())) { diff --git a/src/main/java/dev/plex/extras/command/EnglishMfCommand.java b/src/main/java/dev/plex/extras/command/EnglishMfCommand.java index a99416b..0af2c7c 100755 --- a/src/main/java/dev/plex/extras/command/EnglishMfCommand.java +++ b/src/main/java/dev/plex/extras/command/EnglishMfCommand.java @@ -1,9 +1,7 @@ package dev.plex.extras.command; import com.google.common.collect.ImmutableList; -import dev.plex.command.PlexCommand; -import dev.plex.command.annotation.CommandParameters; -import dev.plex.command.annotation.CommandPermissions; +import dev.plex.command.SimplePlexCommand; import dev.plex.extras.TFMExtras; import java.util.List; import net.kyori.adventure.text.Component; @@ -17,10 +15,16 @@ import org.jetbrains.annotations.Nullable; * Credit to "TheDeus-Group" for the messages :) */ -@CommandParameters(name = "emf", description = "Speak english.", usage = "/ ") -@CommandPermissions(permission = "plex.tfmextras.emf") -public class EnglishMfCommand extends PlexCommand +public class EnglishMfCommand extends SimplePlexCommand { + public EnglishMfCommand() + { + super(command("emf") + .description("Speak english.") + .usage("/ ") + .permission("plex.tfmextras.emf") + .build()); + } @Override protected Component execute(@NotNull CommandSender sender, @Nullable Player player, @NotNull String[] args) { @@ -40,7 +44,7 @@ public class EnglishMfCommand extends PlexCommand } @Override - public @NotNull List smartTabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException + protected @NotNull List suggestions(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException { return args.length == 1 && silentCheckPermission(sender, this.getPermission()) ? onlinePlayerNames() : ImmutableList.of(); } diff --git a/src/main/java/dev/plex/extras/command/ExpelCommand.java b/src/main/java/dev/plex/extras/command/ExpelCommand.java index 62bf8a6..49cfcfe 100644 --- a/src/main/java/dev/plex/extras/command/ExpelCommand.java +++ b/src/main/java/dev/plex/extras/command/ExpelCommand.java @@ -1,8 +1,6 @@ package dev.plex.extras.command; -import dev.plex.command.PlexCommand; -import dev.plex.command.annotation.CommandParameters; -import dev.plex.command.annotation.CommandPermissions; +import dev.plex.command.SimplePlexCommand; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.minimessage.MiniMessage; import org.bukkit.Location; @@ -16,10 +14,17 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; -@CommandParameters(name = "expel", description = "Pushes away nearby players", usage = "/expel ", aliases = "push") -@CommandPermissions(permission = "plex.tfmextras.expel") -public class ExpelCommand extends PlexCommand +public class ExpelCommand extends SimplePlexCommand { + public ExpelCommand() + { + super(command("expel") + .description("Pushes away nearby players") + .usage("/expel ") + .aliases("push") + .permission("plex.tfmextras.expel") + .build()); + } @Override protected Component execute(@NotNull CommandSender sender, @Nullable Player player, @NotNull String[] args) { @@ -85,7 +90,7 @@ public class ExpelCommand extends PlexCommand } @Override - public @NotNull List smartTabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) + protected @NotNull List suggestions(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) { return Collections.emptyList(); } diff --git a/src/main/java/dev/plex/extras/command/JumpPadsCommand.java b/src/main/java/dev/plex/extras/command/JumpPadsCommand.java index 1f241e3..a455d67 100755 --- a/src/main/java/dev/plex/extras/command/JumpPadsCommand.java +++ b/src/main/java/dev/plex/extras/command/JumpPadsCommand.java @@ -1,9 +1,6 @@ package dev.plex.extras.command; -import dev.plex.command.PlexCommand; -import dev.plex.command.annotation.CommandParameters; -import dev.plex.command.annotation.CommandPermissions; -import dev.plex.command.source.RequiredCommandSource; +import dev.plex.command.SimplePlexCommand; import dev.plex.extras.TFMExtras; import dev.plex.extras.jumppads.JumpPads; import dev.plex.extras.jumppads.Mode; @@ -19,10 +16,17 @@ import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -@CommandParameters(name = "jumppads", usage = "/jumppads [player]", description = "Enables jump pads for yourself or another player. Mode types available: none, regular, enhanced, extreme", aliases = "jp,pads,launchpads") -@CommandPermissions(permission = "plex.tfmextras.jumppads", source = RequiredCommandSource.ANY) -public class JumpPadsCommand extends PlexCommand +public class JumpPadsCommand extends SimplePlexCommand { + public JumpPadsCommand() + { + super(command("jumppads") + .description("Enables jump pads for yourself or another player. Mode types available: none, regular, enhanced, extreme") + .usage("/jumppads [player]") + .aliases("jp,pads,launchpads") + .permission("plex.tfmextras.jumppads") + .build()); + } JumpPads jumpPads = TFMExtras.getModule().jumpPads; @Override @@ -119,7 +123,7 @@ public class JumpPadsCommand extends PlexCommand } @Override - public @NotNull List smartTabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException + protected @NotNull List suggestions(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException { if (silentCheckPermission(sender, this.getPermission())) { diff --git a/src/main/java/dev/plex/extras/command/OrbitCommand.java b/src/main/java/dev/plex/extras/command/OrbitCommand.java index 26f8090..a770b7e 100644 --- a/src/main/java/dev/plex/extras/command/OrbitCommand.java +++ b/src/main/java/dev/plex/extras/command/OrbitCommand.java @@ -1,9 +1,7 @@ package dev.plex.extras.command; import com.google.common.collect.ImmutableList; -import dev.plex.command.PlexCommand; -import dev.plex.command.annotation.CommandParameters; -import dev.plex.command.annotation.CommandPermissions; +import dev.plex.command.SimplePlexCommand; import dev.plex.extras.TFMExtras; import net.kyori.adventure.text.Component; import org.bukkit.command.CommandSender; @@ -19,10 +17,16 @@ import java.util.Map; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; -@CommandParameters(name = "orbit", description = "Accelerates the player at a super fast rate", usage = "/ [< | stop>]") -@CommandPermissions(permission = "plex.tfmextras.orbit") -public class OrbitCommand extends PlexCommand +public class OrbitCommand extends SimplePlexCommand { + public OrbitCommand() + { + super(command("orbit") + .description("Accelerates the player at a super fast rate") + .usage("/ [< | stop>]") + .permission("plex.tfmextras.orbit") + .build()); + } private static final Map isOrbited = new ConcurrentHashMap<>(); @Override @@ -66,7 +70,7 @@ public class OrbitCommand extends PlexCommand } @Override - public @NotNull List smartTabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException + protected @NotNull List suggestions(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException { if (args.length == 1 && silentCheckPermission(sender, this.getPermission())) { diff --git a/src/main/java/dev/plex/extras/command/RandomFishCommand.java b/src/main/java/dev/plex/extras/command/RandomFishCommand.java index da5d4bc..58398ab 100755 --- a/src/main/java/dev/plex/extras/command/RandomFishCommand.java +++ b/src/main/java/dev/plex/extras/command/RandomFishCommand.java @@ -1,8 +1,6 @@ package dev.plex.extras.command; -import dev.plex.command.PlexCommand; -import dev.plex.command.annotation.CommandParameters; -import dev.plex.command.annotation.CommandPermissions; +import dev.plex.command.SimplePlexCommand; import dev.plex.command.source.RequiredCommandSource; import dev.plex.extras.TFMExtras; import java.util.Arrays; @@ -19,10 +17,17 @@ import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -@CommandParameters(name = "randomfish", description = "Spawns a random type of fish at your location", aliases = "rfish,bird") -@CommandPermissions(permission = "plex.tfmextras.randomfish", source = RequiredCommandSource.IN_GAME) -public class RandomFishCommand extends PlexCommand +public class RandomFishCommand extends SimplePlexCommand { + public RandomFishCommand() + { + super(command("randomfish") + .description("Spawns a random type of fish at your location") + .aliases("rfish,bird") + .permission("plex.tfmextras.randomfish") + .source(RequiredCommandSource.IN_GAME) + .build()); + } private static final List FISH_TYPES = Arrays.asList(EntityType.COD, EntityType.SALMON, EntityType.PUFFERFISH, EntityType.TROPICAL_FISH); @Override @@ -44,7 +49,7 @@ public class RandomFishCommand extends PlexCommand } @Override - public @NotNull List smartTabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException + protected @NotNull List suggestions(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException { return Collections.emptyList(); } diff --git a/src/main/resources/tfmextras/messages.yml b/src/main/resources/tfmextras/messages.yml new file mode 100644 index 0000000..86ea25b --- /dev/null +++ b/src/main/resources/tfmextras/messages.yml @@ -0,0 +1,22 @@ +playerOrbited: "{0} - Orbiting {1}" +stoppedOrbiting: "No longer orbiting {0}" +alreadyOrbited: "{0} is already being orbited!" +restrictClownfish: "{0} will {1} be able to use the clownfish." +toggleClownfish: "You will {0} be affected by the clownfish." +emptyAdminInfo: "The admin information section of the config.yml file has not been configured." +cakeLyrics: "But there's no sense crying over every mistake. You just keep on trying till you run out of cake." +areaEffectCloudClear: "{0} - Removing all area effect clouds" +chatCleared: "{0} - Cleared the chat" +attributeList: "All possible attributes: {0}" +modifiedAutoClear: "{0} will {1} have their inventory cleared when they join." +modifiedAutoTeleport: "{0} will {1} be teleported automatically when they join." +playersExpelled: "Pushed away players: {0}" +enchantList: "All possible enchantments are for this item are: {0}" +enchantAddAll: "Added all possible enchantments for this item." +enchantReset: "Removed every enchantment from this item." +enchantMustHoldItem: "You must be holding an enchantable item." +enchantSpecify: "Please specify an enchantment." +enchantInvalid: "Invalid enchantment for this item." +enchantAdd: "Added {0} {1}" +enchantRemove: "Removed {0}" +enchantInvalidLevel: "Invalid enchantment level."