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.collect.ImmutableSet;
import com.google.common.reflect.ClassPath; import com.google.common.reflect.ClassPath;
import dev.plex.api.PlexApi; 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.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.extras.jumppads.JumpPads;
import dev.plex.listener.PlexListener; import dev.plex.listener.PlexListener;
import dev.plex.module.PlexModule; import dev.plex.module.PlexModule;
@@ -14,6 +26,7 @@ import java.io.IOException;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.util.Collections; import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.ThreadLocalRandom;
import lombok.Getter; import lombok.Getter;
@@ -41,28 +54,30 @@ public class TFMExtras extends PlexModule
module = this; module = this;
config = new ModuleConfig(this, "tfmextras/config.yml", "config.yml"); config = new ModuleConfig(this, "tfmextras/config.yml", "config.yml");
config.load(); config.load();
loadMessages("tfmextras/messages.yml");
jumpPads = new JumpPads(); jumpPads = new JumpPads();
// plexApi().logging().debug(String.valueOf(config.getInt("server.jumppad_strength")));
} }
@Override @Override
public void enable() public void enable()
{ {
getClassesFrom("dev.plex.extras.command").forEach(aClass -> List.of(
{ new AdminInfoCommand(),
if (PlexCommand.class.isAssignableFrom(aClass) && aClass.isAnnotationPresent(CommandParameters.class) && aClass.isAnnotationPresent(CommandPermissions.class)) new AutoClearCommand(),
{ new AutoTeleportCommand(),
try new CakeCommand(),
{ new CartSitCommand(),
PlexCommand plexCommand = (PlexCommand)aClass.getConstructors()[0].newInstance(); new ClearChatCommand(),
registerCommand(plexCommand); new ClownfishCommand(),
} new CloudClearCommand(),
catch (InstantiationException | IllegalAccessException | InvocationTargetException e) new EjectCommand(),
{ new EnchantCommand(),
throw new RuntimeException(e); new EnglishMfCommand(),
} new ExpelCommand(),
} new JumpPadsCommand(),
}); new OrbitCommand(),
new RandomFishCommand()
).forEach(this::registerCommand);
getClassesFrom("dev.plex.extras.listener").forEach(aClass -> 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 @Override
@@ -148,5 +141,4 @@ public class TFMExtras extends PlexModule
return Collections.unmodifiableSet(classes); return Collections.unmodifiableSet(classes);
} }
} }
@@ -1,8 +1,6 @@
package dev.plex.extras.command; package dev.plex.extras.command;
import dev.plex.command.PlexCommand; import dev.plex.command.SimplePlexCommand;
import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions;
import dev.plex.extras.TFMExtras; import dev.plex.extras.TFMExtras;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@@ -13,10 +11,16 @@ import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@CommandParameters(name = "admininfo", description = "Information on how to apply for admin", aliases = "ai,si,staffinfo") public class AdminInfoCommand extends SimplePlexCommand
@CommandPermissions(permission = "plex.tfmextras.admininfo")
public class AdminInfoCommand extends PlexCommand
{ {
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") private static final List<Component> ADMIN_INFO = TFMExtras.getModule().getConfig().getStringList("server.admininfo")
.stream().map(info -> MiniMessage.miniMessage().deserialize(info)).toList(); .stream().map(info -> MiniMessage.miniMessage().deserialize(info)).toList();
@@ -32,7 +36,7 @@ public class AdminInfoCommand extends PlexCommand
} }
@Override @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(); return Collections.emptyList();
} }
@@ -2,9 +2,7 @@ package dev.plex.extras.command;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import dev.plex.api.player.PlexPlayerView; import dev.plex.api.player.PlexPlayerView;
import dev.plex.command.PlexCommand; import dev.plex.command.SimplePlexCommand;
import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions;
import dev.plex.command.exception.PlayerNotFoundException; import dev.plex.command.exception.PlayerNotFoundException;
import dev.plex.extras.TFMExtras; import dev.plex.extras.TFMExtras;
import java.util.List; import java.util.List;
@@ -14,10 +12,17 @@ import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; 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") public class AutoClearCommand extends SimplePlexCommand
@CommandPermissions(permission = "plex.tfmextras.autoclear")
public class AutoClearCommand extends PlexCommand
{ {
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 @Override
protected Component execute(@NotNull CommandSender sender, @Nullable Player player, @NotNull String[] args) protected Component execute(@NotNull CommandSender sender, @Nullable Player player, @NotNull String[] args)
{ {
@@ -44,7 +49,7 @@ public class AutoClearCommand extends PlexCommand
@Override @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(); 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 com.google.common.collect.ImmutableList;
import dev.plex.api.player.PlexPlayerView; import dev.plex.api.player.PlexPlayerView;
import dev.plex.command.PlexCommand; import dev.plex.command.SimplePlexCommand;
import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions;
import dev.plex.command.exception.PlayerNotFoundException; import dev.plex.command.exception.PlayerNotFoundException;
import dev.plex.extras.TFMExtras; import dev.plex.extras.TFMExtras;
import java.util.List; import java.util.List;
@@ -15,10 +13,17 @@ import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; 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") public class AutoTeleportCommand extends SimplePlexCommand
@CommandPermissions(permission = "plex.tfmextras.autotp")
public class AutoTeleportCommand extends PlexCommand
{ {
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 @Override
protected Component execute(@NotNull CommandSender sender, @Nullable Player player, @NotNull String[] args) protected Component execute(@NotNull CommandSender sender, @Nullable Player player, @NotNull String[] args)
{ {
@@ -50,7 +55,7 @@ public class AutoTeleportCommand extends PlexCommand
} }
@Override @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(); return args.length == 1 && silentCheckPermission(sender, this.getPermission()) ? onlinePlayerNames() : ImmutableList.of();
} }
@@ -1,8 +1,6 @@
package dev.plex.extras.command; package dev.plex.extras.command;
import dev.plex.command.PlexCommand; import dev.plex.command.SimplePlexCommand;
import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions;
import dev.plex.extras.TFMExtras; import dev.plex.extras.TFMExtras;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@@ -17,10 +15,15 @@ import org.bukkit.inventory.meta.ItemMeta;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@CommandParameters(name = "cake", description = "For the people that are still alive - gives a cake to everyone on the server") public class CakeCommand extends SimplePlexCommand
@CommandPermissions(permission = "plex.tfmextras.cake")
public class CakeCommand extends PlexCommand
{ {
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(); private static final ItemStack CAKE = cake();
@Override @Override
@@ -41,7 +44,7 @@ public class CakeCommand extends PlexCommand
} }
@Override @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(); return Collections.emptyList();
} }
@@ -1,9 +1,7 @@
package dev.plex.extras.command; package dev.plex.extras.command;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import dev.plex.command.PlexCommand; import dev.plex.command.SimplePlexCommand;
import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions;
import dev.plex.extras.TFMExtras; import dev.plex.extras.TFMExtras;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
@@ -17,10 +15,17 @@ import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; 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") public class CartSitCommand extends SimplePlexCommand
@CommandPermissions(permission = "plex.tfmextras.cartsit")
public class CartSitCommand extends PlexCommand
{ {
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 @Override
protected Component execute(@NotNull CommandSender sender, @Nullable Player player, @NotNull String[] args) protected Component execute(@NotNull CommandSender sender, @Nullable Player player, @NotNull String[] args)
{ {
@@ -68,7 +73,7 @@ public class CartSitCommand extends PlexCommand
} }
@Override @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(); return args.length == 1 && silentCheckPermission(sender, this.getPermission()) ? onlinePlayerNames() : ImmutableList.of();
} }
@@ -1,8 +1,6 @@
package dev.plex.extras.command; package dev.plex.extras.command;
import dev.plex.command.PlexCommand; import dev.plex.command.SimplePlexCommand;
import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions;
import dev.plex.extras.TFMExtras; import dev.plex.extras.TFMExtras;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@@ -13,10 +11,16 @@ import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@CommandParameters(name = "clearchat", description = "Clears the chat", aliases = "cc,cleanchat,chatclear") public class ClearChatCommand extends SimplePlexCommand
@CommandPermissions(permission = "plex.tfmextras.clearchat")
public class ClearChatCommand extends PlexCommand
{ {
public ClearChatCommand()
{
super(command("clearchat")
.description("Clears the chat")
.aliases("cc,cleanchat,chatclear")
.permission("plex.tfmextras.clearchat")
.build());
}
@Override @Override
protected Component execute(@NotNull CommandSender sender, @Nullable Player player, @NotNull String[] args) protected Component execute(@NotNull CommandSender sender, @Nullable Player player, @NotNull String[] args)
{ {
@@ -36,7 +40,7 @@ public class ClearChatCommand extends PlexCommand
} }
@Override @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(); return Collections.emptyList();
} }
@@ -1,8 +1,6 @@
package dev.plex.extras.command; package dev.plex.extras.command;
import dev.plex.command.PlexCommand; import dev.plex.command.SimplePlexCommand;
import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions;
import dev.plex.extras.TFMExtras; import dev.plex.extras.TFMExtras;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
@@ -18,10 +16,16 @@ import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@CommandParameters(name = "cloudclear", description = "Clears lingering potion area effect clouds", aliases = "clearcloud,aeclear") public class CloudClearCommand extends SimplePlexCommand
@CommandPermissions(permission = "plex.tfmextras.cloudclear")
public class CloudClearCommand extends PlexCommand
{ {
public CloudClearCommand()
{
super(command("cloudclear")
.description("Clears lingering potion area effect clouds")
.aliases("clearcloud,aeclear")
.permission("plex.tfmextras.cloudclear")
.build());
}
@Override @Override
protected Component execute(@NotNull CommandSender sender, @Nullable Player player, @NotNull String[] args) protected Component execute(@NotNull CommandSender sender, @Nullable Player player, @NotNull String[] args)
{ {
@@ -36,7 +40,7 @@ public class CloudClearCommand extends PlexCommand
} }
@Override @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(); return Collections.emptyList();
} }
@@ -1,9 +1,7 @@
package dev.plex.extras.command; package dev.plex.extras.command;
import dev.plex.api.player.PlexPlayerView; import dev.plex.api.player.PlexPlayerView;
import dev.plex.command.PlexCommand; import dev.plex.command.SimplePlexCommand;
import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions;
import dev.plex.command.exception.PlayerNotFoundException; import dev.plex.command.exception.PlayerNotFoundException;
import dev.plex.extras.TFMExtras; import dev.plex.extras.TFMExtras;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
@@ -20,10 +18,16 @@ import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@CommandParameters(name = "clownfish", description = "Gives a player a clownfish capable of knocking people back", usage = "/<command> [<toggle>]") public class ClownfishCommand extends SimplePlexCommand
@CommandPermissions(permission = "plex.tfmextras.clownfish")
public class ClownfishCommand extends PlexCommand
{ {
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 @Override
protected Component execute(@NotNull CommandSender commandSender, @Nullable Player player, @NotNull String[] args) protected Component execute(@NotNull CommandSender commandSender, @Nullable Player player, @NotNull String[] args)
{ {
@@ -92,7 +96,7 @@ public class ClownfishCommand extends PlexCommand
} }
@Override @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 (silentCheckPermission(sender, "plex.tfmextras.clownfish.restrict"))
{ {
if (args.length == 1) if (args.length == 1)
@@ -1,8 +1,6 @@
package dev.plex.extras.command; package dev.plex.extras.command;
import dev.plex.command.PlexCommand; import dev.plex.command.SimplePlexCommand;
import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions;
import dev.plex.command.source.RequiredCommandSource; import dev.plex.command.source.RequiredCommandSource;
import dev.plex.extras.TFMExtras; import dev.plex.extras.TFMExtras;
import java.util.Collections; import java.util.Collections;
@@ -14,10 +12,16 @@ import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@CommandParameters(name = "eject", description = "Removes all passengers from a player") public class EjectCommand extends SimplePlexCommand
@CommandPermissions(permission = "plex.tfmextras.eject", source = RequiredCommandSource.IN_GAME)
public class EjectCommand extends PlexCommand
{ {
public EjectCommand()
{
super(command("eject")
.description("Removes all passengers from a player")
.permission("plex.tfmextras.eject")
.source(RequiredCommandSource.IN_GAME)
.build());
}
@Override @Override
protected Component execute(@NotNull CommandSender sender, @Nullable Player player, @NotNull String[] args) protected Component execute(@NotNull CommandSender sender, @Nullable Player player, @NotNull String[] args)
{ {
@@ -27,7 +31,7 @@ public class EjectCommand extends PlexCommand
} }
@Override @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(); return Collections.emptyList();
} }
@@ -1,9 +1,7 @@
package dev.plex.extras.command; package dev.plex.extras.command;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import dev.plex.command.PlexCommand; import dev.plex.command.SimplePlexCommand;
import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions;
import dev.plex.command.source.RequiredCommandSource; import dev.plex.command.source.RequiredCommandSource;
import io.papermc.paper.registry.RegistryAccess; import io.papermc.paper.registry.RegistryAccess;
@@ -22,10 +20,18 @@ import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@CommandParameters(name = "enchant", description = "Enchants an item", usage = "/<command> <add | reset | list | addall | remove>", aliases = "enchantment") public class EnchantCommand extends SimplePlexCommand
@CommandPermissions(permission = "plex.tfmextras.enchant", source = RequiredCommandSource.IN_GAME)
public class EnchantCommand extends PlexCommand
{ {
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 @Override
protected Component execute(@NotNull CommandSender sender, @Nullable Player player, @NotNull String[] args) protected Component execute(@NotNull CommandSender sender, @Nullable Player player, @NotNull String[] args)
{ {
@@ -120,7 +126,7 @@ public class EnchantCommand extends PlexCommand
} }
@Override @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())) if (silentCheckPermission(sender, this.getPermission()))
{ {
@@ -1,9 +1,7 @@
package dev.plex.extras.command; package dev.plex.extras.command;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import dev.plex.command.PlexCommand; import dev.plex.command.SimplePlexCommand;
import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions;
import dev.plex.extras.TFMExtras; import dev.plex.extras.TFMExtras;
import java.util.List; import java.util.List;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
@@ -17,10 +15,16 @@ import org.jetbrains.annotations.Nullable;
* Credit to "TheDeus-Group" for the messages :) * Credit to "TheDeus-Group" for the messages :)
*/ */
@CommandParameters(name = "emf", description = "Speak english.", usage = "/<command> <player>") public class EnglishMfCommand extends SimplePlexCommand
@CommandPermissions(permission = "plex.tfmextras.emf")
public class EnglishMfCommand extends PlexCommand
{ {
public EnglishMfCommand()
{
super(command("emf")
.description("Speak english.")
.usage("/<command> <player>")
.permission("plex.tfmextras.emf")
.build());
}
@Override @Override
protected Component execute(@NotNull CommandSender sender, @Nullable Player player, @NotNull String[] args) protected Component execute(@NotNull CommandSender sender, @Nullable Player player, @NotNull String[] args)
{ {
@@ -40,7 +44,7 @@ public class EnglishMfCommand extends PlexCommand
} }
@Override @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(); return args.length == 1 && silentCheckPermission(sender, this.getPermission()) ? onlinePlayerNames() : ImmutableList.of();
} }
@@ -1,8 +1,6 @@
package dev.plex.extras.command; package dev.plex.extras.command;
import dev.plex.command.PlexCommand; import dev.plex.command.SimplePlexCommand;
import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage; import net.kyori.adventure.text.minimessage.MiniMessage;
import org.bukkit.Location; import org.bukkit.Location;
@@ -16,10 +14,17 @@ import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@CommandParameters(name = "expel", description = "Pushes away nearby players", usage = "/expel <radius> <strength>", aliases = "push") public class ExpelCommand extends SimplePlexCommand
@CommandPermissions(permission = "plex.tfmextras.expel")
public class ExpelCommand extends PlexCommand
{ {
public ExpelCommand()
{
super(command("expel")
.description("Pushes away nearby players")
.usage("/expel <radius> <strength>")
.aliases("push")
.permission("plex.tfmextras.expel")
.build());
}
@Override @Override
protected Component execute(@NotNull CommandSender sender, @Nullable Player player, @NotNull String[] args) protected Component execute(@NotNull CommandSender sender, @Nullable Player player, @NotNull String[] args)
{ {
@@ -85,7 +90,7 @@ public class ExpelCommand extends PlexCommand
} }
@Override @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(); return Collections.emptyList();
} }
@@ -1,9 +1,6 @@
package dev.plex.extras.command; package dev.plex.extras.command;
import dev.plex.command.PlexCommand; import dev.plex.command.SimplePlexCommand;
import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions;
import dev.plex.command.source.RequiredCommandSource;
import dev.plex.extras.TFMExtras; import dev.plex.extras.TFMExtras;
import dev.plex.extras.jumppads.JumpPads; import dev.plex.extras.jumppads.JumpPads;
import dev.plex.extras.jumppads.Mode; import dev.plex.extras.jumppads.Mode;
@@ -19,10 +16,17 @@ import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; 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") public class JumpPadsCommand extends SimplePlexCommand
@CommandPermissions(permission = "plex.tfmextras.jumppads", source = RequiredCommandSource.ANY)
public class JumpPadsCommand extends PlexCommand
{ {
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; JumpPads jumpPads = TFMExtras.getModule().jumpPads;
@Override @Override
@@ -119,7 +123,7 @@ public class JumpPadsCommand extends PlexCommand
} }
@Override @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())) if (silentCheckPermission(sender, this.getPermission()))
{ {
@@ -1,9 +1,7 @@
package dev.plex.extras.command; package dev.plex.extras.command;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import dev.plex.command.PlexCommand; import dev.plex.command.SimplePlexCommand;
import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions;
import dev.plex.extras.TFMExtras; import dev.plex.extras.TFMExtras;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@@ -19,10 +17,16 @@ import java.util.Map;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
@CommandParameters(name = "orbit", description = "Accelerates the player at a super fast rate", usage = "/<command> <target> [<<power> | stop>]") public class OrbitCommand extends SimplePlexCommand
@CommandPermissions(permission = "plex.tfmextras.orbit")
public class OrbitCommand extends PlexCommand
{ {
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<>(); private static final Map<UUID, Integer> isOrbited = new ConcurrentHashMap<>();
@Override @Override
@@ -66,7 +70,7 @@ public class OrbitCommand extends PlexCommand
} }
@Override @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())) if (args.length == 1 && silentCheckPermission(sender, this.getPermission()))
{ {
@@ -1,8 +1,6 @@
package dev.plex.extras.command; package dev.plex.extras.command;
import dev.plex.command.PlexCommand; import dev.plex.command.SimplePlexCommand;
import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions;
import dev.plex.command.source.RequiredCommandSource; import dev.plex.command.source.RequiredCommandSource;
import dev.plex.extras.TFMExtras; import dev.plex.extras.TFMExtras;
import java.util.Arrays; import java.util.Arrays;
@@ -19,10 +17,17 @@ import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@CommandParameters(name = "randomfish", description = "Spawns a random type of fish at your location", aliases = "rfish,bird") public class RandomFishCommand extends SimplePlexCommand
@CommandPermissions(permission = "plex.tfmextras.randomfish", source = RequiredCommandSource.IN_GAME)
public class RandomFishCommand extends PlexCommand
{ {
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); private static final List<EntityType> FISH_TYPES = Arrays.asList(EntityType.COD, EntityType.SALMON, EntityType.PUFFERFISH, EntityType.TROPICAL_FISH);
@Override @Override
@@ -44,7 +49,7 @@ public class RandomFishCommand extends PlexCommand
} }
@Override @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(); return Collections.emptyList();
} }
+22
View File
@@ -0,0 +1,22 @@
playerOrbited: "<aqua>{0} - Orbiting {1}"
stoppedOrbiting: "<aqua>No longer orbiting {0}"
alreadyOrbited: "<red>{0} is already being orbited!"
restrictClownfish: "<gold>{0} will {1} be able to use the clownfish."
toggleClownfish: "<gray>You will {0} be affected by the clownfish."
emptyAdminInfo: "<red>The admin information section of the config.yml file has not been configured."
cakeLyrics: "<rainbow>But there's no sense crying over every mistake. You just keep on trying till you run out of cake."
areaEffectCloudClear: "<red>{0} - Removing all area effect clouds"
chatCleared: "<red>{0} - Cleared the chat"
attributeList: "<gold>All possible attributes: <yellow>{0}"
modifiedAutoClear: "<gold>{0} will {1} have their inventory cleared when they join."
modifiedAutoTeleport: "<gold>{0} will {1} be teleported automatically when they join."
playersExpelled: "<gray>Pushed away players: <white><em>{0}"
enchantList: "<dark_gray>All possible enchantments are for this item are: <gray>{0}"
enchantAddAll: "<gray>Added all possible enchantments for this item."
enchantReset: "<gray>Removed every enchantment from this item."
enchantMustHoldItem: "<red>You must be holding an enchantable item."
enchantSpecify: "<red>Please specify an enchantment."
enchantInvalid: "<red>Invalid enchantment for this item."
enchantAdd: "<gray>Added {0} {1}"
enchantRemove: "<gray>Removed {0}"
enchantInvalidLevel: "<red>Invalid enchantment level."