From 0f0c8b763e73d1ffce39f51fa35f60c4c8b88707 Mon Sep 17 00:00:00 2001 From: YoyoNow Date: Wed, 5 Nov 2025 17:09:53 +0100 Subject: [PATCH 01/14] Remove some strain on the Database --- .../world/BauLockStateScoreboard.java | 35 ++++++------ .../src/de/steamwar/data}/BauLockState.java | 2 +- .../packets/server/BaulockUpdatePacket.java | 29 ++++++++++ .../core/WorldEditRendererCUIEditor.java | 53 +++++++++++++------ .../velocitycore/commands/BauCommand.java | 3 +- .../steamwar/velocitycore/util/BauLock.java | 8 +++ 6 files changed, 95 insertions(+), 35 deletions(-) rename {VelocityCore/src/de/steamwar/velocitycore/util => CommonCore/Data/src/de/steamwar/data}/BauLockState.java (97%) create mode 100644 CommonCore/Network/src/de/steamwar/network/packets/server/BaulockUpdatePacket.java diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/BauLockStateScoreboard.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/BauLockStateScoreboard.java index abf90dc0..827a6143 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/BauLockStateScoreboard.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/BauLockStateScoreboard.java @@ -23,15 +23,32 @@ import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.config.BauServer; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.utils.ScoreboardElement; +import de.steamwar.data.BauLockState; import de.steamwar.linkage.Linked; +import de.steamwar.network.packets.PacketHandler; +import de.steamwar.network.packets.server.BaulockUpdatePacket; import de.steamwar.sql.UserConfig; +import lombok.Getter; import org.bukkit.entity.Player; @Linked -public class BauLockStateScoreboard implements ScoreboardElement { +public class BauLockStateScoreboard extends PacketHandler implements ScoreboardElement { private static final String BAU_LOCK_CONFIG_NAME = "baulockstate"; + @Getter + private BauLockState lockState = loadLockState(); + + private BauLockState loadLockState() { + String state = UserConfig.getConfig(BauServer.getInstance().getOwner(), BAU_LOCK_CONFIG_NAME); + return state == null ? BauLockState.OPEN : BauLockState.valueOf(state); + } + + @Handler + public void handleBaulockUpdatePacket(BaulockUpdatePacket packet) { + lockState = loadLockState(); + } + @Override public ScoreboardGroup getGroup() { return ScoreboardGroup.FOOTER; @@ -47,23 +64,11 @@ public class BauLockStateScoreboard implements ScoreboardElement { if (!BauServer.getInstance().getOwner().equals(p.getUniqueId())) { return null; } - String state = UserConfig.getConfig(p.getUniqueId(), BAU_LOCK_CONFIG_NAME); - switch (state == null ? BauLockState.OPEN : BauLockState.valueOf(state)) { + switch (lockState) { case OPEN: return null; default: - return "§e" + BauSystem.MESSAGE.parse("SCOREBOARD_LOCK_" + state.toUpperCase(), p); + return "§e" + BauSystem.MESSAGE.parse("SCOREBOARD_LOCK_" + lockState.name(), p); } } - - public enum BauLockState { - - NOBODY, - SUPERVISOR, - SERVERTEAM, - TEAM_AND_SERVERTEAM, - TEAM, - OPEN - } - } diff --git a/VelocityCore/src/de/steamwar/velocitycore/util/BauLockState.java b/CommonCore/Data/src/de/steamwar/data/BauLockState.java similarity index 97% rename from VelocityCore/src/de/steamwar/velocitycore/util/BauLockState.java rename to CommonCore/Data/src/de/steamwar/data/BauLockState.java index 866c4de2..0c558190 100644 --- a/VelocityCore/src/de/steamwar/velocitycore/util/BauLockState.java +++ b/CommonCore/Data/src/de/steamwar/data/BauLockState.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package de.steamwar.velocitycore.util; +package de.steamwar.data; public enum BauLockState { diff --git a/CommonCore/Network/src/de/steamwar/network/packets/server/BaulockUpdatePacket.java b/CommonCore/Network/src/de/steamwar/network/packets/server/BaulockUpdatePacket.java new file mode 100644 index 00000000..55b23b23 --- /dev/null +++ b/CommonCore/Network/src/de/steamwar/network/packets/server/BaulockUpdatePacket.java @@ -0,0 +1,29 @@ +/* + * 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.network.packets.server; + +import de.steamwar.network.packets.NetworkPacket; +import lombok.EqualsAndHashCode; + +@EqualsAndHashCode(callSuper = true) +public class BaulockUpdatePacket extends NetworkPacket { + private static final long serialVersionUID = 6863118892424244051L; + +} diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/WorldEditRendererCUIEditor.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/WorldEditRendererCUIEditor.java index da9646a4..f2b11fde 100644 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/WorldEditRendererCUIEditor.java +++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/WorldEditRendererCUIEditor.java @@ -24,18 +24,27 @@ import de.steamwar.inventory.SWInventory; import de.steamwar.inventory.SWItem; import de.steamwar.sql.UserConfig; import lombok.AllArgsConstructor; +import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.block.data.type.Light; import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.inventory.meta.BlockDataMeta; import org.bukkit.inventory.meta.ItemMeta; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; +import java.util.*; -public class WorldEditRendererCUIEditor { +public class WorldEditRendererCUIEditor implements Listener { + + @EventHandler + public void onPlayerQuit(PlayerQuitEvent event) { + for (Type type : Type.values()) { + type.materialCache.remove(event.getPlayer()); + type.widthCache.remove(event.getPlayer()); + } + } @AllArgsConstructor public enum Type { @@ -43,34 +52,43 @@ public class WorldEditRendererCUIEditor { CLIPBOARD("cui_clipboard_material", "cui_clipboard_width", Material.LIME_CONCRETE, Width.SLIM), ; + private final Map materialCache = new HashMap<>(); + private final Map widthCache = new HashMap<>(); + private final String configMaterial; private final String configWidth; private final Material defaultMaterial; private final Width defaultWidth; public Material getMaterial(Player player) { - String material = UserConfig.getConfig(player.getUniqueId(), configMaterial); - if (material == null) { - return defaultMaterial; - } else { - return Material.valueOf(material); - } + return materialCache.computeIfAbsent(player, p -> { + String material = UserConfig.getConfig(p.getUniqueId(), configMaterial); + if (material == null) { + return defaultMaterial; + } else { + return Material.valueOf(material); + } + }); } public void setMaterial(Player player, Material material) { + materialCache.put(player, material); UserConfig.updatePlayerConfig(player.getUniqueId(), configMaterial, material.name()); } public Width getWidth(Player player) { - String width = UserConfig.getConfig(player.getUniqueId(), configWidth); - if (width == null) { - return defaultWidth; - } else { - return Width.valueOf(width); - } + return widthCache.computeIfAbsent(player, p -> { + String width = UserConfig.getConfig(p.getUniqueId(), configWidth); + if (width == null) { + return defaultWidth; + } else { + return Width.valueOf(width); + } + }); } public void setWidth(Player player, Width width) { + widthCache.put(player, width); UserConfig.updatePlayerConfig(player.getUniqueId(), configWidth, width.name()); } } @@ -90,6 +108,7 @@ public class WorldEditRendererCUIEditor { public WorldEditRendererCUIEditor() { if (Core.getVersion() >= 20) { new Command(); + Bukkit.getPluginManager().registerEvents(this, Core.getInstance()); } } diff --git a/VelocityCore/src/de/steamwar/velocitycore/commands/BauCommand.java b/VelocityCore/src/de/steamwar/velocitycore/commands/BauCommand.java index 0d679ca9..cd23a910 100644 --- a/VelocityCore/src/de/steamwar/velocitycore/commands/BauCommand.java +++ b/VelocityCore/src/de/steamwar/velocitycore/commands/BauCommand.java @@ -33,14 +33,13 @@ import de.steamwar.messages.PlayerChatter; import de.steamwar.network.packets.server.BaumemberUpdatePacket; import de.steamwar.persistent.Bauserver; import de.steamwar.sql.BauweltMember; -import de.steamwar.sql.SchematicType; import de.steamwar.sql.SteamwarUser; import de.steamwar.velocitycore.*; import de.steamwar.velocitycore.inventory.SWInventory; import de.steamwar.velocitycore.inventory.SWItem; import de.steamwar.velocitycore.network.NetworkSender; import de.steamwar.velocitycore.util.BauLock; -import de.steamwar.velocitycore.util.BauLockState; +import de.steamwar.data.BauLockState; import java.util.Collection; import java.util.function.Consumer; diff --git a/VelocityCore/src/de/steamwar/velocitycore/util/BauLock.java b/VelocityCore/src/de/steamwar/velocitycore/util/BauLock.java index 41828c81..ee8d7e71 100644 --- a/VelocityCore/src/de/steamwar/velocitycore/util/BauLock.java +++ b/VelocityCore/src/de/steamwar/velocitycore/util/BauLock.java @@ -19,11 +19,15 @@ package de.steamwar.velocitycore.util; +import de.steamwar.data.BauLockState; import de.steamwar.messages.Chatter; +import de.steamwar.network.packets.server.BaulockUpdatePacket; +import de.steamwar.persistent.Bauserver; import de.steamwar.sql.BauweltMember; import de.steamwar.sql.SteamwarUser; import de.steamwar.sql.UserConfig; import de.steamwar.sql.UserPerm; +import de.steamwar.velocitycore.network.NetworkSender; import lombok.experimental.UtilityClass; @UtilityClass @@ -33,6 +37,10 @@ public class BauLock { public static void setLocked(Chatter owner, BauLockState state) { UserConfig.updatePlayerConfig(owner.user().getId(), BAU_LOCK_CONFIG_NAME, state == BauLockState.OPEN ? null : state.name()); owner.system("BAU_LOCKED_" + state.name()); + + Bauserver bauserver = Bauserver.get(owner.user().getUUID()); + if(bauserver != null) + bauserver.getRegisteredServer().getPlayersConnected().stream().findAny().ifPresent(player -> NetworkSender.send(player, new BaulockUpdatePacket())); } public static boolean isLocked(SteamwarUser owner, SteamwarUser target) { From 2534451e26976472a6c993fbe154319465c8630b Mon Sep 17 00:00:00 2001 From: YoyoNow Date: Wed, 5 Nov 2025 17:13:54 +0100 Subject: [PATCH 02/14] Fix caching problems --- .../src/de/steamwar/core/WorldEditRendererCUIEditor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/WorldEditRendererCUIEditor.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/WorldEditRendererCUIEditor.java index f2b11fde..193e8a98 100644 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/WorldEditRendererCUIEditor.java +++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/WorldEditRendererCUIEditor.java @@ -106,9 +106,9 @@ public class WorldEditRendererCUIEditor implements Listener { } public WorldEditRendererCUIEditor() { + Bukkit.getPluginManager().registerEvents(this, Core.getInstance()); if (Core.getVersion() >= 20) { new Command(); - Bukkit.getPluginManager().registerEvents(this, Core.getInstance()); } } From a3273f68140cf5fcc56dcc2941bc4714acf9a33c Mon Sep 17 00:00:00 2001 From: YoyoNow Date: Wed, 5 Nov 2025 17:15:20 +0100 Subject: [PATCH 03/14] Fix some stuff related to CRIU --- .../features/world/BauLockStateScoreboard.java | 10 +++++++++- .../de/steamwar/core/WorldEditRendererCUIEditor.java | 9 +++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/BauLockStateScoreboard.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/BauLockStateScoreboard.java index 827a6143..147c3c85 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/BauLockStateScoreboard.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/BauLockStateScoreboard.java @@ -23,6 +23,7 @@ import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.config.BauServer; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.utils.ScoreboardElement; +import de.steamwar.core.CRIUWakeupEvent; import de.steamwar.data.BauLockState; import de.steamwar.linkage.Linked; import de.steamwar.network.packets.PacketHandler; @@ -30,9 +31,11 @@ import de.steamwar.network.packets.server.BaulockUpdatePacket; import de.steamwar.sql.UserConfig; import lombok.Getter; import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; @Linked -public class BauLockStateScoreboard extends PacketHandler implements ScoreboardElement { +public class BauLockStateScoreboard extends PacketHandler implements ScoreboardElement, Listener { private static final String BAU_LOCK_CONFIG_NAME = "baulockstate"; @@ -49,6 +52,11 @@ public class BauLockStateScoreboard extends PacketHandler implements ScoreboardE lockState = loadLockState(); } + @EventHandler + public void onCRIUWakeup(CRIUWakeupEvent event) { + lockState = loadLockState(); + } + @Override public ScoreboardGroup getGroup() { return ScoreboardGroup.FOOTER; diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/WorldEditRendererCUIEditor.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/WorldEditRendererCUIEditor.java index 193e8a98..0060d29a 100644 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/WorldEditRendererCUIEditor.java +++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/WorldEditRendererCUIEditor.java @@ -46,6 +46,15 @@ public class WorldEditRendererCUIEditor implements Listener { } } + @EventHandler + public void onCRIUSleep(CRIUSleepEvent event) { + for (Type type : Type.values()) { + type.materialCache.clear(); + type.widthCache.clear(); + } + } + + @AllArgsConstructor public enum Type { SELECTION("cui_selection_material", "cui_selection_width", Material.PURPLE_CONCRETE, Width.MEDIUM), From 17910ec8a493871942577f93d28ad9dcc2347585 Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Thu, 6 Nov 2025 02:07:20 +0100 Subject: [PATCH 04/14] Add version dependant impl --- .gitignore | 1 + .../fightsystem/utils/TpsWarper21.java | 11 +++++++ .../fightsystem/utils/TpsWarper8.java | 11 +++++++ .../fightsystem/commands/TPSWarpCommand.java | 31 ++++++++++--------- .../steamwar/fightsystem/utils/TpsWarper.java | 10 ++++++ 5 files changed, 49 insertions(+), 15 deletions(-) create mode 100644 FightSystem/FightSystem_21/src/de/steamwar/fightsystem/utils/TpsWarper21.java create mode 100644 FightSystem/FightSystem_8/src/de/steamwar/fightsystem/utils/TpsWarper8.java create mode 100644 FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/utils/TpsWarper.java diff --git a/.gitignore b/.gitignore index 3ef53412..cc1b960d 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ steamwar.properties # VSCode bin/ .vscode +.settings # Other lib diff --git a/FightSystem/FightSystem_21/src/de/steamwar/fightsystem/utils/TpsWarper21.java b/FightSystem/FightSystem_21/src/de/steamwar/fightsystem/utils/TpsWarper21.java new file mode 100644 index 00000000..94e8d5d6 --- /dev/null +++ b/FightSystem/FightSystem_21/src/de/steamwar/fightsystem/utils/TpsWarper21.java @@ -0,0 +1,11 @@ +package de.steamwar.fightsystem.utils; + +import net.minecraft.server.MinecraftServer; + +public class TpsWarper21 implements TpsWarper { + + @Override + public void warp(float tps) { + MinecraftServer.getServer().tickRateManager().setTickRate(tps); + } +} diff --git a/FightSystem/FightSystem_8/src/de/steamwar/fightsystem/utils/TpsWarper8.java b/FightSystem/FightSystem_8/src/de/steamwar/fightsystem/utils/TpsWarper8.java new file mode 100644 index 00000000..3e73cb4b --- /dev/null +++ b/FightSystem/FightSystem_8/src/de/steamwar/fightsystem/utils/TpsWarper8.java @@ -0,0 +1,11 @@ +package de.steamwar.fightsystem.utils; + +import de.steamwar.core.TPSWarpUtils; + +public class TpsWarper8 implements TpsWarper { + + @Override + public void warp(float tps) { + TPSWarpUtils.warp(tps); + } +} diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/commands/TPSWarpCommand.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/commands/TPSWarpCommand.java index 434f373e..42bd72d6 100644 --- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/commands/TPSWarpCommand.java +++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/commands/TPSWarpCommand.java @@ -1,20 +1,18 @@ /* - * This file is a part of the SteamWar software. + * This file is a part of the SteamWar software. * - * Copyright (C) 2025 SteamWar.de-Serverteam + * 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 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. + * 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 . + * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . */ package de.steamwar.fightsystem.commands; @@ -24,6 +22,7 @@ import de.steamwar.fightsystem.ArenaMode; import de.steamwar.fightsystem.FightSystem; import de.steamwar.fightsystem.states.FightState; import de.steamwar.fightsystem.states.StateDependentCommand; +import de.steamwar.fightsystem.utils.TpsWarper; import de.steamwar.linkage.Linked; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; @@ -39,15 +38,17 @@ public class TPSWarpCommand implements CommandExecutor { @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { - double tps; + float tps; try { - tps = Double.parseDouble(args[0]); + tps = Float.parseFloat(args[0]); } catch (NumberFormatException | ArrayIndexOutOfBoundsException e) { FightSystem.getMessage().send("TPSWARP_HELP", sender); return false; } - TPSWarpUtils.warp(tps); + TpsWarper warper = TpsWarper.impl; + warper.warp(tps); + FightSystem.getMessage().broadcastActionbar("TPSWARP_SET", tps); return false; } diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/utils/TpsWarper.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/utils/TpsWarper.java new file mode 100644 index 00000000..de7f5b31 --- /dev/null +++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/utils/TpsWarper.java @@ -0,0 +1,10 @@ +package de.steamwar.fightsystem.utils; + +import de.steamwar.core.VersionDependent; +import de.steamwar.fightsystem.FightSystem; + +public interface TpsWarper { + TpsWarper impl = VersionDependent.getVersionImpl(FightSystem.getPlugin()); + + void warp(float tps); +} From 160f98295542580eecf8d793b5b1ae26a6d0d941 Mon Sep 17 00:00:00 2001 From: YoyoNow Date: Fri, 7 Nov 2025 08:34:19 +0100 Subject: [PATCH 05/14] Improve ChatListener for STC Chat Add debug output for DiscordChannel Fix CouncilChannel --- .../discord/channels/CouncilChannel.java | 18 ++++++++++++------ .../discord/channels/StaticMessageChannel.java | 1 + .../velocitycore/listeners/ChatListener.java | 2 +- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/VelocityCore/src/de/steamwar/velocitycore/discord/channels/CouncilChannel.java b/VelocityCore/src/de/steamwar/velocitycore/discord/channels/CouncilChannel.java index cb46e718..7f1b1d60 100644 --- a/VelocityCore/src/de/steamwar/velocitycore/discord/channels/CouncilChannel.java +++ b/VelocityCore/src/de/steamwar/velocitycore/discord/channels/CouncilChannel.java @@ -20,17 +20,16 @@ package de.steamwar.velocitycore.discord.channels; import de.steamwar.sql.SteamwarUser; +import de.steamwar.velocitycore.VelocityCore; import de.steamwar.velocitycore.discord.DiscordBot; import it.unimi.dsi.fastutil.Pair; import net.dv8tion.jda.api.EmbedBuilder; +import net.dv8tion.jda.api.entities.Member; import net.dv8tion.jda.api.entities.Role; import net.dv8tion.jda.api.entities.channel.concrete.ThreadChannel; import net.dv8tion.jda.api.utils.messages.MessageCreateBuilder; -import java.util.Comparator; -import java.util.HashSet; -import java.util.Set; -import java.util.UUID; +import java.util.*; public class CouncilChannel extends StaticMessageChannel { @@ -45,8 +44,15 @@ public class CouncilChannel extends StaticMessageChannel { MessageCreateBuilder messageCreateBuilder = new MessageCreateBuilder(); messageCreateBuilder.setContent("# Ratsmitglieder"); - DiscordBot.getGuild().findMembersWithRoles(role).get() - .stream() + List members; + try { + members = DiscordBot.getGuild().findMembersWithRoles(role).get(); + } catch (Exception e) { + VelocityCore.getLogger().warning("Could not get members for " + role.getName()); + return messageCreateBuilder; + } + + members.stream() .map(member -> { SteamwarUser steamwarUser = SteamwarUser.get(member.getIdLong()); String name = steamwarUser == null ? member.getEffectiveName() : steamwarUser.getUserName(); diff --git a/VelocityCore/src/de/steamwar/velocitycore/discord/channels/StaticMessageChannel.java b/VelocityCore/src/de/steamwar/velocitycore/discord/channels/StaticMessageChannel.java index 178acbcd..5108b1d2 100644 --- a/VelocityCore/src/de/steamwar/velocitycore/discord/channels/StaticMessageChannel.java +++ b/VelocityCore/src/de/steamwar/velocitycore/discord/channels/StaticMessageChannel.java @@ -26,6 +26,7 @@ import net.dv8tion.jda.api.events.interaction.component.GenericComponentInteract import net.dv8tion.jda.api.utils.messages.MessageCreateBuilder; import net.dv8tion.jda.api.utils.messages.MessageEditData; +import java.util.concurrent.TimeoutException; import java.util.function.Consumer; import java.util.function.Supplier; diff --git a/VelocityCore/src/de/steamwar/velocitycore/listeners/ChatListener.java b/VelocityCore/src/de/steamwar/velocitycore/listeners/ChatListener.java index 6b0c7059..d0bfe2a7 100644 --- a/VelocityCore/src/de/steamwar/velocitycore/listeners/ChatListener.java +++ b/VelocityCore/src/de/steamwar/velocitycore/listeners/ChatListener.java @@ -189,7 +189,7 @@ public class ChatListener extends BasicListener { if(format.equals("CHAT_GLOBAL")) { DiscordBot.withBot(bot -> chatToReciever(bot.getIngameChat(), msgReceiver, user, format, coloredMessage)); } else if (format.equals("CHAT_SERVERTEAM")) { - DiscordBot.withBot(bot -> chatToReciever(bot.getServerTeamChat(), msgReceiver, user, format, coloredMessage)); + DiscordBot.withBot(bot -> chatToReciever(bot.getServerTeamChat(), msgReceiver, user, "CHAT_GLOBAL", coloredMessage)); } else if (noReceiver) { sender.system("CHAT_NO_RECEIVER"); } From f0e18bfc720eb8ee4e668e9972d45044ab8d0ba6 Mon Sep 17 00:00:00 2001 From: YoyoNow Date: Fri, 7 Nov 2025 08:39:42 +0100 Subject: [PATCH 06/14] Improve CouncilChannel and StaticMessageChannel --- .../velocitycore/discord/channels/CouncilChannel.java | 4 +++- .../velocitycore/discord/channels/StaticMessageChannel.java | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/VelocityCore/src/de/steamwar/velocitycore/discord/channels/CouncilChannel.java b/VelocityCore/src/de/steamwar/velocitycore/discord/channels/CouncilChannel.java index 7f1b1d60..0f0b8417 100644 --- a/VelocityCore/src/de/steamwar/velocitycore/discord/channels/CouncilChannel.java +++ b/VelocityCore/src/de/steamwar/velocitycore/discord/channels/CouncilChannel.java @@ -46,7 +46,9 @@ public class CouncilChannel extends StaticMessageChannel { List members; try { - members = DiscordBot.getGuild().findMembersWithRoles(role).get(); + members = DiscordBot.getGuild().findMembersWithRoles(role).onError(throwable -> { + // Ignore + }).get(); } catch (Exception e) { VelocityCore.getLogger().warning("Could not get members for " + role.getName()); return messageCreateBuilder; diff --git a/VelocityCore/src/de/steamwar/velocitycore/discord/channels/StaticMessageChannel.java b/VelocityCore/src/de/steamwar/velocitycore/discord/channels/StaticMessageChannel.java index 5108b1d2..f959e1f4 100644 --- a/VelocityCore/src/de/steamwar/velocitycore/discord/channels/StaticMessageChannel.java +++ b/VelocityCore/src/de/steamwar/velocitycore/discord/channels/StaticMessageChannel.java @@ -19,6 +19,7 @@ package de.steamwar.velocitycore.discord.channels; +import de.steamwar.velocitycore.VelocityCore; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.entities.Message; import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel; @@ -64,7 +65,7 @@ public class StaticMessageChannel extends DiscordChannel { if(getChannel().getLatestMessageIdLong() != 0) message = getChannel().getIterableHistory().complete().stream().filter(m -> m.getAuthor().isBot()).findFirst().orElse(null); - update(); + VelocityCore.schedule(this::update); } public void update() { From c17b76851df917d87bdf3a46fce84d96723e922a Mon Sep 17 00:00:00 2001 From: YoyoNow Date: Fri, 7 Nov 2025 08:44:07 +0100 Subject: [PATCH 07/14] Improve chat from discord --- VelocityCore/src/de/steamwar/messages/BungeeCore.properties | 2 +- VelocityCore/src/de/steamwar/messages/BungeeCore_de.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/VelocityCore/src/de/steamwar/messages/BungeeCore.properties b/VelocityCore/src/de/steamwar/messages/BungeeCore.properties index 42605662..14c82866 100644 --- a/VelocityCore/src/de/steamwar/messages/BungeeCore.properties +++ b/VelocityCore/src/de/steamwar/messages/BungeeCore.properties @@ -578,7 +578,7 @@ CHAT_EMPTY=§cDon\'t write meaningless empty messages. CHAT_SERVERTEAM=§8STC §e{0}§8» §f{2} CHAT_DISCORD_SERVERTEAM=§8STC §e{0}§8» §f{2} CHAT_GLOBAL={3}{4}{5}{6}{0}§8» {7}{2} -CHAT_DISCORD_GLOBAL=§8Dc {5}{6}{0}§8» {7}{2} +CHAT_DISCORD_GLOBAL=§8DC {3}{4}{5}{6}{0}§8» {7}{2} CHAT_TEAM=§8TC §e{0}§8» §f{2} CHAT_MSG=§e{0}§8»§e{1} §7{2} diff --git a/VelocityCore/src/de/steamwar/messages/BungeeCore_de.properties b/VelocityCore/src/de/steamwar/messages/BungeeCore_de.properties index a79cfdf7..ced0dabc 100644 --- a/VelocityCore/src/de/steamwar/messages/BungeeCore_de.properties +++ b/VelocityCore/src/de/steamwar/messages/BungeeCore_de.properties @@ -552,7 +552,7 @@ CHAT_EMPTY=§cSchreibe keine inhaltslosen Nachrichten. CHAT_SERVERTEAM=§8STC §e{0}§8» §f{2} CHAT_DISCORD_SERVERTEAM=§8STC §e{0}§8» §f{2} CHAT_GLOBAL={3}{4}{5}{6}{0}§8» {7}{2} -CHAT_DISCORD_GLOBAL=§8Dc {5}{6}{0}§8» {7}{2} +CHAT_DISCORD_GLOBAL=§8DC {3}{4}{5}{6}{0}§8» {7}{2} CHAT_TEAM=§8TC §e{0}§8» §f{2} CHAT_MSG=§e{0}§8»§e{1} §7{2} From 3ccfe92afbddf7ff871dcb9bd22d4a616b5b2017 Mon Sep 17 00:00:00 2001 From: YoyoNow Date: Fri, 7 Nov 2025 08:46:26 +0100 Subject: [PATCH 08/14] Remove DC prefix for discord send messages to cleanup the chat --- VelocityCore/src/de/steamwar/messages/BungeeCore.properties | 2 +- VelocityCore/src/de/steamwar/messages/BungeeCore_de.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/VelocityCore/src/de/steamwar/messages/BungeeCore.properties b/VelocityCore/src/de/steamwar/messages/BungeeCore.properties index 14c82866..9eb776fb 100644 --- a/VelocityCore/src/de/steamwar/messages/BungeeCore.properties +++ b/VelocityCore/src/de/steamwar/messages/BungeeCore.properties @@ -578,7 +578,7 @@ CHAT_EMPTY=§cDon\'t write meaningless empty messages. CHAT_SERVERTEAM=§8STC §e{0}§8» §f{2} CHAT_DISCORD_SERVERTEAM=§8STC §e{0}§8» §f{2} CHAT_GLOBAL={3}{4}{5}{6}{0}§8» {7}{2} -CHAT_DISCORD_GLOBAL=§8DC {3}{4}{5}{6}{0}§8» {7}{2} +CHAT_DISCORD_GLOBAL={3}{4}{5}{6}{0}§8» {7}{2} CHAT_TEAM=§8TC §e{0}§8» §f{2} CHAT_MSG=§e{0}§8»§e{1} §7{2} diff --git a/VelocityCore/src/de/steamwar/messages/BungeeCore_de.properties b/VelocityCore/src/de/steamwar/messages/BungeeCore_de.properties index ced0dabc..82005c6d 100644 --- a/VelocityCore/src/de/steamwar/messages/BungeeCore_de.properties +++ b/VelocityCore/src/de/steamwar/messages/BungeeCore_de.properties @@ -552,7 +552,7 @@ CHAT_EMPTY=§cSchreibe keine inhaltslosen Nachrichten. CHAT_SERVERTEAM=§8STC §e{0}§8» §f{2} CHAT_DISCORD_SERVERTEAM=§8STC §e{0}§8» §f{2} CHAT_GLOBAL={3}{4}{5}{6}{0}§8» {7}{2} -CHAT_DISCORD_GLOBAL=§8DC {3}{4}{5}{6}{0}§8» {7}{2} +CHAT_DISCORD_GLOBAL={3}{4}{5}{6}{0}§8» {7}{2} CHAT_TEAM=§8TC §e{0}§8» §f{2} CHAT_MSG=§e{0}§8»§e{1} §7{2} From f9b3dd34cfdfc19ceba39a04903cd5e7c189d36e Mon Sep 17 00:00:00 2001 From: YoyoNow Date: Fri, 7 Nov 2025 15:25:20 +0100 Subject: [PATCH 09/14] Trigger rebuild --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ad9f4739..ff33e203 100644 --- a/README.md +++ b/README.md @@ -1 +1 @@ -# SteamWar +# SteamWar \ No newline at end of file From cac0ae3e1305c99fa098c1cef83a21fc64938088 Mon Sep 17 00:00:00 2001 From: YoyoNow Date: Fri, 7 Nov 2025 15:41:48 +0100 Subject: [PATCH 10/14] Hotfix MaterialLazyInit for 1.21 --- .../de/steamwar/bausystem/features/util/MaterialLazyInit.java | 1 + 1 file changed, 1 insertion(+) diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/util/MaterialLazyInit.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/util/MaterialLazyInit.java index f05e0de9..4f174c12 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/util/MaterialLazyInit.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/util/MaterialLazyInit.java @@ -87,6 +87,7 @@ public class MaterialLazyInit { Block block = Bukkit.getWorlds().get(0).getBlockAt(0, 0, 0); block.setType(material); unmoveable = block.getPistonMoveReaction() == PistonMoveReaction.BLOCK || block.getPistonMoveReaction() == PistonMoveReaction.IGNORE || block.getState() instanceof TileState; + block.setType(Material.AIR); } if (material.isItem() && material != Material.AIR) { From ee997083406c4879026fa65606fca26ddaaac1bb Mon Sep 17 00:00:00 2001 From: YoyoNow Date: Fri, 7 Nov 2025 22:13:31 +0100 Subject: [PATCH 11/14] Hotfix (FA)WE Selection 1.20+ --- SpigotCore/SpigotCore_Main/src/de/steamwar/entity/CLine.java | 2 ++ .../SpigotCore_Main/src/de/steamwar/entity/CWireframe.java | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/entity/CLine.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/entity/CLine.java index 7e9ae4cc..ea296aad 100644 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/entity/CLine.java +++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/entity/CLine.java @@ -63,7 +63,9 @@ public class CLine extends CEntity { if (Objects.equals(from, this.from) && Objects.equals(to, this.to)) return this; this.from = from; this.to = to; + hide(true); tick(); + hide(false); return this; } diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/entity/CWireframe.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/entity/CWireframe.java index 9f75c6e5..2f6567b6 100644 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/entity/CWireframe.java +++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/entity/CWireframe.java @@ -82,7 +82,7 @@ public class CWireframe extends CEntity { private void updateAndSpawnLines() { List lines = getEntitiesByType(CLine.class); if (pos1 == null || pos2 == null) { - lines.forEach(line -> line.setFrom(null).setTo(null)); + lines.forEach(line -> line.setFromAndTo(null, null)); return; } From 415d7833652d6ad54a615adfdf9991a99e7e6c8f Mon Sep 17 00:00:00 2001 From: YoyoNow Date: Fri, 7 Nov 2025 22:17:30 +0100 Subject: [PATCH 12/14] Hotfix SEND_COMMAND_FEEDBACK in 1.20+ --- .../BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java index a854f082..261eb835 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java @@ -46,6 +46,7 @@ import de.steamwar.linkage.SpigotLinker; import de.steamwar.message.Message; import lombok.Getter; import org.bukkit.Bukkit; +import org.bukkit.GameRule; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -128,6 +129,8 @@ public class BauSystem extends JavaPlugin implements Listener { TraceRecorder.instance.init(); new WorldEditRendererCUIEditor(); + + Bukkit.getWorlds().get(0).setGameRule(GameRule.SEND_COMMAND_FEEDBACK, false); } @EventHandler From fb4e53165f5a673efd52b1b0e72ea73b613f4eac Mon Sep 17 00:00:00 2001 From: YoyoNow Date: Fri, 7 Nov 2025 22:42:48 +0100 Subject: [PATCH 13/14] Hotfix FixedFlagStorage.clear and FixedGlobalFlagStorage.clear --- .../steamwar/bausystem/region/fixed/FixedFlagStorage.java | 7 ++++++- .../bausystem/region/fixed/FixedGlobalFlagStorage.java | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/BauSystem/BauSystem_RegionFixed/src/de/steamwar/bausystem/region/fixed/FixedFlagStorage.java b/BauSystem/BauSystem_RegionFixed/src/de/steamwar/bausystem/region/fixed/FixedFlagStorage.java index 293e0121..c902f941 100644 --- a/BauSystem/BauSystem_RegionFixed/src/de/steamwar/bausystem/region/fixed/FixedFlagStorage.java +++ b/BauSystem/BauSystem_RegionFixed/src/de/steamwar/bausystem/region/fixed/FixedFlagStorage.java @@ -84,7 +84,12 @@ public class FixedFlagStorage implements FlagStorage { @Override public void clear() { - flagMap.clear(); + for (Flag flag : Flag.getFlags()) { + if (flag == Flag.TESTBLOCK) continue; + if (flag == Flag.COLOR) continue; + if (flag == Flag.CHANGED) continue; + flagMap.remove(flag); + } } @Override diff --git a/BauSystem/BauSystem_RegionFixed/src/de/steamwar/bausystem/region/fixed/FixedGlobalFlagStorage.java b/BauSystem/BauSystem_RegionFixed/src/de/steamwar/bausystem/region/fixed/FixedGlobalFlagStorage.java index 1fc4be27..69766fee 100644 --- a/BauSystem/BauSystem_RegionFixed/src/de/steamwar/bausystem/region/fixed/FixedGlobalFlagStorage.java +++ b/BauSystem/BauSystem_RegionFixed/src/de/steamwar/bausystem/region/fixed/FixedGlobalFlagStorage.java @@ -91,7 +91,12 @@ public class FixedGlobalFlagStorage implements FlagStorage { @Override public void clear() { - flagMap.clear(); + for (Flag flag : Flag.getFlags()) { + if (flag == Flag.TESTBLOCK) continue; + if (flag == Flag.COLOR) continue; + if (flag == Flag.CHANGED) continue; + flagMap.remove(flag); + } } @Override From 69cf219e39fdd7cd4a3381822abf7e4d0daa59af Mon Sep 17 00:00:00 2001 From: YoyoNow Date: Fri, 7 Nov 2025 22:47:05 +0100 Subject: [PATCH 14/14] Fix FlatteningWrapper21 --- .../src/de/steamwar/core/FlatteningWrapper21.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/SpigotCore/SpigotCore_21/src/de/steamwar/core/FlatteningWrapper21.java b/SpigotCore/SpigotCore_21/src/de/steamwar/core/FlatteningWrapper21.java index 25ada9a8..35ef5ed2 100644 --- a/SpigotCore/SpigotCore_21/src/de/steamwar/core/FlatteningWrapper21.java +++ b/SpigotCore/SpigotCore_21/src/de/steamwar/core/FlatteningWrapper21.java @@ -32,10 +32,14 @@ public class FlatteningWrapper21 extends FlatteningWrapper14 implements Flatteni 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); + try { + OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(player.startsWith(".") ? player.substring(1) : player); + PlayerProfile playerProfile = offlinePlayer.getPlayerProfile(); + playerProfile.complete(); + skullMeta.setPlayerProfile(playerProfile); + } catch (Exception e) { + // Ignore + } }); return head; }