From 71767ef6d9736efccd03fc9cde542b4df747d7aa Mon Sep 17 00:00:00 2001 From: YoyoNow Date: Sat, 21 Mar 2026 09:20:57 +0100 Subject: [PATCH] Fix TeamCommand /team event ... --- .../steamwar/messages/BungeeCore.properties | 1 - .../messages/BungeeCore_de.properties | 1 - .../velocitycore/commands/TeamCommand.java | 26 +++++++++---------- 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/VelocityCore/src/de/steamwar/messages/BungeeCore.properties b/VelocityCore/src/de/steamwar/messages/BungeeCore.properties index 66d439df..5e619e84 100644 --- a/VelocityCore/src/de/steamwar/messages/BungeeCore.properties +++ b/VelocityCore/src/de/steamwar/messages/BungeeCore.properties @@ -419,7 +419,6 @@ TEAM_NOT_IN_EVENT=§cThis is not possible during an event. TEAM_HELP_HEADER=§7Manage your team with §e/team. TEAM_HELP_LIST=§8/§7team list §8- §7List all teams. TEAM_HELP_INFO=§8/§7team info §8- §7Get information on a team. -TEAM_HELP_TP=§8/§7team tp §8(§7Team§8) §8- §7Teleport to a team server. TEAM_HELP_CREATE=§8/§7team create §8- §7Create your own team. TEAM_HELP_JOIN=§8/§7team join §8- §7Join a team. TEAM_HELP_CHAT=§8/§7teamchat §8- §7Send messages to your team. diff --git a/VelocityCore/src/de/steamwar/messages/BungeeCore_de.properties b/VelocityCore/src/de/steamwar/messages/BungeeCore_de.properties index 71e55412..ed0edfc4 100644 --- a/VelocityCore/src/de/steamwar/messages/BungeeCore_de.properties +++ b/VelocityCore/src/de/steamwar/messages/BungeeCore_de.properties @@ -391,7 +391,6 @@ TEAM_NOT_IN_EVENT=§cDies ist während eines Events nicht möglich. TEAM_HELP_HEADER=§7Mit §e/team §7verwaltest du dein Team. TEAM_HELP_LIST=§8/§7team list §8- §7Liste alle Teams auf. TEAM_HELP_INFO=§8/§7team info §8- §7Informiere dich über ein Team. -TEAM_HELP_TP=§8/§7team tp §8(§7Team§8) §8- §7Teleportiert zum Teamserver. TEAM_HELP_CREATE=§8/§7team create §8- §7Erstelle dein eigenes Team. TEAM_HELP_JOIN=§8/§7team join §8- §7Trete einem Team bei. TEAM_HELP_CHAT=§8/§7teamchat §8- §7Sende Nachrichten an dein Team. diff --git a/VelocityCore/src/de/steamwar/velocitycore/commands/TeamCommand.java b/VelocityCore/src/de/steamwar/velocitycore/commands/TeamCommand.java index 3d861398..70bde6a2 100644 --- a/VelocityCore/src/de/steamwar/velocitycore/commands/TeamCommand.java +++ b/VelocityCore/src/de/steamwar/velocitycore/commands/TeamCommand.java @@ -19,12 +19,6 @@ package de.steamwar.velocitycore.commands; -import com.velocitypowered.api.proxy.ConnectionRequestBuilder; -import com.velocitypowered.api.proxy.server.RegisteredServer; -import com.velocitypowered.api.proxy.server.ServerInfo; -import com.velocitypowered.api.proxy.server.ServerPing; -import com.viaversion.viaversion.api.Via; -import com.viaversion.viaversion.velocity.platform.VelocityViaConfig; import de.steamwar.command.PreviousArguments; import de.steamwar.command.SWCommand; import de.steamwar.command.TypeMapper; @@ -33,19 +27,19 @@ import de.steamwar.linkage.Linked; import de.steamwar.messages.Chatter; import de.steamwar.messages.Message; import de.steamwar.messages.PlayerChatter; -import de.steamwar.persistent.Storage; -import de.steamwar.sql.*; +import de.steamwar.sql.Event; +import de.steamwar.sql.SteamwarUser; +import de.steamwar.sql.Team; +import de.steamwar.sql.TeamTeilnahme; import de.steamwar.velocitycore.VelocityCore; import de.steamwar.velocitycore.discord.DiscordBot; import de.steamwar.velocitycore.inventory.SWItem; import de.steamwar.velocitycore.inventory.SWListInv; -import lombok.val; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.event.ClickEvent; import net.kyori.adventure.text.event.HoverEvent; import net.kyori.adventure.text.format.NamedTextColor; -import java.net.*; import java.time.Instant; import java.time.format.DateTimeFormatter; import java.util.*; @@ -63,7 +57,7 @@ public class TeamCommand extends SWCommand { @Register(noTabComplete = true) public void help(Chatter sender, String... args){ - helpMessages(sender, "TEAM_HELP_HEADER", "TEAM_HELP_LIST", "TEAM_HELP_INFO", "TEAM_HELP_TP"); + helpMessages(sender, "TEAM_HELP_HEADER", "TEAM_HELP_LIST", "TEAM_HELP_INFO"); SteamwarUser user = sender.user(); if(user.getTeam() == 0) { @@ -469,10 +463,14 @@ public class TeamCommand extends SWCommand { @ClassMapper(Event.class) public TypeMapper eventTypeMapper() { - return new TypeMapper() { + return new TypeMapper<>() { @Override public Event map(Chatter sender, PreviousArguments previousArguments, String s) { - return Event.get(s); + try { + return Event.byId(Integer.parseInt(s)); + } catch (NumberFormatException e) { + return null; + } } @Override @@ -487,7 +485,7 @@ public class TeamCommand extends SWCommand { @Override public Collection tabCompletes(Chatter sender, PreviousArguments previousArguments, String s) { - return Event.getComing().stream().map(Event::getEventName).toList(); + return Event.getComing().stream().map(Event::getEventID).map(i -> i + "").toList(); } }; }