diff --git a/BauSystem/BauSystem_21/build.gradle.kts b/BauSystem/BauSystem_21/build.gradle.kts
new file mode 100644
index 00000000..0c9e97d4
--- /dev/null
+++ b/BauSystem/BauSystem_21/build.gradle.kts
@@ -0,0 +1,17 @@
+plugins {
+ steamwar.java
+}
+
+java {
+ sourceCompatibility = JavaVersion.VERSION_21
+ targetCompatibility = JavaVersion.VERSION_21
+}
+
+dependencies {
+ compileOnly(project(":BauSystem:BauSystem_Main", "default"))
+ compileOnly(project(":SpigotCore", "default"))
+
+ compileOnly(libs.paperapi21)
+
+ compileOnly(libs.nms21)
+}
\ No newline at end of file
diff --git a/BauSystem/BauSystem_21/src/de/steamwar/bausystem/utils/NMSWrapper21.java b/BauSystem/BauSystem_21/src/de/steamwar/bausystem/utils/NMSWrapper21.java
new file mode 100644
index 00000000..94751f74
--- /dev/null
+++ b/BauSystem/BauSystem_21/src/de/steamwar/bausystem/utils/NMSWrapper21.java
@@ -0,0 +1,151 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2024 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 com.comphenix.tinyprotocol.Reflection;
+import de.steamwar.bausystem.features.util.NoClipCommand;
+import net.minecraft.core.Holder;
+import net.minecraft.core.component.DataComponents;
+import net.minecraft.core.particles.ParticleParam;
+import net.minecraft.nbt.NBTBase;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+import net.minecraft.network.protocol.game.PacketPlayInSetCreativeSlot;
+import net.minecraft.network.protocol.game.PacketPlayOutExplosion;
+import net.minecraft.network.protocol.game.PacketPlayOutGameStateChange;
+import net.minecraft.world.item.component.CustomData;
+import net.minecraft.world.level.EnumGamemode;
+import net.minecraft.world.level.Explosion;
+import org.bukkit.GameMode;
+import org.bukkit.Material;
+import org.bukkit.craftbukkit.v1_21_R1.entity.CraftPlayer;
+import org.bukkit.craftbukkit.v1_21_R1.inventory.CraftItemStack;
+import org.bukkit.entity.Player;
+import org.bukkit.inventory.ItemStack;
+
+import java.util.List;
+
+public class NMSWrapper21 implements NMSWrapper {
+
+ @Override
+ public void setInternalGameMode(Player player, GameMode gameMode) {
+ ((CraftPlayer) player).getHandle().e.a(EnumGamemode.a(gameMode.getValue()));
+ }
+
+ @Override
+ public void setSlotToItemStack(Player player, Object o) {
+ PacketPlayInSetCreativeSlot packetPlayInSetCreativeSlot = (PacketPlayInSetCreativeSlot) o;
+ int index = packetPlayInSetCreativeSlot.b();
+ 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.e()));
+ if (index < 9) player.getInventory().setHeldItemSlot(index);
+ player.updateInventory();
+ }
+
+ private static final Reflection.FieldAccessor gameStateChangeReason = Reflection.getField(NoClipCommand.gameStateChange, PacketPlayOutGameStateChange.a.class, 12);
+
+ @Override
+ public void setGameStateChangeReason(Object packet) {
+ gameStateChangeReason.set(packet, PacketPlayOutGameStateChange.d);
+ }
+
+ @Override
+ public void setPlayerBuildAbilities(Player player) {
+ ((CraftPlayer) player).getHandle().fZ().d = true;
+ ((CraftPlayer) player).getHandle().fZ().e = true;
+ }
+
+ @Override
+ public Material pathMaterial() {
+ return Material.DIRT_PATH;
+ }
+
+ private static final int threshold = 2048;
+
+ @Override
+ public boolean checkItemStack(ItemStack item) {
+ net.minecraft.world.item.ItemStack nmsItem = CraftItemStack.asNMSCopy(item);
+ NBTTagCompound tag = nmsItem.a(DataComponents.b, CustomData.a).c();
+ if (tag.e("BlockEntityTag")) {
+ NBTTagCompound blockTag = tag.p("BlockEntityTag");
+ if (blockTag.e("Items")) {
+ return drillDown(blockTag.c("Items", 10), 0, 0) > threshold;
+ }
+ }
+
+ return false;
+ }
+
+ private int drillDown(NBTTagList items, int layer, int start) {
+ if (layer > 2) return start + threshold;
+ int invalid = start;
+ for (NBTBase nbtBase : items) {
+ if (!(nbtBase instanceof NBTTagCompound slot))
+ continue;
+ if (slot.e("tag")) {
+ invalid += slot.f("Count");
+ NBTTagCompound iTag = slot.p("tag");
+ if (iTag.e("BlockEntityTag")) {
+ NBTTagCompound blockTag = iTag.p("BlockEntityTag");
+ if (blockTag.e("Items")) {
+ invalid = drillDown(blockTag.c("Items", 10), layer + 1, invalid);
+ }
+ }
+ }
+ if (invalid > threshold)
+ break;
+ }
+ return invalid;
+ }
+
+ private final Class> explosionPacket = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutExplosion");
+ private final Reflection.FieldAccessor a = Reflection.getField(explosionPacket, double.class, 0);
+ private final Reflection.FieldAccessor b = Reflection.getField(explosionPacket, double.class, 1);
+ private final Reflection.FieldAccessor c = Reflection.getField(explosionPacket, double.class, 2);
+ private final Reflection.FieldAccessor d = Reflection.getField(explosionPacket, float.class, 0);
+ private final Reflection.FieldAccessor e = Reflection.getField(explosionPacket, List.class, 0);
+ private final Reflection.FieldAccessor f = Reflection.getField(explosionPacket, Explosion.Effect.class, 0);
+ private final Reflection.FieldAccessor g = Reflection.getField(explosionPacket, ParticleParam.class, 0);
+ private final Reflection.FieldAccessor h = Reflection.getField(explosionPacket, ParticleParam.class, 1);
+ private final Reflection.FieldAccessor i = Reflection.getField(explosionPacket, Holder.class, 0);
+
+ @Override
+ public Object resetExplosionKnockback(Object packet) {
+ PacketPlayOutExplosion packetPlayOutExplosion = (PacketPlayOutExplosion) packet;
+ return new PacketPlayOutExplosion(
+ a.get(packetPlayOutExplosion),
+ b.get(packetPlayOutExplosion),
+ c.get(packetPlayOutExplosion),
+ d.get(packetPlayOutExplosion),
+ e.get(packetPlayOutExplosion),
+ null,
+ f.get(packetPlayOutExplosion),
+ g.get(packetPlayOutExplosion),
+ h.get(packetPlayOutExplosion),
+ i.get(packetPlayOutExplosion)
+ );
+ }
+}
diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/loadtimer/LoadtimerListener.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/loadtimer/LoadtimerListener.java
index ddbaed9a..c528b9ad 100644
--- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/loadtimer/LoadtimerListener.java
+++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/loadtimer/LoadtimerListener.java
@@ -20,6 +20,7 @@
package de.steamwar.bausystem.features.loadtimer;
import de.steamwar.bausystem.region.Region;
+import de.steamwar.core.TrickyTrialsWrapper;
import de.steamwar.linkage.Linked;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
@@ -57,7 +58,7 @@ public class LoadtimerListener implements Listener {
@EventHandler
public void onEntitySpawn(EntitySpawnEvent event) {
- if (!getTimers().isEmpty() && event.getEntityType() == EntityType.PRIMED_TNT) {
+ if (!getTimers().isEmpty() && event.getEntityType() == TrickyTrialsWrapper.impl.getTntEntityType()) {
Region r = Region.getRegion(event.getLocation());
if (hasTimer(r)) {
getTimer(r).onTntSpawn();
@@ -67,7 +68,7 @@ public class LoadtimerListener implements Listener {
@EventHandler
public void onEntityExplode(EntityExplodeEvent event) {
- if (!getTimers().isEmpty() && event.getEntityType() == EntityType.PRIMED_TNT) {
+ if (!getTimers().isEmpty() && event.getEntityType() == TrickyTrialsWrapper.impl.getTntEntityType()) {
Region r = Region.getRegion(event.getLocation());
if (hasTimer(r)) {
getTimer(r).onTntExplode(event);
diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/FreezeListener.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/FreezeListener.java
index df73575c..a284cfa8 100644
--- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/FreezeListener.java
+++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/FreezeListener.java
@@ -6,6 +6,7 @@ import de.steamwar.bausystem.region.flags.Flag;
import de.steamwar.bausystem.region.flags.flagvalues.FreezeMode;
import de.steamwar.bausystem.utils.ScoreboardElement;
import de.steamwar.core.Core;
+import de.steamwar.core.TrickyTrialsWrapper;
import de.steamwar.linkage.Linked;
import org.bukkit.Bukkit;
import org.bukkit.Material;
@@ -31,7 +32,7 @@ public class FreezeListener implements Listener, ScoreboardElement {
return;
}
e.setCancelled(true);
- if (e.getEntityType() == EntityType.PRIMED_TNT) {
+ if (e.getEntityType() == TrickyTrialsWrapper.impl.getTntEntityType()) {
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
e.getLocation().getBlock().setType(Material.TNT, false);
}, 1L);
diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/script/event/EventListener.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/script/event/EventListener.java
index 22c5257c..3886c672 100644
--- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/script/event/EventListener.java
+++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/script/event/EventListener.java
@@ -28,6 +28,7 @@ import de.steamwar.bausystem.features.tpslimit.TPSUtils;
import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.utils.RegionExtensionType;
import de.steamwar.bausystem.region.utils.RegionType;
+import de.steamwar.core.TrickyTrialsWrapper;
import de.steamwar.linkage.Linked;
import org.bukkit.Bukkit;
import org.bukkit.Material;
@@ -161,7 +162,7 @@ public class EventListener implements Listener {
@EventHandler(priority = EventPriority.LOWEST)
public void onEntityExplode(EntityExplodeEvent event) {
- if (event.getEntityType() != EntityType.PRIMED_TNT) {
+ if (event.getEntityType() != TrickyTrialsWrapper.impl.getTntEntityType()) {
return;
}
Region tntRegion = Region.getRegion(event.getLocation());
diff --git a/BauSystem/build.gradle.kts b/BauSystem/build.gradle.kts
index 55df7b50..7a02ffa7 100644
--- a/BauSystem/build.gradle.kts
+++ b/BauSystem/build.gradle.kts
@@ -32,4 +32,5 @@ dependencies {
implementation(project(":BauSystem:BauSystem_18"))
implementation(project(":BauSystem:BauSystem_19"))
implementation(project(":BauSystem:BauSystem_20"))
+ implementation(project(":BauSystem:BauSystem_21"))
}
diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/event/HellsBells.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/event/HellsBells.java
index 7fe7e4b2..3cfa7a87 100644
--- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/event/HellsBells.java
+++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/event/HellsBells.java
@@ -19,6 +19,7 @@
package de.steamwar.fightsystem.event;
+import de.steamwar.core.TrickyTrialsWrapper;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.countdown.Countdown;
@@ -97,13 +98,13 @@ public class HellsBells {
currentDropping = Bukkit.getScheduler().runTaskTimer(FightSystem.getPlugin(), () -> {
for (int w = 0; w < width; w++) {
if (direction.isNorthOrWest()) {
- Config.world.spawnEntity(redStart.addAndToLocation(Config.world, -1 * (direction.dx * length.get() + w * direction.other().dx), 0, -1 * (direction.dz * length.get() + w * direction.other().dz)), EntityType.PRIMED_TNT);
+ Config.world.spawnEntity(redStart.addAndToLocation(Config.world, -1 * (direction.dx * length.get() + w * direction.other().dx), 0, -1 * (direction.dz * length.get() + w * direction.other().dz)), TrickyTrialsWrapper.impl.getTntEntityType());
- Config.world.spawnEntity(blueStart.addAndToLocation(Config.world, direction.dx * length.get() + w * direction.other().dx, 0, direction.dz * length.get() + w * direction.other().dz), EntityType.PRIMED_TNT);
+ Config.world.spawnEntity(blueStart.addAndToLocation(Config.world, direction.dx * length.get() + w * direction.other().dx, 0, direction.dz * length.get() + w * direction.other().dz), TrickyTrialsWrapper.impl.getTntEntityType());
} else {
- Config.world.spawnEntity(redStart.addAndToLocation(Config.world, direction.dx * length.get() + w * direction.other().dx, 0, direction.dz * length.get() + w * direction.other().dz), EntityType.PRIMED_TNT);
+ Config.world.spawnEntity(redStart.addAndToLocation(Config.world, direction.dx * length.get() + w * direction.other().dx, 0, direction.dz * length.get() + w * direction.other().dz), TrickyTrialsWrapper.impl.getTntEntityType());
- Config.world.spawnEntity(blueStart.addAndToLocation(Config.world, -1 * (direction.dx * length.get() + w * direction.other().dx), 0, -1 * (direction.dz * length.get() + w * direction.other().dz)), EntityType.PRIMED_TNT);
+ Config.world.spawnEntity(blueStart.addAndToLocation(Config.world, -1 * (direction.dx * length.get() + w * direction.other().dx), 0, -1 * (direction.dz * length.get() + w * direction.other().dz)), TrickyTrialsWrapper.impl.getTntEntityType());
}
}
if (length.addAndGet(-2) <= 0) {
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 889c3c1c..b4040b74 100644
--- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/Recording.java
+++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/Recording.java
@@ -21,6 +21,7 @@ package de.steamwar.fightsystem.listener;
import com.comphenix.tinyprotocol.Reflection;
import com.comphenix.tinyprotocol.TinyProtocol;
+import de.steamwar.core.TrickyTrialsWrapper;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.events.TeamDeathEvent;
@@ -221,7 +222,7 @@ public class Recording implements Listener {
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onTNTSpawn(EntitySpawnEvent e){
- if(e.getEntityType() != EntityType.PRIMED_TNT)
+ if(e.getEntityType() != TrickyTrialsWrapper.impl.getTntEntityType())
return;
GlobalRecorder.getInstance().tntSpawn(e.getEntity());
@@ -229,7 +230,7 @@ public class Recording implements Listener {
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onExplosion(EntityExplodeEvent e){
- if(e.getEntityType() != EntityType.PRIMED_TNT)
+ if(e.getEntityType() != TrickyTrialsWrapper.impl.getTntEntityType())
return;
Location loc = e.getLocation();
diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/WaterRemover.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/WaterRemover.java
index c89fcab0..847e647b 100644
--- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/WaterRemover.java
+++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/WaterRemover.java
@@ -19,6 +19,7 @@
package de.steamwar.fightsystem.listener;
+import de.steamwar.core.TrickyTrialsWrapper;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.fight.Fight;
@@ -56,7 +57,7 @@ public class WaterRemover implements Listener {
@EventHandler
public void handleEntitySpawn(EntitySpawnEvent event) {
- if(event.getEntityType() != EntityType.PRIMED_TNT)
+ if(event.getEntityType() != TrickyTrialsWrapper.impl.getTntEntityType())
return;
Location location = event.getLocation();
diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/record/PacketProcessor.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/record/PacketProcessor.java
index 6296e374..ee0c1af1 100644
--- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/record/PacketProcessor.java
+++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/record/PacketProcessor.java
@@ -21,6 +21,7 @@ package de.steamwar.fightsystem.record;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import de.steamwar.core.Core;
+import de.steamwar.core.TrickyTrialsWrapper;
import de.steamwar.entity.REntity;
import de.steamwar.entity.REntityServer;
import de.steamwar.entity.RPlayer;
@@ -298,7 +299,7 @@ public class PacketProcessor implements Listener {
private void tntSpawn() throws IOException {
int entityId = source.readInt();
- execSync(() -> addREntity(entityId, new REntity(entityServer, EntityType.PRIMED_TNT, Config.SpecSpawn)));
+ execSync(() -> addREntity(entityId, new REntity(entityServer, TrickyTrialsWrapper.impl.getTntEntityType(), Config.SpecSpawn)));
}
private void entityVelocity() throws IOException {
diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/winconditions/WinconditionTimeTechKO.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/winconditions/WinconditionTimeTechKO.java
index 1659edbc..f1177afa 100644
--- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/winconditions/WinconditionTimeTechKO.java
+++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/winconditions/WinconditionTimeTechKO.java
@@ -19,6 +19,7 @@
package de.steamwar.fightsystem.winconditions;
+import de.steamwar.core.TrickyTrialsWrapper;
import de.steamwar.fightsystem.countdown.Countdown;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightTeam;
@@ -70,7 +71,7 @@ public class WinconditionTimeTechKO extends Wincondition implements Listener {
@EventHandler
public void onSpawn(EntitySpawnEvent e) {
- if(e.getEntityType() != EntityType.PRIMED_TNT)
+ if(e.getEntityType() != TrickyTrialsWrapper.impl.getTntEntityType())
return;
Location location = e.getLocation();
@@ -84,7 +85,7 @@ public class WinconditionTimeTechKO extends Wincondition implements Listener {
@EventHandler
public void onExplode(EntityExplodeEvent e) {
- if(e.getEntityType() != EntityType.PRIMED_TNT)
+ if(e.getEntityType() != TrickyTrialsWrapper.impl.getTntEntityType())
return;
FightTeam spawn = spawnLocations.remove(e.getEntity().getEntityId());
diff --git a/SpigotCore/SpigotCore_14/src/de/steamwar/core/FlatteningWrapper14.java b/SpigotCore/SpigotCore_14/src/de/steamwar/core/FlatteningWrapper14.java
index f5626d03..1aec490e 100644
--- a/SpigotCore/SpigotCore_14/src/de/steamwar/core/FlatteningWrapper14.java
+++ b/SpigotCore/SpigotCore_14/src/de/steamwar/core/FlatteningWrapper14.java
@@ -232,9 +232,21 @@ public class FlatteningWrapper14 implements FlatteningWrapper.IFlatteningWrapper
scoreboardName.set(packet, ChatWrapper.impl.stringToChatComponent(title));
}
- private static final Class> scoreActionEnum = Reflection.getClass("{nms.server}.ScoreboardServer$Action");
- private static final Reflection.FieldAccessor> scoreAction = Reflection.getField(FlatteningWrapper.scoreboardScore, scoreActionEnum, 0);
- private static final Object scoreActionChange = scoreActionEnum.getEnumConstants()[0];
+ private static final Class> scoreActionEnum;
+ private static final Reflection.FieldAccessor> scoreAction;
+ private static final Object scoreActionChange;
+
+ static {
+ if (Core.getVersion() < 21) {
+ scoreActionEnum = Reflection.getClass("{nms.server}.ScoreboardServer$Action");
+ scoreAction = Reflection.getField(FlatteningWrapper.scoreboardScore, scoreActionEnum, 0);
+ scoreActionChange = scoreActionEnum.getEnumConstants()[0];
+ } else {
+ scoreActionEnum = null;
+ scoreAction = null;
+ scoreActionChange = null;
+ }
+ }
@Override
public void setScoreAction(Object packet) {
diff --git a/SpigotCore/SpigotCore_21/build.gradle.kts b/SpigotCore/SpigotCore_21/build.gradle.kts
index b702534b..33938708 100644
--- a/SpigotCore/SpigotCore_21/build.gradle.kts
+++ b/SpigotCore/SpigotCore_21/build.gradle.kts
@@ -30,4 +30,10 @@ dependencies {
attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 21)
}
}
+ compileOnly(libs.nms21) {
+ attributes {
+ // Very Hacky, but it works
+ attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 21)
+ }
+ }
}
diff --git a/SpigotCore/SpigotCore_21/src/de/steamwar/inventory/SWItem21.java b/SpigotCore/SpigotCore_21/src/de/steamwar/core/TrickyTrialsWrapper21.java
similarity index 74%
rename from SpigotCore/SpigotCore_21/src/de/steamwar/inventory/SWItem21.java
rename to SpigotCore/SpigotCore_21/src/de/steamwar/core/TrickyTrialsWrapper21.java
index ed9432b0..c1d1e4c6 100644
--- a/SpigotCore/SpigotCore_21/src/de/steamwar/inventory/SWItem21.java
+++ b/SpigotCore/SpigotCore_21/src/de/steamwar/core/TrickyTrialsWrapper21.java
@@ -17,22 +17,19 @@
* along with this program. If not, see .
*/
-package de.steamwar.inventory;
+package de.steamwar.core;
import org.bukkit.enchantments.Enchantment;
-import org.bukkit.inventory.ItemFlag;
+import org.bukkit.entity.EntityType;
-import java.util.Collection;
-import java.util.EnumSet;
-
-public class SWItem21 implements SWItem.ISWItem {
+public class TrickyTrialsWrapper21 implements TrickyTrialsWrapper {
@Override
- public Collection getHideFlags() {
- return EnumSet.allOf(ItemFlag.class);
+ public EntityType getTntEntityType() {
+ return EntityType.TNT;
}
@Override
- public Enchantment getDurabilityEnchantment() {
+ public Enchantment getUnbreakingEnchantment() {
return Enchantment.UNBREAKING;
}
}
diff --git a/SpigotCore/SpigotCore_8/src/de/steamwar/core/FlatteningWrapper8.java b/SpigotCore/SpigotCore_8/src/de/steamwar/core/FlatteningWrapper8.java
index 535c5261..7d485286 100644
--- a/SpigotCore/SpigotCore_8/src/de/steamwar/core/FlatteningWrapper8.java
+++ b/SpigotCore/SpigotCore_8/src/de/steamwar/core/FlatteningWrapper8.java
@@ -96,7 +96,7 @@ public class FlatteningWrapper8 implements FlatteningWrapper.IFlatteningWrapper
private static final Reflection.FieldAccessor spawnLivingType = Reflection.getField(ProtocolWrapper.spawnLivingPacket, int.class, 1);
private static final Map types = new HashMap<>();
static {
- types.put(EntityType.PRIMED_TNT, 50);
+ types.put(TrickyTrialsWrapper.impl.getTntEntityType(), 50);
types.put(EntityType.ARMOR_STAND, 30);
types.put(EntityType.ARROW, 60);
types.put(EntityType.FIREBALL, 63);
diff --git a/SpigotCore/SpigotCore_8/src/de/steamwar/inventory/SWItem8.java b/SpigotCore/SpigotCore_8/src/de/steamwar/core/TrickyTrialsWrapper8.java
similarity index 62%
rename from SpigotCore/SpigotCore_8/src/de/steamwar/inventory/SWItem8.java
rename to SpigotCore/SpigotCore_8/src/de/steamwar/core/TrickyTrialsWrapper8.java
index d30bf696..6d7392dc 100644
--- a/SpigotCore/SpigotCore_8/src/de/steamwar/inventory/SWItem8.java
+++ b/SpigotCore/SpigotCore_8/src/de/steamwar/core/TrickyTrialsWrapper8.java
@@ -17,29 +17,19 @@
* along with this program. If not, see .
*/
-package de.steamwar.inventory;
+package de.steamwar.core;
import org.bukkit.enchantments.Enchantment;
-import org.bukkit.inventory.ItemFlag;
+import org.bukkit.entity.EntityType;
-import java.util.Collection;
-import java.util.EnumSet;
-
-public class SWItem8 implements SWItem.ISWItem {
+public class TrickyTrialsWrapper8 implements TrickyTrialsWrapper {
@Override
- public Collection getHideFlags() {
- return EnumSet.of(
- ItemFlag.HIDE_ATTRIBUTES,
- ItemFlag.HIDE_DESTROYS,
- ItemFlag.HIDE_UNBREAKABLE,
- ItemFlag.HIDE_ENCHANTS,
- ItemFlag.HIDE_PLACED_ON,
- ItemFlag.HIDE_POTION_EFFECTS
- );
+ public EntityType getTntEntityType() {
+ return EntityType.PRIMED_TNT;
}
@Override
- public Enchantment getDurabilityEnchantment() {
+ public Enchantment getUnbreakingEnchantment() {
return Enchantment.DURABILITY;
}
}
diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/TrickyTrialsWrapper.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/TrickyTrialsWrapper.java
new file mode 100644
index 00000000..d678244c
--- /dev/null
+++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/TrickyTrialsWrapper.java
@@ -0,0 +1,31 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2024 SteamWar.de-Serverteam
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package de.steamwar.core;
+
+import org.bukkit.enchantments.Enchantment;
+import org.bukkit.entity.EntityType;
+
+public interface TrickyTrialsWrapper {
+ TrickyTrialsWrapper impl = VersionDependent.getVersionImpl(Core.getInstance());
+
+ EntityType getTntEntityType();
+
+ Enchantment getUnbreakingEnchantment();
+}
diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/inventory/SWItem.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/inventory/SWItem.java
index 61938cb6..bc401476 100644
--- a/SpigotCore/SpigotCore_Main/src/de/steamwar/inventory/SWItem.java
+++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/inventory/SWItem.java
@@ -23,6 +23,7 @@ import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import de.steamwar.core.Core;
import de.steamwar.core.FlatteningWrapper;
+import de.steamwar.core.TrickyTrialsWrapper;
import de.steamwar.core.VersionDependent;
import org.bukkit.Material;
import org.bukkit.OfflinePlayer;
@@ -33,12 +34,11 @@ import org.bukkit.inventory.meta.ItemMeta;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.EnumSet;
import java.util.List;
public class SWItem {
- private static final ISWItem impl = VersionDependent.getVersionImpl(Core.getInstance());
-
private ItemStack itemStack;
private ItemMeta itemMeta;
private InvCallback callback;
@@ -112,7 +112,7 @@ public class SWItem {
itemMeta.setDisplayName(name);
if (lore != null && !lore.isEmpty()) itemMeta.setLore(lore);
- if (enchanted) itemMeta.addEnchant(impl.getDurabilityEnchantment() , 10, true);
+ if (enchanted) itemMeta.addEnchant(TrickyTrialsWrapper.impl.getUnbreakingEnchantment(), 10, true);
itemStack.setItemMeta(itemMeta);
}
callback = c;
@@ -149,7 +149,7 @@ public class SWItem {
private void hideAttributes() {
if (itemMeta == null) return;
- for (ItemFlag flag : impl.getHideFlags()) {
+ for (ItemFlag flag : EnumSet.allOf(ItemFlag.class)) {
itemMeta.addItemFlags(flag);
}
}
@@ -194,16 +194,10 @@ public class SWItem {
public void setEnchanted(boolean enchanted) {
if (enchanted){
- itemMeta.addEnchant(impl.getDurabilityEnchantment() , 10, true);
+ itemMeta.addEnchant(TrickyTrialsWrapper.impl.getUnbreakingEnchantment() , 10, true);
} else {
- itemMeta.removeEnchant(impl.getDurabilityEnchantment());
+ itemMeta.removeEnchant(TrickyTrialsWrapper.impl.getUnbreakingEnchantment());
}
itemStack.setItemMeta(itemMeta);
}
-
- public interface ISWItem {
- Collection getHideFlags();
-
- Enchantment getDurabilityEnchantment();
- }
}
diff --git a/Teamserver/src/de/steamwar/teamserver/listener/FreezeListener.java b/Teamserver/src/de/steamwar/teamserver/listener/FreezeListener.java
index 5bcb4fed..7d576d2f 100644
--- a/Teamserver/src/de/steamwar/teamserver/listener/FreezeListener.java
+++ b/Teamserver/src/de/steamwar/teamserver/listener/FreezeListener.java
@@ -20,6 +20,7 @@
package de.steamwar.teamserver.listener;
import de.steamwar.core.Core;
+import de.steamwar.core.TrickyTrialsWrapper;
import de.steamwar.teamserver.Builder;
import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.chat.BaseComponent;
@@ -55,7 +56,7 @@ public class FreezeListener implements Listener {
public void onEntitySpawn(EntitySpawnEvent e) {
if (!freeze) return;
e.setCancelled(true);
- if (e.getEntityType() == EntityType.PRIMED_TNT) {
+ if (e.getEntityType() == TrickyTrialsWrapper.impl.getTntEntityType()) {
Bukkit.getScheduler().runTaskLater(Builder.getInstance(), () -> {
e.getLocation().getBlock().setType(Material.TNT, false);
}, 1L);
diff --git a/settings.gradle.kts b/settings.gradle.kts
index d12d432f..7c1d761a 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -130,6 +130,7 @@ dependencyResolutionManagement {
library("nms18", "de.steamwar:spigot:1.18")
library("nms19", "de.steamwar:spigot:1.19")
library("nms20", "de.steamwar:spigot:1.20")
+ library("nms21", "de.steamwar:spigot:1.21")
library("axiom", "de.steamwar:axiompaper:RELEASE")
library("worldedit12", "de.steamwar:worldedit:1.12")
@@ -173,6 +174,7 @@ include(
"BauSystem:BauSystem_18",
"BauSystem:BauSystem_19",
"BauSystem:BauSystem_20",
+ "BauSystem:BauSystem_21",
"BauSystem:BauSystem_Main"
)