From e21105129490fc8c24c0bdf01c67a08ced754f61 Mon Sep 17 00:00:00 2001 From: YoyoNow Date: Mon, 27 Oct 2025 22:04:17 +0100 Subject: [PATCH 01/15] Hotfix GameModeConfig --- CommonCore/SQL/src/de/steamwar/sql/GameModeConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CommonCore/SQL/src/de/steamwar/sql/GameModeConfig.java b/CommonCore/SQL/src/de/steamwar/sql/GameModeConfig.java index 18941b19..b1e62b8b 100644 --- a/CommonCore/SQL/src/de/steamwar/sql/GameModeConfig.java +++ b/CommonCore/SQL/src/de/steamwar/sql/GameModeConfig.java @@ -36,7 +36,7 @@ public final class GameModeConfig { public static final Function ToString = Function.identity(); public static final Function ToStaticWarGear = __ -> "WarGear"; - public static final Function ToInternalName = file -> file.getName().replace(".yml", ""); + public static final Function ToInternalName = file -> file != null ? file.getName().replace(".yml", "") : "WarGear"; public static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("dd.MM.yyyy HH:mm"); private static final Random random = new Random(); From 2410ea3979c2a80078778a30b6752a397e978841 Mon Sep 17 00:00:00 2001 From: YoyoNow Date: Tue, 28 Oct 2025 17:03:48 +0100 Subject: [PATCH 02/15] Fix PunishmentCommand ban localhost for /ban --- .../steamwar/velocitycore/commands/PunishmentCommand.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/VelocityCore/src/de/steamwar/velocitycore/commands/PunishmentCommand.java b/VelocityCore/src/de/steamwar/velocitycore/commands/PunishmentCommand.java index c209c210..5a617c5b 100644 --- a/VelocityCore/src/de/steamwar/velocitycore/commands/PunishmentCommand.java +++ b/VelocityCore/src/de/steamwar/velocitycore/commands/PunishmentCommand.java @@ -21,8 +21,6 @@ package de.steamwar.velocitycore.commands; import com.google.gson.JsonParser; import com.velocitypowered.api.proxy.Player; -import de.steamwar.velocitycore.VelocityCore; -import de.steamwar.velocitycore.listeners.IPSanitizer; import de.steamwar.command.PreviousArguments; import de.steamwar.command.SWCommand; import de.steamwar.command.TypeMapper; @@ -32,6 +30,8 @@ import de.steamwar.sql.BannedUserIPs; import de.steamwar.sql.Punishment; import de.steamwar.sql.SteamwarUser; import de.steamwar.sql.UserPerm; +import de.steamwar.velocitycore.VelocityCore; +import de.steamwar.velocitycore.listeners.IPSanitizer; import java.io.IOException; import java.net.URL; @@ -97,7 +97,9 @@ public class PunishmentCommand { bannedUser.punish(Punishment.PunishmentType.Ban, time, banReason, punisher.getId(), perma); } } - BannedUserIPs.banIP(user.getId(), ip); + if (!player.getUsername().startsWith(".")) { + BannedUserIPs.banIP(user.getId(), ip); + } } } From 4c730bcc48e1852d6e58ad09cf59b33142edbbc1 Mon Sep 17 00:00:00 2001 From: YoyoNow Date: Tue, 28 Oct 2025 17:07:50 +0100 Subject: [PATCH 03/15] Improve PunishmentCommand Permissions --- .../SQL/src/de/steamwar/sql/Punishment.java | 20 +++++++++---------- .../commands/PunishmentCommand.java | 9 +++++---- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/CommonCore/SQL/src/de/steamwar/sql/Punishment.java b/CommonCore/SQL/src/de/steamwar/sql/Punishment.java index f5813792..1cd61078 100644 --- a/CommonCore/SQL/src/de/steamwar/sql/Punishment.java +++ b/CommonCore/SQL/src/de/steamwar/sql/Punishment.java @@ -119,17 +119,17 @@ public class Punishment { @RequiredArgsConstructor @Getter public enum PunishmentType { - Ban(false, "BAN_TEAM", "BAN_PERMA", "BAN_UNTIL", "UNBAN_ERROR", "UNBAN"), - Mute( false, "MUTE_TEAM", "MUTE_PERMA", "MUTE_UNTIL", "UNMUTE_ERROR", "UNMUTE"), - NoSchemReceiving(true, "NOSCHEMRECEIVING_TEAM", "NOSCHEMRECEIVING_PERMA", "NOSCHEMRECEIVING_UNTIL", "UNNOSCHEMRECEIVING_ERROR", "UNNOSCHEMRECEIVING"), - NoSchemSharing(true, "NOSCHEMSHARING_TEAM", "NOSCHEMSHARING_PERMA", "NOSCHEMSHARING_UNTIL", "UNNOSCHEMSHARING_ERROR", "UNNOSCHEMSHARING"), - NoSchemSubmitting(false, "NOSCHEMSUBMITTING_TEAM", "NOSCHEMSUBMITTING_PERMA", "NOSCHEMSUBMITTING_UNTIL", "UNNOSCHEMSUBMITTING_ERROR", "UNNOSCHEMSUBMITTING"), - NoDevServer(true, "NODEVSERVER_TEAM", "NODEVSERVER_PERMA", "NODEVSERVER_UNTIL", "UNNODEVSERVER_ERROR", "UNNODEVSERVER"), - NoFightServer(true, "NOFIGHTSERVER_TEAM", "NOFIGHTSERVER_PERMA", "NOFIGHTSERVER_UNTIL", "UNNOFIGHTSERVER_ERROR", "UNNOFIGHTSERVER"), - NoTeamServer(true, "NOTEAMSERVER_TEAM", "NOTEAMSERVER_PERMA", "NOTEAMSERVER_UNTIL", "UNNOTEAMSERVER_ERROR", "UNNOTEAMSERVER"), - Note(false, "NOTE_TEAM", null, null, null, null, true); + Ban(UserPerm.TEAM, "BAN_TEAM", "BAN_PERMA", "BAN_UNTIL", "UNBAN_ERROR", "UNBAN"), + Mute( UserPerm.TEAM, "MUTE_TEAM", "MUTE_PERMA", "MUTE_UNTIL", "UNMUTE_ERROR", "UNMUTE"), + NoSchemReceiving(UserPerm.MODERATION, "NOSCHEMRECEIVING_TEAM", "NOSCHEMRECEIVING_PERMA", "NOSCHEMRECEIVING_UNTIL", "UNNOSCHEMRECEIVING_ERROR", "UNNOSCHEMRECEIVING"), + NoSchemSharing(UserPerm.MODERATION, "NOSCHEMSHARING_TEAM", "NOSCHEMSHARING_PERMA", "NOSCHEMSHARING_UNTIL", "UNNOSCHEMSHARING_ERROR", "UNNOSCHEMSHARING"), + NoSchemSubmitting(UserPerm.TEAM, "NOSCHEMSUBMITTING_TEAM", "NOSCHEMSUBMITTING_PERMA", "NOSCHEMSUBMITTING_UNTIL", "UNNOSCHEMSUBMITTING_ERROR", "UNNOSCHEMSUBMITTING"), + NoDevServer(UserPerm.PREFIX_DEVELOPER, "NODEVSERVER_TEAM", "NODEVSERVER_PERMA", "NODEVSERVER_UNTIL", "UNNODEVSERVER_ERROR", "UNNODEVSERVER"), + NoFightServer(UserPerm.MODERATION, "NOFIGHTSERVER_TEAM", "NOFIGHTSERVER_PERMA", "NOFIGHTSERVER_UNTIL", "UNNOFIGHTSERVER_ERROR", "UNNOFIGHTSERVER"), + NoTeamServer(UserPerm.MODERATION, "NOTEAMSERVER_TEAM", "NOTEAMSERVER_PERMA", "NOTEAMSERVER_UNTIL", "UNNOTEAMSERVER_ERROR", "UNNOTEAMSERVER"), + Note(UserPerm.TEAM, "NOTE_TEAM", null, null, null, null, true); - private final boolean needsAdmin; + private final UserPerm userPerm; private final String teamMessage; private final String playerMessagePerma; private final String playerMessageUntil; diff --git a/VelocityCore/src/de/steamwar/velocitycore/commands/PunishmentCommand.java b/VelocityCore/src/de/steamwar/velocitycore/commands/PunishmentCommand.java index 5a617c5b..24abde90 100644 --- a/VelocityCore/src/de/steamwar/velocitycore/commands/PunishmentCommand.java +++ b/VelocityCore/src/de/steamwar/velocitycore/commands/PunishmentCommand.java @@ -181,7 +181,7 @@ public class PunishmentCommand { private final Punishment.PunishmentType punishmentType; private PunishCommand(String command, Punishment.PunishmentType punishmentType) { - super(command, UserPerm.TEAM); + super(command, punishmentType.getUserPerm()); this.command = command; this.punishmentType = punishmentType; } @@ -196,7 +196,7 @@ public class PunishmentCommand { @Register public void genericCommand(Chatter sender, @Mapper("toPunish") String toPunish, String date, @ErrorMessage(allowEAs = false, value = "PUNISHMENT_USAGE_REASON") String... message) { SteamwarUser punisher = sender.user(); - if (punishmentType.isNeedsAdmin() && !punisher.hasPerm(UserPerm.MODERATION)) + if (!punisher.hasPerm(punishmentType.getUserPerm())) return; SteamwarUser target = unsafeUser(sender, toPunish); @@ -246,14 +246,15 @@ public class PunishmentCommand { private final Punishment.PunishmentType punishmentType; private UnpunishCommand(String command, Punishment.PunishmentType punishmentType) { - super(command, UserPerm.TEAM); + super(command, punishmentType.getUserPerm()); this.command = command; this.punishmentType = punishmentType; } @Register public void genericCommand(Chatter sender, @ErrorMessage("UNKNOWN_PLAYER") SteamwarUser target) { - if (punishmentType.isNeedsAdmin() && !sender.user().hasPerm(UserPerm.MODERATION)) + SteamwarUser punisher = sender.user(); + if (!punisher.hasPerm(punishmentType.getUserPerm())) return; if (!target.isPunished(punishmentType)) { From 52602045a905dc2da69a2107fbc6c9f959e04e53 Mon Sep 17 00:00:00 2001 From: YoyoNow Date: Tue, 28 Oct 2025 17:36:16 +0100 Subject: [PATCH 04/15] Add GameModeConfig.Checkers --- .../src/de/steamwar/sql/GameModeConfig.java | 9 +++++++++ .../steamwar/messages/BungeeCore.properties | 1 + .../messages/BungeeCore_de.properties | 1 + .../velocitycore/commands/CheckCommand.java | 20 ++++++++++++++++--- 4 files changed, 28 insertions(+), 3 deletions(-) diff --git a/CommonCore/SQL/src/de/steamwar/sql/GameModeConfig.java b/CommonCore/SQL/src/de/steamwar/sql/GameModeConfig.java index b1e62b8b..c7e9ecf8 100644 --- a/CommonCore/SQL/src/de/steamwar/sql/GameModeConfig.java +++ b/CommonCore/SQL/src/de/steamwar/sql/GameModeConfig.java @@ -101,6 +101,14 @@ public final class GameModeConfig { */ public final List CheckQuestions; + /** + * The allowed checkers to check this schematic type denoted by a list of SteamWar ids. + * The people need the {@link UserPerm#CHECK} to be able to check though. + * + * @implSpec {@code []} by default -> denoting every person with {@link UserPerm#CHECK} can check it + */ + public final List Checkers; + /** * Bundle for countdowns during the fight */ @@ -194,6 +202,7 @@ public final class GameModeConfig { } CheckQuestions = loader.getStringList("CheckQuestions"); + Checkers = loader.getIntList("Checkers"); Times = new TimesConfig(loader.with("Times")); // Arena would be here to be in config order but needs Schematic.Size and EnterStages loaded afterwards Schematic = new SchematicConfig<>(loader.with("Schematic")); diff --git a/VelocityCore/src/de/steamwar/messages/BungeeCore.properties b/VelocityCore/src/de/steamwar/messages/BungeeCore.properties index cdec29b8..42605662 100644 --- a/VelocityCore/src/de/steamwar/messages/BungeeCore.properties +++ b/VelocityCore/src/de/steamwar/messages/BungeeCore.properties @@ -319,6 +319,7 @@ CHECK_LIST_CHECKING_HOVER=§eTo the reviewer CHECK_SCHEMATIC_ALREADY_CHECKING=§cYou are already reviewing a schematic! CHECK_SCHEMATIC_OWN=§cYou cannot review your own schematics. CHECK_SCHEMATIC_OWN_TEAM=§cYou cannot review your team schematics. +CHECK_SCHEMATIC_EVENT=§cYou cannot check the schematic for the event. CHECK_SCHEMATIC_PREVIOUS=§7{0} from {1}§8: §e{2} CHECK_INVALID_RANK=§cUnknown schematic rank. CHECK_ABORT=§aThe test operation was canceled! diff --git a/VelocityCore/src/de/steamwar/messages/BungeeCore_de.properties b/VelocityCore/src/de/steamwar/messages/BungeeCore_de.properties index ba79c219..a79cfdf7 100644 --- a/VelocityCore/src/de/steamwar/messages/BungeeCore_de.properties +++ b/VelocityCore/src/de/steamwar/messages/BungeeCore_de.properties @@ -301,6 +301,7 @@ CHECK_LIST_CHECKING_HOVER=§eZum Prüfer CHECK_SCHEMATIC_ALREADY_CHECKING=§cDu prüfst schon eine Schematic! CHECK_SCHEMATIC_OWN=§cDu kannst nicht deine eigenen Schematics prüfen. CHECK_SCHEMATIC_OWN_TEAM=§cDu kannst nicht Schematics deines Teams prüfen. +CHECK_SCHEMATIC_EVENT=§cDu kannst die schematic für das Event nicht prüfen. CHECK_SCHEMATIC_PREVIOUS=§7{0} von {1}§8: §e{2} CHECK_INVALID_RANK=§cUnbekannter Schematicrang. CHECK_ABORT=§aDer Prüfvorgang wurde abgebrochen! diff --git a/VelocityCore/src/de/steamwar/velocitycore/commands/CheckCommand.java b/VelocityCore/src/de/steamwar/velocitycore/commands/CheckCommand.java index 722a1193..43c4feb6 100644 --- a/VelocityCore/src/de/steamwar/velocitycore/commands/CheckCommand.java +++ b/VelocityCore/src/de/steamwar/velocitycore/commands/CheckCommand.java @@ -21,7 +21,6 @@ package de.steamwar.velocitycore.commands; import com.velocitypowered.api.proxy.Player; import de.steamwar.command.SWCommand; -import de.steamwar.sql.GameModeConfig; import de.steamwar.linkage.Linked; import de.steamwar.messages.Chatter; import de.steamwar.messages.Message; @@ -100,17 +99,27 @@ public class CheckCommand extends SWCommand { sender.system("CHECK_LIST_HEADER", schematicList.size()); for (SchematicNode schematic : schematicList) { + GameModeConfig gameModeConfig = ArenaMode.getBySchemType(schematic.getSchemtype()); CheckSession current = currentSchems.get(schematic.getId()); + ClickEvent clickEvent = null; + if (gameModeConfig.Checkers.isEmpty() || gameModeConfig.Checkers.contains(sender.user().getId())) { + if (current == null) { + clickEvent = ClickEvent.runCommand("/check schematic " + schematic.getId()); + } else { + clickEvent = ClickEvent.runCommand("/join " + current.checker.user().getUserName()); + } + } + if (current == null) { sender.prefixless("CHECK_LIST_TO_CHECK", new Message("CHECK_LIST_TO_CHECK_HOVER"), - ClickEvent.runCommand("/check schematic " + schematic.getId()), + clickEvent, getWaitTime(schematic), schematic.getSchemtype().getKuerzel(), SteamwarUser.get(schematic.getOwner()).getUserName(), schematic.getName()); } else { sender.prefixless("CHECK_LIST_CHECKING", new Message("CHECK_LIST_CHECKING_HOVER"), - ClickEvent.runCommand("/join " + current.checker.user().getUserName()), + clickEvent, getWaitTime(schematic), schematic.getSchemtype().getKuerzel(), SteamwarUser.get(schematic.getOwner()).getUserName(), schematic.getName(), current.checker.user().getUserName()); } @@ -125,6 +134,11 @@ public class CheckCommand extends SWCommand { } SchematicNode schem = SchematicNode.getSchematicNode(Integer.parseInt(schemID)); + GameModeConfig gameModeConfig = ArenaMode.getBySchemType(schem.getSchemtype()); + if (!gameModeConfig.Checkers.isEmpty() && !gameModeConfig.Checkers.contains(sender.user().getId())) { + sender.system("CHECK_SCHEMATIC_EVENT"); + return; + } if(!schem.getSchemtype().check()){ VelocityCore.getLogger().log(Level.SEVERE, () -> sender.user().getUserName() + " tried to check an uncheckable schematic!"); return; From 33bb1394aa5cdf2e4941049df0e135bedd9a6839 Mon Sep 17 00:00:00 2001 From: YoyoNow Date: Tue, 28 Oct 2025 17:37:05 +0100 Subject: [PATCH 05/15] Add GameModeConfig.Checkers --- .../de/steamwar/velocitycore/commands/CheckCommand.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/VelocityCore/src/de/steamwar/velocitycore/commands/CheckCommand.java b/VelocityCore/src/de/steamwar/velocitycore/commands/CheckCommand.java index 43c4feb6..2d9f4df8 100644 --- a/VelocityCore/src/de/steamwar/velocitycore/commands/CheckCommand.java +++ b/VelocityCore/src/de/steamwar/velocitycore/commands/CheckCommand.java @@ -102,23 +102,26 @@ public class CheckCommand extends SWCommand { GameModeConfig gameModeConfig = ArenaMode.getBySchemType(schematic.getSchemtype()); CheckSession current = currentSchems.get(schematic.getId()); ClickEvent clickEvent = null; + Message hoverMessage = null; if (gameModeConfig.Checkers.isEmpty() || gameModeConfig.Checkers.contains(sender.user().getId())) { if (current == null) { clickEvent = ClickEvent.runCommand("/check schematic " + schematic.getId()); + hoverMessage = new Message("CHECK_LIST_TO_CHECK_HOVER"); } else { clickEvent = ClickEvent.runCommand("/join " + current.checker.user().getUserName()); + hoverMessage = new Message("CHECK_LIST_CHECKING_HOVER"); } } if (current == null) { sender.prefixless("CHECK_LIST_TO_CHECK", - new Message("CHECK_LIST_TO_CHECK_HOVER"), + hoverMessage, clickEvent, getWaitTime(schematic), schematic.getSchemtype().getKuerzel(), SteamwarUser.get(schematic.getOwner()).getUserName(), schematic.getName()); } else { sender.prefixless("CHECK_LIST_CHECKING", - new Message("CHECK_LIST_CHECKING_HOVER"), + hoverMessage, clickEvent, getWaitTime(schematic), schematic.getSchemtype().getKuerzel(), SteamwarUser.get(schematic.getOwner()).getUserName(), schematic.getName(), current.checker.user().getUserName()); From 2654735bba107aa419f5e13b49331b90e111d367 Mon Sep 17 00:00:00 2001 From: YoyoNow Date: Tue, 28 Oct 2025 17:58:01 +0100 Subject: [PATCH 06/15] Hotfix SchematicSystem.getGameModeConfig --- .../src/de/steamwar/schematicsystem/SchematicSystem.java | 1 + 1 file changed, 1 insertion(+) diff --git a/SchematicSystem/SchematicSystem_Core/src/de/steamwar/schematicsystem/SchematicSystem.java b/SchematicSystem/SchematicSystem_Core/src/de/steamwar/schematicsystem/SchematicSystem.java index 3687a52b..a4e04c43 100644 --- a/SchematicSystem/SchematicSystem_Core/src/de/steamwar/schematicsystem/SchematicSystem.java +++ b/SchematicSystem/SchematicSystem_Core/src/de/steamwar/schematicsystem/SchematicSystem.java @@ -35,6 +35,7 @@ public class SchematicSystem extends JavaPlugin { public static GameModeConfig getGameModeConfig(SchematicType type){ GameModeConfig gameModeConfig = GameModeConfig.getBySchematicType(type); + if (gameModeConfig == null) return null; if (gameModeConfig.CheckQuestions.isEmpty() && gameModeConfig.Schematic.ManualCheck) return null; return gameModeConfig; } From 0c371fb403b258420178377458d36d14b8e162f8 Mon Sep 17 00:00:00 2001 From: YoyoNow Date: Tue, 28 Oct 2025 18:20:39 +0100 Subject: [PATCH 07/15] Fix ModifyPart.changeType --- .../commands/schematiccommand/parts/ModifyPart.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SchematicSystem/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/schematiccommand/parts/ModifyPart.java b/SchematicSystem/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/schematiccommand/parts/ModifyPart.java index 99006559..eb7a8c10 100644 --- a/SchematicSystem/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/schematiccommand/parts/ModifyPart.java +++ b/SchematicSystem/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/schematiccommand/parts/ModifyPart.java @@ -62,7 +62,7 @@ public class ModifyPart extends SWCommand { SchematicType.values().parallelStream() .filter(SchematicType::isAssignable) - .filter(type -> finalClipboard == null || SchematicSystem.getGameModeConfig(type) == null || AutoChecker.sizeCheck(finalClipboard, SchematicSystem.getGameModeConfig(type)).fastOk()) + .filter(type -> finalClipboard != null && SchematicSystem.getGameModeConfig(type) != null && AutoChecker.sizeCheck(finalClipboard, SchematicSystem.getGameModeConfig(type)).fastOk()) .forEach(type -> { TextComponent component = new TextComponent(type.name() + " "); component.setColor(ChatColor.GRAY); From 022276e05a7f99ddc7cfed25672eb19dea06fe51 Mon Sep 17 00:00:00 2001 From: YoyoNow Date: Tue, 28 Oct 2025 18:30:49 +0100 Subject: [PATCH 08/15] Improve SWCommand message visibility --- .../SpigotCore_Main/src/de/steamwar/command/SWCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/command/SWCommand.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/command/SWCommand.java index 01084241..9bc8fea8 100644 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/command/SWCommand.java +++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/command/SWCommand.java @@ -44,7 +44,7 @@ public class SWCommand extends AbstractSWCommand { private Command command; @Setter - private Message message = null; + protected Message message = null; private List defaultHelpMessages = new ArrayList<>(); protected SWCommand(String command) { From f53a31348fa0a4b451379fd71cf7f983ad496b9d Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Tue, 28 Oct 2025 22:27:06 +0100 Subject: [PATCH 09/15] Hotfix: Kotlin ist schwer, ne Yoyo? Signed-off-by: Chaoscaot --- WebsiteBackend/src/de/steamwar/sql/SQLWrapperImpl.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WebsiteBackend/src/de/steamwar/sql/SQLWrapperImpl.kt b/WebsiteBackend/src/de/steamwar/sql/SQLWrapperImpl.kt index 0e843c25..7a850cfb 100644 --- a/WebsiteBackend/src/de/steamwar/sql/SQLWrapperImpl.kt +++ b/WebsiteBackend/src/de/steamwar/sql/SQLWrapperImpl.kt @@ -26,7 +26,7 @@ class SQLWrapperImpl: SQLWrapper { return File("/configs/GameModes") } - override fun loadGameModeConfig(file: File): GameModeConfig { + override fun loadGameModeConfig(file: File?): GameModeConfig { return GameModeConfig(file, GameModeConfig.ToString, GameModeConfig.ToString, GameModeConfig.ToStaticWarGear, true) } From 5243cf850e709e5b00c7cefbe19f5a2695dc874e Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Tue, 28 Oct 2025 23:46:42 +0100 Subject: [PATCH 10/15] =?UTF-8?q?Hotfix:=201.21=20Autopr=C3=BCfer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Chaoscaot --- .../autocheck/AutoChecker15.java | 3 ++- .../schematiccommand/SchematicCommand15.java | 17 +++++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/SchematicSystem/SchematicSystem_15/src/de/steamwar/schematicsystem/autocheck/AutoChecker15.java b/SchematicSystem/SchematicSystem_15/src/de/steamwar/schematicsystem/autocheck/AutoChecker15.java index 97cf6de3..d6189931 100644 --- a/SchematicSystem/SchematicSystem_15/src/de/steamwar/schematicsystem/autocheck/AutoChecker15.java +++ b/SchematicSystem/SchematicSystem_15/src/de/steamwar/schematicsystem/autocheck/AutoChecker15.java @@ -24,6 +24,7 @@ import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.block.BaseBlock; +import de.steamwar.core.Core; import de.steamwar.sql.GameModeConfig; import de.steamwar.sql.SchematicType; import org.bukkit.Material; @@ -109,7 +110,7 @@ public class AutoChecker15 implements AutoChecker.IAutoChecker { if (!itemsInInv.getOrDefault(itemType, EnumSet.noneOf(Material.class)).contains(material)) { result.getForbiddenItems().computeIfAbsent(pos, blockVector3 -> new HashSet<>()).add(itemType); } else if(material == Material.DISPENSER && (itemType == Material.ARROW || itemType == Material.FIRE_CHARGE)) { - counter += item.getByte("Count"); + counter += Core.getVersion() >= 21 ? item.getInt("count") : item.getByte("Count"); } if (item.containsKey("tag")) { result.getForbiddenNbt().computeIfAbsent(pos, blockVector3 -> new HashSet<>()).add(itemType); diff --git a/SchematicSystem/SchematicSystem_15/src/de/steamwar/schematicsystem/commands/schematiccommand/SchematicCommand15.java b/SchematicSystem/SchematicSystem_15/src/de/steamwar/schematicsystem/commands/schematiccommand/SchematicCommand15.java index 62fa611e..05036a9a 100644 --- a/SchematicSystem/SchematicSystem_15/src/de/steamwar/schematicsystem/commands/schematiccommand/SchematicCommand15.java +++ b/SchematicSystem/SchematicSystem_15/src/de/steamwar/schematicsystem/commands/schematiccommand/SchematicCommand15.java @@ -31,6 +31,7 @@ import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockTypes; +import de.steamwar.core.Core; import de.steamwar.sql.GameModeConfig; import de.steamwar.schematicsystem.autocheck.AutoCheckerResult; import de.steamwar.schematicsystem.autocheck.BlockPos; @@ -38,9 +39,17 @@ import de.steamwar.sql.SchematicType; import org.bukkit.Material; import java.util.*; +import java.util.function.BiConsumer; +import java.util.function.BiFunction; +import java.util.function.Function; import java.util.stream.Collectors; public class SchematicCommand15 implements SchematicCommand.ISchematicCommand { + private static final Function getCount = item -> Core.getVersion() >= 21 ? item.getInt("count") : item.getByte("Count"); + private static final BiFunction setCount = (item, count) -> Core.getVersion() >= 21 ? + item.createBuilder().putInt("count", count).build() : + item.createBuilder().putByte("Count", count.byteValue()).build(); + @Override public Clipboard fixClipboard(Clipboard clipboard, AutoCheckerResult result, GameModeConfig type) throws Exception { for (BlockPos blockPos : result.getBlockScanResult().getRecords()) { @@ -87,7 +96,7 @@ public class SchematicCommand15 implements SchematicCommand.ISchematicCommand { BaseBlock block = clipboard.getFullBlock(vector); CompoundTag tag = block.getNbtData(); CompoundTagBuilder builder = tag.createBuilder(); - List items = tag.getList("Items", CompoundTag.class); + List items = new ArrayList<>(tag.getList("Items", CompoundTag.class)); Collections.reverse(items); // To let the first item be in the Dispenser List list = new ArrayList<>(); int diff = entry.getValue() - type.Schematic.MaxDispenserItems; @@ -101,12 +110,12 @@ public class SchematicCommand15 implements SchematicCommand.ISchematicCommand { continue; } - if(diff > item.getByte("Count")) { - diff -= item.getByte("Count"); + if(diff > getCount.apply(item)) { + diff -= getCount.apply(item); continue; } - item = item.createBuilder().putByte("Count", (byte) (item.getByte("Count") - diff)).build(); + item = setCount.apply(item, getCount.apply(item) - diff); diff = 0; list.add(item); } From f216ed0f0b745e95698166a7a10a458bead4bdb5 Mon Sep 17 00:00:00 2001 From: YoyoNow Date: Thu, 30 Oct 2025 15:18:09 +0100 Subject: [PATCH 11/15] Hotfix CheckCommand --- VelocityCore/src/de/steamwar/velocitycore/ArenaMode.java | 2 ++ .../src/de/steamwar/velocitycore/commands/CheckCommand.java | 1 + 2 files changed, 3 insertions(+) diff --git a/VelocityCore/src/de/steamwar/velocitycore/ArenaMode.java b/VelocityCore/src/de/steamwar/velocitycore/ArenaMode.java index 87e2bf92..48a40870 100644 --- a/VelocityCore/src/de/steamwar/velocitycore/ArenaMode.java +++ b/VelocityCore/src/de/steamwar/velocitycore/ArenaMode.java @@ -61,6 +61,8 @@ public class ArenaMode { } if (gameModeConfig.Schematic.loaded && gameModeConfig.Schematic.Type != SchematicType.Normal) { bySchemType.put(gameModeConfig.Schematic.Type, gameModeConfig); + SchematicType checkType = gameModeConfig.Schematic.Type.checkType(); + if (checkType != null) bySchemType.put(checkType, gameModeConfig); } } } diff --git a/VelocityCore/src/de/steamwar/velocitycore/commands/CheckCommand.java b/VelocityCore/src/de/steamwar/velocitycore/commands/CheckCommand.java index 2d9f4df8..589fa0c5 100644 --- a/VelocityCore/src/de/steamwar/velocitycore/commands/CheckCommand.java +++ b/VelocityCore/src/de/steamwar/velocitycore/commands/CheckCommand.java @@ -100,6 +100,7 @@ public class CheckCommand extends SWCommand { for (SchematicNode schematic : schematicList) { GameModeConfig gameModeConfig = ArenaMode.getBySchemType(schematic.getSchemtype()); + if (gameModeConfig == null) gameModeConfig = GameModeConfig.getDefaults(); CheckSession current = currentSchems.get(schematic.getId()); ClickEvent clickEvent = null; Message hoverMessage = null; From 6d8c7654833bbef1dac44f846d5a09628ad0a09f Mon Sep 17 00:00:00 2001 From: YoyoNow Date: Thu, 30 Oct 2025 15:23:40 +0100 Subject: [PATCH 12/15] Hotfix dual checking of Schematics --- .../steamwar/velocitycore/commands/CheckCommand.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/VelocityCore/src/de/steamwar/velocitycore/commands/CheckCommand.java b/VelocityCore/src/de/steamwar/velocitycore/commands/CheckCommand.java index 589fa0c5..9be08fda 100644 --- a/VelocityCore/src/de/steamwar/velocitycore/commands/CheckCommand.java +++ b/VelocityCore/src/de/steamwar/velocitycore/commands/CheckCommand.java @@ -20,6 +20,7 @@ package de.steamwar.velocitycore.commands; import com.velocitypowered.api.proxy.Player; +import com.velocitypowered.api.proxy.ServerConnection; import de.steamwar.command.SWCommand; import de.steamwar.linkage.Linked; import de.steamwar.messages.Chatter; @@ -157,6 +158,15 @@ public class CheckCommand extends SWCommand { sender.system("CHECK_SCHEMATIC_OWN_TEAM"); return; } + + CheckSession checkSession = currentSchems.get(schem.getId()); + if (checkSession != null) { + Optional serverConnection = checkSession.checker.getPlayer().getCurrentServer(); + if (serverConnection.isPresent()) { + sender.getPlayer().createConnectionRequest(serverConnection.get().getServer()).fireAndForget(); + return; + } + } new CheckSession(sender, schem); } From 62c41cdda875b0423fd925eb4cb69704f8958747 Mon Sep 17 00:00:00 2001 From: YoyoNow Date: Thu, 30 Oct 2025 16:29:57 +0100 Subject: [PATCH 13/15] Improve softreload --- .../src/de/steamwar/persistent/Persistent.java | 8 ++++++++ .../src/de/steamwar/velocitycore/VelocityCore.java | 11 +++++++++++ 2 files changed, 19 insertions(+) diff --git a/VelocityCore/Persistent/src/de/steamwar/persistent/Persistent.java b/VelocityCore/Persistent/src/de/steamwar/persistent/Persistent.java index 71139e8e..d5fac548 100644 --- a/VelocityCore/Persistent/src/de/steamwar/persistent/Persistent.java +++ b/VelocityCore/Persistent/src/de/steamwar/persistent/Persistent.java @@ -122,6 +122,7 @@ public class Persistent { container = proxy.getPluginManager().getPlugin("velocitycore").orElseThrow(); plugin = (ReloadablePlugin) container.getInstance().orElseThrow(); } catch (NoSuchElementException e) { + e.printStackTrace(); logger.log(Level.WARNING, "Could not find loaded VelocityCore, continuing without unloading."); } @@ -129,6 +130,7 @@ public class Persistent { try { newContainer = prepareLoad(); } catch (Exception e) { + e.printStackTrace(); logger.log(Level.SEVERE, "Could not instantiate new VelocityCore, aborting softreload.", e); return Command.SINGLE_SUCCESS; } @@ -136,13 +138,19 @@ public class Persistent { broadcast("§eNetwork update is starting§8."); try { if(container != null && plugin != null) { + System.out.println("Proxy Shutdown Event"); plugin.onProxyShutdown(new ProxyShutdownEvent()); + System.out.println("Unloading of Container"); unload(container, plugin); } + System.out.println("Loading of new Container"); registerPlugin.invoke((VelocityPluginManager) proxy.getPluginManager(), newContainer); + System.out.println("Proxy Initialization Event"); ((ReloadablePlugin) newContainer.getInstance().orElseThrow()).onProxyInitialization(new ProxyInitializeEvent()); + System.out.println("Proxy Initialization Event finished"); } catch (Throwable t) { + t.printStackTrace(); logger.log(Level.SEVERE, "Error during softreload", t); broadcast("§cNetwork update failed§8, §cexpect network restart soon§8."); return Command.SINGLE_SUCCESS; diff --git a/VelocityCore/src/de/steamwar/velocitycore/VelocityCore.java b/VelocityCore/src/de/steamwar/velocitycore/VelocityCore.java index 17e559ac..c8150a1b 100644 --- a/VelocityCore/src/de/steamwar/velocitycore/VelocityCore.java +++ b/VelocityCore/src/de/steamwar/velocitycore/VelocityCore.java @@ -45,6 +45,7 @@ import de.steamwar.velocitycore.commands.ServerSwitchCommand; import de.steamwar.velocitycore.commands.TeamCommand; import de.steamwar.velocitycore.discord.DiscordBot; import de.steamwar.velocitycore.discord.DiscordConfig; +import de.steamwar.velocitycore.listeners.BasicListener; import de.steamwar.velocitycore.listeners.PollSystem; import lombok.Getter; import lombok.NonNull; @@ -171,6 +172,16 @@ public class VelocityCore implements ReloadablePlugin { ((PacketHandler) any).register(); } } + + @Override + protected void unlinkObject(Object any) { + if (any instanceof PacketHandler) { + ((PacketHandler) any).unregister(); + } + if (any instanceof BasicListener) { + VelocityCore.getProxy().getEventManager().unregisterListener(instance, any); + } + } }; try { linker.link(); From e97fb674a2eeed3a6610073cf3fb78a4b65547ab Mon Sep 17 00:00:00 2001 From: YoyoNow Date: Tue, 4 Nov 2025 16:15:36 +0100 Subject: [PATCH 14/15] Fix FlatteningWrapper21 --- .../de/steamwar/core/FlatteningWrapper21.java | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 SpigotCore/SpigotCore_21/src/de/steamwar/core/FlatteningWrapper21.java diff --git a/SpigotCore/SpigotCore_21/src/de/steamwar/core/FlatteningWrapper21.java b/SpigotCore/SpigotCore_21/src/de/steamwar/core/FlatteningWrapper21.java new file mode 100644 index 00000000..25ada9a8 --- /dev/null +++ b/SpigotCore/SpigotCore_21/src/de/steamwar/core/FlatteningWrapper21.java @@ -0,0 +1,42 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2025 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.core; + +import com.destroystokyo.paper.profile.PlayerProfile; +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.OfflinePlayer; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.SkullMeta; + +public class FlatteningWrapper21 extends FlatteningWrapper14 implements FlatteningWrapper.IFlatteningWrapper { + + @Override + public ItemStack setSkullOwner(String player) { + ItemStack head = new ItemStack(Material.PLAYER_HEAD, 1); + head.editMeta(SkullMeta.class, skullMeta -> { + OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(player.startsWith(".") ? player.substring(1) : player); + PlayerProfile playerProfile = offlinePlayer.getPlayerProfile(); + if (!playerProfile.isComplete()) playerProfile.complete(); + skullMeta.setPlayerProfile(playerProfile); + }); + return head; + } +} From 73b3d21749e8bc3b0d0103d84677e3ffa98f5e9d Mon Sep 17 00:00:00 2001 From: YoyoNow Date: Tue, 4 Nov 2025 16:38:16 +0100 Subject: [PATCH 15/15] Remove unused stuff --- BauSystem/BauSystem_Main/src/BauSystem.properties | 1 - .../src/de/steamwar/bausystem/features/region/TNTCommand.java | 4 ---- 2 files changed, 5 deletions(-) diff --git a/BauSystem/BauSystem_Main/src/BauSystem.properties b/BauSystem/BauSystem_Main/src/BauSystem.properties index 432ac00a..b90933b6 100644 --- a/BauSystem/BauSystem_Main/src/BauSystem.properties +++ b/BauSystem/BauSystem_Main/src/BauSystem.properties @@ -818,7 +818,6 @@ REGION_TNT_HELP_MODE=§8/§etnt §8[§7Mode§8] §8- §7Set TNT behaviour to a g REGION_TNT_ON=§aTNT-Damage activated REGION_TNT_OFF=§cTNT-Damage deactivated REGION_TNT_TB=§aTNT-Damage activated outside the building area -REGION_TNT_BUILD=§aTNT-Damage activated outside the testblok area REGION_TNT_BUILD_DESTROY=§cAn explosion would have destroyed blocks in the building area REGION_TNT_TB_DESTROY=§cAn explosion would have destroyed blocks in the testblock area AFK_KICK_MESSAGE=§cNothing happened on this server for 15 minutes. diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/TNTCommand.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/TNTCommand.java index 074cd3c5..ad6f86a4 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/TNTCommand.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/TNTCommand.java @@ -123,10 +123,6 @@ public class TNTCommand extends SWCommand { return "REGION_TNT_TB"; } - private String getBuildEnableMessage() { - return "REGION_TNT_BUILD"; - } - private void tntToggle(Region region, TNTMode requestedMode, String requestedMessage) { if (requestedMode != null && region.getFlags().get(Flag.TESTBLOCK).isNotWithDefault(TestblockMode.NO_VALUE)) { region.getFlags().set(Flag.TNT, requestedMode);