diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml
index f277ba1c..e9f4d842 100644
--- a/.gitea/workflows/build.yml
+++ b/.gitea/workflows/build.yml
@@ -129,8 +129,12 @@ jobs:
ssh-keyscan -p "$port" "$DEPLOY_HOST" >> ~/.ssh/known_hosts
ssh -i ~/.ssh/deploy_key -p "$port" "${DEPLOY_USER}@${DEPLOY_HOST}" "mkdir -p '$DEPLOY_PATH'"
- ssh -i ~/.ssh/deploy_key -p "$port" "${DEPLOY_USER}@${DEPLOY_HOST}" "rm -f '$DEPLOY_PATH/*'"
- scp -i ~/.ssh/deploy_key -P "$port" deploy/* "${DEPLOY_USER}@${DEPLOY_HOST}:$DEPLOY_PATH/"
+ ssh -i ~/.ssh/deploy_key -p "$port" "${DEPLOY_USER}@${DEPLOY_HOST}" "mkdir -p '$DEPLOY_PATH/upload'"
+ scp -i ~/.ssh/deploy_key -P "$port" deploy/* "${DEPLOY_USER}@${DEPLOY_HOST}:$DEPLOY_PATH/upload"
+ ssh -i ~/.ssh/deploy_key -p "$port" "${DEPLOY_USER}@${DEPLOY_HOST}" "rm -f '$DEPLOY_PATH'/*.jar '$DEPLOY_PATH'/*.zip"
+ ssh -i ~/.ssh/deploy_key -p "$port" "${DEPLOY_USER}@${DEPLOY_HOST}" "mv '$DEPLOY_PATH'/upload/* '$DEPLOY_PATH'"
+ ssh -i ~/.ssh/deploy_key -p "$port" "${DEPLOY_USER}@${DEPLOY_HOST}" "rm -r '$DEPLOY_PATH/upload'"
+ ssh -i ~/.ssh/deploy_key -p "$port" "${DEPLOY_USER}@${DEPLOY_HOST}" "chmod o-w '$DEPLOY_PATH'/*"
- name: Restart Services
shell: bash
env:
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/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/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/xray/XrayCommand.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/xray/XrayCommand.java
index a5fae7cb..1ddfe6f7 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
@@ -114,8 +114,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/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/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/GameModeConfig.java b/CommonCore/SQL/src/de/steamwar/sql/GameModeConfig.java
index e2106380..f8b27f59 100644
--- a/CommonCore/SQL/src/de/steamwar/sql/GameModeConfig.java
+++ b/CommonCore/SQL/src/de/steamwar/sql/GameModeConfig.java
@@ -411,7 +411,7 @@ public final class GameModeConfig {
}
@ToString
- public static final class ArenaConfig {
+ public static final class ArenaConfig {
public final boolean loaded;
@@ -461,11 +461,11 @@ public final class GameModeConfig {
public final boolean DisableSnowMelt;
/**
- * Disable ice forming
+ * Disable the forming of certain blocks
*
- * @implSpec {@code false} by default
+ * @implSpec {@code empty} by default
*/
- public final boolean DisableIceForm;
+ public final Set DisabledBlockForms;
/**
* Allow leaving the arena area as spectator
@@ -488,7 +488,7 @@ public final class GameModeConfig {
*/
public final boolean NoFloor;
- private ArenaConfig(YMLWrapper loader, SchematicConfig.SizeConfig Size, List EnterStages) {
+ private ArenaConfig(YMLWrapper loader, SchematicConfig.SizeConfig Size, List EnterStages) {
loaded = loader.canLoad();
WaterDepth = loader.getInt("WaterDepth", 0);
WaterDamage = loader.getBoolean("WaterDamage", true);
@@ -497,7 +497,11 @@ public final class GameModeConfig {
BorderFromSchematic = loader.getInt("BorderFromSchematic", 21);
GroundWalkable = loader.getBoolean("GroundWalkable", true);
DisableSnowMelt = loader.getBoolean("DisableSnowMelt", false);
- DisableIceForm = loader.getBoolean("DisableIceForm", false);
+ Set disabledBlockForms = new HashSet<>(loader.getMaterialList("DisabledBlockForms"));
+ if (loader.getBoolean("DisableIceForm", false)) {
+ disabledBlockForms.add(loader.materialMapper.apply("ICE"));
+ }
+ DisabledBlockForms = Collections.unmodifiableSet(disabledBlockForms);
Leaveable = loader.getBoolean("Leaveable", false);
AllowMissiles = loader.getBoolean("AllowMissiles", !EnterStages.isEmpty());
NoFloor = loader.getBoolean("NoFloor", false);
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 a5572bcc..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 {
@@ -175,6 +182,9 @@ class SteamwarUser(id: EntityID) : IntEntity(id) {
leaderInternal = false
}
+ fun hasTeam() =
+ team != 0
+
private var leaderInternal by SteamwarUserTable.leader
var leader: Boolean
get() = leaderInternal
diff --git a/CommonCore/SQL/src/de/steamwar/sql/UserPerm.kt b/CommonCore/SQL/src/de/steamwar/sql/UserPerm.kt
index e22126a9..43ba0696 100644
--- a/CommonCore/SQL/src/de/steamwar/sql/UserPerm.kt
+++ b/CommonCore/SQL/src/de/steamwar/sql/UserPerm.kt
@@ -63,11 +63,11 @@ enum class UserPerm {
PREFIX_NONE to emptyPrefix,
PREFIX_YOUTUBER to Prefix("§x§8§A§2§B§E§5", "CC"), // 8A2BE5
PREFIX_GUIDE to Prefix("§x§e§7§6§2§e§d", "Guide"), // E762ED
- PREFIX_SUPPORTER to Prefix("§x§6§0§9§5§F§B", "Sup"), // 6095FB
- PREFIX_MODERATOR to Prefix("§x§F§F§A§2§5§C", "Mod"), // FFA25C
- PREFIX_BUILDER to Prefix("§x§6§0§F§F§6§A", "Arch"), // 60FF6A
- PREFIX_DEVELOPER to Prefix("§x§0§B§B§C§B§3", "Dev"), // 0BBCB3
- PREFIX_ADMIN to Prefix("§x§F§F§2§B§2§4", "Admin"), // FF2B24
+ PREFIX_SUPPORTER to Prefix("§x§6§0§9§5§F§B", "Sup", true), // 6095FB
+ PREFIX_MODERATOR to Prefix("§x§F§F§A§2§5§C", "Mod", true), // FFA25C
+ PREFIX_BUILDER to Prefix("§x§6§0§F§F§6§A", "Arch", true), // 60FF6A
+ PREFIX_DEVELOPER to Prefix("§x§0§B§B§C§B§3", "Dev", true), // 0BBCB3
+ PREFIX_ADMIN to Prefix("§x§F§F§2§B§2§4", "Admin", true), // FF2B24
)
@JvmStatic
@@ -94,5 +94,5 @@ enum class UserPerm {
}
}
- data class Prefix(val colorCode: String, val chatPrefix: String)
+ data class Prefix(val colorCode: String, val chatPrefix: String, val teamPrefix: Boolean = false)
}
\ No newline at end of file
diff --git a/FightSystem/FightSystem_Core/src/config.yml b/FightSystem/FightSystem_Core/src/config.yml
index 46267a72..81620820 100644
--- a/FightSystem/FightSystem_Core/src/config.yml
+++ b/FightSystem/FightSystem_Core/src/config.yml
@@ -48,6 +48,16 @@ Arena:
GroundWalkable: true # defaults to true if missing
# Disable snow and ice melting
DisableSnowMelt: false # defaults to false if missing
+ # Disabled blocks from forming
+ DisabledBlockForms:
+ # For Cobble Generators
+ # - COBBLESTONE
+ # - BASALT
+ # - STONE
+ # - OBSIDIAN
+ # Disable ice specifically from forming
+ # Deprecated, add ICE to DisabledBlockForms list instead
+ DisableIceForm: false
# Allow leaving the arena area as spectator
Leaveable: false # defaults to false if missing
# Allow missiles to fly to the enemy and not stop at the schem border.
diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.java
index 1c348b4b..be822c7c 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,7 +98,12 @@ 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));
@@ -121,7 +129,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/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..5663fe33 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,7 +63,7 @@ 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);
});
}
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/BlockFormListener.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/BlockFormListener.java
index 29c6be82..55d58adb 100644
--- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/BlockFormListener.java
+++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/BlockFormListener.java
@@ -32,12 +32,16 @@ import org.bukkit.event.block.BlockFormEvent;
public class BlockFormListener implements Listener {
public BlockFormListener() {
- new StateDependentListener(Config.GameModeConfig.Arena.DisableIceForm, FightState.All, this);
+ boolean enabled = !Config.GameModeConfig.Arena.DisabledBlockForms.isEmpty();
+ new StateDependentListener(enabled, FightState.All, this);
}
@EventHandler
public void onBlockForm(BlockFormEvent event) {
- if (Config.ArenaRegion.inRegion(event.getBlock()) && event.getNewState().getType() == Material.ICE) {
+ if (!Config.ArenaRegion.inRegion(event.getBlock())) return;
+
+ Material material = event.getNewState().getType();
+ if (Config.GameModeConfig.Arena.DisabledBlockForms.contains(material)) {
event.setCancelled(true);
}
}
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/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/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..05bed604 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,16 @@ 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.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 +63,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 +84,22 @@ public class Recording implements Listener {
public static final Class> primedTnt = PrimedTnt.class;
public static void iterateOverEntities(Predicate