diff --git a/BauSystem_15/build.gradle b/BauSystem_15/build.gradle
index 48ff7ae9..0dd5c888 100644
--- a/BauSystem_15/build.gradle
+++ b/BauSystem_15/build.gradle
@@ -48,9 +48,9 @@ dependencies {
annotationProcessor 'org.projectlombok:lombok:1.18.22'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.22'
- implementation project(":BauSystem_API")
+ implementation project(":BauSystem_Main")
compileOnly files("${projectDir}/../lib/Spigot-1.15.jar")
compileOnly files("${projectDir}/../lib/WorldEdit-1.15.jar")
- compileOnly files("${projectDir}/../lib/ProtocolLib.jar")
+ compileOnly files("${projectDir}/../lib/SpigotCore.jar")
}
\ No newline at end of file
diff --git a/BauSystem_15/src/de/steamwar/bausystem/features/detonator/DetonatorEntity_15.java b/BauSystem_15/src/de/steamwar/bausystem/entities/DetonatorEntity15.java
similarity index 91%
rename from BauSystem_15/src/de/steamwar/bausystem/features/detonator/DetonatorEntity_15.java
rename to BauSystem_15/src/de/steamwar/bausystem/entities/DetonatorEntity15.java
index 795c14f9..efbd29d8 100644
--- a/BauSystem_15/src/de/steamwar/bausystem/features/detonator/DetonatorEntity_15.java
+++ b/BauSystem_15/src/de/steamwar/bausystem/entities/DetonatorEntity15.java
@@ -17,8 +17,9 @@
* along with this program. If not, see .
*/
-package de.steamwar.bausystem.features.detonator;
+package de.steamwar.bausystem.entities;
+import de.steamwar.bausystem.features.detonator.AbstractDetonatorEntity;
import net.minecraft.server.v1_15_R1.*;
import org.bukkit.World;
import org.bukkit.craftbukkit.v1_15_R1.CraftWorld;
@@ -26,13 +27,13 @@ import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
-class DetonatorEntity_15 extends EntityFallingBlock implements AbstractDetonatorEntity {
+public class DetonatorEntity15 extends EntityFallingBlock implements AbstractDetonatorEntity {
private static final Vec3D ZERO = new Vec3D(0, 0, 0);
private final Vector position;
private int references = 0;
- public DetonatorEntity_15(World world, Vector position) {
+ public DetonatorEntity15(World world, Vector position) {
super(((CraftWorld) world).getHandle(), position.getX(), position.getY(), position.getZ(), Blocks.RED_STAINED_GLASS.getBlockData());
this.position = position;
diff --git a/BauSystem_15/src/de/steamwar/bausystem/features/simulator/SimulatorEntity_15.java b/BauSystem_15/src/de/steamwar/bausystem/entities/SimulatorEntity15.java
similarity index 84%
rename from BauSystem_15/src/de/steamwar/bausystem/features/simulator/SimulatorEntity_15.java
rename to BauSystem_15/src/de/steamwar/bausystem/entities/SimulatorEntity15.java
index 7801e718..10354692 100644
--- a/BauSystem_15/src/de/steamwar/bausystem/features/simulator/SimulatorEntity_15.java
+++ b/BauSystem_15/src/de/steamwar/bausystem/entities/SimulatorEntity15.java
@@ -17,20 +17,21 @@
along with this program. If not, see .
*/
-package de.steamwar.bausystem.features.simulator;
+package de.steamwar.bausystem.entities;
-import de.steamwar.bausystem.shared.BaseEntity_15;
+import de.steamwar.bausystem.features.simulator.AbstractSimulatorEntity;
+import de.steamwar.bausystem.shared.BaseEntity15;
import de.steamwar.bausystem.shared.ReferenceCounter;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
-class SimulatorEntity_15 extends BaseEntity_15 implements AbstractSimulatorEntity {
+public class SimulatorEntity15 extends BaseEntity15 implements AbstractSimulatorEntity {
private ReferenceCounter referenceCounter = new ReferenceCounter();
- public SimulatorEntity_15(World world, Vector position, boolean highlight) {
+ public SimulatorEntity15(World world, Vector position, boolean highlight) {
super(world, position, highlight ? Material.WHITE_STAINED_GLASS : Material.TNT);
this.setNoGravity(true);
diff --git a/BauSystem_15/src/de/steamwar/bausystem/features/tracer/TraceEntity_15.java b/BauSystem_15/src/de/steamwar/bausystem/entities/TraceEntity15.java
similarity index 87%
rename from BauSystem_15/src/de/steamwar/bausystem/features/tracer/TraceEntity_15.java
rename to BauSystem_15/src/de/steamwar/bausystem/entities/TraceEntity15.java
index 72ee13d3..99873513 100644
--- a/BauSystem_15/src/de/steamwar/bausystem/features/tracer/TraceEntity_15.java
+++ b/BauSystem_15/src/de/steamwar/bausystem/entities/TraceEntity15.java
@@ -17,9 +17,10 @@
along with this program. If not, see .
*/
-package de.steamwar.bausystem.features.tracer;
+package de.steamwar.bausystem.entities;
-import de.steamwar.bausystem.shared.BaseEntity_15;
+import de.steamwar.bausystem.features.tracer.AbstractTraceEntity;
+import de.steamwar.bausystem.shared.BaseEntity15;
import de.steamwar.bausystem.shared.ReferenceCounter;
import net.minecraft.server.v1_15_R1.ChatComponentText;
import org.bukkit.Material;
@@ -27,12 +28,12 @@ import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
-class TraceEntity_15 extends BaseEntity_15 implements AbstractTraceEntity {
+public class TraceEntity15 extends BaseEntity15 implements AbstractTraceEntity {
private boolean exploded = false;
private ReferenceCounter referenceCounter = new ReferenceCounter();
- public TraceEntity_15(World world, Vector position, boolean tnt) {
+ public TraceEntity15(World world, Vector position, boolean tnt) {
super(world, position, tnt ? Material.TNT : Material.WHITE_STAINED_GLASS);
this.setNoGravity(true);
diff --git a/BauSystem_15/src/de/steamwar/bausystem/features/warp/WarpEntity_15.java b/BauSystem_15/src/de/steamwar/bausystem/entities/WarpEntity15.java
similarity index 83%
rename from BauSystem_15/src/de/steamwar/bausystem/features/warp/WarpEntity_15.java
rename to BauSystem_15/src/de/steamwar/bausystem/entities/WarpEntity15.java
index 6e455c79..ba0934a6 100644
--- a/BauSystem_15/src/de/steamwar/bausystem/features/warp/WarpEntity_15.java
+++ b/BauSystem_15/src/de/steamwar/bausystem/entities/WarpEntity15.java
@@ -17,19 +17,20 @@
* along with this program. If not, see .
*/
-package de.steamwar.bausystem.features.warp;
+package de.steamwar.bausystem.entities;
-import de.steamwar.bausystem.shared.BaseArmorStand_15;
+import de.steamwar.bausystem.features.warp.AbstractWarpEntity;
+import de.steamwar.bausystem.shared.BaseArmorStand15;
import net.minecraft.server.v1_15_R1.ChatComponentText;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
-public class WarpEntity_15 extends BaseArmorStand_15 implements AbstractWarpEntity {
+public class WarpEntity15 extends BaseArmorStand15 implements AbstractWarpEntity {
private String name;
- public WarpEntity_15(World world, Vector position, String name) {
+ public WarpEntity15(World world, Vector position, String name) {
super(world, position);
setInvisible(true);
setSmall(true);
diff --git a/BauSystem_15/src/de/steamwar/bausystem/features/detonator/Detonator_15.java b/BauSystem_15/src/de/steamwar/bausystem/features/detonator/Detonator_15.java
deleted file mode 100644
index 05b8abd4..00000000
--- a/BauSystem_15/src/de/steamwar/bausystem/features/detonator/Detonator_15.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * This file is a part of the SteamWar software.
- *
- * Copyright (C) 2021 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.features.detonator;
-
-import org.bukkit.World;
-import org.bukkit.util.Vector;
-
-public class Detonator_15 {
-
- static AbstractDetonatorEntity constructEntity(World world, Vector position) {
- return new DetonatorEntity_15(world, position);
- }
-}
diff --git a/BauSystem_15/src/de/steamwar/bausystem/features/other/NoClipCommand_15.java b/BauSystem_15/src/de/steamwar/bausystem/features/other/NoClipCommand_15.java
deleted file mode 100644
index 435c3528..00000000
--- a/BauSystem_15/src/de/steamwar/bausystem/features/other/NoClipCommand_15.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * This file is a part of the SteamWar software.
- *
- * Copyright (C) 2021 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.features.other;
-
-import lombok.experimental.UtilityClass;
-import net.minecraft.server.v1_15_R1.EnumGamemode;
-import net.minecraft.server.v1_15_R1.PlayerInteractManager;
-import org.bukkit.GameMode;
-import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer;
-import org.bukkit.entity.Player;
-
-import java.lang.reflect.Field;
-
-@UtilityClass
-public class NoClipCommand_15 {
-
- private Field gameModeField;
-
- public void setGameModeInternal(Player player, GameMode gameMode) {
- CraftPlayer craftPlayer = (CraftPlayer) player;
- EnumGamemode enumGamemode = EnumGamemode.getById(gameMode.getValue());
- try {
- checkCache();
- gameModeField.set(craftPlayer.getHandle().playerInteractManager, enumGamemode);
- } catch (NoSuchFieldException | IllegalAccessException e) {
- throw new SecurityException("Could not find Field?");
- }
- }
-
- private void checkCache() throws NoSuchFieldException {
- if (gameModeField == null) {
- gameModeField = PlayerInteractManager.class.getDeclaredField("gamemode");
- gameModeField.setAccessible(true);
- }
- }
-}
diff --git a/BauSystem_15/src/de/steamwar/bausystem/features/script/ScriptListener_15.java b/BauSystem_15/src/de/steamwar/bausystem/features/script/ScriptListener_15.java
deleted file mode 100644
index ab952039..00000000
--- a/BauSystem_15/src/de/steamwar/bausystem/features/script/ScriptListener_15.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package de.steamwar.bausystem.features.script;
-
-import lombok.experimental.UtilityClass;
-import org.bukkit.Material;
-import org.bukkit.inventory.ItemStack;
-
-@UtilityClass
-public class ScriptListener_15 {
-
- static boolean isNoBook(ItemStack item) {
- return item.getType() != Material.WRITABLE_BOOK && item.getType() != Material.WRITTEN_BOOK;
- }
-
-}
diff --git a/BauSystem_15/src/de/steamwar/bausystem/features/simulator/Simulator_15.java b/BauSystem_15/src/de/steamwar/bausystem/features/simulator/Simulator_15.java
deleted file mode 100644
index 22504db2..00000000
--- a/BauSystem_15/src/de/steamwar/bausystem/features/simulator/Simulator_15.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- This file is a part of the SteamWar software.
-
- Copyright (C) 2020 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.features.simulator;
-
-import org.bukkit.World;
-import org.bukkit.util.Vector;
-
-public class Simulator_15 {
-
- public static AbstractSimulatorEntity create(World world, Vector tntPosition, boolean highlight) {
- return new SimulatorEntity_15(world, tntPosition, highlight);
- }
-
-}
diff --git a/BauSystem_15/src/de/steamwar/bausystem/features/slaves/MaterialUtils_15.java b/BauSystem_15/src/de/steamwar/bausystem/features/slaves/MaterialUtils_15.java
deleted file mode 100644
index d8a0df55..00000000
--- a/BauSystem_15/src/de/steamwar/bausystem/features/slaves/MaterialUtils_15.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * This file is a part of the SteamWar software.
- *
- * Copyright (C) 2021 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.features.slaves;
-
-import lombok.experimental.UtilityClass;
-import net.minecraft.server.v1_15_R1.WorldGenVines;
-import org.bukkit.Material;
-
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-@UtilityClass
-public class MaterialUtils_15 {
-
- private static Set unpushable = new HashSet<>(Arrays.asList(Material.BARRIER, Material.BEACON, Material.COMMAND_BLOCK, Material.CHAIN_COMMAND_BLOCK, Material.REPEATING_COMMAND_BLOCK, Material.ENCHANTING_TABLE, Material.END_GATEWAY, Material.END_PORTAL, Material.ENDER_CHEST, Material.GRINDSTONE, Material.JIGSAW, Material.JUKEBOX, Material.NETHER_PORTAL, Material.OBSIDIAN, Material.STRUCTURE_VOID, Material.BARREL, Material.BEEHIVE, Material.BEE_NEST, Material.BLAST_FURNACE, Material.BREWING_STAND, Material.CHEST, Material.DAYLIGHT_DETECTOR, Material.DISPENSER, Material.DROPPER, Material.FURNACE, Material.HOPPER, Material.LECTERN, Material.SMOKER, Material.TRAPPED_CHEST));
-
- // TODO: FLOWER
- private static Set breaking = new HashSet<>(Arrays.asList(Material.BAMBOO, Material.CACTUS, Material.CAKE, Material.CARVED_PUMPKIN, Material.CHORUS_FLOWER, Material.CHORUS_PLANT, Material.COBWEB, Material.COCOA, Material.DRAGON_EGG, Material.FIRE, Material.FLOWER_POT, Material.JACK_O_LANTERN, Material.LADDER, Material.LAVA, Material.LAVA, Material.LEVER, Material.LILY_PAD, Material.MELON, Material.NETHER_WART, Material.PUMPKIN, Material.COMPARATOR, Material.REDSTONE_WIRE, Material.REPEATER, Material.TORCH, Material.STRUCTURE_VOID, Material.SCAFFOLDING, Material.SEA_PICKLE, Material.SNOW, Material.SUGAR_CANE, Material.TORCH, Material.TRIPWIRE, Material.TRIPWIRE_HOOK, Material.TURTLE_EGG, Material.VINE, Material.WATER, Material.WHEAT));
-
- static boolean isUnpusheable(Material material) {
- if (unpushable.contains(material)) {
- return true;
- }
- String name = material.name();
- return name.contains("BANNER") || name.contains("SIGN");
- }
-
- static boolean isBreakingOnPush(Material material) {
- if (breaking.contains(material)) {
- return true;
- }
- String name = material.name();
- return name.contains("BED") || name.contains("BUTTON") || name.contains("CARPET") || (name.contains("DOOR") && !name.contains("TRAPDOOR")) || name.contains("HEAD") || name.contains("LEAVES") || name.contains("MUSHROOM") || name.contains("PRESSURE_PLATE") || name.contains("SHULKER_BOX");
- }
-}
diff --git a/BauSystem_15/src/de/steamwar/bausystem/features/tpslimit/TPSLimit_15.java b/BauSystem_15/src/de/steamwar/bausystem/features/tpslimit/TPSLimit_15.java
deleted file mode 100644
index db72b3f7..00000000
--- a/BauSystem_15/src/de/steamwar/bausystem/features/tpslimit/TPSLimit_15.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * This file is a part of the SteamWar software.
- *
- * Copyright (C) 2021 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.features.tpslimit;
-
-import lombok.experimental.UtilityClass;
-import net.minecraft.server.v1_15_R1.*;
-import org.bukkit.Bukkit;
-import org.bukkit.World;
-import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity;
-import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer;
-import org.bukkit.entity.Player;
-import org.bukkit.entity.TNTPrimed;
-
-import java.util.ArrayList;
-import java.util.List;
-
-@UtilityClass
-public class TPSLimit_15 {
-
- private static List> packets = new ArrayList<>();
- private static final Vec3D noMotion = new Vec3D(0, 0, 0);
-
- static void createTickCache(World world) {
- packets.clear();
- world.getEntities().stream().filter(entity -> !(entity instanceof Player)).forEach(entity -> {
- packets.add(new PacketPlayOutEntityVelocity(entity.getEntityId(), noMotion));
- packets.add(new PacketPlayOutEntityTeleport(((CraftEntity) entity).getHandle()));
-
- if (entity instanceof TNTPrimed) {
- net.minecraft.server.v1_15_R1.Entity serverEntity = ((CraftEntity) entity).getHandle();
- packets.add(new PacketPlayOutEntityMetadata(serverEntity.getId(), serverEntity.getDataWatcher(), true));
- }
- });
- }
-
- static void sendTickPackets() {
- Bukkit.getOnlinePlayers().forEach(player -> {
- PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection;
- for (Packet> p : packets) {
- connection.sendPacket(p);
- }
- });
- }
-}
diff --git a/BauSystem_15/src/de/steamwar/bausystem/features/tpslimit/TPSUtils_15.java b/BauSystem_15/src/de/steamwar/bausystem/features/tpslimit/TPSUtils_15.java
deleted file mode 100644
index d5a90652..00000000
--- a/BauSystem_15/src/de/steamwar/bausystem/features/tpslimit/TPSUtils_15.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * This file is a part of the SteamWar software.
- *
- * Copyright (C) 2021 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.features.tpslimit;
-
-import lombok.experimental.UtilityClass;
-import net.minecraft.server.v1_15_R1.SystemUtils;
-
-import java.util.function.LongSupplier;
-
-@UtilityClass
-public class TPSUtils_15 {
-
- public static void init(LongSupplier longSupplier) {
- SystemUtils.a = () -> System.nanoTime() + longSupplier.getAsLong();
- }
-
-}
diff --git a/BauSystem_15/src/de/steamwar/bausystem/features/tracer/TNTTracer_15.java b/BauSystem_15/src/de/steamwar/bausystem/features/tracer/TNTTracer_15.java
deleted file mode 100644
index ae87e5a3..00000000
--- a/BauSystem_15/src/de/steamwar/bausystem/features/tracer/TNTTracer_15.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- This file is a part of the SteamWar software.
-
- Copyright (C) 2020 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.features.tracer;
-
-import org.bukkit.Material;
-import org.bukkit.World;
-import org.bukkit.block.Block;
-import org.bukkit.block.data.BlockData;
-import org.bukkit.block.data.Waterlogged;
-import org.bukkit.util.Vector;
-
-public class TNTTracer_15 {
-
- public static AbstractTraceEntity create(World world, Vector tntPosition, boolean tnt) {
- return new TraceEntity_15(world, tntPosition, tnt);
- }
-
- public static boolean inWater(World world, Vector tntPosition) {
- Block block = world.getBlockAt(tntPosition.getBlockX(), tntPosition.getBlockY(), tntPosition.getBlockZ());
- if (block.getType() == Material.WATER)
- return true;
-
- BlockData data = block.getBlockData();
- if (!(data instanceof Waterlogged))
- return false;
-
- return ((Waterlogged) data).isWaterlogged();
- }
-
- public static Material getTraceShowMaterial() {
- return Material.LIME_CONCRETE;
- }
-
- public static Material getTraceHideMaterial() {
- return Material.RED_CONCRETE;
- }
-
- public static Material getTraceXZMaterial() {
- return Material.QUARTZ_SLAB;
- }
-
-}
diff --git a/BauSystem_15/src/de/steamwar/bausystem/features/util/SelectCommand_15.java b/BauSystem_15/src/de/steamwar/bausystem/features/util/SelectCommand_15.java
deleted file mode 100644
index 7ac89890..00000000
--- a/BauSystem_15/src/de/steamwar/bausystem/features/util/SelectCommand_15.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package de.steamwar.bausystem.features.util;
-
-import com.sk89q.worldedit.bukkit.BukkitWorld;
-import com.sk89q.worldedit.bukkit.WorldEditPlugin;
-import com.sk89q.worldedit.regions.selector.CuboidRegionSelector;
-import com.sk89q.worldedit.world.World;
-import de.steamwar.bausystem.region.Point;
-import de.steamwar.bausystem.region.RegionUtils_15;
-import org.bukkit.Bukkit;
-import org.bukkit.entity.Player;
-
-public class SelectCommand_15 {
-
- static final WorldEditPlugin WORLDEDIT_PLUGIN = ((WorldEditPlugin) Bukkit.getPluginManager().getPlugin("WorldEdit"));
- static final World BUKKITWORLD = new BukkitWorld(Bukkit.getWorlds().get(0));
-
- static void setSelection(Player p, Point minPoint, Point maxPoint) {
- WORLDEDIT_PLUGIN.getSession(p).setRegionSelector(BUKKITWORLD, new CuboidRegionSelector(BUKKITWORLD, RegionUtils_15.toBlockVector3(minPoint), RegionUtils_15.toBlockVector3(maxPoint)));
- }
-
-}
diff --git a/BauSystem_15/src/de/steamwar/bausystem/features/warp/WarpListener_15.java b/BauSystem_15/src/de/steamwar/bausystem/features/warp/WarpListener_15.java
deleted file mode 100644
index 6f98a453..00000000
--- a/BauSystem_15/src/de/steamwar/bausystem/features/warp/WarpListener_15.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * This file is a part of the SteamWar software.
- *
- * Copyright (C) 2021 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.features.warp;
-
-import org.bukkit.World;
-import org.bukkit.util.Vector;
-
-public class WarpListener_15 {
-
- public static AbstractWarpEntity create(World world, Vector position, String name) {
- return new WarpEntity_15(world, position, name);
- }
-}
diff --git a/BauSystem_15/src/de/steamwar/bausystem/features/world/InventoryListener_15.java b/BauSystem_15/src/de/steamwar/bausystem/features/world/InventoryListener_15.java
deleted file mode 100644
index cb5ba25d..00000000
--- a/BauSystem_15/src/de/steamwar/bausystem/features/world/InventoryListener_15.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * This file is a part of the SteamWar software.
- *
- * Copyright (C) 2021 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.features.world;
-
-import net.minecraft.server.v1_15_R1.NBTBase;
-import net.minecraft.server.v1_15_R1.NBTTagCompound;
-import net.minecraft.server.v1_15_R1.NBTTagList;
-import org.bukkit.craftbukkit.v1_15_R1.inventory.CraftItemStack;
-import org.bukkit.inventory.ItemStack;
-
-public class InventoryListener_15 {
-
- private static final int threshold = 2048;
-
- public static boolean checkItemStack(ItemStack item) {
- net.minecraft.server.v1_15_R1.ItemStack nmsItem = CraftItemStack.asNMSCopy(item);
- NBTTagCompound tag = nmsItem.getTag();
- if (tag != null && tag.hasKey("BlockEntityTag")) {
- NBTTagCompound blockTag = tag.getCompound("BlockEntityTag");
- if (blockTag.hasKey("Items")) {
- return drillDown(blockTag.getList("Items", 10), 0, 0) > threshold;
- }
- }
-
- return false;
- }
-
- private static 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))
- continue;
- NBTTagCompound slot = (NBTTagCompound) nbtBase;
- if (slot.hasKey("tag")) {
- invalid += slot.getByte("Count");
- NBTTagCompound iTag = slot.getCompound("tag");
- if (iTag.hasKey("BlockEntityTag")) {
- NBTTagCompound blockTag = iTag.getCompound("BlockEntityTag");
- if (blockTag.hasKey("Items")) {
- invalid = drillDown(blockTag.getList("Items", 10), layer + 1, invalid);
- }
- }
- }
- if (invalid > threshold)
- break;
- }
- return invalid;
- }
-}
diff --git a/BauSystem_15/src/de/steamwar/bausystem/features/world/WorldEditListener_15.java b/BauSystem_15/src/de/steamwar/bausystem/features/world/WorldEditListener_15.java
deleted file mode 100644
index 031034ed..00000000
--- a/BauSystem_15/src/de/steamwar/bausystem/features/world/WorldEditListener_15.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * This file is a part of the SteamWar software.
- *
- * Copyright (C) 2021 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.features.world;
-
-import com.sk89q.worldedit.WorldEdit;
-
-public class WorldEditListener_15 {
-
- static boolean isWorldEditCommand(String command) {
- if (command.startsWith("/")) {
- command = command.replaceFirst("/", "");
- }
- command = command.toLowerCase();
- return WorldEdit.getInstance().getPlatformManager().getPlatformCommandManager().getCommandManager().containsCommand(command);
- }
-}
diff --git a/BauSystem_15/src/de/steamwar/bausystem/region/RegionUtils_15.java b/BauSystem_15/src/de/steamwar/bausystem/region/RegionUtils_15.java
deleted file mode 100644
index 037727d7..00000000
--- a/BauSystem_15/src/de/steamwar/bausystem/region/RegionUtils_15.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * This file is a part of the SteamWar software.
- *
- * Copyright (C) 2021 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.region;
-
-import com.sk89q.worldedit.math.BlockVector3;
-import lombok.experimental.UtilityClass;
-
-@UtilityClass
-public class RegionUtils_15 {
-
- public BlockVector3 toBlockVector3(Point point) {
- return BlockVector3.at(point.getX(), point.getY(), point.getZ());
- }
-}
\ No newline at end of file
diff --git a/BauSystem_15/src/de/steamwar/bausystem/shared/BaseArmorStand_15.java b/BauSystem_15/src/de/steamwar/bausystem/shared/BaseArmorStand15.java
similarity index 93%
rename from BauSystem_15/src/de/steamwar/bausystem/shared/BaseArmorStand_15.java
rename to BauSystem_15/src/de/steamwar/bausystem/shared/BaseArmorStand15.java
index 751032ce..2e604c77 100644
--- a/BauSystem_15/src/de/steamwar/bausystem/shared/BaseArmorStand_15.java
+++ b/BauSystem_15/src/de/steamwar/bausystem/shared/BaseArmorStand15.java
@@ -26,13 +26,13 @@ import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
-public class BaseArmorStand_15 extends EntityArmorStand implements AbstractEntity {
+public class BaseArmorStand15 extends EntityArmorStand implements AbstractEntity {
private static final Vec3D ZERO = new Vec3D(0, 0, 0);
protected Vector position;
- public BaseArmorStand_15(World world, Vector position) {
+ public BaseArmorStand15(World world, Vector position) {
super(((CraftWorld) world).getHandle(), position.getX(), position.getY(), position.getZ());
this.position = position;
diff --git a/BauSystem_15/src/de/steamwar/bausystem/shared/BaseEntity_15.java b/BauSystem_15/src/de/steamwar/bausystem/shared/BaseEntity15.java
similarity index 94%
rename from BauSystem_15/src/de/steamwar/bausystem/shared/BaseEntity_15.java
rename to BauSystem_15/src/de/steamwar/bausystem/shared/BaseEntity15.java
index aec347e4..66480122 100644
--- a/BauSystem_15/src/de/steamwar/bausystem/shared/BaseEntity_15.java
+++ b/BauSystem_15/src/de/steamwar/bausystem/shared/BaseEntity15.java
@@ -28,14 +28,14 @@ import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
-public class BaseEntity_15 extends EntityFallingBlock implements AbstractEntity {
+public class BaseEntity15 extends EntityFallingBlock implements AbstractEntity {
private static final Vec3D ZERO = new Vec3D(0, 0, 0);
private final IBlockData iBlockData;
protected Vector position;
- public BaseEntity_15(World world, Vector position, Material blockType) {
+ public BaseEntity15(World world, Vector position, Material blockType) {
super(((CraftWorld) world).getHandle(), position.getX(), position.getY(), position.getZ(), ((CraftBlockData) blockType.createBlockData()).getState());
this.iBlockData = ((CraftBlockData) blockType.createBlockData()).getState();
this.position = position;
diff --git a/BauSystem_15/src/de/steamwar/bausystem/region/Region_15.java b/BauSystem_15/src/de/steamwar/bausystem/utils/FlatteningWrapper15.java
similarity index 66%
rename from BauSystem_15/src/de/steamwar/bausystem/region/Region_15.java
rename to BauSystem_15/src/de/steamwar/bausystem/utils/FlatteningWrapper15.java
index 388f6575..a1579c29 100644
--- a/BauSystem_15/src/de/steamwar/bausystem/region/Region_15.java
+++ b/BauSystem_15/src/de/steamwar/bausystem/utils/FlatteningWrapper15.java
@@ -1,7 +1,7 @@
/*
* This file is a part of the SteamWar software.
*
- * Copyright (C) 2021 SteamWar.de-Serverteam
+ * Copyright (C) 2022 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
@@ -17,12 +17,13 @@
* along with this program. If not, see .
*/
-package de.steamwar.bausystem.region;
+package de.steamwar.bausystem.utils;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.bukkit.BukkitWorld;
+import com.sk89q.worldedit.bukkit.WorldEditPlugin;
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.extent.clipboard.io.BuiltInClipboardFormat;
@@ -36,11 +37,22 @@ import com.sk89q.worldedit.function.operation.Operations;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.transform.AffineTransform;
import com.sk89q.worldedit.regions.CuboidRegion;
+import com.sk89q.worldedit.regions.selector.CuboidRegionSelector;
import com.sk89q.worldedit.session.ClipboardHolder;
+import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockTypes;
-import lombok.experimental.UtilityClass;
+import de.steamwar.bausystem.region.Color;
+import de.steamwar.bausystem.region.PasteOptions;
+import de.steamwar.bausystem.region.Point;
import org.bukkit.Bukkit;
+import org.bukkit.Material;
+import org.bukkit.block.Block;
+import org.bukkit.block.data.BlockData;
+import org.bukkit.block.data.Waterlogged;
+import org.bukkit.entity.Player;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.util.Vector;
import javax.annotation.Nullable;
import java.io.File;
@@ -50,8 +62,51 @@ import java.io.IOException;
import java.util.*;
import java.util.logging.Level;
-@UtilityClass
-public class Region_15 {
+public class FlatteningWrapper15 implements FlatteningWrapper.IFlatteningWrapper {
+
+ @Override
+ public boolean isNoBook(ItemStack item) {
+ return item.getType() != Material.WRITABLE_BOOK && item.getType() != Material.WRITTEN_BOOK;
+ }
+
+ private static final Set unpushable = new HashSet<>(Arrays.asList(Material.BARRIER, Material.BEACON, Material.COMMAND_BLOCK, Material.CHAIN_COMMAND_BLOCK, Material.REPEATING_COMMAND_BLOCK, Material.ENCHANTING_TABLE, Material.END_GATEWAY, Material.END_PORTAL, Material.ENDER_CHEST, Material.GRINDSTONE, Material.JIGSAW, Material.JUKEBOX, Material.NETHER_PORTAL, Material.OBSIDIAN, Material.STRUCTURE_VOID, Material.BARREL, Material.BEEHIVE, Material.BEE_NEST, Material.BLAST_FURNACE, Material.BREWING_STAND, Material.CHEST, Material.DAYLIGHT_DETECTOR, Material.DISPENSER, Material.DROPPER, Material.FURNACE, Material.HOPPER, Material.LECTERN, Material.SMOKER, Material.TRAPPED_CHEST));
+
+ // TODO: FLOWER
+ private static final Set breaking = new HashSet<>(Arrays.asList(Material.BAMBOO, Material.CACTUS, Material.CAKE, Material.CARVED_PUMPKIN, Material.CHORUS_FLOWER, Material.CHORUS_PLANT, Material.COBWEB, Material.COCOA, Material.DRAGON_EGG, Material.FIRE, Material.FLOWER_POT, Material.JACK_O_LANTERN, Material.LADDER, Material.LAVA, Material.LAVA, Material.LEVER, Material.LILY_PAD, Material.MELON, Material.NETHER_WART, Material.PUMPKIN, Material.COMPARATOR, Material.REDSTONE_WIRE, Material.REPEATER, Material.TORCH, Material.STRUCTURE_VOID, Material.SCAFFOLDING, Material.SEA_PICKLE, Material.SNOW, Material.SUGAR_CANE, Material.TORCH, Material.TRIPWIRE, Material.TRIPWIRE_HOOK, Material.TURTLE_EGG, Material.VINE, Material.WATER, Material.WHEAT));
+
+ @Override
+ public boolean isUnpusheable(Material material) {
+ if (unpushable.contains(material)) {
+ return true;
+ }
+ String name = material.name();
+ return name.contains("BANNER") || name.contains("SIGN");
+ }
+
+ @Override
+ public boolean isBreakingOnPush(Material material) {
+ if (breaking.contains(material)) {
+ return true;
+ }
+ String name = material.name();
+ return name.contains("BED") || name.contains("BUTTON") || name.contains("CARPET") || (name.contains("DOOR") && !name.contains("TRAPDOOR")) || name.contains("HEAD") || name.contains("LEAVES") || name.contains("MUSHROOM") || name.contains("PRESSURE_PLATE") || name.contains("SHULKER_BOX");
+ }
+
+ @Override
+ public boolean isWorldEditCommand(String command) {
+ if (command.startsWith("/")) {
+ command = command.replaceFirst("/", "");
+ }
+ command = command.toLowerCase();
+ return WorldEdit.getInstance().getPlatformManager().getPlatformCommandManager().getCommandManager().containsCommand(command);
+ }
+
+ private static final WorldEditPlugin WORLDEDIT_PLUGIN = Objects.requireNonNull((WorldEditPlugin) Bukkit.getPluginManager().getPlugin("WorldEdit"));
+ private static final World BUKKITWORLD = new BukkitWorld(Bukkit.getWorlds().get(0));
+ @Override
+ public void setSelection(Player p, Point minPoint, Point maxPoint) {
+ WORLDEDIT_PLUGIN.getSession(p).setRegionSelector(BUKKITWORLD, new CuboidRegionSelector(BUKKITWORLD, toBlockVector3(minPoint), toBlockVector3(maxPoint)));
+ }
private static final BaseBlock WOOL = Objects.requireNonNull(BlockTypes.PINK_WOOL).getDefaultState().toBaseBlock();
private static final BaseBlock WOOL2 = Objects.requireNonNull(BlockTypes.YELLOW_WOOL).getDefaultState().toBaseBlock();
@@ -67,17 +122,18 @@ public class Region_15 {
private static final BaseBlock CONCRETE_POWDER = Objects.requireNonNull(BlockTypes.PINK_CONCRETE_POWDER).getDefaultState().toBaseBlock();
private static final BaseBlock CARPET = Objects.requireNonNull(BlockTypes.PINK_CARPET).getDefaultState().toBaseBlock();
- private Map timing = new HashMap<>();
+ private final Map timing = new HashMap<>();
- public void start(String name) {
+ private void start(String name) {
timing.put(name, System.currentTimeMillis());
}
- public long stop(String name) {
+ private long stop(String name) {
return System.currentTimeMillis() - timing.getOrDefault(name, System.currentTimeMillis());
}
- EditSession paste(File file, Point pastePoint, PasteOptions pasteOptions) {
+ @Override
+ public EditSession paste(File file, Point pastePoint, PasteOptions pasteOptions) {
start("clipboardLoad");
Clipboard clipboard;
try (ClipboardReader reader = Objects.requireNonNull(ClipboardFormats.findByFile(file)).getReader(new FileInputStream(file))) {
@@ -93,7 +149,8 @@ public class Region_15 {
return editSession;
}
- EditSession paste(Clipboard clipboard, Point pastePoint, PasteOptions pasteOptions) {
+ @Override
+ public EditSession paste(Clipboard clipboard, Point pastePoint, PasteOptions pasteOptions) {
try (EditSession e = WorldEdit.getInstance().getEditSessionFactory().getEditSession(new BukkitWorld(Bukkit.getWorlds().get(0)), -1)) {
start("changeColor");
if (pasteOptions.getColor() != Color.YELLOW) {
@@ -142,9 +199,9 @@ public class Region_15 {
start("reset");
if (pasteOptions.isReset()) {
- e.setBlocks(new CuboidRegion(RegionUtils_15.toBlockVector3(pasteOptions.getMinPoint()), RegionUtils_15.toBlockVector3(pasteOptions.getMaxPoint())), Objects.requireNonNull(BlockTypes.AIR).getDefaultState().toBaseBlock());
+ e.setBlocks(new CuboidRegion(toBlockVector3(pasteOptions.getMinPoint()), toBlockVector3(pasteOptions.getMaxPoint())), Objects.requireNonNull(BlockTypes.AIR).getDefaultState().toBaseBlock());
if (pasteOptions.getWaterLevel() != 0) {
- e.setBlocks(new CuboidRegion(RegionUtils_15.toBlockVector3(pasteOptions.getMinPoint()), RegionUtils_15.toBlockVector3(pasteOptions.getMaxPoint()).withY(pasteOptions.getWaterLevel())), Objects.requireNonNull(BlockTypes.WATER).getDefaultState().toBaseBlock());
+ e.setBlocks(new CuboidRegion(toBlockVector3(pasteOptions.getMinPoint()), toBlockVector3(pasteOptions.getMaxPoint()).withY(pasteOptions.getWaterLevel())), Objects.requireNonNull(BlockTypes.WATER).getDefaultState().toBaseBlock());
}
}
System.out.println("Reset: " + stop("reset"));
@@ -157,7 +214,8 @@ public class Region_15 {
}
}
- void changeColor(Clipboard clipboard, Color color) throws WorldEditException {
+ @Override
+ public void changeColor(Clipboard clipboard, Color color) throws WorldEditException {
BlockVector3 minimum = clipboard.getRegion().getMinimumPoint();
BaseBlock wool = Objects.requireNonNull(BlockTypes.get(color.name().toLowerCase() + "_wool")).getDefaultState().toBaseBlock();
BaseBlock clay = Objects.requireNonNull(BlockTypes.get(color.name().toLowerCase() + "_terracotta")).getDefaultState().toBaseBlock();
@@ -205,9 +263,10 @@ public class Region_15 {
}
}
- boolean backup(Point minPoint, Point maxPoint, File file) {
+ @Override
+ public boolean backup(Point minPoint, Point maxPoint, File file) {
BukkitWorld bukkitWorld = new BukkitWorld(Bukkit.getWorlds().get(0));
- CuboidRegion region = new CuboidRegion(bukkitWorld, RegionUtils_15.toBlockVector3(minPoint), RegionUtils_15.toBlockVector3(maxPoint));
+ CuboidRegion region = new CuboidRegion(bukkitWorld, toBlockVector3(minPoint), toBlockVector3(maxPoint));
BlockArrayClipboard clipboard = new BlockArrayClipboard(region);
try (EditSession e = WorldEdit.getInstance().getEditSessionFactory().getEditSession(bukkitWorld, -1)) {
ForwardExtentCopy copy = new ForwardExtentCopy(
@@ -228,4 +287,36 @@ public class Region_15 {
return false;
}
}
-}
\ No newline at end of file
+
+ private BlockVector3 toBlockVector3(Point point) {
+ return BlockVector3.at(point.getX(), point.getY(), point.getZ());
+ }
+
+ @Override
+ public boolean inWater(org.bukkit.World world, Vector tntPosition) {
+ Block block = world.getBlockAt(tntPosition.getBlockX(), tntPosition.getBlockY(), tntPosition.getBlockZ());
+ if (block.getType() == Material.WATER)
+ return true;
+
+ BlockData data = block.getBlockData();
+ if (!(data instanceof Waterlogged))
+ return false;
+
+ return ((Waterlogged) data).isWaterlogged();
+ }
+
+ @Override
+ public Material getTraceShowMaterial() {
+ return Material.LIME_CONCRETE;
+ }
+
+ @Override
+ public Material getTraceHideMaterial() {
+ return Material.RED_CONCRETE;
+ }
+
+ @Override
+ public Material getTraceXZMaterial() {
+ return Material.QUARTZ_SLAB;
+ }
+}
diff --git a/BauSystem_15/src/de/steamwar/bausystem/utils/NMSWrapper15.java b/BauSystem_15/src/de/steamwar/bausystem/utils/NMSWrapper15.java
new file mode 100644
index 00000000..76478098
--- /dev/null
+++ b/BauSystem_15/src/de/steamwar/bausystem/utils/NMSWrapper15.java
@@ -0,0 +1,144 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2022 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.entities.DetonatorEntity15;
+import de.steamwar.bausystem.entities.SimulatorEntity15;
+import de.steamwar.bausystem.entities.TraceEntity15;
+import de.steamwar.bausystem.features.detonator.AbstractDetonatorEntity;
+import de.steamwar.bausystem.features.simulator.AbstractSimulatorEntity;
+import de.steamwar.bausystem.features.tracer.AbstractTraceEntity;
+import de.steamwar.bausystem.features.warp.AbstractWarpEntity;
+import de.steamwar.bausystem.entities.WarpEntity15;
+import net.minecraft.server.v1_15_R1.*;
+import org.bukkit.Bukkit;
+import org.bukkit.GameMode;
+import org.bukkit.World;
+import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer;
+import org.bukkit.craftbukkit.v1_15_R1.inventory.CraftItemStack;
+import org.bukkit.entity.Player;
+import org.bukkit.entity.TNTPrimed;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.util.Vector;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.function.LongSupplier;
+
+public class NMSWrapper15 implements NMSWrapper.INMSWrapper {
+
+ private static final Reflection.FieldAccessor playerGameMode = Reflection.getField(PlayerInteractManager.class, "gamemode", EnumGamemode.class);
+ @Override
+ @SuppressWarnings("deprecation")
+ public void setInternalGameMode(Player player, GameMode gameMode) {
+ playerGameMode.set(((CraftPlayer) player).getHandle().playerInteractManager, EnumGamemode.getById(gameMode.getValue()));
+ }
+
+ @Override
+ public void init(LongSupplier longSupplier) {
+ SystemUtils.a = () -> System.nanoTime() + longSupplier.getAsLong();
+ }
+
+ private static final List> packets = new ArrayList<>();
+ private static final Vec3D noMotion = new Vec3D(0, 0, 0);
+ @Override
+ public void createTickCache(World world) {
+ packets.clear();
+ world.getEntities().stream().filter(entity -> !(entity instanceof Player)).forEach(entity -> {
+ packets.add(new PacketPlayOutEntityVelocity(entity.getEntityId(), noMotion));
+ packets.add(new PacketPlayOutEntityTeleport(((CraftEntity) entity).getHandle()));
+
+ if (entity instanceof TNTPrimed) {
+ net.minecraft.server.v1_15_R1.Entity serverEntity = ((CraftEntity) entity).getHandle();
+ packets.add(new PacketPlayOutEntityMetadata(serverEntity.getId(), serverEntity.getDataWatcher(), true));
+ }
+ });
+ }
+
+ @Override
+ public void sendTickPackets() {
+ Bukkit.getOnlinePlayers().forEach(player -> {
+ PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection;
+ for (Packet> p : packets) {
+ connection.sendPacket(p);
+ }
+ });
+ }
+
+ private static final int threshold = 2048;
+ @Override
+ public boolean checkItemStack(ItemStack item) {
+ net.minecraft.server.v1_15_R1.ItemStack nmsItem = CraftItemStack.asNMSCopy(item);
+ NBTTagCompound tag = nmsItem.getTag();
+ if (tag != null && tag.hasKey("BlockEntityTag")) {
+ NBTTagCompound blockTag = tag.getCompound("BlockEntityTag");
+ if (blockTag.hasKey("Items")) {
+ return drillDown(blockTag.getList("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))
+ continue;
+ NBTTagCompound slot = (NBTTagCompound) nbtBase;
+ if (slot.hasKey("tag")) {
+ invalid += slot.getByte("Count");
+ NBTTagCompound iTag = slot.getCompound("tag");
+ if (iTag.hasKey("BlockEntityTag")) {
+ NBTTagCompound blockTag = iTag.getCompound("BlockEntityTag");
+ if (blockTag.hasKey("Items")) {
+ invalid = drillDown(blockTag.getList("Items", 10), layer + 1, invalid);
+ }
+ }
+ }
+ if (invalid > threshold)
+ break;
+ }
+ return invalid;
+ }
+
+ @Override
+ public AbstractWarpEntity createWarp(World world, Vector position, String name) {
+ return new WarpEntity15(world, position, name);
+ }
+
+ @Override
+ public AbstractSimulatorEntity createSimulator(World world, Vector tntPosition, boolean highlight) {
+ return new SimulatorEntity15(world, tntPosition, highlight);
+ }
+
+ @Override
+ public AbstractDetonatorEntity constructDetonator(World world, Vector position) {
+ return new DetonatorEntity15(world, position);
+ }
+
+ @Override
+ public AbstractTraceEntity createTrace(World world, Vector tntPosition, boolean tnt) {
+ return new TraceEntity15(world, tntPosition, tnt);
+ }
+}
diff --git a/BauSystem_API/build.gradle b/BauSystem_API/build.gradle
deleted file mode 100644
index 19035278..00000000
--- a/BauSystem_API/build.gradle
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * This file is a part of the SteamWar software.
- *
- * Copyright (C) 2020 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 .
- */
-
-plugins {
- id 'base'
- id 'java'
-}
-
-group 'steamwar'
-version '1.0'
-
-compileJava.options.encoding = 'UTF-8'
-
-sourceCompatibility = 1.8
-targetCompatibility = 1.8
-
-sourceSets {
- main {
- java {
- srcDirs = ['src/']
- }
- resources {
- srcDirs = ['src/']
- exclude '**/*.java', '**/*.kt'
- }
- }
-}
-
-dependencies {
- compileOnly 'org.projectlombok:lombok:1.18.22'
- testCompileOnly 'org.projectlombok:lombok:1.18.22'
- annotationProcessor 'org.projectlombok:lombok:1.18.22'
- testAnnotationProcessor 'org.projectlombok:lombok:1.18.22'
-
- compileOnly files("${projectDir}/../lib/Spigot-1.15.jar")
-}
\ No newline at end of file
diff --git a/BauSystem_API/settings.gradle b/BauSystem_API/settings.gradle
deleted file mode 100644
index a0fb288d..00000000
--- a/BauSystem_API/settings.gradle
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * This file is a part of the SteamWar software.
- *
- * Copyright (C) 2020 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 .
- */
-
-rootProject.name = 'BauSystem_API'
\ No newline at end of file
diff --git a/BauSystem_Main/build.gradle b/BauSystem_Main/build.gradle
index 1b2cd5c3..2f4feff1 100644
--- a/BauSystem_Main/build.gradle
+++ b/BauSystem_Main/build.gradle
@@ -43,9 +43,6 @@ sourceSets {
}
dependencies {
- implementation project(":BauSystem_15")
- implementation project(":BauSystem_API")
-
implementation 'yoyosource:YAPION:0.25.3'
// implementation files("${projectDir}/../lib/YAPION-SNAPSHOT.jar")
diff --git a/BauSystem_Main/src/BauSystem.properties b/BauSystem_Main/src/BauSystem.properties
index 20bb00ff..2ba75329 100644
--- a/BauSystem_Main/src/BauSystem.properties
+++ b/BauSystem_Main/src/BauSystem.properties
@@ -1077,8 +1077,8 @@ REGION_TNT_BUILD=§cEine Explosion hätte Blöcke im Baubereich zerstört
LOCK_SCHEM_NO_USER=§7Dieser Spieler existiert nicht!
LOCK_SCHEM_NO_SCHEM=§7Dieser Spieler besitzt keine Schematic mit diesem Namen!
LOCK_SCHEM_DIR=§7Die angegebene Schematic ist ein Ordner
-LOCK_SCHEM_LOCKED=§e{0} §7von §e{1} §7wurde von §e{2} §7auf §eNORMAL §7zurück gesetz. §f§lGrund: §f{3}
-LOCK_SCHEM_HELP=§8/§eschemlock §8[§7Owner§8] [§7Schematic§8] [§7Grund§8] - §7Sperre eine Schematic
+LOCK_SCHEM_LOCKED=§e{0} §7von §e{1} §7wurde von §e{2} §7auf §eNORMAL §7zurück gesetzt.
+LOCK_SCHEM_HELP=§8/§eschemlock §8[§7Owner§8] [§7Schematic§8] - §7Sperre eine Schematic (Nutzer über Sperrungsgrund informieren!)
AFK_KICK_MESSAGE=§cAuf diesem Server ist seit 5 Minuten nichts passiert.
AFK_WARNING_MESSAGE=§cDieser Server wird bei weiterer Inaktivität in einer Minute gestoppt
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/Permission.java b/BauSystem_Main/src/de/steamwar/bausystem/Permission.java
index 8e31d4fd..9de5e1e1 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/Permission.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/Permission.java
@@ -23,30 +23,20 @@ import de.steamwar.bausystem.config.BauServer;
import de.steamwar.sql.BauweltMember;
import de.steamwar.sql.SteamwarUser;
import lombok.AllArgsConstructor;
-import lombok.RequiredArgsConstructor;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
-import java.util.function.BiConsumer;
import java.util.function.Predicate;
@AllArgsConstructor
-@RequiredArgsConstructor
public enum Permission {
- WORLD(BauweltMember::isWorld, (player, target) -> {
- target.setWorld(!target.isWorld());
- sendMessages(player, target.isWorld(), target, "PERMISSION_WORLD");
- }),
- WORLDEDIT(BauweltMember::isWorldEdit, (player, target) -> {
- target.setWorldEdit(!target.isWorldEdit());
- sendMessages(player, target.isWorldEdit(), target, "PERMISSION_WORLD_EDIT");
- }),
+ WORLD(BauweltMember::isWorld),
+ WORLDEDIT(BauweltMember::isWorldEdit),
MEMBER(bauweltMember -> true),
OWNER(bauweltMember -> false);
private final Predicate permissionPredicate;
- private BiConsumer permissionChange = (player, bauweltMember) -> {};
public boolean hasPermission(Player member) {
if (member.getUniqueId().equals(BauServer.getInstance().getOwner())) {
@@ -80,12 +70,4 @@ public enum Permission {
BauSystem.MESSAGE.send("PERMISSION_CHANGE_YOU_DISABLE", player, BauSystem.MESSAGE.parse(what, player));
}
}
-
- public void toggle(Player player, BauweltMember target) {
- permissionChange.accept(player, target);
- }
-
- public static void toggle(Player player, BauweltMember target, Permission permission) {
- permission.toggle(player, target);
- }
}
\ No newline at end of file
diff --git a/BauSystem_API/src/de/steamwar/bausystem/SWUtils.java b/BauSystem_Main/src/de/steamwar/bausystem/SWUtils.java
similarity index 100%
rename from BauSystem_API/src/de/steamwar/bausystem/SWUtils.java
rename to BauSystem_Main/src/de/steamwar/bausystem/SWUtils.java
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/bau/BauCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/bau/BauCommand.java
index c31940e1..16c4c8e3 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/bau/BauCommand.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/bau/BauCommand.java
@@ -20,18 +20,16 @@
package de.steamwar.bausystem.features.bau;
import de.steamwar.bausystem.BauSystem;
-import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.config.BauServer;
import de.steamwar.bausystem.linkage.LinkageType;
import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.bausystem.linkage.LinkedInstance;
-import de.steamwar.command.*;
-import de.steamwar.sql.BauweltMember;
-import de.steamwar.sql.SteamwarUser;
+import de.steamwar.command.GuardCheckType;
+import de.steamwar.command.GuardChecker;
+import de.steamwar.command.GuardResult;
+import de.steamwar.command.SWCommand;
import org.bukkit.entity.Player;
-import java.util.stream.Collectors;
-
@Linked(LinkageType.COMMAND)
public class BauCommand extends SWCommand {
@@ -50,78 +48,6 @@ public class BauCommand extends SWCommand {
infoCommand.sendBauInfo(p);
}
- @Register(value = "togglewe", description = "BAU_COMMAND_HELP_TOGGLEWE")
- public void toggleWECommand(@Guard Player p, SteamwarUser user) {
- onToggleWE(p, user);
- }
-
- @Register(value = "toggleworld", description = "BAU_COMMAND_HELP_TOGGLEWORLD")
- public void toggleWorldCommand(@Guard Player p, SteamwarUser user) {
- onToggleWorld(p, user);
- }
-
- @Register("delmember")
- public void delMemberCommand(Player p, SteamwarUser user) {
-
- }
-
- @Register("addmember")
- public void addMemberCommand(Player p, String s) {
-
- }
-
- private void onToggleWE(Player p, SteamwarUser id) {
- if (negativeToggleCheck(p, id)) {
- return;
- }
-
- BauweltMember target = BauweltMember.getBauMember(bauServer.getOwnerID(), id.getId());
- Permission.WORLDEDIT.toggle(p, target);
- }
-
- private void onToggleWorld(Player p, SteamwarUser id) {
- if (negativeToggleCheck(p, id)) {
- return;
- }
-
- BauweltMember target = BauweltMember.getBauMember(bauServer.getOwnerID(), id.getId());
- Permission.WORLD.toggle(p, target);
- }
-
- private boolean negativeToggleCheck(Player p, SteamwarUser id) {
- if (id == null) {
- BauSystem.MESSAGE.send("BAU_UNKNOWN_PLAYER", p);
- return true;
- }
-
- BauweltMember target = BauweltMember.getBauMember(bauServer.getOwnerID(), id.getId());
- if (target == null) {
- BauSystem.MESSAGE.send("BAU_NO_PLAYER", p);
- return true;
- }
- return false;
- }
-
- @ClassMapper(value = SteamwarUser.class, local = true)
- private TypeMapper steamwarUserTypeMapper() {
- return SWCommandUtils.createMapper(s -> BauweltMember.getMembers(bauServer.getOwnerID())
- .stream()
- .map(m -> SteamwarUser.get(m.getMemberID()))
- .filter(u -> u.getUserName().equals(s))
- .findFirst()
- .orElse(null),
- (c, s) -> {
- if (!(c instanceof Player)) {
- return null;
- }
- Player p = (Player) c;
- return BauweltMember.getMembers(SteamwarUser.get(p.getUniqueId()).getId())
- .stream()
- .map(m -> SteamwarUser.get(m.getMemberID()).getUserName())
- .collect(Collectors.toList());
- });
- }
-
@ClassGuard(value = Player.class, local = true)
public GuardChecker bauGuard() {
return (commandSender, guardCheckType, strings, s) -> {
diff --git a/BauSystem_API/src/de/steamwar/bausystem/features/detonator/AbstractDetonatorEntity.java b/BauSystem_Main/src/de/steamwar/bausystem/features/detonator/AbstractDetonatorEntity.java
similarity index 100%
rename from BauSystem_API/src/de/steamwar/bausystem/features/detonator/AbstractDetonatorEntity.java
rename to BauSystem_Main/src/de/steamwar/bausystem/features/detonator/AbstractDetonatorEntity.java
diff --git a/BauSystem_API/src/de/steamwar/bausystem/features/detonator/Detoblock.java b/BauSystem_Main/src/de/steamwar/bausystem/features/detonator/Detoblock.java
similarity index 100%
rename from BauSystem_API/src/de/steamwar/bausystem/features/detonator/Detoblock.java
rename to BauSystem_Main/src/de/steamwar/bausystem/features/detonator/Detoblock.java
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/detonator/Detonator.java b/BauSystem_Main/src/de/steamwar/bausystem/features/detonator/Detonator.java
index 35a40af1..a610a0de 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/detonator/Detonator.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/detonator/Detonator.java
@@ -25,7 +25,7 @@ import de.steamwar.bausystem.configplayer.Config;
import de.steamwar.bausystem.features.autostart.AutostartListener;
import de.steamwar.bausystem.features.detonator.storage.DetonatorStorage;
import de.steamwar.bausystem.features.detonator.storage.ItemStorage;
-import de.steamwar.core.VersionedRunnable;
+import de.steamwar.bausystem.utils.NMSWrapper;
import lombok.experimental.UtilityClass;
import org.bukkit.Bukkit;
import org.bukkit.Location;
@@ -40,7 +40,6 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
import java.util.*;
-import java.util.stream.Collectors;
@UtilityClass
public class Detonator {
@@ -53,11 +52,8 @@ public class Detonator {
}
public static void showDetonator(Player p, List locs) {
- List vecs = locs.stream().map(Location::toVector).collect(Collectors.toList());
List entities = new LinkedList<>();
- VersionedRunnable.call(new VersionedRunnable(() -> {
- vecs.forEach(vector -> entities.add(Detonator_15.constructEntity(p.getWorld(), vector.add(HALF))));
- }, 15));
+ locs.stream().map(Location::toVector).forEach(vector -> entities.add(NMSWrapper.impl.constructDetonator(p.getWorld(), vector.add(HALF))));
entities.forEach(abstractDetonatorEntity -> abstractDetonatorEntity.display(p));
ENTITIES_MAP.putIfAbsent(p, entities);
}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/other/NoClipCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/other/NoClipCommand.java
index e63a2ba7..549deb27 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/other/NoClipCommand.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/other/NoClipCommand.java
@@ -25,9 +25,9 @@ import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.features.tpslimit.TPSUtils;
import de.steamwar.bausystem.linkage.LinkageType;
import de.steamwar.bausystem.linkage.Linked;
+import de.steamwar.bausystem.utils.NMSWrapper;
import de.steamwar.bausystem.utils.ProtocolAPI;
import de.steamwar.command.SWCommand;
-import de.steamwar.core.VersionedRunnable;
import lombok.Getter;
import org.bukkit.GameMode;
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer;
@@ -79,7 +79,7 @@ public class NoClipCommand extends SWCommand implements Listener {
BiFunction first = (player, o) -> {
if (NOCLIPS.contains(player)) {
if (LAST_TICKS.getOrDefault(player, -1L).equals(TPSUtils.currentTick.get())) return o;
- VersionedRunnable.call(new VersionedRunnable(() -> NoClipCommand_15.setGameModeInternal(player, GameMode.SPECTATOR), 15));
+ NMSWrapper.impl.setInternalGameMode(player, GameMode.SPECTATOR);
LAST_TICKS.put(player, TPSUtils.currentTick.get());
}
return o;
@@ -89,7 +89,7 @@ public class NoClipCommand extends SWCommand implements Listener {
BiFunction second = (player, o) -> {
if (NOCLIPS.contains(player)) {
- VersionedRunnable.call(new VersionedRunnable(() -> NoClipCommand_15.setGameModeInternal(player, GameMode.CREATIVE), 15));
+ NMSWrapper.impl.setInternalGameMode(player, GameMode.CREATIVE);
LAST_TICKS.put(player, TPSUtils.currentTick.get());
}
return o;
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/CustomScriptListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/CustomScriptListener.java
index 173b50f2..735c585f 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/CustomScriptListener.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/CustomScriptListener.java
@@ -27,7 +27,7 @@ import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.utils.RegionExtensionType;
import de.steamwar.bausystem.region.utils.RegionType;
-import de.steamwar.core.VersionedCallable;
+import de.steamwar.bausystem.utils.FlatteningWrapper;
import de.steamwar.inventory.SWItem;
import de.steamwar.inventory.SWListInv;
import de.steamwar.sql.UserConfig;
@@ -72,7 +72,7 @@ public class CustomScriptListener implements Listener {
return customCommands;
});
for (ItemStack item : p.getInventory().getContents()) {
- if (item == null || isNoBook(item) || item.getItemMeta() == null) {
+ if (item == null || FlatteningWrapper.impl.isNoBook(item) || item.getItemMeta() == null) {
continue;
}
@@ -173,10 +173,6 @@ public class CustomScriptListener implements Listener {
}
}
- private boolean isNoBook(ItemStack item) {
- return VersionedCallable.call(new VersionedCallable<>(() -> ScriptListener_15.isNoBook(item), 15));
- }
-
public void openCommandsMenu(Player p) {
List> menuCommands = new ArrayList<>();
playerMap.getOrDefault(p, new ArrayList<>()).stream().filter(CustomScript.MenuScript.class::isInstance).map(CustomScript.MenuScript.class::cast).forEach(menuItem -> {
@@ -210,7 +206,7 @@ public class CustomScriptListener implements Listener {
if (item.getType().isAir()) {
return;
}
- if (isNoBook(item) || item.getItemMeta() == null) {
+ if (FlatteningWrapper.impl.isNoBook(item) || item.getItemMeta() == null) {
return;
}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptListener.java
index 2065ba94..870e931c 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptListener.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptListener.java
@@ -3,7 +3,7 @@ package de.steamwar.bausystem.features.script;
import de.steamwar.bausystem.features.script.variables.Context;
import de.steamwar.bausystem.linkage.LinkageType;
import de.steamwar.bausystem.linkage.Linked;
-import de.steamwar.core.VersionedCallable;
+import de.steamwar.bausystem.utils.FlatteningWrapper;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@@ -30,7 +30,7 @@ public class ScriptListener implements Listener {
@EventHandler(priority = EventPriority.HIGH)
public void onLeftClick(PlayerInteractEvent event) {
ItemStack item = event.getItem();
- if (item == null || isNoBook(item) || item.getItemMeta() == null) {
+ if (item == null || FlatteningWrapper.impl.isNoBook(item) || item.getItemMeta() == null) {
return;
}
@@ -48,10 +48,6 @@ public class ScriptListener implements Listener {
new ScriptExecutor((BookMeta) item.getItemMeta(), event.getPlayer());
}
- private boolean isNoBook(ItemStack item) {
- return VersionedCallable.call(new VersionedCallable<>(() -> ScriptListener_15.isNoBook(item), 15));
- }
-
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
GLOBAL_CONTEXT.put(event.getPlayer(), new Context());
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/UnsignCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/UnsignCommand.java
index 10a4270b..7140c428 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/UnsignCommand.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/UnsignCommand.java
@@ -21,8 +21,8 @@ package de.steamwar.bausystem.features.script;
import de.steamwar.bausystem.linkage.LinkageType;
import de.steamwar.bausystem.linkage.Linked;
+import de.steamwar.bausystem.utils.FlatteningWrapper;
import de.steamwar.command.SWCommand;
-import de.steamwar.core.VersionedCallable;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@@ -37,12 +37,8 @@ public class UnsignCommand extends SWCommand {
@Register(description = "UNSIGN_HELP")
public void unsignCommand(Player p) {
ItemStack itemStack = p.getInventory().getItemInMainHand();
- if (isNoBook(itemStack)) return;
+ if (FlatteningWrapper.impl.isNoBook(itemStack)) return;
itemStack.setType(Material.WRITABLE_BOOK);
p.getInventory().setItemInMainHand(itemStack);
}
-
- private boolean isNoBook(ItemStack item) {
- return VersionedCallable.call(new VersionedCallable<>(() -> ScriptListener_15.isNoBook(item), 15));
- }
}
diff --git a/BauSystem_API/src/de/steamwar/bausystem/features/simulator/AbstractSimulatorEntity.java b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/AbstractSimulatorEntity.java
similarity index 100%
rename from BauSystem_API/src/de/steamwar/bausystem/features/simulator/AbstractSimulatorEntity.java
rename to BauSystem_Main/src/de/steamwar/bausystem/features/simulator/AbstractSimulatorEntity.java
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/show/SimulatorEntityShowMode.java b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/show/SimulatorEntityShowMode.java
index f5e1715e..1753826e 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/show/SimulatorEntityShowMode.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/show/SimulatorEntityShowMode.java
@@ -20,11 +20,10 @@
package de.steamwar.bausystem.features.simulator.show;
import de.steamwar.bausystem.features.simulator.AbstractSimulatorEntity;
-import de.steamwar.bausystem.features.simulator.Simulator_15;
import de.steamwar.bausystem.shared.Position;
import de.steamwar.bausystem.shared.RoundedPosition;
import de.steamwar.bausystem.shared.ShowMode;
-import de.steamwar.core.VersionedCallable;
+import de.steamwar.bausystem.utils.NMSWrapper;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
@@ -49,7 +48,7 @@ public class SimulatorEntityShowMode implements ShowMode {
}
public static AbstractSimulatorEntity createEntity(Player player, Vector position, boolean highlight) {
- return VersionedCallable.call(new VersionedCallable<>(() -> Simulator_15.create(player.getWorld(), position, highlight), 15));
+ return NMSWrapper.impl.createSimulator(player.getWorld(), position, highlight);
}
@Override
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/MaterialUtils.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/MaterialUtils.java
deleted file mode 100644
index 35c27649..00000000
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/MaterialUtils.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * This file is a part of the SteamWar software.
- *
- * Copyright (C) 2021 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.features.slaves;
-
-import de.steamwar.core.VersionedCallable;
-import org.bukkit.Material;
-
-public class MaterialUtils {
-
- public static boolean isUnpusheable(Material material) {
- return VersionedCallable.call(
- new VersionedCallable<>(() -> MaterialUtils_15.isUnpusheable(material), 15)
- );
- }
-
- public static boolean isBreakingOnPush(Material material) {
- return VersionedCallable.call(
- new VersionedCallable<>(() -> MaterialUtils_15.isBreakingOnPush(material), 15)
- );
- }
-}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/PistonLine.java b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/PistonLine.java
index de5c04f2..653ccec2 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/PistonLine.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/algorithms/PistonLine.java
@@ -19,11 +19,11 @@
package de.steamwar.bausystem.features.slaves.panzern.algorithms;
-import de.steamwar.bausystem.features.slaves.MaterialUtils;
import de.steamwar.bausystem.features.slaves.panzern.PanzernAlgorithm;
import de.steamwar.bausystem.features.slaves.panzern.PanzernResult;
import de.steamwar.bausystem.linkage.LinkageType;
import de.steamwar.bausystem.linkage.Linked;
+import de.steamwar.bausystem.utils.FlatteningWrapper;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
@@ -46,10 +46,10 @@ public class PistonLine implements PanzernAlgorithm {
}
BlockData blockData = relativeBlock.getBlockData();
if (!(blockData instanceof Piston)) {
- if (MaterialUtils.isUnpusheable(relativeBlock.getType())) {
+ if (FlatteningWrapper.impl.isUnpusheable(relativeBlock.getType())) {
break;
}
- if (MaterialUtils.isBreakingOnPush(relativeBlock.getType())) {
+ if (FlatteningWrapper.impl.isBreakingOnPush(relativeBlock.getType())) {
break;
}
continue;
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/team/LockSchemCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/team/LockSchemCommand.java
index d7cbe22d..daa5200f 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/team/LockSchemCommand.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/team/LockSchemCommand.java
@@ -23,12 +23,12 @@ import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.linkage.LinkageType;
import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.command.SWCommand;
-import de.steamwar.sql.*;
+import de.steamwar.sql.SchematicNode;
+import de.steamwar.sql.SchematicType;
+import de.steamwar.sql.SteamwarUser;
+import de.steamwar.sql.UserGroup;
import org.bukkit.entity.Player;
-import java.sql.Timestamp;
-import java.time.Instant;
-
@Linked(LinkageType.COMMAND)
public class LockSchemCommand extends SWCommand {
@@ -52,7 +52,7 @@ public class LockSchemCommand extends SWCommand {
}
@Register
- public void genericCommand(Player p, String owner, String schematicName, String... reason) {
+ public void genericCommand(Player p, String owner, String schematicName) {
SteamwarUser steamwarUser = SteamwarUser.get(p.getUniqueId());
UserGroup userGroup = steamwarUser.getUserGroup();
@@ -79,14 +79,8 @@ public class LockSchemCommand extends SWCommand {
return;
}
- StringBuilder builder = new StringBuilder();
- for (String s : reason) {
- builder.append(s).append(" ");
- }
-
- BauSystem.MESSAGE.send("LOCK_SCHEM_LOCKED", p, schematic.getName(), schemOwner.getUserName(), schematic.getSchemtype().name(), builder.toString());
+ BauSystem.MESSAGE.send("LOCK_SCHEM_LOCKED", p, schematic.getName(), schemOwner.getUserName(), schematic.getSchemtype().name());
schematic.setSchemtype(SchematicType.Normal);
- new CheckedSchematic(schematic.getName(), schematic.getOwner(), steamwarUser.getId(), Timestamp.from(Instant.now()), Timestamp.from(Instant.now()), builder.toString());
}
private void sendHelp(Player player) {
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tpslimit/TPSLimitUtils.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tpslimit/TPSLimitUtils.java
index 7d4d6e9b..8fde0980 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/tpslimit/TPSLimitUtils.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tpslimit/TPSLimitUtils.java
@@ -20,7 +20,7 @@
package de.steamwar.bausystem.features.tpslimit;
import de.steamwar.bausystem.BauSystem;
-import de.steamwar.core.VersionedRunnable;
+import de.steamwar.bausystem.utils.NMSWrapper;
import lombok.experimental.UtilityClass;
import org.bukkit.Bukkit;
import org.bukkit.World;
@@ -50,11 +50,11 @@ public class TPSLimitUtils {
tpsLimiter = null;
} else {
tpsLimiter = Bukkit.getScheduler().runTaskTimer(BauSystem.getInstance(), () -> {
- VersionedRunnable.call(new VersionedRunnable(() -> TPSLimit_15.createTickCache(WORLD), 15));
+ NMSWrapper.impl.createTickCache(WORLD);
for (int i = 0; i < loops; i++) {
sleepUntilNextTick(sleepDelay);
- VersionedRunnable.call(new VersionedRunnable(TPSLimit_15::sendTickPackets, 15));
+ NMSWrapper.impl.sendTickPackets();
}
}, 0, 1);
}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tpslimit/TPSWarpUtils.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tpslimit/TPSWarpUtils.java
index 28fbbc02..a1a5b656 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/tpslimit/TPSWarpUtils.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tpslimit/TPSWarpUtils.java
@@ -20,9 +20,9 @@
package de.steamwar.bausystem.features.tpslimit;
import de.steamwar.bausystem.BauSystem;
+import de.steamwar.bausystem.utils.NMSWrapper;
import de.steamwar.core.Core;
import de.steamwar.core.TPSWatcher;
-import de.steamwar.core.VersionedRunnable;
import lombok.experimental.UtilityClass;
import org.bukkit.Bukkit;
import org.bukkit.scheduler.BukkitTask;
@@ -36,10 +36,7 @@ public class TPSWarpUtils {
private static BukkitTask bukkitTask = null;
static void init() {
- VersionedRunnable.call(new VersionedRunnable(() -> warp = false, 8),
- new VersionedRunnable(() -> {
- TPSUtils_15.init(() -> nanoOffset);
- }, 15));
+ NMSWrapper.impl.init(() -> nanoOffset);
}
public static void setTPS(double tps) {
diff --git a/BauSystem_API/src/de/steamwar/bausystem/features/tracer/AbstractTraceEntity.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/AbstractTraceEntity.java
similarity index 100%
rename from BauSystem_API/src/de/steamwar/bausystem/features/tracer/AbstractTraceEntity.java
rename to BauSystem_Main/src/de/steamwar/bausystem/features/tracer/AbstractTraceEntity.java
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/gui/TraceShowGui.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/gui/TraceShowGui.java
index d3eea803..2fdc1c5a 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/gui/TraceShowGui.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/gui/TraceShowGui.java
@@ -20,11 +20,10 @@
package de.steamwar.bausystem.features.tracer.gui;
import de.steamwar.bausystem.BauSystem;
-import de.steamwar.bausystem.features.tracer.TNTTracer_15;
import de.steamwar.bausystem.features.tracer.show.ShowModeParameter;
import de.steamwar.bausystem.features.tracer.show.TraceShowManager;
import de.steamwar.bausystem.features.tracer.show.mode.TraceEntityShowMode;
-import de.steamwar.core.VersionedCallable;
+import de.steamwar.bausystem.utils.FlatteningWrapper;
import de.steamwar.inventory.SWInventory;
import de.steamwar.inventory.SWItem;
import lombok.experimental.UtilityClass;
@@ -61,7 +60,7 @@ public class TraceShowGui {
swInventory.setItem(6, interpolateY);
swInventory.setCallback(6, clickType -> toggleInterpolateYPosition(player, swInventory, interpolateY));
- Material xzMaterial = VersionedCallable.call(new VersionedCallable<>(TNTTracer_15::getTraceXZMaterial, 14));
+ Material xzMaterial = FlatteningWrapper.impl.getTraceXZMaterial();
SWItem interpolateXZ = new SWItem(xzMaterial, (byte) 7, BauSystem.MESSAGE.parse("TRACE_SHOW_GUI_INTERPOLATE_XZ_ITEM", player), Arrays.asList(BauSystem.MESSAGE.parse("TRACE_SHOW_GUI_INTERPOLATE_XZ_LORE1", player), BauSystem.MESSAGE.parse("TRACE_SHOW_GUI_INTERPOLATE_XZ_LORE2", player)), false, clickType -> {
});
swInventory.setItem(7, interpolateXZ);
@@ -75,7 +74,7 @@ public class TraceShowGui {
private static void setActiveShow(Player player, SWInventory swInventory) {
if (TraceShowManager.hasActiveShow(player)) {
- Material showMaterial = VersionedCallable.call(new VersionedCallable<>(TNTTracer_15::getTraceShowMaterial, 14));
+ Material showMaterial = FlatteningWrapper.impl.getTraceShowMaterial();
SWItem shown = new SWItem(showMaterial, BauSystem.MESSAGE.parse("TRACE_SHOW_GUI_SHOWN", player), new ArrayList<>(), false, clickType -> {
TraceShowManager.hide(player);
BauSystem.MESSAGE.send("TRACE_MESSAGE_HIDE", player);
@@ -83,7 +82,7 @@ public class TraceShowGui {
});
swInventory.setItem(1, shown);
} else {
- Material hideMaterial = VersionedCallable.call(new VersionedCallable<>(TNTTracer_15::getTraceHideMaterial, 14));
+ Material hideMaterial = FlatteningWrapper.impl.getTraceHideMaterial();
SWItem hidden = new SWItem(hideMaterial, BauSystem.MESSAGE.parse("TRACE_SHOW_GUI_HIDDEN", player), new ArrayList<>(), false, clickType -> {
show(player);
BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW", player);
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/mode/FactoredEntityShowMode.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/mode/FactoredEntityShowMode.java
index a6664124..06288cb6 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/mode/FactoredEntityShowMode.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/show/mode/FactoredEntityShowMode.java
@@ -21,11 +21,11 @@ package de.steamwar.bausystem.features.tracer.show.mode;
import de.steamwar.bausystem.features.tracer.AbstractTraceEntity;
import de.steamwar.bausystem.features.tracer.TNTPosition;
-import de.steamwar.bausystem.features.tracer.TNTTracer_15;
import de.steamwar.bausystem.features.tracer.show.ShowModeParameter;
import de.steamwar.bausystem.shared.RoundedPosition;
import de.steamwar.bausystem.shared.ShowMode;
-import de.steamwar.core.VersionedCallable;
+import de.steamwar.bausystem.utils.FlatteningWrapper;
+import de.steamwar.bausystem.utils.NMSWrapper;
import org.bukkit.entity.Player;
import org.bukkit.util.Consumer;
import org.bukkit.util.Vector;
@@ -91,11 +91,11 @@ public abstract class FactoredEntityShowMode implements ShowMode {
}
private boolean checkWater(Vector position) {
- return VersionedCallable.call(new VersionedCallable<>(() -> TNTTracer_15.inWater(player.getWorld(), position), 15));
+ return FlatteningWrapper.impl.inWater(player.getWorld(), position);
}
public static AbstractTraceEntity createEntity(Player player, Vector position, boolean tnt) {
- return VersionedCallable.call(new VersionedCallable<>(() -> TNTTracer_15.create(player.getWorld(), position, tnt), 15));
+ return NMSWrapper.impl.createTrace(player.getWorld(), position, tnt);
}
private void applyOnPosition(TNTPosition position, Consumer function) {
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/util/SelectCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/util/SelectCommand.java
index 0da7ade2..83c74955 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/util/SelectCommand.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/util/SelectCommand.java
@@ -8,11 +8,11 @@ import de.steamwar.bausystem.region.Point;
import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.utils.RegionExtensionType;
import de.steamwar.bausystem.region.utils.RegionType;
+import de.steamwar.bausystem.utils.FlatteningWrapper;
import de.steamwar.command.GuardCheckType;
import de.steamwar.command.GuardChecker;
import de.steamwar.command.GuardResult;
import de.steamwar.command.SWCommand;
-import de.steamwar.core.VersionedRunnable;
import org.bukkit.entity.Player;
@Linked(LinkageType.COMMAND)
@@ -61,7 +61,7 @@ public class SelectCommand extends SWCommand {
Point minPoint = region.getMinPoint(regionType, regionExtensionType);
Point maxPoint = region.getMaxPoint(regionType, regionExtensionType);
- VersionedRunnable.call(new VersionedRunnable(() -> SelectCommand_15.setSelection(p, minPoint, maxPoint), 15));
+ FlatteningWrapper.impl.setSelection(p, minPoint, maxPoint);
BauSystem.MESSAGE.send("SELECT_MESSAGE", p, minPoint.getX(), minPoint.getY(), minPoint.getZ(), maxPoint.getX(), maxPoint.getY(), maxPoint.getZ());
}
}
diff --git a/BauSystem_API/src/de/steamwar/bausystem/features/warp/AbstractWarpEntity.java b/BauSystem_Main/src/de/steamwar/bausystem/features/warp/AbstractWarpEntity.java
similarity index 100%
rename from BauSystem_API/src/de/steamwar/bausystem/features/warp/AbstractWarpEntity.java
rename to BauSystem_Main/src/de/steamwar/bausystem/features/warp/AbstractWarpEntity.java
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/warp/WarpListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/warp/WarpListener.java
index 4e6690ef..a86f2ca8 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/warp/WarpListener.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/warp/WarpListener.java
@@ -21,7 +21,7 @@ package de.steamwar.bausystem.features.warp;
import de.steamwar.bausystem.linkage.LinkageType;
import de.steamwar.bausystem.linkage.Linked;
-import de.steamwar.core.VersionedCallable;
+import de.steamwar.bausystem.utils.NMSWrapper;
import org.bukkit.*;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@@ -121,7 +121,7 @@ public class WarpListener implements Listener {
}
public static AbstractWarpEntity createEntity(Player player, Vector position, String name) {
- return VersionedCallable.call(new VersionedCallable<>(() -> WarpListener_15.create(player.getWorld(), position, name), 15));
+ return NMSWrapper.impl.createWarp(player.getWorld(), position, name);
}
@EventHandler
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/world/InventoryListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/world/InventoryListener.java
index e924d63e..42f25029 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/world/InventoryListener.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/world/InventoryListener.java
@@ -21,7 +21,7 @@ package de.steamwar.bausystem.features.world;
import de.steamwar.bausystem.linkage.LinkageType;
import de.steamwar.bausystem.linkage.Linked;
-import de.steamwar.core.VersionedCallable;
+import de.steamwar.bausystem.utils.NMSWrapper;
import org.bukkit.attribute.Attribute;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
@@ -58,7 +58,7 @@ public class InventoryListener implements Listener {
}
stack.setItemMeta(meta);
}
- if (VersionedCallable.call(new VersionedCallable(() -> InventoryListener_15.checkItemStack(stack), 15))) {
+ if (NMSWrapper.impl.checkItemStack(stack)) {
e.setCurrentItem(null);
e.setCancelled(true);
return;
@@ -74,7 +74,7 @@ public class InventoryListener implements Listener {
for (int i = 0; i < content.length; i++) {
if (content[i] == null) continue;
int finalI = i;
- if (VersionedCallable.call(new VersionedCallable(() -> InventoryListener_15.checkItemStack(content[finalI]), 15))) {
+ if (NMSWrapper.impl.checkItemStack(content[finalI])) {
p.getInventory().setItem(i, null);
}
}
@@ -83,7 +83,7 @@ public class InventoryListener implements Listener {
@EventHandler(ignoreCancelled = true)
public void onBlockPlace(BlockPlaceEvent event) {
Player p = event.getPlayer();
- if (VersionedCallable.call(new VersionedCallable(() -> InventoryListener_15.checkItemStack(event.getItemInHand()), 15))) {
+ if (NMSWrapper.impl.checkItemStack(event.getItemInHand())) {
event.setCancelled(true);
event.setBuild(false);
p.getInventory().setItemInMainHand(null);
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/world/WorldEditListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/world/WorldEditListener.java
index 07061fcb..dfe69d8e 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/world/WorldEditListener.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/world/WorldEditListener.java
@@ -23,7 +23,7 @@ import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.linkage.LinkageType;
import de.steamwar.bausystem.linkage.Linked;
-import de.steamwar.core.VersionedCallable;
+import de.steamwar.bausystem.utils.FlatteningWrapper;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
@@ -50,6 +50,6 @@ public class WorldEditListener implements Listener {
if (command.startsWith(shortcut)) return true;
}
- return VersionedCallable.call(new VersionedCallable<>(() -> WorldEditListener_15.isWorldEditCommand(command), 15));
+ return FlatteningWrapper.impl.isWorldEditCommand(command);
}
}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/linkage/LinkageUtils.java b/BauSystem_Main/src/de/steamwar/bausystem/linkage/LinkageUtils.java
index 85f41d5a..825eff86 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/linkage/LinkageUtils.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/linkage/LinkageUtils.java
@@ -20,6 +20,8 @@
package de.steamwar.bausystem.linkage;
import de.steamwar.bausystem.BauSystem;
+import de.steamwar.bausystem.utils.FlatteningWrapper;
+import de.steamwar.bausystem.utils.NMSWrapper;
import lombok.experimental.UtilityClass;
import org.bukkit.Bukkit;
@@ -39,6 +41,12 @@ public class LinkageUtils {
private Map, Object> objectMap = new HashMap<>();
private Set fieldsToLink = new HashSet<>();
+ {
+ objectMap.put(BauSystem.class, BauSystem.getInstance());
+ objectMap.put(FlatteningWrapper.IFlatteningWrapper.class, FlatteningWrapper.impl);
+ objectMap.put(NMSWrapper.INMSWrapper.class, NMSWrapper.impl);
+ }
+
public void link() {
internalLinkOrUnlink(false, Linked.class);
internalLinkFields();
diff --git a/BauSystem_API/src/de/steamwar/bausystem/region/Color.java b/BauSystem_Main/src/de/steamwar/bausystem/region/Color.java
similarity index 100%
rename from BauSystem_API/src/de/steamwar/bausystem/region/Color.java
rename to BauSystem_Main/src/de/steamwar/bausystem/region/Color.java
diff --git a/BauSystem_API/src/de/steamwar/bausystem/region/PasteOptions.java b/BauSystem_Main/src/de/steamwar/bausystem/region/PasteOptions.java
similarity index 100%
rename from BauSystem_API/src/de/steamwar/bausystem/region/PasteOptions.java
rename to BauSystem_Main/src/de/steamwar/bausystem/region/PasteOptions.java
diff --git a/BauSystem_API/src/de/steamwar/bausystem/region/Point.java b/BauSystem_Main/src/de/steamwar/bausystem/region/Point.java
similarity index 100%
rename from BauSystem_API/src/de/steamwar/bausystem/region/Point.java
rename to BauSystem_Main/src/de/steamwar/bausystem/region/Point.java
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/region/Region.java b/BauSystem_Main/src/de/steamwar/bausystem/region/Region.java
index ef6ee07d..67a76671 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/region/Region.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/region/Region.java
@@ -28,7 +28,7 @@ import de.steamwar.bausystem.region.tags.Tag;
import de.steamwar.bausystem.region.utils.RegionExtensionType;
import de.steamwar.bausystem.region.utils.RegionType;
import de.steamwar.bausystem.shared.SizedStack;
-import de.steamwar.core.VersionedCallable;
+import de.steamwar.bausystem.utils.FlatteningWrapper;
import de.steamwar.sql.SchematicNode;
import lombok.AccessLevel;
import lombok.Getter;
@@ -546,12 +546,11 @@ public class Region {
}
final File backupFile = new File(definedBackupFolder, LocalDateTime.now().format(formatter) + ".schem");
- //noinspection unchecked
- return VersionedCallable.call(new VersionedCallable<>(() -> Region_15.backup(minPoint, maxPoint, backupFile), 15));
+ return FlatteningWrapper.impl.backup(minPoint, maxPoint, backupFile);
}
public static boolean copy(Point minPoint, Point maxPoint, File file) {
- return VersionedCallable.call(new VersionedCallable<>(() -> Region_15.backup(minPoint, maxPoint, file), 15));
+ return FlatteningWrapper.impl.backup(minPoint, maxPoint, file);
}
public List listBackup() {
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/region/RegionUtils.java b/BauSystem_Main/src/de/steamwar/bausystem/region/RegionUtils.java
index 5def64bc..45eeeec1 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/region/RegionUtils.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/region/RegionUtils.java
@@ -24,8 +24,8 @@ import com.sk89q.worldedit.extent.clipboard.Clipboard;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.region.utils.RegionExtensionType;
import de.steamwar.bausystem.region.utils.RegionType;
+import de.steamwar.bausystem.utils.FlatteningWrapper;
import de.steamwar.bausystem.worlddata.WorldData;
-import de.steamwar.core.VersionedCallable;
import lombok.experimental.UtilityClass;
import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.chat.TextComponent;
@@ -71,11 +71,11 @@ public class RegionUtils {
}
static EditSession paste(File file, Point pastePoint, PasteOptions pasteOptions) {
- return VersionedCallable.call(new VersionedCallable<>(() -> Region_15.paste(file, pastePoint, pasteOptions), 15));
+ return FlatteningWrapper.impl.paste(file, pastePoint, pasteOptions);
}
static EditSession paste(Clipboard clipboard, Point pastePoint, PasteOptions pasteOptions) {
- return VersionedCallable.call(new VersionedCallable<>(() -> Region_15.paste(clipboard, pastePoint, pasteOptions), 15));
+ return FlatteningWrapper.impl.paste(clipboard, pastePoint, pasteOptions);
}
static void save(Region region) {
diff --git a/BauSystem_API/src/de/steamwar/bausystem/shared/AbstractEntity.java b/BauSystem_Main/src/de/steamwar/bausystem/shared/AbstractEntity.java
similarity index 100%
rename from BauSystem_API/src/de/steamwar/bausystem/shared/AbstractEntity.java
rename to BauSystem_Main/src/de/steamwar/bausystem/shared/AbstractEntity.java
diff --git a/BauSystem_API/src/de/steamwar/bausystem/shared/Pair.java b/BauSystem_Main/src/de/steamwar/bausystem/shared/Pair.java
similarity index 100%
rename from BauSystem_API/src/de/steamwar/bausystem/shared/Pair.java
rename to BauSystem_Main/src/de/steamwar/bausystem/shared/Pair.java
diff --git a/BauSystem_API/src/de/steamwar/bausystem/shared/ReferenceCounter.java b/BauSystem_Main/src/de/steamwar/bausystem/shared/ReferenceCounter.java
similarity index 100%
rename from BauSystem_API/src/de/steamwar/bausystem/shared/ReferenceCounter.java
rename to BauSystem_Main/src/de/steamwar/bausystem/shared/ReferenceCounter.java
diff --git a/BauSystem_API/src/de/steamwar/bausystem/shared/SizedStack.java b/BauSystem_Main/src/de/steamwar/bausystem/shared/SizedStack.java
similarity index 100%
rename from BauSystem_API/src/de/steamwar/bausystem/shared/SizedStack.java
rename to BauSystem_Main/src/de/steamwar/bausystem/shared/SizedStack.java
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/utils/FlatteningWrapper.java b/BauSystem_Main/src/de/steamwar/bausystem/utils/FlatteningWrapper.java
new file mode 100644
index 00000000..ebed2038
--- /dev/null
+++ b/BauSystem_Main/src/de/steamwar/bausystem/utils/FlatteningWrapper.java
@@ -0,0 +1,63 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2022 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.sk89q.worldedit.EditSession;
+import com.sk89q.worldedit.WorldEditException;
+import com.sk89q.worldedit.extent.clipboard.Clipboard;
+import de.steamwar.bausystem.BauSystem;
+import de.steamwar.bausystem.region.Color;
+import de.steamwar.bausystem.region.PasteOptions;
+import de.steamwar.bausystem.region.Point;
+import de.steamwar.core.VersionDependent;
+import org.bukkit.Material;
+import org.bukkit.World;
+import org.bukkit.entity.Player;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.util.Vector;
+
+import java.io.File;
+
+public class FlatteningWrapper {
+ private FlatteningWrapper() {}
+
+ public static final IFlatteningWrapper impl = VersionDependent.getVersionImpl(BauSystem.getInstance());
+
+ public interface IFlatteningWrapper {
+ boolean isNoBook(ItemStack item);
+
+ boolean isUnpusheable(Material material);
+ boolean isBreakingOnPush(Material material);
+
+ boolean isWorldEditCommand(String command);
+ void setSelection(Player p, Point minPoint, Point maxPoint);
+
+ EditSession paste(File file, Point pastePoint, PasteOptions pasteOptions);
+ EditSession paste(Clipboard clipboard, Point pastePoint, PasteOptions pasteOptions);
+ void changeColor(Clipboard clipboard, Color color) throws WorldEditException;
+ boolean backup(Point minPoint, Point maxPoint, File file);
+
+ boolean inWater(World world, Vector tntPosition);
+
+ Material getTraceShowMaterial();
+ Material getTraceHideMaterial();
+ Material getTraceXZMaterial();
+ }
+}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/utils/NMSWrapper.java b/BauSystem_Main/src/de/steamwar/bausystem/utils/NMSWrapper.java
new file mode 100644
index 00000000..38686fa8
--- /dev/null
+++ b/BauSystem_Main/src/de/steamwar/bausystem/utils/NMSWrapper.java
@@ -0,0 +1,55 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2022 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.bausystem.BauSystem;
+import de.steamwar.bausystem.features.detonator.AbstractDetonatorEntity;
+import de.steamwar.bausystem.features.simulator.AbstractSimulatorEntity;
+import de.steamwar.bausystem.features.tracer.AbstractTraceEntity;
+import de.steamwar.bausystem.features.warp.AbstractWarpEntity;
+import de.steamwar.core.VersionDependent;
+import org.bukkit.GameMode;
+import org.bukkit.World;
+import org.bukkit.entity.Player;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.util.Vector;
+
+import java.util.function.LongSupplier;
+
+public class NMSWrapper {
+ private NMSWrapper() {}
+
+ public static final INMSWrapper impl = VersionDependent.getVersionImpl(BauSystem.getInstance());
+
+ public interface INMSWrapper {
+ void setInternalGameMode(Player player, GameMode gameMode);
+
+ void init(LongSupplier longSupplier);
+ void createTickCache(World world);
+ void sendTickPackets();
+
+ boolean checkItemStack(ItemStack item);
+
+ AbstractWarpEntity createWarp(World world, Vector position, String name);
+ AbstractSimulatorEntity createSimulator(World world, Vector tntPosition, boolean highlight);
+ AbstractDetonatorEntity constructDetonator(World world, Vector position);
+ AbstractTraceEntity createTrace(World world, Vector tntPosition, boolean tnt);
+ }
+}
diff --git a/build.gradle b/build.gradle
index 0392b342..6ad8376b 100644
--- a/build.gradle
+++ b/build.gradle
@@ -80,6 +80,7 @@ allprojects {
dependencies {
implementation project(":BauSystem_Main")
+ implementation project(":BauSystem_15")
}
task buildResources(type: Copy) {