forked from SteamWar/SteamWar
Merge branch 'main' into VelocityCore/SendCommand2.0
This commit is contained in:
@@ -19,27 +19,21 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.utils;
|
package de.steamwar.bausystem.utils;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import de.steamwar.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.FieldAccessor<EnumGamemode> playerGameMode = Reflection.getField(PlayerInteractManager.class, EnumGamemode.class, 0);
|
private static final Reflection.Field<EnumGamemode> playerGameMode = Reflection.getField(PlayerInteractManager.class, EnumGamemode.class, 0);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@@ -63,7 +57,7 @@ public class NMSWrapper15 implements NMSWrapper {
|
|||||||
player.updateInventory();
|
player.updateInventory();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Reflection.FieldAccessor<Integer> gameStateChangeReason = Reflection.getField(NoClipCommand.gameStateChange, int.class, 0);
|
private static final Reflection.Field<Integer> gameStateChangeReason = Reflection.getField(NoClipCommand.gameStateChange, int.class, 0);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setGameStateChangeReason(Object packet) {
|
public void setGameStateChangeReason(Object packet) {
|
||||||
@@ -120,12 +114,12 @@ public class NMSWrapper15 implements NMSWrapper {
|
|||||||
return invalid;
|
return invalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
private final Class<?> explosionPacket = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutExplosion");
|
private final Class<?> explosionPacket = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundExplodePacket");
|
||||||
private final Reflection.FieldAccessor<Double> a = Reflection.getField(explosionPacket, double.class, 0);
|
private final Reflection.Field<Double> a = Reflection.getField(explosionPacket, double.class, 0);
|
||||||
private final Reflection.FieldAccessor<Double> b = Reflection.getField(explosionPacket, double.class, 1);
|
private final Reflection.Field<Double> b = Reflection.getField(explosionPacket, double.class, 1);
|
||||||
private final Reflection.FieldAccessor<Double> c = Reflection.getField(explosionPacket, double.class, 2);
|
private final Reflection.Field<Double> c = Reflection.getField(explosionPacket, double.class, 2);
|
||||||
private final Reflection.FieldAccessor<Float> d = Reflection.getField(explosionPacket, float.class, 0);
|
private final Reflection.Field<Float> d = Reflection.getField(explosionPacket, float.class, 0);
|
||||||
private final Reflection.FieldAccessor<List> e = Reflection.getField(explosionPacket, List.class, 0);
|
private final Reflection.Field<List> e = Reflection.getField(explosionPacket, List.class, 0);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object resetExplosionKnockback(Object packet) {
|
public Object resetExplosionKnockback(Object packet) {
|
||||||
|
|||||||
@@ -19,12 +19,9 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.utils;
|
package de.steamwar.bausystem.utils;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import de.steamwar.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;
|
||||||
|
|
||||||
|
|||||||
@@ -19,36 +19,26 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.utils;
|
package de.steamwar.bausystem.utils;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import de.steamwar.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.FieldAccessor<EnumGamemode> playerGameMode = Reflection.getField(PlayerInteractManager.class, EnumGamemode.class, 0);
|
private static final Reflection.Field<EnumGamemode> playerGameMode = Reflection.getField(PlayerInteractManager.class, EnumGamemode.class, 0);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@@ -73,7 +63,7 @@ public class NMSWrapper18 implements NMSWrapper {
|
|||||||
player.updateInventory();
|
player.updateInventory();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Reflection.FieldAccessor<PacketPlayOutGameStateChange.a> gameStateChangeReason = Reflection.getField(NoClipCommand.gameStateChange, PacketPlayOutGameStateChange.a.class, 12);
|
private static final Reflection.Field<PacketPlayOutGameStateChange.a> gameStateChangeReason = Reflection.getField(NoClipCommand.gameStateChange, PacketPlayOutGameStateChange.a.class, 12);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setGameStateChangeReason(Object packet) {
|
public void setGameStateChangeReason(Object packet) {
|
||||||
@@ -130,12 +120,12 @@ public class NMSWrapper18 implements NMSWrapper {
|
|||||||
return invalid;
|
return invalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
private final Class<?> explosionPacket = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutExplosion");
|
private final Class<?> explosionPacket = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundExplodePacket");
|
||||||
private final Reflection.FieldAccessor<Double> a = Reflection.getField(explosionPacket, double.class, 0);
|
private final Reflection.Field<Double> a = Reflection.getField(explosionPacket, double.class, 0);
|
||||||
private final Reflection.FieldAccessor<Double> b = Reflection.getField(explosionPacket, double.class, 1);
|
private final Reflection.Field<Double> b = Reflection.getField(explosionPacket, double.class, 1);
|
||||||
private final Reflection.FieldAccessor<Double> c = Reflection.getField(explosionPacket, double.class, 2);
|
private final Reflection.Field<Double> c = Reflection.getField(explosionPacket, double.class, 2);
|
||||||
private final Reflection.FieldAccessor<Float> d = Reflection.getField(explosionPacket, float.class, 0);
|
private final Reflection.Field<Float> d = Reflection.getField(explosionPacket, float.class, 0);
|
||||||
private final Reflection.FieldAccessor<List> e = Reflection.getField(explosionPacket, List.class, 0);
|
private final Reflection.Field<List> e = Reflection.getField(explosionPacket, List.class, 0);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object resetExplosionKnockback(Object packet) {
|
public Object resetExplosionKnockback(Object packet) {
|
||||||
|
|||||||
@@ -19,8 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.utils;
|
package de.steamwar.bausystem.utils;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import de.steamwar.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;
|
||||||
|
|||||||
@@ -19,37 +19,26 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.utils;
|
package de.steamwar.bausystem.utils;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import de.steamwar.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.FieldAccessor<EnumGamemode> playerGameMode = Reflection.getField(PlayerInteractManager.class, EnumGamemode.class, 0);
|
private static final Reflection.Field<EnumGamemode> playerGameMode = Reflection.getField(PlayerInteractManager.class, EnumGamemode.class, 0);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@@ -73,7 +62,7 @@ public class NMSWrapper19 implements NMSWrapper {
|
|||||||
player.updateInventory();
|
player.updateInventory();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Reflection.FieldAccessor<PacketPlayOutGameStateChange.a> gameStateChangeReason = Reflection.getField(NoClipCommand.gameStateChange, PacketPlayOutGameStateChange.a.class, 12);
|
private static final Reflection.Field<PacketPlayOutGameStateChange.a> gameStateChangeReason = Reflection.getField(NoClipCommand.gameStateChange, PacketPlayOutGameStateChange.a.class, 12);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setGameStateChangeReason(Object packet) {
|
public void setGameStateChangeReason(Object packet) {
|
||||||
@@ -130,12 +119,12 @@ public class NMSWrapper19 implements NMSWrapper {
|
|||||||
return invalid;
|
return invalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
private final Class<?> explosionPacket = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutExplosion");
|
private final Class<?> explosionPacket = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundExplodePacket");
|
||||||
private final Reflection.FieldAccessor<Double> a = Reflection.getField(explosionPacket, double.class, 0);
|
private final Reflection.Field<Double> a = Reflection.getField(explosionPacket, double.class, 0);
|
||||||
private final Reflection.FieldAccessor<Double> b = Reflection.getField(explosionPacket, double.class, 1);
|
private final Reflection.Field<Double> b = Reflection.getField(explosionPacket, double.class, 1);
|
||||||
private final Reflection.FieldAccessor<Double> c = Reflection.getField(explosionPacket, double.class, 2);
|
private final Reflection.Field<Double> c = Reflection.getField(explosionPacket, double.class, 2);
|
||||||
private final Reflection.FieldAccessor<Float> d = Reflection.getField(explosionPacket, float.class, 0);
|
private final Reflection.Field<Float> d = Reflection.getField(explosionPacket, float.class, 0);
|
||||||
private final Reflection.FieldAccessor<List> e = Reflection.getField(explosionPacket, List.class, 0);
|
private final Reflection.Field<List> e = Reflection.getField(explosionPacket, List.class, 0);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object resetExplosionKnockback(Object packet) {
|
public Object resetExplosionKnockback(Object packet) {
|
||||||
|
|||||||
@@ -19,17 +19,12 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.utils;
|
package de.steamwar.bausystem.utils;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import de.steamwar.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
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.utils;
|
package de.steamwar.bausystem.utils;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import de.steamwar.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.FieldAccessor<EnumGamemode> playerGameMode = Reflection.getField(PlayerInteractManager.class, EnumGamemode.class, 0);
|
private static final Reflection.Field<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.FieldAccessor<PacketPlayOutGameStateChange.a> gameStateChangeReason = Reflection.getField(NoClipCommand.gameStateChange, PacketPlayOutGameStateChange.a.class, 12);
|
private static final Reflection.Field<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("{nms.network.protocol.game}.PacketPlayOutExplosion");
|
private final Class<?> explosionPacket = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundExplodePacket");
|
||||||
private final Reflection.FieldAccessor<Double> a = Reflection.getField(explosionPacket, double.class, 0);
|
private final Reflection.Field<Double> a = Reflection.getField(explosionPacket, double.class, 0);
|
||||||
private final Reflection.FieldAccessor<Double> b = Reflection.getField(explosionPacket, double.class, 1);
|
private final Reflection.Field<Double> b = Reflection.getField(explosionPacket, double.class, 1);
|
||||||
private final Reflection.FieldAccessor<Double> c = Reflection.getField(explosionPacket, double.class, 2);
|
private final Reflection.Field<Double> c = Reflection.getField(explosionPacket, double.class, 2);
|
||||||
private final Reflection.FieldAccessor<Float> d = Reflection.getField(explosionPacket, float.class, 0);
|
private final Reflection.Field<Float> d = Reflection.getField(explosionPacket, float.class, 0);
|
||||||
private final Reflection.FieldAccessor<List> e = Reflection.getField(explosionPacket, List.class, 0);
|
private final Reflection.Field<List> e = Reflection.getField(explosionPacket, List.class, 0);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object resetExplosionKnockback(Object packet) {
|
public Object resetExplosionKnockback(Object packet) {
|
||||||
|
|||||||
@@ -19,18 +19,12 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.utils;
|
package de.steamwar.bausystem.utils;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import de.steamwar.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
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.utils;
|
package de.steamwar.bausystem.utils;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import de.steamwar.Reflection;
|
||||||
import de.steamwar.bausystem.features.util.NoClipCommand;
|
import de.steamwar.bausystem.features.util.NoClipCommand;
|
||||||
import net.minecraft.core.component.DataComponents;
|
import net.minecraft.core.component.DataComponents;
|
||||||
import net.minecraft.nbt.NBTBase;
|
import net.minecraft.nbt.NBTBase;
|
||||||
@@ -45,7 +45,7 @@ import java.util.Optional;
|
|||||||
|
|
||||||
public class NMSWrapper21 implements NMSWrapper {
|
public class NMSWrapper21 implements NMSWrapper {
|
||||||
|
|
||||||
private static final Reflection.FieldAccessor<PlayerInteractManager> playerInteractManager = Reflection.getField(EntityPlayer.class, null, PlayerInteractManager.class);
|
private static final Reflection.Field<PlayerInteractManager> playerInteractManager = Reflection.getField(EntityPlayer.class, null, PlayerInteractManager.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setInternalGameMode(Player player, GameMode gameMode) {
|
public void setInternalGameMode(Player player, GameMode gameMode) {
|
||||||
@@ -68,14 +68,14 @@ public class NMSWrapper21 implements NMSWrapper {
|
|||||||
player.updateInventory();
|
player.updateInventory();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Reflection.FieldAccessor<PacketPlayOutGameStateChange.a> gameStateChangeReason = Reflection.getField(NoClipCommand.gameStateChange, PacketPlayOutGameStateChange.a.class, 12);
|
private static final Reflection.Field<PacketPlayOutGameStateChange.a> gameStateChangeReason = Reflection.getField(NoClipCommand.gameStateChange, PacketPlayOutGameStateChange.a.class, 12);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setGameStateChangeReason(Object packet) {
|
public void setGameStateChangeReason(Object packet) {
|
||||||
gameStateChangeReason.set(packet, PacketPlayOutGameStateChange.d);
|
gameStateChangeReason.set(packet, PacketPlayOutGameStateChange.d);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Reflection.FieldAccessor<PlayerAbilities> playerAbilities = Reflection.getField(EntityHuman.class, null, PlayerAbilities.class);
|
private static final Reflection.Field<PlayerAbilities> playerAbilities = Reflection.getField(EntityHuman.class, null, PlayerAbilities.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setPlayerBuildAbilities(Player player) {
|
public void setPlayerBuildAbilities(Player player) {
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ dependencies {
|
|||||||
compileOnly(libs.spigotapi)
|
compileOnly(libs.spigotapi)
|
||||||
compileOnly(libs.axiom)
|
compileOnly(libs.axiom)
|
||||||
compileOnly(libs.authlib)
|
compileOnly(libs.authlib)
|
||||||
compileOnly(libs.viaapi)
|
|
||||||
|
|
||||||
compileOnly(libs.fawe18)
|
compileOnly(libs.fawe18)
|
||||||
|
|
||||||
|
|||||||
@@ -1014,5 +1014,3 @@ COLORREPLACE_HELP=§8//§ecolorreplace §8[§7color§8] §8[§7color§8] §8- §
|
|||||||
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}
|
|
||||||
@@ -955,5 +955,3 @@ COLORREPLACE_HELP=§8//§ecolorreplace §8[§7color§8] §8[§7color§8] §8- §
|
|||||||
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}
|
|
||||||
+2
-2
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.features.observer;
|
package de.steamwar.bausystem.features.observer;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import de.steamwar.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("{obc}.block.impl.CraftPoweredRail");
|
private static final Class<?> craftPoweredRail = Reflection.getClass("org.bukkit.craftbukkit.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) {
|
||||||
|
|||||||
+3
-4
@@ -24,7 +24,6 @@ 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;
|
||||||
@@ -32,7 +31,6 @@ 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;
|
||||||
@@ -72,9 +70,10 @@ 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)
|
||||||
|
|||||||
+4
-4
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.features.simulator;
|
package de.steamwar.bausystem.features.simulator;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import de.steamwar.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("{nms.network.protocol.game}.PacketPlayInFlying$PacketPlayInPosition");
|
private Class<?> position = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundMovePlayerPacket$Pos");
|
||||||
private Class<?> look = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInFlying$PacketPlayInLook");
|
private Class<?> look = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundMovePlayerPacket$Rot");
|
||||||
private Class<?> positionLook = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInFlying$PacketPlayInPositionLook");
|
private Class<?> positionLook = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundMovePlayerPacket$PosRot");
|
||||||
|
|
||||||
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<>());
|
||||||
|
|||||||
+2
-2
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.features.smartplace;
|
package de.steamwar.bausystem.features.smartplace;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import de.steamwar.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;
|
||||||
@@ -81,7 +81,7 @@ public class SmartPlaceListener implements Listener {
|
|||||||
IGNORED.remove(Material.BARRIER);
|
IGNORED.remove(Material.BARRIER);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Class<?> useItem = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInUseItem");
|
private static final Class<?> useItem = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundUseItemOnPacket");
|
||||||
|
|
||||||
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<>();
|
||||||
|
|||||||
+10
-10
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.features.tpslimit;
|
package de.steamwar.bausystem.features.tpslimit;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import de.steamwar.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("{nms.world.phys}.Vec3D");
|
private static Class<?> vec3dClass = Reflection.getClass("net.minecraft.world.phys.Vec3");
|
||||||
private static Reflection.FieldAccessor<Object> zeroVec3d = (Reflection.FieldAccessor<Object>) Reflection.getField(vec3dClass, vec3dClass, 0);
|
private static Reflection.Field<Object> zeroVec3d = (Reflection.Field<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("{nms.network.protocol.game}.PacketPlayOutEntityVelocity");
|
private static Class<?> velocityPacketClass = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundSetEntityMotionPacket");
|
||||||
private static Reflection.ConstructorInvoker velocityPacketConstructor = Reflection.getConstructor(velocityPacketClass, int.class, vec3dClass);
|
private static Reflection.Constructor velocityPacketConstructor = Reflection.getConstructor(velocityPacketClass, int.class, vec3dClass);
|
||||||
|
|
||||||
private static Class<?> teleportPacketClass = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutEntityTeleport");
|
private static Class<?> teleportPacketClass = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundTeleportEntityPacket");
|
||||||
private static Class<?> entityClass = Reflection.getClass("{nms.world.entity}.Entity");
|
private static Class<?> entityClass = Reflection.getClass("net.minecraft.world.entity.Entity");
|
||||||
private static Reflection.ConstructorInvoker teleportPacketConstructor = Reflection.getConstructor(teleportPacketClass, entityClass);
|
private static Reflection.Constructor teleportPacketConstructor = Reflection.getConstructor(teleportPacketClass, entityClass);
|
||||||
|
|
||||||
private static Class<?> craftEntityClass = Reflection.getClass("{obc}.entity.CraftEntity");
|
private static Class<?> craftEntityClass = Reflection.getClass("org.bukkit.craftbukkit.entity.CraftEntity");
|
||||||
private static Reflection.MethodInvoker getHandle = Reflection.getMethod(craftEntityClass, "getHandle");
|
private static Reflection.Method 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);
|
||||||
|
|||||||
+5
-5
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.features.tpslimit;
|
package de.steamwar.bausystem.features.tpslimit;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import de.steamwar.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.FieldAccessor<Boolean> fieldAccessor;
|
private static Reflection.Field<Boolean> fieldAccessor;
|
||||||
@Getter
|
@Getter
|
||||||
private static final boolean canFreeze;
|
private static final boolean canFreeze;
|
||||||
|
|
||||||
private static final Reflection.MethodInvoker getWorldHandle = Reflection.getTypedMethod(Reflection.getClass("{obc}.CraftWorld"), "getHandle", null);
|
private static final Reflection.Method getWorldHandle = Reflection.getTypedMethod(Reflection.getClass("org.bukkit.craftbukkit.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.FieldAccessor<Boolean> fieldAccessor;
|
Reflection.Field<Boolean> fieldAccessor;
|
||||||
try {
|
try {
|
||||||
fieldAccessor = Reflection.getField(Reflection.getClass("{nms.server.level}.WorldServer"), "freezed", boolean.class);
|
fieldAccessor = Reflection.getField(Reflection.getClass("net.minecraft.server.level.ServerLevel"), "freezed", boolean.class);
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
fieldAccessor = null;
|
fieldAccessor = null;
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-6
@@ -19,15 +19,12 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.features.tpslimit;
|
package de.steamwar.bausystem.features.tpslimit;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import de.steamwar.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;
|
||||||
|
|
||||||
@@ -104,8 +101,8 @@ public class TPSLimitUtils {
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private static final Class<?> position = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInFlying$PacketPlayInPosition");
|
private static final Class<?> position = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundMovePlayerPacket$Pos");
|
||||||
private static final Class<?> positionLook = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInFlying$PacketPlayInPositionLook");
|
private static final Class<?> positionLook = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundMovePlayerPacket$PosRot");
|
||||||
static {
|
static {
|
||||||
BiFunction<Player, Object, Object> positionSetter = (player, o) -> {
|
BiFunction<Player, Object, Object> positionSetter = (player, o) -> {
|
||||||
if (tpsLimiter != null) {
|
if (tpsLimiter != null) {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.features.util;
|
package de.steamwar.bausystem.features.util;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import de.steamwar.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("{nms.network.protocol.game}.PacketPlayOutGameStateChange");
|
public static final Class<?> gameStateChange = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundGameEventPacket");
|
||||||
private static final Reflection.FieldAccessor<Float> floatFieldAccessor = Reflection.getField(gameStateChange, float.class, 0);
|
private static final Reflection.Field<Float> floatFieldAccessor = Reflection.getField(gameStateChange, float.class, 0);
|
||||||
|
|
||||||
private static final Class<?> position = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInFlying$PacketPlayInPosition");
|
private static final Class<?> position = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundMovePlayerPacket$Pos");
|
||||||
private static final Class<?> positionLook = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInFlying$PacketPlayInPositionLook");
|
private static final Class<?> positionLook = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundMovePlayerPacket$PosRot");
|
||||||
private static final Class<?> useItem = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInUseItem");
|
private static final Class<?> useItem = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundUseItemOnPacket");
|
||||||
private static final Class<?> blockDig = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInBlockDig");
|
private static final Class<?> blockDig = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundPlayerActionPacket");
|
||||||
private static final Class<?> windowClick = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInWindowClick");
|
private static final Class<?> windowClick = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundContainerClickPacket");
|
||||||
private static final Class<?> setSlotStack = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInSetCreativeSlot");
|
private static final Class<?> setSlotStack = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundSetCreativeModeSlotPacket");
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private static final List<Player> NOCLIPS = new ArrayList<>();
|
private static final List<Player> NOCLIPS = new ArrayList<>();
|
||||||
|
|||||||
+2
-2
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.features.world;
|
package de.steamwar.bausystem.features.world;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import de.steamwar.Reflection;
|
||||||
import com.comphenix.tinyprotocol.TinyProtocol;
|
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
@@ -32,7 +32,7 @@ public class AntiCursorReCentering implements Enable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void enable() {
|
public void enable() {
|
||||||
Class<?> closeWindow = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutCloseWindow");
|
Class<?> closeWindow = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundContainerClosePacket");
|
||||||
TinyProtocol.instance.addFilter(closeWindow, (player, object) -> {
|
TinyProtocol.instance.addFilter(closeWindow, (player, object) -> {
|
||||||
if (player.getOpenInventory().getTopInventory().getType() == InventoryType.CRAFTING) {
|
if (player.getOpenInventory().getTopInventory().getType() == InventoryType.CRAFTING) {
|
||||||
return object;
|
return object;
|
||||||
|
|||||||
+2
-2
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.features.world;
|
package de.steamwar.bausystem.features.world;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import de.steamwar.Reflection;
|
||||||
import com.comphenix.tinyprotocol.TinyProtocol;
|
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||||
import de.steamwar.bausystem.utils.NMSWrapper;
|
import de.steamwar.bausystem.utils.NMSWrapper;
|
||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
@@ -29,7 +29,7 @@ import org.bukkit.GameMode;
|
|||||||
public class NoCreativeKnockback {
|
public class NoCreativeKnockback {
|
||||||
|
|
||||||
public NoCreativeKnockback() {
|
public NoCreativeKnockback() {
|
||||||
TinyProtocol.instance.addFilter(Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutExplosion"), (player, o) -> {
|
TinyProtocol.instance.addFilter(Reflection.getClass("net.minecraft.network.protocol.game.ClientboundExplodePacket"), (player, o) -> {
|
||||||
if (player.getGameMode() != GameMode.CREATIVE) return o;
|
if (player.getGameMode() != GameMode.CREATIVE) return o;
|
||||||
return NMSWrapper.impl.resetExplosionKnockback(o);
|
return NMSWrapper.impl.resetExplosionKnockback(o);
|
||||||
});
|
});
|
||||||
|
|||||||
+14
-14
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.features.world;
|
package de.steamwar.bausystem.features.world;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import de.steamwar.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;
|
||||||
@@ -48,21 +48,21 @@ import org.bukkit.util.Vector;
|
|||||||
@MinVersion(20)
|
@MinVersion(20)
|
||||||
public class SignEditFrom20 implements Listener {
|
public class SignEditFrom20 implements Listener {
|
||||||
|
|
||||||
private static final Class<?> blockPosition = Reflection.getClass("{nms.core}.BlockPosition");
|
private static final Class<?> blockPosition = Reflection.getClass("net.minecraft.core.BlockPos");
|
||||||
private static final Class<?> craftBlock = Reflection.getClass("{obc}.block.CraftBlock");
|
private static final Class<?> craftBlock = Reflection.getClass("org.bukkit.craftbukkit.block.CraftBlock");
|
||||||
private static final Class<?> craftWorld = Reflection.getClass("{obc}.CraftWorld");
|
private static final Class<?> craftWorld = Reflection.getClass("org.bukkit.craftbukkit.CraftWorld");
|
||||||
private static final Class<?> generatorAccess = Reflection.getClass("{nms.world.level}.GeneratorAccess");
|
private static final Class<?> generatorAccess = Reflection.getClass("net.minecraft.world.level.LevelAccessor");
|
||||||
private static final Reflection.MethodInvoker getPosition = Reflection.getTypedMethod(craftBlock, "getPosition", blockPosition);
|
private static final Reflection.Method getPosition = Reflection.getTypedMethod(craftBlock, "getPosition", blockPosition);
|
||||||
private static final Reflection.MethodInvoker getWorldHandle = Reflection.getTypedMethod(craftWorld, "getHandle", null);
|
private static final Reflection.Method getWorldHandle = Reflection.getTypedMethod(craftWorld, "getHandle", null);
|
||||||
private static final Reflection.MethodInvoker at = Reflection.getTypedMethod(craftBlock, "at", craftBlock, generatorAccess, blockPosition);
|
private static final Reflection.Method at = Reflection.getTypedMethod(craftBlock, "at", craftBlock, generatorAccess, blockPosition);
|
||||||
|
|
||||||
private static final Class<?> openSign = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutOpenSignEditor");
|
private static final Class<?> openSign = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundOpenSignEditorPacket");
|
||||||
private static final Reflection.FieldAccessor<?> blockPositionFieldAccessor = Reflection.getField(openSign, blockPosition, 0);
|
private static final Reflection.Field<?> blockPositionFieldAccessor = Reflection.getField(openSign, blockPosition, 0);
|
||||||
private static final Reflection.FieldAccessor<?> sideFieldAccessor = Reflection.getField(openSign, boolean.class, 0);
|
private static final Reflection.Field<?> sideFieldAccessor = Reflection.getField(openSign, boolean.class, 0);
|
||||||
|
|
||||||
private static final Class<?> updateSign = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInUpdateSign");
|
private static final Class<?> updateSign = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundSignUpdatePacket");
|
||||||
private static final Reflection.FieldAccessor<?> getBlockPositionFieldAccessor = Reflection.getField(updateSign, blockPosition, 0);
|
private static final Reflection.Field<?> getBlockPositionFieldAccessor = Reflection.getField(updateSign, blockPosition, 0);
|
||||||
private static final Reflection.FieldAccessor<String[]> stringFieldAccessor = Reflection.getField(updateSign, String[].class, 0);
|
private static final Reflection.Field<String[]> stringFieldAccessor = Reflection.getField(updateSign, String[].class, 0);
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void editSign(PlayerInteractEvent event) {
|
public void editSign(PlayerInteractEvent event) {
|
||||||
|
|||||||
+13
-13
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.features.world;
|
package de.steamwar.bausystem.features.world;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import de.steamwar.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;
|
||||||
@@ -40,20 +40,20 @@ import org.bukkit.event.player.PlayerInteractEvent;
|
|||||||
@MaxVersion(19)
|
@MaxVersion(19)
|
||||||
public class SignEditUntil19 implements Listener {
|
public class SignEditUntil19 implements Listener {
|
||||||
|
|
||||||
private static final Class<?> blockPosition = Reflection.getClass("{nms.core}.BlockPosition");
|
private static final Class<?> blockPosition = Reflection.getClass("net.minecraft.core.BlockPos");
|
||||||
private static final Class<?> craftBlock = Reflection.getClass("{obc}.block.CraftBlock");
|
private static final Class<?> craftBlock = Reflection.getClass("org.bukkit.craftbukkit.block.CraftBlock");
|
||||||
private static final Class<?> craftWorld = Reflection.getClass("{obc}.CraftWorld");
|
private static final Class<?> craftWorld = Reflection.getClass("org.bukkit.craftbukkit.CraftWorld");
|
||||||
private static final Class<?> generatorAccess = Reflection.getClass("{nms.world.level}.GeneratorAccess");
|
private static final Class<?> generatorAccess = Reflection.getClass("net.minecraft.world.level.LevelAccessor");
|
||||||
private static final Reflection.MethodInvoker getPosition = Reflection.getTypedMethod(craftBlock, "getPosition", blockPosition);
|
private static final Reflection.Method getPosition = Reflection.getTypedMethod(craftBlock, "getPosition", blockPosition);
|
||||||
private static final Reflection.MethodInvoker getWorldHandle = Reflection.getTypedMethod(craftWorld, "getHandle", null);
|
private static final Reflection.Method getWorldHandle = Reflection.getTypedMethod(craftWorld, "getHandle", null);
|
||||||
private static final Reflection.MethodInvoker at = Reflection.getTypedMethod(craftBlock, "at", craftBlock, generatorAccess, blockPosition);
|
private static final Reflection.Method at = Reflection.getTypedMethod(craftBlock, "at", craftBlock, generatorAccess, blockPosition);
|
||||||
|
|
||||||
private static final Class<?> openSign = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutOpenSignEditor");
|
private static final Class<?> openSign = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundOpenSignEditorPacket");
|
||||||
private static final Reflection.FieldAccessor<?> blockPositionFieldAccessor = Reflection.getField(openSign, blockPosition, 0);
|
private static final Reflection.Field<?> blockPositionFieldAccessor = Reflection.getField(openSign, blockPosition, 0);
|
||||||
|
|
||||||
private static final Class<?> updateSign = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInUpdateSign");
|
private static final Class<?> updateSign = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundSignUpdatePacket");
|
||||||
private static final Reflection.FieldAccessor<?> getBlockPositionFieldAccessor = Reflection.getField(updateSign, blockPosition, 0);
|
private static final Reflection.Field<?> getBlockPositionFieldAccessor = Reflection.getField(updateSign, blockPosition, 0);
|
||||||
private static final Reflection.FieldAccessor<String[]> stringFieldAccessor = Reflection.getField(updateSign, String[].class, 0);
|
private static final Reflection.Field<String[]> stringFieldAccessor = Reflection.getField(updateSign, String[].class, 0);
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void editSign(PlayerInteractEvent event) {
|
public void editSign(PlayerInteractEvent event) {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.features.xray;
|
package de.steamwar.bausystem.features.xray;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import de.steamwar.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.features.techhider.TechHiderCommand;
|
import de.steamwar.bausystem.features.techhider.TechHiderCommand;
|
||||||
@@ -108,8 +108,8 @@ public class XrayCommand extends SWCommand implements Listener, ScoreboardElemen
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Class<?> position = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInFlying$PacketPlayInPosition");
|
private static final Class<?> position = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundMovePlayerPacket$Pos");
|
||||||
private static final Class<?> positionLook = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInFlying$PacketPlayInPositionLook");
|
private static final Class<?> positionLook = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundMovePlayerPacket$PosRot");
|
||||||
|
|
||||||
{
|
{
|
||||||
BiFunction<Player, Object, Object> positionSetter = (player, o) -> {
|
BiFunction<Player, Object, Object> positionSetter = (player, o) -> {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.utils;
|
package de.steamwar.bausystem.utils;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import de.steamwar.Reflection;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.experimental.UtilityClass;
|
import lombok.experimental.UtilityClass;
|
||||||
@@ -81,12 +81,12 @@ public class PlaceItemUtils {
|
|||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Class<?> blockPosition = Reflection.getClass("{nms.core}.BlockPosition");
|
private static final Class<?> blockPosition = Reflection.getClass("net.minecraft.core.BlockPos");
|
||||||
private static final Reflection.ConstructorInvoker blockPositionConstructor = Reflection.getConstructor(blockPosition, int.class, int.class, int.class);
|
private static final Reflection.Constructor blockPositionConstructor = Reflection.getConstructor(blockPosition, int.class, int.class, int.class);
|
||||||
private static final Class<?> craftBlock = Reflection.getClass("{obc}.block.CraftBlockState");
|
private static final Class<?> craftBlock = Reflection.getClass("org.bukkit.craftbukkit.block.CraftBlockState");
|
||||||
private static final Class<?> craftWorld = Reflection.getClass("{obc}.CraftWorld");
|
private static final Class<?> craftWorld = Reflection.getClass("org.bukkit.craftbukkit.CraftWorld");
|
||||||
private static final Reflection.FieldAccessor<?> positionAccessor = Reflection.getField(craftBlock, blockPosition, 0);
|
private static final Reflection.Field<?> positionAccessor = Reflection.getField(craftBlock, blockPosition, 0);
|
||||||
private static final Reflection.FieldAccessor<?> worldAccessor = Reflection.getField(craftBlock, craftWorld, 0);
|
private static final Reflection.Field<?> worldAccessor = Reflection.getField(craftBlock, craftWorld, 0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attempt to place an {@link ItemStack} the {@link Player} is holding against a {@link Block} inside the World.
|
* Attempt to place an {@link ItemStack} the {@link Player} is holding against a {@link Block} inside the World.
|
||||||
|
|||||||
@@ -19,17 +19,16 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.utils;
|
package de.steamwar.bausystem.utils;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import de.steamwar.Reflection;
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.core.BountifulWrapper;
|
import de.steamwar.core.BountifulWrapper;
|
||||||
import de.steamwar.core.Core;
|
|
||||||
import de.steamwar.core.VersionDependent;
|
import de.steamwar.core.VersionDependent;
|
||||||
import de.steamwar.entity.REntity;
|
import de.steamwar.entity.REntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public interface PlayerMovementWrapper {
|
public interface PlayerMovementWrapper {
|
||||||
Class<?> teleportPacket = REntity.teleportPacket;
|
Class<?> teleportPacket = REntity.teleportPacket;
|
||||||
Reflection.FieldAccessor<Integer> teleportEntity = REntity.teleportEntity;
|
Reflection.Field<Integer> teleportEntity = REntity.teleportEntity;
|
||||||
BountifulWrapper.PositionSetter teleportPosition = REntity.teleportPosition;
|
BountifulWrapper.PositionSetter teleportPosition = REntity.teleportPosition;
|
||||||
|
|
||||||
PlayerMovementWrapper impl = VersionDependent.getVersionImpl(BauSystem.getInstance());
|
PlayerMovementWrapper impl = VersionDependent.getVersionImpl(BauSystem.getInstance());
|
||||||
|
|||||||
@@ -1,49 +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 com.viaversion.viaversion.api.Via;
|
|
||||||
import com.viaversion.viaversion.api.ViaAPI;
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
|
||||||
import de.steamwar.linkage.Linked;
|
|
||||||
import net.md_5.bungee.api.ChatMessageType;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
|
||||||
|
|
||||||
@Linked
|
|
||||||
public class VersionAnnouncer implements Listener {
|
|
||||||
|
|
||||||
private final String versionString = Bukkit.getBukkitVersion().split("-", 2)[0];
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
private final ViaAPI<Player> via = Via.getAPI();
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onJoin(PlayerJoinEvent event) {
|
|
||||||
Player player = event.getPlayer();
|
|
||||||
if(via.getServerVersion().supportedVersions().contains(via.getPlayerVersion(player)))
|
|
||||||
return;
|
|
||||||
|
|
||||||
BauSystem.MESSAGE.sendPrefixless("SERVER_VERSION", player, ChatMessageType.ACTION_BAR, versionString);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.utils;
|
package de.steamwar.bausystem.utils;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import de.steamwar.Reflection;
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.IncompleteRegionException;
|
import com.sk89q.worldedit.IncompleteRegionException;
|
||||||
import com.sk89q.worldedit.LocalSession;
|
import com.sk89q.worldedit.LocalSession;
|
||||||
@@ -100,7 +100,7 @@ public class WorldEditUtils {
|
|||||||
.getSessionManager()
|
.getSessionManager()
|
||||||
.get(BukkitAdapter.adapt(player));
|
.get(BukkitAdapter.adapt(player));
|
||||||
|
|
||||||
Reflection.ConstructorInvoker constructorInvoker = Reflection.getConstructor(clazz, com.sk89q.worldedit.world.World.class);
|
Reflection.Constructor constructorInvoker = Reflection.getConstructor(clazz, com.sk89q.worldedit.world.World.class);
|
||||||
RegionSelector regionSelector = (RegionSelector) constructorInvoker.invoke(BukkitAdapter.adapt(player.getWorld()));
|
RegionSelector regionSelector = (RegionSelector) constructorInvoker.invoke(BukkitAdapter.adapt(player.getWorld()));
|
||||||
localSession.setRegionSelector(BukkitAdapter.adapt(player.getWorld()), regionSelector);
|
localSession.setRegionSelector(BukkitAdapter.adapt(player.getWorld()), regionSelector);
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ name: BauSystem
|
|||||||
authors: [ Lixfel, YoyoNow, Chaoscaot, Zeanon, D4rkr34lm ]
|
authors: [ Lixfel, YoyoNow, Chaoscaot, Zeanon, D4rkr34lm ]
|
||||||
version: "2.0"
|
version: "2.0"
|
||||||
depend: [ WorldEdit, SpigotCore ]
|
depend: [ WorldEdit, SpigotCore ]
|
||||||
softdepend:
|
|
||||||
- ViaVersion
|
|
||||||
load: POSTWORLD
|
load: POSTWORLD
|
||||||
main: de.steamwar.bausystem.BauSystem
|
main: de.steamwar.bausystem.BauSystem
|
||||||
api-version: "1.13"
|
api-version: "1.13"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* This file is a part of the SteamWar software.
|
* This file is a part of the SteamWar software.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2024 SteamWar.de-Serverteam
|
* Copyright (C) 2024 SteamWar.de-Serverteam
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* This file is a part of the SteamWar software.
|
* This file is a part of the SteamWar software.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2024 SteamWar.de-Serverteam
|
* Copyright (C) 2024 SteamWar.de-Serverteam
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ public class Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Event create(String eventName, Timestamp start, Timestamp end){
|
public static Event create(String eventName, Timestamp start, Timestamp end){
|
||||||
return get(create.insertGetKey(eventName, start, start, end, 5, false, false));
|
return get(create.insertGetKey(eventName, start, start, end, 5, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Event get(int eventID){
|
public static Event get(int eventID){
|
||||||
|
|||||||
@@ -35,8 +35,9 @@ import java.util.stream.Collectors;
|
|||||||
public class Fight {
|
public class Fight {
|
||||||
|
|
||||||
private static final Table<Fight> table = new Table<>(Fight.class);
|
private static final Table<Fight> table = new Table<>(Fight.class);
|
||||||
private static final SelectStatement<Fight> getPage = new SelectStatement<>(table, "SELECT f.*, (b.NodeId IS NULL OR b.AllowReplay) AND (r.NodeId IS NULL OR r.AllowReplay) AS ReplayAllowed, (SELECT COUNT(1) FROM Replay WHERE Replay.FightID = f.FightID) as ReplayAvailable FROM Fight f LEFT OUTER JOIN SchematicNode b ON f.BlueSchem = b.NodeId LEFT OUTER JOIN SchematicNode r ON f.RedSchem = r.NodeId ORDER BY FightID DESC LIMIT ?, ?");
|
private static final SelectStatement<Fight> getPage = new SelectStatement<>(table, "SELECT f.*, (b.NodeId IS NULL OR b.AllowReplay) AND (r.NodeId IS NULL OR r.AllowReplay) AS ReplayAllowed FROM Fight f LEFT OUTER JOIN SchematicNode b ON f.BlueSchem = b.NodeId LEFT OUTER JOIN SchematicNode r ON f.RedSchem = r.NodeId ORDER BY FightID DESC LIMIT ?, ?");
|
||||||
private static final Statement insert = table.insertFields(true, "GameMode", "Server", "StartTime", "Duration", "BlueLeader", "RedLeader", "BlueSchem", "RedSchem", "Win", "WinCondition");
|
private static final Statement insert = table.insertFields(true, "GameMode", "Server", "StartTime", "Duration", "BlueLeader", "RedLeader", "BlueSchem", "RedSchem", "Win", "WinCondition");
|
||||||
|
private static final Statement updateReplayAvailable = table.update(Table.PRIMARY, "ReplayAvailable");
|
||||||
|
|
||||||
public static List<Fight> getPage(int page, int elementsPerPage) {
|
public static List<Fight> getPage(int page, int elementsPerPage) {
|
||||||
List<Fight> fights = getPage.listSelect(page * elementsPerPage, elementsPerPage);
|
List<Fight> fights = getPage.listSelect(page * elementsPerPage, elementsPerPage);
|
||||||
@@ -54,6 +55,10 @@ public class Fight {
|
|||||||
return insert.insertGetKey(gamemode, server, starttime, duration, blueleader, redleader, blueschem, redschem, win, wincondition);
|
return insert.insertGetKey(gamemode, server, starttime, duration, blueleader, redleader, blueschem, redschem, win, wincondition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void markReplayAvailable(int fightID) {
|
||||||
|
updateReplayAvailable.update(true, fightID);
|
||||||
|
}
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Field(keys = {Table.PRIMARY}, autoincrement = true)
|
@Field(keys = {Table.PRIMARY}, autoincrement = true)
|
||||||
private final int fightID;
|
private final int fightID;
|
||||||
@@ -80,10 +85,10 @@ public class Fight {
|
|||||||
private final int win;
|
private final int win;
|
||||||
@Field
|
@Field
|
||||||
private final String wincondition;
|
private final String wincondition;
|
||||||
|
@Field
|
||||||
|
private final boolean replayAvailable;
|
||||||
@Field // Virtual field for easy select
|
@Field // Virtual field for easy select
|
||||||
private final boolean replayAllowed;
|
private final boolean replayAllowed;
|
||||||
@Field // Virtual field for easy select
|
|
||||||
private final boolean replayAvailable;
|
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private final List<FightPlayer> bluePlayers = new ArrayList<>();
|
private final List<FightPlayer> bluePlayers = new ArrayList<>();
|
||||||
|
|||||||
@@ -28,12 +28,15 @@ import java.sql.PreparedStatement;
|
|||||||
import java.util.zip.GZIPInputStream;
|
import java.util.zip.GZIPInputStream;
|
||||||
|
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@Getter
|
||||||
public class NodeData {
|
public class NodeData {
|
||||||
|
|
||||||
static {
|
static {
|
||||||
new SqlTypeMapper<>(PipedInputStream.class, "BLOB", (rs, identifier) -> { throw new SecurityException("PipedInputStream is write only datatype"); }, PreparedStatement::setBinaryStream);
|
new SqlTypeMapper<>(PipedInputStream.class, "BLOB", (rs, identifier) -> { throw new SecurityException("PipedInputStream is write only datatype"); }, PreparedStatement::setBinaryStream);
|
||||||
new SqlTypeMapper<>(ByteArrayInputStream.class, "BLOB", (rs, identifier) -> { throw new SecurityException("ByteArrayInputStream is write only datatype"); }, PreparedStatement::setBinaryStream);
|
new SqlTypeMapper<>(ByteArrayInputStream.class, "BLOB", (rs, identifier) -> { throw new SecurityException("ByteArrayInputStream is write only datatype"); }, PreparedStatement::setBinaryStream);
|
||||||
new SqlTypeMapper<>(BufferedInputStream.class, "BLOB", (rs, identifier) -> { throw new SecurityException("BufferedInputStream is write only datatype"); }, PreparedStatement::setBinaryStream);
|
new SqlTypeMapper<>(BufferedInputStream.class, "BLOB", (rs, identifier) -> { throw new SecurityException("BufferedInputStream is write only datatype"); }, PreparedStatement::setBinaryStream);
|
||||||
|
|
||||||
|
SqlTypeMapper.ordinalEnumMapper(SchematicFormat.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Table<NodeData> table = new Table<>(NodeData.class);
|
private static final Table<NodeData> table = new Table<>(NodeData.class);
|
||||||
@@ -48,21 +51,24 @@ public class NodeData {
|
|||||||
throw new IllegalArgumentException("Node is a directory");
|
throw new IllegalArgumentException("Node is a directory");
|
||||||
return get.select(rs -> {
|
return get.select(rs -> {
|
||||||
if(rs.next()) {
|
if(rs.next()) {
|
||||||
return new NodeData(node.getId(), rs.getBoolean("NodeFormat"));
|
return new NodeData(node.getId(), SchematicFormat.values()[rs.getInt("NodeFormat")]);
|
||||||
} else {
|
} else {
|
||||||
return new NodeData(node.getId(), false);
|
return new NodeData(node.getId(), SchematicFormat.MCEDIT);
|
||||||
}
|
}
|
||||||
}, node);
|
}, node);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Getter
|
|
||||||
@Field(keys = {Table.PRIMARY})
|
@Field(keys = {Table.PRIMARY})
|
||||||
private final int nodeId;
|
private final int nodeId;
|
||||||
|
|
||||||
@Field
|
@Field
|
||||||
private boolean nodeFormat;
|
private SchematicFormat nodeFormat;
|
||||||
|
|
||||||
public InputStream schemData() throws IOException {
|
public InputStream schemData() throws IOException {
|
||||||
|
return schemData(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public InputStream schemData(boolean decompress) throws IOException {
|
||||||
try {
|
try {
|
||||||
return selSchemData.select(rs -> {
|
return selSchemData.select(rs -> {
|
||||||
rs.next();
|
rs.next();
|
||||||
@@ -71,7 +77,11 @@ public class NodeData {
|
|||||||
if(rs.wasNull() || schemData.available() == 0) {
|
if(rs.wasNull() || schemData.available() == 0) {
|
||||||
throw new SecurityException("SchemData is null");
|
throw new SecurityException("SchemData is null");
|
||||||
}
|
}
|
||||||
return new GZIPInputStream(schemData);
|
if (decompress) {
|
||||||
|
return new GZIPInputStream(schemData);
|
||||||
|
} else {
|
||||||
|
return schemData;
|
||||||
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new SecurityException("SchemData is wrong", e);
|
throw new SecurityException("SchemData is wrong", e);
|
||||||
}
|
}
|
||||||
@@ -81,12 +91,18 @@ public class NodeData {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveFromStream(InputStream blob, boolean newFormat) {
|
public void saveFromStream(InputStream blob, SchematicFormat newFormat) {
|
||||||
updateDatabase.update(nodeId, newFormat, blob);
|
updateDatabase.update(nodeId, newFormat, blob);
|
||||||
nodeFormat = newFormat;
|
nodeFormat = newFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getNodeFormat() {
|
@AllArgsConstructor
|
||||||
return nodeFormat;
|
@Getter
|
||||||
|
public enum SchematicFormat {
|
||||||
|
MCEDIT(".schematic"),
|
||||||
|
SPONGE_V2(".schem"),
|
||||||
|
SPONGE_V3(".schem");
|
||||||
|
|
||||||
|
private final String fileEnding;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ import java.time.Instant;
|
|||||||
public class NodeDownload {
|
public class NodeDownload {
|
||||||
|
|
||||||
private static final char[] HEX = new char[]{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
|
private static final char[] HEX = new char[]{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
|
||||||
private static final String LINK_BASE = "https://steamwar.de/download.php?schem=";
|
private static final String LINK_BASE = "https://api.steamwar.de/download/";
|
||||||
|
|
||||||
private static final Table<NodeDownload> table = new Table<>(NodeDownload.class);
|
private static final Table<NodeDownload> table = new Table<>(NodeDownload.class);
|
||||||
private static final Statement insert = table.insertFields("NodeId", "Link");
|
private static final Statement insert = table.insertFields("NodeId", "Link");
|
||||||
|
|||||||
@@ -1,74 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is a part of the SteamWar software.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2022 SteamWar.de-Serverteam
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.sql;
|
|
||||||
|
|
||||||
import de.steamwar.sql.internal.*;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Getter;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.nio.file.StandardCopyOption;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class Replay {
|
|
||||||
|
|
||||||
static {
|
|
||||||
new SqlTypeMapper<>(File.class, "BLOB", (rs, identifier) -> {
|
|
||||||
try {
|
|
||||||
File file = File.createTempFile("replay", ".replay");
|
|
||||||
file.deleteOnExit();
|
|
||||||
Files.copy(rs.getBinaryStream(identifier), file.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
|
||||||
return file;
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new SQLException(e);
|
|
||||||
}
|
|
||||||
}, (st, index, value) -> {
|
|
||||||
try {
|
|
||||||
st.setBinaryStream(index, new FileInputStream(value));
|
|
||||||
} catch (FileNotFoundException e) {
|
|
||||||
throw new SQLException(e);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final Table<Replay> table = new Table<>(Replay.class);
|
|
||||||
private static final SelectStatement<Replay> get = table.select(Table.PRIMARY);
|
|
||||||
|
|
||||||
public static final Statement insert = table.insertAll();
|
|
||||||
|
|
||||||
public static Replay get(int fightID) {
|
|
||||||
return get.select(fightID);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void save(int fightID, File file) {
|
|
||||||
insert.update(fightID, file);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Field(keys = {Table.PRIMARY})
|
|
||||||
private final int fightID;
|
|
||||||
@Getter
|
|
||||||
@Field
|
|
||||||
private final File replay;
|
|
||||||
}
|
|
||||||
@@ -375,11 +375,10 @@ public class SchematicNode {
|
|||||||
return nodeType == null;
|
return nodeType == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
public String getFileEnding() {
|
||||||
public boolean getSchemFormat() {
|
|
||||||
if(isDir())
|
if(isDir())
|
||||||
throw new SecurityException("Node is Directory");
|
throw new SecurityException("Node is Directory");
|
||||||
return NodeData.get(this).getNodeFormat();
|
return NodeData.get(this).getNodeFormat().getFileEnding();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getRank() {
|
public int getRank() {
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ import java.security.SecureRandom;
|
|||||||
import java.security.spec.InvalidKeySpecException;
|
import java.security.spec.InvalidKeySpecException;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.function.BiConsumer;
|
|
||||||
import java.util.function.Consumer;
|
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;
|
||||||
@@ -73,6 +72,7 @@ public class SteamwarUser {
|
|||||||
|
|
||||||
private static final Statement getPlaytime = new Statement("SELECT SUM(UNIX_TIMESTAMP(EndTime) - UNIX_TIMESTAMP(StartTime)) as Playtime FROM Session WHERE UserID = ?");
|
private static final Statement getPlaytime = new Statement("SELECT SUM(UNIX_TIMESTAMP(EndTime) - UNIX_TIMESTAMP(StartTime)) as Playtime FROM Session WHERE UserID = ?");
|
||||||
private static final Statement getFirstjoin = new Statement("SELECT MIN(StartTime) AS FirstJoin FROM Session WHERE UserID = ?");
|
private static final Statement getFirstjoin = new Statement("SELECT MIN(StartTime) AS FirstJoin FROM Session WHERE UserID = ?");
|
||||||
|
private static final Statement getLastonline = new Statement("SELECT MAX(EndTime) AS LastOnline FROM Session WHERE UserID = ?");
|
||||||
|
|
||||||
private static final Map<Integer, SteamwarUser> usersById = new HashMap<>();
|
private static final Map<Integer, SteamwarUser> usersById = new HashMap<>();
|
||||||
private static final Map<UUID, SteamwarUser> usersByUUID = new HashMap<>();
|
private static final Map<UUID, SteamwarUser> usersByUUID = new HashMap<>();
|
||||||
@@ -121,13 +121,12 @@ public class SteamwarUser {
|
|||||||
return byDiscord.select(discordId);
|
return byDiscord.select(discordId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SteamwarUser getOrCreate(UUID uuid, String name, Consumer<UUID> newPlayer, BiConsumer<String, String> nameUpdate) {
|
public static SteamwarUser getOrCreate(UUID uuid, String name, Consumer<UUID> newPlayer) {
|
||||||
SteamwarUser user = get(uuid);
|
SteamwarUser user = get(uuid);
|
||||||
|
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
if (!user.userName.equals(name)) {
|
if (!user.userName.equals(name)) {
|
||||||
updateName.update(name, user.id);
|
updateName.update(name, user.id);
|
||||||
nameUpdate.accept(user.userName, name);
|
|
||||||
user.userName = name;
|
user.userName = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -276,6 +275,14 @@ public class SteamwarUser {
|
|||||||
}, id);
|
}, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Timestamp getLastOnline() {
|
||||||
|
return getLastonline.select(rs -> {
|
||||||
|
if (rs.next())
|
||||||
|
return rs.getTimestamp("LastOnline");
|
||||||
|
return null;
|
||||||
|
}, id);
|
||||||
|
}
|
||||||
|
|
||||||
public void punish(Punishment.PunishmentType punishment, Timestamp time, String banReason, int from, boolean perma) {
|
public void punish(Punishment.PunishmentType punishment, Timestamp time, String banReason, int from, boolean perma) {
|
||||||
initPunishments();
|
initPunishments();
|
||||||
punishments.remove(punishment);
|
punishments.remove(punishment);
|
||||||
@@ -350,6 +357,10 @@ public class SteamwarUser {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean hasPassword() {
|
||||||
|
return this.password != null;
|
||||||
|
}
|
||||||
|
|
||||||
private byte[] generateHash(String password, byte[] salt)
|
private byte[] generateHash(String password, byte[] salt)
|
||||||
throws InvalidKeySpecException {
|
throws InvalidKeySpecException {
|
||||||
PBEKeySpec spec = new PBEKeySpec(password.toCharArray(), salt, 65536, 512);
|
PBEKeySpec spec = new PBEKeySpec(password.toCharArray(), salt, 65536, 512);
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public class Statement implements AutoCloseable {
|
|||||||
String user = properties.getProperty("user");
|
String user = properties.getProperty("user");
|
||||||
String password = properties.getProperty("password");
|
String password = properties.getProperty("password");
|
||||||
|
|
||||||
PRODUCTION_DATABASE = "core".equals(properties.getProperty("database"));
|
PRODUCTION_DATABASE = "production".equals(properties.getProperty("database"));
|
||||||
MAX_CONNECTIONS = SQLConfig.impl.maxConnections();
|
MAX_CONNECTIONS = SQLConfig.impl.maxConnections();
|
||||||
conProvider = () -> {
|
conProvider = () -> {
|
||||||
try {
|
try {
|
||||||
|
|||||||
+21
-21
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.fightsystem.utils;
|
package de.steamwar.fightsystem.utils;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import de.steamwar.Reflection;
|
||||||
import de.steamwar.core.Core;
|
import de.steamwar.core.Core;
|
||||||
import de.steamwar.fightsystem.Config;
|
import de.steamwar.fightsystem.Config;
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||||
@@ -33,32 +33,32 @@ import java.util.Map;
|
|||||||
|
|
||||||
public class BlockIdWrapper14 implements BlockIdWrapper {
|
public class BlockIdWrapper14 implements BlockIdWrapper {
|
||||||
|
|
||||||
private static final Class<?> chunkProviderServer = Reflection.getClass("{nms.server.level}.ChunkProviderServer");
|
private static final Class<?> chunkProviderServer = Reflection.getClass("net.minecraft.server.level.ServerChunkCache");
|
||||||
private static final Reflection.MethodInvoker getChunkProvider = Reflection.getTypedMethod(worldServer, null, chunkProviderServer);
|
private static final Reflection.Method getChunkProvider = Reflection.getTypedMethod(worldServer, null, chunkProviderServer);
|
||||||
private static final Class<?> playerChunkMap = Reflection.getClass("{nms.server.level}.PlayerChunkMap");
|
private static final Class<?> playerChunkMap = Reflection.getClass("net.minecraft.server.level.ChunkMap");
|
||||||
private static final Reflection.FieldAccessor<?> getPlayerChunkMap = Reflection.getField(chunkProviderServer, playerChunkMap, 0);
|
private static final Reflection.Field<?> getPlayerChunkMap = Reflection.getField(chunkProviderServer, playerChunkMap, 0);
|
||||||
private static final Reflection.FieldAccessor<? extends Map> entityTrackers = Core.getVersion() > 15 ? Reflection.getField(playerChunkMap, Int2ObjectMap.class, 0) : Reflection.getField(playerChunkMap, org.bukkit.craftbukkit.libs.it.unimi.dsi.fastutil.ints.Int2ObjectMap.class, 0);
|
private static final Reflection.Field<? extends Map> entityTrackers = Core.getVersion() > 15 ? Reflection.getField(playerChunkMap, Int2ObjectMap.class, 0) : Reflection.getField(playerChunkMap, org.bukkit.craftbukkit.libs.it.unimi.dsi.fastutil.ints.Int2ObjectMap.class, 0);
|
||||||
private static final Class<?> block = Reflection.getClass("{nms.world.level.block}.Block");
|
private static final Class<?> block = Reflection.getClass("net.minecraft.world.level.block.Block");
|
||||||
private static final Class<?> iBlockData = Reflection.getClass("{nms.world.level.block.state}.IBlockData");
|
private static final Class<?> iBlockData = Reflection.getClass("net.minecraft.world.level.block.state.BlockState");
|
||||||
private static final Class<?> blockPosition = Reflection.getClass("{nms.core}.BlockPosition");
|
private static final Class<?> blockPosition = Reflection.getClass("net.minecraft.core.BlockPos");
|
||||||
|
|
||||||
private final Map trackers;
|
private final Map trackers;
|
||||||
public BlockIdWrapper14() {
|
public BlockIdWrapper14() {
|
||||||
trackers = entityTrackers.get(getPlayerChunkMap.get(getChunkProvider.invoke(getWorldHandle.invoke(Config.world))));
|
trackers = entityTrackers.get(getPlayerChunkMap.get(getChunkProvider.invoke(getWorldHandle.invoke(Config.world))));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Reflection.MethodInvoker getCombinedId = Reflection.getTypedMethod(block, null, int.class, iBlockData);
|
private static final Reflection.Method getCombinedId = Reflection.getTypedMethod(block, null, int.class, iBlockData);
|
||||||
private static final Reflection.MethodInvoker getNMS = Reflection.getTypedMethod(Reflection.getClass("{obc}.block.CraftBlock"), "getNMS", iBlockData);
|
private static final Reflection.Method getNMS = Reflection.getTypedMethod(Reflection.getClass("org.bukkit.craftbukkit.block.CraftBlock"), "getNMS", iBlockData);
|
||||||
@Override
|
@Override
|
||||||
public int blockToId(Block block) {
|
public int blockToId(Block block) {
|
||||||
return (int) getCombinedId.invoke(null, getNMS.invoke(block));
|
return (int) getCombinedId.invoke(null, getNMS.invoke(block));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Reflection.MethodInvoker getByCombinedId = Reflection.getTypedMethod(block, null, iBlockData, int.class);
|
private static final Reflection.Method getByCombinedId = Reflection.getTypedMethod(block, null, iBlockData, int.class);
|
||||||
private static final Reflection.ConstructorInvoker newBlockPosition = Reflection.getConstructor(blockPosition, int.class, int.class, int.class);
|
private static final Reflection.Constructor newBlockPosition = Reflection.getConstructor(blockPosition, int.class, int.class, int.class);
|
||||||
private static final Reflection.MethodInvoker getTypeAndData = Reflection.getMethod(worldServer, null, blockPosition, iBlockData, int.class);
|
private static final Reflection.Method getTypeAndData = Reflection.getMethod(worldServer, null, blockPosition, iBlockData, int.class);
|
||||||
private static final Reflection.MethodInvoker removeTileEntity = Reflection.getMethod(worldServer, Core.getVersion() > 15 ? "m" : "removeTileEntity", blockPosition);
|
private static final Reflection.Method removeTileEntity = Reflection.getMethod(worldServer, Core.getVersion() > 15 ? "m" : "removeTileEntity", blockPosition);
|
||||||
private static final Reflection.MethodInvoker flagDirty = Reflection.getMethod(chunkProviderServer, null, blockPosition);
|
private static final Reflection.Method flagDirty = Reflection.getMethod(chunkProviderServer, null, blockPosition);
|
||||||
@Override
|
@Override
|
||||||
public void setBlock(World world, int x, int y, int z, int blockState) {
|
public void setBlock(World world, int x, int y, int z, int blockState) {
|
||||||
Object blockData = getByCombinedId.invoke(null, blockState);
|
Object blockData = getByCombinedId.invoke(null, blockState);
|
||||||
@@ -70,8 +70,8 @@ public class BlockIdWrapper14 implements BlockIdWrapper {
|
|||||||
flagDirty.invoke(getChunkProvider.invoke(nworld), pos);
|
flagDirty.invoke(getChunkProvider.invoke(nworld), pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Class<?> entityTracker = Reflection.getClass("{nms.server.level}.PlayerChunkMap$EntityTracker");
|
private static final Class<?> entityTracker = Reflection.getClass("net.minecraft.server.level.ChunkMap$TrackedEntity");
|
||||||
private static final Reflection.MethodInvoker updatePlayer = Reflection.getMethod(entityTracker, Core.getVersion() > 15 ? "b" : "updatePlayer", entityPlayer);
|
private static final Reflection.Method updatePlayer = Reflection.getMethod(entityTracker, Core.getVersion() > 15 ? "b" : "updatePlayer", entityPlayer);
|
||||||
@Override
|
@Override
|
||||||
public void trackEntity(Player player, Entity entity) {
|
public void trackEntity(Player player, Entity entity) {
|
||||||
Object tracker = trackers.get(entity.getEntityId());
|
Object tracker = trackers.get(entity.getEntityId());
|
||||||
@@ -79,7 +79,7 @@ public class BlockIdWrapper14 implements BlockIdWrapper {
|
|||||||
updatePlayer.invoke(tracker, getPlayer.invoke(player));
|
updatePlayer.invoke(tracker, getPlayer.invoke(player));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Reflection.MethodInvoker clearPlayer = Reflection.getMethod(entityTracker, Core.getVersion() > 15 ? "a" : "clear", entityPlayer);
|
private static final Reflection.Method clearPlayer = Reflection.getMethod(entityTracker, Core.getVersion() > 15 ? "a" : "clear", entityPlayer);
|
||||||
@Override
|
@Override
|
||||||
public void untrackEntity(Player player, Entity entity) {
|
public void untrackEntity(Player player, Entity entity) {
|
||||||
Object tracker = trackers.get(entity.getEntityId());
|
Object tracker = trackers.get(entity.getEntityId());
|
||||||
@@ -87,8 +87,8 @@ public class BlockIdWrapper14 implements BlockIdWrapper {
|
|||||||
clearPlayer.invoke(tracker, getPlayer.invoke(player));
|
clearPlayer.invoke(tracker, getPlayer.invoke(player));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Reflection.MethodInvoker getMaterialByBlock = Reflection.getTypedMethod(Reflection.getClass("{obc}.util.CraftMagicNumbers"), "getMaterial", Material.class, block);
|
private static final Reflection.Method getMaterialByBlock = Reflection.getTypedMethod(Reflection.getClass("org.bukkit.craftbukkit.util.CraftMagicNumbers"), "getMaterial", Material.class, block);
|
||||||
private static final Reflection.MethodInvoker getBlockByBlockData = Reflection.getTypedMethod(iBlockData, null, block);
|
private static final Reflection.Method getBlockByBlockData = Reflection.getTypedMethod(iBlockData, null, block);
|
||||||
@Override
|
@Override
|
||||||
public Material idToMaterial(int blockState) {
|
public Material idToMaterial(int blockState) {
|
||||||
return (Material)getMaterialByBlock.invoke(null, getBlockByBlockData.invoke(getByCombinedId.invoke(null, blockState)));
|
return (Material)getMaterialByBlock.invoke(null, getBlockByBlockData.invoke(getByCombinedId.invoke(null, blockState)));
|
||||||
|
|||||||
+2
-1
@@ -42,6 +42,7 @@ import com.sk89q.worldedit.world.block.BaseBlock;
|
|||||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||||
import de.steamwar.fightsystem.Config;
|
import de.steamwar.fightsystem.Config;
|
||||||
import de.steamwar.fightsystem.FightSystem;
|
import de.steamwar.fightsystem.FightSystem;
|
||||||
|
import de.steamwar.sql.NodeData;
|
||||||
import de.steamwar.sql.SchematicData;
|
import de.steamwar.sql.SchematicData;
|
||||||
import de.steamwar.sql.SchematicNode;
|
import de.steamwar.sql.SchematicNode;
|
||||||
import org.bukkit.DyeColor;
|
import org.bukkit.DyeColor;
|
||||||
@@ -144,6 +145,6 @@ public class WorldeditWrapper14 implements WorldeditWrapper {
|
|||||||
throw new SecurityException(e);
|
throw new SecurityException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
new SchematicData(schem).saveFromBytes(outputStream.toByteArray(), true);
|
new SchematicData(schem).saveFromBytes(outputStream.toByteArray(), NodeData.SchematicFormat.SPONGE_V2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,5 +31,6 @@ dependencies {
|
|||||||
compileOnly(libs.nms18)
|
compileOnly(libs.nms18)
|
||||||
compileOnly(libs.fawe18)
|
compileOnly(libs.fawe18)
|
||||||
|
|
||||||
|
compileOnly(libs.authlib)
|
||||||
compileOnly(libs.fastutil)
|
compileOnly(libs.fastutil)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,24 +19,29 @@
|
|||||||
|
|
||||||
package de.steamwar.fightsystem.utils;
|
package de.steamwar.fightsystem.utils;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||||
|
import com.mojang.authlib.GameProfile;
|
||||||
|
import de.steamwar.core.ProtocolWrapper;
|
||||||
|
import de.steamwar.fightsystem.FightSystem;
|
||||||
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
public class BlockIdWrapper18 extends BlockIdWrapper14 {
|
public class BlockIdWrapper18 extends BlockIdWrapper14 {
|
||||||
|
|
||||||
private static final Reflection.FieldAccessor<Map> hiddenEntities = Reflection.getField(Reflection.getClass("{obc}.entity.CraftPlayer"), Map.class, 0, UUID.class, Set.class);
|
|
||||||
@Override
|
@Override
|
||||||
public void trackEntity(Player player, Entity entity) {
|
public void trackEntity(Player player, Entity entity) {
|
||||||
hiddenEntities.get(player).remove(entity.getUniqueId());
|
if(entity instanceof Player)
|
||||||
super.trackEntity(player, entity);
|
TinyProtocol.instance.sendPacket(player, ProtocolWrapper.impl.playerInfoPacketConstructor(ProtocolWrapper.PlayerInfoAction.REMOVE, new GameProfile(entity.getUniqueId(), entity.getName()), GameMode.CREATIVE));
|
||||||
|
|
||||||
|
player.showEntity(FightSystem.getPlugin(), entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void untrackEntity(Player player, Entity entity) {
|
public void untrackEntity(Player player, Entity entity) {
|
||||||
hiddenEntities.get(player).put(entity.getUniqueId(), new HashSet<>(1));
|
player.hideEntity(FightSystem.getPlugin(), entity);
|
||||||
super.untrackEntity(player, entity);
|
|
||||||
|
if(entity instanceof Player)
|
||||||
|
TinyProtocol.instance.sendPacket(player, ProtocolWrapper.impl.playerInfoPacketConstructor(ProtocolWrapper.PlayerInfoAction.ADD, new GameProfile(entity.getUniqueId(), entity.getName()), GameMode.CREATIVE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-7
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.fightsystem.utils;
|
package de.steamwar.fightsystem.utils;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import de.steamwar.Reflection;
|
||||||
import de.steamwar.fightsystem.Config;
|
import de.steamwar.fightsystem.Config;
|
||||||
import net.minecraft.server.level.WorldServer;
|
import net.minecraft.server.level.WorldServer;
|
||||||
import net.minecraft.world.level.chunk.Chunk;
|
import net.minecraft.world.level.chunk.Chunk;
|
||||||
@@ -33,9 +33,9 @@ import java.util.stream.StreamSupport;
|
|||||||
|
|
||||||
public class CraftbukkitWrapper18 implements CraftbukkitWrapper {
|
public class CraftbukkitWrapper18 implements CraftbukkitWrapper {
|
||||||
|
|
||||||
private static final Reflection.MethodInvoker getWorld = Reflection.getMethod(Reflection.getClass("{obc}.CraftWorld"), "getHandle");
|
private static final Reflection.Method getWorld = Reflection.getMethod(Reflection.getClass("org.bukkit.craftbukkit.CraftWorld"), "getHandle");
|
||||||
private static final Reflection.MethodInvoker getChunk = Reflection.getTypedMethod(net.minecraft.world.level.World.class, null, Chunk.class, int.class, int.class);
|
private static final Reflection.Method getChunk = Reflection.getTypedMethod(net.minecraft.world.level.World.class, null, Chunk.class, int.class, int.class);
|
||||||
private static final Reflection.MethodInvoker getChunkSections = Reflection.getTypedMethod(Chunk.class, null, ChunkSection[].class);
|
private static final Reflection.Method getChunkSections = Reflection.getTypedMethod(Chunk.class, null, ChunkSection[].class);
|
||||||
private ChunkSection[] getChunkSections(World world, int x, int z) {
|
private ChunkSection[] getChunkSections(World world, int x, int z) {
|
||||||
return (ChunkSection[]) getChunkSections.invoke(getChunk.invoke(getWorld.invoke(world), x, z));
|
return (ChunkSection[]) getChunkSections.invoke(getChunk.invoke(getWorld.invoke(world), x, z));
|
||||||
}
|
}
|
||||||
@@ -46,7 +46,7 @@ public class CraftbukkitWrapper18 implements CraftbukkitWrapper {
|
|||||||
System.arraycopy(getChunkSections(backup, x, z), 0, sections, 0, sections.length);
|
System.arraycopy(getChunkSections(backup, x, z), 0, sections, 0, sections.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Reflection.MethodInvoker getEntity = Reflection.getTypedMethod(Reflection.getClass("{obc}.entity.CraftEntity"), "getHandle", net.minecraft.world.entity.Entity.class);
|
private static final Reflection.Method getEntity = Reflection.getTypedMethod(Reflection.getClass("org.bukkit.craftbukkit.entity.CraftEntity"), "getHandle", net.minecraft.world.entity.Entity.class);
|
||||||
protected net.minecraft.world.entity.Entity getEntity(Entity e) {
|
protected net.minecraft.world.entity.Entity getEntity(Entity e) {
|
||||||
return (net.minecraft.world.entity.Entity) getEntity.invoke(e);
|
return (net.minecraft.world.entity.Entity) getEntity.invoke(e);
|
||||||
}
|
}
|
||||||
@@ -56,8 +56,8 @@ public class CraftbukkitWrapper18 implements CraftbukkitWrapper {
|
|||||||
return getEntity(e).ce();
|
return getEntity(e).ce();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Reflection.MethodInvoker getWorldEntities = Reflection.getTypedMethod(WorldServer.class, null, LevelEntityGetter.class);
|
private static final Reflection.Method getWorldEntities = Reflection.getTypedMethod(WorldServer.class, null, LevelEntityGetter.class);
|
||||||
private static final Reflection.MethodInvoker getIterable = Reflection.getTypedMethod(LevelEntityGetter.class, null, Iterable.class);
|
private static final Reflection.Method getIterable = Reflection.getTypedMethod(LevelEntityGetter.class, null, Iterable.class);
|
||||||
@Override
|
@Override
|
||||||
public Stream<?> entityIterator() {
|
public Stream<?> entityIterator() {
|
||||||
return StreamSupport.stream(((Iterable<?>) getIterable.invoke(getWorldEntities.invoke(getWorld.invoke(Config.world)))).spliterator(), false);
|
return StreamSupport.stream(((Iterable<?>) getIterable.invoke(getWorldEntities.invoke(getWorld.invoke(Config.world)))).spliterator(), false);
|
||||||
|
|||||||
+2
-2
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.fightsystem.utils;
|
package de.steamwar.fightsystem.utils;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import de.steamwar.Reflection;
|
||||||
import de.steamwar.fightsystem.Config;
|
import de.steamwar.fightsystem.Config;
|
||||||
import it.unimi.dsi.fastutil.shorts.Short2ObjectArrayMap;
|
import it.unimi.dsi.fastutil.shorts.Short2ObjectArrayMap;
|
||||||
import net.minecraft.core.BlockPosition;
|
import net.minecraft.core.BlockPosition;
|
||||||
@@ -33,7 +33,7 @@ import java.util.List;
|
|||||||
|
|
||||||
public class HullHiderWrapper18 implements HullHiderWrapper {
|
public class HullHiderWrapper18 implements HullHiderWrapper {
|
||||||
|
|
||||||
private static final Reflection.MethodInvoker getState = Reflection.getTypedMethod(Reflection.getClass("{obc}.block.data.CraftBlockData"), "getState", IBlockData.class);
|
private static final Reflection.Method getState = Reflection.getTypedMethod(Reflection.getClass("org.bukkit.craftbukkit.block.data.CraftBlockData"), "getState", IBlockData.class);
|
||||||
@Override
|
@Override
|
||||||
public Object generateBlockChangePacket(List<Hull.IntVector> changes) {
|
public Object generateBlockChangePacket(List<Hull.IntVector> changes) {
|
||||||
Object[] blockdata = new Object[changes.size()];
|
Object[] blockdata = new Object[changes.size()];
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.fightsystem.utils;
|
package de.steamwar.fightsystem.utils;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import de.steamwar.Reflection;
|
||||||
import de.steamwar.fightsystem.Config;
|
import de.steamwar.fightsystem.Config;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
@@ -29,10 +29,10 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
public class BlockIdWrapper8 implements BlockIdWrapper {
|
public class BlockIdWrapper8 implements BlockIdWrapper {
|
||||||
|
|
||||||
private static final Class<?> entityTracker = Reflection.getClass("{nms}.EntityTracker");
|
private static final Class<?> entityTracker = Reflection.getClass("net.minecraft.EntityTracker");
|
||||||
private static final Reflection.FieldAccessor<?> getEntityTracker = Reflection.getField(worldServer, entityTracker, 0);
|
private static final Reflection.Field<?> getEntityTracker = Reflection.getField(worldServer, entityTracker, 0);
|
||||||
private static final Class<?> intHashMap = Reflection.getClass("{nms}.IntHashMap");
|
private static final Class<?> intHashMap = Reflection.getClass("net.minecraft.IntHashMap");
|
||||||
private static final Reflection.FieldAccessor<?> getTrackedEntities = Reflection.getField(entityTracker, intHashMap, 0);
|
private static final Reflection.Field<?> getTrackedEntities = Reflection.getField(entityTracker, intHashMap, 0);
|
||||||
|
|
||||||
private final Object trackers;
|
private final Object trackers;
|
||||||
public BlockIdWrapper8() {
|
public BlockIdWrapper8() {
|
||||||
@@ -54,9 +54,9 @@ public class BlockIdWrapper8 implements BlockIdWrapper {
|
|||||||
world.getBlockAt(x, y, z).setTypeIdAndData(blockState >> 4, (byte)(blockState & 0b1111), false);
|
world.getBlockAt(x, y, z).setTypeIdAndData(blockState >> 4, (byte)(blockState & 0b1111), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Class<?> entityTrackerEntry = Reflection.getClass("{nms}.EntityTrackerEntry");
|
private static final Class<?> entityTrackerEntry = Reflection.getClass("net.minecraft.EntityTrackerEntry");
|
||||||
private static final Reflection.MethodInvoker get = Reflection.getTypedMethod(intHashMap, "get", Object.class, int.class);
|
private static final Reflection.Method get = Reflection.getTypedMethod(intHashMap, "get", Object.class, int.class);
|
||||||
private static final Reflection.MethodInvoker updatePlayer = Reflection.getMethod(entityTrackerEntry, "updatePlayer", entityPlayer);
|
private static final Reflection.Method updatePlayer = Reflection.getMethod(entityTrackerEntry, "updatePlayer", entityPlayer);
|
||||||
@Override
|
@Override
|
||||||
public void trackEntity(Player player, Entity entity) {
|
public void trackEntity(Player player, Entity entity) {
|
||||||
Object tracker = get.invoke(trackers, entity.getEntityId());
|
Object tracker = get.invoke(trackers, entity.getEntityId());
|
||||||
@@ -64,7 +64,7 @@ public class BlockIdWrapper8 implements BlockIdWrapper {
|
|||||||
updatePlayer.invoke(tracker, getPlayer.invoke(player));
|
updatePlayer.invoke(tracker, getPlayer.invoke(player));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Reflection.MethodInvoker clearPlayer = Reflection.getMethod(entityTrackerEntry, "a", entityPlayer);
|
private static final Reflection.Method clearPlayer = Reflection.getMethod(entityTrackerEntry, "a", entityPlayer);
|
||||||
@Override
|
@Override
|
||||||
public void untrackEntity(Player player, Entity entity) {
|
public void untrackEntity(Player player, Entity entity) {
|
||||||
Object tracker = get.invoke(trackers, entity.getEntityId());
|
Object tracker = get.invoke(trackers, entity.getEntityId());
|
||||||
|
|||||||
@@ -19,15 +19,15 @@
|
|||||||
|
|
||||||
package de.steamwar.fightsystem.utils;
|
package de.steamwar.fightsystem.utils;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import de.steamwar.Reflection;
|
||||||
import de.steamwar.fightsystem.Config;
|
import de.steamwar.fightsystem.Config;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class HullHiderWrapper8 implements HullHiderWrapper {
|
public class HullHiderWrapper8 implements HullHiderWrapper {
|
||||||
|
|
||||||
private static final Reflection.ConstructorInvoker newMultiBlockChange = Reflection.getConstructor("{nms}.PacketPlayOutMultiBlockChange", int.class, short[].class, Reflection.getClass("{nms}.Chunk"));
|
private static final Reflection.Constructor newMultiBlockChange = Reflection.getConstructor("net.minecraft.PacketPlayOutMultiBlockChange", int.class, short[].class, Reflection.getClass("net.minecraft.Chunk"));
|
||||||
private static final Reflection.MethodInvoker getHandle = Reflection.getMethod("{obc}.CraftChunk", "getHandle");
|
private static final Reflection.Method getHandle = Reflection.getMethod("org.bukkit.craftbukkit.CraftChunk", "getHandle");
|
||||||
@Override
|
@Override
|
||||||
public Object generateBlockChangePacket(List<Hull.IntVector> changes) {
|
public Object generateBlockChangePacket(List<Hull.IntVector> changes) {
|
||||||
Hull.IntVector chunk = changes.get(0);
|
Hull.IntVector chunk = changes.get(0);
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ import com.sk89q.worldedit.session.ClipboardHolder;
|
|||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
import de.steamwar.fightsystem.Config;
|
import de.steamwar.fightsystem.Config;
|
||||||
import de.steamwar.fightsystem.FightSystem;
|
import de.steamwar.fightsystem.FightSystem;
|
||||||
|
import de.steamwar.sql.NodeData;
|
||||||
import de.steamwar.sql.SchematicData;
|
import de.steamwar.sql.SchematicData;
|
||||||
import de.steamwar.sql.SchematicNode;
|
import de.steamwar.sql.SchematicNode;
|
||||||
import org.bukkit.DyeColor;
|
import org.bukkit.DyeColor;
|
||||||
@@ -142,6 +143,6 @@ public class WorldeditWrapper8 implements WorldeditWrapper {
|
|||||||
throw new SecurityException(e);
|
throw new SecurityException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
new SchematicData(schem).saveFromBytes(outputStream.toByteArray(), false);
|
new SchematicData(schem).saveFromBytes(outputStream.toByteArray(), NodeData.SchematicFormat.MCEDIT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.fightsystem.utils;
|
package de.steamwar.fightsystem.utils;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import de.steamwar.Reflection;
|
||||||
import de.steamwar.fightsystem.fight.Fight;
|
import de.steamwar.fightsystem.fight.Fight;
|
||||||
import de.steamwar.fightsystem.fight.FightTeam;
|
import de.steamwar.fightsystem.fight.FightTeam;
|
||||||
import de.steamwar.fightsystem.listener.Recording;
|
import de.steamwar.fightsystem.listener.Recording;
|
||||||
@@ -43,9 +43,9 @@ import java.util.Map;
|
|||||||
|
|
||||||
public class BountifulWrapper9 implements BountifulWrapper {
|
public class BountifulWrapper9 implements BountifulWrapper {
|
||||||
|
|
||||||
private static final Class<?> enumHand = Reflection.getClass("{nms.world}.EnumHand");
|
private static final Class<?> enumHand = Reflection.getClass("net.minecraft.world.InteractionHand");
|
||||||
private static final Object mainHand = enumHand.getEnumConstants()[0];
|
private static final Object mainHand = enumHand.getEnumConstants()[0];
|
||||||
private static final Reflection.FieldAccessor<?> blockPlaceHand = Reflection.getField(Recording.blockPlacePacket, enumHand, 0);
|
private static final Reflection.Field<?> blockPlaceHand = Reflection.getField(Recording.blockPlacePacket, enumHand, 0);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean mainHand(Object packet) {
|
public boolean mainHand(Object packet) {
|
||||||
|
|||||||
@@ -153,7 +153,6 @@ public class FightSystem extends JavaPlugin {
|
|||||||
new GamemodeCommand();
|
new GamemodeCommand();
|
||||||
new ReadyCommand();
|
new ReadyCommand();
|
||||||
new AkCommand();
|
new AkCommand();
|
||||||
new LeaderCommand();
|
|
||||||
new LockschemCommand();
|
new LockschemCommand();
|
||||||
new StateCommand();
|
new StateCommand();
|
||||||
new SkipCommand();
|
new SkipCommand();
|
||||||
|
|||||||
@@ -34,9 +34,6 @@ GAMEMODE_NOT_ALLOWED=§cChanging gamemode is not permitted
|
|||||||
GAMEMODE_UNKNOWN=§cUnknown gamemode {0}
|
GAMEMODE_UNKNOWN=§cUnknown gamemode {0}
|
||||||
GAMEMODE_HELP=§8/§7gm §8[§egamemode§8]
|
GAMEMODE_HELP=§8/§7gm §8[§egamemode§8]
|
||||||
|
|
||||||
LEADER_FULL=§cAll teams already have a leader
|
|
||||||
ALREADY_IN_TEAM=§cYou are already in a team
|
|
||||||
|
|
||||||
LOCKSCHEM_HELP=§8/§7lockschem §8[§eteam§8]
|
LOCKSCHEM_HELP=§8/§7lockschem §8[§eteam§8]
|
||||||
UNKNOWN_TEAM=§cThis team does not exist
|
UNKNOWN_TEAM=§cThis team does not exist
|
||||||
LOCKSCHEM_LOCKED=§7Schematic locked
|
LOCKSCHEM_LOCKED=§7Schematic locked
|
||||||
@@ -65,7 +62,9 @@ STATE_RUNNING=§eFighting phase
|
|||||||
STATE_SPECTATE_WIN=§7Victory {0}
|
STATE_SPECTATE_WIN=§7Victory {0}
|
||||||
STATE_SPECTATE_TIE=§7Draw
|
STATE_SPECTATE_TIE=§7Draw
|
||||||
|
|
||||||
REMOVE_TITLE=Kick player
|
MANAGE_TITLE=Manage players
|
||||||
|
MANAGE_LORE1=§eLeft §7click§8: §ekick
|
||||||
|
MANAGE_LORE2=§eRight §7click§8: §epromote
|
||||||
|
|
||||||
KIT_SELECTION_TITLE=Kit selection
|
KIT_SELECTION_TITLE=Kit selection
|
||||||
KIT_NO_KITS=§cNo kits found
|
KIT_NO_KITS=§cNo kits found
|
||||||
@@ -113,7 +112,7 @@ SKIP_NOT_READY=§c§mSkipping to next event
|
|||||||
TEAM_CHAT={0}{1}§8» {0}{2}
|
TEAM_CHAT={0}{1}§8» {0}{2}
|
||||||
CHOOSE_KIT=§eChoose kit
|
CHOOSE_KIT=§eChoose kit
|
||||||
RESPAWN=§eRespawn
|
RESPAWN=§eRespawn
|
||||||
REMOVE_PLAYERS=§cKick player
|
MANAGE_PLAYERS=§cManage players
|
||||||
CHOOSE_SCHEMATIC=§eChoose {0}
|
CHOOSE_SCHEMATIC=§eChoose {0}
|
||||||
SCHEMATIC_REQUIRED=§cChoose a schematic first
|
SCHEMATIC_REQUIRED=§cChoose a schematic first
|
||||||
ADD_AI=§eAdd AI
|
ADD_AI=§eAdd AI
|
||||||
@@ -141,7 +140,6 @@ NO_TELEPORT=§cYou are not allowed to use this teleport function
|
|||||||
OPEN_INVENTORY_TO_CUSTOMIZE=§eOpen inventory to customize your kit
|
OPEN_INVENTORY_TO_CUSTOMIZE=§eOpen inventory to customize your kit
|
||||||
NO_ENTERN=§cYou may not board
|
NO_ENTERN=§cYou may not board
|
||||||
NO_TEAMAREA=§cYou are not allowed in the team area
|
NO_TEAMAREA=§cYou are not allowed in the team area
|
||||||
TEST_BECOME_LEADER=§7Become a team leader with §8/§eleader
|
|
||||||
PREPARE_SCHEM_DELETED=§cApparently the schematic to be submitted was deleted. submission aborted.
|
PREPARE_SCHEM_DELETED=§cApparently the schematic to be submitted was deleted. submission aborted.
|
||||||
PREPARE_SCHEM_EXISTS=§cThere is already a schematic with the suffix -prepared, please rename or delete it, submission aborted.
|
PREPARE_SCHEM_EXISTS=§cThere is already a schematic with the suffix -prepared, please rename or delete it, submission aborted.
|
||||||
PREPARE_ACTIVE_PISTON=§cMoving pistons were found in the team area, submission aborted.
|
PREPARE_ACTIVE_PISTON=§cMoving pistons were found in the team area, submission aborted.
|
||||||
|
|||||||
@@ -32,9 +32,6 @@ GAMEMODE_NOT_ALLOWED=§cSpielmodusänderung verboten
|
|||||||
GAMEMODE_UNKNOWN=§cUnbekannter Spielmodus {0}
|
GAMEMODE_UNKNOWN=§cUnbekannter Spielmodus {0}
|
||||||
GAMEMODE_HELP=§8/§7gm §8[§eSpielmodus§8]
|
GAMEMODE_HELP=§8/§7gm §8[§eSpielmodus§8]
|
||||||
|
|
||||||
LEADER_FULL=§cAlle Teams haben bereits einen Leader
|
|
||||||
ALREADY_IN_TEAM=§cDu bist bereits in einem Team
|
|
||||||
|
|
||||||
LOCKSCHEM_HELP=§8/§7lockschem §8[§eTeam§8]
|
LOCKSCHEM_HELP=§8/§7lockschem §8[§eTeam§8]
|
||||||
UNKNOWN_TEAM=§cDieses Team existiert nicht
|
UNKNOWN_TEAM=§cDieses Team existiert nicht
|
||||||
LOCKSCHEM_LOCKED=§7Schematic gesperrt
|
LOCKSCHEM_LOCKED=§7Schematic gesperrt
|
||||||
@@ -59,7 +56,9 @@ STATE_RUNNING=§eKampfphase
|
|||||||
STATE_SPECTATE_WIN=§7Sieg {0}
|
STATE_SPECTATE_WIN=§7Sieg {0}
|
||||||
STATE_SPECTATE_TIE=§7Unentschieden
|
STATE_SPECTATE_TIE=§7Unentschieden
|
||||||
|
|
||||||
REMOVE_TITLE=Spieler rauswerfen
|
MANAGE_TITLE=Mitspieler verwalten
|
||||||
|
MANAGE_LORE1=§eLinksklick§8: §eRauswurf
|
||||||
|
MANAGE_LORE2=§eRechtsklick§8: §eBefördern
|
||||||
|
|
||||||
KIT_SELECTION_TITLE=Kitauswahl
|
KIT_SELECTION_TITLE=Kitauswahl
|
||||||
KIT_NO_KITS=§cKeine Kits gefunden
|
KIT_NO_KITS=§cKeine Kits gefunden
|
||||||
@@ -106,7 +105,7 @@ SKIP_READY=§aBeschleunigung zum nächsten Event
|
|||||||
SKIP_NOT_READY=§c§mBeschleunigung zum nächsten Event
|
SKIP_NOT_READY=§c§mBeschleunigung zum nächsten Event
|
||||||
CHOOSE_KIT=§eKit wählen
|
CHOOSE_KIT=§eKit wählen
|
||||||
RESPAWN=§eRespawn
|
RESPAWN=§eRespawn
|
||||||
REMOVE_PLAYERS=§cSpieler rauswerfen
|
MANAGE_PLAYERS=§cMitspieler verwalten
|
||||||
CHOOSE_SCHEMATIC=§e{0} wählen
|
CHOOSE_SCHEMATIC=§e{0} wählen
|
||||||
SCHEMATIC_REQUIRED=§cZuerst muss eine Schematic gewählt sein
|
SCHEMATIC_REQUIRED=§cZuerst muss eine Schematic gewählt sein
|
||||||
ADD_AI=§eKI hinzufügen
|
ADD_AI=§eKI hinzufügen
|
||||||
@@ -134,7 +133,6 @@ NO_TELEPORT=§cDu darfst diese Teleportfunktion nicht benutzen
|
|||||||
OPEN_INVENTORY_TO_CUSTOMIZE=§eInventar zum Anpassen des Kits öffnen
|
OPEN_INVENTORY_TO_CUSTOMIZE=§eInventar zum Anpassen des Kits öffnen
|
||||||
NO_ENTERN=§cDu darfst nicht entern
|
NO_ENTERN=§cDu darfst nicht entern
|
||||||
NO_TEAMAREA=§cDu darfst nicht zu den Teams
|
NO_TEAMAREA=§cDu darfst nicht zu den Teams
|
||||||
TEST_BECOME_LEADER=§7Werde zum Teamleader mit §8/§eleader
|
|
||||||
PREPARE_SCHEM_DELETED=§cAnscheinend wurde die auszufahrende Schematic gelöscht, Einsenden wird abgebrochen.
|
PREPARE_SCHEM_DELETED=§cAnscheinend wurde die auszufahrende Schematic gelöscht, Einsenden wird abgebrochen.
|
||||||
PREPARE_SCHEM_EXISTS=§cEs existiert bereits eine Schem mit Namenszusatz -prepared, diese bitte umbenennen oder löschen, Einsenden wird abgebrochen.
|
PREPARE_SCHEM_EXISTS=§cEs existiert bereits eine Schem mit Namenszusatz -prepared, diese bitte umbenennen oder löschen, Einsenden wird abgebrochen.
|
||||||
PREPARE_ACTIVE_PISTON=§cIm Teambereich wurden sich noch bewegende Pistons gefunden, Einsenden wird abgebrochen.
|
PREPARE_ACTIVE_PISTON=§cIm Teambereich wurden sich noch bewegende Pistons gefunden, Einsenden wird abgebrochen.
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.fightsystem.ai;
|
package de.steamwar.fightsystem.ai;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import de.steamwar.Reflection;
|
||||||
import de.steamwar.fightsystem.ArenaMode;
|
import de.steamwar.fightsystem.ArenaMode;
|
||||||
import de.steamwar.fightsystem.Config;
|
import de.steamwar.fightsystem.Config;
|
||||||
import de.steamwar.fightsystem.fight.FightTeam;
|
import de.steamwar.fightsystem.fight.FightTeam;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.fightsystem.commands;
|
package de.steamwar.fightsystem.commands;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import de.steamwar.Reflection;
|
||||||
import de.steamwar.fightsystem.Config;
|
import de.steamwar.fightsystem.Config;
|
||||||
import de.steamwar.fightsystem.FightSystem;
|
import de.steamwar.fightsystem.FightSystem;
|
||||||
import de.steamwar.fightsystem.fight.Fight;
|
import de.steamwar.fightsystem.fight.Fight;
|
||||||
@@ -39,7 +39,7 @@ import org.bukkit.entity.Player;
|
|||||||
@UtilityClass
|
@UtilityClass
|
||||||
public class Commands {
|
public class Commands {
|
||||||
|
|
||||||
private static final Reflection.FieldAccessor<SimpleCommandMap> commandMap = Reflection.getField("{obc}.CraftServer", "commandMap", SimpleCommandMap.class);
|
private static final Reflection.Field<SimpleCommandMap> commandMap = Reflection.getField("org.bukkit.craftbukkit.CraftServer", "commandMap", SimpleCommandMap.class);
|
||||||
public static void injectCommand(Command cmd) {
|
public static void injectCommand(Command cmd) {
|
||||||
commandMap.get(Bukkit.getServer()).register("FightSystem", cmd);
|
commandMap.get(Bukkit.getServer()).register("FightSystem", cmd);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ import de.steamwar.sql.SteamwarUser;
|
|||||||
import net.md_5.bungee.api.ChatMessageType;
|
import net.md_5.bungee.api.ChatMessageType;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.inventory.ClickType;
|
import org.bukkit.event.inventory.ClickType;
|
||||||
|
|
||||||
@@ -53,7 +54,11 @@ public class GUI {
|
|||||||
String name = team.getLeader() != null ? team.getLeader().getEntity().getName() : team.getName();
|
String name = team.getLeader() != null ? team.getLeader().getEntity().getName() : team.getName();
|
||||||
inv.setItem(pos, SWItem.getDye(colorCode), colorCode, msg.parse("JOIN_REQUEST_TEAM", p, team.getColor() + name), click -> {
|
inv.setItem(pos, SWItem.getDye(colorCode), colorCode, msg.parse("JOIN_REQUEST_TEAM", p, team.getColor() + name), click -> {
|
||||||
p.closeInventory();
|
p.closeInventory();
|
||||||
JoinRequest.forPlayer(p, team);
|
|
||||||
|
if(ArenaMode.ManualTeams.contains(Config.mode) && team.canbeLeader(p))
|
||||||
|
team.addMember(p);
|
||||||
|
else
|
||||||
|
JoinRequest.forPlayer(p, team);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,14 +122,21 @@ public class GUI {
|
|||||||
inv.open();
|
inv.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void chooseRemove(Player p){
|
public static void managePlayers(Player p){
|
||||||
List<SWListInv.SWListEntry<UUID>> players = SWListInv.createPlayerList(p.getUniqueId());
|
List<SWListInv.SWListEntry<UUID>> players = SWListInv.createPlayerList(p.getUniqueId());
|
||||||
FightTeam team = Fight.getPlayerTeam(p);
|
FightTeam team = Fight.getPlayerTeam(p);
|
||||||
if(team == null)
|
if(team == null)
|
||||||
return;
|
return;
|
||||||
players.removeIf(swItemUUIDPair -> !team.equals(Fight.getPlayerTeam(Bukkit.getPlayer(swItemUUIDPair.getObject()))));
|
players.removeIf(listEntry -> !team.equals(Fight.getPlayerTeam(Bukkit.getPlayer(listEntry.getObject()))));
|
||||||
SWListInv<UUID> inv = new SWListInv<>(p, msg.parse("REMOVE_TITLE", p), players, (ClickType click, UUID player) -> {
|
players.forEach(listEntry -> listEntry.getItem().setLore(msg.parse("MANAGE_LORE1", p), msg.parse("MANAGE_LORE2", p)));
|
||||||
Commands.kick(p, SteamwarUser.get(player).getUserName());
|
SWListInv<UUID> inv = new SWListInv<>(p, msg.parse("MANAGE_TITLE", p), players, (ClickType click, UUID player) -> {
|
||||||
|
if(click.isLeftClick()) {
|
||||||
|
Commands.kick(p, SteamwarUser.get(player).getUserName());
|
||||||
|
} else if(click.isRightClick()) {
|
||||||
|
LivingEntity target = (LivingEntity) Bukkit.getEntity(player);
|
||||||
|
if(target != null)
|
||||||
|
team.setLeader(team.getFightPlayer(target), false);
|
||||||
|
}
|
||||||
p.closeInventory();
|
p.closeInventory();
|
||||||
});
|
});
|
||||||
inv.setCallback(-999, (ClickType click) -> p.closeInventory());
|
inv.setCallback(-999, (ClickType click) -> p.closeInventory());
|
||||||
|
|||||||
@@ -1,60 +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.fightsystem.commands;
|
|
||||||
|
|
||||||
import de.steamwar.fightsystem.ArenaMode;
|
|
||||||
import de.steamwar.fightsystem.FightSystem;
|
|
||||||
import de.steamwar.fightsystem.fight.Fight;
|
|
||||||
import de.steamwar.fightsystem.fight.FightTeam;
|
|
||||||
import de.steamwar.fightsystem.states.FightState;
|
|
||||||
import de.steamwar.fightsystem.states.StateDependentCommand;
|
|
||||||
import net.md_5.bungee.api.ChatMessageType;
|
|
||||||
import org.bukkit.command.Command;
|
|
||||||
import org.bukkit.command.CommandExecutor;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public class LeaderCommand implements CommandExecutor {
|
|
||||||
|
|
||||||
public LeaderCommand() {
|
|
||||||
new StateDependentCommand(ArenaMode.ManualTeams, FightState.Setup, "leader", this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
|
||||||
if(!(sender instanceof Player))
|
|
||||||
return false;
|
|
||||||
Player player = (Player) sender;
|
|
||||||
|
|
||||||
if(Fight.getFightPlayer(player) != null) {
|
|
||||||
FightSystem.getMessage().sendPrefixless("ALREADY_IN_TEAM", player, ChatMessageType.ACTION_BAR);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
for(FightTeam team : Fight.teams()) {
|
|
||||||
if(team.canbeLeader(player)) {
|
|
||||||
team.addMember(player);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
FightSystem.getMessage().sendPrefixless("LEADER_FULL", player, ChatMessageType.ACTION_BAR);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -73,7 +73,7 @@ public class FightTeam {
|
|||||||
|
|
||||||
if(ArenaMode.VariableTeams.contains(Config.mode)){
|
if(ArenaMode.VariableTeams.contains(Config.mode)){
|
||||||
notReadyKit.setItem(2, "REQUESTS", new ItemBuilder(Material.PAPER).build(), GUI::chooseJoinRequests);
|
notReadyKit.setItem(2, "REQUESTS", new ItemBuilder(Material.PAPER).build(), GUI::chooseJoinRequests);
|
||||||
notReadyKit.setItem(3, "REMOVE_PLAYERS", new ItemBuilder(SWItem.getMaterial("FIREWORK_CHARGE")).build(), GUI::chooseRemove);
|
notReadyKit.setItem(3, "MANAGE_PLAYERS", SWItem.getPlayerSkull("AdmiralSeekrank").getItemStack(), GUI::managePlayers);
|
||||||
if(!AIManager.availableAIs().isEmpty())
|
if(!AIManager.availableAIs().isEmpty())
|
||||||
notReadyKit.setItem(6, "ADD_AI", new ItemBuilder(Material.REDSTONE).build(), GUI::addAI);
|
notReadyKit.setItem(6, "ADD_AI", new ItemBuilder(Material.REDSTONE).build(), GUI::addAI);
|
||||||
}
|
}
|
||||||
@@ -343,7 +343,10 @@ public class FightTeam {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setLeader(FightPlayer leader, boolean silent) {
|
public void setLeader(FightPlayer leader, boolean silent) {
|
||||||
|
if(this.leader != null)
|
||||||
|
this.leader.ifPlayer(memberKit::loadToPlayer);
|
||||||
|
|
||||||
leader.ifPlayer(PersonalKitCreator::closeIfInKitCreator);
|
leader.ifPlayer(PersonalKitCreator::closeIfInKitCreator);
|
||||||
|
|
||||||
this.leader = leader;
|
this.leader = leader;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.fightsystem.fight;
|
package de.steamwar.fightsystem.fight;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import de.steamwar.Reflection;
|
||||||
import de.steamwar.fightsystem.Config;
|
import de.steamwar.fightsystem.Config;
|
||||||
import de.steamwar.fightsystem.FightSystem;
|
import de.steamwar.fightsystem.FightSystem;
|
||||||
import de.steamwar.fightsystem.commands.Commands;
|
import de.steamwar.fightsystem.commands.Commands;
|
||||||
@@ -215,11 +215,11 @@ public class Kit {
|
|||||||
return !normal.isEnchantmentInKit(stack) && !stack.getEnchantments().isEmpty();
|
return !normal.isEnchantmentInKit(stack) && !stack.getEnchantments().isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Class<?> itemStack = Reflection.getClass("{nms.world.item}.ItemStack");
|
private static final Class<?> itemStack = Reflection.getClass("net.minecraft.world.item.ItemStack");
|
||||||
private static final Reflection.MethodInvoker asNMSCopy = Reflection.getTypedMethod(Reflection.getClass("{obc}.inventory.CraftItemStack"), "asNMSCopy", itemStack, ItemStack.class);
|
private static final Reflection.Method asNMSCopy = Reflection.getTypedMethod(Reflection.getClass("org.bukkit.craftbukkit.inventory.CraftItemStack"), "asNMSCopy", itemStack, ItemStack.class);
|
||||||
private static final Class<?> nbtTagCompound = Reflection.getClass("{nms.nbt}.NBTTagCompound");
|
private static final Class<?> nbtTagCompound = Reflection.getClass("net.minecraft.nbt.CompoundTag");
|
||||||
private static final Reflection.MethodInvoker getTag = Reflection.getTypedMethod(itemStack, null, nbtTagCompound);
|
private static final Reflection.Method getTag = Reflection.getTypedMethod(itemStack, null, nbtTagCompound);
|
||||||
private static final Reflection.MethodInvoker getKeys = Reflection.getTypedMethod(nbtTagCompound, null, Set.class);
|
private static final Reflection.Method getKeys = Reflection.getTypedMethod(nbtTagCompound, null, Set.class);
|
||||||
public static boolean hasItems(ItemStack stack) {
|
public static boolean hasItems(ItemStack stack) {
|
||||||
Set<String> keys = new HashSet<>((Set<String>) getKeys.invoke(getTag.invoke(asNMSCopy.invoke(null, stack))));
|
Set<String> keys = new HashSet<>((Set<String>) getKeys.invoke(getTag.invoke(asNMSCopy.invoke(null, stack))));
|
||||||
keys.remove("Enchantments");
|
keys.remove("Enchantments");
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.fightsystem.listener;
|
package de.steamwar.fightsystem.listener;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import de.steamwar.Reflection;
|
||||||
import de.steamwar.fightsystem.Config;
|
import de.steamwar.fightsystem.Config;
|
||||||
import de.steamwar.fightsystem.states.FightState;
|
import de.steamwar.fightsystem.states.FightState;
|
||||||
import de.steamwar.fightsystem.states.StateDependentTask;
|
import de.steamwar.fightsystem.states.StateDependentTask;
|
||||||
@@ -41,7 +41,7 @@ public class ArrowStopper {
|
|||||||
new StateDependentTask(Config.TechhiderActive, FightState.Running, this::run, 1, 1);
|
new StateDependentTask(Config.TechhiderActive, FightState.Running, this::run, 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Class<?> entityArrow = Reflection.getClass("{nms.world.entity.projectile}.EntityArrow");
|
private static final Class<?> entityArrow = Reflection.getClass("net.minecraft.world.entity.projectile.AbstractArrow");
|
||||||
private void run() {
|
private void run() {
|
||||||
Recording.iterateOverEntities(entityArrow::isInstance, entity -> {
|
Recording.iterateOverEntities(entityArrow::isInstance, entity -> {
|
||||||
Projectile arrow = (Projectile) entity;
|
Projectile arrow = (Projectile) entity;
|
||||||
|
|||||||
+2
-2
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.fightsystem.listener;
|
package de.steamwar.fightsystem.listener;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import de.steamwar.Reflection;
|
||||||
import com.comphenix.tinyprotocol.TinyProtocol;
|
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||||
import de.steamwar.core.Core;
|
import de.steamwar.core.Core;
|
||||||
import de.steamwar.fightsystem.Config;
|
import de.steamwar.fightsystem.Config;
|
||||||
@@ -43,7 +43,7 @@ public class ClickAnalyzer {
|
|||||||
public ClickAnalyzer() {
|
public ClickAnalyzer() {
|
||||||
TinyProtocol.instance.addFilter(Recording.blockPlacePacket, this::onBlockPlace);
|
TinyProtocol.instance.addFilter(Recording.blockPlacePacket, this::onBlockPlace);
|
||||||
if(Core.getVersion() > 8)
|
if(Core.getVersion() > 8)
|
||||||
TinyProtocol.instance.addFilter(Reflection.getClass("{nms.network.protocol.game}.PacketPlayInUseItem"), this::onBlockPlace);
|
TinyProtocol.instance.addFilter(Reflection.getClass("net.minecraft.network.protocol.game.ServerboundUseItemOnPacket"), this::onBlockPlace);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object onBlockPlace(Player player, Object packet) {
|
public Object onBlockPlace(Player player, Object packet) {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.fightsystem.listener;
|
package de.steamwar.fightsystem.listener;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import de.steamwar.Reflection;
|
||||||
import com.comphenix.tinyprotocol.TinyProtocol;
|
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||||
import de.steamwar.core.TrickyTrialsWrapper;
|
import de.steamwar.core.TrickyTrialsWrapper;
|
||||||
import de.steamwar.fightsystem.ArenaMode;
|
import de.steamwar.fightsystem.ArenaMode;
|
||||||
@@ -77,8 +77,8 @@ public class Recording implements Listener {
|
|||||||
return fp == null || !fp.isLiving() || FightState.getFightState() == FightState.SPECTATE;
|
return fp == null || !fp.isLiving() || FightState.getFightState() == FightState.SPECTATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Class<?> primedTnt = Reflection.getClass("{nms.world.entity.item}.EntityTNTPrimed");
|
public static final Class<?> primedTnt = Reflection.getClass("net.minecraft.world.entity.item.PrimedTnt");
|
||||||
private static final Reflection.MethodInvoker getBukkitEntity = Reflection.getTypedMethod(Reflection.getClass("{nms.world.entity}.Entity"), "getBukkitEntity", null);
|
private static final Reflection.Method getBukkitEntity = Reflection.getTypedMethod(Reflection.getClass("net.minecraft.world.entity.Entity"), "getBukkitEntity", null);
|
||||||
public static void iterateOverEntities(Predicate<Object> filter, Consumer<Entity> consumer) {
|
public static void iterateOverEntities(Predicate<Object> filter, Consumer<Entity> consumer) {
|
||||||
CraftbukkitWrapper.impl.entityIterator().filter(filter).map(entity -> (Entity) getBukkitEntity.invoke(entity)).forEach(consumer);
|
CraftbukkitWrapper.impl.entityIterator().filter(filter).map(entity -> (Entity) getBukkitEntity.invoke(entity)).forEach(consumer);
|
||||||
}
|
}
|
||||||
@@ -129,9 +129,9 @@ public class Recording implements Listener {
|
|||||||
GlobalRecorder.getInstance().entitySpeed(entity);
|
GlobalRecorder.getInstance().entitySpeed(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Class<?> blockDigPacket = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInBlockDig");
|
private static final Class<?> blockDigPacket = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundPlayerActionPacket");
|
||||||
private static final Class<?> playerDigType = blockDigPacket.getDeclaredClasses()[0];
|
private static final Class<?> playerDigType = blockDigPacket.getDeclaredClasses()[0];
|
||||||
private static final Reflection.FieldAccessor<?> blockDigType = Reflection.getField(blockDigPacket, playerDigType, 0);
|
private static final Reflection.Field<?> blockDigType = Reflection.getField(blockDigPacket, playerDigType, 0);
|
||||||
private static final Object releaseUseItem = playerDigType.getEnumConstants()[5];
|
private static final Object releaseUseItem = playerDigType.getEnumConstants()[5];
|
||||||
private Object blockDig(Player p, Object packet) {
|
private Object blockDig(Player p, Object packet) {
|
||||||
if(!isNotSent(p) && blockDigType.get(packet) == releaseUseItem)
|
if(!isNotSent(p) && blockDigType.get(packet) == releaseUseItem)
|
||||||
@@ -139,7 +139,7 @@ public class Recording implements Listener {
|
|||||||
return packet;
|
return packet;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Class<?> blockPlacePacket = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInBlockPlace");
|
public static final Class<?> blockPlacePacket = Reflection.getClass("net.minecraft.network.protocol.game.ServerboundUseItemPacket");
|
||||||
private Object blockPlace(Player p, Object packet) {
|
private Object blockPlace(Player p, Object packet) {
|
||||||
boolean mainHand = BountifulWrapper.impl.mainHand(packet);
|
boolean mainHand = BountifulWrapper.impl.mainHand(packet);
|
||||||
if(!isNotSent(p) && BountifulWrapper.impl.bowInHand(mainHand, p))
|
if(!isNotSent(p) && BountifulWrapper.impl.bowInHand(mainHand, p))
|
||||||
|
|||||||
@@ -22,8 +22,6 @@ package de.steamwar.fightsystem.listener;
|
|||||||
import de.steamwar.fightsystem.ArenaMode;
|
import de.steamwar.fightsystem.ArenaMode;
|
||||||
import de.steamwar.fightsystem.Config;
|
import de.steamwar.fightsystem.Config;
|
||||||
import de.steamwar.fightsystem.FightSystem;
|
import de.steamwar.fightsystem.FightSystem;
|
||||||
import de.steamwar.fightsystem.fight.Fight;
|
|
||||||
import de.steamwar.fightsystem.fight.FightTeam;
|
|
||||||
import de.steamwar.fightsystem.states.FightState;
|
import de.steamwar.fightsystem.states.FightState;
|
||||||
import de.steamwar.fightsystem.states.StateDependentListener;
|
import de.steamwar.fightsystem.states.StateDependentListener;
|
||||||
import de.steamwar.sql.SteamwarUser;
|
import de.steamwar.sql.SteamwarUser;
|
||||||
@@ -42,7 +40,6 @@ public class TestJoin implements Listener {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void handlePlayerJoin(PlayerJoinEvent event) {
|
public void handlePlayerJoin(PlayerJoinEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
FightTeam fightTeam = Fight.getPlayerTeam(player);
|
|
||||||
|
|
||||||
if(Config.ReplayID != 0 && !SteamwarUser.get(player.getUniqueId()).hasPerm(UserPerm.MODERATION)) {
|
if(Config.ReplayID != 0 && !SteamwarUser.get(player.getUniqueId()).hasPerm(UserPerm.MODERATION)) {
|
||||||
FightSystem.getMessage().send("CHECK_JOIN_DENIED", player);
|
FightSystem.getMessage().send("CHECK_JOIN_DENIED", player);
|
||||||
@@ -50,10 +47,6 @@ public class TestJoin implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fightTeam == null && Fight.teams().stream().anyMatch(team -> team.canbeLeader(player))) {
|
|
||||||
FightSystem.getMessage().send("TEST_BECOME_LEADER", player);
|
|
||||||
}
|
|
||||||
|
|
||||||
player.setOp(true);
|
player.setOp(true);
|
||||||
|
|
||||||
if(FightState.getFightState() == FightState.PRE_LEADER_SETUP){
|
if(FightState.getFightState() == FightState.PRE_LEADER_SETUP){
|
||||||
|
|||||||
@@ -20,15 +20,18 @@
|
|||||||
package de.steamwar.fightsystem.record;
|
package de.steamwar.fightsystem.record;
|
||||||
|
|
||||||
import de.steamwar.fightsystem.Config;
|
import de.steamwar.fightsystem.Config;
|
||||||
import de.steamwar.sql.Replay;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Files;
|
||||||
import java.util.zip.GZIPInputStream;
|
import java.util.zip.GZIPInputStream;
|
||||||
|
|
||||||
public class FileSource extends PacketSource {
|
public class FileSource extends PacketSource {
|
||||||
|
|
||||||
|
public static File replayFile(int fightId) {
|
||||||
|
return new File("/mnt/storage/replays", fightId + ".replay");
|
||||||
|
}
|
||||||
|
|
||||||
public static void startReplay() {
|
public static void startReplay() {
|
||||||
if(Config.replayserver()) {
|
if(Config.replayserver()) {
|
||||||
try {
|
try {
|
||||||
@@ -41,7 +44,7 @@ public class FileSource extends PacketSource {
|
|||||||
|
|
||||||
if(Config.ReplayID > 0) {
|
if(Config.ReplayID > 0) {
|
||||||
try {
|
try {
|
||||||
new FileSource(Replay.get(Config.ReplayID).getReplay());
|
new FileSource(replayFile(Config.ReplayID));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new SecurityException("Could not start replay", e);
|
throw new SecurityException("Could not start replay", e);
|
||||||
}
|
}
|
||||||
@@ -49,7 +52,7 @@ public class FileSource extends PacketSource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public FileSource(File fightFile) throws IOException {
|
public FileSource(File fightFile) throws IOException {
|
||||||
super(new GZIPInputStream(new FileInputStream(fightFile)));
|
super(new GZIPInputStream(Files.newInputStream(fightFile.toPath())));
|
||||||
new PacketProcessor(this);
|
new PacketProcessor(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -22,6 +22,7 @@ package de.steamwar.fightsystem.record;
|
|||||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||||
import de.steamwar.core.Core;
|
import de.steamwar.core.Core;
|
||||||
import de.steamwar.core.TrickyTrialsWrapper;
|
import de.steamwar.core.TrickyTrialsWrapper;
|
||||||
|
import de.steamwar.core.WorldEditWrapper;
|
||||||
import de.steamwar.entity.REntity;
|
import de.steamwar.entity.REntity;
|
||||||
import de.steamwar.entity.REntityServer;
|
import de.steamwar.entity.REntityServer;
|
||||||
import de.steamwar.entity.RPlayer;
|
import de.steamwar.entity.RPlayer;
|
||||||
@@ -523,7 +524,7 @@ public class PacketProcessor implements Listener {
|
|||||||
public void close() {
|
public void close() {
|
||||||
// FAWE 1.12 calls close...
|
// FAWE 1.12 calls close...
|
||||||
}
|
}
|
||||||
}, Core.getVersion() > 12);
|
}, WorldEditWrapper.impl.getNativeFormat());
|
||||||
|
|
||||||
execSync(() -> team.pasteSchem(schemId, clipboard));
|
execSync(() -> team.pasteSchem(schemId, clipboard));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.fightsystem.utils;
|
package de.steamwar.fightsystem.utils;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import de.steamwar.Reflection;
|
||||||
import de.steamwar.core.VersionDependent;
|
import de.steamwar.core.VersionDependent;
|
||||||
import de.steamwar.fightsystem.FightSystem;
|
import de.steamwar.fightsystem.FightSystem;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@@ -29,12 +29,12 @@ import org.bukkit.entity.Entity;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public interface BlockIdWrapper {
|
public interface BlockIdWrapper {
|
||||||
Class<?> worldServer = Reflection.getClass("{nms.server.level}.WorldServer");
|
Class<?> worldServer = Reflection.getClass("net.minecraft.server.level.ServerLevel");
|
||||||
Reflection.MethodInvoker getWorldHandle = Reflection.getTypedMethod(Reflection.getClass("{obc}.CraftWorld"), "getHandle", worldServer);
|
Reflection.Method getWorldHandle = Reflection.getTypedMethod(Reflection.getClass("org.bukkit.craftbukkit.CraftWorld"), "getHandle", worldServer);
|
||||||
|
|
||||||
Class<?> craftPlayer = Reflection.getClass("{obc}.entity.CraftPlayer");
|
Class<?> craftPlayer = Reflection.getClass("org.bukkit.craftbukkit.entity.CraftPlayer");
|
||||||
Class<?> entityPlayer = Reflection.getClass("{nms.server.level}.EntityPlayer");
|
Class<?> entityPlayer = Reflection.getClass("net.minecraft.server.level.ServerPlayer");
|
||||||
Reflection.MethodInvoker getPlayer = Reflection.getTypedMethod(craftPlayer, "getHandle", entityPlayer);
|
Reflection.Method getPlayer = Reflection.getTypedMethod(craftPlayer, "getHandle", entityPlayer);
|
||||||
|
|
||||||
BlockIdWrapper impl = VersionDependent.getVersionImpl(FightSystem.getPlugin());
|
BlockIdWrapper impl = VersionDependent.getVersionImpl(FightSystem.getPlugin());
|
||||||
|
|
||||||
|
|||||||
@@ -40,10 +40,6 @@ public class BungeeFightInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void send() {
|
private void send() {
|
||||||
Player player = Bukkit.getOnlinePlayers().stream().findAny().orElse(null);
|
|
||||||
if(player == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
NetworkSender.send(new FightInfoPacket(
|
NetworkSender.send(new FightInfoPacket(
|
||||||
Config.world.getName(),
|
Config.world.getName(),
|
||||||
Config.SchematicType.toDB(),
|
Config.SchematicType.toDB(),
|
||||||
|
|||||||
@@ -27,23 +27,25 @@ import de.steamwar.fightsystem.fight.Fight;
|
|||||||
import de.steamwar.fightsystem.fight.FightPlayer;
|
import de.steamwar.fightsystem.fight.FightPlayer;
|
||||||
import de.steamwar.fightsystem.fight.FightTeam;
|
import de.steamwar.fightsystem.fight.FightTeam;
|
||||||
import de.steamwar.fightsystem.record.FileRecorder;
|
import de.steamwar.fightsystem.record.FileRecorder;
|
||||||
|
import de.steamwar.fightsystem.record.FileSource;
|
||||||
import de.steamwar.fightsystem.states.FightState;
|
import de.steamwar.fightsystem.states.FightState;
|
||||||
import de.steamwar.fightsystem.states.OneShotStateDependent;
|
import de.steamwar.fightsystem.states.OneShotStateDependent;
|
||||||
import de.steamwar.fightsystem.winconditions.Wincondition;
|
import de.steamwar.fightsystem.winconditions.Wincondition;
|
||||||
import de.steamwar.network.NetworkSender;
|
import de.steamwar.network.NetworkSender;
|
||||||
import de.steamwar.network.packets.common.FightEndsPacket;
|
import de.steamwar.network.packets.common.FightEndsPacket;
|
||||||
import de.steamwar.sql.Replay;
|
|
||||||
import de.steamwar.sql.SchematicNode;
|
import de.steamwar.sql.SchematicNode;
|
||||||
import de.steamwar.sql.SteamwarUser;
|
import de.steamwar.sql.SteamwarUser;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
|
import java.nio.file.Files;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static de.steamwar.sql.Fight.create;
|
import static de.steamwar.sql.Fight.create;
|
||||||
|
import static de.steamwar.sql.Fight.markReplayAvailable;
|
||||||
|
|
||||||
public class FightStatistics {
|
public class FightStatistics {
|
||||||
|
|
||||||
@@ -124,11 +126,9 @@ public class FightStatistics {
|
|||||||
Config.EventKampf.setFight(fightId);
|
Config.EventKampf.setFight(fightId);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
Files.move(FileRecorder.getFile().toPath(), FileSource.replayFile(fightId).toPath());
|
||||||
Replay.save(fightId, FileRecorder.getFile());
|
|
||||||
} catch (Exception e) {
|
markReplayAvailable(fightId);
|
||||||
Bukkit.getLogger().log(Level.INFO, "Failed to save replay", e);
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Bukkit.getLogger().log(Level.SEVERE, "Failed to save statistics", e);
|
Bukkit.getLogger().log(Level.SEVERE, "Failed to save statistics", e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.fightsystem.utils;
|
package de.steamwar.fightsystem.utils;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import de.steamwar.Reflection;
|
||||||
import com.comphenix.tinyprotocol.TinyProtocol;
|
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||||
import de.steamwar.core.Core;
|
import de.steamwar.core.Core;
|
||||||
import de.steamwar.entity.REntity;
|
import de.steamwar.entity.REntity;
|
||||||
@@ -71,10 +71,10 @@ public class HullHider implements Listener {
|
|||||||
|
|
||||||
packetHiders.put(packetPlayOutWorldEvent, this::worldEventHider);
|
packetHiders.put(packetPlayOutWorldEvent, this::worldEventHider);
|
||||||
packetHiders.put(packetPlayOutExplosion, this::explosionHider);
|
packetHiders.put(packetPlayOutExplosion, this::explosionHider);
|
||||||
posHiderGenerator("{nms.network.protocol.game}.PacketPlayOutWorldParticles", Core.getVersion() >= 18 ? double.class : float.class, 1.0);
|
posHiderGenerator("net.minecraft.network.protocol.game.ClientboundLevelParticlesPacket", Core.getVersion() >= 18 ? double.class : float.class, 1.0);
|
||||||
posHiderGenerator("{nms.network.protocol.game}.PacketPlayOutNamedSoundEffect", int.class, 8.0);
|
posHiderGenerator("net.minecraft.network.protocol.game.ClientboundSoundPacket", int.class, 8.0);
|
||||||
if(Core.getVersion() >= 9 && Core.getVersion() < 18)
|
if(Core.getVersion() >= 9 && Core.getVersion() < 18)
|
||||||
posHiderGenerator("{nms.network.protocol.game}.PacketPlayOutCustomSoundEffect", int.class, 8.0);
|
posHiderGenerator("net.minecraft.network.protocol.game.PacketPlayOutCustomSoundEffect", int.class, 8.0);
|
||||||
|
|
||||||
new StateDependentListener(TechHiderWrapper.ENABLED, FightState.Schem, this);
|
new StateDependentListener(TechHiderWrapper.ENABLED, FightState.Schem, this);
|
||||||
new StateDependent(TechHiderWrapper.ENABLED, FightState.Schem) {
|
new StateDependent(TechHiderWrapper.ENABLED, FightState.Schem) {
|
||||||
@@ -198,16 +198,16 @@ public class HullHider implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static final Class<?> packetPlayOutWorldEvent = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutWorldEvent");
|
private static final Class<?> packetPlayOutWorldEvent = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundLevelEventPacket");
|
||||||
private static final Reflection.FieldAccessor<?> worldEventPosition = Reflection.getField(packetPlayOutWorldEvent, TechHider.blockPosition, 0);
|
private static final Reflection.Field<?> worldEventPosition = Reflection.getField(packetPlayOutWorldEvent, TechHider.blockPosition, 0);
|
||||||
public static final Reflection.FieldAccessor<Integer> blockPositionY = Reflection.getField("{nms.core}.BaseBlockPosition", int.class, 1);
|
public static final Reflection.Field<Integer> blockPositionY = Reflection.getField("net.minecraft.core.Vec3i", int.class, 1);
|
||||||
private Object worldEventHider(Player player, Object packet) {
|
private Object worldEventHider(Player player, Object packet) {
|
||||||
Object baseBlock = worldEventPosition.get(packet);
|
Object baseBlock = worldEventPosition.get(packet);
|
||||||
return packetHider(player, packet, new Location(Config.world, TechHider.blockPositionX.get(baseBlock), blockPositionY.get(baseBlock), TechHider.blockPositionZ.get(baseBlock)));
|
return packetHider(player, packet, new Location(Config.world, TechHider.blockPositionX.get(baseBlock), blockPositionY.get(baseBlock), TechHider.blockPositionZ.get(baseBlock)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Class<?> packetPlayOutExplosion = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutExplosion");
|
private static final Class<?> packetPlayOutExplosion = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundExplodePacket");
|
||||||
private static final Reflection.FieldAccessor<List> explosionBlocks = Reflection.getField(packetPlayOutExplosion, List.class, 0);
|
private static final Reflection.Field<List> explosionBlocks = Reflection.getField(packetPlayOutExplosion, List.class, 0);
|
||||||
private static final Function<Object, Location> explosionLocation = posPacketToLocation(packetPlayOutExplosion, double.class, 1.0);
|
private static final Function<Object, Location> explosionLocation = posPacketToLocation(packetPlayOutExplosion, double.class, 1.0);
|
||||||
private Object explosionHider(Player player, Object packet) {
|
private Object explosionHider(Player player, Object packet) {
|
||||||
if(explosionBlocks.get(packet).isEmpty())
|
if(explosionBlocks.get(packet).isEmpty())
|
||||||
@@ -223,9 +223,9 @@ public class HullHider implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static Function<Object, Location> posPacketToLocation(Class<?> type, Class<? extends Number> posType, double factor) {
|
private static Function<Object, Location> posPacketToLocation(Class<?> type, Class<? extends Number> posType, double factor) {
|
||||||
Reflection.FieldAccessor<? extends Number> x = Reflection.getField(type, posType, 0);
|
Reflection.Field<? extends Number> x = Reflection.getField(type, posType, 0);
|
||||||
Reflection.FieldAccessor<? extends Number> y = Reflection.getField(type, posType, 1);
|
Reflection.Field<? extends Number> y = Reflection.getField(type, posType, 1);
|
||||||
Reflection.FieldAccessor<? extends Number> z = Reflection.getField(type, posType, 2);
|
Reflection.Field<? extends Number> z = Reflection.getField(type, posType, 2);
|
||||||
|
|
||||||
return packet -> new Location(Config.world, x.get(packet).doubleValue()/factor, y.get(packet).doubleValue()/factor, z.get(packet).doubleValue()/factor);
|
return packet -> new Location(Config.world, x.get(packet).doubleValue()/factor, y.get(packet).doubleValue()/factor, z.get(packet).doubleValue()/factor);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ commands:
|
|||||||
ready:
|
ready:
|
||||||
kit:
|
kit:
|
||||||
remove:
|
remove:
|
||||||
leader:
|
|
||||||
lockschem:
|
lockschem:
|
||||||
state:
|
state:
|
||||||
skip:
|
skip:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* This file is a part of the SteamWar software.
|
* This file is a part of the SteamWar software.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2024 SteamWar.de-Serverteam
|
* Copyright (C) 2024 SteamWar.de-Serverteam
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
* This file is a part of the SteamWar software.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2025 SteamWar.de-Serverteam
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.steamwar.kotlin
|
||||||
|
|
||||||
|
import de.steamwar.inventory.SWInventory
|
||||||
|
import org.bukkit.entity.Player
|
||||||
|
import org.bukkit.event.inventory.InventoryClickEvent
|
||||||
|
import org.bukkit.inventory.ItemStack
|
||||||
|
|
||||||
|
abstract class KotlinInventory(val player: Player) {
|
||||||
|
|
||||||
|
private val inv: SWInventory by lazy { createInventory() }
|
||||||
|
|
||||||
|
abstract fun createInventory(): SWInventory
|
||||||
|
|
||||||
|
fun open() = inv.open()
|
||||||
|
|
||||||
|
operator fun set(slot: Int, item: Pair<ItemStack, (event: InventoryClickEvent) -> Unit>) {
|
||||||
|
inv.setItemEvent(slot, item.first, item.second)
|
||||||
|
}
|
||||||
|
|
||||||
|
operator fun set(slot: Int, item: ItemStack) {
|
||||||
|
inv.setItemEvent(slot, item) { }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,60 +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.kotlin.inventory
|
|
||||||
|
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent
|
|
||||||
import org.bukkit.event.inventory.InventoryCloseEvent
|
|
||||||
import org.bukkit.inventory.Inventory
|
|
||||||
import org.bukkit.inventory.InventoryHolder
|
|
||||||
import org.bukkit.inventory.ItemStack
|
|
||||||
|
|
||||||
abstract class SWInventoryHolder: InventoryHolder {
|
|
||||||
|
|
||||||
val _inventory: Inventory by lazy { createInventory() }
|
|
||||||
|
|
||||||
private val callbacks = mutableMapOf<Int, (event: InventoryClickEvent) -> Unit>()
|
|
||||||
|
|
||||||
override fun getInventory(): Inventory = _inventory
|
|
||||||
|
|
||||||
abstract fun createInventory(): Inventory
|
|
||||||
|
|
||||||
open fun handleInventoryClick(event: InventoryClickEvent) {
|
|
||||||
callbacks[event.slot]?.invoke(event)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun addItem(item: ItemStack, slot: Int, callback: (event: InventoryClickEvent) -> Unit) {
|
|
||||||
_inventory.setItem(slot, item)
|
|
||||||
addCallback(slot, callback)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun addCallback(slot: Int, callback: (event: InventoryClickEvent) -> Unit) {
|
|
||||||
callbacks[slot] = callback
|
|
||||||
}
|
|
||||||
|
|
||||||
open fun handleClose(event: InventoryCloseEvent) { }
|
|
||||||
|
|
||||||
operator fun set(slot: Int, item: Pair<ItemStack, (event: InventoryClickEvent) -> Unit>) {
|
|
||||||
addItem(item.first, slot, item.second)
|
|
||||||
}
|
|
||||||
|
|
||||||
operator fun set(slot: Int, item: ItemStack) {
|
|
||||||
addItem(item, slot) { }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -10,6 +10,13 @@ NPC_CHAT_2 = §eSteam§8War§f was established in 2019.
|
|||||||
NPC_CHAT_3 = §fBecome a part of our team by applying via our Discord server (https://steamwar.de/discord).
|
NPC_CHAT_3 = §fBecome a part of our team by applying via our Discord server (https://steamwar.de/discord).
|
||||||
NPC_CHAT_4 = §fYou can develop your own buildserver features with our Lua script system.
|
NPC_CHAT_4 = §fYou can develop your own buildserver features with our Lua script system.
|
||||||
NPC_CHAT_5 = §fThere are many secrets to discover in this lobby.
|
NPC_CHAT_5 = §fThere are many secrets to discover in this lobby.
|
||||||
|
## TheBreadBeard
|
||||||
|
NPC_CHAT_3266_0 = §fI collect alts like Infinity Stones.
|
||||||
|
NPC_CHAT_3266_1 = §fYou want my Bread? You can have it! Just look for it! I've hidden the best bakery in the world somewhere!
|
||||||
|
NPC_CHAT_3266_2 = §fHey, I am TheBreadBeard, ex- EuropSuchties player, formerly (un)known as WarGear_Titan.
|
||||||
|
NPC_CHAT_3266_3 = §fInventor of Lactose Intolerance, the Placeholder and Infinity-Ring. All technical principles no one knows or needs.
|
||||||
|
NPC_CHAT_3266_4 = §fKnown for the lobby-banners, logos, spontaneous arenas, as well as an organizer and moderator of many events.
|
||||||
|
NPC_CHAT_3266_5 = §fFrom supporter to moderator to builder ... Maybe the journey takes me to being a developer next.
|
||||||
|
|
||||||
# Portal Command
|
# Portal Command
|
||||||
PORTAL_COMMAND_LIST_HELP = §8/§7portal §elist §8- §7Lists all portals
|
PORTAL_COMMAND_LIST_HELP = §8/§7portal §elist §8- §7Lists all portals
|
||||||
|
|||||||
@@ -10,6 +10,13 @@ NPC_CHAT_2 = §eSteam§8War§f gibt es seit 2019.
|
|||||||
NPC_CHAT_3 = §fBewerbe dich gerne für unser Team über unseren Discord-Server (https://steamwar.de/discord).
|
NPC_CHAT_3 = §fBewerbe dich gerne für unser Team über unseren Discord-Server (https://steamwar.de/discord).
|
||||||
NPC_CHAT_4 = §fDu kannst mit unserm Lua Script-System deine eigenen Bau Features programmieren.
|
NPC_CHAT_4 = §fDu kannst mit unserm Lua Script-System deine eigenen Bau Features programmieren.
|
||||||
NPC_CHAT_5 = §fAuf dieser Lobby sind so einige secrets versteckt.
|
NPC_CHAT_5 = §fAuf dieser Lobby sind so einige secrets versteckt.
|
||||||
|
## TheBreadBeard
|
||||||
|
NPC_CHAT_3266_0 = §fIch sammel Alts wie Infinity Stones.
|
||||||
|
NPC_CHAT_3266_1 = §fIhr wollt meine Teigwaren? Die könnt ihr haben! Sucht sie doch! Irgendwo hab ich die beste Bäckerei der Welt versteckt!
|
||||||
|
NPC_CHAT_3266_2 = §fMoin, Ich bin TheBreadBeard, ehemaliger EuropSuchties Spieler, damals (un)bekannt als WarGear_Titan.
|
||||||
|
NPC_CHAT_3266_3 = §fErfinder der Laktoseintoleranz, des Platzhalters und des Infinity-Rings. Alles Prinzipien, die keiner kennt und keiner braucht.
|
||||||
|
NPC_CHAT_3266_4 = §fBekannt für die Lobbybanner, Logos, spontane Arenen, sowie als Leiter von so manchem Event.
|
||||||
|
NPC_CHAT_3266_5 = §fVon Supporter zu Moderator zu Builder ... Vielleicht führt mich die Reise als Nächstes zum Developer.
|
||||||
|
|
||||||
# Portal Command
|
# Portal Command
|
||||||
PORTAL_COMMAND_LIST_HELP = §8/§7portal §elist §8- §7Listet alle Portale auf
|
PORTAL_COMMAND_LIST_HELP = §8/§7portal §elist §8- §7Listet alle Portale auf
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import de.steamwar.lobby.LobbySystem;
|
|||||||
import de.steamwar.lobby.display.NPC;
|
import de.steamwar.lobby.display.NPC;
|
||||||
import de.steamwar.lobby.listener.BasicListener;
|
import de.steamwar.lobby.listener.BasicListener;
|
||||||
import de.steamwar.sql.SteamwarUser;
|
import de.steamwar.sql.SteamwarUser;
|
||||||
import de.steamwar.sql.UserPerm;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@@ -135,6 +134,10 @@ public class TeamPlayer extends BasicListener {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String parseRandomMessage(Player player, SteamwarUser target, String message) throws MissingResourceException {
|
||||||
|
return LobbySystem.getMessage().parsePrefixed(message + random.nextInt(6), player, target.getUserName(), target.prefix().getColorCode() + target.prefix().getChatPrefix());
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerInteractEntity(PlayerInteractEntityEvent event) {
|
public void onPlayerInteractEntity(PlayerInteractEntityEvent event) {
|
||||||
if (!(event.getRightClicked() instanceof Villager)) {
|
if (!(event.getRightClicked() instanceof Villager)) {
|
||||||
@@ -145,10 +148,14 @@ public class TeamPlayer extends BasicListener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String message = "NPC_CHAT_" + random.nextInt(6);
|
SteamwarUser target = SteamwarUser.get(event.getRightClicked().getName());
|
||||||
SteamwarUser user = SteamwarUser.get(event.getRightClicked().getName());
|
String message;
|
||||||
UserPerm.Prefix prefix = user.prefix();
|
try {
|
||||||
LobbySystem.getMessage().send(message, event.getPlayer(), event.getRightClicked().getName(), prefix.getColorCode() + prefix.getChatPrefix());
|
message = parseRandomMessage(event.getPlayer(), target, "NPC_CHAT_" + target.getId() + "_");
|
||||||
|
} catch (MissingResourceException e) {
|
||||||
|
message = parseRandomMessage(event.getPlayer(), target, "NPC_CHAT_");
|
||||||
|
}
|
||||||
|
event.getPlayer().sendMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
package de.steamwar.misslewars.slowmo;
|
package de.steamwar.misslewars.slowmo;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import de.steamwar.Reflection;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ public class SlowMoUtils {
|
|||||||
private static final Field field;
|
private static final Field field;
|
||||||
public static final boolean freezeEnabled;
|
public static final boolean freezeEnabled;
|
||||||
|
|
||||||
private static final Reflection.MethodInvoker getWorldHandle = Reflection.getTypedMethod(Reflection.getClass("{obc}.CraftWorld"), "getHandle", null);
|
private static final Reflection.Method getWorldHandle = Reflection.getTypedMethod(Reflection.getClass("org.bukkit.craftbukkit.CraftWorld"), "getHandle", null);
|
||||||
private static boolean frozen = false;
|
private static boolean frozen = false;
|
||||||
|
|
||||||
private static final World world;
|
private static final World world;
|
||||||
@@ -40,7 +40,7 @@ public class SlowMoUtils {
|
|||||||
static {
|
static {
|
||||||
Field temp;
|
Field temp;
|
||||||
try {
|
try {
|
||||||
temp = Reflection.getClass("{nms.server.level}.WorldServer").getField("freezed");
|
temp = Reflection.getClass("net.minecraft.server.level.ServerLevel").getField("freezed");
|
||||||
} catch (NoSuchFieldException e) {
|
} catch (NoSuchFieldException e) {
|
||||||
temp = null;
|
temp = null;
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-1
@@ -245,7 +245,7 @@ public class SchematicCommandUtils {
|
|||||||
SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_ELO", player, node.getElo(Season.getSeason()));
|
SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_ELO", player, node.getElo(Season.getSeason()));
|
||||||
}
|
}
|
||||||
|
|
||||||
SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_FORMAT", player, node.getSchemFormat() ? ".schem" : ".schematic");
|
SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_FORMAT", player, node.getFileEnding());
|
||||||
CheckedSchematic.getLastDeclinedOfNode(node.getId()).stream().findFirst().ifPresent(checkedSchematic -> SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_STATUS", player, checkedSchematic.getEndTime(), checkedSchematic.getDeclineReason()));
|
CheckedSchematic.getLastDeclinedOfNode(node.getId()).stream().findFirst().ifPresent(checkedSchematic -> SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_STATUS", player, checkedSchematic.getEndTime(), checkedSchematic.getDeclineReason()));
|
||||||
} else {
|
} else {
|
||||||
SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_TYPE", player, SchematicSystem.MESSAGE.parse("UTIL_INFO_TYPE_DIR", player));
|
SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_TYPE", player, SchematicSystem.MESSAGE.parse("UTIL_INFO_TYPE_DIR", player));
|
||||||
@@ -470,6 +470,9 @@ public class SchematicCommandUtils {
|
|||||||
} else if (extend == SchematicCommand.Extend.AUSFAHREN) {
|
} else if (extend == SchematicCommand.Extend.AUSFAHREN) {
|
||||||
NetworkSender.send(new PrepareSchemPacket(SteamwarUser.get(player.getUniqueId()).getId(), node.getId(), type.toDB()));
|
NetworkSender.send(new PrepareSchemPacket(SteamwarUser.get(player.getUniqueId()).getId(), node.getId(), type.toDB()));
|
||||||
SchematicSystem.MESSAGE.send("UTIL_TYPE_EXTEND", player);
|
SchematicSystem.MESSAGE.send("UTIL_TYPE_EXTEND", player);
|
||||||
|
} else {
|
||||||
|
node.setSchemtype(type.checkType());
|
||||||
|
SchematicSystem.MESSAGE.send("UTIL_SUBMIT_DIRECT_DONE", player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* This file is a part of the SteamWar software.
|
* This file is a part of the SteamWar software.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2024 SteamWar.de-Serverteam
|
* Copyright (C) 2024 SteamWar.de-Serverteam
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.core;
|
package de.steamwar.core;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import de.steamwar.Reflection;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.NamespacedKey;
|
import org.bukkit.NamespacedKey;
|
||||||
@@ -226,14 +226,14 @@ public class FlatteningWrapper14 implements FlatteningWrapper.IFlatteningWrapper
|
|||||||
renamedLegacy.put("RECORD_12", Material.MUSIC_DISC_WAIT);
|
renamedLegacy.put("RECORD_12", Material.MUSIC_DISC_WAIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Reflection.FieldAccessor<?> scoreboardName = Reflection.getField(FlatteningWrapper.scoreboardObjective, Reflection.getClass("{nms.network.chat}.IChatBaseComponent"), 0);
|
private static final Reflection.Field<?> scoreboardName = Reflection.getField(FlatteningWrapper.scoreboardObjective, Reflection.getClass("net.minecraft.network.chat.Component"), 0);
|
||||||
@Override
|
@Override
|
||||||
public void setScoreboardTitle(Object packet, String title) {
|
public void setScoreboardTitle(Object packet, String title) {
|
||||||
scoreboardName.set(packet, ChatWrapper.impl.stringToChatComponent(title));
|
scoreboardName.set(packet, ChatWrapper.impl.stringToChatComponent(title));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Class<?> scoreActionEnum = Core.getVersion() < 21 ? Reflection.getClass("{nms.server}.ScoreboardServer$Action") : null;
|
private static final Class<?> scoreActionEnum = Core.getVersion() < 21 ? Reflection.getClass("net.minecraft.server.ServerScoreboard$Method") : null;
|
||||||
private static final Reflection.FieldAccessor<?> scoreAction = Core.getVersion() < 21 ? Reflection.getField(FlatteningWrapper.scoreboardScore, scoreActionEnum, 0) : null;
|
private static final Reflection.Field<?> scoreAction = Core.getVersion() < 21 ? Reflection.getField(FlatteningWrapper.scoreboardScore, scoreActionEnum, 0) : null;
|
||||||
private static final Object scoreActionChange = Core.getVersion() < 21 ? scoreActionEnum.getEnumConstants()[0] : null;
|
private static final Object scoreActionChange = Core.getVersion() < 21 ? scoreActionEnum.getEnumConstants()[0] : null;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -300,7 +300,7 @@ public class FlatteningWrapper14 implements FlatteningWrapper.IFlatteningWrapper
|
|||||||
return head;
|
return head;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Class<?> entityPose = Reflection.getClass("{nms.world.entity}.EntityPose");
|
private static final Class<?> entityPose = Reflection.getClass("net.minecraft.world.entity.Pose");
|
||||||
private static final Object standing = entityPose.getEnumConstants()[0];
|
private static final Object standing = entityPose.getEnumConstants()[0];
|
||||||
private static final Object swimming = entityPose.getEnumConstants()[3];
|
private static final Object swimming = entityPose.getEnumConstants()[3];
|
||||||
private static final Object sneaking = entityPose.getEnumConstants()[5];
|
private static final Object sneaking = entityPose.getEnumConstants()[5];
|
||||||
@@ -327,13 +327,13 @@ public class FlatteningWrapper14 implements FlatteningWrapper.IFlatteningWrapper
|
|||||||
return displayName != null ? Optional.of(ChatWrapper.impl.stringToChatComponent(displayName)) : Optional.empty();
|
return displayName != null ? Optional.of(ChatWrapper.impl.stringToChatComponent(displayName)) : Optional.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Class<?> registryBlocks = Reflection.getClass("{nms.core}.RegistryBlocks");
|
private static final Class<?> registryBlocks = Reflection.getClass("net.minecraft.core.DefaultedRegistry");
|
||||||
private static final Class<?> entityTypes = Reflection.getClass("{nms.world.entity}.EntityTypes");
|
private static final Class<?> entityTypes = Reflection.getClass("net.minecraft.world.entity.EntityType");
|
||||||
private static final Object entityTypesRegistry = Reflection.getField(Reflection.getClass(Core.getVersion() > 18 ? "net.minecraft.core.registries.BuiltInRegistries" : "{nms.core}.IRegistry"), registryBlocks, 0, entityTypes).get(null);
|
private static final Object entityTypesRegistry = Reflection.getField(Reflection.getClass(Core.getVersion() > 18 ? "net.minecraft.core.registries.BuiltInRegistries" : "net.minecraft.core.IRegistry"), registryBlocks, 0, entityTypes).get(null);
|
||||||
private static final Reflection.MethodInvoker get = Reflection.getMethod(registryBlocks, null, Reflection.getClass("{nms.resources}.MinecraftKey"));
|
private static final Reflection.Method get = Reflection.getMethod(registryBlocks, null, Reflection.getClass("net.minecraft.resources.ResourceLocation"));
|
||||||
private static final Reflection.FieldAccessor<?> spawnType = Reflection.getField(ProtocolWrapper.spawnPacket, entityTypes, 0);
|
private static final Reflection.Field<?> spawnType = Reflection.getField(ProtocolWrapper.spawnPacket, entityTypes, 0);
|
||||||
private static final Reflection.FieldAccessor<?> spawnLivingType = Core.getVersion() > 18 ? spawnType : Reflection.getField(ProtocolWrapper.spawnLivingPacket, int.class, 1);
|
private static final Reflection.Field<?> spawnLivingType = Core.getVersion() > 18 ? spawnType : Reflection.getField(ProtocolWrapper.spawnLivingPacket, int.class, 1);
|
||||||
private static final Reflection.MethodInvoker toMinecraft = Reflection.getMethod("{obc}.util.CraftNamespacedKey", "toMinecraft", NamespacedKey.class);
|
private static final Reflection.Method toMinecraft = Reflection.getMethod("org.bukkit.craftbukkit.util.CraftNamespacedKey", "toMinecraft", NamespacedKey.class);
|
||||||
private static final Map<EntityType, Object> types = new HashMap<>();
|
private static final Map<EntityType, Object> types = new HashMap<>();
|
||||||
static {
|
static {
|
||||||
types.put(EntityType.ARMOR_STAND, 1);
|
types.put(EntityType.ARMOR_STAND, 1);
|
||||||
@@ -352,8 +352,8 @@ public class FlatteningWrapper14 implements FlatteningWrapper.IFlatteningWrapper
|
|||||||
return player.getClientViewDistance();
|
return player.getClientViewDistance();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Reflection.MethodInvoker getHandle = Reflection.getMethod("{obc}.CraftWorld", "getHandle");
|
private static final Reflection.Method getHandle = Reflection.getMethod("org.bukkit.craftbukkit.CraftWorld", "getHandle");
|
||||||
private static final Reflection.MethodInvoker save = Reflection.getMethod("{nms.server.level}.WorldServer", null, Reflection.getClass("{nms.util}.IProgressUpdate"), boolean.class, boolean.class);
|
private static final Reflection.Method save = Reflection.getMethod("net.minecraft.server.level.ServerLevel", null, Reflection.getClass("net.minecraft.util.ProgressListener"), boolean.class, boolean.class);
|
||||||
@Override
|
@Override
|
||||||
public void syncSave(World world) {
|
public void syncSave(World world) {
|
||||||
save.invoke(getHandle.invoke(world), null, true, false);
|
save.invoke(getHandle.invoke(world), null, true, false);
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ package de.steamwar.core;
|
|||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.sk89q.jnbt.*;
|
import com.sk89q.jnbt.*;
|
||||||
import com.sk89q.worldedit.EmptyClipboardException;
|
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.extension.input.InputParseException;
|
import com.sk89q.worldedit.extension.input.InputParseException;
|
||||||
@@ -45,36 +44,30 @@ import com.sk89q.worldedit.world.block.BlockState;
|
|||||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||||
import com.sk89q.worldedit.world.registry.LegacyMapper;
|
import com.sk89q.worldedit.world.registry.LegacyMapper;
|
||||||
import de.steamwar.sql.NoClipboardException;
|
import de.steamwar.sql.NoClipboardException;
|
||||||
|
import de.steamwar.sql.NodeData;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
|
@SuppressWarnings("removal")
|
||||||
public class WorldEditWrapper14 implements WorldEditWrapper {
|
public class WorldEditWrapper14 implements WorldEditWrapper {
|
||||||
|
|
||||||
private static final ClipboardFormat SCHEMATIC = BuiltInClipboardFormat.MCEDIT_SCHEMATIC;
|
|
||||||
private static final ClipboardFormat SCHEM = BuiltInClipboardFormat.SPONGE_SCHEMATIC;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InputStream getPlayerClipboard(Player player, boolean schemFormat) {
|
public InputStream getPlayerClipboard(Player player) {
|
||||||
return WorldEditWrapper.getPlayerClipboard(player, schemFormat, (outputStream, clipboard, clipboardHolder) -> {
|
return WorldEditWrapper.getPlayerClipboard(player, (outputStream, clipboard, clipboardHolder) -> {
|
||||||
if(schemFormat){
|
ClipboardWriter writer = BuiltInClipboardFormat.SPONGE_SCHEMATIC.getWriter(outputStream);
|
||||||
ClipboardWriter writer = SCHEM.getWriter(outputStream);
|
writer.write(clipboard);
|
||||||
writer.write(clipboard);
|
writer.close();
|
||||||
writer.close();
|
|
||||||
}else{
|
|
||||||
SCHEMATIC.getWriter(outputStream).write(clipboard);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setPlayerClipboard(Player player, InputStream is, boolean schemFormat) {
|
public void setPlayerClipboard(Player player, InputStream is, NodeData.SchematicFormat schemFormat) {
|
||||||
Clipboard clipboard = null;
|
Clipboard clipboard = null;
|
||||||
try {
|
try {
|
||||||
clipboard = getClipboard(is, schemFormat);
|
clipboard = getClipboard(is, schemFormat);
|
||||||
@@ -90,12 +83,17 @@ public class WorldEditWrapper14 implements WorldEditWrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Clipboard getClipboard(InputStream is, boolean schemFormat) throws IOException {
|
public Clipboard getClipboard(InputStream is, NodeData.SchematicFormat schemFormat) throws IOException {
|
||||||
try {
|
try {
|
||||||
if(schemFormat){
|
|
||||||
return new SpongeSchematicReader(new NBTInputStream(is)).read();
|
switch (schemFormat) {
|
||||||
}else{
|
case SPONGE_V2:
|
||||||
return new MCEditSchematicReader(new NBTInputStream(is)).read();
|
case SPONGE_V3:
|
||||||
|
return new SpongeSchematicReader(new NBTInputStream(is), this).read();
|
||||||
|
case MCEDIT:
|
||||||
|
return new MCEditSchematicReader(new NBTInputStream(is)).read();
|
||||||
|
default:
|
||||||
|
throw new IOException("This schematic format is currently not supported");
|
||||||
}
|
}
|
||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
throw new NoClipboardException();
|
throw new NoClipboardException();
|
||||||
@@ -124,6 +122,15 @@ public class WorldEditWrapper14 implements WorldEditWrapper {
|
|||||||
return new org.bukkit.util.Vector(v.getX(), v.getY(), v.getZ());
|
return new org.bukkit.util.Vector(v.getX(), v.getY(), v.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public NodeData.SchematicFormat getNativeFormat() {
|
||||||
|
return NodeData.SchematicFormat.SPONGE_V2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, Tag> applyDataFixer(DataFixer fixer, int dataVersion, Map<String, Tag> values) {
|
||||||
|
return fixer.fixUp(DataFixer.FixTypes.BLOCK_ENTITY, new CompoundTag(values), dataVersion).getValue();
|
||||||
|
}
|
||||||
|
|
||||||
private static class MCEditSchematicReader extends NBTSchematicReader {
|
private static class MCEditSchematicReader extends NBTSchematicReader {
|
||||||
|
|
||||||
private final NBTInputStream inputStream;
|
private final NBTInputStream inputStream;
|
||||||
@@ -387,22 +394,24 @@ public class WorldEditWrapper14 implements WorldEditWrapper {
|
|||||||
inputStream.close();
|
inputStream.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private static class SpongeSchematicReader extends NBTSchematicReader {
|
public static class SpongeSchematicReader extends NBTSchematicReader {
|
||||||
|
|
||||||
private final NBTInputStream inputStream;
|
private final NBTInputStream inputStream;
|
||||||
private DataFixer fixer = null;
|
private DataFixer fixer = null;
|
||||||
private int schematicVersion = -1;
|
private int schematicVersion = -1;
|
||||||
private int dataVersion = -1;
|
private int dataVersion = -1;
|
||||||
private boolean faweSchem = false;
|
private boolean faweSchem = false;
|
||||||
|
private final WorldEditWrapper14 wrapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new instance.
|
* Create a new instance.
|
||||||
*
|
*
|
||||||
* @param inputStream the input stream to read from
|
* @param inputStream the input stream to read from
|
||||||
*/
|
*/
|
||||||
public SpongeSchematicReader(NBTInputStream inputStream) {
|
public SpongeSchematicReader(NBTInputStream inputStream, WorldEditWrapper14 wrapper) {
|
||||||
checkNotNull(inputStream);
|
checkNotNull(inputStream);
|
||||||
this.inputStream = inputStream;
|
this.inputStream = inputStream;
|
||||||
|
this.wrapper = wrapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -418,7 +427,7 @@ public class WorldEditWrapper14 implements WorldEditWrapper {
|
|||||||
dataVersion = 1631; // this is a relatively safe assumption unless someone imports a schematic from 1.12, e.g. sponge 7.1-
|
dataVersion = 1631; // this is a relatively safe assumption unless someone imports a schematic from 1.12, e.g. sponge 7.1-
|
||||||
fixer = platform.getDataFixer();
|
fixer = platform.getDataFixer();
|
||||||
return readVersion1(schematicTag);
|
return readVersion1(schematicTag);
|
||||||
} else if (schematicVersion == 2) {
|
} else if (schematicVersion == 2 || schematicVersion == 3) {
|
||||||
dataVersion = requireTag(schematic, "DataVersion", IntTag.class).getValue();
|
dataVersion = requireTag(schematic, "DataVersion", IntTag.class).getValue();
|
||||||
if (dataVersion < liveDataVersion) {
|
if (dataVersion < liveDataVersion) {
|
||||||
fixer = platform.getDataFixer();
|
fixer = platform.getDataFixer();
|
||||||
@@ -447,14 +456,18 @@ public class WorldEditWrapper14 implements WorldEditWrapper {
|
|||||||
|
|
||||||
private CompoundTag getBaseTag() throws IOException {
|
private CompoundTag getBaseTag() throws IOException {
|
||||||
NamedTag rootTag = inputStream.readNamedTag();
|
NamedTag rootTag = inputStream.readNamedTag();
|
||||||
if (!rootTag.getName().equals("Schematic")) {
|
|
||||||
throw new IOException("Tag 'Schematic' does not exist or is not first");
|
|
||||||
}
|
|
||||||
CompoundTag schematicTag = (CompoundTag) rootTag.getTag();
|
CompoundTag schematicTag = (CompoundTag) rootTag.getTag();
|
||||||
|
|
||||||
// Check
|
// Check
|
||||||
Map<String, Tag> schematic = schematicTag.getValue();
|
Map<String, Tag> schematic = schematicTag.getValue();
|
||||||
|
|
||||||
|
if (schematic.size() == 1) {
|
||||||
|
schematicTag = requireTag(schematic, "Schematic", CompoundTag.class);
|
||||||
|
schematic = schematicTag.getValue();
|
||||||
|
} else if (!rootTag.getName().equals("Schematic")) {
|
||||||
|
throw new IOException("Tag 'Schematic' does not exist or is not first");
|
||||||
|
}
|
||||||
|
|
||||||
schematicVersion = requireTag(schematic, "Version", IntTag.class).getValue();
|
schematicVersion = requireTag(schematic, "Version", IntTag.class).getValue();
|
||||||
return schematicTag;
|
return schematicTag;
|
||||||
}
|
}
|
||||||
@@ -499,12 +512,16 @@ public class WorldEditWrapper14 implements WorldEditWrapper {
|
|||||||
region = new CuboidRegion(origin, origin.add(width, height, length).subtract(BlockVector3.ONE));
|
region = new CuboidRegion(origin, origin.add(width, height, length).subtract(BlockVector3.ONE));
|
||||||
}
|
}
|
||||||
|
|
||||||
IntTag paletteMaxTag = getTag(schematic, "PaletteMax", IntTag.class);
|
Map<String, Tag> blockContainer = null;
|
||||||
Map<String, Tag> paletteObject = requireTag(schematic, "Palette", CompoundTag.class).getValue();
|
boolean v3Mode = false;
|
||||||
if (paletteMaxTag != null && paletteObject.size() != paletteMaxTag.getValue()) {
|
|
||||||
throw new IOException("Block palette size does not match expected size.");
|
if (schematicVersion == 3) {
|
||||||
|
blockContainer = requireTag(schematic, "Blocks", CompoundTag.class).getValue();
|
||||||
|
v3Mode = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Map<String, Tag> paletteObject = requireTag(v3Mode ? blockContainer: schematic, "Palette", CompoundTag.class).getValue();
|
||||||
|
|
||||||
Map<Integer, BlockState> palette = new HashMap<>();
|
Map<Integer, BlockState> palette = new HashMap<>();
|
||||||
|
|
||||||
ParserContext parserContext = new ParserContext();
|
ParserContext parserContext = new ParserContext();
|
||||||
@@ -526,12 +543,12 @@ public class WorldEditWrapper14 implements WorldEditWrapper {
|
|||||||
palette.put(id, state);
|
palette.put(id, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
byte[] blocks = requireTag(schematic, "BlockData", ByteArrayTag.class).getValue();
|
byte[] blocks = requireTag(v3Mode ? blockContainer: schematic, v3Mode ? "Data" : "BlockData", ByteArrayTag.class).getValue();
|
||||||
|
|
||||||
Map<BlockVector3, Map<String, Tag>> tileEntitiesMap = new HashMap<>();
|
Map<BlockVector3, Map<String, Tag>> tileEntitiesMap = new HashMap<>();
|
||||||
ListTag tileEntities = getTag(schematic, "BlockEntities", ListTag.class);
|
ListTag tileEntities = getTag(v3Mode ? blockContainer: schematic, "BlockEntities", ListTag.class);
|
||||||
if (tileEntities == null) {
|
if (tileEntities == null) {
|
||||||
tileEntities = getTag(schematic, "TileEntities", ListTag.class);
|
tileEntities = getTag(v3Mode ? blockContainer: schematic, "TileEntities", ListTag.class);
|
||||||
}
|
}
|
||||||
if (tileEntities != null) {
|
if (tileEntities != null) {
|
||||||
List<Map<String, Tag>> tileEntityTags = tileEntities.getValue().stream()
|
List<Map<String, Tag>> tileEntityTags = tileEntities.getValue().stream()
|
||||||
@@ -562,7 +579,7 @@ public class WorldEditWrapper14 implements WorldEditWrapper {
|
|||||||
values.remove("Id");
|
values.remove("Id");
|
||||||
values.remove("Pos");
|
values.remove("Pos");
|
||||||
if (fixer != null) {
|
if (fixer != null) {
|
||||||
tileEntity = fixer.fixUp(DataFixer.FixTypes.BLOCK_ENTITY, new CompoundTag(values), dataVersion).getValue();
|
tileEntity = wrapper.applyDataFixer(fixer, dataVersion, values);
|
||||||
} else {
|
} else {
|
||||||
tileEntity = values;
|
tileEntity = values;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.techhider;
|
package de.steamwar.techhider;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import de.steamwar.Reflection;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
|
||||||
@@ -28,21 +28,21 @@ import java.util.Set;
|
|||||||
|
|
||||||
public class BlockIds14 implements BlockIds {
|
public class BlockIds14 implements BlockIds {
|
||||||
|
|
||||||
private static final Class<?> blockStateList = Reflection.getClass("{nms.world.level.block.state}.BlockStateList");
|
private static final Class<?> blockStateList = Reflection.getClass("net.minecraft.world.level.block.state.StateDefinition");
|
||||||
private static final Class<?> fluidTypeFlowing = Reflection.getClass("{nms.world.level.material}.FluidTypeFlowing");
|
private static final Class<?> fluidTypeFlowing = Reflection.getClass("net.minecraft.world.level.material.FlowingFluid");
|
||||||
private static final Class<?> fluid = Reflection.getClass("{nms.world.level.material}.Fluid");
|
private static final Class<?> fluid = Reflection.getClass("net.minecraft.world.level.material.FluidState");
|
||||||
|
|
||||||
private static final Reflection.MethodInvoker getBlockData = Reflection.getTypedMethod(TechHider.block, null, TechHider.iBlockData);
|
private static final Reflection.Method getBlockData = Reflection.getTypedMethod(TechHider.block, null, TechHider.iBlockData);
|
||||||
@Override
|
@Override
|
||||||
public int materialToId(Material material) {
|
public int materialToId(Material material) {
|
||||||
return getCombinedId(getBlockData.invoke(getBlock(material)));
|
return getCombinedId(getBlockData.invoke(getBlock(material)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Reflection.MethodInvoker getStates = Reflection.getTypedMethod(TechHider.block, null, blockStateList);
|
private static final Reflection.Method getStates = Reflection.getTypedMethod(TechHider.block, null, blockStateList);
|
||||||
private static final Reflection.MethodInvoker getStateList = Reflection.getTypedMethod(blockStateList, null, ImmutableList.class);
|
private static final Reflection.Method getStateList = Reflection.getTypedMethod(blockStateList, null, ImmutableList.class);
|
||||||
private static final Object water = Reflection.getTypedMethod(fluidTypeFlowing, null, fluid, boolean.class).invoke(Reflection.getField(Reflection.getClass("{nms.world.level.material}.FluidTypes"), fluidTypeFlowing, 1).get(null), false);
|
private static final Object water = Reflection.getTypedMethod(fluidTypeFlowing, null, fluid, boolean.class).invoke(Reflection.getField(Reflection.getClass("net.minecraft.world.level.material.Fluids"), fluidTypeFlowing, 1).get(null), false);
|
||||||
private static final Iterable<?> registryBlockId = (Iterable<?>) Reflection.getField(TechHider.block, Reflection.getClass("{nms.core}.RegistryBlockID"), 0).get(null);
|
private static final Iterable<?> registryBlockId = (Iterable<?>) Reflection.getField(TechHider.block, Reflection.getClass("net.minecraft.core.IdMapper"), 0).get(null);
|
||||||
private static final Reflection.MethodInvoker getFluid = Reflection.getTypedMethod(TechHider.iBlockData, null, fluid);
|
private static final Reflection.Method getFluid = Reflection.getTypedMethod(TechHider.iBlockData, null, fluid);
|
||||||
@Override
|
@Override
|
||||||
public Set<Integer> materialToAllIds(Material material) {
|
public Set<Integer> materialToAllIds(Material material) {
|
||||||
Set<Integer> ids = new HashSet<>();
|
Set<Integer> ids = new HashSet<>();
|
||||||
@@ -61,12 +61,12 @@ public class BlockIds14 implements BlockIds {
|
|||||||
return ids;
|
return ids;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Reflection.MethodInvoker getBlock = Reflection.getTypedMethod(TechHider.craftMagicNumbers, "getBlock", TechHider.block, Material.class);
|
private static final Reflection.Method getBlock = Reflection.getTypedMethod(TechHider.craftMagicNumbers, "getBlock", TechHider.block, Material.class);
|
||||||
private Object getBlock(Material material) {
|
private Object getBlock(Material material) {
|
||||||
return getBlock.invoke(null, material);
|
return getBlock.invoke(null, material);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Reflection.MethodInvoker getCombinedId = Reflection.getTypedMethod(TechHider.block, null, int.class, TechHider.iBlockData);
|
private static final Reflection.Method getCombinedId = Reflection.getTypedMethod(TechHider.block, null, int.class, TechHider.iBlockData);
|
||||||
private int getCombinedId(Object blockData) {
|
private int getCombinedId(Object blockData) {
|
||||||
return (int) getCombinedId.invoke(null, blockData);
|
return (int) getCombinedId.invoke(null, blockData);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.techhider;
|
package de.steamwar.techhider;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import de.steamwar.Reflection;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.function.BiFunction;
|
import java.util.function.BiFunction;
|
||||||
@@ -30,8 +30,8 @@ public class ProtocolWrapper14 extends ProtocolWrapper8 {
|
|||||||
@Override
|
@Override
|
||||||
public BiFunction<Player, Object, Object> blockBreakHiderGenerator(Class<?> blockBreakPacket, TechHider techHider) {
|
public BiFunction<Player, Object, Object> blockBreakHiderGenerator(Class<?> blockBreakPacket, TechHider techHider) {
|
||||||
UnaryOperator<Object> blockBreakCloner = ProtocolUtils.shallowCloneGenerator(blockBreakPacket);
|
UnaryOperator<Object> blockBreakCloner = ProtocolUtils.shallowCloneGenerator(blockBreakPacket);
|
||||||
Reflection.FieldAccessor<?> blockBreakPosition = Reflection.getField(blockBreakPacket, TechHider.blockPosition, 0);
|
Reflection.Field<?> blockBreakPosition = Reflection.getField(blockBreakPacket, TechHider.blockPosition, 0);
|
||||||
Reflection.FieldAccessor<?> blockBreakBlockData = Reflection.getField(blockBreakPacket, TechHider.iBlockData, 0);
|
Reflection.Field<?> blockBreakBlockData = Reflection.getField(blockBreakPacket, TechHider.iBlockData, 0);
|
||||||
|
|
||||||
return (p, packet) -> {
|
return (p, packet) -> {
|
||||||
switch (techHider.getLocationEvaluator().checkBlockPos(p, blockBreakPosition.get(packet))) {
|
switch (techHider.getLocationEvaluator().checkBlockPos(p, blockBreakPosition.get(packet))) {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.core;
|
package de.steamwar.core;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import de.steamwar.Reflection;
|
||||||
import com.comphenix.tinyprotocol.TinyProtocol;
|
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||||
import net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket;
|
import net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket;
|
||||||
import net.minecraft.world.level.World;
|
import net.minecraft.world.level.World;
|
||||||
@@ -29,8 +29,8 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
public class CraftbukkitWrapper18 implements CraftbukkitWrapper.ICraftbukkitWrapper {
|
public class CraftbukkitWrapper18 implements CraftbukkitWrapper.ICraftbukkitWrapper {
|
||||||
|
|
||||||
private static final Reflection.MethodInvoker getHandle = Reflection.getMethod("{obc}.CraftChunk", "getHandle");
|
private static final Reflection.Method getHandle = Reflection.getMethod("org.bukkit.craftbukkit.CraftChunk", "getHandle");
|
||||||
private static final Reflection.MethodInvoker getLightEngine = Reflection.getTypedMethod(World.class, null, LightEngine.class);
|
private static final Reflection.Method getLightEngine = Reflection.getTypedMethod(World.class, null, LightEngine.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendChunk(Player p, int chunkX, int chunkZ) {
|
public void sendChunk(Player p, int chunkX, int chunkZ) {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.core;
|
package de.steamwar.core;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import de.steamwar.Reflection;
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
import com.mojang.datafixers.util.Pair;
|
import com.mojang.datafixers.util.Pair;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
@@ -30,16 +30,16 @@ import java.util.List;
|
|||||||
|
|
||||||
public class ProtocolWrapper18 implements ProtocolWrapper {
|
public class ProtocolWrapper18 implements ProtocolWrapper {
|
||||||
|
|
||||||
private static final Reflection.FieldAccessor<List> equipmentStack = Reflection.getField(equipmentPacket, List.class, 0);
|
private static final Reflection.Field<List> equipmentStack = Reflection.getField(equipmentPacket, List.class, 0);
|
||||||
@Override
|
@Override
|
||||||
public void setEquipmentPacketStack(Object packet, Object slot, Object stack) {
|
public void setEquipmentPacketStack(Object packet, Object slot, Object stack) {
|
||||||
equipmentStack.set(packet, Collections.singletonList(new Pair<>(slot, stack)));
|
equipmentStack.set(packet, Collections.singletonList(new Pair<>(slot, stack)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Class<?> playerInfoPacket = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutPlayerInfo");
|
private static final Class<?> playerInfoPacket = Reflection.getClass("net.minecraft.network.protocol.game.PacketPlayOutPlayerInfo");
|
||||||
private static final Class<?> playerInfoActionClass = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutPlayerInfo$EnumPlayerInfoAction");
|
private static final Class<?> playerInfoActionClass = Reflection.getClass("net.minecraft.network.protocol.game.PacketPlayOutPlayerInfo$EnumPlayerInfoAction");
|
||||||
private static final Reflection.FieldAccessor<?> playerInfoAction = Reflection.getField(playerInfoPacket, playerInfoActionClass, 0);
|
private static final Reflection.Field<?> playerInfoAction = Reflection.getField(playerInfoPacket, playerInfoActionClass, 0);
|
||||||
private static final Reflection.FieldAccessor<List> playerInfoData = Reflection.getField(playerInfoPacket, List.class, 0);
|
private static final Reflection.Field<List> playerInfoData = Reflection.getField(playerInfoPacket, List.class, 0);
|
||||||
private static final EnumMap<PlayerInfoAction, Object> actions = new EnumMap<>(PlayerInfoAction.class);
|
private static final EnumMap<PlayerInfoAction, Object> actions = new EnumMap<>(PlayerInfoAction.class);
|
||||||
static {
|
static {
|
||||||
Object[] nativeActions = playerInfoActionClass.getEnumConstants();
|
Object[] nativeActions = playerInfoActionClass.getEnumConstants();
|
||||||
@@ -47,8 +47,8 @@ public class ProtocolWrapper18 implements ProtocolWrapper {
|
|||||||
actions.put(PlayerInfoAction.GAMEMODE, nativeActions[1]);
|
actions.put(PlayerInfoAction.GAMEMODE, nativeActions[1]);
|
||||||
actions.put(PlayerInfoAction.REMOVE, nativeActions[4]);
|
actions.put(PlayerInfoAction.REMOVE, nativeActions[4]);
|
||||||
}
|
}
|
||||||
private static final Class<?> iChatBaseComponent = Reflection.getClass("{nms.network.chat}.IChatBaseComponent");
|
private static final Class<?> iChatBaseComponent = Reflection.getClass("net.minecraft.network.chat.Component");
|
||||||
private static final Reflection.ConstructorInvoker playerInfoDataConstructor = Reflection.getConstructor("{nms.network.protocol.game}.PacketPlayOutPlayerInfo$PlayerInfoData", GameProfile.class, int.class, enumGamemode, iChatBaseComponent);
|
private static final Reflection.Constructor playerInfoDataConstructor = Reflection.getConstructor("net.minecraft.network.protocol.game.PacketPlayOutPlayerInfo$PlayerInfoData", GameProfile.class, int.class, enumGamemode, iChatBaseComponent);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
|
|||||||
@@ -19,25 +19,18 @@
|
|||||||
|
|
||||||
package de.steamwar.core;
|
package de.steamwar.core;
|
||||||
|
|
||||||
import com.sk89q.jnbt.NBTInputStream;
|
import com.sk89q.jnbt.AdventureNBTConverter;
|
||||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
import com.sk89q.worldedit.extent.clipboard.io.*;
|
import com.sk89q.jnbt.Tag;
|
||||||
import de.steamwar.sql.NoClipboardException;
|
import com.sk89q.worldedit.world.DataFixer;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.util.Map;
|
||||||
import java.io.InputStream;
|
|
||||||
|
|
||||||
public class WorldEditWrapper18 extends WorldEditWrapper14 {
|
public class WorldEditWrapper18 extends WorldEditWrapper14 {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("removal")
|
@SuppressWarnings("removal")
|
||||||
public Clipboard getClipboard(InputStream is, boolean schemFormat) throws IOException {
|
public Map<String, Tag> applyDataFixer(DataFixer fixer, int dataVersion, Map<String, Tag> values) {
|
||||||
NBTInputStream nbtStream = new NBTInputStream(is);
|
return ((CompoundTag) AdventureNBTConverter.fromAdventure(fixer.fixUp(DataFixer.FixTypes.BLOCK_ENTITY, new CompoundTag(values).asBinaryTag(), dataVersion))).getValue();
|
||||||
//Use FAWE reader due to FAWE capability of reading corrupt FAWE schems
|
|
||||||
try {
|
|
||||||
return (schemFormat ? new SpongeSchematicReader(nbtStream) : new MCEditSchematicReader(nbtStream)).read();
|
|
||||||
} catch (NullPointerException e) {
|
|
||||||
throw new NoClipboardException();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.techhider;
|
package de.steamwar.techhider;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import de.steamwar.Reflection;
|
||||||
import de.steamwar.core.Core;
|
import de.steamwar.core.Core;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
@@ -46,12 +46,12 @@ public class ChunkHider18 implements ChunkHider {
|
|||||||
private static final UnaryOperator<Object> chunkPacketCloner = ProtocolUtils.shallowCloneGenerator(ClientboundLevelChunkWithLightPacket.class);
|
private static final UnaryOperator<Object> chunkPacketCloner = ProtocolUtils.shallowCloneGenerator(ClientboundLevelChunkWithLightPacket.class);
|
||||||
private static final UnaryOperator<Object> chunkDataCloner = ProtocolUtils.shallowCloneGenerator(ClientboundLevelChunkPacketData.class);
|
private static final UnaryOperator<Object> chunkDataCloner = ProtocolUtils.shallowCloneGenerator(ClientboundLevelChunkPacketData.class);
|
||||||
|
|
||||||
private static final Reflection.FieldAccessor<Integer> chunkXField = Reflection.getField(ClientboundLevelChunkWithLightPacket.class, int.class, 0);
|
private static final Reflection.Field<Integer> chunkXField = Reflection.getField(ClientboundLevelChunkWithLightPacket.class, int.class, 0);
|
||||||
private static final Reflection.FieldAccessor<Integer> chunkZField = Reflection.getField(ClientboundLevelChunkWithLightPacket.class, int.class, 1);
|
private static final Reflection.Field<Integer> chunkZField = Reflection.getField(ClientboundLevelChunkWithLightPacket.class, int.class, 1);
|
||||||
private static final Reflection.FieldAccessor<ClientboundLevelChunkPacketData> chunkData = Reflection.getField(ClientboundLevelChunkWithLightPacket.class, ClientboundLevelChunkPacketData.class, 0);
|
private static final Reflection.Field<ClientboundLevelChunkPacketData> chunkData = Reflection.getField(ClientboundLevelChunkWithLightPacket.class, ClientboundLevelChunkPacketData.class, 0);
|
||||||
|
|
||||||
private static final Reflection.FieldAccessor<byte[]> dataField = Reflection.getField(ClientboundLevelChunkPacketData.class, byte[].class, 0);
|
private static final Reflection.Field<byte[]> dataField = Reflection.getField(ClientboundLevelChunkPacketData.class, byte[].class, 0);
|
||||||
private static final Reflection.FieldAccessor<List> tileEntities = Reflection.getField(ClientboundLevelChunkPacketData.class, List.class, 0);
|
private static final Reflection.Field<List> tileEntities = Reflection.getField(ClientboundLevelChunkPacketData.class, List.class, 0);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BiFunction<Player, Object, Object> chunkHiderGenerator(TechHider techHider) {
|
public BiFunction<Player, Object, Object> chunkHiderGenerator(TechHider techHider) {
|
||||||
@@ -87,11 +87,11 @@ public class ChunkHider18 implements ChunkHider {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Class<?> tileEntity = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundLevelChunkPacketData$a");
|
public static final Class<?> tileEntity = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundLevelChunkPacketData$BlockEntityInfo");
|
||||||
protected static final Reflection.FieldAccessor<TileEntityTypes> entityType = Reflection.getField(tileEntity, TileEntityTypes.class, 0);
|
protected static final Reflection.Field<TileEntityTypes> entityType = Reflection.getField(tileEntity, TileEntityTypes.class, 0);
|
||||||
private static final IRegistry<?> tileEntityTypes = Reflection.getField(Core.getVersion() > 18 ? Reflection.getClass("net.minecraft.core.registries.BuiltInRegistries") : IRegistry.class, IRegistry.class, 0, TileEntityTypes.class).get(null);
|
private static final IRegistry<?> tileEntityTypes = Reflection.getField(Core.getVersion() > 18 ? Reflection.getClass("net.minecraft.core.registries.BuiltInRegistries") : IRegistry.class, IRegistry.class, 0, TileEntityTypes.class).get(null);
|
||||||
private static final Reflection.MethodInvoker getKey = Reflection.getTypedMethod(IRegistry.class, null, MinecraftKey.class, Object.class);
|
private static final Reflection.Method getKey = Reflection.getTypedMethod(IRegistry.class, null, MinecraftKey.class, Object.class);
|
||||||
private static final Reflection.MethodInvoker getName = Reflection.getTypedMethod(MinecraftKey.class, null, String.class);
|
private static final Reflection.Method getName = Reflection.getTypedMethod(MinecraftKey.class, null, String.class);
|
||||||
protected boolean tileEntityVisible(Set<String> hiddenBlockEntities, Object tile) {
|
protected boolean tileEntityVisible(Set<String> hiddenBlockEntities, Object tile) {
|
||||||
return !hiddenBlockEntities.contains((String) getName.invoke(getKey.invoke(tileEntityTypes, entityType.get(tile))));
|
return !hiddenBlockEntities.contains((String) getName.invoke(getKey.invoke(tileEntityTypes, entityType.get(tile))));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.techhider;
|
package de.steamwar.techhider;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import de.steamwar.Reflection;
|
||||||
import net.minecraft.core.SectionPosition;
|
import net.minecraft.core.SectionPosition;
|
||||||
import net.minecraft.network.protocol.game.PacketPlayOutBlockBreak;
|
import net.minecraft.network.protocol.game.PacketPlayOutBlockBreak;
|
||||||
import net.minecraft.world.level.block.entity.TileEntitySign;
|
import net.minecraft.world.level.block.entity.TileEntitySign;
|
||||||
@@ -32,9 +32,9 @@ import java.util.function.BiFunction;
|
|||||||
|
|
||||||
public class ProtocolWrapper18 implements ProtocolWrapper {
|
public class ProtocolWrapper18 implements ProtocolWrapper {
|
||||||
|
|
||||||
private static final Reflection.FieldAccessor<SectionPosition> multiBlockChangeChunk = Reflection.getField(TechHider.multiBlockChangePacket, SectionPosition.class, 0);
|
private static final Reflection.Field<SectionPosition> multiBlockChangeChunk = Reflection.getField(TechHider.multiBlockChangePacket, SectionPosition.class, 0);
|
||||||
private static final Reflection.FieldAccessor<short[]> multiBlockChangePos = Reflection.getField(TechHider.multiBlockChangePacket, short[].class, 0);
|
private static final Reflection.Field<short[]> multiBlockChangePos = Reflection.getField(TechHider.multiBlockChangePacket, short[].class, 0);
|
||||||
private static final Reflection.FieldAccessor<IBlockData[]> multiBlockChangeBlocks = Reflection.getField(TechHider.multiBlockChangePacket, IBlockData[].class, 0);
|
private static final Reflection.Field<IBlockData[]> multiBlockChangeBlocks = Reflection.getField(TechHider.multiBlockChangePacket, IBlockData[].class, 0);
|
||||||
@Override
|
@Override
|
||||||
public BiFunction<Player, Object, Object> multiBlockChangeGenerator(TechHider techHider) {
|
public BiFunction<Player, Object, Object> multiBlockChangeGenerator(TechHider techHider) {
|
||||||
return (p, packet) -> {
|
return (p, packet) -> {
|
||||||
@@ -81,7 +81,7 @@ public class ProtocolWrapper18 implements ProtocolWrapper {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Reflection.FieldAccessor<TileEntityTypes> tileEntityType = Reflection.getField(TechHider.tileEntityDataPacket, TileEntityTypes.class, 0);
|
private static final Reflection.Field<TileEntityTypes> tileEntityType = Reflection.getField(TechHider.tileEntityDataPacket, TileEntityTypes.class, 0);
|
||||||
private static final TileEntityTypes<?> signType = Reflection.getField(TileEntityTypes.class, TileEntityTypes.class, 0, TileEntitySign.class).get(null);
|
private static final TileEntityTypes<?> signType = Reflection.getField(TileEntityTypes.class, TileEntityTypes.class, 0, TileEntitySign.class).get(null);
|
||||||
@Override
|
@Override
|
||||||
public boolean unfilteredTileEntityDataAction(Object packet) {
|
public boolean unfilteredTileEntityDataAction(Object packet) {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.core;
|
package de.steamwar.core;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import de.steamwar.Reflection;
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
import com.mojang.datafixers.util.Pair;
|
import com.mojang.datafixers.util.Pair;
|
||||||
import net.minecraft.SystemUtils;
|
import net.minecraft.SystemUtils;
|
||||||
@@ -35,15 +35,15 @@ import java.util.function.LongSupplier;
|
|||||||
|
|
||||||
public class ProtocolWrapper19 implements ProtocolWrapper {
|
public class ProtocolWrapper19 implements ProtocolWrapper {
|
||||||
|
|
||||||
private static final Reflection.FieldAccessor<List> equipmentStack = Reflection.getField(equipmentPacket, List.class, 0);
|
private static final Reflection.Field<List> equipmentStack = Reflection.getField(equipmentPacket, List.class, 0);
|
||||||
@Override
|
@Override
|
||||||
public void setEquipmentPacketStack(Object packet, Object slot, Object stack) {
|
public void setEquipmentPacketStack(Object packet, Object slot, Object stack) {
|
||||||
equipmentStack.set(packet, Collections.singletonList(new Pair<>(slot, stack)));
|
equipmentStack.set(packet, Collections.singletonList(new Pair<>(slot, stack)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Reflection.ConstructorInvoker removePacketConstructor = Reflection.getConstructor(ClientboundPlayerInfoRemovePacket.class, List.class);
|
private static final Reflection.Constructor removePacketConstructor = Reflection.getConstructor(ClientboundPlayerInfoRemovePacket.class, List.class);
|
||||||
private static final Reflection.FieldAccessor<EnumSet> updateActions = Reflection.getField(ClientboundPlayerInfoUpdatePacket.class, EnumSet.class, 0);
|
private static final Reflection.Field<EnumSet> updateActions = Reflection.getField(ClientboundPlayerInfoUpdatePacket.class, EnumSet.class, 0);
|
||||||
private static final Reflection.FieldAccessor<List> updatePlayers = Reflection.getField(ClientboundPlayerInfoUpdatePacket.class, List.class, 0);
|
private static final Reflection.Field<List> updatePlayers = Reflection.getField(ClientboundPlayerInfoUpdatePacket.class, List.class, 0);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.core;
|
package de.steamwar.core;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import de.steamwar.Reflection;
|
||||||
import com.comphenix.tinyprotocol.TinyProtocol;
|
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||||
import net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket;
|
import net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket;
|
||||||
import net.minecraft.world.level.World;
|
import net.minecraft.world.level.World;
|
||||||
@@ -30,8 +30,8 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
public class CraftbukkitWrapper20 implements CraftbukkitWrapper.ICraftbukkitWrapper {
|
public class CraftbukkitWrapper20 implements CraftbukkitWrapper.ICraftbukkitWrapper {
|
||||||
|
|
||||||
private static final Reflection.MethodInvoker getHandle = Reflection.getMethod("{obc}.CraftChunk", "getHandle", ChunkStatus.class);
|
private static final Reflection.Method getHandle = Reflection.getMethod("org.bukkit.craftbukkit.CraftChunk", "getHandle", ChunkStatus.class);
|
||||||
private static final Reflection.MethodInvoker getLightEngine = Reflection.getTypedMethod(World.class, null, LevelLightEngine.class);
|
private static final Reflection.Method getLightEngine = Reflection.getTypedMethod(World.class, null, LevelLightEngine.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendChunk(Player p, int chunkX, int chunkZ) {
|
public void sendChunk(Player p, int chunkX, int chunkZ) {
|
||||||
|
|||||||
@@ -21,7 +21,13 @@ plugins {
|
|||||||
steamwar.java
|
steamwar.java
|
||||||
}
|
}
|
||||||
|
|
||||||
|
java {
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_21
|
||||||
|
targetCompatibility = JavaVersion.VERSION_21
|
||||||
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
compileOnly(project(":CommonCore", "default"))
|
||||||
compileOnly(project(":SpigotCore:SpigotCore_Main", "default"))
|
compileOnly(project(":SpigotCore:SpigotCore_Main", "default"))
|
||||||
compileOnly(project(":SpigotCore:SpigotCore_18", "default"))
|
compileOnly(project(":SpigotCore:SpigotCore_18", "default"))
|
||||||
compileOnly(project(":SpigotCore:SpigotCore_14", "default"))
|
compileOnly(project(":SpigotCore:SpigotCore_14", "default"))
|
||||||
@@ -29,16 +35,6 @@ dependencies {
|
|||||||
|
|
||||||
compileOnly(libs.fawe21)
|
compileOnly(libs.fawe21)
|
||||||
|
|
||||||
compileOnly(libs.paperapi21) {
|
compileOnly(libs.paperapi21)
|
||||||
attributes {
|
compileOnly(libs.nms21)
|
||||||
// Very Hacky, but it works
|
|
||||||
attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 21)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
compileOnly(libs.nms21) {
|
|
||||||
attributes {
|
|
||||||
// Very Hacky, but it works
|
|
||||||
attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 21)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.core;
|
package de.steamwar.core;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import de.steamwar.Reflection;
|
||||||
import net.minecraft.world.entity.PositionMoveRotation;
|
import net.minecraft.world.entity.PositionMoveRotation;
|
||||||
import net.minecraft.world.phys.Vec3D;
|
import net.minecraft.world.phys.Vec3D;
|
||||||
|
|
||||||
@@ -28,12 +28,12 @@ public class BountifulWrapper21 extends BountifulWrapper9 {
|
|||||||
@Override
|
@Override
|
||||||
public BountifulWrapper.PositionSetter getPositionSetter(Class<?> packetClass, int fieldOffset) {
|
public BountifulWrapper.PositionSetter getPositionSetter(Class<?> packetClass, int fieldOffset) {
|
||||||
try {
|
try {
|
||||||
Reflection.FieldAccessor<PositionMoveRotation> field = Reflection.getField(packetClass, PositionMoveRotation.class, 0);
|
Reflection.Field<PositionMoveRotation> field = Reflection.getField(packetClass, PositionMoveRotation.class, 0);
|
||||||
|
|
||||||
return (packet, x, y, z, pitch, yaw) -> {
|
return (packet, x, y, z, pitch, yaw) -> {
|
||||||
PositionMoveRotation pos = field.get(packet);
|
PositionMoveRotation pos = field.get(packet);
|
||||||
|
|
||||||
field.set(packet, new PositionMoveRotation(new Vec3D(x, y, z), pos.b(), pitch, yaw));
|
field.set(packet, new PositionMoveRotation(new Vec3D(x, y, z), pos.b(), yaw, pitch));
|
||||||
};
|
};
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
return super.getPositionSetter(packetClass, fieldOffset);
|
return super.getPositionSetter(packetClass, fieldOffset);
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.core;
|
package de.steamwar.core;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import de.steamwar.Reflection;
|
||||||
import com.comphenix.tinyprotocol.TinyProtocol;
|
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||||
import net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket;
|
import net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket;
|
||||||
import net.minecraft.world.level.World;
|
import net.minecraft.world.level.World;
|
||||||
@@ -30,8 +30,8 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
public class CraftbukkitWrapper21 implements CraftbukkitWrapper.ICraftbukkitWrapper {
|
public class CraftbukkitWrapper21 implements CraftbukkitWrapper.ICraftbukkitWrapper {
|
||||||
|
|
||||||
private static final Reflection.MethodInvoker getHandle = Reflection.getMethod("{obc}.CraftChunk", "getHandle", ChunkStatus.class);
|
private static final Reflection.Method getHandle = Reflection.getMethod("org.bukkit.craftbukkit.CraftChunk", "getHandle", ChunkStatus.class);
|
||||||
private static final Reflection.MethodInvoker getLightEngine = Reflection.getTypedMethod(World.class, null, LevelLightEngine.class);
|
private static final Reflection.Method getLightEngine = Reflection.getTypedMethod(World.class, null, LevelLightEngine.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendChunk(Player p, int chunkX, int chunkZ) {
|
public void sendChunk(Player p, int chunkX, int chunkZ) {
|
||||||
|
|||||||
@@ -20,33 +20,30 @@
|
|||||||
package de.steamwar.core;
|
package de.steamwar.core;
|
||||||
|
|
||||||
import com.fastasyncworldedit.core.extent.clipboard.io.FastSchematicReaderV2;
|
import com.fastasyncworldedit.core.extent.clipboard.io.FastSchematicReaderV2;
|
||||||
import com.fastasyncworldedit.core.extent.clipboard.io.FastSchematicReaderV3;
|
|
||||||
import com.sk89q.jnbt.NBTInputStream;
|
import com.sk89q.jnbt.NBTInputStream;
|
||||||
import com.sk89q.worldedit.extension.platform.Actor;
|
import com.sk89q.worldedit.extension.platform.Actor;
|
||||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||||
import com.sk89q.worldedit.extent.clipboard.io.BuiltInClipboardFormat;
|
import com.sk89q.worldedit.extent.clipboard.io.BuiltInClipboardFormat;
|
||||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardWriter;
|
import com.sk89q.worldedit.extent.clipboard.io.ClipboardWriter;
|
||||||
import com.sk89q.worldedit.extent.clipboard.io.MCEditSchematicReader;
|
import com.sk89q.worldedit.extent.clipboard.io.MCEditSchematicReader;
|
||||||
import com.sk89q.worldedit.extent.clipboard.io.sponge.SpongeSchematicV1Reader;
|
import com.sk89q.worldedit.extent.clipboard.io.sponge.SpongeSchematicV2Reader;
|
||||||
|
import com.sk89q.worldedit.extent.clipboard.io.sponge.SpongeSchematicV3Reader;
|
||||||
import com.sk89q.worldedit.math.Vector3;
|
import com.sk89q.worldedit.math.Vector3;
|
||||||
import com.sk89q.worldedit.math.transform.Transform;
|
import com.sk89q.worldedit.math.transform.Transform;
|
||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||||
|
import de.steamwar.sql.NodeData;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
import org.enginehub.linbus.stream.LinBinaryIO;
|
import org.enginehub.linbus.stream.LinBinaryIO;
|
||||||
import org.enginehub.linbus.stream.LinStream;
|
|
||||||
import org.enginehub.linbus.tree.LinCompoundTag;
|
|
||||||
import org.enginehub.linbus.tree.LinRootEntry;
|
|
||||||
import org.enginehub.linbus.tree.LinTagType;
|
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
|
||||||
public class WorldEditWrapper21 implements WorldEditWrapper {
|
public class WorldEditWrapper21 implements WorldEditWrapper {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InputStream getPlayerClipboard(Player player, boolean schemFormat) {
|
public InputStream getPlayerClipboard(Player player) {
|
||||||
return WorldEditWrapper.getPlayerClipboard(player, schemFormat, (outputStream, clipboard, clipboardHolder) -> {
|
return WorldEditWrapper.getPlayerClipboard(player, (outputStream, clipboard, clipboardHolder) -> {
|
||||||
ClipboardWriter writer = BuiltInClipboardFormat.FAST_V3.getWriter(outputStream);
|
ClipboardWriter writer = BuiltInClipboardFormat.FAST_V3.getWriter(outputStream);
|
||||||
writer.write(clipboard);
|
writer.write(clipboard);
|
||||||
writer.close();
|
writer.close();
|
||||||
@@ -54,7 +51,7 @@ public class WorldEditWrapper21 implements WorldEditWrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setPlayerClipboard(Player player, InputStream is, boolean schemFormat) {
|
public void setPlayerClipboard(Player player, InputStream is, NodeData.SchematicFormat schemFormat) {
|
||||||
Clipboard clipboard = null;
|
Clipboard clipboard = null;
|
||||||
try {
|
try {
|
||||||
clipboard = getClipboard(is, schemFormat);
|
clipboard = getClipboard(is, schemFormat);
|
||||||
@@ -70,35 +67,13 @@ public class WorldEditWrapper21 implements WorldEditWrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Clipboard getClipboard(InputStream is, boolean schemFormat) throws IOException {
|
@SuppressWarnings("removal")
|
||||||
if (!schemFormat) {
|
public Clipboard getClipboard(InputStream is, NodeData.SchematicFormat schemFormat) throws IOException {
|
||||||
return new MCEditSchematicReader(new NBTInputStream(is)).read();
|
return switch (schemFormat) {
|
||||||
} else {
|
case MCEDIT -> new MCEditSchematicReader(new NBTInputStream(is)).read();
|
||||||
BufferedInputStream bis = new BufferedInputStream(is);
|
case SPONGE_V2 -> new SpongeSchematicV2Reader(LinBinaryIO.read(new DataInputStream(is))).read();
|
||||||
|
case SPONGE_V3 -> new SpongeSchematicV3Reader(LinBinaryIO.read(new DataInputStream(is))).read();
|
||||||
bis.mark(Integer.MAX_VALUE);
|
};
|
||||||
|
|
||||||
LinStream linStream = LinBinaryIO.read(new DataInputStream(bis));
|
|
||||||
|
|
||||||
LinCompoundTag entry = LinRootEntry.readFrom(linStream).value();
|
|
||||||
|
|
||||||
if (entry.value().size() == 1) {
|
|
||||||
entry = entry.getTag("Schematic", LinTagType.compoundTag());
|
|
||||||
}
|
|
||||||
|
|
||||||
bis.reset();
|
|
||||||
|
|
||||||
switch (entry.getTag("Version", LinTagType.intTag()).valueAsInt()) {
|
|
||||||
case 1:
|
|
||||||
return new SpongeSchematicV1Reader(entry.linStream()).read();
|
|
||||||
case 2:
|
|
||||||
return new FastSchematicReaderV2(new NBTInputStream(bis)).read();
|
|
||||||
case 3:
|
|
||||||
return new FastSchematicReaderV3(bis).read();
|
|
||||||
default:
|
|
||||||
throw new IOException("Unknown schematic version");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -122,4 +97,9 @@ public class WorldEditWrapper21 implements WorldEditWrapper {
|
|||||||
v = transform.apply(v);
|
v = transform.apply(v);
|
||||||
return new org.bukkit.util.Vector(v.x(), v.y(), v.z());
|
return new org.bukkit.util.Vector(v.x(), v.y(), v.z());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public NodeData.SchematicFormat getNativeFormat() {
|
||||||
|
return NodeData.SchematicFormat.SPONGE_V3;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,13 +19,12 @@
|
|||||||
|
|
||||||
package de.steamwar.core;
|
package de.steamwar.core;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import de.steamwar.Reflection;
|
||||||
import net.md_5.bungee.api.ChatMessageType;
|
import net.md_5.bungee.api.ChatMessageType;
|
||||||
import net.md_5.bungee.api.chat.BaseComponent;
|
import net.md_5.bungee.api.chat.BaseComponent;
|
||||||
import net.minecraft.server.v1_8_R3.ChatComponentText;
|
import net.minecraft.server.v1_8_R3.ChatComponentText;
|
||||||
import net.minecraft.server.v1_8_R3.MathHelper;
|
import net.minecraft.server.v1_8_R3.MathHelper;
|
||||||
import net.minecraft.server.v1_8_R3.PacketPlayOutChat;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutChat;
|
||||||
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityTeleport;
|
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -50,8 +49,8 @@ public class BountifulWrapper8 implements BountifulWrapper.IBountifulWrapper {
|
|||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Class<?> watchableObject = Reflection.getClass("{nms}.DataWatcher$WatchableObject");
|
private static final Class<?> watchableObject = Reflection.getClass("net.minecraft.DataWatcher$WatchableObject");
|
||||||
private static final Reflection.ConstructorInvoker watchableObjectConstructor = Reflection.getConstructor(watchableObject, int.class, int.class, Object.class);
|
private static final Reflection.Constructor watchableObjectConstructor = Reflection.getConstructor(watchableObject, int.class, int.class, Object.class);
|
||||||
private static final Map<Class<?>, Integer> watchableDatatypes = new HashMap<>();
|
private static final Map<Class<?>, Integer> watchableDatatypes = new HashMap<>();
|
||||||
static {
|
static {
|
||||||
watchableDatatypes.put(byte.class, 0);
|
watchableDatatypes.put(byte.class, 0);
|
||||||
@@ -68,28 +67,28 @@ public class BountifulWrapper8 implements BountifulWrapper.IBountifulWrapper {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BountifulWrapper.PositionSetter getPositionSetter(Class<?> packetClass, int fieldOffset) {
|
public BountifulWrapper.PositionSetter getPositionSetter(Class<?> packetClass, int fieldOffset) {
|
||||||
Reflection.FieldAccessor<Integer> posX = Reflection.getField(packetClass, int.class, fieldOffset);
|
Reflection.Field<Integer> posX = Reflection.getField(packetClass, int.class, fieldOffset);
|
||||||
Reflection.FieldAccessor<Integer> posY = Reflection.getField(packetClass, int.class, fieldOffset +1);
|
Reflection.Field<Integer> posY = Reflection.getField(packetClass, int.class, fieldOffset +1);
|
||||||
Reflection.FieldAccessor<Integer> posZ = Reflection.getField(packetClass, int.class, fieldOffset +2);
|
Reflection.Field<Integer> posZ = Reflection.getField(packetClass, int.class, fieldOffset +2);
|
||||||
Reflection.FieldAccessor<Byte> lookPitch = Reflection.getField(packetClass, byte.class, 0);
|
Reflection.Field<Byte> lookYaw = Reflection.getField(packetClass, byte.class, 0);
|
||||||
Reflection.FieldAccessor<Byte> lookYaw = Reflection.getField(packetClass, byte.class, 1);
|
Reflection.Field<Byte> lookPitch = Reflection.getField(packetClass, byte.class, 1);
|
||||||
|
|
||||||
return (packet, x, y, z, pitch, yaw) -> {
|
return (packet, x, y, z, pitch, yaw) -> {
|
||||||
posX.set(packet, MathHelper.floor(x * 32));
|
posX.set(packet, MathHelper.floor(x * 32));
|
||||||
posY.set(packet, MathHelper.floor(y * 32));
|
posY.set(packet, MathHelper.floor(y * 32));
|
||||||
posZ.set(packet, MathHelper.floor(z * 32));
|
posZ.set(packet, MathHelper.floor(z * 32));
|
||||||
lookPitch.set(packet, (byte)(pitch * 256 / 360));
|
|
||||||
lookYaw.set(packet, (byte)(yaw * 256 / 360));
|
lookYaw.set(packet, (byte)(yaw * 256 / 360));
|
||||||
|
lookPitch.set(packet, (byte)(pitch * 256 / 360));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BountifulWrapper.PositionSetter getRelMoveSetter(Class<?> packetClass) {
|
public BountifulWrapper.PositionSetter getRelMoveSetter(Class<?> packetClass) {
|
||||||
Reflection.FieldAccessor<?> moveX = Reflection.getField(packetClass, "b", byte.class);
|
Reflection.Field<?> moveX = Reflection.getField(packetClass, "b", byte.class);
|
||||||
Reflection.FieldAccessor<?> moveY = Reflection.getField(packetClass, "c", byte.class);
|
Reflection.Field<?> moveY = Reflection.getField(packetClass, "c", byte.class);
|
||||||
Reflection.FieldAccessor<?> moveZ = Reflection.getField(packetClass, "d", byte.class);
|
Reflection.Field<?> moveZ = Reflection.getField(packetClass, "d", byte.class);
|
||||||
Reflection.FieldAccessor<Byte> lookYaw = Reflection.getField(packetClass, "e", byte.class);
|
Reflection.Field<Byte> lookYaw = Reflection.getField(packetClass, "e", byte.class);
|
||||||
Reflection.FieldAccessor<Byte> lookPitch = Reflection.getField(packetClass, "f", byte.class);
|
Reflection.Field<Byte> lookPitch = Reflection.getField(packetClass, "f", byte.class);
|
||||||
|
|
||||||
return (packet, x, y, z, pitch, yaw) -> {
|
return (packet, x, y, z, pitch, yaw) -> {
|
||||||
moveX.set(packet, (byte)(x*32));
|
moveX.set(packet, (byte)(x*32));
|
||||||
|
|||||||
@@ -19,22 +19,22 @@
|
|||||||
|
|
||||||
package de.steamwar.core;
|
package de.steamwar.core;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import de.steamwar.Reflection;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ChatWrapper8 implements ChatWrapper {
|
public class ChatWrapper8 implements ChatWrapper {
|
||||||
|
|
||||||
private static final Reflection.ConstructorInvoker chatComponentConstructor = Reflection.getConstructor(Reflection.getClass("{nms.network.chat}.ChatComponentText"), String.class);
|
private static final Reflection.Constructor chatComponentConstructor = Reflection.getConstructor(Reflection.getClass("net.minecraft.network.chat.ChatComponentText"), String.class);
|
||||||
@Override
|
@Override
|
||||||
public Object stringToChatComponent(String text) {
|
public Object stringToChatComponent(String text) {
|
||||||
return chatComponentConstructor.invoke(text);
|
return chatComponentConstructor.invoke(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Class<?> metadataPacket = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutEntityMetadata");
|
private static final Class<?> metadataPacket = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundSetEntityDataPacket");
|
||||||
private static final Reflection.FieldAccessor<Integer> metadataEntity = Reflection.getField(metadataPacket, int.class, 0);
|
private static final Reflection.Field<Integer> metadataEntity = Reflection.getField(metadataPacket, int.class, 0);
|
||||||
private static final Reflection.FieldAccessor<List> metadataMetadata = Reflection.getField(metadataPacket, List.class, 0);
|
private static final Reflection.Field<List> metadataMetadata = Reflection.getField(metadataPacket, List.class, 0);
|
||||||
@Override
|
@Override
|
||||||
public Object getDataWatcherPacket(int entityId, Object... dataWatcherKeyValues) {
|
public Object getDataWatcherPacket(int entityId, Object... dataWatcherKeyValues) {
|
||||||
Object packet = Reflection.newInstance(metadataPacket);
|
Object packet = Reflection.newInstance(metadataPacket);
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.core;
|
package de.steamwar.core;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import de.steamwar.Reflection;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
@@ -32,9 +32,9 @@ import java.util.Map;
|
|||||||
|
|
||||||
public class FlatteningWrapper8 implements FlatteningWrapper.IFlatteningWrapper {
|
public class FlatteningWrapper8 implements FlatteningWrapper.IFlatteningWrapper {
|
||||||
|
|
||||||
private static final Reflection.FieldAccessor<String> scoreboardName = Reflection.getField(FlatteningWrapper.scoreboardObjective, String.class, 1);
|
private static final Reflection.Field<String> scoreboardName = Reflection.getField(FlatteningWrapper.scoreboardObjective, String.class, 1);
|
||||||
private static final Class<?> scoreActionEnum = Reflection.getClass("{nms}.PacketPlayOutScoreboardScore$EnumScoreboardAction");
|
private static final Class<?> scoreActionEnum = Reflection.getClass("net.minecraft.PacketPlayOutScoreboardScore$EnumScoreboardAction");
|
||||||
private static final Reflection.FieldAccessor<?> scoreAction = Reflection.getField(FlatteningWrapper.scoreboardScore, scoreActionEnum, 0);
|
private static final Reflection.Field<?> scoreAction = Reflection.getField(FlatteningWrapper.scoreboardScore, scoreActionEnum, 0);
|
||||||
private static final Object scoreActionChange = scoreActionEnum.getEnumConstants()[0];
|
private static final Object scoreActionChange = scoreActionEnum.getEnumConstants()[0];
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -76,11 +76,11 @@ public class FlatteningWrapper8 implements FlatteningWrapper.IFlatteningWrapper
|
|||||||
return Byte.valueOf((byte)(pose == FlatteningWrapper.EntityPose.SNEAKING ? 2 : 0));
|
return Byte.valueOf((byte)(pose == FlatteningWrapper.EntityPose.SNEAKING ? 2 : 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Class<?> dataWatcher = Reflection.getClass("{nms}.DataWatcher");
|
private static final Class<?> dataWatcher = Reflection.getClass("net.minecraft.DataWatcher");
|
||||||
private static final Class<?> namedSpawnPacket = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutNamedEntitySpawn");
|
private static final Class<?> namedSpawnPacket = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundAddPlayerPacket");
|
||||||
private static final Reflection.FieldAccessor<?> namedSpawnDataWatcher = Reflection.getField(namedSpawnPacket, dataWatcher, 0);
|
private static final Reflection.Field<?> namedSpawnDataWatcher = Reflection.getField(namedSpawnPacket, dataWatcher, 0);
|
||||||
private static final Class<?> entity = Reflection.getClass("{nms}.Entity");
|
private static final Class<?> entity = Reflection.getClass("net.minecraft.Entity");
|
||||||
private static final Reflection.ConstructorInvoker dataWatcherConstructor = Reflection.getConstructor(dataWatcher, entity);
|
private static final Reflection.Constructor dataWatcherConstructor = Reflection.getConstructor(dataWatcher, entity);
|
||||||
@Override
|
@Override
|
||||||
public void setNamedSpawnPacketDataWatcher(Object packet) {
|
public void setNamedSpawnPacketDataWatcher(Object packet) {
|
||||||
namedSpawnDataWatcher.set(packet, dataWatcherConstructor.invoke((Object) null));
|
namedSpawnDataWatcher.set(packet, dataWatcherConstructor.invoke((Object) null));
|
||||||
@@ -92,8 +92,8 @@ public class FlatteningWrapper8 implements FlatteningWrapper.IFlatteningWrapper
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static final Reflection.FieldAccessor<?> spawnType = Reflection.getField(ProtocolWrapper.spawnPacket, int.class, Core.getVersion() > 8 ? 6 : 9);
|
private static final Reflection.Field<?> spawnType = Reflection.getField(ProtocolWrapper.spawnPacket, int.class, Core.getVersion() > 8 ? 6 : 9);
|
||||||
private static final Reflection.FieldAccessor<Integer> spawnLivingType = Reflection.getField(ProtocolWrapper.spawnLivingPacket, int.class, 1);
|
private static final Reflection.Field<Integer> spawnLivingType = Reflection.getField(ProtocolWrapper.spawnLivingPacket, int.class, 1);
|
||||||
private static final Map<EntityType, Object> types = new HashMap<>();
|
private static final Map<EntityType, Object> types = new HashMap<>();
|
||||||
static {
|
static {
|
||||||
types.put(TrickyTrialsWrapper.impl.getTntEntityType(), 50);
|
types.put(TrickyTrialsWrapper.impl.getTntEntityType(), 50);
|
||||||
@@ -113,7 +113,7 @@ public class FlatteningWrapper8 implements FlatteningWrapper.IFlatteningWrapper
|
|||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Reflection.MethodInvoker save = Reflection.getMethod("{obc}.CraftWorld", "save", boolean.class);
|
private static final Reflection.Method save = Reflection.getMethod("org.bukkit.craftbukkit.CraftWorld", "save", boolean.class);
|
||||||
@Override
|
@Override
|
||||||
public void syncSave(World world) {
|
public void syncSave(World world) {
|
||||||
save.invoke(world, true);
|
save.invoke(world, true);
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.core;
|
package de.steamwar.core;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import de.steamwar.Reflection;
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
|
|
||||||
@@ -29,27 +29,27 @@ import java.util.List;
|
|||||||
|
|
||||||
public class ProtocolWrapper8 implements ProtocolWrapper {
|
public class ProtocolWrapper8 implements ProtocolWrapper {
|
||||||
|
|
||||||
private static final Reflection.FieldAccessor<?> equipmentSlot;
|
private static final Reflection.Field<?> equipmentSlot;
|
||||||
static {
|
static {
|
||||||
if(Core.getVersion() == 8) {
|
if(Core.getVersion() == 8) {
|
||||||
equipmentSlot = Reflection.getField(equipmentPacket, int.class, 1);
|
equipmentSlot = Reflection.getField(equipmentPacket, int.class, 1);
|
||||||
} else {
|
} else {
|
||||||
Class<?> enumItemSlot = Reflection.getClass("{nms.world.entity}.EnumItemSlot");
|
Class<?> enumItemSlot = Reflection.getClass("net.minecraft.world.entity.EnumItemSlot");
|
||||||
equipmentSlot = Reflection.getField(equipmentPacket, enumItemSlot, 0);
|
equipmentSlot = Reflection.getField(equipmentPacket, enumItemSlot, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Reflection.FieldAccessor<?> equipmentStack = Reflection.getField(equipmentPacket, itemStack, 0);
|
private static final Reflection.Field<?> equipmentStack = Reflection.getField(equipmentPacket, itemStack, 0);
|
||||||
@Override
|
@Override
|
||||||
public void setEquipmentPacketStack(Object packet, Object slot, Object stack) {
|
public void setEquipmentPacketStack(Object packet, Object slot, Object stack) {
|
||||||
equipmentSlot.set(packet, slot);
|
equipmentSlot.set(packet, slot);
|
||||||
equipmentStack.set(packet, stack);
|
equipmentStack.set(packet, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Class<?> playerInfoPacket = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutPlayerInfo");
|
private static final Class<?> playerInfoPacket = Reflection.getClass("net.minecraft.network.protocol.game.PacketPlayOutPlayerInfo");
|
||||||
private static final Class<?> playerInfoActionClass = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutPlayerInfo$EnumPlayerInfoAction");
|
private static final Class<?> playerInfoActionClass = Reflection.getClass("net.minecraft.network.protocol.game.PacketPlayOutPlayerInfo$EnumPlayerInfoAction");
|
||||||
private static final Reflection.FieldAccessor<?> playerInfoAction = Reflection.getField(playerInfoPacket, playerInfoActionClass, 0);
|
private static final Reflection.Field<?> playerInfoAction = Reflection.getField(playerInfoPacket, playerInfoActionClass, 0);
|
||||||
private static final Reflection.FieldAccessor<List> playerInfoData = Reflection.getField(playerInfoPacket, List.class, 0);
|
private static final Reflection.Field<List> playerInfoData = Reflection.getField(playerInfoPacket, List.class, 0);
|
||||||
private static final EnumMap<PlayerInfoAction, Object> actions = new EnumMap<>(PlayerInfoAction.class);
|
private static final EnumMap<PlayerInfoAction, Object> actions = new EnumMap<>(PlayerInfoAction.class);
|
||||||
static {
|
static {
|
||||||
Object[] nativeActions = playerInfoActionClass.getEnumConstants();
|
Object[] nativeActions = playerInfoActionClass.getEnumConstants();
|
||||||
@@ -57,8 +57,8 @@ public class ProtocolWrapper8 implements ProtocolWrapper {
|
|||||||
actions.put(PlayerInfoAction.GAMEMODE, nativeActions[1]);
|
actions.put(PlayerInfoAction.GAMEMODE, nativeActions[1]);
|
||||||
actions.put(PlayerInfoAction.REMOVE, nativeActions[4]);
|
actions.put(PlayerInfoAction.REMOVE, nativeActions[4]);
|
||||||
}
|
}
|
||||||
private static final Class<?> iChatBaseComponent = Reflection.getClass("{nms.network.chat}.IChatBaseComponent");
|
private static final Class<?> iChatBaseComponent = Reflection.getClass("net.minecraft.network.chat.Component");
|
||||||
private static final Reflection.ConstructorInvoker playerInfoDataConstructor = Reflection.getConstructor("{nms.network.protocol.game}.PacketPlayOutPlayerInfo$PlayerInfoData", playerInfoPacket, GameProfile.class, int.class, enumGamemode, iChatBaseComponent);
|
private static final Reflection.Constructor playerInfoDataConstructor = Reflection.getConstructor("net.minecraft.network.protocol.game.PacketPlayOutPlayerInfo$PlayerInfoData", playerInfoPacket, GameProfile.class, int.class, enumGamemode, iChatBaseComponent);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ import com.sk89q.worldedit.regions.CuboidRegion;
|
|||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||||
import com.sk89q.worldedit.world.registry.WorldData;
|
import com.sk89q.worldedit.world.registry.WorldData;
|
||||||
|
import de.steamwar.sql.NodeData;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -50,13 +51,13 @@ import java.util.stream.Collectors;
|
|||||||
public class WorldEditWrapper8 implements WorldEditWrapper {
|
public class WorldEditWrapper8 implements WorldEditWrapper {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InputStream getPlayerClipboard(Player player, boolean schemFormat) {
|
public InputStream getPlayerClipboard(Player player) {
|
||||||
return WorldEditWrapper.getPlayerClipboard(player, schemFormat, (outputStream, clipboard, clipboardHolder) ->
|
return WorldEditWrapper.getPlayerClipboard(player, (outputStream, clipboard, clipboardHolder) ->
|
||||||
ClipboardFormat.SCHEMATIC.getWriter(outputStream).write(clipboard, clipboardHolder.getWorldData()));
|
ClipboardFormat.SCHEMATIC.getWriter(outputStream).write(clipboard, clipboardHolder.getWorldData()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setPlayerClipboard(Player player, InputStream is, boolean schemFormat) {
|
public void setPlayerClipboard(Player player, InputStream is, NodeData.SchematicFormat schemFormat) {
|
||||||
WorldData world = new BukkitWorld(player.getWorld()).getWorldData();
|
WorldData world = new BukkitWorld(player.getWorld()).getWorldData();
|
||||||
Clipboard clipboard;
|
Clipboard clipboard;
|
||||||
try {
|
try {
|
||||||
@@ -70,11 +71,16 @@ public class WorldEditWrapper8 implements WorldEditWrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Clipboard getClipboard(InputStream is, boolean schemFormat) throws IOException {
|
public Clipboard getClipboard(InputStream is, NodeData.SchematicFormat schemFormat) throws IOException {
|
||||||
if(schemFormat)
|
switch (schemFormat) {
|
||||||
return new SpongeSchematicReader(new NBTInputStream(is)).read(WorldEdit.getInstance().getServer().getWorlds().get(0).getWorldData());
|
case MCEDIT:
|
||||||
else
|
return new SchematicReader(new NBTInputStream(is)).read(WorldEdit.getInstance().getServer().getWorlds().get(0).getWorldData());
|
||||||
return new SchematicReader(new NBTInputStream(is)).read(WorldEdit.getInstance().getServer().getWorlds().get(0).getWorldData());
|
case SPONGE_V2:
|
||||||
|
case SPONGE_V3:
|
||||||
|
return new SpongeSchematicReader(new NBTInputStream(is)).read(WorldEdit.getInstance().getServer().getWorlds().get(0).getWorldData());
|
||||||
|
default:
|
||||||
|
throw new IllegalArgumentException("Unsupported schematic format");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -99,6 +105,11 @@ public class WorldEditWrapper8 implements WorldEditWrapper {
|
|||||||
return new org.bukkit.util.Vector(v.getX(), v.getY(), v.getZ());
|
return new org.bukkit.util.Vector(v.getX(), v.getY(), v.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public NodeData.SchematicFormat getNativeFormat() {
|
||||||
|
return NodeData.SchematicFormat.MCEDIT;
|
||||||
|
}
|
||||||
|
|
||||||
private static class SpongeSchematicReader implements ClipboardReader {
|
private static class SpongeSchematicReader implements ClipboardReader {
|
||||||
|
|
||||||
private final NBTInputStream inputStream;
|
private final NBTInputStream inputStream;
|
||||||
@@ -137,6 +148,13 @@ public class WorldEditWrapper8 implements WorldEditWrapper {
|
|||||||
IDConverter8 ids = new IDConverter8();
|
IDConverter8 ids = new IDConverter8();
|
||||||
|
|
||||||
Map<String, Tag> schematic = schematicTag.getValue();
|
Map<String, Tag> schematic = schematicTag.getValue();
|
||||||
|
boolean v3Mode = false;
|
||||||
|
|
||||||
|
if (schematic.size() == 1) {
|
||||||
|
schematic = (requireTag(schematic, "Schematic", CompoundTag.class)).getValue();
|
||||||
|
v3Mode = true;
|
||||||
|
}
|
||||||
|
|
||||||
int width = (requireTag(schematic, "Width", ShortTag.class)).getValue();
|
int width = (requireTag(schematic, "Width", ShortTag.class)).getValue();
|
||||||
int height = (requireTag(schematic, "Height", ShortTag.class)).getValue();
|
int height = (requireTag(schematic, "Height", ShortTag.class)).getValue();
|
||||||
int length = (requireTag(schematic, "Length", ShortTag.class)).getValue();
|
int length = (requireTag(schematic, "Length", ShortTag.class)).getValue();
|
||||||
@@ -167,10 +185,13 @@ public class WorldEditWrapper8 implements WorldEditWrapper {
|
|||||||
region = new CuboidRegion(min, min.add(width, height, length).subtract(BlockVector.ONE));
|
region = new CuboidRegion(min, min.add(width, height, length).subtract(BlockVector.ONE));
|
||||||
}
|
}
|
||||||
|
|
||||||
IntTag paletteMaxTag = getTag(schematic, "PaletteMax", IntTag.class);
|
Map<String, Tag> blockContainer = null;
|
||||||
Map<String, Tag> paletteObject = requireTag(schematic, "Palette", CompoundTag.class).getValue();
|
|
||||||
if (paletteMaxTag != null && paletteObject.size() != paletteMaxTag.getValue())
|
if (v3Mode) {
|
||||||
throw new IOException("Block palette size does not match expected size.");
|
blockContainer = getTag(schematic, "Blocks", CompoundTag.class).getValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, Tag> paletteObject = requireTag(v3Mode ? blockContainer : schematic, "Palette", CompoundTag.class).getValue();
|
||||||
|
|
||||||
Map<Integer, BaseBlock> palette = new HashMap<>();
|
Map<Integer, BaseBlock> palette = new HashMap<>();
|
||||||
ParserContext parserContext = new ParserContext();
|
ParserContext parserContext = new ParserContext();
|
||||||
@@ -182,11 +203,11 @@ public class WorldEditWrapper8 implements WorldEditWrapper {
|
|||||||
palette.put(requireTag(paletteObject, palettePart, IntTag.class).getValue(), new BaseBlock(blockID.getBlockId(), blockID.getDataId()));
|
palette.put(requireTag(paletteObject, palettePart, IntTag.class).getValue(), new BaseBlock(blockID.getBlockId(), blockID.getDataId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
byte[] blocks = requireTag(schematic, "BlockData", ByteArrayTag.class).getValue();
|
byte[] blocks = requireTag(v3Mode ? blockContainer : schematic, v3Mode ? "Data" : "BlockData", ByteArrayTag.class).getValue();
|
||||||
Map<BlockVector, Map<String, Tag>> tileEntitiesMap = new HashMap<>();
|
Map<BlockVector, Map<String, Tag>> tileEntitiesMap = new HashMap<>();
|
||||||
ListTag tileEntities = getTag(schematic, "BlockEntities", ListTag.class);
|
ListTag tileEntities = getTag(v3Mode ? blockContainer : schematic, "BlockEntities", ListTag.class);
|
||||||
if (tileEntities == null) {
|
if (tileEntities == null) {
|
||||||
tileEntities = getTag(schematic, "TileEntities", ListTag.class);
|
tileEntities = getTag(v3Mode ? blockContainer : schematic, "TileEntities", ListTag.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tileEntities != null) {
|
if (tileEntities != null) {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.scoreboard;
|
package de.steamwar.scoreboard;
|
||||||
|
|
||||||
import com.comphenix.tinyprotocol.Reflection;
|
import de.steamwar.Reflection;
|
||||||
import com.comphenix.tinyprotocol.TinyProtocol;
|
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||||
import de.steamwar.core.Core;
|
import de.steamwar.core.Core;
|
||||||
import de.steamwar.core.FlatteningWrapper;
|
import de.steamwar.core.FlatteningWrapper;
|
||||||
@@ -30,15 +30,15 @@ import java.util.HashMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class SWScoreboard8 implements SWScoreboard {
|
public class SWScoreboard8 implements SWScoreboard {
|
||||||
private static final Reflection.FieldAccessor<String> scoreboardName = Reflection.getField(FlatteningWrapper.scoreboardObjective, String.class, 0);
|
private static final Reflection.Field<String> scoreboardName = Reflection.getField(FlatteningWrapper.scoreboardObjective, String.class, 0);
|
||||||
private static final Reflection.FieldAccessor<Integer> scoreboardAction = Reflection.getField(FlatteningWrapper.scoreboardObjective, int.class, Core.getVersion() > 15 ? 3 : 0);
|
private static final Reflection.Field<Integer> scoreboardAction = Reflection.getField(FlatteningWrapper.scoreboardObjective, int.class, Core.getVersion() > 15 ? 3 : 0);
|
||||||
private static final Class<?> scoreboardDisplayEnum = Reflection.getClass("{nms.world.scores.criteria}.IScoreboardCriteria$EnumScoreboardHealthDisplay");
|
private static final Class<?> scoreboardDisplayEnum = Reflection.getClass("net.minecraft.world.scores.criteria.IScoreboardCriteria$EnumScoreboardHealthDisplay");
|
||||||
private static final Reflection.FieldAccessor<?> scoreboardDisplayType = Reflection.getField(FlatteningWrapper.scoreboardObjective, scoreboardDisplayEnum, 0);
|
private static final Reflection.Field<?> scoreboardDisplayType = Reflection.getField(FlatteningWrapper.scoreboardObjective, scoreboardDisplayEnum, 0);
|
||||||
private static final Object displayTypeIntegers = scoreboardDisplayEnum.getEnumConstants()[0];
|
private static final Object displayTypeIntegers = scoreboardDisplayEnum.getEnumConstants()[0];
|
||||||
|
|
||||||
private static final Reflection.FieldAccessor<String> scoreName = Reflection.getField(FlatteningWrapper.scoreboardScore, String.class, 0);
|
private static final Reflection.Field<String> scoreName = Reflection.getField(FlatteningWrapper.scoreboardScore, String.class, 0);
|
||||||
private static final Reflection.FieldAccessor<String> scoreScoreboardName = Reflection.getField(FlatteningWrapper.scoreboardScore, String.class, 1);
|
private static final Reflection.Field<String> scoreScoreboardName = Reflection.getField(FlatteningWrapper.scoreboardScore, String.class, 1);
|
||||||
private static final Reflection.FieldAccessor<Integer> scoreValue = Reflection.getField(FlatteningWrapper.scoreboardScore, int.class, 0);
|
private static final Reflection.Field<Integer> scoreValue = Reflection.getField(FlatteningWrapper.scoreboardScore, int.class, 0);
|
||||||
|
|
||||||
private static final HashMap<Player, ScoreboardCallback> playerBoards = new HashMap<>(); //Object -> Scoreboard | Alle Versionen in der Map!
|
private static final HashMap<Player, ScoreboardCallback> playerBoards = new HashMap<>(); //Object -> Scoreboard | Alle Versionen in der Map!
|
||||||
private static int toggle = 0; // Scoreboard 0 updates while scoreboard 1 is presenting. toggle marks the current active scoreboard
|
private static int toggle = 0; // Scoreboard 0 updates while scoreboard 1 is presenting. toggle marks the current active scoreboard
|
||||||
@@ -48,9 +48,9 @@ public class SWScoreboard8 implements SWScoreboard {
|
|||||||
private static final Object[] DISPLAY_SIDEBAR = new Object[2];
|
private static final Object[] DISPLAY_SIDEBAR = new Object[2];
|
||||||
|
|
||||||
static {
|
static {
|
||||||
Class<?> scoreboardDisplayObjective = Reflection.getClass("{nms.network.protocol.game}.PacketPlayOutScoreboardDisplayObjective");
|
Class<?> scoreboardDisplayObjective = Reflection.getClass("net.minecraft.network.protocol.game.PacketPlayOutScoreboardDisplayObjective");
|
||||||
Reflection.FieldAccessor<String> scoreboardDisplayName = Reflection.getField(scoreboardDisplayObjective, String.class, 0);
|
Reflection.Field<String> scoreboardDisplayName = Reflection.getField(scoreboardDisplayObjective, String.class, 0);
|
||||||
Reflection.FieldAccessor<Integer> scoreboardDisplaySlot = Reflection.getField(scoreboardDisplayObjective, int.class, 0);
|
Reflection.Field<Integer> scoreboardDisplaySlot = Reflection.getField(scoreboardDisplayObjective, int.class, 0);
|
||||||
for(int id = 0; id < 2; id++) {
|
for(int id = 0; id < 2; id++) {
|
||||||
DELETE_SCOREBOARD[id] = Reflection.newInstance(FlatteningWrapper.scoreboardObjective);
|
DELETE_SCOREBOARD[id] = Reflection.newInstance(FlatteningWrapper.scoreboardObjective);
|
||||||
scoreboardName.set(DELETE_SCOREBOARD[id], SIDEBAR + id);
|
scoreboardName.set(DELETE_SCOREBOARD[id], SIDEBAR + id);
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user