forked from SteamWar/SteamWar
Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
97935de372 | ||
|
|
5eac6a6c61 | ||
|
|
88742f099d |
+1
-9
@@ -11,13 +11,5 @@ steamwar.properties
|
|||||||
.idea
|
.idea
|
||||||
*.iml
|
*.iml
|
||||||
|
|
||||||
# VSCode
|
|
||||||
bin/
|
|
||||||
.vscode
|
|
||||||
|
|
||||||
# Other
|
# Other
|
||||||
lib
|
lib
|
||||||
/WebsiteBackend/data
|
|
||||||
/WebsiteBackend/logs
|
|
||||||
/WebsiteBackend/skins
|
|
||||||
/WebsiteBackend/config.json
|
|
||||||
@@ -27,8 +27,8 @@ java {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly(project(":BauSystem:BauSystem_Main", "default"))
|
compileOnly(project(":BauSystem:BauSystem_Main"))
|
||||||
compileOnly(project(":SpigotCore", "default"))
|
compileOnly(project(":SpigotCore"))
|
||||||
|
|
||||||
compileOnly(libs.nms15)
|
compileOnly(libs.nms15)
|
||||||
compileOnly(libs.worldedit15)
|
compileOnly(libs.worldedit15)
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ public class FlatteningWrapper15 implements FlatteningWrapper {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setSelection(Player p, Point minPoint, Point maxPoint) {
|
public void setSelection(Player p, Point minPoint, Point maxPoint) {
|
||||||
WORLDEDIT_PLUGIN.getSession(p).setRegionSelector(BUKKITWORLD, new CuboidRegionSelector(BUKKITWORLD, minPoint.toBlockVector3(), maxPoint.toBlockVector3()));
|
WORLDEDIT_PLUGIN.getSession(p).setRegionSelector(BUKKITWORLD, new CuboidRegionSelector(BUKKITWORLD, toBlockVector3(minPoint), toBlockVector3(maxPoint)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -178,9 +178,9 @@ public class FlatteningWrapper15 implements FlatteningWrapper {
|
|||||||
pastePoint.set(v);
|
pastePoint.set(v);
|
||||||
|
|
||||||
if (pasteBuilder.isReset()) {
|
if (pasteBuilder.isReset()) {
|
||||||
e.setBlocks(new CuboidRegion(pasteBuilder.getMinPoint().toBlockVector3(), pasteBuilder.getMaxPoint().toBlockVector3()), Objects.requireNonNull(BlockTypes.AIR).getDefaultState().toBaseBlock());
|
e.setBlocks(new CuboidRegion(toBlockVector3(pasteBuilder.getMinPoint()), toBlockVector3(pasteBuilder.getMaxPoint())), Objects.requireNonNull(BlockTypes.AIR).getDefaultState().toBaseBlock());
|
||||||
if (pasteBuilder.getWaterLevel() != 0) {
|
if (pasteBuilder.getWaterLevel() != 0) {
|
||||||
e.setBlocks(new CuboidRegion(pasteBuilder.getMinPoint().toBlockVector3(), pasteBuilder.getMaxPoint().toBlockVector3().withY(pasteBuilder.getWaterLevel())), Objects.requireNonNull(BlockTypes.WATER).getDefaultState().toBaseBlock());
|
e.setBlocks(new CuboidRegion(toBlockVector3(pasteBuilder.getMinPoint()), toBlockVector3(pasteBuilder.getMaxPoint()).withY(pasteBuilder.getWaterLevel())), Objects.requireNonNull(BlockTypes.WATER).getDefaultState().toBaseBlock());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Operations.completeBlindly(ch.createPaste(e).to(v).ignoreAirBlocks(pasteBuilder.isIgnoreAir()).build());
|
Operations.completeBlindly(ch.createPaste(e).to(v).ignoreAirBlocks(pasteBuilder.isIgnoreAir()).build());
|
||||||
@@ -193,7 +193,7 @@ public class FlatteningWrapper15 implements FlatteningWrapper {
|
|||||||
@Override
|
@Override
|
||||||
public Clipboard copy(Point minPoint, Point maxPoint, Point copyPoint) {
|
public Clipboard copy(Point minPoint, Point maxPoint, Point copyPoint) {
|
||||||
BukkitWorld bukkitWorld = new BukkitWorld(Bukkit.getWorlds().get(0));
|
BukkitWorld bukkitWorld = new BukkitWorld(Bukkit.getWorlds().get(0));
|
||||||
CuboidRegion region = new CuboidRegion(bukkitWorld, minPoint.toBlockVector3(), maxPoint.toBlockVector3());
|
CuboidRegion region = new CuboidRegion(bukkitWorld, toBlockVector3(minPoint), toBlockVector3(maxPoint));
|
||||||
BlockArrayClipboard clipboard = new BlockArrayClipboard(region);
|
BlockArrayClipboard clipboard = new BlockArrayClipboard(region);
|
||||||
try (EditSession e = WorldEdit.getInstance().getEditSessionFactory().getEditSession(bukkitWorld, -1)) {
|
try (EditSession e = WorldEdit.getInstance().getEditSessionFactory().getEditSession(bukkitWorld, -1)) {
|
||||||
ForwardExtentCopy copy = new ForwardExtentCopy(
|
ForwardExtentCopy copy = new ForwardExtentCopy(
|
||||||
@@ -204,7 +204,7 @@ public class FlatteningWrapper15 implements FlatteningWrapper {
|
|||||||
copy.setCopyingBiomes(false);
|
copy.setCopyingBiomes(false);
|
||||||
|
|
||||||
Operations.complete(copy);
|
Operations.complete(copy);
|
||||||
clipboard.setOrigin(copyPoint.toBlockVector3());
|
clipboard.setOrigin(toBlockVector3(copyPoint));
|
||||||
return clipboard;
|
return clipboard;
|
||||||
} catch (WorldEditException e) {
|
} catch (WorldEditException e) {
|
||||||
Bukkit.getLogger().log(Level.SEVERE, e.getMessage(), e);
|
Bukkit.getLogger().log(Level.SEVERE, e.getMessage(), e);
|
||||||
@@ -224,6 +224,10 @@ public class FlatteningWrapper15 implements FlatteningWrapper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private BlockVector3 toBlockVector3(Point point) {
|
||||||
|
return BlockVector3.at(point.getX(), point.getY(), point.getZ());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean inWater(org.bukkit.World world, Vector tntPosition) {
|
public boolean inWater(org.bukkit.World world, Vector tntPosition) {
|
||||||
Block block = world.getBlockAt(tntPosition.getBlockX(), tntPosition.getBlockY(), tntPosition.getBlockZ());
|
Block block = world.getBlockAt(tntPosition.getBlockX(), tntPosition.getBlockY(), tntPosition.getBlockZ());
|
||||||
|
|||||||
@@ -19,21 +19,27 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.utils;
|
package de.steamwar.bausystem.utils;
|
||||||
|
|
||||||
import de.steamwar.Reflection;
|
import com.comphenix.tinyprotocol.Reflection;
|
||||||
import de.steamwar.bausystem.features.util.NoClipCommand;
|
import de.steamwar.bausystem.features.util.NoClipCommand;
|
||||||
import net.minecraft.server.v1_15_R1.*;
|
import net.minecraft.server.v1_15_R1.*;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
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.entity.CraftPlayer;
|
||||||
import org.bukkit.craftbukkit.v1_15_R1.inventory.CraftItemStack;
|
import org.bukkit.craftbukkit.v1_15_R1.inventory.CraftItemStack;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.entity.TNTPrimed;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.function.LongSupplier;
|
||||||
|
|
||||||
public class NMSWrapper15 implements NMSWrapper {
|
public class NMSWrapper15 implements NMSWrapper {
|
||||||
|
|
||||||
private static final Reflection.Field<EnumGamemode> playerGameMode = Reflection.getField(PlayerInteractManager.class, EnumGamemode.class, 0);
|
private static final Reflection.FieldAccessor<EnumGamemode> playerGameMode = Reflection.getField(PlayerInteractManager.class, EnumGamemode.class, 0);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@@ -57,7 +63,7 @@ public class NMSWrapper15 implements NMSWrapper {
|
|||||||
player.updateInventory();
|
player.updateInventory();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Reflection.Field<Integer> gameStateChangeReason = Reflection.getField(NoClipCommand.gameStateChange, int.class, 0);
|
private static final Reflection.FieldAccessor<Integer> gameStateChangeReason = Reflection.getField(NoClipCommand.gameStateChange, int.class, 0);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setGameStateChangeReason(Object packet) {
|
public void setGameStateChangeReason(Object packet) {
|
||||||
@@ -114,12 +120,12 @@ public class NMSWrapper15 implements NMSWrapper {
|
|||||||
return invalid;
|
return invalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
private final Class<?> explosionPacket = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundExplodePacket");
|
private final Class<?> explosionPacket = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutExplosion");
|
||||||
private final Reflection.Field<Double> a = Reflection.getField(explosionPacket, double.class, 0);
|
private final Reflection.FieldAccessor<Double> a = Reflection.getField(explosionPacket, double.class, 0);
|
||||||
private final Reflection.Field<Double> b = Reflection.getField(explosionPacket, double.class, 1);
|
private final Reflection.FieldAccessor<Double> b = Reflection.getField(explosionPacket, double.class, 1);
|
||||||
private final Reflection.Field<Double> c = Reflection.getField(explosionPacket, double.class, 2);
|
private final Reflection.FieldAccessor<Double> c = Reflection.getField(explosionPacket, double.class, 2);
|
||||||
private final Reflection.Field<Float> d = Reflection.getField(explosionPacket, float.class, 0);
|
private final Reflection.FieldAccessor<Float> d = Reflection.getField(explosionPacket, float.class, 0);
|
||||||
private final Reflection.Field<List> e = Reflection.getField(explosionPacket, List.class, 0);
|
private final Reflection.FieldAccessor<List> e = Reflection.getField(explosionPacket, List.class, 0);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object resetExplosionKnockback(Object packet) {
|
public Object resetExplosionKnockback(Object packet) {
|
||||||
|
|||||||
+12
-4
@@ -19,9 +19,12 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.utils;
|
package de.steamwar.bausystem.utils;
|
||||||
|
|
||||||
import de.steamwar.Reflection;
|
import com.comphenix.tinyprotocol.Reflection;
|
||||||
|
import de.steamwar.bausystem.utils.PlayerMovementWrapper;
|
||||||
import net.minecraft.server.v1_15_R1.EntityPlayer;
|
import net.minecraft.server.v1_15_R1.EntityPlayer;
|
||||||
import net.minecraft.server.v1_15_R1.PacketPlayInFlying;
|
import net.minecraft.server.v1_15_R1.PacketPlayInFlying;
|
||||||
|
import net.minecraft.server.v1_15_R1.PacketPlayOutEntity;
|
||||||
|
import net.minecraft.server.v1_15_R1.PacketPlayOutEntityTeleport;
|
||||||
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@@ -43,9 +46,14 @@ public class PlayerMovementWrapper15 implements PlayerMovementWrapper {
|
|||||||
PacketPlayInFlying packetPlayInFlying = ((PacketPlayInFlying) object);
|
PacketPlayInFlying packetPlayInFlying = ((PacketPlayInFlying) object);
|
||||||
Object packet = Reflection.newInstance(teleportPacket);
|
Object packet = Reflection.newInstance(teleportPacket);
|
||||||
teleportEntity.set(packet, player.getEntityId());
|
teleportEntity.set(packet, player.getEntityId());
|
||||||
teleportPosition.set(packet, packetPlayInFlying.a(0.0), packetPlayInFlying.b(0.0), packetPlayInFlying.c(0.0),
|
teleportPosition.set(packet, packetPlayInFlying.a(0.0), packetPlayInFlying.b(0.0), packetPlayInFlying.c(0.0));
|
||||||
Float.isNaN(packetPlayInFlying.a(Float.NaN)) ? player.getLocation().getYaw() : packetPlayInFlying.a(0.0F),
|
if (Float.isNaN(packetPlayInFlying.a(Float.NaN))) {
|
||||||
Float.isNaN(packetPlayInFlying.b(Float.NaN)) ? player.getLocation().getPitch() : packetPlayInFlying.b(0.0F));
|
teleportYaw.set(packet, rotToByte(player.getLocation().getYaw()));
|
||||||
|
teleportPitch.set(packet, rotToByte(player.getLocation().getPitch()));
|
||||||
|
} else {
|
||||||
|
teleportYaw.set(packet, rotToByte(packetPlayInFlying.a(0.0F)));
|
||||||
|
teleportPitch.set(packet, rotToByte(packetPlayInFlying.b(0.0F)));
|
||||||
|
}
|
||||||
return packet;
|
return packet;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,8 +27,8 @@ java {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly(project(":BauSystem:BauSystem_Main", "default"))
|
compileOnly(project(":BauSystem:BauSystem_Main"))
|
||||||
compileOnly(project(":SpigotCore", "default"))
|
compileOnly(project(":SpigotCore"))
|
||||||
|
|
||||||
compileOnly(libs.spigotapi)
|
compileOnly(libs.spigotapi)
|
||||||
compileOnly(libs.nms18)
|
compileOnly(libs.nms18)
|
||||||
|
|||||||
@@ -19,26 +19,36 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.utils;
|
package de.steamwar.bausystem.utils;
|
||||||
|
|
||||||
import de.steamwar.Reflection;
|
import com.comphenix.tinyprotocol.Reflection;
|
||||||
|
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||||
import de.steamwar.bausystem.features.util.NoClipCommand;
|
import de.steamwar.bausystem.features.util.NoClipCommand;
|
||||||
|
import net.minecraft.SystemUtils;
|
||||||
import net.minecraft.nbt.NBTBase;
|
import net.minecraft.nbt.NBTBase;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.nbt.NBTTagList;
|
import net.minecraft.nbt.NBTTagList;
|
||||||
|
import net.minecraft.network.protocol.Packet;
|
||||||
import net.minecraft.network.protocol.game.*;
|
import net.minecraft.network.protocol.game.*;
|
||||||
import net.minecraft.server.level.PlayerInteractManager;
|
import net.minecraft.server.level.PlayerInteractManager;
|
||||||
import net.minecraft.world.level.EnumGamemode;
|
import net.minecraft.world.level.EnumGamemode;
|
||||||
|
import net.minecraft.world.phys.Vec3D;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.craftbukkit.v1_18_R2.entity.CraftEntity;
|
||||||
import org.bukkit.craftbukkit.v1_18_R2.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_18_R2.entity.CraftPlayer;
|
||||||
import org.bukkit.craftbukkit.v1_18_R2.inventory.CraftItemStack;
|
import org.bukkit.craftbukkit.v1_18_R2.inventory.CraftItemStack;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.entity.TNTPrimed;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.function.LongSupplier;
|
||||||
|
|
||||||
public class NMSWrapper18 implements NMSWrapper {
|
public class NMSWrapper18 implements NMSWrapper {
|
||||||
|
|
||||||
private static final Reflection.Field<EnumGamemode> playerGameMode = Reflection.getField(PlayerInteractManager.class, EnumGamemode.class, 0);
|
private static final Reflection.FieldAccessor<EnumGamemode> playerGameMode = Reflection.getField(PlayerInteractManager.class, EnumGamemode.class, 0);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@@ -63,7 +73,7 @@ public class NMSWrapper18 implements NMSWrapper {
|
|||||||
player.updateInventory();
|
player.updateInventory();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Reflection.Field<PacketPlayOutGameStateChange.a> gameStateChangeReason = Reflection.getField(NoClipCommand.gameStateChange, PacketPlayOutGameStateChange.a.class, 12);
|
private static final Reflection.FieldAccessor<PacketPlayOutGameStateChange.a> gameStateChangeReason = Reflection.getField(NoClipCommand.gameStateChange, PacketPlayOutGameStateChange.a.class, 12);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setGameStateChangeReason(Object packet) {
|
public void setGameStateChangeReason(Object packet) {
|
||||||
@@ -120,12 +130,12 @@ public class NMSWrapper18 implements NMSWrapper {
|
|||||||
return invalid;
|
return invalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
private final Class<?> explosionPacket = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundExplodePacket");
|
private final Class<?> explosionPacket = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutExplosion");
|
||||||
private final Reflection.Field<Double> a = Reflection.getField(explosionPacket, double.class, 0);
|
private final Reflection.FieldAccessor<Double> a = Reflection.getField(explosionPacket, double.class, 0);
|
||||||
private final Reflection.Field<Double> b = Reflection.getField(explosionPacket, double.class, 1);
|
private final Reflection.FieldAccessor<Double> b = Reflection.getField(explosionPacket, double.class, 1);
|
||||||
private final Reflection.Field<Double> c = Reflection.getField(explosionPacket, double.class, 2);
|
private final Reflection.FieldAccessor<Double> c = Reflection.getField(explosionPacket, double.class, 2);
|
||||||
private final Reflection.Field<Float> d = Reflection.getField(explosionPacket, float.class, 0);
|
private final Reflection.FieldAccessor<Float> d = Reflection.getField(explosionPacket, float.class, 0);
|
||||||
private final Reflection.Field<List> e = Reflection.getField(explosionPacket, List.class, 0);
|
private final Reflection.FieldAccessor<List> e = Reflection.getField(explosionPacket, List.class, 0);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object resetExplosionKnockback(Object packet) {
|
public Object resetExplosionKnockback(Object packet) {
|
||||||
|
|||||||
+10
-4
@@ -19,7 +19,8 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.utils;
|
package de.steamwar.bausystem.utils;
|
||||||
|
|
||||||
import de.steamwar.Reflection;
|
import com.comphenix.tinyprotocol.Reflection;
|
||||||
|
import de.steamwar.bausystem.utils.PlayerMovementWrapper;
|
||||||
import net.minecraft.network.protocol.game.PacketPlayInFlying;
|
import net.minecraft.network.protocol.game.PacketPlayInFlying;
|
||||||
import net.minecraft.server.level.EntityPlayer;
|
import net.minecraft.server.level.EntityPlayer;
|
||||||
import org.bukkit.craftbukkit.v1_18_R2.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_18_R2.entity.CraftPlayer;
|
||||||
@@ -43,9 +44,14 @@ public class PlayerMovementWrapper18 implements PlayerMovementWrapper {
|
|||||||
PacketPlayInFlying packetPlayInFlying = ((PacketPlayInFlying) object);
|
PacketPlayInFlying packetPlayInFlying = ((PacketPlayInFlying) object);
|
||||||
Object packet = Reflection.newInstance(teleportPacket);
|
Object packet = Reflection.newInstance(teleportPacket);
|
||||||
teleportEntity.set(packet, player.getEntityId());
|
teleportEntity.set(packet, player.getEntityId());
|
||||||
teleportPosition.set(packet, packetPlayInFlying.a, packetPlayInFlying.b, packetPlayInFlying.c,
|
teleportPosition.set(packet, packetPlayInFlying.a, packetPlayInFlying.b, packetPlayInFlying.c);
|
||||||
packetPlayInFlying.h ? player.getLocation().getYaw() : packetPlayInFlying.d,
|
if (packetPlayInFlying.h) {
|
||||||
packetPlayInFlying.h ? player.getLocation().getPitch() : packetPlayInFlying.e);
|
teleportYaw.set(packet, rotToByte(player.getLocation().getYaw()));
|
||||||
|
teleportPitch.set(packet, rotToByte(player.getLocation().getPitch()));
|
||||||
|
} else {
|
||||||
|
teleportYaw.set(packet, rotToByte(packetPlayInFlying.d));
|
||||||
|
teleportPitch.set(packet, rotToByte(packetPlayInFlying.e));
|
||||||
|
}
|
||||||
return packet;
|
return packet;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,8 +27,8 @@ java {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly(project(":BauSystem:BauSystem_Main", "default"))
|
compileOnly(project(":BauSystem:BauSystem_Main"))
|
||||||
compileOnly(project(":SpigotCore", "default"))
|
compileOnly(project(":SpigotCore"))
|
||||||
|
|
||||||
compileOnly(libs.spigotapi)
|
compileOnly(libs.spigotapi)
|
||||||
compileOnly(libs.paperapi)
|
compileOnly(libs.paperapi)
|
||||||
|
|||||||
@@ -19,26 +19,37 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.utils;
|
package de.steamwar.bausystem.utils;
|
||||||
|
|
||||||
import de.steamwar.Reflection;
|
import com.comphenix.tinyprotocol.Reflection;
|
||||||
|
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||||
import de.steamwar.bausystem.features.util.NoClipCommand;
|
import de.steamwar.bausystem.features.util.NoClipCommand;
|
||||||
|
import net.minecraft.SystemUtils;
|
||||||
import net.minecraft.nbt.NBTBase;
|
import net.minecraft.nbt.NBTBase;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.nbt.NBTTagList;
|
import net.minecraft.nbt.NBTTagList;
|
||||||
|
import net.minecraft.network.protocol.Packet;
|
||||||
import net.minecraft.network.protocol.game.*;
|
import net.minecraft.network.protocol.game.*;
|
||||||
|
import net.minecraft.network.syncher.DataWatcher;
|
||||||
import net.minecraft.server.level.PlayerInteractManager;
|
import net.minecraft.server.level.PlayerInteractManager;
|
||||||
import net.minecraft.world.level.EnumGamemode;
|
import net.minecraft.world.level.EnumGamemode;
|
||||||
|
import net.minecraft.world.phys.Vec3D;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.craftbukkit.v1_19_R2.entity.CraftEntity;
|
||||||
import org.bukkit.craftbukkit.v1_19_R2.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_19_R2.entity.CraftPlayer;
|
||||||
import org.bukkit.craftbukkit.v1_19_R2.inventory.CraftItemStack;
|
import org.bukkit.craftbukkit.v1_19_R2.inventory.CraftItemStack;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.entity.TNTPrimed;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.function.LongSupplier;
|
||||||
|
|
||||||
public class NMSWrapper19 implements NMSWrapper {
|
public class NMSWrapper19 implements NMSWrapper {
|
||||||
|
|
||||||
private static final Reflection.Field<EnumGamemode> playerGameMode = Reflection.getField(PlayerInteractManager.class, EnumGamemode.class, 0);
|
private static final Reflection.FieldAccessor<EnumGamemode> playerGameMode = Reflection.getField(PlayerInteractManager.class, EnumGamemode.class, 0);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@@ -62,7 +73,7 @@ public class NMSWrapper19 implements NMSWrapper {
|
|||||||
player.updateInventory();
|
player.updateInventory();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Reflection.Field<PacketPlayOutGameStateChange.a> gameStateChangeReason = Reflection.getField(NoClipCommand.gameStateChange, PacketPlayOutGameStateChange.a.class, 12);
|
private static final Reflection.FieldAccessor<PacketPlayOutGameStateChange.a> gameStateChangeReason = Reflection.getField(NoClipCommand.gameStateChange, PacketPlayOutGameStateChange.a.class, 12);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setGameStateChangeReason(Object packet) {
|
public void setGameStateChangeReason(Object packet) {
|
||||||
@@ -119,12 +130,12 @@ public class NMSWrapper19 implements NMSWrapper {
|
|||||||
return invalid;
|
return invalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
private final Class<?> explosionPacket = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundExplodePacket");
|
private final Class<?> explosionPacket = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutExplosion");
|
||||||
private final Reflection.Field<Double> a = Reflection.getField(explosionPacket, double.class, 0);
|
private final Reflection.FieldAccessor<Double> a = Reflection.getField(explosionPacket, double.class, 0);
|
||||||
private final Reflection.Field<Double> b = Reflection.getField(explosionPacket, double.class, 1);
|
private final Reflection.FieldAccessor<Double> b = Reflection.getField(explosionPacket, double.class, 1);
|
||||||
private final Reflection.Field<Double> c = Reflection.getField(explosionPacket, double.class, 2);
|
private final Reflection.FieldAccessor<Double> c = Reflection.getField(explosionPacket, double.class, 2);
|
||||||
private final Reflection.Field<Float> d = Reflection.getField(explosionPacket, float.class, 0);
|
private final Reflection.FieldAccessor<Float> d = Reflection.getField(explosionPacket, float.class, 0);
|
||||||
private final Reflection.Field<List> e = Reflection.getField(explosionPacket, List.class, 0);
|
private final Reflection.FieldAccessor<List> e = Reflection.getField(explosionPacket, List.class, 0);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object resetExplosionKnockback(Object packet) {
|
public Object resetExplosionKnockback(Object packet) {
|
||||||
|
|||||||
+14
-4
@@ -19,12 +19,17 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.utils;
|
package de.steamwar.bausystem.utils;
|
||||||
|
|
||||||
import de.steamwar.Reflection;
|
import com.comphenix.tinyprotocol.Reflection;
|
||||||
import net.minecraft.network.protocol.game.PacketPlayInFlying;
|
import net.minecraft.network.protocol.game.PacketPlayInFlying;
|
||||||
import net.minecraft.server.level.EntityPlayer;
|
import net.minecraft.server.level.EntityPlayer;
|
||||||
|
import org.bukkit.Location;
|
||||||
import org.bukkit.craftbukkit.v1_19_R2.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_19_R2.entity.CraftPlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public class PlayerMovementWrapper19 implements PlayerMovementWrapper {
|
public class PlayerMovementWrapper19 implements PlayerMovementWrapper {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -43,9 +48,14 @@ public class PlayerMovementWrapper19 implements PlayerMovementWrapper {
|
|||||||
PacketPlayInFlying packetPlayInFlying = ((PacketPlayInFlying) object);
|
PacketPlayInFlying packetPlayInFlying = ((PacketPlayInFlying) object);
|
||||||
Object packet = Reflection.newInstance(teleportPacket);
|
Object packet = Reflection.newInstance(teleportPacket);
|
||||||
teleportEntity.set(packet, player.getEntityId());
|
teleportEntity.set(packet, player.getEntityId());
|
||||||
teleportPosition.set(packet, packetPlayInFlying.a, packetPlayInFlying.b, packetPlayInFlying.c,
|
teleportPosition.set(packet, packetPlayInFlying.a, packetPlayInFlying.b, packetPlayInFlying.c);
|
||||||
packetPlayInFlying.h ? player.getLocation().getYaw() : packetPlayInFlying.d,
|
if (packetPlayInFlying.h) {
|
||||||
packetPlayInFlying.h ? player.getLocation().getPitch() : packetPlayInFlying.e);
|
teleportYaw.set(packet, rotToByte(player.getLocation().getYaw()));
|
||||||
|
teleportPitch.set(packet, rotToByte(player.getLocation().getPitch()));
|
||||||
|
} else {
|
||||||
|
teleportYaw.set(packet, rotToByte(packetPlayInFlying.d));
|
||||||
|
teleportPitch.set(packet, rotToByte(packetPlayInFlying.e));
|
||||||
|
}
|
||||||
return packet;
|
return packet;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,8 +27,8 @@ java {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly(project(":BauSystem:BauSystem_Main", "default"))
|
compileOnly(project(":BauSystem:BauSystem_Main"))
|
||||||
compileOnly(project(":SpigotCore", "default"))
|
compileOnly(project(":SpigotCore"))
|
||||||
|
|
||||||
compileOnly(libs.spigotapi)
|
compileOnly(libs.spigotapi)
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.utils;
|
package de.steamwar.bausystem.utils;
|
||||||
|
|
||||||
import de.steamwar.Reflection;
|
import com.comphenix.tinyprotocol.Reflection;
|
||||||
import de.steamwar.bausystem.features.util.NoClipCommand;
|
import de.steamwar.bausystem.features.util.NoClipCommand;
|
||||||
import net.minecraft.nbt.NBTBase;
|
import net.minecraft.nbt.NBTBase;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
@@ -40,7 +40,7 @@ import java.util.List;
|
|||||||
|
|
||||||
public class NMSWrapper20 implements NMSWrapper {
|
public class NMSWrapper20 implements NMSWrapper {
|
||||||
|
|
||||||
private static final Reflection.Field<EnumGamemode> playerGameMode = Reflection.getField(PlayerInteractManager.class, EnumGamemode.class, 0);
|
private static final Reflection.FieldAccessor<EnumGamemode> playerGameMode = Reflection.getField(PlayerInteractManager.class, EnumGamemode.class, 0);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@@ -64,7 +64,7 @@ public class NMSWrapper20 implements NMSWrapper {
|
|||||||
player.updateInventory();
|
player.updateInventory();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Reflection.Field<PacketPlayOutGameStateChange.a> gameStateChangeReason = Reflection.getField(NoClipCommand.gameStateChange, PacketPlayOutGameStateChange.a.class, 12);
|
private static final Reflection.FieldAccessor<PacketPlayOutGameStateChange.a> gameStateChangeReason = Reflection.getField(NoClipCommand.gameStateChange, PacketPlayOutGameStateChange.a.class, 12);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setGameStateChangeReason(Object packet) {
|
public void setGameStateChangeReason(Object packet) {
|
||||||
@@ -121,12 +121,12 @@ public class NMSWrapper20 implements NMSWrapper {
|
|||||||
return invalid;
|
return invalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
private final Class<?> explosionPacket = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundExplodePacket");
|
private final Class<?> explosionPacket = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutExplosion");
|
||||||
private final Reflection.Field<Double> a = Reflection.getField(explosionPacket, double.class, 0);
|
private final Reflection.FieldAccessor<Double> a = Reflection.getField(explosionPacket, double.class, 0);
|
||||||
private final Reflection.Field<Double> b = Reflection.getField(explosionPacket, double.class, 1);
|
private final Reflection.FieldAccessor<Double> b = Reflection.getField(explosionPacket, double.class, 1);
|
||||||
private final Reflection.Field<Double> c = Reflection.getField(explosionPacket, double.class, 2);
|
private final Reflection.FieldAccessor<Double> c = Reflection.getField(explosionPacket, double.class, 2);
|
||||||
private final Reflection.Field<Float> d = Reflection.getField(explosionPacket, float.class, 0);
|
private final Reflection.FieldAccessor<Float> d = Reflection.getField(explosionPacket, float.class, 0);
|
||||||
private final Reflection.Field<List> e = Reflection.getField(explosionPacket, List.class, 0);
|
private final Reflection.FieldAccessor<List> e = Reflection.getField(explosionPacket, List.class, 0);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object resetExplosionKnockback(Object packet) {
|
public Object resetExplosionKnockback(Object packet) {
|
||||||
|
|||||||
+15
-4
@@ -19,12 +19,18 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.utils;
|
package de.steamwar.bausystem.utils;
|
||||||
|
|
||||||
import de.steamwar.Reflection;
|
import com.comphenix.tinyprotocol.Reflection;
|
||||||
import net.minecraft.network.protocol.game.PacketPlayInFlying;
|
import net.minecraft.network.protocol.game.PacketPlayInFlying;
|
||||||
|
import net.minecraft.network.protocol.game.PacketPlayOutEntityTeleport;
|
||||||
import net.minecraft.server.level.EntityPlayer;
|
import net.minecraft.server.level.EntityPlayer;
|
||||||
|
import org.bukkit.Location;
|
||||||
import org.bukkit.craftbukkit.v1_20_R1.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_20_R1.entity.CraftPlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public class PlayerMovementWrapper20 implements PlayerMovementWrapper {
|
public class PlayerMovementWrapper20 implements PlayerMovementWrapper {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -43,9 +49,14 @@ public class PlayerMovementWrapper20 implements PlayerMovementWrapper {
|
|||||||
PacketPlayInFlying packetPlayInFlying = ((PacketPlayInFlying) object);
|
PacketPlayInFlying packetPlayInFlying = ((PacketPlayInFlying) object);
|
||||||
Object packet = Reflection.newInstance(teleportPacket);
|
Object packet = Reflection.newInstance(teleportPacket);
|
||||||
teleportEntity.set(packet, player.getEntityId());
|
teleportEntity.set(packet, player.getEntityId());
|
||||||
teleportPosition.set(packet, packetPlayInFlying.a, packetPlayInFlying.b, packetPlayInFlying.c,
|
teleportPosition.set(packet, packetPlayInFlying.a, packetPlayInFlying.b, packetPlayInFlying.c);
|
||||||
packetPlayInFlying.h ? player.getLocation().getYaw() : packetPlayInFlying.d,
|
if (packetPlayInFlying.h) {
|
||||||
packetPlayInFlying.h ? player.getLocation().getPitch() : packetPlayInFlying.e);
|
teleportYaw.set(packet, rotToByte(player.getLocation().getYaw()));
|
||||||
|
teleportPitch.set(packet, rotToByte(player.getLocation().getPitch()));
|
||||||
|
} else {
|
||||||
|
teleportYaw.set(packet, rotToByte(packetPlayInFlying.d));
|
||||||
|
teleportPitch.set(packet, rotToByte(packetPlayInFlying.e));
|
||||||
|
}
|
||||||
return packet;
|
return packet;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
plugins {
|
|
||||||
steamwar.java
|
|
||||||
}
|
|
||||||
|
|
||||||
java {
|
|
||||||
sourceCompatibility = JavaVersion.VERSION_21
|
|
||||||
targetCompatibility = JavaVersion.VERSION_21
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
compileOnly(project(":BauSystem:BauSystem_Main", "default"))
|
|
||||||
compileOnly(project(":SpigotCore", "default"))
|
|
||||||
|
|
||||||
compileOnly(libs.paperapi21)
|
|
||||||
|
|
||||||
compileOnly(libs.nms21)
|
|
||||||
}
|
|
||||||
@@ -1,133 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of the SteamWar software.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2024 SteamWar.de-Serverteam
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.utils;
|
|
||||||
|
|
||||||
import de.steamwar.Reflection;
|
|
||||||
import de.steamwar.bausystem.features.util.NoClipCommand;
|
|
||||||
import io.papermc.paper.datacomponent.DataComponentTypes;
|
|
||||||
import io.papermc.paper.datacomponent.item.ItemContainerContents;
|
|
||||||
import net.minecraft.network.protocol.game.ClientboundContainerSetSlotPacket;
|
|
||||||
import net.minecraft.network.protocol.game.ClientboundExplodePacket;
|
|
||||||
import net.minecraft.network.protocol.game.ClientboundGameEventPacket;
|
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
|
||||||
import net.minecraft.server.level.ServerPlayerGameMode;
|
|
||||||
import net.minecraft.world.entity.player.Abilities;
|
|
||||||
import net.minecraft.world.level.GameType;
|
|
||||||
import org.bukkit.GameMode;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
|
||||||
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.player.PlayerGameModeChangeEvent;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
public class NMSWrapper21 implements NMSWrapper {
|
|
||||||
|
|
||||||
private static final Reflection.Field<ServerPlayerGameMode> playerInteractManager = Reflection.getField(ServerPlayer.class, null, ServerPlayerGameMode.class);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setInternalGameMode(Player player, GameMode gameMode) {
|
|
||||||
playerInteractManager.get(((CraftPlayer) player).getHandle()).changeGameModeForPlayer(GameType.byId(gameMode.getValue()), PlayerGameModeChangeEvent.Cause.UNKNOWN, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setSlotToItemStack(Player player, Object o) {
|
|
||||||
ClientboundContainerSetSlotPacket packetPlayInSetCreativeSlot = (ClientboundContainerSetSlotPacket) o;
|
|
||||||
int index = packetPlayInSetCreativeSlot.getSlot();
|
|
||||||
if (index >= 36 && index <= 44) {
|
|
||||||
index -= 36;
|
|
||||||
} else if (index > 44) {
|
|
||||||
index -= 5;
|
|
||||||
} else if (index <= 8) {
|
|
||||||
index = index - 8 + 36;
|
|
||||||
}
|
|
||||||
player.getInventory().setItem(index, CraftItemStack.asBukkitCopy(packetPlayInSetCreativeSlot.getItem()));
|
|
||||||
if (index < 9) player.getInventory().setHeldItemSlot(index);
|
|
||||||
player.updateInventory();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final Reflection.Field<ClientboundGameEventPacket.Type> gameStateChangeReason = Reflection.getField(NoClipCommand.gameStateChange, ClientboundGameEventPacket.Type.class, 12);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setGameStateChangeReason(Object packet) {
|
|
||||||
gameStateChangeReason.set(packet, ClientboundGameEventPacket.CHANGE_GAME_MODE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setPlayerBuildAbilities(Player player) {
|
|
||||||
Abilities abilities = (((CraftPlayer) player).getHandle()).getAbilities();
|
|
||||||
abilities.mayBuild = true;
|
|
||||||
abilities.mayfly = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Material pathMaterial() {
|
|
||||||
return Material.DIRT_PATH;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final int threshold = 2048;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean checkItemStack(ItemStack item) {
|
|
||||||
ItemContainerContents data = item.getData(DataComponentTypes.CONTAINER);
|
|
||||||
if (data == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return drillDown(data.contents(), 0, 0) <= threshold;
|
|
||||||
}
|
|
||||||
|
|
||||||
private int drillDown(List<ItemStack> items, int layer, int start) {
|
|
||||||
if (layer > 2) return start + threshold;
|
|
||||||
int invalid = start;
|
|
||||||
for (int i = start; i < items.size(); i++) {
|
|
||||||
ItemStack item = items.get(i);
|
|
||||||
if (item.isEmpty()) continue;
|
|
||||||
|
|
||||||
invalid += item.getAmount();
|
|
||||||
|
|
||||||
ItemContainerContents data = item.getData(DataComponentTypes.CONTAINER);
|
|
||||||
if (data == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<ItemStack> subItems = data.contents();
|
|
||||||
if (subItems.size() > 1) {
|
|
||||||
invalid = drillDown(subItems, layer + 1, invalid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return invalid;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object resetExplosionKnockback(Object packet) {
|
|
||||||
ClientboundExplodePacket explosion = (ClientboundExplodePacket) packet;
|
|
||||||
|
|
||||||
return new ClientboundExplodePacket(
|
|
||||||
explosion.center(),
|
|
||||||
Optional.empty(),
|
|
||||||
explosion.explosionParticle(),
|
|
||||||
explosion.explosionSound()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -33,12 +33,14 @@ java {
|
|||||||
dependencies {
|
dependencies {
|
||||||
compileOnly(libs.classindex)
|
compileOnly(libs.classindex)
|
||||||
annotationProcessor(libs.classindex)
|
annotationProcessor(libs.classindex)
|
||||||
compileOnly(project(":SpigotCore", "default"))
|
compileOnly(project(":SpigotCore"))
|
||||||
|
|
||||||
compileOnly(libs.spigotapi)
|
compileOnly(libs.spigotapi)
|
||||||
compileOnly(libs.axiom)
|
compileOnly(libs.axiom)
|
||||||
compileOnly(libs.authlib)
|
compileOnly(libs.authlib)
|
||||||
|
compileOnly(libs.viaapi)
|
||||||
|
|
||||||
|
compileOnly(libs.nms20)
|
||||||
compileOnly(libs.fawe18)
|
compileOnly(libs.fawe18)
|
||||||
|
|
||||||
implementation(libs.luaj)
|
implementation(libs.luaj)
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ SCOREBOARD_TRACE_TICKS=Ticks
|
|||||||
SCOREBOARD_TECHHIDER=TechHider§8: §aOn
|
SCOREBOARD_TECHHIDER=TechHider§8: §aOn
|
||||||
SCOREBOARD_XRAY=XRay§8: §aOn
|
SCOREBOARD_XRAY=XRay§8: §aOn
|
||||||
SCOREBOARD_LOCK_TEAM=Bau Lock§8: §eTeam
|
SCOREBOARD_LOCK_TEAM=Bau Lock§8: §eTeam
|
||||||
SCOREBOARD_LOCK_SUPERVISOR=Bau Lock§8: §eSupervisor
|
|
||||||
SCOREBOARD_LOCK_TEAM_AND_SERVERTEAM=Bau Lock§8: §e(Server) Team
|
SCOREBOARD_LOCK_TEAM_AND_SERVERTEAM=Bau Lock§8: §e(Server) Team
|
||||||
SCOREBOARD_LOCK_SERVERTEAM=Bau Lock§8: §eServer Team
|
SCOREBOARD_LOCK_SERVERTEAM=Bau Lock§8: §eServer Team
|
||||||
SCOREBOARD_LOCK_NOBODY=Bau Lock§8: §cNobody
|
SCOREBOARD_LOCK_NOBODY=Bau Lock§8: §cNobody
|
||||||
@@ -272,7 +271,6 @@ SIMULATOR_CHANGE_HELP=§8/§esimulator change §8-§7 Change your simulator wand
|
|||||||
SIMULATOR_DELETE_HELP=§8/§esimulator delete §8[§7name§8] §8-§7 Deletes the simulator
|
SIMULATOR_DELETE_HELP=§8/§esimulator delete §8[§7name§8] §8-§7 Deletes the simulator
|
||||||
SIMULATOR_START_HELP=§8/§esimulator start §8[§7name§8] §8-§7 Starts the simulator
|
SIMULATOR_START_HELP=§8/§esimulator start §8[§7name§8] §8-§7 Starts the simulator
|
||||||
SIMULATOR_COPY_HELP=§8/§esimulator copy §8[§7to-copy§8] §8[§7name§8] §8-§7 Copy the simulator
|
SIMULATOR_COPY_HELP=§8/§esimulator copy §8[§7to-copy§8] §8[§7name§8] §8-§7 Copy the simulator
|
||||||
SIMULATOR_RENAME_HELP=§8/§esimulator rename §8[§7to-rename§8] §8[§7name§8] §8-§7 Rename the simulator
|
|
||||||
SIMULATOR_GUI_ITEM_NAME=§eTNT Simulator
|
SIMULATOR_GUI_ITEM_NAME=§eTNT Simulator
|
||||||
SIMULATOR_NO_SIM_IN_HAND=§cNo simulator item selected
|
SIMULATOR_NO_SIM_IN_HAND=§cNo simulator item selected
|
||||||
SIMULATOR_GUI_SELECT_SIM=Simulator selection
|
SIMULATOR_GUI_SELECT_SIM=Simulator selection
|
||||||
@@ -309,7 +307,6 @@ SIMULATOR_POSITION_Z=§7z-Position
|
|||||||
SIMULATOR_BACK=§eBack
|
SIMULATOR_BACK=§eBack
|
||||||
SIMULATOR_GUI_TOTAL_TNT=§7Total TNT§8: §e{0}
|
SIMULATOR_GUI_TOTAL_TNT=§7Total TNT§8: §e{0}
|
||||||
SIMULATOR_DELETED=§cSimulator deleted
|
SIMULATOR_DELETED=§cSimulator deleted
|
||||||
SIMULATOR_RENAMED=§cSimulator renamed from {0} to {1}
|
|
||||||
## GUI
|
## GUI
|
||||||
SIMULATOR_POSITION_EDIT=§eEdit position
|
SIMULATOR_POSITION_EDIT=§eEdit position
|
||||||
SIMULATOR_POSITION_ADD=§eSet position
|
SIMULATOR_POSITION_ADD=§eSet position
|
||||||
@@ -407,8 +404,6 @@ BLOCK_COUNTER_MESSAGE_SECOND=§7Damage §8> §e{0} §7Blocks §e{1} §7TNT §e
|
|||||||
BLOCK_COUNTER_ENABLE=§7BlockCounter activated
|
BLOCK_COUNTER_ENABLE=§7BlockCounter activated
|
||||||
BLOCK_COUNTER_DISABLE=§7BlockCounter deactivated
|
BLOCK_COUNTER_DISABLE=§7BlockCounter deactivated
|
||||||
# DepthCounter
|
# DepthCounter
|
||||||
DEPTH_COUNTER_DISABLE=§7Depth Counter disabled
|
|
||||||
DEPTH_COUNTER_ENABLE=§7Depth Counter enabled
|
|
||||||
DEPTH_COUNTER_MESSAGE=§7Depth §8> §7
|
DEPTH_COUNTER_MESSAGE=§7Depth §8> §7
|
||||||
DEPTH_COUNTER_COUNT={0}{1}§8×{2}{3}§8×{4}{5}
|
DEPTH_COUNTER_COUNT={0}{1}§8×{2}{3}§8×{4}{5}
|
||||||
DEPTH_COUNTER_HOVER=§7X§8×§7Y§8×§7Z
|
DEPTH_COUNTER_HOVER=§7X§8×§7Y§8×§7Z
|
||||||
@@ -515,7 +510,7 @@ LOADER_HELP_GUI=§8/§7loader gui §8- §7Shows Loader gui
|
|||||||
LOADER_HELP_STOP=§8/§eloader stop §8- §7Stops recording/playback
|
LOADER_HELP_STOP=§8/§eloader stop §8- §7Stops recording/playback
|
||||||
LOADER_HELP_WAIT=§8/§7loader wait §8[§7Ticks§8] - §7Sets wait time between shots
|
LOADER_HELP_WAIT=§8/§7loader wait §8[§7Ticks§8] - §7Sets wait time between shots
|
||||||
LOADER_HELP_SPEED=§8/§7loader speed §8[§7Ticks§8] - §7Sets wait time between actions
|
LOADER_HELP_SPEED=§8/§7loader speed §8[§7Ticks§8] - §7Sets wait time between actions
|
||||||
LOADER_NO_LOADER=§cYou have no Loader. Create one with /loader setup
|
LOADER_NO_LOADER=§cYou have no Laoder. Create one with /loader setup
|
||||||
LOADER_NEW=§7Load your cannon and fire it once, to initialise the loader.
|
LOADER_NEW=§7Load your cannon and fire it once, to initialise the loader.
|
||||||
LOADER_HOW_TO_START=§7Then, execute /§eloader start§7 to start the Loader
|
LOADER_HOW_TO_START=§7Then, execute /§eloader start§7 to start the Loader
|
||||||
LOADER_ACTIVE=§7The Loader is now active.
|
LOADER_ACTIVE=§7The Loader is now active.
|
||||||
@@ -847,7 +842,7 @@ LAUFBAU_SETTINGS_INACTIVE=§cInactive
|
|||||||
LAUFBAU_SETTINGS_MIXED=§e{0}§8/§e{1} §aActive
|
LAUFBAU_SETTINGS_MIXED=§e{0}§8/§e{1} §aActive
|
||||||
LAUFBAU_SETTINGS_GUI_BACK=§eBack
|
LAUFBAU_SETTINGS_GUI_BACK=§eBack
|
||||||
LAUFBAU_SETTINGS_TOGGLE=§eClick §8-§7 Toggle
|
LAUFBAU_SETTINGS_TOGGLE=§eClick §8-§7 Toggle
|
||||||
LAUFBAU_SETTINGS_ADVANCED=§eLeft-Click §8-§7 Advanced settings
|
LAUFBAU_SETTINGS_ADVANCED=§eMiddle-Click §8-§7 Advanced settings
|
||||||
LAUFBAU_BLOCK_COBWEB=§eCobweb
|
LAUFBAU_BLOCK_COBWEB=§eCobweb
|
||||||
LAUFBAU_BLOCK_GRASS_PATH=§eGrass Path
|
LAUFBAU_BLOCK_GRASS_PATH=§eGrass Path
|
||||||
LAUFBAU_BLOCK_SOUL_SAND=§eSoul Sand
|
LAUFBAU_BLOCK_SOUL_SAND=§eSoul Sand
|
||||||
@@ -948,9 +943,6 @@ SPEED_TAB_NAME=Input speed
|
|||||||
WORLDEDIT_WAND=WorldEdit Wand
|
WORLDEDIT_WAND=WorldEdit Wand
|
||||||
WORLDEDIT_LEFTCLICK=Left click: select pos #1
|
WORLDEDIT_LEFTCLICK=Left click: select pos #1
|
||||||
WORLDEDIT_RIGHTCLICK=Right click: select pos #2
|
WORLDEDIT_RIGHTCLICK=Right click: select pos #2
|
||||||
TNT_DETAILS_COMMAND=§8/§etntdetails §8-§7 Toggle information printed after clicking on a TNT
|
|
||||||
TNT_DETAILS_ON = §eTNTDetails §aactivated
|
|
||||||
TNT_DETAILS_OFF = §eTNTDetails §cdeactivated
|
|
||||||
TNT_CLICK_HEADER=§8---=== §eTNT §8===---
|
TNT_CLICK_HEADER=§8---=== §eTNT §8===---
|
||||||
TNT_CLICK_ORDER=§eEntity Order§8: §e{0}
|
TNT_CLICK_ORDER=§eEntity Order§8: §e{0}
|
||||||
TNT_CLICK_FUSE_TIME=§eFuseTime§8: §e{0}
|
TNT_CLICK_FUSE_TIME=§eFuseTime§8: §e{0}
|
||||||
@@ -1019,4 +1011,6 @@ XRAY_OFF=§cXray deactivated
|
|||||||
COLORREPLACE_HELP=§8//§ecolorreplace §8[§7color§8] §8[§7color§8] §8- §7Replace all blocks of one color with another
|
COLORREPLACE_HELP=§8//§ecolorreplace §8[§7color§8] §8[§7color§8] §8- §7Replace all blocks of one color with another
|
||||||
TYPEREPLACE_HELP=§8//§etypereplace §8[§7type§8] §8[§7type§8] §8- §7Replace all blocks of one type with another
|
TYPEREPLACE_HELP=§8//§etypereplace §8[§7type§8] §8[§7type§8] §8- §7Replace all blocks of one type with another
|
||||||
# Schematic
|
# Schematic
|
||||||
SCHEMATIC_GUI_ITEM=§eSchematics
|
SCHEMATIC_GUI_ITEM=§eSchematics
|
||||||
|
#VersionAnnouncer
|
||||||
|
SERVER_VERSION=§7This server runs on Minecraft version §e{0}
|
||||||
@@ -254,7 +254,6 @@ SIMULATOR_CHANGE_HELP=§8/§esimulator change §8-§7 Wechsel zu einem anderen S
|
|||||||
SIMULATOR_DELETE_HELP=§8/§esimulator delete §8[§7name§8] §8-§7 Löscht den Simulator
|
SIMULATOR_DELETE_HELP=§8/§esimulator delete §8[§7name§8] §8-§7 Löscht den Simulator
|
||||||
SIMULATOR_START_HELP=§8/§esimulator start §8[§7name§8] §8-§7 Startet die Simulation
|
SIMULATOR_START_HELP=§8/§esimulator start §8[§7name§8] §8-§7 Startet die Simulation
|
||||||
SIMULATOR_COPY_HELP=§8/§esimulator copy §8[§7to-copy§8] §8[§7name§8] §8-§7 Kopiert einen Simulator
|
SIMULATOR_COPY_HELP=§8/§esimulator copy §8[§7to-copy§8] §8[§7name§8] §8-§7 Kopiert einen Simulator
|
||||||
SIMULATOR_RENAME_HELP=§8/§esimulator rename §8[§7to-rename§8] §8[§7name§8] §8-§7 Benennt einen Simulator um
|
|
||||||
SIMULATOR_GUI_ITEM_NAME=§eTNT Simulator
|
SIMULATOR_GUI_ITEM_NAME=§eTNT Simulator
|
||||||
SIMULATOR_NO_SIM_IN_HAND=§cKein Simulator Item gewählt
|
SIMULATOR_NO_SIM_IN_HAND=§cKein Simulator Item gewählt
|
||||||
SIMULATOR_GUI_SELECT_SIM=Simulator wählen
|
SIMULATOR_GUI_SELECT_SIM=Simulator wählen
|
||||||
@@ -291,7 +290,6 @@ SIMULATOR_POSITION_Z=§7z-Position
|
|||||||
SIMULATOR_BACK=§eZurück
|
SIMULATOR_BACK=§eZurück
|
||||||
SIMULATOR_GUI_TOTAL_TNT=§7Gesamt TNT§8: §e{0}
|
SIMULATOR_GUI_TOTAL_TNT=§7Gesamt TNT§8: §e{0}
|
||||||
SIMULATOR_DELETED=§cSimulator gelöscht
|
SIMULATOR_DELETED=§cSimulator gelöscht
|
||||||
SIMULATOR_RENAMED=§cSimulator von {0} zu {1} umbenannt
|
|
||||||
## GUI
|
## GUI
|
||||||
SIMULATOR_POSITION_EDIT=§ePosition bearbeiten
|
SIMULATOR_POSITION_EDIT=§ePosition bearbeiten
|
||||||
SIMULATOR_POSITION_ADD=§ePosition setzen
|
SIMULATOR_POSITION_ADD=§ePosition setzen
|
||||||
@@ -369,8 +367,6 @@ BLOCK_COUNTER_MESSAGE_SECOND=§7Schaden §8> §e{0} §7Blöcke §e{1} §7TNT
|
|||||||
BLOCK_COUNTER_ENABLE=§7BlockCounter angemacht
|
BLOCK_COUNTER_ENABLE=§7BlockCounter angemacht
|
||||||
BLOCK_COUNTER_DISABLE=§7BlockCounter ausgemacht
|
BLOCK_COUNTER_DISABLE=§7BlockCounter ausgemacht
|
||||||
# DepthCounter
|
# DepthCounter
|
||||||
DEPTH_COUNTER_DISABLE=§7Depth Counter deaktiviert
|
|
||||||
DEPTH_COUNTER_ENABLE=§7Depth Counter aktiviert
|
|
||||||
DEPTH_COUNTER_MESSAGE=§7Tiefe §8> §7
|
DEPTH_COUNTER_MESSAGE=§7Tiefe §8> §7
|
||||||
# TPSLimit
|
# TPSLimit
|
||||||
TPSLIMIT_FREEZE_HELP=§8/§etpslimit 0 §8-§7 Friere TPS ein
|
TPSLIMIT_FREEZE_HELP=§8/§etpslimit 0 §8-§7 Friere TPS ein
|
||||||
@@ -792,7 +788,7 @@ LAUFBAU_SETTINGS_INACTIVE=§cInaktiv
|
|||||||
LAUFBAU_SETTINGS_MIXED=§e{0}§8/§e{1} §aAktiv
|
LAUFBAU_SETTINGS_MIXED=§e{0}§8/§e{1} §aAktiv
|
||||||
LAUFBAU_SETTINGS_GUI_BACK=§eBack
|
LAUFBAU_SETTINGS_GUI_BACK=§eBack
|
||||||
LAUFBAU_SETTINGS_TOGGLE=§eClick §8-§7 Toggle
|
LAUFBAU_SETTINGS_TOGGLE=§eClick §8-§7 Toggle
|
||||||
LAUFBAU_SETTINGS_ADVANCED=§eLinks-Click §8-§7 Erweiterte Einstellung
|
LAUFBAU_SETTINGS_ADVANCED=§eMiddle-Click §8-§7 Erweiterte Einstellung
|
||||||
LAUFBAU_BLOCK_COBWEB=§eCobweb
|
LAUFBAU_BLOCK_COBWEB=§eCobweb
|
||||||
LAUFBAU_BLOCK_GRASS_PATH=§eGrass Path
|
LAUFBAU_BLOCK_GRASS_PATH=§eGrass Path
|
||||||
LAUFBAU_BLOCK_SOUL_SAND=§eSoul Sand
|
LAUFBAU_BLOCK_SOUL_SAND=§eSoul Sand
|
||||||
@@ -889,9 +885,6 @@ SPEED_TAB_NAME=Geschwindigkeit eingeben
|
|||||||
WORLDEDIT_WAND=WorldEdit Wand
|
WORLDEDIT_WAND=WorldEdit Wand
|
||||||
WORLDEDIT_LEFTCLICK=Left click: select pos #1
|
WORLDEDIT_LEFTCLICK=Left click: select pos #1
|
||||||
WORLDEDIT_RIGHTCLICK=Right click: select pos #2
|
WORLDEDIT_RIGHTCLICK=Right click: select pos #2
|
||||||
TNT_DETAILS_COMMAND=§8/§etntdetails §8-§7 Aktiviert/Deaktiviert das senden von Details beim Klick auf TNT
|
|
||||||
TNT_DETAILS_ON = §eTNTDetails §aaktiviert
|
|
||||||
TNT_DETAILS_OFF = §eTNTDetails §cdeaktiviert
|
|
||||||
TNT_CLICK_HEADER=§8---=== §eTNT §8===---
|
TNT_CLICK_HEADER=§8---=== §eTNT §8===---
|
||||||
TNT_CLICK_ORDER=§eEntity Order§8: §e{0}
|
TNT_CLICK_ORDER=§eEntity Order§8: §e{0}
|
||||||
TNT_CLICK_FUSE_TIME=§eFuseTime§8: §e{0}
|
TNT_CLICK_FUSE_TIME=§eFuseTime§8: §e{0}
|
||||||
@@ -959,4 +952,6 @@ XRAY_OFF=§cXray deaktiviert
|
|||||||
COLORREPLACE_HELP=§8//§ecolorreplace §8[§7color§8] §8[§7color§8] §8- §7Ersetzt eine Farbe mit einer anderen
|
COLORREPLACE_HELP=§8//§ecolorreplace §8[§7color§8] §8[§7color§8] §8- §7Ersetzt eine Farbe mit einer anderen
|
||||||
TYPEREPLACE_HELP=§8//§etyreplace §8[§7type§8] §8[§7type§8] §8- §7Ersetzt einen Blockgruppe mit einer anderen
|
TYPEREPLACE_HELP=§8//§etyreplace §8[§7type§8] §8[§7type§8] §8- §7Ersetzt einen Blockgruppe mit einer anderen
|
||||||
# Schematics
|
# Schematics
|
||||||
SCHEMATIC_GUI_ITEM=§eSchematics
|
SCHEMATIC_GUI_ITEM=§eSchematics
|
||||||
|
#VersionAnnouncer
|
||||||
|
SERVER_VERSION=§7Dieser Server läuft auf Minecraft-Version §e{0}
|
||||||
@@ -19,19 +19,15 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem;
|
package de.steamwar.bausystem;
|
||||||
|
|
||||||
import de.steamwar.core.WorldEditRendererCUIEditor;
|
|
||||||
import de.steamwar.bausystem.config.BauServer;
|
import de.steamwar.bausystem.config.BauServer;
|
||||||
import de.steamwar.bausystem.configplayer.Config;
|
import de.steamwar.bausystem.configplayer.Config;
|
||||||
import de.steamwar.bausystem.configplayer.ConfigConverter;
|
import de.steamwar.bausystem.configplayer.ConfigConverter;
|
||||||
import de.steamwar.bausystem.features.gui.BauGUI;
|
import de.steamwar.bausystem.features.gui.BauGUI;
|
||||||
import de.steamwar.bausystem.features.script.lua.SteamWarLuaPlugin;
|
import de.steamwar.bausystem.features.script.lua.SteamWarLuaPlugin;
|
||||||
import de.steamwar.bausystem.features.script.lua.libs.LuaLib;
|
import de.steamwar.bausystem.features.script.lua.libs.LuaLib;
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader;
|
|
||||||
import de.steamwar.bausystem.features.slaves.panzern.Panzern;
|
import de.steamwar.bausystem.features.slaves.panzern.Panzern;
|
||||||
import de.steamwar.bausystem.features.slaves.panzern.PanzernAlgorithm;
|
import de.steamwar.bausystem.features.slaves.panzern.PanzernAlgorithm;
|
||||||
import de.steamwar.bausystem.features.tpslimit.TPSFreezeUtils;
|
import de.steamwar.bausystem.features.tpslimit.TPSFreezeUtils;
|
||||||
import de.steamwar.bausystem.features.tracer.TraceManager;
|
|
||||||
import de.steamwar.bausystem.features.tracer.TraceRecorder;
|
|
||||||
import de.steamwar.bausystem.features.world.BauScoreboard;
|
import de.steamwar.bausystem.features.world.BauScoreboard;
|
||||||
import de.steamwar.bausystem.linkage.specific.BauGuiItem;
|
import de.steamwar.bausystem.linkage.specific.BauGuiItem;
|
||||||
import de.steamwar.bausystem.region.loader.PrototypeLoader;
|
import de.steamwar.bausystem.region.loader.PrototypeLoader;
|
||||||
@@ -74,7 +70,7 @@ import java.util.function.Consumer;
|
|||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class BauSystem extends JavaPlugin {
|
public class BauSystem extends JavaPlugin implements Listener {
|
||||||
|
|
||||||
// This should be treated as final!
|
// This should be treated as final!
|
||||||
public static Message MESSAGE;
|
public static Message MESSAGE;
|
||||||
@@ -186,9 +182,6 @@ public class BauSystem extends JavaPlugin {
|
|||||||
if (any instanceof ConfigConverter) {
|
if (any instanceof ConfigConverter) {
|
||||||
Config.addConfigConverter((ConfigConverter) any);
|
Config.addConfigConverter((ConfigConverter) any);
|
||||||
}
|
}
|
||||||
if (any instanceof BoundingBoxLoader) {
|
|
||||||
((BoundingBoxLoader) any).load();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
instances.forEach((clazz, o) -> {
|
instances.forEach((clazz, o) -> {
|
||||||
@@ -204,11 +197,6 @@ public class BauSystem extends JavaPlugin {
|
|||||||
});
|
});
|
||||||
|
|
||||||
TickListener.impl.init();
|
TickListener.impl.init();
|
||||||
|
|
||||||
TraceManager.instance.init();
|
|
||||||
TraceRecorder.instance.init();
|
|
||||||
|
|
||||||
new WorldEditRendererCUIEditor();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -20,7 +20,6 @@
|
|||||||
package de.steamwar.bausystem.features.cannon.depth;
|
package de.steamwar.bausystem.features.cannon.depth;
|
||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.bausystem.configplayer.Config;
|
|
||||||
import de.steamwar.bausystem.region.Region;
|
import de.steamwar.bausystem.region.Region;
|
||||||
import de.steamwar.bausystem.region.RegionUtils;
|
import de.steamwar.bausystem.region.RegionUtils;
|
||||||
import de.steamwar.bausystem.region.utils.RegionExtensionType;
|
import de.steamwar.bausystem.region.utils.RegionExtensionType;
|
||||||
@@ -66,9 +65,7 @@ public class Depth {
|
|||||||
dimensions.setZ(Math.abs(dimensions.getZ()));
|
dimensions.setZ(Math.abs(dimensions.getZ()));
|
||||||
|
|
||||||
RegionUtils.message(region, player -> {
|
RegionUtils.message(region, player -> {
|
||||||
if (Config.getInstance().get(player).getPlainValueOrDefault("depth_message", true)) {
|
player.spigot().sendMessage(getMessage(player, dimensions.getBlockX() + 1, dimensions.getBlockY() + 1, dimensions.getBlockZ() + 1, tntCount));
|
||||||
player.spigot().sendMessage(getMessage(player, dimensions.getBlockX() + 1, dimensions.getBlockY() + 1, dimensions.getBlockZ() + 1, tntCount));
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
-45
@@ -1,45 +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 <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.features.cannon.depth;
|
|
||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
|
||||||
import de.steamwar.bausystem.configplayer.Config;
|
|
||||||
import de.steamwar.command.SWCommand;
|
|
||||||
import de.steamwar.linkage.Linked;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
@Linked
|
|
||||||
public class DepthCommand extends SWCommand {
|
|
||||||
|
|
||||||
public DepthCommand() {
|
|
||||||
super("depth");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Register
|
|
||||||
public void toggle(Player player) {
|
|
||||||
if (Config.getInstance().get(player).getPlainValueOrDefault("depth_message", true)) {
|
|
||||||
Config.getInstance().get(player).put("depth_message", false);
|
|
||||||
BauSystem.MESSAGE.send("DEPTH_COUNTER_DISABLE", player);
|
|
||||||
} else {
|
|
||||||
Config.getInstance().get(player).put("depth_message", true);
|
|
||||||
BauSystem.MESSAGE.send("DEPTH_COUNTER_ENABLE", player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+2
-4
@@ -22,8 +22,6 @@ package de.steamwar.bausystem.features.gui.editor;
|
|||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.bausystem.features.gui.BauGUI;
|
import de.steamwar.bausystem.features.gui.BauGUI;
|
||||||
import de.steamwar.bausystem.linkage.specific.BauGuiItem;
|
import de.steamwar.bausystem.linkage.specific.BauGuiItem;
|
||||||
import de.steamwar.core.TrickyTrialsWrapper;
|
|
||||||
import de.steamwar.data.CMDs;
|
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
import de.steamwar.inventory.SWListInv;
|
import de.steamwar.inventory.SWListInv;
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
@@ -74,8 +72,8 @@ public class BauGuiEditor implements Listener {
|
|||||||
|
|
||||||
inv.setItem(mapping.getSize() + 5, new SWItem(Material.BARRIER, BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_TRASH", p), Arrays.asList(BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_TRASH_LORE", p)), false, clickType -> {
|
inv.setItem(mapping.getSize() + 5, new SWItem(Material.BARRIER, BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_TRASH", p), Arrays.asList(BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_TRASH_LORE", p)), false, clickType -> {
|
||||||
}).getItemStack());
|
}).getItemStack());
|
||||||
inv.setItem(mapping.getSize() + 6, new SWItem(TrickyTrialsWrapper.impl.getTurtleScute(), BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_MORE", p)).getItemStack());
|
inv.setItem(mapping.getSize() + 6, new SWItem(Material.SCUTE, BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_MORE", p)).getItemStack());
|
||||||
inv.setItem(mapping.getSize() + 8, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_CLOSE", p)).setCustomModelData(CMDs.BACK).getItemStack());
|
inv.setItem(mapping.getSize() + 8, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_CLOSE", p)).getItemStack());
|
||||||
|
|
||||||
p.openInventory(inv);
|
p.openInventory(inv);
|
||||||
p.getOpenInventory().setCursor(cursor == null ? new SWItem().getItemStack() : cursor);
|
p.getOpenInventory().setCursor(cursor == null ? new SWItem().getItemStack() : cursor);
|
||||||
|
|||||||
@@ -93,7 +93,6 @@ public class Loader implements Listener {
|
|||||||
element.execute(delay -> waitTime = delay);
|
element.execute(delay -> waitTime = delay);
|
||||||
if (waitTime > 0) {
|
if (waitTime > 0) {
|
||||||
if (element instanceof LoaderTNT) currentElement--;
|
if (element instanceof LoaderTNT) currentElement--;
|
||||||
waitTime--;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-3
@@ -20,7 +20,6 @@
|
|||||||
package de.steamwar.bausystem.features.loader.elements;
|
package de.steamwar.bausystem.features.loader.elements;
|
||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.data.CMDs;
|
|
||||||
import de.steamwar.inventory.SWAnvilInv;
|
import de.steamwar.inventory.SWAnvilInv;
|
||||||
import de.steamwar.inventory.SWInventory;
|
import de.steamwar.inventory.SWInventory;
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
@@ -114,7 +113,7 @@ public abstract class LoaderInteractionElement<T extends Enum<T> & LoaderSetting
|
|||||||
});
|
});
|
||||||
listInv.setItem(48, new SWItem(Material.ARROW, "§7Back", clickType -> {
|
listInv.setItem(48, new SWItem(Material.ARROW, "§7Back", clickType -> {
|
||||||
backAction.run();
|
backAction.run();
|
||||||
}).setCustomModelData(CMDs.BACK));
|
}));
|
||||||
listInv.setItem(50, new SWItem(Material.GHAST_SPAWN_EGG, "§7Insert another Setting", clickType -> {
|
listInv.setItem(50, new SWItem(Material.GHAST_SPAWN_EGG, "§7Insert another Setting", clickType -> {
|
||||||
elements.add(defaultSetting);
|
elements.add(defaultSetting);
|
||||||
extraPower.add(0);
|
extraPower.add(0);
|
||||||
@@ -151,7 +150,7 @@ public abstract class LoaderInteractionElement<T extends Enum<T> & LoaderSetting
|
|||||||
|
|
||||||
SWInventory swInventory = new SWInventory(player, guiSize, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_TITLE", player));
|
SWInventory swInventory = new SWInventory(player, guiSize, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_TITLE", player));
|
||||||
for (int i = guiSize - 9; i < guiSize; i++) swInventory.setItem(i, new SWItem(Material.GRAY_STAINED_GLASS_PANE, "§7", clickType -> {}));
|
for (int i = guiSize - 9; i < guiSize; i++) swInventory.setItem(i, new SWItem(Material.GRAY_STAINED_GLASS_PANE, "§7", clickType -> {}));
|
||||||
swInventory.setItem(guiSize - 9, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_BACK", player)).setCustomModelData(CMDs.BACK).getItemStack(), clickType -> back.run());
|
swInventory.setItem(guiSize - 9, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_BACK", player)).getItemStack(), clickType -> back.run());
|
||||||
swInventory.setItem(guiSize - 5, new SWItem(Material.WOODEN_AXE, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_COPY", player)).getItemStack(), clickType -> {
|
swInventory.setItem(guiSize - 5, new SWItem(Material.WOODEN_AXE, BauSystem.MESSAGE.parse("LOADER_GUI_SETTINGS_COPY", player)).getItemStack(), clickType -> {
|
||||||
SWAnvilInv swAnvilInv = new SWAnvilInv(player, BauSystem.MESSAGE.parse("LOADER_GUI_COPY_TITLE", player), "1");
|
SWAnvilInv swAnvilInv = new SWAnvilInv(player, BauSystem.MESSAGE.parse("LOADER_GUI_COPY_TITLE", player), "1");
|
||||||
swAnvilInv.setCallback(s -> {
|
swAnvilInv.setCallback(s -> {
|
||||||
|
|||||||
+1
-2
@@ -21,7 +21,6 @@ package de.steamwar.bausystem.features.loader.elements.impl;
|
|||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.bausystem.features.loader.elements.LoaderElement;
|
import de.steamwar.bausystem.features.loader.elements.LoaderElement;
|
||||||
import de.steamwar.data.CMDs;
|
|
||||||
import de.steamwar.inventory.SWAnvilInv;
|
import de.steamwar.inventory.SWAnvilInv;
|
||||||
import de.steamwar.inventory.SWInventory;
|
import de.steamwar.inventory.SWInventory;
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
@@ -61,7 +60,7 @@ public class LoaderWait implements LoaderElement {
|
|||||||
public void click(Player player, Runnable backAction) {
|
public void click(Player player, Runnable backAction) {
|
||||||
SWInventory swInventory = new SWInventory(player, 18, BauSystem.MESSAGE.parse("LOADER_GUI_WAIT_TITLE", player));
|
SWInventory swInventory = new SWInventory(player, 18, BauSystem.MESSAGE.parse("LOADER_GUI_WAIT_TITLE", player));
|
||||||
for (int i = 9; i < 18; i++) swInventory.setItem(i, new SWItem(Material.GRAY_STAINED_GLASS_PANE, "§7"));
|
for (int i = 9; i < 18; i++) swInventory.setItem(i, new SWItem(Material.GRAY_STAINED_GLASS_PANE, "§7"));
|
||||||
swInventory.setItem(9, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("LOADER_GUI_WAIT_BACK", player)).setCustomModelData(CMDs.BACK).getItemStack(), clickType -> backAction.run());
|
swInventory.setItem(9, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("LOADER_GUI_WAIT_BACK", player)).getItemStack(), clickType -> backAction.run());
|
||||||
|
|
||||||
swInventory.setItem(3, new SWItem(SWItem.getDye(1), BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_REMOVE_ONE", player), Arrays.asList(BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_REMOVE_ONE_SHIFT", player)), false, clickType -> {}).getItemStack(), clickType -> {
|
swInventory.setItem(3, new SWItem(SWItem.getDye(1), BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_REMOVE_ONE", player), Arrays.asList(BauSystem.MESSAGE.parse("LOADER_SETTING_TICKS_REMOVE_ONE_SHIFT", player)), false, clickType -> {}).getItemStack(), clickType -> {
|
||||||
delay -= clickType.isShiftClick() ? 5 : 1;
|
delay -= clickType.isShiftClick() ? 5 : 1;
|
||||||
|
|||||||
+2
-3
@@ -20,7 +20,6 @@
|
|||||||
package de.steamwar.bausystem.features.loadtimer;
|
package de.steamwar.bausystem.features.loadtimer;
|
||||||
|
|
||||||
import de.steamwar.bausystem.region.Region;
|
import de.steamwar.bausystem.region.Region;
|
||||||
import de.steamwar.core.TrickyTrialsWrapper;
|
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
@@ -58,7 +57,7 @@ public class LoadtimerListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onEntitySpawn(EntitySpawnEvent event) {
|
public void onEntitySpawn(EntitySpawnEvent event) {
|
||||||
if (!getTimers().isEmpty() && event.getEntityType() == TrickyTrialsWrapper.impl.getTntEntityType()) {
|
if (!getTimers().isEmpty() && event.getEntityType() == EntityType.PRIMED_TNT) {
|
||||||
Region r = Region.getRegion(event.getLocation());
|
Region r = Region.getRegion(event.getLocation());
|
||||||
if (hasTimer(r)) {
|
if (hasTimer(r)) {
|
||||||
getTimer(r).onTntSpawn();
|
getTimer(r).onTntSpawn();
|
||||||
@@ -68,7 +67,7 @@ public class LoadtimerListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onEntityExplode(EntityExplodeEvent event) {
|
public void onEntityExplode(EntityExplodeEvent event) {
|
||||||
if (!getTimers().isEmpty() && event.getEntityType() == TrickyTrialsWrapper.impl.getTntEntityType()) {
|
if (!getTimers().isEmpty() && event.getEntityType() == EntityType.PRIMED_TNT) {
|
||||||
Region r = Region.getRegion(event.getLocation());
|
Region r = Region.getRegion(event.getLocation());
|
||||||
if (hasTimer(r)) {
|
if (hasTimer(r)) {
|
||||||
getTimer(r).onTntExplode(event);
|
getTimer(r).onTntExplode(event);
|
||||||
|
|||||||
+2
-2
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.features.observer;
|
package de.steamwar.bausystem.features.observer;
|
||||||
|
|
||||||
import de.steamwar.Reflection;
|
import com.comphenix.tinyprotocol.Reflection;
|
||||||
import de.steamwar.bausystem.region.Point;
|
import de.steamwar.bausystem.region.Point;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@@ -170,7 +170,7 @@ public class ObserverTracer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Class<?> craftPoweredRail = Reflection.getClass("org.bukkit.craftbukkit.block.impl.CraftPoweredRail");
|
private static final Class<?> craftPoweredRail = Reflection.getClass("{obc}.block.impl.CraftPoweredRail");
|
||||||
private boolean checkAllowed(Block block, BlockData blockData) {
|
private boolean checkAllowed(Block block, BlockData blockData) {
|
||||||
if (checkMaterial(block)) return true;
|
if (checkMaterial(block)) return true;
|
||||||
if (block.getType() == Material.BELL) {
|
if (block.getType() == Material.BELL) {
|
||||||
|
|||||||
+4
-123
@@ -6,14 +6,12 @@ import de.steamwar.bausystem.region.flags.Flag;
|
|||||||
import de.steamwar.bausystem.region.flags.flagvalues.FreezeMode;
|
import de.steamwar.bausystem.region.flags.flagvalues.FreezeMode;
|
||||||
import de.steamwar.bausystem.utils.ScoreboardElement;
|
import de.steamwar.bausystem.utils.ScoreboardElement;
|
||||||
import de.steamwar.core.Core;
|
import de.steamwar.core.Core;
|
||||||
import de.steamwar.core.TrickyTrialsWrapper;
|
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockState;
|
|
||||||
import org.bukkit.block.data.type.NoteBlock;
|
|
||||||
import org.bukkit.block.data.type.Switch;
|
import org.bukkit.block.data.type.Switch;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
@@ -33,7 +31,7 @@ public class FreezeListener implements Listener, ScoreboardElement {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
if (e.getEntityType() == TrickyTrialsWrapper.impl.getTntEntityType()) {
|
if (e.getEntityType() == EntityType.PRIMED_TNT) {
|
||||||
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
|
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
|
||||||
e.getLocation().getBlock().setType(Material.TNT, false);
|
e.getLocation().getBlock().setType(Material.TNT, false);
|
||||||
}, 1L);
|
}, 1L);
|
||||||
@@ -61,24 +59,6 @@ public class FreezeListener implements Listener, ScoreboardElement {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPhysicsEvent(BlockPhysicsEvent e) {
|
public void onPhysicsEvent(BlockPhysicsEvent e) {
|
||||||
if (Region.getRegion(e.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) {
|
if (Region.getRegion(e.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) {
|
||||||
if (e.getSourceBlock().getType() == Material.NOTE_BLOCK) {
|
|
||||||
BlockState state = e.getSourceBlock().getState();
|
|
||||||
NoteBlock noteBlock = (NoteBlock) state.getBlockData();
|
|
||||||
if (noteBlock.isPowered()) {
|
|
||||||
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
|
|
||||||
state.update(true, false);
|
|
||||||
}, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (e.getBlock().getType() == Material.NOTE_BLOCK) {
|
|
||||||
BlockState state = e.getBlock().getState();
|
|
||||||
NoteBlock noteBlock = (NoteBlock) state.getBlockData();
|
|
||||||
if (noteBlock.isPowered()) {
|
|
||||||
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
|
|
||||||
state.update(true, false);
|
|
||||||
}, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -90,105 +70,6 @@ public class FreezeListener implements Listener, ScoreboardElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onNotePlay(NotePlayEvent event) {
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=45, z=98},type=CYAN_TERRACOTTA,data=Block{minecraft:cyan_terracotta},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-107, y=45, z=98},type=SMOOTH_STONE,data=Block{minecraft:smooth_stone},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=45, z=98},type=CYAN_TERRACOTTA,data=Block{minecraft:cyan_terracotta},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-105, y=45, z=98},type=CYAN_TERRACOTTA,data=Block{minecraft:cyan_terracotta},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=45, z=98},type=CYAN_TERRACOTTA,data=Block{minecraft:cyan_terracotta},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=44, z=98},type=CYAN_TERRACOTTA,data=Block{minecraft:cyan_terracotta},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=45, z=98},type=CYAN_TERRACOTTA,data=Block{minecraft:cyan_terracotta},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=46, z=98},type=BARRIER,data=Block{minecraft:barrier},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=45, z=98},type=CYAN_TERRACOTTA,data=Block{minecraft:cyan_terracotta},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=45, z=97},type=CYAN_TERRACOTTA,data=Block{minecraft:cyan_terracotta},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=45, z=98},type=CYAN_TERRACOTTA,data=Block{minecraft:cyan_terracotta},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=45, z=99},type=SMOOTH_STONE,data=Block{minecraft:smooth_stone},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
|
|
||||||
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=custom_head,note=9,powered=true],fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-107, y=47, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=custom_head,note=9,powered=true],fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-105, y=47, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=custom_head,note=9,powered=true],fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=46, z=98},type=BARRIER,data=Block{minecraft:barrier},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=custom_head,note=9,powered=true],fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=48, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=custom_head,note=9,powered=true],fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=97},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=custom_head,note=9,powered=true],fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
|
|
||||||
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=46, z=97},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-107, y=46, z=97},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=46, z=97},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-105, y=46, z=97},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=46, z=97},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=45, z=97},type=CYAN_TERRACOTTA,data=Block{minecraft:cyan_terracotta},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=46, z=97},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=97},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=46, z=97},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=46, z=96},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=46, z=97},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=46, z=98},type=BARRIER,data=Block{minecraft:barrier},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=46, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-107, y=46, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=46, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-105, y=46, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=46, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=45, z=99},type=SMOOTH_STONE,data=Block{minecraft:smooth_stone},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=46, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=46, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=46, z=98},type=BARRIER,data=Block{minecraft:barrier},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=46, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=46, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-107, y=46, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-108, y=46, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-107, y=46, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=46, z=98},type=BARRIER,data=Block{minecraft:barrier},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-107, y=46, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-107, y=45, z=98},type=SMOOTH_STONE,data=Block{minecraft:smooth_stone},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-107, y=46, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-107, y=47, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-107, y=46, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-107, y=46, z=97},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-107, y=46, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-107, y=46, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-105, y=46, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=46, z=98},type=BARRIER,data=Block{minecraft:barrier},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-105, y=46, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-104, y=46, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-105, y=46, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-105, y=45, z=98},type=CYAN_TERRACOTTA,data=Block{minecraft:cyan_terracotta},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-105, y=46, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-105, y=47, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-105, y=46, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-105, y=46, z=97},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-105, y=46, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-105, y=46, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
|
|
||||||
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=harp,note=9,powered=true],fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=harp,note=9,powered=true],fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=harp,note=9,powered=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-107, y=47, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=harp,note=9,powered=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-105, y=47, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=harp,note=9,powered=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=46, z=98},type=BARRIER,data=Block{minecraft:barrier},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=harp,note=9,powered=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=48, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=harp,note=9,powered=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=97},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=harp,note=9,powered=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=harp,note=9,powered=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=harp,note=9,powered=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831}
|
|
||||||
|
|
||||||
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=46, z=100},type=SMOOTH_STONE,data=Block{minecraft:smooth_stone},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-107, y=46, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=46, z=100},type=SMOOTH_STONE,data=Block{minecraft:smooth_stone},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-105, y=46, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=46, z=100},type=SMOOTH_STONE,data=Block{minecraft:smooth_stone},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=45, z=100},type=SMOOTH_STONE,data=Block{minecraft:smooth_stone},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=46, z=100},type=SMOOTH_STONE,data=Block{minecraft:smooth_stone},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=100},type=STONE_SLAB,data=Block{minecraft:stone_slab}[type=bottom,waterlogged=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=46, z=100},type=SMOOTH_STONE,data=Block{minecraft:smooth_stone},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=46, z=99},type=SMOOTH_STONE,data=Block{minecraft:smooth_stone},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=46, z=100},type=SMOOTH_STONE,data=Block{minecraft:smooth_stone},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=46, z=101},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
|
|
||||||
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=48, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-107, y=48, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=48, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-105, y=48, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=48, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=100},type=STONE_SLAB,data=Block{minecraft:stone_slab}[type=bottom,waterlogged=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=48, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=49, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=48, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=48, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=48, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=48, z=101},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-107, y=47, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-105, y=47, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=46, z=99},type=SMOOTH_STONE,data=Block{minecraft:smooth_stone},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=48, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
|
|
||||||
////[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=basedrum,note=9,powered=true],fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=100},type=STONE_SLAB,data=Block{minecraft:stone_slab}[type=bottom,waterlogged=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=101},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-107, y=47, z=101},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=101},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-105, y=47, z=101},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=101},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=46, z=101},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=101},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=48, z=101},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=101},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=100},type=STONE_SLAB,data=Block{minecraft:stone_slab}[type=bottom,waterlogged=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=101},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=102},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-107, y=47, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-108, y=47, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-107, y=47, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=100},type=STONE_SLAB,data=Block{minecraft:stone_slab}[type=bottom,waterlogged=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-107, y=47, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-107, y=46, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-107, y=47, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-107, y=48, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-107, y=47, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-107, y=47, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-107, y=47, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-107, y=47, z=101},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-105, y=47, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=100},type=STONE_SLAB,data=Block{minecraft:stone_slab}[type=bottom,waterlogged=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-105, y=47, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-104, y=47, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-105, y=47, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-105, y=46, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-105, y=47, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-105, y=48, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-105, y=47, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-105, y=47, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-105, y=47, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-105, y=47, z=101},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
|
|
||||||
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=basedrum,note=9,powered=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-107, y=47, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=basedrum,note=9,powered=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-105, y=47, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=basedrum,note=9,powered=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=46, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=basedrum,note=9,powered=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=48, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=basedrum,note=9,powered=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=97},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=basedrum,note=9,powered=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
|
|
||||||
//[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=basedrum,note=9,powered=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=basedrum,note=9,powered=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPistonRetract(BlockPistonRetractEvent e) {
|
public void onPistonRetract(BlockPistonRetractEvent e) {
|
||||||
if (Region.getRegion(e.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) {
|
if (Region.getRegion(e.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) {
|
||||||
@@ -226,13 +107,13 @@ public class FreezeListener implements Listener, ScoreboardElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onBlockBreak(BlockBreakEvent e) {
|
public void onBlockBreak(BlockBreakEvent e) {
|
||||||
if (Core.getVersion() < 19) return;
|
if (Core.getVersion() < 19) return;
|
||||||
if (e.getPlayer().getInventory().getItemInMainHand().getType() == Material.DEBUG_STICK) return;
|
if (e.getPlayer().getInventory().getItemInMainHand().getType() == Material.DEBUG_STICK) return;
|
||||||
if (Region.getRegion(e.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) {
|
if (Region.getRegion(e.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) {
|
||||||
|
if (e.isCancelled()) return;
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
e.getBlock().setType(Material.BARRIER, false);
|
|
||||||
e.getBlock().setType(Material.AIR, false);
|
e.getBlock().setType(Material.AIR, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-1
@@ -20,6 +20,7 @@
|
|||||||
package de.steamwar.bausystem.features.region;
|
package de.steamwar.bausystem.features.region;
|
||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
|
import de.steamwar.bausystem.Permission;
|
||||||
import de.steamwar.bausystem.config.BauServer;
|
import de.steamwar.bausystem.config.BauServer;
|
||||||
import de.steamwar.bausystem.region.GlobalRegion;
|
import de.steamwar.bausystem.region.GlobalRegion;
|
||||||
import de.steamwar.bausystem.region.Region;
|
import de.steamwar.bausystem.region.Region;
|
||||||
@@ -30,6 +31,7 @@ import de.steamwar.bausystem.region.utils.RegionExtensionType;
|
|||||||
import de.steamwar.bausystem.region.utils.RegionType;
|
import de.steamwar.bausystem.region.utils.RegionType;
|
||||||
import de.steamwar.bausystem.utils.PasteBuilder;
|
import de.steamwar.bausystem.utils.PasteBuilder;
|
||||||
import de.steamwar.command.SWCommand;
|
import de.steamwar.command.SWCommand;
|
||||||
|
import de.steamwar.command.TypeValidator;
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import de.steamwar.linkage.LinkedInstance;
|
import de.steamwar.linkage.LinkedInstance;
|
||||||
import de.steamwar.sql.Punishment;
|
import de.steamwar.sql.Punishment;
|
||||||
@@ -38,6 +40,7 @@ import de.steamwar.sql.SteamwarUser;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
@Linked
|
@Linked
|
||||||
@@ -58,7 +61,7 @@ public class ResetCommand extends SWCommand {
|
|||||||
PasteBuilder pasteBuilder = new PasteBuilder(new PasteBuilder.FileProvider(region.getResetFile(RegionType.NORMAL)))
|
PasteBuilder pasteBuilder = new PasteBuilder(new PasteBuilder.FileProvider(region.getResetFile(RegionType.NORMAL)))
|
||||||
.color(region.getPlain(Flag.COLOR, ColorMode.class).getColor());
|
.color(region.getPlain(Flag.COLOR, ColorMode.class).getColor());
|
||||||
region.reset(pasteBuilder, RegionType.NORMAL, RegionExtensionType.NORMAL);
|
region.reset(pasteBuilder, RegionType.NORMAL, RegionExtensionType.NORMAL);
|
||||||
for (Flag value : Flag.getResetFlags()) {
|
for (Flag value : Flag.values()) {
|
||||||
region.set(value, value.getDefaultValue());
|
region.set(value, value.getDefaultValue());
|
||||||
}
|
}
|
||||||
RegionUtils.message(region, "REGION_RESET_RESETED");
|
RegionUtils.message(region, "REGION_RESET_RESETED");
|
||||||
|
|||||||
+6
-6
@@ -24,13 +24,14 @@ import de.steamwar.bausystem.Permission;
|
|||||||
import de.steamwar.bausystem.features.script.ScriptRunner;
|
import de.steamwar.bausystem.features.script.ScriptRunner;
|
||||||
import de.steamwar.bausystem.features.script.lua.SteamWarGlobalLuaPlugin;
|
import de.steamwar.bausystem.features.script.lua.SteamWarGlobalLuaPlugin;
|
||||||
import de.steamwar.bausystem.features.script.lua.libs.StorageLib;
|
import de.steamwar.bausystem.features.script.lua.libs.StorageLib;
|
||||||
|
import de.steamwar.bausystem.features.tpslimit.TPSUtils;
|
||||||
import de.steamwar.bausystem.region.Region;
|
import de.steamwar.bausystem.region.Region;
|
||||||
import de.steamwar.bausystem.region.utils.RegionExtensionType;
|
import de.steamwar.bausystem.region.utils.RegionExtensionType;
|
||||||
import de.steamwar.bausystem.region.utils.RegionType;
|
import de.steamwar.bausystem.region.utils.RegionType;
|
||||||
import de.steamwar.core.TrickyTrialsWrapper;
|
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
@@ -70,10 +71,9 @@ public class EventListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGH)
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||||
if(Permission.BUILD.hasPermission(event.getPlayer())) {
|
|
||||||
ScriptRunner.callEvent(event.getPlayer(), SteamWarGlobalLuaPlugin.EventType.SelfLeave, LuaValue.NIL, event);
|
|
||||||
}
|
|
||||||
StorageLib.removePlayer(event.getPlayer());
|
StorageLib.removePlayer(event.getPlayer());
|
||||||
|
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||||
|
ScriptRunner.callEvent(event.getPlayer(), SteamWarGlobalLuaPlugin.EventType.SelfLeave, LuaValue.NIL, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGH)
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
@@ -146,7 +146,7 @@ public class EventListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGH)
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public void onEntitySpawn(EntitySpawnEvent event) {
|
public void onEntitySpawn(EntitySpawnEvent event) {
|
||||||
if (event.getEntityType() != TrickyTrialsWrapper.impl.getTntEntityType()) {
|
if (event.getEntityType() != EntityType.PRIMED_TNT) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Region tntRegion = Region.getRegion(event.getLocation());
|
Region tntRegion = Region.getRegion(event.getLocation());
|
||||||
@@ -161,7 +161,7 @@ public class EventListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void onEntityExplode(EntityExplodeEvent event) {
|
public void onEntityExplode(EntityExplodeEvent event) {
|
||||||
if (event.getEntityType() != TrickyTrialsWrapper.impl.getTntEntityType()) {
|
if (event.getEntityType() != EntityType.PRIMED_TNT) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Region tntRegion = Region.getRegion(event.getLocation());
|
Region tntRegion = Region.getRegion(event.getLocation());
|
||||||
|
|||||||
-2
@@ -166,8 +166,6 @@ public class SteamWarLuaPlugin extends TwoArgFunction {
|
|||||||
env.set("rawlen", NIL);
|
env.set("rawlen", NIL);
|
||||||
env.set("rawset", NIL);
|
env.set("rawset", NIL);
|
||||||
env.set("xpcall", NIL);
|
env.set("xpcall", NIL);
|
||||||
env.set("require", NIL);
|
|
||||||
env.set("package", NIL);
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -51,7 +51,7 @@ public class TpsLib implements LuaLib {
|
|||||||
tpsLib.set("fiveMinute", getter(() -> TPSWatcher.getTPS(TPSWatcher.TPSType.FIVE_MINUTES)));
|
tpsLib.set("fiveMinute", getter(() -> TPSWatcher.getTPS(TPSWatcher.TPSType.FIVE_MINUTES)));
|
||||||
tpsLib.set("tenMinute", getter(() -> TPSWatcher.getTPS(TPSWatcher.TPSType.TEN_MINUTES)));
|
tpsLib.set("tenMinute", getter(() -> TPSWatcher.getTPS(TPSWatcher.TPSType.TEN_MINUTES)));
|
||||||
tpsLib.set("current", getter(TPSWatcher::getTPS));
|
tpsLib.set("current", getter(TPSWatcher::getTPS));
|
||||||
tpsLib.set("limit", getter(TPSSystem::getCurrentTPSLimit));
|
tpsLib.set("limit", getter(tpsSystem::getCurrentTPSLimit));
|
||||||
return tpsLib;
|
return tpsLib;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
-113
@@ -1,113 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of the SteamWar software.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2023 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 <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.features.script.lua.libs;
|
|
||||||
|
|
||||||
import de.steamwar.bausystem.features.tracer.TNTPoint;
|
|
||||||
import de.steamwar.bausystem.features.tracer.Trace;
|
|
||||||
import de.steamwar.bausystem.features.tracer.TraceManager;
|
|
||||||
import de.steamwar.linkage.Linked;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.util.Vector;
|
|
||||||
import org.luaj.vm2.LuaTable;
|
|
||||||
import org.luaj.vm2.LuaValue;
|
|
||||||
import org.luaj.vm2.lib.ZeroArgFunction;
|
|
||||||
|
|
||||||
@Linked
|
|
||||||
public class TracerLib implements LuaLib {
|
|
||||||
@Override
|
|
||||||
public String name() {
|
|
||||||
return "tracer";
|
|
||||||
}
|
|
||||||
|
|
||||||
private static LuaTable convertTrace(Trace trace) {
|
|
||||||
LuaTable luaTrace = new LuaTable();
|
|
||||||
|
|
||||||
luaTrace.set("getRecords", new ZeroArgFunction() {
|
|
||||||
@Override
|
|
||||||
public LuaValue call() {
|
|
||||||
return LuaValue.listOf(
|
|
||||||
trace.getHistories()
|
|
||||||
.stream()
|
|
||||||
.map((history) -> LuaValue.listOf(history
|
|
||||||
.stream()
|
|
||||||
.map(TracerLib::convertTntPoint)
|
|
||||||
.toArray(LuaValue[]::new)))
|
|
||||||
.toArray(LuaValue[]::new));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
luaTrace.set("getId", new ZeroArgFunction() {
|
|
||||||
@Override
|
|
||||||
public LuaValue call() {
|
|
||||||
return LuaValue.valueOf(trace.getUuid().toString());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
return luaTrace;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static LuaTable convertTntPoint(TNTPoint tntPoint) {
|
|
||||||
Location pointPos = tntPoint.getLocation();
|
|
||||||
LuaTable luaPos = LuaValue.tableOf(new LuaValue[]{
|
|
||||||
LuaValue.valueOf("x"), LuaValue.valueOf(pointPos.getX()),
|
|
||||||
LuaValue.valueOf("y"), LuaValue.valueOf(pointPos.getY()),
|
|
||||||
LuaValue.valueOf("z"), LuaValue.valueOf(pointPos.getZ()),
|
|
||||||
});
|
|
||||||
|
|
||||||
Vector pointVel = tntPoint.getVelocity();
|
|
||||||
LuaTable luaVel = LuaValue.tableOf(new LuaValue[]{
|
|
||||||
LuaValue.valueOf("x"), LuaValue.valueOf(pointVel.getX()),
|
|
||||||
LuaValue.valueOf("y"), LuaValue.valueOf(pointVel.getY()),
|
|
||||||
LuaValue.valueOf("z"), LuaValue.valueOf(pointVel.getZ()),
|
|
||||||
});
|
|
||||||
|
|
||||||
return LuaValue.tableOf(new LuaValue[]{
|
|
||||||
LuaValue.valueOf("pos"), luaPos,
|
|
||||||
LuaValue.valueOf("vel"), luaVel,
|
|
||||||
LuaValue.valueOf("ticksSinceStart"), LuaValue.valueOf(tntPoint.getTicksSinceStart()),
|
|
||||||
LuaValue.valueOf("fuse"), LuaValue.valueOf(tntPoint.getFuse()),
|
|
||||||
LuaValue.valueOf("isExplosion"), LuaValue.valueOf(tntPoint.isExplosion()),
|
|
||||||
LuaValue.valueOf("isInWater"), LuaValue.valueOf(tntPoint.isInWater()),
|
|
||||||
LuaValue.valueOf("hasDestroyedBuild"), LuaValue.valueOf(tntPoint.isDestroyedBuildArea()),
|
|
||||||
LuaValue.valueOf("hasDestroyedTestblock"), LuaValue.valueOf(tntPoint.isDestroyedTestBlock())
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public LuaTable get(Player player) {
|
|
||||||
LuaTable rootTable = LuaValue.tableOf();
|
|
||||||
|
|
||||||
rootTable.set("getTraces", new ZeroArgFunction() {
|
|
||||||
@Override
|
|
||||||
public LuaValue call() {
|
|
||||||
return LuaValue.listOf(TraceManager.instance.getAll()
|
|
||||||
.stream()
|
|
||||||
.map(TracerLib::convertTrace)
|
|
||||||
.toArray(LuaValue[]::new));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
);
|
|
||||||
|
|
||||||
return rootTable;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+2
-6
@@ -160,11 +160,6 @@ public class ShieldPrinting implements Listener {
|
|||||||
|
|
||||||
private void paste(Map<Material, BlockDataConfiguration<?>[]> stateConfiguration) {
|
private void paste(Map<Material, BlockDataConfiguration<?>[]> stateConfiguration) {
|
||||||
for (Map.Entry<Vector, BlockData> entry : shieldData.entrySet()) {
|
for (Map.Entry<Vector, BlockData> entry : shieldData.entrySet()) {
|
||||||
BlockData copied = entry.getValue();
|
|
||||||
if (copied.getMaterial().isAir()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
Block block = entry.getKey().toLocation(WORLD).getBlock();
|
Block block = entry.getKey().toLocation(WORLD).getBlock();
|
||||||
if (entry.getValue().getMaterial() != block.getType()) {
|
if (entry.getValue().getMaterial() != block.getType()) {
|
||||||
block.setBlockData(entry.getValue(), false);
|
block.setBlockData(entry.getValue(), false);
|
||||||
@@ -176,11 +171,12 @@ public class ShieldPrinting implements Listener {
|
|||||||
|
|
||||||
BlockDataConfiguration[] stateConfigurations = stateConfiguration.get(entry.getValue().getMaterial());
|
BlockDataConfiguration[] stateConfigurations = stateConfiguration.get(entry.getValue().getMaterial());
|
||||||
if (stateConfigurations == null) {
|
if (stateConfigurations == null) {
|
||||||
|
block.setBlockData(entry.getValue(), false);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockData worldOriginal = block.getBlockData();
|
BlockData worldOriginal = block.getBlockData();
|
||||||
copied = copied.clone();
|
BlockData copied = entry.getValue().clone();
|
||||||
for (BlockDataConfiguration blockDataConfiguration : stateConfigurations) {
|
for (BlockDataConfiguration blockDataConfiguration : stateConfigurations) {
|
||||||
if (blockDataConfiguration == null) continue;
|
if (blockDataConfiguration == null) continue;
|
||||||
blockDataConfiguration.apply(copied, worldOriginal);
|
blockDataConfiguration.apply(copied, worldOriginal);
|
||||||
|
|||||||
+11
-44
@@ -20,10 +20,10 @@
|
|||||||
package de.steamwar.bausystem.features.simulator;
|
package de.steamwar.bausystem.features.simulator;
|
||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
|
import de.steamwar.bausystem.Permission;
|
||||||
import de.steamwar.bausystem.SWUtils;
|
import de.steamwar.bausystem.SWUtils;
|
||||||
import de.steamwar.bausystem.features.simulator.data.Simulator;
|
import de.steamwar.bausystem.features.simulator.data.Simulator;
|
||||||
import de.steamwar.bausystem.features.simulator.execute.SimulatorExecutor;
|
import de.steamwar.bausystem.features.simulator.execute.SimulatorExecutor;
|
||||||
import de.steamwar.bausystem.features.simulator.preview.SimulatorPreviewCalculator;
|
|
||||||
import de.steamwar.command.PreviousArguments;
|
import de.steamwar.command.PreviousArguments;
|
||||||
import de.steamwar.command.SWCommand;
|
import de.steamwar.command.SWCommand;
|
||||||
import de.steamwar.command.TypeMapper;
|
import de.steamwar.command.TypeMapper;
|
||||||
@@ -31,7 +31,6 @@ import de.steamwar.command.TypeValidator;
|
|||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import de.steamwar.linkage.LinkedInstance;
|
import de.steamwar.linkage.LinkedInstance;
|
||||||
import de.steamwar.linkage.MinVersion;
|
import de.steamwar.linkage.MinVersion;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@@ -64,7 +63,15 @@ public class SimulatorCommand extends SWCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Register(value = "copy", description = "SIMULATOR_COPY_HELP")
|
@Register(value = "copy", description = "SIMULATOR_COPY_HELP")
|
||||||
public void copy(@Validator Player p, @ErrorMessage("SIMULATOR_NOT_EXISTS") Simulator simulator, @Validator("simulatorName") String name) {
|
public void copy(@Validator Player p, @ErrorMessage("SIMULATOR_NOT_EXISTS") Simulator simulator, String name) {
|
||||||
|
if (SimulatorStorage.getSimulator(name) != null) {
|
||||||
|
BauSystem.MESSAGE.send("SIMULATOR_NAME_ALREADY_EXISTS", p);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!name.matches("[a-zA-Z_0-9-]+")) {
|
||||||
|
BauSystem.MESSAGE.send("SIMULATOR_NAME_INVALID", p);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!SimulatorStorage.copy(simulator, name)) {
|
if (!SimulatorStorage.copy(simulator, name)) {
|
||||||
BauSystem.MESSAGE.send("SIMULATOR_ERROR_COPY", p);
|
BauSystem.MESSAGE.send("SIMULATOR_ERROR_COPY", p);
|
||||||
}
|
}
|
||||||
@@ -78,32 +85,7 @@ public class SimulatorCommand extends SWCommand {
|
|||||||
|
|
||||||
@Register(value = "start", description = "SIMULATOR_START_HELP")
|
@Register(value = "start", description = "SIMULATOR_START_HELP")
|
||||||
public void start(@Validator Player p, @ErrorMessage("SIMULATOR_NOT_EXISTS") Simulator simulator) {
|
public void start(@Validator Player p, @ErrorMessage("SIMULATOR_NOT_EXISTS") Simulator simulator) {
|
||||||
SimulatorExecutor.run(simulator, () -> {});
|
SimulatorExecutor.run(simulator);
|
||||||
}
|
|
||||||
|
|
||||||
@Register(value = "rename", description = "SIMULATOR_RENAME_HELP")
|
|
||||||
public void rename(@Validator Player p, @ErrorMessage("SIMULATOR_NOT_EXISTS") Simulator simulator, @Validator("simulatorName") String name) {
|
|
||||||
String oldName = simulator.getName();
|
|
||||||
if (SimulatorStorage.copy(simulator, name)) {
|
|
||||||
SimulatorStorage.delete(simulator);
|
|
||||||
BauSystem.MESSAGE.send("SIMULATOR_RENAMED", p, oldName, name);
|
|
||||||
} else {
|
|
||||||
BauSystem.MESSAGE.send("SIMULATOR_ERROR_COPY", p);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Register(value = "test")
|
|
||||||
public void test(Player player) {
|
|
||||||
for (int i = 0; i < 1; i++) {
|
|
||||||
SimulatorPreviewCalculator data = new SimulatorPreviewCalculator(null);
|
|
||||||
data.spawnTNT(0, 166, 0);
|
|
||||||
data.calculate(simulatorPreviewResult -> {
|
|
||||||
simulatorPreviewResult.show(player);
|
|
||||||
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
|
|
||||||
simulatorPreviewResult.hide(player);
|
|
||||||
}, 100);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ClassMapper(value = Simulator.class, local = true)
|
@ClassMapper(value = Simulator.class, local = true)
|
||||||
@@ -120,19 +102,4 @@ public class SimulatorCommand extends SWCommand {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Validator(value = "simulatorName", local = true)
|
|
||||||
public TypeValidator<String> simulatorName() {
|
|
||||||
return (commandSender, name, messageSender) -> {
|
|
||||||
if (SimulatorStorage.getSimulator(name) != null) {
|
|
||||||
messageSender.send("SIMULATOR_NAME_ALREADY_EXISTS");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!name.matches("[a-zA-Z_0-9-]+")) {
|
|
||||||
messageSender.send("SIMULATOR_NAME_INVALID");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-16
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.features.simulator;
|
package de.steamwar.bausystem.features.simulator;
|
||||||
|
|
||||||
import de.steamwar.Reflection;
|
import com.comphenix.tinyprotocol.Reflection;
|
||||||
import com.comphenix.tinyprotocol.TinyProtocol;
|
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.bausystem.Permission;
|
import de.steamwar.bausystem.Permission;
|
||||||
@@ -72,9 +72,9 @@ import java.util.stream.Collectors;
|
|||||||
public class SimulatorCursor implements Listener {
|
public class SimulatorCursor implements Listener {
|
||||||
|
|
||||||
private final World WORLD = Bukkit.getWorlds().get(0);
|
private final World WORLD = Bukkit.getWorlds().get(0);
|
||||||
private Class<?> position = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundMovePlayerPacket$Pos");
|
private Class<?> position = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInFlying$PacketPlayInPosition");
|
||||||
private Class<?> look = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundMovePlayerPacket$Rot");
|
private Class<?> look = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInFlying$PacketPlayInLook");
|
||||||
private Class<?> positionLook = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundMovePlayerPacket$PosRot");
|
private Class<?> positionLook = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInFlying$PacketPlayInPositionLook");
|
||||||
|
|
||||||
private Map<Player, CursorType> cursorType = Collections.synchronizedMap(new HashMap<>());
|
private Map<Player, CursorType> cursorType = Collections.synchronizedMap(new HashMap<>());
|
||||||
private Map<Player, REntityServer> cursors = Collections.synchronizedMap(new HashMap<>());
|
private Map<Player, REntityServer> cursors = Collections.synchronizedMap(new HashMap<>());
|
||||||
@@ -168,19 +168,9 @@ public class SimulatorCursor implements Listener {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Simulator simulator = SimulatorStorage.getSimulator(player);
|
Simulator simulator = SimulatorStorage.getSimulator(player);
|
||||||
if (simulator != null && simulator.getStabGenerator() != null) {
|
|
||||||
removeCursor(player);
|
|
||||||
SimulatorWatcher.show(null, player);
|
|
||||||
SWUtils.sendToActionbar(player, "§cGenerating Stab");
|
|
||||||
synchronized (calculating) {
|
|
||||||
calculating.remove(player);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
SimulatorWatcher.show(simulator, player);
|
SimulatorWatcher.show(simulator, player);
|
||||||
|
|
||||||
List<REntity> entities = SimulatorWatcher.getEntitiesOfSimulator(simulator);
|
List<REntity> entities = SimulatorWatcher.getEntitiesOfSimulator(simulator);
|
||||||
RayTraceUtils.RRayTraceResult rayTraceResult = RayTraceUtils.traceREntity(player, player.getLocation(), entities);
|
RayTraceUtils.RRayTraceResult rayTraceResult = RayTraceUtils.traceREntity(player, player.getLocation(), entities);
|
||||||
if (rayTraceResult == null) {
|
if (rayTraceResult == null) {
|
||||||
@@ -367,7 +357,7 @@ public class SimulatorCursor implements Listener {
|
|||||||
if (simulator == null) {
|
if (simulator == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SimulatorExecutor.run(simulator, () -> {});
|
SimulatorExecutor.run(simulator);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-2
@@ -44,7 +44,6 @@ import org.bukkit.inventory.meta.ItemMeta;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
@Linked
|
@Linked
|
||||||
@MinVersion(19)
|
@MinVersion(19)
|
||||||
@@ -131,7 +130,7 @@ public class SimulatorStorage implements Enable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void openSimulatorSelector(Player player) {
|
public static void openSimulatorSelector(Player player) {
|
||||||
SimulatorPageGui<Simulator> simulatorPageGui = new SimulatorPageGui<Simulator>(player, null, 6 * 9, simulatorMap.values().stream().sorted(Comparator.comparing(Simulator::getName)).collect(Collectors.toList())) {
|
SimulatorPageGui<Simulator> simulatorPageGui = new SimulatorPageGui<Simulator>(player, null, 6 * 9, new ArrayList<>(simulatorMap.values())) {
|
||||||
@Override
|
@Override
|
||||||
public String baseTitle() {
|
public String baseTitle() {
|
||||||
return "Simulators";
|
return "Simulators";
|
||||||
|
|||||||
+1
-2
@@ -20,7 +20,6 @@
|
|||||||
package de.steamwar.bausystem.features.simulator.data;
|
package de.steamwar.bausystem.features.simulator.data;
|
||||||
|
|
||||||
import de.steamwar.bausystem.features.simulator.execute.SimulatorAction;
|
import de.steamwar.bausystem.features.simulator.execute.SimulatorAction;
|
||||||
import de.steamwar.bausystem.features.simulator.execute.SimulatorStabGenerator;
|
|
||||||
import de.steamwar.inventory.InvCallback;
|
import de.steamwar.inventory.InvCallback;
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
@@ -31,13 +30,13 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.function.BiConsumer;
|
import java.util.function.BiConsumer;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public final class Simulator {
|
public final class Simulator {
|
||||||
private SimulatorStabGenerator stabGenerator = null;
|
|
||||||
private Material material = Material.BARREL;
|
private Material material = Material.BARREL;
|
||||||
private final String name;
|
private final String name;
|
||||||
private boolean autoTrace = false;
|
private boolean autoTrace = false;
|
||||||
|
|||||||
-1
@@ -60,7 +60,6 @@ public final class TNTPhase extends SimulatorPhase {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void toSimulatorActions(Vector position, BiConsumer<Integer, SimulatorAction> tickStart, BiConsumer<Integer, SimulatorAction> tickEnd) {
|
public void toSimulatorActions(Vector position, BiConsumer<Integer, SimulatorAction> tickStart, BiConsumer<Integer, SimulatorAction> tickEnd) {
|
||||||
if (count <= 0) return;
|
|
||||||
tickStart.accept(tickOffset, new SimulatorAction(order, count) {
|
tickStart.accept(tickOffset, new SimulatorAction(order, count) {
|
||||||
@Override
|
@Override
|
||||||
public void accept(World world) {
|
public void accept(World world) {
|
||||||
|
|||||||
-34
@@ -1,34 +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 <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.features.simulator.execute;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import org.bukkit.util.Vector;
|
|
||||||
|
|
||||||
import java.util.function.Function;
|
|
||||||
|
|
||||||
@AllArgsConstructor
|
|
||||||
public enum Direction {
|
|
||||||
X(Vector::getBlockX),
|
|
||||||
Y(Vector::getBlockY),
|
|
||||||
Z(Vector::getBlockZ);
|
|
||||||
|
|
||||||
public final Function<Vector, Integer> component;
|
|
||||||
}
|
|
||||||
+3
-5
@@ -46,7 +46,7 @@ public class SimulatorExecutor implements Listener {
|
|||||||
private static Map<Long, Map<Integer, List<SimulatorAction>>> tickStartActions = new HashMap<>();
|
private static Map<Long, Map<Integer, List<SimulatorAction>>> tickStartActions = new HashMap<>();
|
||||||
private static Map<Long, List<SimulatorAction>> tickEndActions = new HashMap<>();
|
private static Map<Long, List<SimulatorAction>> tickEndActions = new HashMap<>();
|
||||||
|
|
||||||
public static boolean run(Simulator simulator, Runnable onEnd) {
|
public static boolean run(Simulator simulator) {
|
||||||
if (currentlyRunning.contains(simulator)) return false;
|
if (currentlyRunning.contains(simulator)) return false;
|
||||||
currentlyRunning.add(simulator);
|
currentlyRunning.add(simulator);
|
||||||
|
|
||||||
@@ -69,7 +69,7 @@ public class SimulatorExecutor implements Listener {
|
|||||||
public void accept(World world) {
|
public void accept(World world) {
|
||||||
currentlyRunning.remove(simulator);
|
currentlyRunning.remove(simulator);
|
||||||
|
|
||||||
if (simulator.isAutoTrace() && onEnd == null) {
|
if (simulator.isAutoTrace()) {
|
||||||
simulator.getGroups()
|
simulator.getGroups()
|
||||||
.stream()
|
.stream()
|
||||||
.map(SimulatorGroup::getElements)
|
.map(SimulatorGroup::getElements)
|
||||||
@@ -82,12 +82,10 @@ public class SimulatorExecutor implements Listener {
|
|||||||
TraceRecorder.instance.stopRecording(region);
|
TraceRecorder.instance.stopRecording(region);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onEnd.run();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (simulator.isAutoTrace() && onEnd == null) {
|
if (simulator.isAutoTrace()) {
|
||||||
simulator.getGroups()
|
simulator.getGroups()
|
||||||
.stream()
|
.stream()
|
||||||
.map(SimulatorGroup::getElements)
|
.map(SimulatorGroup::getElements)
|
||||||
|
|||||||
-45
@@ -1,45 +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 <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.features.simulator.execute;
|
|
||||||
|
|
||||||
import de.steamwar.bausystem.features.simulator.data.Simulator;
|
|
||||||
import de.steamwar.bausystem.features.simulator.data.tnt.TNTElement;
|
|
||||||
import de.steamwar.bausystem.region.Region;
|
|
||||||
import de.steamwar.bausystem.utils.bossbar.BossBarService;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public class SimulatorStabGenerator {
|
|
||||||
|
|
||||||
private final StabData stabData;
|
|
||||||
|
|
||||||
public SimulatorStabGenerator(Region region, Simulator simulator, TNTElement tntElement, int depthLimit) {
|
|
||||||
stabData = new StabData(region, simulator, tntElement, tntElement.getPhases(), depthLimit);
|
|
||||||
new StabSetup(stabData);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void cancel() {
|
|
||||||
stabData.cancel = true;
|
|
||||||
stabData.simulator.setStabGenerator(null);
|
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
|
||||||
BossBarService.instance.remove(player, stabData.region, "simulator_stab_generator");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-52
@@ -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 <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.features.simulator.execute;
|
|
||||||
|
|
||||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
|
||||||
import de.steamwar.bausystem.features.simulator.data.Simulator;
|
|
||||||
import de.steamwar.bausystem.features.simulator.data.tnt.TNTElement;
|
|
||||||
import de.steamwar.bausystem.features.simulator.data.tnt.TNTPhase;
|
|
||||||
import de.steamwar.bausystem.region.Region;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class StabData {
|
|
||||||
|
|
||||||
protected static final int MAX_RECORDINGS = 5;
|
|
||||||
protected static final int MAX_TICK_DIFFERENCE = 3;
|
|
||||||
protected static final Level LEVEL = Level.INFO;
|
|
||||||
protected static final int TNT_INCREASE = 10;
|
|
||||||
protected static final int MIN_BLOCK_TO_COUNT_AS_DEPTH = 20;
|
|
||||||
|
|
||||||
protected final Region region;
|
|
||||||
protected final Simulator simulator;
|
|
||||||
protected final TNTElement tntElement;
|
|
||||||
protected final List<TNTPhase> phases;
|
|
||||||
protected final int depthLimit;
|
|
||||||
|
|
||||||
protected Clipboard clipboard;
|
|
||||||
protected boolean cancel = false;
|
|
||||||
|
|
||||||
protected Direction direction = null;
|
|
||||||
protected int currentDepth = 0;
|
|
||||||
}
|
|
||||||
-103
@@ -1,103 +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 <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.features.simulator.execute;
|
|
||||||
|
|
||||||
import com.sk89q.worldedit.EditSession;
|
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
|
||||||
import com.sk89q.worldedit.bukkit.BukkitWorld;
|
|
||||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
|
||||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
|
||||||
import de.steamwar.bausystem.features.simulator.data.SimulatorPhase;
|
|
||||||
import de.steamwar.bausystem.features.tracer.TNTPoint;
|
|
||||||
import de.steamwar.bausystem.features.tracer.Trace;
|
|
||||||
import de.steamwar.bausystem.features.tracer.TraceManager;
|
|
||||||
import de.steamwar.bausystem.features.tracer.TraceRecorder;
|
|
||||||
import de.steamwar.bausystem.utils.bossbar.BauSystemBossbar;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.util.Vector;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
public class StabDirection extends StabStep {
|
|
||||||
|
|
||||||
public StabDirection(StabData data) {
|
|
||||||
super(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void start() {
|
|
||||||
try (EditSession e = WorldEdit.getInstance().getEditSessionFactory().getEditSession(new BukkitWorld(Bukkit.getWorlds().get(0)), -1)) {
|
|
||||||
e.setBlocks((com.sk89q.worldedit.regions.Region) new CuboidRegion(data.region.getMinPointTestblockExtension().toBlockVector3(), data.region.getMaxPointTestblockExtension().toBlockVector3()), Objects.requireNonNull(BlockTypes.AIR).getDefaultState().toBaseBlock());
|
|
||||||
}
|
|
||||||
|
|
||||||
Trace trace = TraceRecorder.instance.startRecording(data.region);
|
|
||||||
runSimulator(() -> {
|
|
||||||
TraceRecorder.instance.stopRecording(data.region);
|
|
||||||
calculateDirection(trace);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void calculateDirection(Trace trace) {
|
|
||||||
long tickSinceStart = -1;
|
|
||||||
List<TNTPoint> points = null;
|
|
||||||
for (List<TNTPoint> current : trace.getHistories()) {
|
|
||||||
long ticks = current.get(0).getTicksSinceStart();
|
|
||||||
if (points == null || ticks > tickSinceStart) {
|
|
||||||
tickSinceStart = ticks;
|
|
||||||
points = current;
|
|
||||||
} else if (ticks == tickSinceStart && points.get(0).getTntId() < current.get(0).getTntId()) {
|
|
||||||
points = current;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
TraceManager.instance.remove(trace);
|
|
||||||
if (points == null) {
|
|
||||||
stop();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
TNTPoint current = points.getLast();
|
|
||||||
Vector velocity = current.getVelocity();
|
|
||||||
if (velocity.getX() < 0) velocity.setX(-velocity.getX());
|
|
||||||
if (velocity.getY() < 0) velocity.setY(-velocity.getY());
|
|
||||||
if (velocity.getZ() < 0) velocity.setZ(-velocity.getZ());
|
|
||||||
if (velocity.getX() > velocity.getY() && velocity.getX() > velocity.getZ()) {
|
|
||||||
data.direction = Direction.X;
|
|
||||||
} else if (velocity.getY() > velocity.getX() && velocity.getY() > velocity.getZ()) {
|
|
||||||
data.direction = Direction.Y;
|
|
||||||
} else if (velocity.getZ() > velocity.getX() && velocity.getZ() > velocity.getY()) {
|
|
||||||
data.direction = Direction.Z;
|
|
||||||
} else {
|
|
||||||
stop();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Bukkit.getLogger().log(StabData.LEVEL, "Direction: {0}", data.direction);
|
|
||||||
data.phases.getFirst().setOrder(SimulatorPhase.ORDER_LIMIT);
|
|
||||||
data.phases.getFirst().setCount(StabData.TNT_INCREASE);
|
|
||||||
new StabGenerator(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void bossbar(BauSystemBossbar bossbar, boolean finished) {
|
|
||||||
bossbar.setProgress(0);
|
|
||||||
bossbar.setTitle("§eCalculating Stab Direction");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-61
@@ -1,61 +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 <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.features.simulator.execute;
|
|
||||||
|
|
||||||
import de.steamwar.bausystem.features.tracer.Trace;
|
|
||||||
import de.steamwar.bausystem.features.tracer.TraceRecorder;
|
|
||||||
import de.steamwar.bausystem.region.flags.Flag;
|
|
||||||
import de.steamwar.bausystem.region.flags.flagvalues.ColorMode;
|
|
||||||
import de.steamwar.bausystem.region.utils.RegionExtensionType;
|
|
||||||
import de.steamwar.bausystem.region.utils.RegionType;
|
|
||||||
import de.steamwar.bausystem.utils.PasteBuilder;
|
|
||||||
import de.steamwar.bausystem.utils.bossbar.BauSystemBossbar;
|
|
||||||
|
|
||||||
public class StabFinalizer extends StabStep {
|
|
||||||
|
|
||||||
public StabFinalizer(StabData data) {
|
|
||||||
super(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void start() {
|
|
||||||
try {
|
|
||||||
PasteBuilder.ClipboardProvider clipboardProvider = new PasteBuilder.ClipboardProviderImpl(data.clipboard);
|
|
||||||
PasteBuilder pasteBuilder = new PasteBuilder(clipboardProvider)
|
|
||||||
.color(data.region.getPlain(Flag.COLOR, ColorMode.class).getColor());
|
|
||||||
data.region.reset(pasteBuilder, RegionType.TESTBLOCK, RegionExtensionType.EXTENSION);
|
|
||||||
} catch (SecurityException e) {
|
|
||||||
stop();
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
|
|
||||||
TraceRecorder.instance.startRecording(data.region);
|
|
||||||
runSimulator(() -> {
|
|
||||||
TraceRecorder.instance.stopRecording(data.region);
|
|
||||||
stop();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void bossbar(BauSystemBossbar bossbar, boolean stopped) {
|
|
||||||
bossbar.setProgress(Math.min(data.currentDepth / (double) data.depthLimit, 1.0));
|
|
||||||
bossbar.setTitle("§e" + data.currentDepth + "§8/§7" + data.depthLimit);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-250
@@ -1,250 +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 <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.features.simulator.execute;
|
|
||||||
|
|
||||||
import de.steamwar.bausystem.features.simulator.data.tnt.TNTPhase;
|
|
||||||
import de.steamwar.bausystem.region.Region;
|
|
||||||
import de.steamwar.bausystem.region.flags.Flag;
|
|
||||||
import de.steamwar.bausystem.region.flags.flagvalues.ColorMode;
|
|
||||||
import de.steamwar.bausystem.region.utils.RegionExtensionType;
|
|
||||||
import de.steamwar.bausystem.region.utils.RegionType;
|
|
||||||
import de.steamwar.bausystem.utils.PasteBuilder;
|
|
||||||
import de.steamwar.bausystem.utils.bossbar.BauSystemBossbar;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.HandlerList;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import static de.steamwar.bausystem.features.simulator.execute.Direction.Y;
|
|
||||||
|
|
||||||
public class StabGenerator extends StabStep implements Listener {
|
|
||||||
|
|
||||||
private int recordings = 0;
|
|
||||||
private List<Integer> currentDepths = new ArrayList<>();
|
|
||||||
private int lastDepth = 0;
|
|
||||||
|
|
||||||
private int retries = 0;
|
|
||||||
|
|
||||||
private final Map<Integer, Set<Location>> destroyedBlocksPerSlice = new HashMap<>();
|
|
||||||
|
|
||||||
private Set<Integer> gabStart = new HashSet<>();
|
|
||||||
private Set<TNTPhase> failedAtLeastOnce = new HashSet<>();
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onEntityExplode(EntityExplodeEvent event) {
|
|
||||||
if (Region.getRegion(event.getEntity().getLocation()) == data.region) {
|
|
||||||
event.blockList().forEach(block -> {
|
|
||||||
if (!data.region.inRegion(block.getLocation(), RegionType.TESTBLOCK, RegionExtensionType.EXTENSION)) return;
|
|
||||||
int component = data.direction.component.apply(block.getLocation().toVector());
|
|
||||||
destroyedBlocksPerSlice.computeIfAbsent(component, __ -> new HashSet<>())
|
|
||||||
.add(block.getLocation());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public StabGenerator(StabData data) {
|
|
||||||
super(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void start() {
|
|
||||||
try {
|
|
||||||
PasteBuilder.ClipboardProvider clipboardProvider = new PasteBuilder.ClipboardProviderImpl(data.clipboard);
|
|
||||||
PasteBuilder pasteBuilder = new PasteBuilder(clipboardProvider)
|
|
||||||
.color(data.region.getPlain(Flag.COLOR, ColorMode.class).getColor());
|
|
||||||
data.region.reset(pasteBuilder, RegionType.TESTBLOCK, RegionExtensionType.EXTENSION);
|
|
||||||
} catch (SecurityException e) {
|
|
||||||
stop();
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data.cancel) {
|
|
||||||
HandlerList.unregisterAll(this);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
runSimulator(this::calculateStab);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void calculateStab() {
|
|
||||||
TNTPhase lastPhase = data.phases.getLast();
|
|
||||||
|
|
||||||
List<Map.Entry<Integer, Set<Location>>> locations = destroyedBlocksPerSlice.entrySet()
|
|
||||||
.stream()
|
|
||||||
.sorted(Comparator.comparingInt(Map.Entry::getKey))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
int depth = 0;
|
|
||||||
for (int i = 0; i < locations.size(); i++) {
|
|
||||||
if (data.direction != Y && i > 0 && Math.abs(locations.get(i - 1).getKey() - locations.get(i).getKey()) > 3) {
|
|
||||||
if (gabStart.add(locations.get(i).getKey())) {
|
|
||||||
Bukkit.getLogger().log(StabData.LEVEL, "Increasing tnt count by {0} because of gap", StabData.TNT_INCREASE);
|
|
||||||
lastPhase.setCount(lastPhase.getCount() + StabData.TNT_INCREASE);
|
|
||||||
recordings = 0;
|
|
||||||
currentDepths.clear();
|
|
||||||
|
|
||||||
run();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (i == 0 || i == locations.size() - 1) {
|
|
||||||
if (locations.get(i).getValue().size() > StabData.MIN_BLOCK_TO_COUNT_AS_DEPTH) {
|
|
||||||
depth++;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
depth++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (depth > 0) {
|
|
||||||
Bukkit.getLogger().log(StabData.LEVEL, "{0} {1} {2}", new Object[]{depth, destroyedBlocksPerSlice.size(), destroyedBlocksPerSlice.values().stream().map(Set::size).collect(Collectors.toList())});
|
|
||||||
destroyedBlocksPerSlice.clear();
|
|
||||||
currentDepths.add(depth);
|
|
||||||
} else {
|
|
||||||
destroyedBlocksPerSlice.clear();
|
|
||||||
lastPhase.setTickOffset(lastPhase.getTickOffset() + 1);
|
|
||||||
Bukkit.getLogger().log(StabData.LEVEL, "No dimension - Increasing tickOffset to: {0}", lastPhase.getTickOffset());
|
|
||||||
lastPhase.setOrder(0);
|
|
||||||
if (lastPhase.getTickOffset() > 80) {
|
|
||||||
stop();
|
|
||||||
} else {
|
|
||||||
run();
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int minDepth = currentDepths.stream().min(Integer::compareTo).orElse(0);
|
|
||||||
int maxDepth = currentDepths.stream().max(Integer::compareTo).orElse(0);
|
|
||||||
data.currentDepth = maxDepth;
|
|
||||||
|
|
||||||
int countWithoutLast = 0;
|
|
||||||
for (int i = 0; i < data.phases.size() - 1; i++) {
|
|
||||||
countWithoutLast += data.phases.get(i).getCount();
|
|
||||||
}
|
|
||||||
countWithoutLast -= gabStart.size();
|
|
||||||
|
|
||||||
boolean moreTNTNeeded = maxDepth - countWithoutLast >= lastPhase.getCount() - 5;
|
|
||||||
if (moreTNTNeeded) {
|
|
||||||
Bukkit.getLogger().log(StabData.LEVEL, "Increasing tnt count by {0}", StabData.TNT_INCREASE);
|
|
||||||
lastPhase.setCount(lastPhase.getCount() + StabData.TNT_INCREASE);
|
|
||||||
recordings = 0;
|
|
||||||
currentDepths.clear();
|
|
||||||
|
|
||||||
run();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (recordings++ < StabData.MAX_RECORDINGS) {
|
|
||||||
run();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
recordings = 0;
|
|
||||||
currentDepths.clear();
|
|
||||||
|
|
||||||
if (maxDepth - minDepth > lastPhase.getCount()) {
|
|
||||||
Bukkit.getLogger().log(StabData.LEVEL, "Stab failed at least once. Adding one tnt to {0}", minDepth - 3);
|
|
||||||
int current = 0;
|
|
||||||
TNTPhase last = null;
|
|
||||||
for (TNTPhase phase : data.phases) {
|
|
||||||
if (current < minDepth - 3) {
|
|
||||||
current += phase.getCount();
|
|
||||||
last = phase;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (failedAtLeastOnce.add(last)) {
|
|
||||||
last = null;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (last != null) {
|
|
||||||
last.setCount(last.getCount() + 1);
|
|
||||||
Bukkit.getLogger().log(StabData.LEVEL, "Added to phase {0} now has {1} tnt", new Object[]{data.phases.indexOf(last), last.getCount()});
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (last != null) {
|
|
||||||
run();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Bukkit.getLogger().log(StabData.LEVEL, "No more TNT needed on phase adjusting - {0} new count; {1} current count", new Object[]{maxDepth - countWithoutLast, lastPhase.getCount()});
|
|
||||||
lastPhase.setCount(maxDepth - countWithoutLast);
|
|
||||||
if (lastPhase.getCount() <= 0) {
|
|
||||||
Bukkit.getLogger().log(StabData.LEVEL, "Count was 0 or negative - removing last phase");
|
|
||||||
data.phases.removeLast();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (maxDepth > data.depthLimit) {
|
|
||||||
Bukkit.getLogger().log(StabData.LEVEL, "Depth is greater than {0} - finished", data.depthLimit);
|
|
||||||
new StabFinalizer(data);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (maxDepth <= lastDepth) {
|
|
||||||
if (lastPhase.getCount() <= 0) {
|
|
||||||
retries++;
|
|
||||||
}
|
|
||||||
if (lastPhase.getCount() > 0 || retries > StabData.MAX_TICK_DIFFERENCE) {
|
|
||||||
Bukkit.getLogger().log(StabData.LEVEL, "Depth is equal to last depth recorded {0} - finished", maxDepth);
|
|
||||||
new StabFinalizer(data);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
lastDepth = maxDepth;
|
|
||||||
|
|
||||||
newPhase(data, lastPhase);
|
|
||||||
run();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void newPhase(StabData data, TNTPhase lastPhase) {
|
|
||||||
Bukkit.getLogger().log(StabData.LEVEL, "Adding new phase in next tick");
|
|
||||||
TNTPhase nextPhase = new TNTPhase();
|
|
||||||
nextPhase.setCount(StabData.TNT_INCREASE);
|
|
||||||
nextPhase.setTickOffset(lastPhase.getTickOffset() + 1);
|
|
||||||
nextPhase.setXJump(lastPhase.isXJump());
|
|
||||||
nextPhase.setYJump(lastPhase.isYJump());
|
|
||||||
nextPhase.setZJump(lastPhase.isZJump());
|
|
||||||
data.phases.add(nextPhase);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void bossbar(BauSystemBossbar bossbar, boolean finished) {
|
|
||||||
bossbar.setProgress(Math.min(data.currentDepth / (double) data.depthLimit, 1.0));
|
|
||||||
if (finished) {
|
|
||||||
bossbar.setTitle("§e" + data.currentDepth + "§8/§7" + data.depthLimit);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
StringBuilder st = new StringBuilder();
|
|
||||||
st.append("§7Direction §e").append(data.direction);
|
|
||||||
st.append(" §e").append(data.currentDepth).append("§8/§7").append(data.depthLimit);
|
|
||||||
if (recordings > 0) {
|
|
||||||
st.append(" §7Retries§8:§e ").append(recordings).append("§8/§7").append(StabData.MAX_RECORDINGS);
|
|
||||||
}
|
|
||||||
bossbar.setTitle(st.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-85
@@ -1,85 +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 <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.features.simulator.execute;
|
|
||||||
|
|
||||||
import de.steamwar.bausystem.features.simulator.data.SimulatorGroup;
|
|
||||||
import de.steamwar.bausystem.features.simulator.data.tnt.TNTElement;
|
|
||||||
import de.steamwar.bausystem.features.simulator.data.tnt.TNTPhase;
|
|
||||||
import de.steamwar.bausystem.features.tracer.TraceRecorder;
|
|
||||||
import de.steamwar.bausystem.utils.FlatteningWrapper;
|
|
||||||
import de.steamwar.bausystem.utils.bossbar.BauSystemBossbar;
|
|
||||||
|
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
public class StabSetup extends StabStep {
|
|
||||||
|
|
||||||
public StabSetup(StabData data) {
|
|
||||||
super(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void start() {
|
|
||||||
TNTPhase tntPhase = data.simulator.getGroups().stream()
|
|
||||||
.filter(simulatorGroup -> !simulatorGroup.isDisabled())
|
|
||||||
.map(SimulatorGroup::getElements)
|
|
||||||
.flatMap(List::stream)
|
|
||||||
.filter(TNTElement.class::isInstance)
|
|
||||||
.map(TNTElement.class::cast)
|
|
||||||
.filter(tntElement -> !tntElement.isDisabled())
|
|
||||||
.filter(tntElement -> data.tntElement != tntElement)
|
|
||||||
.map(tntElement -> tntElement.getPhases().stream().max(Comparator.comparingInt(TNTPhase::getTickOffset)))
|
|
||||||
.filter(Optional::isPresent)
|
|
||||||
.map(Optional::get)
|
|
||||||
.peek(phase -> {
|
|
||||||
if (phase.getOrder() > TNTPhase.ORDER_LIMIT) {
|
|
||||||
phase.setOrder(TNTPhase.ORDER_LIMIT);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.filter(phase -> phase != data.phases.get(0))
|
|
||||||
.max(Comparator.comparingInt(TNTPhase::getTickOffset))
|
|
||||||
.orElse(null);
|
|
||||||
if (tntPhase == null) {
|
|
||||||
throw new SecurityException("");
|
|
||||||
}
|
|
||||||
|
|
||||||
TNTPhase phase = data.phases.get(0);
|
|
||||||
data.phases.clear();
|
|
||||||
data.phases.add(phase);
|
|
||||||
phase.setCount(1);
|
|
||||||
phase.setTickOffset(tntPhase.getTickOffset());
|
|
||||||
phase.setOrder(100);
|
|
||||||
|
|
||||||
TraceRecorder.instance.stopRecording(data.region);
|
|
||||||
if (TraceRecorder.instance.isAutoTraceEnabledInRegion(data.region)) {
|
|
||||||
TraceRecorder.instance.removeAutoTraceRegion(data.region);
|
|
||||||
}
|
|
||||||
data.clipboard = FlatteningWrapper.impl.copy(data.region.getMinPointTestblockExtension(), data.region.getMaxPointTestblockExtension(), data.region.getTestBlockPoint());
|
|
||||||
|
|
||||||
new StabDirection(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void bossbar(BauSystemBossbar bossbar, boolean finished) {
|
|
||||||
bossbar.setProgress(0);
|
|
||||||
bossbar.setTitle("§eSetting up Simulator");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-95
@@ -1,95 +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 <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.features.simulator.execute;
|
|
||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
|
||||||
import de.steamwar.bausystem.features.simulator.SimulatorWatcher;
|
|
||||||
import de.steamwar.bausystem.utils.bossbar.BauSystemBossbar;
|
|
||||||
import de.steamwar.bausystem.utils.bossbar.BossBarService;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.boss.BarColor;
|
|
||||||
import org.bukkit.boss.BarStyle;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.HandlerList;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
|
|
||||||
public abstract class StabStep {
|
|
||||||
|
|
||||||
protected final StabData data;
|
|
||||||
|
|
||||||
protected StabStep(StabData data) {
|
|
||||||
this.data = data;
|
|
||||||
run();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected final void run() {
|
|
||||||
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
|
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
|
||||||
BauSystemBossbar bossbar = BossBarService.instance.get(player, data.region, "simulator_stab_generator");
|
|
||||||
bossbar.setColor(BarColor.GREEN);
|
|
||||||
bossbar.setStyle(BarStyle.SEGMENTED_10);
|
|
||||||
bossbar(bossbar, false);
|
|
||||||
}
|
|
||||||
}, 1);
|
|
||||||
|
|
||||||
if (this instanceof Listener) {
|
|
||||||
Bukkit.getPluginManager().registerEvents((Listener) this, BauSystem.getInstance());
|
|
||||||
}
|
|
||||||
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), this::start, 20);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected abstract void start();
|
|
||||||
|
|
||||||
protected final void runSimulator(Runnable onFinish) {
|
|
||||||
SimulatorExecutor.run(data.simulator, () -> {
|
|
||||||
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
|
|
||||||
if (this instanceof Listener) {
|
|
||||||
HandlerList.unregisterAll((Listener) this);
|
|
||||||
}
|
|
||||||
onFinish.run();
|
|
||||||
}, 20);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
protected abstract void bossbar(BauSystemBossbar bossbar, boolean stopped);
|
|
||||||
|
|
||||||
protected final void stop() {
|
|
||||||
data.simulator.setStabGenerator(null);
|
|
||||||
SimulatorWatcher.update(data.simulator);
|
|
||||||
|
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
|
||||||
BauSystemBossbar bossbar = BossBarService.instance.get(player, data.region, "simulator_stab_generator");
|
|
||||||
bossbar.setColor(BarColor.GREEN);
|
|
||||||
bossbar.setStyle(BarStyle.SEGMENTED_10);
|
|
||||||
bossbar(bossbar, true);
|
|
||||||
}
|
|
||||||
new Thread(() -> {
|
|
||||||
try {
|
|
||||||
Thread.sleep(4000);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
Thread.currentThread().interrupt();
|
|
||||||
} finally {
|
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
|
||||||
BossBarService.instance.remove(player, data.region, "simulator_stab_generator");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}).start();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+4
-5
@@ -25,7 +25,6 @@ import de.steamwar.bausystem.features.simulator.data.SimulatorElement;
|
|||||||
import de.steamwar.bausystem.features.simulator.data.SimulatorGroup;
|
import de.steamwar.bausystem.features.simulator.data.SimulatorGroup;
|
||||||
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
|
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
|
||||||
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorPageGui;
|
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorPageGui;
|
||||||
import de.steamwar.data.CMDs;
|
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -71,12 +70,12 @@ public class SimulatorGroupGui extends SimulatorPageGui<SimulatorElement<?>> {
|
|||||||
|
|
||||||
inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> {
|
inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> {
|
||||||
back.open();
|
back.open();
|
||||||
}).setCustomModelData(CMDs.BACK));
|
}));
|
||||||
|
|
||||||
inventory.setItem(8, new SWItem(Material.BARRIER, "§eDelete", clickType -> {
|
inventory.setItem(8, new SWItem(Material.BARRIER, "§eDelete", clickType -> {
|
||||||
simulatorGroup.getElements().clear();
|
simulatorGroup.getElements().clear();
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DELETE));
|
}));
|
||||||
|
|
||||||
inventory.setItem(4, simulatorGroup.toItem(player, clickType -> {
|
inventory.setItem(4, simulatorGroup.toItem(player, clickType -> {
|
||||||
if (simulatorGroup.getMaterial() == null) return;
|
if (simulatorGroup.getMaterial() == null) return;
|
||||||
@@ -86,7 +85,7 @@ public class SimulatorGroupGui extends SimulatorPageGui<SimulatorElement<?>> {
|
|||||||
|
|
||||||
inventory.setItem(48, new SWItem(Material.REPEATER, "§eSettings", clickType -> {
|
inventory.setItem(48, new SWItem(Material.REPEATER, "§eSettings", clickType -> {
|
||||||
new SimulatorGroupSettingsGui(player, simulator, simulatorGroup, this).open();
|
new SimulatorGroupSettingsGui(player, simulator, simulatorGroup, this).open();
|
||||||
}).setCustomModelData(CMDs.Simulator.SETTINGS));
|
}));
|
||||||
boolean disabled = simulatorGroup.getMaterial() == null ? simulatorGroup.getElements().stream().allMatch(SimulatorElement::isDisabled) : simulatorGroup.isDisabled();
|
boolean disabled = simulatorGroup.getMaterial() == null ? simulatorGroup.getElements().stream().allMatch(SimulatorElement::isDisabled) : simulatorGroup.isDisabled();
|
||||||
inventory.setItem(50, new SWItem(disabled ? Material.ENDER_PEARL : Material.ENDER_EYE, simulatorGroup.isDisabled() ? "§cDisabled" : "§aEnabled", clickType -> {
|
inventory.setItem(50, new SWItem(disabled ? Material.ENDER_PEARL : Material.ENDER_EYE, simulatorGroup.isDisabled() ? "§cDisabled" : "§aEnabled", clickType -> {
|
||||||
if (simulatorGroup.getMaterial() == null) {
|
if (simulatorGroup.getMaterial() == null) {
|
||||||
@@ -97,7 +96,7 @@ public class SimulatorGroupGui extends SimulatorPageGui<SimulatorElement<?>> {
|
|||||||
simulatorGroup.setDisabled(!disabled);
|
simulatorGroup.setDisabled(!disabled);
|
||||||
}
|
}
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.ENABLED_OR_DISABLED));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+18
-18
@@ -25,10 +25,10 @@ import de.steamwar.bausystem.features.simulator.data.SimulatorGroup;
|
|||||||
import de.steamwar.bausystem.features.simulator.data.tnt.TNTElement;
|
import de.steamwar.bausystem.features.simulator.data.tnt.TNTElement;
|
||||||
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorAnvilGui;
|
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorAnvilGui;
|
||||||
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
|
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
|
||||||
import de.steamwar.data.CMDs;
|
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ public class SimulatorGroupSettingsGui extends SimulatorBaseGui {
|
|||||||
// Back Arrow
|
// Back Arrow
|
||||||
inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> {
|
inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> {
|
||||||
back.open();
|
back.open();
|
||||||
}).setCustomModelData(CMDs.BACK));
|
}));
|
||||||
|
|
||||||
// Material Chooser
|
// Material Chooser
|
||||||
inventory.setItem(4, simulatorGroup.toItem(player, clickType -> {
|
inventory.setItem(4, simulatorGroup.toItem(player, clickType -> {
|
||||||
@@ -69,10 +69,10 @@ public class SimulatorGroupSettingsGui extends SimulatorBaseGui {
|
|||||||
|
|
||||||
// Base Tick
|
// Base Tick
|
||||||
int baseTicks = simulatorGroup.getBaseTick();
|
int baseTicks = simulatorGroup.getBaseTick();
|
||||||
inventory.setItem(9, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(9, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
simulatorGroup.changeBaseTicks(clickType.isShiftClick() ? 5 : 1);
|
simulatorGroup.changeBaseTicks(clickType.isShiftClick() ? 5 : 1);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
});
|
||||||
SWItem baseTick = new SWItem(Material.REPEATER, "§eTicks§8:§7 " + baseTicks, clickType -> {
|
SWItem baseTick = new SWItem(Material.REPEATER, "§eTicks§8:§7 " + baseTicks, clickType -> {
|
||||||
new SimulatorAnvilGui<>(player, "Ticks", baseTicks + "", Integer::parseInt, integer -> {
|
new SimulatorAnvilGui<>(player, "Ticks", baseTicks + "", Integer::parseInt, integer -> {
|
||||||
if (integer < 0) return false;
|
if (integer < 0) return false;
|
||||||
@@ -83,14 +83,14 @@ public class SimulatorGroupSettingsGui extends SimulatorBaseGui {
|
|||||||
});
|
});
|
||||||
baseTick.getItemStack().setAmount(Math.max(1, Math.min(baseTicks, 64)));
|
baseTick.getItemStack().setAmount(Math.max(1, Math.min(baseTicks, 64)));
|
||||||
inventory.setItem(18, baseTick);
|
inventory.setItem(18, baseTick);
|
||||||
inventory.setItem(27, new SWItem(SWItem.getDye(baseTicks > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(27, SWItem.getDye(baseTicks > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
if (baseTicks - (clickType.isShiftClick() ? 5 : 1) < 0) {
|
if (baseTicks - (clickType.isShiftClick() ? 5 : 1) < 0) {
|
||||||
simulatorGroup.changeBaseTicks(-baseTicks);
|
simulatorGroup.changeBaseTicks(-baseTicks);
|
||||||
} else {
|
} else {
|
||||||
simulatorGroup.changeBaseTicks(clickType.isShiftClick() ? -5 : -1);
|
simulatorGroup.changeBaseTicks(clickType.isShiftClick() ? -5 : -1);
|
||||||
}
|
}
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
});
|
||||||
|
|
||||||
boolean allTNT = simulatorGroup.getElements().stream().allMatch(TNTElement.class::isInstance);
|
boolean allTNT = simulatorGroup.getElements().stream().allMatch(TNTElement.class::isInstance);
|
||||||
|
|
||||||
@@ -163,10 +163,10 @@ public class SimulatorGroupSettingsGui extends SimulatorBaseGui {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Pos X
|
//Pos X
|
||||||
inventory.setItem(15, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList(allTNT ? "§7Shift§8: §e+0.0625" : "§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(15, SWItem.getDye(10), "§e+1", Arrays.asList(allTNT ? "§7Shift§8: §e+0.0625" : "§7Shift§8: §e+5"), false, clickType -> {
|
||||||
simulatorGroup.move(clickType.isShiftClick() ? (allTNT ? 0.0625 : 5) : 1, 0, 0);
|
simulatorGroup.move(clickType.isShiftClick() ? (allTNT ? 0.0625 : 5) : 1, 0, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
});
|
||||||
inventory.setItem(24, new SWItem(Material.PAPER, "§eX", clickType -> {
|
inventory.setItem(24, new SWItem(Material.PAPER, "§eX", clickType -> {
|
||||||
new SimulatorAnvilGui<>(player, "Relative X", "", Double::parseDouble, number -> {
|
new SimulatorAnvilGui<>(player, "Relative X", "", Double::parseDouble, number -> {
|
||||||
if(!allTNT){
|
if(!allTNT){
|
||||||
@@ -177,16 +177,16 @@ public class SimulatorGroupSettingsGui extends SimulatorBaseGui {
|
|||||||
return true;
|
return true;
|
||||||
}, this).setItem(Material.PAPER).open();
|
}, this).setItem(Material.PAPER).open();
|
||||||
}));
|
}));
|
||||||
inventory.setItem(33, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList(allTNT ? "§7Shift§8: §e-0.0625" : "§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(33, SWItem.getDye(1), "§e-1", Arrays.asList(allTNT ? "§7Shift§8: §e-0.0625" : "§7Shift§8: §e-5"), false, clickType -> {
|
||||||
simulatorGroup.move(clickType.isShiftClick() ? (allTNT ? -0.0625 : -5) : -1, 0, 0);
|
simulatorGroup.move(clickType.isShiftClick() ? (allTNT ? -0.0625 : -5) : -1, 0, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
});
|
||||||
|
|
||||||
//Pos Y
|
//Pos Y
|
||||||
inventory.setItem(16, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList(allTNT ? "§7Shift§8: §e+0.0625" : "§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(16, SWItem.getDye(10), "§e+1", Arrays.asList(allTNT ? "§7Shift§8: §e+0.0625" : "§7Shift§8: §e+5"), false, clickType -> {
|
||||||
simulatorGroup.move(0, clickType.isShiftClick() ? (allTNT ? 0.0625 : 5) : 1, 0);
|
simulatorGroup.move(0, clickType.isShiftClick() ? (allTNT ? 0.0625 : 5) : 1, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
});
|
||||||
inventory.setItem(25, new SWItem(Material.PAPER, "§eY", clickType -> {
|
inventory.setItem(25, new SWItem(Material.PAPER, "§eY", clickType -> {
|
||||||
new SimulatorAnvilGui<>(player, "Relative Y", "", Double::parseDouble, number -> {
|
new SimulatorAnvilGui<>(player, "Relative Y", "", Double::parseDouble, number -> {
|
||||||
if(!allTNT){
|
if(!allTNT){
|
||||||
@@ -197,16 +197,16 @@ public class SimulatorGroupSettingsGui extends SimulatorBaseGui {
|
|||||||
return true;
|
return true;
|
||||||
}, this).setItem(Material.PAPER).open();
|
}, this).setItem(Material.PAPER).open();
|
||||||
}));
|
}));
|
||||||
inventory.setItem(34, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList(allTNT ? "§7Shift§8: §e-0.0625" : "§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(34, SWItem.getDye(1), "§e-1", Arrays.asList(allTNT ? "§7Shift§8: §e-0.0625" : "§7Shift§8: §e-5"), false, clickType -> {
|
||||||
simulatorGroup.move(0, clickType.isShiftClick() ? (allTNT ? -0.0625 : -5) : -1, 0);
|
simulatorGroup.move(0, clickType.isShiftClick() ? (allTNT ? -0.0625 : -5) : -1, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.ENABLED_OR_DISABLED));
|
});
|
||||||
|
|
||||||
//Pos Z
|
//Pos Z
|
||||||
inventory.setItem(17, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList(allTNT ? "§7Shift§8: §e+0.0625" : "§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(17, SWItem.getDye(10), "§e+1", Arrays.asList(allTNT ? "§7Shift§8: §e+0.0625" : "§7Shift§8: §e+5"), false, clickType -> {
|
||||||
simulatorGroup.move(0, 0, clickType.isShiftClick() ? (allTNT ? 0.0625 : 5) : 1);
|
simulatorGroup.move(0, 0, clickType.isShiftClick() ? (allTNT ? 0.0625 : 5) : 1);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
});
|
||||||
inventory.setItem(26, new SWItem(Material.PAPER, "§eZ", clickType -> {
|
inventory.setItem(26, new SWItem(Material.PAPER, "§eZ", clickType -> {
|
||||||
new SimulatorAnvilGui<>(player, "Relative Z", "", Double::parseDouble, number -> {
|
new SimulatorAnvilGui<>(player, "Relative Z", "", Double::parseDouble, number -> {
|
||||||
if(!allTNT){
|
if(!allTNT){
|
||||||
@@ -217,9 +217,9 @@ public class SimulatorGroupSettingsGui extends SimulatorBaseGui {
|
|||||||
return true;
|
return true;
|
||||||
}, this).setItem(Material.PAPER).open();
|
}, this).setItem(Material.PAPER).open();
|
||||||
}));
|
}));
|
||||||
inventory.setItem(35, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList(allTNT ? "§7Shift§8: §e-0.0625" : "§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(35, SWItem.getDye(1), "§e-1", Arrays.asList(allTNT ? "§7Shift§8: §e-0.0625" : "§7Shift§8: §e-5"), false, clickType -> {
|
||||||
simulatorGroup.move(0, 0, clickType.isShiftClick() ? (allTNT ? -0.0625 : -5) : -1);
|
simulatorGroup.move(0, 0, clickType.isShiftClick() ? (allTNT ? -0.0625 : -5) : -1);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-2
@@ -24,7 +24,6 @@ import de.steamwar.bausystem.features.simulator.data.Simulator;
|
|||||||
import de.steamwar.bausystem.features.simulator.data.SimulatorElement;
|
import de.steamwar.bausystem.features.simulator.data.SimulatorElement;
|
||||||
import de.steamwar.bausystem.features.simulator.data.SimulatorGroup;
|
import de.steamwar.bausystem.features.simulator.data.SimulatorGroup;
|
||||||
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorPageGui;
|
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorPageGui;
|
||||||
import de.steamwar.data.CMDs;
|
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -51,7 +50,7 @@ public class SimulatorGui extends SimulatorPageGui<SimulatorGroup> {
|
|||||||
}));
|
}));
|
||||||
inventory.setItem(49, new SWItem(Material.REPEATER, "§eSettings", clickType -> {
|
inventory.setItem(49, new SWItem(Material.REPEATER, "§eSettings", clickType -> {
|
||||||
new SimulatorSettingsGui(player, simulator, this).open();
|
new SimulatorSettingsGui(player, simulator, this).open();
|
||||||
}).setCustomModelData(CMDs.Simulator.SETTINGS));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+1
-12
@@ -23,7 +23,6 @@ import de.steamwar.bausystem.features.simulator.SimulatorWatcher;
|
|||||||
import de.steamwar.bausystem.features.simulator.data.Simulator;
|
import de.steamwar.bausystem.features.simulator.data.Simulator;
|
||||||
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
|
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
|
||||||
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorPageGui;
|
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorPageGui;
|
||||||
import de.steamwar.data.CMDs;
|
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -54,16 +53,6 @@ public class SimulatorMaterialGui extends SimulatorPageGui<Material> {
|
|||||||
this.back = back;
|
this.back = back;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldOpen() {
|
|
||||||
if (player.getItemOnCursor().getType().isAir()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
change.accept(player.getItemOnCursor().getType());
|
|
||||||
SimulatorWatcher.update(simulator);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String baseTitle() {
|
public String baseTitle() {
|
||||||
return "Material";
|
return "Material";
|
||||||
@@ -76,7 +65,7 @@ public class SimulatorMaterialGui extends SimulatorPageGui<Material> {
|
|||||||
}));
|
}));
|
||||||
inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> {
|
inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> {
|
||||||
back.open();
|
back.open();
|
||||||
}).setCustomModelData(CMDs.BACK));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+11
-12
@@ -26,7 +26,6 @@ import de.steamwar.bausystem.features.simulator.data.observer.ObserverElement;
|
|||||||
import de.steamwar.bausystem.features.simulator.data.observer.ObserverPhase;
|
import de.steamwar.bausystem.features.simulator.data.observer.ObserverPhase;
|
||||||
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
|
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
|
||||||
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorScrollGui;
|
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorScrollGui;
|
||||||
import de.steamwar.data.CMDs;
|
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -83,12 +82,12 @@ public class SimulatorObserverGui extends SimulatorScrollGui<ObserverPhase> {
|
|||||||
new SimulatorGroupGui(player, simulator, newParent, simulatorGui).open();
|
new SimulatorGroupGui(player, simulator, newParent, simulatorGui).open();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).setCustomModelData(CMDs.BACK));
|
}));
|
||||||
|
|
||||||
inventory.setItem(8, new SWItem(Material.BARRIER, "§eDelete", clickType -> {
|
inventory.setItem(8, new SWItem(Material.BARRIER, "§eDelete", clickType -> {
|
||||||
observer.getPhases().clear();
|
observer.getPhases().clear();
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DELETE));
|
}));
|
||||||
|
|
||||||
// Material Chooser
|
// Material Chooser
|
||||||
inventory.setItem(4, observer.toItem(player, clickType -> {
|
inventory.setItem(4, observer.toItem(player, clickType -> {
|
||||||
@@ -98,18 +97,18 @@ public class SimulatorObserverGui extends SimulatorScrollGui<ObserverPhase> {
|
|||||||
// Settings
|
// Settings
|
||||||
inventory.setItem(47, new SWItem(Material.REPEATER, "§eSettings", clickType -> {
|
inventory.setItem(47, new SWItem(Material.REPEATER, "§eSettings", clickType -> {
|
||||||
new SimulatorObserverSettingsGui(player, simulator, observer, this).open();
|
new SimulatorObserverSettingsGui(player, simulator, observer, this).open();
|
||||||
}).setCustomModelData(CMDs.Simulator.SETTINGS));
|
}));
|
||||||
|
|
||||||
// Enable/Disable
|
// Enable/Disable
|
||||||
inventory.setItem(48, new SWItem(observer.isDisabled() ? Material.ENDER_PEARL : Material.ENDER_EYE, observer.isDisabled() ? "§cDisabled" : "§aEnabled", clickType -> {
|
inventory.setItem(48, new SWItem(observer.isDisabled() ? Material.ENDER_PEARL : Material.ENDER_EYE, observer.isDisabled() ? "§cDisabled" : "§aEnabled", clickType -> {
|
||||||
observer.setDisabled(!observer.isDisabled());
|
observer.setDisabled(!observer.isDisabled());
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.ENABLED_OR_DISABLED));
|
}));
|
||||||
|
|
||||||
// Group chooser
|
// Group chooser
|
||||||
inventory.setItem(51, new SWItem(Material.LEAD, "§eJoin Group", clickType -> {
|
inventory.setItem(51, new SWItem(Material.LEAD, "§eJoin Group", clickType -> {
|
||||||
new SimulatorGroupChooserGui(player, simulator, observer, observer.getGroup(simulator), this).open();
|
new SimulatorGroupChooserGui(player, simulator, observer, observer.getGroup(simulator), this).open();
|
||||||
}).setCustomModelData(CMDs.Simulator.JOIN_GROUP));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -152,15 +151,15 @@ public class SimulatorObserverGui extends SimulatorScrollGui<ObserverPhase> {
|
|||||||
new SWItem(SWItem.getDye(getter.get() < max ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
|
new SWItem(SWItem.getDye(getter.get() < max ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
|
||||||
setter.accept(Math.min(max, getter.get() + (clickType.isShiftClick() ? 5 : 1)));
|
setter.accept(Math.min(max, getter.get() + (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED),
|
}),
|
||||||
observer,
|
observer,
|
||||||
new SWItem(SWItem.getDye(getter.get() > min ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8:§e -5"), false, clickType -> {
|
new SWItem(SWItem.getDye(getter.get() > min ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8:§e -5"), false, clickType -> {
|
||||||
setter.accept(Math.max(min, getter.get() - (clickType.isShiftClick() ? 5 : 1)));
|
setter.accept(Math.max(min, getter.get() - (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED),
|
}),
|
||||||
new SWItem(Material.ANVIL, "§eEdit Activation", clickType -> {
|
new SWItem(Material.ANVIL, "§eEdit Activation", clickType -> {
|
||||||
new SimulatorObserverPhaseSettingsGui(player, simulator, this.observer, observerPhase, this).open();
|
new SimulatorObserverPhaseSettingsGui(player, simulator, this.observer, observerPhase, this).open();
|
||||||
}).setCustomModelData(CMDs.Simulator.EDIT_ACTIVATION),
|
}),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,12 +168,12 @@ public class SimulatorObserverGui extends SimulatorScrollGui<ObserverPhase> {
|
|||||||
return new SWItem[]{
|
return new SWItem[]{
|
||||||
new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
|
new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
|
||||||
addNewPhase(clickType.isShiftClick());
|
addNewPhase(clickType.isShiftClick());
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED),
|
}),
|
||||||
new SWItem(Material.QUARTZ, "§eObserver§8:§a New Phase", clickType -> {
|
new SWItem(Material.QUARTZ, "§eObserver§8:§a New Phase", clickType -> {
|
||||||
addNewPhase(false);
|
addNewPhase(false);
|
||||||
}).setCustomModelData(CMDs.Simulator.NEW_PHASE),
|
}),
|
||||||
new SWItem(SWItem.getDye(8), "§7", clickType -> {
|
new SWItem(SWItem.getDye(8), "§7", clickType -> {
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED),
|
}),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+10
-11
@@ -27,7 +27,6 @@ import de.steamwar.bausystem.features.simulator.data.observer.ObserverPhase;
|
|||||||
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorAnvilGui;
|
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorAnvilGui;
|
||||||
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
|
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
|
||||||
import de.steamwar.core.Core;
|
import de.steamwar.core.Core;
|
||||||
import de.steamwar.data.CMDs;
|
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
@@ -63,7 +62,7 @@ public class SimulatorObserverPhaseSettingsGui extends SimulatorBaseGui {
|
|||||||
// Back Arrow
|
// Back Arrow
|
||||||
inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> {
|
inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> {
|
||||||
back.open();
|
back.open();
|
||||||
}).setCustomModelData(CMDs.BACK));
|
}));
|
||||||
|
|
||||||
// Material Chooser
|
// Material Chooser
|
||||||
inventory.setItem(4, observerElement.toItem(player, clickType -> {
|
inventory.setItem(4, observerElement.toItem(player, clickType -> {
|
||||||
@@ -75,7 +74,7 @@ public class SimulatorObserverPhaseSettingsGui extends SimulatorBaseGui {
|
|||||||
observerElement.getPhases().remove(observer);
|
observerElement.getPhases().remove(observer);
|
||||||
back.open();
|
back.open();
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DELETE));
|
}));
|
||||||
|
|
||||||
int index = observerElement.getPhases().indexOf(observer);
|
int index = observerElement.getPhases().indexOf(observer);
|
||||||
int min;
|
int min;
|
||||||
@@ -96,10 +95,10 @@ public class SimulatorObserverPhaseSettingsGui extends SimulatorBaseGui {
|
|||||||
|
|
||||||
//Tick Offset
|
//Tick Offset
|
||||||
int offset = observer.getTickOffset();
|
int offset = observer.getTickOffset();
|
||||||
inventory.setItem(10, new SWItem(SWItem.getDye(offset < max ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(10, SWItem.getDye(offset < max ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
observer.setTickOffset(Math.min(max, offset + (clickType.isShiftClick() ? 5 : 1)));
|
observer.setTickOffset(Math.min(max, offset + (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
});
|
||||||
|
|
||||||
SWItem offsetItem = new SWItem(Material.REPEATER, "§eStart at§8:§7 " + offset, clickType -> {
|
SWItem offsetItem = new SWItem(Material.REPEATER, "§eStart at§8:§7 " + offset, clickType -> {
|
||||||
new SimulatorAnvilGui<>(player, "Start at", offset + "", Integer::parseInt, integer -> {
|
new SimulatorAnvilGui<>(player, "Start at", offset + "", Integer::parseInt, integer -> {
|
||||||
@@ -112,17 +111,17 @@ public class SimulatorObserverPhaseSettingsGui extends SimulatorBaseGui {
|
|||||||
offsetItem.getItemStack().setAmount(Math.max(1, Math.min(offset, 64)));
|
offsetItem.getItemStack().setAmount(Math.max(1, Math.min(offset, 64)));
|
||||||
inventory.setItem(19, offsetItem);
|
inventory.setItem(19, offsetItem);
|
||||||
|
|
||||||
inventory.setItem(28, new SWItem(SWItem.getDye(offset > min ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(28, SWItem.getDye(offset > min ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
observer.setTickOffset(Math.max(min, offset - (clickType.isShiftClick() ? 5 : 1)));
|
observer.setTickOffset(Math.max(min, offset - (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
});
|
||||||
|
|
||||||
//Order
|
//Order
|
||||||
int order = observer.getOrder();
|
int order = observer.getOrder();
|
||||||
inventory.setItem(13, new SWItem(SWItem.getDye(order < SimulatorPhase.ORDER_LIMIT ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(13, SWItem.getDye(order < SimulatorPhase.ORDER_LIMIT ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
observer.setOrder(Math.min(SimulatorPhase.ORDER_LIMIT, order + (clickType.isShiftClick() ? 5 : 1)));
|
observer.setOrder(Math.min(SimulatorPhase.ORDER_LIMIT, order + (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
});
|
||||||
|
|
||||||
Material negativeNumbers = Material.getMaterial(Core.getVersion() >= 19 ? "RECOVERY_COMPASS" : "FIREWORK_STAR");
|
Material negativeNumbers = Material.getMaterial(Core.getVersion() >= 19 ? "RECOVERY_COMPASS" : "FIREWORK_STAR");
|
||||||
SWItem orderItem = new SWItem(order >= 0 ? Material.COMPASS : negativeNumbers, "§eActivation Order§8:§7 " + order, clickType -> {
|
SWItem orderItem = new SWItem(order >= 0 ? Material.COMPASS : negativeNumbers, "§eActivation Order§8:§7 " + order, clickType -> {
|
||||||
@@ -137,10 +136,10 @@ public class SimulatorObserverPhaseSettingsGui extends SimulatorBaseGui {
|
|||||||
orderItem.getItemStack().setAmount(Math.max(1, Math.min(Math.abs(order), 30)));
|
orderItem.getItemStack().setAmount(Math.max(1, Math.min(Math.abs(order), 30)));
|
||||||
inventory.setItem(22, orderItem);
|
inventory.setItem(22, orderItem);
|
||||||
|
|
||||||
inventory.setItem(31, new SWItem(SWItem.getDye(order > -SimulatorPhase.ORDER_LIMIT ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(31, SWItem.getDye(order > -SimulatorPhase.ORDER_LIMIT ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
observer.setOrder(Math.max(-SimulatorPhase.ORDER_LIMIT, order - (clickType.isShiftClick() ? 5 : 1)));
|
observer.setOrder(Math.max(-SimulatorPhase.ORDER_LIMIT, order - (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
});
|
||||||
|
|
||||||
// Update orientation
|
// Update orientation
|
||||||
inventory.setItem(25, new SWItem(Material.SUNFLOWER, "§7", clickType -> {
|
inventory.setItem(25, new SWItem(Material.SUNFLOWER, "§7", clickType -> {
|
||||||
|
|||||||
+17
-18
@@ -24,7 +24,6 @@ import de.steamwar.bausystem.features.simulator.data.Simulator;
|
|||||||
import de.steamwar.bausystem.features.simulator.data.observer.ObserverElement;
|
import de.steamwar.bausystem.features.simulator.data.observer.ObserverElement;
|
||||||
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorAnvilGui;
|
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorAnvilGui;
|
||||||
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
|
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
|
||||||
import de.steamwar.data.CMDs;
|
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -57,7 +56,7 @@ public class SimulatorObserverSettingsGui extends SimulatorBaseGui {
|
|||||||
// Back Arrow
|
// Back Arrow
|
||||||
inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> {
|
inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> {
|
||||||
back.open();
|
back.open();
|
||||||
}).setCustomModelData(CMDs.BACK));
|
}));
|
||||||
|
|
||||||
// Material Chooser
|
// Material Chooser
|
||||||
inventory.setItem(4, observer.toItem(player, clickType -> {
|
inventory.setItem(4, observer.toItem(player, clickType -> {
|
||||||
@@ -66,10 +65,10 @@ public class SimulatorObserverSettingsGui extends SimulatorBaseGui {
|
|||||||
|
|
||||||
// Base Tick
|
// Base Tick
|
||||||
int baseTicks = observer.getBaseTick();
|
int baseTicks = observer.getBaseTick();
|
||||||
inventory.setItem(9, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(9, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
observer.changeBaseTicks(clickType.isShiftClick() ? 5 : 1);
|
observer.changeBaseTicks(clickType.isShiftClick() ? 5 : 1);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
});
|
||||||
SWItem baseTick = new SWItem(Material.REPEATER, "§eTicks§8:§7 " + baseTicks, clickType -> {
|
SWItem baseTick = new SWItem(Material.REPEATER, "§eTicks§8:§7 " + baseTicks, clickType -> {
|
||||||
new SimulatorAnvilGui<>(player, "Ticks", baseTicks + "", Integer::parseInt, integer -> {
|
new SimulatorAnvilGui<>(player, "Ticks", baseTicks + "", Integer::parseInt, integer -> {
|
||||||
if (integer < 0) return false;
|
if (integer < 0) return false;
|
||||||
@@ -80,20 +79,20 @@ public class SimulatorObserverSettingsGui extends SimulatorBaseGui {
|
|||||||
});
|
});
|
||||||
baseTick.getItemStack().setAmount(Math.max(1, Math.min(baseTicks, 64)));
|
baseTick.getItemStack().setAmount(Math.max(1, Math.min(baseTicks, 64)));
|
||||||
inventory.setItem(18, baseTick);
|
inventory.setItem(18, baseTick);
|
||||||
inventory.setItem(27, new SWItem(SWItem.getDye(baseTicks > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(27, SWItem.getDye(baseTicks > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
if (baseTicks - (clickType.isShiftClick() ? 5 : 1) < 0) {
|
if (baseTicks - (clickType.isShiftClick() ? 5 : 1) < 0) {
|
||||||
observer.changeBaseTicks(-baseTicks);
|
observer.changeBaseTicks(-baseTicks);
|
||||||
} else {
|
} else {
|
||||||
observer.changeBaseTicks(clickType.isShiftClick() ? -5 : -1);
|
observer.changeBaseTicks(clickType.isShiftClick() ? -5 : -1);
|
||||||
}
|
}
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
});
|
||||||
|
|
||||||
//Pos X
|
//Pos X
|
||||||
inventory.setItem(15, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(15, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
observer.move(clickType.isShiftClick() ? 5 : 1, 0, 0);
|
observer.move(clickType.isShiftClick() ? 5 : 1, 0, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
});
|
||||||
inventory.setItem(24, new SWItem(Material.PAPER, "§eX§8:§7 " + observer.getPosition().getBlockX(), clickType -> {
|
inventory.setItem(24, new SWItem(Material.PAPER, "§eX§8:§7 " + observer.getPosition().getBlockX(), clickType -> {
|
||||||
new SimulatorAnvilGui<>(player, "X", observer.getPosition().getBlockX() + "", Integer::parseInt, i -> {
|
new SimulatorAnvilGui<>(player, "X", observer.getPosition().getBlockX() + "", Integer::parseInt, i -> {
|
||||||
observer.getPosition().setX(i);
|
observer.getPosition().setX(i);
|
||||||
@@ -101,16 +100,16 @@ public class SimulatorObserverSettingsGui extends SimulatorBaseGui {
|
|||||||
return true;
|
return true;
|
||||||
}, this).open();
|
}, this).open();
|
||||||
}));
|
}));
|
||||||
inventory.setItem(33, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(33, SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
observer.move(clickType.isShiftClick() ? -5 : -1, 0, 0);
|
observer.move(clickType.isShiftClick() ? -5 : -1, 0, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
});
|
||||||
|
|
||||||
//Pos Y
|
//Pos Y
|
||||||
inventory.setItem(16, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(16, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
observer.move(0, clickType.isShiftClick() ? 5 : 1, 0);
|
observer.move(0, clickType.isShiftClick() ? 5 : 1, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.ENABLED_OR_DISABLED));
|
});
|
||||||
inventory.setItem(25, new SWItem(Material.PAPER, "§eY§8:§7 " + observer.getPosition().getBlockY(), clickType -> {
|
inventory.setItem(25, new SWItem(Material.PAPER, "§eY§8:§7 " + observer.getPosition().getBlockY(), clickType -> {
|
||||||
new SimulatorAnvilGui<>(player, "Y", observer.getPosition().getBlockY() + "", Integer::parseInt, i -> {
|
new SimulatorAnvilGui<>(player, "Y", observer.getPosition().getBlockY() + "", Integer::parseInt, i -> {
|
||||||
observer.getPosition().setY(i);
|
observer.getPosition().setY(i);
|
||||||
@@ -118,16 +117,16 @@ public class SimulatorObserverSettingsGui extends SimulatorBaseGui {
|
|||||||
return true;
|
return true;
|
||||||
}, this).open();
|
}, this).open();
|
||||||
}));
|
}));
|
||||||
inventory.setItem(34, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(34, SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
observer.move(0, clickType.isShiftClick() ? -5 : -1, 0);
|
observer.move(0, clickType.isShiftClick() ? -5 : -1, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
});
|
||||||
|
|
||||||
//Pos Z
|
//Pos Z
|
||||||
inventory.setItem(17, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(17, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
observer.move(0, 0, clickType.isShiftClick() ? 5 : 1);
|
observer.move(0, 0, clickType.isShiftClick() ? 5 : 1);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.ENABLED_OR_DISABLED));
|
});
|
||||||
inventory.setItem(26, new SWItem(Material.PAPER, "§eZ§8:§7 " + observer.getPosition().getBlockZ(), clickType -> {
|
inventory.setItem(26, new SWItem(Material.PAPER, "§eZ§8:§7 " + observer.getPosition().getBlockZ(), clickType -> {
|
||||||
new SimulatorAnvilGui<>(player, "Z", observer.getPosition().getBlockZ() + "", Integer::parseInt, i -> {
|
new SimulatorAnvilGui<>(player, "Z", observer.getPosition().getBlockZ() + "", Integer::parseInt, i -> {
|
||||||
observer.getPosition().setZ(i);
|
observer.getPosition().setZ(i);
|
||||||
@@ -135,9 +134,9 @@ public class SimulatorObserverSettingsGui extends SimulatorBaseGui {
|
|||||||
return true;
|
return true;
|
||||||
}, this).open();
|
}, this).open();
|
||||||
}));
|
}));
|
||||||
inventory.setItem(35, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(35, SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
observer.move(0, 0, clickType.isShiftClick() ? -5 : -1);
|
observer.move(0, 0, clickType.isShiftClick() ? -5 : -1);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+11
-12
@@ -26,7 +26,6 @@ import de.steamwar.bausystem.features.simulator.data.redstone.RedstoneElement;
|
|||||||
import de.steamwar.bausystem.features.simulator.data.redstone.RedstonePhase;
|
import de.steamwar.bausystem.features.simulator.data.redstone.RedstonePhase;
|
||||||
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
|
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
|
||||||
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorScrollGui;
|
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorScrollGui;
|
||||||
import de.steamwar.data.CMDs;
|
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@@ -89,12 +88,12 @@ public class SimulatorRedstoneGui extends SimulatorScrollGui<SimulatorRedstoneGu
|
|||||||
new SimulatorGroupGui(player, simulator, newParent, simulatorGui).open();
|
new SimulatorGroupGui(player, simulator, newParent, simulatorGui).open();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).setCustomModelData(CMDs.BACK));
|
}));
|
||||||
|
|
||||||
inventory.setItem(8, new SWItem(Material.BARRIER, "§eDelete", clickType -> {
|
inventory.setItem(8, new SWItem(Material.BARRIER, "§eDelete", clickType -> {
|
||||||
redstone.getPhases().clear();
|
redstone.getPhases().clear();
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DELETE));
|
}));
|
||||||
|
|
||||||
// Material Chooser
|
// Material Chooser
|
||||||
inventory.setItem(4, redstone.toItem(player, clickType -> {
|
inventory.setItem(4, redstone.toItem(player, clickType -> {
|
||||||
@@ -104,18 +103,18 @@ public class SimulatorRedstoneGui extends SimulatorScrollGui<SimulatorRedstoneGu
|
|||||||
// Settings
|
// Settings
|
||||||
inventory.setItem(47, new SWItem(Material.REPEATER, "§eSettings", clickType -> {
|
inventory.setItem(47, new SWItem(Material.REPEATER, "§eSettings", clickType -> {
|
||||||
new SimulatorRedstoneSettingsGui(player, simulator, redstone, this).open();
|
new SimulatorRedstoneSettingsGui(player, simulator, redstone, this).open();
|
||||||
}).setCustomModelData(CMDs.Simulator.SETTINGS));
|
}));
|
||||||
|
|
||||||
// Enable/Disable
|
// Enable/Disable
|
||||||
inventory.setItem(48, new SWItem(redstone.isDisabled() ? Material.ENDER_PEARL : Material.ENDER_EYE, redstone.isDisabled() ? "§cDisabled" : "§aEnabled", clickType -> {
|
inventory.setItem(48, new SWItem(redstone.isDisabled() ? Material.ENDER_PEARL : Material.ENDER_EYE, redstone.isDisabled() ? "§cDisabled" : "§aEnabled", clickType -> {
|
||||||
redstone.setDisabled(!redstone.isDisabled());
|
redstone.setDisabled(!redstone.isDisabled());
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.ENABLED_OR_DISABLED));
|
}));
|
||||||
|
|
||||||
// Group chooser
|
// Group chooser
|
||||||
inventory.setItem(51, new SWItem(Material.LEAD, "§eJoin Group", clickType -> {
|
inventory.setItem(51, new SWItem(Material.LEAD, "§eJoin Group", clickType -> {
|
||||||
new SimulatorGroupChooserGui(player, simulator, redstone, redstone.getGroup(simulator), this).open();
|
new SimulatorGroupChooserGui(player, simulator, redstone, redstone.getGroup(simulator), this).open();
|
||||||
}).setCustomModelData(CMDs.Simulator.JOIN_GROUP));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -167,15 +166,15 @@ public class SimulatorRedstoneGui extends SimulatorScrollGui<SimulatorRedstoneGu
|
|||||||
new SWItem(SWItem.getDye(getter.get() < max ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
|
new SWItem(SWItem.getDye(getter.get() < max ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
|
||||||
setter.accept(Math.min(max, getter.get() + (clickType.isShiftClick() ? 5 : 1)));
|
setter.accept(Math.min(max, getter.get() + (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED),
|
}),
|
||||||
redstone,
|
redstone,
|
||||||
new SWItem(SWItem.getDye(getter.get() > min ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8:§e -5"), false, clickType -> {
|
new SWItem(SWItem.getDye(getter.get() > min ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8:§e -5"), false, clickType -> {
|
||||||
setter.accept(Math.max(min, getter.get() - (clickType.isShiftClick() ? 5 : 1)));
|
setter.accept(Math.max(min, getter.get() - (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED),
|
}),
|
||||||
new SWItem(Material.ANVIL, "§eEdit Activation", clickType -> {
|
new SWItem(Material.ANVIL, "§eEdit Activation", clickType -> {
|
||||||
new SimulatorRedstonePhaseSettingsGui(player, simulator, this.redstone, redstoneSubPhase.phase, this).open();
|
new SimulatorRedstonePhaseSettingsGui(player, simulator, this.redstone, redstoneSubPhase.phase, this).open();
|
||||||
}).setCustomModelData(CMDs.Simulator.EDIT_ACTIVATION),
|
}),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,12 +183,12 @@ public class SimulatorRedstoneGui extends SimulatorScrollGui<SimulatorRedstoneGu
|
|||||||
return new SWItem[]{
|
return new SWItem[]{
|
||||||
new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
|
new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
|
||||||
addNewPhase(clickType.isShiftClick());
|
addNewPhase(clickType.isShiftClick());
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED),
|
}),
|
||||||
new SWItem(Material.REDSTONE, "§eRedstone§8:§a New Phase", clickType -> {
|
new SWItem(Material.REDSTONE, "§eRedstone§8:§a New Phase", clickType -> {
|
||||||
addNewPhase(false);
|
addNewPhase(false);
|
||||||
}).setCustomModelData(CMDs.Simulator.NEW_PHASE),
|
}),
|
||||||
new SWItem(SWItem.getDye(8), "§7", clickType -> {
|
new SWItem(SWItem.getDye(8), "§7", clickType -> {
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED),
|
}),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+14
-15
@@ -27,7 +27,6 @@ import de.steamwar.bausystem.features.simulator.data.redstone.RedstonePhase;
|
|||||||
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorAnvilGui;
|
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorAnvilGui;
|
||||||
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
|
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
|
||||||
import de.steamwar.core.Core;
|
import de.steamwar.core.Core;
|
||||||
import de.steamwar.data.CMDs;
|
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -61,7 +60,7 @@ public class SimulatorRedstonePhaseSettingsGui extends SimulatorBaseGui {
|
|||||||
// Back Arrow
|
// Back Arrow
|
||||||
inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> {
|
inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> {
|
||||||
back.open();
|
back.open();
|
||||||
}).setCustomModelData(CMDs.BACK));
|
}));
|
||||||
|
|
||||||
// Material Chooser
|
// Material Chooser
|
||||||
inventory.setItem(4, redstoneElement.toItem(player, clickType -> {
|
inventory.setItem(4, redstoneElement.toItem(player, clickType -> {
|
||||||
@@ -73,7 +72,7 @@ public class SimulatorRedstonePhaseSettingsGui extends SimulatorBaseGui {
|
|||||||
redstoneElement.getPhases().remove(redstone);
|
redstoneElement.getPhases().remove(redstone);
|
||||||
back.open();
|
back.open();
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DELETE));
|
}));
|
||||||
|
|
||||||
int index = redstoneElement.getPhases().indexOf(redstone);
|
int index = redstoneElement.getPhases().indexOf(redstone);
|
||||||
int min;
|
int min;
|
||||||
@@ -97,10 +96,10 @@ public class SimulatorRedstonePhaseSettingsGui extends SimulatorBaseGui {
|
|||||||
|
|
||||||
//Tick Offset
|
//Tick Offset
|
||||||
int offset = redstone.getTickOffset();
|
int offset = redstone.getTickOffset();
|
||||||
inventory.setItem(10, new SWItem(SWItem.getDye(offset < maxOffset ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(10, SWItem.getDye(offset < maxOffset ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
redstone.setTickOffset(Math.min(maxOffset, offset + (clickType.isShiftClick() ? 5 : 1)));
|
redstone.setTickOffset(Math.min(maxOffset, offset + (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
});
|
||||||
|
|
||||||
SWItem offsetItem = new SWItem(Material.REPEATER, "§eStart at§8:§7 " + offset, clickType -> {
|
SWItem offsetItem = new SWItem(Material.REPEATER, "§eStart at§8:§7 " + offset, clickType -> {
|
||||||
new SimulatorAnvilGui<>(player, "Start at", offset + "", Integer::parseInt, integer -> {
|
new SimulatorAnvilGui<>(player, "Start at", offset + "", Integer::parseInt, integer -> {
|
||||||
@@ -113,17 +112,17 @@ public class SimulatorRedstonePhaseSettingsGui extends SimulatorBaseGui {
|
|||||||
offsetItem.getItemStack().setAmount(Math.max(1, Math.min(offset, 64)));
|
offsetItem.getItemStack().setAmount(Math.max(1, Math.min(offset, 64)));
|
||||||
inventory.setItem(19, offsetItem);
|
inventory.setItem(19, offsetItem);
|
||||||
|
|
||||||
inventory.setItem(28, new SWItem(SWItem.getDye(offset > min ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(28, SWItem.getDye(offset > min ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
redstone.setTickOffset(Math.max(min, offset - (clickType.isShiftClick() ? 5 : 1)));
|
redstone.setTickOffset(Math.max(min, offset - (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
});
|
||||||
|
|
||||||
//Lifetime
|
//Lifetime
|
||||||
int lifetime = redstone.getLifetime();
|
int lifetime = redstone.getLifetime();
|
||||||
inventory.setItem(11, new SWItem(SWItem.getDye(lifetime < maxLifetime ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(11, SWItem.getDye(lifetime < maxLifetime ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
redstone.setLifetime(Math.min(maxLifetime, lifetime + (clickType.isShiftClick() ? 5 : 1)));
|
redstone.setLifetime(Math.min(maxLifetime, lifetime + (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
});
|
||||||
|
|
||||||
SWItem lifetimeItem = new SWItem(Material.CLOCK, "§eActivation Time§8:§7 " + lifetime, clickType -> {
|
SWItem lifetimeItem = new SWItem(Material.CLOCK, "§eActivation Time§8:§7 " + lifetime, clickType -> {
|
||||||
new SimulatorAnvilGui<>(player, "Activation Time", lifetime + "", Integer::parseInt, integer -> {
|
new SimulatorAnvilGui<>(player, "Activation Time", lifetime + "", Integer::parseInt, integer -> {
|
||||||
@@ -136,17 +135,17 @@ public class SimulatorRedstonePhaseSettingsGui extends SimulatorBaseGui {
|
|||||||
lifetimeItem.getItemStack().setAmount(Math.max(1, Math.min(lifetime, 64)));
|
lifetimeItem.getItemStack().setAmount(Math.max(1, Math.min(lifetime, 64)));
|
||||||
inventory.setItem(20, lifetimeItem);
|
inventory.setItem(20, lifetimeItem);
|
||||||
|
|
||||||
inventory.setItem(29, new SWItem(SWItem.getDye(lifetime > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(29, SWItem.getDye(lifetime > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
redstone.setLifetime(Math.max(0, lifetime - (clickType.isShiftClick() ? 5 : 1)));
|
redstone.setLifetime(Math.max(0, lifetime - (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
});
|
||||||
|
|
||||||
//Order
|
//Order
|
||||||
int order = redstone.getOrder();
|
int order = redstone.getOrder();
|
||||||
inventory.setItem(13, new SWItem(SWItem.getDye(order < SimulatorPhase.ORDER_LIMIT ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(13, SWItem.getDye(order < SimulatorPhase.ORDER_LIMIT ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
redstone.setOrder(Math.min(SimulatorPhase.ORDER_LIMIT, order + (clickType.isShiftClick() ? 5 : 1)));
|
redstone.setOrder(Math.min(SimulatorPhase.ORDER_LIMIT, order + (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
});
|
||||||
|
|
||||||
Material negativeNumbers = Material.getMaterial(Core.getVersion() >= 19 ? "RECOVERY_COMPASS" : "FIREWORK_STAR");
|
Material negativeNumbers = Material.getMaterial(Core.getVersion() >= 19 ? "RECOVERY_COMPASS" : "FIREWORK_STAR");
|
||||||
SWItem orderItem = new SWItem(order >= 0 ? Material.COMPASS : negativeNumbers, "§eActivation Order§8:§7 " + order, clickType -> {
|
SWItem orderItem = new SWItem(order >= 0 ? Material.COMPASS : negativeNumbers, "§eActivation Order§8:§7 " + order, clickType -> {
|
||||||
@@ -161,9 +160,9 @@ public class SimulatorRedstonePhaseSettingsGui extends SimulatorBaseGui {
|
|||||||
orderItem.getItemStack().setAmount(Math.max(1, Math.min(Math.abs(order), 30)));
|
orderItem.getItemStack().setAmount(Math.max(1, Math.min(Math.abs(order), 30)));
|
||||||
inventory.setItem(22, orderItem);
|
inventory.setItem(22, orderItem);
|
||||||
|
|
||||||
inventory.setItem(31, new SWItem(SWItem.getDye(order > -SimulatorPhase.ORDER_LIMIT ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(31, SWItem.getDye(order > -SimulatorPhase.ORDER_LIMIT ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
redstone.setOrder(Math.max(-SimulatorPhase.ORDER_LIMIT, order - (clickType.isShiftClick() ? 5 : 1)));
|
redstone.setOrder(Math.max(-SimulatorPhase.ORDER_LIMIT, order - (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+17
-18
@@ -24,7 +24,6 @@ import de.steamwar.bausystem.features.simulator.data.Simulator;
|
|||||||
import de.steamwar.bausystem.features.simulator.data.redstone.RedstoneElement;
|
import de.steamwar.bausystem.features.simulator.data.redstone.RedstoneElement;
|
||||||
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorAnvilGui;
|
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorAnvilGui;
|
||||||
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
|
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
|
||||||
import de.steamwar.data.CMDs;
|
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -56,7 +55,7 @@ public class SimulatorRedstoneSettingsGui extends SimulatorBaseGui {
|
|||||||
// Back Arrow
|
// Back Arrow
|
||||||
inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> {
|
inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> {
|
||||||
back.open();
|
back.open();
|
||||||
}).setCustomModelData(CMDs.BACK));
|
}));
|
||||||
|
|
||||||
// Material Chooser
|
// Material Chooser
|
||||||
inventory.setItem(4, redstone.toItem(player, clickType -> {
|
inventory.setItem(4, redstone.toItem(player, clickType -> {
|
||||||
@@ -65,10 +64,10 @@ public class SimulatorRedstoneSettingsGui extends SimulatorBaseGui {
|
|||||||
|
|
||||||
// Base Tick
|
// Base Tick
|
||||||
int baseTicks = redstone.getBaseTick();
|
int baseTicks = redstone.getBaseTick();
|
||||||
inventory.setItem(9, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(9, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
redstone.changeBaseTicks(clickType.isShiftClick() ? 5 : 1);
|
redstone.changeBaseTicks(clickType.isShiftClick() ? 5 : 1);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
});
|
||||||
SWItem baseTick = new SWItem(Material.REPEATER, "§eTicks§8:§7 " + baseTicks, clickType -> {
|
SWItem baseTick = new SWItem(Material.REPEATER, "§eTicks§8:§7 " + baseTicks, clickType -> {
|
||||||
new SimulatorAnvilGui<>(player, "Ticks", baseTicks + "", Integer::parseInt, integer -> {
|
new SimulatorAnvilGui<>(player, "Ticks", baseTicks + "", Integer::parseInt, integer -> {
|
||||||
if (integer < 0) return false;
|
if (integer < 0) return false;
|
||||||
@@ -79,20 +78,20 @@ public class SimulatorRedstoneSettingsGui extends SimulatorBaseGui {
|
|||||||
});
|
});
|
||||||
baseTick.getItemStack().setAmount(Math.max(1, Math.min(baseTicks, 64)));
|
baseTick.getItemStack().setAmount(Math.max(1, Math.min(baseTicks, 64)));
|
||||||
inventory.setItem(18, baseTick);
|
inventory.setItem(18, baseTick);
|
||||||
inventory.setItem(27, new SWItem(SWItem.getDye(baseTicks > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(27, SWItem.getDye(baseTicks > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
if (baseTicks - (clickType.isShiftClick() ? 5 : 1) < 0) {
|
if (baseTicks - (clickType.isShiftClick() ? 5 : 1) < 0) {
|
||||||
redstone.changeBaseTicks(-baseTicks);
|
redstone.changeBaseTicks(-baseTicks);
|
||||||
} else {
|
} else {
|
||||||
redstone.changeBaseTicks(clickType.isShiftClick() ? -5 : -1);
|
redstone.changeBaseTicks(clickType.isShiftClick() ? -5 : -1);
|
||||||
}
|
}
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
});
|
||||||
|
|
||||||
//Pos X
|
//Pos X
|
||||||
inventory.setItem(15, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(15, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
redstone.move(clickType.isShiftClick() ? 5 : 1, 0, 0);
|
redstone.move(clickType.isShiftClick() ? 5 : 1, 0, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
});
|
||||||
inventory.setItem(24, new SWItem(Material.PAPER, "§eX§8:§7 " + redstone.getPosition().getBlockX(), clickType -> {
|
inventory.setItem(24, new SWItem(Material.PAPER, "§eX§8:§7 " + redstone.getPosition().getBlockX(), clickType -> {
|
||||||
new SimulatorAnvilGui<>(player, "X", redstone.getPosition().getBlockX() + "", Integer::parseInt, i -> {
|
new SimulatorAnvilGui<>(player, "X", redstone.getPosition().getBlockX() + "", Integer::parseInt, i -> {
|
||||||
redstone.getPosition().setX(i);
|
redstone.getPosition().setX(i);
|
||||||
@@ -100,16 +99,16 @@ public class SimulatorRedstoneSettingsGui extends SimulatorBaseGui {
|
|||||||
return true;
|
return true;
|
||||||
}, this).open();
|
}, this).open();
|
||||||
}));
|
}));
|
||||||
inventory.setItem(33, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(33, SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
redstone.move(clickType.isShiftClick() ? -5 : -1, 0, 0);
|
redstone.move(clickType.isShiftClick() ? -5 : -1, 0, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
});
|
||||||
|
|
||||||
//Pos Y
|
//Pos Y
|
||||||
inventory.setItem(16, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(16, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
redstone.move(0, clickType.isShiftClick() ? 5 : 1, 0);
|
redstone.move(0, clickType.isShiftClick() ? 5 : 1, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
});
|
||||||
inventory.setItem(25, new SWItem(Material.PAPER, "§eY§8:§7 " + redstone.getPosition().getBlockY(), clickType -> {
|
inventory.setItem(25, new SWItem(Material.PAPER, "§eY§8:§7 " + redstone.getPosition().getBlockY(), clickType -> {
|
||||||
new SimulatorAnvilGui<>(player, "Y", redstone.getPosition().getBlockY() + "", Integer::parseInt, i -> {
|
new SimulatorAnvilGui<>(player, "Y", redstone.getPosition().getBlockY() + "", Integer::parseInt, i -> {
|
||||||
redstone.getPosition().setY(i);
|
redstone.getPosition().setY(i);
|
||||||
@@ -117,16 +116,16 @@ public class SimulatorRedstoneSettingsGui extends SimulatorBaseGui {
|
|||||||
return true;
|
return true;
|
||||||
}, this).open();
|
}, this).open();
|
||||||
}));
|
}));
|
||||||
inventory.setItem(34, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(34, SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
redstone.move(0, clickType.isShiftClick() ? -5 : -1, 0);
|
redstone.move(0, clickType.isShiftClick() ? -5 : -1, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
});
|
||||||
|
|
||||||
//Pos Z
|
//Pos Z
|
||||||
inventory.setItem(17, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(17, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
redstone.move(0, 0, clickType.isShiftClick() ? 5 : 1);
|
redstone.move(0, 0, clickType.isShiftClick() ? 5 : 1);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
});
|
||||||
inventory.setItem(26, new SWItem(Material.PAPER, "§eZ§8:§7 " + redstone.getPosition().getBlockZ(), clickType -> {
|
inventory.setItem(26, new SWItem(Material.PAPER, "§eZ§8:§7 " + redstone.getPosition().getBlockZ(), clickType -> {
|
||||||
new SimulatorAnvilGui<>(player, "Z", redstone.getPosition().getBlockZ() + "", Integer::parseInt, i -> {
|
new SimulatorAnvilGui<>(player, "Z", redstone.getPosition().getBlockZ() + "", Integer::parseInt, i -> {
|
||||||
redstone.getPosition().setZ(i);
|
redstone.getPosition().setZ(i);
|
||||||
@@ -134,9 +133,9 @@ public class SimulatorRedstoneSettingsGui extends SimulatorBaseGui {
|
|||||||
return true;
|
return true;
|
||||||
}, this).open();
|
}, this).open();
|
||||||
}));
|
}));
|
||||||
inventory.setItem(35, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(35, SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
redstone.move(0, 0, clickType.isShiftClick() ? -5 : -1);
|
redstone.move(0, 0, clickType.isShiftClick() ? -5 : -1);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+13
-14
@@ -22,7 +22,6 @@ package de.steamwar.bausystem.features.simulator.gui;
|
|||||||
import de.steamwar.bausystem.features.simulator.SimulatorWatcher;
|
import de.steamwar.bausystem.features.simulator.SimulatorWatcher;
|
||||||
import de.steamwar.bausystem.features.simulator.data.Simulator;
|
import de.steamwar.bausystem.features.simulator.data.Simulator;
|
||||||
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
|
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
|
||||||
import de.steamwar.data.CMDs;
|
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -48,7 +47,7 @@ public class SimulatorSettingsGui extends SimulatorBaseGui {
|
|||||||
// Back Arrow
|
// Back Arrow
|
||||||
inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> {
|
inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> {
|
||||||
back.open();
|
back.open();
|
||||||
}).setCustomModelData(CMDs.BACK));
|
}));
|
||||||
|
|
||||||
// Material Chooser
|
// Material Chooser
|
||||||
inventory.setItem(4, simulator.toItem(player, clickType -> {
|
inventory.setItem(4, simulator.toItem(player, clickType -> {
|
||||||
@@ -62,39 +61,39 @@ public class SimulatorSettingsGui extends SimulatorBaseGui {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
//Pos X
|
//Pos X
|
||||||
inventory.setItem(15, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(15, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
simulator.move(clickType.isShiftClick() ? 5 : 1, 0, 0);
|
simulator.move(clickType.isShiftClick() ? 5 : 1, 0, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
});
|
||||||
inventory.setItem(24, new SWItem(Material.PAPER, "§eX", clickType -> {
|
inventory.setItem(24, new SWItem(Material.PAPER, "§eX", clickType -> {
|
||||||
}));
|
}));
|
||||||
inventory.setItem(33, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(33, SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
simulator.move(clickType.isShiftClick() ? -5 : -1, 0, 0);
|
simulator.move(clickType.isShiftClick() ? -5 : -1, 0, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
});
|
||||||
|
|
||||||
//Pos Y
|
//Pos Y
|
||||||
inventory.setItem(16, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(16, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
simulator.move(0, clickType.isShiftClick() ? 5 : 1, 0);
|
simulator.move(0, clickType.isShiftClick() ? 5 : 1, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
});
|
||||||
inventory.setItem(25, new SWItem(Material.PAPER, "§eY", clickType -> {
|
inventory.setItem(25, new SWItem(Material.PAPER, "§eY", clickType -> {
|
||||||
}));
|
}));
|
||||||
inventory.setItem(34, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(34, SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
simulator.move(0, clickType.isShiftClick() ? -5 : -1, 0);
|
simulator.move(0, clickType.isShiftClick() ? -5 : -1, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
});
|
||||||
|
|
||||||
//Pos Z
|
//Pos Z
|
||||||
inventory.setItem(17, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(17, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
simulator.move(0, 0, clickType.isShiftClick() ? 5 : 1);
|
simulator.move(0, 0, clickType.isShiftClick() ? 5 : 1);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
});
|
||||||
inventory.setItem(26, new SWItem(Material.PAPER, "§eZ", clickType -> {
|
inventory.setItem(26, new SWItem(Material.PAPER, "§eZ", clickType -> {
|
||||||
}));
|
}));
|
||||||
inventory.setItem(35, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(35, SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
simulator.move(0, 0, clickType.isShiftClick() ? -5 : -1);
|
simulator.move(0, 0, clickType.isShiftClick() ? -5 : -1);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+12
-27
@@ -24,13 +24,8 @@ import de.steamwar.bausystem.features.simulator.data.Simulator;
|
|||||||
import de.steamwar.bausystem.features.simulator.data.SimulatorGroup;
|
import de.steamwar.bausystem.features.simulator.data.SimulatorGroup;
|
||||||
import de.steamwar.bausystem.features.simulator.data.tnt.TNTElement;
|
import de.steamwar.bausystem.features.simulator.data.tnt.TNTElement;
|
||||||
import de.steamwar.bausystem.features.simulator.data.tnt.TNTPhase;
|
import de.steamwar.bausystem.features.simulator.data.tnt.TNTPhase;
|
||||||
import de.steamwar.bausystem.features.simulator.execute.SimulatorStabGenerator;
|
|
||||||
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorAnvilGui;
|
|
||||||
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
|
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
|
||||||
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorScrollGui;
|
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorScrollGui;
|
||||||
import de.steamwar.bausystem.region.Region;
|
|
||||||
import de.steamwar.core.Core;
|
|
||||||
import de.steamwar.data.CMDs;
|
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -83,12 +78,12 @@ public class SimulatorTNTGui extends SimulatorScrollGui<TNTPhase> {
|
|||||||
new SimulatorGroupGui(player, simulator, newParent, simulatorGui).open();
|
new SimulatorGroupGui(player, simulator, newParent, simulatorGui).open();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).setCustomModelData(CMDs.BACK));
|
}));
|
||||||
|
|
||||||
inventory.setItem(8, new SWItem(Material.BARRIER, "§eDelete", clickType -> {
|
inventory.setItem(8, new SWItem(Material.BARRIER, "§eDelete", clickType -> {
|
||||||
tnt.getPhases().clear();
|
tnt.getPhases().clear();
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DELETE));
|
}));
|
||||||
|
|
||||||
// Material Chooser
|
// Material Chooser
|
||||||
inventory.setItem(4, tnt.toItem(player, clickType -> {
|
inventory.setItem(4, tnt.toItem(player, clickType -> {
|
||||||
@@ -97,31 +92,21 @@ public class SimulatorTNTGui extends SimulatorScrollGui<TNTPhase> {
|
|||||||
|
|
||||||
inventory.setItem(47, new SWItem(Material.REPEATER, "§eSettings", clickType -> {
|
inventory.setItem(47, new SWItem(Material.REPEATER, "§eSettings", clickType -> {
|
||||||
new SimulatorTNTSettingsGui(player, simulator, tnt, this).open();
|
new SimulatorTNTSettingsGui(player, simulator, tnt, this).open();
|
||||||
}).setCustomModelData(CMDs.Simulator.SETTINGS));
|
}));
|
||||||
inventory.setItem(48, new SWItem(tnt.isDisabled() ? Material.ENDER_PEARL : Material.ENDER_EYE, tnt.isDisabled() ? "§cDisabled" : "§aEnabled", clickType -> {
|
inventory.setItem(48, new SWItem(tnt.isDisabled() ? Material.ENDER_PEARL : Material.ENDER_EYE, tnt.isDisabled() ? "§cDisabled" : "§aEnabled", clickType -> {
|
||||||
tnt.setDisabled(!tnt.isDisabled());
|
tnt.setDisabled(!tnt.isDisabled());
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.ENABLED_OR_DISABLED));
|
}));
|
||||||
if (Core.getVersion() > 19) {
|
|
||||||
inventory.setItem(49, new SWItem(Material.CALIBRATED_SCULK_SENSOR, "§eCreate Stab", click -> {
|
|
||||||
new SimulatorAnvilGui<>(player, "Depth Limit", "", Integer::parseInt, depthLimit -> {
|
|
||||||
if (depthLimit <= 0) return false;
|
|
||||||
simulator.setStabGenerator(new SimulatorStabGenerator(Region.getRegion(player.getLocation()), simulator, tnt, depthLimit));
|
|
||||||
SimulatorWatcher.update(simulator);
|
|
||||||
return true;
|
|
||||||
}, null).open();
|
|
||||||
}).setCustomModelData(CMDs.Simulator.CREATE_STAB));
|
|
||||||
}
|
|
||||||
inventory.setItem(50, new SWItem(Material.CHEST, parent.getElements().size() == 1 ? "§eMake Group" : "§eAdd another TNT to Group", clickType -> {
|
inventory.setItem(50, new SWItem(Material.CHEST, parent.getElements().size() == 1 ? "§eMake Group" : "§eAdd another TNT to Group", clickType -> {
|
||||||
TNTElement tntElement = new TNTElement(tnt.getPosition().clone());
|
TNTElement tntElement = new TNTElement(tnt.getPosition().clone());
|
||||||
tntElement.add(new TNTPhase());
|
tntElement.add(new TNTPhase());
|
||||||
parent.add(tntElement);
|
parent.add(tntElement);
|
||||||
new SimulatorGroupGui(player, simulator, parent, new SimulatorGui(player, simulator)).open();
|
new SimulatorGroupGui(player, simulator, parent, new SimulatorGui(player, simulator)).open();
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.MAKE_GROUP));
|
}));
|
||||||
inventory.setItem(51, new SWItem(Material.LEAD, "§eJoin Group", clickType -> {
|
inventory.setItem(51, new SWItem(Material.LEAD, "§eJoin Group", clickType -> {
|
||||||
new SimulatorGroupChooserGui(player, simulator, tnt, tnt.getGroup(simulator), this).open();
|
new SimulatorGroupChooserGui(player, simulator, tnt, tnt.getGroup(simulator), this).open();
|
||||||
}).setCustomModelData(CMDs.Simulator.JOIN_GROUP));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -140,15 +125,15 @@ public class SimulatorTNTGui extends SimulatorScrollGui<TNTPhase> {
|
|||||||
new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
|
new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
|
||||||
tntSetting.setCount(tntSetting.getCount() + (clickType.isShiftClick() ? 5 : 1));
|
tntSetting.setCount(tntSetting.getCount() + (clickType.isShiftClick() ? 5 : 1));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED),
|
}),
|
||||||
tnt,
|
tnt,
|
||||||
new SWItem(SWItem.getDye(tntSetting.getCount() > 1 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8:§e -5"), false, clickType -> {
|
new SWItem(SWItem.getDye(tntSetting.getCount() > 1 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8:§e -5"), false, clickType -> {
|
||||||
tntSetting.setCount(Math.max(1, tntSetting.getCount() - (clickType.isShiftClick() ? 5 : 1)));
|
tntSetting.setCount(Math.max(1, tntSetting.getCount() - (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED),
|
}),
|
||||||
new SWItem(Material.ANVIL, "§eEdit Phase", clickType -> {
|
new SWItem(Material.ANVIL, "§eEdit Phase", clickType -> {
|
||||||
new SimulatorTNTPhaseSettingsGui(player, simulator, this.tnt, tntSetting, this).open();
|
new SimulatorTNTPhaseSettingsGui(player, simulator, this.tnt, tntSetting, this).open();
|
||||||
}).setCustomModelData(CMDs.Simulator.EDIT_ACTIVATION),
|
}),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,12 +142,12 @@ public class SimulatorTNTGui extends SimulatorScrollGui<TNTPhase> {
|
|||||||
return new SWItem[]{
|
return new SWItem[]{
|
||||||
new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
|
new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8:§e +5"), false, clickType -> {
|
||||||
addNewPhase(clickType.isShiftClick());
|
addNewPhase(clickType.isShiftClick());
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED),
|
}),
|
||||||
new SWItem(Material.GUNPOWDER, "§eTNT§8:§a New Phase", clickType -> {
|
new SWItem(Material.GUNPOWDER, "§eTNT§8:§a New Phase", clickType -> {
|
||||||
addNewPhase(false);
|
addNewPhase(false);
|
||||||
}).setCustomModelData(CMDs.Simulator.NEW_PHASE),
|
}),
|
||||||
new SWItem(SWItem.getDye(8), "§7", clickType -> {
|
new SWItem(SWItem.getDye(8), "§7", clickType -> {
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED),
|
}),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+18
-19
@@ -27,7 +27,6 @@ import de.steamwar.bausystem.features.simulator.data.tnt.TNTPhase;
|
|||||||
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorAnvilGui;
|
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorAnvilGui;
|
||||||
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
|
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
|
||||||
import de.steamwar.core.Core;
|
import de.steamwar.core.Core;
|
||||||
import de.steamwar.data.CMDs;
|
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -61,7 +60,7 @@ public class SimulatorTNTPhaseSettingsGui extends SimulatorBaseGui {
|
|||||||
// Back Arrow
|
// Back Arrow
|
||||||
inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> {
|
inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> {
|
||||||
back.open();
|
back.open();
|
||||||
}).setCustomModelData(CMDs.BACK));
|
}));
|
||||||
|
|
||||||
// Material Chooser
|
// Material Chooser
|
||||||
inventory.setItem(4, tntElement.toItem(player, clickType -> {
|
inventory.setItem(4, tntElement.toItem(player, clickType -> {
|
||||||
@@ -73,14 +72,14 @@ public class SimulatorTNTPhaseSettingsGui extends SimulatorBaseGui {
|
|||||||
tntElement.getPhases().remove(tnt);
|
tntElement.getPhases().remove(tnt);
|
||||||
back.open();
|
back.open();
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DELETE));
|
}));
|
||||||
|
|
||||||
//Count
|
//Count
|
||||||
int count = tnt.getCount();
|
int count = tnt.getCount();
|
||||||
inventory.setItem(9, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(9, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
tnt.setCount(count + (clickType.isShiftClick() ? 5 : 1));
|
tnt.setCount(count + (clickType.isShiftClick() ? 5 : 1));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
});
|
||||||
|
|
||||||
SWItem countItem = new SWItem(Material.TNT, "§eCount§8:§7 " + count, clickType -> {
|
SWItem countItem = new SWItem(Material.TNT, "§eCount§8:§7 " + count, clickType -> {
|
||||||
new SimulatorAnvilGui<>(player, "Count", count + "", Integer::parseInt, integer -> {
|
new SimulatorAnvilGui<>(player, "Count", count + "", Integer::parseInt, integer -> {
|
||||||
@@ -93,17 +92,17 @@ public class SimulatorTNTPhaseSettingsGui extends SimulatorBaseGui {
|
|||||||
countItem.getItemStack().setAmount(Math.max(1, Math.min(count, 64)));
|
countItem.getItemStack().setAmount(Math.max(1, Math.min(count, 64)));
|
||||||
inventory.setItem(18, countItem);
|
inventory.setItem(18, countItem);
|
||||||
|
|
||||||
inventory.setItem(27, new SWItem(SWItem.getDye(count > 1 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(27, SWItem.getDye(count > 1 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
tnt.setCount(Math.max(1, count - (clickType.isShiftClick() ? 5 : 1)));
|
tnt.setCount(Math.max(1, count - (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
});
|
||||||
|
|
||||||
//Tick Offset
|
//Tick Offset
|
||||||
int offset = tnt.getTickOffset();
|
int offset = tnt.getTickOffset();
|
||||||
inventory.setItem(10, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(10, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
tnt.setTickOffset(offset + (clickType.isShiftClick() ? 5 : 1));
|
tnt.setTickOffset(offset + (clickType.isShiftClick() ? 5 : 1));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
});
|
||||||
|
|
||||||
SWItem offsetItem = new SWItem(Material.REPEATER, "§eStart at§8:§7 " + offset, clickType -> {
|
SWItem offsetItem = new SWItem(Material.REPEATER, "§eStart at§8:§7 " + offset, clickType -> {
|
||||||
new SimulatorAnvilGui<>(player, "Start at", offset + "", Integer::parseInt, integer -> {
|
new SimulatorAnvilGui<>(player, "Start at", offset + "", Integer::parseInt, integer -> {
|
||||||
@@ -116,17 +115,17 @@ public class SimulatorTNTPhaseSettingsGui extends SimulatorBaseGui {
|
|||||||
offsetItem.getItemStack().setAmount(Math.max(1, Math.min(offset, 64)));
|
offsetItem.getItemStack().setAmount(Math.max(1, Math.min(offset, 64)));
|
||||||
inventory.setItem(19, offsetItem);
|
inventory.setItem(19, offsetItem);
|
||||||
|
|
||||||
inventory.setItem(28, new SWItem(SWItem.getDye(offset > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(28, SWItem.getDye(offset > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
tnt.setTickOffset(Math.max(0, offset - (clickType.isShiftClick() ? 5 : 1)));
|
tnt.setTickOffset(Math.max(0, offset - (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
});
|
||||||
|
|
||||||
//Lifetime
|
//Lifetime
|
||||||
int lifetime = tnt.getLifetime();
|
int lifetime = tnt.getLifetime();
|
||||||
inventory.setItem(11, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(11, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
tnt.setLifetime(lifetime + (clickType.isShiftClick() ? 5 : 1));
|
tnt.setLifetime(lifetime + (clickType.isShiftClick() ? 5 : 1));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
});
|
||||||
|
|
||||||
SWItem lifetimeItem = new SWItem(Material.CLOCK, "§eLifetime§8:§7 " + lifetime, clickType -> {
|
SWItem lifetimeItem = new SWItem(Material.CLOCK, "§eLifetime§8:§7 " + lifetime, clickType -> {
|
||||||
new SimulatorAnvilGui<>(player, "Lifetime", lifetime + "", Integer::parseInt, integer -> {
|
new SimulatorAnvilGui<>(player, "Lifetime", lifetime + "", Integer::parseInt, integer -> {
|
||||||
@@ -139,17 +138,17 @@ public class SimulatorTNTPhaseSettingsGui extends SimulatorBaseGui {
|
|||||||
lifetimeItem.getItemStack().setAmount(Math.max(1, Math.min(lifetime, 64)));
|
lifetimeItem.getItemStack().setAmount(Math.max(1, Math.min(lifetime, 64)));
|
||||||
inventory.setItem(20, lifetimeItem);
|
inventory.setItem(20, lifetimeItem);
|
||||||
|
|
||||||
inventory.setItem(29, new SWItem(SWItem.getDye(lifetime > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(29, SWItem.getDye(lifetime > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
tnt.setLifetime(Math.max(1, lifetime - (clickType.isShiftClick() ? 5 : 1)));
|
tnt.setLifetime(Math.max(1, lifetime - (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
});
|
||||||
|
|
||||||
//Order
|
//Order
|
||||||
int order = tnt.getOrder();
|
int order = tnt.getOrder();
|
||||||
inventory.setItem(13, new SWItem(SWItem.getDye(order < SimulatorPhase.ORDER_LIMIT ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(13, SWItem.getDye(order < SimulatorPhase.ORDER_LIMIT ? 10 : 8), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
tnt.setOrder(Math.min(SimulatorPhase.ORDER_LIMIT, order + (clickType.isShiftClick() ? 5 : 1)));
|
tnt.setOrder(Math.min(SimulatorPhase.ORDER_LIMIT, order + (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
});
|
||||||
|
|
||||||
Material negativeNumbers = Material.getMaterial(Core.getVersion() >= 19 ? "RECOVERY_COMPASS" : "FIREWORK_STAR");
|
Material negativeNumbers = Material.getMaterial(Core.getVersion() >= 19 ? "RECOVERY_COMPASS" : "FIREWORK_STAR");
|
||||||
SWItem orderItem = new SWItem(order >= 0 ? Material.COMPASS : negativeNumbers, "§eCalculation Order§8:§7 " + order, clickType -> {
|
SWItem orderItem = new SWItem(order >= 0 ? Material.COMPASS : negativeNumbers, "§eCalculation Order§8:§7 " + order, clickType -> {
|
||||||
@@ -164,10 +163,10 @@ public class SimulatorTNTPhaseSettingsGui extends SimulatorBaseGui {
|
|||||||
orderItem.getItemStack().setAmount(Math.max(1, Math.min(Math.abs(order), 30)));
|
orderItem.getItemStack().setAmount(Math.max(1, Math.min(Math.abs(order), 30)));
|
||||||
inventory.setItem(22, orderItem);
|
inventory.setItem(22, orderItem);
|
||||||
|
|
||||||
inventory.setItem(31, new SWItem(SWItem.getDye(order > -SimulatorPhase.ORDER_LIMIT ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(31, SWItem.getDye(order > -SimulatorPhase.ORDER_LIMIT ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
tnt.setOrder(Math.max(-SimulatorPhase.ORDER_LIMIT, order - (clickType.isShiftClick() ? 5 : 1)));
|
tnt.setOrder(Math.max(-SimulatorPhase.ORDER_LIMIT, order - (clickType.isShiftClick() ? 5 : 1)));
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
});
|
||||||
|
|
||||||
//Jump
|
//Jump
|
||||||
SWItem jumpX = new SWItem(tnt.isXJump() ? Material.LIME_WOOL : Material.RED_WOOL, "§7TNT §eJump X§8: " + (tnt.isZJump() ? "§aon" : "§coff"), clickType -> {
|
SWItem jumpX = new SWItem(tnt.isXJump() ? Material.LIME_WOOL : Material.RED_WOOL, "§7TNT §eJump X§8: " + (tnt.isZJump() ? "§aon" : "§coff"), clickType -> {
|
||||||
|
|||||||
+18
-18
@@ -24,10 +24,10 @@ import de.steamwar.bausystem.features.simulator.data.Simulator;
|
|||||||
import de.steamwar.bausystem.features.simulator.data.tnt.TNTElement;
|
import de.steamwar.bausystem.features.simulator.data.tnt.TNTElement;
|
||||||
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorAnvilGui;
|
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorAnvilGui;
|
||||||
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
|
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
|
||||||
import de.steamwar.data.CMDs;
|
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@@ -58,7 +58,7 @@ public class SimulatorTNTSettingsGui extends SimulatorBaseGui {
|
|||||||
// Back Arrow
|
// Back Arrow
|
||||||
inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> {
|
inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> {
|
||||||
back.open();
|
back.open();
|
||||||
}).setCustomModelData(CMDs.BACK));
|
}));
|
||||||
|
|
||||||
// Material Chooser
|
// Material Chooser
|
||||||
List<String> lore = new ArrayList<>();
|
List<String> lore = new ArrayList<>();
|
||||||
@@ -74,10 +74,10 @@ public class SimulatorTNTSettingsGui extends SimulatorBaseGui {
|
|||||||
|
|
||||||
// Base Tick
|
// Base Tick
|
||||||
int baseTicks = tnt.getBaseTick();
|
int baseTicks = tnt.getBaseTick();
|
||||||
inventory.setItem(9, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
inventory.setItem(9, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+5"), false, clickType -> {
|
||||||
tnt.changeBaseTicks(clickType.isShiftClick() ? 5 : 1);
|
tnt.changeBaseTicks(clickType.isShiftClick() ? 5 : 1);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
});
|
||||||
SWItem baseTick = new SWItem(Material.REPEATER, "§eTicks§8:§7 " + baseTicks, clickType -> {
|
SWItem baseTick = new SWItem(Material.REPEATER, "§eTicks§8:§7 " + baseTicks, clickType -> {
|
||||||
new SimulatorAnvilGui<>(player, "Ticks", baseTicks + "", Integer::parseInt, integer -> {
|
new SimulatorAnvilGui<>(player, "Ticks", baseTicks + "", Integer::parseInt, integer -> {
|
||||||
if (integer < 0) return false;
|
if (integer < 0) return false;
|
||||||
@@ -88,14 +88,14 @@ public class SimulatorTNTSettingsGui extends SimulatorBaseGui {
|
|||||||
});
|
});
|
||||||
baseTick.getItemStack().setAmount(Math.max(1, Math.min(baseTicks, 64)));
|
baseTick.getItemStack().setAmount(Math.max(1, Math.min(baseTicks, 64)));
|
||||||
inventory.setItem(18, baseTick);
|
inventory.setItem(18, baseTick);
|
||||||
inventory.setItem(27, new SWItem(SWItem.getDye(baseTicks > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
inventory.setItem(27, SWItem.getDye(baseTicks > 0 ? 1 : 8), "§e-1", Arrays.asList("§7Shift§8: §e-5"), false, clickType -> {
|
||||||
if (baseTicks - (clickType.isShiftClick() ? 5 : 1) < 0) {
|
if (baseTicks - (clickType.isShiftClick() ? 5 : 1) < 0) {
|
||||||
tnt.changeBaseTicks(-baseTicks);
|
tnt.changeBaseTicks(-baseTicks);
|
||||||
} else {
|
} else {
|
||||||
tnt.changeBaseTicks(clickType.isShiftClick() ? -5 : -1);
|
tnt.changeBaseTicks(clickType.isShiftClick() ? -5 : -1);
|
||||||
}
|
}
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
});
|
||||||
|
|
||||||
// Subpixel Alignment
|
// Subpixel Alignment
|
||||||
inventory.setItem(21, new SWItem(Material.SUNFLOWER, "§7Align§8: §eCenter", clickType -> {
|
inventory.setItem(21, new SWItem(Material.SUNFLOWER, "§7Align§8: §eCenter", clickType -> {
|
||||||
@@ -135,10 +135,10 @@ public class SimulatorTNTSettingsGui extends SimulatorBaseGui {
|
|||||||
inventory.setItem(30, positivXItem);
|
inventory.setItem(30, positivXItem);
|
||||||
|
|
||||||
// Pos X
|
// Pos X
|
||||||
inventory.setItem(15, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+0.0625"), false, clickType -> {
|
inventory.setItem(15, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+0.0625"), false, clickType -> {
|
||||||
tnt.move(clickType.isShiftClick() ? 0.0625 : 1, 0, 0);
|
tnt.move(clickType.isShiftClick() ? 0.0625 : 1, 0, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
});
|
||||||
inventory.setItem(24, new SWItem(Material.PAPER, "§eX§8:§7 " + tnt.getPosition().getX(), clickType -> {
|
inventory.setItem(24, new SWItem(Material.PAPER, "§eX§8:§7 " + tnt.getPosition().getX(), clickType -> {
|
||||||
new SimulatorAnvilGui<>(player, "X", tnt.getPosition().getX() + "", Double::parseDouble, d -> {
|
new SimulatorAnvilGui<>(player, "X", tnt.getPosition().getX() + "", Double::parseDouble, d -> {
|
||||||
tnt.getPosition().setX(d);
|
tnt.getPosition().setX(d);
|
||||||
@@ -146,16 +146,16 @@ public class SimulatorTNTSettingsGui extends SimulatorBaseGui {
|
|||||||
return true;
|
return true;
|
||||||
}, this).open();
|
}, this).open();
|
||||||
}));
|
}));
|
||||||
inventory.setItem(33, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-0.0625"), false, clickType -> {
|
inventory.setItem(33, SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-0.0625"), false, clickType -> {
|
||||||
tnt.move(clickType.isShiftClick() ? -0.0625 : -1, 0, 0);
|
tnt.move(clickType.isShiftClick() ? -0.0625 : -1, 0, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
});
|
||||||
|
|
||||||
// Pos Y
|
// Pos Y
|
||||||
inventory.setItem(16, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+0.0625"), false, clickType -> {
|
inventory.setItem(16, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+0.0625"), false, clickType -> {
|
||||||
tnt.move(0, clickType.isShiftClick() ? 0.0625 : 1, 0);
|
tnt.move(0, clickType.isShiftClick() ? 0.0625 : 1, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
});
|
||||||
inventory.setItem(25, new SWItem(Material.PAPER, "§eY§8:§7 " + tnt.getPosition().getY(), clickType -> {
|
inventory.setItem(25, new SWItem(Material.PAPER, "§eY§8:§7 " + tnt.getPosition().getY(), clickType -> {
|
||||||
new SimulatorAnvilGui<>(player, "Y", tnt.getPosition().getY() + "", Double::parseDouble, d -> {
|
new SimulatorAnvilGui<>(player, "Y", tnt.getPosition().getY() + "", Double::parseDouble, d -> {
|
||||||
tnt.getPosition().setY(d);
|
tnt.getPosition().setY(d);
|
||||||
@@ -163,16 +163,16 @@ public class SimulatorTNTSettingsGui extends SimulatorBaseGui {
|
|||||||
return true;
|
return true;
|
||||||
}, this).open();
|
}, this).open();
|
||||||
}));
|
}));
|
||||||
inventory.setItem(34, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-0.0625"), false, clickType -> {
|
inventory.setItem(34, SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-0.0625"), false, clickType -> {
|
||||||
tnt.move(0, clickType.isShiftClick() ? -0.0625 : -1, 0);
|
tnt.move(0, clickType.isShiftClick() ? -0.0625 : -1, 0);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
});
|
||||||
|
|
||||||
// Pos Z
|
// Pos Z
|
||||||
inventory.setItem(17, new SWItem(SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+0.0625"), false, clickType -> {
|
inventory.setItem(17, SWItem.getDye(10), "§e+1", Arrays.asList("§7Shift§8: §e+0.0625"), false, clickType -> {
|
||||||
tnt.move(0, 0, clickType.isShiftClick() ? 0.0625 : 1);
|
tnt.move(0, 0, clickType.isShiftClick() ? 0.0625 : 1);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.INCREMENT_OR_DISABLED));
|
});
|
||||||
inventory.setItem(26, new SWItem(Material.PAPER, "§eZ§8:§7 " + tnt.getPosition().getZ(), clickType -> {
|
inventory.setItem(26, new SWItem(Material.PAPER, "§eZ§8:§7 " + tnt.getPosition().getZ(), clickType -> {
|
||||||
new SimulatorAnvilGui<>(player, "Z", tnt.getPosition().getZ() + "", Double::parseDouble, d -> {
|
new SimulatorAnvilGui<>(player, "Z", tnt.getPosition().getZ() + "", Double::parseDouble, d -> {
|
||||||
tnt.getPosition().setZ(d);
|
tnt.getPosition().setZ(d);
|
||||||
@@ -180,9 +180,9 @@ public class SimulatorTNTSettingsGui extends SimulatorBaseGui {
|
|||||||
return true;
|
return true;
|
||||||
}, this).open();
|
}, this).open();
|
||||||
}));
|
}));
|
||||||
inventory.setItem(35, new SWItem(SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-0.0625"), false, clickType -> {
|
inventory.setItem(35, SWItem.getDye(1), "§e-1", Arrays.asList("§7Shift§8: §e-0.0625"), false, clickType -> {
|
||||||
tnt.move(0, 0, clickType.isShiftClick() ? -0.0625 : -1);
|
tnt.move(0, 0, clickType.isShiftClick() ? -0.0625 : -1);
|
||||||
SimulatorWatcher.update(simulator);
|
SimulatorWatcher.update(simulator);
|
||||||
}).setCustomModelData(CMDs.Simulator.DECREMENT_OR_DISABLED));
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -44,7 +44,7 @@ public class SimulatorAnvilGui<T extends Number> {
|
|||||||
if (error.get()) {
|
if (error.get()) {
|
||||||
anvilInv.open();
|
anvilInv.open();
|
||||||
} else {
|
} else {
|
||||||
if (back != null) back.open();
|
back.open();
|
||||||
}
|
}
|
||||||
error.set(false);
|
error.set(false);
|
||||||
}, 0);
|
}, 0);
|
||||||
|
|||||||
+3
-24
@@ -45,8 +45,6 @@ public abstract class SimulatorBaseGui {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final void open() {
|
public final void open() {
|
||||||
if (!shouldOpen()) return;
|
|
||||||
|
|
||||||
String newTitle = title();
|
String newTitle = title();
|
||||||
String originalTitle = player.getOpenInventory().getTitle();
|
String originalTitle = player.getOpenInventory().getTitle();
|
||||||
|
|
||||||
@@ -63,11 +61,7 @@ public abstract class SimulatorBaseGui {
|
|||||||
if (Core.getVersion() > 19) {
|
if (Core.getVersion() > 19) {
|
||||||
player.getOpenInventory().setTitle(title());
|
player.getOpenInventory().setTitle(title());
|
||||||
}
|
}
|
||||||
if (simulator != null && simulator.getStabGenerator() != null) {
|
populate();
|
||||||
populateStabGenerator();
|
|
||||||
} else {
|
|
||||||
populate();
|
|
||||||
}
|
|
||||||
if (player.getOpenInventory().getTopInventory() == inv) {
|
if (player.getOpenInventory().getTopInventory() == inv) {
|
||||||
inventory.open();
|
inventory.open();
|
||||||
SimulatorWatcher.watch(player, simulator, this::open);
|
SimulatorWatcher.watch(player, simulator, this::open);
|
||||||
@@ -75,7 +69,7 @@ public abstract class SimulatorBaseGui {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
player.closeInventory();
|
player.getOpenInventory().close();
|
||||||
|
|
||||||
inventory = new SWInventory(player, () -> {
|
inventory = new SWInventory(player, () -> {
|
||||||
inv = Bukkit.createInventory(null, size, title());
|
inv = Bukkit.createInventory(null, size, title());
|
||||||
@@ -87,25 +81,10 @@ public abstract class SimulatorBaseGui {
|
|||||||
});
|
});
|
||||||
|
|
||||||
SimulatorWatcher.watch(player, simulator, this::open);
|
SimulatorWatcher.watch(player, simulator, this::open);
|
||||||
if (simulator != null && simulator.getStabGenerator() != null) {
|
populate();
|
||||||
populateStabGenerator();
|
|
||||||
} else {
|
|
||||||
populate();
|
|
||||||
}
|
|
||||||
inventory.open();
|
inventory.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void populateStabGenerator() {
|
|
||||||
inventory.setItem(22, new SWItem(Material.BARRIER, "§cCancel Stab Generator", click -> {
|
|
||||||
simulator.getStabGenerator().cancel();
|
|
||||||
SimulatorWatcher.update(simulator);
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean shouldOpen() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setup() {
|
private void setup() {
|
||||||
for (int i = 0; i < 9; i++) {
|
for (int i = 0; i < 9; i++) {
|
||||||
inventory.setItem(i, new SWItem(Material.GRAY_STAINED_GLASS_PANE, "§8", clickType -> {
|
inventory.setItem(i, new SWItem(Material.GRAY_STAINED_GLASS_PANE, "§8", clickType -> {
|
||||||
|
|||||||
+4
-5
@@ -21,7 +21,6 @@ package de.steamwar.bausystem.features.simulator.gui.base;
|
|||||||
|
|
||||||
import de.steamwar.bausystem.features.simulator.data.Simulator;
|
import de.steamwar.bausystem.features.simulator.data.Simulator;
|
||||||
import de.steamwar.core.Core;
|
import de.steamwar.core.Core;
|
||||||
import de.steamwar.data.CMDs;
|
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@@ -51,19 +50,19 @@ public abstract class SimulatorPageGui<T> extends SimulatorBaseGui {
|
|||||||
headerAndFooter();
|
headerAndFooter();
|
||||||
page = Math.min(page, maxPage());
|
page = Math.min(page, maxPage());
|
||||||
|
|
||||||
inventory.setItem(size - 9, new SWItem(SWItem.getDye(page > 0 ? 10 : 8), page > 0 ? (byte) 10 : (byte) 8, Core.MESSAGE.parse(page > 0 ? "SWLISINV_PREVIOUS_PAGE_ACTIVE" : "SWLISINV_PREVIOUS_PAGE_INACTIVE", player), clickType -> {
|
inventory.setItem(size - 9, SWItem.getDye(page > 0 ? 10 : 8), page > 0 ? (byte) 10 : (byte) 8, Core.MESSAGE.parse(page > 0 ? "SWLISINV_PREVIOUS_PAGE_ACTIVE" : "SWLISINV_PREVIOUS_PAGE_INACTIVE", player), clickType -> {
|
||||||
if (page > 0) {
|
if (page > 0) {
|
||||||
page--;
|
page--;
|
||||||
open();
|
open();
|
||||||
}
|
}
|
||||||
}).setCustomModelData(CMDs.PREVIOUS_PAGE));
|
});
|
||||||
boolean hasNext = page < maxPage() - (data.size() % (size - 18) == 0 ? 1 : 0);
|
boolean hasNext = page < maxPage() - (data.size() % (size - 18) == 0 ? 1 : 0);
|
||||||
inventory.setItem(size - 1, new SWItem(SWItem.getDye(hasNext ? 10 : 8), hasNext ? (byte) 10 : (byte) 8, Core.MESSAGE.parse(hasNext ? "SWLISINV_NEXT_PAGE_ACTIVE" : "SWLISINV_NEXT_PAGE_INACTIVE", player), clickType -> {
|
inventory.setItem(size - 1, SWItem.getDye(hasNext ? 10 : 8), hasNext ? (byte) 10 : (byte) 8, Core.MESSAGE.parse(hasNext ? "SWLISINV_NEXT_PAGE_ACTIVE" : "SWLISINV_NEXT_PAGE_INACTIVE", player), clickType -> {
|
||||||
if (hasNext) {
|
if (hasNext) {
|
||||||
page++;
|
page++;
|
||||||
open();
|
open();
|
||||||
}
|
}
|
||||||
}).setCustomModelData(CMDs.NEXT_PAGE));
|
});
|
||||||
|
|
||||||
int minElement = page * (size - 18);
|
int minElement = page * (size - 18);
|
||||||
int maxElement = Math.min(data.size(), (page + 1) * (size - 18));
|
int maxElement = Math.min(data.size(), (page + 1) * (size - 18));
|
||||||
|
|||||||
+4
-5
@@ -22,7 +22,6 @@ package de.steamwar.bausystem.features.simulator.gui.base;
|
|||||||
|
|
||||||
import de.steamwar.bausystem.features.simulator.data.Simulator;
|
import de.steamwar.bausystem.features.simulator.data.Simulator;
|
||||||
import de.steamwar.core.Core;
|
import de.steamwar.core.Core;
|
||||||
import de.steamwar.data.CMDs;
|
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@@ -51,19 +50,19 @@ public abstract class SimulatorScrollGui<T> extends SimulatorBaseGui {
|
|||||||
headerAndFooter();
|
headerAndFooter();
|
||||||
scroll = maxScroll();
|
scroll = maxScroll();
|
||||||
|
|
||||||
inventory.setItem(size - 9, new SWItem(SWItem.getDye(scroll > 0 ? 10 : 8), scroll > 0 ? (byte) 10 : (byte) 8, Core.MESSAGE.parse(scroll > 0 ? "SWLISINV_PREVIOUS_PAGE_ACTIVE" : "SWLISINV_PREVIOUS_PAGE_INACTIVE", player), clickType -> {
|
inventory.setItem(size - 9, SWItem.getDye(scroll > 0 ? 10 : 8), scroll > 0 ? (byte) 10 : (byte) 8, Core.MESSAGE.parse(scroll > 0 ? "SWLISINV_PREVIOUS_PAGE_ACTIVE" : "SWLISINV_PREVIOUS_PAGE_INACTIVE", player), clickType -> {
|
||||||
if (scroll > 0) {
|
if (scroll > 0) {
|
||||||
scroll = Math.max(0, scroll - 9);
|
scroll = Math.max(0, scroll - 9);
|
||||||
open();
|
open();
|
||||||
}
|
}
|
||||||
}).setCustomModelData(CMDs.PREVIOUS_PAGE));
|
});
|
||||||
boolean hasNext = (data.size() + 1) - scroll > 9;
|
boolean hasNext = (data.size() + 1) - scroll > 9;
|
||||||
inventory.setItem(size - 1, new SWItem(SWItem.getDye(hasNext ? 10 : 8), hasNext ? (byte) 10 : (byte) 8, Core.MESSAGE.parse(hasNext ? "SWLISINV_NEXT_PAGE_ACTIVE" : "SWLISINV_NEXT_PAGE_INACTIVE", player), clickType -> {
|
inventory.setItem(size - 1, SWItem.getDye(hasNext ? 10 : 8), hasNext ? (byte) 10 : (byte) 8, Core.MESSAGE.parse(hasNext ? "SWLISINV_NEXT_PAGE_ACTIVE" : "SWLISINV_NEXT_PAGE_INACTIVE", player), clickType -> {
|
||||||
if (hasNext) {
|
if (hasNext) {
|
||||||
scroll = Math.min(scroll + 9, data.size() + 1 - 9);
|
scroll = Math.min(scroll + 9, data.size() + 1 - 9);
|
||||||
open();
|
open();
|
||||||
}
|
}
|
||||||
}).setCustomModelData(CMDs.NEXT_PAGE));
|
});
|
||||||
|
|
||||||
for (int i = 0; i < 9; i++) {
|
for (int i = 0; i < 9; i++) {
|
||||||
if (scroll + i < data.size()) {
|
if (scroll + i < data.size()) {
|
||||||
|
|||||||
-23
@@ -1,23 +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 <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.features.simulator.preview;
|
|
||||||
|
|
||||||
public class SimulatorPreview {
|
|
||||||
}
|
|
||||||
-76
@@ -1,76 +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 <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.features.simulator.preview;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.ToString;
|
|
||||||
import org.bukkit.util.BoundingBox;
|
|
||||||
import org.bukkit.util.VoxelShape;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
@AllArgsConstructor
|
|
||||||
@ToString
|
|
||||||
public class SimulatorPreviewAABB {
|
|
||||||
public double minX;
|
|
||||||
public double minY;
|
|
||||||
public double minZ;
|
|
||||||
public double maxX;
|
|
||||||
public double maxY;
|
|
||||||
public double maxZ;
|
|
||||||
|
|
||||||
public SimulatorPreviewAABB copy() {
|
|
||||||
return new SimulatorPreviewAABB(minX, minY, minZ, maxX, maxY, maxZ);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void expandTowards(double vx, double vy, double vz) {
|
|
||||||
if (vx < 0) {
|
|
||||||
minX += vx;
|
|
||||||
} else {
|
|
||||||
maxX += vx;
|
|
||||||
}
|
|
||||||
if (vy < 0) {
|
|
||||||
minY += vy;
|
|
||||||
} else {
|
|
||||||
maxY += vy;
|
|
||||||
}
|
|
||||||
if (vz < 0) {
|
|
||||||
minZ += vz;
|
|
||||||
} else {
|
|
||||||
maxZ += vz;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void add(double vx, double vy, double vz) {
|
|
||||||
minX += vx;
|
|
||||||
minY += vy;
|
|
||||||
minZ += vz;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean intersects(double x, double y, double z, BoundingBox boundingBox) {
|
|
||||||
return minX - (x + boundingBox.getMaxX()) < -1.0E-7 &&
|
|
||||||
maxX - (x + boundingBox.getMinX()) > 1.0E-7 &&
|
|
||||||
minY - (y + boundingBox.getMaxY()) < -1.0E-7 &&
|
|
||||||
maxY - (y + boundingBox.getMinY()) > 1.0E-7 &&
|
|
||||||
minZ - (z + boundingBox.getMaxZ()) < -1.0E-7 &&
|
|
||||||
maxZ - (z + boundingBox.getMinZ()) > 1.0E-7;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-114
@@ -1,114 +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 <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.features.simulator.preview;
|
|
||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
|
||||||
import de.steamwar.bausystem.features.simulator.data.Simulator;
|
|
||||||
import de.steamwar.bausystem.features.tracer.TNTPoint;
|
|
||||||
import de.steamwar.bausystem.features.tracer.Trace;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.block.data.BlockData;
|
|
||||||
import org.bukkit.util.Consumer;
|
|
||||||
import org.bukkit.util.Vector;
|
|
||||||
import org.bukkit.util.VoxelShape;
|
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class SimulatorPreviewCalculator {
|
|
||||||
private static final World WORLD = Bukkit.getWorlds().get(0);
|
|
||||||
|
|
||||||
public final Simulator simulator;
|
|
||||||
public final List<SimulatorPreviewTNT> tnts = new ArrayList<>();
|
|
||||||
|
|
||||||
private int ticks = 0;
|
|
||||||
private final Set<SimulatorPreviewPos> air = new HashSet<>();
|
|
||||||
private final Map<SimulatorPreviewPos, BlockData> datas = new HashMap<>();
|
|
||||||
private final Map<SimulatorPreviewPos, VoxelShape> shapes = new HashMap<>();
|
|
||||||
|
|
||||||
public BlockData getBlockData(int x, int y, int z) {
|
|
||||||
SimulatorPreviewPos pos = new SimulatorPreviewPos(x, y, z);
|
|
||||||
if (air.contains(pos)) return null;
|
|
||||||
return datas.computeIfAbsent(pos, __ -> {
|
|
||||||
BlockData blockData = WORLD.getBlockData(x, y, z);
|
|
||||||
if (blockData.getMaterial().isAir()) {
|
|
||||||
air.add(pos);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return blockData;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public VoxelShape getBlockShape(int x, int y, int z) {
|
|
||||||
SimulatorPreviewPos pos = new SimulatorPreviewPos(x, y, z);
|
|
||||||
if (air.contains(pos)) return null;
|
|
||||||
return shapes.computeIfAbsent(pos, __ -> {
|
|
||||||
Block block = WORLD.getBlockAt(x, y, z);
|
|
||||||
if (block.getType().isAir()) {
|
|
||||||
air.add(pos);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return block.getCollisionShape();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAir(int x, int y, int z) {
|
|
||||||
SimulatorPreviewPos pos = new SimulatorPreviewPos(x, y, z);
|
|
||||||
air.add(pos);
|
|
||||||
datas.remove(pos);
|
|
||||||
shapes.remove(pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void spawnTNT(double x, double y, double z) {
|
|
||||||
tnts.add(new SimulatorPreviewTNT(this, x, y, z));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void calculate(Consumer<SimulatorPreviewResult> result) {
|
|
||||||
List<TNTPoint> tntPoints = new ArrayList<>();
|
|
||||||
Bukkit.getScheduler().runTaskTimer(BauSystem.getInstance(), bukkitTask -> {
|
|
||||||
long time = System.currentTimeMillis();
|
|
||||||
while (!tnts.isEmpty()) {
|
|
||||||
if (System.currentTimeMillis() - time > 40) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
tick(tntPoints);
|
|
||||||
}
|
|
||||||
bukkitTask.cancel();
|
|
||||||
System.out.println(tntPoints);
|
|
||||||
result.accept(new SimulatorPreviewResult(new Trace(null, tntPoints), air));
|
|
||||||
}, 1, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void tick(List<TNTPoint> tntPoints) {
|
|
||||||
System.out.println("TICK");
|
|
||||||
tnts.removeIf(simulatorPreviewTNT -> {
|
|
||||||
tntPoints.add(new TNTPoint(0, false, false, true, false, false, ticks, simulatorPreviewTNT.fuse, new Location(WORLD, simulatorPreviewTNT.x + 0.49, simulatorPreviewTNT.y, simulatorPreviewTNT.z + 0.49), new Vector(simulatorPreviewTNT.vx, simulatorPreviewTNT.vy, simulatorPreviewTNT.vz), tntPoints));
|
|
||||||
simulatorPreviewTNT.tick();
|
|
||||||
if (!simulatorPreviewTNT.removed) return false;
|
|
||||||
tntPoints.add(new TNTPoint(0, true, false, true, false, false, ticks, simulatorPreviewTNT.fuse, new Location(WORLD, simulatorPreviewTNT.x + 0.49, simulatorPreviewTNT.y, simulatorPreviewTNT.z + 0.49), new Vector(simulatorPreviewTNT.vx, simulatorPreviewTNT.vy, simulatorPreviewTNT.vz), tntPoints));
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
ticks++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-31
@@ -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 <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.features.simulator.preview;
|
|
||||||
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
@EqualsAndHashCode
|
|
||||||
final class SimulatorPreviewPos {
|
|
||||||
public final int x;
|
|
||||||
public final int y;
|
|
||||||
public final int z;
|
|
||||||
}
|
|
||||||
-61
@@ -1,61 +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 <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.features.simulator.preview;
|
|
||||||
|
|
||||||
import de.steamwar.bausystem.features.tracer.Trace;
|
|
||||||
import de.steamwar.bausystem.features.tracer.rendering.BundleFilter;
|
|
||||||
import de.steamwar.bausystem.features.tracer.rendering.PlayerTraceShowData;
|
|
||||||
import lombok.Getter;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.block.data.BlockData;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
public class SimulatorPreviewResult {
|
|
||||||
private static final World WORLD = Bukkit.getWorlds().get(0);
|
|
||||||
private static final BlockData AIR = Material.AIR.createBlockData();
|
|
||||||
|
|
||||||
private final Trace trace;
|
|
||||||
private final Set<SimulatorPreviewPos> air;
|
|
||||||
|
|
||||||
public SimulatorPreviewResult(Trace trace, Set<SimulatorPreviewPos> air) {
|
|
||||||
this.trace = trace;
|
|
||||||
this.air = air;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void show(Player player) {
|
|
||||||
trace.render(player, new PlayerTraceShowData(BundleFilter.DEFAULT));
|
|
||||||
air.forEach(simulatorPreviewPos -> {
|
|
||||||
player.sendBlockChange(new Location(WORLD, simulatorPreviewPos.x, simulatorPreviewPos.y, simulatorPreviewPos.z, 0, 0), AIR);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public void hide(Player player) {
|
|
||||||
trace.hide(player);
|
|
||||||
air.forEach(simulatorPreviewPos -> {
|
|
||||||
player.sendBlockChange(new Location(WORLD, simulatorPreviewPos.x, simulatorPreviewPos.y, simulatorPreviewPos.z, 0, 0), WORLD.getBlockData(simulatorPreviewPos.x, simulatorPreviewPos.y, simulatorPreviewPos.z));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-228
@@ -1,228 +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 <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.features.simulator.preview;
|
|
||||||
|
|
||||||
import org.bukkit.Axis;
|
|
||||||
import org.bukkit.util.BoundingBox;
|
|
||||||
import org.bukkit.util.Vector;
|
|
||||||
import org.bukkit.util.VoxelShape;
|
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class SimulatorPreviewTNT {
|
|
||||||
|
|
||||||
private static final double size = 0.98;
|
|
||||||
private static final Random random = new Random();
|
|
||||||
|
|
||||||
private final SimulatorPreviewCalculator data;
|
|
||||||
private boolean gravity = true;
|
|
||||||
int fuse = 80;
|
|
||||||
double x;
|
|
||||||
double y;
|
|
||||||
double z;
|
|
||||||
double vx;
|
|
||||||
double vy;
|
|
||||||
double vz;
|
|
||||||
|
|
||||||
private SimulatorPreviewVec collide = new SimulatorPreviewVec();
|
|
||||||
private boolean onGround;
|
|
||||||
boolean removed = false;
|
|
||||||
|
|
||||||
public SimulatorPreviewTNT(SimulatorPreviewCalculator data, double x, double y, double z) {
|
|
||||||
this.data = data;
|
|
||||||
|
|
||||||
this.x = x;
|
|
||||||
this.y = y;
|
|
||||||
this.z = z;
|
|
||||||
|
|
||||||
double d = random.nextDouble() * Math.PI * 2;
|
|
||||||
this.vx = -Math.sin(d) * 0.02;
|
|
||||||
this.vy = 0.2;
|
|
||||||
this.vz = -Math.cos(d) * 0.02;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void tick() {
|
|
||||||
System.out.println(x + " " + y + " " + z);
|
|
||||||
// TODO: Issue in movement still!
|
|
||||||
// System.out.println(x + " " + y + " " + z);
|
|
||||||
// Gravity
|
|
||||||
if (gravity) {
|
|
||||||
vy -= 0.04;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Movement
|
|
||||||
move();
|
|
||||||
|
|
||||||
// TODO: EffectsFromOtherBlocks
|
|
||||||
|
|
||||||
// Velocity * 0.98
|
|
||||||
vx *= 0.98;
|
|
||||||
vy *= 0.98;
|
|
||||||
vz *= 0.98;
|
|
||||||
|
|
||||||
// OnGround Velocity * 0.7 -0.5 0.7
|
|
||||||
if (onGround) {
|
|
||||||
vx *= 0.7;
|
|
||||||
vy *= -0.5;
|
|
||||||
vz *= 0.7;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Decrease Fuse
|
|
||||||
fuse--;
|
|
||||||
if (fuse <= 0) {
|
|
||||||
// Explode on zero Fuse
|
|
||||||
explode();
|
|
||||||
} else {
|
|
||||||
// TODO: or do water Movement!
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void move() {
|
|
||||||
collide();
|
|
||||||
double collisionLengthSquared = collide.lengthSquared();
|
|
||||||
if (collisionLengthSquared > 1.0E-7 || new Vector(vx, vy, vz).lengthSquared() - collisionLengthSquared < 1.0E-7) {
|
|
||||||
x += collide.x;
|
|
||||||
y += collide.y;
|
|
||||||
z += collide.z;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean xCollision = !equal(vx, collide.x);
|
|
||||||
boolean zCollision = !equal(vz, collide.z);
|
|
||||||
boolean horizontalCollision = xCollision || zCollision;
|
|
||||||
if (Math.abs(vy) > 0.0F) {
|
|
||||||
boolean verticalCollision = vy != collide.y;
|
|
||||||
onGround = verticalCollision && vy < (double) 0.0F;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (horizontalCollision) {
|
|
||||||
if (xCollision) vx = 0;
|
|
||||||
if (zCollision) vz = 0;
|
|
||||||
}
|
|
||||||
vx = collide.x;
|
|
||||||
vy = collide.y;
|
|
||||||
vz = collide.z;
|
|
||||||
// TODO: Get Block -> updateEntityMovementAfterFallOn!
|
|
||||||
// TODO: Get BlockSpeedFactor multiply
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean equal(double first, double second) {
|
|
||||||
return Math.abs(second - first) < (double) 1.0E-5F;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void collide() {
|
|
||||||
boolean xZero = vx == 0;
|
|
||||||
boolean zZero = vz == 0;
|
|
||||||
if (xZero && vy == 0 && zZero) {
|
|
||||||
collide.x = 0;
|
|
||||||
collide.y = 0;
|
|
||||||
collide.z = 0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
SimulatorPreviewAABB box = new SimulatorPreviewAABB(x, y, z, x + size, y + size, z + size);
|
|
||||||
|
|
||||||
double vx = this.vx;
|
|
||||||
double vy = this.vy;
|
|
||||||
double vz = this.vz;
|
|
||||||
|
|
||||||
if (vy != 0) {
|
|
||||||
vy = iterateBlocks(box.copy(), Axis.Y, vy);
|
|
||||||
if (vy != 0) box.add(0, vy, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean xSmaller = Math.abs(vx) < Math.abs(vz);
|
|
||||||
if (xSmaller && vz != 0) {
|
|
||||||
vz = iterateBlocks(box.copy(), Axis.Z, vz);
|
|
||||||
if (vz != 0) box.add(0, 0, vz);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (vx != 0) {
|
|
||||||
vx = iterateBlocks(box.copy(), Axis.X, vx);
|
|
||||||
if (vx != 0) box.add(vx, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!xSmaller && vz != 0) {
|
|
||||||
vz = iterateBlocks(box.copy(), Axis.Z, vz);
|
|
||||||
if (vz != 0) box.add(0, 0, vz);
|
|
||||||
}
|
|
||||||
|
|
||||||
collide.x = vx;
|
|
||||||
collide.y = vy;
|
|
||||||
collide.z = vz;
|
|
||||||
}
|
|
||||||
|
|
||||||
private double iterateBlocks(SimulatorPreviewAABB box, Axis axis, double v) {
|
|
||||||
switch (axis) {
|
|
||||||
case X -> box.expandTowards(v, 0, 0);
|
|
||||||
case Y -> box.expandTowards(0, v, 0);
|
|
||||||
case Z -> box.expandTowards(0, 0, v);
|
|
||||||
}
|
|
||||||
boolean negative = v < 0;
|
|
||||||
for (int x = floor(box.minX - 1.0E-7) - 1; x < floor(box.maxX + 1.0E-7) + 1; x++) {
|
|
||||||
for (int y = floor(box.minY - 1.0E-7) - 1; y < floor(box.maxY + 1.0E-7) + 1; y++) {
|
|
||||||
for (int z = floor(box.minZ - 1.0E-7) - 1; z < floor(box.maxZ + 1.0E-7) + 1; z++) {
|
|
||||||
VoxelShape shape = data.getBlockShape(x, y, z);
|
|
||||||
if (shape == null) continue;
|
|
||||||
for (BoundingBox other : shape.getBoundingBoxes()) {
|
|
||||||
switch (axis) {
|
|
||||||
case X -> {
|
|
||||||
if (box.intersects(x, y, z, other)) {
|
|
||||||
if (negative) {
|
|
||||||
v = Math.max(v, x + other.getMaxX() - this.x);
|
|
||||||
} else {
|
|
||||||
v = Math.min(v, x + other.getMinX() - this.x - size);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case Y -> {
|
|
||||||
if (box.intersects(x, y, z, other)) {
|
|
||||||
if (negative) {
|
|
||||||
v = Math.max(v, y + other.getMaxY() - this.y);
|
|
||||||
} else {
|
|
||||||
v = Math.min(v, y + other.getMinY() - this.y - size);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case Z -> {
|
|
||||||
if (box.intersects(x, y, z, other)) {
|
|
||||||
if (negative) {
|
|
||||||
v = Math.max(v, z + other.getMaxZ() - this.z);
|
|
||||||
} else {
|
|
||||||
v = Math.min(v, z + other.getMinZ() - this.z - size);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int floor(double value) {
|
|
||||||
int i = (int) value;
|
|
||||||
return value < (double) i ? i - 1 : i;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void explode() {
|
|
||||||
removed = true;
|
|
||||||
// TODO: Implement
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-30
@@ -1,30 +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 <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.features.simulator.preview;
|
|
||||||
|
|
||||||
public class SimulatorPreviewVec {
|
|
||||||
public double x;
|
|
||||||
public double y;
|
|
||||||
public double z;
|
|
||||||
|
|
||||||
public double lengthSquared() {
|
|
||||||
return x * x + y * y + z * z;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+2
-3
@@ -21,7 +21,6 @@ package de.steamwar.bausystem.features.slaves.laufbau;
|
|||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.bausystem.shared.Pair;
|
import de.steamwar.bausystem.shared.Pair;
|
||||||
import de.steamwar.data.CMDs;
|
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
import de.steamwar.inventory.SWListInv;
|
import de.steamwar.inventory.SWListInv;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@@ -60,7 +59,7 @@ public class LaufbauSettings {
|
|||||||
open();
|
open();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (clickType.isLeftClick()) {
|
if (clickType.isCreativeAction()) {
|
||||||
open(entry.getKey());
|
open(entry.getKey());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -92,7 +91,7 @@ public class LaufbauSettings {
|
|||||||
});
|
});
|
||||||
inv.setItem(49, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_GUI_BACK", p), clickType -> {
|
inv.setItem(49, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("LAUFBAU_SETTINGS_GUI_BACK", p), clickType -> {
|
||||||
open();
|
open();
|
||||||
}).setCustomModelData(CMDs.BACK));
|
}));
|
||||||
inv.open();
|
inv.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+12
-14
@@ -24,7 +24,6 @@ import de.steamwar.bausystem.BauSystem;
|
|||||||
import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
|
import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
|
||||||
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
||||||
import de.steamwar.bausystem.features.tracer.TNTPoint;
|
import de.steamwar.bausystem.features.tracer.TNTPoint;
|
||||||
import de.steamwar.bausystem.features.tracer.Trace;
|
|
||||||
import de.steamwar.bausystem.features.tracer.TraceManager;
|
import de.steamwar.bausystem.features.tracer.TraceManager;
|
||||||
import de.steamwar.bausystem.region.Point;
|
import de.steamwar.bausystem.region.Point;
|
||||||
import de.steamwar.bausystem.utils.FlatteningWrapper;
|
import de.steamwar.bausystem.utils.FlatteningWrapper;
|
||||||
@@ -35,6 +34,7 @@ import org.bukkit.util.Vector;
|
|||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.function.BiPredicate;
|
import java.util.function.BiPredicate;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class ProcessingTracesState implements LaufbauState {
|
public class ProcessingTracesState implements LaufbauState {
|
||||||
|
|
||||||
@@ -45,9 +45,8 @@ public class ProcessingTracesState implements LaufbauState {
|
|||||||
private final List<BlockBoundingBox> elements;
|
private final List<BlockBoundingBox> elements;
|
||||||
private final int factor;
|
private final int factor;
|
||||||
|
|
||||||
private final List<Trace> Traces;
|
private final List<TNTPoint> TNTPoints;
|
||||||
private final List<TNTPoint> TNTPoints = new ArrayList<>();
|
private final int totalTntRecords;
|
||||||
private final int totalTraces;
|
|
||||||
|
|
||||||
private final Set<Point> affectedBlocks = new HashSet<>();
|
private final Set<Point> affectedBlocks = new HashSet<>();
|
||||||
private final Map<Point, Set<Cuboid>> cuboidsPerChunk = new HashMap<>();
|
private final Map<Point, Set<Cuboid>> cuboidsPerChunk = new HashMap<>();
|
||||||
@@ -59,13 +58,18 @@ public class ProcessingTracesState implements LaufbauState {
|
|||||||
this.elements = elements;
|
this.elements = elements;
|
||||||
this.factor = factor;
|
this.factor = factor;
|
||||||
|
|
||||||
Traces = new ArrayList<>(TraceManager.instance.getAll());
|
// TODO: Optimize only retrieving traces inside of the affected regions!
|
||||||
totalTraces = Traces.size();
|
TNTPoints = TraceManager.instance.getAll()
|
||||||
|
.stream()
|
||||||
|
.flatMap(trace -> trace.getHistories().stream())
|
||||||
|
.flatMap(Collection::stream)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
totalTntRecords = TNTPoints.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String actionBarMessage(Player p) {
|
public String actionBarMessage(Player p) {
|
||||||
return BauSystem.MESSAGE.parse("LAUFBAU_SIMPLE_PROGRESS", p, BauSystem.MESSAGE.parse("LAUFBAU_STATE_PROCESSING_TRACES", p), totalTraces - Traces.size(), totalTraces, eta(p, start, totalTraces - Traces.size(), totalTraces));
|
return BauSystem.MESSAGE.parse("LAUFBAU_SIMPLE_PROGRESS", p, BauSystem.MESSAGE.parse("LAUFBAU_STATE_PROCESSING_TRACES", p), totalTntRecords - TNTPoints.size(), totalTntRecords, eta(p, start, totalTntRecords - TNTPoints.size(), totalTntRecords));
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean inRegion(Vector location, int expansion) {
|
private boolean inRegion(Vector location, int expansion) {
|
||||||
@@ -74,17 +78,11 @@ public class ProcessingTracesState implements LaufbauState {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasNext() {
|
public boolean hasNext() {
|
||||||
return !Traces.isEmpty() || !TNTPoints.isEmpty();
|
return !TNTPoints.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void next() {
|
public void next() {
|
||||||
if (TNTPoints.isEmpty()) {
|
|
||||||
Trace trace = Traces.remove(0);
|
|
||||||
trace.getHistories().stream().flatMap(Collection::stream).forEach(TNTPoints::add);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
TNTPoint current = TNTPoints.remove(0);
|
TNTPoint current = TNTPoints.remove(0);
|
||||||
if (FlatteningWrapper.impl.inWater(world, current.getLocation().toVector())) return;
|
if (FlatteningWrapper.impl.inWater(world, current.getLocation().toVector())) return;
|
||||||
if (!(inRegion(current.getLocation().toVector(), 1) || (current.getPrevious().isPresent() && inRegion(current.getPrevious().get().getLocation().toVector(), 1))))
|
if (!(inRegion(current.getLocation().toVector(), 1) || (current.getPrevious().isPresent() && inRegion(current.getPrevious().get().getLocation().toVector(), 1))))
|
||||||
|
|||||||
+1
-2
@@ -25,7 +25,6 @@ import com.sk89q.worldedit.world.block.BaseBlock;
|
|||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||||
import de.steamwar.bausystem.utils.WorldEditUtils;
|
import de.steamwar.bausystem.utils.WorldEditUtils;
|
||||||
import de.steamwar.core.Core;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@@ -57,7 +56,7 @@ public class Panzern {
|
|||||||
|
|
||||||
private BaseBlock blockType;
|
private BaseBlock blockType;
|
||||||
private BaseBlock slabType;
|
private BaseBlock slabType;
|
||||||
private static final BaseBlock jukeboxType = (Core.getVersion() > 19 ? BlockTypes.get("lodestone"): BlockTypes.get("jukebox")).getDefaultState().toBaseBlock();
|
private static final BaseBlock jukeboxType = BlockTypes.JUKEBOX.getDefaultState().toBaseBlock();
|
||||||
private static final BaseBlock cobwebType = BlockTypes.COBWEB.getDefaultState().toBaseBlock();
|
private static final BaseBlock cobwebType = BlockTypes.COBWEB.getDefaultState().toBaseBlock();
|
||||||
private static final BaseBlock airType = BlockTypes.AIR.getDefaultState().toBaseBlock();
|
private static final BaseBlock airType = BlockTypes.AIR.getDefaultState().toBaseBlock();
|
||||||
|
|
||||||
|
|||||||
+3
-5
@@ -19,8 +19,8 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.features.smartplace;
|
package de.steamwar.bausystem.features.smartplace;
|
||||||
|
|
||||||
|
import com.comphenix.tinyprotocol.Reflection;
|
||||||
import com.comphenix.tinyprotocol.TinyProtocol;
|
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||||
import de.steamwar.Reflection;
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.bausystem.Permission;
|
import de.steamwar.bausystem.Permission;
|
||||||
import de.steamwar.bausystem.configplayer.Config;
|
import de.steamwar.bausystem.configplayer.Config;
|
||||||
@@ -57,7 +57,6 @@ public class SmartPlaceListener implements Listener {
|
|||||||
static {
|
static {
|
||||||
World world = Bukkit.getWorlds().get(0);
|
World world = Bukkit.getWorlds().get(0);
|
||||||
Block block = world.getBlockAt(0, 0, 0);
|
Block block = world.getBlockAt(0, 0, 0);
|
||||||
block.setType(Material.AIR);
|
|
||||||
BlockState state = block.getState();
|
BlockState state = block.getState();
|
||||||
for (Material material : Material.values()) {
|
for (Material material : Material.values()) {
|
||||||
if (material.isLegacy()) continue;
|
if (material.isLegacy()) continue;
|
||||||
@@ -69,7 +68,6 @@ public class SmartPlaceListener implements Listener {
|
|||||||
} else if (blockData instanceof Stairs) {
|
} else if (blockData instanceof Stairs) {
|
||||||
CONTAINERS.add(material);
|
CONTAINERS.add(material);
|
||||||
}
|
}
|
||||||
state.update(true, false);
|
|
||||||
}
|
}
|
||||||
CONTAINERS.add(Material.GRINDSTONE);
|
CONTAINERS.add(Material.GRINDSTONE);
|
||||||
CONTAINERS.remove(Material.COMPARATOR);
|
CONTAINERS.remove(Material.COMPARATOR);
|
||||||
@@ -83,7 +81,7 @@ public class SmartPlaceListener implements Listener {
|
|||||||
IGNORED.remove(Material.BARRIER);
|
IGNORED.remove(Material.BARRIER);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Class<?> useItem = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundUseItemOnPacket");
|
private static final Class<?> useItem = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInUseItem");
|
||||||
|
|
||||||
private static final Set<Player> SMART_PLACING = new HashSet<>();
|
private static final Set<Player> SMART_PLACING = new HashSet<>();
|
||||||
private static final Set<Player> WAS_EXECUTED = new HashSet<>();
|
private static final Set<Player> WAS_EXECUTED = new HashSet<>();
|
||||||
@@ -225,7 +223,7 @@ public class SmartPlaceListener implements Listener {
|
|||||||
Block block = event.getBlock().getRelative(BlockFace.DOWN);
|
Block block = event.getBlock().getRelative(BlockFace.DOWN);
|
||||||
BlockState old = block.getState();
|
BlockState old = block.getState();
|
||||||
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
|
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
|
||||||
block.setType(Material.GLASS, true);
|
block.setType(Material.GLASS);
|
||||||
old.update(true, false);
|
old.update(true, false);
|
||||||
}, 1);
|
}, 1);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-3
@@ -23,8 +23,6 @@ import de.steamwar.bausystem.BauSystem;
|
|||||||
import de.steamwar.bausystem.region.Point;
|
import de.steamwar.bausystem.region.Point;
|
||||||
import de.steamwar.bausystem.region.Region;
|
import de.steamwar.bausystem.region.Region;
|
||||||
import de.steamwar.bausystem.region.utils.RegionType;
|
import de.steamwar.bausystem.region.utils.RegionType;
|
||||||
import de.steamwar.core.TrickyParticleWrapper;
|
|
||||||
import de.steamwar.core.TrickyTrialsWrapper;
|
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Particle;
|
import org.bukkit.Particle;
|
||||||
@@ -58,7 +56,7 @@ public class BoundaryViewer implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void showRegion(Region region, Player player) {
|
private void showRegion(Region region, Player player) {
|
||||||
drawCuboid(player, TrickyParticleWrapper.impl.getVillagerHappy(), region.getMinPoint(), region.getMaxPoint());
|
drawCuboid(player, Particle.VILLAGER_HAPPY, region.getMinPoint(), region.getMaxPoint());
|
||||||
if (region.hasType(RegionType.TESTBLOCK)) {
|
if (region.hasType(RegionType.TESTBLOCK)) {
|
||||||
drawCuboid(player, Particle.END_ROD, region.getMinPointTestblockExtension(), region.getMaxPointTestblockExtension());
|
drawCuboid(player, Particle.END_ROD, region.getMinPointTestblockExtension(), region.getMaxPointTestblockExtension());
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-10
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.features.tpslimit;
|
package de.steamwar.bausystem.features.tpslimit;
|
||||||
|
|
||||||
import de.steamwar.Reflection;
|
import com.comphenix.tinyprotocol.Reflection;
|
||||||
import com.comphenix.tinyprotocol.TinyProtocol;
|
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||||
import de.steamwar.core.BountifulWrapper;
|
import de.steamwar.core.BountifulWrapper;
|
||||||
import de.steamwar.core.ChatWrapper;
|
import de.steamwar.core.ChatWrapper;
|
||||||
@@ -45,18 +45,18 @@ class PacketCache {
|
|||||||
private static Set<Entity> entities = new HashSet<>();
|
private static Set<Entity> entities = new HashSet<>();
|
||||||
private static BukkitTask task = null;
|
private static BukkitTask task = null;
|
||||||
|
|
||||||
private static Class<?> vec3dClass = Reflection.getClass("net.minecraft.world.phys.Vec3");
|
private static Class<?> vec3dClass = Reflection.getClass("{nms.world.phys}.Vec3D");
|
||||||
private static Reflection.Field<Object> zeroVec3d = (Reflection.Field<Object>) Reflection.getField(vec3dClass, vec3dClass, 0);
|
private static Reflection.FieldAccessor<Object> zeroVec3d = (Reflection.FieldAccessor<Object>) Reflection.getField(vec3dClass, vec3dClass, 0);
|
||||||
private static Object ZERO_VEC3D = zeroVec3d.get(null);
|
private static Object ZERO_VEC3D = zeroVec3d.get(null);
|
||||||
private static Class<?> velocityPacketClass = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundSetEntityMotionPacket");
|
private static Class<?> velocityPacketClass = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutEntityVelocity");
|
||||||
private static Reflection.Constructor velocityPacketConstructor = Reflection.getConstructor(velocityPacketClass, int.class, vec3dClass);
|
private static Reflection.ConstructorInvoker velocityPacketConstructor = Reflection.getConstructor(velocityPacketClass, int.class, vec3dClass);
|
||||||
|
|
||||||
private static Class<?> teleportPacketClass = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundTeleportEntityPacket");
|
private static Class<?> teleportPacketClass = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutEntityTeleport");
|
||||||
private static Class<?> entityClass = Reflection.getClass("net.minecraft.world.entity.Entity");
|
private static Class<?> entityClass = Reflection.getClass("{nms.world.entity}.Entity");
|
||||||
private static Reflection.Constructor teleportPacketConstructor = Reflection.getConstructor(teleportPacketClass, entityClass);
|
private static Reflection.ConstructorInvoker teleportPacketConstructor = Reflection.getConstructor(teleportPacketClass, entityClass);
|
||||||
|
|
||||||
private static Class<?> craftEntityClass = Reflection.getClass("org.bukkit.craftbukkit.entity.CraftEntity");
|
private static Class<?> craftEntityClass = Reflection.getClass("{obc}.entity.CraftEntity");
|
||||||
private static Reflection.Method getHandle = Reflection.getMethod(craftEntityClass, "getHandle");
|
private static Reflection.MethodInvoker getHandle = Reflection.getMethod(craftEntityClass, "getHandle");
|
||||||
|
|
||||||
private static Object noGravityDataWatcher = BountifulWrapper.impl.getDataWatcherObject(5, Boolean.class);
|
private static Object noGravityDataWatcher = BountifulWrapper.impl.getDataWatcherObject(5, Boolean.class);
|
||||||
private static Object fuseDataWatcher = BountifulWrapper.impl.getDataWatcherObject(8, Integer.class);
|
private static Object fuseDataWatcher = BountifulWrapper.impl.getDataWatcherObject(8, Integer.class);
|
||||||
|
|||||||
+6
-6
@@ -42,16 +42,16 @@ public class TPSCommand extends SWCommand {
|
|||||||
public void genericCommand(Player p, String... args) {
|
public void genericCommand(Player p, String... args) {
|
||||||
BauSystem.MESSAGE.sendPrefixless("OTHER_TPS_HEAD", p);
|
BauSystem.MESSAGE.sendPrefixless("OTHER_TPS_HEAD", p);
|
||||||
BauSystem.MESSAGE.sendPrefixless("OTHER_TPS_MESSAGE", p,
|
BauSystem.MESSAGE.sendPrefixless("OTHER_TPS_MESSAGE", p,
|
||||||
TPSWatcher.getTPSUnlimited(TPSWatcher.TPSType.ONE_SECOND),
|
TPSWatcher.getTPS(TPSWatcher.TPSType.ONE_SECOND),
|
||||||
TPSWatcher.getTPSUnlimited(TPSWatcher.TPSType.TEN_SECONDS),
|
TPSWatcher.getTPS(TPSWatcher.TPSType.TEN_SECONDS),
|
||||||
TPSWatcher.getTPSUnlimited(TPSWatcher.TPSType.ONE_MINUTE),
|
TPSWatcher.getTPS(TPSWatcher.TPSType.ONE_MINUTE),
|
||||||
TPSWatcher.getTPSUnlimited(TPSWatcher.TPSType.FIVE_MINUTES),
|
TPSWatcher.getTPS(TPSWatcher.TPSType.FIVE_MINUTES),
|
||||||
TPSWatcher.getTPSUnlimited(TPSWatcher.TPSType.TEN_MINUTES)
|
TPSWatcher.getTPS(TPSWatcher.TPSType.TEN_MINUTES)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register
|
@Register
|
||||||
public void genericCommand(Player p, TPSWatcher.TPSType type) {
|
public void genericCommand(Player p, TPSWatcher.TPSType type) {
|
||||||
BauSystem.MESSAGE.sendPrefixless("OTHER_TPS_SINGLE", p, TPSWatcher.getTPSUnlimited(type));
|
BauSystem.MESSAGE.sendPrefixless("OTHER_TPS_SINGLE", p, tpsSystem.getTPS(type));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-5
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.features.tpslimit;
|
package de.steamwar.bausystem.features.tpslimit;
|
||||||
|
|
||||||
import de.steamwar.Reflection;
|
import com.comphenix.tinyprotocol.Reflection;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.experimental.UtilityClass;
|
import lombok.experimental.UtilityClass;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@@ -28,11 +28,11 @@ import org.bukkit.World;
|
|||||||
@UtilityClass
|
@UtilityClass
|
||||||
public class TPSFreezeUtils {
|
public class TPSFreezeUtils {
|
||||||
|
|
||||||
private static Reflection.Field<Boolean> fieldAccessor;
|
private static Reflection.FieldAccessor<Boolean> fieldAccessor;
|
||||||
@Getter
|
@Getter
|
||||||
private static final boolean canFreeze;
|
private static final boolean canFreeze;
|
||||||
|
|
||||||
private static final Reflection.Method getWorldHandle = Reflection.getTypedMethod(Reflection.getClass("org.bukkit.craftbukkit.CraftWorld"), "getHandle", null);
|
private static final Reflection.MethodInvoker getWorldHandle = Reflection.getTypedMethod(Reflection.getClass("{obc}.CraftWorld"), "getHandle", null);
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private static boolean frozen = false;
|
private static boolean frozen = false;
|
||||||
@@ -40,9 +40,9 @@ public class TPSFreezeUtils {
|
|||||||
private static final World world = Bukkit.getWorlds().get(0);
|
private static final World world = Bukkit.getWorlds().get(0);
|
||||||
|
|
||||||
static {
|
static {
|
||||||
Reflection.Field<Boolean> fieldAccessor;
|
Reflection.FieldAccessor<Boolean> fieldAccessor;
|
||||||
try {
|
try {
|
||||||
fieldAccessor = Reflection.getField(Reflection.getClass("net.minecraft.server.level.ServerLevel"), "freezed", boolean.class);
|
fieldAccessor = Reflection.getField(Reflection.getClass("{nms.server.level}.WorldServer"), "freezed", boolean.class);
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
fieldAccessor = null;
|
fieldAccessor = null;
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-3
@@ -19,12 +19,15 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.features.tpslimit;
|
package de.steamwar.bausystem.features.tpslimit;
|
||||||
|
|
||||||
import de.steamwar.Reflection;
|
import com.comphenix.tinyprotocol.Reflection;
|
||||||
import com.comphenix.tinyprotocol.TinyProtocol;
|
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||||
|
import de.steamwar.bausystem.SWUtils;
|
||||||
import de.steamwar.bausystem.utils.PlayerMovementWrapper;
|
import de.steamwar.bausystem.utils.PlayerMovementWrapper;
|
||||||
import de.steamwar.core.Core;
|
import de.steamwar.core.Core;
|
||||||
|
import de.steamwar.core.TPSWatcher;
|
||||||
import lombok.experimental.UtilityClass;
|
import lombok.experimental.UtilityClass;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.scheduler.BukkitTask;
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
|
|
||||||
@@ -101,8 +104,8 @@ public class TPSLimitUtils {
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private static final Class<?> position = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundMovePlayerPacket$Pos");
|
private static final Class<?> position = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInFlying$PacketPlayInPosition");
|
||||||
private static final Class<?> positionLook = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundMovePlayerPacket$PosRot");
|
private static final Class<?> positionLook = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInFlying$PacketPlayInPositionLook");
|
||||||
static {
|
static {
|
||||||
BiFunction<Player, Object, Object> positionSetter = (player, o) -> {
|
BiFunction<Player, Object, Object> positionSetter = (player, o) -> {
|
||||||
if (tpsLimiter != null) {
|
if (tpsLimiter != null) {
|
||||||
|
|||||||
+11
-9
@@ -38,7 +38,6 @@ import de.steamwar.inventory.SWAnvilInv;
|
|||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import de.steamwar.linkage.LinkedInstance;
|
import de.steamwar.linkage.LinkedInstance;
|
||||||
import de.steamwar.linkage.MaxVersion;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@@ -52,11 +51,14 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
@Linked
|
@Linked
|
||||||
@MaxVersion(20) // Hotfix for 1.21 tps limit! -> Backport coming later
|
|
||||||
public class TPSSystem implements Listener {
|
public class TPSSystem implements Listener {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private static double currentTPSLimit = 20;
|
private double currentTPSLimit = 20;
|
||||||
|
|
||||||
|
public double getTPS(TPSWatcher.TPSType tpsType) {
|
||||||
|
return TPSWatcher.getTPSUnlimited(tpsType);
|
||||||
|
}
|
||||||
|
|
||||||
public TPSSystem() {
|
public TPSSystem() {
|
||||||
if (TPSFreezeUtils.isCanFreeze()) {
|
if (TPSFreezeUtils.isCanFreeze()) {
|
||||||
@@ -334,26 +336,26 @@ public class TPSSystem implements Listener {
|
|||||||
} else if (TPSFreezeUtils.frozen()) {
|
} else if (TPSFreezeUtils.frozen()) {
|
||||||
return "§e" + BauSystem.MESSAGE.parse("SCOREBOARD_TPS", p) + "§8: " + BauSystem.MESSAGE.parse("SCOREBOARD_TPS_FROZEN", p);
|
return "§e" + BauSystem.MESSAGE.parse("SCOREBOARD_TPS", p) + "§8: " + BauSystem.MESSAGE.parse("SCOREBOARD_TPS_FROZEN", p);
|
||||||
} else {
|
} else {
|
||||||
return "§e" + BauSystem.MESSAGE.parse("SCOREBOARD_TPS", p) + "§8: " + tpsColor() + TPSWatcher.getTPSUnlimited(TPSWatcher.TPSType.ONE_SECOND) + tpsLimit();
|
return "§e" + BauSystem.MESSAGE.parse("SCOREBOARD_TPS", p) + "§8: " + tpsColor() + tpsSystem.getTPS(TPSWatcher.TPSType.ONE_SECOND) + tpsLimit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String tpsColor() {
|
private String tpsColor() {
|
||||||
double tps = TPSWatcher.getTPSUnlimited(TPSWatcher.TPSType.ONE_SECOND);
|
double tps = tpsSystem.getTPS(TPSWatcher.TPSType.ONE_SECOND);
|
||||||
if (tps > TPSSystem.getCurrentTPSLimit() * 0.9) {
|
if (tps > tpsSystem.getCurrentTPSLimit() * 0.9) {
|
||||||
return "§a";
|
return "§a";
|
||||||
}
|
}
|
||||||
if (tps > TPSSystem.getCurrentTPSLimit() * 0.5) {
|
if (tps > tpsSystem.getCurrentTPSLimit() * 0.5) {
|
||||||
return "§e";
|
return "§e";
|
||||||
}
|
}
|
||||||
return "§c";
|
return "§c";
|
||||||
}
|
}
|
||||||
|
|
||||||
private String tpsLimit() {
|
private String tpsLimit() {
|
||||||
if (TPSSystem.getCurrentTPSLimit() == 20) {
|
if (tpsSystem.getCurrentTPSLimit() == 20) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
return "§8/§7" + TPSSystem.getCurrentTPSLimit();
|
return "§8/§7" + tpsSystem.getCurrentTPSLimit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,23 +22,25 @@ package de.steamwar.bausystem.features.tracer;
|
|||||||
import de.steamwar.bausystem.region.Region;
|
import de.steamwar.bausystem.region.Region;
|
||||||
import de.steamwar.bausystem.region.utils.RegionExtensionType;
|
import de.steamwar.bausystem.region.utils.RegionExtensionType;
|
||||||
import de.steamwar.bausystem.region.utils.RegionType;
|
import de.steamwar.bausystem.region.utils.RegionType;
|
||||||
import lombok.AccessLevel;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.TNTPrimed;
|
import org.bukkit.entity.TNTPrimed;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import java.io.Externalizable;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.ObjectInput;
|
||||||
|
import java.io.ObjectOutput;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Recording of a tnt at a specific tick
|
* Recording of a tnt at a specific tick
|
||||||
*/
|
*/
|
||||||
@AllArgsConstructor
|
|
||||||
@Getter
|
@Getter
|
||||||
public class TNTPoint{
|
public class TNTPoint implements Externalizable {
|
||||||
/**
|
/**
|
||||||
* Unique number to identify records being of the same tnt
|
* Unique number to identify records being of the same tnt
|
||||||
*/
|
*/
|
||||||
@@ -95,9 +97,12 @@ public class TNTPoint{
|
|||||||
private List<TNTPoint> history;
|
private List<TNTPoint> history;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for object creation in trace recording
|
* Constructor for deserialization only !! Do not Call !!
|
||||||
*/
|
*/
|
||||||
protected TNTPoint(int tntId, TNTPrimed tnt, boolean explosion, boolean afterFirstExplosion, long ticksSinceStart,
|
public TNTPoint() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public TNTPoint(int tntId, TNTPrimed tnt, boolean explosion, boolean afterFirstExplosion, long ticksSinceStart,
|
||||||
List<TNTPoint> history, List<Block> destroyedBlocks) {
|
List<TNTPoint> history, List<Block> destroyedBlocks) {
|
||||||
this.tntId = tntId;
|
this.tntId = tntId;
|
||||||
this.explosion = explosion;
|
this.explosion = explosion;
|
||||||
@@ -156,6 +161,44 @@ public class TNTPoint{
|
|||||||
this.history = history;
|
this.history = history;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeExternal(ObjectOutput objectOutput) throws IOException {
|
||||||
|
objectOutput.writeInt(tntId);
|
||||||
|
objectOutput.writeBoolean(explosion);
|
||||||
|
objectOutput.writeBoolean(inWater);
|
||||||
|
objectOutput.writeBoolean(afterFirstExplosion);
|
||||||
|
objectOutput.writeBoolean(destroyedBuildArea);
|
||||||
|
objectOutput.writeBoolean(destroyedTestBlock);
|
||||||
|
objectOutput.writeLong(ticksSinceStart);
|
||||||
|
objectOutput.writeInt(fuse);
|
||||||
|
objectOutput.writeDouble(location.getX());
|
||||||
|
objectOutput.writeDouble(location.getY());
|
||||||
|
objectOutput.writeDouble(location.getZ());
|
||||||
|
objectOutput.writeDouble(velocity.getX());
|
||||||
|
objectOutput.writeDouble(velocity.getY());
|
||||||
|
objectOutput.writeDouble(velocity.getZ());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readExternal(ObjectInput objectInput) throws IOException {
|
||||||
|
tntId = objectInput.readInt();
|
||||||
|
explosion = objectInput.readBoolean();
|
||||||
|
inWater = objectInput.readBoolean();
|
||||||
|
afterFirstExplosion = objectInput.readBoolean();
|
||||||
|
destroyedBuildArea = objectInput.readBoolean();
|
||||||
|
destroyedTestBlock = objectInput.readBoolean();
|
||||||
|
ticksSinceStart = objectInput.readLong();
|
||||||
|
fuse = objectInput.readInt();
|
||||||
|
double locX = objectInput.readDouble();
|
||||||
|
double locY = objectInput.readDouble();
|
||||||
|
double locZ = objectInput.readDouble();
|
||||||
|
location = new Location(Bukkit.getWorlds().get(0), locX, locY, locZ);
|
||||||
|
double velX = objectInput.readDouble();
|
||||||
|
double velY = objectInput.readDouble();
|
||||||
|
double velZ = objectInput.readDouble();
|
||||||
|
velocity = new Vector(velX, velY, velZ);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "TNTPoint{" +
|
return "TNTPoint{" +
|
||||||
|
|||||||
@@ -26,16 +26,20 @@ import de.steamwar.bausystem.features.tracer.rendering.ViewFlag;
|
|||||||
import de.steamwar.bausystem.region.Region;
|
import de.steamwar.bausystem.region.Region;
|
||||||
import de.steamwar.entity.REntity;
|
import de.steamwar.entity.REntity;
|
||||||
import de.steamwar.entity.REntityServer;
|
import de.steamwar.entity.REntityServer;
|
||||||
|
import lombok.Cleanup;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.*;
|
||||||
import java.lang.ref.SoftReference;
|
import java.lang.ref.SoftReference;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
import java.util.zip.GZIPInputStream;
|
||||||
|
|
||||||
public class Trace {
|
public class Trace {
|
||||||
/**
|
/**
|
||||||
@@ -50,6 +54,12 @@ public class Trace {
|
|||||||
@Getter
|
@Getter
|
||||||
private final File recordsSaveFile;
|
private final File recordsSaveFile;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* File the metadata are saved in
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
private final File metadataSaveFile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Region the trace was recorded in
|
* Region the trace was recorded in
|
||||||
*/
|
*/
|
||||||
@@ -67,10 +77,6 @@ public class Trace {
|
|||||||
*/
|
*/
|
||||||
private SoftReference<List<TNTPoint>> records;
|
private SoftReference<List<TNTPoint>> records;
|
||||||
|
|
||||||
@Setter
|
|
||||||
@Getter
|
|
||||||
private int tntIdCount;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A map of all REntityServers rendering this trace
|
* A map of all REntityServers rendering this trace
|
||||||
*/
|
*/
|
||||||
@@ -85,23 +91,46 @@ public class Trace {
|
|||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
public Trace(Region region, List<TNTPoint> recordList) {
|
public Trace(Region region, List<TNTPoint> recordList) {
|
||||||
this.uuid = UUID.randomUUID();
|
this.uuid = UUID.randomUUID();
|
||||||
|
recordsSaveFile = new File(TraceManager.tracesFolder, uuid + ".records");
|
||||||
this.region = region;
|
this.region = region;
|
||||||
this.date = new Date();
|
this.date = new Date();
|
||||||
records = new SoftReference<>(recordList);
|
records = new SoftReference<>(recordList);
|
||||||
recordsSaveFile = new File(TraceRepository.tracesFolder, uuid + ".records");
|
metadataSaveFile = new File(TraceManager.tracesFolder, uuid + ".meta");
|
||||||
|
|
||||||
|
@Cleanup
|
||||||
|
ObjectOutputStream outputStream = new ObjectOutputStream(new FileOutputStream(metadataSaveFile));
|
||||||
|
outputStream.writeUTF(uuid.toString());
|
||||||
|
outputStream.writeUTF(region.getName());
|
||||||
|
outputStream.writeObject(date);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for deserialising a trace from the file system
|
* Constructor for serialising a trace from the file system
|
||||||
|
*
|
||||||
|
* @param metadataSaveFile the file for this traces metadata
|
||||||
*/
|
*/
|
||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
protected Trace(UUID uuid, Region region, Date date, File recordsFile, int tntIdCount) {
|
public Trace(File metadataSaveFile) {
|
||||||
recordsSaveFile = recordsFile;
|
String uuid = null;
|
||||||
this.uuid = uuid;
|
Region region = null;
|
||||||
this.region = region;
|
Date date = null;
|
||||||
this.date = date;
|
|
||||||
this.records = new SoftReference<>(null);
|
this.metadataSaveFile = metadataSaveFile;
|
||||||
this.tntIdCount = tntIdCount;
|
|
||||||
|
try {
|
||||||
|
@Cleanup
|
||||||
|
ObjectInputStream inputStream = new ObjectInputStream(new FileInputStream(metadataSaveFile));
|
||||||
|
uuid = inputStream.readUTF();
|
||||||
|
region = Region.getREGION_MAP().get(inputStream.readUTF());
|
||||||
|
date = (Date) inputStream.readObject();
|
||||||
|
inputStream.close();
|
||||||
|
} finally {
|
||||||
|
this.uuid = UUID.fromString(uuid);
|
||||||
|
this.region = region;
|
||||||
|
this.date = date;
|
||||||
|
recordsSaveFile = new File(TraceManager.tracesFolder, uuid + ".records");
|
||||||
|
this.records = new SoftReference<>(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -144,8 +173,7 @@ public class Trace {
|
|||||||
entityServer = new REntityServer();
|
entityServer = new REntityServer();
|
||||||
entityServer.addPlayer(player);
|
entityServer.addPlayer(player);
|
||||||
entityServer.setCallback((p, rEntity, entityAction) -> {
|
entityServer.setCallback((p, rEntity, entityAction) -> {
|
||||||
if (entityAction != REntityServer.EntityAction.INTERACT)
|
if (entityAction != REntityServer.EntityAction.INTERACT) return;
|
||||||
return;
|
|
||||||
if (rEntity instanceof TraceEntity) {
|
if (rEntity instanceof TraceEntity) {
|
||||||
((TraceEntity) rEntity).printIntoChat(p);
|
((TraceEntity) rEntity).printIntoChat(p);
|
||||||
}
|
}
|
||||||
@@ -167,8 +195,7 @@ public class Trace {
|
|||||||
REntityServer newEntityServer = new REntityServer();
|
REntityServer newEntityServer = new REntityServer();
|
||||||
newEntityServer.addPlayer(k);
|
newEntityServer.addPlayer(k);
|
||||||
newEntityServer.setCallback((p, rEntity, entityAction) -> {
|
newEntityServer.setCallback((p, rEntity, entityAction) -> {
|
||||||
if (entityAction != REntityServer.EntityAction.INTERACT)
|
if (entityAction != REntityServer.EntityAction.INTERACT) return;
|
||||||
return;
|
|
||||||
if (rEntity instanceof TraceEntity) {
|
if (rEntity instanceof TraceEntity) {
|
||||||
((TraceEntity) rEntity).printIntoChat(p);
|
((TraceEntity) rEntity).printIntoChat(p);
|
||||||
}
|
}
|
||||||
@@ -207,8 +234,7 @@ public class Trace {
|
|||||||
List<TraceEntity> entities = new LinkedList<>();
|
List<TraceEntity> entities = new LinkedList<>();
|
||||||
|
|
||||||
for (List<TNTPoint> bundle : bundles) {
|
for (List<TNTPoint> bundle : bundles) {
|
||||||
entities.add(new TraceEntity(entityServer, bundle.get(0).getLocation(), bundle.get(0).isExplosion(), bundle,
|
entities.add(new TraceEntity(entityServer, bundle.get(0).getLocation(), bundle.get(0).isExplosion(), bundle, this));
|
||||||
this));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply modifiers
|
// Apply modifiers
|
||||||
@@ -286,7 +312,38 @@ public class Trace {
|
|||||||
* Loads the records of this trace from storage to memory
|
* Loads the records of this trace from storage to memory
|
||||||
*/
|
*/
|
||||||
private void loadRecords() {
|
private void loadRecords() {
|
||||||
records = new SoftReference<>(TraceRepository.readTraceRecords(this));
|
List<TNTPoint> records = new ArrayList<>();
|
||||||
|
long readBytes = 0;
|
||||||
|
try {
|
||||||
|
FileInputStream fileInputStream = new FileInputStream(recordsSaveFile);
|
||||||
|
|
||||||
|
@Cleanup
|
||||||
|
ObjectInputStream inputStream = new ObjectInputStream(new GZIPInputStream(fileInputStream));
|
||||||
|
long fileLenght = recordsSaveFile.length();
|
||||||
|
while (fileInputStream.getChannel().position() < fileLenght) {
|
||||||
|
records.add((TNTPoint) inputStream.readObject());
|
||||||
|
readBytes = fileInputStream.getChannel().position();
|
||||||
|
}
|
||||||
|
} catch (EOFException e) {
|
||||||
|
Logger logger = Bukkit.getLogger();
|
||||||
|
logger.log(Level.WARNING, "EOF in trace read detected in " + uuid);
|
||||||
|
logger.log(Level.WARNING, "Read " + readBytes + "/" + recordsSaveFile.length() + " Bytes");
|
||||||
|
logger.log(Level.WARNING, "Read so far: " + records);
|
||||||
|
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (IOException | ClassNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<Integer, List<TNTPoint>> histories = new HashMap<>();
|
||||||
|
for (TNTPoint record : records) {
|
||||||
|
int tntId = record.getTntId();
|
||||||
|
List<TNTPoint> history = histories.computeIfAbsent(tntId, id -> new ArrayList<>());
|
||||||
|
history.add(record);
|
||||||
|
record.setHistory(history);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.records = new SoftReference<>(records);
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized List<TNTPoint> getRecords() {
|
public synchronized List<TNTPoint> getRecords() {
|
||||||
@@ -303,7 +360,6 @@ public class Trace {
|
|||||||
", region=" + region +
|
", region=" + region +
|
||||||
", creationTime=" + date +
|
", creationTime=" + date +
|
||||||
", recordsSaveFile=" + recordsSaveFile.getName() +
|
", recordsSaveFile=" + recordsSaveFile.getName() +
|
||||||
", tntCount=" + tntIdCount +
|
|
||||||
", records=" + getRecords() +
|
", records=" + getRecords() +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-26
@@ -30,14 +30,11 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
import org.bukkit.event.server.PluginEnableEvent;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static de.steamwar.bausystem.features.tracer.TraceRepository.tracesFolder;
|
|
||||||
|
|
||||||
@Linked
|
@Linked
|
||||||
public class TraceManager implements Listener {
|
public class TraceManager implements Listener {
|
||||||
|
|
||||||
@@ -47,9 +44,9 @@ public class TraceManager implements Listener {
|
|||||||
instance = this;
|
instance = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static File tracesFolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "traces");
|
||||||
|
|
||||||
|
public TraceManager() {
|
||||||
public void init() {
|
|
||||||
if (!tracesFolder.exists())
|
if (!tracesFolder.exists())
|
||||||
tracesFolder.mkdir();
|
tracesFolder.mkdir();
|
||||||
|
|
||||||
@@ -57,26 +54,11 @@ public class TraceManager implements Listener {
|
|||||||
if (traceFiles == null)
|
if (traceFiles == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
boolean hasMetaFiles = false;
|
|
||||||
for (File traceFile : traceFiles) {
|
for (File traceFile : traceFiles) {
|
||||||
if (traceFile.getName().contains(".meta")) {
|
if (traceFile.getName().contains(".records"))
|
||||||
hasMetaFiles = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (hasMetaFiles) {
|
|
||||||
for (File traceFile : traceFiles) {
|
|
||||||
traceFile.delete();
|
|
||||||
}
|
|
||||||
traceFiles = new File[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
for (File traceFile : traceFiles) {
|
|
||||||
Trace trace = TraceRepository.readTrace(traceFile);
|
|
||||||
if (trace == null) {
|
|
||||||
traceFile.delete();
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
add(trace);
|
add(new Trace(traceFile));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -149,17 +131,17 @@ public class TraceManager implements Listener {
|
|||||||
*
|
*
|
||||||
* @param trace the trace to be removed
|
* @param trace the trace to be removed
|
||||||
*/
|
*/
|
||||||
public void remove(Trace trace) {
|
public boolean remove(Trace trace) {
|
||||||
Map<Integer, Trace> traces = tracesByRegion.getOrDefault(trace.getRegion(), Collections.emptyMap());
|
Map<Integer, Trace> traces = tracesByRegion.getOrDefault(trace.getRegion(), Collections.emptyMap());
|
||||||
Integer traceId = traces.entrySet().stream()
|
Integer traceId = traces.entrySet().stream()
|
||||||
.filter(entry -> entry.getValue() == trace)
|
.filter(entry -> entry.getValue() == trace)
|
||||||
.map(Map.Entry::getKey)
|
.map(Map.Entry::getKey)
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.orElse(null);
|
.orElse(null);
|
||||||
if (traceId == null) throw new RuntimeException("Trace not found while trying to remove see (c978eb98-b0b2-4009-91d8-acfa34e2831a)");
|
if (traceId == null) return false;
|
||||||
traces.remove(traceId);
|
traces.remove(traceId);
|
||||||
trace.hide();
|
trace.hide();
|
||||||
trace.getRecordsSaveFile().delete();
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -178,6 +160,7 @@ public class TraceManager implements Listener {
|
|||||||
tracesByRegion.getOrDefault(region, new HashMap<>())
|
tracesByRegion.getOrDefault(region, new HashMap<>())
|
||||||
.forEach((i, trace) -> {
|
.forEach((i, trace) -> {
|
||||||
if (trace.getRegion() != region) return;
|
if (trace.getRegion() != region) return;
|
||||||
|
trace.getMetadataSaveFile().delete();
|
||||||
trace.getRecordsSaveFile().delete();
|
trace.getRecordsSaveFile().delete();
|
||||||
});
|
});
|
||||||
tracesByRegion.getOrDefault(region, new HashMap<>()).clear();
|
tracesByRegion.getOrDefault(region, new HashMap<>()).clear();
|
||||||
|
|||||||
+10
-10
@@ -23,7 +23,6 @@ import de.steamwar.bausystem.BauSystem;
|
|||||||
import de.steamwar.bausystem.features.tpslimit.TPSUtils;
|
import de.steamwar.bausystem.features.tpslimit.TPSUtils;
|
||||||
import de.steamwar.bausystem.region.Region;
|
import de.steamwar.bausystem.region.Region;
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import de.steamwar.linkage.LinkedInstance;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.TNTPrimed;
|
import org.bukkit.entity.TNTPrimed;
|
||||||
@@ -40,9 +39,12 @@ import java.util.logging.Logger;
|
|||||||
@Linked
|
@Linked
|
||||||
public class TraceRecorder implements Listener {
|
public class TraceRecorder implements Listener {
|
||||||
|
|
||||||
@LinkedInstance
|
|
||||||
public static TraceRecorder instance;
|
public static TraceRecorder instance;
|
||||||
|
|
||||||
|
{
|
||||||
|
instance = this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Map for all traces being actively recorded
|
* Map for all traces being actively recorded
|
||||||
*/
|
*/
|
||||||
@@ -68,7 +70,7 @@ public class TraceRecorder implements Listener {
|
|||||||
*/
|
*/
|
||||||
private final Set<Region> autoTraceRegions = new HashSet<>();
|
private final Set<Region> autoTraceRegions = new HashSet<>();
|
||||||
|
|
||||||
public void init() {
|
public TraceRecorder() {
|
||||||
BauSystem.runTaskTimer(BauSystem.getInstance(), () -> {
|
BauSystem.runTaskTimer(BauSystem.getInstance(), () -> {
|
||||||
record();
|
record();
|
||||||
checkForAutoTraceFinish();
|
checkForAutoTraceFinish();
|
||||||
@@ -99,14 +101,11 @@ public class TraceRecorder implements Listener {
|
|||||||
*
|
*
|
||||||
* @param region region to be recorded
|
* @param region region to be recorded
|
||||||
*/
|
*/
|
||||||
public Trace startRecording(Region region) {
|
public void startRecording(Region region) {
|
||||||
if (activeTraces.containsKey(region)) {
|
if (activeTraces.containsKey(region)) return;
|
||||||
return activeTraces.get(region).getTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
TraceRecordingWrapper wrappedTrace = new TraceRecordingWrapper(region);
|
TraceRecordingWrapper wrappedTrace = new TraceRecordingWrapper(region);
|
||||||
activeTraces.put(region, wrappedTrace);
|
activeTraces.put(region, wrappedTrace);
|
||||||
return wrappedTrace.getTrace();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -171,13 +170,14 @@ public class TraceRecorder implements Listener {
|
|||||||
if (history.size() == 0) {
|
if (history.size() == 0) {
|
||||||
try {
|
try {
|
||||||
historyMap.put(tntPrimed, history);
|
historyMap.put(tntPrimed, history);
|
||||||
} catch (NullPointerException e) {
|
}
|
||||||
|
catch (NullPointerException e) {
|
||||||
Logger logger = Bukkit.getLogger();
|
Logger logger = Bukkit.getLogger();
|
||||||
//TODO remove when no longer neccecary
|
//TODO remove when no longer neccecary
|
||||||
logger.log(Level.WARNING, "Nullpointer thrown by historyMap");
|
logger.log(Level.WARNING, "Nullpointer thrown by historyMap");
|
||||||
logger.log(Level.WARNING, "TNT History: " + history);
|
logger.log(Level.WARNING, "TNT History: " + history);
|
||||||
logger.log(Level.WARNING, "History Map: " + historyMap);
|
logger.log(Level.WARNING, "History Map: " + historyMap);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
tntID = wrappedTrace.getNextOpenRecordIdAndIncrement();
|
tntID = wrappedTrace.getNextOpenRecordIdAndIncrement();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+22
-5
@@ -24,22 +24,28 @@ import de.steamwar.bausystem.region.Region;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.ObjectOutputStream;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.zip.GZIPOutputStream;
|
||||||
|
|
||||||
public class TraceRecordingWrapper {
|
public class TraceRecordingWrapper {
|
||||||
|
|
||||||
@Getter
|
|
||||||
private final Trace trace;
|
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private final long startTick;
|
private final long startTick;
|
||||||
private final List<TNTPoint> recordsToAdd;
|
private final List<TNTPoint> recordsToAdd;
|
||||||
private final List<TNTPoint> recordList;
|
private final List<TNTPoint> recordList;
|
||||||
|
private final ObjectOutputStream recordsOutputStream;
|
||||||
private int nextOpenRecordId = 0;
|
private int nextOpenRecordId = 0;
|
||||||
@Getter
|
@Getter
|
||||||
private boolean explosionRecorded = false;
|
private boolean explosionRecorded = false;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private final Trace trace;
|
||||||
|
|
||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
public TraceRecordingWrapper(Region region) {
|
public TraceRecordingWrapper(Region region) {
|
||||||
startTick = TPSUtils.currentRealTick.get();
|
startTick = TPSUtils.currentRealTick.get();
|
||||||
@@ -47,6 +53,8 @@ public class TraceRecordingWrapper {
|
|||||||
recordList = new ArrayList<>();
|
recordList = new ArrayList<>();
|
||||||
|
|
||||||
trace = new Trace(region, recordList);
|
trace = new Trace(region, recordList);
|
||||||
|
File recordsSaveFile = new File(TraceManager.tracesFolder, trace.getUuid() + ".records");
|
||||||
|
recordsOutputStream = new ObjectOutputStream(new GZIPOutputStream(new FileOutputStream(recordsSaveFile)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getNextOpenRecordIdAndIncrement() {
|
public int getNextOpenRecordIdAndIncrement() {
|
||||||
@@ -64,14 +72,23 @@ public class TraceRecordingWrapper {
|
|||||||
public void commitRecorded() {
|
public void commitRecorded() {
|
||||||
TraceManager.instance.showPartial(trace, recordsToAdd);
|
TraceManager.instance.showPartial(trace, recordsToAdd);
|
||||||
|
|
||||||
|
recordsToAdd.forEach(record -> {
|
||||||
|
try {
|
||||||
|
recordsOutputStream.writeObject(record);
|
||||||
|
recordsOutputStream.flush();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
recordList.addAll(recordsToAdd);
|
recordList.addAll(recordsToAdd);
|
||||||
trace.setTntIdCount((int) recordList.stream().map(TNTPoint::getTntId).distinct().count());
|
|
||||||
recordsToAdd.clear();
|
recordsToAdd.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
protected void finalizeRecording() {
|
protected void finalizeRecording() {
|
||||||
TraceRepository.writeTrace(trace, recordList);
|
recordsOutputStream.flush();
|
||||||
|
recordsOutputStream.close();
|
||||||
TraceManager.instance.add(trace);
|
TraceManager.instance.add(trace);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
-174
@@ -1,174 +0,0 @@
|
|||||||
package de.steamwar.bausystem.features.tracer;
|
|
||||||
|
|
||||||
import de.steamwar.bausystem.region.Region;
|
|
||||||
import lombok.Cleanup;
|
|
||||||
import lombok.SneakyThrows;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.util.Vector;
|
|
||||||
|
|
||||||
import java.io.*;
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.zip.GZIPInputStream;
|
|
||||||
import java.util.zip.GZIPOutputStream;
|
|
||||||
|
|
||||||
public class TraceRepository {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Increment this when changing serialisation format
|
|
||||||
*/
|
|
||||||
public static final int SERIALISATION_VERSION = 2;
|
|
||||||
public static final int WRITE_TICK_DATA = 0b00000001;
|
|
||||||
public static final int EXPLOSION = 0b00000010;
|
|
||||||
public static final int IN_WATER = 0b00000100;
|
|
||||||
public static final int AFTER_FIRST_EXPLOSION = 0b00001000;
|
|
||||||
public static final int DESTROYED_BUILD_AREA = 0b00010000;
|
|
||||||
public static final int DESTROYED_TEST_BLOCK = 0b00100000;
|
|
||||||
public static File tracesFolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "traces");
|
|
||||||
|
|
||||||
@SneakyThrows
|
|
||||||
public static Trace readTrace(File recordsFile) {
|
|
||||||
@Cleanup
|
|
||||||
ObjectInputStream reader = new ObjectInputStream(new GZIPInputStream(new FileInputStream(recordsFile)));
|
|
||||||
UUID uuid = UUID.fromString(reader.readUTF());
|
|
||||||
Region region = Region.getREGION_MAP().get(reader.readUTF());
|
|
||||||
Date date = (Date) reader.readObject();
|
|
||||||
int serialisationVersion = reader.readInt();
|
|
||||||
if (serialisationVersion != SERIALISATION_VERSION) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
int tntIdCount = reader.readInt();
|
|
||||||
|
|
||||||
return new Trace(uuid, region, date, recordsFile, tntIdCount);
|
|
||||||
}
|
|
||||||
|
|
||||||
@SneakyThrows
|
|
||||||
protected static void writeTrace(Trace trace, List<TNTPoint> records) {
|
|
||||||
ObjectOutputStream outputStream = new ObjectOutputStream(new GZIPOutputStream(new FileOutputStream(trace.getRecordsSaveFile())));
|
|
||||||
outputStream.writeUTF(trace.getUuid().toString());
|
|
||||||
outputStream.writeUTF(trace.getRegion().getName());
|
|
||||||
outputStream.writeObject(trace.getDate());
|
|
||||||
outputStream.writeInt(SERIALISATION_VERSION);
|
|
||||||
|
|
||||||
Map<Integer, List<TNTPoint>> pointsByTNTId = new HashMap<>();
|
|
||||||
records.forEach(tntPoint -> {
|
|
||||||
pointsByTNTId.computeIfAbsent(tntPoint.getTntId(), integer -> new ArrayList<>()).add(tntPoint);
|
|
||||||
});
|
|
||||||
|
|
||||||
outputStream.writeInt(pointsByTNTId.size());
|
|
||||||
for (Map.Entry<Integer, List<TNTPoint>> entry : pointsByTNTId.entrySet()) {
|
|
||||||
outputStream.writeInt(entry.getKey());
|
|
||||||
outputStream.writeInt(entry.getValue().size());
|
|
||||||
|
|
||||||
for (int i = 0; i < entry.getValue().size(); i++) {
|
|
||||||
TNTPoint current = entry.getValue().get(i);
|
|
||||||
if (i == 0) {
|
|
||||||
writeTNTPoint(outputStream, current, true);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
TNTPoint last = entry.getValue().get(i - 1);
|
|
||||||
|
|
||||||
boolean writeTickData = true;
|
|
||||||
if (last.getTicksSinceStart() + 1 == current.getTicksSinceStart() && last.getFuse() - 1 == current.getFuse()) {
|
|
||||||
writeTickData = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
writeTNTPoint(outputStream, current, writeTickData);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
outputStream.flush();
|
|
||||||
outputStream.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
@SneakyThrows
|
|
||||||
private static void writeTNTPoint(ObjectOutputStream outputStream, TNTPoint tntPoint, boolean writeTickData) {
|
|
||||||
byte data = 0;
|
|
||||||
if (writeTickData) data |= WRITE_TICK_DATA;
|
|
||||||
if (tntPoint.isExplosion()) data |= EXPLOSION;
|
|
||||||
if (tntPoint.isInWater()) data |= IN_WATER;
|
|
||||||
if (tntPoint.isAfterFirstExplosion()) data |= AFTER_FIRST_EXPLOSION;
|
|
||||||
if (tntPoint.isDestroyedBuildArea()) data |= DESTROYED_BUILD_AREA;
|
|
||||||
if (tntPoint.isDestroyedTestBlock()) data |= DESTROYED_TEST_BLOCK;
|
|
||||||
outputStream.write(data);
|
|
||||||
|
|
||||||
if (writeTickData) {
|
|
||||||
outputStream.writeLong(tntPoint.getTicksSinceStart());
|
|
||||||
outputStream.writeInt(tntPoint.getFuse());
|
|
||||||
}
|
|
||||||
|
|
||||||
Location location = tntPoint.getLocation();
|
|
||||||
outputStream.writeDouble(location.getX());
|
|
||||||
outputStream.writeDouble(location.getY());
|
|
||||||
outputStream.writeDouble(location.getZ());
|
|
||||||
|
|
||||||
Vector velocity = tntPoint.getVelocity();
|
|
||||||
outputStream.writeDouble(velocity.getX());
|
|
||||||
outputStream.writeDouble(velocity.getY());
|
|
||||||
outputStream.writeDouble(velocity.getZ());
|
|
||||||
}
|
|
||||||
|
|
||||||
@SneakyThrows
|
|
||||||
protected static TNTPoint readTraceRecord(int tntId, TNTPoint last, ObjectInputStream objectInput) {
|
|
||||||
|
|
||||||
int data = objectInput.read();
|
|
||||||
boolean explosion = (data & EXPLOSION) > 0;
|
|
||||||
boolean inWater = (data & IN_WATER) > 0;
|
|
||||||
boolean afterFirstExplosion = (data & AFTER_FIRST_EXPLOSION) > 0;
|
|
||||||
boolean destroyedBuildArea = (data & DESTROYED_BUILD_AREA) > 0;
|
|
||||||
boolean destroyedTestBlock = (data & DESTROYED_TEST_BLOCK) > 0;
|
|
||||||
|
|
||||||
long ticksSinceStart;
|
|
||||||
int fuse;
|
|
||||||
if ((data & WRITE_TICK_DATA) > 0) {
|
|
||||||
ticksSinceStart = objectInput.readLong();
|
|
||||||
fuse = objectInput.readInt();
|
|
||||||
} else {
|
|
||||||
ticksSinceStart = last.getTicksSinceStart() + 1;
|
|
||||||
fuse = last.getFuse() - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
double locX = objectInput.readDouble();
|
|
||||||
double locY = objectInput.readDouble();
|
|
||||||
double locZ = objectInput.readDouble();
|
|
||||||
Location location = new Location(Bukkit.getWorlds().get(0), locX, locY, locZ);
|
|
||||||
|
|
||||||
double velX = objectInput.readDouble();
|
|
||||||
double velY = objectInput.readDouble();
|
|
||||||
double velZ = objectInput.readDouble();
|
|
||||||
Vector velocity = new Vector(velX, velY, velZ);
|
|
||||||
|
|
||||||
return new TNTPoint(tntId, explosion, inWater, afterFirstExplosion, destroyedBuildArea, destroyedTestBlock, ticksSinceStart, fuse, location, velocity, Collections.emptyList());
|
|
||||||
}
|
|
||||||
|
|
||||||
@SneakyThrows
|
|
||||||
protected static List<TNTPoint> readTraceRecords(Trace trace) {
|
|
||||||
File recordsFile = trace.getRecordsSaveFile();
|
|
||||||
@Cleanup
|
|
||||||
ObjectInputStream inputStream = new ObjectInputStream(new GZIPInputStream(new FileInputStream(recordsFile)));
|
|
||||||
inputStream.readUTF();
|
|
||||||
inputStream.readUTF();
|
|
||||||
inputStream.readObject();
|
|
||||||
inputStream.readInt();
|
|
||||||
inputStream.readInt();
|
|
||||||
|
|
||||||
List<TNTPoint> records = new ArrayList<>();
|
|
||||||
Map<Integer, List<TNTPoint>> histories = new HashMap<>();
|
|
||||||
for (int i = 0; i < trace.getTntIdCount(); i++) {
|
|
||||||
int tntId = inputStream.readInt();
|
|
||||||
int size = inputStream.readInt();
|
|
||||||
List<TNTPoint> points = histories.computeIfAbsent(tntId, id -> new ArrayList<>());
|
|
||||||
|
|
||||||
TNTPoint last = null;
|
|
||||||
for (int j = 0; j < size; j++) {
|
|
||||||
TNTPoint point = readTraceRecord(tntId, last, inputStream);
|
|
||||||
point.setHistory(points);
|
|
||||||
points.add(point);
|
|
||||||
last = point;
|
|
||||||
records.add(point);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return records;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-5
@@ -20,7 +20,6 @@
|
|||||||
package de.steamwar.bausystem.features.tracer.rendering;
|
package de.steamwar.bausystem.features.tracer.rendering;
|
||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.bausystem.configplayer.Config;
|
|
||||||
import de.steamwar.bausystem.features.tracer.TNTPoint;
|
import de.steamwar.bausystem.features.tracer.TNTPoint;
|
||||||
import de.steamwar.bausystem.features.tracer.Trace;
|
import de.steamwar.bausystem.features.tracer.Trace;
|
||||||
import de.steamwar.bausystem.features.tracer.TraceManager;
|
import de.steamwar.bausystem.features.tracer.TraceManager;
|
||||||
@@ -31,13 +30,10 @@ import net.md_5.bungee.api.chat.ClickEvent;
|
|||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import yapion.hierarchy.types.YAPIONValue;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static de.steamwar.bausystem.features.util.TNTClickListener.TNT_CLICK_DETAILS;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wrapper for the rendering of a record bundle
|
* Wrapper for the rendering of a record bundle
|
||||||
*/
|
*/
|
||||||
@@ -70,7 +66,6 @@ public class TraceEntity extends RFallingBlockEntity {
|
|||||||
* @param player the player the message should be printed for
|
* @param player the player the message should be printed for
|
||||||
*/
|
*/
|
||||||
public void printIntoChat(Player player) {
|
public void printIntoChat(Player player) {
|
||||||
if (!Config.getInstance().get(player).getOrSetDefault(TNT_CLICK_DETAILS, new YAPIONValue<>(true)).asBoolean().orElse(true)) return;
|
|
||||||
TNTPoint representative = records.get(0);
|
TNTPoint representative = records.get(0);
|
||||||
|
|
||||||
BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_HEADER", player);
|
BauSystem.MESSAGE.sendPrefixless("TNT_CLICK_HEADER", player);
|
||||||
|
|||||||
+2
-3
@@ -26,7 +26,6 @@ import de.steamwar.bausystem.shared.EnumDisplay;
|
|||||||
import de.steamwar.command.PreviousArguments;
|
import de.steamwar.command.PreviousArguments;
|
||||||
import de.steamwar.command.SWCommand;
|
import de.steamwar.command.SWCommand;
|
||||||
import de.steamwar.command.TypeMapper;
|
import de.steamwar.command.TypeMapper;
|
||||||
import de.steamwar.data.CMDs;
|
|
||||||
import de.steamwar.inventory.SWAnvilInv;
|
import de.steamwar.inventory.SWAnvilInv;
|
||||||
import de.steamwar.inventory.SWInventory;
|
import de.steamwar.inventory.SWInventory;
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
@@ -203,9 +202,9 @@ public class MaterialCommand extends SWCommand implements Listener {
|
|||||||
private void searchGUI(Player p) {
|
private void searchGUI(Player p) {
|
||||||
SWInventory swInventory = new SWInventory(p, 54, BauSystem.MESSAGE.parse("MATERIAL_SEARCH", p));
|
SWInventory swInventory = new SWInventory(p, 54, BauSystem.MESSAGE.parse("MATERIAL_SEARCH", p));
|
||||||
Search search = searchMap.get(p);
|
Search search = searchMap.get(p);
|
||||||
swInventory.setItem(0, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("MATERIAL_BACK", p), clickType -> {
|
swInventory.setItem(45, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("MATERIAL_BACK", p), clickType -> {
|
||||||
materialGUI(p);
|
materialGUI(p);
|
||||||
}).setCustomModelData(CMDs.BACK));
|
}));
|
||||||
swInventory.setItem(10, new SWItem(Material.NAME_TAG, BauSystem.MESSAGE.parse("MATERIAL_SEARCH_NAME", p) + BauSystem.MESSAGE.parse("MATERIAL_SEARCH_VALUE", p, search.name), clickType -> {
|
swInventory.setItem(10, new SWItem(Material.NAME_TAG, BauSystem.MESSAGE.parse("MATERIAL_SEARCH_NAME", p) + BauSystem.MESSAGE.parse("MATERIAL_SEARCH_VALUE", p, search.name), clickType -> {
|
||||||
SWAnvilInv swAnvilInv = new SWAnvilInv(p, BauSystem.MESSAGE.parse("MATERIAL_SEARCH_NAME", p), search.name);
|
SWAnvilInv swAnvilInv = new SWAnvilInv(p, BauSystem.MESSAGE.parse("MATERIAL_SEARCH_NAME", p), search.name);
|
||||||
swAnvilInv.setCallback(s -> {
|
swAnvilInv.setCallback(s -> {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.features.util;
|
package de.steamwar.bausystem.features.util;
|
||||||
|
|
||||||
import de.steamwar.Reflection;
|
import com.comphenix.tinyprotocol.Reflection;
|
||||||
import com.comphenix.tinyprotocol.TinyProtocol;
|
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
@@ -49,15 +49,15 @@ import java.util.function.BiFunction;
|
|||||||
@Linked
|
@Linked
|
||||||
public class NoClipCommand extends SWCommand implements Listener {
|
public class NoClipCommand extends SWCommand implements Listener {
|
||||||
|
|
||||||
public static final Class<?> gameStateChange = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundGameEventPacket");
|
public static final Class<?> gameStateChange = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutGameStateChange");
|
||||||
private static final Reflection.Field<Float> floatFieldAccessor = Reflection.getField(gameStateChange, float.class, 0);
|
private static final Reflection.FieldAccessor<Float> floatFieldAccessor = Reflection.getField(gameStateChange, float.class, 0);
|
||||||
|
|
||||||
private static final Class<?> position = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundMovePlayerPacket$Pos");
|
private static final Class<?> position = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInFlying$PacketPlayInPosition");
|
||||||
private static final Class<?> positionLook = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundMovePlayerPacket$PosRot");
|
private static final Class<?> positionLook = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInFlying$PacketPlayInPositionLook");
|
||||||
private static final Class<?> useItem = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundUseItemOnPacket");
|
private static final Class<?> useItem = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInUseItem");
|
||||||
private static final Class<?> blockDig = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundPlayerActionPacket");
|
private static final Class<?> blockDig = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInBlockDig");
|
||||||
private static final Class<?> windowClick = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundContainerClickPacket");
|
private static final Class<?> windowClick = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInWindowClick");
|
||||||
private static final Class<?> setSlotStack = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundSetCreativeModeSlotPacket");
|
private static final Class<?> setSlotStack = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInSetCreativeSlot");
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private static final List<Player> NOCLIPS = new ArrayList<>();
|
private static final List<Player> NOCLIPS = new ArrayList<>();
|
||||||
|
|||||||
@@ -42,15 +42,6 @@ public class SkullCommand extends SWCommand {
|
|||||||
super("skull", "head");
|
super("skull", "head");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register
|
|
||||||
public void giveCommand(@Validator Player p) {
|
|
||||||
if (p.getName().startsWith(".")) {
|
|
||||||
BauSystem.MESSAGE.send("SKULL_INVALID", p);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
giveCommand(p, p.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Register(description = "SKULL_HELP")
|
@Register(description = "SKULL_HELP")
|
||||||
public void giveCommand(@Validator Player p, @Mapper("player") @ErrorMessage("SKULL_INVALID") String skull) {
|
public void giveCommand(@Validator Player p, @Mapper("player") @ErrorMessage("SKULL_INVALID") String skull) {
|
||||||
ItemStack is = SWItem.getPlayerSkull(skull).getItemStack();
|
ItemStack is = SWItem.getPlayerSkull(skull).getItemStack();
|
||||||
@@ -72,7 +63,7 @@ public class SkullCommand extends SWCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> tabCompletes(CommandSender commandSender, PreviousArguments previousArguments, String s) {
|
public List<String> tabCompletes(CommandSender commandSender, PreviousArguments previousArguments, String s) {
|
||||||
return Bukkit.getOnlinePlayers().stream().map(Player::getName).filter(s1 -> !s1.startsWith(".")).collect(Collectors.toList());
|
return Bukkit.getOnlinePlayers().stream().map(Player::getName).filter(s1 -> !s1.endsWith("⍇")).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,12 +39,12 @@ public class SpeedCommand extends SWCommand {
|
|||||||
|
|
||||||
@Register
|
@Register
|
||||||
public void speedCommand(Player p, float speed) {
|
public void speedCommand(Player p, float speed) {
|
||||||
if (speed < -10F) {
|
speed = speed / 10F;
|
||||||
|
if (speed < -1F) {
|
||||||
BauSystem.MESSAGE.send("SPEED_TOO_SMALL", p, speed);
|
BauSystem.MESSAGE.send("SPEED_TOO_SMALL", p, speed);
|
||||||
} else if (speed > 10F) {
|
} else if (speed > 1F) {
|
||||||
BauSystem.MESSAGE.send("SPEED_TOO_HIGH", p, speed);
|
BauSystem.MESSAGE.send("SPEED_TOO_HIGH", p, speed);
|
||||||
} else {
|
} else {
|
||||||
speed = speed / 10F;
|
|
||||||
p.setFlySpeed(speed);
|
p.setFlySpeed(speed);
|
||||||
p.setWalkSpeed(Math.min(speed + 0.1F, 1F));
|
p.setWalkSpeed(Math.min(speed + 0.1F, 1F));
|
||||||
BauSystem.MESSAGE.send("SPEED_CURRENT", p, (p.getFlySpeed() * 10F));
|
BauSystem.MESSAGE.send("SPEED_CURRENT", p, (p.getFlySpeed() * 10F));
|
||||||
|
|||||||
+1
-25
@@ -21,46 +21,22 @@ package de.steamwar.bausystem.features.util;
|
|||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.bausystem.Permission;
|
import de.steamwar.bausystem.Permission;
|
||||||
import de.steamwar.bausystem.configplayer.Config;
|
|
||||||
import de.steamwar.command.SWCommand;
|
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.entity.TNTPrimed;
|
import org.bukkit.entity.TNTPrimed;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||||
import org.bukkit.inventory.EquipmentSlot;
|
import org.bukkit.inventory.EquipmentSlot;
|
||||||
import yapion.hierarchy.types.YAPIONObject;
|
|
||||||
import yapion.hierarchy.types.YAPIONValue;
|
|
||||||
|
|
||||||
@Linked
|
@Linked
|
||||||
public class TNTClickListener extends SWCommand implements Listener {
|
public class TNTClickListener implements Listener {
|
||||||
|
|
||||||
public static final String TNT_CLICK_DETAILS = "tnt_click_details";
|
|
||||||
|
|
||||||
public TNTClickListener() {
|
|
||||||
super("tntdetails");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Register(description = "TNT_DETAILS_COMMAND")
|
|
||||||
public void toggle(Player player) {
|
|
||||||
YAPIONObject yapionObject = Config.getInstance().get(player);
|
|
||||||
if (yapionObject.getOrSetDefault(TNT_CLICK_DETAILS, new YAPIONValue<>(true)).asBoolean().orElse(true)) {
|
|
||||||
yapionObject.put(TNT_CLICK_DETAILS, false);
|
|
||||||
BauSystem.MESSAGE.send("TNT_DETAILS_OFF", player);
|
|
||||||
} else {
|
|
||||||
yapionObject.put(TNT_CLICK_DETAILS, true);
|
|
||||||
BauSystem.MESSAGE.send("TNT_DETAILS_ON", player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerInteractEntity(PlayerInteractEntityEvent event) {
|
public void onPlayerInteractEntity(PlayerInteractEntityEvent event) {
|
||||||
if (!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
if (!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||||
if (event.getHand() != EquipmentSlot.HAND) return;
|
if (event.getHand() != EquipmentSlot.HAND) return;
|
||||||
if (!Config.getInstance().get(event.getPlayer()).getOrSetDefault(TNT_CLICK_DETAILS, new YAPIONValue<>(true)).asBoolean().orElse(true)) return;
|
|
||||||
|
|
||||||
Entity entity = event.getRightClicked();
|
Entity entity = event.getRightClicked();
|
||||||
if (event.getRightClicked() instanceof TNTPrimed) {
|
if (event.getRightClicked() instanceof TNTPrimed) {
|
||||||
|
|||||||
+1
@@ -47,6 +47,7 @@ public class NightVisionBauGuiItem extends BauGuiItem {
|
|||||||
PotionMeta meta = (PotionMeta) itemStack.getItemMeta();
|
PotionMeta meta = (PotionMeta) itemStack.getItemMeta();
|
||||||
meta.setColor(PotionEffectType.NIGHT_VISION.getColor());
|
meta.setColor(PotionEffectType.NIGHT_VISION.getColor());
|
||||||
meta.setDisplayName(BauSystem.MESSAGE.parse("NIGHT_VISION_ITEM_ON", player));
|
meta.setDisplayName(BauSystem.MESSAGE.parse("NIGHT_VISION_ITEM_ON", player));
|
||||||
|
meta.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
|
||||||
meta.setCustomModelData(1);
|
meta.setCustomModelData(1);
|
||||||
itemStack.setItemMeta(meta);
|
itemStack.setItemMeta(meta);
|
||||||
return itemStack;
|
return itemStack;
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public class Warp {
|
|||||||
|
|
||||||
public static void enable() {
|
public static void enable() {
|
||||||
Warp worldSpawn = new Warp("WorldSpawn");
|
Warp worldSpawn = new Warp("WorldSpawn");
|
||||||
worldSpawn.setLocation(Bukkit.getWorlds().get(0).getSpawnLocation().clone().add(0.5, Core.getVersion() >= 20 ? 124 : 1, 0.5));
|
worldSpawn.setLocation(Bukkit.getWorlds().get(0).getSpawnLocation().clone().add(0.5, Core.getVersion() == 20 ? 124 : 1, 0.5));
|
||||||
worldSpawn.setMat(Material.NETHER_STAR);
|
worldSpawn.setMat(Material.NETHER_STAR);
|
||||||
warpMap.put("WorldSpawn", worldSpawn);
|
warpMap.put("WorldSpawn", worldSpawn);
|
||||||
}
|
}
|
||||||
|
|||||||
-6
@@ -20,7 +20,6 @@
|
|||||||
package de.steamwar.bausystem.features.world;
|
package de.steamwar.bausystem.features.world;
|
||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.core.CRIUWakeupEvent;
|
|
||||||
import de.steamwar.core.CheckpointUtils;
|
import de.steamwar.core.CheckpointUtils;
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@@ -70,9 +69,4 @@ public class AFKStopperListener implements Listener {
|
|||||||
if(Bukkit.getOnlinePlayers().isEmpty() || (Bukkit.getOnlinePlayers().size() == 1 && Bukkit.getOnlinePlayers().contains(event.getPlayer())))
|
if(Bukkit.getOnlinePlayers().isEmpty() || (Bukkit.getOnlinePlayers().size() == 1 && Bukkit.getOnlinePlayers().contains(event.getPlayer())))
|
||||||
CheckpointUtils.freeze();
|
CheckpointUtils.freeze();
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onCRIUWakeup(CRIUWakeupEvent event) {
|
|
||||||
lastMovementTime = System.currentTimeMillis();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-6
@@ -21,7 +21,6 @@ package de.steamwar.bausystem.features.world;
|
|||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.bausystem.config.BauServer;
|
import de.steamwar.bausystem.config.BauServer;
|
||||||
import de.steamwar.core.CRIUWakeupEvent;
|
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import de.steamwar.sql.BauweltMember;
|
import de.steamwar.sql.BauweltMember;
|
||||||
import de.steamwar.sql.SteamwarUser;
|
import de.steamwar.sql.SteamwarUser;
|
||||||
@@ -33,6 +32,7 @@ import org.bukkit.event.player.PlayerJoinEvent;
|
|||||||
@Linked
|
@Linked
|
||||||
public class AntiBauAddMemberFix implements Listener {
|
public class AntiBauAddMemberFix implements Listener {
|
||||||
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOW)
|
@EventHandler(priority = EventPriority.LOW)
|
||||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||||
if (BauSystem.DEV_SERVER) return;
|
if (BauSystem.DEV_SERVER) return;
|
||||||
@@ -44,9 +44,4 @@ public class AntiBauAddMemberFix implements Listener {
|
|||||||
throw new SecurityException("The player " + event.getPlayer().getName() + " joined on the server of " + SteamwarUser.get(BauServer.getInstance().getOwnerID()).getUserName() + " without being added!");
|
throw new SecurityException("The player " + event.getPlayer().getName() + " joined on the server of " + SteamwarUser.get(BauServer.getInstance().getOwnerID()).getUserName() + " without being added!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onCRIUWakeup(CRIUWakeupEvent event) {
|
|
||||||
BauweltMember.clear();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user