From 24456458dea7b8743f5201f4cb06825a49aa360d Mon Sep 17 00:00:00 2001 From: zOnlyKroks Date: Sat, 21 Jan 2023 16:18:47 +0100 Subject: [PATCH 01/16] Rework two commands --- src/de/steamwar/bungeecore/BungeeCore.java | 4 +- .../bungeecore/commands/BauCommand.java | 7 +- .../bungeecore/commands/HelpCommand.java | 107 ++++++++---------- .../bungeecore/commands/TeamchatCommand.java | 18 ++- 4 files changed, 65 insertions(+), 71 deletions(-) diff --git a/src/de/steamwar/bungeecore/BungeeCore.java b/src/de/steamwar/bungeecore/BungeeCore.java index 6d3a3d7..f9e937c 100644 --- a/src/de/steamwar/bungeecore/BungeeCore.java +++ b/src/de/steamwar/bungeecore/BungeeCore.java @@ -136,7 +136,7 @@ public class BungeeCore extends Plugin { new KickCommand(); new JoinmeCommand(); new TpCommand(); - new HelpCommand(); + HelpCommand helpCommand = new HelpCommand(); new TeamCommand(); new ServerTeamchatCommand(); new DevCommand(); @@ -176,7 +176,7 @@ public class BungeeCore extends Plugin { new PunishmentCommand("note", Punishment.PunishmentType.Note); if(!EVENT_MODE){ - new BauCommand(); + new BauCommand(helpCommand); new WebpasswordCommand(); new FightCommand(); new ChallengeCommand(); diff --git a/src/de/steamwar/bungeecore/commands/BauCommand.java b/src/de/steamwar/bungeecore/commands/BauCommand.java index 06dc3bc..7bf45b9 100644 --- a/src/de/steamwar/bungeecore/commands/BauCommand.java +++ b/src/de/steamwar/bungeecore/commands/BauCommand.java @@ -41,13 +41,16 @@ import java.util.Map; public class BauCommand extends SWCommand { - public BauCommand(){ + private final HelpCommand command; + + public BauCommand(HelpCommand command){ super("bau", null, "b", "build", "gs"); + this.command = command; } @Register(help = true) public void genericHelp(ProxiedPlayer p, String... args) { - HelpCommand.sendBauHelp(ChatSender.of(p)); + this.command.sendBauHelp(p); } @Register diff --git a/src/de/steamwar/bungeecore/commands/HelpCommand.java b/src/de/steamwar/bungeecore/commands/HelpCommand.java index d3fb3fe..7da1ba7 100644 --- a/src/de/steamwar/bungeecore/commands/HelpCommand.java +++ b/src/de/steamwar/bungeecore/commands/HelpCommand.java @@ -20,72 +20,61 @@ package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.Message; +import de.steamwar.command.SWCommand; import de.steamwar.messages.ChatSender; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.chat.ClickEvent; +import net.md_5.bungee.api.connection.ProxiedPlayer; +import net.md_5.bungee.protocol.packet.Chat; -public class HelpCommand extends BasicCommand { +public class HelpCommand extends SWCommand { public HelpCommand() { super("help", "", "?"); } - @Override - public void execute(CommandSender s, String[] args) { - ChatSender sender = ChatSender.of(s); - if (args.length < 1) { - printPage(sender, ClickEvent.Action.RUN_COMMAND, - "HELP_LOBBY", "/l", - "HELP_BAU", "/build", - "HELP_BAUSERVER", "/help build", - "HELP_FIGHT", "/fight", - "HELP_CHALLENGE", "/challenge", - "HELP_HISTORIC", "/historic", - "HELP_TEAM", "/team", - "HELP_JOIN", "/join", - "HELP_LOCAL", "/local"); - }else if (args[0].equalsIgnoreCase("buildserver")) { - sendBauHelp(sender); - }else if (args[0].equalsIgnoreCase("build")) { - bauHelpGroup(sender, args); - } - } + @Register + public void genericCommand(ProxiedPlayer player) { + ChatSender sender = ChatSender.of(player); - private static void bauHelpGroup(ChatSender sender, String[] args) { - if (args.length < 2) { - sendBauHelpGroup(sender); - return; - } - - switch (args[1].toLowerCase()) { - case "admin": - case "owner": - case "bauwelt": - sender.system("HELP_BAU_GROUP_ADMIN_TITLE"); - sendBauHelp(sender); - return; - case "world": - printPage(sender, "HELP_BAU_GROUP_WORLD_TITLE", "HELP_TNT", "HELP_FIRE", "HELP_FREEZE", "HELP_TPSLIMIT", "HELP_PROTECT", "HELP_RESET"); - return; - case "player": - printPage(sender, "HELP_BAU_GROUP_PLAYER_TITLE", "HELP_SPEED", "HELP_NV", "HELP_WV", "HELP_DEBUGSTICK", "HELP_TRACE", "HELP_LOADER"); - return; - case "worldedit": - case "we": - case "world-edit": - case "edit": - printPage(sender, "HELP_BAU_GROUP_WE_TITLE", "HELP_WE_POS1", "HELP_WE_POS2", "HELP_WE_COPY", "HELP_WE_PASTE", "HELP_WE_FLOPY", "HELP_WE_FLOPYP", "HELP_WE_ROTATE_90", "HELP_WE_ROTATE_180", "HELP_WE_ROTATE_N90"); - return; - case "other": - printPage(sender, "HELP_BAU_GROUP_OTHER_TITLE", "HELP_TESTBLOCK", "HELP_SKULL", "HELP_BAUINFO"); - return; - default: - sendBauHelpGroup(sender); - } - } - - private static void sendBauHelpGroup(ChatSender sender) { printPage(sender, ClickEvent.Action.RUN_COMMAND, + "HELP_LOBBY", "/l", + "HELP_BAU", "/build", + "HELP_BAUSERVER", "/help build", + "HELP_FIGHT", "/fight", + "HELP_CHALLENGE", "/challenge", + "HELP_HISTORIC", "/historic", + "HELP_TEAM", "/team", + "HELP_JOIN", "/join", + "HELP_LOCAL", "/local"); + } + + @Register({"build","world"}) + public void buildWorld(ProxiedPlayer player) { + printPage(ChatSender.of(player), "HELP_BAU_GROUP_WORLD_TITLE", "HELP_TNT", "HELP_FIRE", "HELP_FREEZE", "HELP_TPSLIMIT", "HELP_PROTECT", "HELP_RESET"); + } + + @Register({"build","player"}) + public void buildPlayer(ProxiedPlayer player) { + printPage(ChatSender.of(player), "HELP_BAU_GROUP_PLAYER_TITLE", "HELP_SPEED", "HELP_NV", "HELP_WV", "HELP_DEBUGSTICK", "HELP_TRACE", "HELP_LOADER"); + } + + @Register({"build","worldedit"}) + @Register({"build","we"}) + @Register({"build","world-edit"}) + @Register({"build","edit"}) + public void buildWorldedit(ProxiedPlayer player) { + printPage(ChatSender.of(player), "HELP_BAU_GROUP_WE_TITLE", "HELP_WE_POS1", "HELP_WE_POS2", "HELP_WE_COPY", "HELP_WE_PASTE", "HELP_WE_FLOPY", "HELP_WE_FLOPYP", "HELP_WE_ROTATE_90", "HELP_WE_ROTATE_180", "HELP_WE_ROTATE_N90"); + } + + @Register({"build","other"}) + public void buildOther(ProxiedPlayer player) { + printPage(ChatSender.of(player), "HELP_BAU_GROUP_OTHER_TITLE", "HELP_TESTBLOCK", "HELP_SKULL", "HELP_BAUINFO"); + } + + @Register("build") + public void sendBauHelpGroup(ProxiedPlayer player) { + printPage(ChatSender.of(player), ClickEvent.Action.RUN_COMMAND, "HELP_BAU_GROUP_ADMIN", "/help build admin", "HELP_BAU_GROUP_WORLD", "/help build world", "HELP_BAU_GROUP_PLAYER", "/help build player", @@ -93,8 +82,12 @@ public class HelpCommand extends BasicCommand { "HELP_BAU_GROUP_OTHER", "/help build other"); } - static void sendBauHelp(ChatSender sender) { - printPage(sender, ClickEvent.Action.SUGGEST_COMMAND, + @Register("buildserver") + @Register({"build","admin"}) + @Register({"build","owner"}) + @Register({"build","bauwelt"}) + public void sendBauHelp(ProxiedPlayer player) { + printPage(ChatSender.of(player), ClickEvent.Action.SUGGEST_COMMAND, "HELP_BAU_TP", "/build tp ", "HELP_BAU_ADDMEMBER", "/build addmember ", "HELP_BAU_DELMEMBER", "/build delmember ", diff --git a/src/de/steamwar/bungeecore/commands/TeamchatCommand.java b/src/de/steamwar/bungeecore/commands/TeamchatCommand.java index 60e57dc..8d5e3e3 100644 --- a/src/de/steamwar/bungeecore/commands/TeamchatCommand.java +++ b/src/de/steamwar/bungeecore/commands/TeamchatCommand.java @@ -21,29 +21,27 @@ package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.listeners.ChatListener; import de.steamwar.bungeecore.sql.SteamwarUser; +import de.steamwar.command.SWCommand; import de.steamwar.messages.ChatSender; import net.md_5.bungee.api.CommandSender; +import net.md_5.bungee.api.connection.ProxiedPlayer; -public class TeamchatCommand extends BasicCommand { +public class TeamchatCommand extends SWCommand { public TeamchatCommand() { super("tc", "","teamchat"); } - @Override - public void execute(CommandSender s, String[] args) { - ChatSender sender = ChatSender.of(s); - if(args.length == 0){ - sender.system("TC_USAGE"); - return; - } - + @Register + public void genericCommand(ProxiedPlayer player, @ErrorMessage(value = "TC_USAGE", allowEAs = false) String... args) { + ChatSender sender = ChatSender.of(player); SteamwarUser user = sender.user(); + if(user.getTeam() == 0){ sender.system("TC_NO_TEAM"); return; } - ChatListener.sendChat(sender, ChatSender.allReceivers().filter(player -> player.user().getTeam() == user.getTeam()), "CHAT_TEAM", null, String.join(" ", args)); + ChatListener.sendChat(sender, ChatSender.allReceivers().filter(p -> p.user().getTeam() == user.getTeam()), "CHAT_TEAM", null, String.join(" ", args)); } } From 9f9d0820420eb8b3f92b0b857ea2772a2b78e56b Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 21 Jan 2023 16:49:39 +0100 Subject: [PATCH 02/16] Update TpCommand --- .../bungeecore/commands/TpCommand.java | 81 ++++++++++++------- 1 file changed, 50 insertions(+), 31 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/TpCommand.java b/src/de/steamwar/bungeecore/commands/TpCommand.java index de61885..d9dd23d 100644 --- a/src/de/steamwar/bungeecore/commands/TpCommand.java +++ b/src/de/steamwar/bungeecore/commands/TpCommand.java @@ -22,6 +22,8 @@ package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.*; import de.steamwar.bungeecore.sql.*; import de.steamwar.bungeecore.util.Chat19; +import de.steamwar.command.SWCommand; +import de.steamwar.command.TypeMapper; import de.steamwar.messages.ChatSender; import net.md_5.bungee.BungeeCord; import net.md_5.bungee.api.CommandSender; @@ -30,45 +32,62 @@ import net.md_5.bungee.api.config.ServerInfo; import net.md_5.bungee.api.connection.ProxiedPlayer; import java.util.ArrayList; +import java.util.Collection; +import java.util.List; -public class TpCommand extends BasicCommand { +public class TpCommand extends SWCommand { public TpCommand(){ super("join", null, "tp", "teleport"); } - @Override - public void execute(CommandSender s, String[] args) { - if(!(s instanceof ProxiedPlayer)) - return; - ProxiedPlayer player = (ProxiedPlayer) s; - - ChatSender sender = ChatSender.of(player); - if(args.length == 0){ - if(Event.get() == null) - sender.system("TP_USAGE"); - else - sender.system("TP_USAGE_EVENT"); - return; - } - - ServerInfo server = getTarget(args[0]); - boolean onTeamServer = Storage.teamServers.containsValue(player.getServer().getInfo()); - - //Give control of teleport command to server - if (server == player.getServer().getInfo() || onTeamServer || server == null) { - Chat19.chat(player, "/tp " + String.join(" ", args)); - return; - } - - teleport(player, server); + @Register + public void genericCommand(ProxiedPlayer p) { + ChatSender.of(p).system(Event.get() == null ? "TP_USAGE" : "TP_USAGE_EVENT"); } - @Override - public Iterable onTabComplete(CommandSender commandSender, String[] args) { - if(args.length > 0) - return allPlayers(args[args.length - 1]); - return new ArrayList<>(); + @Register + public void teleportCommand(ProxiedPlayer p, @Mapper("to") String to, String... rest) { + ServerInfo server = getTarget(to); + + //Give control of teleport command to server + if (server == p.getServer().getInfo() || server == null) { + if (rest.length == 0) { + Chat19.chat(p, "/tp " + to); + } else { + Chat19.chat(p, "/tp " + to + " " + String.join(" ", rest)); + } + return; + } + + teleport(p, server); + } + + @Mapper("to") + @Cached(cacheDuration = 10, global = true) + public TypeMapper tabCompleter() { + return new TypeMapper() { + @Override + public String map(CommandSender commandSender, String[] previousArguments, String s) { + return s; + } + + @Override + public Collection tabCompletes(CommandSender sender, String[] previousArguments, String s) { + List list = new ArrayList<>(); + for (ProxiedPlayer player : BungeeCord.getInstance().getPlayers()) { + list.add(player.getName()); + } + if (Event.get() != null) { + EventStarter.getEventServer().keySet().forEach(teamId -> { + Team team = Team.get(teamId); + list.add(team.getTeamName()); + list.add(team.getTeamKuerzel()); + }); + } + return list; + } + }; } public static void teleport(ProxiedPlayer player, ServerInfo server){ From 29945a351bb8ae227053a07b9c815e95125fdab7 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 21 Jan 2023 22:17:41 +0100 Subject: [PATCH 03/16] Update EventCommand --- .../bungeecore/commands/EventCommand.java | 75 ++++++++++--------- 1 file changed, 39 insertions(+), 36 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/EventCommand.java b/src/de/steamwar/bungeecore/commands/EventCommand.java index 75f718f..966ae06 100644 --- a/src/de/steamwar/bungeecore/commands/EventCommand.java +++ b/src/de/steamwar/bungeecore/commands/EventCommand.java @@ -21,54 +21,33 @@ package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.*; import de.steamwar.bungeecore.sql.*; -import net.md_5.bungee.api.CommandSender; +import de.steamwar.command.SWCommand; +import de.steamwar.command.SWCommandUtils; +import de.steamwar.command.TypeMapper; +import de.steamwar.command.TypeValidator; import net.md_5.bungee.api.connection.ProxiedPlayer; import java.time.Instant; import java.time.format.DateTimeFormatter; +import java.util.Arrays; +import java.util.Collection; import java.util.List; import java.util.Set; +import java.util.stream.Collectors; -public class EventCommand extends BasicCommand { +public class EventCommand extends SWCommand { public EventCommand() { - super("event", ""); + super("event"); } - @Override - public void execute(CommandSender sender, String[] args) { - if(!(sender instanceof ProxiedPlayer)) - return; - ProxiedPlayer player = (ProxiedPlayer) sender; - - Event currentEvent = Event.get(); - - if(currentEvent == null) { - noCurrentEvent(player); - return; - } - - if(args.length != 1){ - eventOverview(player, currentEvent); - return; - } - - Team team = Team.get(args[0]); - if(team == null){ - Message.send("EVENT_NO_TEAM", player); - return; - } - - Subserver eventArena = EventStarter.getEventServer().get(team.getTeamId()); - if(eventArena == null || !Subserver.getServerList().contains(eventArena)){ - Message.send("EVENT_NO_FIGHT_TEAM", player); - return; - } - - SubserverSystem.sendPlayer(eventArena, player); + @Validator("noEvent") + public TypeValidator noEventValidator() { + return (sender, value, messageSender) -> Event.get() == null; } - private void noCurrentEvent(ProxiedPlayer player){ + @Register + public void noCurrentEvent(@Validator("noEvent") ProxiedPlayer player){ Message.send("EVENT_NO_CURRENT", player); List coming = Event.getComing(); Instant now = Instant.now(); @@ -99,7 +78,9 @@ public class EventCommand extends BasicCommand { } } - private void eventOverview(ProxiedPlayer player, Event currentEvent){ + @Register + public void eventOverview(@Validator(value = "noEvent", invert = true) ProxiedPlayer player) { + Event currentEvent = Event.get(); Message.send("EVENT_USAGE", player); List fights = EventFight.getEvent(currentEvent.getEventID()); @@ -129,4 +110,26 @@ public class EventCommand extends BasicCommand { BungeeCore.send(player, fline.toString()); } } + + @Register + public void eventWithTeam(@Validator(value = "noEvent", invert = true) ProxiedPlayer player, @ErrorMessage("EVENT_NO_TEAM") Team team) { + Subserver eventArena = EventStarter.getEventServer().get(team.getTeamId()); + if(eventArena == null || !Subserver.getServerList().contains(eventArena)){ + Message.send("EVENT_NO_FIGHT_TEAM", player); + return; + } + SubserverSystem.sendPlayer(eventArena, player); + } + + @ClassMapper(Team.class) + @Cached(cacheDuration = 10, global = true) + public TypeMapper teamMapper() { + return SWCommandUtils.createMapper(Team::get, s -> EventStarter.getEventServer() + .keySet() + .stream() + .map(Team::get) + .map(t -> Arrays.asList(t.getTeamKuerzel(), t.getTeamColor())) + .flatMap(Collection::stream) + .collect(Collectors.toList())); + } } From 647702c0b0a29593de866c0a2e480f8279b01fd4 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 21 Jan 2023 22:22:55 +0100 Subject: [PATCH 04/16] Update JoinmeCommand --- .../bungeecore/commands/JoinmeCommand.java | 98 ++++++++----------- 1 file changed, 41 insertions(+), 57 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/JoinmeCommand.java b/src/de/steamwar/bungeecore/commands/JoinmeCommand.java index e897ba0..7f966fd 100644 --- a/src/de/steamwar/bungeecore/commands/JoinmeCommand.java +++ b/src/de/steamwar/bungeecore/commands/JoinmeCommand.java @@ -21,77 +21,61 @@ package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.*; import de.steamwar.bungeecore.sql.BauweltMember; -import net.md_5.bungee.api.CommandSender; -import net.md_5.bungee.api.ProxyServer; +import de.steamwar.command.SWCommand; import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.config.ServerInfo; import net.md_5.bungee.api.connection.ProxiedPlayer; -import java.util.ArrayList; - -public class JoinmeCommand extends BasicCommand { +public class JoinmeCommand extends SWCommand { public JoinmeCommand() { - super("joinme", ""); + super("joinme"); } - @Override - public void execute(CommandSender sender, String[] args) { - if(sender instanceof ProxiedPlayer) { - ProxiedPlayer player = (ProxiedPlayer) sender; + @Register(description = "JOINME_USAGE") + public void genericCommand(ProxiedPlayer player) { + if (!player.hasPermission("bungeecore.joinme")) return; + Message.broadcast("JOINME_BROADCAST", "JOINME_BROADCAST_HOVER", + new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join " + player.getName()), player.getName(), player.getServer().getInfo().getName()); + } - if (args.length == 0 && player.hasPermission("bungeecore.joinme")) { - Message.broadcast("JOINME_BROADCAST", "JOINME_BROADCAST_HOVER" - , new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join " + player.getName()), player.getName(), player.getServer().getInfo().getName()); - } else if (args.length == 1) { - ProxiedPlayer target = ProxyServer.getInstance().getPlayer(args[0]); - if(target == null || !target.isConnected()){ - Message.send("JOINME_PLAYER_OFFLINE", player); - return; - }else if(target.equals(player)){ - Message.send("JOINME_PLAYER_SELF", player); - return; - } - ServerInfo server = target.getServer().getInfo(); - String serverPerm = BungeeCore.serverPermissions.get(server.getName()); - Subserver subserver = Subserver.getSubserver(target); + @Register + public void genericCommand(ProxiedPlayer player, ProxiedPlayer target) { + if(target == null || !target.isConnected()){ + Message.send("JOINME_PLAYER_OFFLINE", player); + return; + }else if(target.equals(player)){ + Message.send("JOINME_PLAYER_SELF", player); + return; + } + ServerInfo server = target.getServer().getInfo(); + String serverPerm = BungeeCore.serverPermissions.get(server.getName()); + Subserver subserver = Subserver.getSubserver(target); - if(subserver != null) { - Servertype type = subserver.getType(); - if (type == Servertype.ARENA) { - SubserverSystem.sendPlayer(subserver, player); - } else if (type == Servertype.BAUSERVER) { - Bauserver bauserver = (Bauserver) subserver; - if (bauserver.getOwner().equals(player.getUniqueId()) || - BauweltMember.getBauMember(bauserver.getOwner(), player.getUniqueId()) != null) { - SubserverSystem.sendPlayer(subserver, player); - } else { - SubserverSystem.sendDeniedMessage(player, bauserver.getOwner()); - Message.send("JOIN_PLAYER_BLOCK", player); - } - } else if(type == Servertype.BUILDER && !player.hasPermission("bungeecore.server.team")) { - Message.send("JOIN_PLAYER_BLOCK", player); - } else { - SubserverSystem.sendPlayer(subserver, player); - } - }else if(serverPerm != null && !player.hasPermission(serverPerm)){ + if(subserver != null) { + Servertype type = subserver.getType(); + if (type == Servertype.ARENA) { + SubserverSystem.sendPlayer(subserver, player); + } else if (type == Servertype.BAUSERVER) { + Bauserver bauserver = (Bauserver) subserver; + if (bauserver.getOwner().equals(player.getUniqueId()) || + BauweltMember.getBauMember(bauserver.getOwner(), player.getUniqueId()) != null) { + SubserverSystem.sendPlayer(subserver, player); + } else { + SubserverSystem.sendDeniedMessage(player, bauserver.getOwner()); Message.send("JOIN_PLAYER_BLOCK", player); - }else if(serverPerm == null && !player.getGroups().contains("team")) { - Message.send("JOIN_PLAYER_BLOCK", player); - }else{ - player.connect(server); } + } else if(type == Servertype.BUILDER && !player.hasPermission("bungeecore.server.team")) { + Message.send("JOIN_PLAYER_BLOCK", player); } else { - Message.send("JOINME_USAGE", player); + SubserverSystem.sendPlayer(subserver, player); } + }else if(serverPerm != null && !player.hasPermission(serverPerm)){ + Message.send("JOIN_PLAYER_BLOCK", player); + }else if(serverPerm == null && !player.getGroups().contains("team")) { + Message.send("JOIN_PLAYER_BLOCK", player); + }else{ + player.connect(server); } } - - @Override - public Iterable onTabComplete(CommandSender commandSender, String[] args) { - if(args.length == 1){ - return allPlayers(args[0]); - } - return new ArrayList<>(); - } } From a15cf2c94e639e1ef09a73d6516bcf9da33885b6 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 21 Jan 2023 22:28:46 +0100 Subject: [PATCH 05/16] Update JoinmeCommand --- .../bungeecore/commands/JoinmeCommand.java | 38 ++++++++++++++++--- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/JoinmeCommand.java b/src/de/steamwar/bungeecore/commands/JoinmeCommand.java index 7f966fd..953655d 100644 --- a/src/de/steamwar/bungeecore/commands/JoinmeCommand.java +++ b/src/de/steamwar/bungeecore/commands/JoinmeCommand.java @@ -21,11 +21,18 @@ package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.*; import de.steamwar.bungeecore.sql.BauweltMember; +import de.steamwar.command.PreviousArguments; import de.steamwar.command.SWCommand; +import de.steamwar.command.TypeMapper; +import net.md_5.bungee.api.CommandSender; +import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.config.ServerInfo; import net.md_5.bungee.api.connection.ProxiedPlayer; +import java.util.Collection; +import java.util.stream.Collectors; + public class JoinmeCommand extends SWCommand { public JoinmeCommand() { @@ -40,11 +47,8 @@ public class JoinmeCommand extends SWCommand { } @Register - public void genericCommand(ProxiedPlayer player, ProxiedPlayer target) { - if(target == null || !target.isConnected()){ - Message.send("JOINME_PLAYER_OFFLINE", player); - return; - }else if(target.equals(player)){ + public void genericCommand(ProxiedPlayer player, @Validator ProxiedPlayer target) { + if (target.equals(player)){ Message.send("JOINME_PLAYER_SELF", player); return; } @@ -78,4 +82,28 @@ public class JoinmeCommand extends SWCommand { player.connect(server); } } + + @ClassMapper(ProxiedPlayer.class) + public TypeMapper playerMapper() { + return new TypeMapper() { + @Override + public ProxiedPlayer map(CommandSender commandSender, String[] previousArguments, String s) { + return ProxyServer.getInstance().getPlayer(s); + } + + @Override + public boolean validate(CommandSender sender, ProxiedPlayer value, MessageSender messageSender) { + if (value == null || !value.isConnected()) { + messageSender.send("JOINME_PLAYER_OFFLINE", sender); + return false; + } + return true; + } + + @Override + public Collection tabCompletes(CommandSender sender, PreviousArguments previousArguments, String s) { + return ProxyServer.getInstance().getPlayers().stream().map(ProxiedPlayer::getName).collect(Collectors.toList()); + } + }; + } } From 88ff8d8e747099e623841825085cacbd7735a595 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Mon, 23 Jan 2023 16:37:08 +0100 Subject: [PATCH 06/16] Update TeamCommand (not finished) --- .../bungeecore/commands/TeamCommand.java | 147 ++++++++---------- 1 file changed, 64 insertions(+), 83 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/TeamCommand.java b/src/de/steamwar/bungeecore/commands/TeamCommand.java index 9ae3799..ce2ee75 100644 --- a/src/de/steamwar/bungeecore/commands/TeamCommand.java +++ b/src/de/steamwar/bungeecore/commands/TeamCommand.java @@ -24,6 +24,7 @@ import de.steamwar.bungeecore.Storage; import de.steamwar.bungeecore.inventory.SWItem; import de.steamwar.bungeecore.inventory.SWListInv; import de.steamwar.bungeecore.sql.*; +import de.steamwar.command.SWCommand; import de.steamwar.messages.ChatSender; import net.md_5.bungee.BungeeCord; import net.md_5.bungee.api.ChatColor; @@ -49,7 +50,7 @@ import java.util.stream.Collectors; import static de.steamwar.bungeecore.Storage.teamInvitations; -public class TeamCommand extends BasicCommand { +public class TeamCommand extends SWCommand { private static final List> COLOR_CODES = new ArrayList<>(); @@ -77,16 +78,17 @@ public class TeamCommand extends BasicCommand { } public TeamCommand() { - super("team", ""); + super("team"); } - private void help(CommandSender sender){ + @Register + public void help(CommandSender sender, String... args){ Message.send("TEAM_HELP_HEADER", sender); Message.send("TEAM_HELP_LIST", sender); Message.send("TEAM_HELP_INFO", sender); - Message.send("TEAM_HELP_TP", sender); if(!(sender instanceof ProxiedPlayer)) return; + Message.send("TEAM_HELP_TP", sender); ProxiedPlayer player = (ProxiedPlayer) sender; SteamwarUser user = SteamwarUser.get(player.getUniqueId()); @@ -111,72 +113,10 @@ public class TeamCommand extends BasicCommand { } } - @Override - public void execute(CommandSender sender, String[] args){ - if(args.length < 1){ - help(sender); - return; - } - - if(!(sender instanceof ProxiedPlayer)) - return; - - ProxiedPlayer player = (ProxiedPlayer) sender; + @Register("create") + public void create(ProxiedPlayer player, String... args){ SteamwarUser user = SteamwarUser.get(player.getUniqueId()); Team team = Team.get(user.getTeam()); - - switch(args[0].toLowerCase()){ - case "create": - create(player, user, team, args); - break; - case "join": - join(player, user, args); - break; - case "stepback": - stepBack(player,user,team); - break; - case "leave": - leave(player, user, team); - break; - case "invite": - invite(player, user, team, args); - break; - case "remove": - remove(player, user, team, args); - break; - case "changekuerzel": - changekuerzel(player, user, team, args); - break; - case "changename": - changename(player, user, team, args); - break; - case "promote": - promote(player, user, team, args); - break; - case "changecolor": - changeColor(player, user, team); - break; - case "info": - info(player, user, team, args); - break; - case "list": - list(player, args); - break; - case "event": - event(player, user, team, args); - break; - case "tp": - tp(player, user, team, args); - break; - case "server": - server(player, user, team, args); - break; - default: - help(player); - } - } - - private void create(ProxiedPlayer player, SteamwarUser user, Team team, String[] args){ if(unwantedInTeam(player, user)) return; @@ -197,7 +137,9 @@ public class TeamCommand extends BasicCommand { Message.send("TEAM_CREATE_CREATED", player, args[2]); } - private void join(ProxiedPlayer player, SteamwarUser user, String[] args){ + @Register("join") + public void join(ProxiedPlayer player, String... args){ + SteamwarUser user = SteamwarUser.get(player.getUniqueId()); if(unwantedInTeam(player, user)) return; @@ -245,7 +187,10 @@ public class TeamCommand extends BasicCommand { Message.send("TEAM_JOIN_JOINED", player, Team.get(t).getTeamName()); } - private void stepBack(ProxiedPlayer player, SteamwarUser user, Team team) { + @Register("stepback") + public void stepBack(ProxiedPlayer player) { + SteamwarUser user = SteamwarUser.get(player.getUniqueId()); + Team team = Team.get(user.getTeam()); if(notLeader(player, user, team)) return; @@ -258,7 +203,10 @@ public class TeamCommand extends BasicCommand { Message.send("TEAM_STEP_BACK", player); } - private void leave(ProxiedPlayer player, SteamwarUser user, Team team){ + @Register("leave") + public void leave(ProxiedPlayer player){ + SteamwarUser user = SteamwarUser.get(player.getUniqueId()); + Team team = Team.get(user.getTeam()); if(notInTeam(player, user)) return; @@ -278,7 +226,10 @@ public class TeamCommand extends BasicCommand { } - private void invite(ProxiedPlayer player, SteamwarUser user, Team team, String[] args){ + @Register("invite") + public void invite(ProxiedPlayer player, String... args){ + SteamwarUser user = SteamwarUser.get(player.getUniqueId()); + Team team = Team.get(user.getTeam()); if(notLeader(player, user, team)) return; @@ -315,7 +266,10 @@ public class TeamCommand extends BasicCommand { Message.send("TEAM_INVITE_INVITED_TARGET", p, team.getTeamColor(), team.getTeamName()); } - private void remove(ProxiedPlayer player, SteamwarUser user, Team team, String[] args){ + @Register("remove") + public void remove(ProxiedPlayer player, String... args){ + SteamwarUser user = SteamwarUser.get(player.getUniqueId()); + Team team = Team.get(user.getTeam()); if(notLeader(player, user, team)) return; @@ -359,7 +313,10 @@ public class TeamCommand extends BasicCommand { Message.send("TEAM_REMOVE_REMOVED_TARGET", player); } - private void changekuerzel(ProxiedPlayer player, SteamwarUser user, Team team, String[] args){ + @Register("changekurzel") + public void changekuerzel(ProxiedPlayer player, String... args){ + SteamwarUser user = SteamwarUser.get(player.getUniqueId()); + Team team = Team.get(user.getTeam()); if(notLeader(player, user, team)) return; @@ -378,7 +335,10 @@ public class TeamCommand extends BasicCommand { Message.send("TEAM_KUERZEL_CHANGED", player); } - private void changename(ProxiedPlayer player, SteamwarUser user, Team team, String[] args){ + @Register("changename") + public void changename(ProxiedPlayer player, String... args){ + SteamwarUser user = SteamwarUser.get(player.getUniqueId()); + Team team = Team.get(user.getTeam()); if(notLeader(player, user, team)) return; @@ -397,7 +357,10 @@ public class TeamCommand extends BasicCommand { Message.send("TEAM_NAME_CHANGED", player); } - private void promote(ProxiedPlayer player, SteamwarUser user, Team team, String[] args){ + @Register("promote") + public void promote(ProxiedPlayer player, String... args){ + SteamwarUser user = SteamwarUser.get(player.getUniqueId()); + Team team = Team.get(user.getTeam()); if(notLeader(player, user, team)) return; @@ -428,7 +391,10 @@ public class TeamCommand extends BasicCommand { return ProxyServer.getInstance().getPlayer(user.getUuid()) != null ? "§a" + user.getUserName() : "§e" + user.getUserName(); } - private void info(ProxiedPlayer player, SteamwarUser user, Team team, String[] args){ + @Register("info") + public void info(ProxiedPlayer player, String... args){ + SteamwarUser user = SteamwarUser.get(player.getUniqueId()); + Team team = Team.get(user.getTeam()); if(args.length == 1 && user.getTeam() == 0){ Message.send("TEAM_INFO_USAGE", player); return; @@ -469,7 +435,10 @@ public class TeamCommand extends BasicCommand { return sb.toString(); } - private void list(ProxiedPlayer player, String[] args){ + @Register("list") + public void list(ProxiedPlayer player, String... args){ + SteamwarUser user = SteamwarUser.get(player.getUniqueId()); + Team team = Team.get(user.getTeam()); final int TEAMS_PER_PAGE = 10; @@ -520,7 +489,10 @@ public class TeamCommand extends BasicCommand { player.sendMessage(beforePage); } - private void event(ProxiedPlayer player, SteamwarUser user, Team team, String[] args){ + @Register("event") + public void event(ProxiedPlayer player, String[] args){ + SteamwarUser user = SteamwarUser.get(player.getUniqueId()); + Team team = Team.get(user.getTeam()); if(notInTeam(player, user)) return; @@ -563,7 +535,10 @@ public class TeamCommand extends BasicCommand { } } - private void tp(ProxiedPlayer player, SteamwarUser user, Team team, String[] args){ + @Register("tp") + public void tp(ProxiedPlayer player, String... args){ + SteamwarUser user = SteamwarUser.get(player.getUniqueId()); + Team team = Team.get(user.getTeam()); if(args.length == 1){ if(notInTeam(player, user)) return; @@ -609,7 +584,10 @@ public class TeamCommand extends BasicCommand { */ } - private void server(ProxiedPlayer player, SteamwarUser user, Team team, String[] args){ + @Register("server") + public void server(ProxiedPlayer player, String[] args){ + SteamwarUser user = SteamwarUser.get(player.getUniqueId()); + Team team = Team.get(user.getTeam()); if(notLeader(player, user, team)) return; if (user.isPunishedWithMessage(ChatSender.of(player), Punishment.PunishmentType.NoTeamServer)) { @@ -661,7 +639,10 @@ public class TeamCommand extends BasicCommand { } } - private void changeColor(ProxiedPlayer player, SteamwarUser user, Team team) { + @Register("color") + public void changeColor(ProxiedPlayer player) { + SteamwarUser user = SteamwarUser.get(player.getUniqueId()); + Team team = Team.get(user.getTeam()); if(notLeader(player, user, team)) return; @@ -745,7 +726,7 @@ public class TeamCommand extends BasicCommand { return false; } - @Override + // @Override public Iterable onTabComplete(CommandSender commandSender, String[] args){ List tab = new ArrayList<>(); if(args.length == 1){ From d559c61846f21a8bfff69066d87b7a03243a55ce Mon Sep 17 00:00:00 2001 From: yoyosource Date: Mon, 23 Jan 2023 18:00:06 +0100 Subject: [PATCH 07/16] Update TeamCommand (not finished) --- .../bungeecore/commands/TeamCommand.java | 55 +++++-------------- 1 file changed, 15 insertions(+), 40 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/TeamCommand.java b/src/de/steamwar/bungeecore/commands/TeamCommand.java index ce2ee75..3a3b2e9 100644 --- a/src/de/steamwar/bungeecore/commands/TeamCommand.java +++ b/src/de/steamwar/bungeecore/commands/TeamCommand.java @@ -113,28 +113,23 @@ public class TeamCommand extends SWCommand { } } - @Register("create") - public void create(ProxiedPlayer player, String... args){ + @Register(value = "create", description = "TEAM_CREATE_USAGE") + public void create(ProxiedPlayer player, @Length(min = 2, max = 4) @ErrorMessage("TEAM_KUERZEL_LENGHT") String kuerzel, @Length(min = 4, max = 15) @ErrorMessage("TEAM_NAME_LENGHT") String name){ SteamwarUser user = SteamwarUser.get(player.getUniqueId()); Team team = Team.get(user.getTeam()); if(unwantedInTeam(player, user)) return; - if(args.length < 3){ - Message.send("TEAM_CREATE_USAGE", player); - return; - } - - if(checkTeamKuerzel(player, team, args[1])) + if(checkTeamKuerzel(player, team, kuerzel)) return; - if(checkTeamName(player, team, args[2])) + if(checkTeamName(player, team, name)) return; - Team.create(args[1], args[2]); - user.setTeam(Team.get(args[1]).getTeamId()); + Team.create(kuerzel, name); + user.setTeam(Team.get(kuerzel).getTeamId()); user.setLeader(true); - Message.send("TEAM_CREATE_CREATED", player, args[2]); + Message.send("TEAM_CREATE_CREATED", player, name); } @Register("join") @@ -313,8 +308,8 @@ public class TeamCommand extends SWCommand { Message.send("TEAM_REMOVE_REMOVED_TARGET", player); } - @Register("changekurzel") - public void changekuerzel(ProxiedPlayer player, String... args){ + @Register(value = "changekurzel", description = "TEAM_KUERZEL_USAGE") + public void changekuerzel(ProxiedPlayer player, @Length(min = 2, max = 4) @ErrorMessage("TEAM_KUERZEL_LENGHT") String kuerzel){ SteamwarUser user = SteamwarUser.get(player.getUniqueId()); Team team = Team.get(user.getTeam()); if(notLeader(player, user, team)) @@ -323,20 +318,15 @@ public class TeamCommand extends SWCommand { if(notDuringEvent(player)) return; - if(args.length < 2){ - Message.send("TEAM_KUERZEL_USAGE", player); - return; - } - - if(checkTeamKuerzel(player, team, args[1])) + if(checkTeamKuerzel(player, team, kuerzel)) return; - team.setTeamKuerzel(args[1]); + team.setTeamKuerzel(kuerzel); Message.send("TEAM_KUERZEL_CHANGED", player); } - @Register("changename") - public void changename(ProxiedPlayer player, String... args){ + @Register(value = "changename", description = "TEAM_NAME_USAGE") + public void changename(ProxiedPlayer player, @Length(min = 4, max = 15) @ErrorMessage("TEAM_NAME_LENGHT") String name){ SteamwarUser user = SteamwarUser.get(player.getUniqueId()); Team team = Team.get(user.getTeam()); if(notLeader(player, user, team)) @@ -345,15 +335,10 @@ public class TeamCommand extends SWCommand { if(notDuringEvent(player)) return; - if(args.length < 2){ - Message.send("TEAM_NAME_USAGE", player); - return; - } - - if(checkTeamName(player, team, args[1])) + if(checkTeamName(player, team, name)) return; - team.setTeamName(args[1]); + team.setTeamName(name); Message.send("TEAM_NAME_CHANGED", player); } @@ -665,11 +650,6 @@ public class TeamCommand extends SWCommand { } private boolean checkTeamName(ProxiedPlayer player, Team team, String arg){ - if(arg.length() < 4 || arg.length() > 15){ - Message.send("TEAM_NAME_LENGHT", player); - return true; - } - Team t = Team.get(arg); if(t != null && t.getTeamId() != team.getTeamId()){ Message.send("TEAM_NAME_TAKEN", player); @@ -679,11 +659,6 @@ public class TeamCommand extends SWCommand { } private boolean checkTeamKuerzel(ProxiedPlayer player, Team team, String arg){ - if(arg.length() < 2 || arg.length() > 4){ - Message.send("TEAM_KUERZEL_LENGHT", player); - return true; - } - Team t = Team.get(arg); if(t != null && (team == null || t.getTeamId() != team.getTeamId())){ Message.send("TEAM_KUERZEL_TAKEN", player); From 561289b5a679a101aafdab7aedfae4e6af437ec1 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Mon, 23 Jan 2023 18:15:37 +0100 Subject: [PATCH 08/16] Update TeamCommand (not finished) --- .../bungeecore/commands/TeamCommand.java | 119 +++++------------- .../steamwar/messages/BungeeCore.properties | 4 +- .../messages/BungeeCore_de.properties | 4 +- 3 files changed, 33 insertions(+), 94 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/TeamCommand.java b/src/de/steamwar/bungeecore/commands/TeamCommand.java index 3a3b2e9..6185129 100644 --- a/src/de/steamwar/bungeecore/commands/TeamCommand.java +++ b/src/de/steamwar/bungeecore/commands/TeamCommand.java @@ -186,7 +186,7 @@ public class TeamCommand extends SWCommand { public void stepBack(ProxiedPlayer player) { SteamwarUser user = SteamwarUser.get(player.getUniqueId()); Team team = Team.get(user.getTeam()); - if(notLeader(player, user, team)) + if(notLeader(player, user)) return; if(team.size() > 1 && team.getMembers().stream().map(SteamwarUser::get).filter(member -> user != member).noneMatch(SteamwarUser::isLeader)){ @@ -221,22 +221,17 @@ public class TeamCommand extends SWCommand { } - @Register("invite") - public void invite(ProxiedPlayer player, String... args){ + @Register(value = "invite", description = "TEAM_INVITE_USAGE") + public void invite(ProxiedPlayer player, String toInvite){ SteamwarUser user = SteamwarUser.get(player.getUniqueId()); Team team = Team.get(user.getTeam()); - if(notLeader(player, user, team)) + if(notLeader(player, user)) return; if(notDuringEvent(player)) return; - if(args.length != 2){ - Message.send("TEAM_INVITE_USAGE", player); - return; - } - - SteamwarUser target = SteamwarUser.get(args[1]); + SteamwarUser target = SteamwarUser.get(toInvite); if(target == null){ Message.send("TEAM_INVITE_NO_PLAYER", player); return; @@ -255,25 +250,20 @@ public class TeamCommand extends SWCommand { teamInvitations.get(target.getId()).add(team.getTeamId()); - Message.send("TEAM_INVITE_INVITED", player, args[1]); + Message.send("TEAM_INVITE_INVITED", player, toInvite); ProxiedPlayer p = ProxyServer.getInstance().getPlayer(target.getUuid()); if(p != null) Message.send("TEAM_INVITE_INVITED_TARGET", p, team.getTeamColor(), team.getTeamName()); } - @Register("remove") - public void remove(ProxiedPlayer player, String... args){ + @Register(value = "remove", description = "TEAM_REMOVE_USAGE") + public void remove(ProxiedPlayer player, String toRemove){ SteamwarUser user = SteamwarUser.get(player.getUniqueId()); Team team = Team.get(user.getTeam()); - if(notLeader(player, user, team)) + if(notLeader(player, user)) return; - if(args.length != 2){ - Message.send("TEAM_REMOVE_USAGE", player); - return; - } - - SteamwarUser target = SteamwarUser.get(args[1]); + SteamwarUser target = SteamwarUser.get(toRemove); if(target == null){ Message.send("TEAM_REMOVE_NOT_PLAYER", player); return; @@ -312,7 +302,7 @@ public class TeamCommand extends SWCommand { public void changekuerzel(ProxiedPlayer player, @Length(min = 2, max = 4) @ErrorMessage("TEAM_KUERZEL_LENGHT") String kuerzel){ SteamwarUser user = SteamwarUser.get(player.getUniqueId()); Team team = Team.get(user.getTeam()); - if(notLeader(player, user, team)) + if(notLeader(player, user)) return; if(notDuringEvent(player)) @@ -326,10 +316,10 @@ public class TeamCommand extends SWCommand { } @Register(value = "changename", description = "TEAM_NAME_USAGE") - public void changename(ProxiedPlayer player, @Length(min = 4, max = 15) @ErrorMessage("TEAM_NAME_LENGHT") String name){ + public void changename(ProxiedPlayer player, @Length(min = 4, max = 15) @ErrorMessage("TEAM_NAME_LENGTH") String name){ SteamwarUser user = SteamwarUser.get(player.getUniqueId()); Team team = Team.get(user.getTeam()); - if(notLeader(player, user, team)) + if(notLeader(player, user)) return; if(notDuringEvent(player)) @@ -342,24 +332,18 @@ public class TeamCommand extends SWCommand { Message.send("TEAM_NAME_CHANGED", player); } - @Register("promote") - public void promote(ProxiedPlayer player, String... args){ + @Register(value = "promote", description = "TEAM_LEADER_USAGE") + public void promote(ProxiedPlayer player, String toPromote){ SteamwarUser user = SteamwarUser.get(player.getUniqueId()); - Team team = Team.get(user.getTeam()); - if(notLeader(player, user, team)) + if(notLeader(player, user)) return; if(notDuringEvent(player)) return; - if(args.length < 2){ - Message.send("TEAM_LEADER_USAGE", player); - return; - } - - SteamwarUser target = SteamwarUser.get(args[1]); + SteamwarUser target = SteamwarUser.get(toPromote); if(target == null){ - Message.send("TEAM_LEADER_NOT_USER", player, args[1]); + Message.send("TEAM_LEADER_NOT_USER", player, toPromote); return; } @@ -369,7 +353,7 @@ public class TeamCommand extends SWCommand { } target.setLeader(true); - Message.send("TEAM_LEADER_PROMOTED", player, args[1]); + Message.send("TEAM_LEADER_PROMOTED", player, toPromote); } private String playerName(SteamwarUser user){ @@ -421,23 +405,9 @@ public class TeamCommand extends SWCommand { } @Register("list") - public void list(ProxiedPlayer player, String... args){ - SteamwarUser user = SteamwarUser.get(player.getUniqueId()); - Team team = Team.get(user.getTeam()); - + public void list(ProxiedPlayer player, @Min(intValue = 1) @OptionalValue("1") @ErrorMessage("TEAM_LIST_NOT_PAGE") int page){ final int TEAMS_PER_PAGE = 10; - int page; - if(args.length > 1){ - try{ - page = Integer.parseInt(args[1]); - }catch(NumberFormatException e){ - Message.send("TEAM_LIST_NOT_PAGE", player); - return; - } - }else - page = 1; - List all = Team.getAll(); final int lastPage = ((all.size() - 1) / 10) + 1; if(page < 1 || page > lastPage){ @@ -493,7 +463,7 @@ public class TeamCommand extends SWCommand { return; } - if(notLeader(player, user, team)) + if(notLeader(player, user)) return; if(notDuringEvent(player)) @@ -569,20 +539,16 @@ public class TeamCommand extends SWCommand { */ } - @Register("server") - public void server(ProxiedPlayer player, String[] args){ + @Register(value = "server", description = "TEAM_SERVER_USAGE") + public void server(ProxiedPlayer player, String server, @Min(intValue = 1) @Max(intValue = 65535) @ErrorMessage("TEAM_SERVER_PORT_INVALID") int port){ SteamwarUser user = SteamwarUser.get(player.getUniqueId()); Team team = Team.get(user.getTeam()); - if(notLeader(player, user, team)) + if(notLeader(player, user)) return; if (user.isPunishedWithMessage(ChatSender.of(player), Punishment.PunishmentType.NoTeamServer)) { return; } - if (args.length < 2) { - Message.send("TEAM_SERVER_USAGE", player); - return; - } - String server = args[1]; + try { if (isLocalhost(InetAddress.getByName(server))) { Message.send("TEAM_SERVER_ADDRESS_INVALID", player); @@ -592,19 +558,7 @@ public class TeamCommand extends SWCommand { Message.send("TEAM_SERVER_ADDRESS_INVALID", player); return; } - int port = 25565; - if (args.length == 3) { - try { - port = Integer.parseInt(args[2]); - if (port < 1 || port > 65535) { - Message.send("TEAM_SERVER_PORT_INVALID", player); - return; - } - } catch (NumberFormatException e) { - Message.send("TEAM_SERVER_PORT_INVALID", player); - return; - } - } + team.setAddress(server); team.setPort(port); Storage.teamServers.remove(team.getTeamId()); @@ -628,7 +582,7 @@ public class TeamCommand extends SWCommand { public void changeColor(ProxiedPlayer player) { SteamwarUser user = SteamwarUser.get(player.getUniqueId()); Team team = Team.get(user.getTeam()); - if(notLeader(player, user, team)) + if(notLeader(player, user)) return; if(notDuringEvent(player)) @@ -683,7 +637,7 @@ public class TeamCommand extends SWCommand { return false; } - private boolean notLeader(ProxiedPlayer player, SteamwarUser user, Team team){ + private boolean notLeader(ProxiedPlayer player, SteamwarUser user){ if(notInTeam(player, user)) return true; if(!user.isLeader()){ @@ -704,22 +658,7 @@ public class TeamCommand extends SWCommand { // @Override public Iterable onTabComplete(CommandSender commandSender, String[] args){ List tab = new ArrayList<>(); - if(args.length == 1){ - tab.add("create"); - tab.add("join"); - tab.add("invite"); - tab.add("stepback"); - tab.add("leave"); - tab.add("info"); - tab.add("remove"); - tab.add("event"); - tab.add("changekuerzel"); - tab.add("changename"); - tab.add("promote"); - tab.add("changecolor"); - tab.add("tp"); - tab.add("server"); - }else if(args.length == 2){ + if(args.length == 2){ if(args[1].equalsIgnoreCase("event")){ List coming = Event.getComing(); coming.forEach(event -> tab.add(event.getEventName())); diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 23060c2..ec1d480 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -444,13 +444,13 @@ TEAM_REMOVE_REMOVED_TARGET=§cYou were removed from the team. #Team Kuerzel TEAM_KUERZEL_USAGE=§8/§7team changekuerzel §8[§eshortcut§8] TEAM_KUERZEL_CHANGED=§7You changed your teams shortcut! -TEAM_KUERZEL_LENGHT=§cA team shortcut has to consist of 2 to 4 characters. +TEAM_KUERZEL_LENGTH=§cA team shortcut has to consist of 2 to 4 characters. TEAM_KUERZEL_TAKEN=§cThere is already a team with that shortcut. #Team Name TEAM_NAME_USAGE=§8/§7team changename §8[§eteam name§8] TEAM_NAME_CHANGED=§7You have renamed your team! -TEAM_NAME_LENGHT=§cA team name has to consist of 4 to 15 characters. +TEAM_NAME_LENGTH=§cA team name has to consist of 4 to 15 characters. TEAM_NAME_TAKEN=§cThere is already a team with that name. #Team Leader diff --git a/src/de/steamwar/messages/BungeeCore_de.properties b/src/de/steamwar/messages/BungeeCore_de.properties index f9b11af..8cfc82f 100644 --- a/src/de/steamwar/messages/BungeeCore_de.properties +++ b/src/de/steamwar/messages/BungeeCore_de.properties @@ -422,13 +422,13 @@ TEAM_REMOVE_REMOVED_TARGET=§cDu wurdest aus dem Team entfernt. #Team Kuerzel TEAM_KUERZEL_USAGE=§8/§7team changekuerzel §8[§eTeamkürzel§8] TEAM_KUERZEL_CHANGED=§7Du hast das Kürzel des Teams geändert! -TEAM_KUERZEL_LENGHT=§cEin Teamkürzel muss aus 2 bis 4 Buchstaben bestehen. +TEAM_KUERZEL_LENGTH=§cEin Teamkürzel muss aus 2 bis 4 Buchstaben bestehen. TEAM_KUERZEL_TAKEN=§cEs gibt bereits ein Team mit diesem Namen. #Team Name TEAM_NAME_USAGE=§8/§7team changename §8[§eTeamname§8] TEAM_NAME_CHANGED=§7Du hast das Team umbenannt! -TEAM_NAME_LENGHT=§cEin Teamname muss aus 4 bis 15 Buchstaben bestehen. +TEAM_NAME_LENGTH=§cEin Teamname muss aus 4 bis 15 Buchstaben bestehen. TEAM_NAME_TAKEN=§cEs gibt bereits ein Team mit diesem Namen. #Team Leader From 7611abe4dcb6c8ac9330031181d6472fa4c0c557 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Mon, 23 Jan 2023 18:28:12 +0100 Subject: [PATCH 09/16] Remove BasicCommand --- .../bungeecore/commands/BasicCommand.java | 69 ------------------- 1 file changed, 69 deletions(-) delete mode 100644 src/de/steamwar/bungeecore/commands/BasicCommand.java diff --git a/src/de/steamwar/bungeecore/commands/BasicCommand.java b/src/de/steamwar/bungeecore/commands/BasicCommand.java deleted file mode 100644 index d4b9c0a..0000000 --- a/src/de/steamwar/bungeecore/commands/BasicCommand.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - This file is a part of the SteamWar software. - - Copyright (C) 2020 SteamWar.de-Serverteam - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . -*/ - -package de.steamwar.bungeecore.commands; - -import de.steamwar.bungeecore.BungeeCore; -import de.steamwar.bungeecore.Message; -import de.steamwar.bungeecore.sql.SteamwarUser; -import net.md_5.bungee.api.CommandSender; -import net.md_5.bungee.api.ProxyServer; -import net.md_5.bungee.api.connection.ProxiedPlayer; -import net.md_5.bungee.api.plugin.Command; -import net.md_5.bungee.api.plugin.TabExecutor; - -import java.util.ArrayList; -import java.util.List; - -abstract class BasicCommand extends Command implements TabExecutor { - - public BasicCommand(String name, String permission, String... aliases) { - super(name, permission, aliases); - BungeeCore.commands.put("/" + name, permission); - ProxyServer.getInstance().getPluginManager().registerCommand(BungeeCore.get(), this); - } - - Iterable allPlayers(String begin) { - List suggestions = new ArrayList<>(); - for(ProxiedPlayer player : ProxyServer.getInstance().getPlayers()){ - String playerName = player.getName(); - if(playerName.startsWith(begin)) - suggestions.add(playerName); - } - return suggestions; - } - - public Iterable onTabComplete(CommandSender commandSender, String[] args) { - return new ArrayList<>(); - } - - protected SteamwarUser existingUser(CommandSender sender, String arg){ - SteamwarUser target = SteamwarUser.get(arg); - if(target == null) - Message.send("UNKNOWN_PLAYER", sender); - return target; - } - - protected SteamwarUser unsafeUser(CommandSender sender, String arg){ - SteamwarUser target = SteamwarUser.getOrCreateOfflinePlayer(arg); - if(target == null) - Message.send("UNKNOWN_PLAYER", sender); - return target; - } -} From f524cb61dc311cf62998a87526217a82438d8106 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Fri, 17 Feb 2023 14:57:23 +0100 Subject: [PATCH 10/16] Final fixes --- .../bungeecore/commands/TeamCommand.java | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/TeamCommand.java b/src/de/steamwar/bungeecore/commands/TeamCommand.java index 6185129..f8afef5 100644 --- a/src/de/steamwar/bungeecore/commands/TeamCommand.java +++ b/src/de/steamwar/bungeecore/commands/TeamCommand.java @@ -654,22 +654,4 @@ public class TeamCommand extends SWCommand { } return false; } - - // @Override - public Iterable onTabComplete(CommandSender commandSender, String[] args){ - List tab = new ArrayList<>(); - if(args.length == 2){ - if(args[1].equalsIgnoreCase("event")){ - List coming = Event.getComing(); - coming.forEach(event -> tab.add(event.getEventName())); - }else if(args[1].equalsIgnoreCase("join") || args[1].equalsIgnoreCase("info") || args[1].equalsIgnoreCase("tp")){ - List teams = Team.getAll(); - teams.forEach(team -> { - tab.add(team.getTeamName()); - tab.add(team.getTeamKuerzel()); - }); - } - } - return tab; - } } From b3a4c93c5947c60b059a4174d06283b01d66d832 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Fri, 17 Feb 2023 15:08:55 +0100 Subject: [PATCH 11/16] Update stuff --- CommonCore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CommonCore b/CommonCore index d12fbbd..89b0c14 160000 --- a/CommonCore +++ b/CommonCore @@ -1 +1 @@ -Subproject commit d12fbbd339f6f34108301aa08d1377eceea250a5 +Subproject commit 89b0c14da664589a7c9699d73bf72028cdf9dd0d From 6de8ed282b4794687947bc0555e299cb084f9a79 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Fri, 17 Feb 2023 15:22:05 +0100 Subject: [PATCH 12/16] Add usage messsage on no permission --- src/de/steamwar/bungeecore/commands/JoinmeCommand.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/commands/JoinmeCommand.java b/src/de/steamwar/bungeecore/commands/JoinmeCommand.java index 953655d..3b165ca 100644 --- a/src/de/steamwar/bungeecore/commands/JoinmeCommand.java +++ b/src/de/steamwar/bungeecore/commands/JoinmeCommand.java @@ -41,7 +41,10 @@ public class JoinmeCommand extends SWCommand { @Register(description = "JOINME_USAGE") public void genericCommand(ProxiedPlayer player) { - if (!player.hasPermission("bungeecore.joinme")) return; + if (!player.hasPermission("bungeecore.joinme")) { + Message.send("JOINME_USAGE", player); + return; + } Message.broadcast("JOINME_BROADCAST", "JOINME_BROADCAST_HOVER", new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join " + player.getName()), player.getName(), player.getServer().getInfo().getName()); } From 9dd3cb76970f04bf5a01bdad7c2426e043f4cd88 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Fri, 17 Feb 2023 15:27:20 +0100 Subject: [PATCH 13/16] Update JoinmeCommand ProxiedPlayer Validator Fix typos in TeamCommand --- .../bungeecore/commands/JoinmeCommand.java | 32 ++++--------------- .../bungeecore/commands/TeamCommand.java | 4 +-- 2 files changed, 9 insertions(+), 27 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/JoinmeCommand.java b/src/de/steamwar/bungeecore/commands/JoinmeCommand.java index 3b165ca..7b707e5 100644 --- a/src/de/steamwar/bungeecore/commands/JoinmeCommand.java +++ b/src/de/steamwar/bungeecore/commands/JoinmeCommand.java @@ -21,18 +21,13 @@ package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.*; import de.steamwar.bungeecore.sql.BauweltMember; -import de.steamwar.command.PreviousArguments; import de.steamwar.command.SWCommand; -import de.steamwar.command.TypeMapper; +import de.steamwar.command.TypeValidator; import net.md_5.bungee.api.CommandSender; -import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.config.ServerInfo; import net.md_5.bungee.api.connection.ProxiedPlayer; -import java.util.Collection; -import java.util.stream.Collectors; - public class JoinmeCommand extends SWCommand { public JoinmeCommand() { @@ -87,26 +82,13 @@ public class JoinmeCommand extends SWCommand { } @ClassMapper(ProxiedPlayer.class) - public TypeMapper playerMapper() { - return new TypeMapper() { - @Override - public ProxiedPlayer map(CommandSender commandSender, String[] previousArguments, String s) { - return ProxyServer.getInstance().getPlayer(s); - } - - @Override - public boolean validate(CommandSender sender, ProxiedPlayer value, MessageSender messageSender) { - if (value == null || !value.isConnected()) { - messageSender.send("JOINME_PLAYER_OFFLINE", sender); - return false; - } - return true; - } - - @Override - public Collection tabCompletes(CommandSender sender, PreviousArguments previousArguments, String s) { - return ProxyServer.getInstance().getPlayers().stream().map(ProxiedPlayer::getName).collect(Collectors.toList()); + public TypeValidator playerMapper() { + return (sender, value, messageSender) -> { + if (value == null || !value.isConnected()) { + messageSender.send("JOINME_PLAYER_OFFLINE", sender); + return false; } + return true; }; } } diff --git a/src/de/steamwar/bungeecore/commands/TeamCommand.java b/src/de/steamwar/bungeecore/commands/TeamCommand.java index f8afef5..dbe2ad7 100644 --- a/src/de/steamwar/bungeecore/commands/TeamCommand.java +++ b/src/de/steamwar/bungeecore/commands/TeamCommand.java @@ -114,7 +114,7 @@ public class TeamCommand extends SWCommand { } @Register(value = "create", description = "TEAM_CREATE_USAGE") - public void create(ProxiedPlayer player, @Length(min = 2, max = 4) @ErrorMessage("TEAM_KUERZEL_LENGHT") String kuerzel, @Length(min = 4, max = 15) @ErrorMessage("TEAM_NAME_LENGHT") String name){ + public void create(ProxiedPlayer player, @Length(min = 2, max = 4) @ErrorMessage("TEAM_KUERZEL_LENGTH") String kuerzel, @Length(min = 4, max = 15) @ErrorMessage("TEAM_NAME_LENGTH") String name){ SteamwarUser user = SteamwarUser.get(player.getUniqueId()); Team team = Team.get(user.getTeam()); if(unwantedInTeam(player, user)) @@ -299,7 +299,7 @@ public class TeamCommand extends SWCommand { } @Register(value = "changekurzel", description = "TEAM_KUERZEL_USAGE") - public void changekuerzel(ProxiedPlayer player, @Length(min = 2, max = 4) @ErrorMessage("TEAM_KUERZEL_LENGHT") String kuerzel){ + public void changekuerzel(ProxiedPlayer player, @Length(min = 2, max = 4) @ErrorMessage("TEAM_KUERZEL_LENGTH") String kuerzel){ SteamwarUser user = SteamwarUser.get(player.getUniqueId()); Team team = Team.get(user.getTeam()); if(notLeader(player, user)) From 87db98a310649cceee6bd674dae0c1bc6c180762 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Tue, 21 Feb 2023 20:38:19 +0100 Subject: [PATCH 14/16] Fix 3 things --- src/de/steamwar/bungeecore/commands/JoinmeCommand.java | 2 +- src/de/steamwar/bungeecore/commands/TeamCommand.java | 2 +- src/de/steamwar/bungeecore/commands/TeamchatCommand.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/JoinmeCommand.java b/src/de/steamwar/bungeecore/commands/JoinmeCommand.java index 7b707e5..b705c8d 100644 --- a/src/de/steamwar/bungeecore/commands/JoinmeCommand.java +++ b/src/de/steamwar/bungeecore/commands/JoinmeCommand.java @@ -81,7 +81,7 @@ public class JoinmeCommand extends SWCommand { } } - @ClassMapper(ProxiedPlayer.class) + @ClassValidator(ProxiedPlayer.class) public TypeValidator playerMapper() { return (sender, value, messageSender) -> { if (value == null || !value.isConnected()) { diff --git a/src/de/steamwar/bungeecore/commands/TeamCommand.java b/src/de/steamwar/bungeecore/commands/TeamCommand.java index dbe2ad7..877b2a2 100644 --- a/src/de/steamwar/bungeecore/commands/TeamCommand.java +++ b/src/de/steamwar/bungeecore/commands/TeamCommand.java @@ -445,7 +445,7 @@ public class TeamCommand extends SWCommand { } @Register("event") - public void event(ProxiedPlayer player, String[] args){ + public void event(ProxiedPlayer player, String... args){ SteamwarUser user = SteamwarUser.get(player.getUniqueId()); Team team = Team.get(user.getTeam()); if(notInTeam(player, user)) diff --git a/src/de/steamwar/bungeecore/commands/TeamchatCommand.java b/src/de/steamwar/bungeecore/commands/TeamchatCommand.java index 8d5e3e3..f96a793 100644 --- a/src/de/steamwar/bungeecore/commands/TeamchatCommand.java +++ b/src/de/steamwar/bungeecore/commands/TeamchatCommand.java @@ -32,7 +32,7 @@ public class TeamchatCommand extends SWCommand { super("tc", "","teamchat"); } - @Register + @Register(description = "TC_USAGE") public void genericCommand(ProxiedPlayer player, @ErrorMessage(value = "TC_USAGE", allowEAs = false) String... args) { ChatSender sender = ChatSender.of(player); SteamwarUser user = sender.user(); From ba064a1f9e864a9d15c00c798f414d37f8ac094b Mon Sep 17 00:00:00 2001 From: yoyosource Date: Tue, 21 Feb 2023 20:45:00 +0100 Subject: [PATCH 15/16] Fix another one --- .../bungeecore/commands/TeamCommand.java | 65 +++++++++++++------ 1 file changed, 44 insertions(+), 21 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/TeamCommand.java b/src/de/steamwar/bungeecore/commands/TeamCommand.java index 877b2a2..2e647eb 100644 --- a/src/de/steamwar/bungeecore/commands/TeamCommand.java +++ b/src/de/steamwar/bungeecore/commands/TeamCommand.java @@ -24,7 +24,9 @@ import de.steamwar.bungeecore.Storage; import de.steamwar.bungeecore.inventory.SWItem; import de.steamwar.bungeecore.inventory.SWListInv; import de.steamwar.bungeecore.sql.*; +import de.steamwar.command.PreviousArguments; import de.steamwar.command.SWCommand; +import de.steamwar.command.TypeMapper; import de.steamwar.messages.ChatSender; import net.md_5.bungee.BungeeCord; import net.md_5.bungee.api.ChatColor; @@ -42,10 +44,7 @@ import net.md_5.bungee.api.event.ServerConnectEvent; import java.net.*; import java.time.Instant; import java.time.format.DateTimeFormatter; -import java.util.ArrayList; -import java.util.LinkedList; -import java.util.List; -import java.util.Set; +import java.util.*; import java.util.stream.Collectors; import static de.steamwar.bungeecore.Storage.teamInvitations; @@ -445,23 +444,28 @@ public class TeamCommand extends SWCommand { } @Register("event") - public void event(ProxiedPlayer player, String... args){ + public void event(ProxiedPlayer player) { SteamwarUser user = SteamwarUser.get(player.getUniqueId()); Team team = Team.get(user.getTeam()); if(notInTeam(player, user)) return; - if(args.length < 2){ - Message.send("TEAM_EVENT_USAGE", player); - Set events = TeamTeilnahme.getEvents(team.getTeamId()); - if(!events.isEmpty()){ - Message.send("TEAM_EVENT_HEADER", player); - DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern(Message.parse("EVENT_DATE_FORMAT", player)); - for(Event e : events) - Message.sendPrefixless("TEAM_EVENT_EVENT", player, e.getStart().toLocalDateTime().format(dateFormat), e.getEventName()); - } - return; + Message.send("TEAM_EVENT_USAGE", player); + Set events = TeamTeilnahme.getEvents(team.getTeamId()); + if(!events.isEmpty()){ + Message.send("TEAM_EVENT_HEADER", player); + DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern(Message.parse("EVENT_DATE_FORMAT", player)); + for(Event e : events) + Message.sendPrefixless("TEAM_EVENT_EVENT", player, e.getStart().toLocalDateTime().format(dateFormat), e.getEventName()); } + } + + @Register("event") + public void event(ProxiedPlayer player, Event event){ + SteamwarUser user = SteamwarUser.get(player.getUniqueId()); + Team team = Team.get(user.getTeam()); + if(notInTeam(player, user)) + return; if(notLeader(player, user)) return; @@ -469,12 +473,6 @@ public class TeamCommand extends SWCommand { if(notDuringEvent(player)) return; - Event event = Event.get(args[1]); - if(event == null){ - Message.send("TEAM_EVENT_NO_EVENT", player); - return; - } - if(Instant.now().isAfter(event.getDeadline().toInstant())){ Message.send("TEAM_EVENT_OVER", player); return; @@ -603,6 +601,31 @@ public class TeamCommand extends SWCommand { inv.open(); } + @ClassMapper(Event.class) + public TypeMapper eventTypeMapper() { + return new TypeMapper() { + @Override + public Event map(CommandSender commandSender, String[] previousArguments, String s) { + return Event.get(s); + } + + @Override + public boolean validate(CommandSender sender, Event value, MessageSender messageSender) { + if (value == null) { + messageSender.send("TEAM_EVENT_NO_EVENT", sender); + return false; + } else { + return true; + } + } + + @Override + public Collection tabCompletes(CommandSender sender, PreviousArguments previousArguments, String s) { + return Event.getComing().stream().map(Event::getEventName).collect(Collectors.toList()); + } + }; + } + private boolean checkTeamName(ProxiedPlayer player, Team team, String arg){ Team t = Team.get(arg); if(t != null && t.getTeamId() != team.getTeamId()){ From 02c8538d76db2a086a66927ef6c6d2ab22c24ed6 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Tue, 21 Feb 2023 20:49:38 +0100 Subject: [PATCH 16/16] Fix another some weird tab completes --- src/de/steamwar/bungeecore/commands/BauCommand.java | 2 +- src/de/steamwar/bungeecore/commands/TeamCommand.java | 2 +- src/de/steamwar/command/SWCommand.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/BauCommand.java b/src/de/steamwar/bungeecore/commands/BauCommand.java index 7bf45b9..51b33b9 100644 --- a/src/de/steamwar/bungeecore/commands/BauCommand.java +++ b/src/de/steamwar/bungeecore/commands/BauCommand.java @@ -48,7 +48,7 @@ public class BauCommand extends SWCommand { this.command = command; } - @Register(help = true) + @Register(noTabComplete = true) public void genericHelp(ProxiedPlayer p, String... args) { this.command.sendBauHelp(p); } diff --git a/src/de/steamwar/bungeecore/commands/TeamCommand.java b/src/de/steamwar/bungeecore/commands/TeamCommand.java index 2e647eb..39c1ac3 100644 --- a/src/de/steamwar/bungeecore/commands/TeamCommand.java +++ b/src/de/steamwar/bungeecore/commands/TeamCommand.java @@ -80,7 +80,7 @@ public class TeamCommand extends SWCommand { super("team"); } - @Register + @Register(noTabComplete = true) public void help(CommandSender sender, String... args){ Message.send("TEAM_HELP_HEADER", sender); Message.send("TEAM_HELP_LIST", sender); diff --git a/src/de/steamwar/command/SWCommand.java b/src/de/steamwar/command/SWCommand.java index 63bbace..83b4d8d 100644 --- a/src/de/steamwar/command/SWCommand.java +++ b/src/de/steamwar/command/SWCommand.java @@ -120,7 +120,7 @@ public class SWCommand extends AbstractSWCommand { ChatSender.of(sender).system(message, args); } - @Register(help = true) + @Register(noTabComplete = true) public void internalHelp(ProxiedPlayer p, String... args) { ChatSender chatSender = ChatSender.of(p); try {