diff --git a/.idea/runConfigurations/Remote_JVM_Debugger.xml b/.idea/runConfigurations/Remote_JVM_Debugger.xml
new file mode 100644
index 00000000..d7e6e149
--- /dev/null
+++ b/.idea/runConfigurations/Remote_JVM_Debugger.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorCursor.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorCursor.java
index a59a0206..c557f95f 100644
--- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorCursor.java
+++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorCursor.java
@@ -80,7 +80,7 @@ public class SimulatorCursor implements Listener {
}
public SimulatorCursor() {
- BiFunction function = (player, object) -> {
+ BiFunction function = (player, object) -> {
calcCursor(player);
return object;
};
diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/BlockBoundingBox.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/BlockBoundingBox.java
index 12636ba9..0df055af 100644
--- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/BlockBoundingBox.java
+++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/BlockBoundingBox.java
@@ -21,7 +21,6 @@ package de.steamwar.bausystem.features.slaves.laufbau;
import com.sk89q.worldedit.blocks.SkullBlock;
import com.sk89q.worldedit.world.block.BaseBlock;
-import de.steamwar.bausystem.utils.NMSWrapper;
import de.steamwar.inventory.SWItem;
import lombok.Getter;
import lombok.ToString;
@@ -99,7 +98,7 @@ public class BlockBoundingBox {
// addPixel(Material.COBWEB.createBlockData(), 0, 0, 0, 0, 0, 0, createItem("LAUFBAU_BLOCK_COBWEB", Material.COBWEB));
addPixel(Material.END_STONE.createBlockData(), 0, 0, 0, 16, 16, 16, null);
- addPixel(NMSWrapper.impl.pathMaterial().createBlockData(), 0, 0, 0, 16, 15, 16, createItem("LAUFBAU_BLOCK_GRASS_PATH", NMSWrapper.impl.pathMaterial()));
+ addPixel(Material.DIRT_PATH.createBlockData(), 0, 0, 0, 16, 15, 16, createItem("LAUFBAU_BLOCK_GRASS_PATH", Material.DIRT_PATH));
addPixel(Material.MUD.createBlockData(), 0, 0, 0, 16, 14, 16, createItem("LAUFBAU_BLOCK_SOUL_SAND", Material.SOUL_SAND));
Cocoa cocoaNorth = (Cocoa) Material.COCOA.createBlockData();
diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/techhider/TechHiderCommand.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/techhider/TechHiderCommand.java
index f737af0a..4744e41d 100644
--- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/techhider/TechHiderCommand.java
+++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/techhider/TechHiderCommand.java
@@ -31,7 +31,6 @@ import de.steamwar.command.TypeMapper;
import de.steamwar.core.CraftbukkitWrapper;
import de.steamwar.linkage.Linked;
import de.steamwar.linkage.LinkedInstance;
-import de.steamwar.techhider.TechHider;
import net.md_5.bungee.api.ChatMessageType;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
@@ -39,6 +38,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerQuitEvent;
+import de.steamwar.techhider.legacy.TechHider;
import java.util.*;
import java.util.stream.Collectors;
diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/tpslimit/TPSSystem.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/tpslimit/TPSSystem.java
index a9b36c50..3e1c2772 100644
--- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/tpslimit/TPSSystem.java
+++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/tpslimit/TPSSystem.java
@@ -19,13 +19,13 @@
package de.steamwar.bausystem.features.tpslimit;
+import com.destroystokyo.paper.event.server.ServerTickEndEvent;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.SWUtils;
import de.steamwar.bausystem.linkage.BauGuiItem;
import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.utils.ScoreboardElement;
-import de.steamwar.bausystem.utils.TickEndEvent;
import de.steamwar.bausystem.utils.TickManager;
import de.steamwar.bausystem.utils.bossbar.BauSystemBossbar;
import de.steamwar.bausystem.utils.bossbar.BossBarService;
@@ -72,7 +72,7 @@ public class TPSSystem implements Listener {
}
@EventHandler
- public void onTickEnd(TickEndEvent event) {
+ public void onTickEnd(ServerTickEndEvent event) {
bossbar();
}
diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/util/NoClipCommand.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/util/NoClipCommand.java
index 36829c3b..0b10e163 100644
--- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/util/NoClipCommand.java
+++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/util/NoClipCommand.java
@@ -21,17 +21,22 @@ package de.steamwar.bausystem.features.util;
import com.comphenix.tinyprotocol.TinyProtocol;
import com.mojang.authlib.GameProfile;
+import de.steamwar.Reflection;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.features.tpslimit.TPSUtils;
import de.steamwar.bausystem.utils.BauMemberUpdateEvent;
-import de.steamwar.bausystem.utils.NMSWrapper;
import de.steamwar.command.SWCommand;
import de.steamwar.core.ProtocolWrapper;
import de.steamwar.core.SWPlayer;
import de.steamwar.linkage.Linked;
import net.minecraft.network.protocol.game.*;
+import net.minecraft.server.level.ServerPlayerGameMode;
+import net.minecraft.world.entity.player.Abilities;
+import net.minecraft.world.level.GameType;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
+import org.bukkit.craftbukkit.entity.CraftPlayer;
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
@@ -57,11 +62,11 @@ public class NoClipCommand extends SWCommand implements Listener {
public NoClipCommand() {
super("noclip", "nc");
- BiFunction first = (player, o) -> {
+ BiFunction first = (player, o) -> {
NoClipData noClipData = SWPlayer.of(player).getComponent(NoClipData.class).orElse(null);
if (noClipData == null) return o;
if (noClipData.lastTick == TPSUtils.currentTick.get()) return o;
- NMSWrapper.impl.setInternalGameMode(player, GameMode.SPECTATOR);
+ setInternalGameMode(player, GameMode.SPECTATOR);
noClipData.lastTick = TPSUtils.currentTick.get();
return o;
};
@@ -71,7 +76,7 @@ public class NoClipCommand extends SWCommand implements Listener {
BiFunction second = (player, o) -> {
NoClipData noClipData = SWPlayer.of(player).getComponent(NoClipData.class).orElse(null);
if (noClipData == null) return o;
- NMSWrapper.impl.setInternalGameMode(player, GameMode.CREATIVE);
+ setInternalGameMode(player, GameMode.CREATIVE);
noClipData.lastTick = TPSUtils.currentTick.get();
return o;
};
@@ -79,15 +84,31 @@ public class NoClipCommand extends SWCommand implements Listener {
TinyProtocol.instance.addFilter(ServerboundPlayerActionPacket.class, second);
TinyProtocol.instance.addFilter(ServerboundContainerClickPacket.class, second);
- BiFunction third = (player, o) -> {
+ BiFunction third = (player, o) -> {
if (SWPlayer.of(player).hasComponent(NoClipData.class)) {
- NMSWrapper.impl.setSlotToItemStack(player, o);
+ int index = o.slotNum();
+ if (index >= 36 && index <= 44) {
+ index -= 36;
+ } else if (index > 44) {
+ index -= 5;
+ } else if (index <= 8) {
+ index = index - 8 + 36;
+ }
+ player.getInventory().setItem(index, CraftItemStack.asBukkitCopy(o.itemStack()));
+ if (index < 9) player.getInventory().setHeldItemSlot(index);
+ player.updateInventory();
}
return o;
};
TinyProtocol.instance.addFilter(ServerboundSetCreativeModeSlotPacket.class, third);
}
+ private static final Reflection.Field playerGameMode = Reflection.getField(ServerPlayerGameMode.class, GameType.class, 0);
+
+ private void setInternalGameMode(Player player, GameMode gameMode) {
+ playerGameMode.set(((CraftPlayer) player).getHandle().gameMode, GameType.byId(gameMode.getValue()));
+ }
+
@Register(help = true)
public void genericCommand(@Validator Player player) {
SWPlayer swPlayer = SWPlayer.of(player);
@@ -95,7 +116,9 @@ public class NoClipCommand extends SWCommand implements Listener {
swPlayer.removeComponent(NoClipData.class);
} else {
player.setGameMode(GameMode.SPECTATOR);
- NMSWrapper.impl.setPlayerBuildAbilities(player);
+ Abilities abilities = (((CraftPlayer) player).getHandle()).getAbilities();
+ abilities.mayBuild = true;
+ abilities.mayfly = true;
swPlayer.setComponent(new NoClipData());
BauSystem.MESSAGE.send("OTHER_NOCLIP_SLOT_INFO", player);
diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/BauMemberUpdate.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/BauMemberUpdate.java
index a3f912ec..ed5b068b 100644
--- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/BauMemberUpdate.java
+++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/BauMemberUpdate.java
@@ -28,6 +28,7 @@ import de.steamwar.bausystem.utils.bossbar.BossBarService;
import de.steamwar.linkage.Linked;
import de.steamwar.network.packets.PacketHandler;
import de.steamwar.network.packets.server.BaumemberUpdatePacket;
+import io.papermc.paper.event.player.PlayerPickBlockEvent;
import org.bukkit.Bukkit;
import org.bukkit.boss.BarColor;
import org.bukkit.boss.BarStyle;
@@ -35,6 +36,8 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.PlayerDeathEvent;
+import org.bukkit.event.inventory.ClickType;
+import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.player.PlayerItemConsumeEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
@@ -127,4 +130,11 @@ public class BauMemberUpdate extends PacketHandler implements Listener {
}
}, 1);
}
+
+ @EventHandler
+ public void onPlayerClick(PlayerPickBlockEvent event) {
+ if(SPECTATORS.contains(event.getPlayer())) {
+ event.setCancelled(true);
+ }
+ }
}
diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/InventoryListener.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/InventoryListener.java
index edc9f9c2..964f50e6 100644
--- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/InventoryListener.java
+++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/InventoryListener.java
@@ -19,8 +19,9 @@
package de.steamwar.bausystem.features.world;
-import de.steamwar.bausystem.utils.NMSWrapper;
import de.steamwar.linkage.Linked;
+import io.papermc.paper.datacomponent.DataComponentTypes;
+import io.papermc.paper.datacomponent.item.ItemContainerContents;
import org.bukkit.attribute.Attribute;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
@@ -32,6 +33,8 @@ import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
+import java.util.List;
+
@Linked
public class InventoryListener implements Listener {
@@ -57,7 +60,7 @@ public class InventoryListener implements Listener {
}
stack.setItemMeta(meta);
}
- if (NMSWrapper.impl.checkItemStack(stack)) {
+ if (checkItemStack(stack)) {
e.setCurrentItem(null);
e.setCancelled(true);
return;
@@ -73,7 +76,7 @@ public class InventoryListener implements Listener {
for (int i = 0; i < content.length; i++) {
if (content[i] == null) continue;
int finalI = i;
- if (NMSWrapper.impl.checkItemStack(content[finalI])) {
+ if (checkItemStack(content[finalI])) {
p.getInventory().setItem(i, null);
}
}
@@ -82,11 +85,44 @@ public class InventoryListener implements Listener {
@EventHandler(ignoreCancelled = true)
public void onBlockPlace(BlockPlaceEvent event) {
Player p = event.getPlayer();
- if (NMSWrapper.impl.checkItemStack(event.getItemInHand())) {
+ if (checkItemStack(event.getItemInHand())) {
event.setCancelled(true);
event.setBuild(false);
p.getInventory().setItemInMainHand(null);
p.getInventory().setItemInOffHand(null);
}
}
+
+ private static final int threshold = 2048;
+
+ private boolean checkItemStack(ItemStack item) {
+ ItemContainerContents data = item.getData(DataComponentTypes.CONTAINER);
+ if (data == null) {
+ return false;
+ }
+
+ return drillDown(data.contents(), 0, 0) > threshold;
+ }
+
+ private int drillDown(List items, int layer, int start) {
+ if (layer > 2) return start + threshold;
+ int invalid = start;
+ for (int i = start; i < items.size(); i++) {
+ ItemStack item = items.get(i);
+ if (item.isEmpty()) continue;
+
+ invalid += item.getAmount();
+
+ ItemContainerContents data = item.getData(DataComponentTypes.CONTAINER);
+ if (data == null) {
+ continue;
+ }
+
+ List subItems = data.contents();
+ if (subItems.size() > 1) {
+ invalid = drillDown(subItems, layer + 1, invalid);
+ }
+ }
+ return invalid;
+ }
}
diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/NoCreativeKnockback.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/NoCreativeKnockback.java
index 2debf84e..55b7b0f4 100644
--- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/NoCreativeKnockback.java
+++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/NoCreativeKnockback.java
@@ -20,18 +20,24 @@
package de.steamwar.bausystem.features.world;
import com.comphenix.tinyprotocol.TinyProtocol;
-import de.steamwar.bausystem.utils.NMSWrapper;
import de.steamwar.linkage.Linked;
import net.minecraft.network.protocol.game.ClientboundExplodePacket;
import org.bukkit.GameMode;
+import java.util.Optional;
+
@Linked
public class NoCreativeKnockback {
public NoCreativeKnockback() {
TinyProtocol.instance.addFilter(ClientboundExplodePacket.class, (player, o) -> {
if (player.getGameMode() != GameMode.CREATIVE) return o;
- return NMSWrapper.impl.resetExplosionKnockback(o);
+ return new ClientboundExplodePacket(
+ o.center(),
+ Optional.empty(),
+ o.explosionParticle(),
+ o.explosionSound()
+ );
});
}
}
diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/SignEdit.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/SignEdit.java
index 95f0a337..5fcbcbf5 100644
--- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/SignEdit.java
+++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/SignEdit.java
@@ -101,7 +101,7 @@ public class SignEdit implements Listener {
}
{
- TinyProtocol.instance.addTypedFilter(ServerboundSignUpdatePacket.class, (player, o) -> {
+ TinyProtocol.instance.addFilter(ServerboundSignUpdatePacket.class, (player, o) -> {
Bukkit.getScheduler().runTask(BauSystem.getInstance(), () -> {
ServerLevel serverLevel = ((CraftWorld) player.getWorld()).getHandle();
Block signLoc = CraftBlock.at(serverLevel, o.getPos());
diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/SpectatorListener.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/SpectatorListener.java
index c9e6a3a6..92a5c59e 100644
--- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/SpectatorListener.java
+++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/SpectatorListener.java
@@ -25,7 +25,6 @@ import de.steamwar.bausystem.config.BauServer;
import de.steamwar.bausystem.utils.BauMemberUpdateEvent;
import de.steamwar.linkage.Linked;
import de.steamwar.sql.BauweltMember;
-import de.steamwar.techhider.TechHider;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
@@ -40,6 +39,7 @@ import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.EntityPickupItemEvent;
import org.bukkit.event.player.*;
import org.bukkit.util.Vector;
+import de.steamwar.techhider.legacy.TechHider;
import java.util.HashSet;
import java.util.Set;
diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/xray/XrayCommand.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/xray/XrayCommand.java
index c2cb9091..55bcbeeb 100644
--- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/xray/XrayCommand.java
+++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/xray/XrayCommand.java
@@ -28,7 +28,6 @@ import de.steamwar.command.SWCommand;
import de.steamwar.core.CraftbukkitWrapper;
import de.steamwar.linkage.Linked;
import de.steamwar.linkage.LinkedInstance;
-import de.steamwar.techhider.TechHider;
import net.md_5.bungee.api.ChatMessageType;
import net.minecraft.network.protocol.game.ServerboundMovePlayerPacket;
import net.minecraft.server.level.ServerPlayer;
@@ -41,6 +40,7 @@ import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerQuitEvent;
+import de.steamwar.techhider.legacy.TechHider;
import java.util.*;
import java.util.function.BiFunction;
@@ -115,8 +115,8 @@ public class XrayCommand extends SWCommand implements Listener, ScoreboardElemen
return packet;
};
- TinyProtocol.instance.addTypedFilter(ServerboundMovePlayerPacket.Pos.class, positionSetter);
- TinyProtocol.instance.addTypedFilter(ServerboundMovePlayerPacket.PosRot.class, positionSetter);
+ TinyProtocol.instance.addFilter(ServerboundMovePlayerPacket.Pos.class, positionSetter);
+ TinyProtocol.instance.addFilter(ServerboundMovePlayerPacket.PosRot.class, positionSetter);
}
@EventHandler
diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/utils/NMSWrapper.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/utils/NMSWrapper.java
deleted file mode 100644
index 7141ff96..00000000
--- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/utils/NMSWrapper.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * 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.bausystem.utils;
-
-import de.steamwar.Reflection;
-import io.papermc.paper.datacomponent.DataComponentTypes;
-import io.papermc.paper.datacomponent.item.ItemContainerContents;
-import net.minecraft.network.protocol.game.ClientboundContainerSetSlotPacket;
-import net.minecraft.network.protocol.game.ClientboundExplodePacket;
-import net.minecraft.server.level.ServerPlayerGameMode;
-import net.minecraft.world.entity.player.Abilities;
-import net.minecraft.world.level.GameType;
-import org.bukkit.GameMode;
-import org.bukkit.Material;
-import org.bukkit.craftbukkit.entity.CraftPlayer;
-import org.bukkit.craftbukkit.inventory.CraftItemStack;
-import org.bukkit.entity.Player;
-import org.bukkit.inventory.ItemStack;
-
-import java.util.List;
-import java.util.Optional;
-
-public class NMSWrapper {
- public static final NMSWrapper impl = new NMSWrapper();
-
- private static final Reflection.Field playerGameMode = Reflection.getField(ServerPlayerGameMode.class, GameType.class, 0);
-
- public void setInternalGameMode(Player player, GameMode gameMode) {
- playerGameMode.set(((CraftPlayer) player).getHandle().gameMode, GameType.byId(gameMode.getValue()));
- }
-
- public void setSlotToItemStack(Player player, Object o) {
- ClientboundContainerSetSlotPacket packetPlayInSetCreativeSlot = (ClientboundContainerSetSlotPacket) o;
- int index = packetPlayInSetCreativeSlot.getSlot();
- if (index >= 36 && index <= 44) {
- index -= 36;
- } else if (index > 44) {
- index -= 5;
- } else if (index <= 8) {
- index = index - 8 + 36;
- }
- player.getInventory().setItem(index, CraftItemStack.asBukkitCopy(packetPlayInSetCreativeSlot.getItem()));
- if (index < 9) player.getInventory().setHeldItemSlot(index);
- player.updateInventory();
- }
-
- public void setPlayerBuildAbilities(Player player) {
- Abilities abilities = (((CraftPlayer) player).getHandle()).getAbilities();
- abilities.mayBuild = true;
- abilities.mayfly = true;
- }
-
- public Material pathMaterial() {
- return Material.DIRT_PATH;
- }
-
- private static final int threshold = 2048;
-
- public boolean checkItemStack(ItemStack item) {
- ItemContainerContents data = item.getData(DataComponentTypes.CONTAINER);
- if (data == null) {
- return false;
- }
-
- return drillDown(data.contents(), 0, 0) > threshold;
- }
-
- private int drillDown(List items, int layer, int start) {
- if (layer > 2) return start + threshold;
- int invalid = start;
- for (int i = start; i < items.size(); i++) {
- ItemStack item = items.get(i);
- if (item.isEmpty()) continue;
-
- invalid += item.getAmount();
-
- ItemContainerContents data = item.getData(DataComponentTypes.CONTAINER);
- if (data == null) {
- continue;
- }
-
- List subItems = data.contents();
- if (subItems.size() > 1) {
- invalid = drillDown(subItems, layer + 1, invalid);
- }
- }
- return invalid;
- }
-
- public Object resetExplosionKnockback(Object packet) {
- ClientboundExplodePacket explosion = (ClientboundExplodePacket) packet;
-
- return new ClientboundExplodePacket(
- explosion.center(),
- Optional.empty(),
- explosion.explosionParticle(),
- explosion.explosionSound()
- );
- }
-}
diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/utils/TickEndEvent.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/utils/TickEndEvent.java
deleted file mode 100644
index ad145dbe..00000000
--- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/utils/TickEndEvent.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.bausystem.utils;
-
-import org.bukkit.event.Event;
-import org.bukkit.event.HandlerList;
-
-public class TickEndEvent extends Event {
-
- private static final HandlerList handlers = new HandlerList();
-
- public HandlerList getHandlers() {
- return handlers;
- }
-
- public static HandlerList getHandlerList() {
- return handlers;
- }
-}
diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/utils/TickManager.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/utils/TickManager.java
index 086999e3..59d12df2 100644
--- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/utils/TickManager.java
+++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/utils/TickManager.java
@@ -42,7 +42,7 @@ public class TickManager implements Listener {
TinyProtocol.instance.addFilter(ClientboundTickingStatePacket.class, this::blockPacket);
}
- private Object blockPacket(Player player, Object packet) {
+ private Object blockPacket(Player player, ClientboundTickingStatePacket packet) {
if (blockTpsPacket) {
return new ClientboundTickingStatePacket(20, manager.isFrozen());
} else {
diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/utils/TickStartEvent.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/utils/TickStartEvent.java
deleted file mode 100644
index fbb02f22..00000000
--- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/utils/TickStartEvent.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.bausystem.utils;
-
-import org.bukkit.event.Event;
-import org.bukkit.event.HandlerList;
-
-public class TickStartEvent extends Event {
-
- private static final HandlerList handlers = new HandlerList();
-
- public HandlerList getHandlers() {
- return handlers;
- }
-
- public static HandlerList getHandlerList() {
- return handlers;
- }
-}
diff --git a/BauSystem/build.gradle.kts b/BauSystem/build.gradle.kts
index 574ee012..de9fe1b8 100644
--- a/BauSystem/build.gradle.kts
+++ b/BauSystem/build.gradle.kts
@@ -31,15 +31,6 @@ dependencies {
implementation(project(":BauSystem:BauSystem_Main"))
}
-tasks.register("DevBau20") {
- group = "run"
- description = "Run a 1.20 Dev Bau"
- dependsOn(":SpigotCore:shadowJar")
- dependsOn(":BauSystem:shadowJar")
- dependsOn(":SchematicSystem:shadowJar")
- template = "Bau20"
-}
-
tasks.register("DevBau21") {
group = "run"
description = "Run a 1.21 Dev Bau"
diff --git a/CommonCore/SQL/src/de/steamwar/sql/SchematicNode.kt b/CommonCore/SQL/src/de/steamwar/sql/SchematicNode.kt
index 0dde368b..860aeebd 100644
--- a/CommonCore/SQL/src/de/steamwar/sql/SchematicNode.kt
+++ b/CommonCore/SQL/src/de/steamwar/sql/SchematicNode.kt
@@ -434,7 +434,7 @@ class SchematicNode(id: EntityID) : IntEntity(id) {
private var nodeItem by SchematicNodeTable.item
var item: String
get() = nodeItem.ifEmpty {
- if (isDir()) "CHEST" else "CAULDRON_ITEM"
+ if (isDir()) "CHEST" else "CAULDRON"
}
set(value) = useDb {
nodeItem = value
diff --git a/CommonCore/SQL/src/de/steamwar/sql/SteamwarUser.kt b/CommonCore/SQL/src/de/steamwar/sql/SteamwarUser.kt
index 7466a96d..0d19c712 100644
--- a/CommonCore/SQL/src/de/steamwar/sql/SteamwarUser.kt
+++ b/CommonCore/SQL/src/de/steamwar/sql/SteamwarUser.kt
@@ -25,6 +25,7 @@ import org.jetbrains.exposed.v1.core.dao.id.EntityID
import org.jetbrains.exposed.v1.core.dao.id.IntIdTable
import org.jetbrains.exposed.v1.core.eq
import org.jetbrains.exposed.v1.core.inList
+import org.jetbrains.exposed.v1.core.neq
import org.jetbrains.exposed.v1.dao.IntEntity
import org.jetbrains.exposed.v1.dao.IntEntityClass
import org.jetbrains.exposed.v1.jdbc.insert
@@ -136,6 +137,12 @@ class SteamwarUser(id: EntityID) : IntEntity(id) {
.select(SteamwarUserTable.fields).where { UserPermTable.perm eq perm }.map { wrapRow(it) }
}
+ @JvmStatic
+ fun getUsersWithDiscordId() =
+ useDb {
+ find { SteamwarUserTable.discordId neq null }.toList()
+ }
+
@JvmStatic
fun getServerTeam() =
useDb {
diff --git a/FightSystem/FightSystem_Core/build.gradle.kts b/FightSystem/FightSystem_Core/build.gradle.kts
index b346e97c..9b2f746b 100644
--- a/FightSystem/FightSystem_Core/build.gradle.kts
+++ b/FightSystem/FightSystem_Core/build.gradle.kts
@@ -37,4 +37,5 @@ dependencies {
compileOnly(libs.authlib)
compileOnly(libs.nms)
compileOnly(libs.fawe)
+ compileOnly(libs.datafixer)
}
diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.java
index ab85a9b2..d3339975 100644
--- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.java
+++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.java
@@ -41,6 +41,9 @@ import de.steamwar.sql.SchematicNode;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.GameRule;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.player.PlayerPickupArrowEvent;
import org.bukkit.plugin.java.JavaPlugin;
public class FightSystem extends JavaPlugin {
@@ -95,13 +98,20 @@ public class FightSystem extends JavaPlugin {
getMessage().broadcast("PISTON_PUSHED_OUTSIDE");
shutdown();
});
- new StateDependentListener(ArenaMode.All, FightState.All, BountifulWrapper.impl.newDenyArrowPickupListener());
+ new StateDependentListener(ArenaMode.All, FightState.All, new Listener() {
+ @EventHandler
+ public void onArrowPickup(PlayerPickupArrowEvent e) {
+ if (Fight.fighting(e.getPlayer())) e.setCancelled(true);
+ }
+ });
new OneShotStateDependent(ArenaMode.All, FightState.PreSchemSetup, () -> Fight.playSound(SWSound.BLOCK_NOTE_PLING.getSound(), 100.0f, 2.0f));
new OneShotStateDependent(ArenaMode.Test, FightState.All, WorldEditRendererCUIEditor::new);
Config.world.setGameRule(GameRule.REDUCED_DEBUG_INFO, ArenaMode.AntiTest.contains(Config.mode));
- techHider = new TechHiderWrapper();
hullHider = new HullHider();
+ techHider = new TechHiderWrapper(hullHider);
+ FightSystem.getHullHider().getHullMap().values().forEach(hull -> hull.fill(true));
+
FileSource.startReplay();
@@ -120,7 +130,7 @@ public class FightSystem extends JavaPlugin {
Fight.getUnrotated().setSchem(SchematicNode.getSchematicNode(Config.PrepareSchemID));
}
- CraftbukkitWrapper.impl.setupGamerule();
+ Config.world.setGameRule(GameRule.LOCATOR_BAR, false);
}
@Override
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 e6755bb9..6ec55acd 100644
--- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/commands/TPSWarpCommand.java
+++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/commands/TPSWarpCommand.java
@@ -21,8 +21,8 @@ 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 net.minecraft.server.MinecraftServer;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@@ -45,8 +45,7 @@ public class TPSWarpCommand implements CommandExecutor {
return false;
}
- TpsWarper warper = TpsWarper.impl;
- warper.warp(tps);
+ MinecraftServer.getServer().tickRateManager().setTickRate(tps);
FightSystem.getMessage().broadcastActionbar("TPSWARP_SET", tps);
return false;
diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightSchematic.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightSchematic.java
index 790a1cec..c8174349 100644
--- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightSchematic.java
+++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightSchematic.java
@@ -158,6 +158,8 @@ public class FightSchematic extends StateDependent {
FreezeWorld freezer = new FreezeWorld();
team.teleportToSpawn();
+ // TODO: Implement hull generation based on clipboard content!
+ FightSystem.getHullHider().fill(team, false);
Vector dims = WorldeditWrapper.impl.getDimensions(clipboard);
WorldeditWrapper.impl.pasteClipboard(
clipboard,
diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightTeam.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightTeam.java
index 78dff55b..a8cddb3a 100644
--- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightTeam.java
+++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightTeam.java
@@ -44,6 +44,8 @@ import de.steamwar.sql.SteamwarUser;
import lombok.Getter;
import net.md_5.bungee.api.ChatMessageType;
import org.bukkit.*;
+import org.bukkit.attribute.Attribute;
+import org.bukkit.attribute.AttributeInstance;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.scoreboard.NameTagVisibility;
@@ -151,8 +153,8 @@ public class FightTeam {
new TeamArea(this);
team = FightScoreboard.getBukkitTeam(name);
- WorldOfColorWrapper.impl.setTeamColor(team, color);
- BountifulWrapper.impl.setNametagVisibility(team);
+ team.setColor(color);
+ team.setOption(Team.Option.NAME_TAG_VISIBILITY, Team.OptionStatus.FOR_OWN_TEAM);
team.setNameTagVisibility(NameTagVisibility.HIDE_FOR_OTHER_TEAMS);
if (!Config.GameModeConfig.WinConditions.contains(Winconditions.AMONG_US)) {
team.setAllowFriendlyFire(false);
@@ -284,7 +286,8 @@ public class FightTeam {
entity.teleport(spawn);
fightPlayer.ifPlayer(player -> {
- BountifulWrapper.impl.setAttackSpeed(player);
+ AttributeInstance attribute = player.getAttribute(Attribute.ATTACK_SPEED);
+ attribute.setBaseValue(16);
player.setFoodLevel(20);
player.getInventory().clear();
FightSystem.getHullHider().updatePlayer(player);
diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightWorld.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightWorld.java
index e978f038..83c15170 100644
--- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightWorld.java
+++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightWorld.java
@@ -26,7 +26,6 @@ import de.steamwar.fightsystem.listener.Recording;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependent;
import de.steamwar.fightsystem.utils.CraftbukkitWrapper;
-import de.steamwar.fightsystem.utils.FlatteningWrapper;
import de.steamwar.linkage.Linked;
import lombok.Getter;
import org.bukkit.Bukkit;
@@ -64,11 +63,18 @@ public class FightWorld extends StateDependent {
public static void forceLoad() {
Config.ArenaRegion.forEachChunk((cX, cZ) -> {
Config.world.loadChunk(cX, cZ);
- FlatteningWrapper.impl.forceLoadChunk(Config.world, cX, cZ);
+ Config.world.setChunkForceLoaded(cX, cZ, true);
});
}
public static void resetWorld() {
+ World backup = new WorldCreator(Config.world.getName() + "/backup").createWorld();
+ assert backup != null;
+ Config.ArenaRegion.forEachChunk((x, z) -> {
+ CraftbukkitWrapper.impl.resetChunk(Config.world, backup, x, z);
+ });
+ Bukkit.unloadWorld(backup, false);
+
List entities = new ArrayList<>();
Recording.iterateOverEntities(Objects::nonNull, entity -> {
if (entity.getType() != EntityType.PLAYER && (!Config.GameModeConfig.Arena.Leaveable || Config.ArenaRegion.inRegion(entity.getLocation()))) {
@@ -78,14 +84,12 @@ public class FightWorld extends StateDependent {
entities.forEach(Entity::remove);
entities.clear();
- World backup = new WorldCreator(Config.world.getName() + "/backup").createWorld();
- assert backup != null;
+ FightSystem.getHullHider().getHullMap().values().forEach(hull -> hull.fill(true));
+
Config.ArenaRegion.forEachChunk((x, z) -> {
- CraftbukkitWrapper.impl.resetChunk(Config.world, backup, x, z);
for (Player p : Bukkit.getOnlinePlayers()) {
de.steamwar.core.CraftbukkitWrapper.sendChunk(p, x, z);
}
});
- Bukkit.unloadWorld(backup, false);
}
}
\ No newline at end of file
diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/fight/FreezeWorld.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/fight/FreezeWorld.java
index e120d234..71c579bd 100644
--- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/fight/FreezeWorld.java
+++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/fight/FreezeWorld.java
@@ -20,7 +20,6 @@
package de.steamwar.fightsystem.fight;
import de.steamwar.fightsystem.FightSystem;
-import de.steamwar.fightsystem.utils.BountifulWrapper;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@@ -30,19 +29,16 @@ import org.bukkit.event.block.*;
import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.event.inventory.InventoryMoveItemEvent;
import org.bukkit.event.player.PlayerInteractEvent;
+import org.bukkit.event.player.PlayerSwapHandItemsEvent;
public class FreezeWorld implements Listener {
- private final Listener denyHandSwap = BountifulWrapper.impl.newDenyHandSwapListener();
-
public FreezeWorld() {
Bukkit.getPluginManager().registerEvents(this, FightSystem.getPlugin());
- Bukkit.getPluginManager().registerEvents(denyHandSwap, FightSystem.getPlugin());
}
public void disable() {
HandlerList.unregisterAll(this);
- HandlerList.unregisterAll(denyHandSwap);
}
@EventHandler
@@ -94,4 +90,9 @@ public class FreezeWorld implements Listener {
public void handlePlayerInteract(PlayerInteractEvent event) {
event.setCancelled(true);
}
+
+ @EventHandler
+ public void onSwapItems(PlayerSwapHandItemsEvent event) {
+ if (Fight.fighting(event.getPlayer())) event.setCancelled(true);
+ }
}
diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/fight/Kit.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/fight/Kit.java
index 672ab18c..a6844252 100644
--- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/fight/Kit.java
+++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/fight/Kit.java
@@ -24,12 +24,12 @@ import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.commands.Commands;
import de.steamwar.fightsystem.commands.GUI;
import de.steamwar.fightsystem.listener.PersonalKitCreator;
-import de.steamwar.fightsystem.utils.FlatteningWrapper;
-import de.steamwar.fightsystem.utils.ReflectionWrapper;
import de.steamwar.inventory.SWInventory;
import de.steamwar.inventory.SWItem;
import de.steamwar.sql.PersonalKit;
import de.steamwar.sql.SteamwarUser;
+import io.papermc.paper.datacomponent.DataComponentType;
+import io.papermc.paper.datacomponent.DataComponentTypes;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.Material;
@@ -39,6 +39,7 @@ import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.meta.BlockDataMeta;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.potion.PotionEffect;
@@ -193,13 +194,13 @@ public class Kit {
if (Config.GameModeConfig.Kits.ForbiddenItems.contains(stack.getType())) return true;
//Check for attribute modifiers
- if (FlatteningWrapper.impl.hasAttributeModifier(stack)) {
+ if (stack.hasItemMeta() && stack.getItemMeta() != null && stack.getItemMeta().hasAttributeModifiers()) {
return true;
}
if (stack.hasItemMeta()) {
ItemMeta meta = stack.getItemMeta();
- if (FlatteningWrapper.impl.containsBlockMeta(meta)) return true; //Blocks always upwards slabs etc.
+ if (meta instanceof BlockDataMeta && ((BlockDataMeta) meta).hasBlockData()) return true; //Blocks always upwards slabs etc.
if (hasItems(stack)) return true; //Blocks prefilled inventories
}
@@ -208,8 +209,42 @@ public class Kit {
return !normal.isEnchantmentInKit(stack) && !stack.getEnchantments().isEmpty();
}
+ private static final Set FORBIDDEN_TYPES = new HashSet<>();
+
+ static {
+ FORBIDDEN_TYPES.add(DataComponentTypes.CUSTOM_NAME);
+ FORBIDDEN_TYPES.add(DataComponentTypes.PROFILE);
+ FORBIDDEN_TYPES.add(DataComponentTypes.UNBREAKABLE);
+ FORBIDDEN_TYPES.add(DataComponentTypes.BLOCK_DATA);
+ FORBIDDEN_TYPES.add(DataComponentTypes.BLOCKS_ATTACKS);
+ FORBIDDEN_TYPES.add(DataComponentTypes.BUNDLE_CONTENTS);
+ FORBIDDEN_TYPES.add(DataComponentTypes.CUSTOM_MODEL_DATA);
+
+ FORBIDDEN_TYPES.add(DataComponentTypes.ATTRIBUTE_MODIFIERS);
+ FORBIDDEN_TYPES.add(DataComponentTypes.TOOL);
+ FORBIDDEN_TYPES.add(DataComponentTypes.WEAPON);
+ FORBIDDEN_TYPES.add(DataComponentTypes.FOOD);
+ FORBIDDEN_TYPES.add(DataComponentTypes.CONSUMABLE);
+ FORBIDDEN_TYPES.add(DataComponentTypes.POTION_CONTENTS);
+ FORBIDDEN_TYPES.add(DataComponentTypes.STORED_ENCHANTMENTS);
+ FORBIDDEN_TYPES.add(DataComponentTypes.CAN_BREAK);
+ FORBIDDEN_TYPES.add(DataComponentTypes.CAN_PLACE_ON);
+ FORBIDDEN_TYPES.add(DataComponentTypes.MAX_DAMAGE);
+ FORBIDDEN_TYPES.add(DataComponentTypes.USE_REMAINDER);
+ FORBIDDEN_TYPES.add(DataComponentTypes.USE_COOLDOWN);
+ FORBIDDEN_TYPES.add(DataComponentTypes.SUSPICIOUS_STEW_EFFECTS);
+ FORBIDDEN_TYPES.add(DataComponentTypes.CHARGED_PROJECTILES);
+ FORBIDDEN_TYPES.add(DataComponentTypes.INTANGIBLE_PROJECTILE);
+ FORBIDDEN_TYPES.add(DataComponentTypes.FIREWORKS);
+ FORBIDDEN_TYPES.add(DataComponentTypes.FIREWORK_EXPLOSION);
+ FORBIDDEN_TYPES.add(DataComponentTypes.EQUIPPABLE);
+ FORBIDDEN_TYPES.add(DataComponentTypes.REPAIR_COST);
+ FORBIDDEN_TYPES.add(DataComponentTypes.ENCHANTABLE);
+ }
+
public static boolean hasItems(ItemStack stack) {
- return ReflectionWrapper.impl.hasItems(stack);
+ FORBIDDEN_TYPES.forEach(stack::resetData);
+ return false;
}
private boolean isEnchantmentInKit(ItemStack stack) {
diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/ArrowStopper.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/ArrowStopper.java
index 03e00bbf..e6b0c64e 100644
--- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/ArrowStopper.java
+++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/ArrowStopper.java
@@ -22,12 +22,12 @@ package de.steamwar.fightsystem.listener;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentTask;
-import de.steamwar.fightsystem.utils.WorldOfColorWrapper;
import de.steamwar.linkage.Linked;
import net.minecraft.world.entity.projectile.AbstractArrow;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
+import org.bukkit.entity.Arrow;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.projectiles.ProjectileSource;
@@ -93,8 +93,12 @@ public class ArrowStopper {
boolean teamFrom = entity.getVelocity().getZ() > 0;
boolean overMid = location.getZ() > Config.SpecSpawn.getZ();
boolean otherSide = teamFrom == overMid;
- return otherSide || !Config.ArenaRegion.inRegion(location) ||
- WorldOfColorWrapper.impl.isInBlock(entity) ||
+ if (otherSide || !Config.ArenaRegion.inRegion(location)) return true;
+ boolean result = false;
+ if (entity instanceof Arrow arrow) {
+ result = arrow.isInBlock();
+ }
+ return result ||
entity.getVelocity().equals(NULL_VECTOR);
}
}
diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/BlockPlaceCollision.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/BlockPlaceCollision.java
index efce662e..97b49283 100644
--- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/BlockPlaceCollision.java
+++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/BlockPlaceCollision.java
@@ -22,11 +22,11 @@ package de.steamwar.fightsystem.listener;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentListener;
-import de.steamwar.fightsystem.utils.FlatteningWrapper;
import de.steamwar.linkage.Linked;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
+import org.bukkit.entity.Pose;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockPlaceEvent;
@@ -46,7 +46,7 @@ public class BlockPlaceCollision implements Listener {
// Hitbox size: 0.6xz, 1.8y, 1.5y when sneaking
Player player = event.getPlayer();
Location min = player.getLocation().add(-0.3, 0, -0.3);
- Location max = player.getLocation().add(0.3, FlatteningWrapper.impl.isCrouching(player) ? 0.6 : (player.isSneaking() ? 1.5 : 1.8), 0.3);
+ Location max = player.getLocation().add(0.3, player.getPose() == Pose.SWIMMING ? 0.6 : (player.isSneaking() ? 1.5 : 1.8), 0.3);
Location blockmin = block.getLocation();
Location blockmax = block.getLocation().add(1.0, 1.0, 1.0);
diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/Border.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/Border.java
index 39fb1870..55864abd 100644
--- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/Border.java
+++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/Border.java
@@ -24,7 +24,6 @@ import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentTask;
-import de.steamwar.fightsystem.utils.FlatteningWrapper;
import de.steamwar.fightsystem.utils.Region;
import net.md_5.bungee.api.ChatMessageType;
import org.bukkit.Bukkit;
@@ -141,7 +140,7 @@ public class Border {
private void sendChange(Player player, Block block, Material type) {
if (block.getType() == Material.AIR) {
- FlatteningWrapper.impl.sendBlockChange(player, block, type);
+ player.sendBlockChange(block.getLocation(), type.createBlockData());
}
}
}
diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/ClickAnalyzer.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/ClickAnalyzer.java
index 3def965c..3e84d916 100644
--- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/ClickAnalyzer.java
+++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/ClickAnalyzer.java
@@ -24,6 +24,7 @@ import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.utils.CraftbukkitWrapper;
import de.steamwar.linkage.Linked;
import net.minecraft.network.protocol.game.ServerboundUseItemOnPacket;
+import net.minecraft.network.protocol.game.ServerboundUseItemPacket;
import org.bukkit.entity.Player;
import java.io.*;
@@ -42,7 +43,7 @@ public class ClickAnalyzer {
}
public ClickAnalyzer() {
- TinyProtocol.instance.addFilter(Recording.blockPlacePacket, this::onBlockPlace);
+ TinyProtocol.instance.addFilter(ServerboundUseItemPacket.class, this::onBlockPlace);
TinyProtocol.instance.addFilter(ServerboundUseItemOnPacket.class, this::onBlockPlace);
}
diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/DenyInventoryMovement.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/DenyInventoryMovement.java
index e9c1d797..0452691c 100644
--- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/DenyInventoryMovement.java
+++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/DenyInventoryMovement.java
@@ -20,24 +20,22 @@
package de.steamwar.fightsystem.listener;
import de.steamwar.fightsystem.ArenaMode;
+import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentListener;
-import de.steamwar.fightsystem.utils.BountifulWrapper;
import de.steamwar.linkage.Linked;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryDragEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
+import org.bukkit.event.player.PlayerSwapHandItemsEvent;
@Linked
public class DenyInventoryMovement implements Listener {
public DenyInventoryMovement() {
new StateDependentListener(ArenaMode.AntiTest, FightState.AntiIngame, this);
-
- Listener listener = BountifulWrapper.impl.newDenyHandSwapListener();
- new StateDependentListener(ArenaMode.AntiTest, FightState.AntiIngame, listener);
}
@EventHandler
@@ -54,4 +52,9 @@ public class DenyInventoryMovement implements Listener {
public void onItemPickup(PlayerPickupItemEvent event) {
event.setCancelled(true);
}
+
+ @EventHandler
+ public void onSwapItems(PlayerSwapHandItemsEvent event) {
+ if (Fight.fighting(event.getPlayer())) event.setCancelled(true);
+ }
}
diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/Permanent.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/Permanent.java
index 27ca0dc5..75340bd5 100644
--- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/Permanent.java
+++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/Permanent.java
@@ -27,13 +27,12 @@ import de.steamwar.fightsystem.fight.FightPlayer;
import de.steamwar.fightsystem.fight.FightTeam;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentListener;
-import de.steamwar.fightsystem.utils.BountifulWrapper;
-import de.steamwar.fightsystem.utils.FlatteningWrapper;
import de.steamwar.linkage.Linked;
import net.md_5.bungee.api.ChatMessageType;
import org.bukkit.GameMode;
import org.bukkit.Material;
import org.bukkit.block.Block;
+import org.bukkit.block.data.type.Dispenser;
import org.bukkit.entity.Player;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.event.EventHandler;
@@ -62,7 +61,7 @@ public class Permanent implements Listener {
private static final Team spectatorTeam = FightScoreboard.getBukkitTeam("Spectator");
static {
- BountifulWrapper.impl.setNametagVisibility(spectatorTeam);
+ spectatorTeam.setOption(Team.Option.NAME_TAG_VISIBILITY, Team.OptionStatus.FOR_OWN_TEAM);
spectatorTeam.setNameTagVisibility(NameTagVisibility.NEVER);
}
@@ -234,7 +233,7 @@ public class Permanent implements Listener {
return;
}
- if (e.getItem().getType() == Material.TNT || FlatteningWrapper.impl.isFacingWater(block)) {
+ if (e.getItem().getType() == Material.TNT || block.getRelative(((Dispenser) block.getBlockData()).getFacing()).isLiquid()) {
e.setCancelled(true);
}
}
diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/PlayerJoinListener.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/PlayerJoinListener.java
deleted file mode 100644
index 71ecf2a7..00000000
--- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/PlayerJoinListener.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package de.steamwar.fightsystem.listener;
-
-import de.steamwar.fightsystem.states.FightState;
-import de.steamwar.fightsystem.states.StateDependentListener;
-import de.steamwar.linkage.Linked;
-import net.minecraft.network.protocol.game.ClientboundForgetLevelChunkPacket;
-import net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket;
-import net.minecraft.server.level.ServerPlayer;
-import net.minecraft.world.level.ChunkPos;
-import net.minecraft.world.level.chunk.LevelChunk;
-import org.bukkit.Bukkit;
-import org.bukkit.Chunk;
-import org.bukkit.Location;
-import org.bukkit.World;
-import org.bukkit.craftbukkit.CraftWorld;
-import org.bukkit.craftbukkit.entity.CraftPlayer;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.Listener;
-import org.bukkit.event.player.PlayerJoinEvent;
-
-@Linked
-public class PlayerJoinListener implements Listener {
-
- public PlayerJoinListener() {
- new StateDependentListener(true, FightState.All, this);
- }
-
- @EventHandler()
- public void onPlayerJoin(PlayerJoinEvent event) {
- Player player = event.getPlayer();
- World world = player.getWorld();
-
- Location loc = player.getLocation();
- int viewDistance = Bukkit.getViewDistance();
-
- int chunkX = loc.getChunk().getX();
- int chunkZ = loc.getChunk().getZ();
-
- // Iterate through the chunks around the player and force a resend
- for (int x = -viewDistance; x <= viewDistance; x++) {
- for (int z = -viewDistance; z <= viewDistance; z++) {
- Chunk chunk = world.getChunkAt(chunkX + x, chunkZ + z);
- this.forceRefreshChunkForPlayer(player, chunk);
- }
- }
- }
-
- public void forceRefreshChunkForPlayer(Player player, Chunk bukkitChunk) {
- ServerPlayer serverPlayer = ((CraftPlayer) player).getHandle();
- CraftWorld craftWorld = (CraftWorld) bukkitChunk.getWorld();
-
- int chunkX = bukkitChunk.getX();
- int chunkZ = bukkitChunk.getZ();
-
- LevelChunk nmsChunk = craftWorld.getHandle().getChunkSource().getChunk(chunkX, chunkZ, false);
- if (nmsChunk == null) {
- // Chunk isn't loaded in memory on the server side;
- return;
- }
-
- ClientboundForgetLevelChunkPacket unloadPacket = new ClientboundForgetLevelChunkPacket(new ChunkPos(chunkX, chunkZ));
- serverPlayer.connection.send(unloadPacket);
-
- ClientboundLevelChunkWithLightPacket loadPacket = new ClientboundLevelChunkWithLightPacket(
- nmsChunk,
- craftWorld.getHandle().getLightEngine(),
- null,
- null,
- true
- );
- serverPlayer.connection.send(loadPacket);
- }
-}
diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/PrepareSchem.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/PrepareSchem.java
index d8ac07a6..f83c4c21 100644
--- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/PrepareSchem.java
+++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/PrepareSchem.java
@@ -28,12 +28,12 @@ import de.steamwar.fightsystem.fight.FightTeam;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.OneShotStateDependent;
import de.steamwar.fightsystem.states.StateDependentListener;
-import de.steamwar.fightsystem.utils.FlatteningWrapper;
import de.steamwar.fightsystem.utils.Region;
import de.steamwar.fightsystem.utils.WorldeditWrapper;
import de.steamwar.linkage.Linked;
import de.steamwar.sql.SchematicNode;
import org.bukkit.Bukkit;
+import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
@@ -52,7 +52,7 @@ public class PrepareSchem implements Listener {
new OneShotStateDependent(ArenaMode.Prepare, FightState.PostSchemSetup, () -> Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () -> {
stationaryMovingPistons.clear();
Fight.getUnrotated().getSchemRegion().forEach((x, y, z) -> {
- if (FlatteningWrapper.impl.checkPistonMoving(Config.world.getBlockAt(x, y, z))) {
+ if (Config.world.getBlockAt(x, y, z).getType() == Material.MOVING_PISTON) {
stationaryMovingPistons.add(new Vector(x, y, z));
}
});
@@ -76,7 +76,7 @@ public class PrepareSchem implements Listener {
try {
region.forEach((x, y, z) -> {
- if (FlatteningWrapper.impl.checkPistonMoving(Config.world.getBlockAt(x, y, z)) && !stationaryMovingPistons.contains(new Vector(x, y, z))) {
+ if (Config.world.getBlockAt(x, y, z).getType() == Material.MOVING_PISTON && !stationaryMovingPistons.contains(new Vector(x, y, z))) {
FightSystem.getMessage().broadcast("PREPARE_ACTIVE_PISTON");
Bukkit.shutdown();
throw new IllegalStateException();
diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/Recording.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/Recording.java
index 0a506cbf..0187d089 100644
--- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/Recording.java
+++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/Recording.java
@@ -22,6 +22,7 @@ package de.steamwar.fightsystem.listener;
import com.comphenix.tinyprotocol.TinyProtocol;
import de.steamwar.Reflection;
import de.steamwar.fightsystem.ArenaMode;
+import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.events.TeamDeathEvent;
import de.steamwar.fightsystem.events.TeamLeaveEvent;
@@ -34,17 +35,17 @@ import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependent;
import de.steamwar.fightsystem.states.StateDependentListener;
import de.steamwar.fightsystem.states.StateDependentTask;
-import de.steamwar.fightsystem.utils.BountifulWrapper;
-import de.steamwar.fightsystem.utils.CraftbukkitWrapper;
-import de.steamwar.fightsystem.utils.FlatteningWrapper;
import de.steamwar.fightsystem.utils.SWSound;
import de.steamwar.linkage.Linked;
+import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.ServerboundPlayerActionPacket;
import net.minecraft.network.protocol.game.ServerboundUseItemPacket;
+import net.minecraft.world.InteractionHand;
import net.minecraft.world.entity.item.PrimedTnt;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
+import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
@@ -63,6 +64,7 @@ import java.util.Random;
import java.util.function.BiFunction;
import java.util.function.Consumer;
import java.util.function.Predicate;
+import java.util.stream.StreamSupport;
@Linked
public class Recording implements Listener {
@@ -83,12 +85,22 @@ public class Recording implements Listener {
public static final Class> primedTnt = PrimedTnt.class;
public static void iterateOverEntities(Predicate