From 48f11d3285f3ba12f2347bfcefd49e2aa2ede919 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Thu, 4 Jul 2024 08:36:43 +0200 Subject: [PATCH] Fix SWCommand with 0 args, help WV, -1 ping, TICKET_LOG Signed-off-by: Lixfel --- CommonCore | 2 +- src/de/steamwar/command/SWCommand.java | 12 ++-------- .../steamwar/messages/BungeeCore.properties | 24 +++++++++---------- .../messages/BungeeCore_de.properties | 1 - .../steamwar/velocitycore/ServerStarter.java | 2 +- .../velocitycore/commands/HelpCommand.java | 2 +- .../listeners/DiscordTicketHandler.java | 2 +- .../velocitycore/tablist/Tablist.java | 4 +++- 8 files changed, 20 insertions(+), 29 deletions(-) diff --git a/CommonCore b/CommonCore index 20c22c4..e76473e 160000 --- a/CommonCore +++ b/CommonCore @@ -1 +1 @@ -Subproject commit 20c22c47f940c4510de17594b28eb0a96cb9da0c +Subproject commit e76473e0beffe3df5c6d1c3430f62332b7371579 diff --git a/src/de/steamwar/command/SWCommand.java b/src/de/steamwar/command/SWCommand.java index db9421b..9b931a3 100644 --- a/src/de/steamwar/command/SWCommand.java +++ b/src/de/steamwar/command/SWCommand.java @@ -20,17 +20,16 @@ package de.steamwar.command; import com.velocitypowered.api.command.SimpleCommand; -import de.steamwar.velocitycore.VelocityCore; -import de.steamwar.velocitycore.discord.DiscordBot; import de.steamwar.messages.Chatter; import de.steamwar.messages.Message; import de.steamwar.sql.UserPerm; +import de.steamwar.velocitycore.VelocityCore; +import de.steamwar.velocitycore.discord.DiscordBot; import lombok.Getter; import net.kyori.adventure.text.event.ClickEvent; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Supplier; @@ -84,9 +83,6 @@ public class SWCommand extends AbstractSWCommand { @Override public List suggest(Invocation invocation) { - if(invocation.arguments().length == 0) - return Collections.emptyList(); - return SWCommand.this.tabComplete(Chatter.of(invocation.source()), invocation.alias(), invocation.arguments()); } @@ -104,8 +100,6 @@ public class SWCommand extends AbstractSWCommand { VelocityCore.getProxy().getCommandManager().unregister(name); DiscordBot.getCommands().remove(name); - for(String alias : aliases) - DiscordBot.getCommands().remove(alias); } @Override @@ -115,8 +109,6 @@ public class SWCommand extends AbstractSWCommand { VelocityCore.getProxy().getCommandManager().register(VelocityCore.getProxy().getCommandManager().metaBuilder(name).aliases(aliases).plugin(VelocityCore.get()).build(), command); DiscordBot.getCommands().put(name, this); - for(String alias : aliases) - DiscordBot.getCommands().put(alias, this); } @Override diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 5983f53..870d580 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -48,7 +48,6 @@ HELP_TESTBLOCK=§8/§7testblock §8- §7Resets the dummy HELP_RESET=§8/§7reset §8- §7Resets the current region HELP_SPEED=§8/§7speed §8- §7Changes flight and walking speed HELP_NV=§8/§7nv §8- §7(de)activates night vision -HELP_WV=§8/§7wv §8- §7(de)activates underwater vision HELP_TRACE=§8/§7trace §8- §7Gives help regarding the tnt tracer HELP_TPSLIMIT=§8/§7tpslimit §8- §7Gives help regarding the TPS limiter HELP_LOADER=§8/§7loader §8- §7Use the automatic cannon loader @@ -57,7 +56,7 @@ HELP_FREEZE=§8/§7freeze §8- §7Stops block updates HELP_SKULL=§8/§7skull §8- §7Gives you a player head HELP_DEBUGSTICK=§8/§7debugstick §8- §7Gives you a debugstick HELP_BAUINFO=§8/§7buildinfo §8- §7Information about the current build server -HELP_SCHEMSUBMIT=§7For a Tutorial about unlocking your AirShip§8/§7MiniWarGear§8/§7WarGear§8/§7WarShip click §ehere§8! +HELP_SCHEMSUBMIT=§7For a Tutorial about submitting your AirShip§8/§7MiniWarGear§8/§7WarGear§8/§7WarShip click §ehere§8! HELP_SCHEMSUBMIT_HOVER=§ehttps://www.youtube.com/watch?v=9QrQ3UBWveE HELP_WE_POS1=§8//§71 §7» §8//§7pos1 @@ -233,7 +232,7 @@ BAU_START_NOT_ALLOWED = §cYou are not allowed to start this build server. #ChallengeCommand CHALLENGE_USAGE=§8/§7challenge §8[§eplayer§8] -CHALLENGE_OFFLINE=§cThe challenged player isn't online. + CHALLENGE_OFFLINE=§cThe challenged player isn\'t online. CHALLENGE_SELF=§cSchizophrenia? CHALLENGE_IGNORED=§cThe challenged player has blocked you. CHALLENGE_INARENA=§cThe challenged player is already in an arena. @@ -539,16 +538,16 @@ CHAT_YOYONOW_2=I would like to recommend you the command "/bug ".. CHAT_YOYONOW_3=Thank you. CHAT_YOYONOW_4=I wish you still a smooth gaming experience. CHAT_CHAOSCAOT_1=You called me! -CHAT_CHAOSCAOT_2=If something is broken, just say it's a feature. -CHAT_CHAOSCAOT_3=And if it is a feature, just then it can't be broken. -CHAT_CHAOSCAOT_4=Broken is just a definition. So if you define it as a feature, it's not broken. +CHAT_CHAOSCAOT_2=If something is broken, just say it\'s a feature. +CHAT_CHAOSCAOT_3=And if it is a feature, just then it can\'t be broken. +CHAT_CHAOSCAOT_4=Broken is just a definition. So if you define it as a feature, it\'s not broken. CHAT_CHAOSCAOT_5=And if you define it as broken, then tell us using the command "/bug ". CHAT_CHAOSCAOT_6=Thank you and goodbye. CHAT_RECEIVE=§cTo be able to send chat messages, you must also receive them! CHAT_NO_LINKS=§cYou may not send links. CHAT_BC_USAGE=§8/§7bc §8[§emessage§8] CHAT_NO_RECEIVER=§cNobody receives your message -CHAT_EMPTY=§cDon't write meaningless empty messages. +CHAT_EMPTY=§cDon\'t write meaningless empty messages. CHAT_SERVERTEAM=§8STC §e{0}§8» §f{2} CHAT_GLOBAL={3}{4}{5}{6}{0}§8» {7}{2} @@ -712,11 +711,10 @@ DC_UNLINKED=For this action your Discord account has to be linked to your Minecr DC_TITLE_SCHEMINFO=Schematic Info DC_SCHEM_ACCEPT=Your schematic **{0}** has been accepted. DC_SCHEM_DECLINE=Your schematic **{0}** has been declined.\n**Reason:**{1} -DC_AUTH_SUCCESS=:white_check_mark: You're Discord account has been linked with **{0}**. -DC_ROLE_ADDED=:tada: You're getting {0} now. -DC_ROLE_REMOVED=You're not getting {0} anymore. - -DC_TICKET_CREATED=You're Ticket {0} has been created. +DC_AUTH_SUCCESS=:white_check_mark: You\'re Discord account has been linked with **{0}**. +DC_ROLE_ADDED=:tada: Your getting {0} now. +DC_ROLE_REMOVED=Your not getting {0} anymore. +DC_TICKET_CREATED=Your Ticket {0} has been created. DC_TICKET_TITLE=SteamWar Ticket DC_TICKETINTRO_REPORT=Please answer for the punishment of the misconduct the following questions as accurately as possible and attach evidence whenever possible:\n - Which player(s)?\n - On which Server?\n - At what time?\n - Type and nature of the misconduct? DC_TICKETINTRO_IDEA=Describe your idea as detailed as possible. Hereto belongs: What, Why, How, Where? @@ -725,7 +723,7 @@ DC_TICKETINTRO_QUESTION=Please ask your question. A staff member will address th DC_TICKETINTRO_APPEAL=Asking creates wonders. DC_TICKET_CLOSE=Close -DC_SCHEMUPLOAD_NOPERM=You're not allowed to upload schematics. +DC_SCHEMUPLOAD_NOPERM=You\'re not allowed to upload schematics. DC_SCHEMUPLOAD_IGNORED=Skipping `{0}`, not a schematic file. DC_SCHEMUPLOAD_INVCHAR=`{0}` has invalid characters in its name. DC_SCHEMUPLOAD_SUCCESS=`{0}` was uploaded successfully. diff --git a/src/de/steamwar/messages/BungeeCore_de.properties b/src/de/steamwar/messages/BungeeCore_de.properties index 8d4ddca..c61446e 100644 --- a/src/de/steamwar/messages/BungeeCore_de.properties +++ b/src/de/steamwar/messages/BungeeCore_de.properties @@ -44,7 +44,6 @@ HELP_TESTBLOCK=§8/§7testblock §8- §7Erneuert den nächsten Testblock HELP_RESET=§8/§7reset §8- §7Setzt die derzeitige Region zurück HELP_SPEED=§8/§7speed §8- §7Ändert deine Fluggeschwindigkeit HELP_NV=§8/§7nv §8- §7(de)aktiviert Nachtsicht -HELP_WV=§8/§7wv §8- §7(de)aktiviert Unterwassersicht HELP_TRACE=§8/§7trace §8- §7Gibt einen Überblick über den TNT-Tracer HELP_TPSLIMIT=§8/§7tpslimit §8- §7Gibt einen Überblick über den TPS-Limiter HELP_LOADER=§8/§7loader §8- §7Nutze den automatischen Kanonenlader diff --git a/src/de/steamwar/velocitycore/ServerStarter.java b/src/de/steamwar/velocitycore/ServerStarter.java index 43ae472..aa7e14f 100644 --- a/src/de/steamwar/velocitycore/ServerStarter.java +++ b/src/de/steamwar/velocitycore/ServerStarter.java @@ -214,7 +214,7 @@ public class ServerStarter { directory = version.getServerDirectory("Builder"); worldDir = version.getWorldFolder(BUILDER_BASE_PATH); worldName = map; - serverNameProvider = port -> "⛏" + map; + serverNameProvider = port -> map + "⛏"; checkpoint = true; constructor = (serverName, port, builder, shutdownCallback, failureCallback) -> new Builderserver(serverName, worldName, port, builder, shutdownCallback, failureCallback); diff --git a/src/de/steamwar/velocitycore/commands/HelpCommand.java b/src/de/steamwar/velocitycore/commands/HelpCommand.java index 4a22749..8cb6fda 100644 --- a/src/de/steamwar/velocitycore/commands/HelpCommand.java +++ b/src/de/steamwar/velocitycore/commands/HelpCommand.java @@ -53,7 +53,7 @@ public class HelpCommand extends SWCommand { @Register({"build","player"}) public void buildPlayer(Chatter sender) { - printPage(sender, "HELP_BAU_GROUP_PLAYER_TITLE", "HELP_SPEED", "HELP_NV", "HELP_WV", "HELP_DEBUGSTICK", "HELP_TRACE", "HELP_LOADER"); + printPage(sender, "HELP_BAU_GROUP_PLAYER_TITLE", "HELP_SPEED", "HELP_NV", "HELP_DEBUGSTICK", "HELP_TRACE", "HELP_LOADER"); } @Register({"build","worldedit"}) diff --git a/src/de/steamwar/velocitycore/discord/listeners/DiscordTicketHandler.java b/src/de/steamwar/velocitycore/discord/listeners/DiscordTicketHandler.java index dbb2155..914355d 100644 --- a/src/de/steamwar/velocitycore/discord/listeners/DiscordTicketHandler.java +++ b/src/de/steamwar/velocitycore/discord/listeners/DiscordTicketHandler.java @@ -149,7 +149,7 @@ public class DiscordTicketHandler extends ListenerAdapter { if(event.getAuthor().isBot()) return; - ChatterGroup receivers = Chatter.serverteam(); + ChatterGroup receivers = new ChatterGroup(Chatter.allStream().filter(player -> player.user().hasPerm(UserPerm.TICKET_LOG))); try { SteamwarUser user = SteamwarUser.get(Long.parseLong(channel.getTopic())); if(user != null && !user.perms().contains(UserPerm.TEAM)) diff --git a/src/de/steamwar/velocitycore/tablist/Tablist.java b/src/de/steamwar/velocitycore/tablist/Tablist.java index 59bba3b..4d68702 100644 --- a/src/de/steamwar/velocitycore/tablist/Tablist.java +++ b/src/de/steamwar/velocitycore/tablist/Tablist.java @@ -235,7 +235,9 @@ public class Tablist extends ChannelInboundHandlerAdapter { private String ping() { long ping = player.getPing(); - if (ping < 50) { + if (ping == -1) { + return "§7?"; + } else if (ping < 50) { return "§a" + ping; } else if (ping < 150) { return "§e" + ping;