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/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
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) {
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..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,15 +23,40 @@ 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;
+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 implements ScoreboardElement {
+public class BauLockStateScoreboard extends PacketHandler implements ScoreboardElement, Listener {
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();
+ }
+
+ @EventHandler
+ public void onCRIUWakeup(CRIUWakeupEvent event) {
+ lockState = loadLockState();
+ }
+
@Override
public ScoreboardGroup getGroup() {
return ScoreboardGroup.FOOTER;
@@ -47,23 +72,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/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
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/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);
+}
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
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;
}
diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/WorldEditRendererCUIEditor.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/WorldEditRendererCUIEditor.java
index da9646a4..0060d29a 100644
--- a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/WorldEditRendererCUIEditor.java
+++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/WorldEditRendererCUIEditor.java
@@ -24,18 +24,36 @@ 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 implements Listener {
+
+ @EventHandler
+ public void onPlayerQuit(PlayerQuitEvent event) {
+ for (Type type : Type.values()) {
+ type.materialCache.remove(event.getPlayer());
+ type.widthCache.remove(event.getPlayer());
+ }
+ }
+
+ @EventHandler
+ public void onCRIUSleep(CRIUSleepEvent event) {
+ for (Type type : Type.values()) {
+ type.materialCache.clear();
+ type.widthCache.clear();
+ }
+ }
-public class WorldEditRendererCUIEditor {
@AllArgsConstructor
public enum Type {
@@ -43,34 +61,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());
}
}
@@ -88,6 +115,7 @@ public class WorldEditRendererCUIEditor {
}
public WorldEditRendererCUIEditor() {
+ Bukkit.getPluginManager().registerEvents(this, Core.getInstance());
if (Core.getVersion() >= 20) {
new Command();
}
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;
}
diff --git a/VelocityCore/src/de/steamwar/messages/BungeeCore.properties b/VelocityCore/src/de/steamwar/messages/BungeeCore.properties
index 42605662..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 {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 a79cfdf7..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 {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/velocitycore/commands/BauCommand.java b/VelocityCore/src/de/steamwar/velocitycore/commands/BauCommand.java
index c146e1d8..77e5fae6 100644
--- a/VelocityCore/src/de/steamwar/velocitycore/commands/BauCommand.java
+++ b/VelocityCore/src/de/steamwar/velocitycore/commands/BauCommand.java
@@ -39,7 +39,7 @@ 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/discord/channels/CouncilChannel.java b/VelocityCore/src/de/steamwar/velocitycore/discord/channels/CouncilChannel.java
index cb46e718..0f0b8417 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,17 @@ 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).onError(throwable -> {
+ // Ignore
+ }).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..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;
@@ -26,6 +27,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;
@@ -63,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() {
diff --git a/VelocityCore/src/de/steamwar/velocitycore/listeners/ChatListener.java b/VelocityCore/src/de/steamwar/velocitycore/listeners/ChatListener.java
index 3ab11933..95a65761 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");
}
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) {