Brigadier

This commit is contained in:
2026-05-19 21:42:07 -04:00
parent 2d064a5a80
commit d333027a03
17 changed files with 228 additions and 148 deletions
+34 -42
View File
@@ -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", "<aqua>{0} - Orbiting {1}", "0 - The command sender", "1 - The person being orbited");
addDefaultMessage("stoppedOrbiting", "<aqua>No longer orbiting {0}", "0 - The person no longer being orbited");
addDefaultMessage("alreadyOrbited", "<red>{0} is already being orbited!", "0 - The person that is already orbited");
addDefaultMessage("restrictClownfish", "<gold>{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", "<gray>You will {0} be affected by the clownfish.", "0 - Whether they had this option toggled (returns: 'no longer', 'now')");
addDefaultMessage("emptyAdminInfo", "<red>The admin information section of the config.yml file has not been configured.");
addDefaultMessage("cakeLyrics", "<rainbow>But there's no sense crying over every mistake. You just keep on trying till you run out of cake.");
addDefaultMessage("areaEffectCloudClear", "<red>{0} - Removing all area effect clouds", "0 - The command sender");
addDefaultMessage("chatCleared", "<red>{0} - Cleared the chat", "0 - The command sender");
addDefaultMessage("attributeList", "<gold>All possible attributes: <yellow>{0}", "0 - The attribute list, each split by a new line");
addDefaultMessage("modifiedAutoClear", "<gold>{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", "<gold>{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", "<gray>Pushed away players: <white><em>{0}", "0 - The list of players");
addDefaultMessage("enchantList", "<dark_gray>All possible enchantments are for this item are: <gray>{0}", "0 - A comma-separated list of enchantment names");
addDefaultMessage("enchantAddAll", "<gray>Added all possible enchantments for this item.");
addDefaultMessage("enchantReset", "<gray>Removed every enchantment from this item.");
addDefaultMessage("enchantMustHoldItem", "<red>You must be holding an enchantable item.");
addDefaultMessage("enchantSpecify", "<red>Please specify an enchantment.");
addDefaultMessage("enchantInvalid", "<red>Invalid enchantment for this item.");
addDefaultMessage("enchantAdd", "<gray>Added {0} {1}", "0 - The enchantment name", "1 - The enchantment level");
addDefaultMessage("enchantRemove", "<gray>Removed {0}", "0 - The enchantment name");
addDefaultMessage("enchantInvalidLevel", "<red>Invalid enchantment level.");
}
@Override
@@ -148,5 +141,4 @@ public class TFMExtras extends PlexModule
return Collections.unmodifiableSet(classes);
}
}
@@ -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<Component> 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<String> smartTabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException
protected @NotNull List<String> suggestions(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException
{
return Collections.emptyList();
}
@@ -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 = "/<command> <player>", 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("/<command> <player>")
.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<String> smartTabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException
protected @NotNull List<String> suggestions(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException
{
return args.length == 1 && silentCheckPermission(sender, this.getPermission()) ? onlinePlayerNames() : ImmutableList.of();
}
@@ -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 = "/<command> [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("/<command> [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<String> smartTabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException
protected @NotNull List<String> suggestions(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException
{
return args.length == 1 && silentCheckPermission(sender, this.getPermission()) ? onlinePlayerNames() : ImmutableList.of();
}
@@ -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<String> smartTabComplete(@NotNull CommandSender commandSender, @NotNull String s, @NotNull String[] strings) throws IllegalArgumentException
protected @NotNull List<String> suggestions(@NotNull CommandSender commandSender, @NotNull String s, @NotNull String[] strings) throws IllegalArgumentException
{
return Collections.emptyList();
}
@@ -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 = "/<command> <player>", 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("/<command> <player>")
.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<String> smartTabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException
protected @NotNull List<String> suggestions(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException
{
return args.length == 1 && silentCheckPermission(sender, this.getPermission()) ? onlinePlayerNames() : ImmutableList.of();
}
@@ -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<String> smartTabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException
protected @NotNull List<String> suggestions(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException
{
return Collections.emptyList();
}
@@ -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<String> smartTabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException
protected @NotNull List<String> suggestions(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException
{
return Collections.emptyList();
}
@@ -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 = "/<command> [<toggle>]")
@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("/<command> [<toggle>]")
.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<String> smartTabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException {
protected @NotNull List<String> suggestions(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException {
if (silentCheckPermission(sender, "plex.tfmextras.clownfish.restrict"))
{
if (args.length == 1)
@@ -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<String> smartTabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException
protected @NotNull List<String> suggestions(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException
{
return Collections.emptyList();
}
@@ -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 = "/<command> <add | reset | list | addall | remove>", 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("/<command> <add | reset | list | addall | remove>")
.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<String> smartTabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException
protected @NotNull List<String> suggestions(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException
{
if (silentCheckPermission(sender, this.getPermission()))
{
@@ -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 = "/<command> <player>")
@CommandPermissions(permission = "plex.tfmextras.emf")
public class EnglishMfCommand extends PlexCommand
public class EnglishMfCommand extends SimplePlexCommand
{
public EnglishMfCommand()
{
super(command("emf")
.description("Speak english.")
.usage("/<command> <player>")
.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<String> smartTabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException
protected @NotNull List<String> suggestions(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException
{
return args.length == 1 && silentCheckPermission(sender, this.getPermission()) ? onlinePlayerNames() : ImmutableList.of();
}
@@ -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 <radius> <strength>", 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 <radius> <strength>")
.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<String> smartTabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args)
protected @NotNull List<String> suggestions(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args)
{
return Collections.emptyList();
}
@@ -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 <mode> [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 <mode> [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<String> smartTabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException
protected @NotNull List<String> suggestions(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException
{
if (silentCheckPermission(sender, this.getPermission()))
{
@@ -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 = "/<command> <target> [<<power> | 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("/<command> <target> [<<power> | stop>]")
.permission("plex.tfmextras.orbit")
.build());
}
private static final Map<UUID, Integer> isOrbited = new ConcurrentHashMap<>();
@Override
@@ -66,7 +70,7 @@ public class OrbitCommand extends PlexCommand
}
@Override
public @NotNull List<String> smartTabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException
protected @NotNull List<String> suggestions(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException
{
if (args.length == 1 && silentCheckPermission(sender, this.getPermission()))
{
@@ -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<EntityType> 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<String> smartTabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException
protected @NotNull List<String> suggestions(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException
{
return Collections.emptyList();
}