From 9e93552948d2f9609bff9d81db7932397b4ebb14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20Endre=C3=9F?= Date: Tue, 18 Jan 2022 08:54:55 +0100 Subject: [PATCH 01/47] Update build-spigot.sh --- scripts/build-spigot.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build-spigot.sh b/scripts/build-spigot.sh index 0895b32..cf98f68 100644 --- a/scripts/build-spigot.sh +++ b/scripts/build-spigot.sh @@ -7,6 +7,6 @@ while read line; do continue fi echo "Downloading Spigot $line" - curl "https://playuniverse.org/host/download/github/spigot-$line.jar" --output "$1/libraries/spigot/spigot-$line.jar" + curl "http://test.playuniverse.org/host/download/github/spigot-$line.jar" --output "$1/libraries/spigot/spigot-$line.jar" done < $versions echo "Download complete!" From 670e0c9b9e90b6934146167a9b9e864a7c9c7abe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20Endre=C3=9F?= Date: Tue, 18 Jan 2022 08:57:49 +0100 Subject: [PATCH 02/47] Update build-spigot.sh --- scripts/build-spigot.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build-spigot.sh b/scripts/build-spigot.sh index cf98f68..fc051de 100644 --- a/scripts/build-spigot.sh +++ b/scripts/build-spigot.sh @@ -7,6 +7,6 @@ while read line; do continue fi echo "Downloading Spigot $line" - curl "http://test.playuniverse.org/host/download/github/spigot-$line.jar" --output "$1/libraries/spigot/spigot-$line.jar" + curl "http://test.playuniverse.org/host/download/github/spigot-" + $line + ".jar" --output "$1/libraries/spigot/spigot-$line.jar" done < $versions echo "Download complete!" From d73c57b511c3c86d41f87e752d9eb6bcbf9154fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20Endre=C3=9F?= Date: Tue, 18 Jan 2022 09:12:26 +0100 Subject: [PATCH 03/47] Update build-spigot.sh --- scripts/build-spigot.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build-spigot.sh b/scripts/build-spigot.sh index fc051de..944c2e9 100644 --- a/scripts/build-spigot.sh +++ b/scripts/build-spigot.sh @@ -7,6 +7,6 @@ while read line; do continue fi echo "Downloading Spigot $line" - curl "http://test.playuniverse.org/host/download/github/spigot-" + $line + ".jar" --output "$1/libraries/spigot/spigot-$line.jar" + curl "http://test.playuniverse.org/host/download/github/spigot-$line.jar" --output "$1/libraries/spigot/spigot-$line.jar" done < $versions echo "Download complete!" From 8b0cd33fe585710e3bd164d6ff6becd3ba5d9d44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20Endre=C3=9F?= Date: Tue, 18 Jan 2022 11:55:50 +0100 Subject: [PATCH 04/47] Add 1_17_R1 support --- pom.xml | 18 +- .../v1_17_R1/BukkitConversion1_17_R1.java | 218 +++++++++++++ .../v1_17_R1/EntityProvider1_17_R1.java | 47 +++ .../v1_17_R1/PacketHandler1_17_R1.java | 11 + .../v1_17_R1/PlayerProvider1_17_R1.java | 20 ++ .../v1_17_R1/TextureProvider1_17_R1.java | 102 ++++++ .../v1_17_R1/ToolProvider1_17_R1.java | 33 ++ .../v1_17_R1/VersionControl1_17_R1.java | 61 ++++ .../v1_17_R1/data/BukkitContainer1_17_R1.java | 161 ++++++++++ .../v1_17_R1/data/BukkitContext1_17_R1.java | 39 +++ .../v1_17_R1/data/BukkitKey1_17_R1.java | 52 ++++ .../v1_17_R1/data/BukkitType1_17_R1.java | 69 ++++ .../data/SimpleBukkitType1_17_R1.java | 36 +++ .../v1_17_R1/data/SyntaxContainer1_17_R1.java | 185 +++++++++++ .../v1_17_R1/data/SyntaxContext1_17_R1.java | 38 +++ .../v1_17_R1/data/SyntaxType1_17_R1.java | 76 +++++ .../v1_17_R1/data/WrappedType1_17_R1.java | 150 +++++++++ .../BukkitContainerAdapterHook1_17_R1.java | 134 ++++++++ .../v1_17_R1/entity/ArmorStand1_17_R1.java | 24 ++ .../v1_17_R1/entity/Entity1_17_R1.java | 215 +++++++++++++ .../v1_17_R1/entity/EntityLiving1_17_R1.java | 17 + .../v1_17_R1/entity/Player1_17_R1.java | 294 ++++++++++++++++++ .../v1_17_R1/tools/BlockTools1_17_R1.java | 39 +++ .../v1_17_R1/tools/ServerTools1_17_R1.java | 27 ++ .../v1_17_R1/tools/SkinTools1_17_R1.java | 16 + .../utils/EntityConstructors1_17_R1.java | 12 + 26 files changed, 2092 insertions(+), 2 deletions(-) create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/BukkitConversion1_17_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/EntityProvider1_17_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/PacketHandler1_17_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/PlayerProvider1_17_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/TextureProvider1_17_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/ToolProvider1_17_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/VersionControl1_17_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/BukkitContainer1_17_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/BukkitContext1_17_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/BukkitKey1_17_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/BukkitType1_17_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/SimpleBukkitType1_17_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/SyntaxContainer1_17_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/SyntaxContext1_17_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/SyntaxType1_17_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/WrappedType1_17_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/hook/BukkitContainerAdapterHook1_17_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/entity/ArmorStand1_17_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/entity/Entity1_17_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/entity/EntityLiving1_17_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/entity/Player1_17_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/tools/BlockTools1_17_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/tools/ServerTools1_17_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/tools/SkinTools1_17_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/utils/EntityConstructors1_17_R1.java diff --git a/pom.xml b/pom.xml index 112d38c..f0c472b 100644 --- a/pom.xml +++ b/pom.xml @@ -99,6 +99,20 @@ 5.5.2 test + + bukkit + spigot-1.18.1 + 0.1 + system + ${project.basedir}/libraries/spigot/spigot-1.18.1.jar + + + bukkit + spigot-1.17.1 + 0.1 + system + ${project.basedir}/libraries/spigot/spigot-1.17.1.jar + bukkit spigot-1.16.4 @@ -106,7 +120,7 @@ system ${project.basedir}/libraries/spigot/spigot-1.16.4.jar - + diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/BukkitConversion1_17_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/BukkitConversion1_17_R1.java new file mode 100644 index 0000000..0e53ca5 --- /dev/null +++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/BukkitConversion1_17_R1.java @@ -0,0 +1,218 @@ +package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1; + +import java.util.Set; + +import org.bukkit.craftbukkit.v1_17_R1.inventory.CraftItemStack; +import org.bukkit.entity.EntityType; + +import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; +import com.syntaxphoenix.syntaxapi.data.DataType; +import com.syntaxphoenix.syntaxapi.nbt.NbtByte; +import com.syntaxphoenix.syntaxapi.nbt.NbtByteArray; +import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; +import com.syntaxphoenix.syntaxapi.nbt.NbtDouble; +import com.syntaxphoenix.syntaxapi.nbt.NbtEnd; +import com.syntaxphoenix.syntaxapi.nbt.NbtFloat; +import com.syntaxphoenix.syntaxapi.nbt.NbtInt; +import com.syntaxphoenix.syntaxapi.nbt.NbtIntArray; +import com.syntaxphoenix.syntaxapi.nbt.NbtList; +import com.syntaxphoenix.syntaxapi.nbt.NbtLong; +import com.syntaxphoenix.syntaxapi.nbt.NbtLongArray; +import com.syntaxphoenix.syntaxapi.nbt.NbtShort; +import com.syntaxphoenix.syntaxapi.nbt.NbtString; +import com.syntaxphoenix.syntaxapi.nbt.NbtTag; +import com.syntaxphoenix.syntaxapi.nbt.NbtType; + +import net.minecraft.nbt.NBTBase; +import net.minecraft.nbt.NBTNumber; +import net.minecraft.nbt.NBTTagByte; +import net.minecraft.nbt.NBTTagByteArray; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagDouble; +import net.minecraft.nbt.NBTTagEnd; +import net.minecraft.nbt.NBTTagFloat; +import net.minecraft.nbt.NBTTagInt; +import net.minecraft.nbt.NBTTagIntArray; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.nbt.NBTTagLong; +import net.minecraft.nbt.NBTTagLongArray; +import net.minecraft.nbt.NBTTagShort; +import net.minecraft.nbt.NBTTagString; +import net.minecraft.world.item.ItemStack; +import net.sourcewriters.minecraft.vcompat.reflection.BukkitConversion; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; +import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.data.BukkitContext1_17_R1; +import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.data.BukkitType1_17_R1; + +public class BukkitConversion1_17_R1 extends BukkitConversion { + + protected BukkitConversion1_17_R1(VersionControl1_17_R1 versionControl) { + super(versionControl); + } + + @Override + public EntityType toEntityType(NmsEntityType type) { + try { + return EntityType.valueOf(type.name()); + } catch (IllegalArgumentException ignore) { + return null; + } + } + + @Override + public NmsEntityType fromEntityType(EntityType type) { + try { + return NmsEntityType.valueOf(type.name()); + } catch (IllegalArgumentException ignore) { + return null; + } + } + + @Override + public NBTBase toMinecraftTag(NbtTag tag) { + switch (tag.getType()) { + case BYTE: + return NBTTagByte.a((byte) tag.getValue()); + case SHORT: + return NBTTagShort.a((short) tag.getValue()); + case INT: + return NBTTagInt.a((int) tag.getValue()); + case LONG: + return NBTTagLong.a((long) tag.getValue()); + case FLOAT: + return NBTTagFloat.a((float) tag.getValue()); + case DOUBLE: + return NBTTagDouble.a((double) tag.getValue()); + case STRING: + return NBTTagString.a((String) tag.getValue()); + case BYTE_ARRAY: + return new NBTTagByteArray((byte[]) tag.getValue()); + case INT_ARRAY: + return new NBTTagIntArray((int[]) tag.getValue()); + case LONG_ARRAY: + return new NBTTagLongArray((long[]) tag.getValue()); + case LIST: + return toMinecraftList((NbtList) tag); + case COMPOUND: + return toMinecraftCompound((NbtCompound) tag); + case END: + return NBTTagEnd.b; + default: + return null; + } + } + + @Override + public NbtTag fromMinecraftTag(Object raw) { + if (!(raw instanceof NBTBase)) { + return null; + } + NBTBase tag = (NBTBase) raw; + NbtType type = NbtType.getById(tag.getTypeId()); + switch (type) { + case BYTE: + return new NbtByte(((NBTNumber) tag).asByte()); + case SHORT: + return new NbtShort(((NBTNumber) tag).asShort()); + case INT: + return new NbtInt(((NBTNumber) tag).asInt()); + case LONG: + return new NbtLong(((NBTNumber) tag).asLong()); + case FLOAT: + return new NbtFloat(((NBTNumber) tag).asFloat()); + case DOUBLE: + return new NbtDouble(((NBTNumber) tag).asDouble()); + case STRING: + return new NbtString(((NBTTagString) tag).asString()); + case BYTE_ARRAY: + return new NbtByteArray(((NBTTagByteArray) tag).getBytes()); + case INT_ARRAY: + return new NbtIntArray(((NBTTagIntArray) tag).getInts()); + case LONG_ARRAY: + return new NbtLongArray(((NBTTagLongArray) tag).getLongs()); + case LIST: + return fromMinecraftList(tag); + case COMPOUND: + return fromMinecraftCompound(tag); + case END: + return NbtEnd.INSTANCE; + default: + return null; + } + } + + @Override + public NBTTagList toMinecraftList(NbtList list) { + NBTTagList output = new NBTTagList(); + for (NbtTag tag : list) { + output.add(toMinecraftTag(tag)); + } + return output; + } + + @Override + public NbtList fromMinecraftList(Object raw) { + if (!(raw instanceof NBTTagList)) { + return null; + } + NBTTagList list = (NBTTagList) raw; + NbtList output = new NbtList<>(NbtType.getById(list.getTypeId())); + for (NBTBase base : list) { + output.add(fromMinecraftTag(base)); + } + return output; + } + + @Override + public NBTTagCompound toMinecraftCompound(NbtCompound compound) { + NBTTagCompound output = new NBTTagCompound(); + if (compound.isEmpty()) { + return output; + } + Set keys = compound.getKeys(); + for (String key : keys) { + output.set(key, toMinecraftTag(compound.get(key))); + } + return output; + } + + @Override + public NbtCompound fromMinecraftCompound(Object raw) { + if (!(raw instanceof NBTTagCompound)) { + return null; + } + NBTTagCompound compound = (NBTTagCompound) raw; + NbtCompound output = new NbtCompound(); + if (compound.isEmpty()) { + return output; + } + Set keys = compound.getKeys(); + for (String key : keys) { + output.set(key, fromMinecraftTag(compound.get(key))); + } + return output; + } + + @Override + public org.bukkit.inventory.ItemStack itemFromCompound(NbtCompound compound) { + return CraftItemStack.asBukkitCopy(ItemStack.a(toMinecraftCompound(compound))); + } + + @Override + public NbtCompound itemToCompound(org.bukkit.inventory.ItemStack itemStack) { + return fromMinecraftCompound(CraftItemStack.asNMSCopy(itemStack).save(new NBTTagCompound())); + } + + @Override + public WrappedContext createContext(DataAdapterContext context) { + return new BukkitContext1_17_R1(context); + } + + @Override + public WrapType wrap(DataType dataType) { + return new BukkitType1_17_R1<>(dataType); + } + +} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/EntityProvider1_17_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/EntityProvider1_17_R1.java new file mode 100644 index 0000000..6a08ada --- /dev/null +++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/EntityProvider1_17_R1.java @@ -0,0 +1,47 @@ +package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1; + +import java.util.EnumMap; +import java.util.function.Function; + +import org.bukkit.craftbukkit.v1_17_R1.CraftWorld; + +import net.minecraft.world.level.World; +import net.sourcewriters.minecraft.vcompat.reflection.EntityProvider; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; +import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.utils.EntityConstructors1_17_R1; + +public class EntityProvider1_17_R1 extends EntityProvider { + + private final EnumMap> entityMap = new EnumMap<>(NmsEntityType.class); + + protected EntityProvider1_17_R1(VersionControl1_17_R1 versionControl) { + super(versionControl); + } + + @SuppressWarnings("unchecked") + private final Function searchConstructor(NmsEntityType type) { + try { + return (Function) EntityConstructors1_17_R1.class.getField(type.name()).get(null); + } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException ignore) { + return null; + } + } + + private final Function getConstructor(NmsEntityType type) { + return entityMap.computeIfAbsent(type, (key -> searchConstructor(key))); + } + + @Override + public NmsEntity createEntity(org.bukkit.World world, NmsEntityType type) { + if (!(world instanceof CraftWorld)) { + return null; + } + Function function; + if ((function = getConstructor(type)) == null) { + return null; + } + return function.apply(((CraftWorld) world).getHandle()); + } + +} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/PacketHandler1_17_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/PacketHandler1_17_R1.java new file mode 100644 index 0000000..0e8f846 --- /dev/null +++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/PacketHandler1_17_R1.java @@ -0,0 +1,11 @@ +package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1; + +import net.sourcewriters.minecraft.vcompat.reflection.PacketHandler; + +public class PacketHandler1_17_R1 extends PacketHandler { + + protected PacketHandler1_17_R1(VersionControl1_17_R1 versionControl) { + super(versionControl); + } + +} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/PlayerProvider1_17_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/PlayerProvider1_17_R1.java new file mode 100644 index 0000000..b86d64f --- /dev/null +++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/PlayerProvider1_17_R1.java @@ -0,0 +1,20 @@ +package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1; + +import org.bukkit.entity.Player; + +import net.sourcewriters.minecraft.vcompat.reflection.PlayerProvider; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.entity.Player1_17_R1; + +public class PlayerProvider1_17_R1 extends PlayerProvider { + + protected PlayerProvider1_17_R1(VersionControl1_17_R1 versionControl) { + super(versionControl); + } + + @Override + protected NmsPlayer createPlayer(Player player) { + return new Player1_17_R1(player); + } + +} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/TextureProvider1_17_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/TextureProvider1_17_R1.java new file mode 100644 index 0000000..196d308 --- /dev/null +++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/TextureProvider1_17_R1.java @@ -0,0 +1,102 @@ +package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1; + +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_17_R1.block.CraftBlockEntityState; +import org.bukkit.craftbukkit.v1_17_R1.block.CraftSkull; +import org.bukkit.craftbukkit.v1_17_R1.inventory.CraftItemStack; +import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.inventory.meta.SkullMeta; + +import com.mojang.authlib.GameProfile; +import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; +import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.minecraft.nbt.GameProfileSerializer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.entity.TileEntitySkull; +import net.sourcewriters.minecraft.vcompat.reflection.TextureProvider; + +public class TextureProvider1_17_R1 extends TextureProvider { + + private final AbstractReflect craftEntityStateRef = new Reflect(CraftBlockEntityState.class).searchField("tileEntity", "tileEntity"); + private final AbstractReflect craftItemStackRef = new Reflect(CraftItemStack.class).searchField("handle", "handle"); + private final AbstractReflect craftMetaSkullRef = new Reflect("org.bukkit.craftbukkit.v1_17_R1.inventory.CraftMetaSkull") + .searchField("serialized", "serializedProfile").searchField("profile", "profile"); + + protected TextureProvider1_17_R1(VersionControl1_17_R1 versionControl) { + super(versionControl); + } + + @Override + public GameProfile profileFromBlock(Block block) { + if (!(block instanceof CraftSkull)) { + return null; + } + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + return entitySkull.e; + } + + @Override + public GameProfile profileFromItem(org.bukkit.inventory.ItemStack itemStack) { + if (!(itemStack.getItemMeta() instanceof SkullMeta)) { + return null; + } + SkullMeta meta = (SkullMeta) itemStack.getItemMeta(); + GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue("profile", meta); + if (profile == null) { + NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue("serialized", meta); + if (compound == null) { + ItemStack stack = null; + if (itemStack instanceof CraftItemStack) { + stack = (ItemStack) craftItemStackRef.getFieldValue("handle", itemStack); + } + if (stack == null) { + stack = CraftItemStack.asNMSCopy(itemStack); + } + NBTTagCompound stackTag = stack.getOrCreateTag(); + if (stackTag.hasKeyOfType("SkullOwner", 10)) { + compound = stackTag.getCompound("SkullOwner"); + } else if (stackTag.hasKeyOfType("SkullProfile", 10)) { + compound = stackTag.getCompound("SkullProfile"); + } + } + if (compound == null) { + return null; + } + profile = GameProfileSerializer.deserialize(compound); + } + return profile; + } + + @Override + public org.bukkit.inventory.ItemStack getItem(GameProfile profile) { + org.bukkit.inventory.ItemStack craftStack = CraftItemStack.asCraftCopy(new org.bukkit.inventory.ItemStack(Material.PLAYER_HEAD)); + applyItem(craftStack, profile); + return craftStack; + } + + @Override + public boolean applyItem(org.bukkit.inventory.ItemStack itemStack, GameProfile profile) { + ItemMeta meta = itemStack.getItemMeta(); + if (!(meta instanceof SkullMeta)) { + return false; + } + SkullMeta skullMeta = (SkullMeta) meta; + craftMetaSkullRef.setFieldValue(meta, "profile", profile); + itemStack.setItemMeta(skullMeta); + return true; + } + + @Override + public boolean applyBlock(Block block, GameProfile profile) { + if (!(block instanceof CraftSkull)) { + return false; + } + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + entitySkull.setGameProfile(profile); + return true; + } + +} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/ToolProvider1_17_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/ToolProvider1_17_R1.java new file mode 100644 index 0000000..5a588bb --- /dev/null +++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/ToolProvider1_17_R1.java @@ -0,0 +1,33 @@ +package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1; + +import net.sourcewriters.minecraft.vcompat.reflection.ToolProvider; +import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.tools.BlockTools1_17_R1; +import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.tools.ServerTools1_17_R1; +import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.tools.SkinTools1_17_R1; + +public class ToolProvider1_17_R1 extends ToolProvider { + + private final BlockTools1_17_R1 blockTools = new BlockTools1_17_R1(); + private final SkinTools1_17_R1 skinTools = new SkinTools1_17_R1(); + private final ServerTools1_17_R1 serverTools = new ServerTools1_17_R1(); + + protected ToolProvider1_17_R1(VersionControl1_17_R1 versionControl) { + super(versionControl); + } + + @Override + public SkinTools1_17_R1 getSkinTools() { + return skinTools; + } + + @Override + public ServerTools1_17_R1 getServerTools() { + return serverTools; + } + + @Override + public BlockTools1_17_R1 getBlockTools() { + return blockTools; + } + +} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/VersionControl1_17_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/VersionControl1_17_R1.java new file mode 100644 index 0000000..9637a7f --- /dev/null +++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/VersionControl1_17_R1.java @@ -0,0 +1,61 @@ +package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1; + +import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; +import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.data.hook.BukkitContainerAdapterHook1_17_R1; + +public class VersionControl1_17_R1 extends VersionControl { + + public static VersionControl1_17_R1 INSTANCE; + + public static VersionControl1_17_R1 init() { + return INSTANCE != null ? INSTANCE : (INSTANCE = new VersionControl1_17_R1()); + } + + private final ToolProvider1_17_R1 toolProvider = new ToolProvider1_17_R1(this); + private final TextureProvider1_17_R1 textureProvider = new TextureProvider1_17_R1(this); + private final PacketHandler1_17_R1 packetHandler = new PacketHandler1_17_R1(this); + private final EntityProvider1_17_R1 entityProvider = new EntityProvider1_17_R1(this); + private final PlayerProvider1_17_R1 playerProvider = new PlayerProvider1_17_R1(this); + private final BukkitConversion1_17_R1 bukkitConversion = new BukkitConversion1_17_R1(this); + + private VersionControl1_17_R1() { + BukkitContainerAdapterHook1_17_R1.hookEntity(); + } + + @Override + public ToolProvider1_17_R1 getToolProvider() { + return toolProvider; + } + + @Override + public EntityProvider1_17_R1 getEntityProvider() { + return entityProvider; + } + + @Override + public PlayerProvider1_17_R1 getPlayerProvider() { + return playerProvider; + } + + @Override + public TextureProvider1_17_R1 getTextureProvider() { + return textureProvider; + } + + @Override + public PacketHandler1_17_R1 getPacketHandler() { + return packetHandler; + } + + @Override + public BukkitConversion1_17_R1 getBukkitConversion() { + return bukkitConversion; + } + + @Override + public void shutdown() { + dataProvider.getDefaultDistributor().shutdown(); + BukkitContainerAdapterHook1_17_R1.unhookAll(); + } + +} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/BukkitContainer1_17_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/BukkitContainer1_17_R1.java new file mode 100644 index 0000000..9394231 --- /dev/null +++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/BukkitContainer1_17_R1.java @@ -0,0 +1,161 @@ +package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.data; + +import java.util.Arrays; +import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; + +import org.bukkit.NamespacedKey; +import org.bukkit.persistence.PersistentDataAdapterContext; +import org.bukkit.persistence.PersistentDataContainer; +import org.bukkit.persistence.PersistentDataType; + +import com.syntaxphoenix.syntaxapi.data.IDataContainer; + +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; +import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SyntaxKey; + +public final class BukkitContainer1_17_R1 extends WrappedContainer implements PersistentDataContainer { + + private final IDataContainer container; + + public BukkitContainer1_17_R1(IDataContainer container) { + this.container = container; + } + + @Override + public IDataContainer getHandle() { + return container; + } + + @Override + public IDataContainer getAsSyntaxContainer() { + return container; + } + + /* + * + */ + + @Override + public boolean has(NamespacedKey key, PersistentDataType type) { + return has(new BukkitKey1_17_R1(key), WrappedType1_17_R1.wrap(type)); + } + + @Override + public Z get(NamespacedKey key, PersistentDataType type) { + return get(new BukkitKey1_17_R1(key), WrappedType1_17_R1.wrap(type)); + } + + @Override + public Z getOrDefault(NamespacedKey key, PersistentDataType type, Z value) { + return Optional.ofNullable(get(key, type)).orElse(value); + } + + @Override + public void set(NamespacedKey key, PersistentDataType type, Z value) { + set(new BukkitKey1_17_R1(key), value, WrappedType1_17_R1.wrap(type)); + } + + @Override + public void remove(NamespacedKey key) { + remove(new BukkitKey1_17_R1(key)); + } + + @Override + public Set getKeys() { + return Arrays.stream(container.getKeys()).map(SyntaxKey::new).map(BukkitKey1_17_R1::asBukkit).collect(Collectors.toSet()); + } + + @Override + public PersistentDataAdapterContext getAdapterContext() { + return getContext(); + } + + /* + * + */ + + @Override + public BukkitContext1_17_R1 getContext() { + return new BukkitContext1_17_R1(container.getAdapterContext()); + } + + @Override + public boolean has(String key) { + return has(wrappedKey(key)); + } + + @Override + public boolean has(WrappedKey key) { + return container.has(key.getNamespacedKey()); + } + + @Override + public boolean has(String key, WrapType type) { + return has(wrappedKey(key), type); + } + + @Override + public boolean has(WrappedKey key, WrapType type) { + return container.has(key.getNamespacedKey(), type.syntaxType()); + } + + @Override + public Object get(String key) { + return get(wrappedKey(key)); + } + + @Override + public Object get(WrappedKey key) { + return container.get(key.getNamespacedKey()); + } + + @Override + public C get(String key, WrapType type) { + return get(wrappedKey(key), type); + } + + @Override + public C get(WrappedKey key, WrapType type) { + return container.get(key.getNamespacedKey(), type.syntaxType()); + } + + @Override + public void set(String key, B value, WrapType type) { + set(wrappedKey(key), value, type); + } + + @Override + public void set(WrappedKey key, B value, WrapType type) { + container.set(key.getNamespacedKey(), value, type.syntaxType()); + } + + @Override + public boolean remove(String key) { + return false; + } + + @Override + public boolean remove(WrappedKey key) { + return container.remove(key.getNamespacedKey()); + } + + @Override + public Set keySet() { + return container.getKeyspaces(); + } + + @Override + public boolean isEmpty() { + return container.isEmpty(); + } + + @Override + public int size() { + return container.size(); + } + +} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/BukkitContext1_17_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/BukkitContext1_17_R1.java new file mode 100644 index 0000000..1e702c2 --- /dev/null +++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/BukkitContext1_17_R1.java @@ -0,0 +1,39 @@ +package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.data; + +import org.bukkit.persistence.PersistentDataAdapterContext; +import org.bukkit.persistence.PersistentDataContainer; + +import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; +import com.syntaxphoenix.syntaxapi.data.IDataContainer; + +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; + +public final class BukkitContext1_17_R1 extends WrappedContext implements PersistentDataAdapterContext { + + private final DataAdapterContext context; + + public BukkitContext1_17_R1(DataAdapterContext context) { + this.context = context; + } + + @Override + public DataAdapterContext getHandle() { + return context; + } + + @Override + public PersistentDataContainer newPersistentDataContainer() { + return newContainer(); + } + + @Override + public IDataContainer newDataContainer() { + return context.newDataContainer(); + } + + @Override + public BukkitContainer1_17_R1 newContainer() { + return new BukkitContainer1_17_R1(context.newDataContainer()); + } + +} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/BukkitKey1_17_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/BukkitKey1_17_R1.java new file mode 100644 index 0000000..444fe6a --- /dev/null +++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/BukkitKey1_17_R1.java @@ -0,0 +1,52 @@ +package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.data; + +import org.bukkit.NamespacedKey; +import org.bukkit.plugin.Plugin; + +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; + +public final class BukkitKey1_17_R1 extends WrappedKey { + + private final NamespacedKey key; + + public BukkitKey1_17_R1(Plugin plugin, String key) { + this.key = new NamespacedKey(plugin, key); + } + + @SuppressWarnings("deprecation") + public BukkitKey1_17_R1(String name, String key) { + this.key = new NamespacedKey(name, key); + } + + public BukkitKey1_17_R1(NamespacedKey key) { + this.key = key; + } + + @Override + public NamespacedKey getHandle() { + return key; + } + + @Override + public String getName() { + return key.getNamespace(); + } + + @Override + public String getKey() { + return key.getKey(); + } + + @Override + public String toString() { + return key.toString(); + } + + public static NamespacedKey asBukkit(WrappedKey key) { + if (key.getHandle() instanceof NamespacedKey) { + return (NamespacedKey) key.getHandle(); + } + return new BukkitKey1_17_R1(key.getName(), key.getKey()).getHandle(); + } + +} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/BukkitType1_17_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/BukkitType1_17_R1.java new file mode 100644 index 0000000..1f69230 --- /dev/null +++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/BukkitType1_17_R1.java @@ -0,0 +1,69 @@ +package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.data; + +import org.bukkit.persistence.PersistentDataAdapterContext; +import org.bukkit.persistence.PersistentDataType; + +import com.syntaxphoenix.syntaxapi.data.DataType; + +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; + +public class BukkitType1_17_R1 extends WrappedType1_17_R1, P0, P1, C0, C1> + implements PersistentDataType { + + private final DataType type; + + public BukkitType1_17_R1(DataType type) { + super(type.getPrimitive(), type.getComplex()); + this.type = type; + } + + @Override + public DataType getHandle() { + return type; + } + + @Override + public Class getPrimitiveOriginal() { + return type.getPrimitive(); + } + + @Override + public Class getComplexOriginal() { + return type.getComplex(); + } + + /* + * + */ + + @Override + public Class getComplexType() { + return complexType; + } + + @Override + public Class getPrimitiveType() { + return primitiveType; + } + + @Override + public P0 toPrimitive(C0 complex, PersistentDataAdapterContext context) { + return wrapToPrimitive(complex, new SyntaxContext1_17_R1(context)); + } + + @Override + public C0 fromPrimitive(P0 primitive, PersistentDataAdapterContext context) { + return wrapToComplex(primitive, new SyntaxContext1_17_R1(context)); + } + + @Override + public P0 wrapToPrimitive(C0 complex, WrappedContext context) { + return toPrimitiveWrapped(type.toPrimitive(context, toComplexOriginal(complex))); + } + + @Override + public C0 wrapToComplex(P0 primitive, WrappedContext context) { + return toComplexWrapped(type.fromPrimitive(context, toPrimitiveOriginal(primitive))); + } + +} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/SimpleBukkitType1_17_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/SimpleBukkitType1_17_R1.java new file mode 100644 index 0000000..781aeea --- /dev/null +++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/SimpleBukkitType1_17_R1.java @@ -0,0 +1,36 @@ +package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.data; + +import org.bukkit.persistence.PersistentDataAdapterContext; +import org.bukkit.persistence.PersistentDataType; + +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; + +public class SimpleBukkitType1_17_R1 implements PersistentDataType { + + private final WrapType type; + + public SimpleBukkitType1_17_R1(WrapType type) { + this.type = type; + } + + @Override + public Class getComplexType() { + return type.getComplexWrapped(); + } + + @Override + public Class

getPrimitiveType() { + return type.getPrimitiveWrapped(); + } + + @Override + public P toPrimitive(C complex, PersistentDataAdapterContext context) { + return type.wrapToPrimitive(complex, new SyntaxContext1_17_R1(context)); + } + + @Override + public C fromPrimitive(P primitive, PersistentDataAdapterContext context) { + return type.wrapToComplex(primitive, new SyntaxContext1_17_R1(context)); + } + +} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/SyntaxContainer1_17_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/SyntaxContainer1_17_R1.java new file mode 100644 index 0000000..b8df612 --- /dev/null +++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/SyntaxContainer1_17_R1.java @@ -0,0 +1,185 @@ +package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.data; + +import java.util.Set; +import java.util.stream.Collectors; + +import org.bukkit.persistence.PersistentDataContainer; + +import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; +import com.syntaxphoenix.syntaxapi.data.DataType; +import com.syntaxphoenix.syntaxapi.data.IDataContainer; +import com.syntaxphoenix.syntaxapi.utils.key.IKey; + +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; +import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SyntaxKey; + +public final class SyntaxContainer1_17_R1 extends WrappedContainer implements IDataContainer { + + private final PersistentDataContainer container; + + public SyntaxContainer1_17_R1(PersistentDataContainer container) { + this.container = container; + } + + @Override + public PersistentDataContainer getHandle() { + return container; + } + + @Override + public IDataContainer getAsSyntaxContainer() { + return new SyntaxContainer1_17_R1(container); + } + + /* + * + */ + + @Override + public boolean has(IKey key) { + throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); + } + + @Override + public boolean has(String key, DataType type) { + return has(syntaxKey(key), type); + } + + @Override + public boolean has(IKey key, DataType type) { + return has(new SyntaxKey(key), WrappedType1_17_R1.wrap(type)); + } + + @Override + public C get(String key, DataType type) { + return get(syntaxKey(key), type); + } + + @Override + public C get(IKey key, DataType type) { + return get(new SyntaxKey(key), WrappedType1_17_R1.wrap(type)); + } + + @Override + public Object get(String key) { + throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); + } + + @Override + public Object get(IKey key) { + throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); + } + + @Override + public void set(String key, E value, DataType type) { + set(wrappedKey(key), value, WrappedType1_17_R1.wrap(type)); + } + + @Override + public void set(IKey key, E value, DataType type) { + set(new SyntaxKey(key), value, WrappedType1_17_R1.wrap(type)); + } + + @Override + public boolean remove(String key) { + return remove(wrappedKey(key)); + } + + @Override + public boolean remove(IKey key) { + return remove(new SyntaxKey(key)); + } + + @Override + public IKey[] getKeys() { + return container.getKeys().stream().map(BukkitKey1_17_R1::new).map(WrappedKey::getNamespacedKey).toArray(IKey[]::new); + } + + @Override + public Set getKeyspaces() { + return container.getKeys().stream().map(org.bukkit.NamespacedKey::toString).collect(Collectors.toSet()); + } + + @Override + public DataAdapterContext getAdapterContext() { + return getContext(); + } + + /* + * + */ + + @Override + public SyntaxContext1_17_R1 getContext() { + return new SyntaxContext1_17_R1(container.getAdapterContext()); + } + + @Override + public boolean has(String key) { + throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); + } + + @Override + public boolean has(WrappedKey key) { + throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); + } + + @Override + public boolean has(String key, WrapType type) { + return has(wrappedKey(key), type); + } + + @Override + public boolean has(WrappedKey key, WrapType type) { + return container.has(BukkitKey1_17_R1.asBukkit(key), new SimpleBukkitType1_17_R1<>(type)); + } + + @Override + public Object get(WrappedKey key) { + throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); + } + + @Override + public C get(String key, WrapType type) { + return get(wrappedKey(key), type); + } + + @Override + public C get(WrappedKey key, WrapType type) { + return container.get(BukkitKey1_17_R1.asBukkit(key), new SimpleBukkitType1_17_R1<>(type)); + } + + @Override + public void set(String key, B value, WrapType type) { + set(wrappedKey(key), value, type); + } + + @Override + public void set(WrappedKey key, B value, WrapType type) { + container.set(BukkitKey1_17_R1.asBukkit(key), new SimpleBukkitType1_17_R1<>(type), value); + } + + @Override + public boolean remove(WrappedKey key) { + container.remove(BukkitKey1_17_R1.asBukkit(key)); + return true; // Will always return true as we don't know if it contained it + } + + @Override + public Set keySet() { + return getKeyspaces(); + } + + @Override + public boolean isEmpty() { + return container.isEmpty(); + } + + @Override + public int size() { + return container.getKeys().size(); + } + +} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/SyntaxContext1_17_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/SyntaxContext1_17_R1.java new file mode 100644 index 0000000..097f452 --- /dev/null +++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/SyntaxContext1_17_R1.java @@ -0,0 +1,38 @@ +package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.data; + +import org.bukkit.persistence.PersistentDataAdapterContext; +import org.bukkit.persistence.PersistentDataContainer; + +import com.syntaxphoenix.syntaxapi.data.IDataContainer; + +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; + +public final class SyntaxContext1_17_R1 extends WrappedContext implements PersistentDataAdapterContext { + + private final PersistentDataAdapterContext context; + + public SyntaxContext1_17_R1(PersistentDataAdapterContext context) { + this.context = context; + } + + @Override + public PersistentDataAdapterContext getHandle() { + return context; + } + + @Override + public PersistentDataContainer newPersistentDataContainer() { + return context.newPersistentDataContainer(); + } + + @Override + public IDataContainer newDataContainer() { + return newContainer(); + } + + @Override + public SyntaxContainer1_17_R1 newContainer() { + return new SyntaxContainer1_17_R1(context.newPersistentDataContainer()); + } + +} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/SyntaxType1_17_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/SyntaxType1_17_R1.java new file mode 100644 index 0000000..024c8d1 --- /dev/null +++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/SyntaxType1_17_R1.java @@ -0,0 +1,76 @@ +package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.data; + +import org.bukkit.persistence.PersistentDataAdapterContext; +import org.bukkit.persistence.PersistentDataType; + +import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; +import com.syntaxphoenix.syntaxapi.data.DataType; + +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; + +public class SyntaxType1_17_R1 extends WrappedType1_17_R1, P0, P1, C0, C1> + implements DataType { + + private final PersistentDataType type; + + public SyntaxType1_17_R1(PersistentDataType type) { + super(type.getPrimitiveType(), type.getComplexType()); + this.type = type; + } + + @Override + public PersistentDataType getHandle() { + return type; + } + + @Override + public Class getPrimitiveOriginal() { + return type.getPrimitiveType(); + } + + @Override + public Class getComplexOriginal() { + return type.getComplexType(); + } + + /* + * + */ + + @Override + public Class getComplex() { + return complexType; + } + + @Override + public Class getPrimitive() { + return primitiveType; + } + + @Override + public P0 toPrimitive(DataAdapterContext context, C0 complex) { + return wrapToPrimitive(complex, new BukkitContext1_17_R1(context)); + } + + @Override + public C0 fromPrimitive(DataAdapterContext context, P0 primitive) { + return wrapToComplex(primitive, new BukkitContext1_17_R1(context)); + } + + @Override + public P0 wrapToPrimitive(C0 complex, WrappedContext context) { + if (!(context instanceof PersistentDataAdapterContext)) { + return null; + } + return toPrimitiveWrapped(type.toPrimitive(toComplexOriginal(complex), (PersistentDataAdapterContext) context)); + } + + @Override + public C0 wrapToComplex(P0 primitive, WrappedContext context) { + if (!(context instanceof PersistentDataAdapterContext)) { + return null; + } + return toComplexWrapped(type.fromPrimitive(toPrimitiveOriginal(primitive), (PersistentDataAdapterContext) context)); + } + +} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/WrappedType1_17_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/WrappedType1_17_R1.java new file mode 100644 index 0000000..2444fad --- /dev/null +++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/WrappedType1_17_R1.java @@ -0,0 +1,150 @@ +package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.data; + +import java.util.Arrays; + +import org.bukkit.persistence.PersistentDataContainer; +import org.bukkit.persistence.PersistentDataType; + +import com.syntaxphoenix.syntaxapi.data.DataType; +import com.syntaxphoenix.syntaxapi.data.IDataContainer; + +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; + +public abstract class WrappedType1_17_R1 implements WrapType { + + protected final Class primitiveType; + protected final Class complexType; + + private final int primitiveWrap; + private final int complexWrap; + + @SuppressWarnings("unchecked") + protected WrappedType1_17_R1(Class primitive, Class complex) { + this.primitiveWrap = WrappedType1_17_R1.internalState(primitive); + this.complexWrap = WrappedType1_17_R1.internalState(complex); + this.primitiveType = (Class) WrappedType1_17_R1.internalWrap(primitive, primitiveWrap); + this.complexType = (Class) WrappedType1_17_R1.internalWrap(complex, complexWrap); + } + + public abstract H getHandle(); + + public Class getPrimitiveWrapped() { + return primitiveType; + } + + public Class getComplexWrapped() { + return complexType; + } + + public abstract Class getPrimitiveOriginal(); + + public abstract Class getComplexOriginal(); + + @SuppressWarnings("unchecked") + public P0 toPrimitiveWrapped(P1 primitive) { + switch (primitiveWrap) { + case 1: + return (P0) new SyntaxContainer1_17_R1((PersistentDataContainer) primitive); + case 2: + return (P0) Arrays.stream((PersistentDataContainer[]) primitive).map(SyntaxContainer1_17_R1::new) + .toArray(SyntaxContainer1_17_R1[]::new); + case 3: + return (P0) new BukkitContainer1_17_R1((IDataContainer) primitive); + case 4: + return (P0) Arrays.stream((IDataContainer[]) primitive).map(BukkitContainer1_17_R1::new) + .toArray(BukkitContainer1_17_R1[]::new); + default: + return (P0) primitive; + } + } + + @SuppressWarnings("unchecked") + public C0 toComplexWrapped(C1 complex) { + switch (complexWrap) { + case 1: + return (C0) new SyntaxContainer1_17_R1((PersistentDataContainer) complex); + case 2: + return (C0) Arrays.stream((PersistentDataContainer[]) complex).map(SyntaxContainer1_17_R1::new).toArray(SyntaxContainer1_17_R1[]::new); + case 3: + return (C0) new BukkitContainer1_17_R1((IDataContainer) complex); + case 4: + return (C0) Arrays.stream((IDataContainer[]) complex).map(BukkitContainer1_17_R1::new).toArray(BukkitContainer1_17_R1[]::new); + default: + return (C0) complex; + } + } + + @SuppressWarnings("unchecked") + public P1 toPrimitiveOriginal(P0 primitive) { + switch (primitiveWrap) { + case 1: + return (P1) new BukkitContainer1_17_R1((IDataContainer) primitive); + case 2: + return (P1) Arrays.stream((IDataContainer[]) primitive).map(BukkitContainer1_17_R1::new) + .toArray(BukkitContainer1_17_R1[]::new); + case 3: + return (P1) new SyntaxContainer1_17_R1((PersistentDataContainer) primitive); + case 4: + return (P1) Arrays.stream((PersistentDataContainer[]) primitive).map(SyntaxContainer1_17_R1::new) + .toArray(SyntaxContainer1_17_R1[]::new); + default: + return (P1) primitive; + } + } + + @SuppressWarnings("unchecked") + public C1 toComplexOriginal(C0 complex) { + switch (complexWrap) { + case 1: + return (C1) new BukkitContainer1_17_R1((IDataContainer) complex); + case 2: + return (C1) Arrays.stream((IDataContainer[]) complex).map(BukkitContainer1_17_R1::new).toArray(BukkitContainer1_17_R1[]::new); + case 3: + return (C1) new SyntaxContainer1_17_R1((PersistentDataContainer) complex); + case 4: + return (C1) Arrays.stream((PersistentDataContainer[]) complex).map(SyntaxContainer1_17_R1::new).toArray(SyntaxContainer1_17_R1[]::new); + default: + return (C1) complex; + } + } + + protected static Class internalWrap(Class clazz, int state) { + switch (state) { + case 1: + return SyntaxContainer1_17_R1.class; + case 2: + return SyntaxContainer1_17_R1[].class; + case 3: + return BukkitContainer1_17_R1.class; + case 4: + return BukkitContainer1_17_R1[].class; + default: + return clazz; + } + } + + protected static int internalState(Class clazz) { + if (clazz.isAssignableFrom(PersistentDataContainer.class)) { + return 1; + } + if (clazz.isAssignableFrom(PersistentDataContainer[].class)) { + return 2; + } + if (clazz.isAssignableFrom(IDataContainer.class)) { + return 3; + } + if (clazz.isAssignableFrom(IDataContainer[].class)) { + return 4; + } + return 0; + } + + public static BukkitType1_17_R1 wrap(DataType type) { + return new BukkitType1_17_R1<>(type); + } + + public static SyntaxType1_17_R1 wrap(PersistentDataType type) { + return new SyntaxType1_17_R1<>(type); + } + +} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/hook/BukkitContainerAdapterHook1_17_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/hook/BukkitContainerAdapterHook1_17_R1.java new file mode 100644 index 0000000..72b6ccd --- /dev/null +++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/hook/BukkitContainerAdapterHook1_17_R1.java @@ -0,0 +1,134 @@ +package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.data.hook; + +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; + +import org.bukkit.craftbukkit.v1_17_R1.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_17_R1.persistence.CraftPersistentDataContainer; +import org.bukkit.craftbukkit.v1_17_R1.persistence.CraftPersistentDataTypeRegistry; +import org.bukkit.persistence.PersistentDataContainer; + +import com.syntaxphoenix.syntaxapi.data.IDataContainer; +import com.syntaxphoenix.syntaxapi.data.container.nbt.NbtContainer; +import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; +import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; +import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.minecraft.nbt.NBTTagCompound; +import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.data.BukkitContainer1_17_R1; +import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.data.SyntaxContainer1_17_R1; + +@SuppressWarnings({ + "rawtypes", + "unchecked" +}) +public final class BukkitContainerAdapterHook1_17_R1 { + + private static final BukkitContainerAdapterHook1_17_R1 HOOK = new BukkitContainerAdapterHook1_17_R1(); + + private final AbstractReflect registryRef = new Reflect(CraftPersistentDataTypeRegistry.class) + .searchMethod("create", "createAdapter", Class.class, Class.class, Function.class, Function.class) + .searchField("adapters", "adapters") + .searchField("function", "CREATE_ADAPTER"); + private final AbstractReflect entityRef = new Reflect(CraftEntity.class).searchField("registry", "DATA_TYPE_REGISTRY"); + + private BukkitContainerAdapterHook1_17_R1() {} + + private final HashMap map = new HashMap<>(); + + private CraftPersistentDataTypeRegistry getEntityRegistry() { + return (CraftPersistentDataTypeRegistry) entityRef.getFieldValue("registry"); + } + + private void uninjectAll() { + for (CraftPersistentDataTypeRegistry registry : map.keySet()) { + Map adapters = (Map) registryRef.getFieldValue("adapters", registry); + adapters.remove(BukkitContainer1_17_R1.class); + adapters.remove(SyntaxContainer1_17_R1.class); + registryRef.setFieldValue(registry, "function", map.get(registry)); + } + map.clear(); + } + + private void inject(CraftPersistentDataTypeRegistry registry) { + if (map.containsKey(registry)) { + return; + } + map.put(registry, (Function) registryRef.getFieldValue("function", registry)); + Function function = clazz -> createAdapter(registry, registryRef.getMethod("create").getReturnType(), (Class) clazz); + registryRef.setFieldValue(registry, "function", function); + } + + private E createAdapter(CraftPersistentDataTypeRegistry registry, Class adapterType, Class type) { + if (Objects.equals(BukkitContainer1_17_R1.class, type)) { + return (E) buildAdapter(registry, BukkitContainer1_17_R1.class, tag -> fromPrimitiveSyntax(tag)); + } + if (Objects.equals(SyntaxContainer1_17_R1.class, type)) { + return (E) buildAdapter(registry, SyntaxContainer1_17_R1.class, tag -> fromPrimitiveBukkit(registry, tag)); + } + return (E) map.get(registry).apply(type); + } + + private Object buildAdapter(Object handle, Class type, Function function) { + return registryRef.run(handle, "create", type, NBTTagCompound.class, (Function) input -> toPrimitive(input), + function); + } + + private NBTTagCompound toPrimitive(WrappedContainer input) { + Object handle = findFinalContainer(input).getHandle(); + if (handle instanceof PersistentDataContainer) { + if (handle instanceof CraftPersistentDataContainer) { + return ((CraftPersistentDataContainer) handle).toTagCompound(); + } + throw new IllegalArgumentException( + "Expected 'CraftPersistentDataContainer' got '" + handle.getClass().getSimpleName() + " instead'!"); + } + if (handle instanceof IDataContainer) { + if (handle instanceof NbtContainer) { + return (NBTTagCompound) VersionControl.get().getBukkitConversion().toMinecraftCompound(((NbtContainer) handle).asNbt()); + } + throw new IllegalArgumentException( + "Expected 'CraftPersistentDataContainer' got '" + handle.getClass().getSimpleName() + " instead'!"); + } + throw new IllegalArgumentException("Unknown WrappedContainer implementation!"); + } + + private BukkitContainer1_17_R1 fromPrimitiveSyntax(NBTTagCompound data) { + VersionControl control = VersionControl.get(); + NbtContainer container = new NbtContainer(control.getDataProvider().getRegistry()); + NbtCompound compound = control.getBukkitConversion().fromMinecraftCompound(data); + container.fromNbt(compound); + return new BukkitContainer1_17_R1(container); + } + + private SyntaxContainer1_17_R1 fromPrimitiveBukkit(CraftPersistentDataTypeRegistry registry, NBTTagCompound data) { + CraftPersistentDataContainer container = new CraftPersistentDataContainer(registry); + container.putAll(data); + return new SyntaxContainer1_17_R1(container); + } + + private WrappedContainer findFinalContainer(WrappedContainer container) { + WrappedContainer output = container; + while (output.getHandle() instanceof WrappedContainer) { + output = (WrappedContainer) output.getHandle(); + } + return output; + } + + public static void unhookAll() { + HOOK.uninjectAll(); + } + + public static void hookEntity() { + HOOK.inject(HOOK.getEntityRegistry()); + } + + public static void hook(CraftPersistentDataTypeRegistry registry) { + HOOK.inject(registry); + } + +} diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/entity/ArmorStand1_17_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/entity/ArmorStand1_17_R1.java new file mode 100644 index 0000000..4db2f5f --- /dev/null +++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/entity/ArmorStand1_17_R1.java @@ -0,0 +1,24 @@ +package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.entity; + +import net.minecraft.world.entity.EntityTypes; +import net.minecraft.world.entity.decoration.EntityArmorStand; +import net.minecraft.world.level.World; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsArmorStand; + +public class ArmorStand1_17_R1 extends EntityLiving1_17_R1 implements NmsArmorStand { + + public ArmorStand1_17_R1(World world) { + super(new EntityArmorStand(EntityTypes.c, world)); + } + + @Override + public void setSmall(boolean small) { + handle.setSmall(small); + } + + @Override + public boolean isSmall() { + return handle.isSmall(); + } + +} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/entity/Entity1_17_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/entity/Entity1_17_R1.java new file mode 100644 index 0000000..0a3aac1 --- /dev/null +++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/entity/Entity1_17_R1.java @@ -0,0 +1,215 @@ +package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.entity; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.UUID; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.OfflinePlayer; +import org.bukkit.craftbukkit.v1_17_R1.CraftWorld; +import org.bukkit.craftbukkit.v1_17_R1.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_17_R1.util.CraftChatMessage; +import org.bukkit.entity.Player; + +import net.minecraft.network.protocol.game.PacketPlayOutEntityDestroy; +import net.minecraft.network.protocol.game.PacketPlayOutEntityMetadata; +import net.minecraft.network.protocol.game.PacketPlayOutSpawnEntity; +import net.minecraft.server.network.PlayerConnection; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.phys.AxisAlignedBB; +import net.minecraft.world.phys.Vec3D; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.reflection.utils.NmsBoundingBox; + +public abstract class Entity1_17_R1 implements NmsEntity { + + protected final E handle; + + protected final List visible = Collections.synchronizedList(new ArrayList<>()); + + public Entity1_17_R1(E handle) { + this.handle = handle; + } + + @Override + public final E getHandle() { + return handle; + } + + @Override + public int getId() { + return handle.getId(); + } + + @Override + public UUID getUniqueId() { + return handle.getUniqueID(); + } + + @Override + public NmsBoundingBox getBoundingBox() { + AxisAlignedBB box = handle.getBoundingBox(); + return new NmsBoundingBox(box.a, box.b, box.c, box.d, box.e, box.f); + } + + @Override + public void setCustomName(String name) { + handle.setCustomName(CraftChatMessage.fromStringOrNull(name)); + updateVisibility(); + } + + @Override + public String getCustomName() { + return CraftChatMessage.fromComponent(handle.getCustomName()); + } + + @Override + public void setGravity(boolean gravity) { + handle.setNoGravity(!gravity); + } + + @Override + public boolean hasGravity() { + return !handle.isNoGravity(); + } + + @Override + public void setCustomNameVisible(boolean visible) { + handle.setCustomNameVisible(visible); + } + + @Override + public boolean isCustomNameVisible() { + return handle.getCustomNameVisible(); + } + + @Override + public void setInvisible(boolean invisible) { + handle.setInvisible(invisible); + } + + @Override + public boolean isInvisible() { + return handle.isInvisible(); + } + + @Override + public boolean isInteractable() { + return handle.isInteractable(); + } + + @Override + public boolean isCollidable() { + return handle.isCollidable(); + } + + @Override + public void setInvulnerable(boolean invulnerable) { + handle.setInvulnerable(invulnerable); + } + + @Override + public boolean isInvulnerable() { + return handle.isInvulnerable(); + } + + @Override + public void setLocation(Location location) { + handle.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); + if (location.getWorld() == null || handle.getWorld().getWorld() == location.getWorld()) { + updateVisibility(); + return; + } + handle.t = ((CraftWorld) location.getWorld()).getHandle(); + updateVisibility(); + } + + @Override + public Location getLocation() { + Vec3D vector = handle.getPositionVector(); + return new Location(handle.getWorld().getWorld(), vector.b, vector.c, vector.d); + } + + @Override + public void updateVisibility() { + if (visible.isEmpty()) { + return; + } + Player[] players; + synchronized (visible) { + players = visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) + .toArray(Player[]::new); + } + hide(players); + show(players); + } + + @Override + public boolean isShown(Player player) { + synchronized (visible) { + return visible.contains(player.getUniqueId()); + } + } + + @Override + public void hide(Player... players) { + if (players.length == 0) { + return; + } + PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(handle.getId()); + for (Player player : players) { + if (!isShown(player)) { + continue; + } + ((CraftPlayer) player).getHandle().b.sendPacket(packet); + synchronized (visible) { + visible.remove(player.getUniqueId()); + } + } + } + + @Override + public void show(Player... players) { + if (players.length == 0) { + return; + } + PacketPlayOutSpawnEntity packet = new PacketPlayOutSpawnEntity(handle); + PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); + PlayerConnection connection; + for (Player player : players) { + if (isShown(player)) { + continue; + } + connection = ((CraftPlayer) player).getHandle().b; + connection.sendPacket(packet); + connection.sendPacket(metadataPacket); + synchronized (visible) { + visible.add(player.getUniqueId()); + } + } + } + + @Override + public UUID[] getVisible() { + synchronized (visible) { + return visible.toArray(new UUID[0]); + } + } + + @Override + public Player[] getVisibleAsPlayer() { + synchronized (visible) { + return visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) + .toArray(Player[]::new); + } + } + + @Override + public void kill() { + hide(getVisibleAsPlayer()); + handle.die(); + } + +} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/entity/EntityLiving1_17_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/entity/EntityLiving1_17_R1.java new file mode 100644 index 0000000..f783394 --- /dev/null +++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/entity/EntityLiving1_17_R1.java @@ -0,0 +1,17 @@ +package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.entity; + +import net.minecraft.world.entity.EntityLiving; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityLiving; + +public abstract class EntityLiving1_17_R1 extends Entity1_17_R1 implements NmsEntityLiving { + + public EntityLiving1_17_R1(E handle) { + super(handle); + } + + @Override + public void setCollidable(boolean collidable) { + handle.collides = collidable; + } + +} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/entity/Player1_17_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/entity/Player1_17_R1.java new file mode 100644 index 0000000..bde4d75 --- /dev/null +++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/entity/Player1_17_R1.java @@ -0,0 +1,294 @@ +package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.entity; + +import java.util.ArrayList; +import java.util.Collections; + +import org.bukkit.craftbukkit.v1_17_R1.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_17_R1.util.CraftChatMessage; +import org.bukkit.entity.Player; + +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.properties.Property; +import com.mojang.authlib.properties.PropertyMap; +import com.mojang.datafixers.util.Pair; + +import net.minecraft.SystemUtils; +import net.minecraft.network.chat.ChatMessageType; +import net.minecraft.network.chat.IChatBaseComponent; +import net.minecraft.network.protocol.game.ClientboundSetSubtitleTextPacket; +import net.minecraft.network.protocol.game.ClientboundSetTitleTextPacket; +import net.minecraft.network.protocol.game.ClientboundSetTitlesAnimationPacket; +import net.minecraft.network.protocol.game.PacketPlayInClientCommand; +import net.minecraft.network.protocol.game.PacketPlayInClientCommand.EnumClientCommand; +import net.minecraft.network.protocol.game.PacketPlayOutChat; +import net.minecraft.network.protocol.game.PacketPlayOutEntityDestroy; +import net.minecraft.network.protocol.game.PacketPlayOutEntityEquipment; +import net.minecraft.network.protocol.game.PacketPlayOutEntityHeadRotation; +import net.minecraft.network.protocol.game.PacketPlayOutEntityMetadata; +import net.minecraft.network.protocol.game.PacketPlayOutEntityStatus; +import net.minecraft.network.protocol.game.PacketPlayOutHeldItemSlot; +import net.minecraft.network.protocol.game.PacketPlayOutNamedEntitySpawn; +import net.minecraft.network.protocol.game.PacketPlayOutPlayerInfo; +import net.minecraft.network.protocol.game.PacketPlayOutPlayerInfo.EnumPlayerInfoAction; +import net.minecraft.network.protocol.game.PacketPlayOutPlayerListHeaderFooter; +import net.minecraft.network.protocol.game.PacketPlayOutPosition; +import net.minecraft.network.protocol.game.PacketPlayOutRespawn; +import net.minecraft.server.level.EntityPlayer; +import net.minecraft.server.level.WorldServer; +import net.minecraft.server.network.PlayerConnection; +import net.minecraft.util.MathHelper; +import net.minecraft.world.entity.EnumItemSlot; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.biome.BiomeManager; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.reflection.data.type.SkinDataType; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.data.SyntaxContainer1_17_R1; +import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; +import net.sourcewriters.minecraft.vcompat.utils.bukkit.Players; +import net.sourcewriters.minecraft.vcompat.utils.minecraft.MojangProfileServer; +import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; +import net.sourcewriters.minecraft.vcompat.utils.thread.PostAsync; + +public class Player1_17_R1 extends EntityLiving1_17_R1 implements NmsPlayer { + + private String realName; + private Skin realSkin; + + private final WrappedContainer dataAdapter; + + public Player1_17_R1(Player player) { + super(((CraftPlayer) player).getHandle()); + dataAdapter = new SyntaxContainer1_17_R1(getBukkitPlayer().getPersistentDataContainer()); + update(false); + } + + @Override + public CraftPlayer getBukkitPlayer() { + return handle.getBukkitEntity(); + } + + @Override + public WrappedContainer getDataAdapter() { + return dataAdapter; + } + + @Override + public void setSkin(Skin skin) { + if (skin == null) { + return; + } + dataAdapter.set("skin", skin, SkinDataType.WRAPPED_INSTANCE); + } + + @Override + public Skin getSkin() { + return dataAdapter.getOrDefault("skin", SkinDataType.WRAPPED_INSTANCE, realSkin); + } + + @Override + public Skin getRealSkin() { + return realSkin; + } + + @Override + public void setName(String name) { + if (getName().equals(name)) { + return; + } + if (name == null) { + dataAdapter.remove("name"); + return; + } + dataAdapter.set("name", name, WrapType.STRING); + } + + @Override + public String getName() { + return dataAdapter.getOrDefault("name", WrapType.STRING, realName); + } + + @Override + public String getRealName() { + return realName; + } + + @Override + public void setPlayerListHeader(String text) { + setPlayerListHeaderAndFooter(text, getPlayerListFooter()); + } + + @Override + public String getPlayerListHeader() { + return dataAdapter.getOrDefault("header", WrapType.STRING, ""); + } + + @Override + public void setPlayerListFooter(String text) { + setPlayerListHeaderAndFooter(getPlayerListHeader(), text); + } + + @Override + public String getPlayerListFooter() { + return dataAdapter.getOrDefault("footer", WrapType.STRING, ""); + } + + @Override + public int getPing() { + return handle.e; + } + + @Override + public void setPlayerListHeaderAndFooter(String header, String footer) { + dataAdapter.set("header", header, WrapType.STRING); + dataAdapter.set("footer", footer, WrapType.STRING); + sendPlayerListInfo(header, footer); + } + + private final void sendPlayerListInfo(String header, String footer) { + if (handle.b.isDisconnected()) { + return; + } + + IChatBaseComponent headerComponent = header.isEmpty() ? null : CraftChatMessage.fromStringOrNull(header, true); + IChatBaseComponent footerComponent = footer.isEmpty() ? null : CraftChatMessage.fromStringOrNull(footer, true); + + handle.b.sendPacket(new PacketPlayOutPlayerListHeaderFooter(headerComponent, footerComponent)); + } + + @Override + public void setTitleTimes(int fadeIn, int stay, int fadeOut) { + if (handle.b.isDisconnected()) { + return; + } + handle.b.sendPacket(new ClientboundSetTitlesAnimationPacket(fadeIn, stay, fadeOut)); + } + + @Override + public void sendSubtitle(String text) { + if (handle.b.isDisconnected()) { + return; + } + handle.b.sendPacket(new ClientboundSetSubtitleTextPacket(CraftChatMessage.fromStringOrNull(text))); + } + + @Override + public void sendTitle(String text) { + if (handle.b.isDisconnected()) { + return; + } + handle.b.sendPacket(new ClientboundSetTitleTextPacket(CraftChatMessage.fromStringOrNull(text))); + } + + @Override + public void sendActionBar(String text) { + if (handle.b.isDisconnected()) { + return; + } + handle.b.sendPacket(new PacketPlayOutChat(CraftChatMessage.fromStringOrNull(text), ChatMessageType.c, SystemUtils.b)); + } + + @Override + public void fakeRespawn() { + if (handle.b.isDisconnected()) { + return; + } + PacketPlayOutPlayerInfo remInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.e, handle); + PacketPlayOutPlayerInfo addInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.a, handle); + + PacketPlayOutEntityDestroy destroyPacket = new PacketPlayOutEntityDestroy(handle.getId()); + PacketPlayOutNamedEntitySpawn spawnPacket = new PacketPlayOutNamedEntitySpawn(handle); + PacketPlayOutEntityHeadRotation rotationPacket = new PacketPlayOutEntityHeadRotation(handle, + (byte) MathHelper.d(handle.getHeadRotation() * 256F / 360F)); + + ArrayList> list = new ArrayList<>(); + for (EnumItemSlot slot : EnumItemSlot.values()) { + list.add(Pair.of(slot, handle.getEquipment(slot))); + } + PacketPlayOutEntityEquipment equipmentPacket = new PacketPlayOutEntityEquipment(handle.getId(), list); + + Player self = getBukkitPlayer(); + Player[] players = Players.getOnlineWithout(getUniqueId()); + for (Player player : players) { + if (!player.canSee(self)) { + continue; + } + PlayerConnection connection = ((CraftPlayer) player).getHandle().b; + connection.sendPacket(remInfoPacket); + connection.sendPacket(addInfoPacket); + connection.sendPacket(destroyPacket); + connection.sendPacket(spawnPacket); + connection.sendPacket(rotationPacket); + connection.sendPacket(equipmentPacket); + } + + WorldServer world = (WorldServer) handle.t; + + PacketPlayOutRespawn respawnPacket = new PacketPlayOutRespawn(world.getDimensionManager(), world.getDimensionKey(), + BiomeManager.a(world.getSeed()), handle.d.getGameMode(), handle.d.c(), + world.isDebugWorld(), world.isFlatWorld(), true); + PacketPlayOutPosition positionPacket = new PacketPlayOutPosition(handle.locX(), handle.locY(), handle.locZ(), handle.getHeadRotation(), + handle.getXRot(), Collections.emptySet(), 0, false); + PacketPlayOutHeldItemSlot itemPacket = new PacketPlayOutHeldItemSlot(handle.getInventory().k); + PacketPlayOutEntityStatus statusPacket = new PacketPlayOutEntityStatus(handle, (byte) 28); + PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); + + PlayerConnection connection = handle.b; + connection.sendPacket(remInfoPacket); + connection.sendPacket(addInfoPacket); + connection.sendPacket(respawnPacket); + connection.sendPacket(positionPacket); + connection.sendPacket(itemPacket); + connection.sendPacket(statusPacket); + connection.sendPacket(metadataPacket); + + handle.updateAbilities(); + handle.triggerHealthUpdate(); + handle.bU.updateInventory(); + if (handle.bV != handle.bU) { + handle.bV.updateInventory(); + } + self.recalculatePermissions(); + } + + @Override + public void respawn() { + if (handle.b.isDisconnected()) { + return; + } + handle.b.sendPacket(new PacketPlayInClientCommand(EnumClientCommand.a)); + } + + @Override + public void update() { + update(true); + } + + private final void update(boolean flag) { + PostAsync.forcePost(() -> { + realName = MojangProfileServer.getName(getUniqueId()); + realSkin = MojangProfileServer.getSkin(realName, getUniqueId()); + }); + if (flag) { + GameProfile profile = handle.getProfile(); + + Skin skin = getSkin(); + if (skin != null) { + PropertyMap properties = profile.getProperties(); + properties.removeAll("textures"); + properties.put("textures", new Property("textures", skin.getValue(), skin.getSignature())); + } + + String name = getName(); + if (name != null) { + ReflectionProvider.DEFAULT.getReflect("mjGameProfile").setFieldValue(profile, "name", name); + } + + if (!(name == null && skin == null)) { + fakeRespawn(); + } + } + } + +} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/tools/BlockTools1_17_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/tools/BlockTools1_17_R1.java new file mode 100644 index 0000000..8b5f435 --- /dev/null +++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/tools/BlockTools1_17_R1.java @@ -0,0 +1,39 @@ +package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.tools; + +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_17_R1.block.CraftSkull; + +import com.mojang.authlib.properties.Property; +import com.mojang.authlib.properties.PropertyMap; +import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; +import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.minecraft.world.level.block.entity.TileEntitySkull; +import net.sourcewriters.minecraft.vcompat.reflection.tools.BlockTools; +import net.sourcewriters.minecraft.vcompat.utils.constants.MinecraftConstants; + +public class BlockTools1_17_R1 extends BlockTools { + + private final AbstractReflect craftEntityStateRef = new Reflect(CraftSkull.class).searchField("tileEntity", "tileEntity"); + + @Override + public void setHeadTexture(Block block, String texture) { + if (!(block instanceof CraftSkull)) { + return; + } + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + PropertyMap map = entitySkull.e.getProperties(); + map.removeAll("textures"); + map.put("textures", new Property("textures", MinecraftConstants.TEXTURE_SIGNATURE, texture)); + } + + @Override + public String getHeadTexture(Block block) { + if (!(block instanceof CraftSkull)) { + return null; + } + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + return entitySkull.e.getProperties().get("textures").iterator().next().getValue(); + } + +} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/tools/ServerTools1_17_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/tools/ServerTools1_17_R1.java new file mode 100644 index 0000000..2fa2736 --- /dev/null +++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/tools/ServerTools1_17_R1.java @@ -0,0 +1,27 @@ +package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.tools; + +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; +import org.bukkit.craftbukkit.v1_17_R1.CraftServer; + +import net.sourcewriters.minecraft.vcompat.reflection.tools.ServerTools; + +public class ServerTools1_17_R1 extends ServerTools { + + @Override + public void setMotd(String text) { + ((CraftServer) Bukkit.getServer()).getServer().setMotd(text); + } + + @Override + public String getMotd() { + return ((CraftServer) Bukkit.getServer()).getServer().getMotd(); + } + + @SuppressWarnings("resource") + @Override + public ConsoleReader getConsole() { + return ((CraftServer) Bukkit.getServer()).getServer().reader; + } + +} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/tools/SkinTools1_17_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/tools/SkinTools1_17_R1.java new file mode 100644 index 0000000..87b9026 --- /dev/null +++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/tools/SkinTools1_17_R1.java @@ -0,0 +1,16 @@ +package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.tools; + +import org.bukkit.craftbukkit.v1_17_R1.entity.CraftPlayer; +import org.bukkit.entity.Player; + +import net.sourcewriters.minecraft.vcompat.reflection.tools.SkinTools; +import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; + +public class SkinTools1_17_R1 extends SkinTools { + + @Override + public Skin skinFromPlayer(Player player) { + return skinFromGameProfile(((CraftPlayer) player).getHandle().getProfile()); + } + +} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/utils/EntityConstructors1_17_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/utils/EntityConstructors1_17_R1.java new file mode 100644 index 0000000..181d7a9 --- /dev/null +++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/utils/EntityConstructors1_17_R1.java @@ -0,0 +1,12 @@ +package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.utils; + +import java.util.function.Function; + +import net.minecraft.world.level.World; +import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.entity.ArmorStand1_17_R1; + +public abstract class EntityConstructors1_17_R1 { + + public static final Function ARMOR_STAND = (world -> new ArmorStand1_17_R1(world)); + +} \ No newline at end of file From 4a3a4983eb918ce498ac38c92510e05309184c73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20Endre=C3=9F?= Date: Tue, 18 Jan 2022 12:31:38 +0100 Subject: [PATCH 05/47] WIP: Support 1_18_R1 (Missing ConsoleReaderWrapper for 1_8_R1 - 1_9_R2) --- pom.xml | 21 +- .../v1_10_R1/tools/ServerTools1_10_R1.java | 6 +- .../wrapper/ConsoleReaderWrapper1_10_R1.java | 43 +++ .../v1_11_R1/tools/ServerTools1_11_R1.java | 6 +- .../wrapper/ConsoleReaderWrapper1_11_R1.java | 43 +++ .../v1_12_R1/tools/ServerTools1_12_R1.java | 6 +- .../wrapper/ConsoleReaderWrapper1_12_R1.java | 43 +++ .../v1_13_R1/tools/ServerTools1_13_R1.java | 6 +- .../wrapper/ConsoleReaderWrapper1_13_R1.java | 43 +++ .../v1_13_R2/tools/ServerTools1_13_R2.java | 6 +- .../wrapper/ConsoleReaderWrapper1_13_R2.java | 43 +++ .../v1_14_R1/tools/ServerTools1_14_R1.java | 6 +- .../wrapper/ConsoleReaderWrapper1_14_R1.java | 43 +++ .../v1_15_R1/tools/ServerTools1_15_R1.java | 6 +- .../wrapper/ConsoleReaderWrapper1_15_R1.java | 43 +++ .../v1_16_R1/tools/ServerTools1_16_R1.java | 6 +- .../wrapper/ConsoleReaderWrapper1_16_R1.java | 43 +++ .../v1_16_R2/tools/ServerTools1_16_R2.java | 6 +- .../wrapper/ConsoleReaderWrapper1_16_R2.java | 43 +++ .../v1_16_R3/tools/ServerTools1_16_R3.java | 6 +- .../wrapper/ConsoleReaderWrapper1_16_R3.java | 43 +++ .../v1_17_R1/tools/ServerTools1_17_R1.java | 7 +- .../wrapper/ConsoleReaderWrapper1_17_R1.java | 43 +++ .../v1_18_R1/BukkitConversion1_18_R1.java | 218 +++++++++++++ .../v1_18_R1/EntityProvider1_18_R1.java | 47 +++ .../v1_18_R1/PacketHandler1_18_R1.java | 11 + .../v1_18_R1/PlayerProvider1_18_R1.java | 20 ++ .../v1_18_R1/TextureProvider1_18_R1.java | 102 ++++++ .../v1_18_R1/ToolProvider1_18_R1.java | 33 ++ .../v1_18_R1/VersionControl1_18_R1.java | 61 ++++ .../v1_18_R1/data/BukkitContainer1_18_R1.java | 161 ++++++++++ .../v1_18_R1/data/BukkitContext1_18_R1.java | 39 +++ .../v1_18_R1/data/BukkitKey1_18_R1.java | 52 ++++ .../v1_18_R1/data/BukkitType1_18_R1.java | 69 ++++ .../data/SimpleBukkitType1_18_R1.java | 36 +++ .../v1_18_R1/data/SyntaxContainer1_18_R1.java | 185 +++++++++++ .../v1_18_R1/data/SyntaxContext1_18_R1.java | 38 +++ .../v1_18_R1/data/SyntaxType1_18_R1.java | 76 +++++ .../v1_18_R1/data/WrappedType1_18_R1.java | 150 +++++++++ .../BukkitContainerAdapterHook1_18_R1.java | 134 ++++++++ .../v1_18_R1/entity/ArmorStand1_18_R1.java | 24 ++ .../v1_18_R1/entity/Entity1_18_R1.java | 215 +++++++++++++ .../v1_18_R1/entity/EntityLiving1_18_R1.java | 17 + .../v1_18_R1/entity/Player1_18_R1.java | 294 ++++++++++++++++++ .../v1_18_R1/tools/BlockTools1_18_R1.java | 39 +++ .../v1_18_R1/tools/ServerTools1_18_R1.java | 27 ++ .../v1_18_R1/tools/SkinTools1_18_R1.java | 16 + .../utils/EntityConstructors1_18_R1.java | 12 + .../wrapper/ConsoleReaderWrapper1_18_R1.java | 43 +++ .../vcompat/reflection/tools/ServerTools.java | 4 +- .../wrapper/ConsoleReaderWrapper.java | 16 + .../vcompat/utils/logging/BukkitLogger.java | 11 +- 52 files changed, 2666 insertions(+), 45 deletions(-) create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/wrapper/ConsoleReaderWrapper1_10_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/wrapper/ConsoleReaderWrapper1_11_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/wrapper/ConsoleReaderWrapper1_12_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/wrapper/ConsoleReaderWrapper1_13_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/wrapper/ConsoleReaderWrapper1_13_R2.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/wrapper/ConsoleReaderWrapper1_14_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/wrapper/ConsoleReaderWrapper1_15_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/wrapper/ConsoleReaderWrapper1_16_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/wrapper/ConsoleReaderWrapper1_16_R2.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/wrapper/ConsoleReaderWrapper1_16_R3.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/wrapper/ConsoleReaderWrapper1_17_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/BukkitConversion1_18_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/EntityProvider1_18_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/PacketHandler1_18_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/PlayerProvider1_18_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/TextureProvider1_18_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/ToolProvider1_18_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/VersionControl1_18_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/data/BukkitContainer1_18_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/data/BukkitContext1_18_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/data/BukkitKey1_18_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/data/BukkitType1_18_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/data/SimpleBukkitType1_18_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/data/SyntaxContainer1_18_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/data/SyntaxContext1_18_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/data/SyntaxType1_18_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/data/WrappedType1_18_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/data/hook/BukkitContainerAdapterHook1_18_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/entity/ArmorStand1_18_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/entity/Entity1_18_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/entity/EntityLiving1_18_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/entity/Player1_18_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/tools/BlockTools1_18_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/tools/ServerTools1_18_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/tools/SkinTools1_18_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/utils/EntityConstructors1_18_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/wrapper/ConsoleReaderWrapper1_18_R1.java create mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/wrapper/ConsoleReaderWrapper.java diff --git a/pom.xml b/pom.xml index f0c472b..ffcd146 100644 --- a/pom.xml +++ b/pom.xml @@ -99,13 +99,28 @@ 5.5.2 test + + org.spigotmc + spigot-api + 1.18.1-R0.1-SNAPSHOT + provided + + + + jline + jline + 2.12.1 + provided + + + bukkit spigot-1.17.1 @@ -113,14 +128,14 @@ system ${project.basedir}/libraries/spigot/spigot-1.17.1.jar - + + bukkit spigot-1.17.1 @@ -128,7 +128,7 @@ system ${project.basedir}/libraries/spigot/spigot-1.17.1.jar - + @@ -281,8 +281,8 @@ maven-compiler-plugin 3.8.1 - 8 - 8 + 11 + 11 diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/BukkitConversion1_18_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/BukkitConversion1_18_R1.java index 339ffb9..792a3a8 100644 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/BukkitConversion1_18_R1.java +++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/BukkitConversion1_18_R1.java @@ -110,28 +110,28 @@ public NbtTag fromMinecraftTag(Object raw) { return null; } NBTBase tag = (NBTBase) raw; - NbtType type = NbtType.getById(tag.getTypeId()); + NbtType type = NbtType.getById(tag.a()); switch (type) { case BYTE: - return new NbtByte(((NBTNumber) tag).asByte()); + return new NbtByte(((NBTNumber) tag).h()); case SHORT: - return new NbtShort(((NBTNumber) tag).asShort()); + return new NbtShort(((NBTNumber) tag).g()); case INT: - return new NbtInt(((NBTNumber) tag).asInt()); + return new NbtInt(((NBTNumber) tag).f()); case LONG: - return new NbtLong(((NBTNumber) tag).asLong()); + return new NbtLong(((NBTNumber) tag).e()); case FLOAT: - return new NbtFloat(((NBTNumber) tag).asFloat()); + return new NbtFloat(((NBTNumber) tag).j()); case DOUBLE: - return new NbtDouble(((NBTNumber) tag).asDouble()); + return new NbtDouble(((NBTNumber) tag).i()); case STRING: - return new NbtString(((NBTTagString) tag).asString()); + return new NbtString(((NBTTagString) tag).e_()); case BYTE_ARRAY: - return new NbtByteArray(((NBTTagByteArray) tag).getBytes()); + return new NbtByteArray(((NBTTagByteArray) tag).d()); case INT_ARRAY: - return new NbtIntArray(((NBTTagIntArray) tag).getInts()); + return new NbtIntArray(((NBTTagIntArray) tag).f()); case LONG_ARRAY: - return new NbtLongArray(((NBTTagLongArray) tag).getLongs()); + return new NbtLongArray(((NBTTagLongArray) tag).f()); case LIST: return fromMinecraftList(tag); case COMPOUND: @@ -158,7 +158,7 @@ public NbtList fromMinecraftList(Object raw) { return null; } NBTTagList list = (NBTTagList) raw; - NbtList output = new NbtList<>(NbtType.getById(list.getTypeId())); + NbtList output = new NbtList<>(NbtType.getById(list.e())); for (NBTBase base : list) { output.add(fromMinecraftTag(base)); } @@ -173,7 +173,7 @@ public NBTTagCompound toMinecraftCompound(NbtCompound compound) { } Set keys = compound.getKeys(); for (String key : keys) { - output.set(key, toMinecraftTag(compound.get(key))); + output.a(key, toMinecraftTag(compound.get(key))); } return output; } @@ -185,12 +185,12 @@ public NbtCompound fromMinecraftCompound(Object raw) { } NBTTagCompound compound = (NBTTagCompound) raw; NbtCompound output = new NbtCompound(); - if (compound.isEmpty()) { + if (compound.f()) { return output; } - Set keys = compound.getKeys(); + Set keys = compound.d(); for (String key : keys) { - output.set(key, fromMinecraftTag(compound.get(key))); + output.set(key, fromMinecraftTag(compound.c(key))); } return output; } @@ -202,7 +202,7 @@ public org.bukkit.inventory.ItemStack itemFromCompound(NbtCompound compound) { @Override public NbtCompound itemToCompound(org.bukkit.inventory.ItemStack itemStack) { - return fromMinecraftCompound(CraftItemStack.asNMSCopy(itemStack).save(new NBTTagCompound())); + return fromMinecraftCompound(CraftItemStack.asNMSCopy(itemStack).b(new NBTTagCompound())); } @Override diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/TextureProvider1_18_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/TextureProvider1_18_R1.java index b76174c..ebaa130 100644 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/TextureProvider1_18_R1.java +++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/TextureProvider1_18_R1.java @@ -55,17 +55,17 @@ public GameProfile profileFromItem(org.bukkit.inventory.ItemStack itemStack) { if (stack == null) { stack = CraftItemStack.asNMSCopy(itemStack); } - NBTTagCompound stackTag = stack.getOrCreateTag(); - if (stackTag.hasKeyOfType("SkullOwner", 10)) { - compound = stackTag.getCompound("SkullOwner"); - } else if (stackTag.hasKeyOfType("SkullProfile", 10)) { - compound = stackTag.getCompound("SkullProfile"); + NBTTagCompound stackTag = stack.t(); + if (stackTag.b("SkullOwner", 10)) { + compound = stackTag.p("SkullOwner"); + } else if (stackTag.b("SkullProfile", 10)) { + compound = stackTag.p("SkullProfile"); } } if (compound == null) { return null; } - profile = GameProfileSerializer.deserialize(compound); + profile = GameProfileSerializer.a(compound); } return profile; } @@ -95,7 +95,7 @@ public boolean applyBlock(Block block, GameProfile profile) { return false; } TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); - entitySkull.setGameProfile(profile); + entitySkull.a(profile); return true; } diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/entity/ArmorStand1_18_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/entity/ArmorStand1_18_R1.java index ec15563..f7dbe32 100644 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/entity/ArmorStand1_18_R1.java +++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/entity/ArmorStand1_18_R1.java @@ -13,12 +13,12 @@ public ArmorStand1_18_R1(World world) { @Override public void setSmall(boolean small) { - handle.setSmall(small); + handle.a(small); } @Override public boolean isSmall() { - return handle.isSmall(); + return handle.n(); } } \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/entity/Entity1_18_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/entity/Entity1_18_R1.java index 22db07c..51e8733 100644 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/entity/Entity1_18_R1.java +++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/entity/Entity1_18_R1.java @@ -40,85 +40,85 @@ public final E getHandle() { @Override public int getId() { - return handle.getId(); + return handle.ae(); } @Override public UUID getUniqueId() { - return handle.getUniqueID(); + return handle.cm(); } @Override public NmsBoundingBox getBoundingBox() { - AxisAlignedBB box = handle.getBoundingBox(); + AxisAlignedBB box = handle.cw(); return new NmsBoundingBox(box.a, box.b, box.c, box.d, box.e, box.f); } @Override public void setCustomName(String name) { - handle.setCustomName(CraftChatMessage.fromStringOrNull(name)); + handle.a(CraftChatMessage.fromStringOrNull(name)); updateVisibility(); } @Override public String getCustomName() { - return CraftChatMessage.fromComponent(handle.getCustomName()); + return CraftChatMessage.fromComponent(handle.Z()); } @Override public void setGravity(boolean gravity) { - handle.setNoGravity(!gravity); + handle.e(!gravity); } @Override public boolean hasGravity() { - return !handle.isNoGravity(); + return !handle.aM(); } @Override public void setCustomNameVisible(boolean visible) { - handle.setCustomNameVisible(visible); + handle.n(visible); } @Override public boolean isCustomNameVisible() { - return handle.getCustomNameVisible(); + return handle.cr(); } @Override public void setInvisible(boolean invisible) { - handle.setInvisible(invisible); + handle.j(invisible); } @Override public boolean isInvisible() { - return handle.isInvisible(); + return handle.bU(); } @Override public boolean isInteractable() { - return handle.isInteractable(); + return handle.cf(); } @Override public boolean isCollidable() { - return handle.isCollidable(); + return handle.bn(); } @Override public void setInvulnerable(boolean invulnerable) { - handle.setInvulnerable(invulnerable); + handle.m(invulnerable); } @Override public boolean isInvulnerable() { - return handle.isInvulnerable(); + return handle.cg(); } @Override public void setLocation(Location location) { - handle.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); - if (location.getWorld() == null || handle.getWorld().getWorld() == location.getWorld()) { + handle.a(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); + if (location.getWorld() == null || handle.W().getWorld() == location.getWorld()) { updateVisibility(); return; } @@ -128,8 +128,8 @@ public void setLocation(Location location) { @Override public Location getLocation() { - Vec3D vector = handle.getPositionVector(); - return new Location(handle.getWorld().getWorld(), vector.b, vector.c, vector.d); + Vec3D vector = handle.cV(); + return new Location(handle.W().getWorld(), vector.b, vector.c, vector.d); } @Override @@ -158,12 +158,12 @@ public void hide(Player... players) { if (players.length == 0) { return; } - PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(handle.getId()); + PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(handle.ae()); for (Player player : players) { if (!isShown(player)) { continue; } - ((CraftPlayer) player).getHandle().b.sendPacket(packet); + ((CraftPlayer) player).getHandle().b.a(packet); synchronized (visible) { visible.remove(player.getUniqueId()); } @@ -176,15 +176,15 @@ public void show(Player... players) { return; } PacketPlayOutSpawnEntity packet = new PacketPlayOutSpawnEntity(handle); - PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); + PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.ae(), handle.ai(), true); PlayerConnection connection; for (Player player : players) { if (isShown(player)) { continue; } connection = ((CraftPlayer) player).getHandle().b; - connection.sendPacket(packet); - connection.sendPacket(metadataPacket); + connection.a(packet); + connection.a(metadataPacket); synchronized (visible) { visible.add(player.getUniqueId()); } @@ -209,7 +209,7 @@ public Player[] getVisibleAsPlayer() { @Override public void kill() { hide(getVisibleAsPlayer()); - handle.die(); + handle.ag(); } } \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/entity/Player1_18_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/entity/Player1_18_R1.java index 78cc512..1207279 100644 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/entity/Player1_18_R1.java +++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/entity/Player1_18_R1.java @@ -154,7 +154,7 @@ private final void sendPlayerListInfo(String header, String footer) { IChatBaseComponent headerComponent = header.isEmpty() ? null : CraftChatMessage.fromStringOrNull(header, true); IChatBaseComponent footerComponent = footer.isEmpty() ? null : CraftChatMessage.fromStringOrNull(footer, true); - handle.b.sendPacket(new PacketPlayOutPlayerListHeaderFooter(headerComponent, footerComponent)); + handle.b.a(new PacketPlayOutPlayerListHeaderFooter(headerComponent, footerComponent)); } @Override @@ -162,7 +162,7 @@ public void setTitleTimes(int fadeIn, int stay, int fadeOut) { if (handle.b.isDisconnected()) { return; } - handle.b.sendPacket(new ClientboundSetTitlesAnimationPacket(fadeIn, stay, fadeOut)); + handle.b.a(new ClientboundSetTitlesAnimationPacket(fadeIn, stay, fadeOut)); } @Override @@ -170,7 +170,7 @@ public void sendSubtitle(String text) { if (handle.b.isDisconnected()) { return; } - handle.b.sendPacket(new ClientboundSetSubtitleTextPacket(CraftChatMessage.fromStringOrNull(text))); + handle.b.a(new ClientboundSetSubtitleTextPacket(CraftChatMessage.fromStringOrNull(text))); } @Override @@ -178,7 +178,7 @@ public void sendTitle(String text) { if (handle.b.isDisconnected()) { return; } - handle.b.sendPacket(new ClientboundSetTitleTextPacket(CraftChatMessage.fromStringOrNull(text))); + handle.b.a(new ClientboundSetTitleTextPacket(CraftChatMessage.fromStringOrNull(text))); } @Override @@ -186,7 +186,7 @@ public void sendActionBar(String text) { if (handle.b.isDisconnected()) { return; } - handle.b.sendPacket(new PacketPlayOutChat(CraftChatMessage.fromStringOrNull(text), ChatMessageType.c, SystemUtils.b)); + handle.b.a(new PacketPlayOutChat(CraftChatMessage.fromStringOrNull(text), ChatMessageType.c, SystemUtils.b)); } @Override @@ -197,16 +197,16 @@ public void fakeRespawn() { PacketPlayOutPlayerInfo remInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.e, handle); PacketPlayOutPlayerInfo addInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.a, handle); - PacketPlayOutEntityDestroy destroyPacket = new PacketPlayOutEntityDestroy(handle.getId()); + PacketPlayOutEntityDestroy destroyPacket = new PacketPlayOutEntityDestroy(handle.ae()); PacketPlayOutNamedEntitySpawn spawnPacket = new PacketPlayOutNamedEntitySpawn(handle); PacketPlayOutEntityHeadRotation rotationPacket = new PacketPlayOutEntityHeadRotation(handle, - (byte) MathHelper.d(handle.getHeadRotation() * 256F / 360F)); + (byte) MathHelper.d(handle.ce() * 256F / 360F)); ArrayList> list = new ArrayList<>(); for (EnumItemSlot slot : EnumItemSlot.values()) { - list.add(Pair.of(slot, handle.getEquipment(slot))); + list.add(Pair.of(slot, handle.b(slot))); } - PacketPlayOutEntityEquipment equipmentPacket = new PacketPlayOutEntityEquipment(handle.getId(), list); + PacketPlayOutEntityEquipment equipmentPacket = new PacketPlayOutEntityEquipment(handle.ae(), list); Player self = getBukkitPlayer(); Player[] players = Players.getOnlineWithout(getUniqueId()); @@ -215,39 +215,39 @@ public void fakeRespawn() { continue; } PlayerConnection connection = ((CraftPlayer) player).getHandle().b; - connection.sendPacket(remInfoPacket); - connection.sendPacket(addInfoPacket); - connection.sendPacket(destroyPacket); - connection.sendPacket(spawnPacket); - connection.sendPacket(rotationPacket); - connection.sendPacket(equipmentPacket); + connection.a(remInfoPacket); + connection.a(addInfoPacket); + connection.a(destroyPacket); + connection.a(spawnPacket); + connection.a(rotationPacket); + connection.a(equipmentPacket); } WorldServer world = (WorldServer) handle.t; - PacketPlayOutRespawn respawnPacket = new PacketPlayOutRespawn(world.getDimensionManager(), world.getDimensionKey(), - BiomeManager.a(world.getSeed()), handle.d.getGameMode(), handle.d.c(), - world.isDebugWorld(), world.isFlatWorld(), true); - PacketPlayOutPosition positionPacket = new PacketPlayOutPosition(handle.locX(), handle.locY(), handle.locZ(), handle.getHeadRotation(), - handle.getXRot(), Collections.emptySet(), 0, false); - PacketPlayOutHeldItemSlot itemPacket = new PacketPlayOutHeldItemSlot(handle.getInventory().k); + PacketPlayOutRespawn respawnPacket = new PacketPlayOutRespawn(world.q_(), world.aa(), + BiomeManager.a(world.E()), handle.d.b(), handle.d.c(), + world.ad(), world.D(), true); + PacketPlayOutPosition positionPacket = new PacketPlayOutPosition(handle.dc(), handle.de(), handle.di(), handle.ce(), + handle.dn(), Collections.emptySet(), 0, false); + PacketPlayOutHeldItemSlot itemPacket = new PacketPlayOutHeldItemSlot(handle.fq().k); PacketPlayOutEntityStatus statusPacket = new PacketPlayOutEntityStatus(handle, (byte) 28); - PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); + PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.ae(), handle.ai(), true); PlayerConnection connection = handle.b; - connection.sendPacket(remInfoPacket); - connection.sendPacket(addInfoPacket); - connection.sendPacket(respawnPacket); - connection.sendPacket(positionPacket); - connection.sendPacket(itemPacket); - connection.sendPacket(statusPacket); - connection.sendPacket(metadataPacket); - - handle.updateAbilities(); - handle.triggerHealthUpdate(); - handle.bU.updateInventory(); - if (handle.bV != handle.bU) { - handle.bV.updateInventory(); + connection.a(remInfoPacket); + connection.a(addInfoPacket); + connection.a(respawnPacket); + connection.a(positionPacket); + connection.a(itemPacket); + connection.a(statusPacket); + connection.a(metadataPacket); + + handle.w(); + handle.u(); + handle.bV.b(); + if (handle.bW != handle.bV) { + handle.bW.b(); } self.recalculatePermissions(); } @@ -257,7 +257,7 @@ public void respawn() { if (handle.b.isDisconnected()) { return; } - handle.b.sendPacket(new PacketPlayInClientCommand(EnumClientCommand.a)); + handle.b.a(new PacketPlayInClientCommand(EnumClientCommand.a)); } @Override @@ -271,7 +271,7 @@ private final void update(boolean flag) { realSkin = MojangProfileServer.getSkin(realName, getUniqueId()); }); if (flag) { - GameProfile profile = handle.getProfile(); + GameProfile profile = handle.fp(); Skin skin = getSkin(); if (skin != null) { diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/tools/SkinTools1_18_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/tools/SkinTools1_18_R1.java index 7fee8f8..4f5d4d0 100644 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/tools/SkinTools1_18_R1.java +++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/tools/SkinTools1_18_R1.java @@ -10,7 +10,7 @@ public class SkinTools1_18_R1 extends SkinTools { @Override public Skin skinFromPlayer(Player player) { - return skinFromGameProfile(((CraftPlayer) player).getHandle().getProfile()); + return skinFromGameProfile(((CraftPlayer) player).getHandle().fp()); } } \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/tools/ServerTools1_8_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/tools/ServerTools1_8_R1.java index 918333a..1445a92 100644 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/tools/ServerTools1_8_R1.java +++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/tools/ServerTools1_8_R1.java @@ -1,9 +1,9 @@ package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R1.tools; import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; import org.bukkit.craftbukkit.v1_8_R1.CraftServer; +import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R1.wrapper.ConsoleReaderWrapper1_8_R1; import net.sourcewriters.minecraft.vcompat.reflection.tools.ServerTools; public class ServerTools1_8_R1 extends ServerTools { @@ -19,8 +19,8 @@ public String getMotd() { } @Override - public ConsoleReader getConsole() { - return ((CraftServer) Bukkit.getServer()).getServer().reader; + public ConsoleReaderWrapper1_8_R1 getConsole() { + return ConsoleReaderWrapper1_8_R1.INSTANCE; } } \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/wrapper/ConsoleReaderWrapper1_8_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/wrapper/ConsoleReaderWrapper1_8_R1.java new file mode 100644 index 0000000..cd33303 --- /dev/null +++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/wrapper/ConsoleReaderWrapper1_8_R1.java @@ -0,0 +1,43 @@ +package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R1.wrapper; + +import java.io.IOException; +import java.io.Writer; + +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_8_R1.CraftServer; +import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; + +import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; + +public final class ConsoleReaderWrapper1_8_R1 extends ConsoleReaderWrapper { + + public static final ConsoleReaderWrapper1_8_R1 INSTANCE = new ConsoleReaderWrapper1_8_R1(); + + private final ConsoleReader reader; + + @SuppressWarnings("resource") + private ConsoleReaderWrapper1_8_R1() { + this.reader = ((CraftServer) Bukkit.getServer()).getServer().reader; + } + + @Override + public Writer getOutput() { + return reader.getOutput(); + } + + @Override + public boolean isAnsiSupported() { + return reader.getTerminal().isAnsiSupported(); + } + + @Override + public void flush() throws IOException { + reader.flush(); + } + + @Override + public void drawLine() throws IOException { + reader.drawLine(); + } + +} diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/tools/ServerTools1_8_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/tools/ServerTools1_8_R2.java index 0c3cb70..86f4c40 100644 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/tools/ServerTools1_8_R2.java +++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/tools/ServerTools1_8_R2.java @@ -1,9 +1,9 @@ package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R2.tools; import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; import org.bukkit.craftbukkit.v1_8_R2.CraftServer; +import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R2.wrapper.ConsoleReaderWrapper1_8_R2; import net.sourcewriters.minecraft.vcompat.reflection.tools.ServerTools; public class ServerTools1_8_R2 extends ServerTools { @@ -19,8 +19,8 @@ public String getMotd() { } @Override - public ConsoleReader getConsole() { - return ((CraftServer) Bukkit.getServer()).getServer().reader; + public ConsoleReaderWrapper1_8_R2 getConsole() { + return ConsoleReaderWrapper1_8_R2.INSTANCE; } } \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/wrapper/ConsoleReaderWrapper1_8_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/wrapper/ConsoleReaderWrapper1_8_R2.java new file mode 100644 index 0000000..99ffdf7 --- /dev/null +++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/wrapper/ConsoleReaderWrapper1_8_R2.java @@ -0,0 +1,43 @@ +package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R2.wrapper; + +import java.io.IOException; +import java.io.Writer; + +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_8_R2.CraftServer; +import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; + +import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; + +public final class ConsoleReaderWrapper1_8_R2 extends ConsoleReaderWrapper { + + public static final ConsoleReaderWrapper1_8_R2 INSTANCE = new ConsoleReaderWrapper1_8_R2(); + + private final ConsoleReader reader; + + @SuppressWarnings("resource") + private ConsoleReaderWrapper1_8_R2() { + this.reader = ((CraftServer) Bukkit.getServer()).getServer().reader; + } + + @Override + public Writer getOutput() { + return reader.getOutput(); + } + + @Override + public boolean isAnsiSupported() { + return reader.getTerminal().isAnsiSupported(); + } + + @Override + public void flush() throws IOException { + reader.flush(); + } + + @Override + public void drawLine() throws IOException { + reader.drawLine(); + } + +} diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/tools/ServerTools1_8_R3.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/tools/ServerTools1_8_R3.java index 4a37618..8a3f39e 100644 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/tools/ServerTools1_8_R3.java +++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/tools/ServerTools1_8_R3.java @@ -1,9 +1,9 @@ package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R3.tools; import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; import org.bukkit.craftbukkit.v1_8_R3.CraftServer; +import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R3.wrapper.ConsoleReaderWrapper1_8_R3; import net.sourcewriters.minecraft.vcompat.reflection.tools.ServerTools; public class ServerTools1_8_R3 extends ServerTools { @@ -19,8 +19,8 @@ public String getMotd() { } @Override - public ConsoleReader getConsole() { - return ((CraftServer) Bukkit.getServer()).getServer().reader; + public ConsoleReaderWrapper1_8_R3 getConsole() { + return ConsoleReaderWrapper1_8_R3.INSTANCE; } } \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/wrapper/ConsoleReaderWrapper1_8_R3.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/wrapper/ConsoleReaderWrapper1_8_R3.java new file mode 100644 index 0000000..0e37aef --- /dev/null +++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/wrapper/ConsoleReaderWrapper1_8_R3.java @@ -0,0 +1,43 @@ +package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R3.wrapper; + +import java.io.IOException; +import java.io.Writer; + +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_8_R3.CraftServer; +import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; + +import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; + +public final class ConsoleReaderWrapper1_8_R3 extends ConsoleReaderWrapper { + + public static final ConsoleReaderWrapper1_8_R3 INSTANCE = new ConsoleReaderWrapper1_8_R3(); + + private final ConsoleReader reader; + + @SuppressWarnings("resource") + private ConsoleReaderWrapper1_8_R3() { + this.reader = ((CraftServer) Bukkit.getServer()).getServer().reader; + } + + @Override + public Writer getOutput() { + return reader.getOutput(); + } + + @Override + public boolean isAnsiSupported() { + return reader.getTerminal().isAnsiSupported(); + } + + @Override + public void flush() throws IOException { + reader.flush(); + } + + @Override + public void drawLine() throws IOException { + reader.drawLine(); + } + +} diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/tools/ServerTools1_9_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/tools/ServerTools1_9_R1.java index 9ffa15c..5cb6077 100644 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/tools/ServerTools1_9_R1.java +++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/tools/ServerTools1_9_R1.java @@ -1,9 +1,9 @@ package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R1.tools; import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; import org.bukkit.craftbukkit.v1_9_R1.CraftServer; +import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R1.wrapper.ConsoleReaderWrapper1_9_R1; import net.sourcewriters.minecraft.vcompat.reflection.tools.ServerTools; public class ServerTools1_9_R1 extends ServerTools { @@ -19,8 +19,8 @@ public String getMotd() { } @Override - public ConsoleReader getConsole() { - return ((CraftServer) Bukkit.getServer()).getServer().reader; + public ConsoleReaderWrapper1_9_R1 getConsole() { + return ConsoleReaderWrapper1_9_R1.INSTANCE; } } \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/wrapper/ConsoleReaderWrapper1_9_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/wrapper/ConsoleReaderWrapper1_9_R1.java new file mode 100644 index 0000000..56ba4de --- /dev/null +++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/wrapper/ConsoleReaderWrapper1_9_R1.java @@ -0,0 +1,43 @@ +package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R1.wrapper; + +import java.io.IOException; +import java.io.Writer; + +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_9_R1.CraftServer; +import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; + +import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; + +public final class ConsoleReaderWrapper1_9_R1 extends ConsoleReaderWrapper { + + public static final ConsoleReaderWrapper1_9_R1 INSTANCE = new ConsoleReaderWrapper1_9_R1(); + + private final ConsoleReader reader; + + @SuppressWarnings("resource") + private ConsoleReaderWrapper1_9_R1() { + this.reader = ((CraftServer) Bukkit.getServer()).getServer().reader; + } + + @Override + public Writer getOutput() { + return reader.getOutput(); + } + + @Override + public boolean isAnsiSupported() { + return reader.getTerminal().isAnsiSupported(); + } + + @Override + public void flush() throws IOException { + reader.flush(); + } + + @Override + public void drawLine() throws IOException { + reader.drawLine(); + } + +} diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/tools/ServerTools1_9_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/tools/ServerTools1_9_R2.java index 10bed0f..4540499 100644 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/tools/ServerTools1_9_R2.java +++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/tools/ServerTools1_9_R2.java @@ -1,9 +1,9 @@ package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R2.tools; import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; import org.bukkit.craftbukkit.v1_9_R2.CraftServer; +import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R2.wrapper.ConsoleReaderWrapper1_9_R2; import net.sourcewriters.minecraft.vcompat.reflection.tools.ServerTools; public class ServerTools1_9_R2 extends ServerTools { @@ -19,8 +19,8 @@ public String getMotd() { } @Override - public ConsoleReader getConsole() { - return ((CraftServer) Bukkit.getServer()).getServer().reader; + public ConsoleReaderWrapper1_9_R2 getConsole() { + return ConsoleReaderWrapper1_9_R2.INSTANCE; } } \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/wrapper/ConsoleReaderWrapper1_9_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/wrapper/ConsoleReaderWrapper1_9_R2.java new file mode 100644 index 0000000..b5be77d --- /dev/null +++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/wrapper/ConsoleReaderWrapper1_9_R2.java @@ -0,0 +1,43 @@ +package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R2.wrapper; + +import java.io.IOException; +import java.io.Writer; + +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_9_R2.CraftServer; +import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; + +import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; + +public final class ConsoleReaderWrapper1_9_R2 extends ConsoleReaderWrapper { + + public static final ConsoleReaderWrapper1_9_R2 INSTANCE = new ConsoleReaderWrapper1_9_R2(); + + private final ConsoleReader reader; + + @SuppressWarnings("resource") + private ConsoleReaderWrapper1_9_R2() { + this.reader = ((CraftServer) Bukkit.getServer()).getServer().reader; + } + + @Override + public Writer getOutput() { + return reader.getOutput(); + } + + @Override + public boolean isAnsiSupported() { + return reader.getTerminal().isAnsiSupported(); + } + + @Override + public void flush() throws IOException { + reader.flush(); + } + + @Override + public void drawLine() throws IOException { + reader.drawLine(); + } + +} From f0c35fc8db08de27e49282f498587e43e5a81936 Mon Sep 17 00:00:00 2001 From: Lauriichan Date: Tue, 18 Jan 2022 18:15:03 +0100 Subject: [PATCH 07/47] Update versions.txt --- scripts/data/versions.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/data/versions.txt b/scripts/data/versions.txt index 8f8ab87..272d720 100644 --- a/scripts/data/versions.txt +++ b/scripts/data/versions.txt @@ -13,3 +13,5 @@ 1.16.1 1.16.3 1.16.4 +1.17.1 +1.18.1 \ No newline at end of file From 48a6efcef608933f50d29fd729f075bc96c78072 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20Endre=C3=9F?= Date: Wed, 19 Jan 2022 09:40:46 +0100 Subject: [PATCH 08/47] Change structure of vCompat --- lgtm.yml | 24 -- pom.xml | 207 ++---------- .../v1_10_R1/BukkitConversion1_10_R1.java | 231 -------------- .../v1_10_R1/EntityProvider1_10_R1.java | 47 --- .../v1_10_R1/PacketHandler1_10_R1.java | 11 - .../v1_10_R1/PlayerProvider1_10_R1.java | 30 -- .../v1_10_R1/TextureProvider1_10_R1.java | 105 ------- .../v1_10_R1/ToolProvider1_10_R1.java | 33 -- .../v1_10_R1/VersionControl1_10_R1.java | 56 ---- .../v1_10_R1/entity/ArmorStand1_10_R1.java | 23 -- .../v1_10_R1/entity/Entity1_10_R1.java | 215 ------------- .../v1_10_R1/entity/EntityLiving1_10_R1.java | 17 - .../v1_10_R1/entity/Player1_10_R1.java | 296 ------------------ .../reflection/NmsReflection1_10_R1.java | 34 -- .../v1_10_R1/tools/BlockTools1_10_R1.java | 39 --- .../v1_10_R1/tools/ServerTools1_10_R1.java | 26 -- .../v1_10_R1/tools/SkinTools1_10_R1.java | 16 - .../utils/EntityConstructors1_10_R1.java | 12 - .../wrapper/ConsoleReaderWrapper1_10_R1.java | 43 --- .../v1_11_R1/BukkitConversion1_11_R1.java | 228 -------------- .../v1_11_R1/EntityProvider1_11_R1.java | 47 --- .../v1_11_R1/PacketHandler1_11_R1.java | 11 - .../v1_11_R1/PlayerProvider1_11_R1.java | 30 -- .../v1_11_R1/TextureProvider1_11_R1.java | 103 ------ .../v1_11_R1/ToolProvider1_11_R1.java | 33 -- .../v1_11_R1/VersionControl1_11_R1.java | 56 ---- .../v1_11_R1/entity/ArmorStand1_11_R1.java | 23 -- .../v1_11_R1/entity/Entity1_11_R1.java | 215 ------------- .../v1_11_R1/entity/EntityLiving1_11_R1.java | 17 - .../v1_11_R1/entity/Player1_11_R1.java | 295 ----------------- .../reflection/NmsReflection1_11_R1.java | 34 -- .../v1_11_R1/tools/BlockTools1_11_R1.java | 39 --- .../v1_11_R1/tools/ServerTools1_11_R1.java | 26 -- .../v1_11_R1/tools/SkinTools1_11_R1.java | 16 - .../utils/EntityConstructors1_11_R1.java | 12 - .../wrapper/ConsoleReaderWrapper1_11_R1.java | 43 --- .../v1_12_R1/BukkitConversion1_12_R1.java | 226 ------------- .../v1_12_R1/EntityProvider1_12_R1.java | 47 --- .../v1_12_R1/PacketHandler1_12_R1.java | 11 - .../v1_12_R1/PlayerProvider1_12_R1.java | 30 -- .../v1_12_R1/TextureProvider1_12_R1.java | 108 ------- .../v1_12_R1/ToolProvider1_12_R1.java | 33 -- .../v1_12_R1/VersionControl1_12_R1.java | 56 ---- .../v1_12_R1/entity/ArmorStand1_12_R1.java | 23 -- .../v1_12_R1/entity/Entity1_12_R1.java | 215 ------------- .../v1_12_R1/entity/EntityLiving1_12_R1.java | 17 - .../v1_12_R1/entity/Player1_12_R1.java | 295 ----------------- .../reflection/NmsReflection1_12_R1.java | 36 --- .../v1_12_R1/tools/BlockTools1_12_R1.java | 39 --- .../v1_12_R1/tools/ServerTools1_12_R1.java | 26 -- .../v1_12_R1/tools/SkinTools1_12_R1.java | 16 - .../utils/EntityConstructors1_12_R1.java | 12 - .../wrapper/ConsoleReaderWrapper1_12_R1.java | 43 --- .../v1_13_R1/BukkitConversion1_13_R1.java | 218 ------------- .../v1_13_R1/EntityProvider1_13_R1.java | 47 --- .../v1_13_R1/PacketHandler1_13_R1.java | 11 - .../v1_13_R1/PlayerProvider1_13_R1.java | 30 -- .../v1_13_R1/TextureProvider1_13_R1.java | 102 ------ .../v1_13_R1/ToolProvider1_13_R1.java | 33 -- .../v1_13_R1/VersionControl1_13_R1.java | 54 ---- .../v1_13_R1/entity/ArmorStand1_13_R1.java | 23 -- .../v1_13_R1/entity/Entity1_13_R1.java | 216 ------------- .../v1_13_R1/entity/EntityLiving1_13_R1.java | 17 - .../v1_13_R1/entity/Player1_13_R1.java | 293 ----------------- .../v1_13_R1/tools/BlockTools1_13_R1.java | 39 --- .../v1_13_R1/tools/ServerTools1_13_R1.java | 26 -- .../v1_13_R1/tools/SkinTools1_13_R1.java | 16 - .../utils/EntityConstructors1_13_R1.java | 12 - .../wrapper/ConsoleReaderWrapper1_13_R1.java | 43 --- .../v1_13_R2/BukkitConversion1_13_R2.java | 218 ------------- .../v1_13_R2/EntityProvider1_13_R2.java | 47 --- .../v1_13_R2/PacketHandler1_13_R2.java | 11 - .../v1_13_R2/PlayerProvider1_13_R2.java | 30 -- .../v1_13_R2/TextureProvider1_13_R2.java | 102 ------ .../v1_13_R2/ToolProvider1_13_R2.java | 33 -- .../v1_13_R2/VersionControl1_13_R2.java | 54 ---- .../v1_13_R2/entity/ArmorStand1_13_R2.java | 23 -- .../v1_13_R2/entity/Entity1_13_R2.java | 216 ------------- .../v1_13_R2/entity/EntityLiving1_13_R2.java | 17 - .../v1_13_R2/entity/Player1_13_R2.java | 293 ----------------- .../v1_13_R2/tools/BlockTools1_13_R2.java | 39 --- .../v1_13_R2/tools/ServerTools1_13_R2.java | 26 -- .../v1_13_R2/tools/SkinTools1_13_R2.java | 16 - .../utils/EntityConstructors1_13_R2.java | 12 - .../wrapper/ConsoleReaderWrapper1_13_R2.java | 43 --- .../v1_14_R1/BukkitConversion1_14_R1.java | 218 ------------- .../v1_14_R1/EntityProvider1_14_R1.java | 47 --- .../v1_14_R1/PacketHandler1_14_R1.java | 11 - .../v1_14_R1/PlayerProvider1_14_R1.java | 20 -- .../v1_14_R1/TextureProvider1_14_R1.java | 102 ------ .../v1_14_R1/ToolProvider1_14_R1.java | 33 -- .../v1_14_R1/VersionControl1_14_R1.java | 61 ---- .../v1_14_R1/data/BukkitContainer1_14_R1.java | 160 ---------- .../v1_14_R1/data/BukkitContext1_14_R1.java | 39 --- .../v1_14_R1/data/BukkitKey1_14_R1.java | 52 --- .../v1_14_R1/data/BukkitType1_14_R1.java | 69 ---- .../data/SimpleBukkitType1_14_R1.java | 36 --- .../v1_14_R1/data/SyntaxContainer1_14_R1.java | 185 ----------- .../v1_14_R1/data/SyntaxContext1_14_R1.java | 38 --- .../v1_14_R1/data/SyntaxType1_14_R1.java | 76 ----- .../v1_14_R1/data/WrappedType1_14_R1.java | 150 --------- .../BukkitContainerAdapterHook1_14_R1.java | 134 -------- .../v1_14_R1/entity/ArmorStand1_14_R1.java | 24 -- .../v1_14_R1/entity/Entity1_14_R1.java | 215 ------------- .../v1_14_R1/entity/EntityLiving1_14_R1.java | 17 - .../v1_14_R1/entity/Player1_14_R1.java | 289 ----------------- .../v1_14_R1/tools/BlockTools1_14_R1.java | 39 --- .../v1_14_R1/tools/ServerTools1_14_R1.java | 27 -- .../v1_14_R1/tools/SkinTools1_14_R1.java | 16 - .../utils/EntityConstructors1_14_R1.java | 12 - .../wrapper/ConsoleReaderWrapper1_14_R1.java | 43 --- .../v1_15_R1/BukkitConversion1_15_R1.java | 218 ------------- .../v1_15_R1/EntityProvider1_15_R1.java | 47 --- .../v1_15_R1/PacketHandler1_15_R1.java | 11 - .../v1_15_R1/PlayerProvider1_15_R1.java | 20 -- .../v1_15_R1/TextureProvider1_15_R1.java | 102 ------ .../v1_15_R1/ToolProvider1_15_R1.java | 33 -- .../v1_15_R1/VersionControl1_15_R1.java | 61 ---- .../v1_15_R1/data/BukkitContainer1_15_R1.java | 160 ---------- .../v1_15_R1/data/BukkitContext1_15_R1.java | 39 --- .../v1_15_R1/data/BukkitKey1_15_R1.java | 52 --- .../v1_15_R1/data/BukkitType1_15_R1.java | 69 ---- .../data/SimpleBukkitType1_15_R1.java | 36 --- .../v1_15_R1/data/SyntaxContainer1_15_R1.java | 185 ----------- .../v1_15_R1/data/SyntaxContext1_15_R1.java | 38 --- .../v1_15_R1/data/SyntaxType1_15_R1.java | 76 ----- .../v1_15_R1/data/WrappedType1_15_R1.java | 150 --------- .../BukkitContainerAdapterHook1_15_R1.java | 134 -------- .../v1_15_R1/entity/ArmorStand1_15_R1.java | 24 -- .../v1_15_R1/entity/Entity1_15_R1.java | 215 ------------- .../v1_15_R1/entity/EntityLiving1_15_R1.java | 17 - .../v1_15_R1/entity/Player1_15_R1.java | 289 ----------------- .../v1_15_R1/tools/BlockTools1_15_R1.java | 39 --- .../v1_15_R1/tools/ServerTools1_15_R1.java | 27 -- .../v1_15_R1/tools/SkinTools1_15_R1.java | 16 - .../utils/EntityConstructors1_15_R1.java | 12 - .../wrapper/ConsoleReaderWrapper1_15_R1.java | 43 --- .../v1_16_R1/BukkitConversion1_16_R1.java | 218 ------------- .../v1_16_R1/EntityProvider1_16_R1.java | 47 --- .../v1_16_R1/PacketHandler1_16_R1.java | 11 - .../v1_16_R1/PlayerProvider1_16_R1.java | 20 -- .../v1_16_R1/TextureProvider1_16_R1.java | 102 ------ .../v1_16_R1/ToolProvider1_16_R1.java | 33 -- .../v1_16_R1/VersionControl1_16_R1.java | 61 ---- .../v1_16_R1/data/BukkitContainer1_16_R1.java | 161 ---------- .../v1_16_R1/data/BukkitContext1_16_R1.java | 39 --- .../v1_16_R1/data/BukkitKey1_16_R1.java | 52 --- .../v1_16_R1/data/BukkitType1_16_R1.java | 69 ---- .../data/SimpleBukkitType1_16_R1.java | 36 --- .../v1_16_R1/data/SyntaxContainer1_16_R1.java | 185 ----------- .../v1_16_R1/data/SyntaxContext1_16_R1.java | 38 --- .../v1_16_R1/data/SyntaxType1_16_R1.java | 76 ----- .../v1_16_R1/data/WrappedType1_16_R1.java | 150 --------- .../BukkitContainerAdapterHook1_16_R1.java | 134 -------- .../v1_16_R1/entity/ArmorStand1_16_R1.java | 24 -- .../v1_16_R1/entity/Entity1_16_R1.java | 215 ------------- .../v1_16_R1/entity/EntityLiving1_16_R1.java | 17 - .../v1_16_R1/entity/Player1_16_R1.java | 295 ----------------- .../v1_16_R1/tools/BlockTools1_16_R1.java | 39 --- .../v1_16_R1/tools/ServerTools1_16_R1.java | 27 -- .../v1_16_R1/tools/SkinTools1_16_R1.java | 16 - .../utils/EntityConstructors1_16_R1.java | 12 - .../wrapper/ConsoleReaderWrapper1_16_R1.java | 43 --- .../v1_16_R2/BukkitConversion1_16_R2.java | 218 ------------- .../v1_16_R2/EntityProvider1_16_R2.java | 47 --- .../v1_16_R2/PacketHandler1_16_R2.java | 11 - .../v1_16_R2/PlayerProvider1_16_R2.java | 20 -- .../v1_16_R2/TextureProvider1_16_R2.java | 102 ------ .../v1_16_R2/ToolProvider1_16_R2.java | 33 -- .../v1_16_R2/VersionControl1_16_R2.java | 61 ---- .../v1_16_R2/data/BukkitContainer1_16_R2.java | 161 ---------- .../v1_16_R2/data/BukkitContext1_16_R2.java | 39 --- .../v1_16_R2/data/BukkitKey1_16_R2.java | 52 --- .../v1_16_R2/data/BukkitType1_16_R2.java | 69 ---- .../data/SimpleBukkitType1_16_R2.java | 36 --- .../v1_16_R2/data/SyntaxContainer1_16_R2.java | 185 ----------- .../v1_16_R2/data/SyntaxContext1_16_R2.java | 38 --- .../v1_16_R2/data/SyntaxType1_16_R2.java | 76 ----- .../v1_16_R2/data/WrappedType1_16_R2.java | 150 --------- .../BukkitContainerAdapterHook1_16_R2.java | 134 -------- .../v1_16_R2/entity/ArmorStand1_16_R2.java | 24 -- .../v1_16_R2/entity/Entity1_16_R2.java | 215 ------------- .../v1_16_R2/entity/EntityLiving1_16_R2.java | 17 - .../v1_16_R2/entity/Player1_16_R2.java | 295 ----------------- .../v1_16_R2/tools/BlockTools1_16_R2.java | 39 --- .../v1_16_R2/tools/ServerTools1_16_R2.java | 27 -- .../v1_16_R2/tools/SkinTools1_16_R2.java | 16 - .../utils/EntityConstructors1_16_R2.java | 12 - .../wrapper/ConsoleReaderWrapper1_16_R2.java | 43 --- .../v1_16_R3/BukkitConversion1_16_R3.java | 218 ------------- .../v1_16_R3/EntityProvider1_16_R3.java | 47 --- .../v1_16_R3/PacketHandler1_16_R3.java | 11 - .../v1_16_R3/PlayerProvider1_16_R3.java | 20 -- .../v1_16_R3/TextureProvider1_16_R3.java | 102 ------ .../v1_16_R3/ToolProvider1_16_R3.java | 33 -- .../v1_16_R3/VersionControl1_16_R3.java | 61 ---- .../v1_16_R3/data/BukkitContainer1_16_R3.java | 161 ---------- .../v1_16_R3/data/BukkitContext1_16_R3.java | 39 --- .../v1_16_R3/data/BukkitKey1_16_R3.java | 52 --- .../v1_16_R3/data/BukkitType1_16_R3.java | 69 ---- .../data/SimpleBukkitType1_16_R3.java | 36 --- .../v1_16_R3/data/SyntaxContainer1_16_R3.java | 185 ----------- .../v1_16_R3/data/SyntaxContext1_16_R3.java | 38 --- .../v1_16_R3/data/SyntaxType1_16_R3.java | 76 ----- .../v1_16_R3/data/WrappedType1_16_R3.java | 150 --------- .../BukkitContainerAdapterHook1_16_R3.java | 134 -------- .../v1_16_R3/entity/ArmorStand1_16_R3.java | 24 -- .../v1_16_R3/entity/Entity1_16_R3.java | 215 ------------- .../v1_16_R3/entity/EntityLiving1_16_R3.java | 17 - .../v1_16_R3/entity/Player1_16_R3.java | 295 ----------------- .../v1_16_R3/tools/BlockTools1_16_R3.java | 39 --- .../v1_16_R3/tools/ServerTools1_16_R3.java | 27 -- .../v1_16_R3/tools/SkinTools1_16_R3.java | 16 - .../utils/EntityConstructors1_16_R3.java | 12 - .../wrapper/ConsoleReaderWrapper1_16_R3.java | 43 --- .../v1_17_R1/BukkitConversion1_17_R1.java | 218 ------------- .../v1_17_R1/EntityProvider1_17_R1.java | 47 --- .../v1_17_R1/PacketHandler1_17_R1.java | 11 - .../v1_17_R1/PlayerProvider1_17_R1.java | 20 -- .../v1_17_R1/TextureProvider1_17_R1.java | 102 ------ .../v1_17_R1/ToolProvider1_17_R1.java | 33 -- .../v1_17_R1/VersionControl1_17_R1.java | 61 ---- .../v1_17_R1/data/BukkitContainer1_17_R1.java | 161 ---------- .../v1_17_R1/data/BukkitContext1_17_R1.java | 39 --- .../v1_17_R1/data/BukkitKey1_17_R1.java | 52 --- .../v1_17_R1/data/BukkitType1_17_R1.java | 69 ---- .../data/SimpleBukkitType1_17_R1.java | 36 --- .../v1_17_R1/data/SyntaxContainer1_17_R1.java | 185 ----------- .../v1_17_R1/data/SyntaxContext1_17_R1.java | 38 --- .../v1_17_R1/data/SyntaxType1_17_R1.java | 76 ----- .../v1_17_R1/data/WrappedType1_17_R1.java | 150 --------- .../BukkitContainerAdapterHook1_17_R1.java | 134 -------- .../v1_17_R1/entity/ArmorStand1_17_R1.java | 24 -- .../v1_17_R1/entity/Entity1_17_R1.java | 215 ------------- .../v1_17_R1/entity/EntityLiving1_17_R1.java | 17 - .../v1_17_R1/entity/Player1_17_R1.java | 294 ----------------- .../v1_17_R1/tools/BlockTools1_17_R1.java | 39 --- .../v1_17_R1/tools/ServerTools1_17_R1.java | 26 -- .../v1_17_R1/tools/SkinTools1_17_R1.java | 16 - .../utils/EntityConstructors1_17_R1.java | 12 - .../wrapper/ConsoleReaderWrapper1_17_R1.java | 43 --- .../v1_18_R1/BukkitConversion1_18_R1.java | 218 ------------- .../v1_18_R1/EntityProvider1_18_R1.java | 47 --- .../v1_18_R1/PacketHandler1_18_R1.java | 11 - .../v1_18_R1/PlayerProvider1_18_R1.java | 20 -- .../v1_18_R1/TextureProvider1_18_R1.java | 102 ------ .../v1_18_R1/ToolProvider1_18_R1.java | 33 -- .../v1_18_R1/VersionControl1_18_R1.java | 61 ---- .../v1_18_R1/data/BukkitContainer1_18_R1.java | 161 ---------- .../v1_18_R1/data/BukkitContext1_18_R1.java | 39 --- .../v1_18_R1/data/BukkitKey1_18_R1.java | 52 --- .../v1_18_R1/data/BukkitType1_18_R1.java | 69 ---- .../data/SimpleBukkitType1_18_R1.java | 36 --- .../v1_18_R1/data/SyntaxContainer1_18_R1.java | 185 ----------- .../v1_18_R1/data/SyntaxContext1_18_R1.java | 38 --- .../v1_18_R1/data/SyntaxType1_18_R1.java | 76 ----- .../v1_18_R1/data/WrappedType1_18_R1.java | 150 --------- .../BukkitContainerAdapterHook1_18_R1.java | 134 -------- .../v1_18_R1/entity/ArmorStand1_18_R1.java | 24 -- .../v1_18_R1/entity/Entity1_18_R1.java | 215 ------------- .../v1_18_R1/entity/EntityLiving1_18_R1.java | 17 - .../v1_18_R1/entity/Player1_18_R1.java | 294 ----------------- .../v1_18_R1/tools/BlockTools1_18_R1.java | 39 --- .../v1_18_R1/tools/ServerTools1_18_R1.java | 27 -- .../v1_18_R1/tools/SkinTools1_18_R1.java | 16 - .../utils/EntityConstructors1_18_R1.java | 12 - .../wrapper/ConsoleReaderWrapper1_18_R1.java | 43 --- .../v1_8_R1/BukkitConversion1_8_R1.java | 232 -------------- .../v1_8_R1/EntityProvider1_8_R1.java | 47 --- .../provider/v1_8_R1/PacketHandler1_8_R1.java | 11 - .../v1_8_R1/PlayerProvider1_8_R1.java | 30 -- .../v1_8_R1/TextureProvider1_8_R1.java | 107 ------- .../provider/v1_8_R1/ToolProvider1_8_R1.java | 33 -- .../v1_8_R1/VersionControl1_8_R1.java | 56 ---- .../v1_8_R1/entity/ArmorStand1_8_R1.java | 33 -- .../provider/v1_8_R1/entity/Entity1_8_R1.java | 213 ------------- .../v1_8_R1/entity/EntityLiving1_8_R1.java | 17 - .../provider/v1_8_R1/entity/Player1_8_R1.java | 295 ----------------- .../reflection/NmsReflection1_8_R1.java | 34 -- .../v1_8_R1/tools/BlockTools1_8_R1.java | 39 --- .../v1_8_R1/tools/ServerTools1_8_R1.java | 26 -- .../v1_8_R1/tools/SkinTools1_8_R1.java | 16 - .../utils/EntityConstructors1_8_R1.java | 12 - .../wrapper/ConsoleReaderWrapper1_8_R1.java | 43 --- .../v1_8_R2/BukkitConversion1_8_R2.java | 231 -------------- .../v1_8_R2/EntityProvider1_8_R2.java | 47 --- .../provider/v1_8_R2/PacketHandler1_8_R2.java | 11 - .../v1_8_R2/PlayerProvider1_8_R2.java | 30 -- .../v1_8_R2/TextureProvider1_8_R2.java | 105 ------- .../provider/v1_8_R2/ToolProvider1_8_R2.java | 33 -- .../v1_8_R2/VersionControl1_8_R2.java | 56 ---- .../v1_8_R2/entity/ArmorStand1_8_R2.java | 33 -- .../provider/v1_8_R2/entity/Entity1_8_R2.java | 213 ------------- .../v1_8_R2/entity/EntityLiving1_8_R2.java | 17 - .../provider/v1_8_R2/entity/Player1_8_R2.java | 295 ----------------- .../reflection/NmsReflection1_8_R2.java | 34 -- .../v1_8_R2/tools/BlockTools1_8_R2.java | 39 --- .../v1_8_R2/tools/ServerTools1_8_R2.java | 26 -- .../v1_8_R2/tools/SkinTools1_8_R2.java | 16 - .../utils/EntityConstructors1_8_R2.java | 12 - .../wrapper/ConsoleReaderWrapper1_8_R2.java | 43 --- .../v1_8_R3/BukkitConversion1_8_R3.java | 231 -------------- .../v1_8_R3/EntityProvider1_8_R3.java | 47 --- .../provider/v1_8_R3/PacketHandler1_8_R3.java | 11 - .../v1_8_R3/PlayerProvider1_8_R3.java | 30 -- .../v1_8_R3/TextureProvider1_8_R3.java | 105 ------- .../provider/v1_8_R3/ToolProvider1_8_R3.java | 33 -- .../v1_8_R3/VersionControl1_8_R3.java | 56 ---- .../v1_8_R3/entity/ArmorStand1_8_R3.java | 33 -- .../provider/v1_8_R3/entity/Entity1_8_R3.java | 213 ------------- .../v1_8_R3/entity/EntityLiving1_8_R3.java | 17 - .../provider/v1_8_R3/entity/Player1_8_R3.java | 295 ----------------- .../reflection/NmsReflection1_8_R3.java | 34 -- .../v1_8_R3/tools/BlockTools1_8_R3.java | 39 --- .../v1_8_R3/tools/ServerTools1_8_R3.java | 26 -- .../v1_8_R3/tools/SkinTools1_8_R3.java | 16 - .../utils/EntityConstructors1_8_R3.java | 12 - .../wrapper/ConsoleReaderWrapper1_8_R3.java | 43 --- .../v1_9_R1/BukkitConversion1_9_R1.java | 231 -------------- .../v1_9_R1/EntityProvider1_9_R1.java | 47 --- .../provider/v1_9_R1/PacketHandler1_9_R1.java | 11 - .../v1_9_R1/PlayerProvider1_9_R1.java | 30 -- .../v1_9_R1/TextureProvider1_9_R1.java | 105 ------- .../provider/v1_9_R1/ToolProvider1_9_R1.java | 33 -- .../v1_9_R1/VersionControl1_9_R1.java | 56 ---- .../v1_9_R1/entity/ArmorStand1_9_R1.java | 33 -- .../provider/v1_9_R1/entity/Entity1_9_R1.java | 213 ------------- .../v1_9_R1/entity/EntityLiving1_9_R1.java | 17 - .../provider/v1_9_R1/entity/Player1_9_R1.java | 296 ------------------ .../reflection/NmsReflection1_9_R1.java | 34 -- .../v1_9_R1/tools/BlockTools1_9_R1.java | 39 --- .../v1_9_R1/tools/ServerTools1_9_R1.java | 26 -- .../v1_9_R1/tools/SkinTools1_9_R1.java | 16 - .../utils/EntityConstructors1_9_R1.java | 12 - .../wrapper/ConsoleReaderWrapper1_9_R1.java | 43 --- .../v1_9_R2/BukkitConversion1_9_R2.java | 231 -------------- .../v1_9_R2/EntityProvider1_9_R2.java | 47 --- .../provider/v1_9_R2/PacketHandler1_9_R2.java | 11 - .../v1_9_R2/PlayerProvider1_9_R2.java | 30 -- .../v1_9_R2/TextureProvider1_9_R2.java | 105 ------- .../provider/v1_9_R2/ToolProvider1_9_R2.java | 33 -- .../v1_9_R2/VersionControl1_9_R2.java | 56 ---- .../v1_9_R2/entity/ArmorStand1_9_R2.java | 33 -- .../provider/v1_9_R2/entity/Entity1_9_R2.java | 213 ------------- .../v1_9_R2/entity/EntityLiving1_9_R2.java | 17 - .../provider/v1_9_R2/entity/Player1_9_R2.java | 296 ------------------ .../reflection/NmsReflection1_9_R2.java | 34 -- .../v1_9_R2/tools/BlockTools1_9_R2.java | 39 --- .../v1_9_R2/tools/ServerTools1_9_R2.java | 26 -- .../v1_9_R2/tools/SkinTools1_9_R2.java | 16 - .../utils/EntityConstructors1_9_R2.java | 12 - .../wrapper/ConsoleReaderWrapper1_9_R2.java | 43 --- vcompat-api/.classpath | 38 +++ vcompat-api/.project | 23 ++ .../org.eclipse.core.resources.prefs | 6 + .../.settings/org.eclipse.jdt.core.prefs | 8 + .../.settings/org.eclipse.m2e.core.prefs | 4 + vcompat-api/pom.xml | 20 ++ .../vcompat/reflection/BukkitConversion.java | 0 .../vcompat/reflection/DataProvider.java | 0 .../vcompat/reflection/EntityProvider.java | 0 .../vcompat/reflection/PacketHandler.java | 0 .../vcompat/reflection/PlayerProvider.java | 0 .../vcompat/reflection/TextureProvider.java | 0 .../vcompat/reflection/ToolProvider.java | 0 .../vcompat/reflection/VersionControl.java | 0 .../vcompat/reflection/VersionHandler.java | 0 .../vcompat/reflection/data/WrapType.java | 0 .../reflection/data/WrappedContainer.java | 0 .../reflection/data/WrappedContext.java | 0 .../vcompat/reflection/data/WrappedKey.java | 0 .../data/persistence/DataDistributor.java | 0 .../data/persistence/DataObserver.java | 0 .../data/persistence/PersistentContainer.java | 0 .../reflection/data/type/ObjectType.java | 0 .../reflection/data/type/SkinDataType.java | 0 .../data/wrap/SimpleSyntaxContainer.java | 0 .../data/wrap/SimpleSyntaxContext.java | 0 .../data/wrap/SimpleSyntaxType.java | 0 .../reflection/data/wrap/SimpleWrapType.java | 0 .../reflection/data/wrap/SyntaxKey.java | 0 .../reflection/entity/NmsArmorStand.java | 0 .../vcompat/reflection/entity/NmsEntity.java | 0 .../reflection/entity/NmsEntityLiving.java | 0 .../reflection/entity/NmsEntityType.java | 0 .../vcompat/reflection/entity/NmsPlayer.java | 0 .../vcompat/reflection/packet/NmsPacket.java | 0 .../reflection/reflect/FakeReflect.java | 0 .../reflect/ReflectionProvider.java | 0 .../reflection/reflect/Reflections.java | 0 .../reflect/provider/GeneralReflections.java | 0 .../vcompat/reflection/tools/BlockTools.java | 0 .../vcompat/reflection/tools/ServerTools.java | 0 .../vcompat/reflection/tools/SkinTools.java | 0 .../reflection/utils/NmsBoundingBox.java | 0 .../vcompat/reflection/utils/Tracker.java | 0 .../wrapper/ConsoleReaderWrapper.java | 2 + .../vcompat/utils/bukkit/BukkitColor.java | 0 .../vcompat/utils/bukkit/Players.java | 0 .../vcompat/utils/bukkit/unsafe/KeyCache.java | 0 .../utils/constants/DefaultConstants.java | 0 .../utils/constants/MinecraftConstants.java | 0 .../utils/java/function/TriPredicate.java | 0 .../utils/java/net/EasyContentRegistry.java | 0 .../vcompat/utils/java/net/EasyRequest.java | 0 .../vcompat/utils/java/net/EasyResponse.java | 0 .../vcompat/utils/java/net/IEasyContent.java | 0 .../utils/java/net/IEasyTextContent.java | 0 .../java/net/content/EasyJsonContent.java | 0 .../net/content/EasyUrlEncodedContent.java | 0 .../utils/java/net/tools/HeaderParser.java | 0 .../utils/java/net/tools/UrlEncoder.java | 0 .../vcompat/utils/java/tools/ArrayTools.java | 0 .../vcompat/utils/java/tools/OptionTools.java | 0 .../utils/java/tools/ReflectionTools.java | 0 .../vcompat/utils/java/tools/UUIDHelper.java | 0 .../vcompat/utils/logging/BukkitLogType.java | 0 .../vcompat/utils/logging/BukkitLogger.java | 3 +- .../vcompat/utils/logging/LoggingColors.java | 0 .../utils/minecraft/MojangProfileServer.java | 0 .../vcompat/utils/minecraft/Skin.java | 0 .../vcompat/utils/minecraft/SkinModel.java | 0 .../vcompat/utils/thread/PostAsync.java | 0 .../utils/validation/ValidationHelper.java | 0 .../vcompat/version/ServerVersion.java | 0 .../minecraft/vcompat/version/Versions.java | 0 .../vcompat/reflection/BukkitConversion.class | Bin 0 -> 2700 bytes .../vcompat/reflection/DataProvider.class | Bin 0 -> 4941 bytes .../vcompat/reflection/EntityProvider.class | Bin 0 -> 1739 bytes .../vcompat/reflection/PacketHandler.class | Bin 0 -> 1427 bytes .../vcompat/reflection/PlayerProvider.class | Bin 0 -> 2888 bytes .../vcompat/reflection/TextureProvider.class | Bin 0 -> 5541 bytes .../vcompat/reflection/ToolProvider.class | Bin 0 -> 1146 bytes .../vcompat/reflection/VersionControl.class | Bin 0 -> 3759 bytes .../vcompat/reflection/VersionHandler.class | Bin 0 -> 1000 bytes .../vcompat/reflection/data/WrapType.class | Bin 0 -> 3911 bytes .../reflection/data/WrappedContainer.class | Bin 0 -> 6028 bytes .../reflection/data/WrappedContext.class | Bin 0 -> 822 bytes .../vcompat/reflection/data/WrappedKey.class | Bin 0 -> 1252 bytes .../data/persistence/DataDistributor.class | Bin 0 -> 5982 bytes .../data/persistence/DataObserver.class | Bin 0 -> 4587 bytes .../persistence/PersistentContainer.class | Bin 0 -> 5718 bytes .../reflection/data/type/ObjectType.class | Bin 0 -> 1606 bytes .../reflection/data/type/SkinDataType.class | Bin 0 -> 3973 bytes .../data/wrap/SimpleSyntaxContainer.class | Bin 0 -> 7198 bytes .../data/wrap/SimpleSyntaxContext.class | Bin 0 -> 1491 bytes .../data/wrap/SimpleSyntaxType.class | Bin 0 -> 2747 bytes .../reflection/data/wrap/SimpleWrapType.class | Bin 0 -> 2335 bytes .../reflection/data/wrap/SyntaxKey.class | Bin 0 -> 3283 bytes .../reflection/entity/NmsArmorStand.class | Bin 0 -> 288 bytes .../vcompat/reflection/entity/NmsEntity.class | Bin 0 -> 1077 bytes .../reflection/entity/NmsEntityLiving.class | Bin 0 -> 267 bytes .../reflection/entity/NmsEntityType.class | Bin 0 -> 1205 bytes .../vcompat/reflection/entity/NmsPlayer.class | Bin 0 -> 1065 bytes .../vcompat/reflection/packet/NmsPacket.class | Bin 0 -> 314 bytes .../reflection/reflect/FakeReflect.class | Bin 0 -> 9490 bytes .../reflect/ReflectionProvider.class | Bin 0 -> 6124 bytes .../reflection/reflect/Reflections.class | Bin 0 -> 1468 bytes .../reflect/provider/GeneralReflections.class | Bin 0 -> 1255 bytes .../vcompat/reflection/tools/BlockTools.class | Bin 0 -> 506 bytes .../reflection/tools/ServerTools.class | Bin 0 -> 550 bytes .../vcompat/reflection/tools/SkinTools.class | Bin 0 -> 1616 bytes .../reflection/utils/NmsBoundingBox.class | Bin 0 -> 16020 bytes .../vcompat/reflection/utils/Tracker.class | Bin 0 -> 3782 bytes .../wrapper/ConsoleReaderWrapper.class | Bin 0 -> 588 bytes .../vcompat/utils/bukkit/BukkitColor.class | Bin 0 -> 1909 bytes .../vcompat/utils/bukkit/Players.class | Bin 0 -> 3636 bytes .../utils/bukkit/unsafe/KeyCache.class | Bin 0 -> 2997 bytes .../utils/constants/DefaultConstants.class | Bin 0 -> 756 bytes .../utils/constants/MinecraftConstants.class | Bin 0 -> 550 bytes .../utils/java/function/TriPredicate.class | Bin 0 -> 3188 bytes .../utils/java/net/EasyContentRegistry.class | Bin 0 -> 2059 bytes .../vcompat/utils/java/net/EasyRequest.class | Bin 0 -> 11757 bytes .../vcompat/utils/java/net/EasyResponse.class | Bin 0 -> 5492 bytes .../vcompat/utils/java/net/IEasyContent.class | Bin 0 -> 1198 bytes .../utils/java/net/IEasyTextContent.class | Bin 0 -> 1974 bytes .../java/net/content/EasyJsonContent.class | Bin 0 -> 1993 bytes .../net/content/EasyUrlEncodedContent.class | Bin 0 -> 5002 bytes .../utils/java/net/tools/HeaderParser.class | Bin 0 -> 3955 bytes .../utils/java/net/tools/UrlEncoder.class | Bin 0 -> 6578 bytes .../vcompat/utils/java/tools/ArrayTools.class | Bin 0 -> 1341 bytes .../utils/java/tools/OptionTools.class | Bin 0 -> 691 bytes .../utils/java/tools/ReflectionTools.class | Bin 0 -> 1454 bytes .../vcompat/utils/java/tools/UUIDHelper.class | Bin 0 -> 1510 bytes .../vcompat/utils/logging/BukkitLogType.class | Bin 0 -> 2442 bytes .../vcompat/utils/logging/BukkitLogger.class | Bin 0 -> 17212 bytes .../vcompat/utils/logging/LoggingColors.class | Bin 0 -> 5015 bytes .../utils/minecraft/MojangProfileServer.class | Bin 0 -> 5599 bytes .../vcompat/utils/minecraft/Skin.class | Bin 0 -> 6263 bytes .../vcompat/utils/minecraft/SkinModel.class | Bin 0 -> 1804 bytes .../vcompat/utils/thread/PostAsync.class | Bin 0 -> 1386 bytes .../utils/validation/ValidationHelper.class | Bin 0 -> 813 bytes .../ServerVersion$ServerAnalyzer.class | Bin 0 -> 2377 bytes .../vcompat/version/ServerVersion.class | Bin 0 -> 5218 bytes .../minecraft/vcompat/version/Versions.class | Bin 0 -> 5644 bytes vcompat-core/.classpath | 38 +++ vcompat-core/.project | 23 ++ .../org.eclipse.core.resources.prefs | 6 + .../.settings/org.eclipse.jdt.core.prefs | 8 + .../.settings/org.eclipse.m2e.core.prefs | 4 + vcompat-core/pom.xml | 18 ++ .../minecraft/vcompat/entity/Hologram.java | 0 .../vcompat/entity/attributes/Nameable.java | 0 .../vcompat/entity/handler/CustomEntity.java | 0 .../entity/handler/DefaultEntityType.java | 0 .../vcompat/entity/handler/EntityBuilder.java | 0 .../vcompat/entity/handler/EntityManager.java | 0 .../entity/handler/EntityRegistry.java | 0 .../vcompat/entity/handler/EntityType.java | 0 .../vcompat/listener/PlayerListener.java | 0 .../listener/handler/IPlayerHandler.java | 0 .../vcompat/skin/DefaultMojangProvider.java | 0 .../vcompat/skin/DefaultSkinStore.java | 0 .../minecraft/vcompat/skin/Mojang.java | 0 .../vcompat/skin/MojangProvider.java | 0 .../vcompat/skin/PersistentSkinStore.java | 0 .../minecraft/vcompat/skin/Profile.java | 0 .../minecraft/vcompat/skin/SkinStore.java | 0 .../entity/Hologram$HologramBuilder.class | Bin 0 -> 1469 bytes .../minecraft/vcompat/entity/Hologram.class | Bin 0 -> 12264 bytes .../vcompat/entity/attributes/Nameable.class | Bin 0 -> 237 bytes .../vcompat/entity/handler/CustomEntity.class | Bin 0 -> 1968 bytes .../entity/handler/DefaultEntityType.class | Bin 0 -> 1505 bytes .../entity/handler/EntityBuilder.class | Bin 0 -> 1475 bytes .../entity/handler/EntityManager.class | Bin 0 -> 8492 bytes .../entity/handler/EntityRegistry.class | Bin 0 -> 5554 bytes .../vcompat/entity/handler/EntityType.class | Bin 0 -> 193 bytes .../vcompat/listener/PlayerListener.class | Bin 0 -> 4342 bytes .../listener/handler/IPlayerHandler.class | Bin 0 -> 588 bytes .../vcompat/skin/DefaultMojangProvider.class | Bin 0 -> 1659 bytes .../vcompat/skin/DefaultSkinStore.class | Bin 0 -> 3502 bytes .../minecraft/vcompat/skin/Mojang.class | Bin 0 -> 20778 bytes .../vcompat/skin/MojangProvider.class | Bin 0 -> 467 bytes .../vcompat/skin/PersistentSkinStore.class | Bin 0 -> 4127 bytes .../minecraft/vcompat/skin/Profile.class | Bin 0 -> 5177 bytes .../minecraft/vcompat/skin/SkinStore.class | Bin 0 -> 3551 bytes 536 files changed, 232 insertions(+), 27288 deletions(-) delete mode 100644 lgtm.yml delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/BukkitConversion1_10_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/EntityProvider1_10_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/PacketHandler1_10_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/PlayerProvider1_10_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/TextureProvider1_10_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/ToolProvider1_10_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/VersionControl1_10_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/entity/ArmorStand1_10_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/entity/Entity1_10_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/entity/EntityLiving1_10_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/entity/Player1_10_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/reflection/NmsReflection1_10_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/tools/BlockTools1_10_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/tools/ServerTools1_10_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/tools/SkinTools1_10_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/utils/EntityConstructors1_10_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/wrapper/ConsoleReaderWrapper1_10_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/BukkitConversion1_11_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/EntityProvider1_11_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/PacketHandler1_11_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/PlayerProvider1_11_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/TextureProvider1_11_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/ToolProvider1_11_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/VersionControl1_11_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/entity/ArmorStand1_11_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/entity/Entity1_11_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/entity/EntityLiving1_11_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/entity/Player1_11_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/reflection/NmsReflection1_11_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/tools/BlockTools1_11_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/tools/ServerTools1_11_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/tools/SkinTools1_11_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/utils/EntityConstructors1_11_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/wrapper/ConsoleReaderWrapper1_11_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/BukkitConversion1_12_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/EntityProvider1_12_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/PacketHandler1_12_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/PlayerProvider1_12_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/TextureProvider1_12_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/ToolProvider1_12_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/VersionControl1_12_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/entity/ArmorStand1_12_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/entity/Entity1_12_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/entity/EntityLiving1_12_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/entity/Player1_12_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/reflection/NmsReflection1_12_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/tools/BlockTools1_12_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/tools/ServerTools1_12_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/tools/SkinTools1_12_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/utils/EntityConstructors1_12_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/wrapper/ConsoleReaderWrapper1_12_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/BukkitConversion1_13_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/EntityProvider1_13_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/PacketHandler1_13_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/PlayerProvider1_13_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/TextureProvider1_13_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/ToolProvider1_13_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/VersionControl1_13_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/entity/ArmorStand1_13_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/entity/Entity1_13_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/entity/EntityLiving1_13_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/entity/Player1_13_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/tools/BlockTools1_13_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/tools/ServerTools1_13_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/tools/SkinTools1_13_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/utils/EntityConstructors1_13_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/wrapper/ConsoleReaderWrapper1_13_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/BukkitConversion1_13_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/EntityProvider1_13_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/PacketHandler1_13_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/PlayerProvider1_13_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/TextureProvider1_13_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/ToolProvider1_13_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/VersionControl1_13_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/entity/ArmorStand1_13_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/entity/Entity1_13_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/entity/EntityLiving1_13_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/entity/Player1_13_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/tools/BlockTools1_13_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/tools/ServerTools1_13_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/tools/SkinTools1_13_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/utils/EntityConstructors1_13_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/wrapper/ConsoleReaderWrapper1_13_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/BukkitConversion1_14_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/EntityProvider1_14_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/PacketHandler1_14_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/PlayerProvider1_14_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/TextureProvider1_14_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/ToolProvider1_14_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/VersionControl1_14_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/data/BukkitContainer1_14_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/data/BukkitContext1_14_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/data/BukkitKey1_14_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/data/BukkitType1_14_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/data/SimpleBukkitType1_14_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/data/SyntaxContainer1_14_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/data/SyntaxContext1_14_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/data/SyntaxType1_14_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/data/WrappedType1_14_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/data/hook/BukkitContainerAdapterHook1_14_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/entity/ArmorStand1_14_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/entity/Entity1_14_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/entity/EntityLiving1_14_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/entity/Player1_14_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/tools/BlockTools1_14_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/tools/ServerTools1_14_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/tools/SkinTools1_14_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/utils/EntityConstructors1_14_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/wrapper/ConsoleReaderWrapper1_14_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/BukkitConversion1_15_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/EntityProvider1_15_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/PacketHandler1_15_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/PlayerProvider1_15_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/TextureProvider1_15_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/ToolProvider1_15_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/VersionControl1_15_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/data/BukkitContainer1_15_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/data/BukkitContext1_15_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/data/BukkitKey1_15_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/data/BukkitType1_15_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/data/SimpleBukkitType1_15_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/data/SyntaxContainer1_15_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/data/SyntaxContext1_15_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/data/SyntaxType1_15_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/data/WrappedType1_15_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/data/hook/BukkitContainerAdapterHook1_15_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/entity/ArmorStand1_15_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/entity/Entity1_15_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/entity/EntityLiving1_15_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/entity/Player1_15_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/tools/BlockTools1_15_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/tools/ServerTools1_15_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/tools/SkinTools1_15_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/utils/EntityConstructors1_15_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/wrapper/ConsoleReaderWrapper1_15_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/BukkitConversion1_16_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/EntityProvider1_16_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/PacketHandler1_16_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/PlayerProvider1_16_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/TextureProvider1_16_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/ToolProvider1_16_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/VersionControl1_16_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/data/BukkitContainer1_16_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/data/BukkitContext1_16_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/data/BukkitKey1_16_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/data/BukkitType1_16_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/data/SimpleBukkitType1_16_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/data/SyntaxContainer1_16_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/data/SyntaxContext1_16_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/data/SyntaxType1_16_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/data/WrappedType1_16_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/data/hook/BukkitContainerAdapterHook1_16_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/entity/ArmorStand1_16_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/entity/Entity1_16_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/entity/EntityLiving1_16_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/entity/Player1_16_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/tools/BlockTools1_16_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/tools/ServerTools1_16_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/tools/SkinTools1_16_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/utils/EntityConstructors1_16_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/wrapper/ConsoleReaderWrapper1_16_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/BukkitConversion1_16_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/EntityProvider1_16_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/PacketHandler1_16_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/PlayerProvider1_16_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/TextureProvider1_16_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/ToolProvider1_16_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/VersionControl1_16_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/data/BukkitContainer1_16_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/data/BukkitContext1_16_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/data/BukkitKey1_16_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/data/BukkitType1_16_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/data/SimpleBukkitType1_16_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/data/SyntaxContainer1_16_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/data/SyntaxContext1_16_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/data/SyntaxType1_16_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/data/WrappedType1_16_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/data/hook/BukkitContainerAdapterHook1_16_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/entity/ArmorStand1_16_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/entity/Entity1_16_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/entity/EntityLiving1_16_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/entity/Player1_16_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/tools/BlockTools1_16_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/tools/ServerTools1_16_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/tools/SkinTools1_16_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/utils/EntityConstructors1_16_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/wrapper/ConsoleReaderWrapper1_16_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/BukkitConversion1_16_R3.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/EntityProvider1_16_R3.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/PacketHandler1_16_R3.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/PlayerProvider1_16_R3.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/TextureProvider1_16_R3.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/ToolProvider1_16_R3.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/VersionControl1_16_R3.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/data/BukkitContainer1_16_R3.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/data/BukkitContext1_16_R3.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/data/BukkitKey1_16_R3.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/data/BukkitType1_16_R3.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/data/SimpleBukkitType1_16_R3.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/data/SyntaxContainer1_16_R3.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/data/SyntaxContext1_16_R3.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/data/SyntaxType1_16_R3.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/data/WrappedType1_16_R3.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/data/hook/BukkitContainerAdapterHook1_16_R3.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/entity/ArmorStand1_16_R3.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/entity/Entity1_16_R3.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/entity/EntityLiving1_16_R3.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/entity/Player1_16_R3.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/tools/BlockTools1_16_R3.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/tools/ServerTools1_16_R3.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/tools/SkinTools1_16_R3.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/utils/EntityConstructors1_16_R3.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/wrapper/ConsoleReaderWrapper1_16_R3.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/BukkitConversion1_17_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/EntityProvider1_17_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/PacketHandler1_17_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/PlayerProvider1_17_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/TextureProvider1_17_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/ToolProvider1_17_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/VersionControl1_17_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/BukkitContainer1_17_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/BukkitContext1_17_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/BukkitKey1_17_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/BukkitType1_17_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/SimpleBukkitType1_17_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/SyntaxContainer1_17_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/SyntaxContext1_17_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/SyntaxType1_17_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/WrappedType1_17_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/hook/BukkitContainerAdapterHook1_17_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/entity/ArmorStand1_17_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/entity/Entity1_17_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/entity/EntityLiving1_17_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/entity/Player1_17_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/tools/BlockTools1_17_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/tools/ServerTools1_17_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/tools/SkinTools1_17_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/utils/EntityConstructors1_17_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/wrapper/ConsoleReaderWrapper1_17_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/BukkitConversion1_18_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/EntityProvider1_18_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/PacketHandler1_18_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/PlayerProvider1_18_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/TextureProvider1_18_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/ToolProvider1_18_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/VersionControl1_18_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/data/BukkitContainer1_18_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/data/BukkitContext1_18_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/data/BukkitKey1_18_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/data/BukkitType1_18_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/data/SimpleBukkitType1_18_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/data/SyntaxContainer1_18_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/data/SyntaxContext1_18_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/data/SyntaxType1_18_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/data/WrappedType1_18_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/data/hook/BukkitContainerAdapterHook1_18_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/entity/ArmorStand1_18_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/entity/Entity1_18_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/entity/EntityLiving1_18_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/entity/Player1_18_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/tools/BlockTools1_18_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/tools/ServerTools1_18_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/tools/SkinTools1_18_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/utils/EntityConstructors1_18_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/wrapper/ConsoleReaderWrapper1_18_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/BukkitConversion1_8_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/EntityProvider1_8_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/PacketHandler1_8_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/PlayerProvider1_8_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/TextureProvider1_8_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/ToolProvider1_8_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/VersionControl1_8_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/entity/ArmorStand1_8_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/entity/Entity1_8_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/entity/EntityLiving1_8_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/entity/Player1_8_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/reflection/NmsReflection1_8_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/tools/BlockTools1_8_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/tools/ServerTools1_8_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/tools/SkinTools1_8_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/utils/EntityConstructors1_8_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/wrapper/ConsoleReaderWrapper1_8_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/BukkitConversion1_8_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/EntityProvider1_8_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/PacketHandler1_8_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/PlayerProvider1_8_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/TextureProvider1_8_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/ToolProvider1_8_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/VersionControl1_8_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/entity/ArmorStand1_8_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/entity/Entity1_8_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/entity/EntityLiving1_8_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/entity/Player1_8_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/reflection/NmsReflection1_8_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/tools/BlockTools1_8_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/tools/ServerTools1_8_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/tools/SkinTools1_8_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/utils/EntityConstructors1_8_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/wrapper/ConsoleReaderWrapper1_8_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/BukkitConversion1_8_R3.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/EntityProvider1_8_R3.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/PacketHandler1_8_R3.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/PlayerProvider1_8_R3.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/TextureProvider1_8_R3.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/ToolProvider1_8_R3.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/VersionControl1_8_R3.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/entity/ArmorStand1_8_R3.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/entity/Entity1_8_R3.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/entity/EntityLiving1_8_R3.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/entity/Player1_8_R3.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/reflection/NmsReflection1_8_R3.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/tools/BlockTools1_8_R3.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/tools/ServerTools1_8_R3.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/tools/SkinTools1_8_R3.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/utils/EntityConstructors1_8_R3.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/wrapper/ConsoleReaderWrapper1_8_R3.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/BukkitConversion1_9_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/EntityProvider1_9_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/PacketHandler1_9_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/PlayerProvider1_9_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/TextureProvider1_9_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/ToolProvider1_9_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/VersionControl1_9_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/entity/ArmorStand1_9_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/entity/Entity1_9_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/entity/EntityLiving1_9_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/entity/Player1_9_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/reflection/NmsReflection1_9_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/tools/BlockTools1_9_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/tools/ServerTools1_9_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/tools/SkinTools1_9_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/utils/EntityConstructors1_9_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/wrapper/ConsoleReaderWrapper1_9_R1.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/BukkitConversion1_9_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/EntityProvider1_9_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/PacketHandler1_9_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/PlayerProvider1_9_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/TextureProvider1_9_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/ToolProvider1_9_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/VersionControl1_9_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/entity/ArmorStand1_9_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/entity/Entity1_9_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/entity/EntityLiving1_9_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/entity/Player1_9_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/reflection/NmsReflection1_9_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/tools/BlockTools1_9_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/tools/ServerTools1_9_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/tools/SkinTools1_9_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/utils/EntityConstructors1_9_R2.java delete mode 100644 src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/wrapper/ConsoleReaderWrapper1_9_R2.java create mode 100644 vcompat-api/.classpath create mode 100644 vcompat-api/.project create mode 100644 vcompat-api/.settings/org.eclipse.core.resources.prefs create mode 100644 vcompat-api/.settings/org.eclipse.jdt.core.prefs create mode 100644 vcompat-api/.settings/org.eclipse.m2e.core.prefs create mode 100644 vcompat-api/pom.xml rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/reflection/BukkitConversion.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/reflection/DataProvider.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/reflection/EntityProvider.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/reflection/PacketHandler.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/reflection/PlayerProvider.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/reflection/TextureProvider.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/reflection/ToolProvider.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/reflection/VersionControl.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/reflection/VersionHandler.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/WrapType.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/WrappedContainer.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/WrappedContext.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/WrappedKey.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/persistence/DataDistributor.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/persistence/DataObserver.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/persistence/PersistentContainer.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/type/ObjectType.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/type/SkinDataType.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleSyntaxContainer.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleSyntaxContext.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleSyntaxType.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleWrapType.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SyntaxKey.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsArmorStand.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsEntity.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsEntityLiving.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsEntityType.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsPlayer.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/reflection/packet/NmsPacket.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/reflection/reflect/FakeReflect.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/reflection/reflect/ReflectionProvider.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/reflection/reflect/Reflections.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/reflection/reflect/provider/GeneralReflections.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/reflection/tools/BlockTools.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/reflection/tools/ServerTools.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/reflection/tools/SkinTools.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/reflection/utils/NmsBoundingBox.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/reflection/utils/Tracker.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/reflection/wrapper/ConsoleReaderWrapper.java (87%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/utils/bukkit/BukkitColor.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/utils/bukkit/Players.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/utils/bukkit/unsafe/KeyCache.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/utils/constants/DefaultConstants.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/utils/constants/MinecraftConstants.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/utils/java/function/TriPredicate.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/EasyContentRegistry.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/EasyRequest.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/EasyResponse.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/IEasyContent.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/IEasyTextContent.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/content/EasyJsonContent.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/content/EasyUrlEncodedContent.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/tools/HeaderParser.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/tools/UrlEncoder.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/utils/java/tools/ArrayTools.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/utils/java/tools/OptionTools.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/utils/java/tools/ReflectionTools.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/utils/java/tools/UUIDHelper.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/utils/logging/BukkitLogType.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/utils/logging/BukkitLogger.java (99%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/utils/logging/LoggingColors.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/utils/minecraft/MojangProfileServer.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/utils/minecraft/Skin.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/utils/minecraft/SkinModel.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/utils/thread/PostAsync.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/utils/validation/ValidationHelper.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/version/ServerVersion.java (100%) rename {src => vcompat-api/src}/main/java/net/sourcewriters/minecraft/vcompat/version/Versions.java (100%) create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/BukkitConversion.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/DataProvider.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/EntityProvider.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/PacketHandler.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/PlayerProvider.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/TextureProvider.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/ToolProvider.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/VersionControl.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/VersionHandler.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/WrapType.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/WrappedContainer.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/WrappedContext.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/WrappedKey.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/persistence/DataDistributor.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/persistence/DataObserver.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/persistence/PersistentContainer.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/type/ObjectType.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/type/SkinDataType.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleSyntaxContainer.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleSyntaxContext.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleSyntaxType.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleWrapType.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SyntaxKey.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsArmorStand.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsEntity.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsEntityLiving.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsEntityType.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsPlayer.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/packet/NmsPacket.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/reflect/FakeReflect.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/reflect/ReflectionProvider.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/reflect/Reflections.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/reflect/provider/GeneralReflections.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/tools/BlockTools.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/tools/ServerTools.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/tools/SkinTools.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/utils/NmsBoundingBox.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/utils/Tracker.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/wrapper/ConsoleReaderWrapper.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/bukkit/BukkitColor.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/bukkit/Players.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/bukkit/unsafe/KeyCache.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/constants/DefaultConstants.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/constants/MinecraftConstants.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/java/function/TriPredicate.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/java/net/EasyContentRegistry.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/java/net/EasyRequest.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/java/net/EasyResponse.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/java/net/IEasyContent.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/java/net/IEasyTextContent.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/java/net/content/EasyJsonContent.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/java/net/content/EasyUrlEncodedContent.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/java/net/tools/HeaderParser.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/java/net/tools/UrlEncoder.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/java/tools/ArrayTools.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/java/tools/OptionTools.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/java/tools/ReflectionTools.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/java/tools/UUIDHelper.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/logging/BukkitLogType.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/logging/BukkitLogger.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/logging/LoggingColors.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/minecraft/MojangProfileServer.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/minecraft/Skin.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/minecraft/SkinModel.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/thread/PostAsync.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/validation/ValidationHelper.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/version/ServerVersion$ServerAnalyzer.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/version/ServerVersion.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/version/Versions.class create mode 100644 vcompat-core/.classpath create mode 100644 vcompat-core/.project create mode 100644 vcompat-core/.settings/org.eclipse.core.resources.prefs create mode 100644 vcompat-core/.settings/org.eclipse.jdt.core.prefs create mode 100644 vcompat-core/.settings/org.eclipse.m2e.core.prefs create mode 100644 vcompat-core/pom.xml rename {src => vcompat-core/src}/main/java/net/sourcewriters/minecraft/vcompat/entity/Hologram.java (100%) rename {src => vcompat-core/src}/main/java/net/sourcewriters/minecraft/vcompat/entity/attributes/Nameable.java (100%) rename {src => vcompat-core/src}/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/CustomEntity.java (100%) rename {src => vcompat-core/src}/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/DefaultEntityType.java (100%) rename {src => vcompat-core/src}/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/EntityBuilder.java (100%) rename {src => vcompat-core/src}/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/EntityManager.java (100%) rename {src => vcompat-core/src}/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/EntityRegistry.java (100%) rename {src => vcompat-core/src}/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/EntityType.java (100%) rename {src => vcompat-core/src}/main/java/net/sourcewriters/minecraft/vcompat/listener/PlayerListener.java (100%) rename {src => vcompat-core/src}/main/java/net/sourcewriters/minecraft/vcompat/listener/handler/IPlayerHandler.java (100%) rename {src => vcompat-core/src}/main/java/net/sourcewriters/minecraft/vcompat/skin/DefaultMojangProvider.java (100%) rename {src => vcompat-core/src}/main/java/net/sourcewriters/minecraft/vcompat/skin/DefaultSkinStore.java (100%) rename {src => vcompat-core/src}/main/java/net/sourcewriters/minecraft/vcompat/skin/Mojang.java (100%) rename {src => vcompat-core/src}/main/java/net/sourcewriters/minecraft/vcompat/skin/MojangProvider.java (100%) rename {src => vcompat-core/src}/main/java/net/sourcewriters/minecraft/vcompat/skin/PersistentSkinStore.java (100%) rename {src => vcompat-core/src}/main/java/net/sourcewriters/minecraft/vcompat/skin/Profile.java (100%) rename {src => vcompat-core/src}/main/java/net/sourcewriters/minecraft/vcompat/skin/SkinStore.java (100%) create mode 100644 vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/entity/Hologram$HologramBuilder.class create mode 100644 vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/entity/Hologram.class create mode 100644 vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/entity/attributes/Nameable.class create mode 100644 vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/CustomEntity.class create mode 100644 vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/DefaultEntityType.class create mode 100644 vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/EntityBuilder.class create mode 100644 vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/EntityManager.class create mode 100644 vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/EntityRegistry.class create mode 100644 vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/EntityType.class create mode 100644 vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/listener/PlayerListener.class create mode 100644 vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/listener/handler/IPlayerHandler.class create mode 100644 vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/skin/DefaultMojangProvider.class create mode 100644 vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/skin/DefaultSkinStore.class create mode 100644 vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/skin/Mojang.class create mode 100644 vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/skin/MojangProvider.class create mode 100644 vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/skin/PersistentSkinStore.class create mode 100644 vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/skin/Profile.class create mode 100644 vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/skin/SkinStore.class diff --git a/lgtm.yml b/lgtm.yml deleted file mode 100644 index c311106..0000000 --- a/lgtm.yml +++ /dev/null @@ -1,24 +0,0 @@ -path_classifiers: - test: - - exclude: / - - test - - testsuites - - "**/*.test" - - exclude: test/util - generated: - - exclude: "main" - library: - - exclude: "main" - template: - - exclude: "main" -extraction: - java: - index: - build_command: - - ./scripts/build-spigot.sh "$LGTM_SRC" - - ./scripts/lgtm-compile.sh - java_version: 8 - maven: - settings_file: /opt/share/settings.xml - version: 3.6.3 - xml_mode: default \ No newline at end of file diff --git a/pom.xml b/pom.xml index 2047d14..a5582b0 100644 --- a/pom.xml +++ b/pom.xml @@ -1,26 +1,29 @@ - - + 4.0.0 net.sourcewriters.minecraft - vcompat + vcompat-parent 3.0.0 - vCompat - - - github - GitHub OWNER Apache Maven Packages - https://maven.pkg.github.com/SourceWriters/vCompat - - + pom + - 1.8 - 1.8 UTF-8 + + + + spigot + https://hub.spigotmc.org/nexus/content/repositories/public/ + + + minecraft-libraries + https://libraries.minecraft.net + + + + com.mojang authlib @@ -37,6 +40,14 @@ + + org.spigotmc + spigot-api + 1.18.1-R0.1-SNAPSHOT + provided + + + com.syntaxphoenix.syntaxapi java @@ -87,163 +98,8 @@ random 2.0.8 - - org.junit.jupiter - junit-jupiter-api - 5.5.2 - test - - - org.junit.jupiter - junit-jupiter-engine - 5.5.2 - test - - - - org.spigotmc - spigot-api - 1.18.1-R0.1-SNAPSHOT - provided - - - - jline - jline - 2.12.1 - provided - - - - bukkit - spigot-1.18.1 - 0.1 - system - ${project.basedir}/libraries/spigot/spigot-1.18.1.jar - - - bukkit - spigot-1.17.1 - 0.1 - system - ${project.basedir}/libraries/spigot/spigot-1.17.1.jar - - - bukkit - spigot-1.16.4 - 0.1 - system - ${project.basedir}/libraries/spigot/spigot-1.16.4.jar - - - bukkit - spigot-1.16.3 - 0.1 - system - ${project.basedir}/libraries/spigot/spigot-1.16.3.jar - - - bukkit - spigot-1.16.1 - 0.1 - system - ${project.basedir}/libraries/spigot/spigot-1.16.1.jar - - - bukkit - spigot-1.15.2 - 0.1 - system - ${project.basedir}/libraries/spigot/spigot-1.15.2.jar - - - bukkit - spigot-1.14.2 - 0.1 - system - ${project.basedir}/libraries/spigot/spigot-1.14.2.jar - - - bukkit - spigot-1.13.2 - 0.1 - system - ${project.basedir}/libraries/spigot/spigot-1.13.2.jar - - - bukkit - spigot-1.13 - 0.1 - system - ${project.basedir}/libraries/spigot/spigot-1.13.jar - - - bukkit - spigot-1.12.2 - 0.1 - system - ${project.basedir}/libraries/spigot/spigot-1.12.2.jar - - - bukkit - spigot-1.11 - 0.1 - system - ${project.basedir}/libraries/spigot/spigot-1.11.jar - - - bukkit - spigot-1.10.2 - 0.1 - system - ${project.basedir}/libraries/spigot/spigot-1.10.2.jar - - - bukkit - spigot-1.9.4 - 0.1 - system - ${project.basedir}/libraries/spigot/spigot-1.9.4.jar - - - bukkit - spigot-1.9 - 0.1 - system - ${project.basedir}/libraries/spigot/spigot-1.9.jar - - - bukkit - spigot-1.8.8 - 0.1 - system - ${project.basedir}/libraries/spigot/spigot-1.8.8.jar - - - bukkit - spigot-1.8.3 - 0.1 - system - ${project.basedir}/libraries/spigot/spigot-1.8.3.jar - - - bukkit - spigot-1.8 - 0.1 - system - ${project.basedir}/libraries/spigot/spigot-1.8.jar - - - - spigot - https://hub.spigotmc.org/nexus/content/repositories/public/ - - - minecraft-libraries - https://libraries.minecraft.net - - + @@ -274,7 +130,6 @@ - true @@ -287,4 +142,8 @@ - + + vcompat-api + vcompat-core + + \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/BukkitConversion1_10_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/BukkitConversion1_10_R1.java deleted file mode 100644 index cbf6915..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/BukkitConversion1_10_R1.java +++ /dev/null @@ -1,231 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_10_R1; - -import java.util.List; -import java.util.Set; - -import org.bukkit.craftbukkit.v1_10_R1.inventory.CraftItemStack; -import org.bukkit.entity.EntityType; - -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.nbt.NbtByte; -import com.syntaxphoenix.syntaxapi.nbt.NbtByteArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; -import com.syntaxphoenix.syntaxapi.nbt.NbtDouble; -import com.syntaxphoenix.syntaxapi.nbt.NbtEnd; -import com.syntaxphoenix.syntaxapi.nbt.NbtFloat; -import com.syntaxphoenix.syntaxapi.nbt.NbtInt; -import com.syntaxphoenix.syntaxapi.nbt.NbtIntArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtList; -import com.syntaxphoenix.syntaxapi.nbt.NbtLong; -import com.syntaxphoenix.syntaxapi.nbt.NbtLongArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtShort; -import com.syntaxphoenix.syntaxapi.nbt.NbtString; -import com.syntaxphoenix.syntaxapi.nbt.NbtTag; -import com.syntaxphoenix.syntaxapi.nbt.NbtType; - -import net.minecraft.server.v1_10_R1.ItemStack; -import net.minecraft.server.v1_10_R1.NBTBase; -import net.minecraft.server.v1_10_R1.NBTTagByte; -import net.minecraft.server.v1_10_R1.NBTTagByteArray; -import net.minecraft.server.v1_10_R1.NBTTagCompound; -import net.minecraft.server.v1_10_R1.NBTTagDouble; -import net.minecraft.server.v1_10_R1.NBTTagEnd; -import net.minecraft.server.v1_10_R1.NBTTagFloat; -import net.minecraft.server.v1_10_R1.NBTTagInt; -import net.minecraft.server.v1_10_R1.NBTTagIntArray; -import net.minecraft.server.v1_10_R1.NBTTagList; -import net.minecraft.server.v1_10_R1.NBTTagLong; -import net.minecraft.server.v1_10_R1.NBTTagShort; -import net.minecraft.server.v1_10_R1.NBTTagString; -import net.sourcewriters.minecraft.vcompat.reflection.BukkitConversion; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContext; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleWrapType; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; - -public class BukkitConversion1_10_R1 extends BukkitConversion { - - protected BukkitConversion1_10_R1(VersionControl1_10_R1 versionControl) { - super(versionControl); - } - - @Override - public EntityType toEntityType(NmsEntityType type) { - try { - return EntityType.valueOf(type.name()); - } catch (IllegalArgumentException ignore) { - return null; - } - } - - @Override - public NmsEntityType fromEntityType(EntityType type) { - try { - return NmsEntityType.valueOf(type.name()); - } catch (IllegalArgumentException ignore) { - return null; - } - } - - @Override - public NBTBase toMinecraftTag(NbtTag tag) { - switch (tag.getType()) { - case BYTE: - return new NBTTagByte((byte) tag.getValue()); - case SHORT: - return new NBTTagShort((short) tag.getValue()); - case INT: - return new NBTTagInt((int) tag.getValue()); - case LONG: - return new NBTTagLong((long) tag.getValue()); - case FLOAT: - return new NBTTagFloat((float) tag.getValue()); - case DOUBLE: - return new NBTTagDouble((double) tag.getValue()); - case STRING: - return new NBTTagString((String) tag.getValue()); - case BYTE_ARRAY: - return new NBTTagByteArray((byte[]) tag.getValue()); - case INT_ARRAY: - return new NBTTagIntArray((int[]) tag.getValue()); - case LONG_ARRAY: - NBTTagList list = new NBTTagList(); - for (long value : (long[]) tag.getValue()) { - list.add(new NBTTagLong(value)); - } - return list; - case LIST: - return toMinecraftList((NbtList) tag); - case COMPOUND: - return toMinecraftCompound((NbtCompound) tag); - case END: - return (NBTTagEnd) ReflectionProvider.DEFAULT.getReflect("nmsNBTTagEnd").init(); - default: - return null; - } - } - - @Override - public NbtTag fromMinecraftTag(Object raw) { - if (!(raw instanceof NBTBase)) { - return null; - } - NBTBase tag = (NBTBase) raw; - NbtType type = NbtType.getById(tag.getTypeId()); - switch (type) { - case BYTE: - return new NbtByte(((NBTTagByte) tag).g()); - case SHORT: - return new NbtShort(((NBTTagShort) tag).f()); - case INT: - return new NbtInt(((NBTTagInt) tag).e()); - case LONG: - return new NbtLong(((NBTTagLong) tag).d()); - case FLOAT: - return new NbtFloat(((NBTTagFloat) tag).i()); - case DOUBLE: - return new NbtDouble(((NBTTagDouble) tag).h()); - case STRING: - return new NbtString(((NBTTagString) tag).c_()); - case BYTE_ARRAY: - return new NbtByteArray(((NBTTagByteArray) tag).c()); - case INT_ARRAY: - return new NbtIntArray(((NBTTagIntArray) tag).d()); - case LONG_ARRAY: - return new NbtLongArray(new long[0]); - case LIST: - return fromMinecraftList(tag); - case COMPOUND: - return fromMinecraftCompound(tag); - case END: - return NbtEnd.INSTANCE; - default: - return null; - } - } - - @Override - public NBTTagList toMinecraftList(NbtList list) { - NBTTagList output = new NBTTagList(); - for (NbtTag tag : list) { - output.add(toMinecraftTag(tag)); - } - return output; - } - - @SuppressWarnings("unchecked") - @Override - public NbtList fromMinecraftList(Object raw) { - if (!(raw instanceof NBTTagList)) { - return null; - } - NBTTagList list = (NBTTagList) raw; - List content = (List) ReflectionProvider.DEFAULT.getReflect("nmsNBTTagList").getFieldValue("value", list); - NbtList output = new NbtList<>(NbtType.getById(list.getTypeId())); - for (NBTBase base : content) { - output.add(fromMinecraftTag(base)); - } - return output; - } - - @Override - public NBTTagCompound toMinecraftCompound(NbtCompound compound) { - NBTTagCompound output = new NBTTagCompound(); - if (compound.isEmpty()) { - return output; - } - Set keys = compound.getKeys(); - for (String key : keys) { - output.set(key, toMinecraftTag(compound.get(key))); - } - return output; - } - - @Override - public NbtCompound fromMinecraftCompound(Object raw) { - if (!(raw instanceof NBTTagCompound)) { - return null; - } - NBTTagCompound compound = (NBTTagCompound) raw; - NbtCompound output = new NbtCompound(); - if (compound.isEmpty()) { - return output; - } - Set keys = compound.c(); - for (String key : keys) { - output.set(key, fromMinecraftTag(compound.get(key))); - } - return output; - } - - @Override - public org.bukkit.inventory.ItemStack itemFromCompound(NbtCompound compound) { - return CraftItemStack.asBukkitCopy(ItemStack.createStack(toMinecraftCompound(compound))); - } - - @Override - public NbtCompound itemToCompound(org.bukkit.inventory.ItemStack itemStack) { - ItemStack nmsStack = CraftItemStack.asNMSCopy(itemStack); - NBTTagCompound stackTag; - if (!nmsStack.hasTag()) { - stackTag = nmsStack.save(new NBTTagCompound()); - } else { - stackTag = nmsStack.getTag(); - } - return fromMinecraftCompound(stackTag); - } - - @Override - public WrappedContext createContext(DataAdapterContext context) { - return new SimpleSyntaxContext(context); - } - - @Override - public WrapType wrap(DataType dataType) { - return new SimpleWrapType(dataType); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/EntityProvider1_10_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/EntityProvider1_10_R1.java deleted file mode 100644 index ee14b13..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/EntityProvider1_10_R1.java +++ /dev/null @@ -1,47 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_10_R1; - -import java.util.EnumMap; -import java.util.function.Function; - -import org.bukkit.craftbukkit.v1_10_R1.CraftWorld; - -import net.minecraft.server.v1_10_R1.World; -import net.sourcewriters.minecraft.vcompat.reflection.EntityProvider; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_10_R1.utils.EntityConstructors1_10_R1; - -public class EntityProvider1_10_R1 extends EntityProvider { - - private final EnumMap> entityMap = new EnumMap<>(NmsEntityType.class); - - protected EntityProvider1_10_R1(VersionControl1_10_R1 versionControl) { - super(versionControl); - } - - @SuppressWarnings("unchecked") - private final Function searchConstructor(NmsEntityType type) { - try { - return (Function) EntityConstructors1_10_R1.class.getField(type.name()).get(null); - } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException ignore) { - return null; - } - } - - private final Function getConstructor(NmsEntityType type) { - return entityMap.computeIfAbsent(type, (key -> searchConstructor(key))); - } - - @Override - public NmsEntity createEntity(org.bukkit.World world, NmsEntityType type) { - if (!(world instanceof CraftWorld)) { - return null; - } - Function function; - if ((function = getConstructor(type)) == null) { - return null; - } - return function.apply(((CraftWorld) world).getHandle()); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/PacketHandler1_10_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/PacketHandler1_10_R1.java deleted file mode 100644 index 105dc93..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/PacketHandler1_10_R1.java +++ /dev/null @@ -1,11 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_10_R1; - -import net.sourcewriters.minecraft.vcompat.reflection.PacketHandler; - -public class PacketHandler1_10_R1 extends PacketHandler { - - protected PacketHandler1_10_R1(VersionControl1_10_R1 versionControl) { - super(versionControl); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/PlayerProvider1_10_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/PlayerProvider1_10_R1.java deleted file mode 100644 index 41411a6..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/PlayerProvider1_10_R1.java +++ /dev/null @@ -1,30 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_10_R1; - -import java.io.File; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; - -import net.sourcewriters.minecraft.vcompat.reflection.DataProvider; -import net.sourcewriters.minecraft.vcompat.reflection.PlayerProvider; -import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.DataDistributor; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_10_R1.entity.Player1_10_R1; - -public class PlayerProvider1_10_R1 extends PlayerProvider { - - private final DataDistributor distributor; - - protected PlayerProvider1_10_R1(VersionControl1_10_R1 versionControl) { - super(versionControl); - distributor = versionControl.getDataProvider().createDistributor(new File(Bukkit.getWorlds().get(0).getWorldFolder(), "playerdata"), - uuid -> "custom_" + uuid.toString(), DataProvider.DEFAULT_RANDOM); - } - - @Override - protected NmsPlayer createPlayer(Player player) { - return new Player1_10_R1(player, distributor.get(player.getUniqueId())); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/TextureProvider1_10_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/TextureProvider1_10_R1.java deleted file mode 100644 index 6ab83c9..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/TextureProvider1_10_R1.java +++ /dev/null @@ -1,105 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_10_R1; - -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_10_R1.block.CraftSkull; -import org.bukkit.craftbukkit.v1_10_R1.inventory.CraftItemStack; -import org.bukkit.inventory.meta.ItemMeta; -import org.bukkit.inventory.meta.SkullMeta; -import org.bukkit.material.MaterialData; - -import com.mojang.authlib.GameProfile; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; - -import net.minecraft.server.v1_10_R1.GameProfileSerializer; -import net.minecraft.server.v1_10_R1.ItemStack; -import net.minecraft.server.v1_10_R1.NBTTagCompound; -import net.sourcewriters.minecraft.vcompat.reflection.TextureProvider; - -@SuppressWarnings("deprecation") -public class TextureProvider1_10_R1 extends TextureProvider { - - private final AbstractReflect craftItemStackRef = new Reflect(CraftItemStack.class).searchField("handle", "handle"); - private final AbstractReflect craftMetaSkullRef = new Reflect("org.bukkit.craftbukkit.v1_10_R1.inventory.CraftMetaSkull") - .searchField("serialized", "serializedProfile").searchField("profile", "profile"); - private final Material skullMaterial = Material.valueOf("SKULL"); - - protected TextureProvider1_10_R1(VersionControl1_10_R1 versionControl) { - super(versionControl); - } - - @Override - public GameProfile profileFromBlock(Block block) { - if (!(block instanceof CraftSkull)) { - return null; - } - return ((CraftSkull) block).getTileEntity().getGameProfile(); - } - - @Override - public GameProfile profileFromItem(org.bukkit.inventory.ItemStack itemStack) { - if (!(itemStack.getItemMeta() instanceof SkullMeta)) { - return null; - } - SkullMeta meta = (SkullMeta) itemStack.getItemMeta(); - GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue("profile", meta); - if (profile == null) { - NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue("serialized", meta); - if (compound == null) { - ItemStack stack = null; - if (itemStack instanceof CraftItemStack) { - stack = (ItemStack) craftItemStackRef.getFieldValue("handle", itemStack); - } - if (stack == null) { - stack = CraftItemStack.asNMSCopy(itemStack); - } - NBTTagCompound stackTag; - if (!stack.hasTag()) { - stackTag = stack.save(new NBTTagCompound()); - } else { - stackTag = stack.getTag(); - } - if (stackTag.hasKeyOfType("SkullOwner", 10)) { - compound = stackTag.getCompound("SkullOwner"); - } else if (stackTag.hasKeyOfType("SkullProfile", 10)) { - compound = stackTag.getCompound("SkullProfile"); - } - } - if (compound == null) { - return null; - } - profile = GameProfileSerializer.deserialize(compound); - } - return profile; - } - - @Override - public org.bukkit.inventory.ItemStack getItem(GameProfile profile) { - org.bukkit.inventory.ItemStack craftStack = CraftItemStack.asCraftCopy(new MaterialData(skullMaterial, (byte) 3).toItemStack(1)); - applyItem(craftStack, profile); - return craftStack; - } - - @Override - public boolean applyItem(org.bukkit.inventory.ItemStack itemStack, GameProfile profile) { - ItemMeta meta = itemStack.getItemMeta(); - if (!(meta instanceof SkullMeta)) { - return false; - } - SkullMeta skullMeta = (SkullMeta) meta; - craftMetaSkullRef.setFieldValue(meta, "profile", profile); - itemStack.setItemMeta(skullMeta); - return true; - } - - @Override - public boolean applyBlock(Block block, GameProfile profile) { - if (!(block instanceof CraftSkull)) { - return false; - } - ((CraftSkull) block).getTileEntity().setGameProfile(profile); - return true; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/ToolProvider1_10_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/ToolProvider1_10_R1.java deleted file mode 100644 index f824ba9..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/ToolProvider1_10_R1.java +++ /dev/null @@ -1,33 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_10_R1; - -import net.sourcewriters.minecraft.vcompat.reflection.ToolProvider; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_10_R1.tools.BlockTools1_10_R1; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_10_R1.tools.ServerTools1_10_R1; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_10_R1.tools.SkinTools1_10_R1; - -public class ToolProvider1_10_R1 extends ToolProvider { - - private final BlockTools1_10_R1 blockTools = new BlockTools1_10_R1(); - private final SkinTools1_10_R1 skinTools = new SkinTools1_10_R1(); - private final ServerTools1_10_R1 serverTools = new ServerTools1_10_R1(); - - protected ToolProvider1_10_R1(VersionControl1_10_R1 versionControl) { - super(versionControl); - } - - @Override - public SkinTools1_10_R1 getSkinTools() { - return skinTools; - } - - @Override - public ServerTools1_10_R1 getServerTools() { - return serverTools; - } - - @Override - public BlockTools1_10_R1 getBlockTools() { - return blockTools; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/VersionControl1_10_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/VersionControl1_10_R1.java deleted file mode 100644 index 77fe497..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/VersionControl1_10_R1.java +++ /dev/null @@ -1,56 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_10_R1; - -import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_10_R1.reflection.NmsReflection1_10_R1; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; - -public class VersionControl1_10_R1 extends VersionControl { - - public static VersionControl1_10_R1 INSTANCE; - - public static VersionControl1_10_R1 init() { - return INSTANCE != null ? INSTANCE : (INSTANCE = new VersionControl1_10_R1()); - } - - private final ToolProvider1_10_R1 toolProvider = new ToolProvider1_10_R1(this); - private final TextureProvider1_10_R1 textureProvider = new TextureProvider1_10_R1(this); - private final PacketHandler1_10_R1 packetHandler = new PacketHandler1_10_R1(this); - private final EntityProvider1_10_R1 entityProvider = new EntityProvider1_10_R1(this); - private final PlayerProvider1_10_R1 playerProvider = new PlayerProvider1_10_R1(this); - private final BukkitConversion1_10_R1 bukkitConversion = new BukkitConversion1_10_R1(this); - - private VersionControl1_10_R1() { - NmsReflection1_10_R1.INSTANCE.setup(ReflectionProvider.DEFAULT); - } - - @Override - public ToolProvider1_10_R1 getToolProvider() { - return toolProvider; - } - - @Override - public EntityProvider1_10_R1 getEntityProvider() { - return entityProvider; - } - - @Override - public PlayerProvider1_10_R1 getPlayerProvider() { - return playerProvider; - } - - @Override - public TextureProvider1_10_R1 getTextureProvider() { - return textureProvider; - } - - @Override - public PacketHandler1_10_R1 getPacketHandler() { - return packetHandler; - } - - @Override - public BukkitConversion1_10_R1 getBukkitConversion() { - return bukkitConversion; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/entity/ArmorStand1_10_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/entity/ArmorStand1_10_R1.java deleted file mode 100644 index a357fd4..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/entity/ArmorStand1_10_R1.java +++ /dev/null @@ -1,23 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_10_R1.entity; - -import net.minecraft.server.v1_10_R1.EntityArmorStand; -import net.minecraft.server.v1_10_R1.World; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsArmorStand; - -public class ArmorStand1_10_R1 extends EntityLiving1_10_R1 implements NmsArmorStand { - - public ArmorStand1_10_R1(World world) { - super(new EntityArmorStand(world)); - } - - @Override - public void setSmall(boolean small) { - handle.setSmall(small); - } - - @Override - public boolean isSmall() { - return handle.isSmall(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/entity/Entity1_10_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/entity/Entity1_10_R1.java deleted file mode 100644 index 1d3cd41..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/entity/Entity1_10_R1.java +++ /dev/null @@ -1,215 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_10_R1.entity; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.OfflinePlayer; -import org.bukkit.craftbukkit.v1_10_R1.CraftWorld; -import org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer; -import org.bukkit.entity.Player; - -import net.minecraft.server.v1_10_R1.AxisAlignedBB; -import net.minecraft.server.v1_10_R1.Entity; -import net.minecraft.server.v1_10_R1.EntityTypes; -import net.minecraft.server.v1_10_R1.PacketPlayOutEntityDestroy; -import net.minecraft.server.v1_10_R1.PacketPlayOutEntityMetadata; -import net.minecraft.server.v1_10_R1.PacketPlayOutSpawnEntity; -import net.minecraft.server.v1_10_R1.PlayerConnection; -import net.minecraft.server.v1_10_R1.Vec3D; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.utils.NmsBoundingBox; - -public abstract class Entity1_10_R1 implements NmsEntity { - - protected final E handle; - - protected final List visible = Collections.synchronizedList(new ArrayList<>()); - - public Entity1_10_R1(E handle) { - this.handle = handle; - } - - @Override - public final E getHandle() { - return handle; - } - - @Override - public int getId() { - return handle.getId(); - } - - @Override - public UUID getUniqueId() { - return handle.getUniqueID(); - } - - @Override - public NmsBoundingBox getBoundingBox() { - AxisAlignedBB box = handle.getBoundingBox(); - return new NmsBoundingBox(box.a, box.b, box.c, box.d, box.e, box.f); - } - - @Override - public void setCustomName(String name) { - handle.setCustomName(name); - updateVisibility(); - } - - @Override - public String getCustomName() { - return handle.getCustomName(); - } - - @Override - public void setGravity(boolean gravity) { - handle.setNoGravity(!gravity); - } - - @Override - public boolean hasGravity() { - return !handle.isNoGravity(); - } - - @Override - public void setCustomNameVisible(boolean visible) { - handle.setCustomNameVisible(visible); - } - - @Override - public boolean isCustomNameVisible() { - return handle.getCustomNameVisible(); - } - - @Override - public void setInvisible(boolean invisible) { - handle.setInvisible(invisible); - } - - @Override - public boolean isInvisible() { - return handle.isInvisible(); - } - - @Override - public boolean isInteractable() { - return handle.isInteractable(); - } - - @Override - public boolean isCollidable() { - return handle.isCollidable(); - } - - @Override - public void setInvulnerable(boolean invulnerable) { - handle.setInvulnerable(invulnerable); - } - - @Override - public boolean isInvulnerable() { - return handle.isInvulnerable(null); - } - - @Override - public void setLocation(Location location) { - handle.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); - if (location.getWorld() == null || handle.getWorld().getWorld() == location.getWorld()) { - updateVisibility(); - return; - } - handle.world = ((CraftWorld) location.getWorld()).getHandle(); - updateVisibility(); - } - - @Override - public Location getLocation() { - Vec3D vector = handle.d(); - return new Location(handle.getWorld().getWorld(), vector.x, vector.y, vector.z); - } - - @Override - public void updateVisibility() { - if (visible.isEmpty()) { - return; - } - Player[] players; - synchronized (visible) { - players = visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) - .toArray(Player[]::new); - } - hide(players); - show(players); - } - - @Override - public boolean isShown(Player player) { - synchronized (visible) { - return visible.contains(player.getUniqueId()); - } - } - - @Override - public void hide(Player... players) { - if (players.length == 0) { - return; - } - PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(handle.getId()); - for (Player player : players) { - if (!isShown(player)) { - continue; - } - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); - synchronized (visible) { - visible.remove(player.getUniqueId()); - } - } - } - - @Override - public void show(Player... players) { - if (players.length == 0) { - return; - } - PacketPlayOutSpawnEntity packet = new PacketPlayOutSpawnEntity(handle, EntityTypes.a(handle)); - PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); - PlayerConnection connection; - for (Player player : players) { - if (isShown(player)) { - continue; - } - connection = ((CraftPlayer) player).getHandle().playerConnection; - connection.sendPacket(packet); - connection.sendPacket(metadataPacket); - synchronized (visible) { - visible.add(player.getUniqueId()); - } - } - } - - @Override - public UUID[] getVisible() { - synchronized (visible) { - return visible.toArray(new UUID[0]); - } - } - - @Override - public Player[] getVisibleAsPlayer() { - synchronized (visible) { - return visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) - .toArray(Player[]::new); - } - } - - @Override - public void kill() { - hide(getVisibleAsPlayer()); - handle.die(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/entity/EntityLiving1_10_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/entity/EntityLiving1_10_R1.java deleted file mode 100644 index 9ea5d39..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/entity/EntityLiving1_10_R1.java +++ /dev/null @@ -1,17 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_10_R1.entity; - -import net.minecraft.server.v1_10_R1.EntityLiving; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityLiving; - -public abstract class EntityLiving1_10_R1 extends Entity1_10_R1 implements NmsEntityLiving { - - public EntityLiving1_10_R1(E handle) { - super(handle); - } - - @Override - public void setCollidable(boolean collidable) { - handle.collides = collidable; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/entity/Player1_10_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/entity/Player1_10_R1.java deleted file mode 100644 index 773251a..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/entity/Player1_10_R1.java +++ /dev/null @@ -1,296 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_10_R1.entity; - -import java.util.ArrayList; -import java.util.Collections; - -import org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_10_R1.util.CraftChatMessage; -import org.bukkit.entity.Player; - -import com.mojang.authlib.GameProfile; -import com.mojang.authlib.properties.Property; -import com.mojang.authlib.properties.PropertyMap; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; - -import net.minecraft.server.v1_10_R1.EntityPlayer; -import net.minecraft.server.v1_10_R1.EnumItemSlot; -import net.minecraft.server.v1_10_R1.IChatBaseComponent; -import net.minecraft.server.v1_10_R1.MathHelper; -import net.minecraft.server.v1_10_R1.PacketPlayInClientCommand; -import net.minecraft.server.v1_10_R1.PacketPlayInClientCommand.EnumClientCommand; -import net.minecraft.server.v1_10_R1.PacketPlayOutChat; -import net.minecraft.server.v1_10_R1.PacketPlayOutEntityDestroy; -import net.minecraft.server.v1_10_R1.PacketPlayOutEntityEquipment; -import net.minecraft.server.v1_10_R1.PacketPlayOutEntityHeadRotation; -import net.minecraft.server.v1_10_R1.PacketPlayOutEntityMetadata; -import net.minecraft.server.v1_10_R1.PacketPlayOutEntityStatus; -import net.minecraft.server.v1_10_R1.PacketPlayOutHeldItemSlot; -import net.minecraft.server.v1_10_R1.PacketPlayOutNamedEntitySpawn; -import net.minecraft.server.v1_10_R1.PacketPlayOutPlayerInfo; -import net.minecraft.server.v1_10_R1.PacketPlayOutPlayerInfo.EnumPlayerInfoAction; -import net.minecraft.server.v1_10_R1.PacketPlayOutPlayerListHeaderFooter; -import net.minecraft.server.v1_10_R1.PacketPlayOutPosition; -import net.minecraft.server.v1_10_R1.PacketPlayOutRespawn; -import net.minecraft.server.v1_10_R1.PacketPlayOutTitle; -import net.minecraft.server.v1_10_R1.PacketPlayOutTitle.EnumTitleAction; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.PersistentContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.type.SkinDataType; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContainer; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; -import net.sourcewriters.minecraft.vcompat.utils.bukkit.Players; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.MojangProfileServer; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; -import net.sourcewriters.minecraft.vcompat.utils.thread.PostAsync; -import net.minecraft.server.v1_10_R1.PlayerConnection; -import net.minecraft.server.v1_10_R1.WorldServer; - -public class Player1_10_R1 extends EntityLiving1_10_R1 implements NmsPlayer { - - private String realName; - private Skin realSkin; - - private final WrappedContainer dataAdapter; - - public Player1_10_R1(Player player, PersistentContainer container) { - super(((CraftPlayer) player).getHandle()); - this.dataAdapter = new SimpleSyntaxContainer<>(container); - update(false); - } - - @Override - public CraftPlayer getBukkitPlayer() { - return handle.getBukkitEntity(); - } - - @Override - public WrappedContainer getDataAdapter() { - return dataAdapter; - } - - @Override - public void setSkin(Skin skin) { - if (skin == null || getSkin().equals(skin)) { - return; - } - getDataAdapter().set("skin", skin, SkinDataType.WRAPPED_INSTANCE); - } - - @Override - public Skin getSkin() { - return dataAdapter.getOrDefault("skin", SkinDataType.WRAPPED_INSTANCE, realSkin); - } - - @Override - public Skin getRealSkin() { - return realSkin; - } - - @Override - public void setName(String name) { - if (getName().equals(name)) { - return; - } - if (name == null) { - getDataAdapter().remove("name"); - return; - } - getDataAdapter().set("name", name, WrapType.STRING); - } - - @Override - public String getName() { - return getDataAdapter().getOrDefault("name", WrapType.STRING, realName); - } - - @Override - public String getRealName() { - return realName; - } - - @Override - public void setPlayerListHeader(String text) { - setPlayerListHeaderAndFooter(text, getPlayerListFooter()); - } - - @Override - public String getPlayerListHeader() { - return getDataAdapter().getOrDefault("header", WrapType.STRING, ""); - } - - @Override - public void setPlayerListFooter(String text) { - setPlayerListHeaderAndFooter(getPlayerListHeader(), text); - } - - @Override - public String getPlayerListFooter() { - return getDataAdapter().getOrDefault("footer", WrapType.STRING, ""); - } - - @Override - public int getPing() { - return handle.ping; - } - - @Override - public void setPlayerListHeaderAndFooter(String header, String footer) { - getDataAdapter().set("header", header, WrapType.STRING); - getDataAdapter().set("footer", footer, WrapType.STRING); - sendPlayerListInfo(header, footer); - } - - private final void sendPlayerListInfo(String header, String footer) { - if (handle.playerConnection.isDisconnected()) { - return; - } - - IChatBaseComponent headerComponent = header.isEmpty() ? null : CraftChatMessage.fromString(header, true)[0]; - IChatBaseComponent footerComponent = footer.isEmpty() ? null : CraftChatMessage.fromString(footer, true)[0]; - - PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter(); - - Reflect reflect = ReflectionProvider.DEFAULT.getReflect("nmsPacketPlayOutPlayerListHeaderFooter"); - reflect.setFieldValue(packet, "header", headerComponent); - reflect.setFieldValue(packet, "footer", footerComponent); - - handle.playerConnection.sendPacket(packet); - } - - @Override - public void setTitleTimes(int fadeIn, int stay, int fadeOut) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TIMES, null, fadeIn, stay, fadeOut)); - } - - @Override - public void sendSubtitle(String text) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.SUBTITLE, CraftChatMessage.fromString(text)[0])); - } - - @Override - public void sendTitle(String text) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TITLE, CraftChatMessage.fromString(text)[0])); - } - - @Override - public void sendActionBar(String text) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutChat(CraftChatMessage.fromString(text)[0], (byte) 2)); - } - - @Override - public void fakeRespawn() { - if (handle.playerConnection.isDisconnected()) { - return; - } - PacketPlayOutPlayerInfo remInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER, handle); - PacketPlayOutPlayerInfo addInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.ADD_PLAYER, handle); - - PacketPlayOutEntityDestroy destroyPacket = new PacketPlayOutEntityDestroy(handle.getId()); - PacketPlayOutNamedEntitySpawn spawnPacket = new PacketPlayOutNamedEntitySpawn(handle); - PacketPlayOutEntityHeadRotation rotationPacket = new PacketPlayOutEntityHeadRotation(handle, - (byte) MathHelper.d(handle.getHeadRotation() * 256F / 360F)); - - ArrayList equipmentPackets = new ArrayList<>(); - for (EnumItemSlot slot : EnumItemSlot.values()) { - equipmentPackets.add(new PacketPlayOutEntityEquipment(handle.getId(), slot, handle.getEquipment(slot))); - } - - Player self = getBukkitPlayer(); - Player[] players = Players.getOnlineWithout(getUniqueId()); - for (Player player : players) { - if (!player.canSee(self)) { - continue; - } - PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection; - connection.sendPacket(remInfoPacket); - connection.sendPacket(addInfoPacket); - connection.sendPacket(destroyPacket); - connection.sendPacket(spawnPacket); - connection.sendPacket(rotationPacket); - for (PacketPlayOutEntityEquipment equipmentPacket : equipmentPackets) { - connection.sendPacket(equipmentPacket); - } - } - - WorldServer world = (WorldServer) handle.world; - - PacketPlayOutRespawn respawnPacket = new PacketPlayOutRespawn(handle.dimension, world.getDifficulty(), - handle.world.worldData.getType(), handle.playerInteractManager.getGameMode()); - PacketPlayOutPosition positionPacket = new PacketPlayOutPosition(handle.locX, handle.locY, handle.locZ, handle.yaw, handle.pitch, - Collections.emptySet(), 0); - PacketPlayOutHeldItemSlot itemPacket = new PacketPlayOutHeldItemSlot(handle.inventory.itemInHandIndex); - PacketPlayOutEntityStatus statusPacket = new PacketPlayOutEntityStatus(handle, (byte) 28); - PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); - - PlayerConnection connection = handle.playerConnection; - connection.sendPacket(remInfoPacket); - connection.sendPacket(addInfoPacket); - connection.sendPacket(respawnPacket); - connection.sendPacket(positionPacket); - connection.sendPacket(itemPacket); - connection.sendPacket(statusPacket); - connection.sendPacket(metadataPacket); - - handle.updateAbilities(); - handle.triggerHealthUpdate(); - handle.updateInventory(handle.defaultContainer); - if (handle.activeContainer != handle.defaultContainer) { - handle.updateInventory(handle.activeContainer); - } - self.recalculatePermissions(); - } - - @Override - public void respawn() { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayInClientCommand(EnumClientCommand.PERFORM_RESPAWN)); - } - - @Override - public void update() { - update(true); - } - - private final void update(boolean flag) { - PostAsync.forcePost(() -> { - realName = MojangProfileServer.getName(getUniqueId()); - realSkin = MojangProfileServer.getSkin(realName, getUniqueId()); - }); - if (flag) { - GameProfile profile = handle.getProfile(); - - Skin skin = getSkin(); - if (skin != null) { - PropertyMap properties = profile.getProperties(); - properties.removeAll("textures"); - properties.put("textures", new Property("textures", skin.getValue(), skin.getSignature())); - } - - String name = getName(); - if (name != null) { - ReflectionProvider.DEFAULT.getReflect("mjGameProfile").setFieldValue(profile, "name", name); - } - - if (!(name == null && skin == null)) { - fakeRespawn(); - } - } - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/reflection/NmsReflection1_10_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/reflection/NmsReflection1_10_R1.java deleted file mode 100644 index 9c21f88..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/reflection/NmsReflection1_10_R1.java +++ /dev/null @@ -1,34 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_10_R1.reflection; - -import net.minecraft.server.v1_10_R1.NBTTagEnd; -import net.minecraft.server.v1_10_R1.NBTTagList; -import net.minecraft.server.v1_10_R1.PacketPlayOutPlayerListHeaderFooter; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.Reflections; - -public class NmsReflection1_10_R1 extends Reflections { - - public static NmsReflection1_10_R1 INSTANCE = new NmsReflection1_10_R1(); - - private NmsReflection1_10_R1() {} - - @Override - public void setup(ReflectionProvider provider) { - - // - // - // Create Reflects - // - - // - // Minecraft - - provider.createReflect("nmsPacketPlayOutPlayerListHeaderFooter", PacketPlayOutPlayerListHeaderFooter.class) - .searchField("header", "a").searchField("header", "b"); - - provider.createReflect("nmsNBTTagEnd", NBTTagEnd.class); - provider.createReflect("nmsNBTTagList", NBTTagList.class).searchField("value", "list"); - - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/tools/BlockTools1_10_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/tools/BlockTools1_10_R1.java deleted file mode 100644 index 3bd1004..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/tools/BlockTools1_10_R1.java +++ /dev/null @@ -1,39 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_10_R1.tools; - -import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_10_R1.block.CraftSkull; - -import com.mojang.authlib.properties.Property; -import com.mojang.authlib.properties.PropertyMap; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; - -import net.minecraft.server.v1_10_R1.TileEntitySkull; -import net.sourcewriters.minecraft.vcompat.reflection.tools.BlockTools; -import net.sourcewriters.minecraft.vcompat.utils.constants.MinecraftConstants; - -public class BlockTools1_10_R1 extends BlockTools { - - private final AbstractReflect craftEntityStateRef = new Reflect(CraftSkull.class).searchField("tileEntity", "tileEntity"); - - @Override - public void setHeadTexture(Block block, String texture) { - if (!(block instanceof CraftSkull)) { - return; - } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); - PropertyMap map = entitySkull.getGameProfile().getProperties(); - map.removeAll("textures"); - map.put("textures", new Property("textures", MinecraftConstants.TEXTURE_SIGNATURE, texture)); - } - - @Override - public String getHeadTexture(Block block) { - if (!(block instanceof CraftSkull)) { - return null; - } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); - return entitySkull.getGameProfile().getProperties().get("textures").iterator().next().getValue(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/tools/ServerTools1_10_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/tools/ServerTools1_10_R1.java deleted file mode 100644 index d7db518..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/tools/ServerTools1_10_R1.java +++ /dev/null @@ -1,26 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_10_R1.tools; - -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_10_R1.CraftServer; - -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_10_R1.wrapper.ConsoleReaderWrapper1_10_R1; -import net.sourcewriters.minecraft.vcompat.reflection.tools.ServerTools; - -public class ServerTools1_10_R1 extends ServerTools { - - @Override - public void setMotd(String text) { - ((CraftServer) Bukkit.getServer()).getServer().setMotd(text); - } - - @Override - public String getMotd() { - return ((CraftServer) Bukkit.getServer()).getServer().getMotd(); - } - - @Override - public ConsoleReaderWrapper1_10_R1 getConsole() { - return ConsoleReaderWrapper1_10_R1.INSTANCE; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/tools/SkinTools1_10_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/tools/SkinTools1_10_R1.java deleted file mode 100644 index 6f36635..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/tools/SkinTools1_10_R1.java +++ /dev/null @@ -1,16 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_10_R1.tools; - -import org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer; -import org.bukkit.entity.Player; - -import net.sourcewriters.minecraft.vcompat.reflection.tools.SkinTools; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; - -public class SkinTools1_10_R1 extends SkinTools { - - @Override - public Skin skinFromPlayer(Player player) { - return skinFromGameProfile(((CraftPlayer) player).getHandle().getProfile()); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/utils/EntityConstructors1_10_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/utils/EntityConstructors1_10_R1.java deleted file mode 100644 index 959b60c..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/utils/EntityConstructors1_10_R1.java +++ /dev/null @@ -1,12 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_10_R1.utils; - -import java.util.function.Function; - -import net.minecraft.server.v1_10_R1.World; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_10_R1.entity.ArmorStand1_10_R1; - -public abstract class EntityConstructors1_10_R1 { - - public static final Function ARMOR_STAND = (world -> new ArmorStand1_10_R1(world)); - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/wrapper/ConsoleReaderWrapper1_10_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/wrapper/ConsoleReaderWrapper1_10_R1.java deleted file mode 100644 index a9e765c..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/wrapper/ConsoleReaderWrapper1_10_R1.java +++ /dev/null @@ -1,43 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_10_R1.wrapper; - -import java.io.IOException; -import java.io.Writer; - -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_10_R1.CraftServer; -import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; - -import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; - -public final class ConsoleReaderWrapper1_10_R1 extends ConsoleReaderWrapper { - - public static final ConsoleReaderWrapper1_10_R1 INSTANCE = new ConsoleReaderWrapper1_10_R1(); - - private final ConsoleReader reader; - - @SuppressWarnings("resource") - private ConsoleReaderWrapper1_10_R1() { - this.reader = ((CraftServer) Bukkit.getServer()).getServer().reader; - } - - @Override - public Writer getOutput() { - return reader.getOutput(); - } - - @Override - public boolean isAnsiSupported() { - return reader.getTerminal().isAnsiSupported(); - } - - @Override - public void flush() throws IOException { - reader.flush(); - } - - @Override - public void drawLine() throws IOException { - reader.drawLine(); - } - -} diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/BukkitConversion1_11_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/BukkitConversion1_11_R1.java deleted file mode 100644 index 28af2d7..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/BukkitConversion1_11_R1.java +++ /dev/null @@ -1,228 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_11_R1; - -import java.util.List; -import java.util.Set; - -import org.bukkit.craftbukkit.v1_11_R1.inventory.CraftItemStack; -import org.bukkit.entity.EntityType; - -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.nbt.NbtByte; -import com.syntaxphoenix.syntaxapi.nbt.NbtByteArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; -import com.syntaxphoenix.syntaxapi.nbt.NbtDouble; -import com.syntaxphoenix.syntaxapi.nbt.NbtEnd; -import com.syntaxphoenix.syntaxapi.nbt.NbtFloat; -import com.syntaxphoenix.syntaxapi.nbt.NbtInt; -import com.syntaxphoenix.syntaxapi.nbt.NbtIntArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtList; -import com.syntaxphoenix.syntaxapi.nbt.NbtLong; -import com.syntaxphoenix.syntaxapi.nbt.NbtLongArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtShort; -import com.syntaxphoenix.syntaxapi.nbt.NbtString; -import com.syntaxphoenix.syntaxapi.nbt.NbtTag; -import com.syntaxphoenix.syntaxapi.nbt.NbtType; - -import net.minecraft.server.v1_11_R1.ItemStack; -import net.minecraft.server.v1_11_R1.NBTBase; -import net.minecraft.server.v1_11_R1.NBTTagByte; -import net.minecraft.server.v1_11_R1.NBTTagByteArray; -import net.minecraft.server.v1_11_R1.NBTTagCompound; -import net.minecraft.server.v1_11_R1.NBTTagDouble; -import net.minecraft.server.v1_11_R1.NBTTagEnd; -import net.minecraft.server.v1_11_R1.NBTTagFloat; -import net.minecraft.server.v1_11_R1.NBTTagInt; -import net.minecraft.server.v1_11_R1.NBTTagIntArray; -import net.minecraft.server.v1_11_R1.NBTTagList; -import net.minecraft.server.v1_11_R1.NBTTagLong; -import net.minecraft.server.v1_11_R1.NBTTagShort; -import net.minecraft.server.v1_11_R1.NBTTagString; -import net.sourcewriters.minecraft.vcompat.reflection.BukkitConversion; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContext; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleWrapType; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; - -public class BukkitConversion1_11_R1 extends BukkitConversion { - - protected BukkitConversion1_11_R1(VersionControl1_11_R1 versionControl) { - super(versionControl); - } - - @Override - public EntityType toEntityType(NmsEntityType type) { - try { - return EntityType.valueOf(type.name()); - } catch (IllegalArgumentException ignore) { - return null; - } - } - - @Override - public NmsEntityType fromEntityType(EntityType type) { - try { - return NmsEntityType.valueOf(type.name()); - } catch (IllegalArgumentException ignore) { - return null; - } - } - - @Override - public NBTBase toMinecraftTag(NbtTag tag) { - switch (tag.getType()) { - case BYTE: - return new NBTTagByte((byte) tag.getValue()); - case SHORT: - return new NBTTagShort((short) tag.getValue()); - case INT: - return new NBTTagInt((int) tag.getValue()); - case LONG: - return new NBTTagLong((long) tag.getValue()); - case FLOAT: - return new NBTTagFloat((float) tag.getValue()); - case DOUBLE: - return new NBTTagDouble((double) tag.getValue()); - case STRING: - return new NBTTagString((String) tag.getValue()); - case BYTE_ARRAY: - return new NBTTagByteArray((byte[]) tag.getValue()); - case INT_ARRAY: - return new NBTTagIntArray((int[]) tag.getValue()); - case LONG_ARRAY: - NBTTagList list = new NBTTagList(); - for (long value : (long[]) tag.getValue()) { - list.add(new NBTTagLong(value)); - } - return list; - case LIST: - return toMinecraftList((NbtList) tag); - case COMPOUND: - return toMinecraftCompound((NbtCompound) tag); - case END: - return (NBTTagEnd) ReflectionProvider.DEFAULT.getReflect("nmsNBTTagEnd").init(); - default: - return null; - } - } - - @Override - public NbtTag fromMinecraftTag(Object raw) { - if (!(raw instanceof NBTBase)) { - return null; - } - NBTBase tag = (NBTBase) raw; - NbtType type = NbtType.getById(tag.getTypeId()); - switch (type) { - case BYTE: - return new NbtByte(((NBTTagByte) tag).g()); - case SHORT: - return new NbtShort(((NBTTagShort) tag).f()); - case INT: - return new NbtInt(((NBTTagInt) tag).e()); - case LONG: - return new NbtLong(((NBTTagLong) tag).d()); - case FLOAT: - return new NbtFloat(((NBTTagFloat) tag).i()); - case DOUBLE: - return new NbtDouble(((NBTTagDouble) tag).asDouble()); - case STRING: - return new NbtString(((NBTTagString) tag).c_()); - case BYTE_ARRAY: - return new NbtByteArray(((NBTTagByteArray) tag).c()); - case INT_ARRAY: - return new NbtIntArray(((NBTTagIntArray) tag).d()); - case LONG_ARRAY: - return new NbtLongArray(new long[0]); - case LIST: - return fromMinecraftList(tag); - case COMPOUND: - return fromMinecraftCompound(tag); - case END: - return NbtEnd.INSTANCE; - default: - return null; - } - } - - @Override - public NBTTagList toMinecraftList(NbtList list) { - NBTTagList output = new NBTTagList(); - for (NbtTag tag : list) { - output.add(toMinecraftTag(tag)); - } - return output; - } - - @SuppressWarnings("unchecked") - @Override - public NbtList fromMinecraftList(Object raw) { - if (!(raw instanceof NBTTagList)) { - return null; - } - NBTTagList list = (NBTTagList) raw; - List content = (List) ReflectionProvider.DEFAULT.getReflect("nmsNBTTagList").getFieldValue("value", list); - NbtList output = new NbtList<>(NbtType.getById(list.getTypeId())); - for (NBTBase base : content) { - output.add(fromMinecraftTag(base)); - } - return output; - } - - @Override - public NBTTagCompound toMinecraftCompound(NbtCompound compound) { - NBTTagCompound output = new NBTTagCompound(); - if (compound.isEmpty()) { - return output; - } - Set keys = compound.getKeys(); - for (String key : keys) { - output.set(key, toMinecraftTag(compound.get(key))); - } - return output; - } - - @Override - public NbtCompound fromMinecraftCompound(Object raw) { - if (!(raw instanceof NBTTagCompound)) { - return null; - } - NBTTagCompound compound = (NBTTagCompound) raw; - NbtCompound output = new NbtCompound(); - if (compound.isEmpty()) { - return output; - } - Set keys = compound.c(); - for (String key : keys) { - output.set(key, fromMinecraftTag(compound.get(key))); - } - return output; - } - - @Override - public org.bukkit.inventory.ItemStack itemFromCompound(NbtCompound compound) { - return CraftItemStack.asBukkitCopy(new ItemStack(toMinecraftCompound(compound))); - } - - @Override - public NbtCompound itemToCompound(org.bukkit.inventory.ItemStack itemStack) { - ItemStack nmsStack = CraftItemStack.asNMSCopy(itemStack); - if (!nmsStack.hasTag()) { - nmsStack.convertStack(); - } - return fromMinecraftCompound(nmsStack.getTag()); - } - - @Override - public WrappedContext createContext(DataAdapterContext context) { - return new SimpleSyntaxContext(context); - } - - @Override - public WrapType wrap(DataType dataType) { - return new SimpleWrapType(dataType); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/EntityProvider1_11_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/EntityProvider1_11_R1.java deleted file mode 100644 index cd61fcb..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/EntityProvider1_11_R1.java +++ /dev/null @@ -1,47 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_11_R1; - -import java.util.EnumMap; -import java.util.function.Function; - -import org.bukkit.craftbukkit.v1_11_R1.CraftWorld; - -import net.minecraft.server.v1_11_R1.World; -import net.sourcewriters.minecraft.vcompat.reflection.EntityProvider; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_11_R1.utils.EntityConstructors1_11_R1; - -public class EntityProvider1_11_R1 extends EntityProvider { - - private final EnumMap> entityMap = new EnumMap<>(NmsEntityType.class); - - protected EntityProvider1_11_R1(VersionControl1_11_R1 versionControl) { - super(versionControl); - } - - @SuppressWarnings("unchecked") - private final Function searchConstructor(NmsEntityType type) { - try { - return (Function) EntityConstructors1_11_R1.class.getField(type.name()).get(null); - } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException ignore) { - return null; - } - } - - private final Function getConstructor(NmsEntityType type) { - return entityMap.computeIfAbsent(type, (key -> searchConstructor(key))); - } - - @Override - public NmsEntity createEntity(org.bukkit.World world, NmsEntityType type) { - if (!(world instanceof CraftWorld)) { - return null; - } - Function function; - if ((function = getConstructor(type)) == null) { - return null; - } - return function.apply(((CraftWorld) world).getHandle()); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/PacketHandler1_11_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/PacketHandler1_11_R1.java deleted file mode 100644 index 8423e5a..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/PacketHandler1_11_R1.java +++ /dev/null @@ -1,11 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_11_R1; - -import net.sourcewriters.minecraft.vcompat.reflection.PacketHandler; - -public class PacketHandler1_11_R1 extends PacketHandler { - - protected PacketHandler1_11_R1(VersionControl1_11_R1 versionControl) { - super(versionControl); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/PlayerProvider1_11_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/PlayerProvider1_11_R1.java deleted file mode 100644 index 302fe37..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/PlayerProvider1_11_R1.java +++ /dev/null @@ -1,30 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_11_R1; - -import java.io.File; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; - -import net.sourcewriters.minecraft.vcompat.reflection.DataProvider; -import net.sourcewriters.minecraft.vcompat.reflection.PlayerProvider; -import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.DataDistributor; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_11_R1.entity.Player1_11_R1; - -public class PlayerProvider1_11_R1 extends PlayerProvider { - - private final DataDistributor distributor; - - protected PlayerProvider1_11_R1(VersionControl1_11_R1 versionControl) { - super(versionControl); - distributor = versionControl.getDataProvider().createDistributor(new File(Bukkit.getWorlds().get(0).getWorldFolder(), "playerdata"), - uuid -> "custom_" + uuid.toString(), DataProvider.DEFAULT_RANDOM); - } - - @Override - protected NmsPlayer createPlayer(Player player) { - return new Player1_11_R1(player, distributor.get(player.getUniqueId())); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/TextureProvider1_11_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/TextureProvider1_11_R1.java deleted file mode 100644 index 858b989..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/TextureProvider1_11_R1.java +++ /dev/null @@ -1,103 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_11_R1; - -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_11_R1.block.CraftSkull; -import org.bukkit.craftbukkit.v1_11_R1.inventory.CraftItemStack; -import org.bukkit.inventory.meta.ItemMeta; -import org.bukkit.inventory.meta.SkullMeta; -import org.bukkit.material.MaterialData; - -import com.mojang.authlib.GameProfile; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; - -import net.minecraft.server.v1_11_R1.GameProfileSerializer; -import net.minecraft.server.v1_11_R1.ItemStack; -import net.minecraft.server.v1_11_R1.NBTTagCompound; -import net.sourcewriters.minecraft.vcompat.reflection.TextureProvider; - -@SuppressWarnings("deprecation") -public class TextureProvider1_11_R1 extends TextureProvider { - - private final AbstractReflect craftItemStackRef = new Reflect(CraftItemStack.class).searchField("handle", "handle"); - private final AbstractReflect craftMetaSkullRef = new Reflect("org.bukkit.craftbukkit.v1_11_R1.inventory.CraftMetaSkull") - .searchField("serialized", "serializedProfile").searchField("profile", "profile"); - private final Material skullMaterial = Material.valueOf("SKULL"); - - protected TextureProvider1_11_R1(VersionControl1_11_R1 versionControl) { - super(versionControl); - } - - @Override - public GameProfile profileFromBlock(Block block) { - if (!(block instanceof CraftSkull)) { - return null; - } - return ((CraftSkull) block).getTileEntity().getGameProfile(); - } - - @Override - public GameProfile profileFromItem(org.bukkit.inventory.ItemStack itemStack) { - if (!(itemStack.getItemMeta() instanceof SkullMeta)) { - return null; - } - SkullMeta meta = (SkullMeta) itemStack.getItemMeta(); - GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue("profile", meta); - if (profile == null) { - NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue("serialized", meta); - if (compound == null) { - ItemStack stack = null; - if (itemStack instanceof CraftItemStack) { - stack = (ItemStack) craftItemStackRef.getFieldValue("handle", itemStack); - } - if (stack == null) { - stack = CraftItemStack.asNMSCopy(itemStack); - } - if (!stack.hasTag()) { - stack.convertStack(); - } - NBTTagCompound stackTag = stack.getTag(); - if (stackTag.hasKeyOfType("SkullOwner", 10)) { - compound = stackTag.getCompound("SkullOwner"); - } else if (stackTag.hasKeyOfType("SkullProfile", 10)) { - compound = stackTag.getCompound("SkullProfile"); - } - } - if (compound == null) { - return null; - } - profile = GameProfileSerializer.deserialize(compound); - } - return profile; - } - - @Override - public org.bukkit.inventory.ItemStack getItem(GameProfile profile) { - org.bukkit.inventory.ItemStack craftStack = CraftItemStack.asCraftCopy(new MaterialData(skullMaterial, (byte) 3).toItemStack(1)); - applyItem(craftStack, profile); - return craftStack; - } - - @Override - public boolean applyItem(org.bukkit.inventory.ItemStack itemStack, GameProfile profile) { - ItemMeta meta = itemStack.getItemMeta(); - if (!(meta instanceof SkullMeta)) { - return false; - } - SkullMeta skullMeta = (SkullMeta) meta; - craftMetaSkullRef.setFieldValue(meta, "profile", profile); - itemStack.setItemMeta(skullMeta); - return true; - } - - @Override - public boolean applyBlock(Block block, GameProfile profile) { - if (!(block instanceof CraftSkull)) { - return false; - } - ((CraftSkull) block).getTileEntity().setGameProfile(profile); - return true; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/ToolProvider1_11_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/ToolProvider1_11_R1.java deleted file mode 100644 index edc47bb..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/ToolProvider1_11_R1.java +++ /dev/null @@ -1,33 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_11_R1; - -import net.sourcewriters.minecraft.vcompat.reflection.ToolProvider; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_11_R1.tools.BlockTools1_11_R1; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_11_R1.tools.ServerTools1_11_R1; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_11_R1.tools.SkinTools1_11_R1; - -public class ToolProvider1_11_R1 extends ToolProvider { - - private final BlockTools1_11_R1 blockTools = new BlockTools1_11_R1(); - private final SkinTools1_11_R1 skinTools = new SkinTools1_11_R1(); - private final ServerTools1_11_R1 serverTools = new ServerTools1_11_R1(); - - protected ToolProvider1_11_R1(VersionControl1_11_R1 versionControl) { - super(versionControl); - } - - @Override - public SkinTools1_11_R1 getSkinTools() { - return skinTools; - } - - @Override - public ServerTools1_11_R1 getServerTools() { - return serverTools; - } - - @Override - public BlockTools1_11_R1 getBlockTools() { - return blockTools; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/VersionControl1_11_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/VersionControl1_11_R1.java deleted file mode 100644 index 767789b..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/VersionControl1_11_R1.java +++ /dev/null @@ -1,56 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_11_R1; - -import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_11_R1.reflection.NmsReflection1_11_R1; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; - -public class VersionControl1_11_R1 extends VersionControl { - - public static VersionControl1_11_R1 INSTANCE; - - public static VersionControl1_11_R1 init() { - return INSTANCE != null ? INSTANCE : (INSTANCE = new VersionControl1_11_R1()); - } - - private final ToolProvider1_11_R1 toolProvider = new ToolProvider1_11_R1(this); - private final TextureProvider1_11_R1 textureProvider = new TextureProvider1_11_R1(this); - private final PacketHandler1_11_R1 packetHandler = new PacketHandler1_11_R1(this); - private final EntityProvider1_11_R1 entityProvider = new EntityProvider1_11_R1(this); - private final PlayerProvider1_11_R1 playerProvider = new PlayerProvider1_11_R1(this); - private final BukkitConversion1_11_R1 bukkitConversion = new BukkitConversion1_11_R1(this); - - private VersionControl1_11_R1() { - NmsReflection1_11_R1.INSTANCE.setup(ReflectionProvider.DEFAULT); - } - - @Override - public ToolProvider1_11_R1 getToolProvider() { - return toolProvider; - } - - @Override - public EntityProvider1_11_R1 getEntityProvider() { - return entityProvider; - } - - @Override - public PlayerProvider1_11_R1 getPlayerProvider() { - return playerProvider; - } - - @Override - public TextureProvider1_11_R1 getTextureProvider() { - return textureProvider; - } - - @Override - public PacketHandler1_11_R1 getPacketHandler() { - return packetHandler; - } - - @Override - public BukkitConversion1_11_R1 getBukkitConversion() { - return bukkitConversion; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/entity/ArmorStand1_11_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/entity/ArmorStand1_11_R1.java deleted file mode 100644 index 0937819..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/entity/ArmorStand1_11_R1.java +++ /dev/null @@ -1,23 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_11_R1.entity; - -import net.minecraft.server.v1_11_R1.EntityArmorStand; -import net.minecraft.server.v1_11_R1.World; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsArmorStand; - -public class ArmorStand1_11_R1 extends EntityLiving1_11_R1 implements NmsArmorStand { - - public ArmorStand1_11_R1(World world) { - super(new EntityArmorStand(world)); - } - - @Override - public void setSmall(boolean small) { - handle.setSmall(small); - } - - @Override - public boolean isSmall() { - return handle.isSmall(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/entity/Entity1_11_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/entity/Entity1_11_R1.java deleted file mode 100644 index f8209e0..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/entity/Entity1_11_R1.java +++ /dev/null @@ -1,215 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_11_R1.entity; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.OfflinePlayer; -import org.bukkit.craftbukkit.v1_11_R1.CraftWorld; -import org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer; -import org.bukkit.entity.Player; - -import net.minecraft.server.v1_11_R1.AxisAlignedBB; -import net.minecraft.server.v1_11_R1.Entity; -import net.minecraft.server.v1_11_R1.EntityTypes; -import net.minecraft.server.v1_11_R1.PacketPlayOutEntityDestroy; -import net.minecraft.server.v1_11_R1.PacketPlayOutEntityMetadata; -import net.minecraft.server.v1_11_R1.PacketPlayOutSpawnEntity; -import net.minecraft.server.v1_11_R1.PlayerConnection; -import net.minecraft.server.v1_11_R1.Vec3D; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.utils.NmsBoundingBox; - -public abstract class Entity1_11_R1 implements NmsEntity { - - protected final E handle; - - protected final List visible = Collections.synchronizedList(new ArrayList<>()); - - public Entity1_11_R1(E handle) { - this.handle = handle; - } - - @Override - public final E getHandle() { - return handle; - } - - @Override - public int getId() { - return handle.getId(); - } - - @Override - public UUID getUniqueId() { - return handle.getUniqueID(); - } - - @Override - public NmsBoundingBox getBoundingBox() { - AxisAlignedBB box = handle.getBoundingBox(); - return new NmsBoundingBox(box.a, box.b, box.c, box.d, box.e, box.f); - } - - @Override - public void setCustomName(String name) { - handle.setCustomName(name); - updateVisibility(); - } - - @Override - public String getCustomName() { - return handle.getCustomName(); - } - - @Override - public void setGravity(boolean gravity) { - handle.setNoGravity(!gravity); - } - - @Override - public boolean hasGravity() { - return !handle.isNoGravity(); - } - - @Override - public void setCustomNameVisible(boolean visible) { - handle.setCustomNameVisible(visible); - } - - @Override - public boolean isCustomNameVisible() { - return handle.getCustomNameVisible(); - } - - @Override - public void setInvisible(boolean invisible) { - handle.setInvisible(invisible); - } - - @Override - public boolean isInvisible() { - return handle.isInvisible(); - } - - @Override - public boolean isInteractable() { - return handle.isInteractable(); - } - - @Override - public boolean isCollidable() { - return handle.isCollidable(); - } - - @Override - public void setInvulnerable(boolean invulnerable) { - handle.setInvulnerable(invulnerable); - } - - @Override - public boolean isInvulnerable() { - return handle.aW(); - } - - @Override - public void setLocation(Location location) { - handle.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); - if (location.getWorld() == null || handle.getWorld().getWorld() == location.getWorld()) { - updateVisibility(); - return; - } - handle.world = ((CraftWorld) location.getWorld()).getHandle(); - updateVisibility(); - } - - @Override - public Location getLocation() { - Vec3D vector = handle.d(); - return new Location(handle.getWorld().getWorld(), vector.x, vector.y, vector.z); - } - - @Override - public void updateVisibility() { - if (visible.isEmpty()) { - return; - } - Player[] players; - synchronized (visible) { - players = visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) - .toArray(Player[]::new); - } - hide(players); - show(players); - } - - @Override - public boolean isShown(Player player) { - synchronized (visible) { - return visible.contains(player.getUniqueId()); - } - } - - @Override - public void hide(Player... players) { - if (players.length == 0) { - return; - } - PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(handle.getId()); - for (Player player : players) { - if (!isShown(player) && !(player instanceof CraftPlayer)) { - continue; - } - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); - synchronized (visible) { - visible.remove(player.getUniqueId()); - } - } - } - - @Override - public void show(Player... players) { - if (players.length == 0) { - return; - } - PacketPlayOutSpawnEntity packet = new PacketPlayOutSpawnEntity(handle, EntityTypes.b.a(handle.getClass())); - PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); - PlayerConnection connection; - for (Player player : players) { - if (isShown(player)) { - continue; - } - connection = ((CraftPlayer) player).getHandle().playerConnection; - connection.sendPacket(packet); - connection.sendPacket(metadataPacket); - synchronized (visible) { - visible.add(player.getUniqueId()); - } - } - } - - @Override - public UUID[] getVisible() { - synchronized (visible) { - return visible.toArray(new UUID[0]); - } - } - - @Override - public Player[] getVisibleAsPlayer() { - synchronized (visible) { - return visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) - .toArray(Player[]::new); - } - } - - @Override - public void kill() { - hide(getVisibleAsPlayer()); - handle.die(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/entity/EntityLiving1_11_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/entity/EntityLiving1_11_R1.java deleted file mode 100644 index 997a931..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/entity/EntityLiving1_11_R1.java +++ /dev/null @@ -1,17 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_11_R1.entity; - -import net.minecraft.server.v1_11_R1.EntityLiving; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityLiving; - -public abstract class EntityLiving1_11_R1 extends Entity1_11_R1 implements NmsEntityLiving { - - public EntityLiving1_11_R1(E handle) { - super(handle); - } - - @Override - public void setCollidable(boolean collidable) { - handle.collides = collidable; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/entity/Player1_11_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/entity/Player1_11_R1.java deleted file mode 100644 index 1507cf0..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/entity/Player1_11_R1.java +++ /dev/null @@ -1,295 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_11_R1.entity; - -import java.util.ArrayList; -import java.util.Collections; - -import org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_11_R1.util.CraftChatMessage; -import org.bukkit.entity.Player; - -import com.mojang.authlib.GameProfile; -import com.mojang.authlib.properties.Property; -import com.mojang.authlib.properties.PropertyMap; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; - -import net.minecraft.server.v1_11_R1.EntityPlayer; -import net.minecraft.server.v1_11_R1.EnumItemSlot; -import net.minecraft.server.v1_11_R1.IChatBaseComponent; -import net.minecraft.server.v1_11_R1.MathHelper; -import net.minecraft.server.v1_11_R1.PacketPlayInClientCommand; -import net.minecraft.server.v1_11_R1.PacketPlayInClientCommand.EnumClientCommand; -import net.minecraft.server.v1_11_R1.PacketPlayOutEntityDestroy; -import net.minecraft.server.v1_11_R1.PacketPlayOutEntityEquipment; -import net.minecraft.server.v1_11_R1.PacketPlayOutEntityHeadRotation; -import net.minecraft.server.v1_11_R1.PacketPlayOutEntityMetadata; -import net.minecraft.server.v1_11_R1.PacketPlayOutEntityStatus; -import net.minecraft.server.v1_11_R1.PacketPlayOutHeldItemSlot; -import net.minecraft.server.v1_11_R1.PacketPlayOutNamedEntitySpawn; -import net.minecraft.server.v1_11_R1.PacketPlayOutPlayerInfo; -import net.minecraft.server.v1_11_R1.PacketPlayOutPlayerInfo.EnumPlayerInfoAction; -import net.minecraft.server.v1_11_R1.PacketPlayOutPlayerListHeaderFooter; -import net.minecraft.server.v1_11_R1.PacketPlayOutPosition; -import net.minecraft.server.v1_11_R1.PacketPlayOutRespawn; -import net.minecraft.server.v1_11_R1.PacketPlayOutTitle; -import net.minecraft.server.v1_11_R1.PacketPlayOutTitle.EnumTitleAction; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.PersistentContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.type.SkinDataType; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContainer; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; -import net.sourcewriters.minecraft.vcompat.utils.bukkit.Players; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.MojangProfileServer; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; -import net.sourcewriters.minecraft.vcompat.utils.thread.PostAsync; -import net.minecraft.server.v1_11_R1.PlayerConnection; -import net.minecraft.server.v1_11_R1.WorldServer; - -public class Player1_11_R1 extends EntityLiving1_11_R1 implements NmsPlayer { - - private String realName; - private Skin realSkin; - - private final WrappedContainer dataAdapter; - - public Player1_11_R1(Player player, PersistentContainer container) { - super(((CraftPlayer) player).getHandle()); - this.dataAdapter = new SimpleSyntaxContainer<>(container); - update(false); - } - - @Override - public CraftPlayer getBukkitPlayer() { - return handle.getBukkitEntity(); - } - - @Override - public WrappedContainer getDataAdapter() { - return dataAdapter; - } - - @Override - public void setSkin(Skin skin) { - if (skin == null || getSkin().equals(skin)) { - return; - } - getDataAdapter().set("skin", skin, SkinDataType.WRAPPED_INSTANCE); - } - - @Override - public Skin getSkin() { - return dataAdapter.getOrDefault("skin", SkinDataType.WRAPPED_INSTANCE, realSkin); - } - - @Override - public Skin getRealSkin() { - return realSkin; - } - - @Override - public void setName(String name) { - if (getName().equals(name)) { - return; - } - if (name == null) { - getDataAdapter().remove("name"); - return; - } - getDataAdapter().set("name", name, WrapType.STRING); - } - - @Override - public String getName() { - return getDataAdapter().getOrDefault("name", WrapType.STRING, realName); - } - - @Override - public String getRealName() { - return realName; - } - - @Override - public void setPlayerListHeader(String text) { - setPlayerListHeaderAndFooter(text, getPlayerListFooter()); - } - - @Override - public String getPlayerListHeader() { - return getDataAdapter().getOrDefault("header", WrapType.STRING, ""); - } - - @Override - public void setPlayerListFooter(String text) { - setPlayerListHeaderAndFooter(getPlayerListHeader(), text); - } - - @Override - public String getPlayerListFooter() { - return getDataAdapter().getOrDefault("footer", WrapType.STRING, ""); - } - - @Override - public int getPing() { - return handle.ping; - } - - @Override - public void setPlayerListHeaderAndFooter(String header, String footer) { - getDataAdapter().set("header", header, WrapType.STRING); - getDataAdapter().set("footer", footer, WrapType.STRING); - sendPlayerListInfo(header, footer); - } - - private final void sendPlayerListInfo(String header, String footer) { - if (handle.playerConnection.isDisconnected()) { - return; - } - - IChatBaseComponent headerComponent = header.isEmpty() ? null : CraftChatMessage.fromString(header, true)[0]; - IChatBaseComponent footerComponent = footer.isEmpty() ? null : CraftChatMessage.fromString(footer, true)[0]; - - PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter(); - - Reflect reflect = ReflectionProvider.DEFAULT.getReflect("nmsPacketPlayOutPlayerListHeaderFooter"); - reflect.setFieldValue(packet, "header", headerComponent); - reflect.setFieldValue(packet, "footer", footerComponent); - - handle.playerConnection.sendPacket(packet); - } - - @Override - public void setTitleTimes(int fadeIn, int stay, int fadeOut) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TIMES, null, fadeIn, stay, fadeOut)); - } - - @Override - public void sendSubtitle(String text) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.SUBTITLE, CraftChatMessage.fromString(text)[0])); - } - - @Override - public void sendTitle(String text) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TITLE, CraftChatMessage.fromString(text)[0])); - } - - @Override - public void sendActionBar(String text) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.ACTIONBAR, CraftChatMessage.fromString(text)[0])); - } - - @Override - public void fakeRespawn() { - if (handle.playerConnection.isDisconnected()) { - return; - } - PacketPlayOutPlayerInfo remInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER, handle); - PacketPlayOutPlayerInfo addInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.ADD_PLAYER, handle); - - PacketPlayOutEntityDestroy destroyPacket = new PacketPlayOutEntityDestroy(handle.getId()); - PacketPlayOutNamedEntitySpawn spawnPacket = new PacketPlayOutNamedEntitySpawn(handle); - PacketPlayOutEntityHeadRotation rotationPacket = new PacketPlayOutEntityHeadRotation(handle, - (byte) MathHelper.d(handle.getHeadRotation() * 256F / 360F)); - - ArrayList equipmentPackets = new ArrayList<>(); - for (EnumItemSlot slot : EnumItemSlot.values()) { - equipmentPackets.add(new PacketPlayOutEntityEquipment(handle.getId(), slot, handle.getEquipment(slot))); - } - - Player self = getBukkitPlayer(); - Player[] players = Players.getOnlineWithout(getUniqueId()); - for (Player player : players) { - if (!player.canSee(self)) { - continue; - } - PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection; - connection.sendPacket(remInfoPacket); - connection.sendPacket(addInfoPacket); - connection.sendPacket(destroyPacket); - connection.sendPacket(spawnPacket); - connection.sendPacket(rotationPacket); - for (PacketPlayOutEntityEquipment equipmentPacket : equipmentPackets) { - connection.sendPacket(equipmentPacket); - } - } - - WorldServer world = (WorldServer) handle.world; - - PacketPlayOutRespawn respawnPacket = new PacketPlayOutRespawn(handle.dimension, world.getDifficulty(), - handle.world.worldData.getType(), handle.playerInteractManager.getGameMode()); - PacketPlayOutPosition positionPacket = new PacketPlayOutPosition(handle.locX, handle.locY, handle.locZ, handle.yaw, handle.pitch, - Collections.emptySet(), 0); - PacketPlayOutHeldItemSlot itemPacket = new PacketPlayOutHeldItemSlot(handle.inventory.itemInHandIndex); - PacketPlayOutEntityStatus statusPacket = new PacketPlayOutEntityStatus(handle, (byte) 28); - PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); - - PlayerConnection connection = handle.playerConnection; - connection.sendPacket(remInfoPacket); - connection.sendPacket(addInfoPacket); - connection.sendPacket(respawnPacket); - connection.sendPacket(positionPacket); - connection.sendPacket(itemPacket); - connection.sendPacket(statusPacket); - connection.sendPacket(metadataPacket); - - handle.updateAbilities(); - handle.triggerHealthUpdate(); - handle.updateInventory(handle.defaultContainer); - if (handle.activeContainer != handle.defaultContainer) { - handle.updateInventory(handle.activeContainer); - } - self.recalculatePermissions(); - } - - @Override - public void respawn() { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayInClientCommand(EnumClientCommand.PERFORM_RESPAWN)); - } - - @Override - public void update() { - update(true); - } - - private final void update(boolean flag) { - PostAsync.forcePost(() -> { - realName = MojangProfileServer.getName(getUniqueId()); - realSkin = MojangProfileServer.getSkin(realName, getUniqueId()); - }); - if (flag) { - GameProfile profile = handle.getProfile(); - - Skin skin = getSkin(); - if (skin != null) { - PropertyMap properties = profile.getProperties(); - properties.removeAll("textures"); - properties.put("textures", new Property("textures", skin.getValue(), skin.getSignature())); - } - - String name = getName(); - if (name != null) { - ReflectionProvider.DEFAULT.getReflect("mjGameProfile").setFieldValue(profile, "name", name); - } - - if (!(name == null && skin == null)) { - fakeRespawn(); - } - } - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/reflection/NmsReflection1_11_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/reflection/NmsReflection1_11_R1.java deleted file mode 100644 index 09c2c88..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/reflection/NmsReflection1_11_R1.java +++ /dev/null @@ -1,34 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_11_R1.reflection; - -import net.minecraft.server.v1_11_R1.NBTTagEnd; -import net.minecraft.server.v1_11_R1.NBTTagList; -import net.minecraft.server.v1_11_R1.PacketPlayOutPlayerListHeaderFooter; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.Reflections; - -public class NmsReflection1_11_R1 extends Reflections { - - public static NmsReflection1_11_R1 INSTANCE = new NmsReflection1_11_R1(); - - private NmsReflection1_11_R1() {} - - @Override - public void setup(ReflectionProvider provider) { - - // - // - // Create Reflects - // - - // - // Minecraft - - provider.createReflect("nmsPacketPlayOutPlayerListHeaderFooter", PacketPlayOutPlayerListHeaderFooter.class) - .searchField("header", "a").searchField("header", "b"); - - provider.createReflect("nmsNBTTagEnd", NBTTagEnd.class); - provider.createReflect("nmsNBTTagList", NBTTagList.class).searchField("value", "list"); - - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/tools/BlockTools1_11_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/tools/BlockTools1_11_R1.java deleted file mode 100644 index 2305684..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/tools/BlockTools1_11_R1.java +++ /dev/null @@ -1,39 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_11_R1.tools; - -import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_11_R1.block.CraftSkull; - -import com.mojang.authlib.properties.Property; -import com.mojang.authlib.properties.PropertyMap; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; - -import net.minecraft.server.v1_11_R1.TileEntitySkull; -import net.sourcewriters.minecraft.vcompat.reflection.tools.BlockTools; -import net.sourcewriters.minecraft.vcompat.utils.constants.MinecraftConstants; - -public class BlockTools1_11_R1 extends BlockTools { - - private final AbstractReflect craftEntityStateRef = new Reflect(CraftSkull.class).searchField("tileEntity", "tileEntity"); - - @Override - public void setHeadTexture(Block block, String texture) { - if (!(block instanceof CraftSkull)) { - return; - } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); - PropertyMap map = entitySkull.getGameProfile().getProperties(); - map.removeAll("textures"); - map.put("textures", new Property("textures", MinecraftConstants.TEXTURE_SIGNATURE, texture)); - } - - @Override - public String getHeadTexture(Block block) { - if (!(block instanceof CraftSkull)) { - return null; - } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); - return entitySkull.getGameProfile().getProperties().get("textures").iterator().next().getValue(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/tools/ServerTools1_11_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/tools/ServerTools1_11_R1.java deleted file mode 100644 index 9038d0c..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/tools/ServerTools1_11_R1.java +++ /dev/null @@ -1,26 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_11_R1.tools; - -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_11_R1.CraftServer; - -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_11_R1.wrapper.ConsoleReaderWrapper1_11_R1; -import net.sourcewriters.minecraft.vcompat.reflection.tools.ServerTools; - -public class ServerTools1_11_R1 extends ServerTools { - - @Override - public void setMotd(String text) { - ((CraftServer) Bukkit.getServer()).getServer().setMotd(text); - } - - @Override - public String getMotd() { - return ((CraftServer) Bukkit.getServer()).getServer().getMotd(); - } - - @Override - public ConsoleReaderWrapper1_11_R1 getConsole() { - return ConsoleReaderWrapper1_11_R1.INSTANCE; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/tools/SkinTools1_11_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/tools/SkinTools1_11_R1.java deleted file mode 100644 index 6207436..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/tools/SkinTools1_11_R1.java +++ /dev/null @@ -1,16 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_11_R1.tools; - -import org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer; -import org.bukkit.entity.Player; - -import net.sourcewriters.minecraft.vcompat.reflection.tools.SkinTools; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; - -public class SkinTools1_11_R1 extends SkinTools { - - @Override - public Skin skinFromPlayer(Player player) { - return skinFromGameProfile(((CraftPlayer) player).getHandle().getProfile()); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/utils/EntityConstructors1_11_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/utils/EntityConstructors1_11_R1.java deleted file mode 100644 index 947ca08..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/utils/EntityConstructors1_11_R1.java +++ /dev/null @@ -1,12 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_11_R1.utils; - -import java.util.function.Function; - -import net.minecraft.server.v1_11_R1.World; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_11_R1.entity.ArmorStand1_11_R1; - -public abstract class EntityConstructors1_11_R1 { - - public static final Function ARMOR_STAND = (world -> new ArmorStand1_11_R1(world)); - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/wrapper/ConsoleReaderWrapper1_11_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/wrapper/ConsoleReaderWrapper1_11_R1.java deleted file mode 100644 index b231cc9..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/wrapper/ConsoleReaderWrapper1_11_R1.java +++ /dev/null @@ -1,43 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_11_R1.wrapper; - -import java.io.IOException; -import java.io.Writer; - -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_11_R1.CraftServer; -import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; - -import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; - -public final class ConsoleReaderWrapper1_11_R1 extends ConsoleReaderWrapper { - - public static final ConsoleReaderWrapper1_11_R1 INSTANCE = new ConsoleReaderWrapper1_11_R1(); - - private final ConsoleReader reader; - - @SuppressWarnings("resource") - private ConsoleReaderWrapper1_11_R1() { - this.reader = ((CraftServer) Bukkit.getServer()).getServer().reader; - } - - @Override - public Writer getOutput() { - return reader.getOutput(); - } - - @Override - public boolean isAnsiSupported() { - return reader.getTerminal().isAnsiSupported(); - } - - @Override - public void flush() throws IOException { - reader.flush(); - } - - @Override - public void drawLine() throws IOException { - reader.drawLine(); - } - -} diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/BukkitConversion1_12_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/BukkitConversion1_12_R1.java deleted file mode 100644 index 6da5ef7..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/BukkitConversion1_12_R1.java +++ /dev/null @@ -1,226 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_12_R1; - -import java.util.List; -import java.util.Set; - -import org.bukkit.craftbukkit.v1_12_R1.inventory.CraftItemStack; -import org.bukkit.entity.EntityType; - -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.nbt.NbtByte; -import com.syntaxphoenix.syntaxapi.nbt.NbtByteArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; -import com.syntaxphoenix.syntaxapi.nbt.NbtDouble; -import com.syntaxphoenix.syntaxapi.nbt.NbtEnd; -import com.syntaxphoenix.syntaxapi.nbt.NbtFloat; -import com.syntaxphoenix.syntaxapi.nbt.NbtInt; -import com.syntaxphoenix.syntaxapi.nbt.NbtIntArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtList; -import com.syntaxphoenix.syntaxapi.nbt.NbtLong; -import com.syntaxphoenix.syntaxapi.nbt.NbtLongArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtShort; -import com.syntaxphoenix.syntaxapi.nbt.NbtString; -import com.syntaxphoenix.syntaxapi.nbt.NbtTag; -import com.syntaxphoenix.syntaxapi.nbt.NbtType; - -import net.minecraft.server.v1_12_R1.ItemStack; -import net.minecraft.server.v1_12_R1.NBTBase; -import net.minecraft.server.v1_12_R1.NBTTagByte; -import net.minecraft.server.v1_12_R1.NBTTagByteArray; -import net.minecraft.server.v1_12_R1.NBTTagCompound; -import net.minecraft.server.v1_12_R1.NBTTagDouble; -import net.minecraft.server.v1_12_R1.NBTTagEnd; -import net.minecraft.server.v1_12_R1.NBTTagFloat; -import net.minecraft.server.v1_12_R1.NBTTagInt; -import net.minecraft.server.v1_12_R1.NBTTagIntArray; -import net.minecraft.server.v1_12_R1.NBTTagList; -import net.minecraft.server.v1_12_R1.NBTTagLong; -import net.minecraft.server.v1_12_R1.NBTTagLongArray; -import net.minecraft.server.v1_12_R1.NBTTagShort; -import net.minecraft.server.v1_12_R1.NBTTagString; -import net.sourcewriters.minecraft.vcompat.reflection.BukkitConversion; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContext; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleWrapType; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; - -public class BukkitConversion1_12_R1 extends BukkitConversion { - - protected BukkitConversion1_12_R1(VersionControl1_12_R1 versionControl) { - super(versionControl); - } - - @Override - public EntityType toEntityType(NmsEntityType type) { - try { - return EntityType.valueOf(type.name()); - } catch (IllegalArgumentException ignore) { - return null; - } - } - - @Override - public NmsEntityType fromEntityType(EntityType type) { - try { - return NmsEntityType.valueOf(type.name()); - } catch (IllegalArgumentException ignore) { - return null; - } - } - - @Override - public NBTBase toMinecraftTag(NbtTag tag) { - switch (tag.getType()) { - case BYTE: - return new NBTTagByte((byte) tag.getValue()); - case SHORT: - return new NBTTagShort((short) tag.getValue()); - case INT: - return new NBTTagInt((int) tag.getValue()); - case LONG: - return new NBTTagLong((long) tag.getValue()); - case FLOAT: - return new NBTTagFloat((float) tag.getValue()); - case DOUBLE: - return new NBTTagDouble((double) tag.getValue()); - case STRING: - return new NBTTagString((String) tag.getValue()); - case BYTE_ARRAY: - return new NBTTagByteArray((byte[]) tag.getValue()); - case INT_ARRAY: - return new NBTTagIntArray((int[]) tag.getValue()); - case LONG_ARRAY: - return new NBTTagLongArray((long[]) tag.getValue()); - case LIST: - return toMinecraftList((NbtList) tag); - case COMPOUND: - return toMinecraftCompound((NbtCompound) tag); - case END: - return (NBTTagEnd) ReflectionProvider.DEFAULT.getReflect("nmsNBTTagEnd").init(); - default: - return null; - } - } - - @Override - public NbtTag fromMinecraftTag(Object raw) { - if (!(raw instanceof NBTBase)) { - return null; - } - NBTBase tag = (NBTBase) raw; - NbtType type = NbtType.getById(tag.getTypeId()); - switch (type) { - case BYTE: - return new NbtByte(((NBTTagByte) tag).g()); - case SHORT: - return new NbtShort(((NBTTagShort) tag).f()); - case INT: - return new NbtInt(((NBTTagInt) tag).e()); - case LONG: - return new NbtLong(((NBTTagLong) tag).d()); - case FLOAT: - return new NbtFloat(((NBTTagFloat) tag).i()); - case DOUBLE: - return new NbtDouble(((NBTTagDouble) tag).asDouble()); - case STRING: - return new NbtString(((NBTTagString) tag).c_()); - case BYTE_ARRAY: - return new NbtByteArray(((NBTTagByteArray) tag).c()); - case INT_ARRAY: - return new NbtIntArray(((NBTTagIntArray) tag).d()); - case LONG_ARRAY: - return new NbtLongArray( - (long[]) ReflectionProvider.DEFAULT.getReflect("nmsNBTTagLongArray").getFieldValue("value", ((NBTTagLongArray) tag).c())); - case LIST: - return fromMinecraftList(tag); - case COMPOUND: - return fromMinecraftCompound(tag); - case END: - return NbtEnd.INSTANCE; - default: - return null; - } - } - - @Override - public NBTTagList toMinecraftList(NbtList list) { - NBTTagList output = new NBTTagList(); - for (NbtTag tag : list) { - output.add(toMinecraftTag(tag)); - } - return output; - } - - @SuppressWarnings("unchecked") - @Override - public NbtList fromMinecraftList(Object raw) { - if (!(raw instanceof NBTTagList)) { - return null; - } - NBTTagList list = (NBTTagList) raw; - List content = (List) ReflectionProvider.DEFAULT.getReflect("nmsNBTTagList").getFieldValue("value", list); - NbtList output = new NbtList<>(NbtType.getById(list.getTypeId())); - for (NBTBase base : content) { - output.add(fromMinecraftTag(base)); - } - return output; - } - - @Override - public NBTTagCompound toMinecraftCompound(NbtCompound compound) { - NBTTagCompound output = new NBTTagCompound(); - if (compound.isEmpty()) { - return output; - } - Set keys = compound.getKeys(); - for (String key : keys) { - output.set(key, toMinecraftTag(compound.get(key))); - } - return output; - } - - @Override - public NbtCompound fromMinecraftCompound(Object raw) { - if (!(raw instanceof NBTTagCompound)) { - return null; - } - NBTTagCompound compound = (NBTTagCompound) raw; - NbtCompound output = new NbtCompound(); - if (compound.isEmpty()) { - return output; - } - Set keys = compound.c(); - for (String key : keys) { - output.set(key, fromMinecraftTag(compound.get(key))); - } - return output; - } - - @Override - public org.bukkit.inventory.ItemStack itemFromCompound(NbtCompound compound) { - return CraftItemStack.asBukkitCopy(new ItemStack(toMinecraftCompound(compound))); - } - - @Override - public NbtCompound itemToCompound(org.bukkit.inventory.ItemStack itemStack) { - ItemStack nmsStack = CraftItemStack.asNMSCopy(itemStack); - if (!nmsStack.hasTag()) { - nmsStack.convertStack(); - } - return fromMinecraftCompound(nmsStack.getTag()); - } - - @Override - public WrappedContext createContext(DataAdapterContext context) { - return new SimpleSyntaxContext(context); - } - - @Override - public WrapType wrap(DataType dataType) { - return new SimpleWrapType(dataType); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/EntityProvider1_12_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/EntityProvider1_12_R1.java deleted file mode 100644 index 593fc8c..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/EntityProvider1_12_R1.java +++ /dev/null @@ -1,47 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_12_R1; - -import java.util.EnumMap; -import java.util.function.Function; - -import org.bukkit.craftbukkit.v1_12_R1.CraftWorld; - -import net.minecraft.server.v1_12_R1.World; -import net.sourcewriters.minecraft.vcompat.reflection.EntityProvider; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_12_R1.utils.EntityConstructors1_12_R1; - -public class EntityProvider1_12_R1 extends EntityProvider { - - private final EnumMap> entityMap = new EnumMap<>(NmsEntityType.class); - - protected EntityProvider1_12_R1(VersionControl1_12_R1 versionControl) { - super(versionControl); - } - - @SuppressWarnings("unchecked") - private final Function searchConstructor(NmsEntityType type) { - try { - return (Function) EntityConstructors1_12_R1.class.getField(type.name()).get(null); - } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException ignore) { - return null; - } - } - - private final Function getConstructor(NmsEntityType type) { - return entityMap.computeIfAbsent(type, (key -> searchConstructor(key))); - } - - @Override - public NmsEntity createEntity(org.bukkit.World world, NmsEntityType type) { - if (!(world instanceof CraftWorld)) { - return null; - } - Function function; - if ((function = getConstructor(type)) == null) { - return null; - } - return function.apply(((CraftWorld) world).getHandle()); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/PacketHandler1_12_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/PacketHandler1_12_R1.java deleted file mode 100644 index 468b6c0..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/PacketHandler1_12_R1.java +++ /dev/null @@ -1,11 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_12_R1; - -import net.sourcewriters.minecraft.vcompat.reflection.PacketHandler; - -public class PacketHandler1_12_R1 extends PacketHandler { - - protected PacketHandler1_12_R1(VersionControl1_12_R1 versionControl) { - super(versionControl); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/PlayerProvider1_12_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/PlayerProvider1_12_R1.java deleted file mode 100644 index a12557f..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/PlayerProvider1_12_R1.java +++ /dev/null @@ -1,30 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_12_R1; - -import java.io.File; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; - -import net.sourcewriters.minecraft.vcompat.reflection.DataProvider; -import net.sourcewriters.minecraft.vcompat.reflection.PlayerProvider; -import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.DataDistributor; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_12_R1.entity.Player1_12_R1; - -public class PlayerProvider1_12_R1 extends PlayerProvider { - - private final DataDistributor distributor; - - protected PlayerProvider1_12_R1(VersionControl1_12_R1 versionControl) { - super(versionControl); - distributor = versionControl.getDataProvider().createDistributor(new File(Bukkit.getWorlds().get(0).getWorldFolder(), "playerdata"), - uuid -> "custom_" + uuid.toString(), DataProvider.DEFAULT_RANDOM); - } - - @Override - protected NmsPlayer createPlayer(Player player) { - return new Player1_12_R1(player, distributor.get(player.getUniqueId())); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/TextureProvider1_12_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/TextureProvider1_12_R1.java deleted file mode 100644 index 414681a..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/TextureProvider1_12_R1.java +++ /dev/null @@ -1,108 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_12_R1; - -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_12_R1.block.CraftBlockEntityState; -import org.bukkit.craftbukkit.v1_12_R1.block.CraftSkull; -import org.bukkit.craftbukkit.v1_12_R1.inventory.CraftItemStack; -import org.bukkit.inventory.meta.ItemMeta; -import org.bukkit.inventory.meta.SkullMeta; -import org.bukkit.material.MaterialData; - -import com.mojang.authlib.GameProfile; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; - -import net.minecraft.server.v1_12_R1.GameProfileSerializer; -import net.minecraft.server.v1_12_R1.ItemStack; -import net.minecraft.server.v1_12_R1.NBTTagCompound; -import net.minecraft.server.v1_12_R1.TileEntitySkull; -import net.sourcewriters.minecraft.vcompat.reflection.TextureProvider; - -@SuppressWarnings("deprecation") -public class TextureProvider1_12_R1 extends TextureProvider { - - private final AbstractReflect craftEntityStateRef = new Reflect(CraftBlockEntityState.class).searchField("tileEntity", "tileEntity"); - private final AbstractReflect craftItemStackRef = new Reflect(CraftItemStack.class).searchField("handle", "handle"); - private final AbstractReflect craftMetaSkullRef = new Reflect("org.bukkit.craftbukkit.v1_12_R1.inventory.CraftMetaSkull") - .searchField("serialized", "serializedProfile").searchField("profile", "profile"); - private final Material skullMaterial = Material.valueOf("SKULL"); - - protected TextureProvider1_12_R1(VersionControl1_12_R1 versionControl) { - super(versionControl); - } - - @Override - public GameProfile profileFromBlock(Block block) { - if (!(block instanceof CraftSkull)) { - return null; - } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); - return entitySkull.getGameProfile(); - } - - @Override - public GameProfile profileFromItem(org.bukkit.inventory.ItemStack itemStack) { - if (!(itemStack.getItemMeta() instanceof SkullMeta)) { - return null; - } - SkullMeta meta = (SkullMeta) itemStack.getItemMeta(); - GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue("profile", meta); - if (profile == null) { - NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue("serialized", meta); - if (compound == null) { - ItemStack stack = null; - if (itemStack instanceof CraftItemStack) { - stack = (ItemStack) craftItemStackRef.getFieldValue("handle", itemStack); - } - if (stack == null) { - stack = CraftItemStack.asNMSCopy(itemStack); - } - if (!stack.hasTag()) { - stack.convertStack(); - } - NBTTagCompound stackTag = stack.getTag(); - if (stackTag.hasKeyOfType("SkullOwner", 10)) { - compound = stackTag.getCompound("SkullOwner"); - } else if (stackTag.hasKeyOfType("SkullProfile", 10)) { - compound = stackTag.getCompound("SkullProfile"); - } - } - if (compound == null) { - return null; - } - profile = GameProfileSerializer.deserialize(compound); - } - return profile; - } - - @Override - public org.bukkit.inventory.ItemStack getItem(GameProfile profile) { - org.bukkit.inventory.ItemStack craftStack = CraftItemStack.asCraftCopy(new MaterialData(skullMaterial, (byte) 3).toItemStack(1)); - applyItem(craftStack, profile); - return craftStack; - } - - @Override - public boolean applyItem(org.bukkit.inventory.ItemStack itemStack, GameProfile profile) { - ItemMeta meta = itemStack.getItemMeta(); - if (!(meta instanceof SkullMeta)) { - return false; - } - SkullMeta skullMeta = (SkullMeta) meta; - craftMetaSkullRef.setFieldValue(meta, "profile", profile); - itemStack.setItemMeta(skullMeta); - return true; - } - - @Override - public boolean applyBlock(Block block, GameProfile profile) { - if (!(block instanceof CraftSkull)) { - return false; - } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); - entitySkull.setGameProfile(profile); - return true; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/ToolProvider1_12_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/ToolProvider1_12_R1.java deleted file mode 100644 index a504669..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/ToolProvider1_12_R1.java +++ /dev/null @@ -1,33 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_12_R1; - -import net.sourcewriters.minecraft.vcompat.reflection.ToolProvider; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_12_R1.tools.BlockTools1_12_R1; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_12_R1.tools.ServerTools1_12_R1; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_12_R1.tools.SkinTools1_12_R1; - -public class ToolProvider1_12_R1 extends ToolProvider { - - private final BlockTools1_12_R1 blockTools = new BlockTools1_12_R1(); - private final SkinTools1_12_R1 skinTools = new SkinTools1_12_R1(); - private final ServerTools1_12_R1 serverTools = new ServerTools1_12_R1(); - - protected ToolProvider1_12_R1(VersionControl1_12_R1 versionControl) { - super(versionControl); - } - - @Override - public SkinTools1_12_R1 getSkinTools() { - return skinTools; - } - - @Override - public ServerTools1_12_R1 getServerTools() { - return serverTools; - } - - @Override - public BlockTools1_12_R1 getBlockTools() { - return blockTools; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/VersionControl1_12_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/VersionControl1_12_R1.java deleted file mode 100644 index 1ddee0f..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/VersionControl1_12_R1.java +++ /dev/null @@ -1,56 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_12_R1; - -import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_12_R1.reflection.NmsReflection1_12_R1; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; - -public class VersionControl1_12_R1 extends VersionControl { - - public static VersionControl1_12_R1 INSTANCE; - - public static VersionControl1_12_R1 init() { - return INSTANCE != null ? INSTANCE : (INSTANCE = new VersionControl1_12_R1()); - } - - private final ToolProvider1_12_R1 toolProvider = new ToolProvider1_12_R1(this); - private final TextureProvider1_12_R1 textureProvider = new TextureProvider1_12_R1(this); - private final PacketHandler1_12_R1 packetHandler = new PacketHandler1_12_R1(this); - private final EntityProvider1_12_R1 entityProvider = new EntityProvider1_12_R1(this); - private final PlayerProvider1_12_R1 playerProvider = new PlayerProvider1_12_R1(this); - private final BukkitConversion1_12_R1 bukkitConversion = new BukkitConversion1_12_R1(this); - - private VersionControl1_12_R1() { - NmsReflection1_12_R1.INSTANCE.setup(ReflectionProvider.DEFAULT); - } - - @Override - public ToolProvider1_12_R1 getToolProvider() { - return toolProvider; - } - - @Override - public EntityProvider1_12_R1 getEntityProvider() { - return entityProvider; - } - - @Override - public PlayerProvider1_12_R1 getPlayerProvider() { - return playerProvider; - } - - @Override - public TextureProvider1_12_R1 getTextureProvider() { - return textureProvider; - } - - @Override - public PacketHandler1_12_R1 getPacketHandler() { - return packetHandler; - } - - @Override - public BukkitConversion1_12_R1 getBukkitConversion() { - return bukkitConversion; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/entity/ArmorStand1_12_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/entity/ArmorStand1_12_R1.java deleted file mode 100644 index 3f27990..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/entity/ArmorStand1_12_R1.java +++ /dev/null @@ -1,23 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_12_R1.entity; - -import net.minecraft.server.v1_12_R1.EntityArmorStand; -import net.minecraft.server.v1_12_R1.World; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsArmorStand; - -public class ArmorStand1_12_R1 extends EntityLiving1_12_R1 implements NmsArmorStand { - - public ArmorStand1_12_R1(World world) { - super(new EntityArmorStand(world)); - } - - @Override - public void setSmall(boolean small) { - handle.setSmall(small); - } - - @Override - public boolean isSmall() { - return handle.isSmall(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/entity/Entity1_12_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/entity/Entity1_12_R1.java deleted file mode 100644 index b0bf472..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/entity/Entity1_12_R1.java +++ /dev/null @@ -1,215 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_12_R1.entity; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.OfflinePlayer; -import org.bukkit.craftbukkit.v1_12_R1.CraftWorld; -import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer; -import org.bukkit.entity.Player; - -import net.minecraft.server.v1_12_R1.AxisAlignedBB; -import net.minecraft.server.v1_12_R1.Entity; -import net.minecraft.server.v1_12_R1.EntityTypes; -import net.minecraft.server.v1_12_R1.PacketPlayOutEntityDestroy; -import net.minecraft.server.v1_12_R1.PacketPlayOutEntityMetadata; -import net.minecraft.server.v1_12_R1.PacketPlayOutSpawnEntity; -import net.minecraft.server.v1_12_R1.PlayerConnection; -import net.minecraft.server.v1_12_R1.Vec3D; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.utils.NmsBoundingBox; - -public abstract class Entity1_12_R1 implements NmsEntity { - - protected final E handle; - - protected final List visible = Collections.synchronizedList(new ArrayList<>()); - - public Entity1_12_R1(E handle) { - this.handle = handle; - } - - @Override - public final E getHandle() { - return handle; - } - - @Override - public int getId() { - return handle.getId(); - } - - @Override - public UUID getUniqueId() { - return handle.getUniqueID(); - } - - @Override - public NmsBoundingBox getBoundingBox() { - AxisAlignedBB box = handle.getBoundingBox(); - return new NmsBoundingBox(box.a, box.b, box.c, box.d, box.e, box.f); - } - - @Override - public void setCustomName(String name) { - handle.setCustomName(name); - updateVisibility(); - } - - @Override - public String getCustomName() { - return handle.getCustomName(); - } - - @Override - public void setGravity(boolean gravity) { - handle.setNoGravity(!gravity); - } - - @Override - public boolean hasGravity() { - return !handle.isNoGravity(); - } - - @Override - public void setCustomNameVisible(boolean visible) { - handle.setCustomNameVisible(visible); - } - - @Override - public boolean isCustomNameVisible() { - return handle.getCustomNameVisible(); - } - - @Override - public void setInvisible(boolean invisible) { - handle.setInvisible(invisible); - } - - @Override - public boolean isInvisible() { - return handle.isInvisible(); - } - - @Override - public boolean isInteractable() { - return handle.isInteractable(); - } - - @Override - public boolean isCollidable() { - return handle.isCollidable(); - } - - @Override - public void setInvulnerable(boolean invulnerable) { - handle.setInvulnerable(invulnerable); - } - - @Override - public boolean isInvulnerable() { - return handle.be(); - } - - @Override - public void setLocation(Location location) { - handle.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); - if (location.getWorld() == null || handle.getWorld().getWorld() == location.getWorld()) { - updateVisibility(); - return; - } - handle.world = ((CraftWorld) location.getWorld()).getHandle(); - updateVisibility(); - } - - @Override - public Location getLocation() { - Vec3D vector = handle.d(); - return new Location(handle.getWorld().getWorld(), vector.x, vector.y, vector.z); - } - - @Override - public void updateVisibility() { - if (visible.isEmpty()) { - return; - } - Player[] players; - synchronized (visible) { - players = visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) - .toArray(Player[]::new); - } - hide(players); - show(players); - } - - @Override - public boolean isShown(Player player) { - synchronized (visible) { - return visible.contains(player.getUniqueId()); - } - } - - @Override - public void hide(Player... players) { - if (players.length == 0) { - return; - } - PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(handle.getId()); - for (Player player : players) { - if (!isShown(player)) { - continue; - } - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); - synchronized (visible) { - visible.remove(player.getUniqueId()); - } - } - } - - @Override - public void show(Player... players) { - if (players.length == 0) { - return; - } - PacketPlayOutSpawnEntity packet = new PacketPlayOutSpawnEntity(handle, EntityTypes.b.a(handle.getClass())); - PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); - PlayerConnection connection; - for (Player player : players) { - if (isShown(player)) { - continue; - } - connection = ((CraftPlayer) player).getHandle().playerConnection; - connection.sendPacket(packet); - connection.sendPacket(metadataPacket); - synchronized (visible) { - visible.add(player.getUniqueId()); - } - } - } - - @Override - public UUID[] getVisible() { - synchronized (visible) { - return visible.toArray(new UUID[0]); - } - } - - @Override - public Player[] getVisibleAsPlayer() { - synchronized (visible) { - return visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) - .toArray(Player[]::new); - } - } - - @Override - public void kill() { - hide(getVisibleAsPlayer()); - handle.die(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/entity/EntityLiving1_12_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/entity/EntityLiving1_12_R1.java deleted file mode 100644 index ce184e6..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/entity/EntityLiving1_12_R1.java +++ /dev/null @@ -1,17 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_12_R1.entity; - -import net.minecraft.server.v1_12_R1.EntityLiving; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityLiving; - -public abstract class EntityLiving1_12_R1 extends Entity1_12_R1 implements NmsEntityLiving { - - public EntityLiving1_12_R1(E handle) { - super(handle); - } - - @Override - public void setCollidable(boolean collidable) { - handle.collides = collidable; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/entity/Player1_12_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/entity/Player1_12_R1.java deleted file mode 100644 index d516e49..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/entity/Player1_12_R1.java +++ /dev/null @@ -1,295 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_12_R1.entity; - -import java.util.ArrayList; -import java.util.Collections; - -import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_12_R1.util.CraftChatMessage; -import org.bukkit.entity.Player; - -import com.mojang.authlib.GameProfile; -import com.mojang.authlib.properties.Property; -import com.mojang.authlib.properties.PropertyMap; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; - -import net.minecraft.server.v1_12_R1.EntityPlayer; -import net.minecraft.server.v1_12_R1.EnumItemSlot; -import net.minecraft.server.v1_12_R1.IChatBaseComponent; -import net.minecraft.server.v1_12_R1.MathHelper; -import net.minecraft.server.v1_12_R1.PacketPlayInClientCommand; -import net.minecraft.server.v1_12_R1.PacketPlayInClientCommand.EnumClientCommand; -import net.minecraft.server.v1_12_R1.PacketPlayOutEntityDestroy; -import net.minecraft.server.v1_12_R1.PacketPlayOutEntityEquipment; -import net.minecraft.server.v1_12_R1.PacketPlayOutEntityHeadRotation; -import net.minecraft.server.v1_12_R1.PacketPlayOutEntityMetadata; -import net.minecraft.server.v1_12_R1.PacketPlayOutEntityStatus; -import net.minecraft.server.v1_12_R1.PacketPlayOutHeldItemSlot; -import net.minecraft.server.v1_12_R1.PacketPlayOutNamedEntitySpawn; -import net.minecraft.server.v1_12_R1.PacketPlayOutPlayerInfo; -import net.minecraft.server.v1_12_R1.PacketPlayOutPlayerInfo.EnumPlayerInfoAction; -import net.minecraft.server.v1_12_R1.PacketPlayOutPlayerListHeaderFooter; -import net.minecraft.server.v1_12_R1.PacketPlayOutPosition; -import net.minecraft.server.v1_12_R1.PacketPlayOutRespawn; -import net.minecraft.server.v1_12_R1.PacketPlayOutTitle; -import net.minecraft.server.v1_12_R1.PacketPlayOutTitle.EnumTitleAction; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.PersistentContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.type.SkinDataType; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContainer; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; -import net.sourcewriters.minecraft.vcompat.utils.bukkit.Players; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.MojangProfileServer; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; -import net.sourcewriters.minecraft.vcompat.utils.thread.PostAsync; -import net.minecraft.server.v1_12_R1.PlayerConnection; -import net.minecraft.server.v1_12_R1.WorldServer; - -public class Player1_12_R1 extends EntityLiving1_12_R1 implements NmsPlayer { - - private String realName; - private Skin realSkin; - - private final WrappedContainer dataAdapter; - - public Player1_12_R1(Player player, PersistentContainer container) { - super(((CraftPlayer) player).getHandle()); - this.dataAdapter = new SimpleSyntaxContainer<>(container); - update(false); - } - - @Override - public CraftPlayer getBukkitPlayer() { - return handle.getBukkitEntity(); - } - - @Override - public WrappedContainer getDataAdapter() { - return dataAdapter; - } - - @Override - public void setSkin(Skin skin) { - if (skin == null || getSkin().equals(skin)) { - return; - } - getDataAdapter().set("skin", skin, SkinDataType.WRAPPED_INSTANCE); - } - - @Override - public Skin getSkin() { - return dataAdapter.getOrDefault("skin", SkinDataType.WRAPPED_INSTANCE, realSkin); - } - - @Override - public Skin getRealSkin() { - return realSkin; - } - - @Override - public void setName(String name) { - if (getName().equals(name)) { - return; - } - if (name == null) { - getDataAdapter().remove("name"); - return; - } - getDataAdapter().set("name", name, WrapType.STRING); - } - - @Override - public String getName() { - return getDataAdapter().getOrDefault("name", WrapType.STRING, realName); - } - - @Override - public String getRealName() { - return realName; - } - - @Override - public void setPlayerListHeader(String text) { - setPlayerListHeaderAndFooter(text, getPlayerListFooter()); - } - - @Override - public String getPlayerListHeader() { - return getDataAdapter().getOrDefault("header", WrapType.STRING, ""); - } - - @Override - public void setPlayerListFooter(String text) { - setPlayerListHeaderAndFooter(getPlayerListHeader(), text); - } - - @Override - public String getPlayerListFooter() { - return getDataAdapter().getOrDefault("footer", WrapType.STRING, ""); - } - - @Override - public int getPing() { - return handle.ping; - } - - @Override - public void setPlayerListHeaderAndFooter(String header, String footer) { - getDataAdapter().set("header", header, WrapType.STRING); - getDataAdapter().set("footer", footer, WrapType.STRING); - sendPlayerListInfo(header, footer); - } - - private final void sendPlayerListInfo(String header, String footer) { - if (handle.playerConnection.isDisconnected()) { - return; - } - - IChatBaseComponent headerComponent = header.isEmpty() ? null : CraftChatMessage.fromString(header, true)[0]; - IChatBaseComponent footerComponent = footer.isEmpty() ? null : CraftChatMessage.fromString(footer, true)[0]; - - PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter(); - - Reflect reflect = ReflectionProvider.DEFAULT.getReflect("nmsPacketPlayOutPlayerListHeaderFooter"); - reflect.setFieldValue(packet, "header", headerComponent); - reflect.setFieldValue(packet, "footer", footerComponent); - - handle.playerConnection.sendPacket(packet); - } - - @Override - public void setTitleTimes(int fadeIn, int stay, int fadeOut) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TIMES, null, fadeIn, stay, fadeOut)); - } - - @Override - public void sendSubtitle(String text) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.SUBTITLE, CraftChatMessage.fromString(text)[0])); - } - - @Override - public void sendTitle(String text) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TITLE, CraftChatMessage.fromString(text)[0])); - } - - @Override - public void sendActionBar(String text) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.ACTIONBAR, CraftChatMessage.fromString(text)[0])); - } - - @Override - public void fakeRespawn() { - if (handle.playerConnection.isDisconnected()) { - return; - } - PacketPlayOutPlayerInfo remInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER, handle); - PacketPlayOutPlayerInfo addInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.ADD_PLAYER, handle); - - PacketPlayOutEntityDestroy destroyPacket = new PacketPlayOutEntityDestroy(handle.getId()); - PacketPlayOutNamedEntitySpawn spawnPacket = new PacketPlayOutNamedEntitySpawn(handle); - PacketPlayOutEntityHeadRotation rotationPacket = new PacketPlayOutEntityHeadRotation(handle, - (byte) MathHelper.d(handle.getHeadRotation() * 256F / 360F)); - - ArrayList equipmentPackets = new ArrayList<>(); - for (EnumItemSlot slot : EnumItemSlot.values()) { - equipmentPackets.add(new PacketPlayOutEntityEquipment(handle.getId(), slot, handle.getEquipment(slot))); - } - - Player self = getBukkitPlayer(); - Player[] players = Players.getOnlineWithout(getUniqueId()); - for (Player player : players) { - if (!player.canSee(self)) { - continue; - } - PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection; - connection.sendPacket(remInfoPacket); - connection.sendPacket(addInfoPacket); - connection.sendPacket(destroyPacket); - connection.sendPacket(spawnPacket); - connection.sendPacket(rotationPacket); - for (PacketPlayOutEntityEquipment equipmentPacket : equipmentPackets) { - connection.sendPacket(equipmentPacket); - } - } - - WorldServer world = (WorldServer) handle.world; - - PacketPlayOutRespawn respawnPacket = new PacketPlayOutRespawn(handle.dimension, world.getDifficulty(), - handle.world.worldData.getType(), handle.playerInteractManager.getGameMode()); - PacketPlayOutPosition positionPacket = new PacketPlayOutPosition(handle.locX, handle.locY, handle.locZ, handle.yaw, handle.pitch, - Collections.emptySet(), 0); - PacketPlayOutHeldItemSlot itemPacket = new PacketPlayOutHeldItemSlot(handle.inventory.itemInHandIndex); - PacketPlayOutEntityStatus statusPacket = new PacketPlayOutEntityStatus(handle, (byte) 28); - PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); - - PlayerConnection connection = handle.playerConnection; - connection.sendPacket(remInfoPacket); - connection.sendPacket(addInfoPacket); - connection.sendPacket(respawnPacket); - connection.sendPacket(positionPacket); - connection.sendPacket(itemPacket); - connection.sendPacket(statusPacket); - connection.sendPacket(metadataPacket); - - handle.updateAbilities(); - handle.triggerHealthUpdate(); - handle.updateInventory(handle.defaultContainer); - if (handle.activeContainer != handle.defaultContainer) { - handle.updateInventory(handle.activeContainer); - } - self.recalculatePermissions(); - } - - @Override - public void respawn() { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayInClientCommand(EnumClientCommand.PERFORM_RESPAWN)); - } - - @Override - public void update() { - update(true); - } - - private final void update(boolean flag) { - PostAsync.forcePost(() -> { - realName = MojangProfileServer.getName(getUniqueId()); - realSkin = MojangProfileServer.getSkin(realName, getUniqueId()); - }); - if (flag) { - GameProfile profile = handle.getProfile(); - - Skin skin = getSkin(); - if (skin != null) { - PropertyMap properties = profile.getProperties(); - properties.removeAll("textures"); - properties.put("textures", new Property("textures", skin.getValue(), skin.getSignature())); - } - - String name = getName(); - if (name != null) { - ReflectionProvider.DEFAULT.getReflect("mjGameProfile").setFieldValue(profile, "name", name); - } - - if (!(name == null && skin == null)) { - fakeRespawn(); - } - } - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/reflection/NmsReflection1_12_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/reflection/NmsReflection1_12_R1.java deleted file mode 100644 index 1ef4826..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/reflection/NmsReflection1_12_R1.java +++ /dev/null @@ -1,36 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_12_R1.reflection; - -import net.minecraft.server.v1_12_R1.NBTTagEnd; -import net.minecraft.server.v1_12_R1.NBTTagList; -import net.minecraft.server.v1_12_R1.NBTTagLongArray; -import net.minecraft.server.v1_12_R1.PacketPlayOutPlayerListHeaderFooter; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.Reflections; - -public class NmsReflection1_12_R1 extends Reflections { - - public static NmsReflection1_12_R1 INSTANCE = new NmsReflection1_12_R1(); - - private NmsReflection1_12_R1() {} - - @Override - public void setup(ReflectionProvider provider) { - - // - // - // Create Reflects - // - - // - // Minecraft - - provider.createReflect("nmsPacketPlayOutPlayerListHeaderFooter", PacketPlayOutPlayerListHeaderFooter.class) - .searchField("header", "a").searchField("header", "b"); - - provider.createReflect("nmsNBTTagEnd", NBTTagEnd.class); - provider.createReflect("nmsNBTTagLongArray", NBTTagLongArray.class).searchField("value", "b"); - provider.createReflect("nmsNBTTagList", NBTTagList.class).searchField("value", "list"); - - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/tools/BlockTools1_12_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/tools/BlockTools1_12_R1.java deleted file mode 100644 index e414d4e..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/tools/BlockTools1_12_R1.java +++ /dev/null @@ -1,39 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_12_R1.tools; - -import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_12_R1.block.CraftSkull; - -import com.mojang.authlib.properties.Property; -import com.mojang.authlib.properties.PropertyMap; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; - -import net.minecraft.server.v1_12_R1.TileEntitySkull; -import net.sourcewriters.minecraft.vcompat.reflection.tools.BlockTools; -import net.sourcewriters.minecraft.vcompat.utils.constants.MinecraftConstants; - -public class BlockTools1_12_R1 extends BlockTools { - - private final AbstractReflect craftEntityStateRef = new Reflect(CraftSkull.class).searchField("tileEntity", "tileEntity"); - - @Override - public void setHeadTexture(Block block, String texture) { - if (!(block instanceof CraftSkull)) { - return; - } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); - PropertyMap map = entitySkull.getGameProfile().getProperties(); - map.removeAll("textures"); - map.put("textures", new Property("textures", MinecraftConstants.TEXTURE_SIGNATURE, texture)); - } - - @Override - public String getHeadTexture(Block block) { - if (!(block instanceof CraftSkull)) { - return null; - } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); - return entitySkull.getGameProfile().getProperties().get("textures").iterator().next().getValue(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/tools/ServerTools1_12_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/tools/ServerTools1_12_R1.java deleted file mode 100644 index 4c51a9e..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/tools/ServerTools1_12_R1.java +++ /dev/null @@ -1,26 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_12_R1.tools; - -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_12_R1.CraftServer; - -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_12_R1.wrapper.ConsoleReaderWrapper1_12_R1; -import net.sourcewriters.minecraft.vcompat.reflection.tools.ServerTools; - -public class ServerTools1_12_R1 extends ServerTools { - - @Override - public void setMotd(String text) { - ((CraftServer) Bukkit.getServer()).getServer().setMotd(text); - } - - @Override - public String getMotd() { - return ((CraftServer) Bukkit.getServer()).getServer().getMotd(); - } - - @Override - public ConsoleReaderWrapper1_12_R1 getConsole() { - return ConsoleReaderWrapper1_12_R1.INSTANCE; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/tools/SkinTools1_12_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/tools/SkinTools1_12_R1.java deleted file mode 100644 index e74b954..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/tools/SkinTools1_12_R1.java +++ /dev/null @@ -1,16 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_12_R1.tools; - -import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer; -import org.bukkit.entity.Player; - -import net.sourcewriters.minecraft.vcompat.reflection.tools.SkinTools; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; - -public class SkinTools1_12_R1 extends SkinTools { - - @Override - public Skin skinFromPlayer(Player player) { - return skinFromGameProfile(((CraftPlayer) player).getHandle().getProfile()); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/utils/EntityConstructors1_12_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/utils/EntityConstructors1_12_R1.java deleted file mode 100644 index 2039abe..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/utils/EntityConstructors1_12_R1.java +++ /dev/null @@ -1,12 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_12_R1.utils; - -import java.util.function.Function; - -import net.minecraft.server.v1_12_R1.World; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_12_R1.entity.ArmorStand1_12_R1; - -public abstract class EntityConstructors1_12_R1 { - - public static final Function ARMOR_STAND = (world -> new ArmorStand1_12_R1(world)); - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/wrapper/ConsoleReaderWrapper1_12_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/wrapper/ConsoleReaderWrapper1_12_R1.java deleted file mode 100644 index 8f2df4c..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/wrapper/ConsoleReaderWrapper1_12_R1.java +++ /dev/null @@ -1,43 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_12_R1.wrapper; - -import java.io.IOException; -import java.io.Writer; - -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_12_R1.CraftServer; -import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; - -import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; - -public final class ConsoleReaderWrapper1_12_R1 extends ConsoleReaderWrapper { - - public static final ConsoleReaderWrapper1_12_R1 INSTANCE = new ConsoleReaderWrapper1_12_R1(); - - private final ConsoleReader reader; - - @SuppressWarnings("resource") - private ConsoleReaderWrapper1_12_R1() { - this.reader = ((CraftServer) Bukkit.getServer()).getServer().reader; - } - - @Override - public Writer getOutput() { - return reader.getOutput(); - } - - @Override - public boolean isAnsiSupported() { - return reader.getTerminal().isAnsiSupported(); - } - - @Override - public void flush() throws IOException { - reader.flush(); - } - - @Override - public void drawLine() throws IOException { - reader.drawLine(); - } - -} diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/BukkitConversion1_13_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/BukkitConversion1_13_R1.java deleted file mode 100644 index c49bd09..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/BukkitConversion1_13_R1.java +++ /dev/null @@ -1,218 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_13_R1; - -import java.util.Set; - -import org.bukkit.craftbukkit.v1_13_R1.inventory.CraftItemStack; -import org.bukkit.entity.EntityType; - -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.nbt.NbtByte; -import com.syntaxphoenix.syntaxapi.nbt.NbtByteArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; -import com.syntaxphoenix.syntaxapi.nbt.NbtDouble; -import com.syntaxphoenix.syntaxapi.nbt.NbtEnd; -import com.syntaxphoenix.syntaxapi.nbt.NbtFloat; -import com.syntaxphoenix.syntaxapi.nbt.NbtInt; -import com.syntaxphoenix.syntaxapi.nbt.NbtIntArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtList; -import com.syntaxphoenix.syntaxapi.nbt.NbtLong; -import com.syntaxphoenix.syntaxapi.nbt.NbtLongArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtShort; -import com.syntaxphoenix.syntaxapi.nbt.NbtString; -import com.syntaxphoenix.syntaxapi.nbt.NbtTag; -import com.syntaxphoenix.syntaxapi.nbt.NbtType; - -import net.minecraft.server.v1_13_R1.ItemStack; -import net.minecraft.server.v1_13_R1.NBTBase; -import net.minecraft.server.v1_13_R1.NBTNumber; -import net.minecraft.server.v1_13_R1.NBTTagByte; -import net.minecraft.server.v1_13_R1.NBTTagByteArray; -import net.minecraft.server.v1_13_R1.NBTTagCompound; -import net.minecraft.server.v1_13_R1.NBTTagDouble; -import net.minecraft.server.v1_13_R1.NBTTagEnd; -import net.minecraft.server.v1_13_R1.NBTTagFloat; -import net.minecraft.server.v1_13_R1.NBTTagInt; -import net.minecraft.server.v1_13_R1.NBTTagIntArray; -import net.minecraft.server.v1_13_R1.NBTTagList; -import net.minecraft.server.v1_13_R1.NBTTagLong; -import net.minecraft.server.v1_13_R1.NBTTagLongArray; -import net.minecraft.server.v1_13_R1.NBTTagShort; -import net.minecraft.server.v1_13_R1.NBTTagString; -import net.sourcewriters.minecraft.vcompat.reflection.BukkitConversion; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContext; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleWrapType; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; - -public class BukkitConversion1_13_R1 extends BukkitConversion { - - protected BukkitConversion1_13_R1(VersionControl1_13_R1 versionControl) { - super(versionControl); - } - - @Override - public EntityType toEntityType(NmsEntityType type) { - try { - return EntityType.valueOf(type.name()); - } catch (IllegalArgumentException ignore) { - return null; - } - } - - @Override - public NmsEntityType fromEntityType(EntityType type) { - try { - return NmsEntityType.valueOf(type.name()); - } catch (IllegalArgumentException ignore) { - return null; - } - } - - @Override - public NBTBase toMinecraftTag(NbtTag tag) { - switch (tag.getType()) { - case BYTE: - return new NBTTagByte((byte) tag.getValue()); - case SHORT: - return new NBTTagShort((short) tag.getValue()); - case INT: - return new NBTTagInt((int) tag.getValue()); - case LONG: - return new NBTTagLong((long) tag.getValue()); - case FLOAT: - return new NBTTagFloat((float) tag.getValue()); - case DOUBLE: - return new NBTTagDouble((double) tag.getValue()); - case STRING: - return new NBTTagString((String) tag.getValue()); - case BYTE_ARRAY: - return new NBTTagByteArray((byte[]) tag.getValue()); - case INT_ARRAY: - return new NBTTagIntArray((int[]) tag.getValue()); - case LONG_ARRAY: - return new NBTTagLongArray((long[]) tag.getValue()); - case LIST: - return toMinecraftList((NbtList) tag); - case COMPOUND: - return toMinecraftCompound((NbtCompound) tag); - case END: - return new NBTTagEnd(); - default: - return null; - } - } - - @Override - public NbtTag fromMinecraftTag(Object raw) { - if (!(raw instanceof NBTBase)) { - return null; - } - NBTBase tag = (NBTBase) raw; - NbtType type = NbtType.getById(tag.getTypeId()); - switch (type) { - case BYTE: - return new NbtByte(((NBTNumber) tag).g()); - case SHORT: - return new NbtShort(((NBTNumber) tag).f()); - case INT: - return new NbtInt(((NBTNumber) tag).e()); - case LONG: - return new NbtLong(((NBTNumber) tag).d()); - case FLOAT: - return new NbtFloat(((NBTNumber) tag).i()); - case DOUBLE: - return new NbtDouble(((NBTNumber) tag).asDouble()); - case STRING: - return new NbtString(((NBTTagString) tag).b_()); - case BYTE_ARRAY: - return new NbtByteArray(((NBTTagByteArray) tag).c()); - case INT_ARRAY: - return new NbtIntArray(((NBTTagIntArray) tag).d()); - case LONG_ARRAY: - return new NbtLongArray(((NBTTagLongArray) tag).d()); - case LIST: - return fromMinecraftList(tag); - case COMPOUND: - return fromMinecraftCompound(tag); - case END: - return NbtEnd.INSTANCE; - default: - return null; - } - } - - @Override - public NBTTagList toMinecraftList(NbtList list) { - NBTTagList output = new NBTTagList(); - for (NbtTag tag : list) { - output.add(toMinecraftTag(tag)); - } - return output; - } - - @Override - public NbtList fromMinecraftList(Object raw) { - if (!(raw instanceof NBTTagList)) { - return null; - } - NBTTagList list = (NBTTagList) raw; - NbtList output = new NbtList<>(NbtType.getById(list.getTypeId())); - for (NBTBase base : list) { - output.add(fromMinecraftTag(base)); - } - return output; - } - - @Override - public NBTTagCompound toMinecraftCompound(NbtCompound compound) { - NBTTagCompound output = new NBTTagCompound(); - if (compound.isEmpty()) { - return output; - } - Set keys = compound.getKeys(); - for (String key : keys) { - output.set(key, toMinecraftTag(compound.get(key))); - } - return output; - } - - @Override - public NbtCompound fromMinecraftCompound(Object raw) { - if (!(raw instanceof NBTTagCompound)) { - return null; - } - NBTTagCompound compound = (NBTTagCompound) raw; - NbtCompound output = new NbtCompound(); - if (compound.isEmpty()) { - return output; - } - Set keys = compound.getKeys(); - for (String key : keys) { - output.set(key, fromMinecraftTag(compound.get(key))); - } - return output; - } - - @Override - public org.bukkit.inventory.ItemStack itemFromCompound(NbtCompound compound) { - return CraftItemStack.asBukkitCopy(ItemStack.a(toMinecraftCompound(compound))); - } - - @Override - public NbtCompound itemToCompound(org.bukkit.inventory.ItemStack itemStack) { - return fromMinecraftCompound(CraftItemStack.asNMSCopy(itemStack).getOrCreateTag()); - } - - @Override - public WrappedContext createContext(DataAdapterContext context) { - return new SimpleSyntaxContext(context); - } - - @Override - public WrapType wrap(DataType dataType) { - return new SimpleWrapType(dataType); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/EntityProvider1_13_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/EntityProvider1_13_R1.java deleted file mode 100644 index 1a8b960..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/EntityProvider1_13_R1.java +++ /dev/null @@ -1,47 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_13_R1; - -import java.util.EnumMap; -import java.util.function.Function; - -import org.bukkit.craftbukkit.v1_13_R1.CraftWorld; - -import net.minecraft.server.v1_13_R1.World; -import net.sourcewriters.minecraft.vcompat.reflection.EntityProvider; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_13_R1.utils.EntityConstructors1_13_R1; - -public class EntityProvider1_13_R1 extends EntityProvider { - - private final EnumMap> entityMap = new EnumMap<>(NmsEntityType.class); - - protected EntityProvider1_13_R1(VersionControl1_13_R1 versionControl) { - super(versionControl); - } - - @SuppressWarnings("unchecked") - private final Function searchConstructor(NmsEntityType type) { - try { - return (Function) EntityConstructors1_13_R1.class.getField(type.name()).get(null); - } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException ignore) { - return null; - } - } - - private final Function getConstructor(NmsEntityType type) { - return entityMap.computeIfAbsent(type, (key -> searchConstructor(key))); - } - - @Override - public NmsEntity createEntity(org.bukkit.World world, NmsEntityType type) { - if (!(world instanceof CraftWorld)) { - return null; - } - Function function; - if ((function = getConstructor(type)) == null) { - return null; - } - return function.apply(((CraftWorld) world).getHandle()); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/PacketHandler1_13_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/PacketHandler1_13_R1.java deleted file mode 100644 index f358a95..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/PacketHandler1_13_R1.java +++ /dev/null @@ -1,11 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_13_R1; - -import net.sourcewriters.minecraft.vcompat.reflection.PacketHandler; - -public class PacketHandler1_13_R1 extends PacketHandler { - - protected PacketHandler1_13_R1(VersionControl1_13_R1 versionControl) { - super(versionControl); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/PlayerProvider1_13_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/PlayerProvider1_13_R1.java deleted file mode 100644 index 39d6e36..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/PlayerProvider1_13_R1.java +++ /dev/null @@ -1,30 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_13_R1; - -import java.io.File; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; - -import net.sourcewriters.minecraft.vcompat.reflection.DataProvider; -import net.sourcewriters.minecraft.vcompat.reflection.PlayerProvider; -import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.DataDistributor; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_13_R1.entity.Player1_13_R1; - -public class PlayerProvider1_13_R1 extends PlayerProvider { - - private final DataDistributor distributor; - - protected PlayerProvider1_13_R1(VersionControl1_13_R1 versionControl) { - super(versionControl); - distributor = versionControl.getDataProvider().createDistributor(new File(Bukkit.getWorlds().get(0).getWorldFolder(), "playerdata"), - uuid -> "custom_" + uuid.toString(), DataProvider.DEFAULT_RANDOM); - } - - @Override - protected NmsPlayer createPlayer(Player player) { - return new Player1_13_R1(player, distributor.get(player.getUniqueId())); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/TextureProvider1_13_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/TextureProvider1_13_R1.java deleted file mode 100644 index d4c6040..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/TextureProvider1_13_R1.java +++ /dev/null @@ -1,102 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_13_R1; - -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_13_R1.block.CraftBlockEntityState; -import org.bukkit.craftbukkit.v1_13_R1.block.CraftSkull; -import org.bukkit.craftbukkit.v1_13_R1.inventory.CraftItemStack; -import org.bukkit.inventory.meta.ItemMeta; -import org.bukkit.inventory.meta.SkullMeta; - -import com.mojang.authlib.GameProfile; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; - -import net.minecraft.server.v1_13_R1.GameProfileSerializer; -import net.minecraft.server.v1_13_R1.ItemStack; -import net.minecraft.server.v1_13_R1.NBTTagCompound; -import net.minecraft.server.v1_13_R1.TileEntitySkull; -import net.sourcewriters.minecraft.vcompat.reflection.TextureProvider; - -public class TextureProvider1_13_R1 extends TextureProvider { - - private final AbstractReflect craftEntityStateRef = new Reflect(CraftBlockEntityState.class).searchField("tileEntity", "tileEntity"); - private final AbstractReflect craftItemStackRef = new Reflect(CraftItemStack.class).searchField("handle", "handle"); - private final AbstractReflect craftMetaSkullRef = new Reflect("org.bukkit.craftbukkit.v1_13_R1.inventory.CraftMetaSkull") - .searchField("serialized", "serializedProfile").searchField("profile", "profile"); - - protected TextureProvider1_13_R1(VersionControl1_13_R1 versionControl) { - super(versionControl); - } - - @Override - public GameProfile profileFromBlock(Block block) { - if (!(block instanceof CraftSkull)) { - return null; - } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); - return entitySkull.getGameProfile(); - } - - @Override - public GameProfile profileFromItem(org.bukkit.inventory.ItemStack itemStack) { - if (!(itemStack.getItemMeta() instanceof SkullMeta)) { - return null; - } - SkullMeta meta = (SkullMeta) itemStack.getItemMeta(); - GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue("profile", meta); - if (profile == null) { - NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue("serialized", meta); - if (compound == null) { - ItemStack stack = null; - if (itemStack instanceof CraftItemStack) { - stack = (ItemStack) craftItemStackRef.getFieldValue("handle", itemStack); - } - if (stack == null) { - stack = CraftItemStack.asNMSCopy(itemStack); - } - NBTTagCompound stackTag = stack.getOrCreateTag(); - if (stackTag.hasKeyOfType("SkullOwner", 10)) { - compound = stackTag.getCompound("SkullOwner"); - } else if (stackTag.hasKeyOfType("SkullProfile", 10)) { - compound = stackTag.getCompound("SkullProfile"); - } - } - if (compound == null) { - return null; - } - profile = GameProfileSerializer.deserialize(compound); - } - return profile; - } - - @Override - public org.bukkit.inventory.ItemStack getItem(GameProfile profile) { - org.bukkit.inventory.ItemStack craftStack = CraftItemStack.asCraftCopy(new org.bukkit.inventory.ItemStack(Material.PLAYER_HEAD)); - applyItem(craftStack, profile); - return craftStack; - } - - @Override - public boolean applyItem(org.bukkit.inventory.ItemStack itemStack, GameProfile profile) { - ItemMeta meta = itemStack.getItemMeta(); - if (!(meta instanceof SkullMeta)) { - return false; - } - SkullMeta skullMeta = (SkullMeta) meta; - craftMetaSkullRef.setFieldValue(meta, "profile", profile); - itemStack.setItemMeta(skullMeta); - return true; - } - - @Override - public boolean applyBlock(Block block, GameProfile profile) { - if (!(block instanceof CraftSkull)) { - return false; - } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); - entitySkull.setGameProfile(profile); - return true; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/ToolProvider1_13_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/ToolProvider1_13_R1.java deleted file mode 100644 index 84d81c7..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/ToolProvider1_13_R1.java +++ /dev/null @@ -1,33 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_13_R1; - -import net.sourcewriters.minecraft.vcompat.reflection.ToolProvider; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_13_R1.tools.BlockTools1_13_R1; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_13_R1.tools.ServerTools1_13_R1; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_13_R1.tools.SkinTools1_13_R1; - -public class ToolProvider1_13_R1 extends ToolProvider { - - private final BlockTools1_13_R1 blockTools = new BlockTools1_13_R1(); - private final SkinTools1_13_R1 skinTools = new SkinTools1_13_R1(); - private final ServerTools1_13_R1 serverTools = new ServerTools1_13_R1(); - - protected ToolProvider1_13_R1(VersionControl1_13_R1 versionControl) { - super(versionControl); - } - - @Override - public SkinTools1_13_R1 getSkinTools() { - return skinTools; - } - - @Override - public ServerTools1_13_R1 getServerTools() { - return serverTools; - } - - @Override - public BlockTools1_13_R1 getBlockTools() { - return blockTools; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/VersionControl1_13_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/VersionControl1_13_R1.java deleted file mode 100644 index 98af121..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/VersionControl1_13_R1.java +++ /dev/null @@ -1,54 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_13_R1; - -import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; - -public class VersionControl1_13_R1 extends VersionControl { - - public static VersionControl1_13_R1 INSTANCE; - - public static VersionControl1_13_R1 init() { - return INSTANCE != null ? INSTANCE : (INSTANCE = new VersionControl1_13_R1()); - } - - private final ToolProvider1_13_R1 toolProvider = new ToolProvider1_13_R1(this); - private final TextureProvider1_13_R1 textureProvider = new TextureProvider1_13_R1(this); - private final PacketHandler1_13_R1 packetHandler = new PacketHandler1_13_R1(this); - private final EntityProvider1_13_R1 entityProvider = new EntityProvider1_13_R1(this); - private final PlayerProvider1_13_R1 playerProvider = new PlayerProvider1_13_R1(this); - private final BukkitConversion1_13_R1 bukkitConversion = new BukkitConversion1_13_R1(this); - - private VersionControl1_13_R1() { - - } - - @Override - public ToolProvider1_13_R1 getToolProvider() { - return toolProvider; - } - - @Override - public EntityProvider1_13_R1 getEntityProvider() { - return entityProvider; - } - - @Override - public PlayerProvider1_13_R1 getPlayerProvider() { - return playerProvider; - } - - @Override - public TextureProvider1_13_R1 getTextureProvider() { - return textureProvider; - } - - @Override - public PacketHandler1_13_R1 getPacketHandler() { - return packetHandler; - } - - @Override - public BukkitConversion1_13_R1 getBukkitConversion() { - return bukkitConversion; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/entity/ArmorStand1_13_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/entity/ArmorStand1_13_R1.java deleted file mode 100644 index a73f3f0..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/entity/ArmorStand1_13_R1.java +++ /dev/null @@ -1,23 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_13_R1.entity; - -import net.minecraft.server.v1_13_R1.EntityArmorStand; -import net.minecraft.server.v1_13_R1.World; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsArmorStand; - -public class ArmorStand1_13_R1 extends EntityLiving1_13_R1 implements NmsArmorStand { - - public ArmorStand1_13_R1(World world) { - super(new EntityArmorStand(world)); - } - - @Override - public void setSmall(boolean small) { - handle.setSmall(small); - } - - @Override - public boolean isSmall() { - return handle.isSmall(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/entity/Entity1_13_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/entity/Entity1_13_R1.java deleted file mode 100644 index 38653c3..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/entity/Entity1_13_R1.java +++ /dev/null @@ -1,216 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_13_R1.entity; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.OfflinePlayer; -import org.bukkit.craftbukkit.v1_13_R1.CraftWorld; -import org.bukkit.craftbukkit.v1_13_R1.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_13_R1.util.CraftChatMessage; -import org.bukkit.entity.Player; - -import net.minecraft.server.v1_13_R1.AxisAlignedBB; -import net.minecraft.server.v1_13_R1.Entity; -import net.minecraft.server.v1_13_R1.EntityTypes; -import net.minecraft.server.v1_13_R1.PacketPlayOutEntityDestroy; -import net.minecraft.server.v1_13_R1.PacketPlayOutEntityMetadata; -import net.minecraft.server.v1_13_R1.PacketPlayOutSpawnEntity; -import net.minecraft.server.v1_13_R1.PlayerConnection; -import net.minecraft.server.v1_13_R1.Vec3D; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.utils.NmsBoundingBox; - -public abstract class Entity1_13_R1 implements NmsEntity { - - protected final E handle; - - protected final List visible = Collections.synchronizedList(new ArrayList<>()); - - public Entity1_13_R1(E handle) { - this.handle = handle; - } - - @Override - public final E getHandle() { - return handle; - } - - @Override - public int getId() { - return handle.getId(); - } - - @Override - public UUID getUniqueId() { - return handle.getUniqueID(); - } - - @Override - public NmsBoundingBox getBoundingBox() { - AxisAlignedBB box = handle.getBoundingBox(); - return new NmsBoundingBox(box.a, box.b, box.c, box.d, box.e, box.f); - } - - @Override - public void setCustomName(String name) { - handle.setCustomName(CraftChatMessage.fromStringOrNull(name)); - updateVisibility(); - } - - @Override - public String getCustomName() { - return CraftChatMessage.fromComponent(handle.getCustomName()); - } - - @Override - public void setGravity(boolean gravity) { - handle.setNoGravity(!gravity); - } - - @Override - public boolean hasGravity() { - return !handle.isNoGravity(); - } - - @Override - public void setCustomNameVisible(boolean visible) { - handle.setCustomNameVisible(visible); - } - - @Override - public boolean isCustomNameVisible() { - return handle.getCustomNameVisible(); - } - - @Override - public void setInvisible(boolean invisible) { - handle.setInvisible(invisible); - } - - @Override - public boolean isInvisible() { - return handle.isInvisible(); - } - - @Override - public boolean isInteractable() { - return handle.isInteractable(); - } - - @Override - public boolean isCollidable() { - return handle.isCollidable(); - } - - @Override - public void setInvulnerable(boolean invulnerable) { - handle.bl(); - } - - @Override - public boolean isInvulnerable() { - return handle.isInvulnerable(null); - } - - @Override - public void setLocation(Location location) { - handle.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); - if (location.getWorld() == null || handle.getWorld().getWorld() == location.getWorld()) { - updateVisibility(); - return; - } - handle.world = ((CraftWorld) location.getWorld()).getHandle(); - updateVisibility(); - } - - @Override - public Location getLocation() { - Vec3D vector = handle.bI(); - return new Location(handle.getWorld().getWorld(), vector.x, vector.y, vector.z); - } - - @Override - public void updateVisibility() { - if (visible.isEmpty()) { - return; - } - Player[] players; - synchronized (visible) { - players = visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) - .toArray(Player[]::new); - } - hide(players); - show(players); - } - - @Override - public boolean isShown(Player player) { - synchronized (visible) { - return visible.contains(player.getUniqueId()); - } - } - - @Override - public void hide(Player... players) { - if (players.length == 0) { - return; - } - PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(handle.getId()); - for (Player player : players) { - if (!isShown(player)) { - continue; - } - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); - synchronized (visible) { - visible.remove(player.getUniqueId()); - } - } - } - - @Override - public void show(Player... players) { - if (players.length == 0) { - return; - } - PacketPlayOutSpawnEntity packet = new PacketPlayOutSpawnEntity(handle, EntityTypes.REGISTRY.a(handle.P())); - PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); - PlayerConnection connection; - for (Player player : players) { - if (isShown(player)) { - continue; - } - connection = ((CraftPlayer) player).getHandle().playerConnection; - connection.sendPacket(packet); - connection.sendPacket(metadataPacket); - synchronized (visible) { - visible.add(player.getUniqueId()); - } - } - } - - @Override - public UUID[] getVisible() { - synchronized (visible) { - return visible.toArray(new UUID[0]); - } - } - - @Override - public Player[] getVisibleAsPlayer() { - synchronized (visible) { - return visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) - .toArray(Player[]::new); - } - } - - @Override - public void kill() { - hide(getVisibleAsPlayer()); - handle.die(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/entity/EntityLiving1_13_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/entity/EntityLiving1_13_R1.java deleted file mode 100644 index cfc8642..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/entity/EntityLiving1_13_R1.java +++ /dev/null @@ -1,17 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_13_R1.entity; - -import net.minecraft.server.v1_13_R1.EntityLiving; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityLiving; - -public abstract class EntityLiving1_13_R1 extends Entity1_13_R1 implements NmsEntityLiving { - - public EntityLiving1_13_R1(E handle) { - super(handle); - } - - @Override - public void setCollidable(boolean collidable) { - handle.collides = collidable; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/entity/Player1_13_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/entity/Player1_13_R1.java deleted file mode 100644 index 61da9be..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/entity/Player1_13_R1.java +++ /dev/null @@ -1,293 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_13_R1.entity; - -import java.util.ArrayList; -import java.util.Collections; - -import org.bukkit.craftbukkit.v1_13_R1.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_13_R1.util.CraftChatMessage; -import org.bukkit.entity.Player; - -import com.mojang.authlib.GameProfile; -import com.mojang.authlib.properties.Property; -import com.mojang.authlib.properties.PropertyMap; - -import net.minecraft.server.v1_13_R1.EntityPlayer; -import net.minecraft.server.v1_13_R1.EnumItemSlot; -import net.minecraft.server.v1_13_R1.IChatBaseComponent; -import net.minecraft.server.v1_13_R1.MathHelper; -import net.minecraft.server.v1_13_R1.PacketPlayInClientCommand; -import net.minecraft.server.v1_13_R1.PacketPlayInClientCommand.EnumClientCommand; -import net.minecraft.server.v1_13_R1.PacketPlayOutEntityDestroy; -import net.minecraft.server.v1_13_R1.PacketPlayOutEntityEquipment; -import net.minecraft.server.v1_13_R1.PacketPlayOutEntityHeadRotation; -import net.minecraft.server.v1_13_R1.PacketPlayOutEntityMetadata; -import net.minecraft.server.v1_13_R1.PacketPlayOutEntityStatus; -import net.minecraft.server.v1_13_R1.PacketPlayOutHeldItemSlot; -import net.minecraft.server.v1_13_R1.PacketPlayOutNamedEntitySpawn; -import net.minecraft.server.v1_13_R1.PacketPlayOutPlayerInfo; -import net.minecraft.server.v1_13_R1.PacketPlayOutPlayerInfo.EnumPlayerInfoAction; -import net.minecraft.server.v1_13_R1.PacketPlayOutPlayerListHeaderFooter; -import net.minecraft.server.v1_13_R1.PacketPlayOutPosition; -import net.minecraft.server.v1_13_R1.PacketPlayOutRespawn; -import net.minecraft.server.v1_13_R1.PacketPlayOutTitle; -import net.minecraft.server.v1_13_R1.PacketPlayOutTitle.EnumTitleAction; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.PersistentContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.type.SkinDataType; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContainer; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; -import net.sourcewriters.minecraft.vcompat.utils.bukkit.Players; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.MojangProfileServer; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; -import net.sourcewriters.minecraft.vcompat.utils.thread.PostAsync; -import net.minecraft.server.v1_13_R1.PlayerConnection; -import net.minecraft.server.v1_13_R1.WorldServer; - -public class Player1_13_R1 extends EntityLiving1_13_R1 implements NmsPlayer { - - private String realName; - private Skin realSkin; - - private final WrappedContainer dataAdapter; - - public Player1_13_R1(Player player, PersistentContainer container) { - super(((CraftPlayer) player).getHandle()); - this.dataAdapter = new SimpleSyntaxContainer<>(container); - update(false); - } - - @Override - public CraftPlayer getBukkitPlayer() { - return handle.getBukkitEntity(); - } - - @Override - public WrappedContainer getDataAdapter() { - return dataAdapter; - } - - @Override - public void setSkin(Skin skin) { - if (skin == null || getSkin().equals(skin)) { - return; - } - getDataAdapter().set("skin", skin, SkinDataType.WRAPPED_INSTANCE); - } - - @Override - public Skin getSkin() { - return dataAdapter.getOrDefault("skin", SkinDataType.WRAPPED_INSTANCE, realSkin); - } - - @Override - public Skin getRealSkin() { - return realSkin; - } - - @Override - public void setName(String name) { - if (getName().equals(name)) { - return; - } - if (name == null) { - getDataAdapter().remove("name"); - return; - } - getDataAdapter().set("name", name, WrapType.STRING); - } - - @Override - public String getName() { - return getDataAdapter().getOrDefault("name", WrapType.STRING, realName); - } - - @Override - public String getRealName() { - return realName; - } - - @Override - public void setPlayerListHeader(String text) { - setPlayerListHeaderAndFooter(text, getPlayerListFooter()); - } - - @Override - public String getPlayerListHeader() { - return getDataAdapter().getOrDefault("header", WrapType.STRING, ""); - } - - @Override - public void setPlayerListFooter(String text) { - setPlayerListHeaderAndFooter(getPlayerListHeader(), text); - } - - @Override - public String getPlayerListFooter() { - return getDataAdapter().getOrDefault("footer", WrapType.STRING, ""); - } - - @Override - public int getPing() { - return handle.ping; - } - - @Override - public void setPlayerListHeaderAndFooter(String header, String footer) { - getDataAdapter().set("header", header, WrapType.STRING); - getDataAdapter().set("footer", footer, WrapType.STRING); - sendPlayerListInfo(header, footer); - } - - private final void sendPlayerListInfo(String header, String footer) { - if (handle.playerConnection.isDisconnected()) { - return; - } - - IChatBaseComponent headerComponent = header.isEmpty() ? null : CraftChatMessage.fromString(header, true)[0]; - IChatBaseComponent footerComponent = footer.isEmpty() ? null : CraftChatMessage.fromString(footer, true)[0]; - - PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter(); - - packet.a = headerComponent; - packet.b = footerComponent; - - handle.playerConnection.sendPacket(packet); - } - - @Override - public void setTitleTimes(int fadeIn, int stay, int fadeOut) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TIMES, null, fadeIn, stay, fadeOut)); - } - - @Override - public void sendSubtitle(String text) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.SUBTITLE, CraftChatMessage.fromStringOrNull(text))); - } - - @Override - public void sendTitle(String text) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TITLE, CraftChatMessage.fromStringOrNull(text))); - } - - @Override - public void sendActionBar(String text) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.ACTIONBAR, CraftChatMessage.fromStringOrNull(text))); - } - - @Override - public void fakeRespawn() { - if (handle.playerConnection.isDisconnected()) { - return; - } - PacketPlayOutPlayerInfo remInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER, handle); - PacketPlayOutPlayerInfo addInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.ADD_PLAYER, handle); - - PacketPlayOutEntityDestroy destroyPacket = new PacketPlayOutEntityDestroy(handle.getId()); - PacketPlayOutNamedEntitySpawn spawnPacket = new PacketPlayOutNamedEntitySpawn(handle); - PacketPlayOutEntityHeadRotation rotationPacket = new PacketPlayOutEntityHeadRotation(handle, - (byte) MathHelper.d(handle.getHeadRotation() * 256F / 360F)); - - ArrayList equipmentPackets = new ArrayList<>(); - for (EnumItemSlot slot : EnumItemSlot.values()) { - equipmentPackets.add(new PacketPlayOutEntityEquipment(handle.getId(), slot, handle.getEquipment(slot))); - } - - Player self = getBukkitPlayer(); - Player[] players = Players.getOnlineWithout(getUniqueId()); - for (Player player : players) { - if (!player.canSee(self)) { - continue; - } - PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection; - connection.sendPacket(remInfoPacket); - connection.sendPacket(addInfoPacket); - connection.sendPacket(destroyPacket); - connection.sendPacket(spawnPacket); - connection.sendPacket(rotationPacket); - for (PacketPlayOutEntityEquipment equipmentPacket : equipmentPackets) { - connection.sendPacket(equipmentPacket); - } - } - - WorldServer world = (WorldServer) handle.world; - - PacketPlayOutRespawn respawnPacket = new PacketPlayOutRespawn(handle.dimension, world.getDifficulty(), - handle.world.worldData.getType(), handle.playerInteractManager.getGameMode()); - PacketPlayOutPosition positionPacket = new PacketPlayOutPosition(handle.locX, handle.locY, handle.locZ, handle.yaw, handle.pitch, - Collections.emptySet(), 0); - PacketPlayOutHeldItemSlot itemPacket = new PacketPlayOutHeldItemSlot(handle.inventory.itemInHandIndex); - PacketPlayOutEntityStatus statusPacket = new PacketPlayOutEntityStatus(handle, (byte) 28); - PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); - - PlayerConnection connection = handle.playerConnection; - connection.sendPacket(remInfoPacket); - connection.sendPacket(addInfoPacket); - connection.sendPacket(respawnPacket); - connection.sendPacket(positionPacket); - connection.sendPacket(itemPacket); - connection.sendPacket(statusPacket); - connection.sendPacket(metadataPacket); - - handle.updateAbilities(); - handle.triggerHealthUpdate(); - handle.updateInventory(handle.defaultContainer); - if (handle.activeContainer != handle.defaultContainer) { - handle.updateInventory(handle.activeContainer); - } - self.recalculatePermissions(); - } - - @Override - public void respawn() { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayInClientCommand(EnumClientCommand.PERFORM_RESPAWN)); - } - - @Override - public void update() { - update(true); - } - - private final void update(boolean flag) { - PostAsync.forcePost(() -> { - realName = MojangProfileServer.getName(getUniqueId()); - realSkin = MojangProfileServer.getSkin(realName, getUniqueId()); - }); - if (flag) { - GameProfile profile = handle.getProfile(); - - Skin skin = getSkin(); - if (skin != null) { - PropertyMap properties = profile.getProperties(); - properties.removeAll("textures"); - properties.put("textures", new Property("textures", skin.getValue(), skin.getSignature())); - } - - String name = getName(); - if (name != null) { - ReflectionProvider.DEFAULT.getReflect("mjGameProfile").setFieldValue(profile, "name", name); - } - - if (!(name == null && skin == null)) { - fakeRespawn(); - } - } - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/tools/BlockTools1_13_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/tools/BlockTools1_13_R1.java deleted file mode 100644 index 014419a..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/tools/BlockTools1_13_R1.java +++ /dev/null @@ -1,39 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_13_R1.tools; - -import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_13_R1.block.CraftSkull; - -import com.mojang.authlib.properties.Property; -import com.mojang.authlib.properties.PropertyMap; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; - -import net.minecraft.server.v1_13_R1.TileEntitySkull; -import net.sourcewriters.minecraft.vcompat.reflection.tools.BlockTools; -import net.sourcewriters.minecraft.vcompat.utils.constants.MinecraftConstants; - -public class BlockTools1_13_R1 extends BlockTools { - - private final AbstractReflect craftEntityStateRef = new Reflect(CraftSkull.class).searchField("tileEntity", "tileEntity"); - - @Override - public void setHeadTexture(Block block, String texture) { - if (!(block instanceof CraftSkull)) { - return; - } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); - PropertyMap map = entitySkull.getGameProfile().getProperties(); - map.removeAll("textures"); - map.put("textures", new Property("textures", MinecraftConstants.TEXTURE_SIGNATURE, texture)); - } - - @Override - public String getHeadTexture(Block block) { - if (!(block instanceof CraftSkull)) { - return null; - } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); - return entitySkull.getGameProfile().getProperties().get("textures").iterator().next().getValue(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/tools/ServerTools1_13_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/tools/ServerTools1_13_R1.java deleted file mode 100644 index 341c0ff..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/tools/ServerTools1_13_R1.java +++ /dev/null @@ -1,26 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_13_R1.tools; - -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_13_R1.CraftServer; - -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_13_R1.wrapper.ConsoleReaderWrapper1_13_R1; -import net.sourcewriters.minecraft.vcompat.reflection.tools.ServerTools; - -public class ServerTools1_13_R1 extends ServerTools { - - @Override - public void setMotd(String text) { - ((CraftServer) Bukkit.getServer()).getServer().setMotd(text); - } - - @Override - public String getMotd() { - return ((CraftServer) Bukkit.getServer()).getServer().getMotd(); - } - - @Override - public ConsoleReaderWrapper1_13_R1 getConsole() { - return ConsoleReaderWrapper1_13_R1.INSTANCE; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/tools/SkinTools1_13_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/tools/SkinTools1_13_R1.java deleted file mode 100644 index 3fdbbdd..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/tools/SkinTools1_13_R1.java +++ /dev/null @@ -1,16 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_13_R1.tools; - -import org.bukkit.craftbukkit.v1_13_R1.entity.CraftPlayer; -import org.bukkit.entity.Player; - -import net.sourcewriters.minecraft.vcompat.reflection.tools.SkinTools; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; - -public class SkinTools1_13_R1 extends SkinTools { - - @Override - public Skin skinFromPlayer(Player player) { - return skinFromGameProfile(((CraftPlayer) player).getHandle().getProfile()); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/utils/EntityConstructors1_13_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/utils/EntityConstructors1_13_R1.java deleted file mode 100644 index 4fa54ec..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/utils/EntityConstructors1_13_R1.java +++ /dev/null @@ -1,12 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_13_R1.utils; - -import java.util.function.Function; - -import net.minecraft.server.v1_13_R1.World; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_13_R1.entity.ArmorStand1_13_R1; - -public abstract class EntityConstructors1_13_R1 { - - public static final Function ARMOR_STAND = (world -> new ArmorStand1_13_R1(world)); - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/wrapper/ConsoleReaderWrapper1_13_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/wrapper/ConsoleReaderWrapper1_13_R1.java deleted file mode 100644 index b61bbf2..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/wrapper/ConsoleReaderWrapper1_13_R1.java +++ /dev/null @@ -1,43 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_13_R1.wrapper; - -import java.io.IOException; -import java.io.Writer; - -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_13_R1.CraftServer; -import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; - -import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; - -public final class ConsoleReaderWrapper1_13_R1 extends ConsoleReaderWrapper { - - public static final ConsoleReaderWrapper1_13_R1 INSTANCE = new ConsoleReaderWrapper1_13_R1(); - - private final ConsoleReader reader; - - @SuppressWarnings("resource") - private ConsoleReaderWrapper1_13_R1() { - this.reader = ((CraftServer) Bukkit.getServer()).getServer().reader; - } - - @Override - public Writer getOutput() { - return reader.getOutput(); - } - - @Override - public boolean isAnsiSupported() { - return reader.getTerminal().isAnsiSupported(); - } - - @Override - public void flush() throws IOException { - reader.flush(); - } - - @Override - public void drawLine() throws IOException { - reader.drawLine(); - } - -} diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/BukkitConversion1_13_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/BukkitConversion1_13_R2.java deleted file mode 100644 index 54dec63..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/BukkitConversion1_13_R2.java +++ /dev/null @@ -1,218 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_13_R2; - -import java.util.Set; - -import org.bukkit.craftbukkit.v1_13_R2.inventory.CraftItemStack; -import org.bukkit.entity.EntityType; - -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.nbt.NbtByte; -import com.syntaxphoenix.syntaxapi.nbt.NbtByteArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; -import com.syntaxphoenix.syntaxapi.nbt.NbtDouble; -import com.syntaxphoenix.syntaxapi.nbt.NbtEnd; -import com.syntaxphoenix.syntaxapi.nbt.NbtFloat; -import com.syntaxphoenix.syntaxapi.nbt.NbtInt; -import com.syntaxphoenix.syntaxapi.nbt.NbtIntArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtList; -import com.syntaxphoenix.syntaxapi.nbt.NbtLong; -import com.syntaxphoenix.syntaxapi.nbt.NbtLongArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtShort; -import com.syntaxphoenix.syntaxapi.nbt.NbtString; -import com.syntaxphoenix.syntaxapi.nbt.NbtTag; -import com.syntaxphoenix.syntaxapi.nbt.NbtType; - -import net.minecraft.server.v1_13_R2.ItemStack; -import net.minecraft.server.v1_13_R2.NBTBase; -import net.minecraft.server.v1_13_R2.NBTNumber; -import net.minecraft.server.v1_13_R2.NBTTagByte; -import net.minecraft.server.v1_13_R2.NBTTagByteArray; -import net.minecraft.server.v1_13_R2.NBTTagCompound; -import net.minecraft.server.v1_13_R2.NBTTagDouble; -import net.minecraft.server.v1_13_R2.NBTTagEnd; -import net.minecraft.server.v1_13_R2.NBTTagFloat; -import net.minecraft.server.v1_13_R2.NBTTagInt; -import net.minecraft.server.v1_13_R2.NBTTagIntArray; -import net.minecraft.server.v1_13_R2.NBTTagList; -import net.minecraft.server.v1_13_R2.NBTTagLong; -import net.minecraft.server.v1_13_R2.NBTTagLongArray; -import net.minecraft.server.v1_13_R2.NBTTagShort; -import net.minecraft.server.v1_13_R2.NBTTagString; -import net.sourcewriters.minecraft.vcompat.reflection.BukkitConversion; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContext; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleWrapType; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; - -public class BukkitConversion1_13_R2 extends BukkitConversion { - - protected BukkitConversion1_13_R2(VersionControl1_13_R2 versionControl) { - super(versionControl); - } - - @Override - public EntityType toEntityType(NmsEntityType type) { - try { - return EntityType.valueOf(type.name()); - } catch (IllegalArgumentException ignore) { - return null; - } - } - - @Override - public NmsEntityType fromEntityType(EntityType type) { - try { - return NmsEntityType.valueOf(type.name()); - } catch (IllegalArgumentException ignore) { - return null; - } - } - - @Override - public NBTBase toMinecraftTag(NbtTag tag) { - switch (tag.getType()) { - case BYTE: - return new NBTTagByte((byte) tag.getValue()); - case SHORT: - return new NBTTagShort((short) tag.getValue()); - case INT: - return new NBTTagInt((int) tag.getValue()); - case LONG: - return new NBTTagLong((long) tag.getValue()); - case FLOAT: - return new NBTTagFloat((float) tag.getValue()); - case DOUBLE: - return new NBTTagDouble((double) tag.getValue()); - case STRING: - return new NBTTagString((String) tag.getValue()); - case BYTE_ARRAY: - return new NBTTagByteArray((byte[]) tag.getValue()); - case INT_ARRAY: - return new NBTTagIntArray((int[]) tag.getValue()); - case LONG_ARRAY: - return new NBTTagLongArray((long[]) tag.getValue()); - case LIST: - return toMinecraftList((NbtList) tag); - case COMPOUND: - return toMinecraftCompound((NbtCompound) tag); - case END: - return new NBTTagEnd(); - default: - return null; - } - } - - @Override - public NbtTag fromMinecraftTag(Object raw) { - if (!(raw instanceof NBTBase)) { - return null; - } - NBTBase tag = (NBTBase) raw; - NbtType type = NbtType.getById(tag.getTypeId()); - switch (type) { - case BYTE: - return new NbtByte(((NBTNumber) tag).asByte()); - case SHORT: - return new NbtShort(((NBTNumber) tag).asShort()); - case INT: - return new NbtInt(((NBTNumber) tag).asInt()); - case LONG: - return new NbtLong(((NBTNumber) tag).asLong()); - case FLOAT: - return new NbtFloat(((NBTNumber) tag).asFloat()); - case DOUBLE: - return new NbtDouble(((NBTNumber) tag).asDouble()); - case STRING: - return new NbtString(((NBTTagString) tag).asString()); - case BYTE_ARRAY: - return new NbtByteArray(((NBTTagByteArray) tag).c()); - case INT_ARRAY: - return new NbtIntArray(((NBTTagIntArray) tag).d()); - case LONG_ARRAY: - return new NbtLongArray(((NBTTagLongArray) tag).d()); - case LIST: - return fromMinecraftList(tag); - case COMPOUND: - return fromMinecraftCompound(tag); - case END: - return NbtEnd.INSTANCE; - default: - return null; - } - } - - @Override - public NBTTagList toMinecraftList(NbtList list) { - NBTTagList output = new NBTTagList(); - for (NbtTag tag : list) { - output.add(toMinecraftTag(tag)); - } - return output; - } - - @Override - public NbtList fromMinecraftList(Object raw) { - if (!(raw instanceof NBTTagList)) { - return null; - } - NBTTagList list = (NBTTagList) raw; - NbtList output = new NbtList<>(NbtType.getById(list.getTypeId())); - for (NBTBase base : list) { - output.add(fromMinecraftTag(base)); - } - return output; - } - - @Override - public NBTTagCompound toMinecraftCompound(NbtCompound compound) { - NBTTagCompound output = new NBTTagCompound(); - if (compound.isEmpty()) { - return output; - } - Set keys = compound.getKeys(); - for (String key : keys) { - output.set(key, toMinecraftTag(compound.get(key))); - } - return output; - } - - @Override - public NbtCompound fromMinecraftCompound(Object raw) { - if (!(raw instanceof NBTTagCompound)) { - return null; - } - NBTTagCompound compound = (NBTTagCompound) raw; - NbtCompound output = new NbtCompound(); - if (compound.isEmpty()) { - return output; - } - Set keys = compound.getKeys(); - for (String key : keys) { - output.set(key, fromMinecraftTag(compound.get(key))); - } - return output; - } - - @Override - public org.bukkit.inventory.ItemStack itemFromCompound(NbtCompound compound) { - return CraftItemStack.asBukkitCopy(ItemStack.a(toMinecraftCompound(compound))); - } - - @Override - public NbtCompound itemToCompound(org.bukkit.inventory.ItemStack itemStack) { - return fromMinecraftCompound(CraftItemStack.asNMSCopy(itemStack).getOrCreateTag()); - } - - @Override - public WrappedContext createContext(DataAdapterContext context) { - return new SimpleSyntaxContext(context); - } - - @Override - public WrapType wrap(DataType dataType) { - return new SimpleWrapType(dataType); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/EntityProvider1_13_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/EntityProvider1_13_R2.java deleted file mode 100644 index 2fc7d5f..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/EntityProvider1_13_R2.java +++ /dev/null @@ -1,47 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_13_R2; - -import java.util.EnumMap; -import java.util.function.Function; - -import org.bukkit.craftbukkit.v1_13_R2.CraftWorld; - -import net.minecraft.server.v1_13_R2.World; -import net.sourcewriters.minecraft.vcompat.reflection.EntityProvider; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_13_R2.utils.EntityConstructors1_13_R2; - -public class EntityProvider1_13_R2 extends EntityProvider { - - private final EnumMap> entityMap = new EnumMap<>(NmsEntityType.class); - - protected EntityProvider1_13_R2(VersionControl1_13_R2 versionControl) { - super(versionControl); - } - - @SuppressWarnings("unchecked") - private final Function searchConstructor(NmsEntityType type) { - try { - return (Function) EntityConstructors1_13_R2.class.getField(type.name()).get(null); - } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException ignore) { - return null; - } - } - - private final Function getConstructor(NmsEntityType type) { - return entityMap.computeIfAbsent(type, (key -> searchConstructor(key))); - } - - @Override - public NmsEntity createEntity(org.bukkit.World world, NmsEntityType type) { - if (!(world instanceof CraftWorld)) { - return null; - } - Function function; - if ((function = getConstructor(type)) == null) { - return null; - } - return function.apply(((CraftWorld) world).getHandle()); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/PacketHandler1_13_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/PacketHandler1_13_R2.java deleted file mode 100644 index bcd46dc..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/PacketHandler1_13_R2.java +++ /dev/null @@ -1,11 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_13_R2; - -import net.sourcewriters.minecraft.vcompat.reflection.PacketHandler; - -public class PacketHandler1_13_R2 extends PacketHandler { - - protected PacketHandler1_13_R2(VersionControl1_13_R2 versionControl) { - super(versionControl); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/PlayerProvider1_13_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/PlayerProvider1_13_R2.java deleted file mode 100644 index 1b5294e..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/PlayerProvider1_13_R2.java +++ /dev/null @@ -1,30 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_13_R2; - -import java.io.File; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; - -import net.sourcewriters.minecraft.vcompat.reflection.DataProvider; -import net.sourcewriters.minecraft.vcompat.reflection.PlayerProvider; -import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.DataDistributor; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_13_R2.entity.Player1_13_R2; - -public class PlayerProvider1_13_R2 extends PlayerProvider { - - private final DataDistributor distributor; - - protected PlayerProvider1_13_R2(VersionControl1_13_R2 versionControl) { - super(versionControl); - distributor = versionControl.getDataProvider().createDistributor(new File(Bukkit.getWorlds().get(0).getWorldFolder(), "playerdata"), - uuid -> "custom_" + uuid.toString(), DataProvider.DEFAULT_RANDOM); - } - - @Override - protected NmsPlayer createPlayer(Player player) { - return new Player1_13_R2(player, distributor.get(player.getUniqueId())); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/TextureProvider1_13_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/TextureProvider1_13_R2.java deleted file mode 100644 index 9517867..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/TextureProvider1_13_R2.java +++ /dev/null @@ -1,102 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_13_R2; - -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_13_R2.block.CraftBlockEntityState; -import org.bukkit.craftbukkit.v1_13_R2.block.CraftSkull; -import org.bukkit.craftbukkit.v1_13_R2.inventory.CraftItemStack; -import org.bukkit.inventory.meta.ItemMeta; -import org.bukkit.inventory.meta.SkullMeta; - -import com.mojang.authlib.GameProfile; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; - -import net.minecraft.server.v1_13_R2.GameProfileSerializer; -import net.minecraft.server.v1_13_R2.ItemStack; -import net.minecraft.server.v1_13_R2.NBTTagCompound; -import net.minecraft.server.v1_13_R2.TileEntitySkull; -import net.sourcewriters.minecraft.vcompat.reflection.TextureProvider; - -public class TextureProvider1_13_R2 extends TextureProvider { - - private final AbstractReflect craftEntityStateRef = new Reflect(CraftBlockEntityState.class).searchField("tileEntity", "tileEntity"); - private final AbstractReflect craftItemStackRef = new Reflect(CraftItemStack.class).searchField("handle", "handle"); - private final AbstractReflect craftMetaSkullRef = new Reflect("org.bukkit.craftbukkit.v1_13_R2.inventory.CraftMetaSkull") - .searchField("serialized", "serializedProfile").searchField("profile", "profile"); - - protected TextureProvider1_13_R2(VersionControl1_13_R2 versionControl) { - super(versionControl); - } - - @Override - public GameProfile profileFromBlock(Block block) { - if (!(block instanceof CraftSkull)) { - return null; - } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); - return entitySkull.getGameProfile(); - } - - @Override - public GameProfile profileFromItem(org.bukkit.inventory.ItemStack itemStack) { - if (!(itemStack.getItemMeta() instanceof SkullMeta)) { - return null; - } - SkullMeta meta = (SkullMeta) itemStack.getItemMeta(); - GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue("profile", meta); - if (profile == null) { - NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue("serialized", meta); - if (compound == null) { - ItemStack stack = null; - if (itemStack instanceof CraftItemStack) { - stack = (ItemStack) craftItemStackRef.getFieldValue("handle", itemStack); - } - if (stack == null) { - stack = CraftItemStack.asNMSCopy(itemStack); - } - NBTTagCompound stackTag = stack.getOrCreateTag(); - if (stackTag.hasKeyOfType("SkullOwner", 10)) { - compound = stackTag.getCompound("SkullOwner"); - } else if (stackTag.hasKeyOfType("SkullProfile", 10)) { - compound = stackTag.getCompound("SkullProfile"); - } - } - if (compound == null) { - return null; - } - profile = GameProfileSerializer.deserialize(compound); - } - return profile; - } - - @Override - public org.bukkit.inventory.ItemStack getItem(GameProfile profile) { - org.bukkit.inventory.ItemStack craftStack = CraftItemStack.asCraftCopy(new org.bukkit.inventory.ItemStack(Material.PLAYER_HEAD)); - applyItem(craftStack, profile); - return craftStack; - } - - @Override - public boolean applyItem(org.bukkit.inventory.ItemStack itemStack, GameProfile profile) { - ItemMeta meta = itemStack.getItemMeta(); - if (!(meta instanceof SkullMeta)) { - return false; - } - SkullMeta skullMeta = (SkullMeta) meta; - craftMetaSkullRef.setFieldValue(meta, "profile", profile); - itemStack.setItemMeta(skullMeta); - return true; - } - - @Override - public boolean applyBlock(Block block, GameProfile profile) { - if (!(block instanceof CraftSkull)) { - return false; - } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); - entitySkull.setGameProfile(profile); - return true; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/ToolProvider1_13_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/ToolProvider1_13_R2.java deleted file mode 100644 index 8dff8a0..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/ToolProvider1_13_R2.java +++ /dev/null @@ -1,33 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_13_R2; - -import net.sourcewriters.minecraft.vcompat.reflection.ToolProvider; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_13_R2.tools.BlockTools1_13_R2; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_13_R2.tools.ServerTools1_13_R2; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_13_R2.tools.SkinTools1_13_R2; - -public class ToolProvider1_13_R2 extends ToolProvider { - - private final BlockTools1_13_R2 blockTools = new BlockTools1_13_R2(); - private final SkinTools1_13_R2 skinTools = new SkinTools1_13_R2(); - private final ServerTools1_13_R2 serverTools = new ServerTools1_13_R2(); - - protected ToolProvider1_13_R2(VersionControl1_13_R2 versionControl) { - super(versionControl); - } - - @Override - public SkinTools1_13_R2 getSkinTools() { - return skinTools; - } - - @Override - public ServerTools1_13_R2 getServerTools() { - return serverTools; - } - - @Override - public BlockTools1_13_R2 getBlockTools() { - return blockTools; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/VersionControl1_13_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/VersionControl1_13_R2.java deleted file mode 100644 index 1818a0c..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/VersionControl1_13_R2.java +++ /dev/null @@ -1,54 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_13_R2; - -import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; - -public class VersionControl1_13_R2 extends VersionControl { - - public static VersionControl1_13_R2 INSTANCE; - - public static VersionControl1_13_R2 init() { - return INSTANCE != null ? INSTANCE : (INSTANCE = new VersionControl1_13_R2()); - } - - private final ToolProvider1_13_R2 toolProvider = new ToolProvider1_13_R2(this); - private final TextureProvider1_13_R2 textureProvider = new TextureProvider1_13_R2(this); - private final PacketHandler1_13_R2 packetHandler = new PacketHandler1_13_R2(this); - private final EntityProvider1_13_R2 entityProvider = new EntityProvider1_13_R2(this); - private final PlayerProvider1_13_R2 playerProvider = new PlayerProvider1_13_R2(this); - private final BukkitConversion1_13_R2 bukkitConversion = new BukkitConversion1_13_R2(this); - - private VersionControl1_13_R2() { - - } - - @Override - public ToolProvider1_13_R2 getToolProvider() { - return toolProvider; - } - - @Override - public EntityProvider1_13_R2 getEntityProvider() { - return entityProvider; - } - - @Override - public PlayerProvider1_13_R2 getPlayerProvider() { - return playerProvider; - } - - @Override - public TextureProvider1_13_R2 getTextureProvider() { - return textureProvider; - } - - @Override - public PacketHandler1_13_R2 getPacketHandler() { - return packetHandler; - } - - @Override - public BukkitConversion1_13_R2 getBukkitConversion() { - return bukkitConversion; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/entity/ArmorStand1_13_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/entity/ArmorStand1_13_R2.java deleted file mode 100644 index 7f8668c..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/entity/ArmorStand1_13_R2.java +++ /dev/null @@ -1,23 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_13_R2.entity; - -import net.minecraft.server.v1_13_R2.EntityArmorStand; -import net.minecraft.server.v1_13_R2.World; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsArmorStand; - -public class ArmorStand1_13_R2 extends EntityLiving1_13_R2 implements NmsArmorStand { - - public ArmorStand1_13_R2(World world) { - super(new EntityArmorStand(world)); - } - - @Override - public void setSmall(boolean small) { - handle.setSmall(small); - } - - @Override - public boolean isSmall() { - return handle.isSmall(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/entity/Entity1_13_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/entity/Entity1_13_R2.java deleted file mode 100644 index a839bb1..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/entity/Entity1_13_R2.java +++ /dev/null @@ -1,216 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_13_R2.entity; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.OfflinePlayer; -import org.bukkit.craftbukkit.v1_13_R2.CraftWorld; -import org.bukkit.craftbukkit.v1_13_R2.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_13_R2.util.CraftChatMessage; -import org.bukkit.entity.Player; - -import net.minecraft.server.v1_13_R2.AxisAlignedBB; -import net.minecraft.server.v1_13_R2.Entity; -import net.minecraft.server.v1_13_R2.IRegistry; -import net.minecraft.server.v1_13_R2.PacketPlayOutEntityDestroy; -import net.minecraft.server.v1_13_R2.PacketPlayOutEntityMetadata; -import net.minecraft.server.v1_13_R2.PacketPlayOutSpawnEntity; -import net.minecraft.server.v1_13_R2.PlayerConnection; -import net.minecraft.server.v1_13_R2.Vec3D; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.utils.NmsBoundingBox; - -public abstract class Entity1_13_R2 implements NmsEntity { - - protected final E handle; - - protected final List visible = Collections.synchronizedList(new ArrayList<>()); - - public Entity1_13_R2(E handle) { - this.handle = handle; - } - - @Override - public final E getHandle() { - return handle; - } - - @Override - public int getId() { - return handle.getId(); - } - - @Override - public UUID getUniqueId() { - return handle.getUniqueID(); - } - - @Override - public NmsBoundingBox getBoundingBox() { - AxisAlignedBB box = handle.getBoundingBox(); - return new NmsBoundingBox(box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ); - } - - @Override - public void setCustomName(String name) { - handle.setCustomName(CraftChatMessage.fromStringOrNull(name)); - updateVisibility(); - } - - @Override - public String getCustomName() { - return CraftChatMessage.fromComponent(handle.getCustomName()); - } - - @Override - public void setGravity(boolean gravity) { - handle.setNoGravity(!gravity); - } - - @Override - public boolean hasGravity() { - return !handle.isNoGravity(); - } - - @Override - public void setCustomNameVisible(boolean visible) { - handle.setCustomNameVisible(visible); - } - - @Override - public boolean isCustomNameVisible() { - return handle.getCustomNameVisible(); - } - - @Override - public void setInvisible(boolean invisible) { - handle.setInvisible(invisible); - } - - @Override - public boolean isInvisible() { - return handle.isInvisible(); - } - - @Override - public boolean isInteractable() { - return handle.isInteractable(); - } - - @Override - public boolean isCollidable() { - return handle.isCollidable(); - } - - @Override - public void setInvulnerable(boolean invulnerable) { - handle.setInvulnerable(invulnerable); - } - - @Override - public boolean isInvulnerable() { - return handle.bl(); - } - - @Override - public void setLocation(Location location) { - handle.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); - if (location.getWorld() == null || handle.getWorld().getWorld() == location.getWorld()) { - updateVisibility(); - return; - } - handle.world = ((CraftWorld) location.getWorld()).getHandle(); - updateVisibility(); - } - - @Override - public Location getLocation() { - Vec3D vector = handle.bI(); - return new Location(handle.getWorld().getWorld(), vector.x, vector.y, vector.z); - } - - @Override - public void updateVisibility() { - if (visible.isEmpty()) { - return; - } - Player[] players; - synchronized (visible) { - players = visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) - .toArray(Player[]::new); - } - hide(players); - show(players); - } - - @Override - public boolean isShown(Player player) { - synchronized (visible) { - return visible.contains(player.getUniqueId()); - } - } - - @Override - public void hide(Player... players) { - if (players.length == 0) { - return; - } - PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(handle.getId()); - for (Player player : players) { - if (!isShown(player)) { - continue; - } - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); - synchronized (visible) { - visible.remove(player.getUniqueId()); - } - } - } - - @Override - public void show(Player... players) { - if (players.length == 0) { - return; - } - PacketPlayOutSpawnEntity packet = new PacketPlayOutSpawnEntity(handle, IRegistry.ENTITY_TYPE.a(handle.P())); - PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); - PlayerConnection connection; - for (Player player : players) { - if (isShown(player)) { - continue; - } - connection = ((CraftPlayer) player).getHandle().playerConnection; - connection.sendPacket(packet); - connection.sendPacket(metadataPacket); - synchronized (visible) { - visible.add(player.getUniqueId()); - } - } - } - - @Override - public UUID[] getVisible() { - synchronized (visible) { - return visible.toArray(new UUID[0]); - } - } - - @Override - public Player[] getVisibleAsPlayer() { - synchronized (visible) { - return visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) - .toArray(Player[]::new); - } - } - - @Override - public void kill() { - hide(getVisibleAsPlayer()); - handle.die(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/entity/EntityLiving1_13_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/entity/EntityLiving1_13_R2.java deleted file mode 100644 index 07e7fa6..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/entity/EntityLiving1_13_R2.java +++ /dev/null @@ -1,17 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_13_R2.entity; - -import net.minecraft.server.v1_13_R2.EntityLiving; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityLiving; - -public abstract class EntityLiving1_13_R2 extends Entity1_13_R2 implements NmsEntityLiving { - - public EntityLiving1_13_R2(E handle) { - super(handle); - } - - @Override - public void setCollidable(boolean collidable) { - handle.collides = collidable; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/entity/Player1_13_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/entity/Player1_13_R2.java deleted file mode 100644 index ff6c8bd..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/entity/Player1_13_R2.java +++ /dev/null @@ -1,293 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_13_R2.entity; - -import java.util.ArrayList; -import java.util.Collections; - -import org.bukkit.craftbukkit.v1_13_R2.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_13_R2.util.CraftChatMessage; -import org.bukkit.entity.Player; - -import com.mojang.authlib.GameProfile; -import com.mojang.authlib.properties.Property; -import com.mojang.authlib.properties.PropertyMap; - -import net.minecraft.server.v1_13_R2.EntityPlayer; -import net.minecraft.server.v1_13_R2.EnumItemSlot; -import net.minecraft.server.v1_13_R2.IChatBaseComponent; -import net.minecraft.server.v1_13_R2.MathHelper; -import net.minecraft.server.v1_13_R2.PacketPlayInClientCommand; -import net.minecraft.server.v1_13_R2.PacketPlayInClientCommand.EnumClientCommand; -import net.minecraft.server.v1_13_R2.PacketPlayOutEntityDestroy; -import net.minecraft.server.v1_13_R2.PacketPlayOutEntityEquipment; -import net.minecraft.server.v1_13_R2.PacketPlayOutEntityHeadRotation; -import net.minecraft.server.v1_13_R2.PacketPlayOutEntityMetadata; -import net.minecraft.server.v1_13_R2.PacketPlayOutEntityStatus; -import net.minecraft.server.v1_13_R2.PacketPlayOutHeldItemSlot; -import net.minecraft.server.v1_13_R2.PacketPlayOutNamedEntitySpawn; -import net.minecraft.server.v1_13_R2.PacketPlayOutPlayerInfo; -import net.minecraft.server.v1_13_R2.PacketPlayOutPlayerInfo.EnumPlayerInfoAction; -import net.minecraft.server.v1_13_R2.PacketPlayOutPlayerListHeaderFooter; -import net.minecraft.server.v1_13_R2.PacketPlayOutPosition; -import net.minecraft.server.v1_13_R2.PacketPlayOutRespawn; -import net.minecraft.server.v1_13_R2.PacketPlayOutTitle; -import net.minecraft.server.v1_13_R2.PacketPlayOutTitle.EnumTitleAction; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.PersistentContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.type.SkinDataType; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContainer; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; -import net.sourcewriters.minecraft.vcompat.utils.bukkit.Players; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.MojangProfileServer; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; -import net.sourcewriters.minecraft.vcompat.utils.thread.PostAsync; -import net.minecraft.server.v1_13_R2.PlayerConnection; -import net.minecraft.server.v1_13_R2.WorldServer; - -public class Player1_13_R2 extends EntityLiving1_13_R2 implements NmsPlayer { - - private String realName; - private Skin realSkin; - - private final WrappedContainer dataAdapter; - - public Player1_13_R2(Player player, PersistentContainer container) { - super(((CraftPlayer) player).getHandle()); - this.dataAdapter = new SimpleSyntaxContainer<>(container); - update(false); - } - - @Override - public CraftPlayer getBukkitPlayer() { - return handle.getBukkitEntity(); - } - - @Override - public WrappedContainer getDataAdapter() { - return dataAdapter; - } - - @Override - public void setSkin(Skin skin) { - if (skin == null || getSkin().equals(skin)) { - return; - } - dataAdapter.set("skin", skin, SkinDataType.WRAPPED_INSTANCE); - } - - @Override - public Skin getSkin() { - return dataAdapter.getOrDefault("skin", SkinDataType.WRAPPED_INSTANCE, realSkin); - } - - @Override - public Skin getRealSkin() { - return realSkin; - } - - @Override - public void setName(String name) { - if (getName().equals(name)) { - return; - } - if (name == null) { - dataAdapter.remove("name"); - return; - } - dataAdapter.set("name", name, WrapType.STRING); - } - - @Override - public String getName() { - return dataAdapter.getOrDefault("name", WrapType.STRING, realName); - } - - @Override - public String getRealName() { - return realName; - } - - @Override - public void setPlayerListHeader(String text) { - setPlayerListHeaderAndFooter(text, getPlayerListFooter()); - } - - @Override - public String getPlayerListHeader() { - return dataAdapter.getOrDefault("header", WrapType.STRING, ""); - } - - @Override - public void setPlayerListFooter(String text) { - setPlayerListHeaderAndFooter(getPlayerListHeader(), text); - } - - @Override - public String getPlayerListFooter() { - return dataAdapter.getOrDefault("footer", WrapType.STRING, ""); - } - - @Override - public int getPing() { - return handle.ping; - } - - @Override - public void setPlayerListHeaderAndFooter(String header, String footer) { - dataAdapter.set("header", header, WrapType.STRING); - dataAdapter.set("footer", footer, WrapType.STRING); - sendPlayerListInfo(header, footer); - } - - private final void sendPlayerListInfo(String header, String footer) { - if (handle.playerConnection.isDisconnected()) { - return; - } - - IChatBaseComponent headerComponent = header.isEmpty() ? null : CraftChatMessage.fromString(header, true)[0]; - IChatBaseComponent footerComponent = footer.isEmpty() ? null : CraftChatMessage.fromString(footer, true)[0]; - - PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter(); - - packet.header = headerComponent; - packet.footer = footerComponent; - - handle.playerConnection.sendPacket(packet); - } - - @Override - public void setTitleTimes(int fadeIn, int stay, int fadeOut) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TIMES, null, fadeIn, stay, fadeOut)); - } - - @Override - public void sendSubtitle(String text) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.SUBTITLE, CraftChatMessage.fromStringOrNull(text))); - } - - @Override - public void sendTitle(String text) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TITLE, CraftChatMessage.fromStringOrNull(text))); - } - - @Override - public void sendActionBar(String text) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.ACTIONBAR, CraftChatMessage.fromStringOrNull(text))); - } - - @Override - public void fakeRespawn() { - if (handle.playerConnection.isDisconnected()) { - return; - } - PacketPlayOutPlayerInfo remInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER, handle); - PacketPlayOutPlayerInfo addInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.ADD_PLAYER, handle); - - PacketPlayOutEntityDestroy destroyPacket = new PacketPlayOutEntityDestroy(handle.getId()); - PacketPlayOutNamedEntitySpawn spawnPacket = new PacketPlayOutNamedEntitySpawn(handle); - PacketPlayOutEntityHeadRotation rotationPacket = new PacketPlayOutEntityHeadRotation(handle, - (byte) MathHelper.d(handle.getHeadRotation() * 256F / 360F)); - - ArrayList equipmentPackets = new ArrayList<>(); - for (EnumItemSlot slot : EnumItemSlot.values()) { - equipmentPackets.add(new PacketPlayOutEntityEquipment(handle.getId(), slot, handle.getEquipment(slot))); - } - - Player self = getBukkitPlayer(); - Player[] players = Players.getOnlineWithout(getUniqueId()); - for (Player player : players) { - if (!player.canSee(self)) { - continue; - } - PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection; - connection.sendPacket(remInfoPacket); - connection.sendPacket(addInfoPacket); - connection.sendPacket(destroyPacket); - connection.sendPacket(spawnPacket); - connection.sendPacket(rotationPacket); - for (PacketPlayOutEntityEquipment equipmentPacket : equipmentPackets) { - connection.sendPacket(equipmentPacket); - } - } - - WorldServer world = (WorldServer) handle.world; - - PacketPlayOutRespawn respawnPacket = new PacketPlayOutRespawn(handle.dimension, world.getDifficulty(), - handle.world.worldData.getType(), handle.playerInteractManager.getGameMode()); - PacketPlayOutPosition positionPacket = new PacketPlayOutPosition(handle.locX, handle.locY, handle.locZ, handle.yaw, handle.pitch, - Collections.emptySet(), 0); - PacketPlayOutHeldItemSlot itemPacket = new PacketPlayOutHeldItemSlot(handle.inventory.itemInHandIndex); - PacketPlayOutEntityStatus statusPacket = new PacketPlayOutEntityStatus(handle, (byte) 28); - PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); - - PlayerConnection connection = handle.playerConnection; - connection.sendPacket(remInfoPacket); - connection.sendPacket(addInfoPacket); - connection.sendPacket(respawnPacket); - connection.sendPacket(positionPacket); - connection.sendPacket(itemPacket); - connection.sendPacket(statusPacket); - connection.sendPacket(metadataPacket); - - handle.updateAbilities(); - handle.triggerHealthUpdate(); - handle.updateInventory(handle.defaultContainer); - if (handle.activeContainer != handle.defaultContainer) { - handle.updateInventory(handle.activeContainer); - } - self.recalculatePermissions(); - } - - @Override - public void respawn() { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayInClientCommand(EnumClientCommand.PERFORM_RESPAWN)); - } - - @Override - public void update() { - update(true); - } - - private final void update(boolean flag) { - PostAsync.forcePost(() -> { - realName = MojangProfileServer.getName(getUniqueId()); - realSkin = MojangProfileServer.getSkin(realName, getUniqueId()); - }); - if (flag) { - GameProfile profile = handle.getProfile(); - - Skin skin = getSkin(); - if (skin != null) { - PropertyMap properties = profile.getProperties(); - properties.removeAll("textures"); - properties.put("textures", new Property("textures", skin.getValue(), skin.getSignature())); - } - - String name = getName(); - if (name != null) { - ReflectionProvider.DEFAULT.getReflect("mjGameProfile").setFieldValue(profile, "name", name); - } - - if (!(name == null && skin == null)) { - fakeRespawn(); - } - } - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/tools/BlockTools1_13_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/tools/BlockTools1_13_R2.java deleted file mode 100644 index 1e9a714..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/tools/BlockTools1_13_R2.java +++ /dev/null @@ -1,39 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_13_R2.tools; - -import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_13_R2.block.CraftSkull; - -import com.mojang.authlib.properties.Property; -import com.mojang.authlib.properties.PropertyMap; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; - -import net.minecraft.server.v1_13_R2.TileEntitySkull; -import net.sourcewriters.minecraft.vcompat.reflection.tools.BlockTools; -import net.sourcewriters.minecraft.vcompat.utils.constants.MinecraftConstants; - -public class BlockTools1_13_R2 extends BlockTools { - - private final AbstractReflect craftEntityStateRef = new Reflect(CraftSkull.class).searchField("tileEntity", "tileEntity"); - - @Override - public void setHeadTexture(Block block, String texture) { - if (!(block instanceof CraftSkull)) { - return; - } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); - PropertyMap map = entitySkull.getGameProfile().getProperties(); - map.removeAll("textures"); - map.put("textures", new Property("textures", MinecraftConstants.TEXTURE_SIGNATURE, texture)); - } - - @Override - public String getHeadTexture(Block block) { - if (!(block instanceof CraftSkull)) { - return null; - } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); - return entitySkull.getGameProfile().getProperties().get("textures").iterator().next().getValue(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/tools/ServerTools1_13_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/tools/ServerTools1_13_R2.java deleted file mode 100644 index 509989b..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/tools/ServerTools1_13_R2.java +++ /dev/null @@ -1,26 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_13_R2.tools; - -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_13_R2.CraftServer; - -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_13_R2.wrapper.ConsoleReaderWrapper1_13_R2; -import net.sourcewriters.minecraft.vcompat.reflection.tools.ServerTools; - -public class ServerTools1_13_R2 extends ServerTools { - - @Override - public void setMotd(String text) { - ((CraftServer) Bukkit.getServer()).getServer().setMotd(text); - } - - @Override - public String getMotd() { - return ((CraftServer) Bukkit.getServer()).getServer().getMotd(); - } - - @Override - public ConsoleReaderWrapper1_13_R2 getConsole() { - return ConsoleReaderWrapper1_13_R2.INSTANCE; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/tools/SkinTools1_13_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/tools/SkinTools1_13_R2.java deleted file mode 100644 index 83c3c8e..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/tools/SkinTools1_13_R2.java +++ /dev/null @@ -1,16 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_13_R2.tools; - -import org.bukkit.craftbukkit.v1_13_R2.entity.CraftPlayer; -import org.bukkit.entity.Player; - -import net.sourcewriters.minecraft.vcompat.reflection.tools.SkinTools; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; - -public class SkinTools1_13_R2 extends SkinTools { - - @Override - public Skin skinFromPlayer(Player player) { - return skinFromGameProfile(((CraftPlayer) player).getHandle().getProfile()); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/utils/EntityConstructors1_13_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/utils/EntityConstructors1_13_R2.java deleted file mode 100644 index 8e0c2bd..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/utils/EntityConstructors1_13_R2.java +++ /dev/null @@ -1,12 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_13_R2.utils; - -import java.util.function.Function; - -import net.minecraft.server.v1_13_R2.World; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_13_R2.entity.ArmorStand1_13_R2; - -public abstract class EntityConstructors1_13_R2 { - - public static final Function ARMOR_STAND = (world -> new ArmorStand1_13_R2(world)); - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/wrapper/ConsoleReaderWrapper1_13_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/wrapper/ConsoleReaderWrapper1_13_R2.java deleted file mode 100644 index a2215ae..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/wrapper/ConsoleReaderWrapper1_13_R2.java +++ /dev/null @@ -1,43 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_13_R2.wrapper; - -import java.io.IOException; -import java.io.Writer; - -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_13_R2.CraftServer; -import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; - -import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; - -public final class ConsoleReaderWrapper1_13_R2 extends ConsoleReaderWrapper { - - public static final ConsoleReaderWrapper1_13_R2 INSTANCE = new ConsoleReaderWrapper1_13_R2(); - - private final ConsoleReader reader; - - @SuppressWarnings("resource") - private ConsoleReaderWrapper1_13_R2() { - this.reader = ((CraftServer) Bukkit.getServer()).getServer().reader; - } - - @Override - public Writer getOutput() { - return reader.getOutput(); - } - - @Override - public boolean isAnsiSupported() { - return reader.getTerminal().isAnsiSupported(); - } - - @Override - public void flush() throws IOException { - reader.flush(); - } - - @Override - public void drawLine() throws IOException { - reader.drawLine(); - } - -} diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/BukkitConversion1_14_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/BukkitConversion1_14_R1.java deleted file mode 100644 index 6108f80..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/BukkitConversion1_14_R1.java +++ /dev/null @@ -1,218 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_14_R1; - -import java.util.Set; - -import org.bukkit.craftbukkit.v1_14_R1.inventory.CraftItemStack; -import org.bukkit.entity.EntityType; - -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.nbt.NbtByte; -import com.syntaxphoenix.syntaxapi.nbt.NbtByteArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; -import com.syntaxphoenix.syntaxapi.nbt.NbtDouble; -import com.syntaxphoenix.syntaxapi.nbt.NbtEnd; -import com.syntaxphoenix.syntaxapi.nbt.NbtFloat; -import com.syntaxphoenix.syntaxapi.nbt.NbtInt; -import com.syntaxphoenix.syntaxapi.nbt.NbtIntArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtList; -import com.syntaxphoenix.syntaxapi.nbt.NbtLong; -import com.syntaxphoenix.syntaxapi.nbt.NbtLongArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtShort; -import com.syntaxphoenix.syntaxapi.nbt.NbtString; -import com.syntaxphoenix.syntaxapi.nbt.NbtTag; -import com.syntaxphoenix.syntaxapi.nbt.NbtType; - -import net.minecraft.server.v1_14_R1.ItemStack; -import net.minecraft.server.v1_14_R1.NBTBase; -import net.minecraft.server.v1_14_R1.NBTNumber; -import net.minecraft.server.v1_14_R1.NBTTagByte; -import net.minecraft.server.v1_14_R1.NBTTagByteArray; -import net.minecraft.server.v1_14_R1.NBTTagCompound; -import net.minecraft.server.v1_14_R1.NBTTagDouble; -import net.minecraft.server.v1_14_R1.NBTTagEnd; -import net.minecraft.server.v1_14_R1.NBTTagFloat; -import net.minecraft.server.v1_14_R1.NBTTagInt; -import net.minecraft.server.v1_14_R1.NBTTagIntArray; -import net.minecraft.server.v1_14_R1.NBTTagList; -import net.minecraft.server.v1_14_R1.NBTTagLong; -import net.minecraft.server.v1_14_R1.NBTTagLongArray; -import net.minecraft.server.v1_14_R1.NBTTagShort; -import net.minecraft.server.v1_14_R1.NBTTagString; -import net.sourcewriters.minecraft.vcompat.reflection.BukkitConversion; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_14_R1.data.BukkitContext1_14_R1; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_14_R1.data.BukkitType1_14_R1; - -public class BukkitConversion1_14_R1 extends BukkitConversion { - - protected BukkitConversion1_14_R1(VersionControl1_14_R1 versionControl) { - super(versionControl); - } - - @Override - public EntityType toEntityType(NmsEntityType type) { - try { - return EntityType.valueOf(type.name()); - } catch (IllegalArgumentException ignore) { - return null; - } - } - - @Override - public NmsEntityType fromEntityType(EntityType type) { - try { - return NmsEntityType.valueOf(type.name()); - } catch (IllegalArgumentException ignore) { - return null; - } - } - - @Override - public NBTBase toMinecraftTag(NbtTag tag) { - switch (tag.getType()) { - case BYTE: - return new NBTTagByte((byte) tag.getValue()); - case SHORT: - return new NBTTagShort((short) tag.getValue()); - case INT: - return new NBTTagInt((int) tag.getValue()); - case LONG: - return new NBTTagLong((long) tag.getValue()); - case FLOAT: - return new NBTTagFloat((float) tag.getValue()); - case DOUBLE: - return new NBTTagDouble((double) tag.getValue()); - case STRING: - return new NBTTagString((String) tag.getValue()); - case BYTE_ARRAY: - return new NBTTagByteArray((byte[]) tag.getValue()); - case INT_ARRAY: - return new NBTTagIntArray((int[]) tag.getValue()); - case LONG_ARRAY: - return new NBTTagLongArray((long[]) tag.getValue()); - case LIST: - return toMinecraftList((NbtList) tag); - case COMPOUND: - return toMinecraftCompound((NbtCompound) tag); - case END: - return new NBTTagEnd(); - default: - return null; - } - } - - @Override - public NbtTag fromMinecraftTag(Object raw) { - if (!(raw instanceof NBTBase)) { - return null; - } - NBTBase tag = (NBTBase) raw; - NbtType type = NbtType.getById(tag.getTypeId()); - switch (type) { - case BYTE: - return new NbtByte(((NBTNumber) tag).asByte()); - case SHORT: - return new NbtShort(((NBTNumber) tag).asShort()); - case INT: - return new NbtInt(((NBTNumber) tag).asInt()); - case LONG: - return new NbtLong(((NBTNumber) tag).asLong()); - case FLOAT: - return new NbtFloat(((NBTNumber) tag).asFloat()); - case DOUBLE: - return new NbtDouble(((NBTNumber) tag).asDouble()); - case STRING: - return new NbtString(((NBTTagString) tag).asString()); - case BYTE_ARRAY: - return new NbtByteArray(((NBTTagByteArray) tag).getBytes()); - case INT_ARRAY: - return new NbtIntArray(((NBTTagIntArray) tag).getInts()); - case LONG_ARRAY: - return new NbtLongArray(((NBTTagLongArray) tag).getLongs()); - case LIST: - return fromMinecraftList(tag); - case COMPOUND: - return fromMinecraftCompound(tag); - case END: - return NbtEnd.INSTANCE; - default: - return null; - } - } - - @Override - public NBTTagList toMinecraftList(NbtList list) { - NBTTagList output = new NBTTagList(); - for (NbtTag tag : list) { - output.add(toMinecraftTag(tag)); - } - return output; - } - - @Override - public NbtList fromMinecraftList(Object raw) { - if (!(raw instanceof NBTTagList)) { - return null; - } - NBTTagList list = (NBTTagList) raw; - NbtList output = new NbtList<>(NbtType.getById(list.getTypeId())); - for (NBTBase base : list) { - output.add(fromMinecraftTag(base)); - } - return output; - } - - @Override - public NBTTagCompound toMinecraftCompound(NbtCompound compound) { - NBTTagCompound output = new NBTTagCompound(); - if (compound.isEmpty()) { - return output; - } - Set keys = compound.getKeys(); - for (String key : keys) { - output.set(key, toMinecraftTag(compound.get(key))); - } - return output; - } - - @Override - public NbtCompound fromMinecraftCompound(Object raw) { - if (!(raw instanceof NBTTagCompound)) { - return null; - } - NBTTagCompound compound = (NBTTagCompound) raw; - NbtCompound output = new NbtCompound(); - if (compound.isEmpty()) { - return output; - } - Set keys = compound.getKeys(); - for (String key : keys) { - output.set(key, fromMinecraftTag(compound.get(key))); - } - return output; - } - - @Override - public org.bukkit.inventory.ItemStack itemFromCompound(NbtCompound compound) { - return CraftItemStack.asBukkitCopy(ItemStack.a(toMinecraftCompound(compound))); - } - - @Override - public NbtCompound itemToCompound(org.bukkit.inventory.ItemStack itemStack) { - return fromMinecraftCompound(CraftItemStack.asNMSCopy(itemStack).getOrCreateTag()); - } - - @Override - public WrappedContext createContext(DataAdapterContext context) { - return new BukkitContext1_14_R1(context); - } - - @Override - public WrapType wrap(DataType dataType) { - return new BukkitType1_14_R1<>(dataType); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/EntityProvider1_14_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/EntityProvider1_14_R1.java deleted file mode 100644 index 480d6ec..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/EntityProvider1_14_R1.java +++ /dev/null @@ -1,47 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_14_R1; - -import java.util.EnumMap; -import java.util.function.Function; - -import org.bukkit.craftbukkit.v1_14_R1.CraftWorld; - -import net.minecraft.server.v1_14_R1.World; -import net.sourcewriters.minecraft.vcompat.reflection.EntityProvider; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_14_R1.utils.EntityConstructors1_14_R1; - -public class EntityProvider1_14_R1 extends EntityProvider { - - private final EnumMap> entityMap = new EnumMap<>(NmsEntityType.class); - - protected EntityProvider1_14_R1(VersionControl1_14_R1 versionControl) { - super(versionControl); - } - - @SuppressWarnings("unchecked") - private final Function searchConstructor(NmsEntityType type) { - try { - return (Function) EntityConstructors1_14_R1.class.getField(type.name()).get(null); - } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException ignore) { - return null; - } - } - - private final Function getConstructor(NmsEntityType type) { - return entityMap.computeIfAbsent(type, (key -> searchConstructor(key))); - } - - @Override - public NmsEntity createEntity(org.bukkit.World world, NmsEntityType type) { - if (!(world instanceof CraftWorld)) { - return null; - } - Function function; - if ((function = getConstructor(type)) == null) { - return null; - } - return function.apply(((CraftWorld) world).getHandle()); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/PacketHandler1_14_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/PacketHandler1_14_R1.java deleted file mode 100644 index 3fe559a..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/PacketHandler1_14_R1.java +++ /dev/null @@ -1,11 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_14_R1; - -import net.sourcewriters.minecraft.vcompat.reflection.PacketHandler; - -public class PacketHandler1_14_R1 extends PacketHandler { - - protected PacketHandler1_14_R1(VersionControl1_14_R1 versionControl) { - super(versionControl); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/PlayerProvider1_14_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/PlayerProvider1_14_R1.java deleted file mode 100644 index 20e0ab6..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/PlayerProvider1_14_R1.java +++ /dev/null @@ -1,20 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_14_R1; - -import org.bukkit.entity.Player; - -import net.sourcewriters.minecraft.vcompat.reflection.PlayerProvider; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_14_R1.entity.Player1_14_R1; - -public class PlayerProvider1_14_R1 extends PlayerProvider { - - protected PlayerProvider1_14_R1(VersionControl1_14_R1 versionControl) { - super(versionControl); - } - - @Override - protected NmsPlayer createPlayer(Player player) { - return new Player1_14_R1(player); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/TextureProvider1_14_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/TextureProvider1_14_R1.java deleted file mode 100644 index 2a17d07..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/TextureProvider1_14_R1.java +++ /dev/null @@ -1,102 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_14_R1; - -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_14_R1.block.CraftBlockEntityState; -import org.bukkit.craftbukkit.v1_14_R1.block.CraftSkull; -import org.bukkit.craftbukkit.v1_14_R1.inventory.CraftItemStack; -import org.bukkit.inventory.meta.ItemMeta; -import org.bukkit.inventory.meta.SkullMeta; - -import com.mojang.authlib.GameProfile; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; - -import net.minecraft.server.v1_14_R1.GameProfileSerializer; -import net.minecraft.server.v1_14_R1.ItemStack; -import net.minecraft.server.v1_14_R1.NBTTagCompound; -import net.minecraft.server.v1_14_R1.TileEntitySkull; -import net.sourcewriters.minecraft.vcompat.reflection.TextureProvider; - -public class TextureProvider1_14_R1 extends TextureProvider { - - private final AbstractReflect craftEntityStateRef = new Reflect(CraftBlockEntityState.class).searchField("tileEntity", "tileEntity"); - private final AbstractReflect craftItemStackRef = new Reflect(CraftItemStack.class).searchField("handle", "handle"); - private final AbstractReflect craftMetaSkullRef = new Reflect("org.bukkit.craftbukkit.v1_14_R1.inventory.CraftMetaSkull") - .searchField("serialized", "serializedProfile").searchField("profile", "profile"); - - protected TextureProvider1_14_R1(VersionControl1_14_R1 versionControl) { - super(versionControl); - } - - @Override - public GameProfile profileFromBlock(Block block) { - if (!(block instanceof CraftSkull)) { - return null; - } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); - return entitySkull.gameProfile; - } - - @Override - public GameProfile profileFromItem(org.bukkit.inventory.ItemStack itemStack) { - if (!(itemStack.getItemMeta() instanceof SkullMeta)) { - return null; - } - SkullMeta meta = (SkullMeta) itemStack.getItemMeta(); - GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue("profile", meta); - if (profile == null) { - NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue("serialized", meta); - if (compound == null) { - ItemStack stack = null; - if (itemStack instanceof CraftItemStack) { - stack = (ItemStack) craftItemStackRef.getFieldValue("handle", itemStack); - } - if (stack == null) { - stack = CraftItemStack.asNMSCopy(itemStack); - } - NBTTagCompound stackTag = stack.getOrCreateTag(); - if (stackTag.hasKeyOfType("SkullOwner", 10)) { - compound = stackTag.getCompound("SkullOwner"); - } else if (stackTag.hasKeyOfType("SkullProfile", 10)) { - compound = stackTag.getCompound("SkullProfile"); - } - } - if (compound == null) { - return null; - } - profile = GameProfileSerializer.deserialize(compound); - } - return profile; - } - - @Override - public org.bukkit.inventory.ItemStack getItem(GameProfile profile) { - org.bukkit.inventory.ItemStack craftStack = CraftItemStack.asCraftCopy(new org.bukkit.inventory.ItemStack(Material.PLAYER_HEAD)); - applyItem(craftStack, profile); - return craftStack; - } - - @Override - public boolean applyItem(org.bukkit.inventory.ItemStack itemStack, GameProfile profile) { - ItemMeta meta = itemStack.getItemMeta(); - if (!(meta instanceof SkullMeta)) { - return false; - } - SkullMeta skullMeta = (SkullMeta) meta; - craftMetaSkullRef.setFieldValue(meta, "profile", profile); - itemStack.setItemMeta(skullMeta); - return true; - } - - @Override - public boolean applyBlock(Block block, GameProfile profile) { - if (!(block instanceof CraftSkull)) { - return false; - } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); - entitySkull.setGameProfile(profile); - return true; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/ToolProvider1_14_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/ToolProvider1_14_R1.java deleted file mode 100644 index 3e3e45a..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/ToolProvider1_14_R1.java +++ /dev/null @@ -1,33 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_14_R1; - -import net.sourcewriters.minecraft.vcompat.reflection.ToolProvider; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_14_R1.tools.BlockTools1_14_R1; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_14_R1.tools.ServerTools1_14_R1; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_14_R1.tools.SkinTools1_14_R1; - -public class ToolProvider1_14_R1 extends ToolProvider { - - private final BlockTools1_14_R1 blockTools = new BlockTools1_14_R1(); - private final SkinTools1_14_R1 skinTools = new SkinTools1_14_R1(); - private final ServerTools1_14_R1 serverTools = new ServerTools1_14_R1(); - - protected ToolProvider1_14_R1(VersionControl1_14_R1 versionControl) { - super(versionControl); - } - - @Override - public SkinTools1_14_R1 getSkinTools() { - return skinTools; - } - - @Override - public ServerTools1_14_R1 getServerTools() { - return serverTools; - } - - @Override - public BlockTools1_14_R1 getBlockTools() { - return blockTools; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/VersionControl1_14_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/VersionControl1_14_R1.java deleted file mode 100644 index a81a340..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/VersionControl1_14_R1.java +++ /dev/null @@ -1,61 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_14_R1; - -import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_14_R1.data.hook.BukkitContainerAdapterHook1_14_R1; - -public class VersionControl1_14_R1 extends VersionControl { - - public static VersionControl1_14_R1 INSTANCE; - - public static VersionControl1_14_R1 init() { - return INSTANCE != null ? INSTANCE : (INSTANCE = new VersionControl1_14_R1()); - } - - private final ToolProvider1_14_R1 toolProvider = new ToolProvider1_14_R1(this); - private final TextureProvider1_14_R1 textureProvider = new TextureProvider1_14_R1(this); - private final PacketHandler1_14_R1 packetHandler = new PacketHandler1_14_R1(this); - private final EntityProvider1_14_R1 entityProvider = new EntityProvider1_14_R1(this); - private final PlayerProvider1_14_R1 playerProvider = new PlayerProvider1_14_R1(this); - private final BukkitConversion1_14_R1 bukkitConversion = new BukkitConversion1_14_R1(this); - - private VersionControl1_14_R1() { - BukkitContainerAdapterHook1_14_R1.hookEntity(); - } - - @Override - public ToolProvider1_14_R1 getToolProvider() { - return toolProvider; - } - - @Override - public EntityProvider1_14_R1 getEntityProvider() { - return entityProvider; - } - - @Override - public PlayerProvider1_14_R1 getPlayerProvider() { - return playerProvider; - } - - @Override - public TextureProvider1_14_R1 getTextureProvider() { - return textureProvider; - } - - @Override - public PacketHandler1_14_R1 getPacketHandler() { - return packetHandler; - } - - @Override - public BukkitConversion1_14_R1 getBukkitConversion() { - return bukkitConversion; - } - - @Override - public void shutdown() { - dataProvider.getDefaultDistributor().shutdown(); - BukkitContainerAdapterHook1_14_R1.unhookAll(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/data/BukkitContainer1_14_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/data/BukkitContainer1_14_R1.java deleted file mode 100644 index 81f8993..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/data/BukkitContainer1_14_R1.java +++ /dev/null @@ -1,160 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_14_R1.data; - -import java.util.Arrays; -import java.util.Optional; -import java.util.Set; -import java.util.stream.Collectors; - -import org.bukkit.NamespacedKey; -import org.bukkit.persistence.PersistentDataAdapterContext; -import org.bukkit.persistence.PersistentDataContainer; -import org.bukkit.persistence.PersistentDataType; - -import com.syntaxphoenix.syntaxapi.data.IDataContainer; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SyntaxKey; - -public final class BukkitContainer1_14_R1 extends WrappedContainer implements PersistentDataContainer { - - private final IDataContainer container; - - public BukkitContainer1_14_R1(IDataContainer container) { - this.container = container; - } - - @Override - public IDataContainer getHandle() { - return container; - } - - @Override - public IDataContainer getAsSyntaxContainer() { - return container; - } - - /* - * - */ - - @Override - public boolean has(NamespacedKey key, PersistentDataType type) { - return has(new BukkitKey1_14_R1(key), WrappedType1_14_R1.wrap(type)); - } - - @Override - public Z get(NamespacedKey key, PersistentDataType type) { - return get(new BukkitKey1_14_R1(key), WrappedType1_14_R1.wrap(type)); - } - - @Override - public Z getOrDefault(NamespacedKey key, PersistentDataType type, Z value) { - return Optional.ofNullable(get(key, type)).orElse(value); - } - - @Override - public void set(NamespacedKey key, PersistentDataType type, Z value) { - set(new BukkitKey1_14_R1(key), value, WrappedType1_14_R1.wrap(type)); - } - - @Override - public void remove(NamespacedKey key) { - remove(new BukkitKey1_14_R1(key)); - } - - public Set getKeys() { - return Arrays.stream(container.getKeys()).map(SyntaxKey::new).map(BukkitKey1_14_R1::asBukkit).collect(Collectors.toSet()); - } - - @Override - public PersistentDataAdapterContext getAdapterContext() { - return getContext(); - } - - /* - * - */ - - @Override - public BukkitContext1_14_R1 getContext() { - return new BukkitContext1_14_R1(container.getAdapterContext()); - } - - @Override - public boolean has(String key) { - return has(wrappedKey(key)); - } - - @Override - public boolean has(WrappedKey key) { - return container.has(key.getNamespacedKey()); - } - - @Override - public boolean has(String key, WrapType type) { - return has(wrappedKey(key), type); - } - - @Override - public boolean has(WrappedKey key, WrapType type) { - return container.has(key.getNamespacedKey(), type.syntaxType()); - } - - @Override - public Object get(String key) { - return get(wrappedKey(key)); - } - - @Override - public Object get(WrappedKey key) { - return container.get(key.getNamespacedKey()); - } - - @Override - public C get(String key, WrapType type) { - return get(wrappedKey(key), type); - } - - @Override - public C get(WrappedKey key, WrapType type) { - return container.get(key.getNamespacedKey(), type.syntaxType()); - } - - @Override - public void set(String key, B value, WrapType type) { - set(wrappedKey(key), value, type); - } - - @Override - public void set(WrappedKey key, B value, WrapType type) { - container.set(key.getNamespacedKey(), value, type.syntaxType()); - } - - @Override - public boolean remove(String key) { - return false; - } - - @Override - public boolean remove(WrappedKey key) { - return container.remove(key.getNamespacedKey()); - } - - @Override - public Set keySet() { - return container.getKeyspaces(); - } - - @Override - public boolean isEmpty() { - return container.isEmpty(); - } - - @Override - public int size() { - return container.size(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/data/BukkitContext1_14_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/data/BukkitContext1_14_R1.java deleted file mode 100644 index d3bb430..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/data/BukkitContext1_14_R1.java +++ /dev/null @@ -1,39 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_14_R1.data; - -import org.bukkit.persistence.PersistentDataAdapterContext; -import org.bukkit.persistence.PersistentDataContainer; - -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.IDataContainer; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; - -public final class BukkitContext1_14_R1 extends WrappedContext implements PersistentDataAdapterContext { - - private final DataAdapterContext context; - - public BukkitContext1_14_R1(DataAdapterContext context) { - this.context = context; - } - - @Override - public DataAdapterContext getHandle() { - return context; - } - - @Override - public PersistentDataContainer newPersistentDataContainer() { - return newContainer(); - } - - @Override - public IDataContainer newDataContainer() { - return context.newDataContainer(); - } - - @Override - public BukkitContainer1_14_R1 newContainer() { - return new BukkitContainer1_14_R1(context.newDataContainer()); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/data/BukkitKey1_14_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/data/BukkitKey1_14_R1.java deleted file mode 100644 index c57165e..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/data/BukkitKey1_14_R1.java +++ /dev/null @@ -1,52 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_14_R1.data; - -import org.bukkit.NamespacedKey; -import org.bukkit.plugin.Plugin; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; - -public final class BukkitKey1_14_R1 extends WrappedKey { - - private final NamespacedKey key; - - public BukkitKey1_14_R1(Plugin plugin, String key) { - this.key = new NamespacedKey(plugin, key); - } - - @SuppressWarnings("deprecation") - public BukkitKey1_14_R1(String name, String key) { - this.key = new NamespacedKey(name, key); - } - - public BukkitKey1_14_R1(NamespacedKey key) { - this.key = key; - } - - @Override - public NamespacedKey getHandle() { - return key; - } - - @Override - public String getName() { - return key.getNamespace(); - } - - @Override - public String getKey() { - return key.getKey(); - } - - @Override - public String toString() { - return key.toString(); - } - - public static NamespacedKey asBukkit(WrappedKey key) { - if (key.getHandle() instanceof NamespacedKey) { - return (NamespacedKey) key.getHandle(); - } - return new BukkitKey1_14_R1(key.getName(), key.getKey()).getHandle(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/data/BukkitType1_14_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/data/BukkitType1_14_R1.java deleted file mode 100644 index 74e4f8c..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/data/BukkitType1_14_R1.java +++ /dev/null @@ -1,69 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_14_R1.data; - -import org.bukkit.persistence.PersistentDataAdapterContext; -import org.bukkit.persistence.PersistentDataType; - -import com.syntaxphoenix.syntaxapi.data.DataType; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; - -public class BukkitType1_14_R1 extends WrappedType1_14_R1, P0, P1, C0, C1> - implements PersistentDataType { - - private final DataType type; - - public BukkitType1_14_R1(DataType type) { - super(type.getPrimitive(), type.getComplex()); - this.type = type; - } - - @Override - public DataType getHandle() { - return type; - } - - @Override - public Class getPrimitiveOriginal() { - return type.getPrimitive(); - } - - @Override - public Class getComplexOriginal() { - return type.getComplex(); - } - - /* - * - */ - - @Override - public Class getComplexType() { - return complexType; - } - - @Override - public Class getPrimitiveType() { - return primitiveType; - } - - @Override - public P0 toPrimitive(C0 complex, PersistentDataAdapterContext context) { - return wrapToPrimitive(complex, new SyntaxContext1_14_R1(context)); - } - - @Override - public C0 fromPrimitive(P0 primitive, PersistentDataAdapterContext context) { - return wrapToComplex(primitive, new SyntaxContext1_14_R1(context)); - } - - @Override - public P0 wrapToPrimitive(C0 complex, WrappedContext context) { - return toPrimitiveWrapped(type.toPrimitive(context, toComplexOriginal(complex))); - } - - @Override - public C0 wrapToComplex(P0 primitive, WrappedContext context) { - return toComplexWrapped(type.fromPrimitive(context, toPrimitiveOriginal(primitive))); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/data/SimpleBukkitType1_14_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/data/SimpleBukkitType1_14_R1.java deleted file mode 100644 index 1f1e985..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/data/SimpleBukkitType1_14_R1.java +++ /dev/null @@ -1,36 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_14_R1.data; - -import org.bukkit.persistence.PersistentDataAdapterContext; -import org.bukkit.persistence.PersistentDataType; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; - -public class SimpleBukkitType1_14_R1 implements PersistentDataType { - - private final WrapType type; - - public SimpleBukkitType1_14_R1(WrapType type) { - this.type = type; - } - - @Override - public Class getComplexType() { - return type.getComplexWrapped(); - } - - @Override - public Class

getPrimitiveType() { - return type.getPrimitiveWrapped(); - } - - @Override - public P toPrimitive(C complex, PersistentDataAdapterContext context) { - return type.wrapToPrimitive(complex, new SyntaxContext1_14_R1(context)); - } - - @Override - public C fromPrimitive(P primitive, PersistentDataAdapterContext context) { - return type.wrapToComplex(primitive, new SyntaxContext1_14_R1(context)); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/data/SyntaxContainer1_14_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/data/SyntaxContainer1_14_R1.java deleted file mode 100644 index 31759ff..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/data/SyntaxContainer1_14_R1.java +++ /dev/null @@ -1,185 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_14_R1.data; - -import java.util.Set; -import java.util.stream.Collectors; - -import org.bukkit.persistence.PersistentDataContainer; - -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.data.IDataContainer; -import com.syntaxphoenix.syntaxapi.utils.key.IKey; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SyntaxKey; - -public final class SyntaxContainer1_14_R1 extends WrappedContainer implements IDataContainer { - - private final PersistentDataContainer container; - - public SyntaxContainer1_14_R1(PersistentDataContainer container) { - this.container = container; - } - - @Override - public PersistentDataContainer getHandle() { - return container; - } - - @Override - public IDataContainer getAsSyntaxContainer() { - return new SyntaxContainer1_14_R1(container); - } - - /* - * - */ - - @Override - public boolean has(IKey key) { - throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); - } - - @Override - public boolean has(String key, DataType type) { - return has(syntaxKey(key), type); - } - - @Override - public boolean has(IKey key, DataType type) { - return has(new SyntaxKey(key), WrappedType1_14_R1.wrap(type)); - } - - @Override - public C get(String key, DataType type) { - return get(syntaxKey(key), type); - } - - @Override - public C get(IKey key, DataType type) { - return get(new SyntaxKey(key), WrappedType1_14_R1.wrap(type)); - } - - @Override - public Object get(String key) { - throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); - } - - @Override - public Object get(IKey key) { - throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); - } - - @Override - public void set(String key, E value, DataType type) { - set(wrappedKey(key), value, WrappedType1_14_R1.wrap(type)); - } - - @Override - public void set(IKey key, E value, DataType type) { - set(new SyntaxKey(key), value, WrappedType1_14_R1.wrap(type)); - } - - @Override - public boolean remove(String key) { - return remove(wrappedKey(key)); - } - - @Override - public boolean remove(IKey key) { - return remove(new SyntaxKey(key)); - } - - @Override - public IKey[] getKeys() { - return container.getKeys().stream().map(BukkitKey1_14_R1::new).map(WrappedKey::getNamespacedKey).toArray(IKey[]::new); - } - - @Override - public Set getKeyspaces() { - return container.getKeys().stream().map(org.bukkit.NamespacedKey::toString).collect(Collectors.toSet()); - } - - @Override - public DataAdapterContext getAdapterContext() { - return getContext(); - } - - /* - * - */ - - @Override - public SyntaxContext1_14_R1 getContext() { - return new SyntaxContext1_14_R1(container.getAdapterContext()); - } - - @Override - public boolean has(String key) { - throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); - } - - @Override - public boolean has(WrappedKey key) { - throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); - } - - @Override - public boolean has(String key, WrapType type) { - return has(wrappedKey(key), type); - } - - @Override - public boolean has(WrappedKey key, WrapType type) { - return container.has(BukkitKey1_14_R1.asBukkit(key), new SimpleBukkitType1_14_R1<>(type)); - } - - @Override - public Object get(WrappedKey key) { - throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); - } - - @Override - public C get(String key, WrapType type) { - return get(wrappedKey(key), type); - } - - @Override - public C get(WrappedKey key, WrapType type) { - return container.get(BukkitKey1_14_R1.asBukkit(key), new SimpleBukkitType1_14_R1<>(type)); - } - - @Override - public void set(String key, B value, WrapType type) { - set(wrappedKey(key), value, type); - } - - @Override - public void set(WrappedKey key, B value, WrapType type) { - container.set(BukkitKey1_14_R1.asBukkit(key), new SimpleBukkitType1_14_R1<>(type), value); - } - - @Override - public boolean remove(WrappedKey key) { - container.remove(BukkitKey1_14_R1.asBukkit(key)); - return true; // Will always return true as we don't know if it contained it - } - - @Override - public Set keySet() { - return getKeyspaces(); - } - - @Override - public boolean isEmpty() { - return container.isEmpty(); - } - - @Override - public int size() { - return 0; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/data/SyntaxContext1_14_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/data/SyntaxContext1_14_R1.java deleted file mode 100644 index 91cebbc..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/data/SyntaxContext1_14_R1.java +++ /dev/null @@ -1,38 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_14_R1.data; - -import org.bukkit.persistence.PersistentDataAdapterContext; -import org.bukkit.persistence.PersistentDataContainer; - -import com.syntaxphoenix.syntaxapi.data.IDataContainer; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; - -public final class SyntaxContext1_14_R1 extends WrappedContext implements PersistentDataAdapterContext { - - private final PersistentDataAdapterContext context; - - public SyntaxContext1_14_R1(PersistentDataAdapterContext context) { - this.context = context; - } - - @Override - public PersistentDataAdapterContext getHandle() { - return context; - } - - @Override - public PersistentDataContainer newPersistentDataContainer() { - return context.newPersistentDataContainer(); - } - - @Override - public IDataContainer newDataContainer() { - return newContainer(); - } - - @Override - public SyntaxContainer1_14_R1 newContainer() { - return new SyntaxContainer1_14_R1(context.newPersistentDataContainer()); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/data/SyntaxType1_14_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/data/SyntaxType1_14_R1.java deleted file mode 100644 index 31b24d5..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/data/SyntaxType1_14_R1.java +++ /dev/null @@ -1,76 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_14_R1.data; - -import org.bukkit.persistence.PersistentDataAdapterContext; -import org.bukkit.persistence.PersistentDataType; - -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; - -public class SyntaxType1_14_R1 extends WrappedType1_14_R1, P0, P1, C0, C1> - implements DataType { - - private final PersistentDataType type; - - public SyntaxType1_14_R1(PersistentDataType type) { - super(type.getPrimitiveType(), type.getComplexType()); - this.type = type; - } - - @Override - public PersistentDataType getHandle() { - return type; - } - - @Override - public Class getPrimitiveOriginal() { - return type.getPrimitiveType(); - } - - @Override - public Class getComplexOriginal() { - return type.getComplexType(); - } - - /* - * - */ - - @Override - public Class getComplex() { - return complexType; - } - - @Override - public Class getPrimitive() { - return primitiveType; - } - - @Override - public P0 toPrimitive(DataAdapterContext context, C0 complex) { - return wrapToPrimitive(complex, new BukkitContext1_14_R1(context)); - } - - @Override - public C0 fromPrimitive(DataAdapterContext context, P0 primitive) { - return wrapToComplex(primitive, new BukkitContext1_14_R1(context)); - } - - @Override - public P0 wrapToPrimitive(C0 complex, WrappedContext context) { - if (!(context instanceof PersistentDataAdapterContext)) { - return null; - } - return toPrimitiveWrapped(type.toPrimitive(toComplexOriginal(complex), (PersistentDataAdapterContext) context)); - } - - @Override - public C0 wrapToComplex(P0 primitive, WrappedContext context) { - if (!(context instanceof PersistentDataAdapterContext)) { - return null; - } - return toComplexWrapped(type.fromPrimitive(toPrimitiveOriginal(primitive), (PersistentDataAdapterContext) context)); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/data/WrappedType1_14_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/data/WrappedType1_14_R1.java deleted file mode 100644 index 7540ba7..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/data/WrappedType1_14_R1.java +++ /dev/null @@ -1,150 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_14_R1.data; - -import java.util.Arrays; - -import org.bukkit.persistence.PersistentDataContainer; -import org.bukkit.persistence.PersistentDataType; - -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.data.IDataContainer; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; - -public abstract class WrappedType1_14_R1 implements WrapType { - - protected final Class primitiveType; - protected final Class complexType; - - private final int primitiveWrap; - private final int complexWrap; - - @SuppressWarnings("unchecked") - protected WrappedType1_14_R1(Class primitive, Class complex) { - this.primitiveWrap = WrappedType1_14_R1.internalState(primitive); - this.complexWrap = WrappedType1_14_R1.internalState(complex); - this.primitiveType = (Class) WrappedType1_14_R1.internalWrap(primitive, primitiveWrap); - this.complexType = (Class) WrappedType1_14_R1.internalWrap(complex, complexWrap); - } - - public abstract H getHandle(); - - public Class getPrimitiveWrapped() { - return primitiveType; - } - - public Class getComplexWrapped() { - return complexType; - } - - public abstract Class getPrimitiveOriginal(); - - public abstract Class getComplexOriginal(); - - @SuppressWarnings("unchecked") - public P0 toPrimitiveWrapped(P1 primitive) { - switch (primitiveWrap) { - case 1: - return (P0) new SyntaxContainer1_14_R1((PersistentDataContainer) primitive); - case 2: - return (P0) Arrays.stream((PersistentDataContainer[]) primitive).map(SyntaxContainer1_14_R1::new) - .toArray(SyntaxContainer1_14_R1[]::new); - case 3: - return (P0) new BukkitContainer1_14_R1((IDataContainer) primitive); - case 4: - return (P0) Arrays.stream((IDataContainer[]) primitive).map(BukkitContainer1_14_R1::new) - .toArray(BukkitContainer1_14_R1[]::new); - default: - return (P0) primitive; - } - } - - @SuppressWarnings("unchecked") - public C0 toComplexWrapped(C1 complex) { - switch (complexWrap) { - case 1: - return (C0) new SyntaxContainer1_14_R1((PersistentDataContainer) complex); - case 2: - return (C0) Arrays.stream((PersistentDataContainer[]) complex).map(SyntaxContainer1_14_R1::new).toArray(SyntaxContainer1_14_R1[]::new); - case 3: - return (C0) new BukkitContainer1_14_R1((IDataContainer) complex); - case 4: - return (C0) Arrays.stream((IDataContainer[]) complex).map(BukkitContainer1_14_R1::new).toArray(BukkitContainer1_14_R1[]::new); - default: - return (C0) complex; - } - } - - @SuppressWarnings("unchecked") - public P1 toPrimitiveOriginal(P0 primitive) { - switch (primitiveWrap) { - case 1: - return (P1) new BukkitContainer1_14_R1((IDataContainer) primitive); - case 2: - return (P1) Arrays.stream((IDataContainer[]) primitive).map(BukkitContainer1_14_R1::new) - .toArray(BukkitContainer1_14_R1[]::new); - case 3: - return (P1) new SyntaxContainer1_14_R1((PersistentDataContainer) primitive); - case 4: - return (P1) Arrays.stream((PersistentDataContainer[]) primitive).map(SyntaxContainer1_14_R1::new) - .toArray(SyntaxContainer1_14_R1[]::new); - default: - return (P1) primitive; - } - } - - @SuppressWarnings("unchecked") - public C1 toComplexOriginal(C0 complex) { - switch (complexWrap) { - case 1: - return (C1) new BukkitContainer1_14_R1((IDataContainer) complex); - case 2: - return (C1) Arrays.stream((IDataContainer[]) complex).map(BukkitContainer1_14_R1::new).toArray(BukkitContainer1_14_R1[]::new); - case 3: - return (C1) new SyntaxContainer1_14_R1((PersistentDataContainer) complex); - case 4: - return (C1) Arrays.stream((PersistentDataContainer[]) complex).map(SyntaxContainer1_14_R1::new).toArray(SyntaxContainer1_14_R1[]::new); - default: - return (C1) complex; - } - } - - protected static Class internalWrap(Class clazz, int state) { - switch (state) { - case 1: - return SyntaxContainer1_14_R1.class; - case 2: - return SyntaxContainer1_14_R1[].class; - case 3: - return BukkitContainer1_14_R1.class; - case 4: - return BukkitContainer1_14_R1[].class; - default: - return clazz; - } - } - - protected static int internalState(Class clazz) { - if (clazz.isAssignableFrom(PersistentDataContainer.class)) { - return 1; - } - if (clazz.isAssignableFrom(PersistentDataContainer[].class)) { - return 2; - } - if (clazz.isAssignableFrom(IDataContainer.class)) { - return 3; - } - if (clazz.isAssignableFrom(IDataContainer[].class)) { - return 4; - } - return 0; - } - - public static BukkitType1_14_R1 wrap(DataType type) { - return new BukkitType1_14_R1<>(type); - } - - public static SyntaxType1_14_R1 wrap(PersistentDataType type) { - return new SyntaxType1_14_R1<>(type); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/data/hook/BukkitContainerAdapterHook1_14_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/data/hook/BukkitContainerAdapterHook1_14_R1.java deleted file mode 100644 index acad01a..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/data/hook/BukkitContainerAdapterHook1_14_R1.java +++ /dev/null @@ -1,134 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_14_R1.data.hook; - -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; - -import org.bukkit.craftbukkit.v1_14_R1.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_14_R1.persistence.CraftPersistentDataContainer; -import org.bukkit.craftbukkit.v1_14_R1.persistence.CraftPersistentDataTypeRegistry; -import org.bukkit.persistence.PersistentDataContainer; - -import com.syntaxphoenix.syntaxapi.data.IDataContainer; -import com.syntaxphoenix.syntaxapi.data.container.nbt.NbtContainer; -import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; - -import net.minecraft.server.v1_14_R1.NBTTagCompound; -import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_14_R1.data.BukkitContainer1_14_R1; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_14_R1.data.SyntaxContainer1_14_R1; - -@SuppressWarnings({ - "rawtypes", - "unchecked" -}) -public final class BukkitContainerAdapterHook1_14_R1 { - - private static final BukkitContainerAdapterHook1_14_R1 HOOK = new BukkitContainerAdapterHook1_14_R1(); - - private final AbstractReflect registryRef = new Reflect(CraftPersistentDataTypeRegistry.class) - .searchMethod("create", "createAdapter", Class.class, Class.class, Function.class, Function.class) - .searchField("adapters", "adapters") - .searchField("function", "CREATE_ADAPTER"); - private final AbstractReflect entityRef = new Reflect(CraftEntity.class).searchField("registry", "DATA_TYPE_REGISTRY"); - - private BukkitContainerAdapterHook1_14_R1() {} - - private final HashMap map = new HashMap<>(); - - private CraftPersistentDataTypeRegistry getEntityRegistry() { - return (CraftPersistentDataTypeRegistry) entityRef.getFieldValue("registry"); - } - - private void uninjectAll() { - for (CraftPersistentDataTypeRegistry registry : map.keySet()) { - Map adapters = (Map) registryRef.getFieldValue("adapters", registry); - adapters.remove(BukkitContainer1_14_R1.class); - adapters.remove(SyntaxContainer1_14_R1.class); - registryRef.setFieldValue(registry, "function", map.get(registry)); - } - map.clear(); - } - - private void inject(CraftPersistentDataTypeRegistry registry) { - if (map.containsKey(registry)) { - return; - } - map.put(registry, (Function) registryRef.getFieldValue("function", registry)); - Function function = clazz -> createAdapter(registry, registryRef.getMethod("create").getReturnType(), (Class) clazz); - registryRef.setFieldValue(registry, "function", function); - } - - private E createAdapter(CraftPersistentDataTypeRegistry registry, Class adapterType, Class type) { - if (Objects.equals(BukkitContainer1_14_R1.class, type)) { - return (E) buildAdapter(registry, BukkitContainer1_14_R1.class, tag -> fromPrimitiveSyntax(tag)); - } - if (Objects.equals(SyntaxContainer1_14_R1.class, type)) { - return (E) buildAdapter(registry, SyntaxContainer1_14_R1.class, tag -> fromPrimitiveBukkit(registry, tag)); - } - return (E) map.get(registry).apply(type); - } - - private Object buildAdapter(Object handle, Class type, Function function) { - return registryRef.run(handle, "create", type, NBTTagCompound.class, (Function) input -> toPrimitive(input), - function); - } - - private NBTTagCompound toPrimitive(WrappedContainer input) { - Object handle = findFinalContainer(input).getHandle(); - if (handle instanceof PersistentDataContainer) { - if (handle instanceof CraftPersistentDataContainer) { - return ((CraftPersistentDataContainer) handle).toTagCompound(); - } - throw new IllegalArgumentException( - "Expected 'CraftPersistentDataContainer' got '" + handle.getClass().getSimpleName() + " instead'!"); - } - if (handle instanceof IDataContainer) { - if (handle instanceof NbtContainer) { - return (NBTTagCompound) VersionControl.get().getBukkitConversion().toMinecraftCompound(((NbtContainer) handle).asNbt()); - } - throw new IllegalArgumentException( - "Expected 'CraftPersistentDataContainer' got '" + handle.getClass().getSimpleName() + " instead'!"); - } - throw new IllegalArgumentException("Unknown WrappedContainer implementation!"); - } - - private BukkitContainer1_14_R1 fromPrimitiveSyntax(NBTTagCompound data) { - VersionControl control = VersionControl.get(); - NbtContainer container = new NbtContainer(control.getDataProvider().getRegistry()); - NbtCompound compound = control.getBukkitConversion().fromMinecraftCompound(data); - container.fromNbt(compound); - return new BukkitContainer1_14_R1(container); - } - - private SyntaxContainer1_14_R1 fromPrimitiveBukkit(CraftPersistentDataTypeRegistry registry, NBTTagCompound data) { - CraftPersistentDataContainer container = new CraftPersistentDataContainer(registry); - container.putAll(data); - return new SyntaxContainer1_14_R1(container); - } - - private WrappedContainer findFinalContainer(WrappedContainer container) { - WrappedContainer output = container; - while (output.getHandle() instanceof WrappedContainer) { - output = (WrappedContainer) output.getHandle(); - } - return output; - } - - public static void unhookAll() { - HOOK.uninjectAll(); - } - - public static void hookEntity() { - HOOK.inject(HOOK.getEntityRegistry()); - } - - public static void hook(CraftPersistentDataTypeRegistry registry) { - HOOK.inject(registry); - } - -} diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/entity/ArmorStand1_14_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/entity/ArmorStand1_14_R1.java deleted file mode 100644 index ff6b523..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/entity/ArmorStand1_14_R1.java +++ /dev/null @@ -1,24 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_14_R1.entity; - -import net.minecraft.server.v1_14_R1.EntityArmorStand; -import net.minecraft.server.v1_14_R1.EntityTypes; -import net.minecraft.server.v1_14_R1.World; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsArmorStand; - -public class ArmorStand1_14_R1 extends EntityLiving1_14_R1 implements NmsArmorStand { - - public ArmorStand1_14_R1(World world) { - super(new EntityArmorStand(EntityTypes.ARMOR_STAND, world)); - } - - @Override - public void setSmall(boolean small) { - handle.setSmall(small); - } - - @Override - public boolean isSmall() { - return handle.isSmall(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/entity/Entity1_14_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/entity/Entity1_14_R1.java deleted file mode 100644 index 9a62cbc..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/entity/Entity1_14_R1.java +++ /dev/null @@ -1,215 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_14_R1.entity; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.OfflinePlayer; -import org.bukkit.craftbukkit.v1_14_R1.CraftWorld; -import org.bukkit.craftbukkit.v1_14_R1.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_14_R1.util.CraftChatMessage; -import org.bukkit.entity.Player; - -import net.minecraft.server.v1_14_R1.AxisAlignedBB; -import net.minecraft.server.v1_14_R1.Entity; -import net.minecraft.server.v1_14_R1.PacketPlayOutEntityDestroy; -import net.minecraft.server.v1_14_R1.PacketPlayOutEntityMetadata; -import net.minecraft.server.v1_14_R1.PacketPlayOutSpawnEntity; -import net.minecraft.server.v1_14_R1.PlayerConnection; -import net.minecraft.server.v1_14_R1.Vec3D; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.utils.NmsBoundingBox; - -public abstract class Entity1_14_R1 implements NmsEntity { - - protected final E handle; - - protected final List visible = Collections.synchronizedList(new ArrayList<>()); - - public Entity1_14_R1(E handle) { - this.handle = handle; - } - - @Override - public final E getHandle() { - return handle; - } - - @Override - public int getId() { - return handle.getId(); - } - - @Override - public UUID getUniqueId() { - return handle.getUniqueID(); - } - - @Override - public NmsBoundingBox getBoundingBox() { - AxisAlignedBB box = handle.getBoundingBox(); - return new NmsBoundingBox(box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ); - } - - @Override - public void setCustomName(String name) { - handle.setCustomName(CraftChatMessage.fromStringOrNull(name)); - updateVisibility(); - } - - @Override - public String getCustomName() { - return CraftChatMessage.fromComponent(handle.getCustomName()); - } - - @Override - public void setGravity(boolean gravity) { - handle.setNoGravity(!gravity); - } - - @Override - public boolean hasGravity() { - return !handle.isNoGravity(); - } - - @Override - public void setCustomNameVisible(boolean visible) { - handle.setCustomNameVisible(visible); - } - - @Override - public boolean isCustomNameVisible() { - return handle.getCustomNameVisible(); - } - - @Override - public void setInvisible(boolean invisible) { - handle.setInvisible(invisible); - } - - @Override - public boolean isInvisible() { - return handle.isInvisible(); - } - - @Override - public boolean isInteractable() { - return handle.isInteractable(); - } - - @Override - public boolean isCollidable() { - return handle.isCollidable(); - } - - @Override - public void setInvulnerable(boolean invulnerable) { - handle.setInvulnerable(invulnerable); - } - - @Override - public boolean isInvulnerable() { - return handle.isInvulnerable(); - } - - @Override - public void setLocation(Location location) { - handle.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); - if (location.getWorld() == null || handle.getWorld().getWorld() == location.getWorld()) { - updateVisibility(); - return; - } - handle.world = ((CraftWorld) location.getWorld()).getHandle(); - updateVisibility(); - } - - @Override - public Location getLocation() { - Vec3D vector = handle.bO(); - return new Location(handle.getWorld().getWorld(), vector.x, vector.y, vector.z); - } - - @Override - public void updateVisibility() { - if (visible.isEmpty()) { - return; - } - Player[] players; - synchronized (visible) { - players = visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) - .toArray(Player[]::new); - } - hide(players); - show(players); - } - - @Override - public boolean isShown(Player player) { - synchronized (visible) { - return visible.contains(player.getUniqueId()); - } - } - - @Override - public void hide(Player... players) { - if (players.length == 0) { - return; - } - PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(handle.getId()); - for (Player player : players) { - if (!isShown(player)) { - continue; - } - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); - synchronized (visible) { - visible.remove(player.getUniqueId()); - } - } - } - - @Override - public void show(Player... players) { - if (players.length == 0) { - return; - } - PacketPlayOutSpawnEntity packet = new PacketPlayOutSpawnEntity(handle); - PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); - PlayerConnection connection; - for (Player player : players) { - if (isShown(player)) { - continue; - } - connection = ((CraftPlayer) player).getHandle().playerConnection; - connection.sendPacket(packet); - connection.sendPacket(metadataPacket); - synchronized (visible) { - visible.add(player.getUniqueId()); - } - } - } - - @Override - public UUID[] getVisible() { - synchronized (visible) { - return visible.toArray(new UUID[0]); - } - } - - @Override - public Player[] getVisibleAsPlayer() { - synchronized (visible) { - return visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) - .toArray(Player[]::new); - } - } - - @Override - public void kill() { - hide(getVisibleAsPlayer()); - handle.die(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/entity/EntityLiving1_14_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/entity/EntityLiving1_14_R1.java deleted file mode 100644 index cd3db27..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/entity/EntityLiving1_14_R1.java +++ /dev/null @@ -1,17 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_14_R1.entity; - -import net.minecraft.server.v1_14_R1.EntityLiving; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityLiving; - -public abstract class EntityLiving1_14_R1 extends Entity1_14_R1 implements NmsEntityLiving { - - public EntityLiving1_14_R1(E handle) { - super(handle); - } - - @Override - public void setCollidable(boolean collidable) { - handle.collides = collidable; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/entity/Player1_14_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/entity/Player1_14_R1.java deleted file mode 100644 index 3e26d72..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/entity/Player1_14_R1.java +++ /dev/null @@ -1,289 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_14_R1.entity; - -import java.util.ArrayList; -import java.util.Collections; - -import org.bukkit.craftbukkit.v1_14_R1.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_14_R1.util.CraftChatMessage; -import org.bukkit.entity.Player; - -import com.mojang.authlib.GameProfile; -import com.mojang.authlib.properties.Property; -import com.mojang.authlib.properties.PropertyMap; - -import net.minecraft.server.v1_14_R1.EntityPlayer; -import net.minecraft.server.v1_14_R1.EnumItemSlot; -import net.minecraft.server.v1_14_R1.IChatBaseComponent; -import net.minecraft.server.v1_14_R1.MathHelper; -import net.minecraft.server.v1_14_R1.PacketPlayInClientCommand; -import net.minecraft.server.v1_14_R1.PacketPlayInClientCommand.EnumClientCommand; -import net.minecraft.server.v1_14_R1.PacketPlayOutEntityDestroy; -import net.minecraft.server.v1_14_R1.PacketPlayOutEntityEquipment; -import net.minecraft.server.v1_14_R1.PacketPlayOutEntityHeadRotation; -import net.minecraft.server.v1_14_R1.PacketPlayOutEntityMetadata; -import net.minecraft.server.v1_14_R1.PacketPlayOutEntityStatus; -import net.minecraft.server.v1_14_R1.PacketPlayOutHeldItemSlot; -import net.minecraft.server.v1_14_R1.PacketPlayOutNamedEntitySpawn; -import net.minecraft.server.v1_14_R1.PacketPlayOutPlayerInfo; -import net.minecraft.server.v1_14_R1.PacketPlayOutPlayerInfo.EnumPlayerInfoAction; -import net.minecraft.server.v1_14_R1.PacketPlayOutPlayerListHeaderFooter; -import net.minecraft.server.v1_14_R1.PacketPlayOutPosition; -import net.minecraft.server.v1_14_R1.PacketPlayOutRespawn; -import net.minecraft.server.v1_14_R1.PacketPlayOutTitle; -import net.minecraft.server.v1_14_R1.PacketPlayOutTitle.EnumTitleAction; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.type.SkinDataType; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_14_R1.data.SyntaxContainer1_14_R1; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; -import net.sourcewriters.minecraft.vcompat.utils.bukkit.Players; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.MojangProfileServer; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; -import net.sourcewriters.minecraft.vcompat.utils.thread.PostAsync; -import net.minecraft.server.v1_14_R1.PlayerConnection; - -public class Player1_14_R1 extends EntityLiving1_14_R1 implements NmsPlayer { - - private String realName; - private Skin realSkin; - - private final WrappedContainer dataAdapter; - - public Player1_14_R1(Player player) { - super(((CraftPlayer) player).getHandle()); - dataAdapter = new SyntaxContainer1_14_R1(getBukkitPlayer().getPersistentDataContainer()); - update(false); - } - - @Override - public CraftPlayer getBukkitPlayer() { - return handle.getBukkitEntity(); - } - - @Override - public WrappedContainer getDataAdapter() { - return dataAdapter; - } - - @Override - public void setSkin(Skin skin) { - if (skin == null) { - return; - } - dataAdapter.set("skin", skin, SkinDataType.WRAPPED_INSTANCE); - } - - @Override - public Skin getSkin() { - return dataAdapter.getOrDefault("skin", SkinDataType.WRAPPED_INSTANCE, realSkin); - } - - @Override - public Skin getRealSkin() { - return realSkin; - } - - @Override - public void setName(String name) { - if (getName().equals(name)) { - return; - } - if (name == null) { - dataAdapter.remove("name"); - return; - } - dataAdapter.set("name", name, WrapType.STRING); - } - - @Override - public String getName() { - return dataAdapter.getOrDefault("name", WrapType.STRING, realName); - } - - @Override - public String getRealName() { - return realName; - } - - @Override - public void setPlayerListHeader(String text) { - setPlayerListHeaderAndFooter(text, getPlayerListFooter()); - } - - @Override - public String getPlayerListHeader() { - return dataAdapter.getOrDefault("header", WrapType.STRING, ""); - } - - @Override - public void setPlayerListFooter(String text) { - setPlayerListHeaderAndFooter(getPlayerListHeader(), text); - } - - @Override - public String getPlayerListFooter() { - return dataAdapter.getOrDefault("footer", WrapType.STRING, ""); - } - - @Override - public int getPing() { - return handle.ping; - } - - @Override - public void setPlayerListHeaderAndFooter(String header, String footer) { - dataAdapter.set("header", header, WrapType.STRING); - dataAdapter.set("footer", footer, WrapType.STRING); - sendPlayerListInfo(header, footer); - } - - private final void sendPlayerListInfo(String header, String footer) { - if (handle.playerConnection.isDisconnected()) { - return; - } - - IChatBaseComponent headerComponent = header.isEmpty() ? null : CraftChatMessage.fromStringOrNull(header, true); - IChatBaseComponent footerComponent = footer.isEmpty() ? null : CraftChatMessage.fromStringOrNull(footer, true); - - PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter(); - - packet.header = headerComponent; - packet.footer = footerComponent; - - handle.playerConnection.sendPacket(packet); - } - - @Override - public void setTitleTimes(int fadeIn, int stay, int fadeOut) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TIMES, null, fadeIn, stay, fadeOut)); - } - - @Override - public void sendSubtitle(String text) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.SUBTITLE, CraftChatMessage.fromStringOrNull(text))); - } - - @Override - public void sendTitle(String text) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TITLE, CraftChatMessage.fromStringOrNull(text))); - } - - @Override - public void sendActionBar(String text) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.ACTIONBAR, CraftChatMessage.fromStringOrNull(text))); - } - - @Override - public void fakeRespawn() { - if (handle.playerConnection.isDisconnected()) { - return; - } - PacketPlayOutPlayerInfo remInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER, handle); - PacketPlayOutPlayerInfo addInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.ADD_PLAYER, handle); - - PacketPlayOutEntityDestroy destroyPacket = new PacketPlayOutEntityDestroy(handle.getId()); - PacketPlayOutNamedEntitySpawn spawnPacket = new PacketPlayOutNamedEntitySpawn(handle); - PacketPlayOutEntityHeadRotation rotationPacket = new PacketPlayOutEntityHeadRotation(handle, - (byte) MathHelper.d(handle.getHeadRotation() * 256F / 360F)); - - ArrayList equipmentPackets = new ArrayList<>(); - for (EnumItemSlot slot : EnumItemSlot.values()) { - equipmentPackets.add(new PacketPlayOutEntityEquipment(handle.getId(), slot, handle.getEquipment(slot))); - } - - Player self = getBukkitPlayer(); - Player[] players = Players.getOnlineWithout(getUniqueId()); - for (Player player : players) { - if (!player.canSee(self)) { - continue; - } - PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection; - connection.sendPacket(remInfoPacket); - connection.sendPacket(addInfoPacket); - connection.sendPacket(destroyPacket); - connection.sendPacket(spawnPacket); - connection.sendPacket(rotationPacket); - for (PacketPlayOutEntityEquipment equipmentPacket : equipmentPackets) { - connection.sendPacket(equipmentPacket); - } - } - - PacketPlayOutRespawn respawnPacket = new PacketPlayOutRespawn(handle.dimension, handle.world.worldData.getType(), - handle.playerInteractManager.getGameMode()); - PacketPlayOutPosition positionPacket = new PacketPlayOutPosition(handle.locX, handle.locY, handle.locZ, handle.yaw, handle.pitch, - Collections.emptySet(), 0); - PacketPlayOutHeldItemSlot itemPacket = new PacketPlayOutHeldItemSlot(handle.inventory.itemInHandIndex); - PacketPlayOutEntityStatus statusPacket = new PacketPlayOutEntityStatus(handle, (byte) 28); - PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); - - PlayerConnection connection = handle.playerConnection; - connection.sendPacket(remInfoPacket); - connection.sendPacket(addInfoPacket); - connection.sendPacket(respawnPacket); - connection.sendPacket(positionPacket); - connection.sendPacket(itemPacket); - connection.sendPacket(statusPacket); - connection.sendPacket(metadataPacket); - - handle.updateAbilities(); - handle.triggerHealthUpdate(); - handle.updateInventory(handle.defaultContainer); - if (handle.activeContainer != handle.defaultContainer) { - handle.updateInventory(handle.activeContainer); - } - self.recalculatePermissions(); - } - - @Override - public void respawn() { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayInClientCommand(EnumClientCommand.PERFORM_RESPAWN)); - } - - @Override - public void update() { - update(true); - } - - private final void update(boolean flag) { - PostAsync.forcePost(() -> { - realName = MojangProfileServer.getName(getUniqueId()); - realSkin = MojangProfileServer.getSkin(realName, getUniqueId()); - }); - if (flag) { - GameProfile profile = handle.getProfile(); - - Skin skin = getSkin(); - if (skin != null) { - PropertyMap properties = profile.getProperties(); - properties.removeAll("textures"); - properties.put("textures", new Property("textures", skin.getValue(), skin.getSignature())); - } - - String name = getName(); - if (name != null) { - ReflectionProvider.DEFAULT.getReflect("mjGameProfile").setFieldValue(profile, "name", name); - } - - if (!(name == null && skin == null)) { - fakeRespawn(); - } - } - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/tools/BlockTools1_14_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/tools/BlockTools1_14_R1.java deleted file mode 100644 index 38e97df..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/tools/BlockTools1_14_R1.java +++ /dev/null @@ -1,39 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_14_R1.tools; - -import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_14_R1.block.CraftSkull; - -import com.mojang.authlib.properties.Property; -import com.mojang.authlib.properties.PropertyMap; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; - -import net.minecraft.server.v1_14_R1.TileEntitySkull; -import net.sourcewriters.minecraft.vcompat.reflection.tools.BlockTools; -import net.sourcewriters.minecraft.vcompat.utils.constants.MinecraftConstants; - -public class BlockTools1_14_R1 extends BlockTools { - - private final AbstractReflect craftEntityStateRef = new Reflect(CraftSkull.class).searchField("tileEntity", "tileEntity"); - - @Override - public void setHeadTexture(Block block, String texture) { - if (!(block instanceof CraftSkull)) { - return; - } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); - PropertyMap map = entitySkull.gameProfile.getProperties(); - map.removeAll("textures"); - map.put("textures", new Property("textures", MinecraftConstants.TEXTURE_SIGNATURE, texture)); - } - - @Override - public String getHeadTexture(Block block) { - if (!(block instanceof CraftSkull)) { - return null; - } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); - return entitySkull.gameProfile.getProperties().get("textures").iterator().next().getValue(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/tools/ServerTools1_14_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/tools/ServerTools1_14_R1.java deleted file mode 100644 index fb934bd..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/tools/ServerTools1_14_R1.java +++ /dev/null @@ -1,27 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_14_R1.tools; - -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_14_R1.CraftServer; - -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_14_R1.wrapper.ConsoleReaderWrapper1_14_R1; -import net.sourcewriters.minecraft.vcompat.reflection.tools.ServerTools; - -public class ServerTools1_14_R1 extends ServerTools { - - @Override - public void setMotd(String text) { - ((CraftServer) Bukkit.getServer()).getServer().setMotd(text); - } - - @Override - public String getMotd() { - return ((CraftServer) Bukkit.getServer()).getServer().getMotd(); - } - - @SuppressWarnings("resource") - @Override - public ConsoleReaderWrapper1_14_R1 getConsole() { - return ConsoleReaderWrapper1_14_R1.INSTANCE; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/tools/SkinTools1_14_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/tools/SkinTools1_14_R1.java deleted file mode 100644 index 64e5e34..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/tools/SkinTools1_14_R1.java +++ /dev/null @@ -1,16 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_14_R1.tools; - -import org.bukkit.craftbukkit.v1_14_R1.entity.CraftPlayer; -import org.bukkit.entity.Player; - -import net.sourcewriters.minecraft.vcompat.reflection.tools.SkinTools; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; - -public class SkinTools1_14_R1 extends SkinTools { - - @Override - public Skin skinFromPlayer(Player player) { - return skinFromGameProfile(((CraftPlayer) player).getHandle().getProfile()); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/utils/EntityConstructors1_14_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/utils/EntityConstructors1_14_R1.java deleted file mode 100644 index 54a0d98..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/utils/EntityConstructors1_14_R1.java +++ /dev/null @@ -1,12 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_14_R1.utils; - -import java.util.function.Function; - -import net.minecraft.server.v1_14_R1.World; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_14_R1.entity.ArmorStand1_14_R1; - -public abstract class EntityConstructors1_14_R1 { - - public static final Function ARMOR_STAND = (world -> new ArmorStand1_14_R1(world)); - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/wrapper/ConsoleReaderWrapper1_14_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/wrapper/ConsoleReaderWrapper1_14_R1.java deleted file mode 100644 index ca2cf26..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/wrapper/ConsoleReaderWrapper1_14_R1.java +++ /dev/null @@ -1,43 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_14_R1.wrapper; - -import java.io.IOException; -import java.io.Writer; - -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_14_R1.CraftServer; -import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; - -import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; - -public final class ConsoleReaderWrapper1_14_R1 extends ConsoleReaderWrapper { - - public static final ConsoleReaderWrapper1_14_R1 INSTANCE = new ConsoleReaderWrapper1_14_R1(); - - private final ConsoleReader reader; - - @SuppressWarnings("resource") - private ConsoleReaderWrapper1_14_R1() { - this.reader = ((CraftServer) Bukkit.getServer()).getServer().reader; - } - - @Override - public Writer getOutput() { - return reader.getOutput(); - } - - @Override - public boolean isAnsiSupported() { - return reader.getTerminal().isAnsiSupported(); - } - - @Override - public void flush() throws IOException { - reader.flush(); - } - - @Override - public void drawLine() throws IOException { - reader.drawLine(); - } - -} diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/BukkitConversion1_15_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/BukkitConversion1_15_R1.java deleted file mode 100644 index 0726b39..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/BukkitConversion1_15_R1.java +++ /dev/null @@ -1,218 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_15_R1; - -import java.util.Set; - -import org.bukkit.craftbukkit.v1_15_R1.inventory.CraftItemStack; -import org.bukkit.entity.EntityType; - -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.nbt.NbtByte; -import com.syntaxphoenix.syntaxapi.nbt.NbtByteArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; -import com.syntaxphoenix.syntaxapi.nbt.NbtDouble; -import com.syntaxphoenix.syntaxapi.nbt.NbtEnd; -import com.syntaxphoenix.syntaxapi.nbt.NbtFloat; -import com.syntaxphoenix.syntaxapi.nbt.NbtInt; -import com.syntaxphoenix.syntaxapi.nbt.NbtIntArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtList; -import com.syntaxphoenix.syntaxapi.nbt.NbtLong; -import com.syntaxphoenix.syntaxapi.nbt.NbtLongArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtShort; -import com.syntaxphoenix.syntaxapi.nbt.NbtString; -import com.syntaxphoenix.syntaxapi.nbt.NbtTag; -import com.syntaxphoenix.syntaxapi.nbt.NbtType; - -import net.minecraft.server.v1_15_R1.ItemStack; -import net.minecraft.server.v1_15_R1.NBTBase; -import net.minecraft.server.v1_15_R1.NBTNumber; -import net.minecraft.server.v1_15_R1.NBTTagByte; -import net.minecraft.server.v1_15_R1.NBTTagByteArray; -import net.minecraft.server.v1_15_R1.NBTTagCompound; -import net.minecraft.server.v1_15_R1.NBTTagDouble; -import net.minecraft.server.v1_15_R1.NBTTagEnd; -import net.minecraft.server.v1_15_R1.NBTTagFloat; -import net.minecraft.server.v1_15_R1.NBTTagInt; -import net.minecraft.server.v1_15_R1.NBTTagIntArray; -import net.minecraft.server.v1_15_R1.NBTTagList; -import net.minecraft.server.v1_15_R1.NBTTagLong; -import net.minecraft.server.v1_15_R1.NBTTagLongArray; -import net.minecraft.server.v1_15_R1.NBTTagShort; -import net.minecraft.server.v1_15_R1.NBTTagString; -import net.sourcewriters.minecraft.vcompat.reflection.BukkitConversion; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_15_R1.data.BukkitContext1_15_R1; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_15_R1.data.BukkitType1_15_R1; - -public class BukkitConversion1_15_R1 extends BukkitConversion { - - protected BukkitConversion1_15_R1(VersionControl1_15_R1 versionControl) { - super(versionControl); - } - - @Override - public EntityType toEntityType(NmsEntityType type) { - try { - return EntityType.valueOf(type.name()); - } catch (IllegalArgumentException ignore) { - return null; - } - } - - @Override - public NmsEntityType fromEntityType(EntityType type) { - try { - return NmsEntityType.valueOf(type.name()); - } catch (IllegalArgumentException ignore) { - return null; - } - } - - @Override - public NBTBase toMinecraftTag(NbtTag tag) { - switch (tag.getType()) { - case BYTE: - return NBTTagByte.a((byte) tag.getValue()); - case SHORT: - return NBTTagShort.a((short) tag.getValue()); - case INT: - return NBTTagInt.a((int) tag.getValue()); - case LONG: - return NBTTagLong.a((long) tag.getValue()); - case FLOAT: - return NBTTagFloat.a((float) tag.getValue()); - case DOUBLE: - return NBTTagDouble.a((double) tag.getValue()); - case STRING: - return NBTTagString.a((String) tag.getValue()); - case BYTE_ARRAY: - return new NBTTagByteArray((byte[]) tag.getValue()); - case INT_ARRAY: - return new NBTTagIntArray((int[]) tag.getValue()); - case LONG_ARRAY: - return new NBTTagLongArray((long[]) tag.getValue()); - case LIST: - return toMinecraftList((NbtList) tag); - case COMPOUND: - return toMinecraftCompound((NbtCompound) tag); - case END: - return NBTTagEnd.b; - default: - return null; - } - } - - @Override - public NbtTag fromMinecraftTag(Object raw) { - if (!(raw instanceof NBTBase)) { - return null; - } - NBTBase tag = (NBTBase) raw; - NbtType type = NbtType.getById(tag.getTypeId()); - switch (type) { - case BYTE: - return new NbtByte(((NBTNumber) tag).asByte()); - case SHORT: - return new NbtShort(((NBTNumber) tag).asShort()); - case INT: - return new NbtInt(((NBTNumber) tag).asInt()); - case LONG: - return new NbtLong(((NBTNumber) tag).asLong()); - case FLOAT: - return new NbtFloat(((NBTNumber) tag).asFloat()); - case DOUBLE: - return new NbtDouble(((NBTNumber) tag).asDouble()); - case STRING: - return new NbtString(((NBTTagString) tag).asString()); - case BYTE_ARRAY: - return new NbtByteArray(((NBTTagByteArray) tag).getBytes()); - case INT_ARRAY: - return new NbtIntArray(((NBTTagIntArray) tag).getInts()); - case LONG_ARRAY: - return new NbtLongArray(((NBTTagLongArray) tag).getLongs()); - case LIST: - return fromMinecraftList(tag); - case COMPOUND: - return fromMinecraftCompound(tag); - case END: - return NbtEnd.INSTANCE; - default: - return null; - } - } - - @Override - public NBTTagList toMinecraftList(NbtList list) { - NBTTagList output = new NBTTagList(); - for (NbtTag tag : list) { - output.add(toMinecraftTag(tag)); - } - return output; - } - - @Override - public NbtList fromMinecraftList(Object raw) { - if (!(raw instanceof NBTTagList)) { - return null; - } - NBTTagList list = (NBTTagList) raw; - NbtList output = new NbtList<>(NbtType.getById(list.getTypeId())); - for (NBTBase base : list) { - output.add(fromMinecraftTag(base)); - } - return output; - } - - @Override - public NBTTagCompound toMinecraftCompound(NbtCompound compound) { - NBTTagCompound output = new NBTTagCompound(); - if (compound.isEmpty()) { - return output; - } - Set keys = compound.getKeys(); - for (String key : keys) { - output.set(key, toMinecraftTag(compound.get(key))); - } - return output; - } - - @Override - public NbtCompound fromMinecraftCompound(Object raw) { - if (!(raw instanceof NBTTagCompound)) { - return null; - } - NBTTagCompound compound = (NBTTagCompound) raw; - NbtCompound output = new NbtCompound(); - if (compound.isEmpty()) { - return output; - } - Set keys = compound.getKeys(); - for (String key : keys) { - output.set(key, fromMinecraftTag(compound.get(key))); - } - return output; - } - - @Override - public org.bukkit.inventory.ItemStack itemFromCompound(NbtCompound compound) { - return CraftItemStack.asBukkitCopy(ItemStack.a(toMinecraftCompound(compound))); - } - - @Override - public NbtCompound itemToCompound(org.bukkit.inventory.ItemStack itemStack) { - return fromMinecraftCompound(CraftItemStack.asNMSCopy(itemStack).getOrCreateTag()); - } - - @Override - public WrappedContext createContext(DataAdapterContext context) { - return new BukkitContext1_15_R1(context); - } - - @Override - public WrapType wrap(DataType dataType) { - return new BukkitType1_15_R1<>(dataType); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/EntityProvider1_15_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/EntityProvider1_15_R1.java deleted file mode 100644 index 49e7ed4..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/EntityProvider1_15_R1.java +++ /dev/null @@ -1,47 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_15_R1; - -import java.util.EnumMap; -import java.util.function.Function; - -import org.bukkit.craftbukkit.v1_15_R1.CraftWorld; - -import net.minecraft.server.v1_15_R1.World; -import net.sourcewriters.minecraft.vcompat.reflection.EntityProvider; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_15_R1.utils.EntityConstructors1_15_R1; - -public class EntityProvider1_15_R1 extends EntityProvider { - - private final EnumMap> entityMap = new EnumMap<>(NmsEntityType.class); - - protected EntityProvider1_15_R1(VersionControl1_15_R1 versionControl) { - super(versionControl); - } - - @SuppressWarnings("unchecked") - private final Function searchConstructor(NmsEntityType type) { - try { - return (Function) EntityConstructors1_15_R1.class.getField(type.name()).get(null); - } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException ignore) { - return null; - } - } - - private final Function getConstructor(NmsEntityType type) { - return entityMap.computeIfAbsent(type, (key -> searchConstructor(key))); - } - - @Override - public NmsEntity createEntity(org.bukkit.World world, NmsEntityType type) { - if (!(world instanceof CraftWorld)) { - return null; - } - Function function; - if ((function = getConstructor(type)) == null) { - return null; - } - return function.apply(((CraftWorld) world).getHandle()); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/PacketHandler1_15_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/PacketHandler1_15_R1.java deleted file mode 100644 index f0d5ee6..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/PacketHandler1_15_R1.java +++ /dev/null @@ -1,11 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_15_R1; - -import net.sourcewriters.minecraft.vcompat.reflection.PacketHandler; - -public class PacketHandler1_15_R1 extends PacketHandler { - - protected PacketHandler1_15_R1(VersionControl1_15_R1 versionControl) { - super(versionControl); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/PlayerProvider1_15_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/PlayerProvider1_15_R1.java deleted file mode 100644 index 4b49a0e..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/PlayerProvider1_15_R1.java +++ /dev/null @@ -1,20 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_15_R1; - -import org.bukkit.entity.Player; - -import net.sourcewriters.minecraft.vcompat.reflection.PlayerProvider; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_15_R1.entity.Player1_15_R1; - -public class PlayerProvider1_15_R1 extends PlayerProvider { - - protected PlayerProvider1_15_R1(VersionControl1_15_R1 versionControl) { - super(versionControl); - } - - @Override - protected NmsPlayer createPlayer(Player player) { - return new Player1_15_R1(player); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/TextureProvider1_15_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/TextureProvider1_15_R1.java deleted file mode 100644 index d9e2cb3..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/TextureProvider1_15_R1.java +++ /dev/null @@ -1,102 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_15_R1; - -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_15_R1.block.CraftBlockEntityState; -import org.bukkit.craftbukkit.v1_15_R1.block.CraftSkull; -import org.bukkit.craftbukkit.v1_15_R1.inventory.CraftItemStack; -import org.bukkit.inventory.meta.ItemMeta; -import org.bukkit.inventory.meta.SkullMeta; - -import com.mojang.authlib.GameProfile; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; - -import net.minecraft.server.v1_15_R1.GameProfileSerializer; -import net.minecraft.server.v1_15_R1.ItemStack; -import net.minecraft.server.v1_15_R1.NBTTagCompound; -import net.minecraft.server.v1_15_R1.TileEntitySkull; -import net.sourcewriters.minecraft.vcompat.reflection.TextureProvider; - -public class TextureProvider1_15_R1 extends TextureProvider { - - private final AbstractReflect craftEntityStateRef = new Reflect(CraftBlockEntityState.class).searchField("tileEntity", "tileEntity"); - private final AbstractReflect craftItemStackRef = new Reflect(CraftItemStack.class).searchField("handle", "handle"); - private final AbstractReflect craftMetaSkullRef = new Reflect("org.bukkit.craftbukkit.v1_15_R1.inventory.CraftMetaSkull") - .searchField("serialized", "serializedProfile").searchField("profile", "profile"); - - protected TextureProvider1_15_R1(VersionControl1_15_R1 versionControl) { - super(versionControl); - } - - @Override - public GameProfile profileFromBlock(Block block) { - if (!(block instanceof CraftSkull)) { - return null; - } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); - return entitySkull.gameProfile; - } - - @Override - public GameProfile profileFromItem(org.bukkit.inventory.ItemStack itemStack) { - if (!(itemStack.getItemMeta() instanceof SkullMeta)) { - return null; - } - SkullMeta meta = (SkullMeta) itemStack.getItemMeta(); - GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue("profile", meta); - if (profile == null) { - NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue("serialized", meta); - if (compound == null) { - ItemStack stack = null; - if (itemStack instanceof CraftItemStack) { - stack = (ItemStack) craftItemStackRef.getFieldValue("handle", itemStack); - } - if (stack == null) { - stack = CraftItemStack.asNMSCopy(itemStack); - } - NBTTagCompound stackTag = stack.getOrCreateTag(); - if (stackTag.hasKeyOfType("SkullOwner", 10)) { - compound = stackTag.getCompound("SkullOwner"); - } else if (stackTag.hasKeyOfType("SkullProfile", 10)) { - compound = stackTag.getCompound("SkullProfile"); - } - } - if (compound == null) { - return null; - } - profile = GameProfileSerializer.deserialize(compound); - } - return profile; - } - - @Override - public org.bukkit.inventory.ItemStack getItem(GameProfile profile) { - org.bukkit.inventory.ItemStack craftStack = CraftItemStack.asCraftCopy(new org.bukkit.inventory.ItemStack(Material.PLAYER_HEAD)); - applyItem(craftStack, profile); - return craftStack; - } - - @Override - public boolean applyItem(org.bukkit.inventory.ItemStack itemStack, GameProfile profile) { - ItemMeta meta = itemStack.getItemMeta(); - if (!(meta instanceof SkullMeta)) { - return false; - } - SkullMeta skullMeta = (SkullMeta) meta; - craftMetaSkullRef.setFieldValue(meta, "profile", profile); - itemStack.setItemMeta(skullMeta); - return true; - } - - @Override - public boolean applyBlock(Block block, GameProfile profile) { - if (!(block instanceof CraftSkull)) { - return false; - } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); - entitySkull.setGameProfile(profile); - return true; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/ToolProvider1_15_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/ToolProvider1_15_R1.java deleted file mode 100644 index 14c0f0b..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/ToolProvider1_15_R1.java +++ /dev/null @@ -1,33 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_15_R1; - -import net.sourcewriters.minecraft.vcompat.reflection.ToolProvider; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_15_R1.tools.BlockTools1_15_R1; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_15_R1.tools.ServerTools1_15_R1; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_15_R1.tools.SkinTools1_15_R1; - -public class ToolProvider1_15_R1 extends ToolProvider { - - private final BlockTools1_15_R1 blockTools = new BlockTools1_15_R1(); - private final SkinTools1_15_R1 skinTools = new SkinTools1_15_R1(); - private final ServerTools1_15_R1 serverTools = new ServerTools1_15_R1(); - - protected ToolProvider1_15_R1(VersionControl1_15_R1 versionControl) { - super(versionControl); - } - - @Override - public SkinTools1_15_R1 getSkinTools() { - return skinTools; - } - - @Override - public ServerTools1_15_R1 getServerTools() { - return serverTools; - } - - @Override - public BlockTools1_15_R1 getBlockTools() { - return blockTools; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/VersionControl1_15_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/VersionControl1_15_R1.java deleted file mode 100644 index 5a5106b..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/VersionControl1_15_R1.java +++ /dev/null @@ -1,61 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_15_R1; - -import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_15_R1.data.hook.BukkitContainerAdapterHook1_15_R1; - -public class VersionControl1_15_R1 extends VersionControl { - - public static VersionControl1_15_R1 INSTANCE; - - public static VersionControl1_15_R1 init() { - return INSTANCE != null ? INSTANCE : (INSTANCE = new VersionControl1_15_R1()); - } - - private final ToolProvider1_15_R1 toolProvider = new ToolProvider1_15_R1(this); - private final TextureProvider1_15_R1 textureProvider = new TextureProvider1_15_R1(this); - private final PacketHandler1_15_R1 packetHandler = new PacketHandler1_15_R1(this); - private final EntityProvider1_15_R1 entityProvider = new EntityProvider1_15_R1(this); - private final PlayerProvider1_15_R1 playerProvider = new PlayerProvider1_15_R1(this); - private final BukkitConversion1_15_R1 bukkitConversion = new BukkitConversion1_15_R1(this); - - private VersionControl1_15_R1() { - BukkitContainerAdapterHook1_15_R1.hookEntity(); - } - - @Override - public ToolProvider1_15_R1 getToolProvider() { - return toolProvider; - } - - @Override - public EntityProvider1_15_R1 getEntityProvider() { - return entityProvider; - } - - @Override - public PlayerProvider1_15_R1 getPlayerProvider() { - return playerProvider; - } - - @Override - public TextureProvider1_15_R1 getTextureProvider() { - return textureProvider; - } - - @Override - public PacketHandler1_15_R1 getPacketHandler() { - return packetHandler; - } - - @Override - public BukkitConversion1_15_R1 getBukkitConversion() { - return bukkitConversion; - } - - @Override - public void shutdown() { - dataProvider.getDefaultDistributor().shutdown(); - BukkitContainerAdapterHook1_15_R1.unhookAll(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/data/BukkitContainer1_15_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/data/BukkitContainer1_15_R1.java deleted file mode 100644 index a4b3817..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/data/BukkitContainer1_15_R1.java +++ /dev/null @@ -1,160 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_15_R1.data; - -import java.util.Arrays; -import java.util.Optional; -import java.util.Set; -import java.util.stream.Collectors; - -import org.bukkit.NamespacedKey; -import org.bukkit.persistence.PersistentDataAdapterContext; -import org.bukkit.persistence.PersistentDataContainer; -import org.bukkit.persistence.PersistentDataType; - -import com.syntaxphoenix.syntaxapi.data.IDataContainer; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SyntaxKey; - -public final class BukkitContainer1_15_R1 extends WrappedContainer implements PersistentDataContainer { - - private final IDataContainer container; - - public BukkitContainer1_15_R1(IDataContainer container) { - this.container = container; - } - - @Override - public IDataContainer getHandle() { - return container; - } - - @Override - public IDataContainer getAsSyntaxContainer() { - return container; - } - - /* - * - */ - - @Override - public boolean has(NamespacedKey key, PersistentDataType type) { - return has(new BukkitKey1_15_R1(key), WrappedType1_15_R1.wrap(type)); - } - - @Override - public Z get(NamespacedKey key, PersistentDataType type) { - return get(new BukkitKey1_15_R1(key), WrappedType1_15_R1.wrap(type)); - } - - @Override - public Z getOrDefault(NamespacedKey key, PersistentDataType type, Z value) { - return Optional.ofNullable(get(key, type)).orElse(value); - } - - @Override - public void set(NamespacedKey key, PersistentDataType type, Z value) { - set(new BukkitKey1_15_R1(key), value, WrappedType1_15_R1.wrap(type)); - } - - @Override - public void remove(NamespacedKey key) { - remove(new BukkitKey1_15_R1(key)); - } - - public Set getKeys() { - return Arrays.stream(container.getKeys()).map(SyntaxKey::new).map(BukkitKey1_15_R1::asBukkit).collect(Collectors.toSet()); - } - - @Override - public PersistentDataAdapterContext getAdapterContext() { - return getContext(); - } - - /* - * - */ - - @Override - public BukkitContext1_15_R1 getContext() { - return new BukkitContext1_15_R1(container.getAdapterContext()); - } - - @Override - public boolean has(String key) { - return has(wrappedKey(key)); - } - - @Override - public boolean has(WrappedKey key) { - return container.has(key.getNamespacedKey()); - } - - @Override - public boolean has(String key, WrapType type) { - return has(wrappedKey(key), type); - } - - @Override - public boolean has(WrappedKey key, WrapType type) { - return container.has(key.getNamespacedKey(), type.syntaxType()); - } - - @Override - public Object get(String key) { - return get(wrappedKey(key)); - } - - @Override - public Object get(WrappedKey key) { - return container.get(key.getNamespacedKey()); - } - - @Override - public C get(String key, WrapType type) { - return get(wrappedKey(key), type); - } - - @Override - public C get(WrappedKey key, WrapType type) { - return container.get(key.getNamespacedKey(), type.syntaxType()); - } - - @Override - public void set(String key, B value, WrapType type) { - set(wrappedKey(key), value, type); - } - - @Override - public void set(WrappedKey key, B value, WrapType type) { - container.set(key.getNamespacedKey(), value, type.syntaxType()); - } - - @Override - public boolean remove(String key) { - return false; - } - - @Override - public boolean remove(WrappedKey key) { - return container.remove(key.getNamespacedKey()); - } - - @Override - public Set keySet() { - return container.getKeyspaces(); - } - - @Override - public boolean isEmpty() { - return container.isEmpty(); - } - - @Override - public int size() { - return container.size(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/data/BukkitContext1_15_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/data/BukkitContext1_15_R1.java deleted file mode 100644 index 165f155..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/data/BukkitContext1_15_R1.java +++ /dev/null @@ -1,39 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_15_R1.data; - -import org.bukkit.persistence.PersistentDataAdapterContext; -import org.bukkit.persistence.PersistentDataContainer; - -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.IDataContainer; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; - -public final class BukkitContext1_15_R1 extends WrappedContext implements PersistentDataAdapterContext { - - private final DataAdapterContext context; - - public BukkitContext1_15_R1(DataAdapterContext context) { - this.context = context; - } - - @Override - public DataAdapterContext getHandle() { - return context; - } - - @Override - public PersistentDataContainer newPersistentDataContainer() { - return newContainer(); - } - - @Override - public IDataContainer newDataContainer() { - return context.newDataContainer(); - } - - @Override - public BukkitContainer1_15_R1 newContainer() { - return new BukkitContainer1_15_R1(context.newDataContainer()); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/data/BukkitKey1_15_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/data/BukkitKey1_15_R1.java deleted file mode 100644 index bf849e4..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/data/BukkitKey1_15_R1.java +++ /dev/null @@ -1,52 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_15_R1.data; - -import org.bukkit.NamespacedKey; -import org.bukkit.plugin.Plugin; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; - -public final class BukkitKey1_15_R1 extends WrappedKey { - - private final NamespacedKey key; - - public BukkitKey1_15_R1(Plugin plugin, String key) { - this.key = new NamespacedKey(plugin, key); - } - - @SuppressWarnings("deprecation") - public BukkitKey1_15_R1(String name, String key) { - this.key = new NamespacedKey(name, key); - } - - public BukkitKey1_15_R1(NamespacedKey key) { - this.key = key; - } - - @Override - public NamespacedKey getHandle() { - return key; - } - - @Override - public String getName() { - return key.getNamespace(); - } - - @Override - public String getKey() { - return key.getKey(); - } - - @Override - public String toString() { - return key.toString(); - } - - public static NamespacedKey asBukkit(WrappedKey key) { - if (key.getHandle() instanceof NamespacedKey) { - return (NamespacedKey) key.getHandle(); - } - return new BukkitKey1_15_R1(key.getName(), key.getKey()).getHandle(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/data/BukkitType1_15_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/data/BukkitType1_15_R1.java deleted file mode 100644 index 2a64e11..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/data/BukkitType1_15_R1.java +++ /dev/null @@ -1,69 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_15_R1.data; - -import org.bukkit.persistence.PersistentDataAdapterContext; -import org.bukkit.persistence.PersistentDataType; - -import com.syntaxphoenix.syntaxapi.data.DataType; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; - -public class BukkitType1_15_R1 extends WrappedType1_15_R1, P0, P1, C0, C1> - implements PersistentDataType { - - private final DataType type; - - public BukkitType1_15_R1(DataType type) { - super(type.getPrimitive(), type.getComplex()); - this.type = type; - } - - @Override - public DataType getHandle() { - return type; - } - - @Override - public Class getPrimitiveOriginal() { - return type.getPrimitive(); - } - - @Override - public Class getComplexOriginal() { - return type.getComplex(); - } - - /* - * - */ - - @Override - public Class getComplexType() { - return complexType; - } - - @Override - public Class getPrimitiveType() { - return primitiveType; - } - - @Override - public P0 toPrimitive(C0 complex, PersistentDataAdapterContext context) { - return wrapToPrimitive(complex, new SyntaxContext1_15_R1(context)); - } - - @Override - public C0 fromPrimitive(P0 primitive, PersistentDataAdapterContext context) { - return wrapToComplex(primitive, new SyntaxContext1_15_R1(context)); - } - - @Override - public P0 wrapToPrimitive(C0 complex, WrappedContext context) { - return toPrimitiveWrapped(type.toPrimitive(context, toComplexOriginal(complex))); - } - - @Override - public C0 wrapToComplex(P0 primitive, WrappedContext context) { - return toComplexWrapped(type.fromPrimitive(context, toPrimitiveOriginal(primitive))); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/data/SimpleBukkitType1_15_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/data/SimpleBukkitType1_15_R1.java deleted file mode 100644 index 6b8bfc1..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/data/SimpleBukkitType1_15_R1.java +++ /dev/null @@ -1,36 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_15_R1.data; - -import org.bukkit.persistence.PersistentDataAdapterContext; -import org.bukkit.persistence.PersistentDataType; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; - -public class SimpleBukkitType1_15_R1 implements PersistentDataType { - - private final WrapType type; - - public SimpleBukkitType1_15_R1(WrapType type) { - this.type = type; - } - - @Override - public Class getComplexType() { - return type.getComplexWrapped(); - } - - @Override - public Class

getPrimitiveType() { - return type.getPrimitiveWrapped(); - } - - @Override - public P toPrimitive(C complex, PersistentDataAdapterContext context) { - return type.wrapToPrimitive(complex, new SyntaxContext1_15_R1(context)); - } - - @Override - public C fromPrimitive(P primitive, PersistentDataAdapterContext context) { - return type.wrapToComplex(primitive, new SyntaxContext1_15_R1(context)); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/data/SyntaxContainer1_15_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/data/SyntaxContainer1_15_R1.java deleted file mode 100644 index a391fe0..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/data/SyntaxContainer1_15_R1.java +++ /dev/null @@ -1,185 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_15_R1.data; - -import java.util.Set; -import java.util.stream.Collectors; - -import org.bukkit.persistence.PersistentDataContainer; - -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.data.IDataContainer; -import com.syntaxphoenix.syntaxapi.utils.key.IKey; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SyntaxKey; - -public final class SyntaxContainer1_15_R1 extends WrappedContainer implements IDataContainer { - - private final PersistentDataContainer container; - - public SyntaxContainer1_15_R1(PersistentDataContainer container) { - this.container = container; - } - - @Override - public PersistentDataContainer getHandle() { - return container; - } - - @Override - public IDataContainer getAsSyntaxContainer() { - return new SyntaxContainer1_15_R1(container); - } - - /* - * - */ - - @Override - public boolean has(IKey key) { - throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); - } - - @Override - public boolean has(String key, DataType type) { - return has(syntaxKey(key), type); - } - - @Override - public boolean has(IKey key, DataType type) { - return has(new SyntaxKey(key), WrappedType1_15_R1.wrap(type)); - } - - @Override - public C get(String key, DataType type) { - return get(syntaxKey(key), type); - } - - @Override - public C get(IKey key, DataType type) { - return get(new SyntaxKey(key), WrappedType1_15_R1.wrap(type)); - } - - @Override - public Object get(String key) { - throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); - } - - @Override - public Object get(IKey key) { - throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); - } - - @Override - public void set(String key, E value, DataType type) { - set(wrappedKey(key), value, WrappedType1_15_R1.wrap(type)); - } - - @Override - public void set(IKey key, E value, DataType type) { - set(new SyntaxKey(key), value, WrappedType1_15_R1.wrap(type)); - } - - @Override - public boolean remove(String key) { - return remove(wrappedKey(key)); - } - - @Override - public boolean remove(IKey key) { - return remove(new SyntaxKey(key)); - } - - @Override - public IKey[] getKeys() { - return container.getKeys().stream().map(BukkitKey1_15_R1::new).map(WrappedKey::getNamespacedKey).toArray(IKey[]::new); - } - - @Override - public Set getKeyspaces() { - return container.getKeys().stream().map(org.bukkit.NamespacedKey::toString).collect(Collectors.toSet()); - } - - @Override - public DataAdapterContext getAdapterContext() { - return getContext(); - } - - /* - * - */ - - @Override - public SyntaxContext1_15_R1 getContext() { - return new SyntaxContext1_15_R1(container.getAdapterContext()); - } - - @Override - public boolean has(String key) { - throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); - } - - @Override - public boolean has(WrappedKey key) { - throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); - } - - @Override - public boolean has(String key, WrapType type) { - return has(wrappedKey(key), type); - } - - @Override - public boolean has(WrappedKey key, WrapType type) { - return container.has(BukkitKey1_15_R1.asBukkit(key), new SimpleBukkitType1_15_R1<>(type)); - } - - @Override - public Object get(WrappedKey key) { - throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); - } - - @Override - public C get(String key, WrapType type) { - return get(wrappedKey(key), type); - } - - @Override - public C get(WrappedKey key, WrapType type) { - return container.get(BukkitKey1_15_R1.asBukkit(key), new SimpleBukkitType1_15_R1<>(type)); - } - - @Override - public void set(String key, B value, WrapType type) { - set(wrappedKey(key), value, type); - } - - @Override - public void set(WrappedKey key, B value, WrapType type) { - container.set(BukkitKey1_15_R1.asBukkit(key), new SimpleBukkitType1_15_R1<>(type), value); - } - - @Override - public boolean remove(WrappedKey key) { - container.remove(BukkitKey1_15_R1.asBukkit(key)); - return true; // Will always return true as we don't know if it contained it - } - - @Override - public Set keySet() { - return getKeyspaces(); - } - - @Override - public boolean isEmpty() { - return container.isEmpty(); - } - - @Override - public int size() { - return 0; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/data/SyntaxContext1_15_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/data/SyntaxContext1_15_R1.java deleted file mode 100644 index c7cbb1b..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/data/SyntaxContext1_15_R1.java +++ /dev/null @@ -1,38 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_15_R1.data; - -import org.bukkit.persistence.PersistentDataAdapterContext; -import org.bukkit.persistence.PersistentDataContainer; - -import com.syntaxphoenix.syntaxapi.data.IDataContainer; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; - -public final class SyntaxContext1_15_R1 extends WrappedContext implements PersistentDataAdapterContext { - - private final PersistentDataAdapterContext context; - - public SyntaxContext1_15_R1(PersistentDataAdapterContext context) { - this.context = context; - } - - @Override - public PersistentDataAdapterContext getHandle() { - return context; - } - - @Override - public PersistentDataContainer newPersistentDataContainer() { - return context.newPersistentDataContainer(); - } - - @Override - public IDataContainer newDataContainer() { - return newContainer(); - } - - @Override - public SyntaxContainer1_15_R1 newContainer() { - return new SyntaxContainer1_15_R1(context.newPersistentDataContainer()); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/data/SyntaxType1_15_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/data/SyntaxType1_15_R1.java deleted file mode 100644 index d6eaf1d..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/data/SyntaxType1_15_R1.java +++ /dev/null @@ -1,76 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_15_R1.data; - -import org.bukkit.persistence.PersistentDataAdapterContext; -import org.bukkit.persistence.PersistentDataType; - -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; - -public class SyntaxType1_15_R1 extends WrappedType1_15_R1, P0, P1, C0, C1> - implements DataType { - - private final PersistentDataType type; - - public SyntaxType1_15_R1(PersistentDataType type) { - super(type.getPrimitiveType(), type.getComplexType()); - this.type = type; - } - - @Override - public PersistentDataType getHandle() { - return type; - } - - @Override - public Class getPrimitiveOriginal() { - return type.getPrimitiveType(); - } - - @Override - public Class getComplexOriginal() { - return type.getComplexType(); - } - - /* - * - */ - - @Override - public Class getComplex() { - return complexType; - } - - @Override - public Class getPrimitive() { - return primitiveType; - } - - @Override - public P0 toPrimitive(DataAdapterContext context, C0 complex) { - return wrapToPrimitive(complex, new BukkitContext1_15_R1(context)); - } - - @Override - public C0 fromPrimitive(DataAdapterContext context, P0 primitive) { - return wrapToComplex(primitive, new BukkitContext1_15_R1(context)); - } - - @Override - public P0 wrapToPrimitive(C0 complex, WrappedContext context) { - if (!(context instanceof PersistentDataAdapterContext)) { - return null; - } - return toPrimitiveWrapped(type.toPrimitive(toComplexOriginal(complex), (PersistentDataAdapterContext) context)); - } - - @Override - public C0 wrapToComplex(P0 primitive, WrappedContext context) { - if (!(context instanceof PersistentDataAdapterContext)) { - return null; - } - return toComplexWrapped(type.fromPrimitive(toPrimitiveOriginal(primitive), (PersistentDataAdapterContext) context)); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/data/WrappedType1_15_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/data/WrappedType1_15_R1.java deleted file mode 100644 index 1497921..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/data/WrappedType1_15_R1.java +++ /dev/null @@ -1,150 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_15_R1.data; - -import java.util.Arrays; - -import org.bukkit.persistence.PersistentDataContainer; -import org.bukkit.persistence.PersistentDataType; - -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.data.IDataContainer; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; - -public abstract class WrappedType1_15_R1 implements WrapType { - - protected final Class primitiveType; - protected final Class complexType; - - private final int primitiveWrap; - private final int complexWrap; - - @SuppressWarnings("unchecked") - protected WrappedType1_15_R1(Class primitive, Class complex) { - this.primitiveWrap = WrappedType1_15_R1.internalState(primitive); - this.complexWrap = WrappedType1_15_R1.internalState(complex); - this.primitiveType = (Class) WrappedType1_15_R1.internalWrap(primitive, primitiveWrap); - this.complexType = (Class) WrappedType1_15_R1.internalWrap(complex, complexWrap); - } - - public abstract H getHandle(); - - public Class getPrimitiveWrapped() { - return primitiveType; - } - - public Class getComplexWrapped() { - return complexType; - } - - public abstract Class getPrimitiveOriginal(); - - public abstract Class getComplexOriginal(); - - @SuppressWarnings("unchecked") - public P0 toPrimitiveWrapped(P1 primitive) { - switch (primitiveWrap) { - case 1: - return (P0) new SyntaxContainer1_15_R1((PersistentDataContainer) primitive); - case 2: - return (P0) Arrays.stream((PersistentDataContainer[]) primitive).map(SyntaxContainer1_15_R1::new) - .toArray(SyntaxContainer1_15_R1[]::new); - case 3: - return (P0) new BukkitContainer1_15_R1((IDataContainer) primitive); - case 4: - return (P0) Arrays.stream((IDataContainer[]) primitive).map(BukkitContainer1_15_R1::new) - .toArray(BukkitContainer1_15_R1[]::new); - default: - return (P0) primitive; - } - } - - @SuppressWarnings("unchecked") - public C0 toComplexWrapped(C1 complex) { - switch (complexWrap) { - case 1: - return (C0) new SyntaxContainer1_15_R1((PersistentDataContainer) complex); - case 2: - return (C0) Arrays.stream((PersistentDataContainer[]) complex).map(SyntaxContainer1_15_R1::new).toArray(SyntaxContainer1_15_R1[]::new); - case 3: - return (C0) new BukkitContainer1_15_R1((IDataContainer) complex); - case 4: - return (C0) Arrays.stream((IDataContainer[]) complex).map(BukkitContainer1_15_R1::new).toArray(BukkitContainer1_15_R1[]::new); - default: - return (C0) complex; - } - } - - @SuppressWarnings("unchecked") - public P1 toPrimitiveOriginal(P0 primitive) { - switch (primitiveWrap) { - case 1: - return (P1) new BukkitContainer1_15_R1((IDataContainer) primitive); - case 2: - return (P1) Arrays.stream((IDataContainer[]) primitive).map(BukkitContainer1_15_R1::new) - .toArray(BukkitContainer1_15_R1[]::new); - case 3: - return (P1) new SyntaxContainer1_15_R1((PersistentDataContainer) primitive); - case 4: - return (P1) Arrays.stream((PersistentDataContainer[]) primitive).map(SyntaxContainer1_15_R1::new) - .toArray(SyntaxContainer1_15_R1[]::new); - default: - return (P1) primitive; - } - } - - @SuppressWarnings("unchecked") - public C1 toComplexOriginal(C0 complex) { - switch (complexWrap) { - case 1: - return (C1) new BukkitContainer1_15_R1((IDataContainer) complex); - case 2: - return (C1) Arrays.stream((IDataContainer[]) complex).map(BukkitContainer1_15_R1::new).toArray(BukkitContainer1_15_R1[]::new); - case 3: - return (C1) new SyntaxContainer1_15_R1((PersistentDataContainer) complex); - case 4: - return (C1) Arrays.stream((PersistentDataContainer[]) complex).map(SyntaxContainer1_15_R1::new).toArray(SyntaxContainer1_15_R1[]::new); - default: - return (C1) complex; - } - } - - protected static Class internalWrap(Class clazz, int state) { - switch (state) { - case 1: - return SyntaxContainer1_15_R1.class; - case 2: - return SyntaxContainer1_15_R1[].class; - case 3: - return BukkitContainer1_15_R1.class; - case 4: - return BukkitContainer1_15_R1[].class; - default: - return clazz; - } - } - - protected static int internalState(Class clazz) { - if (clazz.isAssignableFrom(PersistentDataContainer.class)) { - return 1; - } - if (clazz.isAssignableFrom(PersistentDataContainer[].class)) { - return 2; - } - if (clazz.isAssignableFrom(IDataContainer.class)) { - return 3; - } - if (clazz.isAssignableFrom(IDataContainer[].class)) { - return 4; - } - return 0; - } - - public static BukkitType1_15_R1 wrap(DataType type) { - return new BukkitType1_15_R1<>(type); - } - - public static SyntaxType1_15_R1 wrap(PersistentDataType type) { - return new SyntaxType1_15_R1<>(type); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/data/hook/BukkitContainerAdapterHook1_15_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/data/hook/BukkitContainerAdapterHook1_15_R1.java deleted file mode 100644 index 2161dba..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/data/hook/BukkitContainerAdapterHook1_15_R1.java +++ /dev/null @@ -1,134 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_15_R1.data.hook; - -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; - -import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_15_R1.persistence.CraftPersistentDataContainer; -import org.bukkit.craftbukkit.v1_15_R1.persistence.CraftPersistentDataTypeRegistry; -import org.bukkit.persistence.PersistentDataContainer; - -import com.syntaxphoenix.syntaxapi.data.IDataContainer; -import com.syntaxphoenix.syntaxapi.data.container.nbt.NbtContainer; -import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; - -import net.minecraft.server.v1_15_R1.NBTTagCompound; -import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_15_R1.data.BukkitContainer1_15_R1; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_15_R1.data.SyntaxContainer1_15_R1; - -@SuppressWarnings({ - "rawtypes", - "unchecked" -}) -public final class BukkitContainerAdapterHook1_15_R1 { - - private static final BukkitContainerAdapterHook1_15_R1 HOOK = new BukkitContainerAdapterHook1_15_R1(); - - private final AbstractReflect registryRef = new Reflect(CraftPersistentDataTypeRegistry.class) - .searchMethod("create", "createAdapter", Class.class, Class.class, Function.class, Function.class) - .searchField("adapters", "adapters") - .searchField("function", "CREATE_ADAPTER"); - private final AbstractReflect entityRef = new Reflect(CraftEntity.class).searchField("registry", "DATA_TYPE_REGISTRY"); - - private BukkitContainerAdapterHook1_15_R1() {} - - private final HashMap map = new HashMap<>(); - - private CraftPersistentDataTypeRegistry getEntityRegistry() { - return (CraftPersistentDataTypeRegistry) entityRef.getFieldValue("registry"); - } - - private void uninjectAll() { - for (CraftPersistentDataTypeRegistry registry : map.keySet()) { - Map adapters = (Map) registryRef.getFieldValue("adapters", registry); - adapters.remove(BukkitContainer1_15_R1.class); - adapters.remove(SyntaxContainer1_15_R1.class); - registryRef.setFieldValue(registry, "function", map.get(registry)); - } - map.clear(); - } - - private void inject(CraftPersistentDataTypeRegistry registry) { - if (map.containsKey(registry)) { - return; - } - map.put(registry, (Function) registryRef.getFieldValue("function", registry)); - Function function = clazz -> createAdapter(registry, registryRef.getMethod("create").getReturnType(), (Class) clazz); - registryRef.setFieldValue(registry, "function", function); - } - - private E createAdapter(CraftPersistentDataTypeRegistry registry, Class adapterType, Class type) { - if (Objects.equals(BukkitContainer1_15_R1.class, type)) { - return (E) buildAdapter(registry, BukkitContainer1_15_R1.class, tag -> fromPrimitiveSyntax(tag)); - } - if (Objects.equals(SyntaxContainer1_15_R1.class, type)) { - return (E) buildAdapter(registry, SyntaxContainer1_15_R1.class, tag -> fromPrimitiveBukkit(registry, tag)); - } - return (E) map.get(registry).apply(type); - } - - private Object buildAdapter(Object handle, Class type, Function function) { - return registryRef.run(handle, "create", type, NBTTagCompound.class, (Function) input -> toPrimitive(input), - function); - } - - private NBTTagCompound toPrimitive(WrappedContainer input) { - Object handle = findFinalContainer(input).getHandle(); - if (handle instanceof PersistentDataContainer) { - if (handle instanceof CraftPersistentDataContainer) { - return ((CraftPersistentDataContainer) handle).toTagCompound(); - } - throw new IllegalArgumentException( - "Expected 'CraftPersistentDataContainer' got '" + handle.getClass().getSimpleName() + " instead'!"); - } - if (handle instanceof IDataContainer) { - if (handle instanceof NbtContainer) { - return (NBTTagCompound) VersionControl.get().getBukkitConversion().toMinecraftCompound(((NbtContainer) handle).asNbt()); - } - throw new IllegalArgumentException( - "Expected 'CraftPersistentDataContainer' got '" + handle.getClass().getSimpleName() + " instead'!"); - } - throw new IllegalArgumentException("Unknown WrappedContainer implementation!"); - } - - private BukkitContainer1_15_R1 fromPrimitiveSyntax(NBTTagCompound data) { - VersionControl control = VersionControl.get(); - NbtContainer container = new NbtContainer(control.getDataProvider().getRegistry()); - NbtCompound compound = control.getBukkitConversion().fromMinecraftCompound(data); - container.fromNbt(compound); - return new BukkitContainer1_15_R1(container); - } - - private SyntaxContainer1_15_R1 fromPrimitiveBukkit(CraftPersistentDataTypeRegistry registry, NBTTagCompound data) { - CraftPersistentDataContainer container = new CraftPersistentDataContainer(registry); - container.putAll(data); - return new SyntaxContainer1_15_R1(container); - } - - private WrappedContainer findFinalContainer(WrappedContainer container) { - WrappedContainer output = container; - while (output.getHandle() instanceof WrappedContainer) { - output = (WrappedContainer) output.getHandle(); - } - return output; - } - - public static void unhookAll() { - HOOK.uninjectAll(); - } - - public static void hookEntity() { - HOOK.inject(HOOK.getEntityRegistry()); - } - - public static void hook(CraftPersistentDataTypeRegistry registry) { - HOOK.inject(registry); - } - -} diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/entity/ArmorStand1_15_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/entity/ArmorStand1_15_R1.java deleted file mode 100644 index 8d4a61c..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/entity/ArmorStand1_15_R1.java +++ /dev/null @@ -1,24 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_15_R1.entity; - -import net.minecraft.server.v1_15_R1.EntityArmorStand; -import net.minecraft.server.v1_15_R1.EntityTypes; -import net.minecraft.server.v1_15_R1.World; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsArmorStand; - -public class ArmorStand1_15_R1 extends EntityLiving1_15_R1 implements NmsArmorStand { - - public ArmorStand1_15_R1(World world) { - super(new EntityArmorStand(EntityTypes.ARMOR_STAND, world)); - } - - @Override - public void setSmall(boolean small) { - handle.setSmall(small); - } - - @Override - public boolean isSmall() { - return handle.isSmall(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/entity/Entity1_15_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/entity/Entity1_15_R1.java deleted file mode 100644 index 7b8d3cd..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/entity/Entity1_15_R1.java +++ /dev/null @@ -1,215 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_15_R1.entity; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.OfflinePlayer; -import org.bukkit.craftbukkit.v1_15_R1.CraftWorld; -import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_15_R1.util.CraftChatMessage; -import org.bukkit.entity.Player; - -import net.minecraft.server.v1_15_R1.AxisAlignedBB; -import net.minecraft.server.v1_15_R1.Entity; -import net.minecraft.server.v1_15_R1.PacketPlayOutEntityDestroy; -import net.minecraft.server.v1_15_R1.PacketPlayOutEntityMetadata; -import net.minecraft.server.v1_15_R1.PacketPlayOutSpawnEntity; -import net.minecraft.server.v1_15_R1.PlayerConnection; -import net.minecraft.server.v1_15_R1.Vec3D; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.utils.NmsBoundingBox; - -public abstract class Entity1_15_R1 implements NmsEntity { - - protected final E handle; - - protected final List visible = Collections.synchronizedList(new ArrayList<>()); - - public Entity1_15_R1(E handle) { - this.handle = handle; - } - - @Override - public final E getHandle() { - return handle; - } - - @Override - public int getId() { - return handle.getId(); - } - - @Override - public UUID getUniqueId() { - return handle.getUniqueID(); - } - - @Override - public NmsBoundingBox getBoundingBox() { - AxisAlignedBB box = handle.getBoundingBox(); - return new NmsBoundingBox(box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ); - } - - @Override - public void setCustomName(String name) { - handle.setCustomName(CraftChatMessage.fromStringOrNull(name)); - updateVisibility(); - } - - @Override - public String getCustomName() { - return CraftChatMessage.fromComponent(handle.getCustomName()); - } - - @Override - public void setGravity(boolean gravity) { - handle.setNoGravity(!gravity); - } - - @Override - public boolean hasGravity() { - return !handle.isNoGravity(); - } - - @Override - public void setCustomNameVisible(boolean visible) { - handle.setCustomNameVisible(visible); - } - - @Override - public boolean isCustomNameVisible() { - return handle.getCustomNameVisible(); - } - - @Override - public void setInvisible(boolean invisible) { - handle.setInvisible(invisible); - } - - @Override - public boolean isInvisible() { - return handle.isInvisible(); - } - - @Override - public boolean isInteractable() { - return handle.isInteractable(); - } - - @Override - public boolean isCollidable() { - return handle.isCollidable(); - } - - @Override - public void setInvulnerable(boolean invulnerable) { - handle.setInvulnerable(invulnerable); - } - - @Override - public boolean isInvulnerable() { - return handle.isInvulnerable(); - } - - @Override - public void setLocation(Location location) { - handle.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); - if (location.getWorld() == null || handle.getWorld().getWorld() == location.getWorld()) { - updateVisibility(); - return; - } - handle.world = ((CraftWorld) location.getWorld()).getHandle(); - updateVisibility(); - } - - @Override - public Location getLocation() { - Vec3D vector = handle.getPositionVector(); - return new Location(handle.getWorld().getWorld(), vector.x, vector.y, vector.z); - } - - @Override - public void updateVisibility() { - if (visible.isEmpty()) { - return; - } - Player[] players; - synchronized (visible) { - players = visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) - .toArray(Player[]::new); - } - hide(players); - show(players); - } - - @Override - public boolean isShown(Player player) { - synchronized (visible) { - return visible.contains(player.getUniqueId()); - } - } - - @Override - public void hide(Player... players) { - if (players.length == 0) { - return; - } - PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(handle.getId()); - for (Player player : players) { - if (!isShown(player)) { - continue; - } - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); - synchronized (visible) { - visible.remove(player.getUniqueId()); - } - } - } - - @Override - public void show(Player... players) { - if (players.length == 0) { - return; - } - PacketPlayOutSpawnEntity packet = new PacketPlayOutSpawnEntity(handle); - PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); - PlayerConnection connection; - for (Player player : players) { - if (isShown(player)) { - continue; - } - connection = ((CraftPlayer) player).getHandle().playerConnection; - connection.sendPacket(packet); - connection.sendPacket(metadataPacket); - synchronized (visible) { - visible.add(player.getUniqueId()); - } - } - } - - @Override - public UUID[] getVisible() { - synchronized (visible) { - return visible.toArray(new UUID[0]); - } - } - - @Override - public Player[] getVisibleAsPlayer() { - synchronized (visible) { - return visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) - .toArray(Player[]::new); - } - } - - @Override - public void kill() { - hide(getVisibleAsPlayer()); - handle.die(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/entity/EntityLiving1_15_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/entity/EntityLiving1_15_R1.java deleted file mode 100644 index 1fce472..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/entity/EntityLiving1_15_R1.java +++ /dev/null @@ -1,17 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_15_R1.entity; - -import net.minecraft.server.v1_15_R1.EntityLiving; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityLiving; - -public abstract class EntityLiving1_15_R1 extends Entity1_15_R1 implements NmsEntityLiving { - - public EntityLiving1_15_R1(E handle) { - super(handle); - } - - @Override - public void setCollidable(boolean collidable) { - handle.collides = collidable; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/entity/Player1_15_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/entity/Player1_15_R1.java deleted file mode 100644 index 5fd9030..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/entity/Player1_15_R1.java +++ /dev/null @@ -1,289 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_15_R1.entity; - -import java.util.ArrayList; -import java.util.Collections; - -import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_15_R1.util.CraftChatMessage; -import org.bukkit.entity.Player; - -import com.mojang.authlib.GameProfile; -import com.mojang.authlib.properties.Property; -import com.mojang.authlib.properties.PropertyMap; - -import net.minecraft.server.v1_15_R1.EntityPlayer; -import net.minecraft.server.v1_15_R1.EnumItemSlot; -import net.minecraft.server.v1_15_R1.IChatBaseComponent; -import net.minecraft.server.v1_15_R1.MathHelper; -import net.minecraft.server.v1_15_R1.PacketPlayInClientCommand; -import net.minecraft.server.v1_15_R1.PacketPlayInClientCommand.EnumClientCommand; -import net.minecraft.server.v1_15_R1.PacketPlayOutEntityDestroy; -import net.minecraft.server.v1_15_R1.PacketPlayOutEntityEquipment; -import net.minecraft.server.v1_15_R1.PacketPlayOutEntityHeadRotation; -import net.minecraft.server.v1_15_R1.PacketPlayOutEntityMetadata; -import net.minecraft.server.v1_15_R1.PacketPlayOutEntityStatus; -import net.minecraft.server.v1_15_R1.PacketPlayOutHeldItemSlot; -import net.minecraft.server.v1_15_R1.PacketPlayOutNamedEntitySpawn; -import net.minecraft.server.v1_15_R1.PacketPlayOutPlayerInfo; -import net.minecraft.server.v1_15_R1.PacketPlayOutPlayerInfo.EnumPlayerInfoAction; -import net.minecraft.server.v1_15_R1.PacketPlayOutPlayerListHeaderFooter; -import net.minecraft.server.v1_15_R1.PacketPlayOutPosition; -import net.minecraft.server.v1_15_R1.PacketPlayOutRespawn; -import net.minecraft.server.v1_15_R1.PacketPlayOutTitle; -import net.minecraft.server.v1_15_R1.PacketPlayOutTitle.EnumTitleAction; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.type.SkinDataType; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_15_R1.data.SyntaxContainer1_15_R1; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; -import net.sourcewriters.minecraft.vcompat.utils.bukkit.Players; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.MojangProfileServer; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; -import net.sourcewriters.minecraft.vcompat.utils.thread.PostAsync; -import net.minecraft.server.v1_15_R1.PlayerConnection; - -public class Player1_15_R1 extends EntityLiving1_15_R1 implements NmsPlayer { - - private String realName; - private Skin realSkin; - - private final WrappedContainer dataAdapter; - - public Player1_15_R1(Player player) { - super(((CraftPlayer) player).getHandle()); - dataAdapter = new SyntaxContainer1_15_R1(getBukkitPlayer().getPersistentDataContainer()); - update(false); - } - - @Override - public CraftPlayer getBukkitPlayer() { - return handle.getBukkitEntity(); - } - - @Override - public WrappedContainer getDataAdapter() { - return dataAdapter; - } - - @Override - public void setSkin(Skin skin) { - if (skin == null) { - return; - } - dataAdapter.set("skin", skin, SkinDataType.WRAPPED_INSTANCE); - } - - @Override - public Skin getSkin() { - return dataAdapter.getOrDefault("skin", SkinDataType.WRAPPED_INSTANCE, realSkin); - } - - @Override - public Skin getRealSkin() { - return realSkin; - } - - @Override - public void setName(String name) { - if (getName().equals(name)) { - return; - } - if (name == null) { - dataAdapter.remove("name"); - return; - } - dataAdapter.set("name", name, WrapType.STRING); - } - - @Override - public String getName() { - return dataAdapter.getOrDefault("name", WrapType.STRING, realName); - } - - @Override - public String getRealName() { - return realName; - } - - @Override - public void setPlayerListHeader(String text) { - setPlayerListHeaderAndFooter(text, getPlayerListFooter()); - } - - @Override - public String getPlayerListHeader() { - return dataAdapter.getOrDefault("header", WrapType.STRING, ""); - } - - @Override - public void setPlayerListFooter(String text) { - setPlayerListHeaderAndFooter(getPlayerListHeader(), text); - } - - @Override - public String getPlayerListFooter() { - return dataAdapter.getOrDefault("footer", WrapType.STRING, ""); - } - - @Override - public int getPing() { - return handle.ping; - } - - @Override - public void setPlayerListHeaderAndFooter(String header, String footer) { - dataAdapter.set("header", header, WrapType.STRING); - dataAdapter.set("footer", footer, WrapType.STRING); - sendPlayerListInfo(header, footer); - } - - private final void sendPlayerListInfo(String header, String footer) { - if (handle.playerConnection.isDisconnected()) { - return; - } - - IChatBaseComponent headerComponent = header.isEmpty() ? null : CraftChatMessage.fromStringOrNull(header, true); - IChatBaseComponent footerComponent = footer.isEmpty() ? null : CraftChatMessage.fromStringOrNull(footer, true); - - PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter(); - - packet.header = headerComponent; - packet.footer = footerComponent; - - handle.playerConnection.sendPacket(packet); - } - - @Override - public void setTitleTimes(int fadeIn, int stay, int fadeOut) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TIMES, null, fadeIn, stay, fadeOut)); - } - - @Override - public void sendSubtitle(String text) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.SUBTITLE, CraftChatMessage.fromStringOrNull(text))); - } - - @Override - public void sendTitle(String text) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TITLE, CraftChatMessage.fromStringOrNull(text))); - } - - @Override - public void sendActionBar(String text) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.ACTIONBAR, CraftChatMessage.fromStringOrNull(text))); - } - - @Override - public void fakeRespawn() { - if (handle.playerConnection.isDisconnected()) { - return; - } - PacketPlayOutPlayerInfo remInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER, handle); - PacketPlayOutPlayerInfo addInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.ADD_PLAYER, handle); - - PacketPlayOutEntityDestroy destroyPacket = new PacketPlayOutEntityDestroy(handle.getId()); - PacketPlayOutNamedEntitySpawn spawnPacket = new PacketPlayOutNamedEntitySpawn(handle); - PacketPlayOutEntityHeadRotation rotationPacket = new PacketPlayOutEntityHeadRotation(handle, - (byte) MathHelper.d(handle.getHeadRotation() * 256F / 360F)); - - ArrayList equipmentPackets = new ArrayList<>(); - for (EnumItemSlot slot : EnumItemSlot.values()) { - equipmentPackets.add(new PacketPlayOutEntityEquipment(handle.getId(), slot, handle.getEquipment(slot))); - } - - Player self = getBukkitPlayer(); - Player[] players = Players.getOnlineWithout(getUniqueId()); - for (Player player : players) { - if (!player.canSee(self)) { - continue; - } - PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection; - connection.sendPacket(remInfoPacket); - connection.sendPacket(addInfoPacket); - connection.sendPacket(destroyPacket); - connection.sendPacket(spawnPacket); - connection.sendPacket(rotationPacket); - for (PacketPlayOutEntityEquipment equipmentPacket : equipmentPackets) { - connection.sendPacket(equipmentPacket); - } - } - - PacketPlayOutRespawn respawnPacket = new PacketPlayOutRespawn(handle.dimension, handle.world.getSeed(), - handle.world.worldData.getType(), handle.playerInteractManager.getGameMode()); - PacketPlayOutPosition positionPacket = new PacketPlayOutPosition(handle.locX(), handle.locY(), handle.locZ(), handle.yaw, - handle.pitch, Collections.emptySet(), 0); - PacketPlayOutHeldItemSlot itemPacket = new PacketPlayOutHeldItemSlot(handle.inventory.itemInHandIndex); - PacketPlayOutEntityStatus statusPacket = new PacketPlayOutEntityStatus(handle, (byte) 28); - PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); - - PlayerConnection connection = handle.playerConnection; - connection.sendPacket(remInfoPacket); - connection.sendPacket(addInfoPacket); - connection.sendPacket(respawnPacket); - connection.sendPacket(positionPacket); - connection.sendPacket(itemPacket); - connection.sendPacket(statusPacket); - connection.sendPacket(metadataPacket); - - handle.updateAbilities(); - handle.triggerHealthUpdate(); - handle.updateInventory(handle.defaultContainer); - if (handle.activeContainer != handle.defaultContainer) { - handle.updateInventory(handle.activeContainer); - } - self.recalculatePermissions(); - } - - @Override - public void respawn() { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayInClientCommand(EnumClientCommand.PERFORM_RESPAWN)); - } - - @Override - public void update() { - update(true); - } - - private final void update(boolean flag) { - PostAsync.forcePost(() -> { - realName = MojangProfileServer.getName(getUniqueId()); - realSkin = MojangProfileServer.getSkin(realName, getUniqueId()); - }); - if (flag) { - GameProfile profile = handle.getProfile(); - - Skin skin = getSkin(); - if (skin != null) { - PropertyMap properties = profile.getProperties(); - properties.removeAll("textures"); - properties.put("textures", new Property("textures", skin.getValue(), skin.getSignature())); - } - - String name = getName(); - if (name != null) { - ReflectionProvider.DEFAULT.getReflect("mjGameProfile").setFieldValue(profile, "name", name); - } - - if (!(name == null && skin == null)) { - fakeRespawn(); - } - } - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/tools/BlockTools1_15_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/tools/BlockTools1_15_R1.java deleted file mode 100644 index c9c22d5..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/tools/BlockTools1_15_R1.java +++ /dev/null @@ -1,39 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_15_R1.tools; - -import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_15_R1.block.CraftSkull; - -import com.mojang.authlib.properties.Property; -import com.mojang.authlib.properties.PropertyMap; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; - -import net.minecraft.server.v1_15_R1.TileEntitySkull; -import net.sourcewriters.minecraft.vcompat.reflection.tools.BlockTools; -import net.sourcewriters.minecraft.vcompat.utils.constants.MinecraftConstants; - -public class BlockTools1_15_R1 extends BlockTools { - - private final AbstractReflect craftEntityStateRef = new Reflect(CraftSkull.class).searchField("tileEntity", "tileEntity"); - - @Override - public void setHeadTexture(Block block, String texture) { - if (!(block instanceof CraftSkull)) { - return; - } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); - PropertyMap map = entitySkull.gameProfile.getProperties(); - map.removeAll("textures"); - map.put("textures", new Property("textures", MinecraftConstants.TEXTURE_SIGNATURE, texture)); - } - - @Override - public String getHeadTexture(Block block) { - if (!(block instanceof CraftSkull)) { - return null; - } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); - return entitySkull.gameProfile.getProperties().get("textures").iterator().next().getValue(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/tools/ServerTools1_15_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/tools/ServerTools1_15_R1.java deleted file mode 100644 index 311604b..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/tools/ServerTools1_15_R1.java +++ /dev/null @@ -1,27 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_15_R1.tools; - -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_15_R1.CraftServer; - -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_15_R1.wrapper.ConsoleReaderWrapper1_15_R1; -import net.sourcewriters.minecraft.vcompat.reflection.tools.ServerTools; - -public class ServerTools1_15_R1 extends ServerTools { - - @Override - public void setMotd(String text) { - ((CraftServer) Bukkit.getServer()).getServer().setMotd(text); - } - - @Override - public String getMotd() { - return ((CraftServer) Bukkit.getServer()).getServer().getMotd(); - } - - @SuppressWarnings("resource") - @Override - public ConsoleReaderWrapper1_15_R1 getConsole() { - return ConsoleReaderWrapper1_15_R1.INSTANCE; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/tools/SkinTools1_15_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/tools/SkinTools1_15_R1.java deleted file mode 100644 index 2cf4e06..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/tools/SkinTools1_15_R1.java +++ /dev/null @@ -1,16 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_15_R1.tools; - -import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer; -import org.bukkit.entity.Player; - -import net.sourcewriters.minecraft.vcompat.reflection.tools.SkinTools; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; - -public class SkinTools1_15_R1 extends SkinTools { - - @Override - public Skin skinFromPlayer(Player player) { - return skinFromGameProfile(((CraftPlayer) player).getHandle().getProfile()); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/utils/EntityConstructors1_15_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/utils/EntityConstructors1_15_R1.java deleted file mode 100644 index 19a3e0e..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/utils/EntityConstructors1_15_R1.java +++ /dev/null @@ -1,12 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_15_R1.utils; - -import java.util.function.Function; - -import net.minecraft.server.v1_15_R1.World; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_15_R1.entity.ArmorStand1_15_R1; - -public abstract class EntityConstructors1_15_R1 { - - public static final Function ARMOR_STAND = (world -> new ArmorStand1_15_R1(world)); - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/wrapper/ConsoleReaderWrapper1_15_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/wrapper/ConsoleReaderWrapper1_15_R1.java deleted file mode 100644 index 9e4e436..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/wrapper/ConsoleReaderWrapper1_15_R1.java +++ /dev/null @@ -1,43 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_15_R1.wrapper; - -import java.io.IOException; -import java.io.Writer; - -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_15_R1.CraftServer; -import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; - -import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; - -public final class ConsoleReaderWrapper1_15_R1 extends ConsoleReaderWrapper { - - public static final ConsoleReaderWrapper1_15_R1 INSTANCE = new ConsoleReaderWrapper1_15_R1(); - - private final ConsoleReader reader; - - @SuppressWarnings("resource") - private ConsoleReaderWrapper1_15_R1() { - this.reader = ((CraftServer) Bukkit.getServer()).getServer().reader; - } - - @Override - public Writer getOutput() { - return reader.getOutput(); - } - - @Override - public boolean isAnsiSupported() { - return reader.getTerminal().isAnsiSupported(); - } - - @Override - public void flush() throws IOException { - reader.flush(); - } - - @Override - public void drawLine() throws IOException { - reader.drawLine(); - } - -} diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/BukkitConversion1_16_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/BukkitConversion1_16_R1.java deleted file mode 100644 index 600a9ef..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/BukkitConversion1_16_R1.java +++ /dev/null @@ -1,218 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R1; - -import java.util.Set; - -import org.bukkit.craftbukkit.v1_16_R1.inventory.CraftItemStack; -import org.bukkit.entity.EntityType; - -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.nbt.NbtByte; -import com.syntaxphoenix.syntaxapi.nbt.NbtByteArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; -import com.syntaxphoenix.syntaxapi.nbt.NbtDouble; -import com.syntaxphoenix.syntaxapi.nbt.NbtEnd; -import com.syntaxphoenix.syntaxapi.nbt.NbtFloat; -import com.syntaxphoenix.syntaxapi.nbt.NbtInt; -import com.syntaxphoenix.syntaxapi.nbt.NbtIntArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtList; -import com.syntaxphoenix.syntaxapi.nbt.NbtLong; -import com.syntaxphoenix.syntaxapi.nbt.NbtLongArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtShort; -import com.syntaxphoenix.syntaxapi.nbt.NbtString; -import com.syntaxphoenix.syntaxapi.nbt.NbtTag; -import com.syntaxphoenix.syntaxapi.nbt.NbtType; - -import net.minecraft.server.v1_16_R1.ItemStack; -import net.minecraft.server.v1_16_R1.NBTBase; -import net.minecraft.server.v1_16_R1.NBTNumber; -import net.minecraft.server.v1_16_R1.NBTTagByte; -import net.minecraft.server.v1_16_R1.NBTTagByteArray; -import net.minecraft.server.v1_16_R1.NBTTagCompound; -import net.minecraft.server.v1_16_R1.NBTTagDouble; -import net.minecraft.server.v1_16_R1.NBTTagEnd; -import net.minecraft.server.v1_16_R1.NBTTagFloat; -import net.minecraft.server.v1_16_R1.NBTTagInt; -import net.minecraft.server.v1_16_R1.NBTTagIntArray; -import net.minecraft.server.v1_16_R1.NBTTagList; -import net.minecraft.server.v1_16_R1.NBTTagLong; -import net.minecraft.server.v1_16_R1.NBTTagLongArray; -import net.minecraft.server.v1_16_R1.NBTTagShort; -import net.minecraft.server.v1_16_R1.NBTTagString; -import net.sourcewriters.minecraft.vcompat.reflection.BukkitConversion; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R1.data.BukkitContext1_16_R1; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R1.data.BukkitType1_16_R1; - -public class BukkitConversion1_16_R1 extends BukkitConversion { - - protected BukkitConversion1_16_R1(VersionControl1_16_R1 versionControl) { - super(versionControl); - } - - @Override - public EntityType toEntityType(NmsEntityType type) { - try { - return EntityType.valueOf(type.name()); - } catch (IllegalArgumentException ignore) { - return null; - } - } - - @Override - public NmsEntityType fromEntityType(EntityType type) { - try { - return NmsEntityType.valueOf(type.name()); - } catch (IllegalArgumentException ignore) { - return null; - } - } - - @Override - public NBTBase toMinecraftTag(NbtTag tag) { - switch (tag.getType()) { - case BYTE: - return NBTTagByte.a((byte) tag.getValue()); - case SHORT: - return NBTTagShort.a((short) tag.getValue()); - case INT: - return NBTTagInt.a((int) tag.getValue()); - case LONG: - return NBTTagLong.a((long) tag.getValue()); - case FLOAT: - return NBTTagFloat.a((float) tag.getValue()); - case DOUBLE: - return NBTTagDouble.a((double) tag.getValue()); - case STRING: - return NBTTagString.a((String) tag.getValue()); - case BYTE_ARRAY: - return new NBTTagByteArray((byte[]) tag.getValue()); - case INT_ARRAY: - return new NBTTagIntArray((int[]) tag.getValue()); - case LONG_ARRAY: - return new NBTTagLongArray((long[]) tag.getValue()); - case LIST: - return toMinecraftList((NbtList) tag); - case COMPOUND: - return toMinecraftCompound((NbtCompound) tag); - case END: - return NBTTagEnd.b; - default: - return null; - } - } - - @Override - public NbtTag fromMinecraftTag(Object raw) { - if (!(raw instanceof NBTBase)) { - return null; - } - NBTBase tag = (NBTBase) raw; - NbtType type = NbtType.getById(tag.getTypeId()); - switch (type) { - case BYTE: - return new NbtByte(((NBTNumber) tag).asByte()); - case SHORT: - return new NbtShort(((NBTNumber) tag).asShort()); - case INT: - return new NbtInt(((NBTNumber) tag).asInt()); - case LONG: - return new NbtLong(((NBTNumber) tag).asLong()); - case FLOAT: - return new NbtFloat(((NBTNumber) tag).asFloat()); - case DOUBLE: - return new NbtDouble(((NBTNumber) tag).asDouble()); - case STRING: - return new NbtString(((NBTTagString) tag).asString()); - case BYTE_ARRAY: - return new NbtByteArray(((NBTTagByteArray) tag).getBytes()); - case INT_ARRAY: - return new NbtIntArray(((NBTTagIntArray) tag).getInts()); - case LONG_ARRAY: - return new NbtLongArray(((NBTTagLongArray) tag).getLongs()); - case LIST: - return fromMinecraftList(tag); - case COMPOUND: - return fromMinecraftCompound(tag); - case END: - return NbtEnd.INSTANCE; - default: - return null; - } - } - - @Override - public NBTTagList toMinecraftList(NbtList list) { - NBTTagList output = new NBTTagList(); - for (NbtTag tag : list) { - output.add(toMinecraftTag(tag)); - } - return output; - } - - @Override - public NbtList fromMinecraftList(Object raw) { - if (!(raw instanceof NBTTagList)) { - return null; - } - NBTTagList list = (NBTTagList) raw; - NbtList output = new NbtList<>(NbtType.getById(list.getTypeId())); - for (NBTBase base : list) { - output.add(fromMinecraftTag(base)); - } - return output; - } - - @Override - public NBTTagCompound toMinecraftCompound(NbtCompound compound) { - NBTTagCompound output = new NBTTagCompound(); - if (compound.isEmpty()) { - return output; - } - Set keys = compound.getKeys(); - for (String key : keys) { - output.set(key, toMinecraftTag(compound.get(key))); - } - return output; - } - - @Override - public NbtCompound fromMinecraftCompound(Object raw) { - if (!(raw instanceof NBTTagCompound)) { - return null; - } - NBTTagCompound compound = (NBTTagCompound) raw; - NbtCompound output = new NbtCompound(); - if (compound.isEmpty()) { - return output; - } - Set keys = compound.getKeys(); - for (String key : keys) { - output.set(key, fromMinecraftTag(compound.get(key))); - } - return output; - } - - @Override - public org.bukkit.inventory.ItemStack itemFromCompound(NbtCompound compound) { - return CraftItemStack.asBukkitCopy(ItemStack.a(toMinecraftCompound(compound))); - } - - @Override - public NbtCompound itemToCompound(org.bukkit.inventory.ItemStack itemStack) { - return fromMinecraftCompound(CraftItemStack.asNMSCopy(itemStack).getOrCreateTag()); - } - - @Override - public WrappedContext createContext(DataAdapterContext context) { - return new BukkitContext1_16_R1(context); - } - - @Override - public WrapType wrap(DataType dataType) { - return new BukkitType1_16_R1<>(dataType); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/EntityProvider1_16_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/EntityProvider1_16_R1.java deleted file mode 100644 index f8c37ce..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/EntityProvider1_16_R1.java +++ /dev/null @@ -1,47 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R1; - -import java.util.EnumMap; -import java.util.function.Function; - -import org.bukkit.craftbukkit.v1_16_R1.CraftWorld; - -import net.minecraft.server.v1_16_R1.World; -import net.sourcewriters.minecraft.vcompat.reflection.EntityProvider; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R1.utils.EntityConstructors1_16_R1; - -public class EntityProvider1_16_R1 extends EntityProvider { - - private final EnumMap> entityMap = new EnumMap<>(NmsEntityType.class); - - protected EntityProvider1_16_R1(VersionControl1_16_R1 versionControl) { - super(versionControl); - } - - @SuppressWarnings("unchecked") - private final Function searchConstructor(NmsEntityType type) { - try { - return (Function) EntityConstructors1_16_R1.class.getField(type.name()).get(null); - } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException ignore) { - return null; - } - } - - private final Function getConstructor(NmsEntityType type) { - return entityMap.computeIfAbsent(type, (key -> searchConstructor(key))); - } - - @Override - public NmsEntity createEntity(org.bukkit.World world, NmsEntityType type) { - if (!(world instanceof CraftWorld)) { - return null; - } - Function function; - if ((function = getConstructor(type)) == null) { - return null; - } - return function.apply(((CraftWorld) world).getHandle()); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/PacketHandler1_16_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/PacketHandler1_16_R1.java deleted file mode 100644 index 6b0ec00..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/PacketHandler1_16_R1.java +++ /dev/null @@ -1,11 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R1; - -import net.sourcewriters.minecraft.vcompat.reflection.PacketHandler; - -public class PacketHandler1_16_R1 extends PacketHandler { - - protected PacketHandler1_16_R1(VersionControl1_16_R1 versionControl) { - super(versionControl); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/PlayerProvider1_16_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/PlayerProvider1_16_R1.java deleted file mode 100644 index e51bb5f..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/PlayerProvider1_16_R1.java +++ /dev/null @@ -1,20 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R1; - -import org.bukkit.entity.Player; - -import net.sourcewriters.minecraft.vcompat.reflection.PlayerProvider; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R1.entity.Player1_16_R1; - -public class PlayerProvider1_16_R1 extends PlayerProvider { - - protected PlayerProvider1_16_R1(VersionControl1_16_R1 versionControl) { - super(versionControl); - } - - @Override - protected NmsPlayer createPlayer(Player player) { - return new Player1_16_R1(player); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/TextureProvider1_16_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/TextureProvider1_16_R1.java deleted file mode 100644 index 95055de..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/TextureProvider1_16_R1.java +++ /dev/null @@ -1,102 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R1; - -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_16_R1.block.CraftBlockEntityState; -import org.bukkit.craftbukkit.v1_16_R1.block.CraftSkull; -import org.bukkit.craftbukkit.v1_16_R1.inventory.CraftItemStack; -import org.bukkit.inventory.meta.ItemMeta; -import org.bukkit.inventory.meta.SkullMeta; - -import com.mojang.authlib.GameProfile; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; - -import net.minecraft.server.v1_16_R1.GameProfileSerializer; -import net.minecraft.server.v1_16_R1.ItemStack; -import net.minecraft.server.v1_16_R1.NBTTagCompound; -import net.minecraft.server.v1_16_R1.TileEntitySkull; -import net.sourcewriters.minecraft.vcompat.reflection.TextureProvider; - -public class TextureProvider1_16_R1 extends TextureProvider { - - private final AbstractReflect craftEntityStateRef = new Reflect(CraftBlockEntityState.class).searchField("tileEntity", "tileEntity"); - private final AbstractReflect craftItemStackRef = new Reflect(CraftItemStack.class).searchField("handle", "handle"); - private final AbstractReflect craftMetaSkullRef = new Reflect("org.bukkit.craftbukkit.v1_16_R1.inventory.CraftMetaSkull") - .searchField("serialized", "serializedProfile").searchField("profile", "profile"); - - protected TextureProvider1_16_R1(VersionControl1_16_R1 versionControl) { - super(versionControl); - } - - @Override - public GameProfile profileFromBlock(Block block) { - if (!(block instanceof CraftSkull)) { - return null; - } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); - return entitySkull.gameProfile; - } - - @Override - public GameProfile profileFromItem(org.bukkit.inventory.ItemStack itemStack) { - if (!(itemStack.getItemMeta() instanceof SkullMeta)) { - return null; - } - SkullMeta meta = (SkullMeta) itemStack.getItemMeta(); - GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue("profile", meta); - if (profile == null) { - NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue("serialized", meta); - if (compound == null) { - ItemStack stack = null; - if (itemStack instanceof CraftItemStack) { - stack = (ItemStack) craftItemStackRef.getFieldValue("handle", itemStack); - } - if (stack == null) { - stack = CraftItemStack.asNMSCopy(itemStack); - } - NBTTagCompound stackTag = stack.getOrCreateTag(); - if (stackTag.hasKeyOfType("SkullOwner", 10)) { - compound = stackTag.getCompound("SkullOwner"); - } else if (stackTag.hasKeyOfType("SkullProfile", 10)) { - compound = stackTag.getCompound("SkullProfile"); - } - } - if (compound == null) { - return null; - } - profile = GameProfileSerializer.deserialize(compound); - } - return profile; - } - - @Override - public org.bukkit.inventory.ItemStack getItem(GameProfile profile) { - org.bukkit.inventory.ItemStack craftStack = CraftItemStack.asCraftCopy(new org.bukkit.inventory.ItemStack(Material.PLAYER_HEAD)); - applyItem(craftStack, profile); - return craftStack; - } - - @Override - public boolean applyItem(org.bukkit.inventory.ItemStack itemStack, GameProfile profile) { - ItemMeta meta = itemStack.getItemMeta(); - if (!(meta instanceof SkullMeta)) { - return false; - } - SkullMeta skullMeta = (SkullMeta) meta; - craftMetaSkullRef.setFieldValue(meta, "profile", profile); - itemStack.setItemMeta(skullMeta); - return true; - } - - @Override - public boolean applyBlock(Block block, GameProfile profile) { - if (!(block instanceof CraftSkull)) { - return false; - } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); - entitySkull.setGameProfile(profile); - return true; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/ToolProvider1_16_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/ToolProvider1_16_R1.java deleted file mode 100644 index 464f2cc..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/ToolProvider1_16_R1.java +++ /dev/null @@ -1,33 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R1; - -import net.sourcewriters.minecraft.vcompat.reflection.ToolProvider; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R1.tools.BlockTools1_16_R1; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R1.tools.ServerTools1_16_R1; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R1.tools.SkinTools1_16_R1; - -public class ToolProvider1_16_R1 extends ToolProvider { - - private final BlockTools1_16_R1 blockTools = new BlockTools1_16_R1(); - private final SkinTools1_16_R1 skinTools = new SkinTools1_16_R1(); - private final ServerTools1_16_R1 serverTools = new ServerTools1_16_R1(); - - protected ToolProvider1_16_R1(VersionControl1_16_R1 versionControl) { - super(versionControl); - } - - @Override - public SkinTools1_16_R1 getSkinTools() { - return skinTools; - } - - @Override - public ServerTools1_16_R1 getServerTools() { - return serverTools; - } - - @Override - public BlockTools1_16_R1 getBlockTools() { - return blockTools; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/VersionControl1_16_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/VersionControl1_16_R1.java deleted file mode 100644 index f154084..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/VersionControl1_16_R1.java +++ /dev/null @@ -1,61 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R1; - -import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R1.data.hook.BukkitContainerAdapterHook1_16_R1; - -public class VersionControl1_16_R1 extends VersionControl { - - public static VersionControl1_16_R1 INSTANCE; - - public static VersionControl1_16_R1 init() { - return INSTANCE != null ? INSTANCE : (INSTANCE = new VersionControl1_16_R1()); - } - - private final ToolProvider1_16_R1 toolProvider = new ToolProvider1_16_R1(this); - private final TextureProvider1_16_R1 textureProvider = new TextureProvider1_16_R1(this); - private final PacketHandler1_16_R1 packetHandler = new PacketHandler1_16_R1(this); - private final EntityProvider1_16_R1 entityProvider = new EntityProvider1_16_R1(this); - private final PlayerProvider1_16_R1 playerProvider = new PlayerProvider1_16_R1(this); - private final BukkitConversion1_16_R1 bukkitConversion = new BukkitConversion1_16_R1(this); - - private VersionControl1_16_R1() { - BukkitContainerAdapterHook1_16_R1.hookEntity(); - } - - @Override - public ToolProvider1_16_R1 getToolProvider() { - return toolProvider; - } - - @Override - public EntityProvider1_16_R1 getEntityProvider() { - return entityProvider; - } - - @Override - public PlayerProvider1_16_R1 getPlayerProvider() { - return playerProvider; - } - - @Override - public TextureProvider1_16_R1 getTextureProvider() { - return textureProvider; - } - - @Override - public PacketHandler1_16_R1 getPacketHandler() { - return packetHandler; - } - - @Override - public BukkitConversion1_16_R1 getBukkitConversion() { - return bukkitConversion; - } - - @Override - public void shutdown() { - dataProvider.getDefaultDistributor().shutdown(); - BukkitContainerAdapterHook1_16_R1.unhookAll(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/data/BukkitContainer1_16_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/data/BukkitContainer1_16_R1.java deleted file mode 100644 index bd7d1c2..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/data/BukkitContainer1_16_R1.java +++ /dev/null @@ -1,161 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R1.data; - -import java.util.Arrays; -import java.util.Optional; -import java.util.Set; -import java.util.stream.Collectors; - -import org.bukkit.NamespacedKey; -import org.bukkit.persistence.PersistentDataAdapterContext; -import org.bukkit.persistence.PersistentDataContainer; -import org.bukkit.persistence.PersistentDataType; - -import com.syntaxphoenix.syntaxapi.data.IDataContainer; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SyntaxKey; - -public final class BukkitContainer1_16_R1 extends WrappedContainer implements PersistentDataContainer { - - private final IDataContainer container; - - public BukkitContainer1_16_R1(IDataContainer container) { - this.container = container; - } - - @Override - public IDataContainer getHandle() { - return container; - } - - @Override - public IDataContainer getAsSyntaxContainer() { - return container; - } - - /* - * - */ - - @Override - public boolean has(NamespacedKey key, PersistentDataType type) { - return has(new BukkitKey1_16_R1(key), WrappedType1_16_R1.wrap(type)); - } - - @Override - public Z get(NamespacedKey key, PersistentDataType type) { - return get(new BukkitKey1_16_R1(key), WrappedType1_16_R1.wrap(type)); - } - - @Override - public Z getOrDefault(NamespacedKey key, PersistentDataType type, Z value) { - return Optional.ofNullable(get(key, type)).orElse(value); - } - - @Override - public void set(NamespacedKey key, PersistentDataType type, Z value) { - set(new BukkitKey1_16_R1(key), value, WrappedType1_16_R1.wrap(type)); - } - - @Override - public void remove(NamespacedKey key) { - remove(new BukkitKey1_16_R1(key)); - } - - @Override - public Set getKeys() { - return Arrays.stream(container.getKeys()).map(SyntaxKey::new).map(BukkitKey1_16_R1::asBukkit).collect(Collectors.toSet()); - } - - @Override - public PersistentDataAdapterContext getAdapterContext() { - return getContext(); - } - - /* - * - */ - - @Override - public BukkitContext1_16_R1 getContext() { - return new BukkitContext1_16_R1(container.getAdapterContext()); - } - - @Override - public boolean has(String key) { - return has(wrappedKey(key)); - } - - @Override - public boolean has(WrappedKey key) { - return container.has(key.getNamespacedKey()); - } - - @Override - public boolean has(String key, WrapType type) { - return has(wrappedKey(key), type); - } - - @Override - public boolean has(WrappedKey key, WrapType type) { - return container.has(key.getNamespacedKey(), type.syntaxType()); - } - - @Override - public Object get(String key) { - return get(wrappedKey(key)); - } - - @Override - public Object get(WrappedKey key) { - return container.get(key.getNamespacedKey()); - } - - @Override - public C get(String key, WrapType type) { - return get(wrappedKey(key), type); - } - - @Override - public C get(WrappedKey key, WrapType type) { - return container.get(key.getNamespacedKey(), type.syntaxType()); - } - - @Override - public void set(String key, B value, WrapType type) { - set(wrappedKey(key), value, type); - } - - @Override - public void set(WrappedKey key, B value, WrapType type) { - container.set(key.getNamespacedKey(), value, type.syntaxType()); - } - - @Override - public boolean remove(String key) { - return false; - } - - @Override - public boolean remove(WrappedKey key) { - return container.remove(key.getNamespacedKey()); - } - - @Override - public Set keySet() { - return container.getKeyspaces(); - } - - @Override - public boolean isEmpty() { - return container.isEmpty(); - } - - @Override - public int size() { - return container.size(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/data/BukkitContext1_16_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/data/BukkitContext1_16_R1.java deleted file mode 100644 index 56b88d3..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/data/BukkitContext1_16_R1.java +++ /dev/null @@ -1,39 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R1.data; - -import org.bukkit.persistence.PersistentDataAdapterContext; -import org.bukkit.persistence.PersistentDataContainer; - -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.IDataContainer; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; - -public final class BukkitContext1_16_R1 extends WrappedContext implements PersistentDataAdapterContext { - - private final DataAdapterContext context; - - public BukkitContext1_16_R1(DataAdapterContext context) { - this.context = context; - } - - @Override - public DataAdapterContext getHandle() { - return context; - } - - @Override - public PersistentDataContainer newPersistentDataContainer() { - return newContainer(); - } - - @Override - public IDataContainer newDataContainer() { - return context.newDataContainer(); - } - - @Override - public BukkitContainer1_16_R1 newContainer() { - return new BukkitContainer1_16_R1(context.newDataContainer()); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/data/BukkitKey1_16_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/data/BukkitKey1_16_R1.java deleted file mode 100644 index c965caf..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/data/BukkitKey1_16_R1.java +++ /dev/null @@ -1,52 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R1.data; - -import org.bukkit.NamespacedKey; -import org.bukkit.plugin.Plugin; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; - -public final class BukkitKey1_16_R1 extends WrappedKey { - - private final NamespacedKey key; - - public BukkitKey1_16_R1(Plugin plugin, String key) { - this.key = new NamespacedKey(plugin, key); - } - - @SuppressWarnings("deprecation") - public BukkitKey1_16_R1(String name, String key) { - this.key = new NamespacedKey(name, key); - } - - public BukkitKey1_16_R1(NamespacedKey key) { - this.key = key; - } - - @Override - public NamespacedKey getHandle() { - return key; - } - - @Override - public String getName() { - return key.getNamespace(); - } - - @Override - public String getKey() { - return key.getKey(); - } - - @Override - public String toString() { - return key.toString(); - } - - public static NamespacedKey asBukkit(WrappedKey key) { - if (key.getHandle() instanceof NamespacedKey) { - return (NamespacedKey) key.getHandle(); - } - return new BukkitKey1_16_R1(key.getName(), key.getKey()).getHandle(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/data/BukkitType1_16_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/data/BukkitType1_16_R1.java deleted file mode 100644 index c7e397a..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/data/BukkitType1_16_R1.java +++ /dev/null @@ -1,69 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R1.data; - -import org.bukkit.persistence.PersistentDataAdapterContext; -import org.bukkit.persistence.PersistentDataType; - -import com.syntaxphoenix.syntaxapi.data.DataType; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; - -public class BukkitType1_16_R1 extends WrappedType1_16_R1, P0, P1, C0, C1> - implements PersistentDataType { - - private final DataType type; - - public BukkitType1_16_R1(DataType type) { - super(type.getPrimitive(), type.getComplex()); - this.type = type; - } - - @Override - public DataType getHandle() { - return type; - } - - @Override - public Class getPrimitiveOriginal() { - return type.getPrimitive(); - } - - @Override - public Class getComplexOriginal() { - return type.getComplex(); - } - - /* - * - */ - - @Override - public Class getComplexType() { - return complexType; - } - - @Override - public Class getPrimitiveType() { - return primitiveType; - } - - @Override - public P0 toPrimitive(C0 complex, PersistentDataAdapterContext context) { - return wrapToPrimitive(complex, new SyntaxContext1_16_R1(context)); - } - - @Override - public C0 fromPrimitive(P0 primitive, PersistentDataAdapterContext context) { - return wrapToComplex(primitive, new SyntaxContext1_16_R1(context)); - } - - @Override - public P0 wrapToPrimitive(C0 complex, WrappedContext context) { - return toPrimitiveWrapped(type.toPrimitive(context, toComplexOriginal(complex))); - } - - @Override - public C0 wrapToComplex(P0 primitive, WrappedContext context) { - return toComplexWrapped(type.fromPrimitive(context, toPrimitiveOriginal(primitive))); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/data/SimpleBukkitType1_16_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/data/SimpleBukkitType1_16_R1.java deleted file mode 100644 index 10f7b95..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/data/SimpleBukkitType1_16_R1.java +++ /dev/null @@ -1,36 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R1.data; - -import org.bukkit.persistence.PersistentDataAdapterContext; -import org.bukkit.persistence.PersistentDataType; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; - -public class SimpleBukkitType1_16_R1 implements PersistentDataType { - - private final WrapType type; - - public SimpleBukkitType1_16_R1(WrapType type) { - this.type = type; - } - - @Override - public Class getComplexType() { - return type.getComplexWrapped(); - } - - @Override - public Class

getPrimitiveType() { - return type.getPrimitiveWrapped(); - } - - @Override - public P toPrimitive(C complex, PersistentDataAdapterContext context) { - return type.wrapToPrimitive(complex, new SyntaxContext1_16_R1(context)); - } - - @Override - public C fromPrimitive(P primitive, PersistentDataAdapterContext context) { - return type.wrapToComplex(primitive, new SyntaxContext1_16_R1(context)); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/data/SyntaxContainer1_16_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/data/SyntaxContainer1_16_R1.java deleted file mode 100644 index 162ca03..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/data/SyntaxContainer1_16_R1.java +++ /dev/null @@ -1,185 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R1.data; - -import java.util.Set; -import java.util.stream.Collectors; - -import org.bukkit.persistence.PersistentDataContainer; - -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.data.IDataContainer; -import com.syntaxphoenix.syntaxapi.utils.key.IKey; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SyntaxKey; - -public final class SyntaxContainer1_16_R1 extends WrappedContainer implements IDataContainer { - - private final PersistentDataContainer container; - - public SyntaxContainer1_16_R1(PersistentDataContainer container) { - this.container = container; - } - - @Override - public PersistentDataContainer getHandle() { - return container; - } - - @Override - public IDataContainer getAsSyntaxContainer() { - return new SyntaxContainer1_16_R1(container); - } - - /* - * - */ - - @Override - public boolean has(IKey key) { - throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); - } - - @Override - public boolean has(String key, DataType type) { - return has(syntaxKey(key), type); - } - - @Override - public boolean has(IKey key, DataType type) { - return has(new SyntaxKey(key), WrappedType1_16_R1.wrap(type)); - } - - @Override - public C get(String key, DataType type) { - return get(syntaxKey(key), type); - } - - @Override - public C get(IKey key, DataType type) { - return get(new SyntaxKey(key), WrappedType1_16_R1.wrap(type)); - } - - @Override - public Object get(String key) { - throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); - } - - @Override - public Object get(IKey key) { - throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); - } - - @Override - public void set(String key, E value, DataType type) { - set(wrappedKey(key), value, WrappedType1_16_R1.wrap(type)); - } - - @Override - public void set(IKey key, E value, DataType type) { - set(new SyntaxKey(key), value, WrappedType1_16_R1.wrap(type)); - } - - @Override - public boolean remove(String key) { - return remove(wrappedKey(key)); - } - - @Override - public boolean remove(IKey key) { - return remove(new SyntaxKey(key)); - } - - @Override - public IKey[] getKeys() { - return container.getKeys().stream().map(BukkitKey1_16_R1::new).map(WrappedKey::getNamespacedKey).toArray(IKey[]::new); - } - - @Override - public Set getKeyspaces() { - return container.getKeys().stream().map(org.bukkit.NamespacedKey::toString).collect(Collectors.toSet()); - } - - @Override - public DataAdapterContext getAdapterContext() { - return getContext(); - } - - /* - * - */ - - @Override - public SyntaxContext1_16_R1 getContext() { - return new SyntaxContext1_16_R1(container.getAdapterContext()); - } - - @Override - public boolean has(String key) { - throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); - } - - @Override - public boolean has(WrappedKey key) { - throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); - } - - @Override - public boolean has(String key, WrapType type) { - return has(wrappedKey(key), type); - } - - @Override - public boolean has(WrappedKey key, WrapType type) { - return container.has(BukkitKey1_16_R1.asBukkit(key), new SimpleBukkitType1_16_R1<>(type)); - } - - @Override - public Object get(WrappedKey key) { - throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); - } - - @Override - public C get(String key, WrapType type) { - return get(wrappedKey(key), type); - } - - @Override - public C get(WrappedKey key, WrapType type) { - return container.get(BukkitKey1_16_R1.asBukkit(key), new SimpleBukkitType1_16_R1<>(type)); - } - - @Override - public void set(String key, B value, WrapType type) { - set(wrappedKey(key), value, type); - } - - @Override - public void set(WrappedKey key, B value, WrapType type) { - container.set(BukkitKey1_16_R1.asBukkit(key), new SimpleBukkitType1_16_R1<>(type), value); - } - - @Override - public boolean remove(WrappedKey key) { - container.remove(BukkitKey1_16_R1.asBukkit(key)); - return true; // Will always return true as we don't know if it contained it - } - - @Override - public Set keySet() { - return getKeyspaces(); - } - - @Override - public boolean isEmpty() { - return container.isEmpty(); - } - - @Override - public int size() { - return container.getKeys().size(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/data/SyntaxContext1_16_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/data/SyntaxContext1_16_R1.java deleted file mode 100644 index 8d544d1..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/data/SyntaxContext1_16_R1.java +++ /dev/null @@ -1,38 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R1.data; - -import org.bukkit.persistence.PersistentDataAdapterContext; -import org.bukkit.persistence.PersistentDataContainer; - -import com.syntaxphoenix.syntaxapi.data.IDataContainer; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; - -public final class SyntaxContext1_16_R1 extends WrappedContext implements PersistentDataAdapterContext { - - private final PersistentDataAdapterContext context; - - public SyntaxContext1_16_R1(PersistentDataAdapterContext context) { - this.context = context; - } - - @Override - public PersistentDataAdapterContext getHandle() { - return context; - } - - @Override - public PersistentDataContainer newPersistentDataContainer() { - return context.newPersistentDataContainer(); - } - - @Override - public IDataContainer newDataContainer() { - return newContainer(); - } - - @Override - public SyntaxContainer1_16_R1 newContainer() { - return new SyntaxContainer1_16_R1(context.newPersistentDataContainer()); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/data/SyntaxType1_16_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/data/SyntaxType1_16_R1.java deleted file mode 100644 index 6a5c2b3..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/data/SyntaxType1_16_R1.java +++ /dev/null @@ -1,76 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R1.data; - -import org.bukkit.persistence.PersistentDataAdapterContext; -import org.bukkit.persistence.PersistentDataType; - -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; - -public class SyntaxType1_16_R1 extends WrappedType1_16_R1, P0, P1, C0, C1> - implements DataType { - - private final PersistentDataType type; - - public SyntaxType1_16_R1(PersistentDataType type) { - super(type.getPrimitiveType(), type.getComplexType()); - this.type = type; - } - - @Override - public PersistentDataType getHandle() { - return type; - } - - @Override - public Class getPrimitiveOriginal() { - return type.getPrimitiveType(); - } - - @Override - public Class getComplexOriginal() { - return type.getComplexType(); - } - - /* - * - */ - - @Override - public Class getComplex() { - return complexType; - } - - @Override - public Class getPrimitive() { - return primitiveType; - } - - @Override - public P0 toPrimitive(DataAdapterContext context, C0 complex) { - return wrapToPrimitive(complex, new BukkitContext1_16_R1(context)); - } - - @Override - public C0 fromPrimitive(DataAdapterContext context, P0 primitive) { - return wrapToComplex(primitive, new BukkitContext1_16_R1(context)); - } - - @Override - public P0 wrapToPrimitive(C0 complex, WrappedContext context) { - if (!(context instanceof PersistentDataAdapterContext)) { - return null; - } - return toPrimitiveWrapped(type.toPrimitive(toComplexOriginal(complex), (PersistentDataAdapterContext) context)); - } - - @Override - public C0 wrapToComplex(P0 primitive, WrappedContext context) { - if (!(context instanceof PersistentDataAdapterContext)) { - return null; - } - return toComplexWrapped(type.fromPrimitive(toPrimitiveOriginal(primitive), (PersistentDataAdapterContext) context)); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/data/WrappedType1_16_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/data/WrappedType1_16_R1.java deleted file mode 100644 index 6e8da6a..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/data/WrappedType1_16_R1.java +++ /dev/null @@ -1,150 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R1.data; - -import java.util.Arrays; - -import org.bukkit.persistence.PersistentDataContainer; -import org.bukkit.persistence.PersistentDataType; - -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.data.IDataContainer; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; - -public abstract class WrappedType1_16_R1 implements WrapType { - - protected final Class primitiveType; - protected final Class complexType; - - private final int primitiveWrap; - private final int complexWrap; - - @SuppressWarnings("unchecked") - protected WrappedType1_16_R1(Class primitive, Class complex) { - this.primitiveWrap = WrappedType1_16_R1.internalState(primitive); - this.complexWrap = WrappedType1_16_R1.internalState(complex); - this.primitiveType = (Class) WrappedType1_16_R1.internalWrap(primitive, primitiveWrap); - this.complexType = (Class) WrappedType1_16_R1.internalWrap(complex, complexWrap); - } - - public abstract H getHandle(); - - public Class getPrimitiveWrapped() { - return primitiveType; - } - - public Class getComplexWrapped() { - return complexType; - } - - public abstract Class getPrimitiveOriginal(); - - public abstract Class getComplexOriginal(); - - @SuppressWarnings("unchecked") - public P0 toPrimitiveWrapped(P1 primitive) { - switch (primitiveWrap) { - case 1: - return (P0) new SyntaxContainer1_16_R1((PersistentDataContainer) primitive); - case 2: - return (P0) Arrays.stream((PersistentDataContainer[]) primitive).map(SyntaxContainer1_16_R1::new) - .toArray(SyntaxContainer1_16_R1[]::new); - case 3: - return (P0) new BukkitContainer1_16_R1((IDataContainer) primitive); - case 4: - return (P0) Arrays.stream((IDataContainer[]) primitive).map(BukkitContainer1_16_R1::new) - .toArray(BukkitContainer1_16_R1[]::new); - default: - return (P0) primitive; - } - } - - @SuppressWarnings("unchecked") - public C0 toComplexWrapped(C1 complex) { - switch (complexWrap) { - case 1: - return (C0) new SyntaxContainer1_16_R1((PersistentDataContainer) complex); - case 2: - return (C0) Arrays.stream((PersistentDataContainer[]) complex).map(SyntaxContainer1_16_R1::new).toArray(SyntaxContainer1_16_R1[]::new); - case 3: - return (C0) new BukkitContainer1_16_R1((IDataContainer) complex); - case 4: - return (C0) Arrays.stream((IDataContainer[]) complex).map(BukkitContainer1_16_R1::new).toArray(BukkitContainer1_16_R1[]::new); - default: - return (C0) complex; - } - } - - @SuppressWarnings("unchecked") - public P1 toPrimitiveOriginal(P0 primitive) { - switch (primitiveWrap) { - case 1: - return (P1) new BukkitContainer1_16_R1((IDataContainer) primitive); - case 2: - return (P1) Arrays.stream((IDataContainer[]) primitive).map(BukkitContainer1_16_R1::new) - .toArray(BukkitContainer1_16_R1[]::new); - case 3: - return (P1) new SyntaxContainer1_16_R1((PersistentDataContainer) primitive); - case 4: - return (P1) Arrays.stream((PersistentDataContainer[]) primitive).map(SyntaxContainer1_16_R1::new) - .toArray(SyntaxContainer1_16_R1[]::new); - default: - return (P1) primitive; - } - } - - @SuppressWarnings("unchecked") - public C1 toComplexOriginal(C0 complex) { - switch (complexWrap) { - case 1: - return (C1) new BukkitContainer1_16_R1((IDataContainer) complex); - case 2: - return (C1) Arrays.stream((IDataContainer[]) complex).map(BukkitContainer1_16_R1::new).toArray(BukkitContainer1_16_R1[]::new); - case 3: - return (C1) new SyntaxContainer1_16_R1((PersistentDataContainer) complex); - case 4: - return (C1) Arrays.stream((PersistentDataContainer[]) complex).map(SyntaxContainer1_16_R1::new).toArray(SyntaxContainer1_16_R1[]::new); - default: - return (C1) complex; - } - } - - protected static Class internalWrap(Class clazz, int state) { - switch (state) { - case 1: - return SyntaxContainer1_16_R1.class; - case 2: - return SyntaxContainer1_16_R1[].class; - case 3: - return BukkitContainer1_16_R1.class; - case 4: - return BukkitContainer1_16_R1[].class; - default: - return clazz; - } - } - - protected static int internalState(Class clazz) { - if (clazz.isAssignableFrom(PersistentDataContainer.class)) { - return 1; - } - if (clazz.isAssignableFrom(PersistentDataContainer[].class)) { - return 2; - } - if (clazz.isAssignableFrom(IDataContainer.class)) { - return 3; - } - if (clazz.isAssignableFrom(IDataContainer[].class)) { - return 4; - } - return 0; - } - - public static BukkitType1_16_R1 wrap(DataType type) { - return new BukkitType1_16_R1<>(type); - } - - public static SyntaxType1_16_R1 wrap(PersistentDataType type) { - return new SyntaxType1_16_R1<>(type); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/data/hook/BukkitContainerAdapterHook1_16_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/data/hook/BukkitContainerAdapterHook1_16_R1.java deleted file mode 100644 index e9e404e..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/data/hook/BukkitContainerAdapterHook1_16_R1.java +++ /dev/null @@ -1,134 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R1.data.hook; - -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; - -import org.bukkit.craftbukkit.v1_16_R1.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_16_R1.persistence.CraftPersistentDataContainer; -import org.bukkit.craftbukkit.v1_16_R1.persistence.CraftPersistentDataTypeRegistry; -import org.bukkit.persistence.PersistentDataContainer; - -import com.syntaxphoenix.syntaxapi.data.IDataContainer; -import com.syntaxphoenix.syntaxapi.data.container.nbt.NbtContainer; -import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; - -import net.minecraft.server.v1_16_R1.NBTTagCompound; -import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R1.data.BukkitContainer1_16_R1; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R1.data.SyntaxContainer1_16_R1; - -@SuppressWarnings({ - "rawtypes", - "unchecked" -}) -public final class BukkitContainerAdapterHook1_16_R1 { - - private static final BukkitContainerAdapterHook1_16_R1 HOOK = new BukkitContainerAdapterHook1_16_R1(); - - private final AbstractReflect registryRef = new Reflect(CraftPersistentDataTypeRegistry.class) - .searchMethod("create", "createAdapter", Class.class, Class.class, Function.class, Function.class) - .searchField("adapters", "adapters") - .searchField("function", "CREATE_ADAPTER"); - private final AbstractReflect entityRef = new Reflect(CraftEntity.class).searchField("registry", "DATA_TYPE_REGISTRY"); - - private BukkitContainerAdapterHook1_16_R1() {} - - private final HashMap map = new HashMap<>(); - - private CraftPersistentDataTypeRegistry getEntityRegistry() { - return (CraftPersistentDataTypeRegistry) entityRef.getFieldValue("registry"); - } - - private void uninjectAll() { - for (CraftPersistentDataTypeRegistry registry : map.keySet()) { - Map adapters = (Map) registryRef.getFieldValue("adapters", registry); - adapters.remove(BukkitContainer1_16_R1.class); - adapters.remove(SyntaxContainer1_16_R1.class); - registryRef.setFieldValue(registry, "function", map.get(registry)); - } - map.clear(); - } - - private void inject(CraftPersistentDataTypeRegistry registry) { - if (map.containsKey(registry)) { - return; - } - map.put(registry, (Function) registryRef.getFieldValue("function", registry)); - Function function = clazz -> createAdapter(registry, registryRef.getMethod("create").getReturnType(), (Class) clazz); - registryRef.setFieldValue(registry, "function", function); - } - - private E createAdapter(CraftPersistentDataTypeRegistry registry, Class adapterType, Class type) { - if (Objects.equals(BukkitContainer1_16_R1.class, type)) { - return (E) buildAdapter(registry, BukkitContainer1_16_R1.class, tag -> fromPrimitiveSyntax(tag)); - } - if (Objects.equals(SyntaxContainer1_16_R1.class, type)) { - return (E) buildAdapter(registry, SyntaxContainer1_16_R1.class, tag -> fromPrimitiveBukkit(registry, tag)); - } - return (E) map.get(registry).apply(type); - } - - private Object buildAdapter(Object handle, Class type, Function function) { - return registryRef.run(handle, "create", type, NBTTagCompound.class, (Function) input -> toPrimitive(input), - function); - } - - private NBTTagCompound toPrimitive(WrappedContainer input) { - Object handle = findFinalContainer(input).getHandle(); - if (handle instanceof PersistentDataContainer) { - if (handle instanceof CraftPersistentDataContainer) { - return ((CraftPersistentDataContainer) handle).toTagCompound(); - } - throw new IllegalArgumentException( - "Expected 'CraftPersistentDataContainer' got '" + handle.getClass().getSimpleName() + " instead'!"); - } - if (handle instanceof IDataContainer) { - if (handle instanceof NbtContainer) { - return (NBTTagCompound) VersionControl.get().getBukkitConversion().toMinecraftCompound(((NbtContainer) handle).asNbt()); - } - throw new IllegalArgumentException( - "Expected 'CraftPersistentDataContainer' got '" + handle.getClass().getSimpleName() + " instead'!"); - } - throw new IllegalArgumentException("Unknown WrappedContainer implementation!"); - } - - private BukkitContainer1_16_R1 fromPrimitiveSyntax(NBTTagCompound data) { - VersionControl control = VersionControl.get(); - NbtContainer container = new NbtContainer(control.getDataProvider().getRegistry()); - NbtCompound compound = control.getBukkitConversion().fromMinecraftCompound(data); - container.fromNbt(compound); - return new BukkitContainer1_16_R1(container); - } - - private SyntaxContainer1_16_R1 fromPrimitiveBukkit(CraftPersistentDataTypeRegistry registry, NBTTagCompound data) { - CraftPersistentDataContainer container = new CraftPersistentDataContainer(registry); - container.putAll(data); - return new SyntaxContainer1_16_R1(container); - } - - private WrappedContainer findFinalContainer(WrappedContainer container) { - WrappedContainer output = container; - while (output.getHandle() instanceof WrappedContainer) { - output = (WrappedContainer) output.getHandle(); - } - return output; - } - - public static void unhookAll() { - HOOK.uninjectAll(); - } - - public static void hookEntity() { - HOOK.inject(HOOK.getEntityRegistry()); - } - - public static void hook(CraftPersistentDataTypeRegistry registry) { - HOOK.inject(registry); - } - -} diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/entity/ArmorStand1_16_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/entity/ArmorStand1_16_R1.java deleted file mode 100644 index 677ca44..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/entity/ArmorStand1_16_R1.java +++ /dev/null @@ -1,24 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R1.entity; - -import net.minecraft.server.v1_16_R1.EntityArmorStand; -import net.minecraft.server.v1_16_R1.EntityTypes; -import net.minecraft.server.v1_16_R1.World; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsArmorStand; - -public class ArmorStand1_16_R1 extends EntityLiving1_16_R1 implements NmsArmorStand { - - public ArmorStand1_16_R1(World world) { - super(new EntityArmorStand(EntityTypes.ARMOR_STAND, world)); - } - - @Override - public void setSmall(boolean small) { - handle.setSmall(small); - } - - @Override - public boolean isSmall() { - return handle.isSmall(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/entity/Entity1_16_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/entity/Entity1_16_R1.java deleted file mode 100644 index 0365a06..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/entity/Entity1_16_R1.java +++ /dev/null @@ -1,215 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R1.entity; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.OfflinePlayer; -import org.bukkit.craftbukkit.v1_16_R1.CraftWorld; -import org.bukkit.craftbukkit.v1_16_R1.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_16_R1.util.CraftChatMessage; -import org.bukkit.entity.Player; - -import net.minecraft.server.v1_16_R1.AxisAlignedBB; -import net.minecraft.server.v1_16_R1.Entity; -import net.minecraft.server.v1_16_R1.PacketPlayOutEntityDestroy; -import net.minecraft.server.v1_16_R1.PacketPlayOutEntityMetadata; -import net.minecraft.server.v1_16_R1.PacketPlayOutSpawnEntity; -import net.minecraft.server.v1_16_R1.PlayerConnection; -import net.minecraft.server.v1_16_R1.Vec3D; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.utils.NmsBoundingBox; - -public abstract class Entity1_16_R1 implements NmsEntity { - - protected final E handle; - - protected final List visible = Collections.synchronizedList(new ArrayList<>()); - - public Entity1_16_R1(E handle) { - this.handle = handle; - } - - @Override - public final E getHandle() { - return handle; - } - - @Override - public int getId() { - return handle.getId(); - } - - @Override - public UUID getUniqueId() { - return handle.getUniqueID(); - } - - @Override - public NmsBoundingBox getBoundingBox() { - AxisAlignedBB box = handle.getBoundingBox(); - return new NmsBoundingBox(box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ); - } - - @Override - public void setCustomName(String name) { - handle.setCustomName(CraftChatMessage.fromStringOrNull(name)); - updateVisibility(); - } - - @Override - public String getCustomName() { - return CraftChatMessage.fromComponent(handle.getCustomName()); - } - - @Override - public void setGravity(boolean gravity) { - handle.setNoGravity(!gravity); - } - - @Override - public boolean hasGravity() { - return !handle.isNoGravity(); - } - - @Override - public void setCustomNameVisible(boolean visible) { - handle.setCustomNameVisible(visible); - } - - @Override - public boolean isCustomNameVisible() { - return handle.getCustomNameVisible(); - } - - @Override - public void setInvisible(boolean invisible) { - handle.setInvisible(invisible); - } - - @Override - public boolean isInvisible() { - return handle.isInvisible(); - } - - @Override - public boolean isInteractable() { - return handle.isInteractable(); - } - - @Override - public boolean isCollidable() { - return handle.isCollidable(); - } - - @Override - public void setInvulnerable(boolean invulnerable) { - handle.setInvulnerable(invulnerable); - } - - @Override - public boolean isInvulnerable() { - return handle.isInvulnerable(); - } - - @Override - public void setLocation(Location location) { - handle.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); - if (location.getWorld() == null || handle.getWorld().getWorld() == location.getWorld()) { - updateVisibility(); - return; - } - handle.world = ((CraftWorld) location.getWorld()).getHandle(); - updateVisibility(); - } - - @Override - public Location getLocation() { - Vec3D vector = handle.getPositionVector(); - return new Location(handle.getWorld().getWorld(), vector.x, vector.y, vector.z); - } - - @Override - public void updateVisibility() { - if (visible.isEmpty()) { - return; - } - Player[] players; - synchronized (visible) { - players = visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) - .toArray(Player[]::new); - } - hide(players); - show(players); - } - - @Override - public boolean isShown(Player player) { - synchronized (visible) { - return visible.contains(player.getUniqueId()); - } - } - - @Override - public void hide(Player... players) { - if (players.length == 0) { - return; - } - PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(handle.getId()); - for (Player player : players) { - if (!isShown(player)) { - continue; - } - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); - synchronized (visible) { - visible.remove(player.getUniqueId()); - } - } - } - - @Override - public void show(Player... players) { - if (players.length == 0) { - return; - } - PacketPlayOutSpawnEntity packet = new PacketPlayOutSpawnEntity(handle); - PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); - PlayerConnection connection; - for (Player player : players) { - if (isShown(player)) { - continue; - } - connection = ((CraftPlayer) player).getHandle().playerConnection; - connection.sendPacket(packet); - connection.sendPacket(metadataPacket); - synchronized (visible) { - visible.add(player.getUniqueId()); - } - } - } - - @Override - public UUID[] getVisible() { - synchronized (visible) { - return visible.toArray(new UUID[0]); - } - } - - @Override - public Player[] getVisibleAsPlayer() { - synchronized (visible) { - return visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) - .toArray(Player[]::new); - } - } - - @Override - public void kill() { - hide(getVisibleAsPlayer()); - handle.die(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/entity/EntityLiving1_16_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/entity/EntityLiving1_16_R1.java deleted file mode 100644 index a551056..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/entity/EntityLiving1_16_R1.java +++ /dev/null @@ -1,17 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R1.entity; - -import net.minecraft.server.v1_16_R1.EntityLiving; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityLiving; - -public abstract class EntityLiving1_16_R1 extends Entity1_16_R1 implements NmsEntityLiving { - - public EntityLiving1_16_R1(E handle) { - super(handle); - } - - @Override - public void setCollidable(boolean collidable) { - handle.collides = collidable; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/entity/Player1_16_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/entity/Player1_16_R1.java deleted file mode 100644 index 76fb05f..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/entity/Player1_16_R1.java +++ /dev/null @@ -1,295 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R1.entity; - -import java.util.ArrayList; -import java.util.Collections; - -import org.bukkit.craftbukkit.v1_16_R1.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_16_R1.util.CraftChatMessage; -import org.bukkit.entity.Player; - -import com.mojang.authlib.GameProfile; -import com.mojang.authlib.properties.Property; -import com.mojang.authlib.properties.PropertyMap; -import com.mojang.datafixers.util.Pair; - -import net.minecraft.server.v1_16_R1.BiomeManager; -import net.minecraft.server.v1_16_R1.EntityPlayer; -import net.minecraft.server.v1_16_R1.EnumItemSlot; -import net.minecraft.server.v1_16_R1.IChatBaseComponent; -import net.minecraft.server.v1_16_R1.ItemStack; -import net.minecraft.server.v1_16_R1.MathHelper; -import net.minecraft.server.v1_16_R1.PacketPlayInClientCommand; -import net.minecraft.server.v1_16_R1.PacketPlayInClientCommand.EnumClientCommand; -import net.minecraft.server.v1_16_R1.PacketPlayOutEntityDestroy; -import net.minecraft.server.v1_16_R1.PacketPlayOutEntityEquipment; -import net.minecraft.server.v1_16_R1.PacketPlayOutEntityHeadRotation; -import net.minecraft.server.v1_16_R1.PacketPlayOutEntityMetadata; -import net.minecraft.server.v1_16_R1.PacketPlayOutEntityStatus; -import net.minecraft.server.v1_16_R1.PacketPlayOutHeldItemSlot; -import net.minecraft.server.v1_16_R1.PacketPlayOutNamedEntitySpawn; -import net.minecraft.server.v1_16_R1.PacketPlayOutPlayerInfo; -import net.minecraft.server.v1_16_R1.PacketPlayOutPlayerInfo.EnumPlayerInfoAction; -import net.minecraft.server.v1_16_R1.PacketPlayOutPlayerListHeaderFooter; -import net.minecraft.server.v1_16_R1.PacketPlayOutPosition; -import net.minecraft.server.v1_16_R1.PacketPlayOutRespawn; -import net.minecraft.server.v1_16_R1.PacketPlayOutTitle; -import net.minecraft.server.v1_16_R1.PacketPlayOutTitle.EnumTitleAction; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.type.SkinDataType; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R1.data.SyntaxContainer1_16_R1; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; -import net.sourcewriters.minecraft.vcompat.utils.bukkit.Players; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.MojangProfileServer; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; -import net.sourcewriters.minecraft.vcompat.utils.thread.PostAsync; -import net.minecraft.server.v1_16_R1.PlayerConnection; -import net.minecraft.server.v1_16_R1.WorldServer; - -public class Player1_16_R1 extends EntityLiving1_16_R1 implements NmsPlayer { - - private String realName; - private Skin realSkin; - - private final WrappedContainer dataAdapter; - - public Player1_16_R1(Player player) { - super(((CraftPlayer) player).getHandle()); - dataAdapter = new SyntaxContainer1_16_R1(getBukkitPlayer().getPersistentDataContainer()); - update(false); - } - - @Override - public CraftPlayer getBukkitPlayer() { - return handle.getBukkitEntity(); - } - - @Override - public WrappedContainer getDataAdapter() { - return dataAdapter; - } - - @Override - public void setSkin(Skin skin) { - if (skin == null) { - return; - } - dataAdapter.set("skin", skin, SkinDataType.WRAPPED_INSTANCE); - } - - @Override - public Skin getSkin() { - return dataAdapter.getOrDefault("skin", SkinDataType.WRAPPED_INSTANCE, realSkin); - } - - @Override - public Skin getRealSkin() { - return realSkin; - } - - @Override - public void setName(String name) { - if (getName().equals(name)) { - return; - } - if (name == null) { - dataAdapter.remove("name"); - return; - } - dataAdapter.set("name", name, WrapType.STRING); - } - - @Override - public String getName() { - return dataAdapter.getOrDefault("name", WrapType.STRING, realName); - } - - @Override - public String getRealName() { - return realName; - } - - @Override - public void setPlayerListHeader(String text) { - setPlayerListHeaderAndFooter(text, getPlayerListFooter()); - } - - @Override - public String getPlayerListHeader() { - return dataAdapter.getOrDefault("header", WrapType.STRING, ""); - } - - @Override - public void setPlayerListFooter(String text) { - setPlayerListHeaderAndFooter(getPlayerListHeader(), text); - } - - @Override - public String getPlayerListFooter() { - return dataAdapter.getOrDefault("footer", WrapType.STRING, ""); - } - - @Override - public int getPing() { - return handle.ping; - } - - @Override - public void setPlayerListHeaderAndFooter(String header, String footer) { - dataAdapter.set("header", header, WrapType.STRING); - dataAdapter.set("footer", footer, WrapType.STRING); - sendPlayerListInfo(header, footer); - } - - private final void sendPlayerListInfo(String header, String footer) { - if (handle.playerConnection.isDisconnected()) { - return; - } - - IChatBaseComponent headerComponent = header.isEmpty() ? null : CraftChatMessage.fromStringOrNull(header, true); - IChatBaseComponent footerComponent = footer.isEmpty() ? null : CraftChatMessage.fromStringOrNull(footer, true); - - PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter(); - - packet.header = headerComponent; - packet.footer = footerComponent; - - handle.playerConnection.sendPacket(packet); - } - - @Override - public void setTitleTimes(int fadeIn, int stay, int fadeOut) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TIMES, null, fadeIn, stay, fadeOut)); - } - - @Override - public void sendSubtitle(String text) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.SUBTITLE, CraftChatMessage.fromStringOrNull(text))); - } - - @Override - public void sendTitle(String text) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TITLE, CraftChatMessage.fromStringOrNull(text))); - } - - @Override - public void sendActionBar(String text) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.ACTIONBAR, CraftChatMessage.fromStringOrNull(text))); - } - - @Override - public void fakeRespawn() { - if (handle.playerConnection.isDisconnected()) { - return; - } - PacketPlayOutPlayerInfo remInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER, handle); - PacketPlayOutPlayerInfo addInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.ADD_PLAYER, handle); - - PacketPlayOutEntityDestroy destroyPacket = new PacketPlayOutEntityDestroy(handle.getId()); - PacketPlayOutNamedEntitySpawn spawnPacket = new PacketPlayOutNamedEntitySpawn(handle); - PacketPlayOutEntityHeadRotation rotationPacket = new PacketPlayOutEntityHeadRotation(handle, - (byte) MathHelper.d(handle.getHeadRotation() * 256F / 360F)); - - ArrayList> list = new ArrayList<>(); - for (EnumItemSlot slot : EnumItemSlot.values()) { - list.add(Pair.of(slot, handle.getEquipment(slot))); - } - PacketPlayOutEntityEquipment equipmentPacket = new PacketPlayOutEntityEquipment(handle.getId(), list); - - Player self = getBukkitPlayer(); - Player[] players = Players.getOnlineWithout(getUniqueId()); - for (Player player : players) { - if (!player.canSee(self)) { - continue; - } - PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection; - connection.sendPacket(remInfoPacket); - connection.sendPacket(addInfoPacket); - connection.sendPacket(destroyPacket); - connection.sendPacket(spawnPacket); - connection.sendPacket(rotationPacket); - connection.sendPacket(equipmentPacket); - } - - WorldServer world = (WorldServer) handle.world; - - PacketPlayOutRespawn respawnPacket = new PacketPlayOutRespawn(world.getTypeKey(), world.getDimensionKey(), - BiomeManager.a(world.getSeed()), handle.playerInteractManager.getGameMode(), handle.playerInteractManager.c(), - world.isDebugWorld(), world.isFlatWorld(), true); - PacketPlayOutPosition positionPacket = new PacketPlayOutPosition(handle.locX(), handle.locY(), handle.locZ(), handle.yaw, - handle.pitch, Collections.emptySet(), 0); - PacketPlayOutHeldItemSlot itemPacket = new PacketPlayOutHeldItemSlot(handle.inventory.itemInHandIndex); - PacketPlayOutEntityStatus statusPacket = new PacketPlayOutEntityStatus(handle, (byte) 28); - PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); - - PlayerConnection connection = handle.playerConnection; - connection.sendPacket(remInfoPacket); - connection.sendPacket(addInfoPacket); - connection.sendPacket(respawnPacket); - connection.sendPacket(positionPacket); - connection.sendPacket(itemPacket); - connection.sendPacket(statusPacket); - connection.sendPacket(metadataPacket); - - handle.updateAbilities(); - handle.triggerHealthUpdate(); - handle.updateInventory(handle.defaultContainer); - if (handle.activeContainer != handle.defaultContainer) { - handle.updateInventory(handle.activeContainer); - } - self.recalculatePermissions(); - } - - @Override - public void respawn() { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayInClientCommand(EnumClientCommand.PERFORM_RESPAWN)); - } - - @Override - public void update() { - update(true); - } - - private final void update(boolean flag) { - PostAsync.forcePost(() -> { - realName = MojangProfileServer.getName(getUniqueId()); - realSkin = MojangProfileServer.getSkin(realName, getUniqueId()); - }); - if (flag) { - GameProfile profile = handle.getProfile(); - - Skin skin = getSkin(); - if (skin != null) { - PropertyMap properties = profile.getProperties(); - properties.removeAll("textures"); - properties.put("textures", new Property("textures", skin.getValue(), skin.getSignature())); - } - - String name = getName(); - if (name != null) { - ReflectionProvider.DEFAULT.getReflect("mjGameProfile").setFieldValue(profile, "name", name); - } - - if (!(name == null && skin == null)) { - fakeRespawn(); - } - } - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/tools/BlockTools1_16_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/tools/BlockTools1_16_R1.java deleted file mode 100644 index f8a8532..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/tools/BlockTools1_16_R1.java +++ /dev/null @@ -1,39 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R1.tools; - -import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_16_R1.block.CraftSkull; - -import com.mojang.authlib.properties.Property; -import com.mojang.authlib.properties.PropertyMap; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; - -import net.minecraft.server.v1_16_R1.TileEntitySkull; -import net.sourcewriters.minecraft.vcompat.reflection.tools.BlockTools; -import net.sourcewriters.minecraft.vcompat.utils.constants.MinecraftConstants; - -public class BlockTools1_16_R1 extends BlockTools { - - private final AbstractReflect craftEntityStateRef = new Reflect(CraftSkull.class).searchField("tileEntity", "tileEntity"); - - @Override - public void setHeadTexture(Block block, String texture) { - if (!(block instanceof CraftSkull)) { - return; - } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); - PropertyMap map = entitySkull.gameProfile.getProperties(); - map.removeAll("textures"); - map.put("textures", new Property("textures", MinecraftConstants.TEXTURE_SIGNATURE, texture)); - } - - @Override - public String getHeadTexture(Block block) { - if (!(block instanceof CraftSkull)) { - return null; - } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); - return entitySkull.gameProfile.getProperties().get("textures").iterator().next().getValue(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/tools/ServerTools1_16_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/tools/ServerTools1_16_R1.java deleted file mode 100644 index afb8778..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/tools/ServerTools1_16_R1.java +++ /dev/null @@ -1,27 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R1.tools; - -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_16_R1.CraftServer; - -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R1.wrapper.ConsoleReaderWrapper1_16_R1; -import net.sourcewriters.minecraft.vcompat.reflection.tools.ServerTools; - -public class ServerTools1_16_R1 extends ServerTools { - - @Override - public void setMotd(String text) { - ((CraftServer) Bukkit.getServer()).getServer().setMotd(text); - } - - @Override - public String getMotd() { - return ((CraftServer) Bukkit.getServer()).getServer().getMotd(); - } - - @SuppressWarnings("resource") - @Override - public ConsoleReaderWrapper1_16_R1 getConsole() { - return ConsoleReaderWrapper1_16_R1.INSTANCE; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/tools/SkinTools1_16_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/tools/SkinTools1_16_R1.java deleted file mode 100644 index a81ea8a..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/tools/SkinTools1_16_R1.java +++ /dev/null @@ -1,16 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R1.tools; - -import org.bukkit.craftbukkit.v1_16_R1.entity.CraftPlayer; -import org.bukkit.entity.Player; - -import net.sourcewriters.minecraft.vcompat.reflection.tools.SkinTools; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; - -public class SkinTools1_16_R1 extends SkinTools { - - @Override - public Skin skinFromPlayer(Player player) { - return skinFromGameProfile(((CraftPlayer) player).getHandle().getProfile()); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/utils/EntityConstructors1_16_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/utils/EntityConstructors1_16_R1.java deleted file mode 100644 index 589941c..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/utils/EntityConstructors1_16_R1.java +++ /dev/null @@ -1,12 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R1.utils; - -import java.util.function.Function; - -import net.minecraft.server.v1_16_R1.World; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R1.entity.ArmorStand1_16_R1; - -public abstract class EntityConstructors1_16_R1 { - - public static final Function ARMOR_STAND = (world -> new ArmorStand1_16_R1(world)); - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/wrapper/ConsoleReaderWrapper1_16_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/wrapper/ConsoleReaderWrapper1_16_R1.java deleted file mode 100644 index 6033d65..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/wrapper/ConsoleReaderWrapper1_16_R1.java +++ /dev/null @@ -1,43 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R1.wrapper; - -import java.io.IOException; -import java.io.Writer; - -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_16_R1.CraftServer; -import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; - -import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; - -public final class ConsoleReaderWrapper1_16_R1 extends ConsoleReaderWrapper { - - public static final ConsoleReaderWrapper1_16_R1 INSTANCE = new ConsoleReaderWrapper1_16_R1(); - - private final ConsoleReader reader; - - @SuppressWarnings("resource") - private ConsoleReaderWrapper1_16_R1() { - this.reader = ((CraftServer) Bukkit.getServer()).getServer().reader; - } - - @Override - public Writer getOutput() { - return reader.getOutput(); - } - - @Override - public boolean isAnsiSupported() { - return reader.getTerminal().isAnsiSupported(); - } - - @Override - public void flush() throws IOException { - reader.flush(); - } - - @Override - public void drawLine() throws IOException { - reader.drawLine(); - } - -} diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/BukkitConversion1_16_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/BukkitConversion1_16_R2.java deleted file mode 100644 index 905c0ed..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/BukkitConversion1_16_R2.java +++ /dev/null @@ -1,218 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R2; - -import java.util.Set; - -import org.bukkit.craftbukkit.v1_16_R2.inventory.CraftItemStack; -import org.bukkit.entity.EntityType; - -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.nbt.NbtByte; -import com.syntaxphoenix.syntaxapi.nbt.NbtByteArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; -import com.syntaxphoenix.syntaxapi.nbt.NbtDouble; -import com.syntaxphoenix.syntaxapi.nbt.NbtEnd; -import com.syntaxphoenix.syntaxapi.nbt.NbtFloat; -import com.syntaxphoenix.syntaxapi.nbt.NbtInt; -import com.syntaxphoenix.syntaxapi.nbt.NbtIntArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtList; -import com.syntaxphoenix.syntaxapi.nbt.NbtLong; -import com.syntaxphoenix.syntaxapi.nbt.NbtLongArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtShort; -import com.syntaxphoenix.syntaxapi.nbt.NbtString; -import com.syntaxphoenix.syntaxapi.nbt.NbtTag; -import com.syntaxphoenix.syntaxapi.nbt.NbtType; - -import net.minecraft.server.v1_16_R2.ItemStack; -import net.minecraft.server.v1_16_R2.NBTBase; -import net.minecraft.server.v1_16_R2.NBTNumber; -import net.minecraft.server.v1_16_R2.NBTTagByte; -import net.minecraft.server.v1_16_R2.NBTTagByteArray; -import net.minecraft.server.v1_16_R2.NBTTagCompound; -import net.minecraft.server.v1_16_R2.NBTTagDouble; -import net.minecraft.server.v1_16_R2.NBTTagEnd; -import net.minecraft.server.v1_16_R2.NBTTagFloat; -import net.minecraft.server.v1_16_R2.NBTTagInt; -import net.minecraft.server.v1_16_R2.NBTTagIntArray; -import net.minecraft.server.v1_16_R2.NBTTagList; -import net.minecraft.server.v1_16_R2.NBTTagLong; -import net.minecraft.server.v1_16_R2.NBTTagLongArray; -import net.minecraft.server.v1_16_R2.NBTTagShort; -import net.minecraft.server.v1_16_R2.NBTTagString; -import net.sourcewriters.minecraft.vcompat.reflection.BukkitConversion; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R2.data.BukkitContext1_16_R2; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R2.data.BukkitType1_16_R2; - -public class BukkitConversion1_16_R2 extends BukkitConversion { - - protected BukkitConversion1_16_R2(VersionControl1_16_R2 versionControl) { - super(versionControl); - } - - @Override - public EntityType toEntityType(NmsEntityType type) { - try { - return EntityType.valueOf(type.name()); - } catch (IllegalArgumentException ignore) { - return null; - } - } - - @Override - public NmsEntityType fromEntityType(EntityType type) { - try { - return NmsEntityType.valueOf(type.name()); - } catch (IllegalArgumentException ignore) { - return null; - } - } - - @Override - public NBTBase toMinecraftTag(NbtTag tag) { - switch (tag.getType()) { - case BYTE: - return NBTTagByte.a((byte) tag.getValue()); - case SHORT: - return NBTTagShort.a((short) tag.getValue()); - case INT: - return NBTTagInt.a((int) tag.getValue()); - case LONG: - return NBTTagLong.a((long) tag.getValue()); - case FLOAT: - return NBTTagFloat.a((float) tag.getValue()); - case DOUBLE: - return NBTTagDouble.a((double) tag.getValue()); - case STRING: - return NBTTagString.a((String) tag.getValue()); - case BYTE_ARRAY: - return new NBTTagByteArray((byte[]) tag.getValue()); - case INT_ARRAY: - return new NBTTagIntArray((int[]) tag.getValue()); - case LONG_ARRAY: - return new NBTTagLongArray((long[]) tag.getValue()); - case LIST: - return toMinecraftList((NbtList) tag); - case COMPOUND: - return toMinecraftCompound((NbtCompound) tag); - case END: - return NBTTagEnd.b; - default: - return null; - } - } - - @Override - public NbtTag fromMinecraftTag(Object raw) { - if (!(raw instanceof NBTBase)) { - return null; - } - NBTBase tag = (NBTBase) raw; - NbtType type = NbtType.getById(tag.getTypeId()); - switch (type) { - case BYTE: - return new NbtByte(((NBTNumber) tag).asByte()); - case SHORT: - return new NbtShort(((NBTNumber) tag).asShort()); - case INT: - return new NbtInt(((NBTNumber) tag).asInt()); - case LONG: - return new NbtLong(((NBTNumber) tag).asLong()); - case FLOAT: - return new NbtFloat(((NBTNumber) tag).asFloat()); - case DOUBLE: - return new NbtDouble(((NBTNumber) tag).asDouble()); - case STRING: - return new NbtString(((NBTTagString) tag).asString()); - case BYTE_ARRAY: - return new NbtByteArray(((NBTTagByteArray) tag).getBytes()); - case INT_ARRAY: - return new NbtIntArray(((NBTTagIntArray) tag).getInts()); - case LONG_ARRAY: - return new NbtLongArray(((NBTTagLongArray) tag).getLongs()); - case LIST: - return fromMinecraftList(tag); - case COMPOUND: - return fromMinecraftCompound(tag); - case END: - return NbtEnd.INSTANCE; - default: - return null; - } - } - - @Override - public NBTTagList toMinecraftList(NbtList list) { - NBTTagList output = new NBTTagList(); - for (NbtTag tag : list) { - output.add(toMinecraftTag(tag)); - } - return output; - } - - @Override - public NbtList fromMinecraftList(Object raw) { - if (!(raw instanceof NBTTagList)) { - return null; - } - NBTTagList list = (NBTTagList) raw; - NbtList output = new NbtList<>(NbtType.getById(list.getTypeId())); - for (NBTBase base : list) { - output.add(fromMinecraftTag(base)); - } - return output; - } - - @Override - public NBTTagCompound toMinecraftCompound(NbtCompound compound) { - NBTTagCompound output = new NBTTagCompound(); - if (compound.isEmpty()) { - return output; - } - Set keys = compound.getKeys(); - for (String key : keys) { - output.set(key, toMinecraftTag(compound.get(key))); - } - return output; - } - - @Override - public NbtCompound fromMinecraftCompound(Object raw) { - if (!(raw instanceof NBTTagCompound)) { - return null; - } - NBTTagCompound compound = (NBTTagCompound) raw; - NbtCompound output = new NbtCompound(); - if (compound.isEmpty()) { - return output; - } - Set keys = compound.getKeys(); - for (String key : keys) { - output.set(key, fromMinecraftTag(compound.get(key))); - } - return output; - } - - @Override - public org.bukkit.inventory.ItemStack itemFromCompound(NbtCompound compound) { - return CraftItemStack.asBukkitCopy(ItemStack.a(toMinecraftCompound(compound))); - } - - @Override - public NbtCompound itemToCompound(org.bukkit.inventory.ItemStack itemStack) { - return fromMinecraftCompound(CraftItemStack.asNMSCopy(itemStack).getOrCreateTag()); - } - - @Override - public WrappedContext createContext(DataAdapterContext context) { - return new BukkitContext1_16_R2(context); - } - - @Override - public WrapType wrap(DataType dataType) { - return new BukkitType1_16_R2<>(dataType); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/EntityProvider1_16_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/EntityProvider1_16_R2.java deleted file mode 100644 index 4870db5..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/EntityProvider1_16_R2.java +++ /dev/null @@ -1,47 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R2; - -import java.util.EnumMap; -import java.util.function.Function; - -import org.bukkit.craftbukkit.v1_16_R2.CraftWorld; - -import net.minecraft.server.v1_16_R2.World; -import net.sourcewriters.minecraft.vcompat.reflection.EntityProvider; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R2.utils.EntityConstructors1_16_R2; - -public class EntityProvider1_16_R2 extends EntityProvider { - - private final EnumMap> entityMap = new EnumMap<>(NmsEntityType.class); - - protected EntityProvider1_16_R2(VersionControl1_16_R2 versionControl) { - super(versionControl); - } - - @SuppressWarnings("unchecked") - private final Function searchConstructor(NmsEntityType type) { - try { - return (Function) EntityConstructors1_16_R2.class.getField(type.name()).get(null); - } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException ignore) { - return null; - } - } - - private final Function getConstructor(NmsEntityType type) { - return entityMap.computeIfAbsent(type, (key -> searchConstructor(key))); - } - - @Override - public NmsEntity createEntity(org.bukkit.World world, NmsEntityType type) { - if (!(world instanceof CraftWorld)) { - return null; - } - Function function; - if ((function = getConstructor(type)) == null) { - return null; - } - return function.apply(((CraftWorld) world).getHandle()); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/PacketHandler1_16_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/PacketHandler1_16_R2.java deleted file mode 100644 index 9a34899..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/PacketHandler1_16_R2.java +++ /dev/null @@ -1,11 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R2; - -import net.sourcewriters.minecraft.vcompat.reflection.PacketHandler; - -public class PacketHandler1_16_R2 extends PacketHandler { - - protected PacketHandler1_16_R2(VersionControl1_16_R2 versionControl) { - super(versionControl); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/PlayerProvider1_16_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/PlayerProvider1_16_R2.java deleted file mode 100644 index 726cdb6..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/PlayerProvider1_16_R2.java +++ /dev/null @@ -1,20 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R2; - -import org.bukkit.entity.Player; - -import net.sourcewriters.minecraft.vcompat.reflection.PlayerProvider; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R2.entity.Player1_16_R2; - -public class PlayerProvider1_16_R2 extends PlayerProvider { - - protected PlayerProvider1_16_R2(VersionControl1_16_R2 versionControl) { - super(versionControl); - } - - @Override - protected NmsPlayer createPlayer(Player player) { - return new Player1_16_R2(player); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/TextureProvider1_16_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/TextureProvider1_16_R2.java deleted file mode 100644 index 6eb514c..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/TextureProvider1_16_R2.java +++ /dev/null @@ -1,102 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R2; - -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_16_R2.block.CraftBlockEntityState; -import org.bukkit.craftbukkit.v1_16_R2.block.CraftSkull; -import org.bukkit.craftbukkit.v1_16_R2.inventory.CraftItemStack; -import org.bukkit.inventory.meta.ItemMeta; -import org.bukkit.inventory.meta.SkullMeta; - -import com.mojang.authlib.GameProfile; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; - -import net.minecraft.server.v1_16_R2.GameProfileSerializer; -import net.minecraft.server.v1_16_R2.ItemStack; -import net.minecraft.server.v1_16_R2.NBTTagCompound; -import net.minecraft.server.v1_16_R2.TileEntitySkull; -import net.sourcewriters.minecraft.vcompat.reflection.TextureProvider; - -public class TextureProvider1_16_R2 extends TextureProvider { - - private final AbstractReflect craftEntityStateRef = new Reflect(CraftBlockEntityState.class).searchField("tileEntity", "tileEntity"); - private final AbstractReflect craftItemStackRef = new Reflect(CraftItemStack.class).searchField("handle", "handle"); - private final AbstractReflect craftMetaSkullRef = new Reflect("org.bukkit.craftbukkit.v1_16_R2.inventory.CraftMetaSkull") - .searchField("serialized", "serializedProfile").searchField("profile", "profile"); - - protected TextureProvider1_16_R2(VersionControl1_16_R2 versionControl) { - super(versionControl); - } - - @Override - public GameProfile profileFromBlock(Block block) { - if (!(block instanceof CraftSkull)) { - return null; - } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); - return entitySkull.gameProfile; - } - - @Override - public GameProfile profileFromItem(org.bukkit.inventory.ItemStack itemStack) { - if (!(itemStack.getItemMeta() instanceof SkullMeta)) { - return null; - } - SkullMeta meta = (SkullMeta) itemStack.getItemMeta(); - GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue("profile", meta); - if (profile == null) { - NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue("serialized", meta); - if (compound == null) { - ItemStack stack = null; - if (itemStack instanceof CraftItemStack) { - stack = (ItemStack) craftItemStackRef.getFieldValue("handle", itemStack); - } - if (stack == null) { - stack = CraftItemStack.asNMSCopy(itemStack); - } - NBTTagCompound stackTag = stack.getOrCreateTag(); - if (stackTag.hasKeyOfType("SkullOwner", 10)) { - compound = stackTag.getCompound("SkullOwner"); - } else if (stackTag.hasKeyOfType("SkullProfile", 10)) { - compound = stackTag.getCompound("SkullProfile"); - } - } - if (compound == null) { - return null; - } - profile = GameProfileSerializer.deserialize(compound); - } - return profile; - } - - @Override - public org.bukkit.inventory.ItemStack getItem(GameProfile profile) { - org.bukkit.inventory.ItemStack craftStack = CraftItemStack.asCraftCopy(new org.bukkit.inventory.ItemStack(Material.PLAYER_HEAD)); - applyItem(craftStack, profile); - return craftStack; - } - - @Override - public boolean applyItem(org.bukkit.inventory.ItemStack itemStack, GameProfile profile) { - ItemMeta meta = itemStack.getItemMeta(); - if (!(meta instanceof SkullMeta)) { - return false; - } - SkullMeta skullMeta = (SkullMeta) meta; - craftMetaSkullRef.setFieldValue(meta, "profile", profile); - itemStack.setItemMeta(skullMeta); - return true; - } - - @Override - public boolean applyBlock(Block block, GameProfile profile) { - if (!(block instanceof CraftSkull)) { - return false; - } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); - entitySkull.setGameProfile(profile); - return true; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/ToolProvider1_16_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/ToolProvider1_16_R2.java deleted file mode 100644 index 6257519..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/ToolProvider1_16_R2.java +++ /dev/null @@ -1,33 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R2; - -import net.sourcewriters.minecraft.vcompat.reflection.ToolProvider; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R2.tools.BlockTools1_16_R2; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R2.tools.ServerTools1_16_R2; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R2.tools.SkinTools1_16_R2; - -public class ToolProvider1_16_R2 extends ToolProvider { - - private final BlockTools1_16_R2 blockTools = new BlockTools1_16_R2(); - private final SkinTools1_16_R2 skinTools = new SkinTools1_16_R2(); - private final ServerTools1_16_R2 serverTools = new ServerTools1_16_R2(); - - protected ToolProvider1_16_R2(VersionControl1_16_R2 versionControl) { - super(versionControl); - } - - @Override - public SkinTools1_16_R2 getSkinTools() { - return skinTools; - } - - @Override - public ServerTools1_16_R2 getServerTools() { - return serverTools; - } - - @Override - public BlockTools1_16_R2 getBlockTools() { - return blockTools; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/VersionControl1_16_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/VersionControl1_16_R2.java deleted file mode 100644 index 143a7dd..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/VersionControl1_16_R2.java +++ /dev/null @@ -1,61 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R2; - -import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R2.data.hook.BukkitContainerAdapterHook1_16_R2; - -public class VersionControl1_16_R2 extends VersionControl { - - public static VersionControl1_16_R2 INSTANCE; - - public static VersionControl1_16_R2 init() { - return INSTANCE != null ? INSTANCE : (INSTANCE = new VersionControl1_16_R2()); - } - - private final ToolProvider1_16_R2 toolProvider = new ToolProvider1_16_R2(this); - private final TextureProvider1_16_R2 textureProvider = new TextureProvider1_16_R2(this); - private final PacketHandler1_16_R2 packetHandler = new PacketHandler1_16_R2(this); - private final EntityProvider1_16_R2 entityProvider = new EntityProvider1_16_R2(this); - private final PlayerProvider1_16_R2 playerProvider = new PlayerProvider1_16_R2(this); - private final BukkitConversion1_16_R2 bukkitConversion = new BukkitConversion1_16_R2(this); - - private VersionControl1_16_R2() { - BukkitContainerAdapterHook1_16_R2.hookEntity(); - } - - @Override - public ToolProvider1_16_R2 getToolProvider() { - return toolProvider; - } - - @Override - public EntityProvider1_16_R2 getEntityProvider() { - return entityProvider; - } - - @Override - public PlayerProvider1_16_R2 getPlayerProvider() { - return playerProvider; - } - - @Override - public TextureProvider1_16_R2 getTextureProvider() { - return textureProvider; - } - - @Override - public PacketHandler1_16_R2 getPacketHandler() { - return packetHandler; - } - - @Override - public BukkitConversion1_16_R2 getBukkitConversion() { - return bukkitConversion; - } - - @Override - public void shutdown() { - dataProvider.getDefaultDistributor().shutdown(); - BukkitContainerAdapterHook1_16_R2.unhookAll(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/data/BukkitContainer1_16_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/data/BukkitContainer1_16_R2.java deleted file mode 100644 index 348d61c..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/data/BukkitContainer1_16_R2.java +++ /dev/null @@ -1,161 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R2.data; - -import java.util.Arrays; -import java.util.Optional; -import java.util.Set; -import java.util.stream.Collectors; - -import org.bukkit.NamespacedKey; -import org.bukkit.persistence.PersistentDataAdapterContext; -import org.bukkit.persistence.PersistentDataContainer; -import org.bukkit.persistence.PersistentDataType; - -import com.syntaxphoenix.syntaxapi.data.IDataContainer; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SyntaxKey; - -public final class BukkitContainer1_16_R2 extends WrappedContainer implements PersistentDataContainer { - - private final IDataContainer container; - - public BukkitContainer1_16_R2(IDataContainer container) { - this.container = container; - } - - @Override - public IDataContainer getHandle() { - return container; - } - - @Override - public IDataContainer getAsSyntaxContainer() { - return container; - } - - /* - * - */ - - @Override - public boolean has(NamespacedKey key, PersistentDataType type) { - return has(new BukkitKey1_16_R2(key), WrappedType1_16_R2.wrap(type)); - } - - @Override - public Z get(NamespacedKey key, PersistentDataType type) { - return get(new BukkitKey1_16_R2(key), WrappedType1_16_R2.wrap(type)); - } - - @Override - public Z getOrDefault(NamespacedKey key, PersistentDataType type, Z value) { - return Optional.ofNullable(get(key, type)).orElse(value); - } - - @Override - public void set(NamespacedKey key, PersistentDataType type, Z value) { - set(new BukkitKey1_16_R2(key), value, WrappedType1_16_R2.wrap(type)); - } - - @Override - public void remove(NamespacedKey key) { - remove(new BukkitKey1_16_R2(key)); - } - - @Override - public Set getKeys() { - return Arrays.stream(container.getKeys()).map(SyntaxKey::new).map(BukkitKey1_16_R2::asBukkit).collect(Collectors.toSet()); - } - - @Override - public PersistentDataAdapterContext getAdapterContext() { - return getContext(); - } - - /* - * - */ - - @Override - public BukkitContext1_16_R2 getContext() { - return new BukkitContext1_16_R2(container.getAdapterContext()); - } - - @Override - public boolean has(String key) { - return has(wrappedKey(key)); - } - - @Override - public boolean has(WrappedKey key) { - return container.has(key.getNamespacedKey()); - } - - @Override - public boolean has(String key, WrapType type) { - return has(wrappedKey(key), type); - } - - @Override - public boolean has(WrappedKey key, WrapType type) { - return container.has(key.getNamespacedKey(), type.syntaxType()); - } - - @Override - public Object get(String key) { - return get(wrappedKey(key)); - } - - @Override - public Object get(WrappedKey key) { - return container.get(key.getNamespacedKey()); - } - - @Override - public C get(String key, WrapType type) { - return get(wrappedKey(key), type); - } - - @Override - public C get(WrappedKey key, WrapType type) { - return container.get(key.getNamespacedKey(), type.syntaxType()); - } - - @Override - public void set(String key, B value, WrapType type) { - set(wrappedKey(key), value, type); - } - - @Override - public void set(WrappedKey key, B value, WrapType type) { - container.set(key.getNamespacedKey(), value, type.syntaxType()); - } - - @Override - public boolean remove(String key) { - return false; - } - - @Override - public boolean remove(WrappedKey key) { - return container.remove(key.getNamespacedKey()); - } - - @Override - public Set keySet() { - return container.getKeyspaces(); - } - - @Override - public boolean isEmpty() { - return container.isEmpty(); - } - - @Override - public int size() { - return container.size(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/data/BukkitContext1_16_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/data/BukkitContext1_16_R2.java deleted file mode 100644 index da08fc2..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/data/BukkitContext1_16_R2.java +++ /dev/null @@ -1,39 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R2.data; - -import org.bukkit.persistence.PersistentDataAdapterContext; -import org.bukkit.persistence.PersistentDataContainer; - -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.IDataContainer; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; - -public final class BukkitContext1_16_R2 extends WrappedContext implements PersistentDataAdapterContext { - - private final DataAdapterContext context; - - public BukkitContext1_16_R2(DataAdapterContext context) { - this.context = context; - } - - @Override - public DataAdapterContext getHandle() { - return context; - } - - @Override - public PersistentDataContainer newPersistentDataContainer() { - return newContainer(); - } - - @Override - public IDataContainer newDataContainer() { - return context.newDataContainer(); - } - - @Override - public BukkitContainer1_16_R2 newContainer() { - return new BukkitContainer1_16_R2(context.newDataContainer()); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/data/BukkitKey1_16_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/data/BukkitKey1_16_R2.java deleted file mode 100644 index 0239cdd..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/data/BukkitKey1_16_R2.java +++ /dev/null @@ -1,52 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R2.data; - -import org.bukkit.NamespacedKey; -import org.bukkit.plugin.Plugin; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; - -public final class BukkitKey1_16_R2 extends WrappedKey { - - private final NamespacedKey key; - - public BukkitKey1_16_R2(Plugin plugin, String key) { - this.key = new NamespacedKey(plugin, key); - } - - @SuppressWarnings("deprecation") - public BukkitKey1_16_R2(String name, String key) { - this.key = new NamespacedKey(name, key); - } - - public BukkitKey1_16_R2(NamespacedKey key) { - this.key = key; - } - - @Override - public NamespacedKey getHandle() { - return key; - } - - @Override - public String getName() { - return key.getNamespace(); - } - - @Override - public String getKey() { - return key.getKey(); - } - - @Override - public String toString() { - return key.toString(); - } - - public static NamespacedKey asBukkit(WrappedKey key) { - if (key.getHandle() instanceof NamespacedKey) { - return (NamespacedKey) key.getHandle(); - } - return new BukkitKey1_16_R2(key.getName(), key.getKey()).getHandle(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/data/BukkitType1_16_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/data/BukkitType1_16_R2.java deleted file mode 100644 index da95a3c..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/data/BukkitType1_16_R2.java +++ /dev/null @@ -1,69 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R2.data; - -import org.bukkit.persistence.PersistentDataAdapterContext; -import org.bukkit.persistence.PersistentDataType; - -import com.syntaxphoenix.syntaxapi.data.DataType; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; - -public class BukkitType1_16_R2 extends WrappedType1_16_R2, P0, P1, C0, C1> - implements PersistentDataType { - - private final DataType type; - - public BukkitType1_16_R2(DataType type) { - super(type.getPrimitive(), type.getComplex()); - this.type = type; - } - - @Override - public DataType getHandle() { - return type; - } - - @Override - public Class getPrimitiveOriginal() { - return type.getPrimitive(); - } - - @Override - public Class getComplexOriginal() { - return type.getComplex(); - } - - /* - * - */ - - @Override - public Class getComplexType() { - return complexType; - } - - @Override - public Class getPrimitiveType() { - return primitiveType; - } - - @Override - public P0 toPrimitive(C0 complex, PersistentDataAdapterContext context) { - return wrapToPrimitive(complex, new SyntaxContext1_16_R2(context)); - } - - @Override - public C0 fromPrimitive(P0 primitive, PersistentDataAdapterContext context) { - return wrapToComplex(primitive, new SyntaxContext1_16_R2(context)); - } - - @Override - public P0 wrapToPrimitive(C0 complex, WrappedContext context) { - return toPrimitiveWrapped(type.toPrimitive(context, toComplexOriginal(complex))); - } - - @Override - public C0 wrapToComplex(P0 primitive, WrappedContext context) { - return toComplexWrapped(type.fromPrimitive(context, toPrimitiveOriginal(primitive))); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/data/SimpleBukkitType1_16_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/data/SimpleBukkitType1_16_R2.java deleted file mode 100644 index fbc530c..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/data/SimpleBukkitType1_16_R2.java +++ /dev/null @@ -1,36 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R2.data; - -import org.bukkit.persistence.PersistentDataAdapterContext; -import org.bukkit.persistence.PersistentDataType; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; - -public class SimpleBukkitType1_16_R2 implements PersistentDataType { - - private final WrapType type; - - public SimpleBukkitType1_16_R2(WrapType type) { - this.type = type; - } - - @Override - public Class getComplexType() { - return type.getComplexWrapped(); - } - - @Override - public Class

getPrimitiveType() { - return type.getPrimitiveWrapped(); - } - - @Override - public P toPrimitive(C complex, PersistentDataAdapterContext context) { - return type.wrapToPrimitive(complex, new SyntaxContext1_16_R2(context)); - } - - @Override - public C fromPrimitive(P primitive, PersistentDataAdapterContext context) { - return type.wrapToComplex(primitive, new SyntaxContext1_16_R2(context)); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/data/SyntaxContainer1_16_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/data/SyntaxContainer1_16_R2.java deleted file mode 100644 index f844d9b..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/data/SyntaxContainer1_16_R2.java +++ /dev/null @@ -1,185 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R2.data; - -import java.util.Set; -import java.util.stream.Collectors; - -import org.bukkit.persistence.PersistentDataContainer; - -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.data.IDataContainer; -import com.syntaxphoenix.syntaxapi.utils.key.IKey; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SyntaxKey; - -public final class SyntaxContainer1_16_R2 extends WrappedContainer implements IDataContainer { - - private final PersistentDataContainer container; - - public SyntaxContainer1_16_R2(PersistentDataContainer container) { - this.container = container; - } - - @Override - public PersistentDataContainer getHandle() { - return container; - } - - @Override - public IDataContainer getAsSyntaxContainer() { - return new SyntaxContainer1_16_R2(container); - } - - /* - * - */ - - @Override - public boolean has(IKey key) { - throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); - } - - @Override - public boolean has(String key, DataType type) { - return has(syntaxKey(key), type); - } - - @Override - public boolean has(IKey key, DataType type) { - return has(new SyntaxKey(key), WrappedType1_16_R2.wrap(type)); - } - - @Override - public C get(String key, DataType type) { - return get(syntaxKey(key), type); - } - - @Override - public C get(IKey key, DataType type) { - return get(new SyntaxKey(key), WrappedType1_16_R2.wrap(type)); - } - - @Override - public Object get(String key) { - throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); - } - - @Override - public Object get(IKey key) { - throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); - } - - @Override - public void set(String key, E value, DataType type) { - set(wrappedKey(key), value, WrappedType1_16_R2.wrap(type)); - } - - @Override - public void set(IKey key, E value, DataType type) { - set(new SyntaxKey(key), value, WrappedType1_16_R2.wrap(type)); - } - - @Override - public boolean remove(String key) { - return remove(wrappedKey(key)); - } - - @Override - public boolean remove(IKey key) { - return remove(new SyntaxKey(key)); - } - - @Override - public IKey[] getKeys() { - return container.getKeys().stream().map(BukkitKey1_16_R2::new).map(WrappedKey::getNamespacedKey).toArray(IKey[]::new); - } - - @Override - public Set getKeyspaces() { - return container.getKeys().stream().map(org.bukkit.NamespacedKey::toString).collect(Collectors.toSet()); - } - - @Override - public DataAdapterContext getAdapterContext() { - return getContext(); - } - - /* - * - */ - - @Override - public SyntaxContext1_16_R2 getContext() { - return new SyntaxContext1_16_R2(container.getAdapterContext()); - } - - @Override - public boolean has(String key) { - throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); - } - - @Override - public boolean has(WrappedKey key) { - throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); - } - - @Override - public boolean has(String key, WrapType type) { - return has(wrappedKey(key), type); - } - - @Override - public boolean has(WrappedKey key, WrapType type) { - return container.has(BukkitKey1_16_R2.asBukkit(key), new SimpleBukkitType1_16_R2<>(type)); - } - - @Override - public Object get(WrappedKey key) { - throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); - } - - @Override - public C get(String key, WrapType type) { - return get(wrappedKey(key), type); - } - - @Override - public C get(WrappedKey key, WrapType type) { - return container.get(BukkitKey1_16_R2.asBukkit(key), new SimpleBukkitType1_16_R2<>(type)); - } - - @Override - public void set(String key, B value, WrapType type) { - set(wrappedKey(key), value, type); - } - - @Override - public void set(WrappedKey key, B value, WrapType type) { - container.set(BukkitKey1_16_R2.asBukkit(key), new SimpleBukkitType1_16_R2<>(type), value); - } - - @Override - public boolean remove(WrappedKey key) { - container.remove(BukkitKey1_16_R2.asBukkit(key)); - return true; // Will always return true as we don't know if it contained it - } - - @Override - public Set keySet() { - return getKeyspaces(); - } - - @Override - public boolean isEmpty() { - return container.isEmpty(); - } - - @Override - public int size() { - return container.getKeys().size(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/data/SyntaxContext1_16_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/data/SyntaxContext1_16_R2.java deleted file mode 100644 index 25ea05f..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/data/SyntaxContext1_16_R2.java +++ /dev/null @@ -1,38 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R2.data; - -import org.bukkit.persistence.PersistentDataAdapterContext; -import org.bukkit.persistence.PersistentDataContainer; - -import com.syntaxphoenix.syntaxapi.data.IDataContainer; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; - -public final class SyntaxContext1_16_R2 extends WrappedContext implements PersistentDataAdapterContext { - - private final PersistentDataAdapterContext context; - - public SyntaxContext1_16_R2(PersistentDataAdapterContext context) { - this.context = context; - } - - @Override - public PersistentDataAdapterContext getHandle() { - return context; - } - - @Override - public PersistentDataContainer newPersistentDataContainer() { - return context.newPersistentDataContainer(); - } - - @Override - public IDataContainer newDataContainer() { - return newContainer(); - } - - @Override - public SyntaxContainer1_16_R2 newContainer() { - return new SyntaxContainer1_16_R2(context.newPersistentDataContainer()); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/data/SyntaxType1_16_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/data/SyntaxType1_16_R2.java deleted file mode 100644 index 606d481..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/data/SyntaxType1_16_R2.java +++ /dev/null @@ -1,76 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R2.data; - -import org.bukkit.persistence.PersistentDataAdapterContext; -import org.bukkit.persistence.PersistentDataType; - -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; - -public class SyntaxType1_16_R2 extends WrappedType1_16_R2, P0, P1, C0, C1> - implements DataType { - - private final PersistentDataType type; - - public SyntaxType1_16_R2(PersistentDataType type) { - super(type.getPrimitiveType(), type.getComplexType()); - this.type = type; - } - - @Override - public PersistentDataType getHandle() { - return type; - } - - @Override - public Class getPrimitiveOriginal() { - return type.getPrimitiveType(); - } - - @Override - public Class getComplexOriginal() { - return type.getComplexType(); - } - - /* - * - */ - - @Override - public Class getComplex() { - return complexType; - } - - @Override - public Class getPrimitive() { - return primitiveType; - } - - @Override - public P0 toPrimitive(DataAdapterContext context, C0 complex) { - return wrapToPrimitive(complex, new BukkitContext1_16_R2(context)); - } - - @Override - public C0 fromPrimitive(DataAdapterContext context, P0 primitive) { - return wrapToComplex(primitive, new BukkitContext1_16_R2(context)); - } - - @Override - public P0 wrapToPrimitive(C0 complex, WrappedContext context) { - if (!(context instanceof PersistentDataAdapterContext)) { - return null; - } - return toPrimitiveWrapped(type.toPrimitive(toComplexOriginal(complex), (PersistentDataAdapterContext) context)); - } - - @Override - public C0 wrapToComplex(P0 primitive, WrappedContext context) { - if (!(context instanceof PersistentDataAdapterContext)) { - return null; - } - return toComplexWrapped(type.fromPrimitive(toPrimitiveOriginal(primitive), (PersistentDataAdapterContext) context)); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/data/WrappedType1_16_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/data/WrappedType1_16_R2.java deleted file mode 100644 index f3481af..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/data/WrappedType1_16_R2.java +++ /dev/null @@ -1,150 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R2.data; - -import java.util.Arrays; - -import org.bukkit.persistence.PersistentDataContainer; -import org.bukkit.persistence.PersistentDataType; - -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.data.IDataContainer; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; - -public abstract class WrappedType1_16_R2 implements WrapType { - - protected final Class primitiveType; - protected final Class complexType; - - private final int primitiveWrap; - private final int complexWrap; - - @SuppressWarnings("unchecked") - protected WrappedType1_16_R2(Class primitive, Class complex) { - this.primitiveWrap = WrappedType1_16_R2.internalState(primitive); - this.complexWrap = WrappedType1_16_R2.internalState(complex); - this.primitiveType = (Class) WrappedType1_16_R2.internalWrap(primitive, primitiveWrap); - this.complexType = (Class) WrappedType1_16_R2.internalWrap(complex, complexWrap); - } - - public abstract H getHandle(); - - public Class getPrimitiveWrapped() { - return primitiveType; - } - - public Class getComplexWrapped() { - return complexType; - } - - public abstract Class getPrimitiveOriginal(); - - public abstract Class getComplexOriginal(); - - @SuppressWarnings("unchecked") - public P0 toPrimitiveWrapped(P1 primitive) { - switch (primitiveWrap) { - case 1: - return (P0) new SyntaxContainer1_16_R2((PersistentDataContainer) primitive); - case 2: - return (P0) Arrays.stream((PersistentDataContainer[]) primitive).map(SyntaxContainer1_16_R2::new) - .toArray(SyntaxContainer1_16_R2[]::new); - case 3: - return (P0) new BukkitContainer1_16_R2((IDataContainer) primitive); - case 4: - return (P0) Arrays.stream((IDataContainer[]) primitive).map(BukkitContainer1_16_R2::new) - .toArray(BukkitContainer1_16_R2[]::new); - default: - return (P0) primitive; - } - } - - @SuppressWarnings("unchecked") - public C0 toComplexWrapped(C1 complex) { - switch (complexWrap) { - case 1: - return (C0) new SyntaxContainer1_16_R2((PersistentDataContainer) complex); - case 2: - return (C0) Arrays.stream((PersistentDataContainer[]) complex).map(SyntaxContainer1_16_R2::new).toArray(BukkitContainer1_16_R2[]::new); - case 3: - return (C0) new BukkitContainer1_16_R2((IDataContainer) complex); - case 4: - return (C0) Arrays.stream((IDataContainer[]) complex).map(BukkitContainer1_16_R2::new).toArray(BukkitContainer1_16_R2[]::new); - default: - return (C0) complex; - } - } - - @SuppressWarnings("unchecked") - public P1 toPrimitiveOriginal(P0 primitive) { - switch (primitiveWrap) { - case 1: - return (P1) new BukkitContainer1_16_R2((IDataContainer) primitive); - case 2: - return (P1) Arrays.stream((IDataContainer[]) primitive).map(BukkitContainer1_16_R2::new) - .toArray(BukkitContainer1_16_R2[]::new); - case 3: - return (P1) new SyntaxContainer1_16_R2((PersistentDataContainer) primitive); - case 4: - return (P1) Arrays.stream((PersistentDataContainer[]) primitive).map(SyntaxContainer1_16_R2::new) - .toArray(BukkitContainer1_16_R2[]::new); - default: - return (P1) primitive; - } - } - - @SuppressWarnings("unchecked") - public C1 toComplexOriginal(C0 complex) { - switch (complexWrap) { - case 1: - return (C1) new BukkitContainer1_16_R2((IDataContainer) complex); - case 2: - return (C1) Arrays.stream((IDataContainer[]) complex).map(BukkitContainer1_16_R2::new).toArray(BukkitContainer1_16_R2[]::new); - case 3: - return (C1) new SyntaxContainer1_16_R2((PersistentDataContainer) complex); - case 4: - return (C1) Arrays.stream((PersistentDataContainer[]) complex).map(SyntaxContainer1_16_R2::new).toArray(SyntaxContainer1_16_R2[]::new); - default: - return (C1) complex; - } - } - - protected static Class internalWrap(Class clazz, int state) { - switch (state) { - case 1: - return SyntaxContainer1_16_R2.class; - case 2: - return SyntaxContainer1_16_R2[].class; - case 3: - return BukkitContainer1_16_R2.class; - case 4: - return BukkitContainer1_16_R2[].class; - default: - return clazz; - } - } - - protected static int internalState(Class clazz) { - if (clazz.isAssignableFrom(PersistentDataContainer.class)) { - return 1; - } - if (clazz.isAssignableFrom(PersistentDataContainer[].class)) { - return 2; - } - if (clazz.isAssignableFrom(IDataContainer.class)) { - return 3; - } - if (clazz.isAssignableFrom(IDataContainer[].class)) { - return 4; - } - return 0; - } - - public static BukkitType1_16_R2 wrap(DataType type) { - return new BukkitType1_16_R2<>(type); - } - - public static SyntaxType1_16_R2 wrap(PersistentDataType type) { - return new SyntaxType1_16_R2<>(type); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/data/hook/BukkitContainerAdapterHook1_16_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/data/hook/BukkitContainerAdapterHook1_16_R2.java deleted file mode 100644 index 8cf5d64..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/data/hook/BukkitContainerAdapterHook1_16_R2.java +++ /dev/null @@ -1,134 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R2.data.hook; - -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; - -import org.bukkit.craftbukkit.v1_16_R2.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_16_R2.persistence.CraftPersistentDataContainer; -import org.bukkit.craftbukkit.v1_16_R2.persistence.CraftPersistentDataTypeRegistry; -import org.bukkit.persistence.PersistentDataContainer; - -import com.syntaxphoenix.syntaxapi.data.IDataContainer; -import com.syntaxphoenix.syntaxapi.data.container.nbt.NbtContainer; -import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; - -import net.minecraft.server.v1_16_R2.NBTTagCompound; -import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R2.data.BukkitContainer1_16_R2; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R2.data.SyntaxContainer1_16_R2; - -@SuppressWarnings({ - "rawtypes", - "unchecked" -}) -public final class BukkitContainerAdapterHook1_16_R2 { - - private static final BukkitContainerAdapterHook1_16_R2 HOOK = new BukkitContainerAdapterHook1_16_R2(); - - private final AbstractReflect registryRef = new Reflect(CraftPersistentDataTypeRegistry.class) - .searchMethod("create", "createAdapter", Class.class, Class.class, Function.class, Function.class) - .searchField("adapters", "adapters") - .searchField("function", "CREATE_ADAPTER"); - private final AbstractReflect entityRef = new Reflect(CraftEntity.class).searchField("registry", "DATA_TYPE_REGISTRY"); - - private BukkitContainerAdapterHook1_16_R2() {} - - private final HashMap map = new HashMap<>(); - - private CraftPersistentDataTypeRegistry getEntityRegistry() { - return (CraftPersistentDataTypeRegistry) entityRef.getFieldValue("registry"); - } - - private void uninjectAll() { - for (CraftPersistentDataTypeRegistry registry : map.keySet()) { - Map adapters = (Map) registryRef.getFieldValue("adapters", registry); - adapters.remove(BukkitContainer1_16_R2.class); - adapters.remove(SyntaxContainer1_16_R2.class); - registryRef.setFieldValue(registry, "function", map.get(registry)); - } - map.clear(); - } - - private void inject(CraftPersistentDataTypeRegistry registry) { - if (map.containsKey(registry)) { - return; - } - map.put(registry, (Function) registryRef.getFieldValue("function", registry)); - Function function = clazz -> createAdapter(registry, registryRef.getMethod("create").getReturnType(), (Class) clazz); - registryRef.setFieldValue(registry, "function", function); - } - - private E createAdapter(CraftPersistentDataTypeRegistry registry, Class adapterType, Class type) { - if (Objects.equals(BukkitContainer1_16_R2.class, type)) { - return (E) buildAdapter(registry, BukkitContainer1_16_R2.class, tag -> fromPrimitiveSyntax(tag)); - } - if (Objects.equals(SyntaxContainer1_16_R2.class, type)) { - return (E) buildAdapter(registry, SyntaxContainer1_16_R2.class, tag -> fromPrimitiveBukkit(registry, tag)); - } - return (E) map.get(registry).apply(type); - } - - private Object buildAdapter(Object handle, Class type, Function function) { - return registryRef.run(handle, "create", type, NBTTagCompound.class, (Function) input -> toPrimitive(input), - function); - } - - private NBTTagCompound toPrimitive(WrappedContainer input) { - Object handle = findFinalContainer(input).getHandle(); - if (handle instanceof PersistentDataContainer) { - if (handle instanceof CraftPersistentDataContainer) { - return ((CraftPersistentDataContainer) handle).toTagCompound(); - } - throw new IllegalArgumentException( - "Expected 'CraftPersistentDataContainer' got '" + handle.getClass().getSimpleName() + " instead'!"); - } - if (handle instanceof IDataContainer) { - if (handle instanceof NbtContainer) { - return (NBTTagCompound) VersionControl.get().getBukkitConversion().toMinecraftCompound(((NbtContainer) handle).asNbt()); - } - throw new IllegalArgumentException( - "Expected 'CraftPersistentDataContainer' got '" + handle.getClass().getSimpleName() + " instead'!"); - } - throw new IllegalArgumentException("Unknown WrappedContainer implementation!"); - } - - private BukkitContainer1_16_R2 fromPrimitiveSyntax(NBTTagCompound data) { - VersionControl control = VersionControl.get(); - NbtContainer container = new NbtContainer(control.getDataProvider().getRegistry()); - NbtCompound compound = control.getBukkitConversion().fromMinecraftCompound(data); - container.fromNbt(compound); - return new BukkitContainer1_16_R2(container); - } - - private SyntaxContainer1_16_R2 fromPrimitiveBukkit(CraftPersistentDataTypeRegistry registry, NBTTagCompound data) { - CraftPersistentDataContainer container = new CraftPersistentDataContainer(registry); - container.putAll(data); - return new SyntaxContainer1_16_R2(container); - } - - private WrappedContainer findFinalContainer(WrappedContainer container) { - WrappedContainer output = container; - while (output.getHandle() instanceof WrappedContainer) { - output = (WrappedContainer) output.getHandle(); - } - return output; - } - - public static void unhookAll() { - HOOK.uninjectAll(); - } - - public static void hookEntity() { - HOOK.inject(HOOK.getEntityRegistry()); - } - - public static void hook(CraftPersistentDataTypeRegistry registry) { - HOOK.inject(registry); - } - -} diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/entity/ArmorStand1_16_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/entity/ArmorStand1_16_R2.java deleted file mode 100644 index a39a732..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/entity/ArmorStand1_16_R2.java +++ /dev/null @@ -1,24 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R2.entity; - -import net.minecraft.server.v1_16_R2.EntityArmorStand; -import net.minecraft.server.v1_16_R2.EntityTypes; -import net.minecraft.server.v1_16_R2.World; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsArmorStand; - -public class ArmorStand1_16_R2 extends EntityLiving1_16_R2 implements NmsArmorStand { - - public ArmorStand1_16_R2(World world) { - super(new EntityArmorStand(EntityTypes.ARMOR_STAND, world)); - } - - @Override - public void setSmall(boolean small) { - handle.setSmall(small); - } - - @Override - public boolean isSmall() { - return handle.isSmall(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/entity/Entity1_16_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/entity/Entity1_16_R2.java deleted file mode 100644 index e65fbe7..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/entity/Entity1_16_R2.java +++ /dev/null @@ -1,215 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R2.entity; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.OfflinePlayer; -import org.bukkit.craftbukkit.v1_16_R2.CraftWorld; -import org.bukkit.craftbukkit.v1_16_R2.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_16_R2.util.CraftChatMessage; -import org.bukkit.entity.Player; - -import net.minecraft.server.v1_16_R2.AxisAlignedBB; -import net.minecraft.server.v1_16_R2.Entity; -import net.minecraft.server.v1_16_R2.PacketPlayOutEntityDestroy; -import net.minecraft.server.v1_16_R2.PacketPlayOutEntityMetadata; -import net.minecraft.server.v1_16_R2.PacketPlayOutSpawnEntity; -import net.minecraft.server.v1_16_R2.PlayerConnection; -import net.minecraft.server.v1_16_R2.Vec3D; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.utils.NmsBoundingBox; - -public abstract class Entity1_16_R2 implements NmsEntity { - - protected final E handle; - - protected final List visible = Collections.synchronizedList(new ArrayList<>()); - - public Entity1_16_R2(E handle) { - this.handle = handle; - } - - @Override - public final E getHandle() { - return handle; - } - - @Override - public int getId() { - return handle.getId(); - } - - @Override - public UUID getUniqueId() { - return handle.getUniqueID(); - } - - @Override - public NmsBoundingBox getBoundingBox() { - AxisAlignedBB box = handle.getBoundingBox(); - return new NmsBoundingBox(box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ); - } - - @Override - public void setCustomName(String name) { - handle.setCustomName(CraftChatMessage.fromStringOrNull(name)); - updateVisibility(); - } - - @Override - public String getCustomName() { - return CraftChatMessage.fromComponent(handle.getCustomName()); - } - - @Override - public void setGravity(boolean gravity) { - handle.setNoGravity(!gravity); - } - - @Override - public boolean hasGravity() { - return !handle.isNoGravity(); - } - - @Override - public void setCustomNameVisible(boolean visible) { - handle.setCustomNameVisible(visible); - } - - @Override - public boolean isCustomNameVisible() { - return handle.getCustomNameVisible(); - } - - @Override - public void setInvisible(boolean invisible) { - handle.setInvisible(invisible); - } - - @Override - public boolean isInvisible() { - return handle.isInvisible(); - } - - @Override - public boolean isInteractable() { - return handle.isInteractable(); - } - - @Override - public boolean isCollidable() { - return handle.isCollidable(); - } - - @Override - public void setInvulnerable(boolean invulnerable) { - handle.setInvulnerable(invulnerable); - } - - @Override - public boolean isInvulnerable() { - return handle.isInvulnerable(); - } - - @Override - public void setLocation(Location location) { - handle.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); - if (location.getWorld() == null || handle.getWorld().getWorld() == location.getWorld()) { - updateVisibility(); - return; - } - handle.world = ((CraftWorld) location.getWorld()).getHandle(); - updateVisibility(); - } - - @Override - public Location getLocation() { - Vec3D vector = handle.getPositionVector(); - return new Location(handle.getWorld().getWorld(), vector.x, vector.y, vector.z); - } - - @Override - public void updateVisibility() { - if (visible.isEmpty()) { - return; - } - Player[] players; - synchronized (visible) { - players = visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) - .toArray(Player[]::new); - } - hide(players); - show(players); - } - - @Override - public boolean isShown(Player player) { - synchronized (visible) { - return visible.contains(player.getUniqueId()); - } - } - - @Override - public void hide(Player... players) { - if (players.length == 0) { - return; - } - PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(handle.getId()); - for (Player player : players) { - if (!isShown(player)) { - continue; - } - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); - synchronized (visible) { - visible.remove(player.getUniqueId()); - } - } - } - - @Override - public void show(Player... players) { - if (players.length == 0) { - return; - } - PacketPlayOutSpawnEntity packet = new PacketPlayOutSpawnEntity(handle); - PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); - PlayerConnection connection; - for (Player player : players) { - if (isShown(player)) { - continue; - } - connection = ((CraftPlayer) player).getHandle().playerConnection; - connection.sendPacket(packet); - connection.sendPacket(metadataPacket); - synchronized (visible) { - visible.add(player.getUniqueId()); - } - } - } - - @Override - public UUID[] getVisible() { - synchronized (visible) { - return visible.toArray(new UUID[0]); - } - } - - @Override - public Player[] getVisibleAsPlayer() { - synchronized (visible) { - return visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) - .toArray(Player[]::new); - } - } - - @Override - public void kill() { - hide(getVisibleAsPlayer()); - handle.die(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/entity/EntityLiving1_16_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/entity/EntityLiving1_16_R2.java deleted file mode 100644 index 5c62ab8..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/entity/EntityLiving1_16_R2.java +++ /dev/null @@ -1,17 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R2.entity; - -import net.minecraft.server.v1_16_R2.EntityLiving; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityLiving; - -public abstract class EntityLiving1_16_R2 extends Entity1_16_R2 implements NmsEntityLiving { - - public EntityLiving1_16_R2(E handle) { - super(handle); - } - - @Override - public void setCollidable(boolean collidable) { - handle.collides = collidable; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/entity/Player1_16_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/entity/Player1_16_R2.java deleted file mode 100644 index 194c6f6..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/entity/Player1_16_R2.java +++ /dev/null @@ -1,295 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R2.entity; - -import java.util.ArrayList; -import java.util.Collections; - -import org.bukkit.craftbukkit.v1_16_R2.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_16_R2.util.CraftChatMessage; -import org.bukkit.entity.Player; - -import com.mojang.authlib.GameProfile; -import com.mojang.authlib.properties.Property; -import com.mojang.authlib.properties.PropertyMap; -import com.mojang.datafixers.util.Pair; - -import net.minecraft.server.v1_16_R2.BiomeManager; -import net.minecraft.server.v1_16_R2.EntityPlayer; -import net.minecraft.server.v1_16_R2.EnumItemSlot; -import net.minecraft.server.v1_16_R2.IChatBaseComponent; -import net.minecraft.server.v1_16_R2.ItemStack; -import net.minecraft.server.v1_16_R2.MathHelper; -import net.minecraft.server.v1_16_R2.PacketPlayInClientCommand; -import net.minecraft.server.v1_16_R2.PacketPlayInClientCommand.EnumClientCommand; -import net.minecraft.server.v1_16_R2.PacketPlayOutEntityDestroy; -import net.minecraft.server.v1_16_R2.PacketPlayOutEntityEquipment; -import net.minecraft.server.v1_16_R2.PacketPlayOutEntityHeadRotation; -import net.minecraft.server.v1_16_R2.PacketPlayOutEntityMetadata; -import net.minecraft.server.v1_16_R2.PacketPlayOutEntityStatus; -import net.minecraft.server.v1_16_R2.PacketPlayOutHeldItemSlot; -import net.minecraft.server.v1_16_R2.PacketPlayOutNamedEntitySpawn; -import net.minecraft.server.v1_16_R2.PacketPlayOutPlayerInfo; -import net.minecraft.server.v1_16_R2.PacketPlayOutPlayerInfo.EnumPlayerInfoAction; -import net.minecraft.server.v1_16_R2.PacketPlayOutPlayerListHeaderFooter; -import net.minecraft.server.v1_16_R2.PacketPlayOutPosition; -import net.minecraft.server.v1_16_R2.PacketPlayOutRespawn; -import net.minecraft.server.v1_16_R2.PacketPlayOutTitle; -import net.minecraft.server.v1_16_R2.PacketPlayOutTitle.EnumTitleAction; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.type.SkinDataType; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R2.data.SyntaxContainer1_16_R2; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; -import net.sourcewriters.minecraft.vcompat.utils.bukkit.Players; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.MojangProfileServer; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; -import net.sourcewriters.minecraft.vcompat.utils.thread.PostAsync; -import net.minecraft.server.v1_16_R2.PlayerConnection; -import net.minecraft.server.v1_16_R2.WorldServer; - -public class Player1_16_R2 extends EntityLiving1_16_R2 implements NmsPlayer { - - private String realName; - private Skin realSkin; - - private final WrappedContainer dataAdapter; - - public Player1_16_R2(Player player) { - super(((CraftPlayer) player).getHandle()); - dataAdapter = new SyntaxContainer1_16_R2(getBukkitPlayer().getPersistentDataContainer()); - update(false); - } - - @Override - public CraftPlayer getBukkitPlayer() { - return handle.getBukkitEntity(); - } - - @Override - public WrappedContainer getDataAdapter() { - return dataAdapter; - } - - @Override - public void setSkin(Skin skin) { - if (skin == null) { - return; - } - dataAdapter.set("skin", skin, SkinDataType.WRAPPED_INSTANCE); - } - - @Override - public Skin getSkin() { - return dataAdapter.getOrDefault("skin", SkinDataType.WRAPPED_INSTANCE, realSkin); - } - - @Override - public Skin getRealSkin() { - return realSkin; - } - - @Override - public void setName(String name) { - if (getName().equals(name)) { - return; - } - if (name == null) { - dataAdapter.remove("name"); - return; - } - dataAdapter.set("name", name, WrapType.STRING); - } - - @Override - public String getName() { - return dataAdapter.getOrDefault("name", WrapType.STRING, realName); - } - - @Override - public String getRealName() { - return realName; - } - - @Override - public void setPlayerListHeader(String text) { - setPlayerListHeaderAndFooter(text, getPlayerListFooter()); - } - - @Override - public String getPlayerListHeader() { - return dataAdapter.getOrDefault("header", WrapType.STRING, ""); - } - - @Override - public void setPlayerListFooter(String text) { - setPlayerListHeaderAndFooter(getPlayerListHeader(), text); - } - - @Override - public String getPlayerListFooter() { - return dataAdapter.getOrDefault("footer", WrapType.STRING, ""); - } - - @Override - public int getPing() { - return handle.ping; - } - - @Override - public void setPlayerListHeaderAndFooter(String header, String footer) { - dataAdapter.set("header", header, WrapType.STRING); - dataAdapter.set("footer", footer, WrapType.STRING); - sendPlayerListInfo(header, footer); - } - - private final void sendPlayerListInfo(String header, String footer) { - if (handle.playerConnection.isDisconnected()) { - return; - } - - IChatBaseComponent headerComponent = header.isEmpty() ? null : CraftChatMessage.fromStringOrNull(header, true); - IChatBaseComponent footerComponent = footer.isEmpty() ? null : CraftChatMessage.fromStringOrNull(footer, true); - - PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter(); - - packet.header = headerComponent; - packet.footer = footerComponent; - - handle.playerConnection.sendPacket(packet); - } - - @Override - public void setTitleTimes(int fadeIn, int stay, int fadeOut) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TIMES, null, fadeIn, stay, fadeOut)); - } - - @Override - public void sendSubtitle(String text) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.SUBTITLE, CraftChatMessage.fromStringOrNull(text))); - } - - @Override - public void sendTitle(String text) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TITLE, CraftChatMessage.fromStringOrNull(text))); - } - - @Override - public void sendActionBar(String text) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.ACTIONBAR, CraftChatMessage.fromStringOrNull(text))); - } - - @Override - public void fakeRespawn() { - if (handle.playerConnection.isDisconnected()) { - return; - } - PacketPlayOutPlayerInfo remInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER, handle); - PacketPlayOutPlayerInfo addInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.ADD_PLAYER, handle); - - PacketPlayOutEntityDestroy destroyPacket = new PacketPlayOutEntityDestroy(handle.getId()); - PacketPlayOutNamedEntitySpawn spawnPacket = new PacketPlayOutNamedEntitySpawn(handle); - PacketPlayOutEntityHeadRotation rotationPacket = new PacketPlayOutEntityHeadRotation(handle, - (byte) MathHelper.d(handle.getHeadRotation() * 256F / 360F)); - - ArrayList> list = new ArrayList<>(); - for (EnumItemSlot slot : EnumItemSlot.values()) { - list.add(Pair.of(slot, handle.getEquipment(slot))); - } - PacketPlayOutEntityEquipment equipmentPacket = new PacketPlayOutEntityEquipment(handle.getId(), list); - - Player self = getBukkitPlayer(); - Player[] players = Players.getOnlineWithout(getUniqueId()); - for (Player player : players) { - if (!player.canSee(self)) { - continue; - } - PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection; - connection.sendPacket(remInfoPacket); - connection.sendPacket(addInfoPacket); - connection.sendPacket(destroyPacket); - connection.sendPacket(spawnPacket); - connection.sendPacket(rotationPacket); - connection.sendPacket(equipmentPacket); - } - - WorldServer world = (WorldServer) handle.world; - - PacketPlayOutRespawn respawnPacket = new PacketPlayOutRespawn(world.getDimensionManager(), world.getDimensionKey(), - BiomeManager.a(world.getSeed()), handle.playerInteractManager.getGameMode(), handle.playerInteractManager.c(), - world.isDebugWorld(), world.isFlatWorld(), true); - PacketPlayOutPosition positionPacket = new PacketPlayOutPosition(handle.locX(), handle.locY(), handle.locZ(), handle.yaw, - handle.pitch, Collections.emptySet(), 0); - PacketPlayOutHeldItemSlot itemPacket = new PacketPlayOutHeldItemSlot(handle.inventory.itemInHandIndex); - PacketPlayOutEntityStatus statusPacket = new PacketPlayOutEntityStatus(handle, (byte) 28); - PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); - - PlayerConnection connection = handle.playerConnection; - connection.sendPacket(remInfoPacket); - connection.sendPacket(addInfoPacket); - connection.sendPacket(respawnPacket); - connection.sendPacket(positionPacket); - connection.sendPacket(itemPacket); - connection.sendPacket(statusPacket); - connection.sendPacket(metadataPacket); - - handle.updateAbilities(); - handle.triggerHealthUpdate(); - handle.updateInventory(handle.defaultContainer); - if (handle.activeContainer != handle.defaultContainer) { - handle.updateInventory(handle.activeContainer); - } - self.recalculatePermissions(); - } - - @Override - public void respawn() { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayInClientCommand(EnumClientCommand.PERFORM_RESPAWN)); - } - - @Override - public void update() { - update(true); - } - - private final void update(boolean flag) { - PostAsync.forcePost(() -> { - realName = MojangProfileServer.getName(getUniqueId()); - realSkin = MojangProfileServer.getSkin(realName, getUniqueId()); - }); - if (flag) { - GameProfile profile = handle.getProfile(); - - Skin skin = getSkin(); - if (skin != null) { - PropertyMap properties = profile.getProperties(); - properties.removeAll("textures"); - properties.put("textures", new Property("textures", skin.getValue(), skin.getSignature())); - } - - String name = getName(); - if (name != null) { - ReflectionProvider.DEFAULT.getReflect("mjGameProfile").setFieldValue(profile, "name", name); - } - - if (!(name == null && skin == null)) { - fakeRespawn(); - } - } - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/tools/BlockTools1_16_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/tools/BlockTools1_16_R2.java deleted file mode 100644 index b683151..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/tools/BlockTools1_16_R2.java +++ /dev/null @@ -1,39 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R2.tools; - -import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_16_R2.block.CraftSkull; - -import com.mojang.authlib.properties.Property; -import com.mojang.authlib.properties.PropertyMap; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; - -import net.minecraft.server.v1_16_R2.TileEntitySkull; -import net.sourcewriters.minecraft.vcompat.reflection.tools.BlockTools; -import net.sourcewriters.minecraft.vcompat.utils.constants.MinecraftConstants; - -public class BlockTools1_16_R2 extends BlockTools { - - private final AbstractReflect craftEntityStateRef = new Reflect(CraftSkull.class).searchField("tileEntity", "tileEntity"); - - @Override - public void setHeadTexture(Block block, String texture) { - if (!(block instanceof CraftSkull)) { - return; - } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); - PropertyMap map = entitySkull.gameProfile.getProperties(); - map.removeAll("textures"); - map.put("textures", new Property("textures", MinecraftConstants.TEXTURE_SIGNATURE, texture)); - } - - @Override - public String getHeadTexture(Block block) { - if (!(block instanceof CraftSkull)) { - return null; - } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); - return entitySkull.gameProfile.getProperties().get("textures").iterator().next().getValue(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/tools/ServerTools1_16_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/tools/ServerTools1_16_R2.java deleted file mode 100644 index 03f51f1..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/tools/ServerTools1_16_R2.java +++ /dev/null @@ -1,27 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R2.tools; - -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_16_R2.CraftServer; - -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R2.wrapper.ConsoleReaderWrapper1_16_R2; -import net.sourcewriters.minecraft.vcompat.reflection.tools.ServerTools; - -public class ServerTools1_16_R2 extends ServerTools { - - @Override - public void setMotd(String text) { - ((CraftServer) Bukkit.getServer()).getServer().setMotd(text); - } - - @Override - public String getMotd() { - return ((CraftServer) Bukkit.getServer()).getServer().getMotd(); - } - - @SuppressWarnings("resource") - @Override - public ConsoleReaderWrapper1_16_R2 getConsole() { - return ConsoleReaderWrapper1_16_R2.INSTANCE; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/tools/SkinTools1_16_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/tools/SkinTools1_16_R2.java deleted file mode 100644 index 9b9f797..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/tools/SkinTools1_16_R2.java +++ /dev/null @@ -1,16 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R2.tools; - -import org.bukkit.craftbukkit.v1_16_R2.entity.CraftPlayer; -import org.bukkit.entity.Player; - -import net.sourcewriters.minecraft.vcompat.reflection.tools.SkinTools; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; - -public class SkinTools1_16_R2 extends SkinTools { - - @Override - public Skin skinFromPlayer(Player player) { - return skinFromGameProfile(((CraftPlayer) player).getHandle().getProfile()); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/utils/EntityConstructors1_16_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/utils/EntityConstructors1_16_R2.java deleted file mode 100644 index 3603889..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/utils/EntityConstructors1_16_R2.java +++ /dev/null @@ -1,12 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R2.utils; - -import java.util.function.Function; - -import net.minecraft.server.v1_16_R2.World; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R2.entity.ArmorStand1_16_R2; - -public abstract class EntityConstructors1_16_R2 { - - public static final Function ARMOR_STAND = (world -> new ArmorStand1_16_R2(world)); - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/wrapper/ConsoleReaderWrapper1_16_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/wrapper/ConsoleReaderWrapper1_16_R2.java deleted file mode 100644 index 8075931..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/wrapper/ConsoleReaderWrapper1_16_R2.java +++ /dev/null @@ -1,43 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R2.wrapper; - -import java.io.IOException; -import java.io.Writer; - -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_16_R2.CraftServer; -import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; - -import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; - -public final class ConsoleReaderWrapper1_16_R2 extends ConsoleReaderWrapper { - - public static final ConsoleReaderWrapper1_16_R2 INSTANCE = new ConsoleReaderWrapper1_16_R2(); - - private final ConsoleReader reader; - - @SuppressWarnings("resource") - private ConsoleReaderWrapper1_16_R2() { - this.reader = ((CraftServer) Bukkit.getServer()).getServer().reader; - } - - @Override - public Writer getOutput() { - return reader.getOutput(); - } - - @Override - public boolean isAnsiSupported() { - return reader.getTerminal().isAnsiSupported(); - } - - @Override - public void flush() throws IOException { - reader.flush(); - } - - @Override - public void drawLine() throws IOException { - reader.drawLine(); - } - -} diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/BukkitConversion1_16_R3.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/BukkitConversion1_16_R3.java deleted file mode 100644 index 74b3168..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/BukkitConversion1_16_R3.java +++ /dev/null @@ -1,218 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R3; - -import java.util.Set; - -import org.bukkit.craftbukkit.v1_16_R3.inventory.CraftItemStack; -import org.bukkit.entity.EntityType; - -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.nbt.NbtByte; -import com.syntaxphoenix.syntaxapi.nbt.NbtByteArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; -import com.syntaxphoenix.syntaxapi.nbt.NbtDouble; -import com.syntaxphoenix.syntaxapi.nbt.NbtEnd; -import com.syntaxphoenix.syntaxapi.nbt.NbtFloat; -import com.syntaxphoenix.syntaxapi.nbt.NbtInt; -import com.syntaxphoenix.syntaxapi.nbt.NbtIntArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtList; -import com.syntaxphoenix.syntaxapi.nbt.NbtLong; -import com.syntaxphoenix.syntaxapi.nbt.NbtLongArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtShort; -import com.syntaxphoenix.syntaxapi.nbt.NbtString; -import com.syntaxphoenix.syntaxapi.nbt.NbtTag; -import com.syntaxphoenix.syntaxapi.nbt.NbtType; - -import net.minecraft.server.v1_16_R3.ItemStack; -import net.minecraft.server.v1_16_R3.NBTBase; -import net.minecraft.server.v1_16_R3.NBTNumber; -import net.minecraft.server.v1_16_R3.NBTTagByte; -import net.minecraft.server.v1_16_R3.NBTTagByteArray; -import net.minecraft.server.v1_16_R3.NBTTagCompound; -import net.minecraft.server.v1_16_R3.NBTTagDouble; -import net.minecraft.server.v1_16_R3.NBTTagEnd; -import net.minecraft.server.v1_16_R3.NBTTagFloat; -import net.minecraft.server.v1_16_R3.NBTTagInt; -import net.minecraft.server.v1_16_R3.NBTTagIntArray; -import net.minecraft.server.v1_16_R3.NBTTagList; -import net.minecraft.server.v1_16_R3.NBTTagLong; -import net.minecraft.server.v1_16_R3.NBTTagLongArray; -import net.minecraft.server.v1_16_R3.NBTTagShort; -import net.minecraft.server.v1_16_R3.NBTTagString; -import net.sourcewriters.minecraft.vcompat.reflection.BukkitConversion; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R3.data.BukkitContext1_16_R3; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R3.data.BukkitType1_16_R3; - -public class BukkitConversion1_16_R3 extends BukkitConversion { - - protected BukkitConversion1_16_R3(VersionControl1_16_R3 versionControl) { - super(versionControl); - } - - @Override - public EntityType toEntityType(NmsEntityType type) { - try { - return EntityType.valueOf(type.name()); - } catch (IllegalArgumentException ignore) { - return null; - } - } - - @Override - public NmsEntityType fromEntityType(EntityType type) { - try { - return NmsEntityType.valueOf(type.name()); - } catch (IllegalArgumentException ignore) { - return null; - } - } - - @Override - public NBTBase toMinecraftTag(NbtTag tag) { - switch (tag.getType()) { - case BYTE: - return NBTTagByte.a((byte) tag.getValue()); - case SHORT: - return NBTTagShort.a((short) tag.getValue()); - case INT: - return NBTTagInt.a((int) tag.getValue()); - case LONG: - return NBTTagLong.a((long) tag.getValue()); - case FLOAT: - return NBTTagFloat.a((float) tag.getValue()); - case DOUBLE: - return NBTTagDouble.a((double) tag.getValue()); - case STRING: - return NBTTagString.a((String) tag.getValue()); - case BYTE_ARRAY: - return new NBTTagByteArray((byte[]) tag.getValue()); - case INT_ARRAY: - return new NBTTagIntArray((int[]) tag.getValue()); - case LONG_ARRAY: - return new NBTTagLongArray((long[]) tag.getValue()); - case LIST: - return toMinecraftList((NbtList) tag); - case COMPOUND: - return toMinecraftCompound((NbtCompound) tag); - case END: - return NBTTagEnd.b; - default: - return null; - } - } - - @Override - public NbtTag fromMinecraftTag(Object raw) { - if (!(raw instanceof NBTBase)) { - return null; - } - NBTBase tag = (NBTBase) raw; - NbtType type = NbtType.getById(tag.getTypeId()); - switch (type) { - case BYTE: - return new NbtByte(((NBTNumber) tag).asByte()); - case SHORT: - return new NbtShort(((NBTNumber) tag).asShort()); - case INT: - return new NbtInt(((NBTNumber) tag).asInt()); - case LONG: - return new NbtLong(((NBTNumber) tag).asLong()); - case FLOAT: - return new NbtFloat(((NBTNumber) tag).asFloat()); - case DOUBLE: - return new NbtDouble(((NBTNumber) tag).asDouble()); - case STRING: - return new NbtString(((NBTTagString) tag).asString()); - case BYTE_ARRAY: - return new NbtByteArray(((NBTTagByteArray) tag).getBytes()); - case INT_ARRAY: - return new NbtIntArray(((NBTTagIntArray) tag).getInts()); - case LONG_ARRAY: - return new NbtLongArray(((NBTTagLongArray) tag).getLongs()); - case LIST: - return fromMinecraftList(tag); - case COMPOUND: - return fromMinecraftCompound(tag); - case END: - return NbtEnd.INSTANCE; - default: - return null; - } - } - - @Override - public NBTTagList toMinecraftList(NbtList list) { - NBTTagList output = new NBTTagList(); - for (NbtTag tag : list) { - output.add(toMinecraftTag(tag)); - } - return output; - } - - @Override - public NbtList fromMinecraftList(Object raw) { - if (!(raw instanceof NBTTagList)) { - return null; - } - NBTTagList list = (NBTTagList) raw; - NbtList output = new NbtList<>(NbtType.getById(list.getTypeId())); - for (NBTBase base : list) { - output.add(fromMinecraftTag(base)); - } - return output; - } - - @Override - public NBTTagCompound toMinecraftCompound(NbtCompound compound) { - NBTTagCompound output = new NBTTagCompound(); - if (compound.isEmpty()) { - return output; - } - Set keys = compound.getKeys(); - for (String key : keys) { - output.set(key, toMinecraftTag(compound.get(key))); - } - return output; - } - - @Override - public NbtCompound fromMinecraftCompound(Object raw) { - if (!(raw instanceof NBTTagCompound)) { - return null; - } - NBTTagCompound compound = (NBTTagCompound) raw; - NbtCompound output = new NbtCompound(); - if (compound.isEmpty()) { - return output; - } - Set keys = compound.getKeys(); - for (String key : keys) { - output.set(key, fromMinecraftTag(compound.get(key))); - } - return output; - } - - @Override - public org.bukkit.inventory.ItemStack itemFromCompound(NbtCompound compound) { - return CraftItemStack.asBukkitCopy(ItemStack.a(toMinecraftCompound(compound))); - } - - @Override - public NbtCompound itemToCompound(org.bukkit.inventory.ItemStack itemStack) { - return fromMinecraftCompound(CraftItemStack.asNMSCopy(itemStack).save(new NBTTagCompound())); - } - - @Override - public WrappedContext createContext(DataAdapterContext context) { - return new BukkitContext1_16_R3(context); - } - - @Override - public WrapType wrap(DataType dataType) { - return new BukkitType1_16_R3<>(dataType); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/EntityProvider1_16_R3.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/EntityProvider1_16_R3.java deleted file mode 100644 index a732afe..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/EntityProvider1_16_R3.java +++ /dev/null @@ -1,47 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R3; - -import java.util.EnumMap; -import java.util.function.Function; - -import org.bukkit.craftbukkit.v1_16_R3.CraftWorld; - -import net.minecraft.server.v1_16_R3.World; -import net.sourcewriters.minecraft.vcompat.reflection.EntityProvider; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R3.utils.EntityConstructors1_16_R3; - -public class EntityProvider1_16_R3 extends EntityProvider { - - private final EnumMap> entityMap = new EnumMap<>(NmsEntityType.class); - - protected EntityProvider1_16_R3(VersionControl1_16_R3 versionControl) { - super(versionControl); - } - - @SuppressWarnings("unchecked") - private final Function searchConstructor(NmsEntityType type) { - try { - return (Function) EntityConstructors1_16_R3.class.getField(type.name()).get(null); - } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException ignore) { - return null; - } - } - - private final Function getConstructor(NmsEntityType type) { - return entityMap.computeIfAbsent(type, (key -> searchConstructor(key))); - } - - @Override - public NmsEntity createEntity(org.bukkit.World world, NmsEntityType type) { - if (!(world instanceof CraftWorld)) { - return null; - } - Function function; - if ((function = getConstructor(type)) == null) { - return null; - } - return function.apply(((CraftWorld) world).getHandle()); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/PacketHandler1_16_R3.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/PacketHandler1_16_R3.java deleted file mode 100644 index ff5ae81..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/PacketHandler1_16_R3.java +++ /dev/null @@ -1,11 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R3; - -import net.sourcewriters.minecraft.vcompat.reflection.PacketHandler; - -public class PacketHandler1_16_R3 extends PacketHandler { - - protected PacketHandler1_16_R3(VersionControl1_16_R3 versionControl) { - super(versionControl); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/PlayerProvider1_16_R3.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/PlayerProvider1_16_R3.java deleted file mode 100644 index bafd66d..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/PlayerProvider1_16_R3.java +++ /dev/null @@ -1,20 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R3; - -import org.bukkit.entity.Player; - -import net.sourcewriters.minecraft.vcompat.reflection.PlayerProvider; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R3.entity.Player1_16_R3; - -public class PlayerProvider1_16_R3 extends PlayerProvider { - - protected PlayerProvider1_16_R3(VersionControl1_16_R3 versionControl) { - super(versionControl); - } - - @Override - protected NmsPlayer createPlayer(Player player) { - return new Player1_16_R3(player); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/TextureProvider1_16_R3.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/TextureProvider1_16_R3.java deleted file mode 100644 index d94a2d1..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/TextureProvider1_16_R3.java +++ /dev/null @@ -1,102 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R3; - -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_16_R3.block.CraftBlockEntityState; -import org.bukkit.craftbukkit.v1_16_R3.block.CraftSkull; -import org.bukkit.craftbukkit.v1_16_R3.inventory.CraftItemStack; -import org.bukkit.inventory.meta.ItemMeta; -import org.bukkit.inventory.meta.SkullMeta; - -import com.mojang.authlib.GameProfile; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; - -import net.minecraft.server.v1_16_R3.GameProfileSerializer; -import net.minecraft.server.v1_16_R3.ItemStack; -import net.minecraft.server.v1_16_R3.NBTTagCompound; -import net.minecraft.server.v1_16_R3.TileEntitySkull; -import net.sourcewriters.minecraft.vcompat.reflection.TextureProvider; - -public class TextureProvider1_16_R3 extends TextureProvider { - - private final AbstractReflect craftEntityStateRef = new Reflect(CraftBlockEntityState.class).searchField("tileEntity", "tileEntity"); - private final AbstractReflect craftItemStackRef = new Reflect(CraftItemStack.class).searchField("handle", "handle"); - private final AbstractReflect craftMetaSkullRef = new Reflect("org.bukkit.craftbukkit.v1_16_R3.inventory.CraftMetaSkull") - .searchField("serialized", "serializedProfile").searchField("profile", "profile"); - - protected TextureProvider1_16_R3(VersionControl1_16_R3 versionControl) { - super(versionControl); - } - - @Override - public GameProfile profileFromBlock(Block block) { - if (!(block instanceof CraftSkull)) { - return null; - } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); - return entitySkull.gameProfile; - } - - @Override - public GameProfile profileFromItem(org.bukkit.inventory.ItemStack itemStack) { - if (!(itemStack.getItemMeta() instanceof SkullMeta)) { - return null; - } - SkullMeta meta = (SkullMeta) itemStack.getItemMeta(); - GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue("profile", meta); - if (profile == null) { - NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue("serialized", meta); - if (compound == null) { - ItemStack stack = null; - if (itemStack instanceof CraftItemStack) { - stack = (ItemStack) craftItemStackRef.getFieldValue("handle", itemStack); - } - if (stack == null) { - stack = CraftItemStack.asNMSCopy(itemStack); - } - NBTTagCompound stackTag = stack.getOrCreateTag(); - if (stackTag.hasKeyOfType("SkullOwner", 10)) { - compound = stackTag.getCompound("SkullOwner"); - } else if (stackTag.hasKeyOfType("SkullProfile", 10)) { - compound = stackTag.getCompound("SkullProfile"); - } - } - if (compound == null) { - return null; - } - profile = GameProfileSerializer.deserialize(compound); - } - return profile; - } - - @Override - public org.bukkit.inventory.ItemStack getItem(GameProfile profile) { - org.bukkit.inventory.ItemStack craftStack = CraftItemStack.asCraftCopy(new org.bukkit.inventory.ItemStack(Material.PLAYER_HEAD)); - applyItem(craftStack, profile); - return craftStack; - } - - @Override - public boolean applyItem(org.bukkit.inventory.ItemStack itemStack, GameProfile profile) { - ItemMeta meta = itemStack.getItemMeta(); - if (!(meta instanceof SkullMeta)) { - return false; - } - SkullMeta skullMeta = (SkullMeta) meta; - craftMetaSkullRef.setFieldValue(meta, "profile", profile); - itemStack.setItemMeta(skullMeta); - return true; - } - - @Override - public boolean applyBlock(Block block, GameProfile profile) { - if (!(block instanceof CraftSkull)) { - return false; - } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); - entitySkull.setGameProfile(profile); - return true; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/ToolProvider1_16_R3.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/ToolProvider1_16_R3.java deleted file mode 100644 index fe893a4..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/ToolProvider1_16_R3.java +++ /dev/null @@ -1,33 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R3; - -import net.sourcewriters.minecraft.vcompat.reflection.ToolProvider; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R3.tools.BlockTools1_16_R3; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R3.tools.ServerTools1_16_R3; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R3.tools.SkinTools1_16_R3; - -public class ToolProvider1_16_R3 extends ToolProvider { - - private final BlockTools1_16_R3 blockTools = new BlockTools1_16_R3(); - private final SkinTools1_16_R3 skinTools = new SkinTools1_16_R3(); - private final ServerTools1_16_R3 serverTools = new ServerTools1_16_R3(); - - protected ToolProvider1_16_R3(VersionControl1_16_R3 versionControl) { - super(versionControl); - } - - @Override - public SkinTools1_16_R3 getSkinTools() { - return skinTools; - } - - @Override - public ServerTools1_16_R3 getServerTools() { - return serverTools; - } - - @Override - public BlockTools1_16_R3 getBlockTools() { - return blockTools; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/VersionControl1_16_R3.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/VersionControl1_16_R3.java deleted file mode 100644 index d1055de..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/VersionControl1_16_R3.java +++ /dev/null @@ -1,61 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R3; - -import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R3.data.hook.BukkitContainerAdapterHook1_16_R3; - -public class VersionControl1_16_R3 extends VersionControl { - - public static VersionControl1_16_R3 INSTANCE; - - public static VersionControl1_16_R3 init() { - return INSTANCE != null ? INSTANCE : (INSTANCE = new VersionControl1_16_R3()); - } - - private final ToolProvider1_16_R3 toolProvider = new ToolProvider1_16_R3(this); - private final TextureProvider1_16_R3 textureProvider = new TextureProvider1_16_R3(this); - private final PacketHandler1_16_R3 packetHandler = new PacketHandler1_16_R3(this); - private final EntityProvider1_16_R3 entityProvider = new EntityProvider1_16_R3(this); - private final PlayerProvider1_16_R3 playerProvider = new PlayerProvider1_16_R3(this); - private final BukkitConversion1_16_R3 bukkitConversion = new BukkitConversion1_16_R3(this); - - private VersionControl1_16_R3() { - BukkitContainerAdapterHook1_16_R3.hookEntity(); - } - - @Override - public ToolProvider1_16_R3 getToolProvider() { - return toolProvider; - } - - @Override - public EntityProvider1_16_R3 getEntityProvider() { - return entityProvider; - } - - @Override - public PlayerProvider1_16_R3 getPlayerProvider() { - return playerProvider; - } - - @Override - public TextureProvider1_16_R3 getTextureProvider() { - return textureProvider; - } - - @Override - public PacketHandler1_16_R3 getPacketHandler() { - return packetHandler; - } - - @Override - public BukkitConversion1_16_R3 getBukkitConversion() { - return bukkitConversion; - } - - @Override - public void shutdown() { - dataProvider.getDefaultDistributor().shutdown(); - BukkitContainerAdapterHook1_16_R3.unhookAll(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/data/BukkitContainer1_16_R3.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/data/BukkitContainer1_16_R3.java deleted file mode 100644 index a95aeee..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/data/BukkitContainer1_16_R3.java +++ /dev/null @@ -1,161 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R3.data; - -import java.util.Arrays; -import java.util.Optional; -import java.util.Set; -import java.util.stream.Collectors; - -import org.bukkit.NamespacedKey; -import org.bukkit.persistence.PersistentDataAdapterContext; -import org.bukkit.persistence.PersistentDataContainer; -import org.bukkit.persistence.PersistentDataType; - -import com.syntaxphoenix.syntaxapi.data.IDataContainer; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SyntaxKey; - -public final class BukkitContainer1_16_R3 extends WrappedContainer implements PersistentDataContainer { - - private final IDataContainer container; - - public BukkitContainer1_16_R3(IDataContainer container) { - this.container = container; - } - - @Override - public IDataContainer getHandle() { - return container; - } - - @Override - public IDataContainer getAsSyntaxContainer() { - return container; - } - - /* - * - */ - - @Override - public boolean has(NamespacedKey key, PersistentDataType type) { - return has(new BukkitKey1_16_R3(key), WrappedType1_16_R3.wrap(type)); - } - - @Override - public Z get(NamespacedKey key, PersistentDataType type) { - return get(new BukkitKey1_16_R3(key), WrappedType1_16_R3.wrap(type)); - } - - @Override - public Z getOrDefault(NamespacedKey key, PersistentDataType type, Z value) { - return Optional.ofNullable(get(key, type)).orElse(value); - } - - @Override - public void set(NamespacedKey key, PersistentDataType type, Z value) { - set(new BukkitKey1_16_R3(key), value, WrappedType1_16_R3.wrap(type)); - } - - @Override - public void remove(NamespacedKey key) { - remove(new BukkitKey1_16_R3(key)); - } - - @Override - public Set getKeys() { - return Arrays.stream(container.getKeys()).map(SyntaxKey::new).map(BukkitKey1_16_R3::asBukkit).collect(Collectors.toSet()); - } - - @Override - public PersistentDataAdapterContext getAdapterContext() { - return getContext(); - } - - /* - * - */ - - @Override - public BukkitContext1_16_R3 getContext() { - return new BukkitContext1_16_R3(container.getAdapterContext()); - } - - @Override - public boolean has(String key) { - return has(wrappedKey(key)); - } - - @Override - public boolean has(WrappedKey key) { - return container.has(key.getNamespacedKey()); - } - - @Override - public boolean has(String key, WrapType type) { - return has(wrappedKey(key), type); - } - - @Override - public boolean has(WrappedKey key, WrapType type) { - return container.has(key.getNamespacedKey(), type.syntaxType()); - } - - @Override - public Object get(String key) { - return get(wrappedKey(key)); - } - - @Override - public Object get(WrappedKey key) { - return container.get(key.getNamespacedKey()); - } - - @Override - public C get(String key, WrapType type) { - return get(wrappedKey(key), type); - } - - @Override - public C get(WrappedKey key, WrapType type) { - return container.get(key.getNamespacedKey(), type.syntaxType()); - } - - @Override - public void set(String key, B value, WrapType type) { - set(wrappedKey(key), value, type); - } - - @Override - public void set(WrappedKey key, B value, WrapType type) { - container.set(key.getNamespacedKey(), value, type.syntaxType()); - } - - @Override - public boolean remove(String key) { - return false; - } - - @Override - public boolean remove(WrappedKey key) { - return container.remove(key.getNamespacedKey()); - } - - @Override - public Set keySet() { - return container.getKeyspaces(); - } - - @Override - public boolean isEmpty() { - return container.isEmpty(); - } - - @Override - public int size() { - return container.size(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/data/BukkitContext1_16_R3.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/data/BukkitContext1_16_R3.java deleted file mode 100644 index 41d494f..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/data/BukkitContext1_16_R3.java +++ /dev/null @@ -1,39 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R3.data; - -import org.bukkit.persistence.PersistentDataAdapterContext; -import org.bukkit.persistence.PersistentDataContainer; - -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.IDataContainer; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; - -public final class BukkitContext1_16_R3 extends WrappedContext implements PersistentDataAdapterContext { - - private final DataAdapterContext context; - - public BukkitContext1_16_R3(DataAdapterContext context) { - this.context = context; - } - - @Override - public DataAdapterContext getHandle() { - return context; - } - - @Override - public PersistentDataContainer newPersistentDataContainer() { - return newContainer(); - } - - @Override - public IDataContainer newDataContainer() { - return context.newDataContainer(); - } - - @Override - public BukkitContainer1_16_R3 newContainer() { - return new BukkitContainer1_16_R3(context.newDataContainer()); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/data/BukkitKey1_16_R3.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/data/BukkitKey1_16_R3.java deleted file mode 100644 index 6f4451d..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/data/BukkitKey1_16_R3.java +++ /dev/null @@ -1,52 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R3.data; - -import org.bukkit.NamespacedKey; -import org.bukkit.plugin.Plugin; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; - -public final class BukkitKey1_16_R3 extends WrappedKey { - - private final NamespacedKey key; - - public BukkitKey1_16_R3(Plugin plugin, String key) { - this.key = new NamespacedKey(plugin, key); - } - - @SuppressWarnings("deprecation") - public BukkitKey1_16_R3(String name, String key) { - this.key = new NamespacedKey(name, key); - } - - public BukkitKey1_16_R3(NamespacedKey key) { - this.key = key; - } - - @Override - public NamespacedKey getHandle() { - return key; - } - - @Override - public String getName() { - return key.getNamespace(); - } - - @Override - public String getKey() { - return key.getKey(); - } - - @Override - public String toString() { - return key.toString(); - } - - public static NamespacedKey asBukkit(WrappedKey key) { - if (key.getHandle() instanceof NamespacedKey) { - return (NamespacedKey) key.getHandle(); - } - return new BukkitKey1_16_R3(key.getName(), key.getKey()).getHandle(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/data/BukkitType1_16_R3.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/data/BukkitType1_16_R3.java deleted file mode 100644 index 8dce2d2..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/data/BukkitType1_16_R3.java +++ /dev/null @@ -1,69 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R3.data; - -import org.bukkit.persistence.PersistentDataAdapterContext; -import org.bukkit.persistence.PersistentDataType; - -import com.syntaxphoenix.syntaxapi.data.DataType; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; - -public class BukkitType1_16_R3 extends WrappedType1_16_R3, P0, P1, C0, C1> - implements PersistentDataType { - - private final DataType type; - - public BukkitType1_16_R3(DataType type) { - super(type.getPrimitive(), type.getComplex()); - this.type = type; - } - - @Override - public DataType getHandle() { - return type; - } - - @Override - public Class getPrimitiveOriginal() { - return type.getPrimitive(); - } - - @Override - public Class getComplexOriginal() { - return type.getComplex(); - } - - /* - * - */ - - @Override - public Class getComplexType() { - return complexType; - } - - @Override - public Class getPrimitiveType() { - return primitiveType; - } - - @Override - public P0 toPrimitive(C0 complex, PersistentDataAdapterContext context) { - return wrapToPrimitive(complex, new SyntaxContext1_16_R3(context)); - } - - @Override - public C0 fromPrimitive(P0 primitive, PersistentDataAdapterContext context) { - return wrapToComplex(primitive, new SyntaxContext1_16_R3(context)); - } - - @Override - public P0 wrapToPrimitive(C0 complex, WrappedContext context) { - return toPrimitiveWrapped(type.toPrimitive(context, toComplexOriginal(complex))); - } - - @Override - public C0 wrapToComplex(P0 primitive, WrappedContext context) { - return toComplexWrapped(type.fromPrimitive(context, toPrimitiveOriginal(primitive))); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/data/SimpleBukkitType1_16_R3.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/data/SimpleBukkitType1_16_R3.java deleted file mode 100644 index bad048e..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/data/SimpleBukkitType1_16_R3.java +++ /dev/null @@ -1,36 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R3.data; - -import org.bukkit.persistence.PersistentDataAdapterContext; -import org.bukkit.persistence.PersistentDataType; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; - -public class SimpleBukkitType1_16_R3 implements PersistentDataType { - - private final WrapType type; - - public SimpleBukkitType1_16_R3(WrapType type) { - this.type = type; - } - - @Override - public Class getComplexType() { - return type.getComplexWrapped(); - } - - @Override - public Class

getPrimitiveType() { - return type.getPrimitiveWrapped(); - } - - @Override - public P toPrimitive(C complex, PersistentDataAdapterContext context) { - return type.wrapToPrimitive(complex, new SyntaxContext1_16_R3(context)); - } - - @Override - public C fromPrimitive(P primitive, PersistentDataAdapterContext context) { - return type.wrapToComplex(primitive, new SyntaxContext1_16_R3(context)); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/data/SyntaxContainer1_16_R3.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/data/SyntaxContainer1_16_R3.java deleted file mode 100644 index ce5e07e..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/data/SyntaxContainer1_16_R3.java +++ /dev/null @@ -1,185 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R3.data; - -import java.util.Set; -import java.util.stream.Collectors; - -import org.bukkit.persistence.PersistentDataContainer; - -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.data.IDataContainer; -import com.syntaxphoenix.syntaxapi.utils.key.IKey; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SyntaxKey; - -public final class SyntaxContainer1_16_R3 extends WrappedContainer implements IDataContainer { - - private final PersistentDataContainer container; - - public SyntaxContainer1_16_R3(PersistentDataContainer container) { - this.container = container; - } - - @Override - public PersistentDataContainer getHandle() { - return container; - } - - @Override - public IDataContainer getAsSyntaxContainer() { - return new SyntaxContainer1_16_R3(container); - } - - /* - * - */ - - @Override - public boolean has(IKey key) { - throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); - } - - @Override - public boolean has(String key, DataType type) { - return has(syntaxKey(key), type); - } - - @Override - public boolean has(IKey key, DataType type) { - return has(new SyntaxKey(key), WrappedType1_16_R3.wrap(type)); - } - - @Override - public C get(String key, DataType type) { - return get(syntaxKey(key), type); - } - - @Override - public C get(IKey key, DataType type) { - return get(new SyntaxKey(key), WrappedType1_16_R3.wrap(type)); - } - - @Override - public Object get(String key) { - throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); - } - - @Override - public Object get(IKey key) { - throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); - } - - @Override - public void set(String key, E value, DataType type) { - set(wrappedKey(key), value, WrappedType1_16_R3.wrap(type)); - } - - @Override - public void set(IKey key, E value, DataType type) { - set(new SyntaxKey(key), value, WrappedType1_16_R3.wrap(type)); - } - - @Override - public boolean remove(String key) { - return remove(wrappedKey(key)); - } - - @Override - public boolean remove(IKey key) { - return remove(new SyntaxKey(key)); - } - - @Override - public IKey[] getKeys() { - return container.getKeys().stream().map(BukkitKey1_16_R3::new).map(WrappedKey::getNamespacedKey).toArray(IKey[]::new); - } - - @Override - public Set getKeyspaces() { - return container.getKeys().stream().map(org.bukkit.NamespacedKey::toString).collect(Collectors.toSet()); - } - - @Override - public DataAdapterContext getAdapterContext() { - return getContext(); - } - - /* - * - */ - - @Override - public SyntaxContext1_16_R3 getContext() { - return new SyntaxContext1_16_R3(container.getAdapterContext()); - } - - @Override - public boolean has(String key) { - throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); - } - - @Override - public boolean has(WrappedKey key) { - throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); - } - - @Override - public boolean has(String key, WrapType type) { - return has(wrappedKey(key), type); - } - - @Override - public boolean has(WrappedKey key, WrapType type) { - return container.has(BukkitKey1_16_R3.asBukkit(key), new SimpleBukkitType1_16_R3<>(type)); - } - - @Override - public Object get(WrappedKey key) { - throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); - } - - @Override - public C get(String key, WrapType type) { - return get(wrappedKey(key), type); - } - - @Override - public C get(WrappedKey key, WrapType type) { - return container.get(BukkitKey1_16_R3.asBukkit(key), new SimpleBukkitType1_16_R3<>(type)); - } - - @Override - public void set(String key, B value, WrapType type) { - set(wrappedKey(key), value, type); - } - - @Override - public void set(WrappedKey key, B value, WrapType type) { - container.set(BukkitKey1_16_R3.asBukkit(key), new SimpleBukkitType1_16_R3<>(type), value); - } - - @Override - public boolean remove(WrappedKey key) { - container.remove(BukkitKey1_16_R3.asBukkit(key)); - return true; // Will always return true as we don't know if it contained it - } - - @Override - public Set keySet() { - return getKeyspaces(); - } - - @Override - public boolean isEmpty() { - return container.isEmpty(); - } - - @Override - public int size() { - return container.getKeys().size(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/data/SyntaxContext1_16_R3.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/data/SyntaxContext1_16_R3.java deleted file mode 100644 index 7960bfa..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/data/SyntaxContext1_16_R3.java +++ /dev/null @@ -1,38 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R3.data; - -import org.bukkit.persistence.PersistentDataAdapterContext; -import org.bukkit.persistence.PersistentDataContainer; - -import com.syntaxphoenix.syntaxapi.data.IDataContainer; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; - -public final class SyntaxContext1_16_R3 extends WrappedContext implements PersistentDataAdapterContext { - - private final PersistentDataAdapterContext context; - - public SyntaxContext1_16_R3(PersistentDataAdapterContext context) { - this.context = context; - } - - @Override - public PersistentDataAdapterContext getHandle() { - return context; - } - - @Override - public PersistentDataContainer newPersistentDataContainer() { - return context.newPersistentDataContainer(); - } - - @Override - public IDataContainer newDataContainer() { - return newContainer(); - } - - @Override - public SyntaxContainer1_16_R3 newContainer() { - return new SyntaxContainer1_16_R3(context.newPersistentDataContainer()); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/data/SyntaxType1_16_R3.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/data/SyntaxType1_16_R3.java deleted file mode 100644 index 57cd421..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/data/SyntaxType1_16_R3.java +++ /dev/null @@ -1,76 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R3.data; - -import org.bukkit.persistence.PersistentDataAdapterContext; -import org.bukkit.persistence.PersistentDataType; - -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; - -public class SyntaxType1_16_R3 extends WrappedType1_16_R3, P0, P1, C0, C1> - implements DataType { - - private final PersistentDataType type; - - public SyntaxType1_16_R3(PersistentDataType type) { - super(type.getPrimitiveType(), type.getComplexType()); - this.type = type; - } - - @Override - public PersistentDataType getHandle() { - return type; - } - - @Override - public Class getPrimitiveOriginal() { - return type.getPrimitiveType(); - } - - @Override - public Class getComplexOriginal() { - return type.getComplexType(); - } - - /* - * - */ - - @Override - public Class getComplex() { - return complexType; - } - - @Override - public Class getPrimitive() { - return primitiveType; - } - - @Override - public P0 toPrimitive(DataAdapterContext context, C0 complex) { - return wrapToPrimitive(complex, new BukkitContext1_16_R3(context)); - } - - @Override - public C0 fromPrimitive(DataAdapterContext context, P0 primitive) { - return wrapToComplex(primitive, new BukkitContext1_16_R3(context)); - } - - @Override - public P0 wrapToPrimitive(C0 complex, WrappedContext context) { - if (!(context instanceof PersistentDataAdapterContext)) { - return null; - } - return toPrimitiveWrapped(type.toPrimitive(toComplexOriginal(complex), (PersistentDataAdapterContext) context)); - } - - @Override - public C0 wrapToComplex(P0 primitive, WrappedContext context) { - if (!(context instanceof PersistentDataAdapterContext)) { - return null; - } - return toComplexWrapped(type.fromPrimitive(toPrimitiveOriginal(primitive), (PersistentDataAdapterContext) context)); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/data/WrappedType1_16_R3.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/data/WrappedType1_16_R3.java deleted file mode 100644 index 6ca30a8..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/data/WrappedType1_16_R3.java +++ /dev/null @@ -1,150 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R3.data; - -import java.util.Arrays; - -import org.bukkit.persistence.PersistentDataContainer; -import org.bukkit.persistence.PersistentDataType; - -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.data.IDataContainer; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; - -public abstract class WrappedType1_16_R3 implements WrapType { - - protected final Class primitiveType; - protected final Class complexType; - - private final int primitiveWrap; - private final int complexWrap; - - @SuppressWarnings("unchecked") - protected WrappedType1_16_R3(Class primitive, Class complex) { - this.primitiveWrap = WrappedType1_16_R3.internalState(primitive); - this.complexWrap = WrappedType1_16_R3.internalState(complex); - this.primitiveType = (Class) WrappedType1_16_R3.internalWrap(primitive, primitiveWrap); - this.complexType = (Class) WrappedType1_16_R3.internalWrap(complex, complexWrap); - } - - public abstract H getHandle(); - - public Class getPrimitiveWrapped() { - return primitiveType; - } - - public Class getComplexWrapped() { - return complexType; - } - - public abstract Class getPrimitiveOriginal(); - - public abstract Class getComplexOriginal(); - - @SuppressWarnings("unchecked") - public P0 toPrimitiveWrapped(P1 primitive) { - switch (primitiveWrap) { - case 1: - return (P0) new SyntaxContainer1_16_R3((PersistentDataContainer) primitive); - case 2: - return (P0) Arrays.stream((PersistentDataContainer[]) primitive).map(SyntaxContainer1_16_R3::new) - .toArray(SyntaxContainer1_16_R3[]::new); - case 3: - return (P0) new BukkitContainer1_16_R3((IDataContainer) primitive); - case 4: - return (P0) Arrays.stream((IDataContainer[]) primitive).map(BukkitContainer1_16_R3::new) - .toArray(BukkitContainer1_16_R3[]::new); - default: - return (P0) primitive; - } - } - - @SuppressWarnings("unchecked") - public C0 toComplexWrapped(C1 complex) { - switch (complexWrap) { - case 1: - return (C0) new SyntaxContainer1_16_R3((PersistentDataContainer) complex); - case 2: - return (C0) Arrays.stream((PersistentDataContainer[]) complex).map(SyntaxContainer1_16_R3::new).toArray(SyntaxContainer1_16_R3[]::new); - case 3: - return (C0) new BukkitContainer1_16_R3((IDataContainer) complex); - case 4: - return (C0) Arrays.stream((IDataContainer[]) complex).map(BukkitContainer1_16_R3::new).toArray(BukkitContainer1_16_R3[]::new); - default: - return (C0) complex; - } - } - - @SuppressWarnings("unchecked") - public P1 toPrimitiveOriginal(P0 primitive) { - switch (primitiveWrap) { - case 1: - return (P1) new BukkitContainer1_16_R3((IDataContainer) primitive); - case 2: - return (P1) Arrays.stream((IDataContainer[]) primitive).map(BukkitContainer1_16_R3::new) - .toArray(BukkitContainer1_16_R3[]::new); - case 3: - return (P1) new SyntaxContainer1_16_R3((PersistentDataContainer) primitive); - case 4: - return (P1) Arrays.stream((PersistentDataContainer[]) primitive).map(SyntaxContainer1_16_R3::new) - .toArray(SyntaxContainer1_16_R3[]::new); - default: - return (P1) primitive; - } - } - - @SuppressWarnings("unchecked") - public C1 toComplexOriginal(C0 complex) { - switch (complexWrap) { - case 1: - return (C1) new BukkitContainer1_16_R3((IDataContainer) complex); - case 2: - return (C1) Arrays.stream((IDataContainer[]) complex).map(BukkitContainer1_16_R3::new).toArray(BukkitContainer1_16_R3[]::new); - case 3: - return (C1) new SyntaxContainer1_16_R3((PersistentDataContainer) complex); - case 4: - return (C1) Arrays.stream((PersistentDataContainer[]) complex).map(SyntaxContainer1_16_R3::new).toArray(SyntaxContainer1_16_R3[]::new); - default: - return (C1) complex; - } - } - - protected static Class internalWrap(Class clazz, int state) { - switch (state) { - case 1: - return SyntaxContainer1_16_R3.class; - case 2: - return SyntaxContainer1_16_R3[].class; - case 3: - return BukkitContainer1_16_R3.class; - case 4: - return BukkitContainer1_16_R3[].class; - default: - return clazz; - } - } - - protected static int internalState(Class clazz) { - if (clazz.isAssignableFrom(PersistentDataContainer.class)) { - return 1; - } - if (clazz.isAssignableFrom(PersistentDataContainer[].class)) { - return 2; - } - if (clazz.isAssignableFrom(IDataContainer.class)) { - return 3; - } - if (clazz.isAssignableFrom(IDataContainer[].class)) { - return 4; - } - return 0; - } - - public static BukkitType1_16_R3 wrap(DataType type) { - return new BukkitType1_16_R3<>(type); - } - - public static SyntaxType1_16_R3 wrap(PersistentDataType type) { - return new SyntaxType1_16_R3<>(type); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/data/hook/BukkitContainerAdapterHook1_16_R3.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/data/hook/BukkitContainerAdapterHook1_16_R3.java deleted file mode 100644 index c1bca14..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/data/hook/BukkitContainerAdapterHook1_16_R3.java +++ /dev/null @@ -1,134 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R3.data.hook; - -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; - -import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_16_R3.persistence.CraftPersistentDataContainer; -import org.bukkit.craftbukkit.v1_16_R3.persistence.CraftPersistentDataTypeRegistry; -import org.bukkit.persistence.PersistentDataContainer; - -import com.syntaxphoenix.syntaxapi.data.IDataContainer; -import com.syntaxphoenix.syntaxapi.data.container.nbt.NbtContainer; -import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; - -import net.minecraft.server.v1_16_R3.NBTTagCompound; -import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R3.data.BukkitContainer1_16_R3; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R3.data.SyntaxContainer1_16_R3; - -@SuppressWarnings({ - "rawtypes", - "unchecked" -}) -public final class BukkitContainerAdapterHook1_16_R3 { - - private static final BukkitContainerAdapterHook1_16_R3 HOOK = new BukkitContainerAdapterHook1_16_R3(); - - private final AbstractReflect registryRef = new Reflect(CraftPersistentDataTypeRegistry.class) - .searchMethod("create", "createAdapter", Class.class, Class.class, Function.class, Function.class) - .searchField("adapters", "adapters") - .searchField("function", "CREATE_ADAPTER"); - private final AbstractReflect entityRef = new Reflect(CraftEntity.class).searchField("registry", "DATA_TYPE_REGISTRY"); - - private BukkitContainerAdapterHook1_16_R3() {} - - private final HashMap map = new HashMap<>(); - - private CraftPersistentDataTypeRegistry getEntityRegistry() { - return (CraftPersistentDataTypeRegistry) entityRef.getFieldValue("registry"); - } - - private void uninjectAll() { - for (CraftPersistentDataTypeRegistry registry : map.keySet()) { - Map adapters = (Map) registryRef.getFieldValue("adapters", registry); - adapters.remove(BukkitContainer1_16_R3.class); - adapters.remove(SyntaxContainer1_16_R3.class); - registryRef.setFieldValue(registry, "function", map.get(registry)); - } - map.clear(); - } - - private void inject(CraftPersistentDataTypeRegistry registry) { - if (map.containsKey(registry)) { - return; - } - map.put(registry, (Function) registryRef.getFieldValue("function", registry)); - Function function = clazz -> createAdapter(registry, registryRef.getMethod("create").getReturnType(), (Class) clazz); - registryRef.setFieldValue(registry, "function", function); - } - - private E createAdapter(CraftPersistentDataTypeRegistry registry, Class adapterType, Class type) { - if (Objects.equals(BukkitContainer1_16_R3.class, type)) { - return (E) buildAdapter(registry, BukkitContainer1_16_R3.class, tag -> fromPrimitiveSyntax(tag)); - } - if (Objects.equals(SyntaxContainer1_16_R3.class, type)) { - return (E) buildAdapter(registry, SyntaxContainer1_16_R3.class, tag -> fromPrimitiveBukkit(registry, tag)); - } - return (E) map.get(registry).apply(type); - } - - private Object buildAdapter(Object handle, Class type, Function function) { - return registryRef.run(handle, "create", type, NBTTagCompound.class, (Function) input -> toPrimitive(input), - function); - } - - private NBTTagCompound toPrimitive(WrappedContainer input) { - Object handle = findFinalContainer(input).getHandle(); - if (handle instanceof PersistentDataContainer) { - if (handle instanceof CraftPersistentDataContainer) { - return ((CraftPersistentDataContainer) handle).toTagCompound(); - } - throw new IllegalArgumentException( - "Expected 'CraftPersistentDataContainer' got '" + handle.getClass().getSimpleName() + " instead'!"); - } - if (handle instanceof IDataContainer) { - if (handle instanceof NbtContainer) { - return (NBTTagCompound) VersionControl.get().getBukkitConversion().toMinecraftCompound(((NbtContainer) handle).asNbt()); - } - throw new IllegalArgumentException( - "Expected 'CraftPersistentDataContainer' got '" + handle.getClass().getSimpleName() + " instead'!"); - } - throw new IllegalArgumentException("Unknown WrappedContainer implementation!"); - } - - private BukkitContainer1_16_R3 fromPrimitiveSyntax(NBTTagCompound data) { - VersionControl control = VersionControl.get(); - NbtContainer container = new NbtContainer(control.getDataProvider().getRegistry()); - NbtCompound compound = control.getBukkitConversion().fromMinecraftCompound(data); - container.fromNbt(compound); - return new BukkitContainer1_16_R3(container); - } - - private SyntaxContainer1_16_R3 fromPrimitiveBukkit(CraftPersistentDataTypeRegistry registry, NBTTagCompound data) { - CraftPersistentDataContainer container = new CraftPersistentDataContainer(registry); - container.putAll(data); - return new SyntaxContainer1_16_R3(container); - } - - private WrappedContainer findFinalContainer(WrappedContainer container) { - WrappedContainer output = container; - while (output.getHandle() instanceof WrappedContainer) { - output = (WrappedContainer) output.getHandle(); - } - return output; - } - - public static void unhookAll() { - HOOK.uninjectAll(); - } - - public static void hookEntity() { - HOOK.inject(HOOK.getEntityRegistry()); - } - - public static void hook(CraftPersistentDataTypeRegistry registry) { - HOOK.inject(registry); - } - -} diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/entity/ArmorStand1_16_R3.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/entity/ArmorStand1_16_R3.java deleted file mode 100644 index 4553418..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/entity/ArmorStand1_16_R3.java +++ /dev/null @@ -1,24 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R3.entity; - -import net.minecraft.server.v1_16_R3.EntityArmorStand; -import net.minecraft.server.v1_16_R3.EntityTypes; -import net.minecraft.server.v1_16_R3.World; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsArmorStand; - -public class ArmorStand1_16_R3 extends EntityLiving1_16_R3 implements NmsArmorStand { - - public ArmorStand1_16_R3(World world) { - super(new EntityArmorStand(EntityTypes.ARMOR_STAND, world)); - } - - @Override - public void setSmall(boolean small) { - handle.setSmall(small); - } - - @Override - public boolean isSmall() { - return handle.isSmall(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/entity/Entity1_16_R3.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/entity/Entity1_16_R3.java deleted file mode 100644 index 01d37be..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/entity/Entity1_16_R3.java +++ /dev/null @@ -1,215 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R3.entity; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.OfflinePlayer; -import org.bukkit.craftbukkit.v1_16_R3.CraftWorld; -import org.bukkit.craftbukkit.v1_16_R3.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_16_R3.util.CraftChatMessage; -import org.bukkit.entity.Player; - -import net.minecraft.server.v1_16_R3.AxisAlignedBB; -import net.minecraft.server.v1_16_R3.Entity; -import net.minecraft.server.v1_16_R3.PacketPlayOutEntityDestroy; -import net.minecraft.server.v1_16_R3.PacketPlayOutEntityMetadata; -import net.minecraft.server.v1_16_R3.PacketPlayOutSpawnEntity; -import net.minecraft.server.v1_16_R3.PlayerConnection; -import net.minecraft.server.v1_16_R3.Vec3D; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.utils.NmsBoundingBox; - -public abstract class Entity1_16_R3 implements NmsEntity { - - protected final E handle; - - protected final List visible = Collections.synchronizedList(new ArrayList<>()); - - public Entity1_16_R3(E handle) { - this.handle = handle; - } - - @Override - public final E getHandle() { - return handle; - } - - @Override - public int getId() { - return handle.getId(); - } - - @Override - public UUID getUniqueId() { - return handle.getUniqueID(); - } - - @Override - public NmsBoundingBox getBoundingBox() { - AxisAlignedBB box = handle.getBoundingBox(); - return new NmsBoundingBox(box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ); - } - - @Override - public void setCustomName(String name) { - handle.setCustomName(CraftChatMessage.fromStringOrNull(name)); - updateVisibility(); - } - - @Override - public String getCustomName() { - return CraftChatMessage.fromComponent(handle.getCustomName()); - } - - @Override - public void setGravity(boolean gravity) { - handle.setNoGravity(!gravity); - } - - @Override - public boolean hasGravity() { - return !handle.isNoGravity(); - } - - @Override - public void setCustomNameVisible(boolean visible) { - handle.setCustomNameVisible(visible); - } - - @Override - public boolean isCustomNameVisible() { - return handle.getCustomNameVisible(); - } - - @Override - public void setInvisible(boolean invisible) { - handle.setInvisible(invisible); - } - - @Override - public boolean isInvisible() { - return handle.isInvisible(); - } - - @Override - public boolean isInteractable() { - return handle.isInteractable(); - } - - @Override - public boolean isCollidable() { - return handle.isCollidable(); - } - - @Override - public void setInvulnerable(boolean invulnerable) { - handle.setInvulnerable(invulnerable); - } - - @Override - public boolean isInvulnerable() { - return handle.isInvulnerable(); - } - - @Override - public void setLocation(Location location) { - handle.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); - if (location.getWorld() == null || handle.getWorld().getWorld() == location.getWorld()) { - updateVisibility(); - return; - } - handle.world = ((CraftWorld) location.getWorld()).getHandle(); - updateVisibility(); - } - - @Override - public Location getLocation() { - Vec3D vector = handle.getPositionVector(); - return new Location(handle.getWorld().getWorld(), vector.x, vector.y, vector.z); - } - - @Override - public void updateVisibility() { - if (visible.isEmpty()) { - return; - } - Player[] players; - synchronized (visible) { - players = visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) - .toArray(Player[]::new); - } - hide(players); - show(players); - } - - @Override - public boolean isShown(Player player) { - synchronized (visible) { - return visible.contains(player.getUniqueId()); - } - } - - @Override - public void hide(Player... players) { - if (players.length == 0) { - return; - } - PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(handle.getId()); - for (Player player : players) { - if (!isShown(player)) { - continue; - } - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); - synchronized (visible) { - visible.remove(player.getUniqueId()); - } - } - } - - @Override - public void show(Player... players) { - if (players.length == 0) { - return; - } - PacketPlayOutSpawnEntity packet = new PacketPlayOutSpawnEntity(handle); - PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); - PlayerConnection connection; - for (Player player : players) { - if (isShown(player)) { - continue; - } - connection = ((CraftPlayer) player).getHandle().playerConnection; - connection.sendPacket(packet); - connection.sendPacket(metadataPacket); - synchronized (visible) { - visible.add(player.getUniqueId()); - } - } - } - - @Override - public UUID[] getVisible() { - synchronized (visible) { - return visible.toArray(new UUID[0]); - } - } - - @Override - public Player[] getVisibleAsPlayer() { - synchronized (visible) { - return visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) - .toArray(Player[]::new); - } - } - - @Override - public void kill() { - hide(getVisibleAsPlayer()); - handle.die(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/entity/EntityLiving1_16_R3.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/entity/EntityLiving1_16_R3.java deleted file mode 100644 index 26d6638..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/entity/EntityLiving1_16_R3.java +++ /dev/null @@ -1,17 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R3.entity; - -import net.minecraft.server.v1_16_R3.EntityLiving; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityLiving; - -public abstract class EntityLiving1_16_R3 extends Entity1_16_R3 implements NmsEntityLiving { - - public EntityLiving1_16_R3(E handle) { - super(handle); - } - - @Override - public void setCollidable(boolean collidable) { - handle.collides = collidable; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/entity/Player1_16_R3.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/entity/Player1_16_R3.java deleted file mode 100644 index 10834fa..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/entity/Player1_16_R3.java +++ /dev/null @@ -1,295 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R3.entity; - -import java.util.ArrayList; -import java.util.Collections; - -import org.bukkit.craftbukkit.v1_16_R3.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_16_R3.util.CraftChatMessage; -import org.bukkit.entity.Player; - -import com.mojang.authlib.GameProfile; -import com.mojang.authlib.properties.Property; -import com.mojang.authlib.properties.PropertyMap; -import com.mojang.datafixers.util.Pair; - -import net.minecraft.server.v1_16_R3.BiomeManager; -import net.minecraft.server.v1_16_R3.EntityPlayer; -import net.minecraft.server.v1_16_R3.EnumItemSlot; -import net.minecraft.server.v1_16_R3.IChatBaseComponent; -import net.minecraft.server.v1_16_R3.ItemStack; -import net.minecraft.server.v1_16_R3.MathHelper; -import net.minecraft.server.v1_16_R3.PacketPlayInClientCommand; -import net.minecraft.server.v1_16_R3.PacketPlayInClientCommand.EnumClientCommand; -import net.minecraft.server.v1_16_R3.PacketPlayOutEntityDestroy; -import net.minecraft.server.v1_16_R3.PacketPlayOutEntityEquipment; -import net.minecraft.server.v1_16_R3.PacketPlayOutEntityHeadRotation; -import net.minecraft.server.v1_16_R3.PacketPlayOutEntityMetadata; -import net.minecraft.server.v1_16_R3.PacketPlayOutEntityStatus; -import net.minecraft.server.v1_16_R3.PacketPlayOutHeldItemSlot; -import net.minecraft.server.v1_16_R3.PacketPlayOutNamedEntitySpawn; -import net.minecraft.server.v1_16_R3.PacketPlayOutPlayerInfo; -import net.minecraft.server.v1_16_R3.PacketPlayOutPlayerInfo.EnumPlayerInfoAction; -import net.minecraft.server.v1_16_R3.PacketPlayOutPlayerListHeaderFooter; -import net.minecraft.server.v1_16_R3.PacketPlayOutPosition; -import net.minecraft.server.v1_16_R3.PacketPlayOutRespawn; -import net.minecraft.server.v1_16_R3.PacketPlayOutTitle; -import net.minecraft.server.v1_16_R3.PacketPlayOutTitle.EnumTitleAction; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.type.SkinDataType; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R3.data.SyntaxContainer1_16_R3; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; -import net.sourcewriters.minecraft.vcompat.utils.bukkit.Players; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.MojangProfileServer; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; -import net.sourcewriters.minecraft.vcompat.utils.thread.PostAsync; -import net.minecraft.server.v1_16_R3.PlayerConnection; -import net.minecraft.server.v1_16_R3.WorldServer; - -public class Player1_16_R3 extends EntityLiving1_16_R3 implements NmsPlayer { - - private String realName; - private Skin realSkin; - - private final WrappedContainer dataAdapter; - - public Player1_16_R3(Player player) { - super(((CraftPlayer) player).getHandle()); - dataAdapter = new SyntaxContainer1_16_R3(getBukkitPlayer().getPersistentDataContainer()); - update(false); - } - - @Override - public CraftPlayer getBukkitPlayer() { - return handle.getBukkitEntity(); - } - - @Override - public WrappedContainer getDataAdapter() { - return dataAdapter; - } - - @Override - public void setSkin(Skin skin) { - if (skin == null) { - return; - } - dataAdapter.set("skin", skin, SkinDataType.WRAPPED_INSTANCE); - } - - @Override - public Skin getSkin() { - return dataAdapter.getOrDefault("skin", SkinDataType.WRAPPED_INSTANCE, realSkin); - } - - @Override - public Skin getRealSkin() { - return realSkin; - } - - @Override - public void setName(String name) { - if (getName().equals(name)) { - return; - } - if (name == null) { - dataAdapter.remove("name"); - return; - } - dataAdapter.set("name", name, WrapType.STRING); - } - - @Override - public String getName() { - return dataAdapter.getOrDefault("name", WrapType.STRING, realName); - } - - @Override - public String getRealName() { - return realName; - } - - @Override - public void setPlayerListHeader(String text) { - setPlayerListHeaderAndFooter(text, getPlayerListFooter()); - } - - @Override - public String getPlayerListHeader() { - return dataAdapter.getOrDefault("header", WrapType.STRING, ""); - } - - @Override - public void setPlayerListFooter(String text) { - setPlayerListHeaderAndFooter(getPlayerListHeader(), text); - } - - @Override - public String getPlayerListFooter() { - return dataAdapter.getOrDefault("footer", WrapType.STRING, ""); - } - - @Override - public int getPing() { - return handle.ping; - } - - @Override - public void setPlayerListHeaderAndFooter(String header, String footer) { - dataAdapter.set("header", header, WrapType.STRING); - dataAdapter.set("footer", footer, WrapType.STRING); - sendPlayerListInfo(header, footer); - } - - private final void sendPlayerListInfo(String header, String footer) { - if (handle.playerConnection.isDisconnected()) { - return; - } - - IChatBaseComponent headerComponent = header.isEmpty() ? null : CraftChatMessage.fromStringOrNull(header, true); - IChatBaseComponent footerComponent = footer.isEmpty() ? null : CraftChatMessage.fromStringOrNull(footer, true); - - PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter(); - - packet.header = headerComponent; - packet.footer = footerComponent; - - handle.playerConnection.sendPacket(packet); - } - - @Override - public void setTitleTimes(int fadeIn, int stay, int fadeOut) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TIMES, null, fadeIn, stay, fadeOut)); - } - - @Override - public void sendSubtitle(String text) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.SUBTITLE, CraftChatMessage.fromStringOrNull(text))); - } - - @Override - public void sendTitle(String text) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TITLE, CraftChatMessage.fromStringOrNull(text))); - } - - @Override - public void sendActionBar(String text) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.ACTIONBAR, CraftChatMessage.fromStringOrNull(text))); - } - - @Override - public void fakeRespawn() { - if (handle.playerConnection.isDisconnected()) { - return; - } - PacketPlayOutPlayerInfo remInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER, handle); - PacketPlayOutPlayerInfo addInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.ADD_PLAYER, handle); - - PacketPlayOutEntityDestroy destroyPacket = new PacketPlayOutEntityDestroy(handle.getId()); - PacketPlayOutNamedEntitySpawn spawnPacket = new PacketPlayOutNamedEntitySpawn(handle); - PacketPlayOutEntityHeadRotation rotationPacket = new PacketPlayOutEntityHeadRotation(handle, - (byte) MathHelper.d(handle.getHeadRotation() * 256F / 360F)); - - ArrayList> list = new ArrayList<>(); - for (EnumItemSlot slot : EnumItemSlot.values()) { - list.add(Pair.of(slot, handle.getEquipment(slot))); - } - PacketPlayOutEntityEquipment equipmentPacket = new PacketPlayOutEntityEquipment(handle.getId(), list); - - Player self = getBukkitPlayer(); - Player[] players = Players.getOnlineWithout(getUniqueId()); - for (Player player : players) { - if (!player.canSee(self)) { - continue; - } - PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection; - connection.sendPacket(remInfoPacket); - connection.sendPacket(addInfoPacket); - connection.sendPacket(destroyPacket); - connection.sendPacket(spawnPacket); - connection.sendPacket(rotationPacket); - connection.sendPacket(equipmentPacket); - } - - WorldServer world = (WorldServer) handle.world; - - PacketPlayOutRespawn respawnPacket = new PacketPlayOutRespawn(world.getDimensionManager(), world.getDimensionKey(), - BiomeManager.a(world.getSeed()), handle.playerInteractManager.getGameMode(), handle.playerInteractManager.c(), - world.isDebugWorld(), world.isFlatWorld(), true); - PacketPlayOutPosition positionPacket = new PacketPlayOutPosition(handle.locX(), handle.locY(), handle.locZ(), handle.yaw, - handle.pitch, Collections.emptySet(), 0); - PacketPlayOutHeldItemSlot itemPacket = new PacketPlayOutHeldItemSlot(handle.inventory.itemInHandIndex); - PacketPlayOutEntityStatus statusPacket = new PacketPlayOutEntityStatus(handle, (byte) 28); - PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); - - PlayerConnection connection = handle.playerConnection; - connection.sendPacket(remInfoPacket); - connection.sendPacket(addInfoPacket); - connection.sendPacket(respawnPacket); - connection.sendPacket(positionPacket); - connection.sendPacket(itemPacket); - connection.sendPacket(statusPacket); - connection.sendPacket(metadataPacket); - - handle.updateAbilities(); - handle.triggerHealthUpdate(); - handle.updateInventory(handle.defaultContainer); - if (handle.activeContainer != handle.defaultContainer) { - handle.updateInventory(handle.activeContainer); - } - self.recalculatePermissions(); - } - - @Override - public void respawn() { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayInClientCommand(EnumClientCommand.PERFORM_RESPAWN)); - } - - @Override - public void update() { - update(true); - } - - private final void update(boolean flag) { - PostAsync.forcePost(() -> { - realName = MojangProfileServer.getName(getUniqueId()); - realSkin = MojangProfileServer.getSkin(realName, getUniqueId()); - }); - if (flag) { - GameProfile profile = handle.getProfile(); - - Skin skin = getSkin(); - if (skin != null) { - PropertyMap properties = profile.getProperties(); - properties.removeAll("textures"); - properties.put("textures", new Property("textures", skin.getValue(), skin.getSignature())); - } - - String name = getName(); - if (name != null) { - ReflectionProvider.DEFAULT.getReflect("mjGameProfile").setFieldValue(profile, "name", name); - } - - if (!(name == null && skin == null)) { - fakeRespawn(); - } - } - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/tools/BlockTools1_16_R3.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/tools/BlockTools1_16_R3.java deleted file mode 100644 index 9c730fc..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/tools/BlockTools1_16_R3.java +++ /dev/null @@ -1,39 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R3.tools; - -import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_16_R3.block.CraftSkull; - -import com.mojang.authlib.properties.Property; -import com.mojang.authlib.properties.PropertyMap; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; - -import net.minecraft.server.v1_16_R3.TileEntitySkull; -import net.sourcewriters.minecraft.vcompat.reflection.tools.BlockTools; -import net.sourcewriters.minecraft.vcompat.utils.constants.MinecraftConstants; - -public class BlockTools1_16_R3 extends BlockTools { - - private final AbstractReflect craftEntityStateRef = new Reflect(CraftSkull.class).searchField("tileEntity", "tileEntity"); - - @Override - public void setHeadTexture(Block block, String texture) { - if (!(block instanceof CraftSkull)) { - return; - } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); - PropertyMap map = entitySkull.gameProfile.getProperties(); - map.removeAll("textures"); - map.put("textures", new Property("textures", MinecraftConstants.TEXTURE_SIGNATURE, texture)); - } - - @Override - public String getHeadTexture(Block block) { - if (!(block instanceof CraftSkull)) { - return null; - } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); - return entitySkull.gameProfile.getProperties().get("textures").iterator().next().getValue(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/tools/ServerTools1_16_R3.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/tools/ServerTools1_16_R3.java deleted file mode 100644 index f819fda..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/tools/ServerTools1_16_R3.java +++ /dev/null @@ -1,27 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R3.tools; - -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_16_R3.CraftServer; - -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R3.wrapper.ConsoleReaderWrapper1_16_R3; -import net.sourcewriters.minecraft.vcompat.reflection.tools.ServerTools; - -public class ServerTools1_16_R3 extends ServerTools { - - @Override - public void setMotd(String text) { - ((CraftServer) Bukkit.getServer()).getServer().setMotd(text); - } - - @Override - public String getMotd() { - return ((CraftServer) Bukkit.getServer()).getServer().getMotd(); - } - - @SuppressWarnings("resource") - @Override - public ConsoleReaderWrapper1_16_R3 getConsole() { - return ConsoleReaderWrapper1_16_R3.INSTANCE; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/tools/SkinTools1_16_R3.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/tools/SkinTools1_16_R3.java deleted file mode 100644 index 4c1ef08..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/tools/SkinTools1_16_R3.java +++ /dev/null @@ -1,16 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R3.tools; - -import org.bukkit.craftbukkit.v1_16_R3.entity.CraftPlayer; -import org.bukkit.entity.Player; - -import net.sourcewriters.minecraft.vcompat.reflection.tools.SkinTools; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; - -public class SkinTools1_16_R3 extends SkinTools { - - @Override - public Skin skinFromPlayer(Player player) { - return skinFromGameProfile(((CraftPlayer) player).getHandle().getProfile()); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/utils/EntityConstructors1_16_R3.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/utils/EntityConstructors1_16_R3.java deleted file mode 100644 index a8581db..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/utils/EntityConstructors1_16_R3.java +++ /dev/null @@ -1,12 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R3.utils; - -import java.util.function.Function; - -import net.minecraft.server.v1_16_R3.World; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R3.entity.ArmorStand1_16_R3; - -public abstract class EntityConstructors1_16_R3 { - - public static final Function ARMOR_STAND = (world -> new ArmorStand1_16_R3(world)); - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/wrapper/ConsoleReaderWrapper1_16_R3.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/wrapper/ConsoleReaderWrapper1_16_R3.java deleted file mode 100644 index e80da03..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/wrapper/ConsoleReaderWrapper1_16_R3.java +++ /dev/null @@ -1,43 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_16_R3.wrapper; - -import java.io.IOException; -import java.io.Writer; - -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_16_R3.CraftServer; -import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; - -import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; - -public final class ConsoleReaderWrapper1_16_R3 extends ConsoleReaderWrapper { - - public static final ConsoleReaderWrapper1_16_R3 INSTANCE = new ConsoleReaderWrapper1_16_R3(); - - private final ConsoleReader reader; - - @SuppressWarnings("resource") - private ConsoleReaderWrapper1_16_R3() { - this.reader = ((CraftServer) Bukkit.getServer()).getServer().reader; - } - - @Override - public Writer getOutput() { - return reader.getOutput(); - } - - @Override - public boolean isAnsiSupported() { - return reader.getTerminal().isAnsiSupported(); - } - - @Override - public void flush() throws IOException { - reader.flush(); - } - - @Override - public void drawLine() throws IOException { - reader.drawLine(); - } - -} diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/BukkitConversion1_17_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/BukkitConversion1_17_R1.java deleted file mode 100644 index 0e53ca5..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/BukkitConversion1_17_R1.java +++ /dev/null @@ -1,218 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1; - -import java.util.Set; - -import org.bukkit.craftbukkit.v1_17_R1.inventory.CraftItemStack; -import org.bukkit.entity.EntityType; - -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.nbt.NbtByte; -import com.syntaxphoenix.syntaxapi.nbt.NbtByteArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; -import com.syntaxphoenix.syntaxapi.nbt.NbtDouble; -import com.syntaxphoenix.syntaxapi.nbt.NbtEnd; -import com.syntaxphoenix.syntaxapi.nbt.NbtFloat; -import com.syntaxphoenix.syntaxapi.nbt.NbtInt; -import com.syntaxphoenix.syntaxapi.nbt.NbtIntArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtList; -import com.syntaxphoenix.syntaxapi.nbt.NbtLong; -import com.syntaxphoenix.syntaxapi.nbt.NbtLongArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtShort; -import com.syntaxphoenix.syntaxapi.nbt.NbtString; -import com.syntaxphoenix.syntaxapi.nbt.NbtTag; -import com.syntaxphoenix.syntaxapi.nbt.NbtType; - -import net.minecraft.nbt.NBTBase; -import net.minecraft.nbt.NBTNumber; -import net.minecraft.nbt.NBTTagByte; -import net.minecraft.nbt.NBTTagByteArray; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagDouble; -import net.minecraft.nbt.NBTTagEnd; -import net.minecraft.nbt.NBTTagFloat; -import net.minecraft.nbt.NBTTagInt; -import net.minecraft.nbt.NBTTagIntArray; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.nbt.NBTTagLong; -import net.minecraft.nbt.NBTTagLongArray; -import net.minecraft.nbt.NBTTagShort; -import net.minecraft.nbt.NBTTagString; -import net.minecraft.world.item.ItemStack; -import net.sourcewriters.minecraft.vcompat.reflection.BukkitConversion; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.data.BukkitContext1_17_R1; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.data.BukkitType1_17_R1; - -public class BukkitConversion1_17_R1 extends BukkitConversion { - - protected BukkitConversion1_17_R1(VersionControl1_17_R1 versionControl) { - super(versionControl); - } - - @Override - public EntityType toEntityType(NmsEntityType type) { - try { - return EntityType.valueOf(type.name()); - } catch (IllegalArgumentException ignore) { - return null; - } - } - - @Override - public NmsEntityType fromEntityType(EntityType type) { - try { - return NmsEntityType.valueOf(type.name()); - } catch (IllegalArgumentException ignore) { - return null; - } - } - - @Override - public NBTBase toMinecraftTag(NbtTag tag) { - switch (tag.getType()) { - case BYTE: - return NBTTagByte.a((byte) tag.getValue()); - case SHORT: - return NBTTagShort.a((short) tag.getValue()); - case INT: - return NBTTagInt.a((int) tag.getValue()); - case LONG: - return NBTTagLong.a((long) tag.getValue()); - case FLOAT: - return NBTTagFloat.a((float) tag.getValue()); - case DOUBLE: - return NBTTagDouble.a((double) tag.getValue()); - case STRING: - return NBTTagString.a((String) tag.getValue()); - case BYTE_ARRAY: - return new NBTTagByteArray((byte[]) tag.getValue()); - case INT_ARRAY: - return new NBTTagIntArray((int[]) tag.getValue()); - case LONG_ARRAY: - return new NBTTagLongArray((long[]) tag.getValue()); - case LIST: - return toMinecraftList((NbtList) tag); - case COMPOUND: - return toMinecraftCompound((NbtCompound) tag); - case END: - return NBTTagEnd.b; - default: - return null; - } - } - - @Override - public NbtTag fromMinecraftTag(Object raw) { - if (!(raw instanceof NBTBase)) { - return null; - } - NBTBase tag = (NBTBase) raw; - NbtType type = NbtType.getById(tag.getTypeId()); - switch (type) { - case BYTE: - return new NbtByte(((NBTNumber) tag).asByte()); - case SHORT: - return new NbtShort(((NBTNumber) tag).asShort()); - case INT: - return new NbtInt(((NBTNumber) tag).asInt()); - case LONG: - return new NbtLong(((NBTNumber) tag).asLong()); - case FLOAT: - return new NbtFloat(((NBTNumber) tag).asFloat()); - case DOUBLE: - return new NbtDouble(((NBTNumber) tag).asDouble()); - case STRING: - return new NbtString(((NBTTagString) tag).asString()); - case BYTE_ARRAY: - return new NbtByteArray(((NBTTagByteArray) tag).getBytes()); - case INT_ARRAY: - return new NbtIntArray(((NBTTagIntArray) tag).getInts()); - case LONG_ARRAY: - return new NbtLongArray(((NBTTagLongArray) tag).getLongs()); - case LIST: - return fromMinecraftList(tag); - case COMPOUND: - return fromMinecraftCompound(tag); - case END: - return NbtEnd.INSTANCE; - default: - return null; - } - } - - @Override - public NBTTagList toMinecraftList(NbtList list) { - NBTTagList output = new NBTTagList(); - for (NbtTag tag : list) { - output.add(toMinecraftTag(tag)); - } - return output; - } - - @Override - public NbtList fromMinecraftList(Object raw) { - if (!(raw instanceof NBTTagList)) { - return null; - } - NBTTagList list = (NBTTagList) raw; - NbtList output = new NbtList<>(NbtType.getById(list.getTypeId())); - for (NBTBase base : list) { - output.add(fromMinecraftTag(base)); - } - return output; - } - - @Override - public NBTTagCompound toMinecraftCompound(NbtCompound compound) { - NBTTagCompound output = new NBTTagCompound(); - if (compound.isEmpty()) { - return output; - } - Set keys = compound.getKeys(); - for (String key : keys) { - output.set(key, toMinecraftTag(compound.get(key))); - } - return output; - } - - @Override - public NbtCompound fromMinecraftCompound(Object raw) { - if (!(raw instanceof NBTTagCompound)) { - return null; - } - NBTTagCompound compound = (NBTTagCompound) raw; - NbtCompound output = new NbtCompound(); - if (compound.isEmpty()) { - return output; - } - Set keys = compound.getKeys(); - for (String key : keys) { - output.set(key, fromMinecraftTag(compound.get(key))); - } - return output; - } - - @Override - public org.bukkit.inventory.ItemStack itemFromCompound(NbtCompound compound) { - return CraftItemStack.asBukkitCopy(ItemStack.a(toMinecraftCompound(compound))); - } - - @Override - public NbtCompound itemToCompound(org.bukkit.inventory.ItemStack itemStack) { - return fromMinecraftCompound(CraftItemStack.asNMSCopy(itemStack).save(new NBTTagCompound())); - } - - @Override - public WrappedContext createContext(DataAdapterContext context) { - return new BukkitContext1_17_R1(context); - } - - @Override - public WrapType wrap(DataType dataType) { - return new BukkitType1_17_R1<>(dataType); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/EntityProvider1_17_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/EntityProvider1_17_R1.java deleted file mode 100644 index 6a08ada..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/EntityProvider1_17_R1.java +++ /dev/null @@ -1,47 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1; - -import java.util.EnumMap; -import java.util.function.Function; - -import org.bukkit.craftbukkit.v1_17_R1.CraftWorld; - -import net.minecraft.world.level.World; -import net.sourcewriters.minecraft.vcompat.reflection.EntityProvider; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.utils.EntityConstructors1_17_R1; - -public class EntityProvider1_17_R1 extends EntityProvider { - - private final EnumMap> entityMap = new EnumMap<>(NmsEntityType.class); - - protected EntityProvider1_17_R1(VersionControl1_17_R1 versionControl) { - super(versionControl); - } - - @SuppressWarnings("unchecked") - private final Function searchConstructor(NmsEntityType type) { - try { - return (Function) EntityConstructors1_17_R1.class.getField(type.name()).get(null); - } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException ignore) { - return null; - } - } - - private final Function getConstructor(NmsEntityType type) { - return entityMap.computeIfAbsent(type, (key -> searchConstructor(key))); - } - - @Override - public NmsEntity createEntity(org.bukkit.World world, NmsEntityType type) { - if (!(world instanceof CraftWorld)) { - return null; - } - Function function; - if ((function = getConstructor(type)) == null) { - return null; - } - return function.apply(((CraftWorld) world).getHandle()); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/PacketHandler1_17_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/PacketHandler1_17_R1.java deleted file mode 100644 index 0e8f846..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/PacketHandler1_17_R1.java +++ /dev/null @@ -1,11 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1; - -import net.sourcewriters.minecraft.vcompat.reflection.PacketHandler; - -public class PacketHandler1_17_R1 extends PacketHandler { - - protected PacketHandler1_17_R1(VersionControl1_17_R1 versionControl) { - super(versionControl); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/PlayerProvider1_17_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/PlayerProvider1_17_R1.java deleted file mode 100644 index b86d64f..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/PlayerProvider1_17_R1.java +++ /dev/null @@ -1,20 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1; - -import org.bukkit.entity.Player; - -import net.sourcewriters.minecraft.vcompat.reflection.PlayerProvider; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.entity.Player1_17_R1; - -public class PlayerProvider1_17_R1 extends PlayerProvider { - - protected PlayerProvider1_17_R1(VersionControl1_17_R1 versionControl) { - super(versionControl); - } - - @Override - protected NmsPlayer createPlayer(Player player) { - return new Player1_17_R1(player); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/TextureProvider1_17_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/TextureProvider1_17_R1.java deleted file mode 100644 index 196d308..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/TextureProvider1_17_R1.java +++ /dev/null @@ -1,102 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1; - -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_17_R1.block.CraftBlockEntityState; -import org.bukkit.craftbukkit.v1_17_R1.block.CraftSkull; -import org.bukkit.craftbukkit.v1_17_R1.inventory.CraftItemStack; -import org.bukkit.inventory.meta.ItemMeta; -import org.bukkit.inventory.meta.SkullMeta; - -import com.mojang.authlib.GameProfile; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; - -import net.minecraft.nbt.GameProfileSerializer; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.block.entity.TileEntitySkull; -import net.sourcewriters.minecraft.vcompat.reflection.TextureProvider; - -public class TextureProvider1_17_R1 extends TextureProvider { - - private final AbstractReflect craftEntityStateRef = new Reflect(CraftBlockEntityState.class).searchField("tileEntity", "tileEntity"); - private final AbstractReflect craftItemStackRef = new Reflect(CraftItemStack.class).searchField("handle", "handle"); - private final AbstractReflect craftMetaSkullRef = new Reflect("org.bukkit.craftbukkit.v1_17_R1.inventory.CraftMetaSkull") - .searchField("serialized", "serializedProfile").searchField("profile", "profile"); - - protected TextureProvider1_17_R1(VersionControl1_17_R1 versionControl) { - super(versionControl); - } - - @Override - public GameProfile profileFromBlock(Block block) { - if (!(block instanceof CraftSkull)) { - return null; - } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); - return entitySkull.e; - } - - @Override - public GameProfile profileFromItem(org.bukkit.inventory.ItemStack itemStack) { - if (!(itemStack.getItemMeta() instanceof SkullMeta)) { - return null; - } - SkullMeta meta = (SkullMeta) itemStack.getItemMeta(); - GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue("profile", meta); - if (profile == null) { - NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue("serialized", meta); - if (compound == null) { - ItemStack stack = null; - if (itemStack instanceof CraftItemStack) { - stack = (ItemStack) craftItemStackRef.getFieldValue("handle", itemStack); - } - if (stack == null) { - stack = CraftItemStack.asNMSCopy(itemStack); - } - NBTTagCompound stackTag = stack.getOrCreateTag(); - if (stackTag.hasKeyOfType("SkullOwner", 10)) { - compound = stackTag.getCompound("SkullOwner"); - } else if (stackTag.hasKeyOfType("SkullProfile", 10)) { - compound = stackTag.getCompound("SkullProfile"); - } - } - if (compound == null) { - return null; - } - profile = GameProfileSerializer.deserialize(compound); - } - return profile; - } - - @Override - public org.bukkit.inventory.ItemStack getItem(GameProfile profile) { - org.bukkit.inventory.ItemStack craftStack = CraftItemStack.asCraftCopy(new org.bukkit.inventory.ItemStack(Material.PLAYER_HEAD)); - applyItem(craftStack, profile); - return craftStack; - } - - @Override - public boolean applyItem(org.bukkit.inventory.ItemStack itemStack, GameProfile profile) { - ItemMeta meta = itemStack.getItemMeta(); - if (!(meta instanceof SkullMeta)) { - return false; - } - SkullMeta skullMeta = (SkullMeta) meta; - craftMetaSkullRef.setFieldValue(meta, "profile", profile); - itemStack.setItemMeta(skullMeta); - return true; - } - - @Override - public boolean applyBlock(Block block, GameProfile profile) { - if (!(block instanceof CraftSkull)) { - return false; - } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); - entitySkull.setGameProfile(profile); - return true; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/ToolProvider1_17_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/ToolProvider1_17_R1.java deleted file mode 100644 index 5a588bb..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/ToolProvider1_17_R1.java +++ /dev/null @@ -1,33 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1; - -import net.sourcewriters.minecraft.vcompat.reflection.ToolProvider; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.tools.BlockTools1_17_R1; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.tools.ServerTools1_17_R1; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.tools.SkinTools1_17_R1; - -public class ToolProvider1_17_R1 extends ToolProvider { - - private final BlockTools1_17_R1 blockTools = new BlockTools1_17_R1(); - private final SkinTools1_17_R1 skinTools = new SkinTools1_17_R1(); - private final ServerTools1_17_R1 serverTools = new ServerTools1_17_R1(); - - protected ToolProvider1_17_R1(VersionControl1_17_R1 versionControl) { - super(versionControl); - } - - @Override - public SkinTools1_17_R1 getSkinTools() { - return skinTools; - } - - @Override - public ServerTools1_17_R1 getServerTools() { - return serverTools; - } - - @Override - public BlockTools1_17_R1 getBlockTools() { - return blockTools; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/VersionControl1_17_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/VersionControl1_17_R1.java deleted file mode 100644 index 9637a7f..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/VersionControl1_17_R1.java +++ /dev/null @@ -1,61 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1; - -import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.data.hook.BukkitContainerAdapterHook1_17_R1; - -public class VersionControl1_17_R1 extends VersionControl { - - public static VersionControl1_17_R1 INSTANCE; - - public static VersionControl1_17_R1 init() { - return INSTANCE != null ? INSTANCE : (INSTANCE = new VersionControl1_17_R1()); - } - - private final ToolProvider1_17_R1 toolProvider = new ToolProvider1_17_R1(this); - private final TextureProvider1_17_R1 textureProvider = new TextureProvider1_17_R1(this); - private final PacketHandler1_17_R1 packetHandler = new PacketHandler1_17_R1(this); - private final EntityProvider1_17_R1 entityProvider = new EntityProvider1_17_R1(this); - private final PlayerProvider1_17_R1 playerProvider = new PlayerProvider1_17_R1(this); - private final BukkitConversion1_17_R1 bukkitConversion = new BukkitConversion1_17_R1(this); - - private VersionControl1_17_R1() { - BukkitContainerAdapterHook1_17_R1.hookEntity(); - } - - @Override - public ToolProvider1_17_R1 getToolProvider() { - return toolProvider; - } - - @Override - public EntityProvider1_17_R1 getEntityProvider() { - return entityProvider; - } - - @Override - public PlayerProvider1_17_R1 getPlayerProvider() { - return playerProvider; - } - - @Override - public TextureProvider1_17_R1 getTextureProvider() { - return textureProvider; - } - - @Override - public PacketHandler1_17_R1 getPacketHandler() { - return packetHandler; - } - - @Override - public BukkitConversion1_17_R1 getBukkitConversion() { - return bukkitConversion; - } - - @Override - public void shutdown() { - dataProvider.getDefaultDistributor().shutdown(); - BukkitContainerAdapterHook1_17_R1.unhookAll(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/BukkitContainer1_17_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/BukkitContainer1_17_R1.java deleted file mode 100644 index 9394231..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/BukkitContainer1_17_R1.java +++ /dev/null @@ -1,161 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.data; - -import java.util.Arrays; -import java.util.Optional; -import java.util.Set; -import java.util.stream.Collectors; - -import org.bukkit.NamespacedKey; -import org.bukkit.persistence.PersistentDataAdapterContext; -import org.bukkit.persistence.PersistentDataContainer; -import org.bukkit.persistence.PersistentDataType; - -import com.syntaxphoenix.syntaxapi.data.IDataContainer; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SyntaxKey; - -public final class BukkitContainer1_17_R1 extends WrappedContainer implements PersistentDataContainer { - - private final IDataContainer container; - - public BukkitContainer1_17_R1(IDataContainer container) { - this.container = container; - } - - @Override - public IDataContainer getHandle() { - return container; - } - - @Override - public IDataContainer getAsSyntaxContainer() { - return container; - } - - /* - * - */ - - @Override - public boolean has(NamespacedKey key, PersistentDataType type) { - return has(new BukkitKey1_17_R1(key), WrappedType1_17_R1.wrap(type)); - } - - @Override - public Z get(NamespacedKey key, PersistentDataType type) { - return get(new BukkitKey1_17_R1(key), WrappedType1_17_R1.wrap(type)); - } - - @Override - public Z getOrDefault(NamespacedKey key, PersistentDataType type, Z value) { - return Optional.ofNullable(get(key, type)).orElse(value); - } - - @Override - public void set(NamespacedKey key, PersistentDataType type, Z value) { - set(new BukkitKey1_17_R1(key), value, WrappedType1_17_R1.wrap(type)); - } - - @Override - public void remove(NamespacedKey key) { - remove(new BukkitKey1_17_R1(key)); - } - - @Override - public Set getKeys() { - return Arrays.stream(container.getKeys()).map(SyntaxKey::new).map(BukkitKey1_17_R1::asBukkit).collect(Collectors.toSet()); - } - - @Override - public PersistentDataAdapterContext getAdapterContext() { - return getContext(); - } - - /* - * - */ - - @Override - public BukkitContext1_17_R1 getContext() { - return new BukkitContext1_17_R1(container.getAdapterContext()); - } - - @Override - public boolean has(String key) { - return has(wrappedKey(key)); - } - - @Override - public boolean has(WrappedKey key) { - return container.has(key.getNamespacedKey()); - } - - @Override - public boolean has(String key, WrapType type) { - return has(wrappedKey(key), type); - } - - @Override - public boolean has(WrappedKey key, WrapType type) { - return container.has(key.getNamespacedKey(), type.syntaxType()); - } - - @Override - public Object get(String key) { - return get(wrappedKey(key)); - } - - @Override - public Object get(WrappedKey key) { - return container.get(key.getNamespacedKey()); - } - - @Override - public C get(String key, WrapType type) { - return get(wrappedKey(key), type); - } - - @Override - public C get(WrappedKey key, WrapType type) { - return container.get(key.getNamespacedKey(), type.syntaxType()); - } - - @Override - public void set(String key, B value, WrapType type) { - set(wrappedKey(key), value, type); - } - - @Override - public void set(WrappedKey key, B value, WrapType type) { - container.set(key.getNamespacedKey(), value, type.syntaxType()); - } - - @Override - public boolean remove(String key) { - return false; - } - - @Override - public boolean remove(WrappedKey key) { - return container.remove(key.getNamespacedKey()); - } - - @Override - public Set keySet() { - return container.getKeyspaces(); - } - - @Override - public boolean isEmpty() { - return container.isEmpty(); - } - - @Override - public int size() { - return container.size(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/BukkitContext1_17_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/BukkitContext1_17_R1.java deleted file mode 100644 index 1e702c2..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/BukkitContext1_17_R1.java +++ /dev/null @@ -1,39 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.data; - -import org.bukkit.persistence.PersistentDataAdapterContext; -import org.bukkit.persistence.PersistentDataContainer; - -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.IDataContainer; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; - -public final class BukkitContext1_17_R1 extends WrappedContext implements PersistentDataAdapterContext { - - private final DataAdapterContext context; - - public BukkitContext1_17_R1(DataAdapterContext context) { - this.context = context; - } - - @Override - public DataAdapterContext getHandle() { - return context; - } - - @Override - public PersistentDataContainer newPersistentDataContainer() { - return newContainer(); - } - - @Override - public IDataContainer newDataContainer() { - return context.newDataContainer(); - } - - @Override - public BukkitContainer1_17_R1 newContainer() { - return new BukkitContainer1_17_R1(context.newDataContainer()); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/BukkitKey1_17_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/BukkitKey1_17_R1.java deleted file mode 100644 index 444fe6a..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/BukkitKey1_17_R1.java +++ /dev/null @@ -1,52 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.data; - -import org.bukkit.NamespacedKey; -import org.bukkit.plugin.Plugin; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; - -public final class BukkitKey1_17_R1 extends WrappedKey { - - private final NamespacedKey key; - - public BukkitKey1_17_R1(Plugin plugin, String key) { - this.key = new NamespacedKey(plugin, key); - } - - @SuppressWarnings("deprecation") - public BukkitKey1_17_R1(String name, String key) { - this.key = new NamespacedKey(name, key); - } - - public BukkitKey1_17_R1(NamespacedKey key) { - this.key = key; - } - - @Override - public NamespacedKey getHandle() { - return key; - } - - @Override - public String getName() { - return key.getNamespace(); - } - - @Override - public String getKey() { - return key.getKey(); - } - - @Override - public String toString() { - return key.toString(); - } - - public static NamespacedKey asBukkit(WrappedKey key) { - if (key.getHandle() instanceof NamespacedKey) { - return (NamespacedKey) key.getHandle(); - } - return new BukkitKey1_17_R1(key.getName(), key.getKey()).getHandle(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/BukkitType1_17_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/BukkitType1_17_R1.java deleted file mode 100644 index 1f69230..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/BukkitType1_17_R1.java +++ /dev/null @@ -1,69 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.data; - -import org.bukkit.persistence.PersistentDataAdapterContext; -import org.bukkit.persistence.PersistentDataType; - -import com.syntaxphoenix.syntaxapi.data.DataType; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; - -public class BukkitType1_17_R1 extends WrappedType1_17_R1, P0, P1, C0, C1> - implements PersistentDataType { - - private final DataType type; - - public BukkitType1_17_R1(DataType type) { - super(type.getPrimitive(), type.getComplex()); - this.type = type; - } - - @Override - public DataType getHandle() { - return type; - } - - @Override - public Class getPrimitiveOriginal() { - return type.getPrimitive(); - } - - @Override - public Class getComplexOriginal() { - return type.getComplex(); - } - - /* - * - */ - - @Override - public Class getComplexType() { - return complexType; - } - - @Override - public Class getPrimitiveType() { - return primitiveType; - } - - @Override - public P0 toPrimitive(C0 complex, PersistentDataAdapterContext context) { - return wrapToPrimitive(complex, new SyntaxContext1_17_R1(context)); - } - - @Override - public C0 fromPrimitive(P0 primitive, PersistentDataAdapterContext context) { - return wrapToComplex(primitive, new SyntaxContext1_17_R1(context)); - } - - @Override - public P0 wrapToPrimitive(C0 complex, WrappedContext context) { - return toPrimitiveWrapped(type.toPrimitive(context, toComplexOriginal(complex))); - } - - @Override - public C0 wrapToComplex(P0 primitive, WrappedContext context) { - return toComplexWrapped(type.fromPrimitive(context, toPrimitiveOriginal(primitive))); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/SimpleBukkitType1_17_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/SimpleBukkitType1_17_R1.java deleted file mode 100644 index 781aeea..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/SimpleBukkitType1_17_R1.java +++ /dev/null @@ -1,36 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.data; - -import org.bukkit.persistence.PersistentDataAdapterContext; -import org.bukkit.persistence.PersistentDataType; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; - -public class SimpleBukkitType1_17_R1 implements PersistentDataType { - - private final WrapType type; - - public SimpleBukkitType1_17_R1(WrapType type) { - this.type = type; - } - - @Override - public Class getComplexType() { - return type.getComplexWrapped(); - } - - @Override - public Class

getPrimitiveType() { - return type.getPrimitiveWrapped(); - } - - @Override - public P toPrimitive(C complex, PersistentDataAdapterContext context) { - return type.wrapToPrimitive(complex, new SyntaxContext1_17_R1(context)); - } - - @Override - public C fromPrimitive(P primitive, PersistentDataAdapterContext context) { - return type.wrapToComplex(primitive, new SyntaxContext1_17_R1(context)); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/SyntaxContainer1_17_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/SyntaxContainer1_17_R1.java deleted file mode 100644 index b8df612..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/SyntaxContainer1_17_R1.java +++ /dev/null @@ -1,185 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.data; - -import java.util.Set; -import java.util.stream.Collectors; - -import org.bukkit.persistence.PersistentDataContainer; - -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.data.IDataContainer; -import com.syntaxphoenix.syntaxapi.utils.key.IKey; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SyntaxKey; - -public final class SyntaxContainer1_17_R1 extends WrappedContainer implements IDataContainer { - - private final PersistentDataContainer container; - - public SyntaxContainer1_17_R1(PersistentDataContainer container) { - this.container = container; - } - - @Override - public PersistentDataContainer getHandle() { - return container; - } - - @Override - public IDataContainer getAsSyntaxContainer() { - return new SyntaxContainer1_17_R1(container); - } - - /* - * - */ - - @Override - public boolean has(IKey key) { - throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); - } - - @Override - public boolean has(String key, DataType type) { - return has(syntaxKey(key), type); - } - - @Override - public boolean has(IKey key, DataType type) { - return has(new SyntaxKey(key), WrappedType1_17_R1.wrap(type)); - } - - @Override - public C get(String key, DataType type) { - return get(syntaxKey(key), type); - } - - @Override - public C get(IKey key, DataType type) { - return get(new SyntaxKey(key), WrappedType1_17_R1.wrap(type)); - } - - @Override - public Object get(String key) { - throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); - } - - @Override - public Object get(IKey key) { - throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); - } - - @Override - public void set(String key, E value, DataType type) { - set(wrappedKey(key), value, WrappedType1_17_R1.wrap(type)); - } - - @Override - public void set(IKey key, E value, DataType type) { - set(new SyntaxKey(key), value, WrappedType1_17_R1.wrap(type)); - } - - @Override - public boolean remove(String key) { - return remove(wrappedKey(key)); - } - - @Override - public boolean remove(IKey key) { - return remove(new SyntaxKey(key)); - } - - @Override - public IKey[] getKeys() { - return container.getKeys().stream().map(BukkitKey1_17_R1::new).map(WrappedKey::getNamespacedKey).toArray(IKey[]::new); - } - - @Override - public Set getKeyspaces() { - return container.getKeys().stream().map(org.bukkit.NamespacedKey::toString).collect(Collectors.toSet()); - } - - @Override - public DataAdapterContext getAdapterContext() { - return getContext(); - } - - /* - * - */ - - @Override - public SyntaxContext1_17_R1 getContext() { - return new SyntaxContext1_17_R1(container.getAdapterContext()); - } - - @Override - public boolean has(String key) { - throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); - } - - @Override - public boolean has(WrappedKey key) { - throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); - } - - @Override - public boolean has(String key, WrapType type) { - return has(wrappedKey(key), type); - } - - @Override - public boolean has(WrappedKey key, WrapType type) { - return container.has(BukkitKey1_17_R1.asBukkit(key), new SimpleBukkitType1_17_R1<>(type)); - } - - @Override - public Object get(WrappedKey key) { - throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); - } - - @Override - public C get(String key, WrapType type) { - return get(wrappedKey(key), type); - } - - @Override - public C get(WrappedKey key, WrapType type) { - return container.get(BukkitKey1_17_R1.asBukkit(key), new SimpleBukkitType1_17_R1<>(type)); - } - - @Override - public void set(String key, B value, WrapType type) { - set(wrappedKey(key), value, type); - } - - @Override - public void set(WrappedKey key, B value, WrapType type) { - container.set(BukkitKey1_17_R1.asBukkit(key), new SimpleBukkitType1_17_R1<>(type), value); - } - - @Override - public boolean remove(WrappedKey key) { - container.remove(BukkitKey1_17_R1.asBukkit(key)); - return true; // Will always return true as we don't know if it contained it - } - - @Override - public Set keySet() { - return getKeyspaces(); - } - - @Override - public boolean isEmpty() { - return container.isEmpty(); - } - - @Override - public int size() { - return container.getKeys().size(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/SyntaxContext1_17_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/SyntaxContext1_17_R1.java deleted file mode 100644 index 097f452..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/SyntaxContext1_17_R1.java +++ /dev/null @@ -1,38 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.data; - -import org.bukkit.persistence.PersistentDataAdapterContext; -import org.bukkit.persistence.PersistentDataContainer; - -import com.syntaxphoenix.syntaxapi.data.IDataContainer; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; - -public final class SyntaxContext1_17_R1 extends WrappedContext implements PersistentDataAdapterContext { - - private final PersistentDataAdapterContext context; - - public SyntaxContext1_17_R1(PersistentDataAdapterContext context) { - this.context = context; - } - - @Override - public PersistentDataAdapterContext getHandle() { - return context; - } - - @Override - public PersistentDataContainer newPersistentDataContainer() { - return context.newPersistentDataContainer(); - } - - @Override - public IDataContainer newDataContainer() { - return newContainer(); - } - - @Override - public SyntaxContainer1_17_R1 newContainer() { - return new SyntaxContainer1_17_R1(context.newPersistentDataContainer()); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/SyntaxType1_17_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/SyntaxType1_17_R1.java deleted file mode 100644 index 024c8d1..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/SyntaxType1_17_R1.java +++ /dev/null @@ -1,76 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.data; - -import org.bukkit.persistence.PersistentDataAdapterContext; -import org.bukkit.persistence.PersistentDataType; - -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; - -public class SyntaxType1_17_R1 extends WrappedType1_17_R1, P0, P1, C0, C1> - implements DataType { - - private final PersistentDataType type; - - public SyntaxType1_17_R1(PersistentDataType type) { - super(type.getPrimitiveType(), type.getComplexType()); - this.type = type; - } - - @Override - public PersistentDataType getHandle() { - return type; - } - - @Override - public Class getPrimitiveOriginal() { - return type.getPrimitiveType(); - } - - @Override - public Class getComplexOriginal() { - return type.getComplexType(); - } - - /* - * - */ - - @Override - public Class getComplex() { - return complexType; - } - - @Override - public Class getPrimitive() { - return primitiveType; - } - - @Override - public P0 toPrimitive(DataAdapterContext context, C0 complex) { - return wrapToPrimitive(complex, new BukkitContext1_17_R1(context)); - } - - @Override - public C0 fromPrimitive(DataAdapterContext context, P0 primitive) { - return wrapToComplex(primitive, new BukkitContext1_17_R1(context)); - } - - @Override - public P0 wrapToPrimitive(C0 complex, WrappedContext context) { - if (!(context instanceof PersistentDataAdapterContext)) { - return null; - } - return toPrimitiveWrapped(type.toPrimitive(toComplexOriginal(complex), (PersistentDataAdapterContext) context)); - } - - @Override - public C0 wrapToComplex(P0 primitive, WrappedContext context) { - if (!(context instanceof PersistentDataAdapterContext)) { - return null; - } - return toComplexWrapped(type.fromPrimitive(toPrimitiveOriginal(primitive), (PersistentDataAdapterContext) context)); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/WrappedType1_17_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/WrappedType1_17_R1.java deleted file mode 100644 index 2444fad..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/WrappedType1_17_R1.java +++ /dev/null @@ -1,150 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.data; - -import java.util.Arrays; - -import org.bukkit.persistence.PersistentDataContainer; -import org.bukkit.persistence.PersistentDataType; - -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.data.IDataContainer; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; - -public abstract class WrappedType1_17_R1 implements WrapType { - - protected final Class primitiveType; - protected final Class complexType; - - private final int primitiveWrap; - private final int complexWrap; - - @SuppressWarnings("unchecked") - protected WrappedType1_17_R1(Class primitive, Class complex) { - this.primitiveWrap = WrappedType1_17_R1.internalState(primitive); - this.complexWrap = WrappedType1_17_R1.internalState(complex); - this.primitiveType = (Class) WrappedType1_17_R1.internalWrap(primitive, primitiveWrap); - this.complexType = (Class) WrappedType1_17_R1.internalWrap(complex, complexWrap); - } - - public abstract H getHandle(); - - public Class getPrimitiveWrapped() { - return primitiveType; - } - - public Class getComplexWrapped() { - return complexType; - } - - public abstract Class getPrimitiveOriginal(); - - public abstract Class getComplexOriginal(); - - @SuppressWarnings("unchecked") - public P0 toPrimitiveWrapped(P1 primitive) { - switch (primitiveWrap) { - case 1: - return (P0) new SyntaxContainer1_17_R1((PersistentDataContainer) primitive); - case 2: - return (P0) Arrays.stream((PersistentDataContainer[]) primitive).map(SyntaxContainer1_17_R1::new) - .toArray(SyntaxContainer1_17_R1[]::new); - case 3: - return (P0) new BukkitContainer1_17_R1((IDataContainer) primitive); - case 4: - return (P0) Arrays.stream((IDataContainer[]) primitive).map(BukkitContainer1_17_R1::new) - .toArray(BukkitContainer1_17_R1[]::new); - default: - return (P0) primitive; - } - } - - @SuppressWarnings("unchecked") - public C0 toComplexWrapped(C1 complex) { - switch (complexWrap) { - case 1: - return (C0) new SyntaxContainer1_17_R1((PersistentDataContainer) complex); - case 2: - return (C0) Arrays.stream((PersistentDataContainer[]) complex).map(SyntaxContainer1_17_R1::new).toArray(SyntaxContainer1_17_R1[]::new); - case 3: - return (C0) new BukkitContainer1_17_R1((IDataContainer) complex); - case 4: - return (C0) Arrays.stream((IDataContainer[]) complex).map(BukkitContainer1_17_R1::new).toArray(BukkitContainer1_17_R1[]::new); - default: - return (C0) complex; - } - } - - @SuppressWarnings("unchecked") - public P1 toPrimitiveOriginal(P0 primitive) { - switch (primitiveWrap) { - case 1: - return (P1) new BukkitContainer1_17_R1((IDataContainer) primitive); - case 2: - return (P1) Arrays.stream((IDataContainer[]) primitive).map(BukkitContainer1_17_R1::new) - .toArray(BukkitContainer1_17_R1[]::new); - case 3: - return (P1) new SyntaxContainer1_17_R1((PersistentDataContainer) primitive); - case 4: - return (P1) Arrays.stream((PersistentDataContainer[]) primitive).map(SyntaxContainer1_17_R1::new) - .toArray(SyntaxContainer1_17_R1[]::new); - default: - return (P1) primitive; - } - } - - @SuppressWarnings("unchecked") - public C1 toComplexOriginal(C0 complex) { - switch (complexWrap) { - case 1: - return (C1) new BukkitContainer1_17_R1((IDataContainer) complex); - case 2: - return (C1) Arrays.stream((IDataContainer[]) complex).map(BukkitContainer1_17_R1::new).toArray(BukkitContainer1_17_R1[]::new); - case 3: - return (C1) new SyntaxContainer1_17_R1((PersistentDataContainer) complex); - case 4: - return (C1) Arrays.stream((PersistentDataContainer[]) complex).map(SyntaxContainer1_17_R1::new).toArray(SyntaxContainer1_17_R1[]::new); - default: - return (C1) complex; - } - } - - protected static Class internalWrap(Class clazz, int state) { - switch (state) { - case 1: - return SyntaxContainer1_17_R1.class; - case 2: - return SyntaxContainer1_17_R1[].class; - case 3: - return BukkitContainer1_17_R1.class; - case 4: - return BukkitContainer1_17_R1[].class; - default: - return clazz; - } - } - - protected static int internalState(Class clazz) { - if (clazz.isAssignableFrom(PersistentDataContainer.class)) { - return 1; - } - if (clazz.isAssignableFrom(PersistentDataContainer[].class)) { - return 2; - } - if (clazz.isAssignableFrom(IDataContainer.class)) { - return 3; - } - if (clazz.isAssignableFrom(IDataContainer[].class)) { - return 4; - } - return 0; - } - - public static BukkitType1_17_R1 wrap(DataType type) { - return new BukkitType1_17_R1<>(type); - } - - public static SyntaxType1_17_R1 wrap(PersistentDataType type) { - return new SyntaxType1_17_R1<>(type); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/hook/BukkitContainerAdapterHook1_17_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/hook/BukkitContainerAdapterHook1_17_R1.java deleted file mode 100644 index 72b6ccd..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/data/hook/BukkitContainerAdapterHook1_17_R1.java +++ /dev/null @@ -1,134 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.data.hook; - -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; - -import org.bukkit.craftbukkit.v1_17_R1.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_17_R1.persistence.CraftPersistentDataContainer; -import org.bukkit.craftbukkit.v1_17_R1.persistence.CraftPersistentDataTypeRegistry; -import org.bukkit.persistence.PersistentDataContainer; - -import com.syntaxphoenix.syntaxapi.data.IDataContainer; -import com.syntaxphoenix.syntaxapi.data.container.nbt.NbtContainer; -import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; - -import net.minecraft.nbt.NBTTagCompound; -import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.data.BukkitContainer1_17_R1; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.data.SyntaxContainer1_17_R1; - -@SuppressWarnings({ - "rawtypes", - "unchecked" -}) -public final class BukkitContainerAdapterHook1_17_R1 { - - private static final BukkitContainerAdapterHook1_17_R1 HOOK = new BukkitContainerAdapterHook1_17_R1(); - - private final AbstractReflect registryRef = new Reflect(CraftPersistentDataTypeRegistry.class) - .searchMethod("create", "createAdapter", Class.class, Class.class, Function.class, Function.class) - .searchField("adapters", "adapters") - .searchField("function", "CREATE_ADAPTER"); - private final AbstractReflect entityRef = new Reflect(CraftEntity.class).searchField("registry", "DATA_TYPE_REGISTRY"); - - private BukkitContainerAdapterHook1_17_R1() {} - - private final HashMap map = new HashMap<>(); - - private CraftPersistentDataTypeRegistry getEntityRegistry() { - return (CraftPersistentDataTypeRegistry) entityRef.getFieldValue("registry"); - } - - private void uninjectAll() { - for (CraftPersistentDataTypeRegistry registry : map.keySet()) { - Map adapters = (Map) registryRef.getFieldValue("adapters", registry); - adapters.remove(BukkitContainer1_17_R1.class); - adapters.remove(SyntaxContainer1_17_R1.class); - registryRef.setFieldValue(registry, "function", map.get(registry)); - } - map.clear(); - } - - private void inject(CraftPersistentDataTypeRegistry registry) { - if (map.containsKey(registry)) { - return; - } - map.put(registry, (Function) registryRef.getFieldValue("function", registry)); - Function function = clazz -> createAdapter(registry, registryRef.getMethod("create").getReturnType(), (Class) clazz); - registryRef.setFieldValue(registry, "function", function); - } - - private E createAdapter(CraftPersistentDataTypeRegistry registry, Class adapterType, Class type) { - if (Objects.equals(BukkitContainer1_17_R1.class, type)) { - return (E) buildAdapter(registry, BukkitContainer1_17_R1.class, tag -> fromPrimitiveSyntax(tag)); - } - if (Objects.equals(SyntaxContainer1_17_R1.class, type)) { - return (E) buildAdapter(registry, SyntaxContainer1_17_R1.class, tag -> fromPrimitiveBukkit(registry, tag)); - } - return (E) map.get(registry).apply(type); - } - - private Object buildAdapter(Object handle, Class type, Function function) { - return registryRef.run(handle, "create", type, NBTTagCompound.class, (Function) input -> toPrimitive(input), - function); - } - - private NBTTagCompound toPrimitive(WrappedContainer input) { - Object handle = findFinalContainer(input).getHandle(); - if (handle instanceof PersistentDataContainer) { - if (handle instanceof CraftPersistentDataContainer) { - return ((CraftPersistentDataContainer) handle).toTagCompound(); - } - throw new IllegalArgumentException( - "Expected 'CraftPersistentDataContainer' got '" + handle.getClass().getSimpleName() + " instead'!"); - } - if (handle instanceof IDataContainer) { - if (handle instanceof NbtContainer) { - return (NBTTagCompound) VersionControl.get().getBukkitConversion().toMinecraftCompound(((NbtContainer) handle).asNbt()); - } - throw new IllegalArgumentException( - "Expected 'CraftPersistentDataContainer' got '" + handle.getClass().getSimpleName() + " instead'!"); - } - throw new IllegalArgumentException("Unknown WrappedContainer implementation!"); - } - - private BukkitContainer1_17_R1 fromPrimitiveSyntax(NBTTagCompound data) { - VersionControl control = VersionControl.get(); - NbtContainer container = new NbtContainer(control.getDataProvider().getRegistry()); - NbtCompound compound = control.getBukkitConversion().fromMinecraftCompound(data); - container.fromNbt(compound); - return new BukkitContainer1_17_R1(container); - } - - private SyntaxContainer1_17_R1 fromPrimitiveBukkit(CraftPersistentDataTypeRegistry registry, NBTTagCompound data) { - CraftPersistentDataContainer container = new CraftPersistentDataContainer(registry); - container.putAll(data); - return new SyntaxContainer1_17_R1(container); - } - - private WrappedContainer findFinalContainer(WrappedContainer container) { - WrappedContainer output = container; - while (output.getHandle() instanceof WrappedContainer) { - output = (WrappedContainer) output.getHandle(); - } - return output; - } - - public static void unhookAll() { - HOOK.uninjectAll(); - } - - public static void hookEntity() { - HOOK.inject(HOOK.getEntityRegistry()); - } - - public static void hook(CraftPersistentDataTypeRegistry registry) { - HOOK.inject(registry); - } - -} diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/entity/ArmorStand1_17_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/entity/ArmorStand1_17_R1.java deleted file mode 100644 index 4db2f5f..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/entity/ArmorStand1_17_R1.java +++ /dev/null @@ -1,24 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.entity; - -import net.minecraft.world.entity.EntityTypes; -import net.minecraft.world.entity.decoration.EntityArmorStand; -import net.minecraft.world.level.World; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsArmorStand; - -public class ArmorStand1_17_R1 extends EntityLiving1_17_R1 implements NmsArmorStand { - - public ArmorStand1_17_R1(World world) { - super(new EntityArmorStand(EntityTypes.c, world)); - } - - @Override - public void setSmall(boolean small) { - handle.setSmall(small); - } - - @Override - public boolean isSmall() { - return handle.isSmall(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/entity/Entity1_17_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/entity/Entity1_17_R1.java deleted file mode 100644 index 0a3aac1..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/entity/Entity1_17_R1.java +++ /dev/null @@ -1,215 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.entity; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.OfflinePlayer; -import org.bukkit.craftbukkit.v1_17_R1.CraftWorld; -import org.bukkit.craftbukkit.v1_17_R1.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_17_R1.util.CraftChatMessage; -import org.bukkit.entity.Player; - -import net.minecraft.network.protocol.game.PacketPlayOutEntityDestroy; -import net.minecraft.network.protocol.game.PacketPlayOutEntityMetadata; -import net.minecraft.network.protocol.game.PacketPlayOutSpawnEntity; -import net.minecraft.server.network.PlayerConnection; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.phys.AxisAlignedBB; -import net.minecraft.world.phys.Vec3D; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.utils.NmsBoundingBox; - -public abstract class Entity1_17_R1 implements NmsEntity { - - protected final E handle; - - protected final List visible = Collections.synchronizedList(new ArrayList<>()); - - public Entity1_17_R1(E handle) { - this.handle = handle; - } - - @Override - public final E getHandle() { - return handle; - } - - @Override - public int getId() { - return handle.getId(); - } - - @Override - public UUID getUniqueId() { - return handle.getUniqueID(); - } - - @Override - public NmsBoundingBox getBoundingBox() { - AxisAlignedBB box = handle.getBoundingBox(); - return new NmsBoundingBox(box.a, box.b, box.c, box.d, box.e, box.f); - } - - @Override - public void setCustomName(String name) { - handle.setCustomName(CraftChatMessage.fromStringOrNull(name)); - updateVisibility(); - } - - @Override - public String getCustomName() { - return CraftChatMessage.fromComponent(handle.getCustomName()); - } - - @Override - public void setGravity(boolean gravity) { - handle.setNoGravity(!gravity); - } - - @Override - public boolean hasGravity() { - return !handle.isNoGravity(); - } - - @Override - public void setCustomNameVisible(boolean visible) { - handle.setCustomNameVisible(visible); - } - - @Override - public boolean isCustomNameVisible() { - return handle.getCustomNameVisible(); - } - - @Override - public void setInvisible(boolean invisible) { - handle.setInvisible(invisible); - } - - @Override - public boolean isInvisible() { - return handle.isInvisible(); - } - - @Override - public boolean isInteractable() { - return handle.isInteractable(); - } - - @Override - public boolean isCollidable() { - return handle.isCollidable(); - } - - @Override - public void setInvulnerable(boolean invulnerable) { - handle.setInvulnerable(invulnerable); - } - - @Override - public boolean isInvulnerable() { - return handle.isInvulnerable(); - } - - @Override - public void setLocation(Location location) { - handle.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); - if (location.getWorld() == null || handle.getWorld().getWorld() == location.getWorld()) { - updateVisibility(); - return; - } - handle.t = ((CraftWorld) location.getWorld()).getHandle(); - updateVisibility(); - } - - @Override - public Location getLocation() { - Vec3D vector = handle.getPositionVector(); - return new Location(handle.getWorld().getWorld(), vector.b, vector.c, vector.d); - } - - @Override - public void updateVisibility() { - if (visible.isEmpty()) { - return; - } - Player[] players; - synchronized (visible) { - players = visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) - .toArray(Player[]::new); - } - hide(players); - show(players); - } - - @Override - public boolean isShown(Player player) { - synchronized (visible) { - return visible.contains(player.getUniqueId()); - } - } - - @Override - public void hide(Player... players) { - if (players.length == 0) { - return; - } - PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(handle.getId()); - for (Player player : players) { - if (!isShown(player)) { - continue; - } - ((CraftPlayer) player).getHandle().b.sendPacket(packet); - synchronized (visible) { - visible.remove(player.getUniqueId()); - } - } - } - - @Override - public void show(Player... players) { - if (players.length == 0) { - return; - } - PacketPlayOutSpawnEntity packet = new PacketPlayOutSpawnEntity(handle); - PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); - PlayerConnection connection; - for (Player player : players) { - if (isShown(player)) { - continue; - } - connection = ((CraftPlayer) player).getHandle().b; - connection.sendPacket(packet); - connection.sendPacket(metadataPacket); - synchronized (visible) { - visible.add(player.getUniqueId()); - } - } - } - - @Override - public UUID[] getVisible() { - synchronized (visible) { - return visible.toArray(new UUID[0]); - } - } - - @Override - public Player[] getVisibleAsPlayer() { - synchronized (visible) { - return visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) - .toArray(Player[]::new); - } - } - - @Override - public void kill() { - hide(getVisibleAsPlayer()); - handle.die(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/entity/EntityLiving1_17_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/entity/EntityLiving1_17_R1.java deleted file mode 100644 index f783394..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/entity/EntityLiving1_17_R1.java +++ /dev/null @@ -1,17 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.entity; - -import net.minecraft.world.entity.EntityLiving; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityLiving; - -public abstract class EntityLiving1_17_R1 extends Entity1_17_R1 implements NmsEntityLiving { - - public EntityLiving1_17_R1(E handle) { - super(handle); - } - - @Override - public void setCollidable(boolean collidable) { - handle.collides = collidable; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/entity/Player1_17_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/entity/Player1_17_R1.java deleted file mode 100644 index bde4d75..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/entity/Player1_17_R1.java +++ /dev/null @@ -1,294 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.entity; - -import java.util.ArrayList; -import java.util.Collections; - -import org.bukkit.craftbukkit.v1_17_R1.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_17_R1.util.CraftChatMessage; -import org.bukkit.entity.Player; - -import com.mojang.authlib.GameProfile; -import com.mojang.authlib.properties.Property; -import com.mojang.authlib.properties.PropertyMap; -import com.mojang.datafixers.util.Pair; - -import net.minecraft.SystemUtils; -import net.minecraft.network.chat.ChatMessageType; -import net.minecraft.network.chat.IChatBaseComponent; -import net.minecraft.network.protocol.game.ClientboundSetSubtitleTextPacket; -import net.minecraft.network.protocol.game.ClientboundSetTitleTextPacket; -import net.minecraft.network.protocol.game.ClientboundSetTitlesAnimationPacket; -import net.minecraft.network.protocol.game.PacketPlayInClientCommand; -import net.minecraft.network.protocol.game.PacketPlayInClientCommand.EnumClientCommand; -import net.minecraft.network.protocol.game.PacketPlayOutChat; -import net.minecraft.network.protocol.game.PacketPlayOutEntityDestroy; -import net.minecraft.network.protocol.game.PacketPlayOutEntityEquipment; -import net.minecraft.network.protocol.game.PacketPlayOutEntityHeadRotation; -import net.minecraft.network.protocol.game.PacketPlayOutEntityMetadata; -import net.minecraft.network.protocol.game.PacketPlayOutEntityStatus; -import net.minecraft.network.protocol.game.PacketPlayOutHeldItemSlot; -import net.minecraft.network.protocol.game.PacketPlayOutNamedEntitySpawn; -import net.minecraft.network.protocol.game.PacketPlayOutPlayerInfo; -import net.minecraft.network.protocol.game.PacketPlayOutPlayerInfo.EnumPlayerInfoAction; -import net.minecraft.network.protocol.game.PacketPlayOutPlayerListHeaderFooter; -import net.minecraft.network.protocol.game.PacketPlayOutPosition; -import net.minecraft.network.protocol.game.PacketPlayOutRespawn; -import net.minecraft.server.level.EntityPlayer; -import net.minecraft.server.level.WorldServer; -import net.minecraft.server.network.PlayerConnection; -import net.minecraft.util.MathHelper; -import net.minecraft.world.entity.EnumItemSlot; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.biome.BiomeManager; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.type.SkinDataType; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.data.SyntaxContainer1_17_R1; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; -import net.sourcewriters.minecraft.vcompat.utils.bukkit.Players; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.MojangProfileServer; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; -import net.sourcewriters.minecraft.vcompat.utils.thread.PostAsync; - -public class Player1_17_R1 extends EntityLiving1_17_R1 implements NmsPlayer { - - private String realName; - private Skin realSkin; - - private final WrappedContainer dataAdapter; - - public Player1_17_R1(Player player) { - super(((CraftPlayer) player).getHandle()); - dataAdapter = new SyntaxContainer1_17_R1(getBukkitPlayer().getPersistentDataContainer()); - update(false); - } - - @Override - public CraftPlayer getBukkitPlayer() { - return handle.getBukkitEntity(); - } - - @Override - public WrappedContainer getDataAdapter() { - return dataAdapter; - } - - @Override - public void setSkin(Skin skin) { - if (skin == null) { - return; - } - dataAdapter.set("skin", skin, SkinDataType.WRAPPED_INSTANCE); - } - - @Override - public Skin getSkin() { - return dataAdapter.getOrDefault("skin", SkinDataType.WRAPPED_INSTANCE, realSkin); - } - - @Override - public Skin getRealSkin() { - return realSkin; - } - - @Override - public void setName(String name) { - if (getName().equals(name)) { - return; - } - if (name == null) { - dataAdapter.remove("name"); - return; - } - dataAdapter.set("name", name, WrapType.STRING); - } - - @Override - public String getName() { - return dataAdapter.getOrDefault("name", WrapType.STRING, realName); - } - - @Override - public String getRealName() { - return realName; - } - - @Override - public void setPlayerListHeader(String text) { - setPlayerListHeaderAndFooter(text, getPlayerListFooter()); - } - - @Override - public String getPlayerListHeader() { - return dataAdapter.getOrDefault("header", WrapType.STRING, ""); - } - - @Override - public void setPlayerListFooter(String text) { - setPlayerListHeaderAndFooter(getPlayerListHeader(), text); - } - - @Override - public String getPlayerListFooter() { - return dataAdapter.getOrDefault("footer", WrapType.STRING, ""); - } - - @Override - public int getPing() { - return handle.e; - } - - @Override - public void setPlayerListHeaderAndFooter(String header, String footer) { - dataAdapter.set("header", header, WrapType.STRING); - dataAdapter.set("footer", footer, WrapType.STRING); - sendPlayerListInfo(header, footer); - } - - private final void sendPlayerListInfo(String header, String footer) { - if (handle.b.isDisconnected()) { - return; - } - - IChatBaseComponent headerComponent = header.isEmpty() ? null : CraftChatMessage.fromStringOrNull(header, true); - IChatBaseComponent footerComponent = footer.isEmpty() ? null : CraftChatMessage.fromStringOrNull(footer, true); - - handle.b.sendPacket(new PacketPlayOutPlayerListHeaderFooter(headerComponent, footerComponent)); - } - - @Override - public void setTitleTimes(int fadeIn, int stay, int fadeOut) { - if (handle.b.isDisconnected()) { - return; - } - handle.b.sendPacket(new ClientboundSetTitlesAnimationPacket(fadeIn, stay, fadeOut)); - } - - @Override - public void sendSubtitle(String text) { - if (handle.b.isDisconnected()) { - return; - } - handle.b.sendPacket(new ClientboundSetSubtitleTextPacket(CraftChatMessage.fromStringOrNull(text))); - } - - @Override - public void sendTitle(String text) { - if (handle.b.isDisconnected()) { - return; - } - handle.b.sendPacket(new ClientboundSetTitleTextPacket(CraftChatMessage.fromStringOrNull(text))); - } - - @Override - public void sendActionBar(String text) { - if (handle.b.isDisconnected()) { - return; - } - handle.b.sendPacket(new PacketPlayOutChat(CraftChatMessage.fromStringOrNull(text), ChatMessageType.c, SystemUtils.b)); - } - - @Override - public void fakeRespawn() { - if (handle.b.isDisconnected()) { - return; - } - PacketPlayOutPlayerInfo remInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.e, handle); - PacketPlayOutPlayerInfo addInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.a, handle); - - PacketPlayOutEntityDestroy destroyPacket = new PacketPlayOutEntityDestroy(handle.getId()); - PacketPlayOutNamedEntitySpawn spawnPacket = new PacketPlayOutNamedEntitySpawn(handle); - PacketPlayOutEntityHeadRotation rotationPacket = new PacketPlayOutEntityHeadRotation(handle, - (byte) MathHelper.d(handle.getHeadRotation() * 256F / 360F)); - - ArrayList> list = new ArrayList<>(); - for (EnumItemSlot slot : EnumItemSlot.values()) { - list.add(Pair.of(slot, handle.getEquipment(slot))); - } - PacketPlayOutEntityEquipment equipmentPacket = new PacketPlayOutEntityEquipment(handle.getId(), list); - - Player self = getBukkitPlayer(); - Player[] players = Players.getOnlineWithout(getUniqueId()); - for (Player player : players) { - if (!player.canSee(self)) { - continue; - } - PlayerConnection connection = ((CraftPlayer) player).getHandle().b; - connection.sendPacket(remInfoPacket); - connection.sendPacket(addInfoPacket); - connection.sendPacket(destroyPacket); - connection.sendPacket(spawnPacket); - connection.sendPacket(rotationPacket); - connection.sendPacket(equipmentPacket); - } - - WorldServer world = (WorldServer) handle.t; - - PacketPlayOutRespawn respawnPacket = new PacketPlayOutRespawn(world.getDimensionManager(), world.getDimensionKey(), - BiomeManager.a(world.getSeed()), handle.d.getGameMode(), handle.d.c(), - world.isDebugWorld(), world.isFlatWorld(), true); - PacketPlayOutPosition positionPacket = new PacketPlayOutPosition(handle.locX(), handle.locY(), handle.locZ(), handle.getHeadRotation(), - handle.getXRot(), Collections.emptySet(), 0, false); - PacketPlayOutHeldItemSlot itemPacket = new PacketPlayOutHeldItemSlot(handle.getInventory().k); - PacketPlayOutEntityStatus statusPacket = new PacketPlayOutEntityStatus(handle, (byte) 28); - PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); - - PlayerConnection connection = handle.b; - connection.sendPacket(remInfoPacket); - connection.sendPacket(addInfoPacket); - connection.sendPacket(respawnPacket); - connection.sendPacket(positionPacket); - connection.sendPacket(itemPacket); - connection.sendPacket(statusPacket); - connection.sendPacket(metadataPacket); - - handle.updateAbilities(); - handle.triggerHealthUpdate(); - handle.bU.updateInventory(); - if (handle.bV != handle.bU) { - handle.bV.updateInventory(); - } - self.recalculatePermissions(); - } - - @Override - public void respawn() { - if (handle.b.isDisconnected()) { - return; - } - handle.b.sendPacket(new PacketPlayInClientCommand(EnumClientCommand.a)); - } - - @Override - public void update() { - update(true); - } - - private final void update(boolean flag) { - PostAsync.forcePost(() -> { - realName = MojangProfileServer.getName(getUniqueId()); - realSkin = MojangProfileServer.getSkin(realName, getUniqueId()); - }); - if (flag) { - GameProfile profile = handle.getProfile(); - - Skin skin = getSkin(); - if (skin != null) { - PropertyMap properties = profile.getProperties(); - properties.removeAll("textures"); - properties.put("textures", new Property("textures", skin.getValue(), skin.getSignature())); - } - - String name = getName(); - if (name != null) { - ReflectionProvider.DEFAULT.getReflect("mjGameProfile").setFieldValue(profile, "name", name); - } - - if (!(name == null && skin == null)) { - fakeRespawn(); - } - } - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/tools/BlockTools1_17_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/tools/BlockTools1_17_R1.java deleted file mode 100644 index 8b5f435..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/tools/BlockTools1_17_R1.java +++ /dev/null @@ -1,39 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.tools; - -import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_17_R1.block.CraftSkull; - -import com.mojang.authlib.properties.Property; -import com.mojang.authlib.properties.PropertyMap; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; - -import net.minecraft.world.level.block.entity.TileEntitySkull; -import net.sourcewriters.minecraft.vcompat.reflection.tools.BlockTools; -import net.sourcewriters.minecraft.vcompat.utils.constants.MinecraftConstants; - -public class BlockTools1_17_R1 extends BlockTools { - - private final AbstractReflect craftEntityStateRef = new Reflect(CraftSkull.class).searchField("tileEntity", "tileEntity"); - - @Override - public void setHeadTexture(Block block, String texture) { - if (!(block instanceof CraftSkull)) { - return; - } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); - PropertyMap map = entitySkull.e.getProperties(); - map.removeAll("textures"); - map.put("textures", new Property("textures", MinecraftConstants.TEXTURE_SIGNATURE, texture)); - } - - @Override - public String getHeadTexture(Block block) { - if (!(block instanceof CraftSkull)) { - return null; - } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); - return entitySkull.e.getProperties().get("textures").iterator().next().getValue(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/tools/ServerTools1_17_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/tools/ServerTools1_17_R1.java deleted file mode 100644 index 108359e..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/tools/ServerTools1_17_R1.java +++ /dev/null @@ -1,26 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.tools; - -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_17_R1.CraftServer; - -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.wrapper.ConsoleReaderWrapper1_17_R1; -import net.sourcewriters.minecraft.vcompat.reflection.tools.ServerTools; - -public class ServerTools1_17_R1 extends ServerTools { - - @Override - public void setMotd(String text) { - ((CraftServer) Bukkit.getServer()).getServer().setMotd(text); - } - - @Override - public String getMotd() { - return ((CraftServer) Bukkit.getServer()).getServer().getMotd(); - } - - @Override - public ConsoleReaderWrapper1_17_R1 getConsole() { - return ConsoleReaderWrapper1_17_R1.INSTANCE; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/tools/SkinTools1_17_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/tools/SkinTools1_17_R1.java deleted file mode 100644 index 87b9026..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/tools/SkinTools1_17_R1.java +++ /dev/null @@ -1,16 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.tools; - -import org.bukkit.craftbukkit.v1_17_R1.entity.CraftPlayer; -import org.bukkit.entity.Player; - -import net.sourcewriters.minecraft.vcompat.reflection.tools.SkinTools; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; - -public class SkinTools1_17_R1 extends SkinTools { - - @Override - public Skin skinFromPlayer(Player player) { - return skinFromGameProfile(((CraftPlayer) player).getHandle().getProfile()); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/utils/EntityConstructors1_17_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/utils/EntityConstructors1_17_R1.java deleted file mode 100644 index 181d7a9..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/utils/EntityConstructors1_17_R1.java +++ /dev/null @@ -1,12 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.utils; - -import java.util.function.Function; - -import net.minecraft.world.level.World; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.entity.ArmorStand1_17_R1; - -public abstract class EntityConstructors1_17_R1 { - - public static final Function ARMOR_STAND = (world -> new ArmorStand1_17_R1(world)); - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/wrapper/ConsoleReaderWrapper1_17_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/wrapper/ConsoleReaderWrapper1_17_R1.java deleted file mode 100644 index 50faace..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_17_R1/wrapper/ConsoleReaderWrapper1_17_R1.java +++ /dev/null @@ -1,43 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_17_R1.wrapper; - -import java.io.IOException; -import java.io.Writer; - -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_17_R1.CraftServer; -import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; - -import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; - -public final class ConsoleReaderWrapper1_17_R1 extends ConsoleReaderWrapper { - - public static final ConsoleReaderWrapper1_17_R1 INSTANCE = new ConsoleReaderWrapper1_17_R1(); - - private final ConsoleReader reader; - - @SuppressWarnings("resource") - private ConsoleReaderWrapper1_17_R1() { - this.reader = ((CraftServer) Bukkit.getServer()).getServer().reader; - } - - @Override - public Writer getOutput() { - return reader.getOutput(); - } - - @Override - public boolean isAnsiSupported() { - return reader.getTerminal().isAnsiSupported(); - } - - @Override - public void flush() throws IOException { - reader.flush(); - } - - @Override - public void drawLine() throws IOException { - reader.drawLine(); - } - -} diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/BukkitConversion1_18_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/BukkitConversion1_18_R1.java deleted file mode 100644 index 792a3a8..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/BukkitConversion1_18_R1.java +++ /dev/null @@ -1,218 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_18_R1; - -import java.util.Set; - -import org.bukkit.craftbukkit.v1_18_R1.inventory.CraftItemStack; -import org.bukkit.entity.EntityType; - -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.nbt.NbtByte; -import com.syntaxphoenix.syntaxapi.nbt.NbtByteArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; -import com.syntaxphoenix.syntaxapi.nbt.NbtDouble; -import com.syntaxphoenix.syntaxapi.nbt.NbtEnd; -import com.syntaxphoenix.syntaxapi.nbt.NbtFloat; -import com.syntaxphoenix.syntaxapi.nbt.NbtInt; -import com.syntaxphoenix.syntaxapi.nbt.NbtIntArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtList; -import com.syntaxphoenix.syntaxapi.nbt.NbtLong; -import com.syntaxphoenix.syntaxapi.nbt.NbtLongArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtShort; -import com.syntaxphoenix.syntaxapi.nbt.NbtString; -import com.syntaxphoenix.syntaxapi.nbt.NbtTag; -import com.syntaxphoenix.syntaxapi.nbt.NbtType; - -import net.minecraft.nbt.NBTBase; -import net.minecraft.nbt.NBTNumber; -import net.minecraft.nbt.NBTTagByte; -import net.minecraft.nbt.NBTTagByteArray; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagDouble; -import net.minecraft.nbt.NBTTagEnd; -import net.minecraft.nbt.NBTTagFloat; -import net.minecraft.nbt.NBTTagInt; -import net.minecraft.nbt.NBTTagIntArray; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.nbt.NBTTagLong; -import net.minecraft.nbt.NBTTagLongArray; -import net.minecraft.nbt.NBTTagShort; -import net.minecraft.nbt.NBTTagString; -import net.minecraft.world.item.ItemStack; -import net.sourcewriters.minecraft.vcompat.reflection.BukkitConversion; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_18_R1.data.BukkitContext1_18_R1; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_18_R1.data.BukkitType1_18_R1; - -public class BukkitConversion1_18_R1 extends BukkitConversion { - - protected BukkitConversion1_18_R1(VersionControl1_18_R1 versionControl) { - super(versionControl); - } - - @Override - public EntityType toEntityType(NmsEntityType type) { - try { - return EntityType.valueOf(type.name()); - } catch (IllegalArgumentException ignore) { - return null; - } - } - - @Override - public NmsEntityType fromEntityType(EntityType type) { - try { - return NmsEntityType.valueOf(type.name()); - } catch (IllegalArgumentException ignore) { - return null; - } - } - - @Override - public NBTBase toMinecraftTag(NbtTag tag) { - switch (tag.getType()) { - case BYTE: - return NBTTagByte.a((byte) tag.getValue()); - case SHORT: - return NBTTagShort.a((short) tag.getValue()); - case INT: - return NBTTagInt.a((int) tag.getValue()); - case LONG: - return NBTTagLong.a((long) tag.getValue()); - case FLOAT: - return NBTTagFloat.a((float) tag.getValue()); - case DOUBLE: - return NBTTagDouble.a((double) tag.getValue()); - case STRING: - return NBTTagString.a((String) tag.getValue()); - case BYTE_ARRAY: - return new NBTTagByteArray((byte[]) tag.getValue()); - case INT_ARRAY: - return new NBTTagIntArray((int[]) tag.getValue()); - case LONG_ARRAY: - return new NBTTagLongArray((long[]) tag.getValue()); - case LIST: - return toMinecraftList((NbtList) tag); - case COMPOUND: - return toMinecraftCompound((NbtCompound) tag); - case END: - return NBTTagEnd.b; - default: - return null; - } - } - - @Override - public NbtTag fromMinecraftTag(Object raw) { - if (!(raw instanceof NBTBase)) { - return null; - } - NBTBase tag = (NBTBase) raw; - NbtType type = NbtType.getById(tag.a()); - switch (type) { - case BYTE: - return new NbtByte(((NBTNumber) tag).h()); - case SHORT: - return new NbtShort(((NBTNumber) tag).g()); - case INT: - return new NbtInt(((NBTNumber) tag).f()); - case LONG: - return new NbtLong(((NBTNumber) tag).e()); - case FLOAT: - return new NbtFloat(((NBTNumber) tag).j()); - case DOUBLE: - return new NbtDouble(((NBTNumber) tag).i()); - case STRING: - return new NbtString(((NBTTagString) tag).e_()); - case BYTE_ARRAY: - return new NbtByteArray(((NBTTagByteArray) tag).d()); - case INT_ARRAY: - return new NbtIntArray(((NBTTagIntArray) tag).f()); - case LONG_ARRAY: - return new NbtLongArray(((NBTTagLongArray) tag).f()); - case LIST: - return fromMinecraftList(tag); - case COMPOUND: - return fromMinecraftCompound(tag); - case END: - return NbtEnd.INSTANCE; - default: - return null; - } - } - - @Override - public NBTTagList toMinecraftList(NbtList list) { - NBTTagList output = new NBTTagList(); - for (NbtTag tag : list) { - output.add(toMinecraftTag(tag)); - } - return output; - } - - @Override - public NbtList fromMinecraftList(Object raw) { - if (!(raw instanceof NBTTagList)) { - return null; - } - NBTTagList list = (NBTTagList) raw; - NbtList output = new NbtList<>(NbtType.getById(list.e())); - for (NBTBase base : list) { - output.add(fromMinecraftTag(base)); - } - return output; - } - - @Override - public NBTTagCompound toMinecraftCompound(NbtCompound compound) { - NBTTagCompound output = new NBTTagCompound(); - if (compound.isEmpty()) { - return output; - } - Set keys = compound.getKeys(); - for (String key : keys) { - output.a(key, toMinecraftTag(compound.get(key))); - } - return output; - } - - @Override - public NbtCompound fromMinecraftCompound(Object raw) { - if (!(raw instanceof NBTTagCompound)) { - return null; - } - NBTTagCompound compound = (NBTTagCompound) raw; - NbtCompound output = new NbtCompound(); - if (compound.f()) { - return output; - } - Set keys = compound.d(); - for (String key : keys) { - output.set(key, fromMinecraftTag(compound.c(key))); - } - return output; - } - - @Override - public org.bukkit.inventory.ItemStack itemFromCompound(NbtCompound compound) { - return CraftItemStack.asBukkitCopy(ItemStack.a(toMinecraftCompound(compound))); - } - - @Override - public NbtCompound itemToCompound(org.bukkit.inventory.ItemStack itemStack) { - return fromMinecraftCompound(CraftItemStack.asNMSCopy(itemStack).b(new NBTTagCompound())); - } - - @Override - public WrappedContext createContext(DataAdapterContext context) { - return new BukkitContext1_18_R1(context); - } - - @Override - public WrapType wrap(DataType dataType) { - return new BukkitType1_18_R1<>(dataType); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/EntityProvider1_18_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/EntityProvider1_18_R1.java deleted file mode 100644 index 1e60b72..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/EntityProvider1_18_R1.java +++ /dev/null @@ -1,47 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_18_R1; - -import java.util.EnumMap; -import java.util.function.Function; - -import org.bukkit.craftbukkit.v1_18_R1.CraftWorld; - -import net.minecraft.world.level.World; -import net.sourcewriters.minecraft.vcompat.reflection.EntityProvider; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_18_R1.utils.EntityConstructors1_18_R1; - -public class EntityProvider1_18_R1 extends EntityProvider { - - private final EnumMap> entityMap = new EnumMap<>(NmsEntityType.class); - - protected EntityProvider1_18_R1(VersionControl1_18_R1 versionControl) { - super(versionControl); - } - - @SuppressWarnings("unchecked") - private final Function searchConstructor(NmsEntityType type) { - try { - return (Function) EntityConstructors1_18_R1.class.getField(type.name()).get(null); - } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException ignore) { - return null; - } - } - - private final Function getConstructor(NmsEntityType type) { - return entityMap.computeIfAbsent(type, (key -> searchConstructor(key))); - } - - @Override - public NmsEntity createEntity(org.bukkit.World world, NmsEntityType type) { - if (!(world instanceof CraftWorld)) { - return null; - } - Function function; - if ((function = getConstructor(type)) == null) { - return null; - } - return function.apply(((CraftWorld) world).getHandle()); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/PacketHandler1_18_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/PacketHandler1_18_R1.java deleted file mode 100644 index 2d6cbf9..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/PacketHandler1_18_R1.java +++ /dev/null @@ -1,11 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_18_R1; - -import net.sourcewriters.minecraft.vcompat.reflection.PacketHandler; - -public class PacketHandler1_18_R1 extends PacketHandler { - - protected PacketHandler1_18_R1(VersionControl1_18_R1 versionControl) { - super(versionControl); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/PlayerProvider1_18_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/PlayerProvider1_18_R1.java deleted file mode 100644 index 7518c67..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/PlayerProvider1_18_R1.java +++ /dev/null @@ -1,20 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_18_R1; - -import org.bukkit.entity.Player; - -import net.sourcewriters.minecraft.vcompat.reflection.PlayerProvider; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_18_R1.entity.Player1_18_R1; - -public class PlayerProvider1_18_R1 extends PlayerProvider { - - protected PlayerProvider1_18_R1(VersionControl1_18_R1 versionControl) { - super(versionControl); - } - - @Override - protected NmsPlayer createPlayer(Player player) { - return new Player1_18_R1(player); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/TextureProvider1_18_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/TextureProvider1_18_R1.java deleted file mode 100644 index ebaa130..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/TextureProvider1_18_R1.java +++ /dev/null @@ -1,102 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_18_R1; - -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_18_R1.block.CraftBlockEntityState; -import org.bukkit.craftbukkit.v1_18_R1.block.CraftSkull; -import org.bukkit.craftbukkit.v1_18_R1.inventory.CraftItemStack; -import org.bukkit.inventory.meta.ItemMeta; -import org.bukkit.inventory.meta.SkullMeta; - -import com.mojang.authlib.GameProfile; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; - -import net.minecraft.nbt.GameProfileSerializer; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.block.entity.TileEntitySkull; -import net.sourcewriters.minecraft.vcompat.reflection.TextureProvider; - -public class TextureProvider1_18_R1 extends TextureProvider { - - private final AbstractReflect craftEntityStateRef = new Reflect(CraftBlockEntityState.class).searchField("tileEntity", "tileEntity"); - private final AbstractReflect craftItemStackRef = new Reflect(CraftItemStack.class).searchField("handle", "handle"); - private final AbstractReflect craftMetaSkullRef = new Reflect("org.bukkit.craftbukkit.v1_18_R1.inventory.CraftMetaSkull") - .searchField("serialized", "serializedProfile").searchField("profile", "profile"); - - protected TextureProvider1_18_R1(VersionControl1_18_R1 versionControl) { - super(versionControl); - } - - @Override - public GameProfile profileFromBlock(Block block) { - if (!(block instanceof CraftSkull)) { - return null; - } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); - return entitySkull.e; - } - - @Override - public GameProfile profileFromItem(org.bukkit.inventory.ItemStack itemStack) { - if (!(itemStack.getItemMeta() instanceof SkullMeta)) { - return null; - } - SkullMeta meta = (SkullMeta) itemStack.getItemMeta(); - GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue("profile", meta); - if (profile == null) { - NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue("serialized", meta); - if (compound == null) { - ItemStack stack = null; - if (itemStack instanceof CraftItemStack) { - stack = (ItemStack) craftItemStackRef.getFieldValue("handle", itemStack); - } - if (stack == null) { - stack = CraftItemStack.asNMSCopy(itemStack); - } - NBTTagCompound stackTag = stack.t(); - if (stackTag.b("SkullOwner", 10)) { - compound = stackTag.p("SkullOwner"); - } else if (stackTag.b("SkullProfile", 10)) { - compound = stackTag.p("SkullProfile"); - } - } - if (compound == null) { - return null; - } - profile = GameProfileSerializer.a(compound); - } - return profile; - } - - @Override - public org.bukkit.inventory.ItemStack getItem(GameProfile profile) { - org.bukkit.inventory.ItemStack craftStack = CraftItemStack.asCraftCopy(new org.bukkit.inventory.ItemStack(Material.PLAYER_HEAD)); - applyItem(craftStack, profile); - return craftStack; - } - - @Override - public boolean applyItem(org.bukkit.inventory.ItemStack itemStack, GameProfile profile) { - ItemMeta meta = itemStack.getItemMeta(); - if (!(meta instanceof SkullMeta)) { - return false; - } - SkullMeta skullMeta = (SkullMeta) meta; - craftMetaSkullRef.setFieldValue(meta, "profile", profile); - itemStack.setItemMeta(skullMeta); - return true; - } - - @Override - public boolean applyBlock(Block block, GameProfile profile) { - if (!(block instanceof CraftSkull)) { - return false; - } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); - entitySkull.a(profile); - return true; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/ToolProvider1_18_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/ToolProvider1_18_R1.java deleted file mode 100644 index 081ae62..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/ToolProvider1_18_R1.java +++ /dev/null @@ -1,33 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_18_R1; - -import net.sourcewriters.minecraft.vcompat.reflection.ToolProvider; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_18_R1.tools.BlockTools1_18_R1; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_18_R1.tools.ServerTools1_18_R1; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_18_R1.tools.SkinTools1_18_R1; - -public class ToolProvider1_18_R1 extends ToolProvider { - - private final BlockTools1_18_R1 blockTools = new BlockTools1_18_R1(); - private final SkinTools1_18_R1 skinTools = new SkinTools1_18_R1(); - private final ServerTools1_18_R1 serverTools = new ServerTools1_18_R1(); - - protected ToolProvider1_18_R1(VersionControl1_18_R1 versionControl) { - super(versionControl); - } - - @Override - public SkinTools1_18_R1 getSkinTools() { - return skinTools; - } - - @Override - public ServerTools1_18_R1 getServerTools() { - return serverTools; - } - - @Override - public BlockTools1_18_R1 getBlockTools() { - return blockTools; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/VersionControl1_18_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/VersionControl1_18_R1.java deleted file mode 100644 index 85eb61f..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/VersionControl1_18_R1.java +++ /dev/null @@ -1,61 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_18_R1; - -import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_18_R1.data.hook.BukkitContainerAdapterHook1_18_R1; - -public class VersionControl1_18_R1 extends VersionControl { - - public static VersionControl1_18_R1 INSTANCE; - - public static VersionControl1_18_R1 init() { - return INSTANCE != null ? INSTANCE : (INSTANCE = new VersionControl1_18_R1()); - } - - private final ToolProvider1_18_R1 toolProvider = new ToolProvider1_18_R1(this); - private final TextureProvider1_18_R1 textureProvider = new TextureProvider1_18_R1(this); - private final PacketHandler1_18_R1 packetHandler = new PacketHandler1_18_R1(this); - private final EntityProvider1_18_R1 entityProvider = new EntityProvider1_18_R1(this); - private final PlayerProvider1_18_R1 playerProvider = new PlayerProvider1_18_R1(this); - private final BukkitConversion1_18_R1 bukkitConversion = new BukkitConversion1_18_R1(this); - - private VersionControl1_18_R1() { - BukkitContainerAdapterHook1_18_R1.hookEntity(); - } - - @Override - public ToolProvider1_18_R1 getToolProvider() { - return toolProvider; - } - - @Override - public EntityProvider1_18_R1 getEntityProvider() { - return entityProvider; - } - - @Override - public PlayerProvider1_18_R1 getPlayerProvider() { - return playerProvider; - } - - @Override - public TextureProvider1_18_R1 getTextureProvider() { - return textureProvider; - } - - @Override - public PacketHandler1_18_R1 getPacketHandler() { - return packetHandler; - } - - @Override - public BukkitConversion1_18_R1 getBukkitConversion() { - return bukkitConversion; - } - - @Override - public void shutdown() { - dataProvider.getDefaultDistributor().shutdown(); - BukkitContainerAdapterHook1_18_R1.unhookAll(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/data/BukkitContainer1_18_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/data/BukkitContainer1_18_R1.java deleted file mode 100644 index 3b27b47..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/data/BukkitContainer1_18_R1.java +++ /dev/null @@ -1,161 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_18_R1.data; - -import java.util.Arrays; -import java.util.Optional; -import java.util.Set; -import java.util.stream.Collectors; - -import org.bukkit.NamespacedKey; -import org.bukkit.persistence.PersistentDataAdapterContext; -import org.bukkit.persistence.PersistentDataContainer; -import org.bukkit.persistence.PersistentDataType; - -import com.syntaxphoenix.syntaxapi.data.IDataContainer; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SyntaxKey; - -public final class BukkitContainer1_18_R1 extends WrappedContainer implements PersistentDataContainer { - - private final IDataContainer container; - - public BukkitContainer1_18_R1(IDataContainer container) { - this.container = container; - } - - @Override - public IDataContainer getHandle() { - return container; - } - - @Override - public IDataContainer getAsSyntaxContainer() { - return container; - } - - /* - * - */ - - @Override - public boolean has(NamespacedKey key, PersistentDataType type) { - return has(new BukkitKey1_18_R1(key), WrappedType1_18_R1.wrap(type)); - } - - @Override - public Z get(NamespacedKey key, PersistentDataType type) { - return get(new BukkitKey1_18_R1(key), WrappedType1_18_R1.wrap(type)); - } - - @Override - public Z getOrDefault(NamespacedKey key, PersistentDataType type, Z value) { - return Optional.ofNullable(get(key, type)).orElse(value); - } - - @Override - public void set(NamespacedKey key, PersistentDataType type, Z value) { - set(new BukkitKey1_18_R1(key), value, WrappedType1_18_R1.wrap(type)); - } - - @Override - public void remove(NamespacedKey key) { - remove(new BukkitKey1_18_R1(key)); - } - - @Override - public Set getKeys() { - return Arrays.stream(container.getKeys()).map(SyntaxKey::new).map(BukkitKey1_18_R1::asBukkit).collect(Collectors.toSet()); - } - - @Override - public PersistentDataAdapterContext getAdapterContext() { - return getContext(); - } - - /* - * - */ - - @Override - public BukkitContext1_18_R1 getContext() { - return new BukkitContext1_18_R1(container.getAdapterContext()); - } - - @Override - public boolean has(String key) { - return has(wrappedKey(key)); - } - - @Override - public boolean has(WrappedKey key) { - return container.has(key.getNamespacedKey()); - } - - @Override - public boolean has(String key, WrapType type) { - return has(wrappedKey(key), type); - } - - @Override - public boolean has(WrappedKey key, WrapType type) { - return container.has(key.getNamespacedKey(), type.syntaxType()); - } - - @Override - public Object get(String key) { - return get(wrappedKey(key)); - } - - @Override - public Object get(WrappedKey key) { - return container.get(key.getNamespacedKey()); - } - - @Override - public C get(String key, WrapType type) { - return get(wrappedKey(key), type); - } - - @Override - public C get(WrappedKey key, WrapType type) { - return container.get(key.getNamespacedKey(), type.syntaxType()); - } - - @Override - public void set(String key, B value, WrapType type) { - set(wrappedKey(key), value, type); - } - - @Override - public void set(WrappedKey key, B value, WrapType type) { - container.set(key.getNamespacedKey(), value, type.syntaxType()); - } - - @Override - public boolean remove(String key) { - return false; - } - - @Override - public boolean remove(WrappedKey key) { - return container.remove(key.getNamespacedKey()); - } - - @Override - public Set keySet() { - return container.getKeyspaces(); - } - - @Override - public boolean isEmpty() { - return container.isEmpty(); - } - - @Override - public int size() { - return container.size(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/data/BukkitContext1_18_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/data/BukkitContext1_18_R1.java deleted file mode 100644 index 4ad1984..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/data/BukkitContext1_18_R1.java +++ /dev/null @@ -1,39 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_18_R1.data; - -import org.bukkit.persistence.PersistentDataAdapterContext; -import org.bukkit.persistence.PersistentDataContainer; - -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.IDataContainer; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; - -public final class BukkitContext1_18_R1 extends WrappedContext implements PersistentDataAdapterContext { - - private final DataAdapterContext context; - - public BukkitContext1_18_R1(DataAdapterContext context) { - this.context = context; - } - - @Override - public DataAdapterContext getHandle() { - return context; - } - - @Override - public PersistentDataContainer newPersistentDataContainer() { - return newContainer(); - } - - @Override - public IDataContainer newDataContainer() { - return context.newDataContainer(); - } - - @Override - public BukkitContainer1_18_R1 newContainer() { - return new BukkitContainer1_18_R1(context.newDataContainer()); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/data/BukkitKey1_18_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/data/BukkitKey1_18_R1.java deleted file mode 100644 index 3fba0b4..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/data/BukkitKey1_18_R1.java +++ /dev/null @@ -1,52 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_18_R1.data; - -import org.bukkit.NamespacedKey; -import org.bukkit.plugin.Plugin; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; - -public final class BukkitKey1_18_R1 extends WrappedKey { - - private final NamespacedKey key; - - public BukkitKey1_18_R1(Plugin plugin, String key) { - this.key = new NamespacedKey(plugin, key); - } - - @SuppressWarnings("deprecation") - public BukkitKey1_18_R1(String name, String key) { - this.key = new NamespacedKey(name, key); - } - - public BukkitKey1_18_R1(NamespacedKey key) { - this.key = key; - } - - @Override - public NamespacedKey getHandle() { - return key; - } - - @Override - public String getName() { - return key.getNamespace(); - } - - @Override - public String getKey() { - return key.getKey(); - } - - @Override - public String toString() { - return key.toString(); - } - - public static NamespacedKey asBukkit(WrappedKey key) { - if (key.getHandle() instanceof NamespacedKey) { - return (NamespacedKey) key.getHandle(); - } - return new BukkitKey1_18_R1(key.getName(), key.getKey()).getHandle(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/data/BukkitType1_18_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/data/BukkitType1_18_R1.java deleted file mode 100644 index 66140ad..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/data/BukkitType1_18_R1.java +++ /dev/null @@ -1,69 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_18_R1.data; - -import org.bukkit.persistence.PersistentDataAdapterContext; -import org.bukkit.persistence.PersistentDataType; - -import com.syntaxphoenix.syntaxapi.data.DataType; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; - -public class BukkitType1_18_R1 extends WrappedType1_18_R1, P0, P1, C0, C1> - implements PersistentDataType { - - private final DataType type; - - public BukkitType1_18_R1(DataType type) { - super(type.getPrimitive(), type.getComplex()); - this.type = type; - } - - @Override - public DataType getHandle() { - return type; - } - - @Override - public Class getPrimitiveOriginal() { - return type.getPrimitive(); - } - - @Override - public Class getComplexOriginal() { - return type.getComplex(); - } - - /* - * - */ - - @Override - public Class getComplexType() { - return complexType; - } - - @Override - public Class getPrimitiveType() { - return primitiveType; - } - - @Override - public P0 toPrimitive(C0 complex, PersistentDataAdapterContext context) { - return wrapToPrimitive(complex, new SyntaxContext1_18_R1(context)); - } - - @Override - public C0 fromPrimitive(P0 primitive, PersistentDataAdapterContext context) { - return wrapToComplex(primitive, new SyntaxContext1_18_R1(context)); - } - - @Override - public P0 wrapToPrimitive(C0 complex, WrappedContext context) { - return toPrimitiveWrapped(type.toPrimitive(context, toComplexOriginal(complex))); - } - - @Override - public C0 wrapToComplex(P0 primitive, WrappedContext context) { - return toComplexWrapped(type.fromPrimitive(context, toPrimitiveOriginal(primitive))); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/data/SimpleBukkitType1_18_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/data/SimpleBukkitType1_18_R1.java deleted file mode 100644 index 0b46425..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/data/SimpleBukkitType1_18_R1.java +++ /dev/null @@ -1,36 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_18_R1.data; - -import org.bukkit.persistence.PersistentDataAdapterContext; -import org.bukkit.persistence.PersistentDataType; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; - -public class SimpleBukkitType1_18_R1 implements PersistentDataType { - - private final WrapType type; - - public SimpleBukkitType1_18_R1(WrapType type) { - this.type = type; - } - - @Override - public Class getComplexType() { - return type.getComplexWrapped(); - } - - @Override - public Class

getPrimitiveType() { - return type.getPrimitiveWrapped(); - } - - @Override - public P toPrimitive(C complex, PersistentDataAdapterContext context) { - return type.wrapToPrimitive(complex, new SyntaxContext1_18_R1(context)); - } - - @Override - public C fromPrimitive(P primitive, PersistentDataAdapterContext context) { - return type.wrapToComplex(primitive, new SyntaxContext1_18_R1(context)); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/data/SyntaxContainer1_18_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/data/SyntaxContainer1_18_R1.java deleted file mode 100644 index 2764789..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/data/SyntaxContainer1_18_R1.java +++ /dev/null @@ -1,185 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_18_R1.data; - -import java.util.Set; -import java.util.stream.Collectors; - -import org.bukkit.persistence.PersistentDataContainer; - -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.data.IDataContainer; -import com.syntaxphoenix.syntaxapi.utils.key.IKey; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SyntaxKey; - -public final class SyntaxContainer1_18_R1 extends WrappedContainer implements IDataContainer { - - private final PersistentDataContainer container; - - public SyntaxContainer1_18_R1(PersistentDataContainer container) { - this.container = container; - } - - @Override - public PersistentDataContainer getHandle() { - return container; - } - - @Override - public IDataContainer getAsSyntaxContainer() { - return new SyntaxContainer1_18_R1(container); - } - - /* - * - */ - - @Override - public boolean has(IKey key) { - throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); - } - - @Override - public boolean has(String key, DataType type) { - return has(syntaxKey(key), type); - } - - @Override - public boolean has(IKey key, DataType type) { - return has(new SyntaxKey(key), WrappedType1_18_R1.wrap(type)); - } - - @Override - public C get(String key, DataType type) { - return get(syntaxKey(key), type); - } - - @Override - public C get(IKey key, DataType type) { - return get(new SyntaxKey(key), WrappedType1_18_R1.wrap(type)); - } - - @Override - public Object get(String key) { - throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); - } - - @Override - public Object get(IKey key) { - throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); - } - - @Override - public void set(String key, E value, DataType type) { - set(wrappedKey(key), value, WrappedType1_18_R1.wrap(type)); - } - - @Override - public void set(IKey key, E value, DataType type) { - set(new SyntaxKey(key), value, WrappedType1_18_R1.wrap(type)); - } - - @Override - public boolean remove(String key) { - return remove(wrappedKey(key)); - } - - @Override - public boolean remove(IKey key) { - return remove(new SyntaxKey(key)); - } - - @Override - public IKey[] getKeys() { - return container.getKeys().stream().map(BukkitKey1_18_R1::new).map(WrappedKey::getNamespacedKey).toArray(IKey[]::new); - } - - @Override - public Set getKeyspaces() { - return container.getKeys().stream().map(org.bukkit.NamespacedKey::toString).collect(Collectors.toSet()); - } - - @Override - public DataAdapterContext getAdapterContext() { - return getContext(); - } - - /* - * - */ - - @Override - public SyntaxContext1_18_R1 getContext() { - return new SyntaxContext1_18_R1(container.getAdapterContext()); - } - - @Override - public boolean has(String key) { - throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); - } - - @Override - public boolean has(WrappedKey key) { - throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); - } - - @Override - public boolean has(String key, WrapType type) { - return has(wrappedKey(key), type); - } - - @Override - public boolean has(WrappedKey key, WrapType type) { - return container.has(BukkitKey1_18_R1.asBukkit(key), new SimpleBukkitType1_18_R1<>(type)); - } - - @Override - public Object get(WrappedKey key) { - throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); - } - - @Override - public C get(String key, WrapType type) { - return get(wrappedKey(key), type); - } - - @Override - public C get(WrappedKey key, WrapType type) { - return container.get(BukkitKey1_18_R1.asBukkit(key), new SimpleBukkitType1_18_R1<>(type)); - } - - @Override - public void set(String key, B value, WrapType type) { - set(wrappedKey(key), value, type); - } - - @Override - public void set(WrappedKey key, B value, WrapType type) { - container.set(BukkitKey1_18_R1.asBukkit(key), new SimpleBukkitType1_18_R1<>(type), value); - } - - @Override - public boolean remove(WrappedKey key) { - container.remove(BukkitKey1_18_R1.asBukkit(key)); - return true; // Will always return true as we don't know if it contained it - } - - @Override - public Set keySet() { - return getKeyspaces(); - } - - @Override - public boolean isEmpty() { - return container.isEmpty(); - } - - @Override - public int size() { - return container.getKeys().size(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/data/SyntaxContext1_18_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/data/SyntaxContext1_18_R1.java deleted file mode 100644 index 6f3d733..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/data/SyntaxContext1_18_R1.java +++ /dev/null @@ -1,38 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_18_R1.data; - -import org.bukkit.persistence.PersistentDataAdapterContext; -import org.bukkit.persistence.PersistentDataContainer; - -import com.syntaxphoenix.syntaxapi.data.IDataContainer; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; - -public final class SyntaxContext1_18_R1 extends WrappedContext implements PersistentDataAdapterContext { - - private final PersistentDataAdapterContext context; - - public SyntaxContext1_18_R1(PersistentDataAdapterContext context) { - this.context = context; - } - - @Override - public PersistentDataAdapterContext getHandle() { - return context; - } - - @Override - public PersistentDataContainer newPersistentDataContainer() { - return context.newPersistentDataContainer(); - } - - @Override - public IDataContainer newDataContainer() { - return newContainer(); - } - - @Override - public SyntaxContainer1_18_R1 newContainer() { - return new SyntaxContainer1_18_R1(context.newPersistentDataContainer()); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/data/SyntaxType1_18_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/data/SyntaxType1_18_R1.java deleted file mode 100644 index d891654..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/data/SyntaxType1_18_R1.java +++ /dev/null @@ -1,76 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_18_R1.data; - -import org.bukkit.persistence.PersistentDataAdapterContext; -import org.bukkit.persistence.PersistentDataType; - -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; - -public class SyntaxType1_18_R1 extends WrappedType1_18_R1, P0, P1, C0, C1> - implements DataType { - - private final PersistentDataType type; - - public SyntaxType1_18_R1(PersistentDataType type) { - super(type.getPrimitiveType(), type.getComplexType()); - this.type = type; - } - - @Override - public PersistentDataType getHandle() { - return type; - } - - @Override - public Class getPrimitiveOriginal() { - return type.getPrimitiveType(); - } - - @Override - public Class getComplexOriginal() { - return type.getComplexType(); - } - - /* - * - */ - - @Override - public Class getComplex() { - return complexType; - } - - @Override - public Class getPrimitive() { - return primitiveType; - } - - @Override - public P0 toPrimitive(DataAdapterContext context, C0 complex) { - return wrapToPrimitive(complex, new BukkitContext1_18_R1(context)); - } - - @Override - public C0 fromPrimitive(DataAdapterContext context, P0 primitive) { - return wrapToComplex(primitive, new BukkitContext1_18_R1(context)); - } - - @Override - public P0 wrapToPrimitive(C0 complex, WrappedContext context) { - if (!(context instanceof PersistentDataAdapterContext)) { - return null; - } - return toPrimitiveWrapped(type.toPrimitive(toComplexOriginal(complex), (PersistentDataAdapterContext) context)); - } - - @Override - public C0 wrapToComplex(P0 primitive, WrappedContext context) { - if (!(context instanceof PersistentDataAdapterContext)) { - return null; - } - return toComplexWrapped(type.fromPrimitive(toPrimitiveOriginal(primitive), (PersistentDataAdapterContext) context)); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/data/WrappedType1_18_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/data/WrappedType1_18_R1.java deleted file mode 100644 index 202fb13..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/data/WrappedType1_18_R1.java +++ /dev/null @@ -1,150 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_18_R1.data; - -import java.util.Arrays; - -import org.bukkit.persistence.PersistentDataContainer; -import org.bukkit.persistence.PersistentDataType; - -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.data.IDataContainer; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; - -public abstract class WrappedType1_18_R1 implements WrapType { - - protected final Class primitiveType; - protected final Class complexType; - - private final int primitiveWrap; - private final int complexWrap; - - @SuppressWarnings("unchecked") - protected WrappedType1_18_R1(Class primitive, Class complex) { - this.primitiveWrap = WrappedType1_18_R1.internalState(primitive); - this.complexWrap = WrappedType1_18_R1.internalState(complex); - this.primitiveType = (Class) WrappedType1_18_R1.internalWrap(primitive, primitiveWrap); - this.complexType = (Class) WrappedType1_18_R1.internalWrap(complex, complexWrap); - } - - public abstract H getHandle(); - - public Class getPrimitiveWrapped() { - return primitiveType; - } - - public Class getComplexWrapped() { - return complexType; - } - - public abstract Class getPrimitiveOriginal(); - - public abstract Class getComplexOriginal(); - - @SuppressWarnings("unchecked") - public P0 toPrimitiveWrapped(P1 primitive) { - switch (primitiveWrap) { - case 1: - return (P0) new SyntaxContainer1_18_R1((PersistentDataContainer) primitive); - case 2: - return (P0) Arrays.stream((PersistentDataContainer[]) primitive).map(SyntaxContainer1_18_R1::new) - .toArray(SyntaxContainer1_18_R1[]::new); - case 3: - return (P0) new BukkitContainer1_18_R1((IDataContainer) primitive); - case 4: - return (P0) Arrays.stream((IDataContainer[]) primitive).map(BukkitContainer1_18_R1::new) - .toArray(BukkitContainer1_18_R1[]::new); - default: - return (P0) primitive; - } - } - - @SuppressWarnings("unchecked") - public C0 toComplexWrapped(C1 complex) { - switch (complexWrap) { - case 1: - return (C0) new SyntaxContainer1_18_R1((PersistentDataContainer) complex); - case 2: - return (C0) Arrays.stream((PersistentDataContainer[]) complex).map(SyntaxContainer1_18_R1::new).toArray(SyntaxContainer1_18_R1[]::new); - case 3: - return (C0) new BukkitContainer1_18_R1((IDataContainer) complex); - case 4: - return (C0) Arrays.stream((IDataContainer[]) complex).map(BukkitContainer1_18_R1::new).toArray(BukkitContainer1_18_R1[]::new); - default: - return (C0) complex; - } - } - - @SuppressWarnings("unchecked") - public P1 toPrimitiveOriginal(P0 primitive) { - switch (primitiveWrap) { - case 1: - return (P1) new BukkitContainer1_18_R1((IDataContainer) primitive); - case 2: - return (P1) Arrays.stream((IDataContainer[]) primitive).map(BukkitContainer1_18_R1::new) - .toArray(BukkitContainer1_18_R1[]::new); - case 3: - return (P1) new SyntaxContainer1_18_R1((PersistentDataContainer) primitive); - case 4: - return (P1) Arrays.stream((PersistentDataContainer[]) primitive).map(SyntaxContainer1_18_R1::new) - .toArray(SyntaxContainer1_18_R1[]::new); - default: - return (P1) primitive; - } - } - - @SuppressWarnings("unchecked") - public C1 toComplexOriginal(C0 complex) { - switch (complexWrap) { - case 1: - return (C1) new BukkitContainer1_18_R1((IDataContainer) complex); - case 2: - return (C1) Arrays.stream((IDataContainer[]) complex).map(BukkitContainer1_18_R1::new).toArray(BukkitContainer1_18_R1[]::new); - case 3: - return (C1) new SyntaxContainer1_18_R1((PersistentDataContainer) complex); - case 4: - return (C1) Arrays.stream((PersistentDataContainer[]) complex).map(SyntaxContainer1_18_R1::new).toArray(SyntaxContainer1_18_R1[]::new); - default: - return (C1) complex; - } - } - - protected static Class internalWrap(Class clazz, int state) { - switch (state) { - case 1: - return SyntaxContainer1_18_R1.class; - case 2: - return SyntaxContainer1_18_R1[].class; - case 3: - return BukkitContainer1_18_R1.class; - case 4: - return BukkitContainer1_18_R1[].class; - default: - return clazz; - } - } - - protected static int internalState(Class clazz) { - if (clazz.isAssignableFrom(PersistentDataContainer.class)) { - return 1; - } - if (clazz.isAssignableFrom(PersistentDataContainer[].class)) { - return 2; - } - if (clazz.isAssignableFrom(IDataContainer.class)) { - return 3; - } - if (clazz.isAssignableFrom(IDataContainer[].class)) { - return 4; - } - return 0; - } - - public static BukkitType1_18_R1 wrap(DataType type) { - return new BukkitType1_18_R1<>(type); - } - - public static SyntaxType1_18_R1 wrap(PersistentDataType type) { - return new SyntaxType1_18_R1<>(type); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/data/hook/BukkitContainerAdapterHook1_18_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/data/hook/BukkitContainerAdapterHook1_18_R1.java deleted file mode 100644 index 9779674..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/data/hook/BukkitContainerAdapterHook1_18_R1.java +++ /dev/null @@ -1,134 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_18_R1.data.hook; - -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; - -import org.bukkit.craftbukkit.v1_18_R1.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_18_R1.persistence.CraftPersistentDataContainer; -import org.bukkit.craftbukkit.v1_18_R1.persistence.CraftPersistentDataTypeRegistry; -import org.bukkit.persistence.PersistentDataContainer; - -import com.syntaxphoenix.syntaxapi.data.IDataContainer; -import com.syntaxphoenix.syntaxapi.data.container.nbt.NbtContainer; -import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; - -import net.minecraft.nbt.NBTTagCompound; -import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_18_R1.data.BukkitContainer1_18_R1; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_18_R1.data.SyntaxContainer1_18_R1; - -@SuppressWarnings({ - "rawtypes", - "unchecked" -}) -public final class BukkitContainerAdapterHook1_18_R1 { - - private static final BukkitContainerAdapterHook1_18_R1 HOOK = new BukkitContainerAdapterHook1_18_R1(); - - private final AbstractReflect registryRef = new Reflect(CraftPersistentDataTypeRegistry.class) - .searchMethod("create", "createAdapter", Class.class, Class.class, Function.class, Function.class) - .searchField("adapters", "adapters") - .searchField("function", "CREATE_ADAPTER"); - private final AbstractReflect entityRef = new Reflect(CraftEntity.class).searchField("registry", "DATA_TYPE_REGISTRY"); - - private BukkitContainerAdapterHook1_18_R1() {} - - private final HashMap map = new HashMap<>(); - - private CraftPersistentDataTypeRegistry getEntityRegistry() { - return (CraftPersistentDataTypeRegistry) entityRef.getFieldValue("registry"); - } - - private void uninjectAll() { - for (CraftPersistentDataTypeRegistry registry : map.keySet()) { - Map adapters = (Map) registryRef.getFieldValue("adapters", registry); - adapters.remove(BukkitContainer1_18_R1.class); - adapters.remove(SyntaxContainer1_18_R1.class); - registryRef.setFieldValue(registry, "function", map.get(registry)); - } - map.clear(); - } - - private void inject(CraftPersistentDataTypeRegistry registry) { - if (map.containsKey(registry)) { - return; - } - map.put(registry, (Function) registryRef.getFieldValue("function", registry)); - Function function = clazz -> createAdapter(registry, registryRef.getMethod("create").getReturnType(), (Class) clazz); - registryRef.setFieldValue(registry, "function", function); - } - - private E createAdapter(CraftPersistentDataTypeRegistry registry, Class adapterType, Class type) { - if (Objects.equals(BukkitContainer1_18_R1.class, type)) { - return (E) buildAdapter(registry, BukkitContainer1_18_R1.class, tag -> fromPrimitiveSyntax(tag)); - } - if (Objects.equals(SyntaxContainer1_18_R1.class, type)) { - return (E) buildAdapter(registry, SyntaxContainer1_18_R1.class, tag -> fromPrimitiveBukkit(registry, tag)); - } - return (E) map.get(registry).apply(type); - } - - private Object buildAdapter(Object handle, Class type, Function function) { - return registryRef.run(handle, "create", type, NBTTagCompound.class, (Function) input -> toPrimitive(input), - function); - } - - private NBTTagCompound toPrimitive(WrappedContainer input) { - Object handle = findFinalContainer(input).getHandle(); - if (handle instanceof PersistentDataContainer) { - if (handle instanceof CraftPersistentDataContainer) { - return ((CraftPersistentDataContainer) handle).toTagCompound(); - } - throw new IllegalArgumentException( - "Expected 'CraftPersistentDataContainer' got '" + handle.getClass().getSimpleName() + " instead'!"); - } - if (handle instanceof IDataContainer) { - if (handle instanceof NbtContainer) { - return (NBTTagCompound) VersionControl.get().getBukkitConversion().toMinecraftCompound(((NbtContainer) handle).asNbt()); - } - throw new IllegalArgumentException( - "Expected 'CraftPersistentDataContainer' got '" + handle.getClass().getSimpleName() + " instead'!"); - } - throw new IllegalArgumentException("Unknown WrappedContainer implementation!"); - } - - private BukkitContainer1_18_R1 fromPrimitiveSyntax(NBTTagCompound data) { - VersionControl control = VersionControl.get(); - NbtContainer container = new NbtContainer(control.getDataProvider().getRegistry()); - NbtCompound compound = control.getBukkitConversion().fromMinecraftCompound(data); - container.fromNbt(compound); - return new BukkitContainer1_18_R1(container); - } - - private SyntaxContainer1_18_R1 fromPrimitiveBukkit(CraftPersistentDataTypeRegistry registry, NBTTagCompound data) { - CraftPersistentDataContainer container = new CraftPersistentDataContainer(registry); - container.putAll(data); - return new SyntaxContainer1_18_R1(container); - } - - private WrappedContainer findFinalContainer(WrappedContainer container) { - WrappedContainer output = container; - while (output.getHandle() instanceof WrappedContainer) { - output = (WrappedContainer) output.getHandle(); - } - return output; - } - - public static void unhookAll() { - HOOK.uninjectAll(); - } - - public static void hookEntity() { - HOOK.inject(HOOK.getEntityRegistry()); - } - - public static void hook(CraftPersistentDataTypeRegistry registry) { - HOOK.inject(registry); - } - -} diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/entity/ArmorStand1_18_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/entity/ArmorStand1_18_R1.java deleted file mode 100644 index f7dbe32..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/entity/ArmorStand1_18_R1.java +++ /dev/null @@ -1,24 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_18_R1.entity; - -import net.minecraft.world.entity.EntityTypes; -import net.minecraft.world.entity.decoration.EntityArmorStand; -import net.minecraft.world.level.World; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsArmorStand; - -public class ArmorStand1_18_R1 extends EntityLiving1_18_R1 implements NmsArmorStand { - - public ArmorStand1_18_R1(World world) { - super(new EntityArmorStand(EntityTypes.c, world)); - } - - @Override - public void setSmall(boolean small) { - handle.a(small); - } - - @Override - public boolean isSmall() { - return handle.n(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/entity/Entity1_18_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/entity/Entity1_18_R1.java deleted file mode 100644 index 51e8733..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/entity/Entity1_18_R1.java +++ /dev/null @@ -1,215 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_18_R1.entity; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.OfflinePlayer; -import org.bukkit.craftbukkit.v1_18_R1.CraftWorld; -import org.bukkit.craftbukkit.v1_18_R1.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_18_R1.util.CraftChatMessage; -import org.bukkit.entity.Player; - -import net.minecraft.network.protocol.game.PacketPlayOutEntityDestroy; -import net.minecraft.network.protocol.game.PacketPlayOutEntityMetadata; -import net.minecraft.network.protocol.game.PacketPlayOutSpawnEntity; -import net.minecraft.server.network.PlayerConnection; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.phys.AxisAlignedBB; -import net.minecraft.world.phys.Vec3D; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.utils.NmsBoundingBox; - -public abstract class Entity1_18_R1 implements NmsEntity { - - protected final E handle; - - protected final List visible = Collections.synchronizedList(new ArrayList<>()); - - public Entity1_18_R1(E handle) { - this.handle = handle; - } - - @Override - public final E getHandle() { - return handle; - } - - @Override - public int getId() { - return handle.ae(); - } - - @Override - public UUID getUniqueId() { - return handle.cm(); - } - - @Override - public NmsBoundingBox getBoundingBox() { - AxisAlignedBB box = handle.cw(); - return new NmsBoundingBox(box.a, box.b, box.c, box.d, box.e, box.f); - } - - @Override - public void setCustomName(String name) { - handle.a(CraftChatMessage.fromStringOrNull(name)); - updateVisibility(); - } - - @Override - public String getCustomName() { - return CraftChatMessage.fromComponent(handle.Z()); - } - - @Override - public void setGravity(boolean gravity) { - handle.e(!gravity); - } - - @Override - public boolean hasGravity() { - return !handle.aM(); - } - - @Override - public void setCustomNameVisible(boolean visible) { - handle.n(visible); - } - - @Override - public boolean isCustomNameVisible() { - return handle.cr(); - } - - @Override - public void setInvisible(boolean invisible) { - handle.j(invisible); - } - - @Override - public boolean isInvisible() { - return handle.bU(); - } - - @Override - public boolean isInteractable() { - return handle.cf(); - } - - @Override - public boolean isCollidable() { - return handle.bn(); - } - - @Override - public void setInvulnerable(boolean invulnerable) { - handle.m(invulnerable); - } - - @Override - public boolean isInvulnerable() { - return handle.cg(); - } - - @Override - public void setLocation(Location location) { - handle.a(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); - if (location.getWorld() == null || handle.W().getWorld() == location.getWorld()) { - updateVisibility(); - return; - } - handle.t = ((CraftWorld) location.getWorld()).getHandle(); - updateVisibility(); - } - - @Override - public Location getLocation() { - Vec3D vector = handle.cV(); - return new Location(handle.W().getWorld(), vector.b, vector.c, vector.d); - } - - @Override - public void updateVisibility() { - if (visible.isEmpty()) { - return; - } - Player[] players; - synchronized (visible) { - players = visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) - .toArray(Player[]::new); - } - hide(players); - show(players); - } - - @Override - public boolean isShown(Player player) { - synchronized (visible) { - return visible.contains(player.getUniqueId()); - } - } - - @Override - public void hide(Player... players) { - if (players.length == 0) { - return; - } - PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(handle.ae()); - for (Player player : players) { - if (!isShown(player)) { - continue; - } - ((CraftPlayer) player).getHandle().b.a(packet); - synchronized (visible) { - visible.remove(player.getUniqueId()); - } - } - } - - @Override - public void show(Player... players) { - if (players.length == 0) { - return; - } - PacketPlayOutSpawnEntity packet = new PacketPlayOutSpawnEntity(handle); - PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.ae(), handle.ai(), true); - PlayerConnection connection; - for (Player player : players) { - if (isShown(player)) { - continue; - } - connection = ((CraftPlayer) player).getHandle().b; - connection.a(packet); - connection.a(metadataPacket); - synchronized (visible) { - visible.add(player.getUniqueId()); - } - } - } - - @Override - public UUID[] getVisible() { - synchronized (visible) { - return visible.toArray(new UUID[0]); - } - } - - @Override - public Player[] getVisibleAsPlayer() { - synchronized (visible) { - return visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) - .toArray(Player[]::new); - } - } - - @Override - public void kill() { - hide(getVisibleAsPlayer()); - handle.ag(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/entity/EntityLiving1_18_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/entity/EntityLiving1_18_R1.java deleted file mode 100644 index e7e522f..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/entity/EntityLiving1_18_R1.java +++ /dev/null @@ -1,17 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_18_R1.entity; - -import net.minecraft.world.entity.EntityLiving; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityLiving; - -public abstract class EntityLiving1_18_R1 extends Entity1_18_R1 implements NmsEntityLiving { - - public EntityLiving1_18_R1(E handle) { - super(handle); - } - - @Override - public void setCollidable(boolean collidable) { - handle.collides = collidable; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/entity/Player1_18_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/entity/Player1_18_R1.java deleted file mode 100644 index 1207279..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/entity/Player1_18_R1.java +++ /dev/null @@ -1,294 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_18_R1.entity; - -import java.util.ArrayList; -import java.util.Collections; - -import org.bukkit.craftbukkit.v1_18_R1.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_18_R1.util.CraftChatMessage; -import org.bukkit.entity.Player; - -import com.mojang.authlib.GameProfile; -import com.mojang.authlib.properties.Property; -import com.mojang.authlib.properties.PropertyMap; -import com.mojang.datafixers.util.Pair; - -import net.minecraft.SystemUtils; -import net.minecraft.network.chat.ChatMessageType; -import net.minecraft.network.chat.IChatBaseComponent; -import net.minecraft.network.protocol.game.ClientboundSetSubtitleTextPacket; -import net.minecraft.network.protocol.game.ClientboundSetTitleTextPacket; -import net.minecraft.network.protocol.game.ClientboundSetTitlesAnimationPacket; -import net.minecraft.network.protocol.game.PacketPlayInClientCommand; -import net.minecraft.network.protocol.game.PacketPlayInClientCommand.EnumClientCommand; -import net.minecraft.network.protocol.game.PacketPlayOutChat; -import net.minecraft.network.protocol.game.PacketPlayOutEntityDestroy; -import net.minecraft.network.protocol.game.PacketPlayOutEntityEquipment; -import net.minecraft.network.protocol.game.PacketPlayOutEntityHeadRotation; -import net.minecraft.network.protocol.game.PacketPlayOutEntityMetadata; -import net.minecraft.network.protocol.game.PacketPlayOutEntityStatus; -import net.minecraft.network.protocol.game.PacketPlayOutHeldItemSlot; -import net.minecraft.network.protocol.game.PacketPlayOutNamedEntitySpawn; -import net.minecraft.network.protocol.game.PacketPlayOutPlayerInfo; -import net.minecraft.network.protocol.game.PacketPlayOutPlayerInfo.EnumPlayerInfoAction; -import net.minecraft.network.protocol.game.PacketPlayOutPlayerListHeaderFooter; -import net.minecraft.network.protocol.game.PacketPlayOutPosition; -import net.minecraft.network.protocol.game.PacketPlayOutRespawn; -import net.minecraft.server.level.EntityPlayer; -import net.minecraft.server.level.WorldServer; -import net.minecraft.server.network.PlayerConnection; -import net.minecraft.util.MathHelper; -import net.minecraft.world.entity.EnumItemSlot; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.biome.BiomeManager; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.type.SkinDataType; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_18_R1.data.SyntaxContainer1_18_R1; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; -import net.sourcewriters.minecraft.vcompat.utils.bukkit.Players; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.MojangProfileServer; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; -import net.sourcewriters.minecraft.vcompat.utils.thread.PostAsync; - -public class Player1_18_R1 extends EntityLiving1_18_R1 implements NmsPlayer { - - private String realName; - private Skin realSkin; - - private final WrappedContainer dataAdapter; - - public Player1_18_R1(Player player) { - super(((CraftPlayer) player).getHandle()); - dataAdapter = new SyntaxContainer1_18_R1(getBukkitPlayer().getPersistentDataContainer()); - update(false); - } - - @Override - public CraftPlayer getBukkitPlayer() { - return handle.getBukkitEntity(); - } - - @Override - public WrappedContainer getDataAdapter() { - return dataAdapter; - } - - @Override - public void setSkin(Skin skin) { - if (skin == null) { - return; - } - dataAdapter.set("skin", skin, SkinDataType.WRAPPED_INSTANCE); - } - - @Override - public Skin getSkin() { - return dataAdapter.getOrDefault("skin", SkinDataType.WRAPPED_INSTANCE, realSkin); - } - - @Override - public Skin getRealSkin() { - return realSkin; - } - - @Override - public void setName(String name) { - if (getName().equals(name)) { - return; - } - if (name == null) { - dataAdapter.remove("name"); - return; - } - dataAdapter.set("name", name, WrapType.STRING); - } - - @Override - public String getName() { - return dataAdapter.getOrDefault("name", WrapType.STRING, realName); - } - - @Override - public String getRealName() { - return realName; - } - - @Override - public void setPlayerListHeader(String text) { - setPlayerListHeaderAndFooter(text, getPlayerListFooter()); - } - - @Override - public String getPlayerListHeader() { - return dataAdapter.getOrDefault("header", WrapType.STRING, ""); - } - - @Override - public void setPlayerListFooter(String text) { - setPlayerListHeaderAndFooter(getPlayerListHeader(), text); - } - - @Override - public String getPlayerListFooter() { - return dataAdapter.getOrDefault("footer", WrapType.STRING, ""); - } - - @Override - public int getPing() { - return handle.e; - } - - @Override - public void setPlayerListHeaderAndFooter(String header, String footer) { - dataAdapter.set("header", header, WrapType.STRING); - dataAdapter.set("footer", footer, WrapType.STRING); - sendPlayerListInfo(header, footer); - } - - private final void sendPlayerListInfo(String header, String footer) { - if (handle.b.isDisconnected()) { - return; - } - - IChatBaseComponent headerComponent = header.isEmpty() ? null : CraftChatMessage.fromStringOrNull(header, true); - IChatBaseComponent footerComponent = footer.isEmpty() ? null : CraftChatMessage.fromStringOrNull(footer, true); - - handle.b.a(new PacketPlayOutPlayerListHeaderFooter(headerComponent, footerComponent)); - } - - @Override - public void setTitleTimes(int fadeIn, int stay, int fadeOut) { - if (handle.b.isDisconnected()) { - return; - } - handle.b.a(new ClientboundSetTitlesAnimationPacket(fadeIn, stay, fadeOut)); - } - - @Override - public void sendSubtitle(String text) { - if (handle.b.isDisconnected()) { - return; - } - handle.b.a(new ClientboundSetSubtitleTextPacket(CraftChatMessage.fromStringOrNull(text))); - } - - @Override - public void sendTitle(String text) { - if (handle.b.isDisconnected()) { - return; - } - handle.b.a(new ClientboundSetTitleTextPacket(CraftChatMessage.fromStringOrNull(text))); - } - - @Override - public void sendActionBar(String text) { - if (handle.b.isDisconnected()) { - return; - } - handle.b.a(new PacketPlayOutChat(CraftChatMessage.fromStringOrNull(text), ChatMessageType.c, SystemUtils.b)); - } - - @Override - public void fakeRespawn() { - if (handle.b.isDisconnected()) { - return; - } - PacketPlayOutPlayerInfo remInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.e, handle); - PacketPlayOutPlayerInfo addInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.a, handle); - - PacketPlayOutEntityDestroy destroyPacket = new PacketPlayOutEntityDestroy(handle.ae()); - PacketPlayOutNamedEntitySpawn spawnPacket = new PacketPlayOutNamedEntitySpawn(handle); - PacketPlayOutEntityHeadRotation rotationPacket = new PacketPlayOutEntityHeadRotation(handle, - (byte) MathHelper.d(handle.ce() * 256F / 360F)); - - ArrayList> list = new ArrayList<>(); - for (EnumItemSlot slot : EnumItemSlot.values()) { - list.add(Pair.of(slot, handle.b(slot))); - } - PacketPlayOutEntityEquipment equipmentPacket = new PacketPlayOutEntityEquipment(handle.ae(), list); - - Player self = getBukkitPlayer(); - Player[] players = Players.getOnlineWithout(getUniqueId()); - for (Player player : players) { - if (!player.canSee(self)) { - continue; - } - PlayerConnection connection = ((CraftPlayer) player).getHandle().b; - connection.a(remInfoPacket); - connection.a(addInfoPacket); - connection.a(destroyPacket); - connection.a(spawnPacket); - connection.a(rotationPacket); - connection.a(equipmentPacket); - } - - WorldServer world = (WorldServer) handle.t; - - PacketPlayOutRespawn respawnPacket = new PacketPlayOutRespawn(world.q_(), world.aa(), - BiomeManager.a(world.E()), handle.d.b(), handle.d.c(), - world.ad(), world.D(), true); - PacketPlayOutPosition positionPacket = new PacketPlayOutPosition(handle.dc(), handle.de(), handle.di(), handle.ce(), - handle.dn(), Collections.emptySet(), 0, false); - PacketPlayOutHeldItemSlot itemPacket = new PacketPlayOutHeldItemSlot(handle.fq().k); - PacketPlayOutEntityStatus statusPacket = new PacketPlayOutEntityStatus(handle, (byte) 28); - PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.ae(), handle.ai(), true); - - PlayerConnection connection = handle.b; - connection.a(remInfoPacket); - connection.a(addInfoPacket); - connection.a(respawnPacket); - connection.a(positionPacket); - connection.a(itemPacket); - connection.a(statusPacket); - connection.a(metadataPacket); - - handle.w(); - handle.u(); - handle.bV.b(); - if (handle.bW != handle.bV) { - handle.bW.b(); - } - self.recalculatePermissions(); - } - - @Override - public void respawn() { - if (handle.b.isDisconnected()) { - return; - } - handle.b.a(new PacketPlayInClientCommand(EnumClientCommand.a)); - } - - @Override - public void update() { - update(true); - } - - private final void update(boolean flag) { - PostAsync.forcePost(() -> { - realName = MojangProfileServer.getName(getUniqueId()); - realSkin = MojangProfileServer.getSkin(realName, getUniqueId()); - }); - if (flag) { - GameProfile profile = handle.fp(); - - Skin skin = getSkin(); - if (skin != null) { - PropertyMap properties = profile.getProperties(); - properties.removeAll("textures"); - properties.put("textures", new Property("textures", skin.getValue(), skin.getSignature())); - } - - String name = getName(); - if (name != null) { - ReflectionProvider.DEFAULT.getReflect("mjGameProfile").setFieldValue(profile, "name", name); - } - - if (!(name == null && skin == null)) { - fakeRespawn(); - } - } - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/tools/BlockTools1_18_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/tools/BlockTools1_18_R1.java deleted file mode 100644 index c222ffd..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/tools/BlockTools1_18_R1.java +++ /dev/null @@ -1,39 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_18_R1.tools; - -import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_18_R1.block.CraftSkull; - -import com.mojang.authlib.properties.Property; -import com.mojang.authlib.properties.PropertyMap; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; - -import net.minecraft.world.level.block.entity.TileEntitySkull; -import net.sourcewriters.minecraft.vcompat.reflection.tools.BlockTools; -import net.sourcewriters.minecraft.vcompat.utils.constants.MinecraftConstants; - -public class BlockTools1_18_R1 extends BlockTools { - - private final AbstractReflect craftEntityStateRef = new Reflect(CraftSkull.class).searchField("tileEntity", "tileEntity"); - - @Override - public void setHeadTexture(Block block, String texture) { - if (!(block instanceof CraftSkull)) { - return; - } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); - PropertyMap map = entitySkull.e.getProperties(); - map.removeAll("textures"); - map.put("textures", new Property("textures", MinecraftConstants.TEXTURE_SIGNATURE, texture)); - } - - @Override - public String getHeadTexture(Block block) { - if (!(block instanceof CraftSkull)) { - return null; - } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); - return entitySkull.e.getProperties().get("textures").iterator().next().getValue(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/tools/ServerTools1_18_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/tools/ServerTools1_18_R1.java deleted file mode 100644 index af79092..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/tools/ServerTools1_18_R1.java +++ /dev/null @@ -1,27 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_18_R1.tools; - -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_18_R1.CraftServer; - -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_18_R1.wrapper.ConsoleReaderWrapper1_18_R1; -import net.sourcewriters.minecraft.vcompat.reflection.tools.ServerTools; - -public class ServerTools1_18_R1 extends ServerTools { - - @Override - public void setMotd(String text) { - ((CraftServer) Bukkit.getServer()).getServer().e(text); - } - - @Override - public String getMotd() { - return ((CraftServer) Bukkit.getServer()).getServer().aa(); - } - - @SuppressWarnings("resource") - @Override - public ConsoleReaderWrapper1_18_R1 getConsole() { - return ConsoleReaderWrapper1_18_R1.INSTANCE; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/tools/SkinTools1_18_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/tools/SkinTools1_18_R1.java deleted file mode 100644 index 4f5d4d0..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/tools/SkinTools1_18_R1.java +++ /dev/null @@ -1,16 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_18_R1.tools; - -import org.bukkit.craftbukkit.v1_18_R1.entity.CraftPlayer; -import org.bukkit.entity.Player; - -import net.sourcewriters.minecraft.vcompat.reflection.tools.SkinTools; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; - -public class SkinTools1_18_R1 extends SkinTools { - - @Override - public Skin skinFromPlayer(Player player) { - return skinFromGameProfile(((CraftPlayer) player).getHandle().fp()); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/utils/EntityConstructors1_18_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/utils/EntityConstructors1_18_R1.java deleted file mode 100644 index 5279a5d..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/utils/EntityConstructors1_18_R1.java +++ /dev/null @@ -1,12 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_18_R1.utils; - -import java.util.function.Function; - -import net.minecraft.world.level.World; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_18_R1.entity.ArmorStand1_18_R1; - -public abstract class EntityConstructors1_18_R1 { - - public static final Function ARMOR_STAND = (world -> new ArmorStand1_18_R1(world)); - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/wrapper/ConsoleReaderWrapper1_18_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/wrapper/ConsoleReaderWrapper1_18_R1.java deleted file mode 100644 index 6383c9b..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_18_R1/wrapper/ConsoleReaderWrapper1_18_R1.java +++ /dev/null @@ -1,43 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_18_R1.wrapper; - -import java.io.IOException; -import java.io.Writer; - -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_18_R1.CraftServer; - -import jline.console.ConsoleReader; -import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; - -public final class ConsoleReaderWrapper1_18_R1 extends ConsoleReaderWrapper { - - public static final ConsoleReaderWrapper1_18_R1 INSTANCE = new ConsoleReaderWrapper1_18_R1(); - - private final ConsoleReader reader; - - @SuppressWarnings("resource") - private ConsoleReaderWrapper1_18_R1() { - this.reader = ((CraftServer) Bukkit.getServer()).getServer().reader; - } - - @Override - public Writer getOutput() { - return reader.getOutput(); - } - - @Override - public boolean isAnsiSupported() { - return reader.getTerminal().isAnsiSupported(); - } - - @Override - public void flush() throws IOException { - reader.flush(); - } - - @Override - public void drawLine() throws IOException { - reader.drawLine(); - } - -} diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/BukkitConversion1_8_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/BukkitConversion1_8_R1.java deleted file mode 100644 index 53082bb..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/BukkitConversion1_8_R1.java +++ /dev/null @@ -1,232 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R1; - -import java.util.List; -import java.util.Set; - -import org.bukkit.craftbukkit.v1_8_R1.inventory.CraftItemStack; -import org.bukkit.entity.EntityType; - -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.nbt.NbtByte; -import com.syntaxphoenix.syntaxapi.nbt.NbtByteArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; -import com.syntaxphoenix.syntaxapi.nbt.NbtDouble; -import com.syntaxphoenix.syntaxapi.nbt.NbtEnd; -import com.syntaxphoenix.syntaxapi.nbt.NbtFloat; -import com.syntaxphoenix.syntaxapi.nbt.NbtInt; -import com.syntaxphoenix.syntaxapi.nbt.NbtIntArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtList; -import com.syntaxphoenix.syntaxapi.nbt.NbtLong; -import com.syntaxphoenix.syntaxapi.nbt.NbtLongArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtShort; -import com.syntaxphoenix.syntaxapi.nbt.NbtString; -import com.syntaxphoenix.syntaxapi.nbt.NbtTag; -import com.syntaxphoenix.syntaxapi.nbt.NbtType; - -import net.minecraft.server.v1_8_R1.ItemStack; -import net.minecraft.server.v1_8_R1.NBTBase; -import net.minecraft.server.v1_8_R1.NBTTagByte; -import net.minecraft.server.v1_8_R1.NBTTagByteArray; -import net.minecraft.server.v1_8_R1.NBTTagCompound; -import net.minecraft.server.v1_8_R1.NBTTagDouble; -import net.minecraft.server.v1_8_R1.NBTTagEnd; -import net.minecraft.server.v1_8_R1.NBTTagFloat; -import net.minecraft.server.v1_8_R1.NBTTagInt; -import net.minecraft.server.v1_8_R1.NBTTagIntArray; -import net.minecraft.server.v1_8_R1.NBTTagList; -import net.minecraft.server.v1_8_R1.NBTTagLong; -import net.minecraft.server.v1_8_R1.NBTTagShort; -import net.minecraft.server.v1_8_R1.NBTTagString; -import net.sourcewriters.minecraft.vcompat.reflection.BukkitConversion; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContext; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleWrapType; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; - -public class BukkitConversion1_8_R1 extends BukkitConversion { - - protected BukkitConversion1_8_R1(VersionControl1_8_R1 versionControl) { - super(versionControl); - } - - @Override - public EntityType toEntityType(NmsEntityType type) { - try { - return EntityType.valueOf(type.name()); - } catch (IllegalArgumentException ignore) { - return null; - } - } - - @Override - public NmsEntityType fromEntityType(EntityType type) { - try { - return NmsEntityType.valueOf(type.name()); - } catch (IllegalArgumentException ignore) { - return null; - } - } - - @Override - public NBTBase toMinecraftTag(NbtTag tag) { - switch (tag.getType()) { - case BYTE: - return new NBTTagByte((byte) tag.getValue()); - case SHORT: - return new NBTTagShort((short) tag.getValue()); - case INT: - return new NBTTagInt((int) tag.getValue()); - case LONG: - return new NBTTagLong((long) tag.getValue()); - case FLOAT: - return new NBTTagFloat((float) tag.getValue()); - case DOUBLE: - return new NBTTagDouble((double) tag.getValue()); - case STRING: - return new NBTTagString((String) tag.getValue()); - case BYTE_ARRAY: - return new NBTTagByteArray((byte[]) tag.getValue()); - case INT_ARRAY: - return new NBTTagIntArray((int[]) tag.getValue()); - case LONG_ARRAY: - NBTTagList list = new NBTTagList(); - for (long value : (long[]) tag.getValue()) { - list.add(new NBTTagLong(value)); - } - return list; - case LIST: - return toMinecraftList((NbtList) tag); - case COMPOUND: - return toMinecraftCompound((NbtCompound) tag); - case END: - return (NBTTagEnd) ReflectionProvider.DEFAULT.getReflect("nmsNBTTagEnd").init(); - default: - return null; - } - } - - @Override - public NbtTag fromMinecraftTag(Object raw) { - if (!(raw instanceof NBTBase)) { - return null; - } - NBTBase tag = (NBTBase) raw; - NbtType type = NbtType.getById(tag.getTypeId()); - switch (type) { - case BYTE: - return new NbtByte(((NBTTagByte) tag).f()); - case SHORT: - return new NbtShort(((NBTTagShort) tag).e()); - case INT: - return new NbtInt(((NBTTagInt) tag).d()); - case LONG: - return new NbtLong(((NBTTagLong) tag).c()); - case FLOAT: - return new NbtFloat(((NBTTagFloat) tag).h()); - case DOUBLE: - return new NbtDouble(((NBTTagDouble) tag).g()); - case STRING: - return new NbtString(((NBTTagString) tag).a_()); - case BYTE_ARRAY: - return new NbtByteArray(((NBTTagByteArray) tag).c()); - case INT_ARRAY: - return new NbtIntArray(((NBTTagIntArray) tag).c()); - case LONG_ARRAY: - return new NbtLongArray(new long[0]); - case LIST: - return fromMinecraftList(tag); - case COMPOUND: - return fromMinecraftCompound(tag); - case END: - return NbtEnd.INSTANCE; - default: - return null; - } - } - - @Override - public NBTTagList toMinecraftList(NbtList list) { - NBTTagList output = new NBTTagList(); - for (NbtTag tag : list) { - output.add(toMinecraftTag(tag)); - } - return output; - } - - @SuppressWarnings("unchecked") - @Override - public NbtList fromMinecraftList(Object raw) { - if (!(raw instanceof NBTTagList)) { - return null; - } - NBTTagList list = (NBTTagList) raw; - List content = (List) ReflectionProvider.DEFAULT.getReflect("nmsNBTTagList").getFieldValue("value", list); - NbtList output = new NbtList<>(NbtType.getById(list.getTypeId())); - for (NBTBase base : content) { - output.add(fromMinecraftTag(base)); - } - return output; - } - - @Override - public NBTTagCompound toMinecraftCompound(NbtCompound compound) { - NBTTagCompound output = new NBTTagCompound(); - if (compound.isEmpty()) { - return output; - } - Set keys = compound.getKeys(); - for (String key : keys) { - output.set(key, toMinecraftTag(compound.get(key))); - } - return output; - } - - @SuppressWarnings("unchecked") - @Override - public NbtCompound fromMinecraftCompound(Object raw) { - if (!(raw instanceof NBTTagCompound)) { - return null; - } - NBTTagCompound compound = (NBTTagCompound) raw; - NbtCompound output = new NbtCompound(); - if (compound.isEmpty()) { - return output; - } - Set keys = compound.c(); - for (String key : keys) { - output.set(key, fromMinecraftTag(compound.get(key))); - } - return output; - } - - @Override - public org.bukkit.inventory.ItemStack itemFromCompound(NbtCompound compound) { - return CraftItemStack.asBukkitCopy(ItemStack.createStack(toMinecraftCompound(compound))); - } - - @Override - public NbtCompound itemToCompound(org.bukkit.inventory.ItemStack itemStack) { - ItemStack nmsStack = CraftItemStack.asNMSCopy(itemStack); - NBTTagCompound stackTag; - if (!nmsStack.hasTag()) { - stackTag = nmsStack.save(new NBTTagCompound()); - } else { - stackTag = nmsStack.getTag(); - } - return fromMinecraftCompound(stackTag); - } - - @Override - public WrappedContext createContext(DataAdapterContext context) { - return new SimpleSyntaxContext(context); - } - - @Override - public WrapType wrap(DataType dataType) { - return new SimpleWrapType(dataType); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/EntityProvider1_8_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/EntityProvider1_8_R1.java deleted file mode 100644 index f190b67..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/EntityProvider1_8_R1.java +++ /dev/null @@ -1,47 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R1; - -import java.util.EnumMap; -import java.util.function.Function; - -import org.bukkit.craftbukkit.v1_8_R1.CraftWorld; - -import net.minecraft.server.v1_8_R1.World; -import net.sourcewriters.minecraft.vcompat.reflection.EntityProvider; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R1.utils.EntityConstructors1_8_R1; - -public class EntityProvider1_8_R1 extends EntityProvider { - - private final EnumMap> entityMap = new EnumMap<>(NmsEntityType.class); - - protected EntityProvider1_8_R1(VersionControl1_8_R1 versionControl) { - super(versionControl); - } - - @SuppressWarnings("unchecked") - private final Function searchConstructor(NmsEntityType type) { - try { - return (Function) EntityConstructors1_8_R1.class.getField(type.name()).get(null); - } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException ignore) { - return null; - } - } - - private final Function getConstructor(NmsEntityType type) { - return entityMap.computeIfAbsent(type, (key -> searchConstructor(key))); - } - - @Override - public NmsEntity createEntity(org.bukkit.World world, NmsEntityType type) { - if (!(world instanceof CraftWorld)) { - return null; - } - Function function; - if ((function = getConstructor(type)) == null) { - return null; - } - return function.apply(((CraftWorld) world).getHandle()); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/PacketHandler1_8_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/PacketHandler1_8_R1.java deleted file mode 100644 index c648cb5..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/PacketHandler1_8_R1.java +++ /dev/null @@ -1,11 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R1; - -import net.sourcewriters.minecraft.vcompat.reflection.PacketHandler; - -public class PacketHandler1_8_R1 extends PacketHandler { - - protected PacketHandler1_8_R1(VersionControl1_8_R1 versionControl) { - super(versionControl); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/PlayerProvider1_8_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/PlayerProvider1_8_R1.java deleted file mode 100644 index 0020d6d..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/PlayerProvider1_8_R1.java +++ /dev/null @@ -1,30 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R1; - -import java.io.File; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; - -import net.sourcewriters.minecraft.vcompat.reflection.DataProvider; -import net.sourcewriters.minecraft.vcompat.reflection.PlayerProvider; -import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.DataDistributor; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R1.entity.Player1_8_R1; - -public class PlayerProvider1_8_R1 extends PlayerProvider { - - private final DataDistributor distributor; - - protected PlayerProvider1_8_R1(VersionControl1_8_R1 versionControl) { - super(versionControl); - distributor = versionControl.getDataProvider().createDistributor(new File(Bukkit.getWorlds().get(0).getWorldFolder(), "playerdata"), - uuid -> "custom_" + uuid.toString(), DataProvider.DEFAULT_RANDOM); - } - - @Override - protected NmsPlayer createPlayer(Player player) { - return new Player1_8_R1(player, distributor.get(player.getUniqueId())); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/TextureProvider1_8_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/TextureProvider1_8_R1.java deleted file mode 100644 index 825d00f..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/TextureProvider1_8_R1.java +++ /dev/null @@ -1,107 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R1; - -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_8_R1.block.CraftSkull; -import org.bukkit.craftbukkit.v1_8_R1.inventory.CraftItemStack; -import org.bukkit.inventory.meta.ItemMeta; -import org.bukkit.inventory.meta.SkullMeta; -import org.bukkit.material.MaterialData; - -import com.mojang.authlib.GameProfile; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; - -import net.minecraft.server.v1_8_R1.GameProfileSerializer; -import net.minecraft.server.v1_8_R1.ItemStack; -import net.minecraft.server.v1_8_R1.NBTTagCompound; -import net.minecraft.server.v1_8_R1.TileEntitySkull; -import net.sourcewriters.minecraft.vcompat.reflection.TextureProvider; - -@SuppressWarnings("deprecation") -public class TextureProvider1_8_R1 extends TextureProvider { - - private final AbstractReflect craftItemStackRef = new Reflect(CraftItemStack.class).searchField("handle", "handle"); - private final AbstractReflect craftMetaSkullRef = new Reflect("org.bukkit.craftbukkit.v1_8_R1.inventory.CraftMetaSkull") - .searchField("serialized", "serializedProfile").searchField("profile", "profile"); - private final AbstractReflect craftSkullRef = new Reflect(CraftSkull.class).searchField("tileEntity", "skull"); - private final Material skullMaterial = Material.valueOf("SKULL"); - - protected TextureProvider1_8_R1(VersionControl1_8_R1 versionControl) { - super(versionControl); - } - - @Override - public GameProfile profileFromBlock(Block block) { - if (!(block instanceof CraftSkull)) { - return null; - } - return ((TileEntitySkull) craftSkullRef.getFieldValue("tileEntity", block)).getGameProfile(); - } - - @Override - public GameProfile profileFromItem(org.bukkit.inventory.ItemStack itemStack) { - if (!(itemStack.getItemMeta() instanceof SkullMeta)) { - return null; - } - SkullMeta meta = (SkullMeta) itemStack.getItemMeta(); - GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue("profile", meta); - if (profile == null) { - NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue("serialized", meta); - if (compound == null) { - ItemStack stack = null; - if (itemStack instanceof CraftItemStack) { - stack = (ItemStack) craftItemStackRef.getFieldValue("handle", itemStack); - } - if (stack == null) { - stack = CraftItemStack.asNMSCopy(itemStack); - } - NBTTagCompound stackTag; - if (!stack.hasTag()) { - stackTag = stack.save(new NBTTagCompound()); - } else { - stackTag = stack.getTag(); - } - if (stackTag.hasKeyOfType("SkullOwner", 10)) { - compound = stackTag.getCompound("SkullOwner"); - } else if (stackTag.hasKeyOfType("SkullProfile", 10)) { - compound = stackTag.getCompound("SkullProfile"); - } - } - if (compound == null) { - return null; - } - profile = GameProfileSerializer.deserialize(compound); - } - return profile; - } - - @Override - public org.bukkit.inventory.ItemStack getItem(GameProfile profile) { - org.bukkit.inventory.ItemStack craftStack = CraftItemStack.asCraftCopy(new MaterialData(skullMaterial, (byte) 3).toItemStack(1)); - applyItem(craftStack, profile); - return craftStack; - } - - @Override - public boolean applyItem(org.bukkit.inventory.ItemStack itemStack, GameProfile profile) { - ItemMeta meta = itemStack.getItemMeta(); - if (!(meta instanceof SkullMeta)) { - return false; - } - SkullMeta skullMeta = (SkullMeta) meta; - craftMetaSkullRef.setFieldValue(meta, "profile", profile); - itemStack.setItemMeta(skullMeta); - return true; - } - - @Override - public boolean applyBlock(Block block, GameProfile profile) { - if (!(block instanceof CraftSkull)) { - return false; - } - ((TileEntitySkull) craftSkullRef.getFieldValue("tileEntity", block)).setGameProfile(profile); - return true; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/ToolProvider1_8_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/ToolProvider1_8_R1.java deleted file mode 100644 index d94d998..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/ToolProvider1_8_R1.java +++ /dev/null @@ -1,33 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R1; - -import net.sourcewriters.minecraft.vcompat.reflection.ToolProvider; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R1.tools.BlockTools1_8_R1; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R1.tools.ServerTools1_8_R1; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R1.tools.SkinTools1_8_R1; - -public class ToolProvider1_8_R1 extends ToolProvider { - - private final BlockTools1_8_R1 blockTools = new BlockTools1_8_R1(); - private final SkinTools1_8_R1 skinTools = new SkinTools1_8_R1(); - private final ServerTools1_8_R1 serverTools = new ServerTools1_8_R1(); - - protected ToolProvider1_8_R1(VersionControl1_8_R1 versionControl) { - super(versionControl); - } - - @Override - public SkinTools1_8_R1 getSkinTools() { - return skinTools; - } - - @Override - public ServerTools1_8_R1 getServerTools() { - return serverTools; - } - - @Override - public BlockTools1_8_R1 getBlockTools() { - return blockTools; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/VersionControl1_8_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/VersionControl1_8_R1.java deleted file mode 100644 index b60fc83..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/VersionControl1_8_R1.java +++ /dev/null @@ -1,56 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R1; - -import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R1.reflection.NmsReflection1_8_R1; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; - -public class VersionControl1_8_R1 extends VersionControl { - - public static VersionControl1_8_R1 INSTANCE; - - public static VersionControl1_8_R1 init() { - return INSTANCE != null ? INSTANCE : (INSTANCE = new VersionControl1_8_R1()); - } - - private final ToolProvider1_8_R1 toolProvider = new ToolProvider1_8_R1(this); - private final TextureProvider1_8_R1 textureProvider = new TextureProvider1_8_R1(this); - private final PacketHandler1_8_R1 packetHandler = new PacketHandler1_8_R1(this); - private final EntityProvider1_8_R1 entityProvider = new EntityProvider1_8_R1(this); - private final PlayerProvider1_8_R1 playerProvider = new PlayerProvider1_8_R1(this); - private final BukkitConversion1_8_R1 bukkitConversion = new BukkitConversion1_8_R1(this); - - private VersionControl1_8_R1() { - NmsReflection1_8_R1.INSTANCE.setup(ReflectionProvider.DEFAULT); - } - - @Override - public ToolProvider1_8_R1 getToolProvider() { - return toolProvider; - } - - @Override - public EntityProvider1_8_R1 getEntityProvider() { - return entityProvider; - } - - @Override - public PlayerProvider1_8_R1 getPlayerProvider() { - return playerProvider; - } - - @Override - public TextureProvider1_8_R1 getTextureProvider() { - return textureProvider; - } - - @Override - public PacketHandler1_8_R1 getPacketHandler() { - return packetHandler; - } - - @Override - public BukkitConversion1_8_R1 getBukkitConversion() { - return bukkitConversion; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/entity/ArmorStand1_8_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/entity/ArmorStand1_8_R1.java deleted file mode 100644 index 9a2247f..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/entity/ArmorStand1_8_R1.java +++ /dev/null @@ -1,33 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R1.entity; - -import net.minecraft.server.v1_8_R1.EntityArmorStand; -import net.minecraft.server.v1_8_R1.World; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsArmorStand; - -public class ArmorStand1_8_R1 extends EntityLiving1_8_R1 implements NmsArmorStand { - - public ArmorStand1_8_R1(World world) { - super(new EntityArmorStand(world)); - } - - @Override - public boolean hasGravity() { - return handle.hasGravity(); - } - - @Override - public void setGravity(boolean gravity) { - handle.setGravity(gravity); - } - - @Override - public void setSmall(boolean small) { - handle.setSmall(small); - } - - @Override - public boolean isSmall() { - return handle.isSmall(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/entity/Entity1_8_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/entity/Entity1_8_R1.java deleted file mode 100644 index 3bb5277..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/entity/Entity1_8_R1.java +++ /dev/null @@ -1,213 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R1.entity; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.OfflinePlayer; -import org.bukkit.craftbukkit.v1_8_R1.CraftWorld; -import org.bukkit.craftbukkit.v1_8_R1.entity.CraftPlayer; -import org.bukkit.entity.Player; - -import net.minecraft.server.v1_8_R1.AxisAlignedBB; -import net.minecraft.server.v1_8_R1.Entity; -import net.minecraft.server.v1_8_R1.EntityTypes; -import net.minecraft.server.v1_8_R1.PacketPlayOutEntityDestroy; -import net.minecraft.server.v1_8_R1.PacketPlayOutEntityMetadata; -import net.minecraft.server.v1_8_R1.PacketPlayOutSpawnEntity; -import net.minecraft.server.v1_8_R1.PlayerConnection; -import net.minecraft.server.v1_8_R1.Vec3D; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.utils.NmsBoundingBox; - -public abstract class Entity1_8_R1 implements NmsEntity { - - protected final E handle; - - protected final List visible = Collections.synchronizedList(new ArrayList<>()); - - public Entity1_8_R1(E handle) { - this.handle = handle; - } - - @Override - public final E getHandle() { - return handle; - } - - @Override - public int getId() { - return handle.getId(); - } - - @Override - public UUID getUniqueId() { - return handle.getUniqueID(); - } - - @Override - public NmsBoundingBox getBoundingBox() { - AxisAlignedBB box = handle.getBoundingBox(); - return new NmsBoundingBox(box.a, box.b, box.c, box.d, box.e, box.f); - } - - @Override - public void setCustomName(String name) { - handle.setCustomName(name); - updateVisibility(); - } - - @Override - public String getCustomName() { - return handle.getCustomName(); - } - - @Override - public void setCustomNameVisible(boolean visible) { - handle.setCustomNameVisible(visible); - } - - @Override - public boolean isCustomNameVisible() { - return handle.getCustomNameVisible(); - } - - @Override - public void setInvisible(boolean invisible) { - handle.setInvisible(invisible); - } - - @Override - public boolean isInvisible() { - return handle.isInvisible(); - } - - @Override - public boolean isInteractable() { - return handle.ad(); - } - - @Override - public boolean isCollidable() { - return handle.ae(); - } - - @Override - public void setInvulnerable(boolean invulnerable) { - handle.h(invulnerable); - } - - @Override - public boolean isInvulnerable() { - return handle.isInvulnerable(null); - } - - @Override - public boolean hasGravity() { - return true; - } - - @Override - public void setGravity(boolean gravity) {} - - @Override - public void setLocation(Location location) { - handle.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); - if (location.getWorld() == null || handle.getWorld().getWorld() == location.getWorld()) { - updateVisibility(); - return; - } - handle.world = ((CraftWorld) location.getWorld()).getHandle(); - updateVisibility(); - } - - @Override - public Location getLocation() { - Vec3D vector = handle.d(); - return new Location(handle.getWorld().getWorld(), vector.a, vector.b, vector.c); - } - - @Override - public void updateVisibility() { - if (visible.isEmpty()) { - return; - } - Player[] players; - synchronized (visible) { - players = visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) - .toArray(Player[]::new); - } - hide(players); - show(players); - } - - @Override - public boolean isShown(Player player) { - synchronized (visible) { - return visible.contains(player.getUniqueId()); - } - } - - @Override - public void hide(Player... players) { - if (players.length == 0) { - return; - } - PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(handle.getId()); - for (Player player : players) { - if (!isShown(player)) { - continue; - } - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); - synchronized (visible) { - visible.remove(player.getUniqueId()); - } - } - } - - @Override - public void show(Player... players) { - if (players.length == 0) { - return; - } - PacketPlayOutSpawnEntity packet = new PacketPlayOutSpawnEntity(handle, EntityTypes.a(handle)); - PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); - PlayerConnection connection; - for (Player player : players) { - if (isShown(player)) { - continue; - } - connection = ((CraftPlayer) player).getHandle().playerConnection; - connection.sendPacket(packet); - connection.sendPacket(metadataPacket); - synchronized (visible) { - visible.add(player.getUniqueId()); - } - } - } - - @Override - public UUID[] getVisible() { - synchronized (visible) { - return visible.toArray(new UUID[0]); - } - } - - @Override - public Player[] getVisibleAsPlayer() { - synchronized (visible) { - return visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) - .toArray(Player[]::new); - } - } - - @Override - public void kill() { - hide(getVisibleAsPlayer()); - handle.die(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/entity/EntityLiving1_8_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/entity/EntityLiving1_8_R1.java deleted file mode 100644 index 0e40af9..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/entity/EntityLiving1_8_R1.java +++ /dev/null @@ -1,17 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R1.entity; - -import net.minecraft.server.v1_8_R1.EntityLiving; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityLiving; - -public abstract class EntityLiving1_8_R1 extends Entity1_8_R1 implements NmsEntityLiving { - - public EntityLiving1_8_R1(E handle) { - super(handle); - } - - @Override - public void setCollidable(boolean collidable) { - - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/entity/Player1_8_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/entity/Player1_8_R1.java deleted file mode 100644 index 5740f90..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/entity/Player1_8_R1.java +++ /dev/null @@ -1,295 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R1.entity; - -import java.util.ArrayList; -import java.util.Collections; - -import org.bukkit.craftbukkit.v1_8_R1.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_8_R1.util.CraftChatMessage; -import org.bukkit.entity.Player; - -import com.mojang.authlib.GameProfile; -import com.mojang.authlib.properties.Property; -import com.mojang.authlib.properties.PropertyMap; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; - -import net.minecraft.server.v1_8_R1.EntityPlayer; -import net.minecraft.server.v1_8_R1.EnumClientCommand; -import net.minecraft.server.v1_8_R1.EnumPlayerInfoAction; -import net.minecraft.server.v1_8_R1.EnumTitleAction; -import net.minecraft.server.v1_8_R1.IChatBaseComponent; -import net.minecraft.server.v1_8_R1.MathHelper; -import net.minecraft.server.v1_8_R1.PacketPlayInClientCommand; -import net.minecraft.server.v1_8_R1.PacketPlayOutChat; -import net.minecraft.server.v1_8_R1.PacketPlayOutEntityDestroy; -import net.minecraft.server.v1_8_R1.PacketPlayOutEntityEquipment; -import net.minecraft.server.v1_8_R1.PacketPlayOutEntityHeadRotation; -import net.minecraft.server.v1_8_R1.PacketPlayOutEntityMetadata; -import net.minecraft.server.v1_8_R1.PacketPlayOutEntityStatus; -import net.minecraft.server.v1_8_R1.PacketPlayOutHeldItemSlot; -import net.minecraft.server.v1_8_R1.PacketPlayOutNamedEntitySpawn; -import net.minecraft.server.v1_8_R1.PacketPlayOutPlayerInfo; -import net.minecraft.server.v1_8_R1.PacketPlayOutPlayerListHeaderFooter; -import net.minecraft.server.v1_8_R1.PacketPlayOutPosition; -import net.minecraft.server.v1_8_R1.PacketPlayOutRespawn; -import net.minecraft.server.v1_8_R1.PacketPlayOutTitle; -import net.minecraft.server.v1_8_R1.PlayerConnection; -import net.minecraft.server.v1_8_R1.WorldServer; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.PersistentContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.type.SkinDataType; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContainer; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; -import net.sourcewriters.minecraft.vcompat.utils.bukkit.Players; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.MojangProfileServer; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; -import net.sourcewriters.minecraft.vcompat.utils.thread.PostAsync; - -public class Player1_8_R1 extends EntityLiving1_8_R1 implements NmsPlayer { - - private String realName; - private Skin realSkin; - - private final WrappedContainer dataAdapter; - - public Player1_8_R1(Player player, PersistentContainer container) { - super(((CraftPlayer) player).getHandle()); - this.dataAdapter = new SimpleSyntaxContainer<>(container); - update(false); - } - - @Override - public CraftPlayer getBukkitPlayer() { - return handle.getBukkitEntity(); - } - - @Override - public WrappedContainer getDataAdapter() { - return dataAdapter; - } - - @Override - public void setSkin(Skin skin) { - if (skin == null || getSkin().equals(skin)) { - return; - } - getDataAdapter().set("skin", skin, SkinDataType.WRAPPED_INSTANCE); - } - - @Override - public Skin getSkin() { - return dataAdapter.getOrDefault("skin", SkinDataType.WRAPPED_INSTANCE, realSkin); - } - - @Override - public Skin getRealSkin() { - return realSkin; - } - - @Override - public void setName(String name) { - if (getName().equals(name)) { - return; - } - if (name == null) { - getDataAdapter().remove("name"); - return; - } - getDataAdapter().set("name", name, WrapType.STRING); - } - - @Override - public String getName() { - return getDataAdapter().getOrDefault("name", WrapType.STRING, realName); - } - - @Override - public String getRealName() { - return realName; - } - - @Override - public void setPlayerListHeader(String text) { - setPlayerListHeaderAndFooter(text, getPlayerListFooter()); - } - - @Override - public String getPlayerListHeader() { - return getDataAdapter().getOrDefault("header", WrapType.STRING, ""); - } - - @Override - public void setPlayerListFooter(String text) { - setPlayerListHeaderAndFooter(getPlayerListHeader(), text); - } - - @Override - public String getPlayerListFooter() { - return getDataAdapter().getOrDefault("footer", WrapType.STRING, ""); - } - - @Override - public int getPing() { - return handle.ping; - } - - @Override - public void setPlayerListHeaderAndFooter(String header, String footer) { - getDataAdapter().set("header", header, WrapType.STRING); - getDataAdapter().set("footer", footer, WrapType.STRING); - sendPlayerListInfo(header, footer); - } - - private final void sendPlayerListInfo(String header, String footer) { - if (handle.playerConnection.isDisconnected()) { - return; - } - - IChatBaseComponent headerComponent = header.isEmpty() ? null : CraftChatMessage.fromString(header, true)[0]; - IChatBaseComponent footerComponent = footer.isEmpty() ? null : CraftChatMessage.fromString(footer, true)[0]; - - PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter(); - - Reflect reflect = ReflectionProvider.DEFAULT.getReflect("nmsPacketPlayOutPlayerListHeaderFooter"); - reflect.setFieldValue(packet, "header", headerComponent); - reflect.setFieldValue(packet, "footer", footerComponent); - - handle.playerConnection.sendPacket(packet); - } - - @Override - public void setTitleTimes(int fadeIn, int stay, int fadeOut) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TIMES, null, fadeIn, stay, fadeOut)); - } - - @Override - public void sendSubtitle(String text) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.SUBTITLE, CraftChatMessage.fromString(text)[0])); - } - - @Override - public void sendTitle(String text) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TITLE, CraftChatMessage.fromString(text)[0])); - } - - @Override - public void sendActionBar(String text) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutChat(CraftChatMessage.fromString(text)[0], (byte) 2)); - } - - @Override - public void fakeRespawn() { - if (handle.playerConnection.isDisconnected()) { - return; - } - PacketPlayOutPlayerInfo remInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER, handle); - PacketPlayOutPlayerInfo addInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.ADD_PLAYER, handle); - - PacketPlayOutEntityDestroy destroyPacket = new PacketPlayOutEntityDestroy(handle.getId()); - PacketPlayOutNamedEntitySpawn spawnPacket = new PacketPlayOutNamedEntitySpawn(handle); - PacketPlayOutEntityHeadRotation rotationPacket = new PacketPlayOutEntityHeadRotation(handle, - (byte) MathHelper.d(handle.getHeadRotation() * 256F / 360F)); - - ArrayList equipmentPackets = new ArrayList<>(); - for (int slot = 0; slot < 5; slot++) { - equipmentPackets.add(new PacketPlayOutEntityEquipment(handle.getId(), slot, handle.getEquipment(slot))); - } - - Player self = getBukkitPlayer(); - Player[] players = Players.getOnlineWithout(getUniqueId()); - for (Player player : players) { - if (!player.canSee(self)) { - continue; - } - PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection; - connection.sendPacket(remInfoPacket); - connection.sendPacket(addInfoPacket); - connection.sendPacket(destroyPacket); - connection.sendPacket(spawnPacket); - connection.sendPacket(rotationPacket); - for (PacketPlayOutEntityEquipment equipmentPacket : equipmentPackets) { - connection.sendPacket(equipmentPacket); - } - } - - WorldServer world = (WorldServer) handle.world; - - PacketPlayOutRespawn respawnPacket = new PacketPlayOutRespawn(handle.dimension, world.getDifficulty(), - handle.world.worldData.getType(), handle.playerInteractManager.getGameMode()); - PacketPlayOutPosition positionPacket = new PacketPlayOutPosition(handle.locX, handle.locY, handle.locZ, handle.yaw, handle.pitch, - Collections.emptySet()); - PacketPlayOutHeldItemSlot itemPacket = new PacketPlayOutHeldItemSlot(handle.inventory.itemInHandIndex); - PacketPlayOutEntityStatus statusPacket = new PacketPlayOutEntityStatus(handle, (byte) 28); - PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); - - PlayerConnection connection = handle.playerConnection; - connection.sendPacket(remInfoPacket); - connection.sendPacket(addInfoPacket); - connection.sendPacket(respawnPacket); - connection.sendPacket(positionPacket); - connection.sendPacket(itemPacket); - connection.sendPacket(statusPacket); - connection.sendPacket(metadataPacket); - - handle.updateAbilities(); - handle.triggerHealthUpdate(); - handle.updateInventory(handle.defaultContainer); - if (handle.activeContainer != handle.defaultContainer) { - handle.updateInventory(handle.activeContainer); - } - self.recalculatePermissions(); - } - - @Override - public void respawn() { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayInClientCommand(EnumClientCommand.PERFORM_RESPAWN)); - } - - @Override - public void update() { - update(true); - } - - private final void update(boolean flag) { - PostAsync.forcePost(() -> { - realName = MojangProfileServer.getName(getUniqueId()); - realSkin = MojangProfileServer.getSkin(realName, getUniqueId()); - }); - if (flag) { - GameProfile profile = handle.getProfile(); - - Skin skin = getSkin(); - if (skin != null) { - PropertyMap properties = profile.getProperties(); - properties.removeAll("textures"); - properties.put("textures", new Property("textures", skin.getValue(), skin.getSignature())); - } - - String name = getName(); - if (name != null) { - ReflectionProvider.DEFAULT.getReflect("mjGameProfile").setFieldValue(profile, "name", name); - } - - if (!(name == null && skin == null)) { - fakeRespawn(); - } - } - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/reflection/NmsReflection1_8_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/reflection/NmsReflection1_8_R1.java deleted file mode 100644 index e38ae76..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/reflection/NmsReflection1_8_R1.java +++ /dev/null @@ -1,34 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R1.reflection; - -import net.minecraft.server.v1_8_R1.NBTTagEnd; -import net.minecraft.server.v1_8_R1.NBTTagList; -import net.minecraft.server.v1_8_R1.PacketPlayOutPlayerListHeaderFooter; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.Reflections; - -public class NmsReflection1_8_R1 extends Reflections { - - public static NmsReflection1_8_R1 INSTANCE = new NmsReflection1_8_R1(); - - private NmsReflection1_8_R1() {} - - @Override - public void setup(ReflectionProvider provider) { - - // - // - // Create Reflects - // - - // - // Minecraft - - provider.createReflect("nmsPacketPlayOutPlayerListHeaderFooter", PacketPlayOutPlayerListHeaderFooter.class) - .searchField("header", "a").searchField("header", "b"); - - provider.createReflect("nmsNBTTagEnd", NBTTagEnd.class); - provider.createReflect("nmsNBTTagList", NBTTagList.class).searchField("value", "list"); - - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/tools/BlockTools1_8_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/tools/BlockTools1_8_R1.java deleted file mode 100644 index 82ec379..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/tools/BlockTools1_8_R1.java +++ /dev/null @@ -1,39 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R1.tools; - -import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_8_R1.block.CraftSkull; - -import com.mojang.authlib.properties.Property; -import com.mojang.authlib.properties.PropertyMap; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; - -import net.minecraft.server.v1_8_R1.TileEntitySkull; -import net.sourcewriters.minecraft.vcompat.reflection.tools.BlockTools; -import net.sourcewriters.minecraft.vcompat.utils.constants.MinecraftConstants; - -public class BlockTools1_8_R1 extends BlockTools { - - private final AbstractReflect craftEntityStateRef = new Reflect(CraftSkull.class).searchField("tileEntity", "tileEntity"); - - @Override - public void setHeadTexture(Block block, String texture) { - if (!(block instanceof CraftSkull)) { - return; - } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); - PropertyMap map = entitySkull.getGameProfile().getProperties(); - map.removeAll("textures"); - map.put("textures", new Property("textures", MinecraftConstants.TEXTURE_SIGNATURE, texture)); - } - - @Override - public String getHeadTexture(Block block) { - if (!(block instanceof CraftSkull)) { - return null; - } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); - return entitySkull.getGameProfile().getProperties().get("textures").iterator().next().getValue(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/tools/ServerTools1_8_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/tools/ServerTools1_8_R1.java deleted file mode 100644 index 1445a92..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/tools/ServerTools1_8_R1.java +++ /dev/null @@ -1,26 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R1.tools; - -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_8_R1.CraftServer; - -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R1.wrapper.ConsoleReaderWrapper1_8_R1; -import net.sourcewriters.minecraft.vcompat.reflection.tools.ServerTools; - -public class ServerTools1_8_R1 extends ServerTools { - - @Override - public void setMotd(String text) { - ((CraftServer) Bukkit.getServer()).getServer().setMotd(text); - } - - @Override - public String getMotd() { - return ((CraftServer) Bukkit.getServer()).getServer().getMotd(); - } - - @Override - public ConsoleReaderWrapper1_8_R1 getConsole() { - return ConsoleReaderWrapper1_8_R1.INSTANCE; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/tools/SkinTools1_8_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/tools/SkinTools1_8_R1.java deleted file mode 100644 index 69e057f..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/tools/SkinTools1_8_R1.java +++ /dev/null @@ -1,16 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R1.tools; - -import org.bukkit.craftbukkit.v1_8_R1.entity.CraftPlayer; -import org.bukkit.entity.Player; - -import net.sourcewriters.minecraft.vcompat.reflection.tools.SkinTools; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; - -public class SkinTools1_8_R1 extends SkinTools { - - @Override - public Skin skinFromPlayer(Player player) { - return skinFromGameProfile(((CraftPlayer) player).getHandle().getProfile()); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/utils/EntityConstructors1_8_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/utils/EntityConstructors1_8_R1.java deleted file mode 100644 index 87044df..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/utils/EntityConstructors1_8_R1.java +++ /dev/null @@ -1,12 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R1.utils; - -import java.util.function.Function; - -import net.minecraft.server.v1_8_R1.World; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R1.entity.ArmorStand1_8_R1; - -public abstract class EntityConstructors1_8_R1 { - - public static final Function ARMOR_STAND = (world -> new ArmorStand1_8_R1(world)); - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/wrapper/ConsoleReaderWrapper1_8_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/wrapper/ConsoleReaderWrapper1_8_R1.java deleted file mode 100644 index cd33303..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/wrapper/ConsoleReaderWrapper1_8_R1.java +++ /dev/null @@ -1,43 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R1.wrapper; - -import java.io.IOException; -import java.io.Writer; - -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_8_R1.CraftServer; -import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; - -import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; - -public final class ConsoleReaderWrapper1_8_R1 extends ConsoleReaderWrapper { - - public static final ConsoleReaderWrapper1_8_R1 INSTANCE = new ConsoleReaderWrapper1_8_R1(); - - private final ConsoleReader reader; - - @SuppressWarnings("resource") - private ConsoleReaderWrapper1_8_R1() { - this.reader = ((CraftServer) Bukkit.getServer()).getServer().reader; - } - - @Override - public Writer getOutput() { - return reader.getOutput(); - } - - @Override - public boolean isAnsiSupported() { - return reader.getTerminal().isAnsiSupported(); - } - - @Override - public void flush() throws IOException { - reader.flush(); - } - - @Override - public void drawLine() throws IOException { - reader.drawLine(); - } - -} diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/BukkitConversion1_8_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/BukkitConversion1_8_R2.java deleted file mode 100644 index 328dbc5..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/BukkitConversion1_8_R2.java +++ /dev/null @@ -1,231 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R2; - -import java.util.List; -import java.util.Set; - -import org.bukkit.craftbukkit.v1_8_R2.inventory.CraftItemStack; -import org.bukkit.entity.EntityType; - -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.nbt.NbtByte; -import com.syntaxphoenix.syntaxapi.nbt.NbtByteArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; -import com.syntaxphoenix.syntaxapi.nbt.NbtDouble; -import com.syntaxphoenix.syntaxapi.nbt.NbtEnd; -import com.syntaxphoenix.syntaxapi.nbt.NbtFloat; -import com.syntaxphoenix.syntaxapi.nbt.NbtInt; -import com.syntaxphoenix.syntaxapi.nbt.NbtIntArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtList; -import com.syntaxphoenix.syntaxapi.nbt.NbtLong; -import com.syntaxphoenix.syntaxapi.nbt.NbtLongArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtShort; -import com.syntaxphoenix.syntaxapi.nbt.NbtString; -import com.syntaxphoenix.syntaxapi.nbt.NbtTag; -import com.syntaxphoenix.syntaxapi.nbt.NbtType; - -import net.minecraft.server.v1_8_R2.ItemStack; -import net.minecraft.server.v1_8_R2.NBTBase; -import net.minecraft.server.v1_8_R2.NBTTagByte; -import net.minecraft.server.v1_8_R2.NBTTagByteArray; -import net.minecraft.server.v1_8_R2.NBTTagCompound; -import net.minecraft.server.v1_8_R2.NBTTagDouble; -import net.minecraft.server.v1_8_R2.NBTTagEnd; -import net.minecraft.server.v1_8_R2.NBTTagFloat; -import net.minecraft.server.v1_8_R2.NBTTagInt; -import net.minecraft.server.v1_8_R2.NBTTagIntArray; -import net.minecraft.server.v1_8_R2.NBTTagList; -import net.minecraft.server.v1_8_R2.NBTTagLong; -import net.minecraft.server.v1_8_R2.NBTTagShort; -import net.minecraft.server.v1_8_R2.NBTTagString; -import net.sourcewriters.minecraft.vcompat.reflection.BukkitConversion; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContext; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleWrapType; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; - -public class BukkitConversion1_8_R2 extends BukkitConversion { - - protected BukkitConversion1_8_R2(VersionControl1_8_R2 versionControl) { - super(versionControl); - } - - @Override - public EntityType toEntityType(NmsEntityType type) { - try { - return EntityType.valueOf(type.name()); - } catch (IllegalArgumentException ignore) { - return null; - } - } - - @Override - public NmsEntityType fromEntityType(EntityType type) { - try { - return NmsEntityType.valueOf(type.name()); - } catch (IllegalArgumentException ignore) { - return null; - } - } - - @Override - public NBTBase toMinecraftTag(NbtTag tag) { - switch (tag.getType()) { - case BYTE: - return new NBTTagByte((byte) tag.getValue()); - case SHORT: - return new NBTTagShort((short) tag.getValue()); - case INT: - return new NBTTagInt((int) tag.getValue()); - case LONG: - return new NBTTagLong((long) tag.getValue()); - case FLOAT: - return new NBTTagFloat((float) tag.getValue()); - case DOUBLE: - return new NBTTagDouble((double) tag.getValue()); - case STRING: - return new NBTTagString((String) tag.getValue()); - case BYTE_ARRAY: - return new NBTTagByteArray((byte[]) tag.getValue()); - case INT_ARRAY: - return new NBTTagIntArray((int[]) tag.getValue()); - case LONG_ARRAY: - NBTTagList list = new NBTTagList(); - for (long value : (long[]) tag.getValue()) { - list.add(new NBTTagLong(value)); - } - return list; - case LIST: - return toMinecraftList((NbtList) tag); - case COMPOUND: - return toMinecraftCompound((NbtCompound) tag); - case END: - return (NBTTagEnd) ReflectionProvider.DEFAULT.getReflect("nmsNBTTagEnd").init(); - default: - return null; - } - } - - @Override - public NbtTag fromMinecraftTag(Object raw) { - if (!(raw instanceof NBTBase)) { - return null; - } - NBTBase tag = (NBTBase) raw; - NbtType type = NbtType.getById(tag.getTypeId()); - switch (type) { - case BYTE: - return new NbtByte(((NBTTagByte) tag).f()); - case SHORT: - return new NbtShort(((NBTTagShort) tag).e()); - case INT: - return new NbtInt(((NBTTagInt) tag).d()); - case LONG: - return new NbtLong(((NBTTagLong) tag).c()); - case FLOAT: - return new NbtFloat(((NBTTagFloat) tag).h()); - case DOUBLE: - return new NbtDouble(((NBTTagDouble) tag).g()); - case STRING: - return new NbtString(((NBTTagString) tag).a_()); - case BYTE_ARRAY: - return new NbtByteArray(((NBTTagByteArray) tag).c()); - case INT_ARRAY: - return new NbtIntArray(((NBTTagIntArray) tag).c()); - case LONG_ARRAY: - return new NbtLongArray(new long[0]); - case LIST: - return fromMinecraftList(tag); - case COMPOUND: - return fromMinecraftCompound(tag); - case END: - return NbtEnd.INSTANCE; - default: - return null; - } - } - - @Override - public NBTTagList toMinecraftList(NbtList list) { - NBTTagList output = new NBTTagList(); - for (NbtTag tag : list) { - output.add(toMinecraftTag(tag)); - } - return output; - } - - @SuppressWarnings("unchecked") - @Override - public NbtList fromMinecraftList(Object raw) { - if (!(raw instanceof NBTTagList)) { - return null; - } - NBTTagList list = (NBTTagList) raw; - List content = (List) ReflectionProvider.DEFAULT.getReflect("nmsNBTTagList").getFieldValue("value", list); - NbtList output = new NbtList<>(NbtType.getById(list.getTypeId())); - for (NBTBase base : content) { - output.add(fromMinecraftTag(base)); - } - return output; - } - - @Override - public NBTTagCompound toMinecraftCompound(NbtCompound compound) { - NBTTagCompound output = new NBTTagCompound(); - if (compound.isEmpty()) { - return output; - } - Set keys = compound.getKeys(); - for (String key : keys) { - output.set(key, toMinecraftTag(compound.get(key))); - } - return output; - } - - @Override - public NbtCompound fromMinecraftCompound(Object raw) { - if (!(raw instanceof NBTTagCompound)) { - return null; - } - NBTTagCompound compound = (NBTTagCompound) raw; - NbtCompound output = new NbtCompound(); - if (compound.isEmpty()) { - return output; - } - Set keys = compound.c(); - for (String key : keys) { - output.set(key, fromMinecraftTag(compound.get(key))); - } - return output; - } - - @Override - public org.bukkit.inventory.ItemStack itemFromCompound(NbtCompound compound) { - return CraftItemStack.asBukkitCopy(ItemStack.createStack(toMinecraftCompound(compound))); - } - - @Override - public NbtCompound itemToCompound(org.bukkit.inventory.ItemStack itemStack) { - ItemStack nmsStack = CraftItemStack.asNMSCopy(itemStack); - NBTTagCompound stackTag; - if (!nmsStack.hasTag()) { - stackTag = nmsStack.save(new NBTTagCompound()); - } else { - stackTag = nmsStack.getTag(); - } - return fromMinecraftCompound(stackTag); - } - - @Override - public WrappedContext createContext(DataAdapterContext context) { - return new SimpleSyntaxContext(context); - } - - @Override - public WrapType wrap(DataType dataType) { - return new SimpleWrapType(dataType); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/EntityProvider1_8_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/EntityProvider1_8_R2.java deleted file mode 100644 index 53cdb4f..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/EntityProvider1_8_R2.java +++ /dev/null @@ -1,47 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R2; - -import java.util.EnumMap; -import java.util.function.Function; - -import org.bukkit.craftbukkit.v1_8_R2.CraftWorld; - -import net.minecraft.server.v1_8_R2.World; -import net.sourcewriters.minecraft.vcompat.reflection.EntityProvider; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R2.utils.EntityConstructors1_8_R2; - -public class EntityProvider1_8_R2 extends EntityProvider { - - private final EnumMap> entityMap = new EnumMap<>(NmsEntityType.class); - - protected EntityProvider1_8_R2(VersionControl1_8_R2 versionControl) { - super(versionControl); - } - - @SuppressWarnings("unchecked") - private final Function searchConstructor(NmsEntityType type) { - try { - return (Function) EntityConstructors1_8_R2.class.getField(type.name()).get(null); - } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException ignore) { - return null; - } - } - - private final Function getConstructor(NmsEntityType type) { - return entityMap.computeIfAbsent(type, (key -> searchConstructor(key))); - } - - @Override - public NmsEntity createEntity(org.bukkit.World world, NmsEntityType type) { - if (!(world instanceof CraftWorld)) { - return null; - } - Function function; - if ((function = getConstructor(type)) == null) { - return null; - } - return function.apply(((CraftWorld) world).getHandle()); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/PacketHandler1_8_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/PacketHandler1_8_R2.java deleted file mode 100644 index 227d58e..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/PacketHandler1_8_R2.java +++ /dev/null @@ -1,11 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R2; - -import net.sourcewriters.minecraft.vcompat.reflection.PacketHandler; - -public class PacketHandler1_8_R2 extends PacketHandler { - - protected PacketHandler1_8_R2(VersionControl1_8_R2 versionControl) { - super(versionControl); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/PlayerProvider1_8_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/PlayerProvider1_8_R2.java deleted file mode 100644 index 92edb33..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/PlayerProvider1_8_R2.java +++ /dev/null @@ -1,30 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R2; - -import java.io.File; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; - -import net.sourcewriters.minecraft.vcompat.reflection.DataProvider; -import net.sourcewriters.minecraft.vcompat.reflection.PlayerProvider; -import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.DataDistributor; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R2.entity.Player1_8_R2; - -public class PlayerProvider1_8_R2 extends PlayerProvider { - - private final DataDistributor distributor; - - protected PlayerProvider1_8_R2(VersionControl1_8_R2 versionControl) { - super(versionControl); - distributor = versionControl.getDataProvider().createDistributor(new File(Bukkit.getWorlds().get(0).getWorldFolder(), "playerdata"), - uuid -> "custom_" + uuid.toString(), DataProvider.DEFAULT_RANDOM); - } - - @Override - protected NmsPlayer createPlayer(Player player) { - return new Player1_8_R2(player, distributor.get(player.getUniqueId())); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/TextureProvider1_8_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/TextureProvider1_8_R2.java deleted file mode 100644 index bd6d55a..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/TextureProvider1_8_R2.java +++ /dev/null @@ -1,105 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R2; - -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_8_R2.block.CraftSkull; -import org.bukkit.craftbukkit.v1_8_R2.inventory.CraftItemStack; -import org.bukkit.inventory.meta.ItemMeta; -import org.bukkit.inventory.meta.SkullMeta; -import org.bukkit.material.MaterialData; - -import com.mojang.authlib.GameProfile; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; - -import net.minecraft.server.v1_8_R2.GameProfileSerializer; -import net.minecraft.server.v1_8_R2.ItemStack; -import net.minecraft.server.v1_8_R2.NBTTagCompound; -import net.sourcewriters.minecraft.vcompat.reflection.TextureProvider; - -@SuppressWarnings("deprecation") -public class TextureProvider1_8_R2 extends TextureProvider { - - private final AbstractReflect craftItemStackRef = new Reflect(CraftItemStack.class).searchField("handle", "handle"); - private final AbstractReflect craftMetaSkullRef = new Reflect("org.bukkit.craftbukkit.v1_8_R2.inventory.CraftMetaSkull") - .searchField("serialized", "serializedProfile").searchField("profile", "profile"); - private final Material skullMaterial = Material.valueOf("SKULL"); - - protected TextureProvider1_8_R2(VersionControl1_8_R2 versionControl) { - super(versionControl); - } - - @Override - public GameProfile profileFromBlock(Block block) { - if (!(block instanceof CraftSkull)) { - return null; - } - return ((CraftSkull) block).getTileEntity().getGameProfile(); - } - - @Override - public GameProfile profileFromItem(org.bukkit.inventory.ItemStack itemStack) { - if (!(itemStack.getItemMeta() instanceof SkullMeta)) { - return null; - } - SkullMeta meta = (SkullMeta) itemStack.getItemMeta(); - GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue("profile", meta); - if (profile == null) { - NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue("serialized", meta); - if (compound == null) { - ItemStack stack = null; - if (itemStack instanceof CraftItemStack) { - stack = (ItemStack) craftItemStackRef.getFieldValue("handle", itemStack); - } - if (stack == null) { - stack = CraftItemStack.asNMSCopy(itemStack); - } - NBTTagCompound stackTag; - if (!stack.hasTag()) { - stackTag = stack.save(new NBTTagCompound()); - } else { - stackTag = stack.getTag(); - } - if (stackTag.hasKeyOfType("SkullOwner", 10)) { - compound = stackTag.getCompound("SkullOwner"); - } else if (stackTag.hasKeyOfType("SkullProfile", 10)) { - compound = stackTag.getCompound("SkullProfile"); - } - } - if (compound == null) { - return null; - } - profile = GameProfileSerializer.deserialize(compound); - } - return profile; - } - - @Override - public org.bukkit.inventory.ItemStack getItem(GameProfile profile) { - org.bukkit.inventory.ItemStack craftStack = CraftItemStack.asCraftCopy(new MaterialData(skullMaterial, (byte) 3).toItemStack(1)); - applyItem(craftStack, profile); - return craftStack; - } - - @Override - public boolean applyItem(org.bukkit.inventory.ItemStack itemStack, GameProfile profile) { - ItemMeta meta = itemStack.getItemMeta(); - if (!(meta instanceof SkullMeta)) { - return false; - } - SkullMeta skullMeta = (SkullMeta) meta; - craftMetaSkullRef.setFieldValue(meta, "profile", profile); - itemStack.setItemMeta(skullMeta); - return true; - } - - @Override - public boolean applyBlock(Block block, GameProfile profile) { - if (!(block instanceof CraftSkull)) { - return false; - } - ((CraftSkull) block).getTileEntity().setGameProfile(profile); - return true; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/ToolProvider1_8_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/ToolProvider1_8_R2.java deleted file mode 100644 index 03650f7..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/ToolProvider1_8_R2.java +++ /dev/null @@ -1,33 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R2; - -import net.sourcewriters.minecraft.vcompat.reflection.ToolProvider; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R2.tools.BlockTools1_8_R2; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R2.tools.ServerTools1_8_R2; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R2.tools.SkinTools1_8_R2; - -public class ToolProvider1_8_R2 extends ToolProvider { - - private final BlockTools1_8_R2 blockTools = new BlockTools1_8_R2(); - private final SkinTools1_8_R2 skinTools = new SkinTools1_8_R2(); - private final ServerTools1_8_R2 serverTools = new ServerTools1_8_R2(); - - protected ToolProvider1_8_R2(VersionControl1_8_R2 versionControl) { - super(versionControl); - } - - @Override - public SkinTools1_8_R2 getSkinTools() { - return skinTools; - } - - @Override - public ServerTools1_8_R2 getServerTools() { - return serverTools; - } - - @Override - public BlockTools1_8_R2 getBlockTools() { - return blockTools; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/VersionControl1_8_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/VersionControl1_8_R2.java deleted file mode 100644 index 8cd546f..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/VersionControl1_8_R2.java +++ /dev/null @@ -1,56 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R2; - -import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R2.reflection.NmsReflection1_8_R2; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; - -public class VersionControl1_8_R2 extends VersionControl { - - public static VersionControl1_8_R2 INSTANCE; - - public static VersionControl1_8_R2 init() { - return INSTANCE != null ? INSTANCE : (INSTANCE = new VersionControl1_8_R2()); - } - - private final ToolProvider1_8_R2 toolProvider = new ToolProvider1_8_R2(this); - private final TextureProvider1_8_R2 textureProvider = new TextureProvider1_8_R2(this); - private final PacketHandler1_8_R2 packetHandler = new PacketHandler1_8_R2(this); - private final EntityProvider1_8_R2 entityProvider = new EntityProvider1_8_R2(this); - private final PlayerProvider1_8_R2 playerProvider = new PlayerProvider1_8_R2(this); - private final BukkitConversion1_8_R2 bukkitConversion = new BukkitConversion1_8_R2(this); - - private VersionControl1_8_R2() { - NmsReflection1_8_R2.INSTANCE.setup(ReflectionProvider.DEFAULT); - } - - @Override - public ToolProvider1_8_R2 getToolProvider() { - return toolProvider; - } - - @Override - public EntityProvider1_8_R2 getEntityProvider() { - return entityProvider; - } - - @Override - public PlayerProvider1_8_R2 getPlayerProvider() { - return playerProvider; - } - - @Override - public TextureProvider1_8_R2 getTextureProvider() { - return textureProvider; - } - - @Override - public PacketHandler1_8_R2 getPacketHandler() { - return packetHandler; - } - - @Override - public BukkitConversion1_8_R2 getBukkitConversion() { - return bukkitConversion; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/entity/ArmorStand1_8_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/entity/ArmorStand1_8_R2.java deleted file mode 100644 index c80721f..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/entity/ArmorStand1_8_R2.java +++ /dev/null @@ -1,33 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R2.entity; - -import net.minecraft.server.v1_8_R2.EntityArmorStand; -import net.minecraft.server.v1_8_R2.World; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsArmorStand; - -public class ArmorStand1_8_R2 extends EntityLiving1_8_R2 implements NmsArmorStand { - - public ArmorStand1_8_R2(World world) { - super(new EntityArmorStand(world)); - } - - @Override - public boolean hasGravity() { - return handle.hasGravity(); - } - - @Override - public void setGravity(boolean gravity) { - handle.setGravity(gravity); - } - - @Override - public void setSmall(boolean small) { - handle.setSmall(small); - } - - @Override - public boolean isSmall() { - return handle.isSmall(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/entity/Entity1_8_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/entity/Entity1_8_R2.java deleted file mode 100644 index 7ab61b4..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/entity/Entity1_8_R2.java +++ /dev/null @@ -1,213 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R2.entity; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.OfflinePlayer; -import org.bukkit.craftbukkit.v1_8_R2.CraftWorld; -import org.bukkit.craftbukkit.v1_8_R2.entity.CraftPlayer; -import org.bukkit.entity.Player; - -import net.minecraft.server.v1_8_R2.AxisAlignedBB; -import net.minecraft.server.v1_8_R2.Entity; -import net.minecraft.server.v1_8_R2.EntityTypes; -import net.minecraft.server.v1_8_R2.PacketPlayOutEntityDestroy; -import net.minecraft.server.v1_8_R2.PacketPlayOutEntityMetadata; -import net.minecraft.server.v1_8_R2.PacketPlayOutSpawnEntity; -import net.minecraft.server.v1_8_R2.PlayerConnection; -import net.minecraft.server.v1_8_R2.Vec3D; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.utils.NmsBoundingBox; - -public abstract class Entity1_8_R2 implements NmsEntity { - - protected final E handle; - - protected final List visible = Collections.synchronizedList(new ArrayList<>()); - - public Entity1_8_R2(E handle) { - this.handle = handle; - } - - @Override - public final E getHandle() { - return handle; - } - - @Override - public int getId() { - return handle.getId(); - } - - @Override - public UUID getUniqueId() { - return handle.getUniqueID(); - } - - @Override - public NmsBoundingBox getBoundingBox() { - AxisAlignedBB box = handle.getBoundingBox(); - return new NmsBoundingBox(box.a, box.b, box.c, box.d, box.e, box.f); - } - - @Override - public void setCustomName(String name) { - handle.setCustomName(name); - updateVisibility(); - } - - @Override - public String getCustomName() { - return handle.getCustomName(); - } - - @Override - public void setCustomNameVisible(boolean visible) { - handle.setCustomNameVisible(visible); - } - - @Override - public boolean isCustomNameVisible() { - return handle.getCustomNameVisible(); - } - - @Override - public void setInvisible(boolean invisible) { - handle.setInvisible(invisible); - } - - @Override - public boolean isInvisible() { - return handle.isInvisible(); - } - - @Override - public boolean isInteractable() { - return handle.ad(); - } - - @Override - public boolean isCollidable() { - return handle.ae(); - } - - @Override - public void setInvulnerable(boolean invulnerable) { - handle.h(invulnerable); - } - - @Override - public boolean isInvulnerable() { - return handle.isInvulnerable(null); - } - - @Override - public boolean hasGravity() { - return true; - } - - @Override - public void setGravity(boolean gravity) {} - - @Override - public void setLocation(Location location) { - handle.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); - if (location.getWorld() == null || handle.getWorld().getWorld() == location.getWorld()) { - updateVisibility(); - return; - } - handle.world = ((CraftWorld) location.getWorld()).getHandle(); - updateVisibility(); - } - - @Override - public Location getLocation() { - Vec3D vector = handle.d(); - return new Location(handle.getWorld().getWorld(), vector.a, vector.b, vector.c); - } - - @Override - public void updateVisibility() { - if (visible.isEmpty()) { - return; - } - Player[] players; - synchronized (visible) { - players = visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) - .toArray(Player[]::new); - } - hide(players); - show(players); - } - - @Override - public boolean isShown(Player player) { - synchronized (visible) { - return visible.contains(player.getUniqueId()); - } - } - - @Override - public void hide(Player... players) { - if (players.length == 0) { - return; - } - PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(handle.getId()); - for (Player player : players) { - if (!isShown(player)) { - continue; - } - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); - synchronized (visible) { - visible.remove(player.getUniqueId()); - } - } - } - - @Override - public void show(Player... players) { - if (players.length == 0) { - return; - } - PacketPlayOutSpawnEntity packet = new PacketPlayOutSpawnEntity(handle, EntityTypes.a(handle)); - PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); - PlayerConnection connection; - for (Player player : players) { - if (isShown(player)) { - continue; - } - connection = ((CraftPlayer) player).getHandle().playerConnection; - connection.sendPacket(packet); - connection.sendPacket(metadataPacket); - synchronized (visible) { - visible.add(player.getUniqueId()); - } - } - } - - @Override - public UUID[] getVisible() { - synchronized (visible) { - return visible.toArray(new UUID[0]); - } - } - - @Override - public Player[] getVisibleAsPlayer() { - synchronized (visible) { - return visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) - .toArray(Player[]::new); - } - } - - @Override - public void kill() { - hide(getVisibleAsPlayer()); - handle.die(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/entity/EntityLiving1_8_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/entity/EntityLiving1_8_R2.java deleted file mode 100644 index dd7d3c8..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/entity/EntityLiving1_8_R2.java +++ /dev/null @@ -1,17 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R2.entity; - -import net.minecraft.server.v1_8_R2.EntityLiving; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityLiving; - -public abstract class EntityLiving1_8_R2 extends Entity1_8_R2 implements NmsEntityLiving { - - public EntityLiving1_8_R2(E handle) { - super(handle); - } - - @Override - public void setCollidable(boolean collidable) { - - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/entity/Player1_8_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/entity/Player1_8_R2.java deleted file mode 100644 index 620c217..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/entity/Player1_8_R2.java +++ /dev/null @@ -1,295 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R2.entity; - -import java.util.ArrayList; -import java.util.Collections; - -import org.bukkit.craftbukkit.v1_8_R2.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_8_R2.util.CraftChatMessage; -import org.bukkit.entity.Player; - -import com.mojang.authlib.GameProfile; -import com.mojang.authlib.properties.Property; -import com.mojang.authlib.properties.PropertyMap; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; - -import net.minecraft.server.v1_8_R2.EntityPlayer; -import net.minecraft.server.v1_8_R2.IChatBaseComponent; -import net.minecraft.server.v1_8_R2.MathHelper; -import net.minecraft.server.v1_8_R2.PacketPlayInClientCommand; -import net.minecraft.server.v1_8_R2.PacketPlayInClientCommand.EnumClientCommand; -import net.minecraft.server.v1_8_R2.PacketPlayOutChat; -import net.minecraft.server.v1_8_R2.PacketPlayOutEntityDestroy; -import net.minecraft.server.v1_8_R2.PacketPlayOutEntityEquipment; -import net.minecraft.server.v1_8_R2.PacketPlayOutEntityHeadRotation; -import net.minecraft.server.v1_8_R2.PacketPlayOutEntityMetadata; -import net.minecraft.server.v1_8_R2.PacketPlayOutEntityStatus; -import net.minecraft.server.v1_8_R2.PacketPlayOutHeldItemSlot; -import net.minecraft.server.v1_8_R2.PacketPlayOutNamedEntitySpawn; -import net.minecraft.server.v1_8_R2.PacketPlayOutPlayerInfo; -import net.minecraft.server.v1_8_R2.PacketPlayOutPlayerInfo.EnumPlayerInfoAction; -import net.minecraft.server.v1_8_R2.PacketPlayOutPlayerListHeaderFooter; -import net.minecraft.server.v1_8_R2.PacketPlayOutPosition; -import net.minecraft.server.v1_8_R2.PacketPlayOutRespawn; -import net.minecraft.server.v1_8_R2.PacketPlayOutTitle; -import net.minecraft.server.v1_8_R2.PacketPlayOutTitle.EnumTitleAction; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.PersistentContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.type.SkinDataType; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContainer; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; -import net.sourcewriters.minecraft.vcompat.utils.bukkit.Players; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.MojangProfileServer; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; -import net.sourcewriters.minecraft.vcompat.utils.thread.PostAsync; -import net.minecraft.server.v1_8_R2.PlayerConnection; -import net.minecraft.server.v1_8_R2.WorldServer; - -public class Player1_8_R2 extends EntityLiving1_8_R2 implements NmsPlayer { - - private String realName; - private Skin realSkin; - - private final WrappedContainer dataAdapter; - - public Player1_8_R2(Player player, PersistentContainer container) { - super(((CraftPlayer) player).getHandle()); - this.dataAdapter = new SimpleSyntaxContainer<>(container); - update(false); - } - - @Override - public CraftPlayer getBukkitPlayer() { - return handle.getBukkitEntity(); - } - - @Override - public WrappedContainer getDataAdapter() { - return dataAdapter; - } - - @Override - public void setSkin(Skin skin) { - if (skin == null || getSkin().equals(skin)) { - return; - } - getDataAdapter().set("skin", skin, SkinDataType.WRAPPED_INSTANCE); - } - - @Override - public Skin getSkin() { - return dataAdapter.getOrDefault("skin", SkinDataType.WRAPPED_INSTANCE, realSkin); - } - - @Override - public Skin getRealSkin() { - return realSkin; - } - - @Override - public void setName(String name) { - if (getName().equals(name)) { - return; - } - if (name == null) { - getDataAdapter().remove("name"); - return; - } - getDataAdapter().set("name", name, WrapType.STRING); - } - - @Override - public String getName() { - return getDataAdapter().getOrDefault("name", WrapType.STRING, realName); - } - - @Override - public String getRealName() { - return realName; - } - - @Override - public void setPlayerListHeader(String text) { - setPlayerListHeaderAndFooter(text, getPlayerListFooter()); - } - - @Override - public String getPlayerListHeader() { - return getDataAdapter().getOrDefault("header", WrapType.STRING, ""); - } - - @Override - public void setPlayerListFooter(String text) { - setPlayerListHeaderAndFooter(getPlayerListHeader(), text); - } - - @Override - public String getPlayerListFooter() { - return getDataAdapter().getOrDefault("footer", WrapType.STRING, ""); - } - - @Override - public int getPing() { - return handle.ping; - } - - @Override - public void setPlayerListHeaderAndFooter(String header, String footer) { - getDataAdapter().set("header", header, WrapType.STRING); - getDataAdapter().set("footer", footer, WrapType.STRING); - sendPlayerListInfo(header, footer); - } - - private final void sendPlayerListInfo(String header, String footer) { - if (handle.playerConnection.isDisconnected()) { - return; - } - - IChatBaseComponent headerComponent = header.isEmpty() ? null : CraftChatMessage.fromString(header, true)[0]; - IChatBaseComponent footerComponent = footer.isEmpty() ? null : CraftChatMessage.fromString(footer, true)[0]; - - PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter(); - - Reflect reflect = ReflectionProvider.DEFAULT.getReflect("nmsPacketPlayOutPlayerListHeaderFooter"); - reflect.setFieldValue(packet, "header", headerComponent); - reflect.setFieldValue(packet, "footer", footerComponent); - - handle.playerConnection.sendPacket(packet); - } - - @Override - public void setTitleTimes(int fadeIn, int stay, int fadeOut) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TIMES, null, fadeIn, stay, fadeOut)); - } - - @Override - public void sendSubtitle(String text) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.SUBTITLE, CraftChatMessage.fromString(text)[0])); - } - - @Override - public void sendTitle(String text) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TITLE, CraftChatMessage.fromString(text)[0])); - } - - @Override - public void sendActionBar(String text) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutChat(CraftChatMessage.fromString(text)[0], (byte) 2)); - } - - @Override - public void fakeRespawn() { - if (handle.playerConnection.isDisconnected()) { - return; - } - PacketPlayOutPlayerInfo remInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER, handle); - PacketPlayOutPlayerInfo addInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.ADD_PLAYER, handle); - - PacketPlayOutEntityDestroy destroyPacket = new PacketPlayOutEntityDestroy(handle.getId()); - PacketPlayOutNamedEntitySpawn spawnPacket = new PacketPlayOutNamedEntitySpawn(handle); - PacketPlayOutEntityHeadRotation rotationPacket = new PacketPlayOutEntityHeadRotation(handle, - (byte) MathHelper.d(handle.getHeadRotation() * 256F / 360F)); - - ArrayList equipmentPackets = new ArrayList<>(); - for (int slot = 0; slot < 5; slot++) { - equipmentPackets.add(new PacketPlayOutEntityEquipment(handle.getId(), slot, handle.getEquipment(slot))); - } - - Player self = getBukkitPlayer(); - Player[] players = Players.getOnlineWithout(getUniqueId()); - for (Player player : players) { - if (!player.canSee(self)) { - continue; - } - PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection; - connection.sendPacket(remInfoPacket); - connection.sendPacket(addInfoPacket); - connection.sendPacket(destroyPacket); - connection.sendPacket(spawnPacket); - connection.sendPacket(rotationPacket); - for (PacketPlayOutEntityEquipment equipmentPacket : equipmentPackets) { - connection.sendPacket(equipmentPacket); - } - } - - WorldServer world = (WorldServer) handle.world; - - PacketPlayOutRespawn respawnPacket = new PacketPlayOutRespawn(handle.dimension, world.getDifficulty(), - handle.world.worldData.getType(), handle.playerInteractManager.getGameMode()); - PacketPlayOutPosition positionPacket = new PacketPlayOutPosition(handle.locX, handle.locY, handle.locZ, handle.yaw, handle.pitch, - Collections.emptySet()); - PacketPlayOutHeldItemSlot itemPacket = new PacketPlayOutHeldItemSlot(handle.inventory.itemInHandIndex); - PacketPlayOutEntityStatus statusPacket = new PacketPlayOutEntityStatus(handle, (byte) 28); - PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); - - PlayerConnection connection = handle.playerConnection; - connection.sendPacket(remInfoPacket); - connection.sendPacket(addInfoPacket); - connection.sendPacket(respawnPacket); - connection.sendPacket(positionPacket); - connection.sendPacket(itemPacket); - connection.sendPacket(statusPacket); - connection.sendPacket(metadataPacket); - - handle.updateAbilities(); - handle.triggerHealthUpdate(); - handle.updateInventory(handle.defaultContainer); - if (handle.activeContainer != handle.defaultContainer) { - handle.updateInventory(handle.activeContainer); - } - self.recalculatePermissions(); - } - - @Override - public void respawn() { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayInClientCommand(EnumClientCommand.PERFORM_RESPAWN)); - } - - @Override - public void update() { - update(true); - } - - private final void update(boolean flag) { - PostAsync.forcePost(() -> { - realName = MojangProfileServer.getName(getUniqueId()); - realSkin = MojangProfileServer.getSkin(realName, getUniqueId()); - }); - if (flag) { - GameProfile profile = handle.getProfile(); - - Skin skin = getSkin(); - if (skin != null) { - PropertyMap properties = profile.getProperties(); - properties.removeAll("textures"); - properties.put("textures", new Property("textures", skin.getValue(), skin.getSignature())); - } - - String name = getName(); - if (name != null) { - ReflectionProvider.DEFAULT.getReflect("mjGameProfile").setFieldValue(profile, "name", name); - } - - if (!(name == null && skin == null)) { - fakeRespawn(); - } - } - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/reflection/NmsReflection1_8_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/reflection/NmsReflection1_8_R2.java deleted file mode 100644 index 8be7889..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/reflection/NmsReflection1_8_R2.java +++ /dev/null @@ -1,34 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R2.reflection; - -import net.minecraft.server.v1_8_R2.NBTTagEnd; -import net.minecraft.server.v1_8_R2.NBTTagList; -import net.minecraft.server.v1_8_R2.PacketPlayOutPlayerListHeaderFooter; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.Reflections; - -public class NmsReflection1_8_R2 extends Reflections { - - public static NmsReflection1_8_R2 INSTANCE = new NmsReflection1_8_R2(); - - private NmsReflection1_8_R2() {} - - @Override - public void setup(ReflectionProvider provider) { - - // - // - // Create Reflects - // - - // - // Minecraft - - provider.createReflect("nmsPacketPlayOutPlayerListHeaderFooter", PacketPlayOutPlayerListHeaderFooter.class) - .searchField("header", "a").searchField("header", "b"); - - provider.createReflect("nmsNBTTagEnd", NBTTagEnd.class); - provider.createReflect("nmsNBTTagList", NBTTagList.class).searchField("value", "list"); - - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/tools/BlockTools1_8_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/tools/BlockTools1_8_R2.java deleted file mode 100644 index f1e7215..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/tools/BlockTools1_8_R2.java +++ /dev/null @@ -1,39 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R2.tools; - -import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_8_R2.block.CraftSkull; - -import com.mojang.authlib.properties.Property; -import com.mojang.authlib.properties.PropertyMap; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; - -import net.minecraft.server.v1_8_R2.TileEntitySkull; -import net.sourcewriters.minecraft.vcompat.reflection.tools.BlockTools; -import net.sourcewriters.minecraft.vcompat.utils.constants.MinecraftConstants; - -public class BlockTools1_8_R2 extends BlockTools { - - private final AbstractReflect craftEntityStateRef = new Reflect(CraftSkull.class).searchField("tileEntity", "tileEntity"); - - @Override - public void setHeadTexture(Block block, String texture) { - if (!(block instanceof CraftSkull)) { - return; - } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); - PropertyMap map = entitySkull.getGameProfile().getProperties(); - map.removeAll("textures"); - map.put("textures", new Property("textures", MinecraftConstants.TEXTURE_SIGNATURE, texture)); - } - - @Override - public String getHeadTexture(Block block) { - if (!(block instanceof CraftSkull)) { - return null; - } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); - return entitySkull.getGameProfile().getProperties().get("textures").iterator().next().getValue(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/tools/ServerTools1_8_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/tools/ServerTools1_8_R2.java deleted file mode 100644 index 86f4c40..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/tools/ServerTools1_8_R2.java +++ /dev/null @@ -1,26 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R2.tools; - -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_8_R2.CraftServer; - -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R2.wrapper.ConsoleReaderWrapper1_8_R2; -import net.sourcewriters.minecraft.vcompat.reflection.tools.ServerTools; - -public class ServerTools1_8_R2 extends ServerTools { - - @Override - public void setMotd(String text) { - ((CraftServer) Bukkit.getServer()).getServer().setMotd(text); - } - - @Override - public String getMotd() { - return ((CraftServer) Bukkit.getServer()).getServer().getMotd(); - } - - @Override - public ConsoleReaderWrapper1_8_R2 getConsole() { - return ConsoleReaderWrapper1_8_R2.INSTANCE; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/tools/SkinTools1_8_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/tools/SkinTools1_8_R2.java deleted file mode 100644 index 10037a3..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/tools/SkinTools1_8_R2.java +++ /dev/null @@ -1,16 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R2.tools; - -import org.bukkit.craftbukkit.v1_8_R2.entity.CraftPlayer; -import org.bukkit.entity.Player; - -import net.sourcewriters.minecraft.vcompat.reflection.tools.SkinTools; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; - -public class SkinTools1_8_R2 extends SkinTools { - - @Override - public Skin skinFromPlayer(Player player) { - return skinFromGameProfile(((CraftPlayer) player).getHandle().getProfile()); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/utils/EntityConstructors1_8_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/utils/EntityConstructors1_8_R2.java deleted file mode 100644 index dc2ce01..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/utils/EntityConstructors1_8_R2.java +++ /dev/null @@ -1,12 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R2.utils; - -import java.util.function.Function; - -import net.minecraft.server.v1_8_R2.World; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R2.entity.ArmorStand1_8_R2; - -public abstract class EntityConstructors1_8_R2 { - - public static final Function ARMOR_STAND = (world -> new ArmorStand1_8_R2(world)); - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/wrapper/ConsoleReaderWrapper1_8_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/wrapper/ConsoleReaderWrapper1_8_R2.java deleted file mode 100644 index 99ffdf7..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/wrapper/ConsoleReaderWrapper1_8_R2.java +++ /dev/null @@ -1,43 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R2.wrapper; - -import java.io.IOException; -import java.io.Writer; - -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_8_R2.CraftServer; -import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; - -import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; - -public final class ConsoleReaderWrapper1_8_R2 extends ConsoleReaderWrapper { - - public static final ConsoleReaderWrapper1_8_R2 INSTANCE = new ConsoleReaderWrapper1_8_R2(); - - private final ConsoleReader reader; - - @SuppressWarnings("resource") - private ConsoleReaderWrapper1_8_R2() { - this.reader = ((CraftServer) Bukkit.getServer()).getServer().reader; - } - - @Override - public Writer getOutput() { - return reader.getOutput(); - } - - @Override - public boolean isAnsiSupported() { - return reader.getTerminal().isAnsiSupported(); - } - - @Override - public void flush() throws IOException { - reader.flush(); - } - - @Override - public void drawLine() throws IOException { - reader.drawLine(); - } - -} diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/BukkitConversion1_8_R3.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/BukkitConversion1_8_R3.java deleted file mode 100644 index ca77c4b..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/BukkitConversion1_8_R3.java +++ /dev/null @@ -1,231 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R3; - -import java.util.List; -import java.util.Set; - -import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack; -import org.bukkit.entity.EntityType; - -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.nbt.NbtByte; -import com.syntaxphoenix.syntaxapi.nbt.NbtByteArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; -import com.syntaxphoenix.syntaxapi.nbt.NbtDouble; -import com.syntaxphoenix.syntaxapi.nbt.NbtEnd; -import com.syntaxphoenix.syntaxapi.nbt.NbtFloat; -import com.syntaxphoenix.syntaxapi.nbt.NbtInt; -import com.syntaxphoenix.syntaxapi.nbt.NbtIntArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtList; -import com.syntaxphoenix.syntaxapi.nbt.NbtLong; -import com.syntaxphoenix.syntaxapi.nbt.NbtLongArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtShort; -import com.syntaxphoenix.syntaxapi.nbt.NbtString; -import com.syntaxphoenix.syntaxapi.nbt.NbtTag; -import com.syntaxphoenix.syntaxapi.nbt.NbtType; - -import net.minecraft.server.v1_8_R3.ItemStack; -import net.minecraft.server.v1_8_R3.NBTBase; -import net.minecraft.server.v1_8_R3.NBTTagByte; -import net.minecraft.server.v1_8_R3.NBTTagByteArray; -import net.minecraft.server.v1_8_R3.NBTTagCompound; -import net.minecraft.server.v1_8_R3.NBTTagDouble; -import net.minecraft.server.v1_8_R3.NBTTagEnd; -import net.minecraft.server.v1_8_R3.NBTTagFloat; -import net.minecraft.server.v1_8_R3.NBTTagInt; -import net.minecraft.server.v1_8_R3.NBTTagIntArray; -import net.minecraft.server.v1_8_R3.NBTTagList; -import net.minecraft.server.v1_8_R3.NBTTagLong; -import net.minecraft.server.v1_8_R3.NBTTagShort; -import net.minecraft.server.v1_8_R3.NBTTagString; -import net.sourcewriters.minecraft.vcompat.reflection.BukkitConversion; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContext; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleWrapType; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; - -public class BukkitConversion1_8_R3 extends BukkitConversion { - - protected BukkitConversion1_8_R3(VersionControl1_8_R3 versionControl) { - super(versionControl); - } - - @Override - public EntityType toEntityType(NmsEntityType type) { - try { - return EntityType.valueOf(type.name()); - } catch (IllegalArgumentException ignore) { - return null; - } - } - - @Override - public NmsEntityType fromEntityType(EntityType type) { - try { - return NmsEntityType.valueOf(type.name()); - } catch (IllegalArgumentException ignore) { - return null; - } - } - - @Override - public NBTBase toMinecraftTag(NbtTag tag) { - switch (tag.getType()) { - case BYTE: - return new NBTTagByte((byte) tag.getValue()); - case SHORT: - return new NBTTagShort((short) tag.getValue()); - case INT: - return new NBTTagInt((int) tag.getValue()); - case LONG: - return new NBTTagLong((long) tag.getValue()); - case FLOAT: - return new NBTTagFloat((float) tag.getValue()); - case DOUBLE: - return new NBTTagDouble((double) tag.getValue()); - case STRING: - return new NBTTagString((String) tag.getValue()); - case BYTE_ARRAY: - return new NBTTagByteArray((byte[]) tag.getValue()); - case INT_ARRAY: - return new NBTTagIntArray((int[]) tag.getValue()); - case LONG_ARRAY: - NBTTagList list = new NBTTagList(); - for (long value : (long[]) tag.getValue()) { - list.add(new NBTTagLong(value)); - } - return list; - case LIST: - return toMinecraftList((NbtList) tag); - case COMPOUND: - return toMinecraftCompound((NbtCompound) tag); - case END: - return (NBTTagEnd) ReflectionProvider.DEFAULT.getReflect("nmsNBTTagEnd").init(); - default: - return null; - } - } - - @Override - public NbtTag fromMinecraftTag(Object raw) { - if (!(raw instanceof NBTBase)) { - return null; - } - NBTBase tag = (NBTBase) raw; - NbtType type = NbtType.getById(tag.getTypeId()); - switch (type) { - case BYTE: - return new NbtByte(((NBTTagByte) tag).f()); - case SHORT: - return new NbtShort(((NBTTagShort) tag).e()); - case INT: - return new NbtInt(((NBTTagInt) tag).d()); - case LONG: - return new NbtLong(((NBTTagLong) tag).c()); - case FLOAT: - return new NbtFloat(((NBTTagFloat) tag).h()); - case DOUBLE: - return new NbtDouble(((NBTTagDouble) tag).g()); - case STRING: - return new NbtString(((NBTTagString) tag).a_()); - case BYTE_ARRAY: - return new NbtByteArray(((NBTTagByteArray) tag).c()); - case INT_ARRAY: - return new NbtIntArray(((NBTTagIntArray) tag).c()); - case LONG_ARRAY: - return new NbtLongArray(new long[0]); - case LIST: - return fromMinecraftList(tag); - case COMPOUND: - return fromMinecraftCompound(tag); - case END: - return NbtEnd.INSTANCE; - default: - return null; - } - } - - @Override - public NBTTagList toMinecraftList(NbtList list) { - NBTTagList output = new NBTTagList(); - for (NbtTag tag : list) { - output.add(toMinecraftTag(tag)); - } - return output; - } - - @SuppressWarnings("unchecked") - @Override - public NbtList fromMinecraftList(Object raw) { - if (!(raw instanceof NBTTagList)) { - return null; - } - NBTTagList list = (NBTTagList) raw; - List content = (List) ReflectionProvider.DEFAULT.getReflect("nmsNBTTagList").getFieldValue("value", list); - NbtList output = new NbtList<>(NbtType.getById(list.getTypeId())); - for (NBTBase base : content) { - output.add(fromMinecraftTag(base)); - } - return output; - } - - @Override - public NBTTagCompound toMinecraftCompound(NbtCompound compound) { - NBTTagCompound output = new NBTTagCompound(); - if (compound.isEmpty()) { - return output; - } - Set keys = compound.getKeys(); - for (String key : keys) { - output.set(key, toMinecraftTag(compound.get(key))); - } - return output; - } - - @Override - public NbtCompound fromMinecraftCompound(Object raw) { - if (!(raw instanceof NBTTagCompound)) { - return null; - } - NBTTagCompound compound = (NBTTagCompound) raw; - NbtCompound output = new NbtCompound(); - if (compound.isEmpty()) { - return output; - } - Set keys = compound.c(); - for (String key : keys) { - output.set(key, fromMinecraftTag(compound.get(key))); - } - return output; - } - - @Override - public org.bukkit.inventory.ItemStack itemFromCompound(NbtCompound compound) { - return CraftItemStack.asBukkitCopy(ItemStack.createStack(toMinecraftCompound(compound))); - } - - @Override - public NbtCompound itemToCompound(org.bukkit.inventory.ItemStack itemStack) { - ItemStack nmsStack = CraftItemStack.asNMSCopy(itemStack); - NBTTagCompound stackTag; - if (!nmsStack.hasTag()) { - stackTag = nmsStack.save(new NBTTagCompound()); - } else { - stackTag = nmsStack.getTag(); - } - return fromMinecraftCompound(stackTag); - } - - @Override - public WrappedContext createContext(DataAdapterContext context) { - return new SimpleSyntaxContext(context); - } - - @Override - public WrapType wrap(DataType dataType) { - return new SimpleWrapType(dataType); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/EntityProvider1_8_R3.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/EntityProvider1_8_R3.java deleted file mode 100644 index 4399e8d..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/EntityProvider1_8_R3.java +++ /dev/null @@ -1,47 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R3; - -import java.util.EnumMap; -import java.util.function.Function; - -import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; - -import net.minecraft.server.v1_8_R3.World; -import net.sourcewriters.minecraft.vcompat.reflection.EntityProvider; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R3.utils.EntityConstructors1_8_R3; - -public class EntityProvider1_8_R3 extends EntityProvider { - - private final EnumMap> entityMap = new EnumMap<>(NmsEntityType.class); - - protected EntityProvider1_8_R3(VersionControl1_8_R3 versionControl) { - super(versionControl); - } - - @SuppressWarnings("unchecked") - private final Function searchConstructor(NmsEntityType type) { - try { - return (Function) EntityConstructors1_8_R3.class.getField(type.name()).get(null); - } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException ignore) { - return null; - } - } - - private final Function getConstructor(NmsEntityType type) { - return entityMap.computeIfAbsent(type, (key -> searchConstructor(key))); - } - - @Override - public NmsEntity createEntity(org.bukkit.World world, NmsEntityType type) { - if (!(world instanceof CraftWorld)) { - return null; - } - Function function; - if ((function = getConstructor(type)) == null) { - return null; - } - return function.apply(((CraftWorld) world).getHandle()); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/PacketHandler1_8_R3.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/PacketHandler1_8_R3.java deleted file mode 100644 index 66e13ad..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/PacketHandler1_8_R3.java +++ /dev/null @@ -1,11 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R3; - -import net.sourcewriters.minecraft.vcompat.reflection.PacketHandler; - -public class PacketHandler1_8_R3 extends PacketHandler { - - protected PacketHandler1_8_R3(VersionControl1_8_R3 versionControl) { - super(versionControl); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/PlayerProvider1_8_R3.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/PlayerProvider1_8_R3.java deleted file mode 100644 index 4615e4f..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/PlayerProvider1_8_R3.java +++ /dev/null @@ -1,30 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R3; - -import java.io.File; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; - -import net.sourcewriters.minecraft.vcompat.reflection.DataProvider; -import net.sourcewriters.minecraft.vcompat.reflection.PlayerProvider; -import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.DataDistributor; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R3.entity.Player1_8_R3; - -public class PlayerProvider1_8_R3 extends PlayerProvider { - - private final DataDistributor distributor; - - protected PlayerProvider1_8_R3(VersionControl1_8_R3 versionControl) { - super(versionControl); - distributor = versionControl.getDataProvider().createDistributor(new File(Bukkit.getWorlds().get(0).getWorldFolder(), "playerdata"), - uuid -> "custom_" + uuid.toString(), DataProvider.DEFAULT_RANDOM); - } - - @Override - protected NmsPlayer createPlayer(Player player) { - return new Player1_8_R3(player, distributor.get(player.getUniqueId())); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/TextureProvider1_8_R3.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/TextureProvider1_8_R3.java deleted file mode 100644 index 72d093b..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/TextureProvider1_8_R3.java +++ /dev/null @@ -1,105 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R3; - -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_8_R3.block.CraftSkull; -import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack; -import org.bukkit.inventory.meta.ItemMeta; -import org.bukkit.inventory.meta.SkullMeta; -import org.bukkit.material.MaterialData; - -import com.mojang.authlib.GameProfile; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; - -import net.minecraft.server.v1_8_R3.GameProfileSerializer; -import net.minecraft.server.v1_8_R3.ItemStack; -import net.minecraft.server.v1_8_R3.NBTTagCompound; -import net.sourcewriters.minecraft.vcompat.reflection.TextureProvider; - -@SuppressWarnings("deprecation") -public class TextureProvider1_8_R3 extends TextureProvider { - - private final AbstractReflect craftItemStackRef = new Reflect(CraftItemStack.class).searchField("handle", "handle"); - private final AbstractReflect craftMetaSkullRef = new Reflect("org.bukkit.craftbukkit.v1_8_R3.inventory.CraftMetaSkull") - .searchField("serialized", "serializedProfile").searchField("profile", "profile"); - private final Material skullMaterial = Material.valueOf("SKULL"); - - protected TextureProvider1_8_R3(VersionControl1_8_R3 versionControl) { - super(versionControl); - } - - @Override - public GameProfile profileFromBlock(Block block) { - if (!(block instanceof CraftSkull)) { - return null; - } - return ((CraftSkull) block).getTileEntity().getGameProfile(); - } - - @Override - public GameProfile profileFromItem(org.bukkit.inventory.ItemStack itemStack) { - if (!(itemStack.getItemMeta() instanceof SkullMeta)) { - return null; - } - SkullMeta meta = (SkullMeta) itemStack.getItemMeta(); - GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue("profile", meta); - if (profile == null) { - NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue("serialized", meta); - if (compound == null) { - ItemStack stack = null; - if (itemStack instanceof CraftItemStack) { - stack = (ItemStack) craftItemStackRef.getFieldValue("handle", itemStack); - } - if (stack == null) { - stack = CraftItemStack.asNMSCopy(itemStack); - } - NBTTagCompound stackTag; - if (!stack.hasTag()) { - stackTag = stack.save(new NBTTagCompound()); - } else { - stackTag = stack.getTag(); - } - if (stackTag.hasKeyOfType("SkullOwner", 10)) { - compound = stackTag.getCompound("SkullOwner"); - } else if (stackTag.hasKeyOfType("SkullProfile", 10)) { - compound = stackTag.getCompound("SkullProfile"); - } - } - if (compound == null) { - return null; - } - profile = GameProfileSerializer.deserialize(compound); - } - return profile; - } - - @Override - public org.bukkit.inventory.ItemStack getItem(GameProfile profile) { - org.bukkit.inventory.ItemStack craftStack = CraftItemStack.asCraftCopy(new MaterialData(skullMaterial, (byte) 3).toItemStack(1)); - applyItem(craftStack, profile); - return craftStack; - } - - @Override - public boolean applyItem(org.bukkit.inventory.ItemStack itemStack, GameProfile profile) { - ItemMeta meta = itemStack.getItemMeta(); - if (!(meta instanceof SkullMeta)) { - return false; - } - SkullMeta skullMeta = (SkullMeta) meta; - craftMetaSkullRef.setFieldValue(meta, "profile", profile); - itemStack.setItemMeta(skullMeta); - return true; - } - - @Override - public boolean applyBlock(Block block, GameProfile profile) { - if (!(block instanceof CraftSkull)) { - return false; - } - ((CraftSkull) block).getTileEntity().setGameProfile(profile); - return true; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/ToolProvider1_8_R3.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/ToolProvider1_8_R3.java deleted file mode 100644 index 786de5a..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/ToolProvider1_8_R3.java +++ /dev/null @@ -1,33 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R3; - -import net.sourcewriters.minecraft.vcompat.reflection.ToolProvider; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R3.tools.BlockTools1_8_R3; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R3.tools.ServerTools1_8_R3; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R3.tools.SkinTools1_8_R3; - -public class ToolProvider1_8_R3 extends ToolProvider { - - private final BlockTools1_8_R3 blockTools = new BlockTools1_8_R3(); - private final SkinTools1_8_R3 skinTools = new SkinTools1_8_R3(); - private final ServerTools1_8_R3 serverTools = new ServerTools1_8_R3(); - - protected ToolProvider1_8_R3(VersionControl1_8_R3 versionControl) { - super(versionControl); - } - - @Override - public SkinTools1_8_R3 getSkinTools() { - return skinTools; - } - - @Override - public ServerTools1_8_R3 getServerTools() { - return serverTools; - } - - @Override - public BlockTools1_8_R3 getBlockTools() { - return blockTools; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/VersionControl1_8_R3.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/VersionControl1_8_R3.java deleted file mode 100644 index 14ce3d6..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/VersionControl1_8_R3.java +++ /dev/null @@ -1,56 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R3; - -import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R3.reflection.NmsReflection1_8_R3; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; - -public class VersionControl1_8_R3 extends VersionControl { - - public static VersionControl1_8_R3 INSTANCE; - - public static VersionControl1_8_R3 init() { - return INSTANCE != null ? INSTANCE : (INSTANCE = new VersionControl1_8_R3()); - } - - private final ToolProvider1_8_R3 toolProvider = new ToolProvider1_8_R3(this); - private final TextureProvider1_8_R3 textureProvider = new TextureProvider1_8_R3(this); - private final PacketHandler1_8_R3 packetHandler = new PacketHandler1_8_R3(this); - private final EntityProvider1_8_R3 entityProvider = new EntityProvider1_8_R3(this); - private final PlayerProvider1_8_R3 playerProvider = new PlayerProvider1_8_R3(this); - private final BukkitConversion1_8_R3 bukkitConversion = new BukkitConversion1_8_R3(this); - - private VersionControl1_8_R3() { - NmsReflection1_8_R3.INSTANCE.setup(ReflectionProvider.DEFAULT); - } - - @Override - public ToolProvider1_8_R3 getToolProvider() { - return toolProvider; - } - - @Override - public EntityProvider1_8_R3 getEntityProvider() { - return entityProvider; - } - - @Override - public PlayerProvider1_8_R3 getPlayerProvider() { - return playerProvider; - } - - @Override - public TextureProvider1_8_R3 getTextureProvider() { - return textureProvider; - } - - @Override - public PacketHandler1_8_R3 getPacketHandler() { - return packetHandler; - } - - @Override - public BukkitConversion1_8_R3 getBukkitConversion() { - return bukkitConversion; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/entity/ArmorStand1_8_R3.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/entity/ArmorStand1_8_R3.java deleted file mode 100644 index a60a7ee..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/entity/ArmorStand1_8_R3.java +++ /dev/null @@ -1,33 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R3.entity; - -import net.minecraft.server.v1_8_R3.EntityArmorStand; -import net.minecraft.server.v1_8_R3.World; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsArmorStand; - -public class ArmorStand1_8_R3 extends EntityLiving1_8_R3 implements NmsArmorStand { - - public ArmorStand1_8_R3(World world) { - super(new EntityArmorStand(world)); - } - - @Override - public boolean hasGravity() { - return handle.hasGravity(); - } - - @Override - public void setGravity(boolean gravity) { - handle.setGravity(gravity); - } - - @Override - public void setSmall(boolean small) { - handle.setSmall(small); - } - - @Override - public boolean isSmall() { - return handle.isSmall(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/entity/Entity1_8_R3.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/entity/Entity1_8_R3.java deleted file mode 100644 index cfe965d..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/entity/Entity1_8_R3.java +++ /dev/null @@ -1,213 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R3.entity; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.OfflinePlayer; -import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; -import org.bukkit.entity.Player; - -import net.minecraft.server.v1_8_R3.AxisAlignedBB; -import net.minecraft.server.v1_8_R3.Entity; -import net.minecraft.server.v1_8_R3.EntityTypes; -import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy; -import net.minecraft.server.v1_8_R3.PacketPlayOutEntityMetadata; -import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntity; -import net.minecraft.server.v1_8_R3.PlayerConnection; -import net.minecraft.server.v1_8_R3.Vec3D; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.utils.NmsBoundingBox; - -public abstract class Entity1_8_R3 implements NmsEntity { - - protected final E handle; - - protected final List visible = Collections.synchronizedList(new ArrayList<>()); - - public Entity1_8_R3(E handle) { - this.handle = handle; - } - - @Override - public final E getHandle() { - return handle; - } - - @Override - public int getId() { - return handle.getId(); - } - - @Override - public UUID getUniqueId() { - return handle.getUniqueID(); - } - - @Override - public NmsBoundingBox getBoundingBox() { - AxisAlignedBB box = handle.getBoundingBox(); - return new NmsBoundingBox(box.a, box.b, box.c, box.d, box.e, box.f); - } - - @Override - public void setCustomName(String name) { - handle.setCustomName(name); - updateVisibility(); - } - - @Override - public String getCustomName() { - return handle.getCustomName(); - } - - @Override - public void setCustomNameVisible(boolean visible) { - handle.setCustomNameVisible(visible); - } - - @Override - public boolean isCustomNameVisible() { - return handle.getCustomNameVisible(); - } - - @Override - public void setInvisible(boolean invisible) { - handle.setInvisible(invisible); - } - - @Override - public boolean isInvisible() { - return handle.isInvisible(); - } - - @Override - public boolean isInteractable() { - return handle.ad(); - } - - @Override - public boolean isCollidable() { - return handle.ae(); - } - - @Override - public void setInvulnerable(boolean invulnerable) { - handle.h(invulnerable); - } - - @Override - public boolean isInvulnerable() { - return handle.isInvulnerable(null); - } - - @Override - public boolean hasGravity() { - return true; - } - - @Override - public void setGravity(boolean gravity) {} - - @Override - public void setLocation(Location location) { - handle.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); - if (location.getWorld() == null || handle.getWorld().getWorld() == location.getWorld()) { - updateVisibility(); - return; - } - handle.world = ((CraftWorld) location.getWorld()).getHandle(); - updateVisibility(); - } - - @Override - public Location getLocation() { - Vec3D vector = handle.d(); - return new Location(handle.getWorld().getWorld(), vector.a, vector.b, vector.c); - } - - @Override - public void updateVisibility() { - if (visible.isEmpty()) { - return; - } - Player[] players; - synchronized (visible) { - players = visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) - .toArray(Player[]::new); - } - hide(players); - show(players); - } - - @Override - public boolean isShown(Player player) { - synchronized (visible) { - return visible.contains(player.getUniqueId()); - } - } - - @Override - public void hide(Player... players) { - if (players.length == 0) { - return; - } - PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(handle.getId()); - for (Player player : players) { - if (!isShown(player)) { - continue; - } - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); - synchronized (visible) { - visible.remove(player.getUniqueId()); - } - } - } - - @Override - public void show(Player... players) { - if (players.length == 0) { - return; - } - PacketPlayOutSpawnEntity packet = new PacketPlayOutSpawnEntity(handle, EntityTypes.a(handle)); - PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); - PlayerConnection connection; - for (Player player : players) { - if (isShown(player)) { - continue; - } - connection = ((CraftPlayer) player).getHandle().playerConnection; - connection.sendPacket(packet); - connection.sendPacket(metadataPacket); - synchronized (visible) { - visible.add(player.getUniqueId()); - } - } - } - - @Override - public UUID[] getVisible() { - synchronized (visible) { - return visible.toArray(new UUID[0]); - } - } - - @Override - public Player[] getVisibleAsPlayer() { - synchronized (visible) { - return visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) - .toArray(Player[]::new); - } - } - - @Override - public void kill() { - hide(getVisibleAsPlayer()); - handle.die(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/entity/EntityLiving1_8_R3.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/entity/EntityLiving1_8_R3.java deleted file mode 100644 index 8940326..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/entity/EntityLiving1_8_R3.java +++ /dev/null @@ -1,17 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R3.entity; - -import net.minecraft.server.v1_8_R3.EntityLiving; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityLiving; - -public abstract class EntityLiving1_8_R3 extends Entity1_8_R3 implements NmsEntityLiving { - - public EntityLiving1_8_R3(E handle) { - super(handle); - } - - @Override - public void setCollidable(boolean collidable) { - - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/entity/Player1_8_R3.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/entity/Player1_8_R3.java deleted file mode 100644 index 6527c08..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/entity/Player1_8_R3.java +++ /dev/null @@ -1,295 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R3.entity; - -import java.util.ArrayList; -import java.util.Collections; - -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_8_R3.util.CraftChatMessage; -import org.bukkit.entity.Player; - -import com.mojang.authlib.GameProfile; -import com.mojang.authlib.properties.Property; -import com.mojang.authlib.properties.PropertyMap; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; - -import net.minecraft.server.v1_8_R3.EntityPlayer; -import net.minecraft.server.v1_8_R3.IChatBaseComponent; -import net.minecraft.server.v1_8_R3.MathHelper; -import net.minecraft.server.v1_8_R3.PacketPlayInClientCommand; -import net.minecraft.server.v1_8_R3.PacketPlayInClientCommand.EnumClientCommand; -import net.minecraft.server.v1_8_R3.PacketPlayOutChat; -import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy; -import net.minecraft.server.v1_8_R3.PacketPlayOutEntityEquipment; -import net.minecraft.server.v1_8_R3.PacketPlayOutEntityHeadRotation; -import net.minecraft.server.v1_8_R3.PacketPlayOutEntityMetadata; -import net.minecraft.server.v1_8_R3.PacketPlayOutEntityStatus; -import net.minecraft.server.v1_8_R3.PacketPlayOutHeldItemSlot; -import net.minecraft.server.v1_8_R3.PacketPlayOutNamedEntitySpawn; -import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo; -import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo.EnumPlayerInfoAction; -import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerListHeaderFooter; -import net.minecraft.server.v1_8_R3.PacketPlayOutPosition; -import net.minecraft.server.v1_8_R3.PacketPlayOutRespawn; -import net.minecraft.server.v1_8_R3.PacketPlayOutTitle; -import net.minecraft.server.v1_8_R3.PacketPlayOutTitle.EnumTitleAction; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.PersistentContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.type.SkinDataType; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContainer; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; -import net.sourcewriters.minecraft.vcompat.utils.bukkit.Players; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.MojangProfileServer; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; -import net.sourcewriters.minecraft.vcompat.utils.thread.PostAsync; -import net.minecraft.server.v1_8_R3.PlayerConnection; -import net.minecraft.server.v1_8_R3.WorldServer; - -public class Player1_8_R3 extends EntityLiving1_8_R3 implements NmsPlayer { - - private String realName; - private Skin realSkin; - - private final WrappedContainer dataAdapter; - - public Player1_8_R3(Player player, PersistentContainer container) { - super(((CraftPlayer) player).getHandle()); - this.dataAdapter = new SimpleSyntaxContainer<>(container); - update(false); - } - - @Override - public CraftPlayer getBukkitPlayer() { - return handle.getBukkitEntity(); - } - - @Override - public WrappedContainer getDataAdapter() { - return dataAdapter; - } - - @Override - public void setSkin(Skin skin) { - if (skin == null || getSkin().equals(skin)) { - return; - } - getDataAdapter().set("skin", skin, SkinDataType.WRAPPED_INSTANCE); - } - - @Override - public Skin getSkin() { - return dataAdapter.getOrDefault("skin", SkinDataType.WRAPPED_INSTANCE, realSkin); - } - - @Override - public Skin getRealSkin() { - return realSkin; - } - - @Override - public void setName(String name) { - if (getName().equals(name)) { - return; - } - if (name == null) { - getDataAdapter().remove("name"); - return; - } - getDataAdapter().set("name", name, WrapType.STRING); - } - - @Override - public String getName() { - return getDataAdapter().getOrDefault("name", WrapType.STRING, realName); - } - - @Override - public String getRealName() { - return realName; - } - - @Override - public void setPlayerListHeader(String text) { - setPlayerListHeaderAndFooter(text, getPlayerListFooter()); - } - - @Override - public String getPlayerListHeader() { - return getDataAdapter().getOrDefault("header", WrapType.STRING, ""); - } - - @Override - public void setPlayerListFooter(String text) { - setPlayerListHeaderAndFooter(getPlayerListHeader(), text); - } - - @Override - public String getPlayerListFooter() { - return getDataAdapter().getOrDefault("footer", WrapType.STRING, ""); - } - - @Override - public int getPing() { - return handle.ping; - } - - @Override - public void setPlayerListHeaderAndFooter(String header, String footer) { - getDataAdapter().set("header", header, WrapType.STRING); - getDataAdapter().set("footer", footer, WrapType.STRING); - sendPlayerListInfo(header, footer); - } - - private final void sendPlayerListInfo(String header, String footer) { - if (handle.playerConnection.isDisconnected()) { - return; - } - - IChatBaseComponent headerComponent = header.isEmpty() ? null : CraftChatMessage.fromString(header, true)[0]; - IChatBaseComponent footerComponent = footer.isEmpty() ? null : CraftChatMessage.fromString(footer, true)[0]; - - PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter(); - - Reflect reflect = ReflectionProvider.DEFAULT.getReflect("nmsPacketPlayOutPlayerListHeaderFooter"); - reflect.setFieldValue(packet, "header", headerComponent); - reflect.setFieldValue(packet, "footer", footerComponent); - - handle.playerConnection.sendPacket(packet); - } - - @Override - public void setTitleTimes(int fadeIn, int stay, int fadeOut) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TIMES, null, fadeIn, stay, fadeOut)); - } - - @Override - public void sendSubtitle(String text) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.SUBTITLE, CraftChatMessage.fromString(text)[0])); - } - - @Override - public void sendTitle(String text) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TITLE, CraftChatMessage.fromString(text)[0])); - } - - @Override - public void sendActionBar(String text) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutChat(CraftChatMessage.fromString(text)[0], (byte) 2)); - } - - @Override - public void fakeRespawn() { - if (handle.playerConnection.isDisconnected()) { - return; - } - PacketPlayOutPlayerInfo remInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER, handle); - PacketPlayOutPlayerInfo addInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.ADD_PLAYER, handle); - - PacketPlayOutEntityDestroy destroyPacket = new PacketPlayOutEntityDestroy(handle.getId()); - PacketPlayOutNamedEntitySpawn spawnPacket = new PacketPlayOutNamedEntitySpawn(handle); - PacketPlayOutEntityHeadRotation rotationPacket = new PacketPlayOutEntityHeadRotation(handle, - (byte) MathHelper.d(handle.getHeadRotation() * 256F / 360F)); - - ArrayList equipmentPackets = new ArrayList<>(); - for (int slot = 0; slot < 5; slot++) { - equipmentPackets.add(new PacketPlayOutEntityEquipment(handle.getId(), slot, handle.getEquipment(slot))); - } - - Player self = getBukkitPlayer(); - Player[] players = Players.getOnlineWithout(getUniqueId()); - for (Player player : players) { - if (!player.canSee(self)) { - continue; - } - PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection; - connection.sendPacket(remInfoPacket); - connection.sendPacket(addInfoPacket); - connection.sendPacket(destroyPacket); - connection.sendPacket(spawnPacket); - connection.sendPacket(rotationPacket); - for (PacketPlayOutEntityEquipment equipmentPacket : equipmentPackets) { - connection.sendPacket(equipmentPacket); - } - } - - WorldServer world = (WorldServer) handle.world; - - PacketPlayOutRespawn respawnPacket = new PacketPlayOutRespawn(handle.dimension, world.getDifficulty(), - handle.world.worldData.getType(), handle.playerInteractManager.getGameMode()); - PacketPlayOutPosition positionPacket = new PacketPlayOutPosition(handle.locX, handle.locY, handle.locZ, handle.yaw, handle.pitch, - Collections.emptySet()); - PacketPlayOutHeldItemSlot itemPacket = new PacketPlayOutHeldItemSlot(handle.inventory.itemInHandIndex); - PacketPlayOutEntityStatus statusPacket = new PacketPlayOutEntityStatus(handle, (byte) 28); - PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); - - PlayerConnection connection = handle.playerConnection; - connection.sendPacket(remInfoPacket); - connection.sendPacket(addInfoPacket); - connection.sendPacket(respawnPacket); - connection.sendPacket(positionPacket); - connection.sendPacket(itemPacket); - connection.sendPacket(statusPacket); - connection.sendPacket(metadataPacket); - - handle.updateAbilities(); - handle.triggerHealthUpdate(); - handle.updateInventory(handle.defaultContainer); - if (handle.activeContainer != handle.defaultContainer) { - handle.updateInventory(handle.activeContainer); - } - self.recalculatePermissions(); - } - - @Override - public void respawn() { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayInClientCommand(EnumClientCommand.PERFORM_RESPAWN)); - } - - @Override - public void update() { - update(true); - } - - private final void update(boolean flag) { - PostAsync.forcePost(() -> { - realName = MojangProfileServer.getName(getUniqueId()); - realSkin = MojangProfileServer.getSkin(realName, getUniqueId()); - }); - if (flag) { - GameProfile profile = handle.getProfile(); - - Skin skin = getSkin(); - if (skin != null) { - PropertyMap properties = profile.getProperties(); - properties.removeAll("textures"); - properties.put("textures", new Property("textures", skin.getValue(), skin.getSignature())); - } - - String name = getName(); - if (name != null) { - ReflectionProvider.DEFAULT.getReflect("mjGameProfile").setFieldValue(profile, "name", name); - } - - if (!(name == null && skin == null)) { - fakeRespawn(); - } - } - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/reflection/NmsReflection1_8_R3.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/reflection/NmsReflection1_8_R3.java deleted file mode 100644 index f746394..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/reflection/NmsReflection1_8_R3.java +++ /dev/null @@ -1,34 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R3.reflection; - -import net.minecraft.server.v1_8_R3.NBTTagEnd; -import net.minecraft.server.v1_8_R3.NBTTagList; -import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerListHeaderFooter; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.Reflections; - -public class NmsReflection1_8_R3 extends Reflections { - - public static NmsReflection1_8_R3 INSTANCE = new NmsReflection1_8_R3(); - - private NmsReflection1_8_R3() {} - - @Override - public void setup(ReflectionProvider provider) { - - // - // - // Create Reflects - // - - // - // Minecraft - - provider.createReflect("nmsPacketPlayOutPlayerListHeaderFooter", PacketPlayOutPlayerListHeaderFooter.class) - .searchField("header", "a").searchField("header", "b"); - - provider.createReflect("nmsNBTTagEnd", NBTTagEnd.class); - provider.createReflect("nmsNBTTagList", NBTTagList.class).searchField("value", "list"); - - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/tools/BlockTools1_8_R3.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/tools/BlockTools1_8_R3.java deleted file mode 100644 index 91983d8..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/tools/BlockTools1_8_R3.java +++ /dev/null @@ -1,39 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R3.tools; - -import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_8_R3.block.CraftSkull; - -import com.mojang.authlib.properties.Property; -import com.mojang.authlib.properties.PropertyMap; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; - -import net.minecraft.server.v1_8_R3.TileEntitySkull; -import net.sourcewriters.minecraft.vcompat.reflection.tools.BlockTools; -import net.sourcewriters.minecraft.vcompat.utils.constants.MinecraftConstants; - -public class BlockTools1_8_R3 extends BlockTools { - - private final AbstractReflect craftEntityStateRef = new Reflect(CraftSkull.class).searchField("tileEntity", "tileEntity"); - - @Override - public void setHeadTexture(Block block, String texture) { - if (!(block instanceof CraftSkull)) { - return; - } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); - PropertyMap map = entitySkull.getGameProfile().getProperties(); - map.removeAll("textures"); - map.put("textures", new Property("textures", MinecraftConstants.TEXTURE_SIGNATURE, texture)); - } - - @Override - public String getHeadTexture(Block block) { - if (!(block instanceof CraftSkull)) { - return null; - } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); - return entitySkull.getGameProfile().getProperties().get("textures").iterator().next().getValue(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/tools/ServerTools1_8_R3.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/tools/ServerTools1_8_R3.java deleted file mode 100644 index 8a3f39e..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/tools/ServerTools1_8_R3.java +++ /dev/null @@ -1,26 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R3.tools; - -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_8_R3.CraftServer; - -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R3.wrapper.ConsoleReaderWrapper1_8_R3; -import net.sourcewriters.minecraft.vcompat.reflection.tools.ServerTools; - -public class ServerTools1_8_R3 extends ServerTools { - - @Override - public void setMotd(String text) { - ((CraftServer) Bukkit.getServer()).getServer().setMotd(text); - } - - @Override - public String getMotd() { - return ((CraftServer) Bukkit.getServer()).getServer().getMotd(); - } - - @Override - public ConsoleReaderWrapper1_8_R3 getConsole() { - return ConsoleReaderWrapper1_8_R3.INSTANCE; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/tools/SkinTools1_8_R3.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/tools/SkinTools1_8_R3.java deleted file mode 100644 index aa350c7..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/tools/SkinTools1_8_R3.java +++ /dev/null @@ -1,16 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R3.tools; - -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; -import org.bukkit.entity.Player; - -import net.sourcewriters.minecraft.vcompat.reflection.tools.SkinTools; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; - -public class SkinTools1_8_R3 extends SkinTools { - - @Override - public Skin skinFromPlayer(Player player) { - return skinFromGameProfile(((CraftPlayer) player).getHandle().getProfile()); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/utils/EntityConstructors1_8_R3.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/utils/EntityConstructors1_8_R3.java deleted file mode 100644 index 24bcead..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/utils/EntityConstructors1_8_R3.java +++ /dev/null @@ -1,12 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R3.utils; - -import java.util.function.Function; - -import net.minecraft.server.v1_8_R3.World; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R3.entity.ArmorStand1_8_R3; - -public abstract class EntityConstructors1_8_R3 { - - public static final Function ARMOR_STAND = (world -> new ArmorStand1_8_R3(world)); - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/wrapper/ConsoleReaderWrapper1_8_R3.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/wrapper/ConsoleReaderWrapper1_8_R3.java deleted file mode 100644 index 0e37aef..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/wrapper/ConsoleReaderWrapper1_8_R3.java +++ /dev/null @@ -1,43 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_8_R3.wrapper; - -import java.io.IOException; -import java.io.Writer; - -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_8_R3.CraftServer; -import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; - -import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; - -public final class ConsoleReaderWrapper1_8_R3 extends ConsoleReaderWrapper { - - public static final ConsoleReaderWrapper1_8_R3 INSTANCE = new ConsoleReaderWrapper1_8_R3(); - - private final ConsoleReader reader; - - @SuppressWarnings("resource") - private ConsoleReaderWrapper1_8_R3() { - this.reader = ((CraftServer) Bukkit.getServer()).getServer().reader; - } - - @Override - public Writer getOutput() { - return reader.getOutput(); - } - - @Override - public boolean isAnsiSupported() { - return reader.getTerminal().isAnsiSupported(); - } - - @Override - public void flush() throws IOException { - reader.flush(); - } - - @Override - public void drawLine() throws IOException { - reader.drawLine(); - } - -} diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/BukkitConversion1_9_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/BukkitConversion1_9_R1.java deleted file mode 100644 index ad61638..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/BukkitConversion1_9_R1.java +++ /dev/null @@ -1,231 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R1; - -import java.util.List; -import java.util.Set; - -import org.bukkit.craftbukkit.v1_9_R1.inventory.CraftItemStack; -import org.bukkit.entity.EntityType; - -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.nbt.NbtByte; -import com.syntaxphoenix.syntaxapi.nbt.NbtByteArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; -import com.syntaxphoenix.syntaxapi.nbt.NbtDouble; -import com.syntaxphoenix.syntaxapi.nbt.NbtEnd; -import com.syntaxphoenix.syntaxapi.nbt.NbtFloat; -import com.syntaxphoenix.syntaxapi.nbt.NbtInt; -import com.syntaxphoenix.syntaxapi.nbt.NbtIntArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtList; -import com.syntaxphoenix.syntaxapi.nbt.NbtLong; -import com.syntaxphoenix.syntaxapi.nbt.NbtLongArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtShort; -import com.syntaxphoenix.syntaxapi.nbt.NbtString; -import com.syntaxphoenix.syntaxapi.nbt.NbtTag; -import com.syntaxphoenix.syntaxapi.nbt.NbtType; - -import net.minecraft.server.v1_9_R1.ItemStack; -import net.minecraft.server.v1_9_R1.NBTBase; -import net.minecraft.server.v1_9_R1.NBTTagByte; -import net.minecraft.server.v1_9_R1.NBTTagByteArray; -import net.minecraft.server.v1_9_R1.NBTTagCompound; -import net.minecraft.server.v1_9_R1.NBTTagDouble; -import net.minecraft.server.v1_9_R1.NBTTagEnd; -import net.minecraft.server.v1_9_R1.NBTTagFloat; -import net.minecraft.server.v1_9_R1.NBTTagInt; -import net.minecraft.server.v1_9_R1.NBTTagIntArray; -import net.minecraft.server.v1_9_R1.NBTTagList; -import net.minecraft.server.v1_9_R1.NBTTagLong; -import net.minecraft.server.v1_9_R1.NBTTagShort; -import net.minecraft.server.v1_9_R1.NBTTagString; -import net.sourcewriters.minecraft.vcompat.reflection.BukkitConversion; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContext; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleWrapType; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; - -public class BukkitConversion1_9_R1 extends BukkitConversion { - - protected BukkitConversion1_9_R1(VersionControl1_9_R1 versionControl) { - super(versionControl); - } - - @Override - public EntityType toEntityType(NmsEntityType type) { - try { - return EntityType.valueOf(type.name()); - } catch (IllegalArgumentException ignore) { - return null; - } - } - - @Override - public NmsEntityType fromEntityType(EntityType type) { - try { - return NmsEntityType.valueOf(type.name()); - } catch (IllegalArgumentException ignore) { - return null; - } - } - - @Override - public NBTBase toMinecraftTag(NbtTag tag) { - switch (tag.getType()) { - case BYTE: - return new NBTTagByte((byte) tag.getValue()); - case SHORT: - return new NBTTagShort((short) tag.getValue()); - case INT: - return new NBTTagInt((int) tag.getValue()); - case LONG: - return new NBTTagLong((long) tag.getValue()); - case FLOAT: - return new NBTTagFloat((float) tag.getValue()); - case DOUBLE: - return new NBTTagDouble((double) tag.getValue()); - case STRING: - return new NBTTagString((String) tag.getValue()); - case BYTE_ARRAY: - return new NBTTagByteArray((byte[]) tag.getValue()); - case INT_ARRAY: - return new NBTTagIntArray((int[]) tag.getValue()); - case LONG_ARRAY: - NBTTagList list = new NBTTagList(); - for (long value : (long[]) tag.getValue()) { - list.add(new NBTTagLong(value)); - } - return list; - case LIST: - return toMinecraftList((NbtList) tag); - case COMPOUND: - return toMinecraftCompound((NbtCompound) tag); - case END: - return (NBTTagEnd) ReflectionProvider.DEFAULT.getReflect("nmsNBTTagEnd").init(); - default: - return null; - } - } - - @Override - public NbtTag fromMinecraftTag(Object raw) { - if (!(raw instanceof NBTBase)) { - return null; - } - NBTBase tag = (NBTBase) raw; - NbtType type = NbtType.getById(tag.getTypeId()); - switch (type) { - case BYTE: - return new NbtByte(((NBTTagByte) tag).f()); - case SHORT: - return new NbtShort(((NBTTagShort) tag).e()); - case INT: - return new NbtInt(((NBTTagInt) tag).d()); - case LONG: - return new NbtLong(((NBTTagLong) tag).c()); - case FLOAT: - return new NbtFloat(((NBTTagFloat) tag).h()); - case DOUBLE: - return new NbtDouble(((NBTTagDouble) tag).g()); - case STRING: - return new NbtString(((NBTTagString) tag).a_()); - case BYTE_ARRAY: - return new NbtByteArray(((NBTTagByteArray) tag).c()); - case INT_ARRAY: - return new NbtIntArray(((NBTTagIntArray) tag).c()); - case LONG_ARRAY: - return new NbtLongArray(new long[0]); - case LIST: - return fromMinecraftList(tag); - case COMPOUND: - return fromMinecraftCompound(tag); - case END: - return NbtEnd.INSTANCE; - default: - return null; - } - } - - @Override - public NBTTagList toMinecraftList(NbtList list) { - NBTTagList output = new NBTTagList(); - for (NbtTag tag : list) { - output.add(toMinecraftTag(tag)); - } - return output; - } - - @SuppressWarnings("unchecked") - @Override - public NbtList fromMinecraftList(Object raw) { - if (!(raw instanceof NBTTagList)) { - return null; - } - NBTTagList list = (NBTTagList) raw; - List content = (List) ReflectionProvider.DEFAULT.getReflect("nmsNBTTagList").getFieldValue("value", list); - NbtList output = new NbtList<>(NbtType.getById(list.getTypeId())); - for (NBTBase base : content) { - output.add(fromMinecraftTag(base)); - } - return output; - } - - @Override - public NBTTagCompound toMinecraftCompound(NbtCompound compound) { - NBTTagCompound output = new NBTTagCompound(); - if (compound.isEmpty()) { - return output; - } - Set keys = compound.getKeys(); - for (String key : keys) { - output.set(key, toMinecraftTag(compound.get(key))); - } - return output; - } - - @Override - public NbtCompound fromMinecraftCompound(Object raw) { - if (!(raw instanceof NBTTagCompound)) { - return null; - } - NBTTagCompound compound = (NBTTagCompound) raw; - NbtCompound output = new NbtCompound(); - if (compound.isEmpty()) { - return output; - } - Set keys = compound.c(); - for (String key : keys) { - output.set(key, fromMinecraftTag(compound.get(key))); - } - return output; - } - - @Override - public org.bukkit.inventory.ItemStack itemFromCompound(NbtCompound compound) { - return CraftItemStack.asBukkitCopy(ItemStack.createStack(toMinecraftCompound(compound))); - } - - @Override - public NbtCompound itemToCompound(org.bukkit.inventory.ItemStack itemStack) { - ItemStack nmsStack = CraftItemStack.asNMSCopy(itemStack); - NBTTagCompound stackTag; - if (!nmsStack.hasTag()) { - stackTag = nmsStack.save(new NBTTagCompound()); - } else { - stackTag = nmsStack.getTag(); - } - return fromMinecraftCompound(stackTag); - } - - @Override - public WrappedContext createContext(DataAdapterContext context) { - return new SimpleSyntaxContext(context); - } - - @Override - public WrapType wrap(DataType dataType) { - return new SimpleWrapType(dataType); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/EntityProvider1_9_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/EntityProvider1_9_R1.java deleted file mode 100644 index 5671a86..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/EntityProvider1_9_R1.java +++ /dev/null @@ -1,47 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R1; - -import java.util.EnumMap; -import java.util.function.Function; - -import org.bukkit.craftbukkit.v1_9_R1.CraftWorld; - -import net.minecraft.server.v1_9_R1.World; -import net.sourcewriters.minecraft.vcompat.reflection.EntityProvider; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R1.utils.EntityConstructors1_9_R1; - -public class EntityProvider1_9_R1 extends EntityProvider { - - private final EnumMap> entityMap = new EnumMap<>(NmsEntityType.class); - - protected EntityProvider1_9_R1(VersionControl1_9_R1 versionControl) { - super(versionControl); - } - - @SuppressWarnings("unchecked") - private final Function searchConstructor(NmsEntityType type) { - try { - return (Function) EntityConstructors1_9_R1.class.getField(type.name()).get(null); - } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException ignore) { - return null; - } - } - - private final Function getConstructor(NmsEntityType type) { - return entityMap.computeIfAbsent(type, (key -> searchConstructor(key))); - } - - @Override - public NmsEntity createEntity(org.bukkit.World world, NmsEntityType type) { - if (!(world instanceof CraftWorld)) { - return null; - } - Function function; - if ((function = getConstructor(type)) == null) { - return null; - } - return function.apply(((CraftWorld) world).getHandle()); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/PacketHandler1_9_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/PacketHandler1_9_R1.java deleted file mode 100644 index 1ab5bfc..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/PacketHandler1_9_R1.java +++ /dev/null @@ -1,11 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R1; - -import net.sourcewriters.minecraft.vcompat.reflection.PacketHandler; - -public class PacketHandler1_9_R1 extends PacketHandler { - - protected PacketHandler1_9_R1(VersionControl1_9_R1 versionControl) { - super(versionControl); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/PlayerProvider1_9_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/PlayerProvider1_9_R1.java deleted file mode 100644 index 20bbaed..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/PlayerProvider1_9_R1.java +++ /dev/null @@ -1,30 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R1; - -import java.io.File; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; - -import net.sourcewriters.minecraft.vcompat.reflection.DataProvider; -import net.sourcewriters.minecraft.vcompat.reflection.PlayerProvider; -import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.DataDistributor; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R1.entity.Player1_9_R1; - -public class PlayerProvider1_9_R1 extends PlayerProvider { - - private final DataDistributor distributor; - - protected PlayerProvider1_9_R1(VersionControl1_9_R1 versionControl) { - super(versionControl); - distributor = versionControl.getDataProvider().createDistributor(new File(Bukkit.getWorlds().get(0).getWorldFolder(), "playerdata"), - uuid -> "custom_" + uuid.toString(), DataProvider.DEFAULT_RANDOM); - } - - @Override - protected NmsPlayer createPlayer(Player player) { - return new Player1_9_R1(player, distributor.get(player.getUniqueId())); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/TextureProvider1_9_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/TextureProvider1_9_R1.java deleted file mode 100644 index c9b3a0a..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/TextureProvider1_9_R1.java +++ /dev/null @@ -1,105 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R1; - -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_9_R1.block.CraftSkull; -import org.bukkit.craftbukkit.v1_9_R1.inventory.CraftItemStack; -import org.bukkit.inventory.meta.ItemMeta; -import org.bukkit.inventory.meta.SkullMeta; -import org.bukkit.material.MaterialData; - -import com.mojang.authlib.GameProfile; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; - -import net.minecraft.server.v1_9_R1.GameProfileSerializer; -import net.minecraft.server.v1_9_R1.ItemStack; -import net.minecraft.server.v1_9_R1.NBTTagCompound; -import net.sourcewriters.minecraft.vcompat.reflection.TextureProvider; - -@SuppressWarnings("deprecation") -public class TextureProvider1_9_R1 extends TextureProvider { - - private final AbstractReflect craftItemStackRef = new Reflect(CraftItemStack.class).searchField("handle", "handle"); - private final AbstractReflect craftMetaSkullRef = new Reflect("org.bukkit.craftbukkit.v1_9_R1.inventory.CraftMetaSkull") - .searchField("serialized", "serializedProfile").searchField("profile", "profile"); - private final Material skullMaterial = Material.valueOf("SKULL"); - - protected TextureProvider1_9_R1(VersionControl1_9_R1 versionControl) { - super(versionControl); - } - - @Override - public GameProfile profileFromBlock(Block block) { - if (!(block instanceof CraftSkull)) { - return null; - } - return ((CraftSkull) block).getTileEntity().getGameProfile(); - } - - @Override - public GameProfile profileFromItem(org.bukkit.inventory.ItemStack itemStack) { - if (!(itemStack.getItemMeta() instanceof SkullMeta)) { - return null; - } - SkullMeta meta = (SkullMeta) itemStack.getItemMeta(); - GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue("profile", meta); - if (profile == null) { - NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue("serialized", meta); - if (compound == null) { - ItemStack stack = null; - if (itemStack instanceof CraftItemStack) { - stack = (ItemStack) craftItemStackRef.getFieldValue("handle", itemStack); - } - if (stack == null) { - stack = CraftItemStack.asNMSCopy(itemStack); - } - NBTTagCompound stackTag; - if (!stack.hasTag()) { - stackTag = stack.save(new NBTTagCompound()); - } else { - stackTag = stack.getTag(); - } - if (stackTag.hasKeyOfType("SkullOwner", 10)) { - compound = stackTag.getCompound("SkullOwner"); - } else if (stackTag.hasKeyOfType("SkullProfile", 10)) { - compound = stackTag.getCompound("SkullProfile"); - } - } - if (compound == null) { - return null; - } - profile = GameProfileSerializer.deserialize(compound); - } - return profile; - } - - @Override - public org.bukkit.inventory.ItemStack getItem(GameProfile profile) { - org.bukkit.inventory.ItemStack craftStack = CraftItemStack.asCraftCopy(new MaterialData(skullMaterial, (byte) 3).toItemStack(1)); - applyItem(craftStack, profile); - return craftStack; - } - - @Override - public boolean applyItem(org.bukkit.inventory.ItemStack itemStack, GameProfile profile) { - ItemMeta meta = itemStack.getItemMeta(); - if (!(meta instanceof SkullMeta)) { - return false; - } - SkullMeta skullMeta = (SkullMeta) meta; - craftMetaSkullRef.setFieldValue(meta, "profile", profile); - itemStack.setItemMeta(skullMeta); - return true; - } - - @Override - public boolean applyBlock(Block block, GameProfile profile) { - if (!(block instanceof CraftSkull)) { - return false; - } - ((CraftSkull) block).getTileEntity().setGameProfile(profile); - return true; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/ToolProvider1_9_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/ToolProvider1_9_R1.java deleted file mode 100644 index c8f1937..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/ToolProvider1_9_R1.java +++ /dev/null @@ -1,33 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R1; - -import net.sourcewriters.minecraft.vcompat.reflection.ToolProvider; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R1.tools.BlockTools1_9_R1; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R1.tools.ServerTools1_9_R1; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R1.tools.SkinTools1_9_R1; - -public class ToolProvider1_9_R1 extends ToolProvider { - - private final BlockTools1_9_R1 blockTools = new BlockTools1_9_R1(); - private final SkinTools1_9_R1 skinTools = new SkinTools1_9_R1(); - private final ServerTools1_9_R1 serverTools = new ServerTools1_9_R1(); - - protected ToolProvider1_9_R1(VersionControl1_9_R1 versionControl) { - super(versionControl); - } - - @Override - public SkinTools1_9_R1 getSkinTools() { - return skinTools; - } - - @Override - public ServerTools1_9_R1 getServerTools() { - return serverTools; - } - - @Override - public BlockTools1_9_R1 getBlockTools() { - return blockTools; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/VersionControl1_9_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/VersionControl1_9_R1.java deleted file mode 100644 index 839cc75..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/VersionControl1_9_R1.java +++ /dev/null @@ -1,56 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R1; - -import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R1.reflection.NmsReflection1_9_R1; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; - -public class VersionControl1_9_R1 extends VersionControl { - - public static VersionControl1_9_R1 INSTANCE; - - public static VersionControl1_9_R1 init() { - return INSTANCE != null ? INSTANCE : (INSTANCE = new VersionControl1_9_R1()); - } - - private final ToolProvider1_9_R1 toolProvider = new ToolProvider1_9_R1(this); - private final TextureProvider1_9_R1 textureProvider = new TextureProvider1_9_R1(this); - private final PacketHandler1_9_R1 packetHandler = new PacketHandler1_9_R1(this); - private final EntityProvider1_9_R1 entityProvider = new EntityProvider1_9_R1(this); - private final PlayerProvider1_9_R1 playerProvider = new PlayerProvider1_9_R1(this); - private final BukkitConversion1_9_R1 bukkitConversion = new BukkitConversion1_9_R1(this); - - private VersionControl1_9_R1() { - NmsReflection1_9_R1.INSTANCE.setup(ReflectionProvider.DEFAULT); - } - - @Override - public ToolProvider1_9_R1 getToolProvider() { - return toolProvider; - } - - @Override - public EntityProvider1_9_R1 getEntityProvider() { - return entityProvider; - } - - @Override - public PlayerProvider1_9_R1 getPlayerProvider() { - return playerProvider; - } - - @Override - public TextureProvider1_9_R1 getTextureProvider() { - return textureProvider; - } - - @Override - public PacketHandler1_9_R1 getPacketHandler() { - return packetHandler; - } - - @Override - public BukkitConversion1_9_R1 getBukkitConversion() { - return bukkitConversion; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/entity/ArmorStand1_9_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/entity/ArmorStand1_9_R1.java deleted file mode 100644 index a71cd39..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/entity/ArmorStand1_9_R1.java +++ /dev/null @@ -1,33 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R1.entity; - -import net.minecraft.server.v1_9_R1.EntityArmorStand; -import net.minecraft.server.v1_9_R1.World; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsArmorStand; - -public class ArmorStand1_9_R1 extends EntityLiving1_9_R1 implements NmsArmorStand { - - public ArmorStand1_9_R1(World world) { - super(new EntityArmorStand(world)); - } - - @Override - public boolean hasGravity() { - return handle.hasGravity(); - } - - @Override - public void setGravity(boolean gravity) { - handle.setGravity(gravity); - } - - @Override - public void setSmall(boolean small) { - handle.setSmall(small); - } - - @Override - public boolean isSmall() { - return handle.isSmall(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/entity/Entity1_9_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/entity/Entity1_9_R1.java deleted file mode 100644 index 10eb5a4..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/entity/Entity1_9_R1.java +++ /dev/null @@ -1,213 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R1.entity; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.OfflinePlayer; -import org.bukkit.craftbukkit.v1_9_R1.CraftWorld; -import org.bukkit.craftbukkit.v1_9_R1.entity.CraftPlayer; -import org.bukkit.entity.Player; - -import net.minecraft.server.v1_9_R1.AxisAlignedBB; -import net.minecraft.server.v1_9_R1.Entity; -import net.minecraft.server.v1_9_R1.EntityTypes; -import net.minecraft.server.v1_9_R1.PacketPlayOutEntityDestroy; -import net.minecraft.server.v1_9_R1.PacketPlayOutEntityMetadata; -import net.minecraft.server.v1_9_R1.PacketPlayOutSpawnEntity; -import net.minecraft.server.v1_9_R1.PlayerConnection; -import net.minecraft.server.v1_9_R1.Vec3D; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.utils.NmsBoundingBox; - -public abstract class Entity1_9_R1 implements NmsEntity { - - protected final E handle; - - protected final List visible = Collections.synchronizedList(new ArrayList<>()); - - public Entity1_9_R1(E handle) { - this.handle = handle; - } - - @Override - public final E getHandle() { - return handle; - } - - @Override - public int getId() { - return handle.getId(); - } - - @Override - public UUID getUniqueId() { - return handle.getUniqueID(); - } - - @Override - public NmsBoundingBox getBoundingBox() { - AxisAlignedBB box = handle.getBoundingBox(); - return new NmsBoundingBox(box.a, box.b, box.c, box.d, box.e, box.f); - } - - @Override - public void setCustomName(String name) { - handle.setCustomName(name); - updateVisibility(); - } - - @Override - public String getCustomName() { - return handle.getCustomName(); - } - - @Override - public void setCustomNameVisible(boolean visible) { - handle.setCustomNameVisible(visible); - } - - @Override - public boolean isCustomNameVisible() { - return handle.getCustomNameVisible(); - } - - @Override - public void setInvisible(boolean invisible) { - handle.setInvisible(invisible); - } - - @Override - public boolean isInvisible() { - return handle.isInvisible(); - } - - @Override - public boolean isInteractable() { - return handle.isInteractable(); - } - - @Override - public boolean isCollidable() { - return handle.isCollidable(); - } - - @Override - public void setInvulnerable(boolean invulnerable) { - handle.h(invulnerable); - } - - @Override - public boolean isInvulnerable() { - return handle.isInvulnerable(null); - } - - @Override - public boolean hasGravity() { - return true; - } - - @Override - public void setGravity(boolean gravity) {} - - @Override - public void setLocation(Location location) { - handle.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); - if (location.getWorld() == null || handle.getWorld().getWorld() == location.getWorld()) { - updateVisibility(); - return; - } - handle.world = ((CraftWorld) location.getWorld()).getHandle(); - updateVisibility(); - } - - @Override - public Location getLocation() { - Vec3D vector = handle.d(); - return new Location(handle.getWorld().getWorld(), vector.x, vector.y, vector.z); - } - - @Override - public void updateVisibility() { - if (visible.isEmpty()) { - return; - } - Player[] players; - synchronized (visible) { - players = visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) - .toArray(Player[]::new); - } - hide(players); - show(players); - } - - @Override - public boolean isShown(Player player) { - synchronized (visible) { - return visible.contains(player.getUniqueId()); - } - } - - @Override - public void hide(Player... players) { - if (players.length == 0) { - return; - } - PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(handle.getId()); - for (Player player : players) { - if (!isShown(player)) { - continue; - } - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); - synchronized (visible) { - visible.remove(player.getUniqueId()); - } - } - } - - @Override - public void show(Player... players) { - if (players.length == 0) { - return; - } - PacketPlayOutSpawnEntity packet = new PacketPlayOutSpawnEntity(handle, EntityTypes.a(handle)); - PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); - PlayerConnection connection; - for (Player player : players) { - if (isShown(player)) { - continue; - } - connection = ((CraftPlayer) player).getHandle().playerConnection; - connection.sendPacket(packet); - connection.sendPacket(metadataPacket); - synchronized (visible) { - visible.add(player.getUniqueId()); - } - } - } - - @Override - public UUID[] getVisible() { - synchronized (visible) { - return visible.toArray(new UUID[0]); - } - } - - @Override - public Player[] getVisibleAsPlayer() { - synchronized (visible) { - return visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) - .toArray(Player[]::new); - } - } - - @Override - public void kill() { - hide(getVisibleAsPlayer()); - handle.die(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/entity/EntityLiving1_9_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/entity/EntityLiving1_9_R1.java deleted file mode 100644 index be3e212..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/entity/EntityLiving1_9_R1.java +++ /dev/null @@ -1,17 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R1.entity; - -import net.minecraft.server.v1_9_R1.EntityLiving; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityLiving; - -public abstract class EntityLiving1_9_R1 extends Entity1_9_R1 implements NmsEntityLiving { - - public EntityLiving1_9_R1(E handle) { - super(handle); - } - - @Override - public void setCollidable(boolean collidable) { - handle.collides = collidable; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/entity/Player1_9_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/entity/Player1_9_R1.java deleted file mode 100644 index 62647c8..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/entity/Player1_9_R1.java +++ /dev/null @@ -1,296 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R1.entity; - -import java.util.ArrayList; -import java.util.Collections; - -import org.bukkit.craftbukkit.v1_9_R1.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_9_R1.util.CraftChatMessage; -import org.bukkit.entity.Player; - -import com.mojang.authlib.GameProfile; -import com.mojang.authlib.properties.Property; -import com.mojang.authlib.properties.PropertyMap; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; - -import net.minecraft.server.v1_9_R1.EntityPlayer; -import net.minecraft.server.v1_9_R1.EnumItemSlot; -import net.minecraft.server.v1_9_R1.IChatBaseComponent; -import net.minecraft.server.v1_9_R1.MathHelper; -import net.minecraft.server.v1_9_R1.PacketPlayInClientCommand; -import net.minecraft.server.v1_9_R1.PacketPlayInClientCommand.EnumClientCommand; -import net.minecraft.server.v1_9_R1.PacketPlayOutChat; -import net.minecraft.server.v1_9_R1.PacketPlayOutEntityDestroy; -import net.minecraft.server.v1_9_R1.PacketPlayOutEntityEquipment; -import net.minecraft.server.v1_9_R1.PacketPlayOutEntityHeadRotation; -import net.minecraft.server.v1_9_R1.PacketPlayOutEntityMetadata; -import net.minecraft.server.v1_9_R1.PacketPlayOutEntityStatus; -import net.minecraft.server.v1_9_R1.PacketPlayOutHeldItemSlot; -import net.minecraft.server.v1_9_R1.PacketPlayOutNamedEntitySpawn; -import net.minecraft.server.v1_9_R1.PacketPlayOutPlayerInfo; -import net.minecraft.server.v1_9_R1.PacketPlayOutPlayerInfo.EnumPlayerInfoAction; -import net.minecraft.server.v1_9_R1.PacketPlayOutPlayerListHeaderFooter; -import net.minecraft.server.v1_9_R1.PacketPlayOutPosition; -import net.minecraft.server.v1_9_R1.PacketPlayOutRespawn; -import net.minecraft.server.v1_9_R1.PacketPlayOutTitle; -import net.minecraft.server.v1_9_R1.PacketPlayOutTitle.EnumTitleAction; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.PersistentContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.type.SkinDataType; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContainer; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; -import net.sourcewriters.minecraft.vcompat.utils.bukkit.Players; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.MojangProfileServer; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; -import net.sourcewriters.minecraft.vcompat.utils.thread.PostAsync; -import net.minecraft.server.v1_9_R1.PlayerConnection; -import net.minecraft.server.v1_9_R1.WorldServer; - -public class Player1_9_R1 extends EntityLiving1_9_R1 implements NmsPlayer { - - private String realName; - private Skin realSkin; - - private final WrappedContainer dataAdapter; - - public Player1_9_R1(Player player, PersistentContainer container) { - super(((CraftPlayer) player).getHandle()); - this.dataAdapter = new SimpleSyntaxContainer<>(container); - update(false); - } - - @Override - public CraftPlayer getBukkitPlayer() { - return handle.getBukkitEntity(); - } - - @Override - public WrappedContainer getDataAdapter() { - return dataAdapter; - } - - @Override - public void setSkin(Skin skin) { - if (skin == null || getSkin().equals(skin)) { - return; - } - getDataAdapter().set("skin", skin, SkinDataType.WRAPPED_INSTANCE); - } - - @Override - public Skin getSkin() { - return dataAdapter.getOrDefault("skin", SkinDataType.WRAPPED_INSTANCE, realSkin); - } - - @Override - public Skin getRealSkin() { - return realSkin; - } - - @Override - public void setName(String name) { - if (getName().equals(name)) { - return; - } - if (name == null) { - getDataAdapter().remove("name"); - return; - } - getDataAdapter().set("name", name, WrapType.STRING); - } - - @Override - public String getName() { - return getDataAdapter().getOrDefault("name", WrapType.STRING, realName); - } - - @Override - public String getRealName() { - return realName; - } - - @Override - public void setPlayerListHeader(String text) { - setPlayerListHeaderAndFooter(text, getPlayerListFooter()); - } - - @Override - public String getPlayerListHeader() { - return getDataAdapter().getOrDefault("header", WrapType.STRING, ""); - } - - @Override - public void setPlayerListFooter(String text) { - setPlayerListHeaderAndFooter(getPlayerListHeader(), text); - } - - @Override - public String getPlayerListFooter() { - return getDataAdapter().getOrDefault("footer", WrapType.STRING, ""); - } - - @Override - public int getPing() { - return handle.ping; - } - - @Override - public void setPlayerListHeaderAndFooter(String header, String footer) { - getDataAdapter().set("header", header, WrapType.STRING); - getDataAdapter().set("footer", footer, WrapType.STRING); - sendPlayerListInfo(header, footer); - } - - private final void sendPlayerListInfo(String header, String footer) { - if (handle.playerConnection.isDisconnected()) { - return; - } - - IChatBaseComponent headerComponent = header.isEmpty() ? null : CraftChatMessage.fromString(header, true)[0]; - IChatBaseComponent footerComponent = footer.isEmpty() ? null : CraftChatMessage.fromString(footer, true)[0]; - - PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter(); - - Reflect reflect = ReflectionProvider.DEFAULT.getReflect("nmsPacketPlayOutPlayerListHeaderFooter"); - reflect.setFieldValue(packet, "header", headerComponent); - reflect.setFieldValue(packet, "footer", footerComponent); - - handle.playerConnection.sendPacket(packet); - } - - @Override - public void setTitleTimes(int fadeIn, int stay, int fadeOut) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TIMES, null, fadeIn, stay, fadeOut)); - } - - @Override - public void sendSubtitle(String text) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.SUBTITLE, CraftChatMessage.fromString(text)[0])); - } - - @Override - public void sendTitle(String text) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TITLE, CraftChatMessage.fromString(text)[0])); - } - - @Override - public void sendActionBar(String text) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutChat(CraftChatMessage.fromString(text)[0], (byte) 2)); - } - - @Override - public void fakeRespawn() { - if (handle.playerConnection.isDisconnected()) { - return; - } - PacketPlayOutPlayerInfo remInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER, handle); - PacketPlayOutPlayerInfo addInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.ADD_PLAYER, handle); - - PacketPlayOutEntityDestroy destroyPacket = new PacketPlayOutEntityDestroy(handle.getId()); - PacketPlayOutNamedEntitySpawn spawnPacket = new PacketPlayOutNamedEntitySpawn(handle); - PacketPlayOutEntityHeadRotation rotationPacket = new PacketPlayOutEntityHeadRotation(handle, - (byte) MathHelper.d(handle.getHeadRotation() * 256F / 360F)); - - ArrayList equipmentPackets = new ArrayList<>(); - for (EnumItemSlot slot : EnumItemSlot.values()) { - equipmentPackets.add(new PacketPlayOutEntityEquipment(handle.getId(), slot, handle.getEquipment(slot))); - } - - Player self = getBukkitPlayer(); - Player[] players = Players.getOnlineWithout(getUniqueId()); - for (Player player : players) { - if (!player.canSee(self)) { - continue; - } - PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection; - connection.sendPacket(remInfoPacket); - connection.sendPacket(addInfoPacket); - connection.sendPacket(destroyPacket); - connection.sendPacket(spawnPacket); - connection.sendPacket(rotationPacket); - for (PacketPlayOutEntityEquipment equipmentPacket : equipmentPackets) { - connection.sendPacket(equipmentPacket); - } - } - - WorldServer world = (WorldServer) handle.world; - - PacketPlayOutRespawn respawnPacket = new PacketPlayOutRespawn(handle.dimension, world.getDifficulty(), - handle.world.worldData.getType(), handle.playerInteractManager.getGameMode()); - PacketPlayOutPosition positionPacket = new PacketPlayOutPosition(handle.locX, handle.locY, handle.locZ, handle.yaw, handle.pitch, - Collections.emptySet(), 0); - PacketPlayOutHeldItemSlot itemPacket = new PacketPlayOutHeldItemSlot(handle.inventory.itemInHandIndex); - PacketPlayOutEntityStatus statusPacket = new PacketPlayOutEntityStatus(handle, (byte) 28); - PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); - - PlayerConnection connection = handle.playerConnection; - connection.sendPacket(remInfoPacket); - connection.sendPacket(addInfoPacket); - connection.sendPacket(respawnPacket); - connection.sendPacket(positionPacket); - connection.sendPacket(itemPacket); - connection.sendPacket(statusPacket); - connection.sendPacket(metadataPacket); - - handle.updateAbilities(); - handle.triggerHealthUpdate(); - handle.updateInventory(handle.defaultContainer); - if (handle.activeContainer != handle.defaultContainer) { - handle.updateInventory(handle.activeContainer); - } - self.recalculatePermissions(); - } - - @Override - public void respawn() { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayInClientCommand(EnumClientCommand.PERFORM_RESPAWN)); - } - - @Override - public void update() { - update(true); - } - - private final void update(boolean flag) { - PostAsync.forcePost(() -> { - realName = MojangProfileServer.getName(getUniqueId()); - realSkin = MojangProfileServer.getSkin(realName, getUniqueId()); - }); - if (flag) { - GameProfile profile = handle.getProfile(); - - Skin skin = getSkin(); - if (skin != null) { - PropertyMap properties = profile.getProperties(); - properties.removeAll("textures"); - properties.put("textures", new Property("textures", skin.getValue(), skin.getSignature())); - } - - String name = getName(); - if (name != null) { - ReflectionProvider.DEFAULT.getReflect("mjGameProfile").setFieldValue(profile, "name", name); - } - - if (!(name == null && skin == null)) { - fakeRespawn(); - } - } - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/reflection/NmsReflection1_9_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/reflection/NmsReflection1_9_R1.java deleted file mode 100644 index 2231ece..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/reflection/NmsReflection1_9_R1.java +++ /dev/null @@ -1,34 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R1.reflection; - -import net.minecraft.server.v1_9_R1.NBTTagEnd; -import net.minecraft.server.v1_9_R1.NBTTagList; -import net.minecraft.server.v1_9_R1.PacketPlayOutPlayerListHeaderFooter; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.Reflections; - -public class NmsReflection1_9_R1 extends Reflections { - - public static NmsReflection1_9_R1 INSTANCE = new NmsReflection1_9_R1(); - - private NmsReflection1_9_R1() {} - - @Override - public void setup(ReflectionProvider provider) { - - // - // - // Create Reflects - // - - // - // Minecraft - - provider.createReflect("nmsPacketPlayOutPlayerListHeaderFooter", PacketPlayOutPlayerListHeaderFooter.class) - .searchField("header", "a").searchField("header", "b"); - - provider.createReflect("nmsNBTTagEnd", NBTTagEnd.class); - provider.createReflect("nmsNBTTagList", NBTTagList.class).searchField("value", "list"); - - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/tools/BlockTools1_9_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/tools/BlockTools1_9_R1.java deleted file mode 100644 index b58f8be..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/tools/BlockTools1_9_R1.java +++ /dev/null @@ -1,39 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R1.tools; - -import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_9_R1.block.CraftSkull; - -import com.mojang.authlib.properties.Property; -import com.mojang.authlib.properties.PropertyMap; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; - -import net.minecraft.server.v1_9_R1.TileEntitySkull; -import net.sourcewriters.minecraft.vcompat.reflection.tools.BlockTools; -import net.sourcewriters.minecraft.vcompat.utils.constants.MinecraftConstants; - -public class BlockTools1_9_R1 extends BlockTools { - - private final AbstractReflect craftEntityStateRef = new Reflect(CraftSkull.class).searchField("tileEntity", "tileEntity"); - - @Override - public void setHeadTexture(Block block, String texture) { - if (!(block instanceof CraftSkull)) { - return; - } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); - PropertyMap map = entitySkull.getGameProfile().getProperties(); - map.removeAll("textures"); - map.put("textures", new Property("textures", MinecraftConstants.TEXTURE_SIGNATURE, texture)); - } - - @Override - public String getHeadTexture(Block block) { - if (!(block instanceof CraftSkull)) { - return null; - } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); - return entitySkull.getGameProfile().getProperties().get("textures").iterator().next().getValue(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/tools/ServerTools1_9_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/tools/ServerTools1_9_R1.java deleted file mode 100644 index 5cb6077..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/tools/ServerTools1_9_R1.java +++ /dev/null @@ -1,26 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R1.tools; - -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_9_R1.CraftServer; - -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R1.wrapper.ConsoleReaderWrapper1_9_R1; -import net.sourcewriters.minecraft.vcompat.reflection.tools.ServerTools; - -public class ServerTools1_9_R1 extends ServerTools { - - @Override - public void setMotd(String text) { - ((CraftServer) Bukkit.getServer()).getServer().setMotd(text); - } - - @Override - public String getMotd() { - return ((CraftServer) Bukkit.getServer()).getServer().getMotd(); - } - - @Override - public ConsoleReaderWrapper1_9_R1 getConsole() { - return ConsoleReaderWrapper1_9_R1.INSTANCE; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/tools/SkinTools1_9_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/tools/SkinTools1_9_R1.java deleted file mode 100644 index 89b55cb..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/tools/SkinTools1_9_R1.java +++ /dev/null @@ -1,16 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R1.tools; - -import org.bukkit.craftbukkit.v1_9_R1.entity.CraftPlayer; -import org.bukkit.entity.Player; - -import net.sourcewriters.minecraft.vcompat.reflection.tools.SkinTools; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; - -public class SkinTools1_9_R1 extends SkinTools { - - @Override - public Skin skinFromPlayer(Player player) { - return skinFromGameProfile(((CraftPlayer) player).getHandle().getProfile()); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/utils/EntityConstructors1_9_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/utils/EntityConstructors1_9_R1.java deleted file mode 100644 index 2a37191..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/utils/EntityConstructors1_9_R1.java +++ /dev/null @@ -1,12 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R1.utils; - -import java.util.function.Function; - -import net.minecraft.server.v1_9_R1.World; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R1.entity.ArmorStand1_9_R1; - -public abstract class EntityConstructors1_9_R1 { - - public static final Function ARMOR_STAND = (world -> new ArmorStand1_9_R1(world)); - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/wrapper/ConsoleReaderWrapper1_9_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/wrapper/ConsoleReaderWrapper1_9_R1.java deleted file mode 100644 index 56ba4de..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/wrapper/ConsoleReaderWrapper1_9_R1.java +++ /dev/null @@ -1,43 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R1.wrapper; - -import java.io.IOException; -import java.io.Writer; - -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_9_R1.CraftServer; -import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; - -import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; - -public final class ConsoleReaderWrapper1_9_R1 extends ConsoleReaderWrapper { - - public static final ConsoleReaderWrapper1_9_R1 INSTANCE = new ConsoleReaderWrapper1_9_R1(); - - private final ConsoleReader reader; - - @SuppressWarnings("resource") - private ConsoleReaderWrapper1_9_R1() { - this.reader = ((CraftServer) Bukkit.getServer()).getServer().reader; - } - - @Override - public Writer getOutput() { - return reader.getOutput(); - } - - @Override - public boolean isAnsiSupported() { - return reader.getTerminal().isAnsiSupported(); - } - - @Override - public void flush() throws IOException { - reader.flush(); - } - - @Override - public void drawLine() throws IOException { - reader.drawLine(); - } - -} diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/BukkitConversion1_9_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/BukkitConversion1_9_R2.java deleted file mode 100644 index 6c1c9f0..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/BukkitConversion1_9_R2.java +++ /dev/null @@ -1,231 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R2; - -import java.util.List; -import java.util.Set; - -import org.bukkit.craftbukkit.v1_9_R2.inventory.CraftItemStack; -import org.bukkit.entity.EntityType; - -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.nbt.NbtByte; -import com.syntaxphoenix.syntaxapi.nbt.NbtByteArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; -import com.syntaxphoenix.syntaxapi.nbt.NbtDouble; -import com.syntaxphoenix.syntaxapi.nbt.NbtEnd; -import com.syntaxphoenix.syntaxapi.nbt.NbtFloat; -import com.syntaxphoenix.syntaxapi.nbt.NbtInt; -import com.syntaxphoenix.syntaxapi.nbt.NbtIntArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtList; -import com.syntaxphoenix.syntaxapi.nbt.NbtLong; -import com.syntaxphoenix.syntaxapi.nbt.NbtLongArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtShort; -import com.syntaxphoenix.syntaxapi.nbt.NbtString; -import com.syntaxphoenix.syntaxapi.nbt.NbtTag; -import com.syntaxphoenix.syntaxapi.nbt.NbtType; - -import net.minecraft.server.v1_9_R2.ItemStack; -import net.minecraft.server.v1_9_R2.NBTBase; -import net.minecraft.server.v1_9_R2.NBTTagByte; -import net.minecraft.server.v1_9_R2.NBTTagByteArray; -import net.minecraft.server.v1_9_R2.NBTTagCompound; -import net.minecraft.server.v1_9_R2.NBTTagDouble; -import net.minecraft.server.v1_9_R2.NBTTagEnd; -import net.minecraft.server.v1_9_R2.NBTTagFloat; -import net.minecraft.server.v1_9_R2.NBTTagInt; -import net.minecraft.server.v1_9_R2.NBTTagIntArray; -import net.minecraft.server.v1_9_R2.NBTTagList; -import net.minecraft.server.v1_9_R2.NBTTagLong; -import net.minecraft.server.v1_9_R2.NBTTagShort; -import net.minecraft.server.v1_9_R2.NBTTagString; -import net.sourcewriters.minecraft.vcompat.reflection.BukkitConversion; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContext; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleWrapType; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; - -public class BukkitConversion1_9_R2 extends BukkitConversion { - - protected BukkitConversion1_9_R2(VersionControl1_9_R2 versionControl) { - super(versionControl); - } - - @Override - public EntityType toEntityType(NmsEntityType type) { - try { - return EntityType.valueOf(type.name()); - } catch (IllegalArgumentException ignore) { - return null; - } - } - - @Override - public NmsEntityType fromEntityType(EntityType type) { - try { - return NmsEntityType.valueOf(type.name()); - } catch (IllegalArgumentException ignore) { - return null; - } - } - - @Override - public NBTBase toMinecraftTag(NbtTag tag) { - switch (tag.getType()) { - case BYTE: - return new NBTTagByte((byte) tag.getValue()); - case SHORT: - return new NBTTagShort((short) tag.getValue()); - case INT: - return new NBTTagInt((int) tag.getValue()); - case LONG: - return new NBTTagLong((long) tag.getValue()); - case FLOAT: - return new NBTTagFloat((float) tag.getValue()); - case DOUBLE: - return new NBTTagDouble((double) tag.getValue()); - case STRING: - return new NBTTagString((String) tag.getValue()); - case BYTE_ARRAY: - return new NBTTagByteArray((byte[]) tag.getValue()); - case INT_ARRAY: - return new NBTTagIntArray((int[]) tag.getValue()); - case LONG_ARRAY: - NBTTagList list = new NBTTagList(); - for (long value : (long[]) tag.getValue()) { - list.add(new NBTTagLong(value)); - } - return list; - case LIST: - return toMinecraftList((NbtList) tag); - case COMPOUND: - return toMinecraftCompound((NbtCompound) tag); - case END: - return (NBTTagEnd) ReflectionProvider.DEFAULT.getReflect("nmsNBTTagEnd").init(); - default: - return null; - } - } - - @Override - public NbtTag fromMinecraftTag(Object raw) { - if (!(raw instanceof NBTBase)) { - return null; - } - NBTBase tag = (NBTBase) raw; - NbtType type = NbtType.getById(tag.getTypeId()); - switch (type) { - case BYTE: - return new NbtByte(((NBTTagByte) tag).f()); - case SHORT: - return new NbtShort(((NBTTagShort) tag).e()); - case INT: - return new NbtInt(((NBTTagInt) tag).d()); - case LONG: - return new NbtLong(((NBTTagLong) tag).c()); - case FLOAT: - return new NbtFloat(((NBTTagFloat) tag).h()); - case DOUBLE: - return new NbtDouble(((NBTTagDouble) tag).g()); - case STRING: - return new NbtString(((NBTTagString) tag).a_()); - case BYTE_ARRAY: - return new NbtByteArray(((NBTTagByteArray) tag).c()); - case INT_ARRAY: - return new NbtIntArray(((NBTTagIntArray) tag).c()); - case LONG_ARRAY: - return new NbtLongArray(new long[0]); - case LIST: - return fromMinecraftList(tag); - case COMPOUND: - return fromMinecraftCompound(tag); - case END: - return NbtEnd.INSTANCE; - default: - return null; - } - } - - @Override - public NBTTagList toMinecraftList(NbtList list) { - NBTTagList output = new NBTTagList(); - for (NbtTag tag : list) { - output.add(toMinecraftTag(tag)); - } - return output; - } - - @SuppressWarnings("unchecked") - @Override - public NbtList fromMinecraftList(Object raw) { - if (!(raw instanceof NBTTagList)) { - return null; - } - NBTTagList list = (NBTTagList) raw; - List content = (List) ReflectionProvider.DEFAULT.getReflect("nmsNBTTagList").getFieldValue("value", list); - NbtList output = new NbtList<>(NbtType.getById(list.getTypeId())); - for (NBTBase base : content) { - output.add(fromMinecraftTag(base)); - } - return output; - } - - @Override - public NBTTagCompound toMinecraftCompound(NbtCompound compound) { - NBTTagCompound output = new NBTTagCompound(); - if (compound.isEmpty()) { - return output; - } - Set keys = compound.getKeys(); - for (String key : keys) { - output.set(key, toMinecraftTag(compound.get(key))); - } - return output; - } - - @Override - public NbtCompound fromMinecraftCompound(Object raw) { - if (!(raw instanceof NBTTagCompound)) { - return null; - } - NBTTagCompound compound = (NBTTagCompound) raw; - NbtCompound output = new NbtCompound(); - if (compound.isEmpty()) { - return output; - } - Set keys = compound.c(); - for (String key : keys) { - output.set(key, fromMinecraftTag(compound.get(key))); - } - return output; - } - - @Override - public org.bukkit.inventory.ItemStack itemFromCompound(NbtCompound compound) { - return CraftItemStack.asBukkitCopy(ItemStack.createStack(toMinecraftCompound(compound))); - } - - @Override - public NbtCompound itemToCompound(org.bukkit.inventory.ItemStack itemStack) { - ItemStack nmsStack = CraftItemStack.asNMSCopy(itemStack); - NBTTagCompound stackTag; - if (!nmsStack.hasTag()) { - stackTag = nmsStack.save(new NBTTagCompound()); - } else { - stackTag = nmsStack.getTag(); - } - return fromMinecraftCompound(stackTag); - } - - @Override - public WrappedContext createContext(DataAdapterContext context) { - return new SimpleSyntaxContext(context); - } - - @Override - public WrapType wrap(DataType dataType) { - return new SimpleWrapType(dataType); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/EntityProvider1_9_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/EntityProvider1_9_R2.java deleted file mode 100644 index f39370b..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/EntityProvider1_9_R2.java +++ /dev/null @@ -1,47 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R2; - -import java.util.EnumMap; -import java.util.function.Function; - -import org.bukkit.craftbukkit.v1_9_R2.CraftWorld; - -import net.minecraft.server.v1_9_R2.World; -import net.sourcewriters.minecraft.vcompat.reflection.EntityProvider; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R2.utils.EntityConstructors1_9_R2; - -public class EntityProvider1_9_R2 extends EntityProvider { - - private final EnumMap> entityMap = new EnumMap<>(NmsEntityType.class); - - protected EntityProvider1_9_R2(VersionControl1_9_R2 versionControl) { - super(versionControl); - } - - @SuppressWarnings("unchecked") - private final Function searchConstructor(NmsEntityType type) { - try { - return (Function) EntityConstructors1_9_R2.class.getField(type.name()).get(null); - } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException ignore) { - return null; - } - } - - private final Function getConstructor(NmsEntityType type) { - return entityMap.computeIfAbsent(type, (key -> searchConstructor(key))); - } - - @Override - public NmsEntity createEntity(org.bukkit.World world, NmsEntityType type) { - if (!(world instanceof CraftWorld)) { - return null; - } - Function function; - if ((function = getConstructor(type)) == null) { - return null; - } - return function.apply(((CraftWorld) world).getHandle()); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/PacketHandler1_9_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/PacketHandler1_9_R2.java deleted file mode 100644 index 744764f..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/PacketHandler1_9_R2.java +++ /dev/null @@ -1,11 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R2; - -import net.sourcewriters.minecraft.vcompat.reflection.PacketHandler; - -public class PacketHandler1_9_R2 extends PacketHandler { - - protected PacketHandler1_9_R2(VersionControl1_9_R2 versionControl) { - super(versionControl); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/PlayerProvider1_9_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/PlayerProvider1_9_R2.java deleted file mode 100644 index 63e7c8b..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/PlayerProvider1_9_R2.java +++ /dev/null @@ -1,30 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R2; - -import java.io.File; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; - -import net.sourcewriters.minecraft.vcompat.reflection.DataProvider; -import net.sourcewriters.minecraft.vcompat.reflection.PlayerProvider; -import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.DataDistributor; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R2.entity.Player1_9_R2; - -public class PlayerProvider1_9_R2 extends PlayerProvider { - - private final DataDistributor distributor; - - protected PlayerProvider1_9_R2(VersionControl1_9_R2 versionControl) { - super(versionControl); - distributor = versionControl.getDataProvider().createDistributor(new File(Bukkit.getWorlds().get(0).getWorldFolder(), "playerdata"), - uuid -> "custom_" + uuid.toString(), DataProvider.DEFAULT_RANDOM); - } - - @Override - protected NmsPlayer createPlayer(Player player) { - return new Player1_9_R2(player, distributor.get(player.getUniqueId())); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/TextureProvider1_9_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/TextureProvider1_9_R2.java deleted file mode 100644 index 4802206..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/TextureProvider1_9_R2.java +++ /dev/null @@ -1,105 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R2; - -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_9_R2.block.CraftSkull; -import org.bukkit.craftbukkit.v1_9_R2.inventory.CraftItemStack; -import org.bukkit.inventory.meta.ItemMeta; -import org.bukkit.inventory.meta.SkullMeta; -import org.bukkit.material.MaterialData; - -import com.mojang.authlib.GameProfile; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; - -import net.minecraft.server.v1_9_R2.GameProfileSerializer; -import net.minecraft.server.v1_9_R2.ItemStack; -import net.minecraft.server.v1_9_R2.NBTTagCompound; -import net.sourcewriters.minecraft.vcompat.reflection.TextureProvider; - -@SuppressWarnings("deprecation") -public class TextureProvider1_9_R2 extends TextureProvider { - - private final AbstractReflect craftItemStackRef = new Reflect(CraftItemStack.class).searchField("handle", "handle"); - private final AbstractReflect craftMetaSkullRef = new Reflect("org.bukkit.craftbukkit.v1_9_R2.inventory.CraftMetaSkull") - .searchField("serialized", "serializedProfile").searchField("profile", "profile"); - private final Material skullMaterial = Material.valueOf("SKULL"); - - protected TextureProvider1_9_R2(VersionControl1_9_R2 versionControl) { - super(versionControl); - } - - @Override - public GameProfile profileFromBlock(Block block) { - if (!(block instanceof CraftSkull)) { - return null; - } - return ((CraftSkull) block).getTileEntity().getGameProfile(); - } - - @Override - public GameProfile profileFromItem(org.bukkit.inventory.ItemStack itemStack) { - if (!(itemStack.getItemMeta() instanceof SkullMeta)) { - return null; - } - SkullMeta meta = (SkullMeta) itemStack.getItemMeta(); - GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue("profile", meta); - if (profile == null) { - NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue("serialized", meta); - if (compound == null) { - ItemStack stack = null; - if (itemStack instanceof CraftItemStack) { - stack = (ItemStack) craftItemStackRef.getFieldValue("handle", itemStack); - } - if (stack == null) { - stack = CraftItemStack.asNMSCopy(itemStack); - } - NBTTagCompound stackTag; - if (!stack.hasTag()) { - stackTag = stack.save(new NBTTagCompound()); - } else { - stackTag = stack.getTag(); - } - if (stackTag.hasKeyOfType("SkullOwner", 10)) { - compound = stackTag.getCompound("SkullOwner"); - } else if (stackTag.hasKeyOfType("SkullProfile", 10)) { - compound = stackTag.getCompound("SkullProfile"); - } - } - if (compound == null) { - return null; - } - profile = GameProfileSerializer.deserialize(compound); - } - return profile; - } - - @Override - public org.bukkit.inventory.ItemStack getItem(GameProfile profile) { - org.bukkit.inventory.ItemStack craftStack = CraftItemStack.asCraftCopy(new MaterialData(skullMaterial, (byte) 3).toItemStack(1)); - applyItem(craftStack, profile); - return craftStack; - } - - @Override - public boolean applyItem(org.bukkit.inventory.ItemStack itemStack, GameProfile profile) { - ItemMeta meta = itemStack.getItemMeta(); - if (!(meta instanceof SkullMeta)) { - return false; - } - SkullMeta skullMeta = (SkullMeta) meta; - craftMetaSkullRef.setFieldValue(meta, "profile", profile); - itemStack.setItemMeta(skullMeta); - return true; - } - - @Override - public boolean applyBlock(Block block, GameProfile profile) { - if (!(block instanceof CraftSkull)) { - return false; - } - ((CraftSkull) block).getTileEntity().setGameProfile(profile); - return true; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/ToolProvider1_9_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/ToolProvider1_9_R2.java deleted file mode 100644 index ab2945f..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/ToolProvider1_9_R2.java +++ /dev/null @@ -1,33 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R2; - -import net.sourcewriters.minecraft.vcompat.reflection.ToolProvider; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R2.tools.BlockTools1_9_R2; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R2.tools.ServerTools1_9_R2; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R2.tools.SkinTools1_9_R2; - -public class ToolProvider1_9_R2 extends ToolProvider { - - private final BlockTools1_9_R2 blockTools = new BlockTools1_9_R2(); - private final SkinTools1_9_R2 skinTools = new SkinTools1_9_R2(); - private final ServerTools1_9_R2 serverTools = new ServerTools1_9_R2(); - - protected ToolProvider1_9_R2(VersionControl1_9_R2 versionControl) { - super(versionControl); - } - - @Override - public SkinTools1_9_R2 getSkinTools() { - return skinTools; - } - - @Override - public ServerTools1_9_R2 getServerTools() { - return serverTools; - } - - @Override - public BlockTools1_9_R2 getBlockTools() { - return blockTools; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/VersionControl1_9_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/VersionControl1_9_R2.java deleted file mode 100644 index 9441d2a..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/VersionControl1_9_R2.java +++ /dev/null @@ -1,56 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R2; - -import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R2.reflection.NmsReflection1_9_R2; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; - -public class VersionControl1_9_R2 extends VersionControl { - - public static VersionControl1_9_R2 INSTANCE; - - public static VersionControl1_9_R2 init() { - return INSTANCE != null ? INSTANCE : (INSTANCE = new VersionControl1_9_R2()); - } - - private final ToolProvider1_9_R2 toolProvider = new ToolProvider1_9_R2(this); - private final TextureProvider1_9_R2 textureProvider = new TextureProvider1_9_R2(this); - private final PacketHandler1_9_R2 packetHandler = new PacketHandler1_9_R2(this); - private final EntityProvider1_9_R2 entityProvider = new EntityProvider1_9_R2(this); - private final PlayerProvider1_9_R2 playerProvider = new PlayerProvider1_9_R2(this); - private final BukkitConversion1_9_R2 bukkitConversion = new BukkitConversion1_9_R2(this); - - private VersionControl1_9_R2() { - NmsReflection1_9_R2.INSTANCE.setup(ReflectionProvider.DEFAULT); - } - - @Override - public ToolProvider1_9_R2 getToolProvider() { - return toolProvider; - } - - @Override - public EntityProvider1_9_R2 getEntityProvider() { - return entityProvider; - } - - @Override - public PlayerProvider1_9_R2 getPlayerProvider() { - return playerProvider; - } - - @Override - public TextureProvider1_9_R2 getTextureProvider() { - return textureProvider; - } - - @Override - public PacketHandler1_9_R2 getPacketHandler() { - return packetHandler; - } - - @Override - public BukkitConversion1_9_R2 getBukkitConversion() { - return bukkitConversion; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/entity/ArmorStand1_9_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/entity/ArmorStand1_9_R2.java deleted file mode 100644 index b67b339..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/entity/ArmorStand1_9_R2.java +++ /dev/null @@ -1,33 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R2.entity; - -import net.minecraft.server.v1_9_R2.EntityArmorStand; -import net.minecraft.server.v1_9_R2.World; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsArmorStand; - -public class ArmorStand1_9_R2 extends EntityLiving1_9_R2 implements NmsArmorStand { - - public ArmorStand1_9_R2(World world) { - super(new EntityArmorStand(world)); - } - - @Override - public boolean hasGravity() { - return handle.hasGravity(); - } - - @Override - public void setGravity(boolean gravity) { - handle.setGravity(gravity); - } - - @Override - public void setSmall(boolean small) { - handle.setSmall(small); - } - - @Override - public boolean isSmall() { - return handle.isSmall(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/entity/Entity1_9_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/entity/Entity1_9_R2.java deleted file mode 100644 index 0deb812..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/entity/Entity1_9_R2.java +++ /dev/null @@ -1,213 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R2.entity; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.OfflinePlayer; -import org.bukkit.craftbukkit.v1_9_R2.CraftWorld; -import org.bukkit.craftbukkit.v1_9_R2.entity.CraftPlayer; -import org.bukkit.entity.Player; - -import net.minecraft.server.v1_9_R2.AxisAlignedBB; -import net.minecraft.server.v1_9_R2.Entity; -import net.minecraft.server.v1_9_R2.EntityTypes; -import net.minecraft.server.v1_9_R2.PacketPlayOutEntityDestroy; -import net.minecraft.server.v1_9_R2.PacketPlayOutEntityMetadata; -import net.minecraft.server.v1_9_R2.PacketPlayOutSpawnEntity; -import net.minecraft.server.v1_9_R2.PlayerConnection; -import net.minecraft.server.v1_9_R2.Vec3D; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.utils.NmsBoundingBox; - -public abstract class Entity1_9_R2 implements NmsEntity { - - protected final E handle; - - protected final List visible = Collections.synchronizedList(new ArrayList<>()); - - public Entity1_9_R2(E handle) { - this.handle = handle; - } - - @Override - public final E getHandle() { - return handle; - } - - @Override - public int getId() { - return handle.getId(); - } - - @Override - public UUID getUniqueId() { - return handle.getUniqueID(); - } - - @Override - public NmsBoundingBox getBoundingBox() { - AxisAlignedBB box = handle.getBoundingBox(); - return new NmsBoundingBox(box.a, box.b, box.c, box.d, box.e, box.f); - } - - @Override - public void setCustomName(String name) { - handle.setCustomName(name); - updateVisibility(); - } - - @Override - public String getCustomName() { - return handle.getCustomName(); - } - - @Override - public void setCustomNameVisible(boolean visible) { - handle.setCustomNameVisible(visible); - } - - @Override - public boolean isCustomNameVisible() { - return handle.getCustomNameVisible(); - } - - @Override - public void setInvisible(boolean invisible) { - handle.setInvisible(invisible); - } - - @Override - public boolean isInvisible() { - return handle.isInvisible(); - } - - @Override - public boolean isInteractable() { - return handle.isInteractable(); - } - - @Override - public boolean isCollidable() { - return handle.isCollidable(); - } - - @Override - public void setInvulnerable(boolean invulnerable) { - handle.setInvulnerable(invulnerable); - } - - @Override - public boolean isInvulnerable() { - return handle.isInvulnerable(null); - } - - @Override - public boolean hasGravity() { - return true; - } - - @Override - public void setGravity(boolean gravity) {} - - @Override - public void setLocation(Location location) { - handle.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); - if (location.getWorld() == null || handle.getWorld().getWorld() == location.getWorld()) { - updateVisibility(); - return; - } - handle.world = ((CraftWorld) location.getWorld()).getHandle(); - updateVisibility(); - } - - @Override - public Location getLocation() { - Vec3D vector = handle.d(); - return new Location(handle.getWorld().getWorld(), vector.x, vector.y, vector.z); - } - - @Override - public void updateVisibility() { - if (visible.isEmpty()) { - return; - } - Player[] players; - synchronized (visible) { - players = visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) - .toArray(Player[]::new); - } - hide(players); - show(players); - } - - @Override - public boolean isShown(Player player) { - synchronized (visible) { - return visible.contains(player.getUniqueId()); - } - } - - @Override - public void hide(Player... players) { - if (players.length == 0) { - return; - } - PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(handle.getId()); - for (Player player : players) { - if (!isShown(player)) { - continue; - } - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); - synchronized (visible) { - visible.remove(player.getUniqueId()); - } - } - } - - @Override - public void show(Player... players) { - if (players.length == 0) { - return; - } - PacketPlayOutSpawnEntity packet = new PacketPlayOutSpawnEntity(handle, EntityTypes.a(handle)); - PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); - PlayerConnection connection; - for (Player player : players) { - if (isShown(player)) { - continue; - } - connection = ((CraftPlayer) player).getHandle().playerConnection; - connection.sendPacket(packet); - connection.sendPacket(metadataPacket); - synchronized (visible) { - visible.add(player.getUniqueId()); - } - } - } - - @Override - public UUID[] getVisible() { - synchronized (visible) { - return visible.toArray(new UUID[0]); - } - } - - @Override - public Player[] getVisibleAsPlayer() { - synchronized (visible) { - return visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) - .toArray(Player[]::new); - } - } - - @Override - public void kill() { - hide(getVisibleAsPlayer()); - handle.die(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/entity/EntityLiving1_9_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/entity/EntityLiving1_9_R2.java deleted file mode 100644 index 06d038e..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/entity/EntityLiving1_9_R2.java +++ /dev/null @@ -1,17 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R2.entity; - -import net.minecraft.server.v1_9_R2.EntityLiving; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityLiving; - -public abstract class EntityLiving1_9_R2 extends Entity1_9_R2 implements NmsEntityLiving { - - public EntityLiving1_9_R2(E handle) { - super(handle); - } - - @Override - public void setCollidable(boolean collidable) { - handle.collides = collidable; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/entity/Player1_9_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/entity/Player1_9_R2.java deleted file mode 100644 index 9847e96..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/entity/Player1_9_R2.java +++ /dev/null @@ -1,296 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R2.entity; - -import java.util.ArrayList; -import java.util.Collections; - -import org.bukkit.craftbukkit.v1_9_R2.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_9_R2.util.CraftChatMessage; -import org.bukkit.entity.Player; - -import com.mojang.authlib.GameProfile; -import com.mojang.authlib.properties.Property; -import com.mojang.authlib.properties.PropertyMap; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; - -import net.minecraft.server.v1_9_R2.EntityPlayer; -import net.minecraft.server.v1_9_R2.EnumItemSlot; -import net.minecraft.server.v1_9_R2.IChatBaseComponent; -import net.minecraft.server.v1_9_R2.MathHelper; -import net.minecraft.server.v1_9_R2.PacketPlayInClientCommand; -import net.minecraft.server.v1_9_R2.PacketPlayInClientCommand.EnumClientCommand; -import net.minecraft.server.v1_9_R2.PacketPlayOutChat; -import net.minecraft.server.v1_9_R2.PacketPlayOutEntityDestroy; -import net.minecraft.server.v1_9_R2.PacketPlayOutEntityEquipment; -import net.minecraft.server.v1_9_R2.PacketPlayOutEntityHeadRotation; -import net.minecraft.server.v1_9_R2.PacketPlayOutEntityMetadata; -import net.minecraft.server.v1_9_R2.PacketPlayOutEntityStatus; -import net.minecraft.server.v1_9_R2.PacketPlayOutHeldItemSlot; -import net.minecraft.server.v1_9_R2.PacketPlayOutNamedEntitySpawn; -import net.minecraft.server.v1_9_R2.PacketPlayOutPlayerInfo; -import net.minecraft.server.v1_9_R2.PacketPlayOutPlayerInfo.EnumPlayerInfoAction; -import net.minecraft.server.v1_9_R2.PacketPlayOutPlayerListHeaderFooter; -import net.minecraft.server.v1_9_R2.PacketPlayOutPosition; -import net.minecraft.server.v1_9_R2.PacketPlayOutRespawn; -import net.minecraft.server.v1_9_R2.PacketPlayOutTitle; -import net.minecraft.server.v1_9_R2.PacketPlayOutTitle.EnumTitleAction; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.PersistentContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.type.SkinDataType; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContainer; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; -import net.sourcewriters.minecraft.vcompat.utils.bukkit.Players; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.MojangProfileServer; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; -import net.sourcewriters.minecraft.vcompat.utils.thread.PostAsync; -import net.minecraft.server.v1_9_R2.PlayerConnection; -import net.minecraft.server.v1_9_R2.WorldServer; - -public class Player1_9_R2 extends EntityLiving1_9_R2 implements NmsPlayer { - - private String realName; - private Skin realSkin; - - private final WrappedContainer dataAdapter; - - public Player1_9_R2(Player player, PersistentContainer container) { - super(((CraftPlayer) player).getHandle()); - this.dataAdapter = new SimpleSyntaxContainer<>(container); - update(false); - } - - @Override - public CraftPlayer getBukkitPlayer() { - return handle.getBukkitEntity(); - } - - @Override - public WrappedContainer getDataAdapter() { - return dataAdapter; - } - - @Override - public void setSkin(Skin skin) { - if (skin == null || getSkin().equals(skin)) { - return; - } - getDataAdapter().set("skin", skin, SkinDataType.WRAPPED_INSTANCE); - } - - @Override - public Skin getSkin() { - return dataAdapter.getOrDefault("skin", SkinDataType.WRAPPED_INSTANCE, realSkin); - } - - @Override - public Skin getRealSkin() { - return realSkin; - } - - @Override - public void setName(String name) { - if (getName().equals(name)) { - return; - } - if (name == null) { - getDataAdapter().remove("name"); - return; - } - getDataAdapter().set("name", name, WrapType.STRING); - } - - @Override - public String getName() { - return getDataAdapter().getOrDefault("name", WrapType.STRING, realName); - } - - @Override - public String getRealName() { - return realName; - } - - @Override - public void setPlayerListHeader(String text) { - setPlayerListHeaderAndFooter(text, getPlayerListFooter()); - } - - @Override - public String getPlayerListHeader() { - return getDataAdapter().getOrDefault("header", WrapType.STRING, ""); - } - - @Override - public void setPlayerListFooter(String text) { - setPlayerListHeaderAndFooter(getPlayerListHeader(), text); - } - - @Override - public String getPlayerListFooter() { - return getDataAdapter().getOrDefault("footer", WrapType.STRING, ""); - } - - @Override - public int getPing() { - return handle.ping; - } - - @Override - public void setPlayerListHeaderAndFooter(String header, String footer) { - getDataAdapter().set("header", header, WrapType.STRING); - getDataAdapter().set("footer", footer, WrapType.STRING); - sendPlayerListInfo(header, footer); - } - - private final void sendPlayerListInfo(String header, String footer) { - if (handle.playerConnection.isDisconnected()) { - return; - } - - IChatBaseComponent headerComponent = header.isEmpty() ? null : CraftChatMessage.fromString(header, true)[0]; - IChatBaseComponent footerComponent = footer.isEmpty() ? null : CraftChatMessage.fromString(footer, true)[0]; - - PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter(); - - Reflect reflect = ReflectionProvider.DEFAULT.getReflect("nmsPacketPlayOutPlayerListHeaderFooter"); - reflect.setFieldValue(packet, "header", headerComponent); - reflect.setFieldValue(packet, "footer", footerComponent); - - handle.playerConnection.sendPacket(packet); - } - - @Override - public void setTitleTimes(int fadeIn, int stay, int fadeOut) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TIMES, null, fadeIn, stay, fadeOut)); - } - - @Override - public void sendSubtitle(String text) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.SUBTITLE, CraftChatMessage.fromString(text)[0])); - } - - @Override - public void sendTitle(String text) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TITLE, CraftChatMessage.fromString(text)[0])); - } - - @Override - public void sendActionBar(String text) { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayOutChat(CraftChatMessage.fromString(text)[0], (byte) 2)); - } - - @Override - public void fakeRespawn() { - if (handle.playerConnection.isDisconnected()) { - return; - } - PacketPlayOutPlayerInfo remInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER, handle); - PacketPlayOutPlayerInfo addInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.ADD_PLAYER, handle); - - PacketPlayOutEntityDestroy destroyPacket = new PacketPlayOutEntityDestroy(handle.getId()); - PacketPlayOutNamedEntitySpawn spawnPacket = new PacketPlayOutNamedEntitySpawn(handle); - PacketPlayOutEntityHeadRotation rotationPacket = new PacketPlayOutEntityHeadRotation(handle, - (byte) MathHelper.d(handle.getHeadRotation() * 256F / 360F)); - - ArrayList equipmentPackets = new ArrayList<>(); - for (EnumItemSlot slot : EnumItemSlot.values()) { - equipmentPackets.add(new PacketPlayOutEntityEquipment(handle.getId(), slot, handle.getEquipment(slot))); - } - - Player self = getBukkitPlayer(); - Player[] players = Players.getOnlineWithout(getUniqueId()); - for (Player player : players) { - if (!player.canSee(self)) { - continue; - } - PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection; - connection.sendPacket(remInfoPacket); - connection.sendPacket(addInfoPacket); - connection.sendPacket(destroyPacket); - connection.sendPacket(spawnPacket); - connection.sendPacket(rotationPacket); - for (PacketPlayOutEntityEquipment equipmentPacket : equipmentPackets) { - connection.sendPacket(equipmentPacket); - } - } - - WorldServer world = (WorldServer) handle.world; - - PacketPlayOutRespawn respawnPacket = new PacketPlayOutRespawn(handle.dimension, world.getDifficulty(), - handle.world.worldData.getType(), handle.playerInteractManager.getGameMode()); - PacketPlayOutPosition positionPacket = new PacketPlayOutPosition(handle.locX, handle.locY, handle.locZ, handle.yaw, handle.pitch, - Collections.emptySet(), 0); - PacketPlayOutHeldItemSlot itemPacket = new PacketPlayOutHeldItemSlot(handle.inventory.itemInHandIndex); - PacketPlayOutEntityStatus statusPacket = new PacketPlayOutEntityStatus(handle, (byte) 28); - PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); - - PlayerConnection connection = handle.playerConnection; - connection.sendPacket(remInfoPacket); - connection.sendPacket(addInfoPacket); - connection.sendPacket(respawnPacket); - connection.sendPacket(positionPacket); - connection.sendPacket(itemPacket); - connection.sendPacket(statusPacket); - connection.sendPacket(metadataPacket); - - handle.updateAbilities(); - handle.triggerHealthUpdate(); - handle.updateInventory(handle.defaultContainer); - if (handle.activeContainer != handle.defaultContainer) { - handle.updateInventory(handle.activeContainer); - } - self.recalculatePermissions(); - } - - @Override - public void respawn() { - if (handle.playerConnection.isDisconnected()) { - return; - } - handle.playerConnection.sendPacket(new PacketPlayInClientCommand(EnumClientCommand.PERFORM_RESPAWN)); - } - - @Override - public void update() { - update(true); - } - - private final void update(boolean flag) { - PostAsync.forcePost(() -> { - realName = MojangProfileServer.getName(getUniqueId()); - realSkin = MojangProfileServer.getSkin(realName, getUniqueId()); - }); - if (flag) { - GameProfile profile = handle.getProfile(); - - Skin skin = getSkin(); - if (skin != null) { - PropertyMap properties = profile.getProperties(); - properties.removeAll("textures"); - properties.put("textures", new Property("textures", skin.getValue(), skin.getSignature())); - } - - String name = getName(); - if (name != null) { - ReflectionProvider.DEFAULT.getReflect("mjGameProfile").setFieldValue(profile, "name", name); - } - - if (!(name == null && skin == null)) { - fakeRespawn(); - } - } - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/reflection/NmsReflection1_9_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/reflection/NmsReflection1_9_R2.java deleted file mode 100644 index 4df52a7..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/reflection/NmsReflection1_9_R2.java +++ /dev/null @@ -1,34 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R2.reflection; - -import net.minecraft.server.v1_9_R2.NBTTagEnd; -import net.minecraft.server.v1_9_R2.NBTTagList; -import net.minecraft.server.v1_9_R2.PacketPlayOutPlayerListHeaderFooter; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.Reflections; - -public class NmsReflection1_9_R2 extends Reflections { - - public static NmsReflection1_9_R2 INSTANCE = new NmsReflection1_9_R2(); - - private NmsReflection1_9_R2() {} - - @Override - public void setup(ReflectionProvider provider) { - - // - // - // Create Reflects - // - - // - // Minecraft - - provider.createReflect("nmsPacketPlayOutPlayerListHeaderFooter", PacketPlayOutPlayerListHeaderFooter.class) - .searchField("header", "a").searchField("header", "b"); - - provider.createReflect("nmsNBTTagEnd", NBTTagEnd.class); - provider.createReflect("nmsNBTTagList", NBTTagList.class).searchField("value", "list"); - - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/tools/BlockTools1_9_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/tools/BlockTools1_9_R2.java deleted file mode 100644 index cd0bb32..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/tools/BlockTools1_9_R2.java +++ /dev/null @@ -1,39 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R2.tools; - -import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_9_R2.block.CraftSkull; - -import com.mojang.authlib.properties.Property; -import com.mojang.authlib.properties.PropertyMap; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; - -import net.minecraft.server.v1_9_R2.TileEntitySkull; -import net.sourcewriters.minecraft.vcompat.reflection.tools.BlockTools; -import net.sourcewriters.minecraft.vcompat.utils.constants.MinecraftConstants; - -public class BlockTools1_9_R2 extends BlockTools { - - private final AbstractReflect craftEntityStateRef = new Reflect(CraftSkull.class).searchField("tileEntity", "tileEntity"); - - @Override - public void setHeadTexture(Block block, String texture) { - if (!(block instanceof CraftSkull)) { - return; - } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); - PropertyMap map = entitySkull.getGameProfile().getProperties(); - map.removeAll("textures"); - map.put("textures", new Property("textures", MinecraftConstants.TEXTURE_SIGNATURE, texture)); - } - - @Override - public String getHeadTexture(Block block) { - if (!(block instanceof CraftSkull)) { - return null; - } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); - return entitySkull.getGameProfile().getProperties().get("textures").iterator().next().getValue(); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/tools/ServerTools1_9_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/tools/ServerTools1_9_R2.java deleted file mode 100644 index 4540499..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/tools/ServerTools1_9_R2.java +++ /dev/null @@ -1,26 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R2.tools; - -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_9_R2.CraftServer; - -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R2.wrapper.ConsoleReaderWrapper1_9_R2; -import net.sourcewriters.minecraft.vcompat.reflection.tools.ServerTools; - -public class ServerTools1_9_R2 extends ServerTools { - - @Override - public void setMotd(String text) { - ((CraftServer) Bukkit.getServer()).getServer().setMotd(text); - } - - @Override - public String getMotd() { - return ((CraftServer) Bukkit.getServer()).getServer().getMotd(); - } - - @Override - public ConsoleReaderWrapper1_9_R2 getConsole() { - return ConsoleReaderWrapper1_9_R2.INSTANCE; - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/tools/SkinTools1_9_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/tools/SkinTools1_9_R2.java deleted file mode 100644 index 26046bd..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/tools/SkinTools1_9_R2.java +++ /dev/null @@ -1,16 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R2.tools; - -import org.bukkit.craftbukkit.v1_9_R2.entity.CraftPlayer; -import org.bukkit.entity.Player; - -import net.sourcewriters.minecraft.vcompat.reflection.tools.SkinTools; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; - -public class SkinTools1_9_R2 extends SkinTools { - - @Override - public Skin skinFromPlayer(Player player) { - return skinFromGameProfile(((CraftPlayer) player).getHandle().getProfile()); - } - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/utils/EntityConstructors1_9_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/utils/EntityConstructors1_9_R2.java deleted file mode 100644 index 4735565..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/utils/EntityConstructors1_9_R2.java +++ /dev/null @@ -1,12 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R2.utils; - -import java.util.function.Function; - -import net.minecraft.server.v1_9_R2.World; -import net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R2.entity.ArmorStand1_9_R2; - -public abstract class EntityConstructors1_9_R2 { - - public static final Function ARMOR_STAND = (world -> new ArmorStand1_9_R2(world)); - -} \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/wrapper/ConsoleReaderWrapper1_9_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/wrapper/ConsoleReaderWrapper1_9_R2.java deleted file mode 100644 index b5be77d..0000000 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/wrapper/ConsoleReaderWrapper1_9_R2.java +++ /dev/null @@ -1,43 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.provider.v1_9_R2.wrapper; - -import java.io.IOException; -import java.io.Writer; - -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_9_R2.CraftServer; -import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; - -import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; - -public final class ConsoleReaderWrapper1_9_R2 extends ConsoleReaderWrapper { - - public static final ConsoleReaderWrapper1_9_R2 INSTANCE = new ConsoleReaderWrapper1_9_R2(); - - private final ConsoleReader reader; - - @SuppressWarnings("resource") - private ConsoleReaderWrapper1_9_R2() { - this.reader = ((CraftServer) Bukkit.getServer()).getServer().reader; - } - - @Override - public Writer getOutput() { - return reader.getOutput(); - } - - @Override - public boolean isAnsiSupported() { - return reader.getTerminal().isAnsiSupported(); - } - - @Override - public void flush() throws IOException { - reader.flush(); - } - - @Override - public void drawLine() throws IOException { - reader.drawLine(); - } - -} diff --git a/vcompat-api/.classpath b/vcompat-api/.classpath new file mode 100644 index 0000000..0fb79cf --- /dev/null +++ b/vcompat-api/.classpath @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vcompat-api/.project b/vcompat-api/.project new file mode 100644 index 0000000..d8b40e2 --- /dev/null +++ b/vcompat-api/.project @@ -0,0 +1,23 @@ + + + vcompat-api + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + diff --git a/vcompat-api/.settings/org.eclipse.core.resources.prefs b/vcompat-api/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..29abf99 --- /dev/null +++ b/vcompat-api/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,6 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 +encoding//src/test/java=UTF-8 +encoding//src/test/resources=UTF-8 +encoding/=UTF-8 diff --git a/vcompat-api/.settings/org.eclipse.jdt.core.prefs b/vcompat-api/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..2af1e7b --- /dev/null +++ b/vcompat-api/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore +org.eclipse.jdt.core.compiler.release=disabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/vcompat-api/.settings/org.eclipse.m2e.core.prefs b/vcompat-api/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/vcompat-api/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/vcompat-api/pom.xml b/vcompat-api/pom.xml new file mode 100644 index 0000000..df59124 --- /dev/null +++ b/vcompat-api/pom.xml @@ -0,0 +1,20 @@ + + 4.0.0 + + net.sourcewriters.minecraft + vcompat-parent + 3.0.0 + + vcompat-api + + + + jline + jline + 2.12.1 + provided + + + \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/BukkitConversion.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/BukkitConversion.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/reflection/BukkitConversion.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/BukkitConversion.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/DataProvider.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/DataProvider.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/reflection/DataProvider.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/DataProvider.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/EntityProvider.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/EntityProvider.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/reflection/EntityProvider.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/EntityProvider.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/PacketHandler.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/PacketHandler.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/reflection/PacketHandler.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/PacketHandler.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/PlayerProvider.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/PlayerProvider.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/reflection/PlayerProvider.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/PlayerProvider.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/TextureProvider.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/TextureProvider.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/reflection/TextureProvider.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/TextureProvider.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/ToolProvider.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/ToolProvider.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/reflection/ToolProvider.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/ToolProvider.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/VersionControl.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/VersionControl.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/reflection/VersionControl.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/VersionControl.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/VersionHandler.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/VersionHandler.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/reflection/VersionHandler.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/VersionHandler.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/WrapType.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/WrapType.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/WrapType.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/WrapType.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/WrappedContainer.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/WrappedContainer.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/WrappedContainer.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/WrappedContainer.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/WrappedContext.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/WrappedContext.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/WrappedContext.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/WrappedContext.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/WrappedKey.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/WrappedKey.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/WrappedKey.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/WrappedKey.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/persistence/DataDistributor.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/persistence/DataDistributor.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/persistence/DataDistributor.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/persistence/DataDistributor.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/persistence/DataObserver.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/persistence/DataObserver.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/persistence/DataObserver.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/persistence/DataObserver.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/persistence/PersistentContainer.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/persistence/PersistentContainer.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/persistence/PersistentContainer.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/persistence/PersistentContainer.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/type/ObjectType.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/type/ObjectType.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/type/ObjectType.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/type/ObjectType.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/type/SkinDataType.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/type/SkinDataType.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/type/SkinDataType.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/type/SkinDataType.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleSyntaxContainer.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleSyntaxContainer.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleSyntaxContainer.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleSyntaxContainer.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleSyntaxContext.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleSyntaxContext.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleSyntaxContext.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleSyntaxContext.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleSyntaxType.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleSyntaxType.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleSyntaxType.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleSyntaxType.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleWrapType.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleWrapType.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleWrapType.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleWrapType.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SyntaxKey.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SyntaxKey.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SyntaxKey.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SyntaxKey.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsArmorStand.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsArmorStand.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsArmorStand.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsArmorStand.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsEntity.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsEntity.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsEntity.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsEntity.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsEntityLiving.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsEntityLiving.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsEntityLiving.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsEntityLiving.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsEntityType.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsEntityType.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsEntityType.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsEntityType.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsPlayer.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsPlayer.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsPlayer.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsPlayer.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/packet/NmsPacket.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/packet/NmsPacket.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/reflection/packet/NmsPacket.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/packet/NmsPacket.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/reflect/FakeReflect.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/reflect/FakeReflect.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/reflection/reflect/FakeReflect.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/reflect/FakeReflect.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/reflect/ReflectionProvider.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/reflect/ReflectionProvider.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/reflection/reflect/ReflectionProvider.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/reflect/ReflectionProvider.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/reflect/Reflections.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/reflect/Reflections.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/reflection/reflect/Reflections.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/reflect/Reflections.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/reflect/provider/GeneralReflections.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/reflect/provider/GeneralReflections.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/reflection/reflect/provider/GeneralReflections.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/reflect/provider/GeneralReflections.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/tools/BlockTools.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/tools/BlockTools.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/reflection/tools/BlockTools.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/tools/BlockTools.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/tools/ServerTools.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/tools/ServerTools.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/reflection/tools/ServerTools.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/tools/ServerTools.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/tools/SkinTools.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/tools/SkinTools.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/reflection/tools/SkinTools.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/tools/SkinTools.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/utils/NmsBoundingBox.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/utils/NmsBoundingBox.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/reflection/utils/NmsBoundingBox.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/utils/NmsBoundingBox.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/utils/Tracker.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/utils/Tracker.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/reflection/utils/Tracker.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/utils/Tracker.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/wrapper/ConsoleReaderWrapper.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/wrapper/ConsoleReaderWrapper.java similarity index 87% rename from src/main/java/net/sourcewriters/minecraft/vcompat/reflection/wrapper/ConsoleReaderWrapper.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/wrapper/ConsoleReaderWrapper.java index f928bc5..01402ca 100644 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/wrapper/ConsoleReaderWrapper.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/wrapper/ConsoleReaderWrapper.java @@ -9,6 +9,8 @@ public abstract class ConsoleReaderWrapper { public abstract boolean isAnsiSupported(); + public abstract boolean isJLineSupported(); + public abstract void flush() throws IOException; public abstract void drawLine() throws IOException; diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/utils/bukkit/BukkitColor.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/bukkit/BukkitColor.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/utils/bukkit/BukkitColor.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/bukkit/BukkitColor.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/utils/bukkit/Players.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/bukkit/Players.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/utils/bukkit/Players.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/bukkit/Players.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/utils/bukkit/unsafe/KeyCache.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/bukkit/unsafe/KeyCache.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/utils/bukkit/unsafe/KeyCache.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/bukkit/unsafe/KeyCache.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/utils/constants/DefaultConstants.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/constants/DefaultConstants.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/utils/constants/DefaultConstants.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/constants/DefaultConstants.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/utils/constants/MinecraftConstants.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/constants/MinecraftConstants.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/utils/constants/MinecraftConstants.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/constants/MinecraftConstants.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/function/TriPredicate.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/function/TriPredicate.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/function/TriPredicate.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/function/TriPredicate.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/EasyContentRegistry.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/EasyContentRegistry.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/EasyContentRegistry.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/EasyContentRegistry.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/EasyRequest.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/EasyRequest.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/EasyRequest.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/EasyRequest.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/EasyResponse.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/EasyResponse.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/EasyResponse.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/EasyResponse.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/IEasyContent.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/IEasyContent.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/IEasyContent.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/IEasyContent.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/IEasyTextContent.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/IEasyTextContent.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/IEasyTextContent.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/IEasyTextContent.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/content/EasyJsonContent.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/content/EasyJsonContent.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/content/EasyJsonContent.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/content/EasyJsonContent.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/content/EasyUrlEncodedContent.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/content/EasyUrlEncodedContent.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/content/EasyUrlEncodedContent.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/content/EasyUrlEncodedContent.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/tools/HeaderParser.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/tools/HeaderParser.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/tools/HeaderParser.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/tools/HeaderParser.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/tools/UrlEncoder.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/tools/UrlEncoder.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/tools/UrlEncoder.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/tools/UrlEncoder.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/tools/ArrayTools.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/tools/ArrayTools.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/tools/ArrayTools.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/tools/ArrayTools.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/tools/OptionTools.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/tools/OptionTools.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/tools/OptionTools.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/tools/OptionTools.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/tools/ReflectionTools.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/tools/ReflectionTools.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/tools/ReflectionTools.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/tools/ReflectionTools.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/tools/UUIDHelper.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/tools/UUIDHelper.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/tools/UUIDHelper.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/tools/UUIDHelper.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/utils/logging/BukkitLogType.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/logging/BukkitLogType.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/utils/logging/BukkitLogType.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/logging/BukkitLogType.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/utils/logging/BukkitLogger.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/logging/BukkitLogger.java similarity index 99% rename from src/main/java/net/sourcewriters/minecraft/vcompat/utils/logging/BukkitLogger.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/logging/BukkitLogger.java index ab89b5b..1e7c8f5 100644 --- a/src/main/java/net/sourcewriters/minecraft/vcompat/utils/logging/BukkitLogger.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/logging/BukkitLogger.java @@ -14,7 +14,6 @@ import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; import org.bukkit.ChatColor; -import org.bukkit.craftbukkit.Main; import org.bukkit.plugin.Plugin; import org.fusesource.jansi.Ansi; @@ -57,7 +56,7 @@ public BukkitLogger(String plugin) { this.reader = getReader(); this.writer = reader.getOutput(); this.colored = this.ansiSupported = reader.isAnsiSupported(); - this.jLine = Main.useJline; + this.jLine = reader.isJLineSupported(); setDefaults(); } diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/utils/logging/LoggingColors.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/logging/LoggingColors.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/utils/logging/LoggingColors.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/logging/LoggingColors.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/utils/minecraft/MojangProfileServer.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/minecraft/MojangProfileServer.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/utils/minecraft/MojangProfileServer.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/minecraft/MojangProfileServer.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/utils/minecraft/Skin.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/minecraft/Skin.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/utils/minecraft/Skin.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/minecraft/Skin.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/utils/minecraft/SkinModel.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/minecraft/SkinModel.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/utils/minecraft/SkinModel.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/minecraft/SkinModel.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/utils/thread/PostAsync.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/thread/PostAsync.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/utils/thread/PostAsync.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/thread/PostAsync.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/utils/validation/ValidationHelper.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/validation/ValidationHelper.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/utils/validation/ValidationHelper.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/validation/ValidationHelper.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/version/ServerVersion.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/version/ServerVersion.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/version/ServerVersion.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/version/ServerVersion.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/version/Versions.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/version/Versions.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/version/Versions.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/version/Versions.java diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/BukkitConversion.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/BukkitConversion.class new file mode 100644 index 0000000000000000000000000000000000000000..bc2b7bd41a2defa7acff8d7910a0ebe9c2bd669e GIT binary patch literal 2700 zcmc&$+invv5FMwXrJ?s5_xmkrq2?wbHA|okR3L@6QddFZ%}LzUO|p(0r)|Us@Fjcz zydd$w2k=pdv9p^dXS20G`9M5r`0Y>2XbKvaa&{KncxN zjaG!m^NQ_gx}TSoD$`W)oifjBAw9ZQFO`H&OK%@labpCc1YU#$$u@1@GOtkPiomcV zJfTwr*5aALppcMOvYbq035;%wqQ`VyaYT;0S-Tlc%L0$V5S$x>GcZhGGJ|1m)GIlz zT$U@N?o3AJSvkv;Fl&D^s&_?=z-m}t-FZq9nDA5PbH&_;1@-e51WRC{lX9aP&|VJ< z-Obm*yrq!z5K01LTE6kL& zSjVTDB*KR6d+p?fjR$i+j5o06HV5=0=9Ht@do<61D@{)IMB7&gOLs(OwHhFTv^Au3HAtV zhNaxrECNq#PfOLH?+|xevwR7iOc*Dw>~QfHqrQqX07Mt#dBvIL=FsAYSf`&(52C;{ zqp$I?T3}V2N4_2AKjdVvKpzyVR(T-+A@J@0d3R3j?vvs+1spxVFbI_Tf5?|L zC-BADS~=c&=^lHj5WF0BE9s_jv<&_~4Zju)f!Maay{ro}!{@u_*s|$E0-v4iO4tJG znzpF{?fqL$bD&0V0?t&te*ug`)Z9cM0wcJJz*!hY`4QhDD2Er9zC-LQz74?`K4W%w z7A@w`5@4aJ1rsodE7XT6m`3cGj&HNAZ*xHKqBf6q=E8O!E?9XHE?IdQu2^{$t|3N~ z&vn$h0fujLeGAvO;f~e23-_$N4{<9KuxRBHJZR}ZMEzx;t@R^h{22K};E9j;^bZ7X BeV+gT literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/DataProvider.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/DataProvider.class new file mode 100644 index 0000000000000000000000000000000000000000..2d71e45e47b77c52fb381712f9176076a0c2f6ff GIT binary patch literal 4941 zcmcInSy$Ue6#jF0f$0kAi*r9OH$buMnRTb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fJSv_rZKfa?zjb; zc=JGOn|P_}&WA~|8ExRb)<#-AMZf&7?LG za`n{oI1o3;3@&jZ(!Gp>krf=CT}I~}L?ZNkboMtKufKW zhD%De69}+_&eVZ0wvc^WsWaF@-ONr)X@{)>&*1{ekutZ^&=tQ`B&$9M1QhbG|wJ`1$QSfXA@&$S^z&xUwhVRC@ea3dQBb z9*cl`(j6*$=7r-USJ{#eeeNj{2KI|U33c*XhBGnXG7lqth#rAZs8?<<@VR8jHANs) zi(#+YNy#P&)eZwCL*J?O7zzhs6u4?CIYq8^dy&y-hXZaRi}M!NkYiZyP?G!8ai7bs z+xN+LqZ4|r-*ctV=fr5JcVfcuEG@6aDme_rS)6pjbcK*hsWMa+37;IDl79YoY@1ZG z7E#X9&R}_xyNbsNF-)qRP>$^W^zcw9`%NhQf%ChCNAgHi(j`t#EiIcQ#Qt~^gE|E; zT(xi!B@@?iGmjf9Yc46jgi!vd5(jbO*H8thsAdZPG+{t5``kYeH%b_gX z#XZu`P=@2U9=fUwe4!Elq3lufOe*~Y3zzYb;o|~g()yIyE%){xDTHC|SW7W_#mn+! zFjQ2s%|8p3!90lO;7g(BK{>AW>7?6z@6KF?56#|_w1QrGxvdp{pUlhnc^cc)nJmq5 z&}!(Jh79s_%HSLdw7;cq8QOF8##fl1BR`8)GqUO_c!54ZCH6uQ>vST2{mv-%#=>3s z?CuiXF%m?DR*mBly5>=;H|k$-WsYk*bKIWe{wFeKp&@hR3JR;?wqoZqxDu+UMfWAt c(I7G!*h(x#5HS72kp9S;!A`V3N)p}u1yzt3%K!iX literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/PacketHandler.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/PacketHandler.class new file mode 100644 index 0000000000000000000000000000000000000000..bf5b8d1049d233bb980292e1c5bbab1e245a672e GIT binary patch literal 1427 zcmd5+&2G~`5dPLN2~9!@15EiH%@CnREmAQA!*Dnu(EdfPbLcB%igUWeuhcnu_8 z08U68cmN&>FZpdMJz=-?v!D@%6Fa~a~{=&u8{Reu^};T zkY(shaurUC1cuN3G0g+d=CKh+=|Li6byRvHRXjH;%=n?4^Ve_We6Tc^a3UHZ{#@_p zk&Mk-kq$QM5>M?Y@~tQ<7!u(x|2ai((~3(XF+5nR&?z+;+^H~v;nC7lf76wry>0LJ zOJxVW^1mN`5Hmvk?`FKwVD(I;V$ajwQQY}Iu5Sln%#GB9XE)@qGGp<^suPt;HF(~m7U%G13_D{`~Uy| literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/PlayerProvider.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/PlayerProvider.class new file mode 100644 index 0000000000000000000000000000000000000000..c8fd587f434207c009673cae7d80284ab9b37401 GIT binary patch literal 2888 zcmb_eYf~Fl7=8|kEQD>jmQo59wXGoutYWRDp|o5qUIClC(lrXX zqLY@-9m|zY!PvBHnRd)o*VszuHuI)yIC3>B)2@}XjrpuulFq!7+p;p!(GaX%M3PD< zYTC3jS?LI9c~53Rpn3M0xn&wf*UB0RGanadT(H(`(=9quAa!tcq-wadG&32Wt8yCb&Ec_ zTPrOGBZd^8-|_>XOw=hv9%5Rc^B~|-z5;skY-mU5J{1)KwhYEK>H5|PEL1b>gf6HA z+2;XJo|(`wiO;z?&4OWCcHx06G0~56$KxgpVM@m|W|*!N?#DzW7JI1RBv^5E^ns39 zB$#BK{Lh({Xc1t$Lwc{;wtf}e2y zH6hSZVew#8E-@8PqcN{)P{EaUS{n0}zPo2o2#Z+O@s+B?^%M^Aaa{B-cEbMQSnCcq~R zV?4b3aB(E1u3zo7dk&Ii!L?|DyV zJ0-TDosxSw*Xf_bySTy;C7=&V`}+shKG<8k$~D1qcb#9Q`327_q`lGC_%IRs6RnY- z(H-4ItPXE5v>l1<;KnvL1U(3CY=Mh}&_y#Yv3J>n(dP@^+%2k5`-X9wN)#ZS zGgQT03Q(N?28h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~z`=Zi7{&D#KTaD380(>zIM1VU5p1!yhg~7KLI2!Cp95!xW!gx6$yyiYvB3kmp5RfX3FOm9a|>*nkQN#zNP_D zyoql{@C_!b5<L1mEN7 zQI;)_106rW4>dHUcxy8(XHK1cA;(JHK_GrC74;Lg@-V03j^z)Dc7CSg=XitV63XIO za1j>7x1>}3QbS)A#N~it&y-nuBLch?3h%nB>Er0UAdQO7k@B-U=|xQ<2tf?Y$RHQ}gX z|85a5;>Dtd`A|I7dqn32q4Z}RH}L`AJ8C1;qRcZS>T^)vj{9d>o6;LI>%YzQO6D|N?H@m|+AD6w?fKA0d|tg11~=q}cIKd- zFROKElUEXsBL1k6W4>na_uXjVB|ztnV5J!?oPC~8)$#kjSl0sXirvD7i3Qw!1Dmd6 z8%NtY+HoE2?{P~#9^hvyVSp_((niRQy!hUO2RXATfWbr9$q@nZFgi%1bIDq)wARJ7 zHYp!|3y~2bva6x(7J4UcU{~yYw6E6-*tdWK*Ek!@!6Z^XtsYFlWJuO92$wKT`elMW+%E(*IT01Xi`*-D*eV2t-sMH`;9CSQ z=YPR)0r|=x>D#h`3W)&gsv#%GkZ5ta35EJk~uE#Rd}^jHWzT0)QF3-}^2 z%ILBdpudc(RncFmg5J9V`j_#Q70}sn75ZD`E=up~YCYBZ)dIerq*S(bE#f-IVVha@t2<_VcsP=eHxUQ}Vvg z&naJ8C|JpJT__HHDh_WGu^!rkB>OsERFtnO%I$u%eL7_GE8!dIej9o$M&Z3wz&mAb zQC|)HWOy*drM<+ZU1ee|?p?-3c1ccz3+w&A*c?IcApd+)uT>-U$|^`5CaEJUkO~sG zT2egR6)96isySA`Z%@X$nZDoq84Jq4#m~rbR@DjivcV9E=2B#uRhHJU zY4yERz(Qs9jfK#|)h9irO7+nn-Uoa?ZsL}*@-$U0bWJke>e4*&2!|EW%~fBhe7 C!*a&} literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/ToolProvider.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/ToolProvider.class new file mode 100644 index 0000000000000000000000000000000000000000..d850d1acadb17da161e84425874bf97acdc0544c GIT binary patch literal 1146 zcmbW1$xg#C5QcxJp@mSEmVK4D6_CggiIyU@2yv(oQmY)enbZ_R8Y9;&;t6;jPDmVh z03Hf4NmI64sz@G>J@aK|Jod-u+dF_mZ0BGxltW?Mp6Y8~JZfo#?zvqV3SaXZ;|_e) zec;B`;wBKjkt%dsN(Gl%4P;yB9BhW;lmL%@L7;OUwgaIVvK1LhQ)Q@?8snkrDl}RJ z(jQ%ScZa zZF4JolwsPqe%GkXFgqBgoW#j+k`|cMY?LU&^51Zu9!4S8(xQLITA_MXDc}rAhI~hu z=DiFf3#vk`w40V~B2V|55tSlh3QYw`sHbC7e<;MAA#N>D{(XY2kBj|*5Y=hM_u@=O z9a4zUqs~9L;{(p{T=9<57UkbrR>$;D?$7YZ>>bdl(X9q-`l!cYAxD~pNlcNvqM1c9 zySM)e=Y?h&oafA$u>_ZGqE30NY(=qXsiYAn~V OP8Jq6;&C&HWa|q=k7L^a literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/VersionControl.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/VersionControl.class new file mode 100644 index 0000000000000000000000000000000000000000..c1c715380a508122459909f79840bd44fa466ab6 GIT binary patch literal 3759 zcmbtXdv_B>9KF*7l7@xSlqwG&prA?61S=wt@<`KGkWgwA3i^a zeu}CXICAv(mw)(~JRa}tZj((9RFn3cbmup-bLajZb7%Iie}4TP!29?vh5>;~rsn1x zt7%uYHCuNz+sUoyrdGApMK`xvwN@Ico3ph=L#w*FW#%e;gU_O6y0&G+5EVH1KwVXH zhH5V5ZY@0Edjf;SQlVU)EzDmNNR~R|W!KitrM$p?0ywT}x)s%EYH09+f8n(TOd}vJvTQsGcRzyM3-{ThUu#7jk=|o`g&lg z4L#R%b;HSdbY070Q@W`#95yKrmh~l5b(^*(u+b;XcxhMR&R-@ErKY;-Y~VZ-*em2@ zXgcBI<5fd9b@#GBB$ciRM2l8UOW+V*h+$OVTz>&m@FETi3|NZ-7gOmz=PI&F%vV*l?Bb7R~HPXAz8Ajs!>sGUD`qC-f_>J1R{72eOr&~^cXv_d(-rB{8ww6!h{1O2x+8F9m!QnulE!^kV5EC=bQ?XH__q|ijVvo( zcV=zP(M%$GYZmpN8k`w>g;QO-{)g^S0KAn!F2X-Zq65#INoCsZtc|sh3P^J z=LOFGA3uVPzokl!f{S2H4>K5L&E{yq@g-+F;XsHIxP&V)u=YbD=8q}3iUMQcG#4CC zwFE{}*TYVSFp3H$F-4)VwT7WqS(=lnPGiEOij}}fS9Xeq>NxoXW-uGWEpDVv;=CaRA7PFm(4B(gNRi`a znzpSK8MH844<>yt4hm^hZZf%gMZw3oLs@b()vnfWYHr=C2{ghp1G*uspyz(5%V)W> zQiRHzX9n1n}b`;o<(_7)<5nOiF>hevs5$NU+%O|XQ zRHfe4Bn-ffC^6@Gl6H=(J}|=o#GL4zRTyDBBM(uj5L2eByBi&9eTZi_1aT*OC)bV9 zp*L%&8=AchS9)FWndJyi$CE=3#Y%wey@@H17hBm!d=3&@OcXhEqIVzJ>ofe zl(4rtDylqS3KAK3aK@9Ps(Fb7Pr^`@=YsIjxpVJ5bI#nk_s`#7zX80#UKJ&QcZssWB%PW_eKp!DGYQ5zQIV0C zHkd`}_(s~msLNPIR;Ni25<&Y(CKs_XRd@oeYdMoaER#|2Wq3`TKy#MEj?=`NG!}S2 zSWc%PI25Rz>QN%?)F^@SS;)vrPbb>;1wQzXWbcGz^GWJ9-f?=N>L{bxKn-hD^E+V; z0_zP_up+QF-~)Z0j)%&e$zjaa z(A#I%${coqXRdX$ReB|?^7q)>I&B_#f(A1~`X$12|L;PswimpAD1@>LjV8( literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/WrapType.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/WrapType.class new file mode 100644 index 0000000000000000000000000000000000000000..df6814af17dfd890ffacf1814f2a5b66e4daab58 GIT binary patch literal 3911 zcmcJS+j1L45QhJ89LsXnu^k5!0)$fl*$^)TCxJ)^bh0C}k&L7`7y)K2ucdWXyUJ>P z0&4`_F%W{SDv-eu`j7 zAmLhp-u8CNcTL?f-MU`f*rwM6hSO`6oIu_L14w7A< zqYoR!!qR|JZFp|IH?Cxv>P4fN8dRzm9nU7KjA0NgKEm)ZSjqUPAH9V7)##b#HjJ7v60I(^<2SnAUe6UDoj zjUXm)l@2|eyibGuD#zOvt_H}Z^gHpc3|&XSvm~)9Mo_ca{>#-^Z#pn443h~ zhAWt-K9uOpaz6HKSKZ+8+0`fnKHx!&@HDP!h+>Yl1-7JiUBelreax2BZfY1;T7oU9 zB{fVa?Q^!Imew$(v@BavThuVEv|DURZCS$$N;BA!T0z5$N?Tz|Y9$RXDXqem)K)dT zthBG#lG@iAURByRY)S1q4X-Kfd$vXdCJef+6n2^$mR~Wc&kCF~yqf8(n!e545vS`` z5Uv~FD_Yj3z;tZ3=g7}EX1h)0cHyX+sI0`f5~s*bhAu^pwI4cp>gyT#`UGEQDqa{^ zU^~_mP~Df}$J*_k@EMQJ@%LamArXSuDbIJHDWk6tDO{kLs8DXV=5i%5E zOl>{hRsvUOC7!vb!i^ws?RnnkHKqI{;}P7a%jyXmNm+Ib9`+boX!DMyn{X<2?8RkQ zw703*1r56`kUW_uftkbmg4}oZ#^Q-QhiRm>E6WdwMVq(bI9Di7VxBMA^rewlxp}nq zGf&ZyM_;3jPQ9PLTgItlP@f};5Dj6Jn0j2uW5m?oLgo%by)ERk#MIY9o+PH87VSrOJC#GH&@(eNcv5+qiQx6OIA`$hkkY6FD-WBpCV(MEVzfSfj-oTrryhStmSI!dn z^${+w{egEL;=MniEBH{tM+&YnDo3(nFh|%a{?DJNk`EX7ATu3oJRpOs8Z${H2)pS(9e{W zUvLQzC>tBn1Aj}_uo-5?BHrrZ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2wA@fN;;?>(MEZfcSniY#6p>bMUHa&l^Q6iACH?fJfHRMpo1+bz?!5 zCmez~Q7I_}+c0?se}?-Kc9k1l68;Km=B;$W-RB>xZ^AGZYSqkI8wGlr7Osw~%@4X; z2De(fHh6w`qd7&_^L&`g?C!wbZrl(l{Hqj7m}AG6-Gc7ac!iH}IbE?V)k@$YtFkqO zg{hsuBMH45Po*(kj^anSag4PU@GSr1`yGE1Y{~pe{I;hbW5@6OrwvK|ieX?kcJVjm zPT;o_;;FEU{mzpi_HaZLY;D-b{{1-M^!MNy?<=-)#}9J62haKK=biQoe)~nXdvVBF z*Nek`{}HGEsNa6cY4`crhp8TSmdliwj|;d+j5sb~*u%QSmcZ(K zirmfg;4(%Z&6M&l^#5?jH@e{I=PJZ1#T>0 z&>;sm?auUZyF6U3#!cLE#OuNb_>gNqB7&=y82i{CyUj5n$0xoViX+GUCOKx;kz;sW zIf_JGPmaUH7GoEn`m>rO>Q0Kt@`yf5$plt%@B9kxq?b`$&9ZAW*S(XlXez;$&EGcE bQ0G^Sea^lw@Bm-q8}^6*{ubZidmQ`+8>3Gr literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/WrappedContext.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/WrappedContext.class new file mode 100644 index 0000000000000000000000000000000000000000..1a4b44c57518e9316c2d6c405524fe6ee0b4dd97 GIT binary patch literal 822 zcmb_axlY4C5S;}lh7j&>S9A#lTTmd8C=vuABUw-+3Khk~UcyGs+FEZQd=?cF1s}ji zA!dy!0v)07-23M6d;fTS1At@Lb76+TnG%Ml@kj^aQA;Cq%7;>kK;xa^4?#Rk&~Pp8 zA`uuFD;}ajexor-MA(Xz5o6oK_r)63oIv8C;lSuSEFH1=nnQG!C=jg z1B|+;rSVId7azx+Sr#^`y;;0|&Otw0(chZF6~&srI&V?I`a^tBim ze&mPaNEoi=U?hE`!hrXM5&WYTQ6&5C<ZLC-lW=Uub3Tsj*-VRLt8-MJQ2nCo*JX-2wO|Az8cI^H#kiJN_OQ$SVBpZum@>!vm z9Ins?(-QJJuT1_6*JCc_64Qb0zuAkt>cij3y=PdJbhPgb)Y%Ro02={P5MQjtd hMRW=A0ez27;GIQX%b>b*sMcapb9kD_XK6)Se*l62IiUam literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/persistence/DataDistributor.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/persistence/DataDistributor.class new file mode 100644 index 0000000000000000000000000000000000000000..5f9990b2bc01d9066f4cff8da016ea31119644de GIT binary patch literal 5982 zcmcgwiCYxs9ezI+99#w=TQnMjvBto%f?E?3BdDpOMiI~i#7I-qVRwL$VP?BKi;^Cu zcbZ=5-K0l)q)iXorfme#HodPjZPWf8{S(@z@Au8IqaZ$N2|Um4cm9s|cYgcIe=oia zU_1V)p-SM0V|v+=TQ26z(?!cOi>2(8<(RpmG3I5bbM92Z@Ulg7%rrC4q)Mb)f87 zcDCOrbPKE;w8kC7D;G@x=knd1Lx;QjZdS^pp~PNKD2JrGoBsm3RO)Eaowo93QDE2g za+45**GX^lj)m6=yFt+;@sUf zEKqo(xcPcYmeoCO-b^t{*6LV?+XQM1LNz0BN4jk>c|)MPlMuLF$D7bB@Z@sK9dTVu zq|kT@!iGKu-avV3)GQ7eqc&qK)#v66d)O#iavm&JdlMF;^P%gt?zM6P9c<0z{ALOv z&*A?!v(Q_gf1}{PS{N>6mC)6aNT5afORGR4-8QVDP2iSFay)31CYT_TNTVf*c5Kzq zA+Wk~pvSd?%v{ou#aozLOEXSxqUbu-<7S?B1vaK*qR4a`_hC6-Nw2+IM-5iUQKycT zNXpTDI_jXy(fvB=u}Y4*bTr}?CWBnjG(39JafZY)WM}%!qsv3t$G#2^V2_5k3aqc7 zITohiFnVTfz^!UU$>7(Fy=BX0<*UO(7}W6a;*f;dMrOnzftJNo z@%=2Wod%}USUcb|OyU?G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i4g)PraAxD^c}t)N4q{=igqOjX-%qfnpO933QVZJ98251LpC;1hwpy!uw9=n_wFa zb~jD4O$q5cQd4BUra;JwlgT~b$>g3CjX$g4P$a=el?1PGF8#ezN#Ns;n#8$a`jiB` zx4(TBA0Oby(;c(;%rmIv*B8!JpW{6r-c5`q;66gTovyHhuGU46x(WDBg1U=xKcJ-c z!=*Elx-*cvnFa}=P2o!n96wxqkmY$_6M0^0;-3#eW|%en2b(nXYOK{lrapekXda?= zg5L_?c|0p{5nq!Kf3pgeaPfn>hatF6NvZpH0x2b;l@%$6#4+Sx1RRI-;@uM)j>w&p%}a71?=Ps*)>+lydNm^RFHwXZa6|JZY7f^Xd0Ofe0S;!WB|?g zL*?@ocanR)5#*jULN$KGn^pL6kU(EldP)<^%r%co__-SWf-dxHHTo_7fIq3xpYaO* Sf>(K8{_6Kv{2l+my8i*$^@Cgh literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/persistence/DataObserver.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/persistence/DataObserver.class new file mode 100644 index 0000000000000000000000000000000000000000..aec427f5224b597f89bfd6b0fd55b8509f184f6c GIT binary patch literal 4587 zcmcIo`CAm{9sdlwFtAQk@QNUyC5f;E#zc)Vpos#;gTo49MALNG9bjac+0M)&rfsxG zn%=c-dXT19+Qzm?+G=Ihn5Oo!ZF;2VpV5DyKQ#S(XLi}e^5{PGQ6G8V`M&S_JwM+A z-}=w%Zvxncf2t@`&}*B%?l~DZVV-m?-*i2F%CgObYmE8&bi$cR8@}$EV<|J?TaK+K z4d2kyyk>d6X(vp*n}mT;&vd6vS4C98@)O3ip{ERcTpt)c!DlKe6x0-`hcdQpjHXNl zRSC!T4T^IW9KLN$4(7G;yYg&1C}YqXw+%nzQr;7HLPlqNC&iQ-DQlV{lo17YdA^h0 zXD6+M;X5=Tr7-1rl&X^>jeTkz0OKqJ@aNyGAasnfD8 ze_LBTo=OQ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RIW_I57o0L^o}t6Sh`Q*l?3y?cvXSAl5dl69-7A7`vkUq!SR+s}mJ{VSMJa0Sn> zx#qR}@GQ0~y%+GYdCI4+;cPGC+Shs=4MgD=viR}^y!bMz<%$rl;iW9TyO8Ji^E_X< zjuqk2E3#a{kINv?SWi2)V2=6-c-xtAz#f9-aYA!1Pxtfu0Jfr!)P4-nN|V+(1nFtQ zumIdMIh)s$+a+8kX93O{MBgEyOogJdMDfQQ{*8t>k2y_-?!b!-wgkOL;%6A4gx>;MimJO2v9x!Y|d7l nt8kETdR)jEPU-WH3klbFW5P`?`uOjGh=2SS#qh18 literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/persistence/PersistentContainer.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/persistence/PersistentContainer.class new file mode 100644 index 0000000000000000000000000000000000000000..d564472feaeabd69da5c714a09aafe5dc5073777 GIT binary patch literal 5718 zcmcIn`&Sg_8Gb%kScFLwyu@1~isJ5~j@mYDvq)<(Mhl`9#b|CFb_ZBlb~iJ#C?;vG zO^msjG--3GZPVM2{h>Lh$Vqcf|A78cJ$>Hq8+L{TS3SfZU}wI|`#$gUUgy96`}cnU zd>?;LqDf)2`fK zSiuk6QqHx{EItQ=@dcR-vst?z`Ts>nV&3uhy(% zwDWW*kFuMm-8qFW1E=VeChgPXmq`h?){GV=OHNSrTpl|&BtVGI5w;W_H#Z7p`*@+~ zaxa;i;%zstpf2$wjq?I3tHu=$HE%4%hMhUkKyqo_A0E}&GE2q zM=#Q%Kcnz`YSp4wiXdauJ_|{-DXbl4br`A6jJw`BXS~RK>0;_S#WBY#$a}b$2&M|Y z!udynh&ktl(WWr?Ex2D{(^4bmDvO3(dK4D)GdmS6J4yx6J@qD!7d>_VBtrSVr(f6 z%Wf-q8>3w zmo=z!3FD)#^!q*aYyGh>3P~EsCQ(#)B60ys-?W=Q;rLUOBAQDUrch|dG%8YqUsc!= zPo2SXF&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eOu;AkRG_zHQC{|Jk+8xaDtH#p@x7?Io49?G zv2V7r(|@I4A6}sIOG3Vnn$-DS!rq$inT|6v0{7w*Lql6Pq>5KV%^z3YFQ{S|AR7Gi zE{zI_-}=yJfPVR~6Mgi(13~(3jdVhxCkyo3N1wsSV>}f(`a8ORrC)wp4RlGQU1&o$ zt?a?mG`7c@jb6gze?i;Io=wl5ah~lYtAexQ*xf7bj>>VMJ@Om6f1&A?Np=_n&88Ij zz1=p&2FfFBK;ZetVE1klmJ&|j%+7goiyi9u3;VCJryDpR@EAubJwD`u?y2&aM=X!S zh}h7x1Z@!?Il2z|i~dZ8+$@CZ5PkwD38TzM(1kwW(0ob;aGid$l`eLkjJ&pim=Bef z`dyZ~Z0|Y!CopVVveM4atkm+ex9FLmWBG_YC<>NfXGBJJY#nDR4W5t&4_MP2 zgPjD*q0v%IV3J_Vs_Jx1^Ru_<8Jiw=OrMpeS8db1rErgJU`k*E7yMO054wElb$sZx zg9eS1eXu;`SyuQwi^I2OS>9Yif<{<1RjEx@$|de1oYPmTrTVF*dxjJ1m3pbY>O-Za zQJ1AgQ+o;TIyT>{liK$y4Nkgf<)m4mHJVyFT|1^fcyel0e^t=uTt2iSwP|RMH#em> z_o*qiQK}VNljpZXl}_uJ~vx1rLx%LG2>a<0#DuFt7}KF7H}mvdGyJm0DXo^RCx z&$ry<`Iei8)9}uc(@cxcU)c@jr5{#{@i~6@Y?8{2j-Od=)S!K?w2#$obj9jMcf)0= z(P~)6ievMRBz%%0;vNvRc7|0^CB(F}XKh=hIxojlZrpU*Atde{6__83s=lRf6O)cg zwJ{%5W9GJl**!}8_~$m}Vfy6Q+av4vf_s2Z9vQ6tTSz!cHZ9qQFKaA$RCfsheJ$a> JvCk>r{s*CtL&pFB literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleSyntaxContext.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleSyntaxContext.class new file mode 100644 index 0000000000000000000000000000000000000000..e685348e11341ea8484503277f39a5e2609ac23d GIT binary patch literal 1491 zcmb`H+iuf95QhKF$;5Tqgq9Kx0oqbXii9sHDw3;8rKl=WR4#&oxZF6~bgRU+oJ|wN zOMwJbfW!mvP>5OEszTI@$|X^}v*Vr5|BPqy`_GSG0JhLDkYQ+gLfJ!q6uM#@N+rUf zJ&>MoLw=;}Q`a8^T-l*G>I+v%-?O`1aeEx{z;4Mw&=;)_p5l`|-&10u4CEMIrXju~ zVj#K+hrw`TBE$10iLi&!V}fH}cyf~LcpzgruSnBwmj|Ri0XPhWZRtt1!|iqL2? z2 z;qbo}n{q7nggW3}S3h{G-bj@vL)jB!T|!+uPWglk&n^Rd{ZEiHhbnFxxJA(^-k60O zSZ1(D%ao1-(s9LhiZXHx+@t!ZL0#DE5!6Ht4|HR!Fl=6;$!6-M8*GX4JK?9??sKna zzv-ONlsP6f*h348SYj|+(P-{V{fes>jNDTlPMy$_J&&tVNXI^2wPZBO+o^hK$H5AT z&(i-3O@bZ~vhrjbxJK6^?e>wOFJNw*(eKGuls?lgg9W&~RHq2$ zIpGfOCIp9MYeMBGYVXe}XShELs!f3^F{r#td8{U&bz0**zF}=PnC3LfOlP+qSI HTI+uSJk6Dd literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleSyntaxType.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleSyntaxType.class new file mode 100644 index 0000000000000000000000000000000000000000..8310ef114288418ac4abb2f96f64ca694ba25227 GIT binary patch literal 2747 zcmb_eYg5xe6g}HkYD*9(R`HGaY5|Qee9&5iDuPt)Ogs3&PfJ-a*e02Dc{u(lo$-Yq z`~m(b$Gb^P3+)Ikekhy0n?3jJ*>i9B_4~(90Qd1CiV(wsDWqPvHk^vsattY)x?VF( zQE~XH)Hf?u&E`^f#A;Pkq+yx*3YT2pa=5LRjGA2)rT3=f+vWGRh$6x;u+BHRUghSR z{%U!h_C(RckR}|x?!IZiwS;MG`!jAE9^w;%RUixz=?=L*a?S9(9LKnx?6G;uy#EC?*J}LsgfkAyL~=Y#pnr;RbZ_Hp!t%Fx{zr zcB8qpZfUrUJD$X|8}Hs3WF2$U%gT`NJjY%T$})-jQQTvg?(pz?p)@?eLx#SJBe)d) z4KjS_?ru6(&u#s_`~KQTxiq68i$~OARQ;EmJ-ME0wO6Ni)-G#Xi$*J+r5Pr>sssi? z@ViE$l{eXr+)V1PI##Wz?z*jvB2`A-t@1ey&y;?Bo_;~=irI}e5vD4l&Q@|i)N_XF z-^sln;2WyXF<9B+R4e^_n^>;(wSy_AKCwZ=rB+AU(C-NS66$M1V~qaA2qEsqdZE#? z7wN+>T3M!fh{pKXH}sEcHj_>Qr!xHaCIA2c literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleWrapType.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleWrapType.class new file mode 100644 index 0000000000000000000000000000000000000000..17c8d407d999ef0b26ddc04f46a76ff19a3b5404 GIT binary patch literal 2335 zcmb_d+int36kP|f2n@YYZL6)?dgW3(YPGc;Br!BKCd6V&>Vr=Qn6}fv%w#xi>8oF) ziN@3iKfsSN?lTMn1WYL5VK{Rxd#| zwQiVt#o>oSJ*!xCn+w&^4{Lfw7?!D4x!~%#!)G)B`uF_q5zK;j$Cg1AAylQe=NLWon$ zByQ4du63Hmd74q2hqBPKcgx?45(9?YSoCq1T-;rEUE+R6;u3clzEVsJcY^jn{3V{^ zzDGSgiPBk-C=B!09qePiYc({@Ls$FS)o*HhW~5?aAj`1&qRVK`-ZOjlIY)o~{rWcmcVQ}MVOX|wPjl^> zlh^kh!_ysCs~DD^cX-j$_VRY6%011|i>99U4BOHQ+~eB5!>d~E!1DNuC;EYcHio5( z;A|02RWA?*Lu*-F7qUdDxe~g%W9ydjB6#CfL#ug)>1s4lTjv$st@6AKPBU~Y8kXTL zF=&ab?Uc0bTDfd^TGgzT3`=_^Z|UqV-{YFet&*1W9K$N5lbZ}}8M~lI(2A%E1uCs1 zk=%@;8!-hv41;IEsfeSOK`H5;SPjGFMDip<1eYpD{NYtwaT{cZ18Q9czUyTo|~K8F~oZ?*yimRF2lp@MZ9+0v%)gIIT(h|c8pj^ zDjOrDoMa4b5%g|2AZBkB;{+AabeYIlE@+-+o@IXe>kXEsX_Zj+%j$QGg zo;n$-J~iRG;+cA%0eNn>OSu_l&!aWNrJTp}=ejd zYEV&ReWSBHKaiC4k&0zxsP2T}#6Cr0$H@OQF5fhKq~ftWM$h)O7e_MRSkazt?@|*W zY=);Q?&ATSyU8ot1wMJR6Q7VAd(=LtNj#Tznks8qKOi$ka|3aBv?;?vAQhbRtk1gA_=X%tS)^u;jF1QhVfv*&N$uLnb0EV?^mvt>G zH%$|Hk>@?zp)B|s-%us5)Q1@U3Y#{F^uc|LxRY7iF4wB3w53ojITpBaP}RfJoB!xj zzBxABy#nM6H_aUV6{LGQ@HxZv@RkBQgrkC?7`_!I$*XvVaf;lIi5{Y^S{8LVle@0& zD%fF|I-%@o`Y70C7g#NNVO+ zTw*vx-zyBx9%AGrCVrxiEtsThx11P98$k`C4^uQY<_F_Crs<7fkU)~4#Zx;{6e-AN z0dToFr~6Q4#XlN<%5uUIv^o=r1xWTKE;hR#*K$aBgm1-LB83LSf653-nZ}>-NnI* T)a58ZN0CNEg(<;68AJa9L_#!m literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsArmorStand.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsArmorStand.class new file mode 100644 index 0000000000000000000000000000000000000000..1674731f198367411f62f4887d80b26f57a02d19 GIT binary patch literal 288 zcmbV{J#GRq5QX3H69WM$;uO%}k{TgWMNq7ig3c@hGP1qMo@~U`C~^P}h47*@X;ZxB z)6>lNZujdCfH_7AEy6Oe=u~~hlE0%Bj!AnPxQyl?x-Kh!HliaR9G7CNpgD+@i(dP* zh`x%2n6Ovq5Z+FvHrknR)SKNYw-sIptAC$gJs*A8+J+;cmskpKoFjB5+vz7k+4KwA qlj)W)D4rwUtz*LYkKe3O%QA#^PB*V_WnqOL8u2~`nGjwZj^P8EbyKnc literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsEntity.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsEntity.class new file mode 100644 index 0000000000000000000000000000000000000000..cab9cea69b8b12176e7636912fe7bc969b0ddb19 GIT binary patch literal 1077 zcmb7D%Tg0T6upgsNCE*85KzGv>cj`VbdiN6K5(j1XjLjKVAYvvk|v!VobDN9>2JC4 z1N_PP1YR4h4x^`P0l z$!HOnM@kqIxD_-*0#&rSN_@+>_0=a=G9x7IcEb;NVOewYKGP-{9kCJWZUhC{j!A{; zx0=VuL#ZNfHohkksG!_o%5toSKq)w}S1SXir#?*V1hb!sdMvc)*`gXkU&okwYeI(# zyT~HL9Bm0{iIgJtCW?hBpNLc~eQK?Y4>PGyz}|odtodpq-?B+RKJR zVd%u~dSKf*aS+(VcK(ZrqsuO0X1FUrNY@H18#_@Jx-&>FG0M(N6u$spCA;Ej%QmPq z5HU7nH#jZExWPlkl14pjF=jUHS0iYij)zzrbp4w0PLCtmG>}>-Vm1KE4~3KjYIye` z$yAKnaFBc_aEP`4=aSo8wB7N75bj^4L(Sm|tU6qSy2FOI*S)>r@s7t$f4=4IZExT8_C2`obar6Z;RAT+ n@DV&l`~gp3&*4*t1fIcjcOF2~;S0}y39qmc00z_9*vfMHUT+f-Vsi%2ywg!A*_#1J1l>aA+C*$>dN XW%26_J%4@wF!O{FhONWMYk>F*-q2BL literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsEntityType.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsEntityType.class new file mode 100644 index 0000000000000000000000000000000000000000..571d1acd77bca640146fd0fd07d4f4fce2c7df88 GIT binary patch literal 1205 zcmb_bOK%cU6#gzl8KBdaQbqglT@}zc=|WvVY6;TV$Rp`c3~^yD;{~S~1~M~X_*dF4 z+GuQC`=gBKPO*#&cg*76bIv{IJFjnk{r+|V;3e`ZA`E3m__{Y3xu*E+TE1{Sy>B_f zba~g;$L63vHOR74q;kNKGEHg|e@#ToS(7E6b< z#^DE}S*pKgs8r{Ws6eQd`cZAWRjM9U42J#pbApW*P1|xTf0seY=2{HV^5CP0V<8D@ zO~VRO46)+WC6lerx;1>)a(ab>Tq{AoX$=dAN$Hvf6>)}@D$TP#>UV_OVYu{1Md#5wLvU3RdtBfuBid8i8T;9PW=?+R?iZrUWR?rH|dh-VRYip&u}^w=S6i zq&6f^$P%S90ZF(;(q54+zs>Jp?X;$xVd)gB(I2EKCs;L3vG$doBe+gyl5P;(5QIdF4D(D}(p6J~_QLcut`r%)50Y5wxy?C}RUW#|7hvZP0?#YA literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/packet/NmsPacket.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/packet/NmsPacket.class new file mode 100644 index 0000000000000000000000000000000000000000..e2fcdac9e769519b259ccde52289d4691ae18692 GIT binary patch literal 314 zcmb7A%T5A85UfFQc_f4nG4{~}jGiDN5F{b--i{3p?9OgxW`X@R4txL~Wf(WagPuI} zyQ{0x=da@lz$3Z|8VWB~0{OgjTK3Kaah@_`MLS*v+UYziIFOT7Dms|lQo(u~5%bJ1 z>MX&nLVv?Mrj+fPUf(xyGr^t0eMFP5Y~VxjnTs`tYsH13GMLoURw|lIrIHVY&azf9 zHmNA|eh41EZ!5HyW^Fl?E)L(GMuXXJ%Hi|h*6cqDhEcM@O|)kG570nT`xe@D>|6j@ CXkqFA literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/reflect/FakeReflect.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/reflect/FakeReflect.class new file mode 100644 index 0000000000000000000000000000000000000000..09798897ee8f95b8d214f02cd91543a6befc4cb1 GIT binary patch literal 9490 zcmc&(Npl-T6n<^VcC08)LK2g(g*~>ih$V!@Cg7MDNK67Tm^Hvy9@&#fBQrBfYzPFi z@B6;57m5QE5K>T36{_F>7j6_6E?l_q7bxEA?isZ;J<`}7ilicqdis6ud*6Hgx@Yq9 zKi_;002jhX?a;ztn{9e|w^DTq=0V5uOvlZaE!!+OM$yY3C{)UmhL?BDV#zFcR>k%& z^Ml5IbB`EqhctstI5qE1+nzBsIZ-ifYfAnyCN1BH?4=EZ^kDza?F_CMS~!7T2AM*o zBq=iJ8ro+ZF!EK;D&+@)ah$cNuTZjV%iGEz)!j3KBnB#DW(F86$wDV&7_{~A`yDv6 zEDNpB#$f3X>anX@9yOiojnR_H;JBem!6=Owjzz!uUaf~$1$eeESv-3lPu)@5z zM~RfC^=4o#oYoGfGFYY408vkeGf<(bU9OB-MIJy+B21&?Uay_%s5ZZsbUG^w?XU>7 z^d>A9H6Ay;-3M*cVX&fGnkh;!=oq%fZNsZNsAN}oMqh3#W~yz>ESVn8Sc-5172EZk zYQd{G=wP*PQ_qn>U&O6GMLAi^SQr5)xg@6<^mUEtO;pCv&E`2^2_uftff$39St5w@ z=K#TNI6~)SRgIXKDD;Ot$Fj$Jl@U!qy*;-uxNy#9qyt%|ZKKS~yjHH#ErZ2{nr;l% zHsL{Qan@Ryo)qha!Rd`nMHzIU7D8MG`FQcjTu>ZsWu8n1Cun@hd04RMgR5VweqOK9 zN{d{Pht?vcn!y^412Kz1Co1L{mhJk1tkMKRU`zaol1-Xg5w#O_70HFq;9?C*bcaxS z4iV39~F5}ha{vyr9Flnvn5?A&o>2qB?DBLSs4+xgC3NJEG z8ajy4IlG%vi&Q3RLe@1m23zKC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CTZ4V@mqEnGa>Qwj)7T`C_ z!>=(FV|36DP!BYzr{5!3>l8c46${rBd7Q$W%-X|4`uq{Wzorl2Qy;>kdQ-GNW251t zUZBQ3oMUi~3DwVEO;HcQy@;l2a0u>`tmFInd%k{_9m7?2SgNxQYlteiJ-2?t5xBp8 zBgU8RydeM@xe-PWG%_+Gj2>!i^oXR_jf;w!*dnC2@d!K`ZPkwj^td*tCmI_)r8RoG zvC*@7e$Pc)9m9jq3wo;;8(Y1sCHP9TQ9o9{UW(Tm8|kHZBiiT~KKi|-59;m4R_{uy Z9QIl2!x>8On)DHPFVYSzKH$ap;lCYR#YF%B literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/reflect/ReflectionProvider.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/reflect/ReflectionProvider.class new file mode 100644 index 0000000000000000000000000000000000000000..b868e02d30bde85c9b5f807b4450f0d5305db387 GIT binary patch literal 6124 zcmcgwX;&N98GbGj49G(u1UoT~sht`Z34)y338BJvK$t?!YGG`gq|P7)kkRJR2ro&S zw&}iaY3uGy7k5e9q^&VcPJ8;PAA0%+`e&Lx_s*3x#yUiBa{5IxbLU;3_r1@1NB{co zTYm@8k2ej}35;iLH(JOQouqxuNx8ODh-Ok*JLy=e$O^JL#r!+0t$F zTzP56$*rfBY{x)Qp!JHiZbj2pb|pH!c!fFw55$Kr&kW6tT^^l2H#syX&^A#KO1Mrc zyAl&naGeOid>Ih8tlDbTFO1 zasqt?+gZ0AiYpCcmgL@Z<#XiWY8UUF&*&HD_m2*Y%T? zPnD39AZqa9QjPiz$;BDVT@^60nS#D!*aeCT#A*svi$@bG;dxJ)rh|pGR9-+_5@;Mu zrc>FJdrBbC9iHdAcy7sVV=o*q@hA>54l9|o^DNo>y2DwU zT}`pnO^MV>)^dvuN($_|7vvlH63|z+Q+#hh6?l4gD9E0DZFj2wzwE;EAq3DXd;Mt> zd$CX6eaJ)$T0MvMv6br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git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/reflect/Reflections.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/reflect/Reflections.class new file mode 100644 index 0000000000000000000000000000000000000000..98759c23deef0c1cf0fa59b97e09b8c9f608d4f7 GIT binary patch literal 1468 zcmbtU%~BIV5dJy|u;=ngLrqgnTZ+P;+lBTa5`($hEo~qhOBnX8g(Gi9v>_g*KMW@i-si$;}ypg)}HW`K6jM~|BY%Bwkj8ov`okz zT24b)HR%T~p<28+>ub;HsHXJFrM)!9Fp4Nv;nX;x1ZQ%zVQ*Nx)pY&tai~IHZK;|{Jua`?KvzW(X z5(|XcFt-0klEV$$gwaBLeMneLKPm!oKfIJYir0eH>xDUA_~vPL^UVzkDk zzM!!56;nO`3|qiVnxV&$!WGOw|3=)sA=fOfGIEahFsDDC2W44l f;2ukznTF`hV)2h!o~g<7nS5g1nh@@Xs0V)l&~tvq literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/reflect/provider/GeneralReflections.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/reflect/provider/GeneralReflections.class new file mode 100644 index 0000000000000000000000000000000000000000..de42afb7f2549c5d9eaff941af641979ca1f2b71 GIT binary patch literal 1255 zcmb_bU2hUW6g>llrOVdZRa-x4>nD_?`{)CWNhP)+5@HHsd@&i8p$yp%GCN@XS;nMI zH1P-cql|aAizPN`l=!f-GiUBSbLP&uKYo7w4&XVe1~LpsfzVDAPLwM?DyfBv9A5^) zReYeGsT=xZt{o)?o^Z7cgW1#>t8gm&LOF*b5Q=+8ze6GeOAId;^<*IR3x;gD(q&kxhkap!p=iNEfg!(_>@O2^%|Z@&hSerjs5S9> zLUnl06AX4Ubh+2%O2+F1G?7J-`1DXl47o_?$(W&4Ui2Opg?W>fzE8FRH*k-kv0zm%tFiC^B@*K*!L>;D8Qzwg zBR=Jh7fWetC4=MI98&jq6xAxtSa0+x(EMaP3`HPM(iI=endM^lrL?sIwy3lL-P*)M zJT~x%VfWuSEIh$edge%QX~fv+suv(um7VH7|eFk z!w2L5hKVAgh*vd4^q5y-w7y+ut&()jd=T%U74KHuH}oMJzK$8b?f%PU=*R6ZGHrKxzKN|_olwS1B4;!#*`>%8JuxlZRJmj>_|x-+p5JQrog?~@t5WN4kKQrUBcMz23+@UQhmw$Z?52TimX zqL{Ya)kPxBNF=#r*o}26^06?=)vKm&A5_I~8UOQ}1BS4Y_Ew6?NIu)z(8A+htWCy~ zdOlZ{Cr;A0utB`mGqgsP*}!QCvmXRUe-iY6GcdG=OPg<$QyZ- literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/tools/ServerTools.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/tools/ServerTools.class new file mode 100644 index 0000000000000000000000000000000000000000..b7cd297179c16a677f5ed33f11a1bd23287344ec GIT binary patch literal 550 zcmbtR!A=4(6r94s>WYF0-o1ebd-MP?MiNh}Bx3MfmIszBThcA?U7k!l_yK;D@f9(e zcrspQ=Dki|C$DesFRuX3aU7x`aG8;lxmntT)>b>Rxt!~a600Uot`aj}C?_pVQc9dQ znRLdaxg3yPk-hgiL?BR`sg;tc%BHeEnz2=&+|`+O7Xrmrdngd}%$On+v0Fh2Wr1qU z&)hEOBc7v1DGAhLlc;p4toHS`8MsHC3tYwj&DjwMb847rlbg1L11jGZSI1w@Sgn48#RtZa1!`+QsA0M!lGaJb<*j@Tv8U@V~d E0VhwD-v9sr literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/tools/SkinTools.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/tools/SkinTools.class new file mode 100644 index 0000000000000000000000000000000000000000..967e74a34deef98a7b5772962aacec160ef8e535 GIT binary patch literal 1616 zcmbtUTTc@~6#fQUww9$JH}43F*p|y6sDMR8Q4lRiQbMBfWm<hnYKX1)sT>;b35OB=j@s9oFBiwd;>6n7Zw^AW?ZRx$t(Lg`QBGr`Xyde zuFUyjUGwdnSKJbs`*PipIjuaGYtM5^JX28as##eGF|=)pZNVMk=J~7aCIK0mrj@Jo z3`1i)vBnUZ^WMoQ8gb4>7)=bVX>zh$E@q{_Dzc7bXis}N;j9T?nSJdrq&HNFVK#lX zC{qlv5`{ePd&Lz;>`0$sEuQxLJkOR31*N%kwbDDhYD^_g<*%$2rQ$eSCMo2pmX-w8bt@XEOavT{NIU1J{Qi(T)zR$)D+$1eg*bK=aT=lAX5kBWRHL<3eaSOLC3@~(7s885!#F3y+ zF|rrhBT;lyB94)ZwR7Sb#IS`SQt97T8zbN(ahDQ8jt&{>${}Up4#U9d(qmzqVe&M3 z57M7e!aW=JF~ML_x|T_UCxgmpU%B~I6r-53@xVYM1YHwOnQC+t(>5NOLz@mWD(?#O z&QXlvktyC;hN=1&sIk?(-9JxEC$LBn)r#m1l3aa3Fhq~#!!Q_xKL-3EQTn2qg@hGY zc>x!xc3U!9j!^9m!JFU9VPkq3|k*xZt#$mkS mF`iHaVT@xAPbu<#bmAH2iEDxE5wM?Vv#2H+p3}Yoi@yPf%E>hV literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/utils/NmsBoundingBox.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/utils/NmsBoundingBox.class new file mode 100644 index 0000000000000000000000000000000000000000..2c42bc9989e17b1a7bf1ceb60c385d0b8ba606ad GIT binary patch literal 16020 zcmcgz34B!LwLj-(naRw}p1@5ABm^XxNgyo(Isu|2pg;r2B1phxNQPw0GI5fyxzwc< zjWM)JBWi11s@Mv}Vht#^*4oytzSreFyV&=%`|{dqZENkb<^9k1-MP6FCO+T$CY3+TKr*To|{yCSXq(O6I2K!3EWuWoI3Ut?^br!Csk-Wc2Cp>(FaE5p0ObzR|} z_PTXDu0(I9bWpm4iI;0|t8QAP3GcxJX%sTN2S_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& z(l|H~2yoIkIFSc%(i{Zyq?42Ss)h05mQRxh0V@ap-8j!kqhceSs*DT@7@4#fw!hTy zB1&b^dc#MphMyvaNxO|~+H2^Fj~0u&e)R$D5cuMb_Nn8#p-xk|a4hfJWWgc}1n|cnc5*6Nn)jF_J(G+lWI61iGpr z_aqSLst_MdAkbAI?o)_SzJKh{+#p9UqnNzL6v$&Ll^7PyG)fR_N@>0^4KgW1B%e;r z#thnIl+&d~1!OXldW=fiWz2Hr|5w|l;)NMK$PZz$ET5j)i{4=`x*&LhABIgl-h7H5 z-CA>kKlLnnNa5DYN6{w$SbYIzRAWv7$})m39tAd!EXv|z*q2yI8>ilt9zL444Ezqm m;N`=RbZ|ea3S(!ARpZqVKep=E1 literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/utils/Tracker.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/utils/Tracker.class new file mode 100644 index 0000000000000000000000000000000000000000..03482dcc583b55f41ed3a78a90bd98db1d74f64a GIT binary patch literal 3782 zcmbtXS#uoK89jHlM&rg7vapeC8QbzA$>6q~6^~HB0tLZ%AyQZjNw}Kn8MW2ZJ?ZW- zmXnZ#C1EEU5C~aF2!6=}d2xiRpm>9#_z(FbsgQGT_h@?1j8c`9s(QNb{nqoH@4Hu@ z{`=a80KSGR1~LNEo*h}C-wG=B|L1;A`&#nZr7Fic7exoTPE3j*>U5Omuvs#hk zhSp*rD=T(jASW<*L0*)WE4{jPcIg7e1ParR=R`9C*@?*q1ah-})h;570TX!?1h$pw z;!LZtWCx3K$+ZQB%6>(<56Hk#-^pSwT6RK#nezV=V@cqKx*g5BG7RSezp)T8bb*}{ z^OI#Axyr~o+f>;}m(l|ZPTiAHD_~f+_LiECHFeI~@buJ7X{J=fcHC%SxC@iT<-nFz z6Faa|;QC4{2y8Ek7X^kVk|4CHcvYJjF)@l=RAA^jVud&Z+B-4%NXmI<>u%R>&@h$9 zaI=9ugmhzeC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P)Y#c!3lHN|M(grP#@ z>%vEPu)Kzc-^cd^bGDCM!wT>|{0tv0fleBu8l3$!HqM|9GTcM-e3*4Qq*I9NX5kXU z1$TF26_**X3cR!TgY~^1CN<4MY#A)7hT?)Ep(>#!;phh#SN_u_c$nZmM;i*tJTgOfsJ3`sJ9q&v@>d1^ dYp%VD-{KAZ_B;Fmf5O|`Q{DY%yn}Z!@*e{1^dSHM literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/wrapper/ConsoleReaderWrapper.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/wrapper/ConsoleReaderWrapper.class new file mode 100644 index 0000000000000000000000000000000000000000..86eb9658820acf286aa68d66f8ce72fa2b99bc84 GIT binary patch literal 588 zcmb_ZO-}+b5S_xp0-_-Jg*R{D!5%$mObpRPT_q6%iMO&8C|S0fwhR6(PbMDx0sbiC zw4l+%qnEy!>3j3}{_*+-0LQTJLx#Xj%nj8tRUuy}VYt$CCSo2cHZpV`%2~n;ReTij z&ZB{%ZT4|Hsq?m4Eo>^s7~3O(TK%k+8InyMIe7FVqwk*WSgxX0k18G zyaZV&mLUgu0+j$O-lekvR}X9uaRRkKhAiqaC9J;+dS)Utf!p98TRtIB9COo2O_E}# zwPq`D{R>I^ZXHOd2z?%F(M^*?D#M3vjz^qS=xf{gkB{6aO7(<5>EbEmiCviXVTVBd zE9q6|`-ebbsMx}0Ktb1?;8NJ>8-FeL$focP0ITEq0P<+z_VD%5qlg4CclZK@XEZWU sT9GVu4ej!hfVd9!P#aKjScOf8wH4M~(k)bYsMtp4?(Yaj_gsa>Cybbr;Q#;t literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/bukkit/BukkitColor.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/bukkit/BukkitColor.class new file mode 100644 index 0000000000000000000000000000000000000000..e5c812d5db296b31bbeb19cbefd0fdc1abb4f816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~3w}(RHqU!1DOm9esk&@ddu* No@{DW}cy^WUkoUZ@Gd&Y(1R`mw}&>@0#{XzWA>3 zU2ltfAgIREeQIPS^@6W2GKR*8%NCoyAKrfvEc7-CbIGWjhy zRibEsVW7>!9QSI(MH2nktzi#R4BazDZozVeBVTy*1mY zxsGi<5>@iVFgCR{@_c67x(5vJY3M??tO-^4daF?p?oD2?0!|!*TV?K=avg1ItE2`( zy(O#9aCs{8?!`!8G)a+spkW*n3|)ql5JNc%U#oc(AU039BY_{PTa|sX!&A(`BKFbHVM6;#vZCa|5k(uU+ET7 zXp98NFs=HEIv`VgqvR4e$-vGf@gdH{ae7N1hSnO+;vcnj%xV<|#%#@ReVYig;oQ7U>%dbx~^dL#y<=0F~Y4+W9$)Hh|n+?sdXG11x zB2pWlYWNJFGxTmyO1)3*s)inkAahsVzbRR~#W1-?^6)cbKu(&}rdVuCije)+g+ z^R_MAg2g>gcyW+QCtf3Lr?lhvj^V)DuTqUej&PiSWAx6(uwPCWTE%JAfdtaBN$EQ+ z+jetbwr&D_NYTzNI-RDw@-OuY{Y%e~evZArV&rGq>A?H+Us{4Z90+zm1CXAl$aXR~ zqdVz?&vEF{%siouu62A|%*9SnT)9pTK}KnG()S>F+=l_mhempU zG#Gj#1j*Vkany?fp8YEo-S>hvy5ges)K8;h*1N5;F zVKa%-0edu?NMB#$8=@>?Z-j#4o1x9pfh=7ril!1qLp!SIPAWX5HX%|WM1N8?Ta@Za y3PbYL^9pQ0s0Dx~?$fW-*#mOpqJ>pFq#fDP-{KLz$M8QapWf*J literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/constants/DefaultConstants.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/constants/DefaultConstants.class new file mode 100644 index 0000000000000000000000000000000000000000..8f8c79b326a6ddc49d5ce3fcc8fcda7e8d12f22c GIT binary patch literal 756 zcmb_a%T59@6g>rz0S6!We(O$L*tl|`F)@h71ks3LYsy%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h+k42GzJ8q|i-f;I`Q4CxBc5|5$@UPIE3W%^A~a31Z1G@Z|788Vgd@R!I5nUG&l za1ob?55Bs}Fd3^P{xP28%VAu`6$xDo&(BE1f?Z6R8ntNkh>UJrWr!@yWnQMT$=qaW zl3}hA%t200q@hu1%+SHfmNr&&d!DZpX?UX zgx2_#INHElotnR_<-g;ocoB5r9E_t+k1Lhg=_R5MK%4)bk(C74QNLr zu6u8V1&OF1Ql&ei{hHnb-1zM-Fn}C|i&8c~4{p*bEJTZT1RjS_3q;+$pAci%$3SKe z&3*g0`xZ5!UGdzzkKv{2T`~%JxZ0>BkXXxT6_QO?JG#)}C2A`NLjt2@Ba`~};}NAA zqg5T)525fX0T{<)AHWEC2%rs=iZTuCW8xd)?`WsYLb;62Kp72QOi{)p(OE8I$d3{^ ViZUet2SaoRLPY!!3^Sfp`WMIgG_e2x literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/java/net/EasyRequest.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/java/net/EasyRequest.class new file mode 100644 index 0000000000000000000000000000000000000000..03a32b29844c4089b586203b75ec894d008e953c GIT binary patch literal 11757 zcmd5?d0>=hng2b>WWLGpk&83X!axh;WYR)85}-f`5J&ALIgx?9cu-uL@v@?{dv@Wj&0BX0ChTq* zT5L}xBC+lUfze}IokYcTXIUW#ueXvttyUk`3)>^zF)P)dumzh(?pQVwrf1WtM8X9ynil&UlfiaO#k>L-<*EU>!m z7#GV%N<|P@))9@wBB>RE{EEu$B)l=+X&WdXrZq<~g%C_PQ2@W7xP?a0*5A9=PHeUI zMk%JUmUxF1-EJi!>bE=TU*-b8rsAxuDXSSF#menLF&ncK zU2{zs2&hqoi4v5mQI&}@lm<{ENVLXpiA1AT_?r23p^6=mSZDm^WTaP#p^A;`x3;#_grbrCc4(d5u|HlJYV1kG zd+qR2o}a&P;exvPOBaONtuC_fo>COdH!%Sd1E>?!dh8<&lj~1q*sWQMa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YdnC+LC*it99J`r*B^4ceuIuXOD`FOaKd)+xE5&576TfAr{z1i$@MD_z`^I{+sE0c7N9xU|ZQCeKSi0*P zu7Xzt9)5@PwFFe~7l8x!o=R!ytBr?_ zM&k~;e~VTm=zb{uIy%#TL-*y^vG+E5)A!%TzVy&->`%Xj-lKQ$z$-K>jze_aFY))% zx^BYgMGx*nANCQ4KD?X0r+q{m#=|rsY{^K-C*~BBPeSi%W zS7xWtoximZiG4TeAtnj5%9jsFWB%fnz!>#FI9g-z{##Xx57u0KOj=~irvu9>S>FHV zb+jaI#+iVxfKT9X1Var79G7zhN6w=-5sH0MZs#8~W+$CXcbzKZy)Q$#gZJN(gVF5Z zt2k4}lh>gRzJ=L%8FSgeGM*~q@*R9+X6Wx|qscdr8e&F&#c~Y1r-T&b0QnlEWg97& zBK3Mmh65zTBeb6rI4*e}^i2mmdvFqKFp1^~?8OyaC2AF4_}?u0#=Gf8BK0=<6r6t> zJqmKu^hBQuu<2Uuq~2-GK$xs#BU&xsMh-N2u^22>lVb? zM;U^Ccj?M}o}jI8h_x{!N$6Gw&alMl^(O^bG#wjwnjjeJS^zagnz6%@5^AW7&1$UC zh_=ZPD;Z$XN_-O2WJz!Ij4{z?@8EOQ`kjezt;85-Ooc1`Jcp=X zl&E6?YAQ{TUlL_}z>d_JEF^(UECay~p*+A{~^dL$7@?EIUMl7_47TQA#?Y@Q1B-ic0kK=(Rt%GSw zvFh0JIs1jAHOPueE`Vy?8aNl?_z7)4hM(eR>@#|EgWmlPH}NO@nci^9-@>bS4SoLs DRnpQS literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/java/net/IEasyContent.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/java/net/IEasyContent.class new file mode 100644 index 0000000000000000000000000000000000000000..cfb7634243358a80035c71f356e215027033774e GIT binary patch literal 1198 zcmbtTTTc@~6#j;mUT7_X2;vp*EisP92Oo;45KJ`dwa`R)nr??O&33lgovqYgrSVB) z`~m(bl?9R(KyYCrh_O}>H z8-Ad)GMfy!dZW#d-wwO742DV-vnVjkdsOsQGU&)?S9Ai&u;_)p2-+f2_B~PNwHT0X zsowC8OSVj;bgxNS&3Gs)ly$L+8s@FyP{j;Sz5i^Ia+e2TR~?M^qQLd=fi$rsY=Qbj zfbP{j8WoSn+K8j!VJNjan!LnN@qQd?{(_FS2ol+B*qM}Ds;7lXA_{+yC46IjGtE%x z$|(r@Ta7FzY}srfwlYH@odm<9dioLUaQEJM%`C+&37-6Wyqf`~$R+lB)TVI|`9^lm z40p0XVpyK09Fb{4JDwp=I;6RlTd8NtQhDLz!rZmQCB_qYT0@3ay8t8=QF4D`2EA^R z#r}%9AEmFD`$FOjs&p2dp^Q^bW0#MZPBJYa-D&WBx@~xI{Tmh-K0DXr;F=4rrY<;x zCD=4)vFz>@oFmJsi#bpF3%L0AeTk&YxI$1;`@P$`w~=ZPKVKL>>%R bag9zZUB?Ydc9Y~3j@8^E4Wj|rj_ZE_Nb)mf literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/java/net/IEasyTextContent.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/java/net/IEasyTextContent.class new file mode 100644 index 0000000000000000000000000000000000000000..a08dbc6f11deda6645f8990d50777b6d36ae419a GIT binary patch literal 1974 zcmbtVT~pIQ6g^uDX-g2PLIoAU&$fV3K|u?mtyIM#D##4OgR`^?1ly#OY!Q6&-}vhI zfFd)#I^%D09PcI>ELb0k58Y<7d(J)g+`F3}zrKD0Fou^JLJT=eNW-;jPEovdOeq}K zsF;>0I($_cn?<`)<Jzz&g6nL0lHEh!_&+(Qx`eq5ZUV^x_PIwyA8NTV=SCth3&4 zhDP4S(1~+8`f#41b;7hvd5@v19vhS`wHUzwLr12+xXv9{$jMg=`QdSezo_F9E)$+t ztHLTV3^&5p$?++JEHjGYst!%1*-@are^#rk2xoz>l*zq#!7lRhB6mzR4_=1ly6G}Z z7mnK5bq7Z^q$`NNY`&v-*PCg`OlmpHFwzXf>*3|Bs_k`^bRf4D~6%w&QYsflhvA3RXp6|WPA6)($ZlG%4;+c#XoB8 zWJ&SOEU$VDn)0%(Bo35yIosqVFp_KzqLe6qpQ__jU^q|se^(;4s9NBejyC9Yyh~hi zhS zKSpc4>A_tXAPx# literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/java/net/content/EasyJsonContent.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/java/net/content/EasyJsonContent.class new file mode 100644 index 0000000000000000000000000000000000000000..d94b8f8ee0e778e05f82bce83e414266898cc2b3 GIT binary patch literal 1993 zcmbtUZBGYZ{sY%n%{wU*f?@X6fF=UlwxjFZq=Q+|xU-S7g}iRHGk_nfd1No6;c=O^~A+>^F;cfvrqfwGrmvcH;yK{d54^azX?FJA^b z_WI_o>nIC-0@Y85vZCo9yDgQ`3-qkk*VhDUwNGICh~{~LzDUN28w*^mF^50q?0 z&q6owTA3vy&)#LCwintu;hznH*!~5__X1BX3gpW(8;G!WROw-Ki>|gkc@-%OVC)pd|Io zOLzpb!BFGnnc88C>MHhvo%w!z&Cbav@;yf?kBRDR1qK@7mbbnCB=${yzc67HrWk=c z<>Tw6i?t#BraON`RPxuooj|H)Okve-=oTuAM==&KjTsANfy%K(YfCHQ0?rEb?rEI@ zSGvhcp!9C*_M^0Y0(KWXIvs(+b{sZ3s{28kX1bsxA1nG<6k3)3n!Yb$7S{x(j^sNG zkl|ei1kEBfqpAR|#C>huS56-U8D;X%ul%SJszWjvMLk z*}^S>xnt?F@vfT{&<1mMwxp7JOb?UICWmU>RwQt$qQO|dX;dEkLelb*+=UHihLcUb(tRe@5C#J zr!O(|2S$IVnZrr`@1qkigmH7DZ@H*4;5`!n7^%F(smd#qh(7%S6Nl&_dg!n{L=E%Q zEE-J=&KOAoU*T-V_bpHTmLEHJz@t+@sRNqNpre>HS?V0FWYApxxA%}|I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@p-j_+cJDA$JWI>MLH(W53?SnPQN%{^uHT^+%mCgb{MU)g3- z+FoT;dK-n!iaghkVRgeKlM|i^T+8Fev2kpWX>T6CY4W?%{<6kACaV0N#tFPBYtDF8 zrMJ@e;_XWfLR*=ZcQXqKu!ln2%i6Gy=XO6f;s8b7#*@3BXSV|pbn-RoAWq;A`Y7-u z0e*(#&r#Y_)SW9*cTP*5g`4!a)P>m4{~2%7XN1)Kg$KezE35EVj`=k`$6?&U3i7dR zuYsGlSv&k1+h$GCO(@cJQ%HJv<^%yRPCYntYI4t_r8`-T|K>8n{zFLhA5O{q(Q@0-Sm~8~^|S literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/java/net/tools/HeaderParser.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/java/net/tools/HeaderParser.class new file mode 100644 index 0000000000000000000000000000000000000000..181421a60d0ac919e68770311407111718e40eb5 GIT binary patch literal 3955 zcmb_f3s)P*75+v@EQpOCU~Cg7aUR$K8IVm{r?wm$0|tZzcB=$p;y%`5fhA&B*sX4AOCstEdUSV9StFY6SnEcJtyyG%nPpNo30n1v1~Kr8WVo}e8!o{8GbzPTUjqY zZJamaa=Gs~{2VZiann6*xSr{12n%dc3$lhi89#My+RXR@)kiGb@{bBswX}{1gnOKE zGm0wI>WH9PU~`JLhVwJ$O!r~qT-Fq*PdOPQJ7Tz&{4NQ@{*>hj^r!wW&L#vRIq9~* zv6d9K829FE-p1;nDqlu&Rq7Dsc)UZw9wlW8GY{w3P8q@aOxwOf6Y;9=` z?17?09h$I9!|i3doX~Lx?xe0v3Bz|>f$e3w$&#D^yK#?(yBWGQ=9^KQzfy@C#1u5XvY0IS|mXAr0JhDl_;iTpA^+lG-71)riONbO=|#> zsyehGu46wA(70zk$>1;plNuflV8wvLbBkbrhxS~@i$ zSr{u(7+jW!B7uiA91+-e3kjv;D2~xJPsS$QQYiz1bhX}6!b%>F>*z)gt&lK*#+GEz z|59Q{!AhW`5B)Oa<4hQ9VoqT1IxelFtsyB8+t9v`yRI=8#Qq!*tCU9~bBf zS}QrW!R;zo6@=50(~kuR;r=|%E1s2{c2_FEjIe=HuFpFT?H!_dY zpt^aYn8LIMOQ7TZQYUad7BkJ$@i?-)94xO?N94gPdY}$-DIr_OWbIK!#u2!Gy%hna z5){*X3Qy>8OBQ&2ny!_J!pC_H`PEujEKhU3spA3|vs!iKbyHBmmu`vhq%3%!Wdqh%amS zQdu!hGMgt&SI1Xyi3LiTp{#~8 zOA0C&8I%a$mPWoK*%}P)M5^&#`!2Vrh?+6{sd%?FSu!5QOSmi>pzl?{9+46LfsP-R zBHU|ctQjL)gDV1|vmH@%;>S9Ef}iq4dbzAcBG%2F#{$Vy%D5l*OllpT z&+&`Z7%E8x@A@RhujI~uEo0ah+_};txv$}M4U1)WZLgDOL#N}nctfC0g|H~9V5V21 z{9c+_k}GCxd~PwH$QxNNIcYnt*<*O@ zA8rWjUd!lWJKE>C4BLs>jG6N-$0pON1&|Hu+R_rKtns$$VM$+FwbFf->}9tGTjUO@ zCZH#6+jM)fhUb}VX(OuD!2#aCRqV>aXGpfj{MPst=Uea{iCsm_>l}m-c*yZe?=FR+ZA0>cY_ePL5vGM5ERid3oiZ0kG;NoEoLS z9}~E|GAM}%DwTTF5A znF2nq2G17oRW*3NfEO22*YMIA=G?s0`Tjf(#Oi;vgqN#2Q~L^dc9geTwouY)sqv-9hRO@_ky7 zdY#lw^Xj}#-({YUagRVNcNAlOw-Kd-C~=~666FExp>8{W%68x|M+uG|LKlvag)Sm? z;}P^QRJ}y)X9xy}oJ1BUk!RZ}&(3xRgB;;c_%q+9iT4+dgbK@k)ak<-t`7wMYgcGG lq@k045S$p||G)Wbwo3{^_$yID_#00W=)a(k4S2h{_P>G`IspIx literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/java/net/tools/UrlEncoder.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/java/net/tools/UrlEncoder.class new file mode 100644 index 0000000000000000000000000000000000000000..abde39c60a8b3e41890370f924b26630ae494b55 GIT binary patch literal 6578 zcmb_gd3;pW75;8!c{7tqGDHRl5F9YkEQCo#M@a~h1Sqi~qHKm(ull>)A?n$#9WT3ZD~oj_J?JeJhen7&$#rZgLs4Uk4N&q@jurO61# zW8qXHp~dtdxvbZvYO;Nq+DXao6_K`>s;3f~z?P$An{Uz?maNbdRJ*eN7&xhN0rgSB z?P?;a(Kl1gQ(}>L&{_-DntReA^TW|dETS(EuoV@r7O>aS&kFnkCl32>Jlj2(h{;|| zL9T#vz9GvEp6W#=yb7id#w#rl9!$dw$#Oi;E2=AAEg5Ed;eblSTv{|S|Cga2AZ`%EESD<@Hxy? zaI(OJ;Q*L8PkM0*P8G;bXcwj;39TU>YaoZf>FFk#w3VZ=Rh+hD5h*xrFg|JS@n9Y* z6;x15LxnM*{cs*a@wM4$H^P&kVOJursBSD`oPgZ00C&QqHW3Y^l zxCNccF*KnyEt+hG3fRSF4J&VfljBu#*b6d(k2l&L1yKt39w`vaH2XFLK}` z3iS2}+u-73QY{s93QQW-*YsCSsFq{Cs`DU@844~Em~3#e zv`XJpClczWHO3U-K^G=V{>@%|3123^#CA0W$<|UU8_Fdza9=SO)=G(6ytoXPla%Py zVl4vGifTu@+Ek4I?ZOpad{wq2hcUTuP#EtLYxMq%@nY6g zTIO#+0;9lOASP zs~jUb!{HOiGl@q>Ru;rCKa7tpsZ+a*W+aIlYvMqpe4gJVGW%(T>ijrfUH`p+-2WwT&T7+W#X7rRO`_~x8 zjrN$82nv2Yn1*T9ttJ(Tax!<}6@khTx|_Z8X#L^A0T9fu;xz?76F7bt%;xa7B%bI{ zhpUC{7u2TBl=4u))n8N1?vs-NT{|F z;qk;KFaD1ASmHW{mjqr)4}isK3SX+mTB2IApgtbokm?*`OilC52*#D0I<<82qu(@- z9G^EG^_JvXH5y&Pi)v+#6Ms3P*;}JUI+wNN!v``3AA0c)eoM}O`cT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JH0HkCi=X7VdhpX8{JaOhlx$MzY%^O8BPe~xfQwMhl$m8=SrDJ^;ysSm zCZ?}vhXih*H*Ta)Z^8_0!%W=5#&atXaT|iXg4Sa@QGYwpeg~0$Cna<2YS2X}EOga`0S6};oJ^qDyK(Qv zr7O!FZlFr5_yPVB7ybtE^kl%{v9QWb_wDZ6eZD@o`^WEZhXAHAqah;jq+xn`(`mUi zbH}wj({1W?t6|n$x$f!PHK)EMJ-y{wc2nP!+fw%&hvB^I%H1UuYKRGR`%AWLZ0OHd zH_e(SkeIa^mNzF5EtZxAVhhfinMM?;4B|)#bQx56)~c_X?vh-!O@Us+sY!cTx|SLT zlQHkL)fAXF{u8r8Mb9yu9n-DJrfFDBGL95q8Gp&Eo@+HWDy8<6y0Wg)xHDC?HX71v zxul%=mp!xRkDaS%$O>eAJ^yguL#2>LFH&g~(66EIl$mX$36QmA=chHGzCFgwn1}rSy{J*_L+8q_f!zEMU28-=KWRixXTL68CqjlAW_p zpm4g5yIaS#3_E*r+J#mLbXGlCd$TCF{CA*Xn8@pv&G&h>1i_`wlZ5>VlGFnn%V1pD zne?2tYsz^&gS*PKg!#55ZQ2r->V==NCpd-nG-RDMNI1b`5Bm@#X_yp9SN)Im)Kc%e z%fGY#X(p6yxCd5=UlD90>Q`{Aaip^s?Bk;cNPcAyL7J^v29oGtn`tMo@8sw`E}@HA z-HapX@eldJD8cdgcl53tAZLuOJdPhu#iDbcksF8)O)i$l_L1Mml^5@#VkjT`bo8sd z#|<%GtUw-6DoKd}iripdric!yxjw xiY#UOL&zmsKFNGg@IFBWb35?>4=Jhu`w%@MHvy+K(kj3ypeMq_X)Z_b=nt07I)DHG literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/java/tools/OptionTools.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/java/tools/OptionTools.class new file mode 100644 index 0000000000000000000000000000000000000000..1858e9615a9fe343bc1b6f6aeb77c2f466555a97 GIT binary patch literal 691 zcmbtRO;6NN6g{`?P-dKwf&&9Om>4#I35{+{M2XSFRS^>iiMV=GAM&8nPTDuPHgV%$ zaOcVm8#kJ`;0O3${0riF1rrk4nI`w^+@5>xeLsKyI0f(kw?lY>C%Lw9RgBA2zblQ^ zWfc!iuG3QO+xR#wh9hO;u{Bv0AF5*&+oE8&HL|A2cU&AI5JWYWsr+rcH8|9%6-+!b zxv?7pe|cqB5Iig1=oWl5+h|}yFqLr3i}7%v%N;eyv|uJFQkCth(zyJh7}x_-37#hZ zt8-n@Ne^^-^s>~I&QlJYUw)m`!rgusJE?4aWv_*4+z2s4P5TnNKz$XPf zempMokXcMG^o`Z;nEYD9Em{YI4cBPf=MD57W*>1KQ>?h3-`7;Y((0>+!Rdzo_zSuV zLH~Yo_Zy;5X!s`|Jn1ifKKm7%u-%8Fp5t_oI3i(>lnadSFmt2kNJu*R9({x+=7|e# XGV8)WV^brXajz_Fd%){az^D&|t literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/java/tools/ReflectionTools.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/java/tools/ReflectionTools.class new file mode 100644 index 0000000000000000000000000000000000000000..148d6d2234392e5684d3e243215006c143e2c7ac GIT binary patch literal 1454 zcmb_cOHq%A?9Ed^8r6`?KI2q-A6D1$P?Ou-q;Fymu$8$$`EX-!fXSoagGk_%Hk;;<-sP1iEqIWai#;&OMLsyz=YM=^20}tV#$myf8IKu^TN*)ebG) z(JWi3>!zk!eAiJ9)JDC@9i`>yhOO-L1FkrY29d9|T|-kHy4NVF zBhH>~Gpv{Y2i77(%x+axgWKeDF+mc0wPa`AzsmICU;sEfi879 zDdkuG#g9-+AcY|bX{yE*Br-A>W=PaD$Bn8H-gGwit_zKDF)HIaZZPzbc15o@4Q-3p z2^$#%^g9W~FvbviUr1maw*SQE9^x1BZ6x0;N6!``;gxR~AB~R9Z_c(clDyf*t?>Lz8h5D*a}64V5c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|UB{;~K36o3$ITMN49PxpjE3LspZ>mqotvQQN&X~k`5=7!D(jwqte2RK5 zzLyX}Igx(GPauI%vpU@l^-3@=5 zmh%Lu%!$0W{1ozQCh+8$npR58lXyyC62B4Ts?*q3mNSVz39{7Pw&5Hu^_2YWEdH@^ z9RD82bK}B66E-ds+N8+Uh;w0Fe^WnI~S03P`kv;Y7A literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/minecraft/MojangProfileServer.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/minecraft/MojangProfileServer.class new file mode 100644 index 0000000000000000000000000000000000000000..eaddb1a121af2d103d10c6d4fade970fb8070263 GIT binary patch literal 5599 zcmb_giCX5DACqaj>Y+|Y_b)U_Z;os-w|pTs=TOB5So=@ zo3TJoiH$R<3M)lYMt4VMm7&=D_YjBW9cQqd5|bCZg#U1)iGP;|hw~k^`oS zTNFs+mJW&!0aR&N2|tl-mNLtrV6}!4lqy&rV(7Xu@qW`fX7tCXIuJ@mjM#C*ii){h z^udEF+K?WO()W(g`$Pc7W5tk}?oCAR%a|PlJuzd#98j>a=E}&`I!l68x(IR5M;~t2 za0foHP>2(01)HxfM3T*Agb=ey!)Dw@ZVXz&&y0>n z(|W7?(NK>Da+k(;4-PU=rnKEs(BP__H?%gCcYML_U^%wnP8B+%akV`fK7_4|(y(DW z@U)tPNsCb;D^7~@+ckU`J4nbpAQ{7&D*$8o5=NXSOH%@8+PdcImJy6_+K7yH8YxKt z70n7(EzYObOf)uNT0XR3kBYk&B(sCBhP`N2P-bWPZJB}!R@QWMxW+9EL<{z5Xvcm9 z>X=B*?!iS-bm~K};Nc(+3XXRus45ir<6azApfvgrM5l%>bQ1?7l`<3LTVtUUS5VM( zmc$F02SOn`4EB6M}I*$v77nPbNxZ%4|VELGk%S zm^)V3_g)aP`A69;`T5!aAFl9(kKHHt8e zI4L=cI{QFJB9%!y9~h+jV5=a>uURbxu(mF(cMjSju(Y?B7&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-I?=ifW@w_LCA2KII8U%haAMp}Sr{<@n)g?K+*rZmg zZwg;#@N!>WbxC!pXByK}oveDIq;JGH6K6AqYC9pcU? zT^S`kVgw=1>`w4(5+i&zjl;qOYzfI}x=Z)wK%bQ0uwCNBC6a#y?VF5&k4w$2pEfTKHeYDpu(~U&g~z xp&b6^R7xM)*KB~D(*Foo9wnb2%j2?NhCy`JV*G2a(y_cB7Vs(fx77Ea{{xK2fLZ_m literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/minecraft/Skin.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/minecraft/Skin.class new file mode 100644 index 0000000000000000000000000000000000000000..0427c2f83c2f88fcbe388859f802d0c22393c049 GIT binary patch literal 6263 zcmbtY`Fj)R5q{T~WU(Y5a~g2Cu_c4J3<=_hZA@zL0Ty-xO`ELk#jKGfM_Pj+S6kYq zv>`py#xy;y_H0;QbZN+n+#|~Ku zA4)V#>o*P?k+_lQi?nz5n?1GR|xIj#OAj5ETSxAGFdM9;v=HPJLC0*&6eADocm$g?1O|m7D%u)i1uWLwX9@+t zW*u`dSA)+=lW112$|Y$vHD((O>UFR)J1bIX?xjYptFhO|}z^S4J7t zb#}CfKOH(^*sEa*AMG`Vr3T5u`a+SIxOGV1aN1xrfG#}l!$&oQCoHF|n2vp5xiZ;J z1B3QaKR(97i0x`_6LlZg@d-Rh0uZW(M<)+aWj^YML0vuAIQ zcKVz6<@sKWgE}lUkSBK1X?L>q;=A&mV(GA>{Yb)0b+Z2kkiei1Nevs5slLcjV;~+$ zCyYa;+R=uYN*M7-w{!t0bA`RKSj;E2L)?TxRug38$FBs8V+P1L9)-fck z2^>fz2ON1njC4I<3)U))HrC|rV{Q&W6gd) z=7=L-)bWx67Tep=-1b-iFXPKTd`ZKW`>JM1#HMm8`>KwwNuw-lYwu{SZ($LoIi!%0 ze)P)~^-VeXDsQO?vg~oV3spXROGCx@Fw@-LG~8nj+MEJ>__l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Rq^f*}_TmH5t4);xz4?w(V5ZtGrZ3Xy+6!mDh5xRC`#e@l*UvVX4Gv zdgNf4f}#(x)CcXqe5J|U>;jT2UHGkTj1109n>Os!+L@>FoBiv`o^ugbxb`&pDsWX9 zR3%Yd8orK2VHT{Th`v)VWj*7$-0SF#oGdQ&d|9eIaJmC;Xa>jJ|| z2RQ%A?BZMj>pfWOF@|@D!o4p^V40R(SkJkz>c%iiX8oci9K1k;OzJhFazeu06(=0r zo!~B-!LQ^%mfV%35AZfIT_L71VtR*|-X*51Ihg8POny#7*A*ttY@-MPKr&q=7?)l|-&@(0(I?LuM7SIW2-Qo#+Wz=l*%FX4~*8gJxitW=0Ft)8g= z>}p)bRWz0gqI_XZ2{WY>IfuWvA~i0nINn{uXa;}HPFM~)PmBluPTfWL2mYznfBheu CO^=lT literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/minecraft/SkinModel.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/minecraft/SkinModel.class new file mode 100644 index 0000000000000000000000000000000000000000..21989ed7543ad852bd9c43bc041b9b8220fc7808 GIT binary patch literal 1804 zcmbtUZEw?76n<`;#EEfAW7>4Iunq<+cA;6>fNcrT(v>a4X|;JoD*G_q1~(WSyR)6L z{uK5rx*`>{X^7AJP1Ce)F!MD;YwYq(z(McjN=r`MDw@i0W=_sIBf+`j@9V&|A>jNDnlqr=>X08th zTW<6t-|}4s!w!4g@AAkKYq_aG!AYW!Jn~}V({~dF=RJ_-n6fo|g!3xSF-#tpqvK;- zpndn3A@}2UKL{gtmB++)`h7$m5Zizcq@3fasBRS};k_pvzLRP$CE>_5hN-&wu9w2} z1sxY*3W`^BETTd7kH{ROu(9>n?Ilg~K?zF?g*b6{T@m$}j?ZCIt0bWvK6RrJdu=-k z2P5nfZV>C(_XZ_=NnhM|eoc#aWfO1wrSRFF`ZN$&5`4N z*AwkH@phIMMIniz? zWmFC^{|qW|*(WCZGWdu^nZh(;qGu9Tsp~J%y-(y_R-sIFm}%yRlsQKSHR}+TyTjZgO%4srD;y&+AilA#6(K1IT&B}8o$opLVFz5rtqtOWKCswz!R8Q0!w`8m}x zPl#9VS;loj{0+Kgd?BIVRW^bawVcHa=ID1eqi#NQQl-&sHk0;ZrYw}hrZ8UVQzllb|^f*%KeUG^EC#2-EKLqBc3rN3&k2ks_Zp* z7X28|U@%Nw$q5YPFvu|C@}sh4H+f@EN!{_h7DJ&>{5KhWU>G)#MuuUqLQQxXw(H#A zv+6C*kgs^Q)v8&(Bk!Y!nRTT)izLPkj6x^nqUi(->y`g+EHxw@2+J2)Qgp+>P28fc zI>AQE>5vlY&|8Lqs<7<$+ty(uMGu;xXn04iOqw<@Ba<>t@SHsB#~cn>GK|I@ z#?ZI#(S*v;ljYqva2>i_tr}QFfgxK}BfRBEt8!-}x+2R>O;cc!W}d>NyR_2jtI?0Z zbhk)X`O&(_e!oC>tgZ~QYYsJC)L4uq$s1G1Q?_1JzRo0RR91 literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/validation/ValidationHelper.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/validation/ValidationHelper.class new file mode 100644 index 0000000000000000000000000000000000000000..14eef288ee733a8c05c1d1cdd7bd49a2347cabcd GIT binary patch literal 813 zcmb_a+invv5Is)PZo8yyvL#%~rKR*C0fZkBN`-__xkv#XQblU}mXE?T&V=QKRXXP*q1C>yDoyy{m-$-iOd1b0hQ^T?39dyF@%O_c8Cr(fO_eD7 zjG@}@3>a!J(tYWpiupQbFw3yiBd&KvJd|cz47FqkdTA*1Kp5rxNw8)QRnG9L_g{+b zQe7(FHU-gj+Pl4J*?ntN5_R`3gvOn8I|C0*hV^Og8?9v|^m7vxu}tjNNhmX?jgMut zJY4-vk1=o^*KnQ44^k5gQs-&=0?|LX|IYH!z)h#&3PbA>6eqSXPckF(oN8iVy9{1T zo`_13r+rL#sVtgrAxY-tOZsP6=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Lj98nkra`EUQ4rIPw?~&QN8! z8+-0UjU`Gr%b)Z7c}`Sd4_Geu;M_IMY6UiiRmm`C@LpKaL`rzR5+I`iHrGHnmmBy= z(?D8+1~SYviK8vi8zqcXQcY^ApntT43blm&qb2MgEn)v?G5sSdL#rVjHZk#wLyhUi zwZD=oTNYJANYxNhHH1_RhDyowY6y<H`1&@z@;A`h zOcNVfjp3%TI>cwtx=WZ`-=v>Sb4};m^=*223vRDLlik=P$Jjl|6;1Pct|<3$1LJ=A z4+g`xLcqfMg!M9Q8JmBb7INc0W;wphrIXFGCCrZ|d0SsA;j5#`=IcxEZ|e6QZhf` zM)De)+v{wnZ?KoViRbVZFX`L3ig$I%1l{?D?nW|hyohh(JB*|st@v)(o!O8-$JH3e v|0uqv3+?;(0iV)eeo8NXhL7+|e9V;{jQ&^nHGV@|+5Ii&i{Eiw(qR1$L&Ody literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/version/Versions.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/version/Versions.class new file mode 100644 index 0000000000000000000000000000000000000000..73a84f1b9a2b16467efa709827b99b77234f3165 GIT binary patch literal 5644 zcmb_g3tJS|8Gg_1;;_qLkOUP(#hSzg64$6THF!h7xCs}_QX&v)hIN2}Wp^{XOEhiT z+S=yUR@jzTfqH;|KqH z_a=Zx@gD^~f&EE68_A?{W?X;HG_tyxiOd*DJ#K2_*~n}>HIvpja@t5GBZKysQ4kQQ znbKypNJ2|aMEb_2^mtZaLr=7~tE0dD#K4)suKrlGuUFvVZVHKH&L^|lx%6a8Pa5Z( zH!W=}m)s_>xlG2H*g$`@_i=&R?j^`r)-;k6+`m57)laY`z_#wys1(ypYUe0MadoBQ zirDK88A&61M8F?z9ux?4q|WLg_)()mMYX^^-LzV7Ze~n32eh$-F4?ByT4GQ$4f*a& z2C|bzM&Q7zI2O!Kdg_Fp?J4+2AQEm~m3f1pfmKvsoq`5|y(@7|r#`Ob5?O~t2=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*jg8O^TYqTly0z2b}-sIu^C<1%8#<`d=B%gL#CfisfB1)_@-bdzGoR?GoQa-q*Mq0 zhs;p^Ps0zG(1HU{oH*o+ioB5|Xd2g`^C(pU}-er4xMknN|O$ocL~{+q+v@>G=ixoWmRTaFxR% zejQ*>R*3Kr&jK3HjaiiJC~v~snCE-|jYN^{_&a>F>#kh;J>Mk$ABy;S3qQ_imGbI6 z@E392Uj{4-_Jj+#p2FX=fa}VD<=P)D;8$_82>d4txSQ{?WY#zVZz=j`p9{}Uzx6Erd&VLXZ|+ga<-uMF@h)yIhAs>L86*(`qHH?JN(3jLTj%&LzlG emNsrj+1l_62mhp0AO3}ZbCk|}fmQnh1pg1GgQbuF literal 0 HcmV?d00001 diff --git a/vcompat-core/.classpath b/vcompat-core/.classpath new file mode 100644 index 0000000..0fb79cf --- /dev/null +++ b/vcompat-core/.classpath @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vcompat-core/.project b/vcompat-core/.project new file mode 100644 index 0000000..86cd72d --- /dev/null +++ b/vcompat-core/.project @@ -0,0 +1,23 @@ + + + vcompat-core + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + diff --git a/vcompat-core/.settings/org.eclipse.core.resources.prefs b/vcompat-core/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..29abf99 --- /dev/null +++ b/vcompat-core/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,6 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 +encoding//src/test/java=UTF-8 +encoding//src/test/resources=UTF-8 +encoding/=UTF-8 diff --git a/vcompat-core/.settings/org.eclipse.jdt.core.prefs b/vcompat-core/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..2af1e7b --- /dev/null +++ b/vcompat-core/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore +org.eclipse.jdt.core.compiler.release=disabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/vcompat-core/.settings/org.eclipse.m2e.core.prefs b/vcompat-core/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/vcompat-core/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/vcompat-core/pom.xml b/vcompat-core/pom.xml new file mode 100644 index 0000000..111472e --- /dev/null +++ b/vcompat-core/pom.xml @@ -0,0 +1,18 @@ + + 4.0.0 + + net.sourcewriters.minecraft + vcompat-parent + 3.0.0 + + vcompat-core + + + ${project.parent.groupId} + vcompat-api + ${project.parent.version} + + + \ No newline at end of file diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/entity/Hologram.java b/vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/entity/Hologram.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/entity/Hologram.java rename to vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/entity/Hologram.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/entity/attributes/Nameable.java b/vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/entity/attributes/Nameable.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/entity/attributes/Nameable.java rename to vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/entity/attributes/Nameable.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/CustomEntity.java b/vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/CustomEntity.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/CustomEntity.java rename to vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/CustomEntity.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/DefaultEntityType.java b/vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/DefaultEntityType.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/DefaultEntityType.java rename to vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/DefaultEntityType.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/EntityBuilder.java b/vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/EntityBuilder.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/EntityBuilder.java rename to vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/EntityBuilder.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/EntityManager.java b/vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/EntityManager.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/EntityManager.java rename to vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/EntityManager.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/EntityRegistry.java b/vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/EntityRegistry.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/EntityRegistry.java rename to vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/EntityRegistry.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/EntityType.java b/vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/EntityType.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/EntityType.java rename to vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/EntityType.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/listener/PlayerListener.java b/vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/listener/PlayerListener.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/listener/PlayerListener.java rename to vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/listener/PlayerListener.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/listener/handler/IPlayerHandler.java b/vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/listener/handler/IPlayerHandler.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/listener/handler/IPlayerHandler.java rename to vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/listener/handler/IPlayerHandler.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/skin/DefaultMojangProvider.java b/vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/skin/DefaultMojangProvider.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/skin/DefaultMojangProvider.java rename to vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/skin/DefaultMojangProvider.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/skin/DefaultSkinStore.java b/vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/skin/DefaultSkinStore.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/skin/DefaultSkinStore.java rename to vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/skin/DefaultSkinStore.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/skin/Mojang.java b/vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/skin/Mojang.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/skin/Mojang.java rename to vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/skin/Mojang.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/skin/MojangProvider.java b/vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/skin/MojangProvider.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/skin/MojangProvider.java rename to vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/skin/MojangProvider.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/skin/PersistentSkinStore.java b/vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/skin/PersistentSkinStore.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/skin/PersistentSkinStore.java rename to vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/skin/PersistentSkinStore.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/skin/Profile.java b/vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/skin/Profile.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/skin/Profile.java rename to vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/skin/Profile.java diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/skin/SkinStore.java b/vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/skin/SkinStore.java similarity index 100% rename from src/main/java/net/sourcewriters/minecraft/vcompat/skin/SkinStore.java rename to vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/skin/SkinStore.java diff --git a/vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/entity/Hologram$HologramBuilder.class b/vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/entity/Hologram$HologramBuilder.class new file mode 100644 index 0000000000000000000000000000000000000000..bc51539888ffc86c7d1edd4e90c3eed15c1469cf GIT binary patch literal 1469 zcmbVMOK;Oa5dJnvYbT^6B<1}oP-xOt^#LIct}06UNTsxq=tBZdn`D!^a_nNSi+bk- z2QK^&;6NpiIC0`fA!Z#L+NKxx;@R1q{pOqbX8rrm_n!csVpcr__-^2}#aqvk z!t;&3<%qV&yV5vlyZwDG4dF;j9vXGmc6%Q0PsWSqfn|4ury;}eECJ9icRIH4jO7qF zLSY!4w;W3@Fr+Kh9fnNJ?FbE7hQ|r8V{SR5aUqWpu{g4Emo>YFi&<( zL6}*L$t&?+YI04ilxSLEUtA=m?NtoGG9^t zOm=WzB>?+)>~1Ey`%ZN@y1PoG6s_zJ=r3oEaPu_4rx0Lb5EKDWIPTzXm^4e3-9xJQ wi$L#3pi>d3Ha#=@4G&I1Qjn^Ls-sps3|EgZ71|1_WYrkZ%wn2WGvU7e7YJ*alK=n! literal 0 HcmV?d00001 diff --git a/vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/entity/Hologram.class b/vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/entity/Hologram.class new file mode 100644 index 0000000000000000000000000000000000000000..86958aa6be273f8771af704bffab1daa57b663d9 GIT binary patch literal 12264 zcmdT~e|*&CeSbf>OD?&5LxB7s;S!AeN^%JV1;i#02nk3qmmon9ROCnwIJw;6-33Le zROi-dtzFms5Y$%OR<;(aSP7z4sch=(I$h`1cKxy1cHP=;vz^=AoNN02JkR%g_suU1 z(0__AdA{H0`#hf?@6XTYIbQq4vo8QxrZ)MIqp&z0NjIeugUPtvc60yYYWO%>_ufodn*tjPg?~g^2P3?oJbYftQrl#Oq zeQjq~$C`}_tGh0Mm?5)zFdFNRBwG{;dZWAJ;q+iKqHy4%2`)b$3Jx$Wt&}5QqZN&$ z6w1184(|^)4W^^9rnY1tVo?m?rz#SxOZOvSXkm8TEOpCj^dk%j3f z$y@mbgN=V=YKetXln|Blo+!<;^nzTBC=bS?w+u!)`xT~+R)tnd?F-*ZE7Abl{A9Y^ z!U{Ai6h>3M@H z-d@Cb>f0L%@6&GM!*<6lG~Z2ol8IZ5lX>?>V=*7Xll1Wq2;f5OK%a%1P%c)8SlA`r zp4%6TgeiBP&MgNN)=bKGK7bds^hHx`CaMc}N77EPE6kv!#>)bJ3?ShH{i|f0&ldJ! zua-6;xcW$P(}8__Y9qPxNB~Z~FeVogEd@wpzYl{79Tz~TBeE+z7)xj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ewriters/minecraft/vcompat/entity/attributes/Nameable.class b/vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/entity/attributes/Nameable.class new file mode 100644 index 0000000000000000000000000000000000000000..53b3751d024878f5ccd4726b495f29be245ea478 GIT binary patch literal 237 zcmY+9I|>3p5Jao}tsevfy@MuBXdsvfMxudWU^ct7GUCq4Ot0eA3_O5`5@!Sv)7Oux z>gVhJ05Cx(L4`20EXo(9%lPVyu=6T6mNTdKqAppHpS38qV&tZ@h%;#^?A1!=tkV-G zs1bTcebMTq?Ln>6BWFVBdX{oIAwi;2rHwtrgV($6?yRFc z@_%?}r9!1X^sx{9QB}X0U4rfM?aDwaedKn$pzX`Z-ArN~_8!>FG7187FTH{1`d)D0 zKG}aMTUwyd3B#_yMsouE6#20icn31NBQTW&>gPmmx9O>AT_sxi?(XjPmig+3El;a3 z5Ljr2(Sf_4bh}Es&Fq>g<+k*tmb4eo1xj~Sp!AwRtv-&nvd73b!?vs-k9h|(s0!rk zD|;s(aLU0n9J4#^po}Sj*(Ry_KI!et=&85wOM$BK>hF1xGUx2FpgSrSSf7N8VXm3U zgZd;OqlBi}EIKHnL~eR1&jQmb-syXXL7EA(CRZ~%+G}+md;KhxQY3rffb0u_N`YzQNXDqi>1fDKTlo2N&8?$&8PF&74c<(?thhHd8*b7?fD>|Lhi z%}gq>)Q=)>zz56P)SsK&9o}sR0~IUVq_gQU@dFv9#h%i9ApJ1n!#!L7VAcj^F6p;D zE%ywL@~wl-$&wtY4#SK);i14!^&f|QXW9MWdq*4t6OlRYr=!}YMr?FCWZf1=k{xr% z_OI;N$@oy2w>>|McHPXO!ZLdy&uLmf&b%h>PMOJIZ`dGKa%NE0s5yg^TxWTDLj4@& zY~y##HS%vzYplM(!mqr_;SAR*A%QurC)sK9T&py1hDQno9O!&368XAJ<10h>wG3b28a~Tl zT}lI6B;vv^+@uVq!L1G%7mtmv!x))D3>$wwZtVWom_NHOvBZK4GyJUlDw8*G)1Ghf r-)g>pgWFbqo5?$wyo>Mb{Tl93zQTR1Te)GSz$UgB7)L$V93K7)R*%|b literal 0 HcmV?d00001 diff --git a/vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/DefaultEntityType.class b/vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/DefaultEntityType.class new file mode 100644 index 0000000000000000000000000000000000000000..a049fbcd29e74b570fb2f88a653013af6aaef42f GIT binary patch literal 1505 zcmb_cT~8B16g|VX-L@=W6^neRsHp9Ntf=TiD}g{kVrh+qCe^2*3}wl7OSW4~e~EuX zArYdH`0S4|-dR?kYp;~=~~HkOuLp@PnTm9dsBmoXcRH& z+|m$3R9a&i;^<`<$kQzqTJ>$=Z1QbOFeLJgD!0nqF{STq#-U({B)EHKlR>Qsx4`QZ zI-E*h%_{}o*YE(7gs{E1$RW2{f}rcEbeB35$77^bq!>@rXr);N2FK*2(qB!OJPmym)lXg-A^HNdKfo%90p$dP#~AjUWXN+y!awOq zIl^$M5<0?2=@_G53DJXb`u0;k$=Qbp#>k%VPUI;)EkDN`?aL@tpPo3u?G89X0q{YZ zXREj)#gcs&lRn&_RmO$&Z@Bk`jPuOr;JBCZ931w+F-+m14}K|oL73zbMk{X>{j8Fe u2fnU|Mq?VI)DHD`UBuKUPLg#@YWUD_PwsEivuOKP`=%kuBa=% ztL^=|*Y0p_3s+0svs>J4I6~Q#zPQ$vPD7{&EQYx~zRzukyG?tewkPVEA?zKvLNO$& zr?#@geZRmE-IPt2>#hGSsDR;5rfPD<C#KkT$T;mX5-#5>X^ zM~672=h~lwCxuTIr7LxbA(c7LP{{5uERCrHVq>$)UPHtX!dx6TkYEU9vO7^Q%*PSN zWCRNgE0@bCh7@iZw79`piX(~`!)%p${juAw3AM#*4po}0dUfvXa3zgAP+GbreTKE_ zb%#ZLNskirIzy5V*G3;sZmKEtMlk*POm?jM42$F1VQidYX^6wYzar1eHJVC{5XKf2 z#;{7^SMHgCAhdAJEIPyPU}3siI`;PV`n$r{Go=M|gGC*VoN5d~ s0*~;Rd`wwq;TF%sr7r?UztJan3RvIp3>ktAx|XH9b3`zK{6O>kKTkt_sQ>@~ literal 0 HcmV?d00001 diff --git a/vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/EntityManager.class b/vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/EntityManager.class new file mode 100644 index 0000000000000000000000000000000000000000..9ad4dc5f6616dda8ca747a68936772be30ac24c2 GIT binary patch literal 8492 zcmc&(33L%a#$D1D(!?QTZD^Y|O`7g)y6^kmbW78?_x~A5BO@Fi+2_>fNHh8~|GoR( zfA7BczaM+<)Pn#n5g`pl0vqC{6HX>lcGNs%TaIZb!~Is=jM_%G6FwMC^bZ(L*o-@t zGZ^kQ;$1P*4mYWvtw!AFF>MV&fwKL^K_eV9;yvLVo%_wGqah@)c|5XXR?;!!l$w^_ z(iSrYO?#WGOkj%AZkb7eiipyaa;#W*qiq|55l(ItC~3EP;)av5O@Yhuy|Xql9w?*C z+?+}}iGJ7E#&uLvYMVV0t!;J*h|2{+YpuBDtP=>-)b17tZccQWr3hfAj%k>#VV1zG zJcvtCj+rG8sMMihioBbvV=DAg-c{?Ehv@>vNyo4qff*4l$M#fzr)hT>oiSQi9!W%v z*lxqNd?1vVD2 zgsx>f)w0=xI?lxl8BjZ$np@gCcJ5__7J@HVXk#f6*6OH3J@cT)bT*}|SeI$aV7ZP(I8WfF3E)Y~+vnz(FW)C&rI|ktV@6B}qS*z8Uf!g*O-C<(x!!<4s^%yJJNAT8#lES;ICaRRQej z_ca|QxouDe=(%Uaj6Yy^3^-OIZp0X5*0^4rjN&XyYO9Xz*unCZbXdRo1?J@>k~%Htx)_l@kEpa(W9dUmzKgppN9P;!YsnH zVLD>q%7zklQ!L3^kq*V&Ql#ejhv+k9gRBpeQIhu+lB)i6V*CjlknzW;xVj)FbTi*; zv$CGb6IJCXf}qbRmizu*HIrbSRc*2!tq*iF@{j;a}NmQBW61ezw0Q{K+Dv39pK>uoyTj-%Y;8C|S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1R%R)6| znxd;2r}FBil}iWfNDAxu#s;p>dP3UdbJN1iIxfUJ@J{+5n_P0_U7q8Jc7%f6NN!F$ z?ip$h;@!B(^W6;|;Hq4#H)pV(;0tnc1tC@tvb?&UE2kiEjbs9s@j91DELqECn>1@l z{&HbTKPpfa`9blt-viZ0oifAbp2T}2L(t?!CEGAQaBSphx-X5vbytK)T8U#j$+(sJ z+k80YdhQC6S#Qmxc?pW1g~kk*yw3kAdWv^Zt)TF7dSlMb2%e}5O2R&g+azJTX1gjc zqq@DU1pCPPSCG1|R4U!TDfa~q<;!yMvHU8INfoLloW#dRtGI?L462AyMHf|=W2^Wi zKIK{=W;1%G5N})ky*SQ;1cu`9_T_umXb)Z-3S3+~gcVg{p2x(hA_V> z7<>Tt?+rAx597h??IU}R6pM=DiqI`1PhCq>1j)S*J8(dO zy-*dmwoJsf;dA&rQECj8NAU%ETW9q00F1s}gk>sFf-3FX5FBCTOi>AULc{$U4nvTO z4+A3%$D9X@z|5n$xsTFwipol5Q{#Gw)Z+$N3DfdRbkCRXpu7BabBWK_C2ssu09%(l z0=`ZG-ySVsd0qkRXFLJRc$JY>Tuq`HT|Br6Rd_(1Y2&ue%*ua0tPG zRO|+(Tk%)=6i@eM9-9|^gY08|tVI6=KjpQKiSrwd{T6?~pVZx-@i#oJ?*4&);~91L SA3TQ<36}ki;9o!#qw0UiV_(kz literal 0 HcmV?d00001 diff --git a/vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/EntityRegistry.class b/vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/EntityRegistry.class new file mode 100644 index 0000000000000000000000000000000000000000..0eb671cabe92e174f903397dbcce4bfb7c00afa4 GIT binary patch literal 5554 zcmc&%`%@d&75*+#SR*X~V}o%V6GII_h+2-F*hz(nEsA3|_z{aZwcXbu7Fe^|C94%K z?jz5pN%~5ksoV6OM?2#m+-X8eGHpF&CY|Z@Ps+6Y?%kEN3N&@4cFGLe-E;3f=R4nd z+cbu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>_@r3H#hVzo zK|wT;`XiRwtCreBO9G#R!TCWDW|Z0^q1ra7w(xt*e^BLML}go5Wg8Y@6Pb`_ysFBg zQuzeGC6B!k9;w{9i9-?Ew$o|p_zv}q(v~7^Bb25hmV2v~dqc}r+PXv91|qaQ4zCKT zq(I#yBnj$Z`Y*UGcD){&zltl@ppC8v0|e{y{|k?euE(#-FvqB3H}e;)hJEU}9|zPk zuIgfd6%1y0oU&GqwBsQ0-pkpC7~aE_9*FoN$67g`VDJQc(x>-aTx{u8SR=QaQU literal 0 HcmV?d00001 diff --git a/vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/EntityType.class b/vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/EntityType.class new file mode 100644 index 0000000000000000000000000000000000000000..9412dc841cea81d85a41afe74a629ccc70194b06 GIT binary patch literal 193 zcmYLDu?~Vj6zidK>Y{@mp^G;<7)PCq4)_BnKJf?~ZNI@!ywt47vf)NOw7q5I)V`CKrX-1>z&zEp zR++YmI$u+YSwJSlC!LePV!1l@e#Fk$WGgU@y2*pdd}h`cuG?%VATaPJ0pa^c2wMi} HF~Il_-s(0a literal 0 HcmV?d00001 diff --git a/vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/listener/PlayerListener.class b/vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/listener/PlayerListener.class new file mode 100644 index 0000000000000000000000000000000000000000..bf50265232e457bd8f5258b1834193d106be02aa GIT binary patch literal 4342 zcmb_eX;&0S6urgPFf=jZ0vL^3G%%nOH5%if362_37*G@=iN}F3snM9O$PEJ1Of8;OZQ%=mSnr5a4K}L<|2vqf}``)|nzE}0$YAwoTt`t6Yq&-`c-C0*r>9;g(dIEC-_&uh_{pE!_t%2pigY7%i*~->L z%CaqQ8(|uodIid2PSOlPpiW0U<_lD`s_#|YTBJimrF2Ef#52SFrhCBXPm#ac4kuxx zdJWf-Yqc3dDe6L4isc%XvGm1MK2WY+^2oBq9NTl9l#Ufx$q)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o`_3wCh)Almh$gV z*HAuz7X|*n>s!hi%GONa%@WAHcLdH{{wvSkYStgvO4)5g9V<|eHcD?hd5rM|xr3a= z_^R2Z61-E1^JtFIqxb+HGLLc`W_ivq@^x5)kMRjBvzH>3e3vP{m!b3@)N2^M%+gnA z5E@3f((oz8@DkW|0-xiHYvAU~soePG%5n4cHE{FI)wtQi{PvQY4ssJGH(kuKn>+iM ZUpKkwnUS0Cua}#%Q@QzpH7dc6{{gR%j1B+* literal 0 HcmV?d00001 diff --git a/vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/listener/handler/IPlayerHandler.class b/vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/listener/handler/IPlayerHandler.class new file mode 100644 index 0000000000000000000000000000000000000000..d0b0fa3cb7e6ee0f9a120b69b1e0d789fc60c1d1 GIT binary patch literal 588 zcma)3%T5A85UfUI1s|X$euG||lkvdGphnFGO*GtxrI8`CGh}wa@L66x_yK;Dv3K#} zMYvSIrmMSpzP>*`0bJrRL5+4TB8Nid#&H((II2bF^O=synj*5}peEXl ztl0Y}tCt+^R$+oVp)=JBt*myh>Tx*bED{>tJ$T~?*QeiHX4G7L>E;Cp!dqz5iCoPVpH%$ bo=Xue?20YDJ?sk-4%SmN*HE;Du!hbLch{O` literal 0 HcmV?d00001 diff --git a/vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/skin/DefaultMojangProvider.class b/vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/skin/DefaultMojangProvider.class new file mode 100644 index 0000000000000000000000000000000000000000..742d0bb40d93d4a6f5b5cd47070fc051799cc383 GIT binary patch literal 1659 zcmbVMYflqF6g^W)TiWH-LPdNlXj>kOsGyb*350~Cq6t#PPY&(04sLhJbPMrcX(BX{ z#2?^~GTzxP?UwXI^~282-nnz`IcMhX?>|3(0a!&oiV(xPEnKtiG*n5PD(MPUH*3-s zCB-YQc~Wv}$DG!`NZZ^J72dGi*Uk~Qt8bNaBFjQW5oQ=W;wRj+C~UqtJQ5{0iU`AM z-^ksN3~@rXU0IPr5qQBvZ@AJj_xE?U@(i(KI{>C)eWWi*Mh9Olrpp@t2TEV zN-*s7%2_M)O^>wdYWa1-jjTyqy6X(7OaRs6l`S%aH=VMGV*uj@hLL0#$YhIAOi+GD zMVn_FDU1(+;hKRV#P#gDfhb}OqXjyI-A3(DsCWF(A{EJkQ{q;UE2+QzVA%aE$%R+_ zi|KiaBrH`G?xrQl_nmi)ote*mr2c8tg|d0gyH%au_5ITQ#q0G`M-fES zZ#9PH{^?(u#xPj21Xr5ba|0{7A>w=9zh;{nieb9vZCuop@R+(`fSy5wkkm~u7wX&k08LEA9%Z!{ z-}iW~c)9>XQzW2t6A!LpO$D%wHr7KtB6O{_LfW;A^aU~pxw-i!a=RL8;T#L^7dmJo zR0||1K_Vtdh8CJ@?Q9E8lh?~0>olIwOtVekDV}*e>D2t1EA-alW4h2eRy&r)J?m!3 Qu-O3bSey3?+7-gfzj5=QDF6Tf literal 0 HcmV?d00001 diff --git a/vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/skin/DefaultSkinStore.class b/vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/skin/DefaultSkinStore.class new file mode 100644 index 0000000000000000000000000000000000000000..eaec4491810ff638a631ea89b7cbe2f81205e9b1 GIT binary patch literal 3502 zcmbtWSyL2O6#gzV&@eQMD5xMr2}TyYqC5kbUfJ-nKmn@f=23lsiv8M-v+4sfl zdD1`Niw{Xvf{Cf5@|0Ai@{>}je5bpCMy4W#FTI?5?)RPZ-E&U&U;p0y4Zt3JYoJ15 zpJVyyqFeH^)>Y5;Ew7j^*p8L;^thj%$-0GU&GjkUNguPubt&(U@Oi{{JP*xiWuQS}ZJEeYs7GB56q-y_qDrA*h)SI-6~-*@ ztRBlV+NL2ltMjAUv*kT9CjCj9*=AN0v`Di|YQ~(G4r^YUx_N=1i_~QMzi6^j|N=;b4!n*FB zX?fiBoXU#4~u7 zqWe~nhtq$boW@H|Rw^dV>tP9ziPJd4n8xiq$15jpL=uEw z1~ICSV0j5pz%^pxtf*m(+fMF?Gb?G2O7C?^cfVlbJlI$UYwcuEM@#FCsY@G36I_x_ zJxzQXlpJ0*@d`A1LOZj=+RsiZY`I^cB&sHn%vH{}gWWwBSKr8zhh<_M6EYU;Yit3I zmO(MwCN5)&N%?N@m5^?|xV(wTzSuI+kTJj_$UHz;EW2#p(w@XIZNfo{Ip=j@ET_9T z15TAGnAK|_)5*t-fs#VwVlLsKnYb$Bp~|{a(s{}~AH`0E)JX9CK5ok=sQKRS^bSEH z;8EB0Sx3Z08wwlm{SS?Qr5Lpthlo#n@V*2LR*N1?W`Xj1q) zo_(}41V5pjT;3{n4Y}@AX*v@-n5Y6{mL(g{a%RQdSH2ih{{Pifw#1(inyx)iok?m6xuLibHXj3o;9mnzp^14{GiUz(^*t$%_a#9%hTA}0r zU3ti%ZfsC?0ml>vzWj0UZt$%F)sQgxufl6BEl264cyH{z1GD!R)SthD#viff`@nlG zuk`^=HIm%Z!2RoJGs8V-Mho9Kz_200yF`u(+BWsgVdD+d_VWJF4H$`AeEtDz_}Y1! z>j?<9#3c-Z*%I!HFo}Szc!cZQ0>4B&nbLIuec!X zF+n;PqUwyI5@!B@r$$3!{yULg&T?M+j=n$87K#1*P1K7(=jL$n1}c-c6Zfj$86)dh zAnS;!pF~BgXwRV^Fe7`vjxYedrCITS_Bco5;yg+bJW8WMp0zfyour6mB=Wj3I>hSzwPMtPUE_wXS; W3Z6d3b$o`;xhA=Ofv@llHvR|gRb$Ek literal 0 HcmV?d00001 diff --git a/vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/skin/Mojang.class b/vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/skin/Mojang.class new file mode 100644 index 0000000000000000000000000000000000000000..45733db0a1f738b2af33325d6f2be83bf9178e28 GIT binary patch literal 20778 zcmd5^d0>>)wLd4B+Si5mJNJI`&61hPWbwWCPv%?hJ@?$- zIp=rJJ>P}b|NZln;b3p5!+T}O7x9L|?rvYe+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Rla%)Z(SWR9@1!Z3k{UfZP2v zmLC9S58^*b+DWzih*EZ;7H=zCZ+lq1t!%xmY`v{)y``)RG|px*r6=V*MicBoKTG2tEx2_W;4q0>QmN@R*^1(-vVv^xSqT zXxNL31F`EH^LfH3$0NtzP7wOME%b1b&>d8Ox^`Ub=$P0qMEQ$Ka!lI006DhRnuEF) z@eu%j6v^cmaVFyhoJ=`J=ktqnA-_bec(#IH#s4(&8cr9#j{nf(4Z5AbO84=bv;)_> z_!|lsU3hxj0;Za7>f2ywD=3nqT Y>gt#L8-AC6i}rH3;&=Re{v%cX56{VGyZ`_I literal 0 HcmV?d00001 diff --git a/vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/skin/MojangProvider.class b/vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/skin/MojangProvider.class new file mode 100644 index 0000000000000000000000000000000000000000..ca37f0f982fb0488972ec3f4c040efd0b0d756bd GIT binary patch literal 467 zcmb7>O-{ow5QU#ho6we@0+&cOc-ch|8&IW6K_Ep%Y>hjK98w24PPiKj4#1%h)4-;% zfsJLq`SfPy`TgVd4Zs{HAqE0-OI|j0>omPMaxXhwZ=My`pNy3^b*XG| z=jzU^$%PmS%u3ZMS+Oi{A4}3+;H)5jRT;8=x#q*KDkoGqy;6EAjuk z2#j<^iWlFD;(LKf)(5=cO*x_6AkVkC1Om+Rw*W)Vb%cN~0wMNUAG12Zgx^yf^!g!= KSQ9wzE3;4XgNaN4 literal 0 HcmV?d00001 diff --git a/vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/skin/PersistentSkinStore.class b/vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/skin/PersistentSkinStore.class new file mode 100644 index 0000000000000000000000000000000000000000..568528f11e01fbb65fa008714a8c21813e391283 GIT binary patch literal 4127 zcmcInTUQfT7~O}2OcF=sA|NVN(YCoL)2j7CB9$VxXb5Uzyw$ct7+@eI>106hp-=r2 zKK98M9@?%JyV_NkPj#*Sfc~7?eP$*XAliV-#bSmz=ghaiy}xgtIsEauMX8f_u_I1#-U#z71yI3#esl?HAWMa6qKETEW`oL(@Q5mjeg zfukx0(Jv76d{U8M$5p(K54e2Ju+#byORz5zO)cmvx>nGOb6Uo>%;H=kga~2^q5|Ws zaPBmv70^ zo>^p-v?*^T%QMsB(&WyGkI)AK*Ch3^FeWjjAk7`r@$QCnR9wdmfpBRyy<8}`8|?-v z9@p1U39@R^yX=9Bk?8%MC#>L>KzBXAQOnX-Q~dsik;NWa$2%(Sf{h|~qie=05jBbU zrk%mH$D*;SP4Eq8Yxq)1@<3oQvYj{IxYjuy)b^jo4bsz2QutcMetfgZfmLnkz$~U! z<6&!#HSiOqt&RkJJjR^a5enn3|+#aizkYLPD(x+Pn2MTITTEa8lE zkiBBcz>6Drcto+{Sx2_6)mY@n6yL6Q6v18`$GS>VO}ee6tJP9P4#gV;_3>#P>Xu-VJko zwYeZsNgn;YO1$qFP2vs4*KyzpcExx<@&xU^wb(D{;KQ-_&-id1C;e+&<#+Pv;$0%| zMISTi#}OQ8$YrpW%OFnU3~^*GD(^($oXq7D{t}lp5%N3clXBBhfg?C-zVqc zK!4yR0#6Z+_XpPT)$Q+nVxY(W!>fPd%u)Xn2iIY|fLYgOkk$mw^Ll~(HVloubp}Z` z=?H%=koF~qMa(fl&eJW3G!{`{u7~-vgd(NUXb@?DfYX_-QRRB6rMtew_0kHX@V}ym z0t$q}Z;0Tv47|c2DDIE~%Ndl)b3CwlX&VD^i*u!7U8JuF;!3n!-$CSV1B_G1D-H?Q Xl|he0-9U0grrCyv&h?R3=hgoJx9Kx) literal 0 HcmV?d00001 diff --git a/vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/skin/Profile.class b/vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/skin/Profile.class new file mode 100644 index 0000000000000000000000000000000000000000..ab90249e0eac0a4a576ba5eb312843806c2e060b GIT binary patch literal 5177 zcmbtX`+FQ^6@DkXo7rrpE#2M>rL=%ZvbjtPy{D$6O^d0U3%R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cxRUD1EX{-so}R`<_=9-W{UG*b=Lnf;eGPUMM0!re&}rHXABeFx7;G~ z2{&=J4Dh>1MO4h<+*OH5T&|qM<;uBTuAEHe%0X1FoZ`9G(!xAk$KUzkt}1eOE1jv5yH9Wzpc`{=o9~RyRY-+mr%`u;n<~Z&Mkx+&k)}0I zz&9v;uiDsL*Qd`A)eHi-cfgy^q&2ch7JfZ!ld z!a+xgiCQ1P)lx_ZS1${i}M>htf(<@}z^!iS>FefdH(ONhC+>aD@B9O%h)LcNjinSMcqNv`_2$wW6 z{AHpkyBM1&nL~bTv6I&rTecWmuB+)3+yV|AW6qy!I*+5>F=Yy?nxpLnJR}cea{p)n zPZaPpAH`0_ncD%z+Jl2cp%+QHni!XBP|~%91rF>cDnpdqLsaf1Dtm~^edxemMr}|t zfkA2yar{kSn7^Z(?krjv!vrxAmAsl&!$^y$b^54v;0}BV&k(yo%6%DMp+^%%B)>`> zQK+8Ovpg5rE=RED-`GxURos683soGwNI*+Ler_7%DxDyUM)Tnew()Z~y88^i*5$9= z&C%zhUoYU;uIA`BgJR!OyQ+TZ|SiqSA-mD9j5LOo?V;e(~vbs?8{4{6Y{!#I;I#yR5{bd0~0$aqv z^CbsMViYIcMTu2s@#|@pffw-sSw4=}<$404(r>F1;PUA70=WO~XJdVHM3H%*T z;vXC=KfqJ?7oL_G(I@NeLq8*G@i#vs7T~Y=9rK`yUi=xa$c#A5J4KcRdCQ>8k`V2$ z$9sHQO^ef&H=Qq@{Iir7`O<{oMXHBbgfeH2GGUlGOsxx8B9mw9tmOGUb*k|Ge*q4K BRSf_D literal 0 HcmV?d00001 diff --git a/vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/skin/SkinStore.class b/vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/skin/SkinStore.class new file mode 100644 index 0000000000000000000000000000000000000000..f478f11ff066776719ee2bbcb6bf2e6fdfeedc2f GIT binary patch literal 3551 zcmbtWTXz#x6#h;#>9l1E6x&JxMY%PXmH=X@O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yp_QkWq&R`tHZ#|P6vtVaC14we5N`-{+@(lohoZD| zx7z+`MpdO9VUy6HaS-bG>c1@F+nOq*IJeBB7H&yWBDC*LrJrKF4qx(bC0}zJrR%}k J!;nfF{{sH7yr}>H literal 0 HcmV?d00001 From e4d6588563d3afe5e3216230a0420bb78f9026dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20Endre=C3=9F?= Date: Wed, 19 Jan 2022 10:02:02 +0100 Subject: [PATCH 09/47] Move stuff --- .../vcompat/VersionCompatProvider.java | 21 ++++++++++++++++++ .../minecraft/vcompat/entity/Hologram.java | 7 ++++-- .../vcompat/entity/attributes/Nameable.java | 0 .../vcompat/entity/handler/CustomEntity.java | 0 .../entity/handler/DefaultEntityType.java | 0 .../vcompat/entity/handler/EntityBuilder.java | 0 .../vcompat/entity/handler/EntityManager.java | 0 .../entity/handler/EntityRegistry.java | 0 .../vcompat/entity/handler/EntityType.java | 0 .../vcompat/listener/PlayerListener.java | 4 ++-- .../listener/handler/IPlayerHandler.java | 0 .../vcompat/reflection/VersionControl.java | 17 -------------- .../reflection/data/type/SkinDataType.java | 4 ++-- .../data/wrap/SimpleSyntaxType.java | 11 ++++++--- .../vcompat/skin/DefaultMojangProvider.java | 0 .../vcompat/skin/DefaultSkinStore.java | 0 .../minecraft/vcompat/skin/Mojang.java | 4 ++-- .../vcompat/skin/MojangProvider.java | 0 .../vcompat/skin/PersistentSkinStore.java | 0 .../minecraft/vcompat/skin/Profile.java | 0 .../minecraft/vcompat/skin/SkinStore.java | 0 .../vcompat/utils/logging/BukkitLogger.java | 4 ++-- .../vcompat/VersionCompatProvider.class | Bin 0 -> 1131 bytes .../entity/Hologram$HologramBuilder.class | Bin 1469 -> 1469 bytes .../minecraft/vcompat/entity/Hologram.class | Bin 0 -> 12607 bytes .../vcompat/entity/attributes/Nameable.class | Bin .../vcompat/entity/handler/CustomEntity.class | Bin .../entity/handler/DefaultEntityType.class | Bin .../entity/handler/EntityBuilder.class | Bin .../entity/handler/EntityManager.class | Bin .../entity/handler/EntityRegistry.class | Bin .../vcompat/entity/handler/EntityType.class | Bin .../vcompat/listener/PlayerListener.class | Bin 0 -> 4495 bytes .../listener/handler/IPlayerHandler.class | Bin .../vcompat/reflection/VersionControl.class | Bin 3759 -> 2056 bytes .../reflection/data/type/SkinDataType.class | Bin 3973 -> 4126 bytes .../data/wrap/SimpleSyntaxType.class | Bin 2747 -> 3269 bytes .../vcompat/skin/DefaultMojangProvider.class | Bin .../vcompat/skin/DefaultSkinStore.class | Bin .../minecraft/vcompat/skin/Mojang.class | Bin 0 -> 20931 bytes .../vcompat/skin/MojangProvider.class | Bin .../vcompat/skin/PersistentSkinStore.class | Bin .../minecraft/vcompat/skin/Profile.class | Bin .../minecraft/vcompat/skin/SkinStore.class | Bin .../vcompat/utils/logging/BukkitLogger.class | Bin 17212 -> 17366 bytes .../minecraft/vcompat/VersionCompat.java | 12 ++++++++++ .../minecraft/vcompat/VersionCompat.class | Bin 0 -> 516 bytes .../minecraft/vcompat/entity/Hologram.class | Bin 12264 -> 0 bytes .../vcompat/listener/PlayerListener.class | Bin 4342 -> 0 bytes .../minecraft/vcompat/skin/Mojang.class | Bin 20778 -> 0 bytes 50 files changed, 54 insertions(+), 30 deletions(-) create mode 100644 vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/VersionCompatProvider.java rename {vcompat-core => vcompat-api}/src/main/java/net/sourcewriters/minecraft/vcompat/entity/Hologram.java (96%) rename {vcompat-core => vcompat-api}/src/main/java/net/sourcewriters/minecraft/vcompat/entity/attributes/Nameable.java (100%) rename {vcompat-core => vcompat-api}/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/CustomEntity.java (100%) rename {vcompat-core => vcompat-api}/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/DefaultEntityType.java (100%) rename {vcompat-core => vcompat-api}/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/EntityBuilder.java (100%) rename {vcompat-core => vcompat-api}/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/EntityManager.java (100%) rename {vcompat-core => vcompat-api}/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/EntityRegistry.java (100%) rename {vcompat-core => vcompat-api}/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/EntityType.java (100%) rename {vcompat-core => vcompat-api}/src/main/java/net/sourcewriters/minecraft/vcompat/listener/PlayerListener.java (93%) rename {vcompat-core => vcompat-api}/src/main/java/net/sourcewriters/minecraft/vcompat/listener/handler/IPlayerHandler.java (100%) rename {vcompat-core => vcompat-api}/src/main/java/net/sourcewriters/minecraft/vcompat/skin/DefaultMojangProvider.java (100%) rename {vcompat-core => vcompat-api}/src/main/java/net/sourcewriters/minecraft/vcompat/skin/DefaultSkinStore.java (100%) rename {vcompat-core => vcompat-api}/src/main/java/net/sourcewriters/minecraft/vcompat/skin/Mojang.java (98%) rename {vcompat-core => vcompat-api}/src/main/java/net/sourcewriters/minecraft/vcompat/skin/MojangProvider.java (100%) rename {vcompat-core => vcompat-api}/src/main/java/net/sourcewriters/minecraft/vcompat/skin/PersistentSkinStore.java (100%) rename {vcompat-core => vcompat-api}/src/main/java/net/sourcewriters/minecraft/vcompat/skin/Profile.java (100%) rename {vcompat-core => vcompat-api}/src/main/java/net/sourcewriters/minecraft/vcompat/skin/SkinStore.java (100%) create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/VersionCompatProvider.class rename {vcompat-core => vcompat-api}/target/classes/net/sourcewriters/minecraft/vcompat/entity/Hologram$HologramBuilder.class (86%) create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/entity/Hologram.class rename {vcompat-core => vcompat-api}/target/classes/net/sourcewriters/minecraft/vcompat/entity/attributes/Nameable.class (100%) rename {vcompat-core => vcompat-api}/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/CustomEntity.class (100%) rename {vcompat-core => vcompat-api}/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/DefaultEntityType.class (100%) rename {vcompat-core => vcompat-api}/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/EntityBuilder.class (100%) rename {vcompat-core => vcompat-api}/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/EntityManager.class (100%) rename {vcompat-core => vcompat-api}/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/EntityRegistry.class (100%) rename {vcompat-core => vcompat-api}/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/EntityType.class (100%) create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/listener/PlayerListener.class rename {vcompat-core => vcompat-api}/target/classes/net/sourcewriters/minecraft/vcompat/listener/handler/IPlayerHandler.class (100%) rename {vcompat-core => vcompat-api}/target/classes/net/sourcewriters/minecraft/vcompat/skin/DefaultMojangProvider.class (100%) rename {vcompat-core => vcompat-api}/target/classes/net/sourcewriters/minecraft/vcompat/skin/DefaultSkinStore.class (100%) create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/skin/Mojang.class rename {vcompat-core => vcompat-api}/target/classes/net/sourcewriters/minecraft/vcompat/skin/MojangProvider.class (100%) rename {vcompat-core => vcompat-api}/target/classes/net/sourcewriters/minecraft/vcompat/skin/PersistentSkinStore.class (100%) rename {vcompat-core => vcompat-api}/target/classes/net/sourcewriters/minecraft/vcompat/skin/Profile.class (100%) rename {vcompat-core => vcompat-api}/target/classes/net/sourcewriters/minecraft/vcompat/skin/SkinStore.class (100%) create mode 100644 vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/VersionCompat.java create mode 100644 vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/VersionCompat.class delete mode 100644 vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/entity/Hologram.class delete mode 100644 vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/listener/PlayerListener.class delete mode 100644 vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/skin/Mojang.class diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/VersionCompatProvider.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/VersionCompatProvider.java new file mode 100644 index 0000000..135645d --- /dev/null +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/VersionCompatProvider.java @@ -0,0 +1,21 @@ +package net.sourcewriters.minecraft.vcompat; + +import com.syntaxphoenix.syntaxapi.utils.java.tools.Container; + +import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; + +public abstract class VersionCompatProvider { + + protected static final Container PROVIDER = Container.of(); + + public static VersionCompatProvider get() { + return PROVIDER.get(); + } + + public static boolean isAvailable() { + return PROVIDER.isPresent(); + } + + public abstract VersionControl getControl(); + +} diff --git a/vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/entity/Hologram.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/entity/Hologram.java similarity index 96% rename from vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/entity/Hologram.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/entity/Hologram.java index 0ed0dff..9a0f637 100644 --- a/vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/entity/Hologram.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/entity/Hologram.java @@ -9,17 +9,20 @@ import org.bukkit.Location; import org.bukkit.entity.Player; +import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; import net.sourcewriters.minecraft.vcompat.entity.handler.CustomEntity; import net.sourcewriters.minecraft.vcompat.entity.handler.DefaultEntityType; import net.sourcewriters.minecraft.vcompat.entity.handler.EntityBuilder; import net.sourcewriters.minecraft.vcompat.entity.handler.EntityType; -import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; +import net.sourcewriters.minecraft.vcompat.reflection.EntityProvider; import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsArmorStand; import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; public class Hologram extends CustomEntity { public static final EntityBuilder BUILDER = new HologramBuilder(); + + private final EntityProvider entityProvider = VersionCompatProvider.get().getControl().getEntityProvider(); private final ArrayList entities = new ArrayList<>(); private final ArrayList lines = new ArrayList<>(); @@ -213,7 +216,7 @@ private void updateOrder(int offset) { private void spawnEntity(String line) { - NmsArmorStand entity = (NmsArmorStand) VersionControl.get().getEntityProvider().createEntity(location.getWorld(), + NmsArmorStand entity = (NmsArmorStand) entityProvider.createEntity(location.getWorld(), NmsEntityType.ARMOR_STAND); entity.setCustomName(line); diff --git a/vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/entity/attributes/Nameable.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/entity/attributes/Nameable.java similarity index 100% rename from vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/entity/attributes/Nameable.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/entity/attributes/Nameable.java diff --git a/vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/CustomEntity.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/CustomEntity.java similarity index 100% rename from vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/CustomEntity.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/CustomEntity.java diff --git a/vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/DefaultEntityType.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/DefaultEntityType.java similarity index 100% rename from vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/DefaultEntityType.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/DefaultEntityType.java diff --git a/vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/EntityBuilder.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/EntityBuilder.java similarity index 100% rename from vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/EntityBuilder.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/EntityBuilder.java diff --git a/vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/EntityManager.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/EntityManager.java similarity index 100% rename from vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/EntityManager.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/EntityManager.java diff --git a/vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/EntityRegistry.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/EntityRegistry.java similarity index 100% rename from vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/EntityRegistry.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/EntityRegistry.java diff --git a/vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/EntityType.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/EntityType.java similarity index 100% rename from vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/EntityType.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/EntityType.java diff --git a/vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/listener/PlayerListener.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/listener/PlayerListener.java similarity index 93% rename from vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/listener/PlayerListener.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/listener/PlayerListener.java index a9e07b1..b25c83c 100644 --- a/vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/listener/PlayerListener.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/listener/PlayerListener.java @@ -16,9 +16,9 @@ import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.plugin.Plugin; +import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; import net.sourcewriters.minecraft.vcompat.listener.handler.IPlayerHandler; import net.sourcewriters.minecraft.vcompat.reflection.PlayerProvider; -import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; public final class PlayerListener implements Listener { @@ -37,7 +37,7 @@ public static void unregisterHandler(IPlayerHandler handler) { INSTANCE.unregister(handler); } - private final PlayerProvider provider = VersionControl.get().getPlayerProvider(); + private final PlayerProvider provider = VersionCompatProvider.get().getControl().getPlayerProvider(); private final List handlers = Collections.synchronizedList(new ArrayList<>()); private final Set set = Collections.synchronizedSet(new HashSet<>()); diff --git a/vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/listener/handler/IPlayerHandler.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/listener/handler/IPlayerHandler.java similarity index 100% rename from vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/listener/handler/IPlayerHandler.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/listener/handler/IPlayerHandler.java diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/VersionControl.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/VersionControl.java index 1338c40..1169459 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/VersionControl.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/VersionControl.java @@ -1,25 +1,8 @@ package net.sourcewriters.minecraft.vcompat.reflection; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; -import com.syntaxphoenix.syntaxapi.utils.java.tools.Container; - -import net.sourcewriters.minecraft.vcompat.version.Versions; - public abstract class VersionControl { public static final String CLASSPATH = "net.sourcewriters.minecraft.vcompat.reflection.provider.v$version.VersionControl$version"; - public static Container CURRENT = Container.of(); - - public static VersionControl get() { - if (CURRENT.isPresent()) { - return CURRENT.get(); - } - Reflect reflect = new Reflect(CLASSPATH.replace("$version", Versions.getServerAsString().substring(1))); - if (reflect.getOwner() == null || !VersionControl.class.isAssignableFrom(reflect.getOwner())) { - return null; - } - return CURRENT.replace((VersionControl) reflect.searchMethod("init", "init").run("init")).lock().get(); - } protected final DataProvider dataProvider = new DataProvider(this); diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/type/SkinDataType.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/type/SkinDataType.java index 37ae393..819f41f 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/type/SkinDataType.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/type/SkinDataType.java @@ -5,14 +5,14 @@ import com.syntaxphoenix.syntaxapi.data.IDataContainer; import com.syntaxphoenix.syntaxapi.data.PrimitiveDataType; -import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; +import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; public final class SkinDataType implements DataType { public static final DataType INSTANCE = new SkinDataType(); - public static final WrapType WRAPPED_INSTANCE = VersionControl.get().getBukkitConversion().wrap(INSTANCE); + public static final WrapType WRAPPED_INSTANCE = VersionCompatProvider.get().getControl().getBukkitConversion().wrap(INSTANCE); private SkinDataType() {} diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleSyntaxType.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleSyntaxType.java index 2b9452d..6da8bdc 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleSyntaxType.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleSyntaxType.java @@ -1,16 +1,21 @@ package net.sourcewriters.minecraft.vcompat.reflection.data.wrap; +import java.util.Objects; + import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; import com.syntaxphoenix.syntaxapi.data.DataType; -import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; +import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; +import net.sourcewriters.minecraft.vcompat.reflection.BukkitConversion; import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; public class SimpleSyntaxType implements DataType { private final WrapType type; + private final BukkitConversion conversion; public SimpleSyntaxType(WrapType type) { + this.conversion = Objects.requireNonNull(VersionCompatProvider.get(), "Can't initialize before VersionCompatProvider isn't loaded").getControl().getBukkitConversion(); this.type = type; } @@ -26,12 +31,12 @@ public Class

getPrimitive() { @Override public P toPrimitive(DataAdapterContext context, C complex) { - return type.wrapToPrimitive(complex, VersionControl.get().getBukkitConversion().createContext(context)); + return type.wrapToPrimitive(complex, conversion.createContext(context)); } @Override public C fromPrimitive(DataAdapterContext context, P primitive) { - return type.wrapToComplex(primitive, VersionControl.get().getBukkitConversion().createContext(context)); + return type.wrapToComplex(primitive, conversion.createContext(context)); } } \ No newline at end of file diff --git a/vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/skin/DefaultMojangProvider.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/skin/DefaultMojangProvider.java similarity index 100% rename from vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/skin/DefaultMojangProvider.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/skin/DefaultMojangProvider.java diff --git a/vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/skin/DefaultSkinStore.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/skin/DefaultSkinStore.java similarity index 100% rename from vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/skin/DefaultSkinStore.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/skin/DefaultSkinStore.java diff --git a/vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/skin/Mojang.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/skin/Mojang.java similarity index 98% rename from vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/skin/Mojang.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/skin/Mojang.java index a3ea2bc..8e2c4f5 100644 --- a/vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/skin/Mojang.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/skin/Mojang.java @@ -17,8 +17,8 @@ import com.syntaxphoenix.syntaxapi.net.http.RequestType; import com.syntaxphoenix.syntaxapi.net.http.ResponseCode; +import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; import net.sourcewriters.minecraft.vcompat.reflection.PlayerProvider; -import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; import net.sourcewriters.minecraft.vcompat.utils.java.net.EasyRequest; import net.sourcewriters.minecraft.vcompat.utils.java.net.EasyResponse; @@ -36,7 +36,7 @@ public class Mojang { private final SkinStore store; private final ILogger logger; - private final PlayerProvider playerProvider = VersionControl.get().getPlayerProvider(); + private final PlayerProvider playerProvider = VersionCompatProvider.get().getControl().getPlayerProvider(); private boolean debug = false; diff --git a/vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/skin/MojangProvider.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/skin/MojangProvider.java similarity index 100% rename from vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/skin/MojangProvider.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/skin/MojangProvider.java diff --git a/vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/skin/PersistentSkinStore.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/skin/PersistentSkinStore.java similarity index 100% rename from vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/skin/PersistentSkinStore.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/skin/PersistentSkinStore.java diff --git a/vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/skin/Profile.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/skin/Profile.java similarity index 100% rename from vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/skin/Profile.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/skin/Profile.java diff --git a/vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/skin/SkinStore.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/skin/SkinStore.java similarity index 100% rename from vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/skin/SkinStore.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/skin/SkinStore.java diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/logging/BukkitLogger.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/logging/BukkitLogger.java index 1e7c8f5..e102209 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/logging/BukkitLogger.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/logging/BukkitLogger.java @@ -10,7 +10,7 @@ import com.syntaxphoenix.syntaxapi.utils.java.Times; import com.syntaxphoenix.syntaxapi.utils.java.tools.Container; -import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; +import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; import org.bukkit.ChatColor; @@ -31,7 +31,7 @@ public class BukkitLogger implements ILogger { private static ConsoleReaderWrapper getReader() { return READER.isPresent() ? READER.get() - : READER.replace(VersionControl.get().getToolProvider().getServerTools().getConsole()).get(); + : READER.replace(VersionCompatProvider.get().getControl().getToolProvider().getServerTools().getConsole()).get(); } private final boolean ansiSupported, jLine; diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/VersionCompatProvider.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/VersionCompatProvider.class new file mode 100644 index 0000000000000000000000000000000000000000..91639bf46eaa07175097e8fe8f6890e618df9dc7 GIT binary patch literal 1131 zcmbtUOK;Oa5dJnv>%=uQgz{>6wdIlYfN#7KDpdg_q=-f>%7NR)-K1MN-e|oJ}&7T4US z9LlXImWedm48?k*$53jk1L5NomOY$ixSLO1fGW-~6x4v>VZD)4T(bg(vjG;c$gtd@ zvOUj6eW73QeoQs1byURT9@o;^Gv{K<$?;Ld#Q^8wlO%H}Q--Mmu+ik^~frqOja2c_~cn4 z&uv=m<9$Z(0kwDZS-=XtEd+G%oby;B>eCDq(rR}Xwm#v)Jj8R5V0r+Tus0eX<2>D*%|w3H<;7 delta 29 lcmdnXy_b8#HWt<{1~$g-$-7ys8T%)HXK`ShGTDN)6#$qi3Gn~` diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/entity/Hologram.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/entity/Hologram.class new file mode 100644 index 0000000000000000000000000000000000000000..105ccff9523278700b44a51d46315ccb0c0423f3 GIT binary patch literal 12607 zcmdT~eSDSGegB@^o808)3E?#mZo-=a;U*A7A(A%;37BABfbb%y=q0(pm783=FDRm| zTDNYkowIXws8i8(tQHkig7{LjtlHYObGDn?+O>AG?fSBA)wSEGGyDF|d7hgmH#Zod z|BTN^&-0w;oZtKJ`}>`9^TvlSdM>qIEJZfq#WanwbsRB z`y!N#mKqbOcz9?yN`m2p*4gr!Jn|(&5P#+Yz^0i!%a6(~9`wgLeq3TpJ60L5E z$3y$uBZ(xJT$62nY?g2_H~Lq1_9dF)eX)3VlHS*r$&E6y$bLa~Hd>}=sDD>=cQPL7 z-=+8DM`Jx9v5H6?i|?x5k=nB-lB{mGrzv%AC>q&Er>kuWdAq}rUAvQfY2iz3=gvf! zFZuO7WF1L1DtIauY*z3#$9ls)lqocyL*zMbzSw!NgU^ouW>}bsQu3_Vj0&JI+d?k# z6p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19<9}~p@ literal 0 HcmV?d00001 diff --git a/vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/entity/attributes/Nameable.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/entity/attributes/Nameable.class similarity index 100% rename from vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/entity/attributes/Nameable.class rename to vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/entity/attributes/Nameable.class diff --git a/vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/CustomEntity.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/CustomEntity.class similarity index 100% rename from vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/CustomEntity.class rename to vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/CustomEntity.class diff --git a/vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/DefaultEntityType.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/DefaultEntityType.class similarity index 100% rename from vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/DefaultEntityType.class rename to vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/DefaultEntityType.class diff --git a/vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/EntityBuilder.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/EntityBuilder.class similarity index 100% rename from vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/EntityBuilder.class rename to vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/EntityBuilder.class diff --git a/vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/EntityManager.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/EntityManager.class similarity index 100% rename from vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/EntityManager.class rename to vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/EntityManager.class diff --git a/vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/EntityRegistry.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/EntityRegistry.class similarity index 100% rename from vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/EntityRegistry.class rename to vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/EntityRegistry.class diff --git a/vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/EntityType.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/EntityType.class similarity index 100% rename from vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/EntityType.class rename to vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/EntityType.class diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/listener/PlayerListener.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/listener/PlayerListener.class new file mode 100644 index 0000000000000000000000000000000000000000..af9a13029a98a4eed06bbcb4b53c85cc57e1f90f GIT binary patch literal 4495 zcmb_f`F9gl6#ibfY12WZKub|}#V$Z70)i=E8&C>uTI`~tqSJKR4x}@6GN}}C-&b64 z!+qZuR7xx7c>LM_!+*h_JmU9WCds6>G=M#)ZQh$Z-@W&{-@EtakAHss4ZsaJt)WOD zVw+w#>7?AadB1CUrkf0pShg8=jX^Iw7I#KQ4KJLqlAdXsZn!I9jGJz|ztm77aOGiR z%m^n8dnnx5f7pzB8p;G}9d{_)pE`2H^1|krX?x+!O9JI>vF@IhSagrTj`quNA0gDJ z>x@|grYo?kASl-yOfW{vvHe`Sd;o$~bX!BV;iX(tp!M?5nj3b?=!Ok@AVEsWQoEul z8S;%!Exhz#di z9cyu&K!|uz$M#$&A<$AFY(P(04+?_N^=Q=4zz_?`bXFi8>#$y60i#P-Izz)H1(^>K zkwpyas6a?Vlfc59NLyUj7?)=@gpIOno3T~H7J^q^EU>yRpfb4?sh_?fgSb)0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9n1n}b`;o<(_7)<5nOiF>hevs5$NU+%O|XQ zRHfe4Bn-ffC^6@Gl6H=(J}|=o#GL4zRTyDBBM(uj5L2eByBi&9eTZi_1aT*OC)bV9 zp*L%&8=AchS9)FWndJyi$CE=3#Y%wey@@H17hBm!d=3&@OcXhEqIVzJ>ofe zlGC=Fl+g$Rn88=cw=CuSv*m@2ir#`&3mD=mrVvE?rmf{#BG=zlH&s;w!8`NsM{erBw-!*bbkVB`4g*iQg_#u+9TtxFXOJy z@MNNXwxJ6VVmYbP!!#4gZxP05CLu~1IWX;@RYoZFGMk?+)GYVsae z%;U0Sqc0+`X7U1jM6}s7IB|wSoSax^7^sA# z7o3NOL3*{AoM)Kk>!vFHPU>J){D<^Qy2Q}H9YO=wO+(UUhQR8An+KSUubDoY8*xQJ z6GPqVf`=biZL)@|Xy)&gPQ8T~=aRD%76cK~(26$xQ>iq!Ys#L&%S)*`-X@^F*Y$sTjJwO9?}iH1{{MdZH(=dhyDP1$O z#wY}m8gTA{4Q|1aLeVx#(m1<`qBP1=xUfN|0;*}X7 z4r-qOne=ZU(Fa6ochJC)@as`u8rL>)eFwKC`1J(2caPm3a{KabKHCaPAQO!X3d+fL z!-EQhQE8<2W>e%^pk%m@L8IabhA>Q8D5S;+Mj=v^CXy@eI|*ST*0@iP8aW?|*u!|j zrzcLhO_EO!^_&dI{(TgbO8Zbt<*$(0`YwWl{!*z_7Pl~wDOyA|_Y}HTGBb*1bL6Xw z=c|hwH3>B2C|dB8P%aX`i!6!iEkiF^GNy>55W*pv6^v(pW{**m&vI>e2`JJfi?`Od phhQ4hN4gCkjhY!c(E}vl*nfcGG-i*0f8j{O=afRgeC~BE{06eyp!5I$ diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleSyntaxType.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleSyntaxType.class index 8310ef114288418ac4abb2f96f64ca694ba25227..29d4f88dd1aa61e884ad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I$$S2j{2ar%@sWi5vF;JyC5(-a zex$L@cypV{9j+Df9khSCL|>vakWS=R3%S9~#9_z`vr^c*U#PBlF)65aOEtsoeJ gaWNmeSU-5m!9!gv{lmo)%W`3{B2N}~vj1oG4@BWiK>z>% diff --git a/vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/skin/DefaultMojangProvider.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/skin/DefaultMojangProvider.class similarity index 100% rename from vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/skin/DefaultMojangProvider.class rename to vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/skin/DefaultMojangProvider.class diff --git a/vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/skin/DefaultSkinStore.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/skin/DefaultSkinStore.class similarity index 100% rename from vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/skin/DefaultSkinStore.class rename to vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/skin/DefaultSkinStore.class diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/skin/Mojang.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/skin/Mojang.class new file mode 100644 index 0000000000000000000000000000000000000000..77773958d96d86647100b48e85fa29106288165f GIT binary patch literal 20931 zcmd5^d0qu5Lfx zuM38K3nOd&;WY-in1-$OulM^x_~~n1wKmWmXDVH~xOrvUrA;j>mo92nG*@e;{I@anLpGM@K7;ReP=x09c%FU{N2IHU22fY7}wVm3q*b0(a7px zDBv3(Q%W$E%v!o+!OFIIi>-n>%I@A1??jjNfoQsv@i8V3q^u8i1fopmH4kvU zi>$8D-5rZZq5-C9&SkU#xHjp9?nR-yopR@v2 zzNTi?936*thx{7?(WE9!7dlcP8dx2IX@ZfkZ&8K-h%9akt_l0&Ju;oyCnxRvx|xDa zM_^UY8YaFR6Fol|4#sCPJybKGnL5%V%@vb?G&=8?vPbPQCfA%uN5D&kG{&S#I-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14V1*uvy#aE16ut-YWqKdGpjB*SjVhmg)5 zHUOcGKqdRy6gOIa_<1F~|dT?}^T$X=_HzP7br1V5II;FAMF zP#ZHhg2_sCKL~=w`bBUT5d0(%d>RPu27=E3!976mGXp|UD?1PbapMFOq)xzKJqe;| zKvZ@xUbw?K2l+vi8u2TwzQPBUPWmv$Ygv_1z86n znBlHRkN+r5=n-4!(F~#6$&I>pO6-WF*v}>SWhFT&?Jaw?;146Y{4D;1 zz9Te~kJ3f_B3**}8_jsOls`}F`8B$hU#IK&82*vm7jcF34cdSuuw%C$mLwl0+Z7x~ z)>0rlVCgmCIEuYll7V2ln#5|qJhoG;^V0e^+Rici>yzk_Gr&-mx++b{Snep`L}HUEx(&woIB OxnJ=|{uBR&D*p#zlek&{ literal 0 HcmV?d00001 diff --git a/vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/skin/MojangProvider.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/skin/MojangProvider.class similarity index 100% rename from vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/skin/MojangProvider.class rename to vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/skin/MojangProvider.class diff --git a/vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/skin/PersistentSkinStore.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/skin/PersistentSkinStore.class similarity index 100% rename from vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/skin/PersistentSkinStore.class rename to vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/skin/PersistentSkinStore.class diff --git a/vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/skin/Profile.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/skin/Profile.class similarity index 100% rename from vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/skin/Profile.class rename to vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/skin/Profile.class diff --git a/vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/skin/SkinStore.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/skin/SkinStore.class similarity index 100% rename from vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/skin/SkinStore.class rename to vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/skin/SkinStore.class diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/logging/BukkitLogger.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/logging/BukkitLogger.class index e95611346acf56af2481af9edf8f3a21c0853848..cb6709143d958d6227e2a7ea435c4778c0a04e29 100644 GIT binary patch literal 17366 zcmcIr349dg*?*o*HnZ6b2@nHBP}=KfTGOw6PVp35sn2{ zDbJB_aU~qn@x!VlAnuK%;Cy)LNF|c79;PoiWbR5uO;yhgi;`14%Ge7Bp5fHcTzHBR ziZ=G6G^GWxj5m=CC1HkXMJdnp?KS}s-E_s`J)tC%Z+1r{91SOrW-6(hw34ZGUaZsb zQ!O2$(ZNjPV)5=^S1MtcVHsR6?h$Ol51s0066VVQ)4p|+TKb*ZDER7ink)d`xREfD zGBQP{AWa1i$(R{fOnU)MLAaF@({!CQ^7&~7&D7{Hc+AkkPN&1^2qsUgi)j{U4Gl}9 za5PJ&a`H1(No*`h^|TxD<)QWn3^KYU))9)V48_CpyERzeZ6wWTV`>HE;fz~R%N(7W zXfCo!IB|k#I11y!qHE;ae4Q51Li`RM@^x$`$wrM9GaWaKO!?_pYSHL8rX!2Nx)RAA z`DvcY@h8M%o5ILT!uIh@M-{0qR~+!YW2sfA6KE+CI}{)(I39~IH5G~0kv(k+3I$NN z(F%=FB#tUZ#(oj$w31fAlfd0_1b;?+reg-rq7wlaTuo~=LJDsjB!f;gI-Nu(GgX4U zHY2_XelE3)Y5w53OR6g9zycOep^!$WGR+wziv_rJYA56|%g9pR#Q8gQG6>Aqmj4eq6`*1wsdj8Y9kU|6Y_^q9_pMVYv0b$&L9=KCPf)d^ani~P+CV)T z!4dbC#OXFmr>Nvd4T@h9>VY&&y*jOY^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Wp_02D@y?g2lcd{ajasX~kXpocJou#6 zPiNoyK;w|Qe2bHNjb;Tw&f;;cRXJv}T7du8>d_cbH{z<5TCGHpT7_b@n*aEt9W@;5 z)EYGLT6(Ekr!}iFz`8V(#!-n_t~L zHpmqjgZ!LWNKFqJgD^B&0}sRJIfmju^-&a5d;5>U8(6LlWEvxFp)0c&CXVyTRcltW z+KKN-)OFNsEBtC3E>YK`R^5O_9Glg4w5gl;FA;a(YPC~qXv(MiZ10#VWSh#*)2f`F zOcO90dG9l8_*XGI&B*iuOi7OIJmQc1Im5QyDcg2SgSIQ$*U2VtN+U4FfLyqotFc*M zrcPt)EEnpR(D`L_d*d!Pu)C>dlPk0k1pLnZ zj!Ow0R4tq^4k$fM-*y+JRx?rzEqC>FN*AkVNUEnQ zpH%g{jj8(ptLJT+>13-X|ADG4LXygeI#t@|?2CQXaaen$*XydH6-+yldIEZM7qUAk z!y*1#7R_-SKqsh|sQq+j*&-7D|E1pbG0C;$Ke diff --git a/vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/listener/PlayerListener.class b/vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/listener/PlayerListener.class deleted file mode 100644 index bf50265232e457bd8f5258b1834193d106be02aa..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4342 zcmb_eX;&0S6urgPFf=jZ0vL^3G%%nOH5%if362_37*G@=iN}F3snM9O$PEJ1Of8;OZQ%=mSnr5a4K}L<|2vqf}``)|nzE}0$YAwoTt`t6Yq&-`c-C0*r>9;g(dIEC-_&uh_{pE!_t%2pigY7%i*~->L z%CaqQ8(|uodIid2PSOlPpiW0U<_lD`s_#|YTBJimrF2Ef#52SFrhCBXPm#ac4kuxx zdJWf-Yqc3dDe6L4isc%XvGm1MK2WY+^2oBq9NTl9l#Ufx$q)x*rfrQ)MR7MHT2zL$ zO2=y4E-;svSxzUlaa|q?A)=D5CLL7>X=oOhmzP7E>l$OSJ3QGGu@390r}UVe7<3)mI&CK9VS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JtFIqxb+HGLLc`W_ivq@^x5)kMRjBvzH>3e3vP{m!b3@)N2^M%+gnA z5E@3f((oz8@DkW|0-xiHYvAU~soePG%5n4cHE{FI)wtQi{PvQY4ssJGH(kuKn>+iM ZUpKkwnUS0Cua}#%Q@QzpH7dc6{{gR%j1B+* diff --git a/vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/skin/Mojang.class b/vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/skin/Mojang.class deleted file mode 100644 index 45733db0a1f738b2af33325d6f2be83bf9178e28..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 20778 zcmd5^d0>>)wLd4B+Si5mJNJI`&61hPWbwWCPv%?hJ@?$- zIp=rJJ>P}b|NZln;b3p5!+T}O7x9L|?rvYe+Y$1tjkq^<1iO1Y zc)!6Ha4!n3_XO4%g^rYgI8Z=?%dHhM#eQcevsIU!}EuhSc1I=gj% z^Id9nh3*C6NHFAOnx4CiHUQTqz0keTA6&OibZBgq>4i53BA!h>T|sZax5>H#0&Zyq ztlTZFsyRB2?D2axdqXizn9j>dfsl8tAExmI1Ma0s0wA)e&9^S#iS){J<_t~RId!uH zn@;bV-gQiTDJFW3FW`&JVtTMT!7gf5-beIf=S>~(`zox4Z!5ih*(bq zN)-!WHU~84Xp96|vCdG)30W$nnPv<`P~7zpEuNkp|7NC*H8~;D8}a!QX<0-y=Y~hx zt}dEQa}AmUJLclz3I|(#ljhNU*u~S?i4Yme1YlQ($YyF9JPb^R7(|I#T+?^S86r#< zNf@_4(SWBLjwF#MW6cgP=@Dl2_?c?bj;hu^LEjx~3E%0=vFSO3$72?lVm4iD(lS~M zXARnF8eN{ShG|qfEiRRA?Ix|H<>=M{4)gc|h*<-6*4C=}fz1Zp z!gP|2=pv7QZ7|gB?F6**H+6UwyJ5iI5aO?(TkMx>dYlJF3crw8(S?7w^N?Yx(9LtO6!I zLXX0;=FOk8;sR`zbMjrgH@x>TrqQX};5ofMKQ^OI`V1!D)*b1p@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3err$)83gNbN>*4UOko{40+J zIt>gX$(-K9)Yw|p*g(|STGd!uxxjD&iQdB~t0S+`R`0g7ZHKl3N!;6^Wgn|gO+X}@ zw?mFHhejlj10odZACWVG$P6Gd6NsDzM9u~x=Kzs&b4SF|DjOoftWMIC>LjxhAW82e zu{5kCmSn(5q(UGSy=|70R4T6sXTv~;#e5{#3%~#u0EZUfaACsSD{XJ6w7sDcD~iqn zE3M(3NYPTfp(N%Fy;v^zA+V(-hTZ=(my19FobxFBpn(ZhgwiRW?}L)-iV*n+6#*E zlZrajz@i+^hLFx4HUpt8KAkbZ9wWyAa&P(kkSg~g48XR;z1Z#Ok9z`J(Z481yQ~=6{~v_RH?9yR$;SGg>AG7 z+h`S*(J+7t{sQG+w_AfB01wGmxO&^aun&EOMu~rk3Rla%)Z(SWR9@1!Z3k{UfZP2v zmLC9S58^*b+DWzih*EZ;7H=zCZ+lq1t!%xmY`v{)y``)RG|px*r6=V*MicBoKTG2tEx2_W;4q0>QmN@R*^1(-vVv^xSqT zXxNL31F`EH^LfH3$0NtzP7wOME%b1b&>d8Ox^`Ub=$P0qMEQ$Ka!lI006DhRnuEF) z@eu%j6v^cmaVFyhoJ=`J=ktqnA-_bec(#IH#s4(&8cr9#j{nf(4Z5AbO84=bv;)_> z_!|lsU3hxj0;Za7>f2ywD=3nqT Y>gt#L8-AC6i}rH3;&=Re{v%cX56{VGyZ`_I From f3a28d4fd7499dfef52e4eb5e166d954b238c7df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20Endre=C3=9F?= Date: Wed, 19 Jan 2022 10:03:27 +0100 Subject: [PATCH 10/47] Move dependencies around --- pom.xml | 76 -------------------------------------------- vcompat-api/pom.xml | 52 ++++++++++++++++++++++++++++++ vcompat-core/pom.xml | 29 +++++++++++++++++ 3 files changed, 81 insertions(+), 76 deletions(-) diff --git a/pom.xml b/pom.xml index a5582b0..1ce70ec 100644 --- a/pom.xml +++ b/pom.xml @@ -46,58 +46,6 @@ 1.18.1-R0.1-SNAPSHOT provided - - - - com.syntaxphoenix.syntaxapi - java - 2.0.11 - - - com.syntaxphoenix.syntaxapi - data-nbtcontainer - 2.0.11 - - - com.syntaxphoenix.syntaxapi - data-base - 2.0.11 - - - com.syntaxphoenix.syntaxapi - net - 2.0.12 - - - com.syntaxphoenix.syntaxapi - command - 2.0.10 - - - com.syntaxphoenix.syntaxapi - nbt - 2.0.9 - - - com.syntaxphoenix.syntaxapi - version - 2.0.9 - - - com.syntaxphoenix.syntaxapi - reflection - 2.0.8 - - - com.syntaxphoenix.syntaxapi - key - 2.0.8 - - - com.syntaxphoenix.syntaxapi - random - 2.0.8 - @@ -108,30 +56,6 @@ - - maven-shade-plugin - 3.1.1 - - - package - - shade - - - - - - - *:* - - META-INF/*.SF - META-INF/*.DSA - META-INF/*.RSA - - - - - maven-compiler-plugin 3.8.1 diff --git a/vcompat-api/pom.xml b/vcompat-api/pom.xml index df59124..67d7b38 100644 --- a/vcompat-api/pom.xml +++ b/vcompat-api/pom.xml @@ -16,5 +16,57 @@ 2.12.1 provided + + + + com.syntaxphoenix.syntaxapi + java + 2.0.11 + + + com.syntaxphoenix.syntaxapi + data-nbtcontainer + 2.0.11 + + + com.syntaxphoenix.syntaxapi + data-base + 2.0.11 + + + com.syntaxphoenix.syntaxapi + net + 2.0.12 + + + com.syntaxphoenix.syntaxapi + command + 2.0.10 + + + com.syntaxphoenix.syntaxapi + nbt + 2.0.9 + + + com.syntaxphoenix.syntaxapi + version + 2.0.9 + + + com.syntaxphoenix.syntaxapi + reflection + 2.0.8 + + + com.syntaxphoenix.syntaxapi + key + 2.0.8 + + + com.syntaxphoenix.syntaxapi + random + 2.0.8 + \ No newline at end of file diff --git a/vcompat-core/pom.xml b/vcompat-core/pom.xml index 111472e..f135fc7 100644 --- a/vcompat-core/pom.xml +++ b/vcompat-core/pom.xml @@ -15,4 +15,33 @@ ${project.parent.version} + + + + + maven-shade-plugin + 3.1.1 + + + package + + shade + + + + + + + *:* + + META-INF/*.SF + META-INF/*.DSA + META-INF/*.RSA + + + + + + + \ No newline at end of file From 907ed926cee0f3b13a3e675ff10bb6bb2d2b448e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20Endre=C3=9F?= Date: Wed, 19 Jan 2022 10:44:20 +0100 Subject: [PATCH 11/47] Update api to be up2date with latest technology developed for vCompat --- vcompat-api/pom.xml | 39 +- .../vcompat/VersionCompatProvider.java | 8 +- .../vcompat/data/AbstractDataAdapter.java | 46 ++ .../data/AbstractDataAdapterRegistry.java | 60 +++ .../vcompat/data/AbstractDataContainer.java | 118 ++++ .../vcompat/data/AbstractDataFactory.java | 42 ++ .../vcompat/data/api/ChainDataType.java | 191 +++++++ .../vcompat/data/api/DefaultDataType.java | 41 ++ .../vcompat/data/api/IDataAdapter.java | 17 + .../vcompat/data/api/IDataAdapterContext.java | 7 + .../data/api/IDataAdapterRegistry.java | 13 + .../vcompat/data/api/IDataContainer.java | 45 ++ .../vcompat/data/api/IDataFactory.java | 23 + .../minecraft/vcompat/data/api/IDataType.java | 142 +++++ .../vcompat/data/nbt/NbtAdapter.java | 225 ++++++++ .../vcompat/data/nbt/NbtAdapterRegistry.java | 47 ++ .../vcompat/data/nbt/NbtContainer.java | 92 ++++ .../vcompat/data/util/NumberConversion.java | 33 ++ .../minecraft/vcompat/entity/Hologram.java | 6 +- .../vcompat/entity/handler/EntityManager.java | 2 +- .../vcompat/listener/PlayerListener.java | 4 +- .../listener/handler/IPlayerHandler.java | 2 +- .../BukkitConversion.java | 16 +- .../DataProvider.java | 13 +- .../EntityProvider.java | 6 +- .../PlayerProvider.java | 6 +- .../TextureProvider.java | 4 +- .../ToolProvider.java | 8 +- .../VersionControl.java | 4 +- .../VersionHandler.java | 2 +- .../data/WrapType.java | 38 +- .../data/WrappedContainer.java | 8 +- .../vcompat/provider/data/WrappedContext.java | 11 + .../data/WrappedKey.java | 2 +- .../data/persistence/DataDistributor.java | 4 +- .../data/persistence/DataObserver.java | 2 +- .../data/persistence/PersistentContainer.java | 7 +- .../data/type/ObjectType.java | 6 +- .../provider/data/type/SkinDataType.java | 47 ++ .../data/wrap/SimpleSyntaxContainer.java | 13 +- .../data/wrap/SimpleSyntaxContext.java | 31 ++ .../data/wrap/SimpleSyntaxType.java | 17 +- .../data/wrap/SimpleWrapType.java | 13 +- .../data/wrap/SyntaxKey.java | 6 +- .../entity/NmsArmorStand.java | 2 +- .../entity/NmsEntity.java | 4 +- .../entity/NmsEntityLiving.java | 2 +- .../provider/entity/NmsEntityType.java | 7 + .../entity/NmsPlayer.java | 6 +- .../provider/lookup/ClassLookupProvider.java | 128 +++++ .../lookup/ClassLookups.java} | 10 +- .../provider/lookup/handle/ClassLookup.java | 510 ++++++++++++++++++ .../lookup/handle/ClassLookupCache.java | 59 ++ .../provider/lookup/handle/FakeLookup.java | 19 + .../lookup/handle/field/IFieldHandle.java | 17 + .../lookup/handle/field/SafeFieldHandle.java | 45 ++ .../field/UnsafeDeclaredFieldHandle.java | 40 ++ .../handle/field/UnsafeFieldHandle.java | 35 ++ .../handle/field/UnsafeStaticFieldHandle.java | 42 ++ .../lookup/provider/GeneralReflections.java | 34 ++ .../tools/BlockTools.java | 2 +- .../tools/ServerTools.java | 4 +- .../tools/SkinTools.java | 4 +- .../utils/NmsBoundingBox.java | 4 +- .../utils/Tracker.java | 2 +- .../wrapper/ConsoleReaderWrapper.java | 2 +- .../vcompat/reflection/PacketHandler.java | 18 - .../reflection/data/WrappedContext.java | 11 - .../reflection/data/type/SkinDataType.java | 49 -- .../data/wrap/SimpleSyntaxContext.java | 32 -- .../reflection/entity/NmsEntityType.java | 7 - .../vcompat/reflection/packet/NmsPacket.java | 7 - .../reflection/reflect/FakeReflect.java | 240 --------- .../reflect/ReflectionProvider.java | 127 ----- .../reflect/provider/GeneralReflections.java | 34 -- .../vcompat/skin/DefaultSkinStore.java | 2 +- .../minecraft/vcompat/skin/Mojang.java | 28 +- .../vcompat/skin/PersistentSkinStore.java | 6 +- .../minecraft/vcompat/skin/Profile.java | 10 +- .../minecraft/vcompat/skin/SkinStore.java | 2 +- .../{utils => util}/bukkit/BukkitColor.java | 2 +- .../{utils => util}/bukkit/Players.java | 2 +- .../bukkit/unsafe/KeyCache.java | 2 +- .../constants/DefaultConstants.java | 2 +- .../constants/MinecraftConstants.java | 2 +- .../java/function/TriPredicate.java | 2 +- .../java/net/EasyContentRegistry.java | 6 +- .../{utils => util}/java/net/EasyRequest.java | 13 +- .../util/java/net/EasyRequestType.java | 40 ++ .../java/net/EasyResponse.java | 4 +- .../util/java/net/EasyResponseCode.java | 126 +++++ .../java/net/IEasyContent.java | 6 +- .../java/net/IEasyTextContent.java | 2 +- .../java/net/content/EasyJsonContent.java | 4 +- .../net/content/EasyUrlEncodedContent.java | 20 +- .../java/net/tools/HeaderParser.java | 2 +- .../java/net/tools/UrlEncoder.java | 2 +- .../java/tools/ArrayTools.java | 2 +- .../java/tools/OptionTools.java | 2 +- .../util/java/tools/ReflectionTools.java | 79 +++ .../java/tools/UUIDHelper.java | 2 +- .../logging/BukkitLogType.java | 2 +- .../{utils => util}/logging/BukkitLogger.java | 4 +- .../logging/LoggingColors.java | 2 +- .../minecraft/MojangProfileServer.java | 2 +- .../{utils => util}/minecraft/Skin.java | 2 +- .../{utils => util}/minecraft/SkinModel.java | 2 +- .../{utils => util}/thread/PostAsync.java | 2 +- .../validation/ValidationHelper.java | 2 +- .../utils/java/tools/ReflectionTools.java | 22 - .../minecraft/vcompat/version/Versions.java | 2 +- .../vcompat/VersionCompatProvider.class | Bin 1131 -> 1034 bytes .../vcompat/data/AbstractDataAdapter.class | Bin 0 -> 2449 bytes .../data/AbstractDataAdapterRegistry.class | Bin 0 -> 6118 bytes .../vcompat/data/AbstractDataContainer.class | Bin 0 -> 7815 bytes .../vcompat/data/AbstractDataFactory.class | Bin 0 -> 4065 bytes .../vcompat/data/api/ChainDataType.class | Bin 0 -> 8655 bytes .../vcompat/data/api/DefaultDataType.class | Bin 0 -> 2716 bytes .../vcompat/data/api/IDataAdapter.class | Bin 0 -> 644 bytes .../data/api/IDataAdapterContext.class | Bin 0 -> 253 bytes .../data/api/IDataAdapterRegistry.class | Bin 0 -> 517 bytes .../vcompat/data/api/IDataContainer.class | Bin 0 -> 2352 bytes .../vcompat/data/api/IDataFactory.class | Bin 0 -> 2031 bytes .../vcompat/data/api/IDataType.class | Bin 0 -> 11196 bytes .../vcompat/data/nbt/NbtAdapter.class | Bin 0 -> 17024 bytes .../vcompat/data/nbt/NbtAdapterRegistry.class | Bin 0 -> 3395 bytes .../vcompat/data/nbt/NbtContainer.class | Bin 0 -> 4391 bytes .../vcompat/data/util/NumberConversion.class | Bin 0 -> 2876 bytes .../minecraft/vcompat/entity/Hologram.class | Bin 12607 -> 12577 bytes .../entity/handler/EntityManager.class | Bin 8492 -> 8486 bytes .../vcompat/listener/PlayerListener.class | Bin 4495 -> 4475 bytes .../listener/handler/IPlayerHandler.class | Bin 588 -> 584 bytes .../vcompat/provider/BukkitConversion.class | Bin 0 -> 2737 bytes .../vcompat/provider/DataProvider.class | Bin 0 -> 4905 bytes .../vcompat/provider/EntityProvider.class | Bin 0 -> 1709 bytes .../vcompat/provider/PlayerProvider.class | Bin 0 -> 2856 bytes .../TextureProvider.class | Bin 5541 -> 5525 bytes .../vcompat/provider/ToolProvider.class | Bin 0 -> 1124 bytes .../vcompat/provider/VersionControl.class | Bin 0 -> 1852 bytes .../vcompat/provider/VersionHandler.class | Bin 0 -> 986 bytes .../vcompat/provider/data/WrapType.class | Bin 0 -> 3912 bytes .../provider/data/WrappedContainer.class | Bin 0 -> 5964 bytes .../provider/data/WrappedContext.class | Bin 0 -> 844 bytes .../data/WrappedKey.class | Bin 1252 -> 1246 bytes .../data/persistence/DataDistributor.class | Bin 0 -> 5940 bytes .../data/persistence/DataObserver.class | Bin 4587 -> 4573 bytes .../persistence/PersistentContainer.class | Bin 0 -> 5690 bytes .../provider/data/type/ObjectType.class | Bin 0 -> 1590 bytes .../provider/data/type/SkinDataType.class | Bin 0 -> 4237 bytes .../data/wrap/SimpleSyntaxContainer.class | Bin 0 -> 7240 bytes .../data/wrap/SimpleSyntaxContext.class | Bin 0 -> 1568 bytes .../provider/data/wrap/SimpleSyntaxType.class | Bin 0 -> 3328 bytes .../provider/data/wrap/SimpleWrapType.class | Bin 0 -> 2393 bytes .../data/wrap/SyntaxKey.class | Bin 3283 -> 3275 bytes .../provider/entity/NmsArmorStand.class | Bin 0 -> 284 bytes .../entity/NmsEntity.class | Bin 1077 -> 1073 bytes .../provider/entity/NmsEntityLiving.class | Bin 0 -> 263 bytes .../provider/entity/NmsEntityType.class | Bin 0 -> 1193 bytes .../vcompat/provider/entity/NmsPlayer.class | Bin 0 -> 1057 bytes .../provider/lookup/ClassLookupProvider.class | Bin 0 -> 5619 bytes .../provider/lookup/ClassLookups.class | Bin 0 -> 1455 bytes .../provider/lookup/handle/ClassLookup.class | Bin 0 -> 18400 bytes .../lookup/handle/ClassLookupCache.class | Bin 0 -> 4350 bytes .../provider/lookup/handle/FakeLookup.class | Bin 0 -> 861 bytes .../lookup/handle/field/IFieldHandle.class | Bin 0 -> 882 bytes .../lookup/handle/field/SafeFieldHandle.class | Bin 0 -> 2096 bytes .../field/UnsafeDeclaredFieldHandle.class | Bin 0 -> 2214 bytes .../handle/field/UnsafeFieldHandle.class | Bin 0 -> 2201 bytes .../field/UnsafeStaticFieldHandle.class | Bin 0 -> 2330 bytes .../lookup/provider/GeneralReflections.class | Bin 0 -> 1304 bytes .../vcompat/provider/tools/BlockTools.class | Bin 0 -> 502 bytes .../vcompat/provider/tools/ServerTools.class | Bin 0 -> 544 bytes .../tools/SkinTools.class | Bin 1616 -> 1609 bytes .../utils/NmsBoundingBox.class | Bin 16020 -> 15979 bytes .../utils/Tracker.class | Bin 3782 -> 3778 bytes .../wrapper/ConsoleReaderWrapper.class | Bin 0 -> 584 bytes .../vcompat/reflection/BukkitConversion.class | Bin 2700 -> 0 bytes .../vcompat/reflection/DataProvider.class | Bin 4941 -> 0 bytes .../vcompat/reflection/EntityProvider.class | Bin 1739 -> 0 bytes .../vcompat/reflection/PacketHandler.class | Bin 1427 -> 0 bytes .../vcompat/reflection/PlayerProvider.class | Bin 2888 -> 0 bytes .../vcompat/reflection/ToolProvider.class | Bin 1146 -> 0 bytes .../vcompat/reflection/VersionControl.class | Bin 2056 -> 0 bytes .../vcompat/reflection/VersionHandler.class | Bin 1000 -> 0 bytes .../vcompat/reflection/data/WrapType.class | Bin 3911 -> 0 bytes .../reflection/data/WrappedContainer.class | Bin 6028 -> 0 bytes .../reflection/data/WrappedContext.class | Bin 822 -> 0 bytes .../data/persistence/DataDistributor.class | Bin 5982 -> 0 bytes .../persistence/PersistentContainer.class | Bin 5718 -> 0 bytes .../reflection/data/type/ObjectType.class | Bin 1606 -> 0 bytes .../reflection/data/type/SkinDataType.class | Bin 4126 -> 0 bytes .../data/wrap/SimpleSyntaxContainer.class | Bin 7198 -> 0 bytes .../data/wrap/SimpleSyntaxContext.class | Bin 1491 -> 0 bytes .../data/wrap/SimpleSyntaxType.class | Bin 3269 -> 0 bytes .../reflection/data/wrap/SimpleWrapType.class | Bin 2335 -> 0 bytes .../reflection/entity/NmsArmorStand.class | Bin 288 -> 0 bytes .../reflection/entity/NmsEntityLiving.class | Bin 267 -> 0 bytes .../reflection/entity/NmsEntityType.class | Bin 1205 -> 0 bytes .../vcompat/reflection/entity/NmsPlayer.class | Bin 1065 -> 0 bytes .../vcompat/reflection/packet/NmsPacket.class | Bin 314 -> 0 bytes .../reflection/reflect/FakeReflect.class | Bin 9490 -> 0 bytes .../reflect/ReflectionProvider.class | Bin 6124 -> 0 bytes .../reflection/reflect/Reflections.class | Bin 1468 -> 0 bytes .../reflect/provider/GeneralReflections.class | Bin 1255 -> 0 bytes .../vcompat/reflection/tools/BlockTools.class | Bin 506 -> 0 bytes .../reflection/tools/ServerTools.class | Bin 550 -> 0 bytes .../wrapper/ConsoleReaderWrapper.class | Bin 588 -> 0 bytes .../vcompat/skin/DefaultSkinStore.class | Bin 3502 -> 3493 bytes .../minecraft/vcompat/skin/Mojang.class | Bin 20931 -> 20883 bytes .../vcompat/skin/PersistentSkinStore.class | Bin 4127 -> 4172 bytes .../minecraft/vcompat/skin/Profile.class | Bin 5177 -> 5222 bytes .../minecraft/vcompat/skin/SkinStore.class | Bin 3551 -> 3543 bytes .../{utils => util}/bukkit/BukkitColor.class | Bin 1909 -> 1907 bytes .../{utils => util}/bukkit/Players.class | Bin 3636 -> 3634 bytes .../bukkit/unsafe/KeyCache.class | Bin 2997 -> 2992 bytes .../constants/DefaultConstants.class | Bin 756 -> 754 bytes .../util/constants/MinecraftConstants.class | Bin 0 -> 548 bytes .../java/function/TriPredicate.class | Bin 3188 -> 3174 bytes .../util/java/net/EasyContentRegistry.class | Bin 0 -> 2048 bytes .../vcompat/util/java/net/EasyRequest.class | Bin 0 -> 11815 bytes .../util/java/net/EasyRequestType.class | Bin 0 -> 2289 bytes .../java/net/EasyResponse.class | Bin 5492 -> 5485 bytes .../util/java/net/EasyResponseCode.class | Bin 0 -> 4227 bytes .../vcompat/util/java/net/IEasyContent.class | Bin 0 -> 1223 bytes .../java/net/IEasyTextContent.class | Bin 1974 -> 1971 bytes .../java/net/content/EasyJsonContent.class | Bin 1993 -> 1990 bytes .../net/content/EasyUrlEncodedContent.class | Bin 0 -> 5064 bytes .../java/net/tools/HeaderParser.class | Bin 3955 -> 3953 bytes .../java/net/tools/UrlEncoder.class | Bin 6578 -> 6572 bytes .../java/tools/ArrayTools.class | Bin 1341 -> 1339 bytes .../java/tools/OptionTools.class | Bin 691 -> 689 bytes .../util/java/tools/ReflectionTools.class | Bin 0 -> 3213 bytes .../java/tools/UUIDHelper.class | Bin 1510 -> 1508 bytes .../logging/BukkitLogType.class | Bin 2442 -> 2439 bytes .../logging/BukkitLogger.class | Bin 17366 -> 17314 bytes .../logging/LoggingColors.class | Bin 5015 -> 5013 bytes .../minecraft/MojangProfileServer.class | Bin 5599 -> 5592 bytes .../{utils => util}/minecraft/Skin.class | Bin 6263 -> 6254 bytes .../{utils => util}/minecraft/SkinModel.class | Bin 1804 -> 1798 bytes .../{utils => util}/thread/PostAsync.class | Bin 1386 -> 1384 bytes .../validation/ValidationHelper.class | Bin 813 -> 811 bytes .../utils/constants/MinecraftConstants.class | Bin 550 -> 0 bytes .../utils/java/net/EasyContentRegistry.class | Bin 2059 -> 0 bytes .../vcompat/utils/java/net/EasyRequest.class | Bin 11757 -> 0 bytes .../vcompat/utils/java/net/IEasyContent.class | Bin 1198 -> 0 bytes .../net/content/EasyUrlEncodedContent.class | Bin 5002 -> 0 bytes .../utils/java/tools/ReflectionTools.class | Bin 1454 -> 0 bytes .../minecraft/vcompat/version/Versions.class | Bin 5644 -> 5639 bytes .../minecraft/vcompat/VersionCompat.java | 6 +- .../minecraft/vcompat/VersionCompat.class | Bin 516 -> 514 bytes 250 files changed, 2618 insertions(+), 770 deletions(-) create mode 100644 vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/AbstractDataAdapter.java create mode 100644 vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/AbstractDataAdapterRegistry.java create mode 100644 vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/AbstractDataContainer.java create mode 100644 vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/AbstractDataFactory.java create mode 100644 vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/api/ChainDataType.java create mode 100644 vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/api/DefaultDataType.java create mode 100644 vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/api/IDataAdapter.java create mode 100644 vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/api/IDataAdapterContext.java create mode 100644 vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/api/IDataAdapterRegistry.java create mode 100644 vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/api/IDataContainer.java create mode 100644 vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/api/IDataFactory.java create mode 100644 vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/api/IDataType.java create mode 100644 vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/nbt/NbtAdapter.java create mode 100644 vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/nbt/NbtAdapterRegistry.java create mode 100644 vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/nbt/NbtContainer.java create mode 100644 vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/util/NumberConversion.java rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{reflection => provider}/BukkitConversion.java (65%) rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{reflection => provider}/DataProvider.java (77%) rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{reflection => provider}/EntityProvider.java (70%) rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{reflection => provider}/PlayerProvider.java (86%) rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{reflection => provider}/TextureProvider.java (95%) rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{reflection => provider}/ToolProvider.java (55%) rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{reflection => provider}/VersionControl.java (85%) rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{reflection => provider}/VersionHandler.java (83%) rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{reflection => provider}/data/WrapType.java (53%) rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{reflection => provider}/data/WrappedContainer.java (86%) create mode 100644 vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/data/WrappedContext.java rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{reflection => provider}/data/WrappedKey.java (89%) rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{reflection => provider}/data/persistence/DataDistributor.java (94%) rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{reflection => provider}/data/persistence/DataObserver.java (97%) rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{reflection => provider}/data/persistence/PersistentContainer.java (94%) rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{reflection => provider}/data/type/ObjectType.java (74%) create mode 100644 vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/data/type/SkinDataType.java rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{reflection => provider}/data/wrap/SimpleSyntaxContainer.java (84%) create mode 100644 vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/data/wrap/SimpleSyntaxContext.java rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{reflection => provider}/data/wrap/SimpleSyntaxType.java (61%) rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{reflection => provider}/data/wrap/SimpleWrapType.java (62%) rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{reflection => provider}/data/wrap/SyntaxKey.java (85%) rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{reflection => provider}/entity/NmsArmorStand.java (65%) rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{reflection => provider}/entity/NmsEntity.java (87%) rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{reflection => provider}/entity/NmsEntityLiving.java (61%) create mode 100644 vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/entity/NmsEntityType.java rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{reflection => provider}/entity/NmsPlayer.java (79%) create mode 100644 vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/lookup/ClassLookupProvider.java rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{reflection/reflect/Reflections.java => provider/lookup/ClassLookups.java} (51%) create mode 100644 vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/ClassLookup.java create mode 100644 vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/ClassLookupCache.java create mode 100644 vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/FakeLookup.java create mode 100644 vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/field/IFieldHandle.java create mode 100644 vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/field/SafeFieldHandle.java create mode 100644 vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/field/UnsafeDeclaredFieldHandle.java create mode 100644 vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/field/UnsafeFieldHandle.java create mode 100644 vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/field/UnsafeStaticFieldHandle.java create mode 100644 vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/lookup/provider/GeneralReflections.java rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{reflection => provider}/tools/BlockTools.java (76%) rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{reflection => provider}/tools/ServerTools.java (56%) rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{reflection => provider}/tools/SkinTools.java (83%) rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{reflection => provider}/utils/NmsBoundingBox.java (99%) rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{reflection => provider}/utils/Tracker.java (95%) rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{reflection => provider}/wrapper/ConsoleReaderWrapper.java (85%) delete mode 100644 vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/PacketHandler.java delete mode 100644 vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/WrappedContext.java delete mode 100644 vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/type/SkinDataType.java delete mode 100644 vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleSyntaxContext.java delete mode 100644 vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsEntityType.java delete mode 100644 vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/packet/NmsPacket.java delete mode 100644 vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/reflect/FakeReflect.java delete mode 100644 vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/reflect/ReflectionProvider.java delete mode 100644 vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/reflect/provider/GeneralReflections.java rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{utils => util}/bukkit/BukkitColor.java (95%) rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{utils => util}/bukkit/Players.java (97%) rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{utils => util}/bukkit/unsafe/KeyCache.java (95%) rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{utils => util}/constants/DefaultConstants.java (79%) rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{utils => util}/constants/MinecraftConstants.java (74%) rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{utils => util}/java/function/TriPredicate.java (98%) rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{utils => util}/java/net/EasyContentRegistry.java (77%) rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{utils => util}/java/net/EasyRequest.java (94%) create mode 100644 vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/java/net/EasyRequestType.java rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{utils => util}/java/net/EasyResponse.java (93%) create mode 100644 vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/java/net/EasyResponseCode.java rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{utils => util}/java/net/IEasyContent.java (71%) rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{utils => util}/java/net/IEasyTextContent.java (91%) rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{utils => util}/java/net/content/EasyJsonContent.java (87%) rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{utils => util}/java/net/content/EasyUrlEncodedContent.java (81%) rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{utils => util}/java/net/tools/HeaderParser.java (97%) rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{utils => util}/java/net/tools/UrlEncoder.java (99%) rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{utils => util}/java/tools/ArrayTools.java (90%) rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{utils => util}/java/tools/OptionTools.java (85%) create mode 100644 vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/java/tools/ReflectionTools.java rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{utils => util}/java/tools/UUIDHelper.java (95%) rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{utils => util}/logging/BukkitLogType.java (96%) rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{utils => util}/logging/BukkitLogger.java (98%) rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{utils => util}/logging/LoggingColors.java (98%) rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{utils => util}/minecraft/MojangProfileServer.java (98%) rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{utils => util}/minecraft/Skin.java (98%) rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{utils => util}/minecraft/SkinModel.java (91%) rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{utils => util}/thread/PostAsync.java (94%) rename vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/{utils => util}/validation/ValidationHelper.java (83%) delete mode 100644 vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/tools/ReflectionTools.java create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/data/AbstractDataAdapter.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/data/AbstractDataAdapterRegistry.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/data/AbstractDataContainer.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/data/AbstractDataFactory.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/data/api/ChainDataType.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/data/api/DefaultDataType.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/data/api/IDataAdapter.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/data/api/IDataAdapterContext.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/data/api/IDataAdapterRegistry.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/data/api/IDataContainer.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/data/api/IDataFactory.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/data/api/IDataType.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/data/nbt/NbtAdapter.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/data/nbt/NbtAdapterRegistry.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/data/nbt/NbtContainer.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/data/util/NumberConversion.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/BukkitConversion.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/DataProvider.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/EntityProvider.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/PlayerProvider.class rename vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/{reflection => provider}/TextureProvider.class (81%) create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/ToolProvider.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/VersionControl.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/VersionHandler.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/WrapType.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/WrappedContainer.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/WrappedContext.class rename vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/{reflection => provider}/data/WrappedKey.class (58%) create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/persistence/DataDistributor.class rename vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/{reflection => provider}/data/persistence/DataObserver.class (80%) create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/persistence/PersistentContainer.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/type/ObjectType.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/type/SkinDataType.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/wrap/SimpleSyntaxContainer.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/wrap/SimpleSyntaxContext.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/wrap/SimpleSyntaxType.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/wrap/SimpleWrapType.class rename vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/{reflection => provider}/data/wrap/SyntaxKey.class (71%) create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/entity/NmsArmorStand.class rename vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/{reflection => provider}/entity/NmsEntity.class (63%) create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/entity/NmsEntityLiving.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/entity/NmsEntityType.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/entity/NmsPlayer.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/lookup/ClassLookupProvider.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/lookup/ClassLookups.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/ClassLookup.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/ClassLookupCache.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/FakeLookup.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/field/IFieldHandle.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/field/SafeFieldHandle.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/field/UnsafeDeclaredFieldHandle.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/field/UnsafeFieldHandle.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/field/UnsafeStaticFieldHandle.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/lookup/provider/GeneralReflections.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/tools/BlockTools.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/tools/ServerTools.class rename vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/{reflection => provider}/tools/SkinTools.class (64%) rename vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/{reflection => provider}/utils/NmsBoundingBox.class (81%) rename vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/{reflection => provider}/utils/Tracker.class (90%) create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/wrapper/ConsoleReaderWrapper.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/BukkitConversion.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/DataProvider.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/EntityProvider.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/PacketHandler.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/PlayerProvider.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/ToolProvider.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/VersionControl.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/VersionHandler.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/WrapType.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/WrappedContainer.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/WrappedContext.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/persistence/DataDistributor.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/persistence/PersistentContainer.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/type/ObjectType.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/type/SkinDataType.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleSyntaxContainer.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleSyntaxContext.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleSyntaxType.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleWrapType.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsArmorStand.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsEntityLiving.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsEntityType.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsPlayer.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/packet/NmsPacket.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/reflect/FakeReflect.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/reflect/ReflectionProvider.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/reflect/Reflections.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/reflect/provider/GeneralReflections.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/tools/BlockTools.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/tools/ServerTools.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/wrapper/ConsoleReaderWrapper.class rename vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/{utils => util}/bukkit/BukkitColor.class (87%) rename vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/{utils => util}/bukkit/Players.class (84%) rename vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/{utils => util}/bukkit/unsafe/KeyCache.class (64%) rename vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/{utils => util}/constants/DefaultConstants.class (52%) create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/constants/MinecraftConstants.class rename vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/{utils => util}/java/function/TriPredicate.class (51%) create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/net/EasyContentRegistry.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/net/EasyRequest.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/net/EasyRequestType.class rename vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/{utils => util}/java/net/EasyResponse.class (74%) create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/net/EasyResponseCode.class create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/net/IEasyContent.class rename vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/{utils => util}/java/net/IEasyTextContent.class (64%) rename vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/{utils => util}/java/net/content/EasyJsonContent.class (82%) create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/net/content/EasyUrlEncodedContent.class rename vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/{utils => util}/java/net/tools/HeaderParser.class (80%) rename vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/{utils => util}/java/net/tools/UrlEncoder.class (85%) rename vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/{utils => util}/java/tools/ArrayTools.class (69%) rename vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/{utils => util}/java/tools/OptionTools.class (57%) create mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/tools/ReflectionTools.class rename vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/{utils => util}/java/tools/UUIDHelper.class (77%) rename vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/{utils => util}/logging/BukkitLogType.class (78%) rename vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/{utils => util}/logging/BukkitLogger.class (66%) rename vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/{utils => util}/logging/LoggingColors.class (89%) rename vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/{utils => util}/minecraft/MojangProfileServer.class (80%) rename vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/{utils => util}/minecraft/Skin.class (80%) rename vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/{utils => util}/minecraft/SkinModel.class (63%) rename vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/{utils => util}/thread/PostAsync.class (81%) rename vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/{utils => util}/validation/ValidationHelper.class (56%) delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/constants/MinecraftConstants.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/java/net/EasyContentRegistry.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/java/net/EasyRequest.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/java/net/IEasyContent.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/java/net/content/EasyUrlEncodedContent.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/java/tools/ReflectionTools.class diff --git a/vcompat-api/pom.xml b/vcompat-api/pom.xml index 67d7b38..879b555 100644 --- a/vcompat-api/pom.xml +++ b/vcompat-api/pom.xml @@ -21,52 +21,37 @@ com.syntaxphoenix.syntaxapi java - 2.0.11 + 2.0.14 com.syntaxphoenix.syntaxapi - data-nbtcontainer - 2.0.11 - - - com.syntaxphoenix.syntaxapi - data-base - 2.0.11 - - - com.syntaxphoenix.syntaxapi - net + nbt 2.0.12 com.syntaxphoenix.syntaxapi - command - 2.0.10 - - - com.syntaxphoenix.syntaxapi - nbt - 2.0.9 + version + 2.0.12 com.syntaxphoenix.syntaxapi - version - 2.0.9 + key + 2.0.11 com.syntaxphoenix.syntaxapi - reflection - 2.0.8 + random + 2.0.11 com.syntaxphoenix.syntaxapi - key - 2.0.8 + logging + 2.0.11 com.syntaxphoenix.syntaxapi - random - 2.0.8 + json-lib + 2.0.11 \ No newline at end of file diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/VersionCompatProvider.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/VersionCompatProvider.java index 135645d..9a809d2 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/VersionCompatProvider.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/VersionCompatProvider.java @@ -2,7 +2,7 @@ import com.syntaxphoenix.syntaxapi.utils.java.tools.Container; -import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; +import net.sourcewriters.minecraft.vcompat.provider.VersionControl; public abstract class VersionCompatProvider { @@ -12,9 +12,9 @@ public static VersionCompatProvider get() { return PROVIDER.get(); } - public static boolean isAvailable() { - return PROVIDER.isPresent(); - } + /* + * Impl + */ public abstract VersionControl getControl(); diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/AbstractDataAdapter.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/AbstractDataAdapter.java new file mode 100644 index 0000000..e8d2da8 --- /dev/null +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/AbstractDataAdapter.java @@ -0,0 +1,46 @@ +package net.sourcewriters.minecraft.vcompat.data; + +import java.util.function.Function; + +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapter; + +public abstract class AbstractDataAdapter implements IDataAdapter { + + private final Function builder; + private final Function extractor; + + private final Class

primitiveType; + private final Class complexType; + + public AbstractDataAdapter(Class

primitiveType, Class complexType, Function builder, Function extractor) { + this.primitiveType = primitiveType; + this.complexType = complexType; + this.builder = builder; + this.extractor = extractor; + } + + public abstract Class getBaseType(); + + @Override + public Class

getPrimitiveType() { + return primitiveType; + } + + @Override + public Class getComplexType() { + return complexType; + } + + public P extract(B input) { + return complexType.isInstance(input) ? extractor.apply(complexType.cast(input)) : null; + } + + public C build(Object input) { + return primitiveType.isInstance(input) ? builder.apply(primitiveType.cast(input)) : null; + } + + public boolean isInstance(B base) { + return complexType.isInstance(base); + } + +} diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/AbstractDataAdapterRegistry.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/AbstractDataAdapterRegistry.java new file mode 100644 index 0000000..1f93f1e --- /dev/null +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/AbstractDataAdapterRegistry.java @@ -0,0 +1,60 @@ +package net.sourcewriters.minecraft.vcompat.data; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.function.Function; + +import com.google.common.base.Objects; + +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapter; +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterRegistry; +import net.sourcewriters.minecraft.vcompat.data.api.IDataType; + +public abstract class AbstractDataAdapterRegistry implements IDataAdapterRegistry { + + protected final List> adapters = Collections.synchronizedList(new ArrayList<>()); + + protected abstract IDataAdapter build(Class clazz); + + public abstract IDataAdapter create(Class

primitiveType, Class complexType, Function builder, + Function extractor); + + public AbstractDataAdapterRegistry() { + for (IDataType type : IDataType.PRIMITIVES) { + adapters.add(build(type.getPrimitive())); + } + } + + @Override + public B wrap(Object value) { + if (value == null) { + return null; + } + IDataAdapter adapter = find(value.getClass(), IDataAdapter::getPrimitiveType); + if (adapter == null) { + return null; + } + return adapter.getPrimitiveType().isInstance(value) ? adapter.build(value) : null; + } + + @Override + public Object extract(B base) { + if (base == null) { + return null; + } + IDataAdapter adapter = find(base.getClass(), IDataAdapter::getComplexType); + return adapter == null ? null : adapter.extract(base); + } + + @Override + public boolean has(Class clazz) { + return adapters.stream() + .anyMatch(adapter -> Objects.equal(clazz, adapter.getPrimitiveType()) || Objects.equal(clazz, adapter.getComplexType())); + } + + private IDataAdapter find(Class clazz, Function, Class> mapper) { + return adapters.stream().filter(adapter -> mapper.apply(adapter).isAssignableFrom(clazz)).findAny().orElseGet(() -> build(clazz)); + } + +} diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/AbstractDataContainer.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/AbstractDataContainer.java new file mode 100644 index 0000000..3bd1b3c --- /dev/null +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/AbstractDataContainer.java @@ -0,0 +1,118 @@ +package net.sourcewriters.minecraft.vcompat.data; + +import com.syntaxphoenix.syntaxapi.utils.key.IKey; +import com.syntaxphoenix.syntaxapi.utils.key.NamespacedKey; + +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterRegistry; +import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; +import net.sourcewriters.minecraft.vcompat.data.api.IDataType; +import net.sourcewriters.minecraft.vcompat.data.util.NumberConversion; + +public abstract class AbstractDataContainer implements IDataContainer { + + protected final IDataAdapterRegistry registry; + + public AbstractDataContainer(IDataAdapterRegistry registry) { + this.registry = registry; + } + + @Override + public IDataAdapterRegistry getRegistry() { + return registry; + } + + @Override + public Object get(String key) { + B raw = getRaw(key); + if (raw == null) { + return raw; + } + return registry.extract(raw); + } + + @Override + public E get(String key, IDataType type) { + Object value = registry.getBase().isAssignableFrom(type.getPrimitive()) ? getRaw(key) : get(key); + if (value == null || !type.isPrimitive(value)) { + if (Number.class.isAssignableFrom(type.getComplex())) { + return NumberConversion.convert(0, type.getComplex()); + } + return null; + } + E output = type.fromPrimitiveObj(getContext(), value); + if (output == null && Number.class.isAssignableFrom(type.getComplex())) { + return NumberConversion.convert(0, type.getComplex()); + } + return output; + } + + @Override + public boolean has(String key, IDataType type) { + if (!has(key)) { + return false; + } + Object value = registry.getBase().isAssignableFrom(type.getPrimitive()) ? getRaw(key) : get(key); + return value != null && type.isPrimitive(value); + } + + @Override + public void set(String key, E value, IDataType type) { + set(key, registry.wrap(type.toPrimitive(getContext(), value))); + } + + /* + * Key conversion + */ + + @Override + public Object get(IKey key) { + return get(key.asString()); + } + + @Override + public E get(IKey key, IDataType type) { + return get(key.asString(), type); + } + + @Override + public void set(IKey key, E value, IDataType type) { + set(key.asString(), value, type); + } + + @Override + public boolean has(IKey key) { + return has(key.asString()); + } + + @Override + public boolean has(IKey key, IDataType type) { + return has(key.asString(), type); + } + + @Override + public boolean remove(IKey key) { + return remove(key.asString()); + } + + @Override + public IKey[] getKeys() { + return getKeyspaces().stream().map(NamespacedKey::fromString).toArray(IKey[]::new); + } + + /* + * Abstract + */ + + public abstract B getRaw(String key); + + public B getRaw(IKey key) { + return getRaw(key.asString()); + } + + public abstract void set(String key, B value); + + public void set(IKey key, B value) { + set(key.asString(), value); + } + +} diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/AbstractDataFactory.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/AbstractDataFactory.java new file mode 100644 index 0000000..4561e64 --- /dev/null +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/AbstractDataFactory.java @@ -0,0 +1,42 @@ +package net.sourcewriters.minecraft.vcompat.data; + +import java.io.File; +import java.io.InputStream; +import java.io.OutputStream; + +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterRegistry; +import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; +import net.sourcewriters.minecraft.vcompat.data.api.IDataFactory; + +public abstract class AbstractDataFactory implements IDataFactory { + + protected final IDataAdapterRegistry registry; + + public AbstractDataFactory(IDataAdapterRegistry registry) { + this.registry = registry; + } + + @Override + public IDataAdapterRegistry getRegistry() { + return registry; + } + + @Override + public abstract AbstractDataFactory toFile(IDataContainer container, File file); + + @Override + public abstract AbstractDataFactory toStream(IDataContainer container, OutputStream stream); + + @Override + public abstract AbstractDataFactory toString(IDataContainer container, StringBuilder builder); + + @Override + public abstract AbstractDataFactory fromFile(IDataContainer container, File file); + + @Override + public abstract AbstractDataFactory fromStream(IDataContainer container, InputStream stream); + + @Override + public abstract AbstractDataFactory fromString(IDataContainer container, String string); + +} diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/api/ChainDataType.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/api/ChainDataType.java new file mode 100644 index 0000000..8bff681 --- /dev/null +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/api/ChainDataType.java @@ -0,0 +1,191 @@ +package net.sourcewriters.minecraft.vcompat.data.api; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.Objects; +import java.util.Optional; + +public class ChainDataType

implements IDataType { + + private final ArrayList> types = new ArrayList<>(); + + /* + * Contains + */ + + public boolean has(IDataType type) { + return hasExact(type) || hasComplex(type.getComplex()); + } + + public boolean hasExact(IDataType type) { + return types.contains(type); + } + + public boolean hasComplex(Class complex) { + return types.stream().anyMatch(type -> Objects.equals(type.getComplex(), complex)); + } + + /* + * Add + */ + + public ChainDataType add(IDataType type) { + if (type == null) { + return this; + } + if (has(type)) { + return this; + } + types.add(type); + return this; + } + + public ChainDataType addAll(IDataType... types) { + if (types == null) { + return this; + } + for (int index = 0; index < types.length; index++) { + add(types[index]); + } + return this; + } + + public ChainDataType addAll(Iterable> types) { + if (types == null) { + return this; + } + return addAll(types.iterator()); + } + + public ChainDataType addAll(Iterator> types) { + if (types == null) { + return this; + } + while (types.hasNext()) { + add(types.next()); + } + return this; + } + + /* + * Remove + */ + + public ChainDataType remove(IDataType type) { + types.remove(type); + return this; + } + + public ChainDataType removeAll(IDataType... types) { + if (types == null) { + return this; + } + for (int index = 0; index < types.length; index++) { + remove(types[index]); + } + return this; + } + + public ChainDataType removeAll(Iterable> types) { + if (types == null) { + return this; + } + return removeAll(types.iterator()); + } + + public ChainDataType removeAll(Iterator> types) { + if (types == null) { + return this; + } + while (types.hasNext()) { + remove(types.next()); + } + return this; + } + + /* + * Get + */ + + public IDataType get(int index) { + return types.get(index); + } + + public IDataType[] get(int start, int length) { + return types.subList(start, start + length).toArray(new IDataType[0]); + } + + /* + * Other + */ + + public int size() { + return types.size(); + } + + public boolean isEmpty() { + return types.isEmpty(); + } + + public ChainDataType clear() { + types.clear(); + return this; + } + + /* + * Cast + */ + + @SuppressWarnings("unchecked") + public Optional> asComplex(Class complex) { + return Optional.ofNullable(Objects.equals(getComplex(), complex) ? (ChainDataType) this : null); + } + + @SuppressWarnings("unchecked") + public Optional> asPrimitive(Class primitive) { + return Optional.ofNullable(Objects.equals(getPrimitive(), primitive) ? (ChainDataType) this : null); + } + + /* + * DataType + */ + + @SuppressWarnings("unchecked") + @Override + public Class getComplex() { + return isEmpty() ? null : (Class) types.get(size() - 1).getComplex(); + } + + @SuppressWarnings("unchecked") + @Override + public Class

getPrimitive() { + return isEmpty() ? null : (Class

) types.get(0).getPrimitive(); + } + + @SuppressWarnings("unchecked") + @Override + public C fromPrimitive(IDataAdapterContext context, P primitive) { + Object output = primitive; + for (int index = size() - 1; index > -1; index--) { + if (output == null) { + return null; + } + output = types.get(index).fromPrimitiveObj(context, output); + } + return isComplex(output) ? (C) output : null; + } + + @SuppressWarnings("unchecked") + @Override + public P toPrimitive(IDataAdapterContext context, C complex) { + Object output = complex; + for (int index = size() - 1; index > -1; index--) { + if (output == null) { + return null; + } + output = types.get(index).toPrimitiveObj(context, output); + } + return isPrimitive(output) ? (P) output : null; + } + +} diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/api/DefaultDataType.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/api/DefaultDataType.java new file mode 100644 index 0000000..25f7a32 --- /dev/null +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/api/DefaultDataType.java @@ -0,0 +1,41 @@ +package net.sourcewriters.minecraft.vcompat.data.api; + +import java.util.function.BiFunction; + +class DefaultDataType implements IDataType { + + private final Class

primitiveType; + private final Class complexType; + + private final BiFunction fromPrimitive; + private final BiFunction toPrimitive; + + DefaultDataType(Class

primitiveType, Class complexType, BiFunction fromPrimitive, + BiFunction toPrimitive) { + this.primitiveType = primitiveType; + this.complexType = complexType; + this.fromPrimitive = fromPrimitive; + this.toPrimitive = toPrimitive; + } + + @Override + public Class getComplex() { + return this.complexType; + } + + @Override + public Class

getPrimitive() { + return this.primitiveType; + } + + @Override + public P toPrimitive(IDataAdapterContext context, C complex) { + return toPrimitive.apply(complex, context); + } + + @Override + public C fromPrimitive(IDataAdapterContext context, P primitive) { + return fromPrimitive.apply(primitive, context); + } + +} \ No newline at end of file diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/api/IDataAdapter.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/api/IDataAdapter.java new file mode 100644 index 0000000..6963c1a --- /dev/null +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/api/IDataAdapter.java @@ -0,0 +1,17 @@ +package net.sourcewriters.minecraft.vcompat.data.api; + +public interface IDataAdapter { + + Class getBaseType(); + + Class

getPrimitiveType(); + + Class getComplexType(); + + P extract(B input); + + C build(Object input); + + boolean isInstance(B base); + +} diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/api/IDataAdapterContext.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/api/IDataAdapterContext.java new file mode 100644 index 0000000..ee53cc3 --- /dev/null +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/api/IDataAdapterContext.java @@ -0,0 +1,7 @@ +package net.sourcewriters.minecraft.vcompat.data.api; + +public interface IDataAdapterContext { + + public IDataContainer newContainer(); + +} diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/api/IDataAdapterRegistry.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/api/IDataAdapterRegistry.java new file mode 100644 index 0000000..55a8ef6 --- /dev/null +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/api/IDataAdapterRegistry.java @@ -0,0 +1,13 @@ +package net.sourcewriters.minecraft.vcompat.data.api; + +public interface IDataAdapterRegistry { + + Class getBase(); + + boolean has(Class clazz); // == isRegistered + + Object extract(B base); + + B wrap(Object value); + +} diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/api/IDataContainer.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/api/IDataContainer.java new file mode 100644 index 0000000..bdeac01 --- /dev/null +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/api/IDataContainer.java @@ -0,0 +1,45 @@ +package net.sourcewriters.minecraft.vcompat.data.api; + +import java.util.Set; + +import com.syntaxphoenix.syntaxapi.utils.key.IKey; + +public interface IDataContainer { + + IDataAdapterRegistry getRegistry(); + + IDataAdapterContext getContext(); + + boolean has(String key); + + boolean has(IKey key); + + boolean has(String key, IDataType type); + + boolean has(IKey key, IDataType type); + + Object get(String key); + + Object get(IKey key); + + E get(String key, IDataType type); + + E get(IKey key, IDataType type); + + boolean remove(String key); + + boolean remove(IKey key); + + void set(String key, E value, IDataType type); + + void set(IKey key, E value, IDataType type); + + Set getKeyspaces(); + + IKey[] getKeys(); + + boolean isEmpty(); + + int size(); + +} diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/api/IDataFactory.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/api/IDataFactory.java new file mode 100644 index 0000000..efb04b5 --- /dev/null +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/api/IDataFactory.java @@ -0,0 +1,23 @@ +package net.sourcewriters.minecraft.vcompat.data.api; + +import java.io.File; +import java.io.InputStream; +import java.io.OutputStream; + +public interface IDataFactory { + + IDataAdapterRegistry getRegistry(); + + IDataFactory toFile(IDataContainer container, File file); + + IDataFactory toStream(IDataContainer container, OutputStream stream); + + IDataFactory toString(IDataContainer container, StringBuilder builder); + + IDataFactory fromFile(IDataContainer container, File file); + + IDataFactory fromStream(IDataContainer container, InputStream stream); + + IDataFactory fromString(IDataContainer container, String string); + +} diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/api/IDataType.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/api/IDataType.java new file mode 100644 index 0000000..0ea2f49 --- /dev/null +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/api/IDataType.java @@ -0,0 +1,142 @@ +package net.sourcewriters.minecraft.vcompat.data.api; + +import java.math.BigDecimal; +import java.math.BigInteger; +import java.nio.ByteBuffer; +import java.util.Arrays; +import java.util.Objects; +import java.util.Optional; +import java.util.UUID; +import java.util.function.BiFunction; +import java.util.function.Function; + +import com.syntaxphoenix.syntaxapi.utils.java.Primitives; + +public interface IDataType

{ + + public static final IDataType BYTE = of(Byte.class); + public static final IDataType SHORT = of(Short.class); + public static final IDataType INTEGER = of(Integer.class); + public static final IDataType LONG = of(Long.class); + + public static final IDataType FLOAT = of(Float.class); + public static final IDataType DOUBLE = of(Double.class); + + public static final IDataType BIG_INTEGER = of(BigInteger.class); + public static final IDataType BIG_DECIMAL = of(BigDecimal.class); + + public static final IDataType BOOLEAN = of(Boolean.class); + + public static final IDataType STRING = of(String.class); + + public static final IDataType INT_ARRAY = of(int[].class); + public static final IDataType BYTE_ARRAY = of(byte[].class); + public static final IDataType LONG_ARRAY = of(long[].class); + + public static final IDataType CONTAINER = of(IDataContainer.class); + public static final IDataType CONTAINER_ARRAY = of(IDataContainer[].class); + + public static final IDataType UUID = of(byte[].class, UUID.class, array -> { + ByteBuffer buffer = ByteBuffer.wrap(array); + long mostSignificant = buffer.getLong(); + long leastSignificant = buffer.getLong(); + return new UUID(mostSignificant, leastSignificant); + }, uniqueId -> { + ByteBuffer buffer = ByteBuffer.wrap(new byte[16]); + buffer.putLong(uniqueId.getMostSignificantBits()); + buffer.putLong(uniqueId.getLeastSignificantBits()); + return buffer.array(); + }); + + public static final IDataType[] PRIMITIVES = new IDataType[] { + BYTE, + SHORT, + INTEGER, + LONG, + FLOAT, + DOUBLE, + BIG_INTEGER, + BIG_DECIMAL, + BOOLEAN, + STRING, + INT_ARRAY, + BYTE_ARRAY, + LONG_ARRAY, + CONTAINER, + CONTAINER_ARRAY + }; + + public static Optional> getPrimitiveType(Object object) { + Class clazz = Primitives.fromPrimitive(object.getClass()); + return Arrays.stream(PRIMITIVES).filter(type -> Objects.equals(clazz, type.getComplex())).findFirst(); + } + + public static boolean isPrimitiveType(Object object) { + Class clazz = Primitives.fromPrimitive(object.getClass()); + return Arrays.stream(PRIMITIVES).anyMatch(type -> Objects.equals(clazz, type.getComplex())); + } + + public default boolean isComplex(Object object) { + if (object == null) { + return false; + } + return getComplex().isAssignableFrom(Primitives.fromPrimitive(object.getClass())); + } + + public default boolean isPrimitive(Object object) { + if (object == null) { + return false; + } + return getPrimitive().isAssignableFrom(Primitives.fromPrimitive(object.getClass())); + } + + public Class getComplex(); + + public Class

getPrimitive(); + + public P toPrimitive(IDataAdapterContext context, C complex); + + public C fromPrimitive(IDataAdapterContext context, P primitive); + + @SuppressWarnings("unchecked") + public default P toPrimitiveObj(IDataAdapterContext context, Object complex) { + if (complex == null) { + return null; + } + if (isComplex(complex)) { + return toPrimitive(context, (C) complex); + } + if (isPrimitive(complex)) { + return (P) complex; + } + return null; + } + + @SuppressWarnings("unchecked") + public default C fromPrimitiveObj(IDataAdapterContext context, Object primitive) { + if (primitive == null) { + return null; + } + if (isPrimitive(primitive)) { + return fromPrimitive(context, (P) primitive); + } + if (isComplex(primitive)) { + return (C) primitive; + } + return null; + } + + public static

IDataType of(Class

type) { + return new DefaultDataType<>(type, type, (value, context) -> value, (value, context) -> value); + } + + public static IDataType of(Class

primitive, Class complex, Function from, Function to) { + return new DefaultDataType<>(primitive, complex, (value, context) -> from.apply(value), (value, context) -> to.apply(value)); + } + + public static IDataType of(Class

primitive, Class complex, BiFunction from, + BiFunction to) { + return new DefaultDataType<>(primitive, complex, from, to); + } + +} \ No newline at end of file diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/nbt/NbtAdapter.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/nbt/NbtAdapter.java new file mode 100644 index 0000000..8847259 --- /dev/null +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/nbt/NbtAdapter.java @@ -0,0 +1,225 @@ +package net.sourcewriters.minecraft.vcompat.data.nbt; + +import java.math.BigDecimal; +import java.math.BigInteger; +import java.util.ArrayList; +import java.util.Objects; +import java.util.function.Function; + +import com.syntaxphoenix.syntaxapi.nbt.NbtBigDecimal; +import com.syntaxphoenix.syntaxapi.nbt.NbtBigInt; +import com.syntaxphoenix.syntaxapi.nbt.NbtByte; +import com.syntaxphoenix.syntaxapi.nbt.NbtByteArray; +import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; +import com.syntaxphoenix.syntaxapi.nbt.NbtDouble; +import com.syntaxphoenix.syntaxapi.nbt.NbtFloat; +import com.syntaxphoenix.syntaxapi.nbt.NbtInt; +import com.syntaxphoenix.syntaxapi.nbt.NbtIntArray; +import com.syntaxphoenix.syntaxapi.nbt.NbtList; +import com.syntaxphoenix.syntaxapi.nbt.NbtLong; +import com.syntaxphoenix.syntaxapi.nbt.NbtLongArray; +import com.syntaxphoenix.syntaxapi.nbt.NbtShort; +import com.syntaxphoenix.syntaxapi.nbt.NbtString; +import com.syntaxphoenix.syntaxapi.nbt.NbtTag; +import com.syntaxphoenix.syntaxapi.nbt.NbtType; +import com.syntaxphoenix.syntaxapi.utils.java.Primitives; + +import net.sourcewriters.minecraft.vcompat.data.AbstractDataAdapter; +import net.sourcewriters.minecraft.vcompat.data.AbstractDataContainer; +import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; + +public class NbtAdapter extends AbstractDataAdapter { + + protected NbtAdapter(Class

primitiveType, Class resultType, Function builder, Function extractor) { + super(primitiveType, resultType, builder, extractor); + } + + @Override + public Class getBaseType() { + return NbtTag.class; + } + + /* + * + */ + + @SuppressWarnings({ + "rawtypes", + "unchecked" + }) + protected static AbstractDataAdapter createAdapter(NbtAdapterRegistry registry, Class type) { + type = Primitives.fromPrimitive(type); + + /* + * Numbers + */ + + if (Objects.equals(Boolean.class, type)) { + return new NbtAdapter(Boolean.class, NbtByte.class, state -> new NbtByte((byte) (state ? 1 : 0)), + value -> value.getByteValue() == 1); + } + + if (Objects.equals(Byte.class, type)) { + return new NbtAdapter(Byte.class, NbtByte.class, NbtByte::new, value -> value.getByteValue()); + } + + if (Objects.equals(Short.class, type)) { + return new NbtAdapter(Short.class, NbtShort.class, NbtShort::new, value -> value.getShortValue()); + } + + if (Objects.equals(Integer.class, type)) { + return new NbtAdapter(Integer.class, NbtInt.class, NbtInt::new, value -> value.getIntValue()); + } + + if (Objects.equals(Long.class, type)) { + return new NbtAdapter(Long.class, NbtLong.class, NbtLong::new, value -> value.getLongValue()); + } + + if (Objects.equals(BigInteger.class, type)) { + return new NbtAdapter(BigInteger.class, NbtBigInt.class, NbtBigInt::new, value -> value.getInteger()); + } + + if (Objects.equals(Float.class, type)) { + return new NbtAdapter(Float.class, NbtFloat.class, NbtFloat::new, value -> value.getFloatValue()); + } + + if (Objects.equals(Double.class, type)) { + return new NbtAdapter(Double.class, NbtDouble.class, NbtDouble::new, value -> value.getDoubleValue()); + } + + if (Objects.equals(BigDecimal.class, type)) { + return new NbtAdapter(BigDecimal.class, NbtBigDecimal.class, NbtBigDecimal::new, + value -> value.getDecimal()); + } + + /* + * String + */ + + if (Objects.equals(String.class, type)) { + return new NbtAdapter(String.class, NbtString.class, NbtString::new, value -> value.getValue()); + } + + /* + * Number Arrays + */ + + if (Objects.equals(byte[].class, type)) { + return new NbtAdapter(byte[].class, NbtByteArray.class, NbtByteArray::new, value -> value.getValue()); + } + + if (Objects.equals(int[].class, type)) { + return new NbtAdapter(int[].class, NbtIntArray.class, NbtIntArray::new, value -> value.getValue()); + } + + if (Objects.equals(long[].class, type)) { + return new NbtAdapter(long[].class, NbtLongArray.class, NbtLongArray::new, value -> value.getValue()); + } + + /* + * Complex Arrays + */ + + if (Objects.equals(IDataContainer[].class, type)) { + return new NbtAdapter(IDataContainer[].class, NbtList.class, containers -> { + NbtList list = new NbtList<>(NbtType.COMPOUND); + for (IDataContainer container : containers) { + list.add(toNbtCompound(registry, container)); + } + return list; + }, list -> { + if (list.getElementType() != NbtType.COMPOUND) { + return new IDataContainer[0]; + } + NbtList nbtList = list; + ArrayList containers = new ArrayList<>(); + for (NbtTag tag : nbtList) { + containers.add(fromNbtCompound(registry, (NbtCompound) tag)); + } + return containers.toArray(new IDataContainer[0]); + }); + } + + if (Objects.equals(AbstractDataContainer[].class, type)) { + return new NbtAdapter(AbstractDataContainer[].class, NbtList.class, containers -> { + NbtList list = new NbtList<>(NbtType.COMPOUND); + for (AbstractDataContainer container : containers) { + list.add(toNbtCompound(registry, container)); + } + return list; + }, list -> { + if (list.getElementType() != NbtType.COMPOUND) { + return new AbstractDataContainer[0]; + } + NbtList nbtList = list; + ArrayList containers = new ArrayList<>(); + for (NbtTag tag : nbtList) { + containers.add(fromNbtCompound(registry, (NbtCompound) tag)); + } + return containers.toArray(new AbstractDataContainer[0]); + }); + } + + if (Objects.equals(NbtContainer[].class, type)) { + return new NbtAdapter(NbtContainer[].class, NbtList.class, containers -> { + NbtList list = new NbtList<>(NbtType.COMPOUND); + for (NbtContainer container : containers) { + list.add(toNbtCompound(registry, container)); + } + return list; + }, list -> { + if (list.getElementType() != NbtType.COMPOUND) { + return new NbtContainer[0]; + } + NbtList nbtList = list; + ArrayList containers = new ArrayList<>(); + for (NbtTag tag : nbtList) { + containers.add(fromNbtCompound(registry, (NbtCompound) tag)); + } + return containers.toArray(new NbtContainer[0]); + }); + } + + /* + * Complex + */ + + if (IDataContainer.class.isAssignableFrom(type)) { + return new NbtAdapter(IDataContainer.class, NbtCompound.class, container -> { + return toNbtCompound(registry, container); + }, compound -> { + return fromNbtCompound(registry, compound); + }); + } + + /* + * NbtTag + */ + + if (NbtTag.class.isAssignableFrom(type)) { + return new NbtAdapter(NbtTag.class, NbtTag.class, tag -> tag, tag -> tag); + } + + return null; + } + + private static NbtCompound toNbtCompound(NbtAdapterRegistry registry, IDataContainer container) { + if (container instanceof NbtContainer) { + return ((NbtContainer) container).getRoot().clone(); + } + NbtCompound compound = new NbtCompound(); + for (String key : container.getKeyspaces()) { + Object object = container.get(key); + NbtTag tag = registry.wrap(object); + if (tag != null) { + compound.set(key, tag); + } + } + return compound; + } + + private static NbtContainer fromNbtCompound(NbtAdapterRegistry registry, NbtCompound compound) { + return new NbtContainer(compound.clone(), registry); + } + +} diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/nbt/NbtAdapterRegistry.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/nbt/NbtAdapterRegistry.java new file mode 100644 index 0000000..664dde8 --- /dev/null +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/nbt/NbtAdapterRegistry.java @@ -0,0 +1,47 @@ +package net.sourcewriters.minecraft.vcompat.data.nbt; + +import java.util.function.Function; + +import com.syntaxphoenix.syntaxapi.nbt.NbtTag; +import com.syntaxphoenix.syntaxapi.nbt.NbtType; + +import net.sourcewriters.minecraft.vcompat.data.AbstractDataAdapterRegistry; +import net.sourcewriters.minecraft.vcompat.data.AbstractDataContainer; +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapter; +import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; + +public class NbtAdapterRegistry extends AbstractDataAdapterRegistry { + + public NbtAdapterRegistry() { + adapters.add(build(IDataContainer.class)); + adapters.add(build(IDataContainer[].class)); + adapters.add(build(AbstractDataContainer[].class)); + adapters.add(build(NbtContainer[].class)); + } + + @Override + public Object extract(NbtTag base) { + if (base.getType() == NbtType.END) { + return null; + } + return super.extract(base); + } + + @Override + public Class getBase() { + return NbtTag.class; + } + + @SuppressWarnings("unchecked") + @Override + protected IDataAdapter build(Class clazz) { + return (IDataAdapter) NbtAdapter.createAdapter(this, clazz); + } + + @Override + public IDataAdapter create(Class

primitiveType, Class complexType, Function builder, + Function extractor) { + return new NbtAdapter<>(primitiveType, complexType, builder, extractor); + } + +} diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/nbt/NbtContainer.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/nbt/NbtContainer.java new file mode 100644 index 0000000..d1eaace --- /dev/null +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/nbt/NbtContainer.java @@ -0,0 +1,92 @@ +package net.sourcewriters.minecraft.vcompat.data.nbt; + +import java.util.Set; + +import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; +import com.syntaxphoenix.syntaxapi.nbt.NbtTag; +import com.syntaxphoenix.syntaxapi.nbt.utils.NbtStorage; + +import net.sourcewriters.minecraft.vcompat.data.AbstractDataContainer; +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterContext; +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterRegistry; + +public class NbtContainer extends AbstractDataContainer implements IDataAdapterContext, NbtStorage { + + protected final NbtCompound root; + + public NbtContainer(IDataAdapterRegistry registry) { + this(new NbtCompound(), registry); + } + + protected NbtContainer(NbtCompound root, IDataAdapterRegistry registry) { + super(registry); + this.root = root; + } + + @Override + public NbtContainer newContainer() { + return new NbtContainer(registry); + } + + @Override + public IDataAdapterContext getContext() { + return this; + } + + public NbtCompound getRoot() { + return root; + } + + @Override + public void fromNbt(NbtCompound nbt) { + root.clear(); + for (String key : nbt.getKeys()) { + set(key, nbt.get(key)); + } + } + + @Override + public NbtCompound asNbt() { + return root.clone(); + } + + @Override + public boolean has(String key) { + return root.hasKey(key); + } + + @Override + public NbtTag getRaw(String key) { + return root.get(key); + } + + @Override + public boolean remove(String key) { + return root.remove(key) != null; + } + + @Override + public void set(String key, NbtTag value) { + if(value == null) { + remove(key); + return; + } + root.set(key, value); + } + + @Override + public Set getKeyspaces() { + return root.getKeys(); + } + + @Override + public boolean isEmpty() { + return root.isEmpty(); + } + + @Override + public int size() { + return root.size(); + } + +} diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/util/NumberConversion.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/util/NumberConversion.java new file mode 100644 index 0000000..285aa77 --- /dev/null +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/data/util/NumberConversion.java @@ -0,0 +1,33 @@ +package net.sourcewriters.minecraft.vcompat.data.util; + +import java.math.BigDecimal; +import java.math.BigInteger; +import java.util.HashMap; +import java.util.function.Function; + +public final class NumberConversion { + + private static final HashMap, Function> MAP = new HashMap<>(); + + static { + MAP.put(Byte.class, Number::byteValue); + MAP.put(Short.class, Number::shortValue); + MAP.put(Integer.class, Number::intValue); + MAP.put(Float.class, Number::floatValue); + MAP.put(Long.class, Number::longValue); + MAP.put(Double.class, Number::doubleValue); + MAP.put(BigInteger.class, number -> BigInteger.valueOf(number.longValue())); + MAP.put(BigDecimal.class, number -> BigDecimal.valueOf(number.doubleValue())); + } + + private NumberConversion() {} + + public static E convert(Number number, Class clazz) { + Function mapper = MAP.get(clazz); + if (mapper == null) { + return null; + } + return clazz.cast(mapper.apply(number)); + } + +} diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/entity/Hologram.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/entity/Hologram.java index 9a0f637..6a1ebc8 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/entity/Hologram.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/entity/Hologram.java @@ -14,9 +14,9 @@ import net.sourcewriters.minecraft.vcompat.entity.handler.DefaultEntityType; import net.sourcewriters.minecraft.vcompat.entity.handler.EntityBuilder; import net.sourcewriters.minecraft.vcompat.entity.handler.EntityType; -import net.sourcewriters.minecraft.vcompat.reflection.EntityProvider; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsArmorStand; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; +import net.sourcewriters.minecraft.vcompat.provider.EntityProvider; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsArmorStand; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityType; public class Hologram extends CustomEntity { diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/EntityManager.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/EntityManager.java index 10027ae..263073f 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/EntityManager.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/EntityManager.java @@ -10,7 +10,7 @@ import net.sourcewriters.minecraft.vcompat.listener.PlayerListener; import net.sourcewriters.minecraft.vcompat.listener.handler.IPlayerHandler; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsPlayer; public class EntityManager implements IPlayerHandler { diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/listener/PlayerListener.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/listener/PlayerListener.java index b25c83c..303889e 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/listener/PlayerListener.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/listener/PlayerListener.java @@ -18,8 +18,8 @@ import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; import net.sourcewriters.minecraft.vcompat.listener.handler.IPlayerHandler; -import net.sourcewriters.minecraft.vcompat.reflection.PlayerProvider; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.provider.PlayerProvider; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsPlayer; public final class PlayerListener implements Listener { diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/listener/handler/IPlayerHandler.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/listener/handler/IPlayerHandler.java index e3f789e..1f1a160 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/listener/handler/IPlayerHandler.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/listener/handler/IPlayerHandler.java @@ -1,6 +1,6 @@ package net.sourcewriters.minecraft.vcompat.listener.handler; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsPlayer; public interface IPlayerHandler { diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/BukkitConversion.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/BukkitConversion.java similarity index 65% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/BukkitConversion.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/BukkitConversion.java index ac2b569..43402e3 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/BukkitConversion.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/BukkitConversion.java @@ -1,17 +1,17 @@ -package net.sourcewriters.minecraft.vcompat.reflection; +package net.sourcewriters.minecraft.vcompat.provider; import org.bukkit.entity.EntityType; import org.bukkit.inventory.ItemStack; -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; import com.syntaxphoenix.syntaxapi.nbt.NbtList; import com.syntaxphoenix.syntaxapi.nbt.NbtTag; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterContext; +import net.sourcewriters.minecraft.vcompat.data.api.IDataType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityType; public abstract class BukkitConversion extends VersionHandler { @@ -39,8 +39,8 @@ protected BukkitConversion(V versionControl) { public abstract NbtCompound itemToCompound(ItemStack itemStack); - public abstract WrappedContext createContext(DataAdapterContext context); + public abstract WrappedContext createContext(IDataAdapterContext context); - public abstract WrapType wrap(DataType dataType); + public abstract WrapType wrap(IDataType dataType); } \ No newline at end of file diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/DataProvider.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/DataProvider.java similarity index 77% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/DataProvider.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/DataProvider.java index 20971fa..d7c7943 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/DataProvider.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/DataProvider.java @@ -1,4 +1,4 @@ -package net.sourcewriters.minecraft.vcompat.reflection; +package net.sourcewriters.minecraft.vcompat.provider; import java.io.File; import java.util.UUID; @@ -7,12 +7,11 @@ import org.bukkit.Bukkit; -import com.syntaxphoenix.syntaxapi.data.container.nbt.NbtAdapterRegistry; -import com.syntaxphoenix.syntaxapi.data.container.nbt.NbtContainer; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.DataDistributor; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContainer; +import net.sourcewriters.minecraft.vcompat.data.nbt.NbtAdapterRegistry; +import net.sourcewriters.minecraft.vcompat.data.nbt.NbtContainer; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.provider.data.persistence.DataDistributor; +import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SimpleSyntaxContainer; public class DataProvider extends VersionHandler { diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/EntityProvider.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/EntityProvider.java similarity index 70% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/EntityProvider.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/EntityProvider.java index 4403e9f..e06d062 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/EntityProvider.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/EntityProvider.java @@ -1,10 +1,10 @@ -package net.sourcewriters.minecraft.vcompat.reflection; +package net.sourcewriters.minecraft.vcompat.provider; import org.bukkit.World; import org.bukkit.entity.EntityType; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityType; public abstract class EntityProvider extends VersionHandler { diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/PlayerProvider.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/PlayerProvider.java similarity index 86% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/PlayerProvider.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/PlayerProvider.java index 04936e2..e48f3f9 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/PlayerProvider.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/PlayerProvider.java @@ -1,4 +1,4 @@ -package net.sourcewriters.minecraft.vcompat.reflection; +package net.sourcewriters.minecraft.vcompat.provider; import java.util.Collections; import java.util.HashMap; @@ -8,8 +8,8 @@ import org.bukkit.Bukkit; import org.bukkit.entity.Player; -import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.PersistentContainer; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.provider.data.persistence.PersistentContainer; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsPlayer; public abstract class PlayerProvider extends VersionHandler { diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/TextureProvider.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/TextureProvider.java similarity index 95% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/TextureProvider.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/TextureProvider.java index 5a7caa2..461e079 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/TextureProvider.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/TextureProvider.java @@ -1,6 +1,6 @@ -package net.sourcewriters.minecraft.vcompat.reflection; +package net.sourcewriters.minecraft.vcompat.provider; -import static net.sourcewriters.minecraft.vcompat.utils.constants.MinecraftConstants.TEXTURE_SIGNATURE; +import static net.sourcewriters.minecraft.vcompat.util.constants.MinecraftConstants.TEXTURE_SIGNATURE; import java.util.Collections; import java.util.HashMap; diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/ToolProvider.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/ToolProvider.java similarity index 55% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/ToolProvider.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/ToolProvider.java index 0222b29..01e414a 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/ToolProvider.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/ToolProvider.java @@ -1,8 +1,8 @@ -package net.sourcewriters.minecraft.vcompat.reflection; +package net.sourcewriters.minecraft.vcompat.provider; -import net.sourcewriters.minecraft.vcompat.reflection.tools.BlockTools; -import net.sourcewriters.minecraft.vcompat.reflection.tools.ServerTools; -import net.sourcewriters.minecraft.vcompat.reflection.tools.SkinTools; +import net.sourcewriters.minecraft.vcompat.provider.tools.BlockTools; +import net.sourcewriters.minecraft.vcompat.provider.tools.ServerTools; +import net.sourcewriters.minecraft.vcompat.provider.tools.SkinTools; public abstract class ToolProvider extends VersionHandler { diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/VersionControl.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/VersionControl.java similarity index 85% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/VersionControl.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/VersionControl.java index 1169459..36c6e86 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/VersionControl.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/VersionControl.java @@ -1,4 +1,4 @@ -package net.sourcewriters.minecraft.vcompat.reflection; +package net.sourcewriters.minecraft.vcompat.provider; public abstract class VersionControl { @@ -18,8 +18,6 @@ public DataProvider getDataProvider() { public abstract TextureProvider getTextureProvider(); - public abstract PacketHandler getPacketHandler(); - public abstract BukkitConversion getBukkitConversion(); public void shutdown() {} diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/VersionHandler.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/VersionHandler.java similarity index 83% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/VersionHandler.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/VersionHandler.java index f5da047..f6f076a 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/VersionHandler.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/VersionHandler.java @@ -1,4 +1,4 @@ -package net.sourcewriters.minecraft.vcompat.reflection; +package net.sourcewriters.minecraft.vcompat.provider; public abstract class VersionHandler { diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/WrapType.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/data/WrapType.java similarity index 53% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/WrapType.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/data/WrapType.java index 109f328..9c9e678 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/WrapType.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/data/WrapType.java @@ -1,34 +1,32 @@ -package net.sourcewriters.minecraft.vcompat.reflection.data; +package net.sourcewriters.minecraft.vcompat.provider.data; import java.math.BigDecimal; import java.math.BigInteger; -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.data.PrimitiveDataType; - -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxType; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleWrapType; +import net.sourcewriters.minecraft.vcompat.data.api.IDataType; +import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SimpleSyntaxType; +import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SimpleWrapType; public interface WrapType { - public static final SimpleWrapType BYTE = new SimpleWrapType<>(PrimitiveDataType.BYTE); - public static final SimpleWrapType SHORT = new SimpleWrapType<>(PrimitiveDataType.SHORT); - public static final SimpleWrapType INTEGER = new SimpleWrapType<>(PrimitiveDataType.INTEGER); - public static final SimpleWrapType LONG = new SimpleWrapType<>(PrimitiveDataType.LONG); + public static final SimpleWrapType BYTE = new SimpleWrapType<>(IDataType.BYTE); + public static final SimpleWrapType SHORT = new SimpleWrapType<>(IDataType.SHORT); + public static final SimpleWrapType INTEGER = new SimpleWrapType<>(IDataType.INTEGER); + public static final SimpleWrapType LONG = new SimpleWrapType<>(IDataType.LONG); - public static final SimpleWrapType FLOAT = new SimpleWrapType<>(PrimitiveDataType.FLOAT); - public static final SimpleWrapType DOUBLE = new SimpleWrapType<>(PrimitiveDataType.DOUBLE); + public static final SimpleWrapType FLOAT = new SimpleWrapType<>(IDataType.FLOAT); + public static final SimpleWrapType DOUBLE = new SimpleWrapType<>(IDataType.DOUBLE); - public static final SimpleWrapType BIG_INTEGER = new SimpleWrapType<>(PrimitiveDataType.BIG_INTEGER); - public static final SimpleWrapType BIG_DECIMAL = new SimpleWrapType<>(PrimitiveDataType.BIG_DECIMAL); + public static final SimpleWrapType BIG_INTEGER = new SimpleWrapType<>(IDataType.BIG_INTEGER); + public static final SimpleWrapType BIG_DECIMAL = new SimpleWrapType<>(IDataType.BIG_DECIMAL); - public static final SimpleWrapType BOOLEAN = new SimpleWrapType<>(PrimitiveDataType.BOOLEAN); + public static final SimpleWrapType BOOLEAN = new SimpleWrapType<>(IDataType.BOOLEAN); - public static final SimpleWrapType STRING = new SimpleWrapType<>(PrimitiveDataType.STRING); + public static final SimpleWrapType STRING = new SimpleWrapType<>(IDataType.STRING); - public static final SimpleWrapType INT_ARRAY = new SimpleWrapType<>(PrimitiveDataType.INT_ARRAY); - public static final SimpleWrapType BYTE_ARRAY = new SimpleWrapType<>(PrimitiveDataType.BYTE_ARRAY); - public static final SimpleWrapType LONG_ARRAY = new SimpleWrapType<>(PrimitiveDataType.LONG_ARRAY); + public static final SimpleWrapType INT_ARRAY = new SimpleWrapType<>(IDataType.INT_ARRAY); + public static final SimpleWrapType BYTE_ARRAY = new SimpleWrapType<>(IDataType.BYTE_ARRAY); + public static final SimpleWrapType LONG_ARRAY = new SimpleWrapType<>(IDataType.LONG_ARRAY); /* * Interface @@ -42,7 +40,7 @@ public interface WrapType { C wrapToComplex(P primitive, WrappedContext context); - public default DataType syntaxType() { + public default IDataType syntaxType() { return new SimpleSyntaxType<>(this); } diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/WrappedContainer.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/data/WrappedContainer.java similarity index 86% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/WrappedContainer.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/data/WrappedContainer.java index 08e6aeb..656f7e7 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/WrappedContainer.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/data/WrappedContainer.java @@ -1,16 +1,16 @@ -package net.sourcewriters.minecraft.vcompat.reflection.data; +package net.sourcewriters.minecraft.vcompat.provider.data; -import static net.sourcewriters.minecraft.vcompat.utils.constants.DefaultConstants.NAMESPACE_STRING; +import static net.sourcewriters.minecraft.vcompat.util.constants.DefaultConstants.NAMESPACE_STRING; import java.util.Optional; import java.util.Set; -import com.syntaxphoenix.syntaxapi.data.IDataContainer; import com.syntaxphoenix.syntaxapi.utils.key.IKey; import com.syntaxphoenix.syntaxapi.utils.key.Namespace; import com.syntaxphoenix.syntaxapi.utils.key.NamespacedKey; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SyntaxKey; +import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; +import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SyntaxKey; public abstract class WrappedContainer { diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/data/WrappedContext.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/data/WrappedContext.java new file mode 100644 index 0000000..167cf9a --- /dev/null +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/data/WrappedContext.java @@ -0,0 +1,11 @@ +package net.sourcewriters.minecraft.vcompat.provider.data; + +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterContext; + +public abstract class WrappedContext implements IDataAdapterContext { + + public abstract H getHandle(); + + public abstract WrappedContainer newWrapContainer(); + +} \ No newline at end of file diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/WrappedKey.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/data/WrappedKey.java similarity index 89% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/WrappedKey.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/data/WrappedKey.java index 59bd378..6e1f4fe 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/WrappedKey.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/data/WrappedKey.java @@ -1,4 +1,4 @@ -package net.sourcewriters.minecraft.vcompat.reflection.data; +package net.sourcewriters.minecraft.vcompat.provider.data; import com.syntaxphoenix.syntaxapi.utils.key.Namespace; import com.syntaxphoenix.syntaxapi.utils.key.NamespacedKey; diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/persistence/DataDistributor.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/data/persistence/DataDistributor.java similarity index 94% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/persistence/DataDistributor.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/data/persistence/DataDistributor.java index fd89ce1..2f3e1cf 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/persistence/DataDistributor.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/data/persistence/DataDistributor.java @@ -1,4 +1,4 @@ -package net.sourcewriters.minecraft.vcompat.reflection.data.persistence; +package net.sourcewriters.minecraft.vcompat.provider.data.persistence; import java.io.File; import java.util.Collections; @@ -7,7 +7,7 @@ import java.util.function.Function; import java.util.function.Supplier; -import net.sourcewriters.minecraft.vcompat.reflection.DataProvider; +import net.sourcewriters.minecraft.vcompat.provider.DataProvider; public class DataDistributor { diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/persistence/DataObserver.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/data/persistence/DataObserver.java similarity index 97% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/persistence/DataObserver.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/data/persistence/DataObserver.java index a306136..3e15c47 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/persistence/DataObserver.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/data/persistence/DataObserver.java @@ -1,4 +1,4 @@ -package net.sourcewriters.minecraft.vcompat.reflection.data.persistence; +package net.sourcewriters.minecraft.vcompat.provider.data.persistence; import java.io.IOException; diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/persistence/PersistentContainer.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/data/persistence/PersistentContainer.java similarity index 94% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/persistence/PersistentContainer.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/data/persistence/PersistentContainer.java index c70a125..73b9f04 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/persistence/PersistentContainer.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/data/persistence/PersistentContainer.java @@ -1,4 +1,4 @@ -package net.sourcewriters.minecraft.vcompat.reflection.data.persistence; +package net.sourcewriters.minecraft.vcompat.provider.data.persistence; import java.io.File; import java.util.LinkedHashSet; @@ -7,12 +7,13 @@ import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.function.Consumer; -import com.syntaxphoenix.syntaxapi.data.container.nbt.NbtAdapterRegistry; -import com.syntaxphoenix.syntaxapi.data.container.nbt.NbtContainer; import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; import com.syntaxphoenix.syntaxapi.nbt.NbtTag; import com.syntaxphoenix.syntaxapi.utils.key.IKey; +import net.sourcewriters.minecraft.vcompat.data.nbt.NbtAdapterRegistry; +import net.sourcewriters.minecraft.vcompat.data.nbt.NbtContainer; + public class PersistentContainer extends NbtContainer { protected final ReadWriteLock lock = new ReentrantReadWriteLock(); diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/type/ObjectType.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/data/type/ObjectType.java similarity index 74% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/type/ObjectType.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/data/type/ObjectType.java index 6eb67bd..c19cf3f 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/type/ObjectType.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/data/type/ObjectType.java @@ -1,7 +1,7 @@ -package net.sourcewriters.minecraft.vcompat.reflection.data.type; +package net.sourcewriters.minecraft.vcompat.provider.data.type; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContext; public final class ObjectType implements WrapType { diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/data/type/SkinDataType.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/data/type/SkinDataType.java new file mode 100644 index 0000000..1926175 --- /dev/null +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/data/type/SkinDataType.java @@ -0,0 +1,47 @@ +package net.sourcewriters.minecraft.vcompat.provider.data.type; + +import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterContext; +import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; +import net.sourcewriters.minecraft.vcompat.data.api.IDataType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; +import net.sourcewriters.minecraft.vcompat.util.minecraft.Skin; + +public final class SkinDataType implements IDataType { + + public static final IDataType INSTANCE = new SkinDataType(); + public static final WrapType WRAPPED_INSTANCE = VersionCompatProvider.get().getControl().getBukkitConversion().wrap(INSTANCE); + + private SkinDataType() {} + + @Override + public Class getComplex() { + return Skin.class; + } + + @Override + public Class getPrimitive() { + return IDataContainer.class; + } + + @Override + public IDataContainer toPrimitive(IDataAdapterContext context, Skin complex) { + IDataContainer container = context.newContainer(); + container.set("name", complex.getName(), IDataType.STRING); + container.set("value", complex.getValue(), IDataType.STRING); + container.set("signature", complex.getSignature(), IDataType.STRING); + return container; + } + + @Override + public Skin fromPrimitive(IDataAdapterContext context, IDataContainer container) { + String name = container.get("name", IDataType.STRING); + String value = container.get("value", IDataType.STRING); + String signature = container.get("signature", IDataType.STRING); + if(name == null || value == null || signature == null) { + return null; + } + return new Skin(name, value, signature, false); + } + +} \ No newline at end of file diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleSyntaxContainer.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/data/wrap/SimpleSyntaxContainer.java similarity index 84% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleSyntaxContainer.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/data/wrap/SimpleSyntaxContainer.java index fac02a0..6d82ebc 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleSyntaxContainer.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/data/wrap/SimpleSyntaxContainer.java @@ -1,12 +1,11 @@ -package net.sourcewriters.minecraft.vcompat.reflection.data.wrap; +package net.sourcewriters.minecraft.vcompat.provider.data.wrap; import java.util.Set; -import com.syntaxphoenix.syntaxapi.data.IDataContainer; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; +import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedKey; public final class SimpleSyntaxContainer extends WrappedContainer { @@ -32,7 +31,7 @@ public E getAsSyntaxContainer() { @Override public SimpleSyntaxContext getContext() { - return new SimpleSyntaxContext(container.getAdapterContext()); + return new SimpleSyntaxContext(container.getContext()); } @Override diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/data/wrap/SimpleSyntaxContext.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/data/wrap/SimpleSyntaxContext.java new file mode 100644 index 0000000..4222315 --- /dev/null +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/data/wrap/SimpleSyntaxContext.java @@ -0,0 +1,31 @@ +package net.sourcewriters.minecraft.vcompat.provider.data.wrap; + +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterContext; +import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContext; + +public class SimpleSyntaxContext extends WrappedContext { + + private final IDataAdapterContext context; + + public SimpleSyntaxContext(IDataAdapterContext context) { + this.context = context; + } + + @Override + public IDataAdapterContext getHandle() { + return context; + } + + @Override + public IDataContainer newContainer() { + return context.newContainer(); + } + + @Override + public WrappedContainer newWrapContainer() { + return new SimpleSyntaxContainer<>(context.newContainer()); + } + +} \ No newline at end of file diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleSyntaxType.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/data/wrap/SimpleSyntaxType.java similarity index 61% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleSyntaxType.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/data/wrap/SimpleSyntaxType.java index 6da8bdc..1326584 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleSyntaxType.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/data/wrap/SimpleSyntaxType.java @@ -1,15 +1,14 @@ -package net.sourcewriters.minecraft.vcompat.reflection.data.wrap; +package net.sourcewriters.minecraft.vcompat.provider.data.wrap; import java.util.Objects; -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; - import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; -import net.sourcewriters.minecraft.vcompat.reflection.BukkitConversion; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterContext; +import net.sourcewriters.minecraft.vcompat.data.api.IDataType; +import net.sourcewriters.minecraft.vcompat.provider.BukkitConversion; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; -public class SimpleSyntaxType implements DataType { +public class SimpleSyntaxType implements IDataType { private final WrapType type; private final BukkitConversion conversion; @@ -30,12 +29,12 @@ public Class

getPrimitive() { } @Override - public P toPrimitive(DataAdapterContext context, C complex) { + public P toPrimitive(IDataAdapterContext context, C complex) { return type.wrapToPrimitive(complex, conversion.createContext(context)); } @Override - public C fromPrimitive(DataAdapterContext context, P primitive) { + public C fromPrimitive(IDataAdapterContext context, P primitive) { return type.wrapToComplex(primitive, conversion.createContext(context)); } diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleWrapType.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/data/wrap/SimpleWrapType.java similarity index 62% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleWrapType.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/data/wrap/SimpleWrapType.java index 5929388..82b1434 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleWrapType.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/data/wrap/SimpleWrapType.java @@ -1,15 +1,14 @@ -package net.sourcewriters.minecraft.vcompat.reflection.data.wrap; +package net.sourcewriters.minecraft.vcompat.provider.data.wrap; -import com.syntaxphoenix.syntaxapi.data.DataType; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.data.api.IDataType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContext; public class SimpleWrapType implements WrapType { - private final DataType type; + private final IDataType type; - public SimpleWrapType(DataType type) { + public SimpleWrapType(IDataType type) { this.type = type; } diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SyntaxKey.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/data/wrap/SyntaxKey.java similarity index 85% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SyntaxKey.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/data/wrap/SyntaxKey.java index f69d5a3..e3fea8a 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SyntaxKey.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/data/wrap/SyntaxKey.java @@ -1,6 +1,6 @@ -package net.sourcewriters.minecraft.vcompat.reflection.data.wrap; +package net.sourcewriters.minecraft.vcompat.provider.data.wrap; -import static net.sourcewriters.minecraft.vcompat.utils.constants.DefaultConstants.NAMESPACE_STRING; +import static net.sourcewriters.minecraft.vcompat.util.constants.DefaultConstants.NAMESPACE_STRING; import org.bukkit.plugin.Plugin; @@ -8,7 +8,7 @@ import com.syntaxphoenix.syntaxapi.utils.key.Namespace; import com.syntaxphoenix.syntaxapi.utils.key.NamespacedKey; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedKey; public final class SyntaxKey extends WrappedKey { diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsArmorStand.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/entity/NmsArmorStand.java similarity index 65% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsArmorStand.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/entity/NmsArmorStand.java index 467c16d..6f64b98 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsArmorStand.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/entity/NmsArmorStand.java @@ -1,4 +1,4 @@ -package net.sourcewriters.minecraft.vcompat.reflection.entity; +package net.sourcewriters.minecraft.vcompat.provider.entity; public interface NmsArmorStand extends NmsEntityLiving { diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsEntity.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/entity/NmsEntity.java similarity index 87% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsEntity.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/entity/NmsEntity.java index ea115fa..204a900 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsEntity.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/entity/NmsEntity.java @@ -1,11 +1,11 @@ -package net.sourcewriters.minecraft.vcompat.reflection.entity; +package net.sourcewriters.minecraft.vcompat.provider.entity; import java.util.UUID; import org.bukkit.Location; import org.bukkit.entity.Player; -import net.sourcewriters.minecraft.vcompat.reflection.utils.NmsBoundingBox; +import net.sourcewriters.minecraft.vcompat.provider.utils.NmsBoundingBox; public interface NmsEntity { diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsEntityLiving.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/entity/NmsEntityLiving.java similarity index 61% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsEntityLiving.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/entity/NmsEntityLiving.java index fe8d70a..4f6743b 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsEntityLiving.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/entity/NmsEntityLiving.java @@ -1,4 +1,4 @@ -package net.sourcewriters.minecraft.vcompat.reflection.entity; +package net.sourcewriters.minecraft.vcompat.provider.entity; public interface NmsEntityLiving extends NmsEntity { diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/entity/NmsEntityType.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/entity/NmsEntityType.java new file mode 100644 index 0000000..6463bc7 --- /dev/null +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/entity/NmsEntityType.java @@ -0,0 +1,7 @@ +package net.sourcewriters.minecraft.vcompat.provider.entity; + +public enum NmsEntityType { + + ARMOR_STAND; + +} \ No newline at end of file diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsPlayer.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/entity/NmsPlayer.java similarity index 79% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsPlayer.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/entity/NmsPlayer.java index d4f43af..166610d 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsPlayer.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/entity/NmsPlayer.java @@ -1,9 +1,9 @@ -package net.sourcewriters.minecraft.vcompat.reflection.entity; +package net.sourcewriters.minecraft.vcompat.provider.entity; import org.bukkit.entity.Player; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.util.minecraft.Skin; public interface NmsPlayer extends NmsEntityLiving { diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/lookup/ClassLookupProvider.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/lookup/ClassLookupProvider.java new file mode 100644 index 0000000..5186b37 --- /dev/null +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/lookup/ClassLookupProvider.java @@ -0,0 +1,128 @@ +package net.sourcewriters.minecraft.vcompat.provider.lookup; + +import java.util.Map.Entry; +import java.util.Optional; + +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookup; +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookupCache; +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.FakeLookup; +import net.sourcewriters.minecraft.vcompat.util.java.tools.ReflectionTools; +import net.sourcewriters.minecraft.vcompat.version.Versions; + +public final class ClassLookupProvider { + + public static final String CB_PATH_FORMAT = "org.bukkit.craftbukkit.%s.%s"; + + public static final String NMS_PATH_FORMAT_LEGACY = "net.minecraft.server.%s.%s"; + public static final String NMS_PATH_FORMAT_REMAP = "net.minecraft.%s"; + + private final ClassLookupCache cache; + + private final String cbPath; + private final String nmsPath; + + private boolean skip = false; + + public ClassLookupProvider() { + this(new ClassLookupCache()); + } + + public ClassLookupProvider(final ClassLookupCache cache) { + this.cache = cache; + this.cbPath = String.format(CB_PATH_FORMAT, Versions.getServerAsString(), "%s"); + this.nmsPath = Versions.getServer().getMinor() >= 17 ? NMS_PATH_FORMAT_REMAP + : String.format(NMS_PATH_FORMAT_LEGACY, Versions.getServerAsString(), "%s"); + } + + /* + * Delete + */ + + public void deleteAll() { + cache.clear(); + } + + public void deleteByName(final String name) { + cache.delete(name); + } + + public void deleteByPackage(final String path) { + final Entry[] array = cache.entries(); + for (final Entry entry : array) { + if (!entry.getValue().getOwner().getPackageName().equals(path)) { + continue; + } + cache.delete(entry.getKey()); + } + } + + /* + * Skip + */ + + public ClassLookupProvider require(final boolean skip) { + this.skip = !skip; + return this; + } + + public ClassLookupProvider skip(final boolean skip) { + this.skip = skip; + return this; + } + + public boolean skip() { + return skip; + } + + /* + * Reflection + */ + + public ClassLookupCache getReflection() { + return cache; + } + + public String getNmsPath() { + return nmsPath; + } + + public String getCbPath() { + return cbPath; + } + + public ClassLookup createNMSLookup(final String name, final String path) { + return skip ? FakeLookup.FAKE : cache.create(name, getNMSClass(path)); + } + + public ClassLookup createCBLookup(final String name, final String path) { + return skip ? FakeLookup.FAKE : cache.create(name, getCBClass(path)); + } + + public ClassLookup createLookup(final String name, final String path) { + return skip ? FakeLookup.FAKE : cache.create(name, getClass(path)); + } + + public ClassLookup createLookup(final String name, final Class clazz) { + return skip ? FakeLookup.FAKE : cache.create(name, clazz); + } + + public Optional getOptionalLookup(final String name) { + return cache.get(name); + } + + public ClassLookup getLookup(final String name) { + return cache.get(name).orElse(null); + } + + public Class getNMSClass(final String path) { + return getClass(String.format(nmsPath, path)); + } + + public Class getCBClass(final String path) { + return getClass(String.format(cbPath, path)); + } + + public Class getClass(final String path) { + return ReflectionTools.getClass(path); + } +} \ No newline at end of file diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/reflect/Reflections.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/lookup/ClassLookups.java similarity index 51% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/reflect/Reflections.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/lookup/ClassLookups.java index 0329bcd..3f7bec2 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/reflect/Reflections.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/lookup/ClassLookups.java @@ -1,16 +1,16 @@ -package net.sourcewriters.minecraft.vcompat.reflection.reflect; +package net.sourcewriters.minecraft.vcompat.provider.lookup; import java.util.function.Consumer; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.provider.GeneralReflections; +import net.sourcewriters.minecraft.vcompat.provider.lookup.provider.GeneralReflections; -public abstract class Reflections { +public abstract class ClassLookups { - public static void globalSetup(ReflectionProvider provider) { + public static void globalSetup(ClassLookupProvider provider) { GeneralReflections.INSTANCE.setup(provider); } - public abstract void setup(ReflectionProvider provider); + public abstract void setup(ClassLookupProvider provider); public static T predicate(boolean condition, T value, Consumer action) { if (condition) { diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/ClassLookup.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/ClassLookup.java new file mode 100644 index 0000000..c5b2507 --- /dev/null +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/ClassLookup.java @@ -0,0 +1,510 @@ +package net.sourcewriters.minecraft.vcompat.provider.lookup.handle; + +import java.lang.invoke.MethodHandle; +import java.lang.invoke.MethodHandles; +import java.lang.invoke.MethodHandles.Lookup; +import java.lang.invoke.VarHandle; +import java.lang.reflect.Constructor; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.util.Collection; +import java.util.HashMap; +import java.util.function.Predicate; + +import com.syntaxphoenix.syntaxapi.utils.java.Arrays; +import com.syntaxphoenix.syntaxapi.utils.java.Exceptions; + +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.field.IFieldHandle; +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.field.SafeFieldHandle; +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.field.UnsafeDeclaredFieldHandle; +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.field.UnsafeStaticFieldHandle; +import net.sourcewriters.minecraft.vcompat.util.java.tools.ReflectionTools; + +public class ClassLookup { + + public static final Lookup LOOKUP = MethodHandles.lookup(); + + private Class owner; + private Lookup privateLookup; + + private final HashMap constructors = new HashMap<>(); + private final HashMap methods = new HashMap<>(); + private final HashMap> fields = new HashMap<>(); + + protected ClassLookup(final String classPath) throws IllegalAccessException { + this(ReflectionTools.getClass(classPath)); + } + + protected ClassLookup(final Class owner) throws IllegalAccessException { + this.owner = owner; + this.privateLookup = owner != null ? MethodHandles.privateLookupIn(owner, LOOKUP) : null; + } + + /* + * + */ + + public Class getOwner() { + return owner; + } + + public Lookup getPrivateLockup() { + return privateLookup; + } + + /* + * + */ + + public void delete() { + constructors.clear(); + methods.clear(); + fields.clear(); + owner = null; + privateLookup = null; + } + + public boolean isValid() { + return owner != null; + } + + /* + * + */ + + public Collection getConstructors() { + return constructors.values(); + } + + public Collection getMethods() { + return methods.values(); + } + + public Collection> getFields() { + return fields.values(); + } + + /* + * + */ + + public MethodHandle getConstructor(final String name) { + return isValid() ? constructors.get(name) : null; + } + + public MethodHandle getMethod(final String name) { + return isValid() ? methods.get(name) : null; + } + + public IFieldHandle getField(final String name) { + return isValid() ? fields.get(name) : null; + } + + /* + * + */ + + public boolean hasConstructor(final String name) { + return isValid() && constructors.containsKey(name); + } + + public boolean hasMethod(final String name) { + return isValid() && methods.containsKey(name); + } + + public boolean hasField(final String name) { + return isValid() && fields.containsKey(name); + } + + /* + * + */ + + public Object init() { + if (!isValid()) { + return null; + } + final MethodHandle handle = constructors.computeIfAbsent("$base#empty", ignore -> { + try { + return LOOKUP.unreflectConstructor(owner.getConstructor()); + } catch (IllegalAccessException | NoSuchMethodException | SecurityException e) { + return null; + } + }); + if (handle == null) { + constructors.remove("$base#empty"); + return null; + } + try { + return handle.invoke(); + } catch (final Throwable e) { + e.printStackTrace(); + } + return null; + } + + public Object init(final String name, final Object... args) { + if (!isValid() || !constructors.containsKey(name)) { + return null; + } + try { + return constructors.get(name).invokeWithArguments(args); + } catch (final Throwable e) { + e.printStackTrace(); + } + return null; + } + + /* + * + */ + + public ClassLookup execute(final String name, final Object... args) { + run(name, args); + return this; + } + + public ClassLookup execute(final Object source, final String name, final Object... args) { + run(source, name, args); + return this; + } + + public Object run(final String name, final Object... args) { + if (!isValid() || !methods.containsKey(name)) { + return null; + } + try { + return methods.get(name).invokeWithArguments(args); + } catch (final Throwable e) { + e.printStackTrace(); + } + return null; + } + + public Object run(final Object source, final String name, final Object... args) { + if (!isValid() || !methods.containsKey(name)) { + return null; + } + try { + return methods.get(name).invokeWithArguments(mergeBack(args, source)); + } catch (final Throwable e) { + e.printStackTrace(); + } + return null; + } + + /* + * + */ + + public Object getFieldValue(final String name) { + return isValid() && fields.containsKey(name) ? fields.get(name).getValue() : null; + } + + public Object getFieldValue(final Object source, final String name) { + return isValid() && fields.containsKey(name) ? fields.get(name).getValue(source) : null; + } + + public void setFieldValue(final String name, final Object value) { + if (!isValid() || !fields.containsKey(name)) { + return; + } + fields.get(name).setValue(value); + } + + public void setFieldValue(final Object source, final String name, final Object value) { + if (!isValid() || !fields.containsKey(name)) { + return; + } + fields.get(name).setValue(source, value); + } + + /* + * + */ + + public ClassLookup searchConstructor(final Predicate predicate, final String name, final Class... args) { + return predicate.test(this) ? searchConstructor(name, args) : this; + } + + public ClassLookup searchConstructor(final String name, final Class... arguments) { + if (hasConstructor(name)) { + return this; + } + Constructor constructor = null; + try { + constructor = owner.getDeclaredConstructor(arguments); + } catch (NoSuchMethodException | SecurityException e) { + } + if (constructor == null) { + try { + constructor = owner.getConstructor(arguments); + } catch (NoSuchMethodException | SecurityException e) { + } + } + if (constructor != null) { + try { + constructors.put(name, unreflect(constructor)); + } catch (final IllegalAccessException e) { + } + } + return this; + } + + public ClassLookup searchConstructorsByArguments(String base, final Class... arguments) { + final Constructor[] constructors = Arrays.merge(Constructor[]::new, owner.getDeclaredConstructors(), owner.getConstructors()); + if (constructors.length == 0) { + return this; + } + base += '-'; + int current = 0; + for (final Constructor constructor : constructors) { + final Class[] args = constructor.getParameterTypes(); + if (args.length != arguments.length) { + continue; + } + try { + if (ReflectionTools.hasSameArguments(arguments, args)) { + this.constructors.put(base + current, unreflect(constructor)); + current++; + } + } catch (final IllegalAccessException e) { + } + } + return this; + } + + /* + * + */ + + public ClassLookup searchMethod(final Predicate predicate, final String name, final String methodName, + final Class... arguments) { + return predicate.test(this) ? searchMethod(name, methodName, arguments) : this; + } + + public ClassLookup searchMethod(final String name, final String methodName, final Class... arguments) { + if (hasMethod(name)) { + return this; + } + Method method = null; + try { + method = owner.getDeclaredMethod(methodName, arguments); + } catch (NoSuchMethodException | SecurityException e) { + } + if (method == null) { + try { + method = owner.getMethod(methodName, arguments); + } catch (NoSuchMethodException | SecurityException e) { + } + } + if (method != null) { + try { + methods.put(name, unreflect(method)); + } catch (IllegalAccessException | SecurityException e) { + System.out.println(Exceptions.stackTraceToString(e)); + } + } + return this; + } + + public ClassLookup searchMethodsByArguments(String base, final Class... arguments) { + final Method[] methods = Arrays.merge(Method[]::new, owner.getDeclaredMethods(), owner.getMethods()); + if (methods.length == 0) { + return this; + } + base += '-'; + int current = 0; + for (final Method method : methods) { + final Class[] args = method.getParameterTypes(); + if (args.length != arguments.length) { + continue; + } + try { + if (ReflectionTools.hasSameArguments(arguments, args)) { + this.methods.put(base + current, unreflect(method)); + current++; + } + } catch (IllegalAccessException | SecurityException e) { + } + } + return this; + } + + /* + * + */ + + public ClassLookup searchField(final Predicate predicate, final String name, final String fieldName, final Class type) { + return predicate.test(this) ? searchField(name, fieldName, type) : this; + } + + public ClassLookup searchField(final String name, final String fieldName) { + if (hasMethod(name)) { + return this; + } + Field field = null; + try { + field = owner.getDeclaredField(fieldName); + } catch (NoSuchFieldException | SecurityException e) { + } + if (field == null) { + try { + field = owner.getField(fieldName); + } catch (NoSuchFieldException | SecurityException e) { + } + } + if (field != null) { + storeField(name, field); + } + return this; + } + + public ClassLookup searchField(final String name, final String fieldName, final Class type) { + if (hasField(name)) { + return this; + } + VarHandle handle = null; + try { + handle = privateLookup.findVarHandle(owner, fieldName, type); + } catch (NoSuchFieldException | IllegalAccessException e) { + } + if (handle == null) { + try { + handle = privateLookup.findStaticVarHandle(owner, fieldName, type); + } catch (SecurityException | NoSuchFieldException | IllegalAccessException e) { + } + } + if (handle != null) { + fields.put(name, new SafeFieldHandle(handle)); + } + return this; + } + + /* + * + */ + + public boolean putField(final String name, final Field field) { + return putField(name, field, false); + } + + public boolean putField(final String name, final Field field, final boolean forceSafe) { + if (field == null || name == null || field.getDeclaringClass() != owner || fields.containsKey(name)) { + return false; + } + storeField(name, field, forceSafe); + return true; + } + + /* + * + */ + + private void storeField(final String name, final Field field) { + storeField(name, field, false); + } + + private void storeField(final String name, final Field field, final boolean forceSafe) { + if (forceSafe || !Modifier.isFinal(field.getModifiers())) { + try { + fields.put(name, new SafeFieldHandle(unreflect(field))); + return; + } catch (IllegalAccessException | SecurityException e) { + if (forceSafe) { + return; + } + } + } + if (!Modifier.isStatic(field.getModifiers())) { + fields.put(name, new UnsafeDeclaredFieldHandle(field)); + return; + } + fields.put(name, new UnsafeStaticFieldHandle(field)); + } + + private VarHandle unreflect(final Field field) throws IllegalAccessException, SecurityException { + if (Modifier.isStatic(field.getModifiers())) { + final boolean access = field.canAccess(null); + if (!access) { + field.setAccessible(true); + } + final VarHandle out = LOOKUP.unreflectVarHandle(field); + if (!access) { + field.setAccessible(false); + } + return out; + } + if (field.trySetAccessible()) { + final VarHandle out = LOOKUP.unreflectVarHandle(field); + field.setAccessible(false); + return out; + } + return LOOKUP.unreflectVarHandle(field); + } + + private MethodHandle unreflect(final Method method) throws IllegalAccessException, SecurityException { + if (Modifier.isStatic(method.getModifiers())) { + final boolean access = method.canAccess(null); + if (!access) { + method.setAccessible(true); + } + final MethodHandle out = LOOKUP.unreflect(method); + if (!access) { + method.setAccessible(false); + } + return out; + } + if (method.trySetAccessible()) { + final MethodHandle out = LOOKUP.unreflect(method); + method.setAccessible(false); + return out; + } + return LOOKUP.unreflect(method); + } + + private MethodHandle unreflect(final Constructor constructor) throws IllegalAccessException { + final boolean access = constructor.canAccess(null); + if (!access) { + constructor.setAccessible(true); + } + final MethodHandle out = LOOKUP.unreflectConstructor(constructor); + if (!access) { + constructor.setAccessible(false); + } + return out; + } + + /* + * + */ + + public static Object[] mergeBack(final Object[] array1, final Object... array2) { + final Object[] output = new Object[array1.length + array2.length]; + System.arraycopy(array2, 0, output, 0, array2.length); + System.arraycopy(array1, 0, output, array2.length, array1.length); + return output; + } + + /* + * + */ + + public static final ClassLookup of(final Class clazz) { + try { + return new ClassLookup(clazz); + } catch (final IllegalAccessException e) { + return null; + } + } + + public static final ClassLookup of(final String path) { + try { + return new ClassLookup(path); + } catch (final IllegalAccessException e) { + return null; + } + } + +} \ No newline at end of file diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/ClassLookupCache.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/ClassLookupCache.java new file mode 100644 index 0000000..dca1c2f --- /dev/null +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/ClassLookupCache.java @@ -0,0 +1,59 @@ +package net.sourcewriters.minecraft.vcompat.provider.lookup.handle; + +import java.util.HashMap; +import java.util.Map.Entry; +import java.util.Optional; + +public class ClassLookupCache { + + protected final HashMap cache = new HashMap<>(); + + public void clear() { + cache.values().forEach(ClassLookup::delete); + cache.clear(); + } + + public Optional get(final String name) { + return Optional.ofNullable(cache.get(name)); + } + + public boolean has(final String name) { + return cache.containsKey(name); + } + + public ClassLookup create(final String name, final String path) { + if (has(name)) { + return cache.get(name); + } + final ClassLookup reflect = create(path); + cache.put(name, reflect); + return reflect; + } + + public ClassLookup create(final String name, final Class clazz) { + if (has(name)) { + return cache.get(name); + } + final ClassLookup reflect = create(clazz); + cache.put(name, reflect); + return reflect; + } + + public void delete(final String name) { + cache.remove(name); + } + + @SuppressWarnings("unchecked") + public Entry[] entries() { + return cache.entrySet().toArray(Entry[]::new); + } + + private ClassLookup create(final Class clazz) { + return ClassLookup.of(clazz); + } + + private ClassLookup create(final String path) { + return ClassLookup.of(path); + } + +} \ No newline at end of file diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/FakeLookup.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/FakeLookup.java new file mode 100644 index 0000000..2e75086 --- /dev/null +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/FakeLookup.java @@ -0,0 +1,19 @@ +package net.sourcewriters.minecraft.vcompat.provider.lookup.handle; + +public class FakeLookup extends ClassLookup { + + public static final FakeLookup FAKE = build(); + + private FakeLookup() throws IllegalAccessException { + super((Class) null); + } + + private static final FakeLookup build() { + try { + return new FakeLookup(); + } catch (IllegalAccessException e) { + return null; + } + } + +} \ No newline at end of file diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/field/IFieldHandle.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/field/IFieldHandle.java new file mode 100644 index 0000000..e6391dc --- /dev/null +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/field/IFieldHandle.java @@ -0,0 +1,17 @@ +package net.sourcewriters.minecraft.vcompat.provider.lookup.handle.field; + +public interface IFieldHandle { + + Object getValue(); + + Object getValue(Object source); + + IFieldHandle setValue(Object value); + + IFieldHandle setValue(Object source, Object value); + + O getHandle(); + + boolean isUnsafe(); + +} diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/field/SafeFieldHandle.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/field/SafeFieldHandle.java new file mode 100644 index 0000000..7993890 --- /dev/null +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/field/SafeFieldHandle.java @@ -0,0 +1,45 @@ +package net.sourcewriters.minecraft.vcompat.provider.lookup.handle.field; + +import java.lang.invoke.VarHandle; + +public class SafeFieldHandle implements IFieldHandle { + + private final VarHandle handle; + + public SafeFieldHandle(VarHandle handle) { + this.handle = handle; + } + + @Override + public Object getValue() { + return handle.get(); + } + + @Override + public Object getValue(Object source) { + return handle.get(source); + } + + @Override + public IFieldHandle setValue(Object value) { + handle.set(value); + return this; + } + + @Override + public IFieldHandle setValue(Object source, Object value) { + handle.set(source, value); + return this; + } + + @Override + public VarHandle getHandle() { + return handle; + } + + @Override + public boolean isUnsafe() { + return false; + } + +} diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/field/UnsafeDeclaredFieldHandle.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/field/UnsafeDeclaredFieldHandle.java new file mode 100644 index 0000000..ce9bd1c --- /dev/null +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/field/UnsafeDeclaredFieldHandle.java @@ -0,0 +1,40 @@ +package net.sourcewriters.minecraft.vcompat.provider.lookup.handle.field; + +import java.lang.reflect.Field; + +public final class UnsafeDeclaredFieldHandle extends UnsafeFieldHandle { + + private final Field handle; + private final long offset; + + public UnsafeDeclaredFieldHandle(Field handle) { + this.handle = handle; + this.offset = UNSAFE.objectFieldOffset(handle); + } + + @Override + public Object getValue() { + return null; // Stay null because its not static + } + + @Override + public Object getValue(Object source) { + return getMemoryValue(source, offset); + } + + @Override + public IFieldHandle setValue(Object value) { + return this; // Do nothing because its not static + } + + @Override + public IFieldHandle setValue(Object source, Object value) { + return setMemoryValue(source, offset, value); + } + + @Override + public Field getHandle() { + return handle; + } + +} diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/field/UnsafeFieldHandle.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/field/UnsafeFieldHandle.java new file mode 100644 index 0000000..b0b3a7f --- /dev/null +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/field/UnsafeFieldHandle.java @@ -0,0 +1,35 @@ +package net.sourcewriters.minecraft.vcompat.provider.lookup.handle.field; + +import java.lang.reflect.Field; + +import sun.misc.Unsafe; + +public abstract class UnsafeFieldHandle implements IFieldHandle { + + protected static final Unsafe UNSAFE = getUnsafe(); + + protected final IFieldHandle setMemoryValue(Object base, long offset, Object value) { + UNSAFE.putObject(base, offset, value); + return this; + } + + protected final Object getMemoryValue(Object base, long offset) { + return UNSAFE.getObject(base, offset); + } + + @Override + public final boolean isUnsafe() { + return true; + } + + private static Unsafe getUnsafe() { + try { + Field field = Unsafe.class.getDeclaredField("theUnsafe"); + field.setAccessible(true); + return (Unsafe) field.get(null); + } catch (Exception ignore) { + return null; + } + } + +} diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/field/UnsafeStaticFieldHandle.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/field/UnsafeStaticFieldHandle.java new file mode 100644 index 0000000..df013ba --- /dev/null +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/field/UnsafeStaticFieldHandle.java @@ -0,0 +1,42 @@ +package net.sourcewriters.minecraft.vcompat.provider.lookup.handle.field; + +import java.lang.reflect.Field; + +public final class UnsafeStaticFieldHandle extends UnsafeFieldHandle { + + private final Field handle; + private final Object base; + private final long offset; + + public UnsafeStaticFieldHandle(Field handle) { + this.handle = handle; + this.base = UNSAFE.staticFieldBase(handle); + this.offset = UNSAFE.staticFieldOffset(handle); + } + + @Override + public Object getValue() { + return getMemoryValue(base, offset); + } + + @Override + public Object getValue(Object source) { + return null; // Stay null because its static + } + + @Override + public IFieldHandle setValue(Object value) { + return setMemoryValue(base, offset, value); + } + + @Override + public IFieldHandle setValue(Object source, Object value) { + return this; // Do nothing because its static + } + + @Override + public Field getHandle() { + return handle; + } + +} diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/lookup/provider/GeneralReflections.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/lookup/provider/GeneralReflections.java new file mode 100644 index 0000000..fcfa429 --- /dev/null +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/lookup/provider/GeneralReflections.java @@ -0,0 +1,34 @@ +package net.sourcewriters.minecraft.vcompat.provider.lookup.provider; + +import com.mojang.authlib.GameProfile; + +import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookupProvider; +import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookups; + +public class GeneralReflections extends ClassLookups { + + public static GeneralReflections INSTANCE = new GeneralReflections(); + + private GeneralReflections() {} + + @Override + public void setup(ClassLookupProvider provider) { + + // + // + // Needed classes to create Reflects + // + + // + // + // Create Reflects + // + + // + // Mojang + + provider.createLookup("mjGameProfile", GameProfile.class).searchField("name", "name"); + + } + +} \ No newline at end of file diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/tools/BlockTools.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/tools/BlockTools.java similarity index 76% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/tools/BlockTools.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/tools/BlockTools.java index c3cb1a6..b6a28c5 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/tools/BlockTools.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/tools/BlockTools.java @@ -1,4 +1,4 @@ -package net.sourcewriters.minecraft.vcompat.reflection.tools; +package net.sourcewriters.minecraft.vcompat.provider.tools; import org.bukkit.block.Block; diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/tools/ServerTools.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/tools/ServerTools.java similarity index 56% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/tools/ServerTools.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/tools/ServerTools.java index 30d71a6..a28d521 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/tools/ServerTools.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/tools/ServerTools.java @@ -1,6 +1,6 @@ -package net.sourcewriters.minecraft.vcompat.reflection.tools; +package net.sourcewriters.minecraft.vcompat.provider.tools; -import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; +import net.sourcewriters.minecraft.vcompat.provider.wrapper.ConsoleReaderWrapper; public abstract class ServerTools { diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/tools/SkinTools.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/tools/SkinTools.java similarity index 83% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/tools/SkinTools.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/tools/SkinTools.java index 6a8e2b7..7466930 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/tools/SkinTools.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/tools/SkinTools.java @@ -1,4 +1,4 @@ -package net.sourcewriters.minecraft.vcompat.reflection.tools; +package net.sourcewriters.minecraft.vcompat.provider.tools; import org.bukkit.entity.Player; @@ -6,7 +6,7 @@ import com.mojang.authlib.properties.Property; import com.mojang.authlib.properties.PropertyMap; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; +import net.sourcewriters.minecraft.vcompat.util.minecraft.Skin; public abstract class SkinTools { diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/utils/NmsBoundingBox.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/utils/NmsBoundingBox.java similarity index 99% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/utils/NmsBoundingBox.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/utils/NmsBoundingBox.java index fb5e48b..1b79b32 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/utils/NmsBoundingBox.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/utils/NmsBoundingBox.java @@ -1,4 +1,4 @@ -package net.sourcewriters.minecraft.vcompat.reflection.utils; +package net.sourcewriters.minecraft.vcompat.provider.utils; import static org.bukkit.util.NumberConversions.checkFinite; @@ -10,7 +10,7 @@ import org.bukkit.util.RayTraceResult; import org.bukkit.util.Vector; -import net.sourcewriters.minecraft.vcompat.utils.validation.ValidationHelper; +import net.sourcewriters.minecraft.vcompat.util.validation.ValidationHelper; public class NmsBoundingBox { diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/utils/Tracker.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/utils/Tracker.java similarity index 95% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/utils/Tracker.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/utils/Tracker.java index f2f41aa..4c62571 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/utils/Tracker.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/utils/Tracker.java @@ -1,4 +1,4 @@ -package net.sourcewriters.minecraft.vcompat.reflection.utils; +package net.sourcewriters.minecraft.vcompat.provider.utils; import java.util.Optional; diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/wrapper/ConsoleReaderWrapper.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/wrapper/ConsoleReaderWrapper.java similarity index 85% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/wrapper/ConsoleReaderWrapper.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/wrapper/ConsoleReaderWrapper.java index 01402ca..387be25 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/wrapper/ConsoleReaderWrapper.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/wrapper/ConsoleReaderWrapper.java @@ -1,4 +1,4 @@ -package net.sourcewriters.minecraft.vcompat.reflection.wrapper; +package net.sourcewriters.minecraft.vcompat.provider.wrapper; import java.io.IOException; import java.io.Writer; diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/PacketHandler.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/PacketHandler.java deleted file mode 100644 index a8ce795..0000000 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/PacketHandler.java +++ /dev/null @@ -1,18 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection; - -import com.syntaxphoenix.syntaxapi.command.ArgumentMap; -import com.syntaxphoenix.syntaxapi.utils.key.IKey; - -import net.sourcewriters.minecraft.vcompat.reflection.packet.NmsPacket; - -public abstract class PacketHandler extends VersionHandler { - - protected PacketHandler(V versionControl) { - super(versionControl); - } - - public NmsPacket buildPacket(IKey key, ArgumentMap data) { - return null; - } - -} \ No newline at end of file diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/WrappedContext.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/WrappedContext.java deleted file mode 100644 index 7077627..0000000 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/WrappedContext.java +++ /dev/null @@ -1,11 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.data; - -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; - -public abstract class WrappedContext implements DataAdapterContext { - - public abstract H getHandle(); - - public abstract WrappedContainer newContainer(); - -} \ No newline at end of file diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/type/SkinDataType.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/type/SkinDataType.java deleted file mode 100644 index 819f41f..0000000 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/type/SkinDataType.java +++ /dev/null @@ -1,49 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.data.type; - -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.data.IDataContainer; -import com.syntaxphoenix.syntaxapi.data.PrimitiveDataType; - -import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; - -public final class SkinDataType implements DataType { - - public static final DataType INSTANCE = new SkinDataType(); - public static final WrapType WRAPPED_INSTANCE = VersionCompatProvider.get().getControl().getBukkitConversion().wrap(INSTANCE); - - private SkinDataType() {} - - @Override - public Class getComplex() { - return Skin.class; - } - - @Override - public Class getPrimitive() { - return IDataContainer.class; - } - - @Override - public IDataContainer toPrimitive(DataAdapterContext context, Skin complex) { - IDataContainer container = context.newDataContainer(); - container.set("name", complex.getName(), PrimitiveDataType.STRING); - container.set("value", complex.getValue(), PrimitiveDataType.STRING); - container.set("signature", complex.getSignature(), PrimitiveDataType.STRING); - return container; - } - - @Override - public Skin fromPrimitive(DataAdapterContext context, IDataContainer container) { - String name = container.get("name", PrimitiveDataType.STRING); - String value = container.get("value", PrimitiveDataType.STRING); - String signature = container.get("signature", PrimitiveDataType.STRING); - if(name == null || value == null || signature == null) { - return null; - } - return new Skin(name, value, signature, false); - } - -} \ No newline at end of file diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleSyntaxContext.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleSyntaxContext.java deleted file mode 100644 index 3a57af7..0000000 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleSyntaxContext.java +++ /dev/null @@ -1,32 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.data.wrap; - -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.IDataContainer; - -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; - -public class SimpleSyntaxContext extends WrappedContext { - - private final DataAdapterContext context; - - public SimpleSyntaxContext(DataAdapterContext context) { - this.context = context; - } - - @Override - public DataAdapterContext getHandle() { - return context; - } - - @Override - public IDataContainer newDataContainer() { - return context.newDataContainer(); - } - - @Override - public WrappedContainer newContainer() { - return new SimpleSyntaxContainer<>(context.newDataContainer()); - } - -} \ No newline at end of file diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsEntityType.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsEntityType.java deleted file mode 100644 index ef8849e..0000000 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsEntityType.java +++ /dev/null @@ -1,7 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.entity; - -public enum NmsEntityType { - - ARMOR_STAND; - -} \ No newline at end of file diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/packet/NmsPacket.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/packet/NmsPacket.java deleted file mode 100644 index e5d020e..0000000 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/packet/NmsPacket.java +++ /dev/null @@ -1,7 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.packet; - -import com.syntaxphoenix.syntaxapi.utils.key.IKeyed; - -public interface NmsPacket extends IKeyed { - -} \ No newline at end of file diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/reflect/FakeReflect.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/reflect/FakeReflect.java deleted file mode 100644 index 22bfdcf..0000000 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/reflect/FakeReflect.java +++ /dev/null @@ -1,240 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.reflect; - -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.function.Predicate; - -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; - -public class FakeReflect extends Reflect { - - public static final FakeReflect FAKE = new FakeReflect(); - - @SuppressWarnings("rawtypes") - private final Collection collection = Collections.unmodifiableCollection(Arrays.asList()); - - private FakeReflect() { - super((Class) null); - } - - /* - * - */ - - @Override - public Class getOwner() { - return null; - } - - /* - * - */ - - @Override - public void delete() {} - - /* - * - */ - - @SuppressWarnings("unchecked") - @Override - public Collection> getConstructors() { - return collection; - } - - @SuppressWarnings("unchecked") - @Override - public Collection getMethods() { - return collection; - } - - @SuppressWarnings("unchecked") - @Override - public Collection getFields() { - return collection; - } - - /* - * - */ - - @Override - public boolean putConstructor(String name, Constructor constructor) { - return true; - } - - @Override - public boolean putMethod(String name, Method method) { - return true; - } - - @Override - public boolean putField(String name, Field field) { - return true; - } - - /* - * - */ - - @Override - public boolean containsMethod(String name) { - return false; - } - - @Override - public boolean containsField(String name) { - return false; - } - - /* - * - */ - - @Override - public Object init() { - return null; - } - - @Override - public Object init(String name, Object... args) { - return null; - } - - /* - * - */ - - @Override - public FakeReflect execute(String name, Object... args) { - return this; - } - - @Override - public FakeReflect execute(Object source, String name, Object... args) { - return this; - } - - @Override - public Object run(String name, Object... args) { - return null; - } - - @Override - public Object run(Object source, String name, Object... args) { - return null; - } - - /* - * - */ - - @Override - public Object getFieldValue(String name) { - return null; - } - - @Override - public Object getFieldValue(String name, Object source) { - return null; - } - - @Override - public void setFieldValue(String name, Object value) {} - - @Override - public void setFieldValue(Object source, String name, Object value) {} - - /* - * - */ - - @Override - public Constructor getConstructor(String name) { - return null; - } - - @Override - public Method getMethod(String name) { - return null; - } - - @Override - public Field getField(String name) { - return null; - } - - /* - * - */ - - @Override - public FakeReflect searchConstructor(Predicate predicate, String name, Class... args) { - return this; - } - - @Override - public FakeReflect searchConstructor(String name, Class... args) { - return this; - } - - @Override - public FakeReflect searchConstructorsByArguments(String base, Class... arguments) { - return this; - } - - /* - * - */ - - @Override - public FakeReflect searchMethod(Predicate predicate, String name, String methodName, Class... arguments) { - return this; - } - - @Override - public FakeReflect searchMethod(String name, String methodName, Class... arguments) { - return this; - } - - @Override - public FakeReflect searchMethodsByArguments(String base, Class... arguments) { - return this; - } - - /* - * - */ - - @Override - public FakeReflect searchField(Predicate predicate, String name, String fieldName) { - return this; - } - - @Override - public FakeReflect searchField(String name, String fieldName) { - return this; - } - - @Override - public FakeReflect searchFields(String name, String fieldName) { - return this; - } - - @Override - public FakeReflect searchField(String name, Class type) { - return this; - } - - @Override - public FakeReflect searchFields(String name, Class type) { - return this; - } - -} \ No newline at end of file diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/reflect/ReflectionProvider.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/reflect/ReflectionProvider.java deleted file mode 100644 index a62d6ab..0000000 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/reflect/ReflectionProvider.java +++ /dev/null @@ -1,127 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.reflect; - -import static net.sourcewriters.minecraft.vcompat.reflection.reflect.FakeReflect.FAKE; - -import java.util.Optional; -import java.util.function.Consumer; - -import com.syntaxphoenix.syntaxapi.reflection.ClassCache; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; -import com.syntaxphoenix.syntaxapi.reflection.ReflectCache; - -import net.sourcewriters.minecraft.vcompat.version.ServerVersion; -import net.sourcewriters.minecraft.vcompat.version.Versions; - -public class ReflectionProvider { - - public static final String CB_PATH_FORMAT = "org.bukkit.craftbukkit.%s.%s"; - public static final String NMS_PATH_FORMAT = "net.minecraft.server.%s.%s"; - - public static final ReflectionProvider DEFAULT = new ReflectionProvider(provider -> Reflections.globalSetup(provider)); - - protected final ReflectCache cache; - - protected final String cbPath; - protected final String nmsPath; - - protected final ServerVersion version; - - private boolean skip = false; - - public ReflectionProvider() { - this((Consumer) null); - } - - public ReflectionProvider(Consumer setup) { - this(new ReflectCache(), setup); - } - - public ReflectionProvider(ReflectCache cache) { - this(cache, null); - } - - public ReflectionProvider(ReflectCache cache, Consumer setup) { - this.cache = cache; - this.version = Versions.getServer(); - this.cbPath = String.format(CB_PATH_FORMAT, Versions.getServerAsString(), "%s"); - this.nmsPath = String.format(NMS_PATH_FORMAT, Versions.getServerAsString(), "%s"); - if (setup != null) { - setup.accept(this); - } - } - - public ServerVersion getVersion() { - return version; - } - - /* - * Skip - */ - - public ReflectionProvider require(boolean skip) { - this.skip = !skip; - return this; - } - - public ReflectionProvider skip(boolean skip) { - this.skip = skip; - return this; - } - - public boolean skip() { - return skip; - } - - /* - * Reflection - */ - - public ReflectCache getReflection() { - return cache; - } - - public String getNmsPath() { - return nmsPath; - } - - public String getCbPath() { - return cbPath; - } - - public Reflect createNMSReflect(String name, String path) { - return skip ? FAKE : cache.create(name, getNMSClass(path)); - } - - public Reflect createCBReflect(String name, String path) { - return skip ? FAKE : cache.create(name, getCBClass(path)); - } - - public Reflect createReflect(String name, String path) { - return skip ? FAKE : cache.create(name, getClass(path)); - } - - public Reflect createReflect(String name, Class clazz) { - return skip ? FAKE : cache.create(name, clazz); - } - - public Optional getOptionalReflect(String name) { - return cache.get(name); - } - - public Reflect getReflect(String name) { - return cache.get(name).orElse(null); - } - - public Class getNMSClass(String path) { - return getClass(String.format(nmsPath, path)); - } - - public Class getCBClass(String path) { - return getClass(String.format(cbPath, path)); - } - - public Class getClass(String path) { - return ClassCache.getClass(path); - } - -} \ No newline at end of file diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/reflect/provider/GeneralReflections.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/reflect/provider/GeneralReflections.java deleted file mode 100644 index 828aad8..0000000 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/reflect/provider/GeneralReflections.java +++ /dev/null @@ -1,34 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.reflection.reflect.provider; - -import com.mojang.authlib.GameProfile; - -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.Reflections; - -public class GeneralReflections extends Reflections { - - public static GeneralReflections INSTANCE = new GeneralReflections(); - - private GeneralReflections() {} - - @Override - public void setup(ReflectionProvider provider) { - - // - // - // Needed classes to create Reflects - // - - // - // - // Create Reflects - // - - // - // Mojang - - provider.createReflect("mjGameProfile", GameProfile.class).searchField("name", "name"); - - } - -} \ No newline at end of file diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/skin/DefaultSkinStore.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/skin/DefaultSkinStore.java index 87f6d11..ae16dc8 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/skin/DefaultSkinStore.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/skin/DefaultSkinStore.java @@ -3,7 +3,7 @@ import java.util.ArrayList; import java.util.Optional; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; +import net.sourcewriters.minecraft.vcompat.util.minecraft.Skin; public class DefaultSkinStore extends SkinStore { diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/skin/Mojang.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/skin/Mojang.java index 8e2c4f5..338d2e3 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/skin/Mojang.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/skin/Mojang.java @@ -14,18 +14,18 @@ import com.syntaxphoenix.syntaxapi.logging.ILogger; import com.syntaxphoenix.syntaxapi.logging.LogTypeId; -import com.syntaxphoenix.syntaxapi.net.http.RequestType; -import com.syntaxphoenix.syntaxapi.net.http.ResponseCode; import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; -import net.sourcewriters.minecraft.vcompat.reflection.PlayerProvider; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.utils.java.net.EasyRequest; -import net.sourcewriters.minecraft.vcompat.utils.java.net.EasyResponse; -import net.sourcewriters.minecraft.vcompat.utils.java.net.content.EasyUrlEncodedContent; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.MojangProfileServer; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.SkinModel; +import net.sourcewriters.minecraft.vcompat.provider.PlayerProvider; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.util.java.net.EasyRequest; +import net.sourcewriters.minecraft.vcompat.util.java.net.EasyRequestType; +import net.sourcewriters.minecraft.vcompat.util.java.net.EasyResponse; +import net.sourcewriters.minecraft.vcompat.util.java.net.EasyResponseCode; +import net.sourcewriters.minecraft.vcompat.util.java.net.content.EasyUrlEncodedContent; +import net.sourcewriters.minecraft.vcompat.util.minecraft.MojangProfileServer; +import net.sourcewriters.minecraft.vcompat.util.minecraft.Skin; +import net.sourcewriters.minecraft.vcompat.util.minecraft.SkinModel; public class Mojang { @@ -170,11 +170,11 @@ public Skin getSkinFrom(URL url, SkinModel model, int timeout) { logger.log(LogTypeId.ERROR, "Can't connect to url!"); return null; } - EasyRequest request = new EasyRequest(RequestType.POST); + EasyRequest request = new EasyRequest(EasyRequestType.POST); request.header("Authorization", "Bearer " + profile.getAuthToken()); request.data("url", url.toString()).data("model", model.toString()); EasyResponse response = request.run(String.format(URL_SKIN_UPLOAD, profile.getUniqueId()), EasyUrlEncodedContent.URL_ENCODED); - if (response.getCode() != ResponseCode.NO_CONTENT) { + if (response.getCode() != EasyResponseCode.NO_CONTENT) { if (debug) { logger.log(LogTypeId.DEBUG, "Code: " + response.getCode() + " / Length: " + response.getData().length); logger.log(LogTypeId.DEBUG, response.getDataAsJson().toPrettyString().split("\n")); @@ -234,11 +234,11 @@ public Skin getSkinFrom(String name, URL url, SkinModel model, int timeout) { logger.log(LogTypeId.ERROR, "Can't connect to url!"); return null; } - EasyRequest request = new EasyRequest(RequestType.POST); + EasyRequest request = new EasyRequest(EasyRequestType.POST); request.header("Authorization", "Bearer " + profile.getAuthToken()); request.data("url", url.toString()).data("model", model.toString()); EasyResponse response = request.run(String.format(URL_SKIN_UPLOAD, profile.getUniqueId()), EasyUrlEncodedContent.URL_ENCODED); - if (response.getCode() != ResponseCode.NO_CONTENT) { + if (response.getCode() != EasyResponseCode.NO_CONTENT) { if (debug) { logger.log(LogTypeId.DEBUG, "Code: " + response.getCode() + " / Length: " + response.getData().length); logger.log(LogTypeId.DEBUG, response.getDataAsJson().toPrettyString().split("\n")); diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/skin/PersistentSkinStore.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/skin/PersistentSkinStore.java index ab732ec..b1a8294 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/skin/PersistentSkinStore.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/skin/PersistentSkinStore.java @@ -5,9 +5,9 @@ import com.syntaxphoenix.syntaxapi.utils.key.IKey; -import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.PersistentContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.type.SkinDataType; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; +import net.sourcewriters.minecraft.vcompat.provider.data.persistence.PersistentContainer; +import net.sourcewriters.minecraft.vcompat.provider.data.type.SkinDataType; +import net.sourcewriters.minecraft.vcompat.util.minecraft.Skin; public class PersistentSkinStore extends SkinStore { diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/skin/Profile.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/skin/Profile.java index 2723a02..07cc99f 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/skin/Profile.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/skin/Profile.java @@ -7,9 +7,9 @@ import com.syntaxphoenix.syntaxapi.json.JsonObject; import com.syntaxphoenix.syntaxapi.json.JsonValue; import com.syntaxphoenix.syntaxapi.json.ValueType; -import com.syntaxphoenix.syntaxapi.net.http.RequestType; -import net.sourcewriters.minecraft.vcompat.utils.java.net.EasyRequest; +import net.sourcewriters.minecraft.vcompat.util.java.net.EasyRequest; +import net.sourcewriters.minecraft.vcompat.util.java.net.EasyRequestType; public class Profile { @@ -77,7 +77,7 @@ public boolean validate() { return false; } try { - EasyRequest request = new EasyRequest(RequestType.POST).data("accessToken", authToken).data("clientToken", + EasyRequest request = new EasyRequest(EasyRequestType.POST).data("accessToken", authToken).data("clientToken", provider.getClientIdentifier().toString()); return request.run(String.format(AUTH_SERVER, "validate")).getCode() == 204; } catch (IOException ignore) { @@ -90,7 +90,7 @@ public Profile refresh() { return this; } try { - EasyRequest request = new EasyRequest(RequestType.POST).data("accessToken", authToken).data("clientToken", + EasyRequest request = new EasyRequest(EasyRequestType.POST).data("accessToken", authToken).data("clientToken", provider.getClientIdentifier().toString()); JsonValue responseRaw = request.run(String.format(AUTH_SERVER, "refresh")).getDataAsJson(); if (!responseRaw.hasType(ValueType.OBJECT)) { @@ -110,7 +110,7 @@ public Profile refresh() { public Profile authenticate() { try { - EasyRequest request = new EasyRequest(RequestType.POST); + EasyRequest request = new EasyRequest(EasyRequestType.POST); JsonObject object = new JsonObject(); JsonObject agent = new JsonObject(); agent.set("name", "Minecraft"); diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/skin/SkinStore.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/skin/SkinStore.java index 72c6681..baafbce 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/skin/SkinStore.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/skin/SkinStore.java @@ -7,7 +7,7 @@ import com.syntaxphoenix.syntaxapi.nbt.NbtType; import com.syntaxphoenix.syntaxapi.nbt.utils.NbtStorage; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; +import net.sourcewriters.minecraft.vcompat.util.minecraft.Skin; public abstract class SkinStore implements NbtStorage> { diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/bukkit/BukkitColor.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/bukkit/BukkitColor.java similarity index 95% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/bukkit/BukkitColor.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/bukkit/BukkitColor.java index 0294f49..f9b9d92 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/bukkit/BukkitColor.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/bukkit/BukkitColor.java @@ -1,4 +1,4 @@ -package net.sourcewriters.minecraft.vcompat.utils.bukkit; +package net.sourcewriters.minecraft.vcompat.util.bukkit; import java.util.regex.Pattern; diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/bukkit/Players.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/bukkit/Players.java similarity index 97% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/bukkit/Players.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/bukkit/Players.java index 7f3077e..d2d1dec 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/bukkit/Players.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/bukkit/Players.java @@ -1,4 +1,4 @@ -package net.sourcewriters.minecraft.vcompat.utils.bukkit; +package net.sourcewriters.minecraft.vcompat.util.bukkit; import java.util.ArrayList; import java.util.Arrays; diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/bukkit/unsafe/KeyCache.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/bukkit/unsafe/KeyCache.java similarity index 95% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/bukkit/unsafe/KeyCache.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/bukkit/unsafe/KeyCache.java index ba655b9..aea98b2 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/bukkit/unsafe/KeyCache.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/bukkit/unsafe/KeyCache.java @@ -1,4 +1,4 @@ -package net.sourcewriters.minecraft.vcompat.utils.bukkit.unsafe; +package net.sourcewriters.minecraft.vcompat.util.bukkit.unsafe; import java.util.Collections; import java.util.HashMap; diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/constants/DefaultConstants.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/constants/DefaultConstants.java similarity index 79% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/constants/DefaultConstants.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/constants/DefaultConstants.java index 3482b0d..ef273ae 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/constants/DefaultConstants.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/constants/DefaultConstants.java @@ -1,4 +1,4 @@ -package net.sourcewriters.minecraft.vcompat.utils.constants; +package net.sourcewriters.minecraft.vcompat.util.constants; import com.syntaxphoenix.syntaxapi.utils.key.Namespace; diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/constants/MinecraftConstants.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/constants/MinecraftConstants.java similarity index 74% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/constants/MinecraftConstants.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/constants/MinecraftConstants.java index 8b11a60..edbd527 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/constants/MinecraftConstants.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/constants/MinecraftConstants.java @@ -1,4 +1,4 @@ -package net.sourcewriters.minecraft.vcompat.utils.constants; +package net.sourcewriters.minecraft.vcompat.util.constants; public class MinecraftConstants { diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/function/TriPredicate.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/java/function/TriPredicate.java similarity index 98% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/function/TriPredicate.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/java/function/TriPredicate.java index 3330406..f2c34e0 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/function/TriPredicate.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/java/function/TriPredicate.java @@ -1,4 +1,4 @@ -package net.sourcewriters.minecraft.vcompat.utils.java.function; +package net.sourcewriters.minecraft.vcompat.util.java.function; import java.util.Objects; diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/EasyContentRegistry.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/java/net/EasyContentRegistry.java similarity index 77% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/EasyContentRegistry.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/java/net/EasyContentRegistry.java index a031195..ead169a 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/EasyContentRegistry.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/java/net/EasyContentRegistry.java @@ -1,9 +1,9 @@ -package net.sourcewriters.minecraft.vcompat.utils.java.net; +package net.sourcewriters.minecraft.vcompat.util.java.net; import java.util.concurrent.ConcurrentHashMap; -import net.sourcewriters.minecraft.vcompat.utils.java.net.content.EasyJsonContent; -import net.sourcewriters.minecraft.vcompat.utils.java.net.content.EasyUrlEncodedContent; +import net.sourcewriters.minecraft.vcompat.util.java.net.content.EasyJsonContent; +import net.sourcewriters.minecraft.vcompat.util.java.net.content.EasyUrlEncodedContent; public final class EasyContentRegistry { diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/EasyRequest.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/java/net/EasyRequest.java similarity index 94% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/EasyRequest.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/java/net/EasyRequest.java index dd7bf25..e75a75a 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/EasyRequest.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/java/net/EasyRequest.java @@ -1,4 +1,4 @@ -package net.sourcewriters.minecraft.vcompat.utils.java.net; +package net.sourcewriters.minecraft.vcompat.util.java.net; import java.io.IOException; import java.io.InputStream; @@ -17,17 +17,16 @@ import com.syntaxphoenix.syntaxapi.json.JsonValue; import com.syntaxphoenix.syntaxapi.json.ValueType; import com.syntaxphoenix.syntaxapi.json.value.JsonNull; -import com.syntaxphoenix.syntaxapi.net.http.RequestType; import com.syntaxphoenix.syntaxapi.utils.java.Streams; -import net.sourcewriters.minecraft.vcompat.utils.java.net.content.EasyJsonContent; +import net.sourcewriters.minecraft.vcompat.util.java.net.content.EasyJsonContent; public class EasyRequest { private static final String[] EMPTY = new String[0]; private final HashMap> headers = new HashMap<>(); - private final RequestType requestType; + private final EasyRequestType requestType; private JsonValue data; @@ -36,11 +35,11 @@ public class EasyRequest { private String agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36"; - public EasyRequest(RequestType requestType) { - this.requestType = Objects.requireNonNull(requestType, "RequestType is needed to cast an Http request"); + public EasyRequest(EasyRequestType requestType) { + this.requestType = Objects.requireNonNull(requestType, "EasyRequestType is needed to cast an Http request"); } - public RequestType getRequestType() { + public EasyRequestType getRequestType() { return requestType; } diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/java/net/EasyRequestType.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/java/net/EasyRequestType.java new file mode 100644 index 0000000..5ff6ab7 --- /dev/null +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/java/net/EasyRequestType.java @@ -0,0 +1,40 @@ +package net.sourcewriters.minecraft.vcompat.util.java.net; + +public enum EasyRequestType { + + GET, + HEAD, + PUT(true), + POST(true), + DELETE(true), + OPTIONS(true), + PATCH(true), + CONNECT, + TRACE, + NONE; + + private final boolean output; + + private EasyRequestType() { + output = false; + } + + private EasyRequestType(boolean state) { + output = state; + } + + public boolean hasOutput() { + return output; + } + + public static EasyRequestType fromString(String value) { + value = value.toUpperCase(); + for (EasyRequestType type : values()) { + if (type.name().equals(value)) { + return type; + } + } + return NONE; + } + +} \ No newline at end of file diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/EasyResponse.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/java/net/EasyResponse.java similarity index 93% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/EasyResponse.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/java/net/EasyResponse.java index ced984c..de1e14c 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/EasyResponse.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/java/net/EasyResponse.java @@ -1,4 +1,4 @@ -package net.sourcewriters.minecraft.vcompat.utils.java.net; +package net.sourcewriters.minecraft.vcompat.util.java.net; import java.util.List; import java.util.Map; @@ -10,7 +10,7 @@ import com.syntaxphoenix.syntaxapi.json.ValueType; import com.syntaxphoenix.syntaxapi.json.value.JsonNull; -import net.sourcewriters.minecraft.vcompat.utils.java.net.tools.HeaderParser; +import net.sourcewriters.minecraft.vcompat.util.java.net.tools.HeaderParser; public class EasyResponse { diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/java/net/EasyResponseCode.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/java/net/EasyResponseCode.java new file mode 100644 index 0000000..aeae3c2 --- /dev/null +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/java/net/EasyResponseCode.java @@ -0,0 +1,126 @@ +package net.sourcewriters.minecraft.vcompat.util.java.net; + +import java.lang.reflect.Field; + +import com.syntaxphoenix.syntaxapi.utils.java.Strings; + +import net.sourcewriters.minecraft.vcompat.util.java.tools.ReflectionTools; + +public final class EasyResponseCode { + + private EasyResponseCode() { + throw new UnsupportedOperationException("Constant class"); + } + + /** + * Informations + */ + + public static final int CONTINUE = 100; + public static final int SWITCHING_PROTOCOLS = 101; + public static final int PROCESSING = 102; + + /** + * Succeeded Operations + */ + + public static final int OK = 200; + public static final int CREATED = 201; + public static final int ACCEPTED = 202; + public static final int NON_AUTHORITATIVE_INFORMATION = 203; + public static final int NO_CONTENT = 204; + public static final int RESET_CONTENT = 205; + public static final int PARTIAL_CONTENT = 206; + public static final int MULTI_STATUS = 207; + public static final int ALREADY_REPORTED = 208; + public static final int IM_USED = 226; + + /** + * Redirects + */ + + public static final int MULTIPLE_CHOICES = 300; + public static final int MOVED_PERMANENTLY = 301; + public static final int FOUND_MOVE_TEMPORARILLY = 302; + public static final int SEE_OTHER = 303; + public static final int NOT_MODIFIED = 304; + public static final int USE_PROXY = 305; + public static final int TEMPORARY_REDIRECT = 307; + public static final int PERMANENT_REDIRECT = 308; + + /** + * Client Errors + */ + + public static final int BAD_REQUEST = 400; + public static final int UNAUTHORIZED = 401; + public static final int PAYMENT_REQUIRED = 402; + public static final int FORBIDDEN = 403; + public static final int NOT_FOUND = 404; + public static final int METHOD_NOT_ALLOWED = 405; + public static final int NOT_ACCEPTABLE = 406; + public static final int PROXY_AUTHENTICATION_REQUIRED = 407; + public static final int REQUEST_TIMOEOUT = 408; + public static final int CONFLICT = 409; + public static final int GONE = 410; + public static final int LENGTH_REQUIRED = 411; + public static final int PRECONDITION_FAILED = 412; + public static final int REQUEST_ENTITY_TOO_LARGE = 413; + public static final int URI_TOO_LONG = 414; + public static final int UNSUPPORTED_MEDIA_TYPE = 415; + public static final int REQUESTED_RANGE_NOT_SATISFIABLE = 416; + public static final int EXPECTATION_FAILED = 417; + public static final int POLICY_NOT_FULFILLED = 420; + public static final int MISDIRECTED_REQUEST = 421; + public static final int UNPROCESSABLE_ENTITY = 422; + public static final int LOCKED = 423; + public static final int FAILED_DEPENDENCY = 424; + public static final int UPGRADE_REQUIRED = 426; + public static final int PRECONDITION_REQUIRED = 428; + public static final int TOO_MANY_REQUESTS = 429; + public static final int REQUEST_HEADER_FIELDS_TOO_LARGE = 431; + public static final int UNAVAILABLE_FOR_LEGAL_REASONS = 451; + + /** + * Server Errors + */ + + public static final int INTERNAL_SERVER_ERROR = 500; + public static final int NOT_IMPLEMENTED = 501; + public static final int BAD_GATEWAY = 502; + public static final int SERVICE_UNAVAILABLE = 503; + public static final int GATEWAY_TIMEOUT = 504; + public static final int HTTP_VERSION_NOT_SUPPORTED = 505; + public static final int VARIANT_ALSO_NEGOTIATES = 506; + public static final int INSUFFICIENT_STORAGE = 507; + public static final int LOOP_DETECTED = 508; + public static final int BANDWITH_LIMIT_EXCEEDED = 509; + public static final int NOT_EXTENDED = 510; + public static final int NETWORK_AUTHENTICATION_REQUIRED = 511; + + /* + * + */ + + public static final String getName(int code) { + Field[] fields = EasyResponseCode.class.getFields(); + for (Field field : fields) { + if (((int) ReflectionTools.getValue(field)) == code) { + return format(field.getName()); + } + } + return ""; + } + + private static final String format(String name) { + if (!name.contains("_")) { + return Strings.firstLetterToUpperCase(name); + } + String[] parts = name.split("_"); + for (int index = 0; index < parts.length; index++) { + parts[index] = Strings.firstLetterToUpperCase(parts[index]); + } + return String.join(" ", parts); + } + +} diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/IEasyContent.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/java/net/IEasyContent.java similarity index 71% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/IEasyContent.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/java/net/IEasyContent.java index 52889c9..fbe0777 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/IEasyContent.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/java/net/IEasyContent.java @@ -1,4 +1,4 @@ -package net.sourcewriters.minecraft.vcompat.utils.java.net; +package net.sourcewriters.minecraft.vcompat.util.java.net; import java.net.URL; @@ -20,6 +20,8 @@ default String type() { JsonValue deserialize(byte[] data); - default void modify(URL url, JsonValue value) {} + default URL modify(URL url, JsonValue value) { + return url; + } } diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/IEasyTextContent.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/java/net/IEasyTextContent.java similarity index 91% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/IEasyTextContent.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/java/net/IEasyTextContent.java index 9e4674e..cd5c962 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/IEasyTextContent.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/java/net/IEasyTextContent.java @@ -1,4 +1,4 @@ -package net.sourcewriters.minecraft.vcompat.utils.java.net; +package net.sourcewriters.minecraft.vcompat.util.java.net; import java.nio.charset.StandardCharsets; diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/content/EasyJsonContent.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/java/net/content/EasyJsonContent.java similarity index 87% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/content/EasyJsonContent.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/java/net/content/EasyJsonContent.java index bbbc1d2..6617858 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/content/EasyJsonContent.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/java/net/content/EasyJsonContent.java @@ -1,4 +1,4 @@ -package net.sourcewriters.minecraft.vcompat.utils.java.net.content; +package net.sourcewriters.minecraft.vcompat.util.java.net.content; import java.io.IOException; @@ -7,7 +7,7 @@ import com.syntaxphoenix.syntaxapi.json.io.JsonSyntaxException; import com.syntaxphoenix.syntaxapi.json.value.JsonNull; -import net.sourcewriters.minecraft.vcompat.utils.java.net.IEasyTextContent; +import net.sourcewriters.minecraft.vcompat.util.java.net.IEasyTextContent; public class EasyJsonContent implements IEasyTextContent { diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/content/EasyUrlEncodedContent.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/java/net/content/EasyUrlEncodedContent.java similarity index 81% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/content/EasyUrlEncodedContent.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/java/net/content/EasyUrlEncodedContent.java index 9453129..9fa330f 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/content/EasyUrlEncodedContent.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/java/net/content/EasyUrlEncodedContent.java @@ -1,5 +1,6 @@ -package net.sourcewriters.minecraft.vcompat.utils.java.net.content; +package net.sourcewriters.minecraft.vcompat.util.java.net.content; +import java.net.MalformedURLException; import java.net.URL; import java.nio.charset.StandardCharsets; @@ -7,11 +8,10 @@ import com.syntaxphoenix.syntaxapi.json.JsonObject; import com.syntaxphoenix.syntaxapi.json.JsonValue; import com.syntaxphoenix.syntaxapi.json.ValueType; -import com.syntaxphoenix.syntaxapi.utils.net.UrlReflection; -import net.sourcewriters.minecraft.vcompat.utils.java.net.IEasyTextContent; -import net.sourcewriters.minecraft.vcompat.utils.java.net.tools.HeaderParser; -import net.sourcewriters.minecraft.vcompat.utils.java.net.tools.UrlEncoder; +import net.sourcewriters.minecraft.vcompat.util.java.net.IEasyTextContent; +import net.sourcewriters.minecraft.vcompat.util.java.net.tools.HeaderParser; +import net.sourcewriters.minecraft.vcompat.util.java.net.tools.UrlEncoder; public class EasyUrlEncodedContent implements IEasyTextContent { @@ -36,12 +36,16 @@ public final boolean modifyUrl() { } @Override - public void modify(URL url, JsonValue value) { + public URL modify(URL url, JsonValue value) { String data = toString(value); if (data == null) { - return; + return url; + } + try { + return new URL(url.toString() + '?' + data); + } catch (MalformedURLException e) { + return url; } - UrlReflection.applyQuery(url, '?' + data); } @Override diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/tools/HeaderParser.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/java/net/tools/HeaderParser.java similarity index 97% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/tools/HeaderParser.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/java/net/tools/HeaderParser.java index b0ea414..f9b52a6 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/tools/HeaderParser.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/java/net/tools/HeaderParser.java @@ -1,4 +1,4 @@ -package net.sourcewriters.minecraft.vcompat.utils.java.net.tools; +package net.sourcewriters.minecraft.vcompat.util.java.net.tools; import java.math.BigDecimal; import java.math.BigInteger; diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/tools/UrlEncoder.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/java/net/tools/UrlEncoder.java similarity index 99% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/tools/UrlEncoder.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/java/net/tools/UrlEncoder.java index 81562b9..bf673e5 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/net/tools/UrlEncoder.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/java/net/tools/UrlEncoder.java @@ -1,4 +1,4 @@ -package net.sourcewriters.minecraft.vcompat.utils.java.net.tools; +package net.sourcewriters.minecraft.vcompat.util.java.net.tools; import java.io.CharArrayWriter; import java.io.UnsupportedEncodingException; diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/tools/ArrayTools.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/java/tools/ArrayTools.java similarity index 90% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/tools/ArrayTools.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/java/tools/ArrayTools.java index cad79fc..d2ff1cb 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/tools/ArrayTools.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/java/tools/ArrayTools.java @@ -1,4 +1,4 @@ -package net.sourcewriters.minecraft.vcompat.utils.java.tools; +package net.sourcewriters.minecraft.vcompat.util.java.tools; import java.util.ArrayList; import java.util.List; diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/tools/OptionTools.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/java/tools/OptionTools.java similarity index 85% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/tools/OptionTools.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/java/tools/OptionTools.java index d430aed..fb84282 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/tools/OptionTools.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/java/tools/OptionTools.java @@ -1,4 +1,4 @@ -package net.sourcewriters.minecraft.vcompat.utils.java.tools; +package net.sourcewriters.minecraft.vcompat.util.java.tools; import java.util.Optional; diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/java/tools/ReflectionTools.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/java/tools/ReflectionTools.java new file mode 100644 index 0000000..a86ac9b --- /dev/null +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/java/tools/ReflectionTools.java @@ -0,0 +1,79 @@ +package net.sourcewriters.minecraft.vcompat.util.java.tools; + +import java.lang.reflect.Array; +import java.lang.reflect.Field; + +public final class ReflectionTools { + + private ReflectionTools() {} + + public static boolean hasSameArguments(Class[] compare1, Class[] compare2) { + if (compare1.length == 0 && compare2.length == 0) { + return true; + } else if (compare1.length != compare2.length) { + return false; + } + for (Class arg1 : compare1) { + boolean found = true; + for (Class arg2 : compare2) { + if (!arg1.isAssignableFrom(arg2)) { + found = false; + break; + } + } + if (!found) { + return false; + } + } + return true; + } + + public static Class subclass(Class clazz, String name) { + for (Class search : clazz.getClasses()) { + if (search.getSimpleName().split("\\.")[0].equals(name)) { + return search; + } + } + return null; + } + + public static Class arrayclass(Class clazz) { + return Array.newInstance(clazz, 1).getClass(); + } + + public static Class getClass(String classPath) { + try { + return Class.forName(classPath); + } catch (ClassNotFoundException ignored) { + return null; + } + } + + public static Object getValue(Field field, Object source) { + if (field != null) { + boolean access = field.canAccess(source); + if (!access) { + field.setAccessible(true); + } + Object output = null; + try { + output = field.get(source); + } catch (IllegalArgumentException | IllegalAccessException e) { + if (!access) { + field.setAccessible(access); + } + e.printStackTrace(); + } + if (!access) { + field.setAccessible(access); + } + return output; + } + return null; + } + + public static Object getValue(Field field) { + return getValue(field, null); + } + +} \ No newline at end of file diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/tools/UUIDHelper.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/java/tools/UUIDHelper.java similarity index 95% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/tools/UUIDHelper.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/java/tools/UUIDHelper.java index 057eeaa..aaa781c 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/tools/UUIDHelper.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/java/tools/UUIDHelper.java @@ -1,4 +1,4 @@ -package net.sourcewriters.minecraft.vcompat.utils.java.tools; +package net.sourcewriters.minecraft.vcompat.util.java.tools; import java.security.SecureRandom; import java.util.UUID; diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/logging/BukkitLogType.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/logging/BukkitLogType.java similarity index 96% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/logging/BukkitLogType.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/logging/BukkitLogType.java index e5fc0cc..87d3e30 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/logging/BukkitLogType.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/logging/BukkitLogType.java @@ -1,4 +1,4 @@ -package net.sourcewriters.minecraft.vcompat.utils.logging; +package net.sourcewriters.minecraft.vcompat.util.logging; import com.syntaxphoenix.syntaxapi.logging.color.ColorTools; import com.syntaxphoenix.syntaxapi.logging.color.LogTypeColor; diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/logging/BukkitLogger.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/logging/BukkitLogger.java similarity index 98% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/logging/BukkitLogger.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/logging/BukkitLogger.java index e102209..826d47d 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/logging/BukkitLogger.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/logging/BukkitLogger.java @@ -1,4 +1,4 @@ -package net.sourcewriters.minecraft.vcompat.utils.logging; +package net.sourcewriters.minecraft.vcompat.util.logging; import com.syntaxphoenix.syntaxapi.logging.ILogger; import com.syntaxphoenix.syntaxapi.logging.LogTypeId; @@ -11,7 +11,7 @@ import com.syntaxphoenix.syntaxapi.utils.java.tools.Container; import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; -import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; +import net.sourcewriters.minecraft.vcompat.provider.wrapper.ConsoleReaderWrapper; import org.bukkit.ChatColor; import org.bukkit.plugin.Plugin; diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/logging/LoggingColors.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/logging/LoggingColors.java similarity index 98% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/logging/LoggingColors.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/logging/LoggingColors.java index 1b458f3..a7c2305 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/logging/LoggingColors.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/logging/LoggingColors.java @@ -1,4 +1,4 @@ -package net.sourcewriters.minecraft.vcompat.utils.logging; +package net.sourcewriters.minecraft.vcompat.util.logging; import org.bukkit.ChatColor; import org.fusesource.jansi.Ansi; diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/minecraft/MojangProfileServer.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/minecraft/MojangProfileServer.java similarity index 98% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/minecraft/MojangProfileServer.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/minecraft/MojangProfileServer.java index acc6a78..97a1ef4 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/minecraft/MojangProfileServer.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/minecraft/MojangProfileServer.java @@ -1,4 +1,4 @@ -package net.sourcewriters.minecraft.vcompat.utils.minecraft; +package net.sourcewriters.minecraft.vcompat.util.minecraft; import java.io.IOException; import java.net.URL; diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/minecraft/Skin.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/minecraft/Skin.java similarity index 98% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/minecraft/Skin.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/minecraft/Skin.java index 761e1a5..1a63044 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/minecraft/Skin.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/minecraft/Skin.java @@ -1,4 +1,4 @@ -package net.sourcewriters.minecraft.vcompat.utils.minecraft; +package net.sourcewriters.minecraft.vcompat.util.minecraft; import java.io.IOException; import java.io.Serializable; diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/minecraft/SkinModel.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/minecraft/SkinModel.java similarity index 91% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/minecraft/SkinModel.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/minecraft/SkinModel.java index 1276e1b..3e2b162 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/minecraft/SkinModel.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/minecraft/SkinModel.java @@ -1,4 +1,4 @@ -package net.sourcewriters.minecraft.vcompat.utils.minecraft; +package net.sourcewriters.minecraft.vcompat.util.minecraft; public enum SkinModel { diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/thread/PostAsync.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/thread/PostAsync.java similarity index 94% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/thread/PostAsync.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/thread/PostAsync.java index ab6c747..eaab63a 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/thread/PostAsync.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/thread/PostAsync.java @@ -1,4 +1,4 @@ -package net.sourcewriters.minecraft.vcompat.utils.thread; +package net.sourcewriters.minecraft.vcompat.util.thread; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/validation/ValidationHelper.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/validation/ValidationHelper.java similarity index 83% rename from vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/validation/ValidationHelper.java rename to vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/validation/ValidationHelper.java index e9796c6..90ea561 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/validation/ValidationHelper.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/util/validation/ValidationHelper.java @@ -1,4 +1,4 @@ -package net.sourcewriters.minecraft.vcompat.utils.validation; +package net.sourcewriters.minecraft.vcompat.util.validation; public class ValidationHelper { diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/tools/ReflectionTools.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/tools/ReflectionTools.java deleted file mode 100644 index 9dc8877..0000000 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/utils/java/tools/ReflectionTools.java +++ /dev/null @@ -1,22 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.utils.java.tools; - -import java.lang.reflect.Array; - -public final class ReflectionTools { - - private ReflectionTools() {} - - public static Class subclass(Class clazz, String name) { - for (Class search : clazz.getClasses()) { - if (search.getSimpleName().split("\\.")[0].equals(name)) { - return search; - } - } - return null; - } - - public static Class arrayclass(Class clazz) { - return Array.newInstance(clazz, 1).getClass(); - } - -} \ No newline at end of file diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/version/Versions.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/version/Versions.java index efcdd34..6941397 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/version/Versions.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/version/Versions.java @@ -8,7 +8,7 @@ import com.syntaxphoenix.syntaxapi.version.DefaultVersion; import com.syntaxphoenix.syntaxapi.version.Version; -import net.sourcewriters.minecraft.vcompat.utils.java.function.TriPredicate; +import net.sourcewriters.minecraft.vcompat.util.java.function.TriPredicate; public abstract class Versions { diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/VersionCompatProvider.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/VersionCompatProvider.class index 91639bf46eaa07175097e8fe8f6890e618df9dc7..2e01411e7926e17f8947dfeadc0a654b0966f968 100644 GIT binary patch delta 78 zcmaFO(Z#`a>ff$?3=9nB3@RJBHZlovrKgrS=jW9a<>xRm*lTF|OcYSzC@9J=%S=fv gnykVc%E&Ugig}d~3nPO9gCbBPBZCrff$?3=9nB44NCcHZoarXBIn_C1&O%Cgr3uGB9gsMsYFlGAQ#fs4yrp zGH_-V2Nb0ir{{P0LA5F3HT#oBV?*l#z9^ zAM+}A22KVA21N!&25z85>OdL<*f%i0V2hUL~qb|vkhCEwY57A z%?*!%#1nAC1xN%$FL(eR3USWNcD=QoG!hqy=bSm`JKy;m`=5Vb{0-nPKF=d1Q1@MB zhuwbQxZek!a)Z!5^nBL|FKVy61bUA@EIk7^!xO;*`1=>r*Z(djiKJ5e(PiFm+wB zv*6;oo^2Erl4EC@-F4jTu6R(WJf5I3aTet_C z=EjksnnDeq6r z1Qy28qNNbX={%nhuQqj#vf0&d=%&Xbxj1H+ZgX&fAL~2!M|m{I=r+da8l$e~pTpsY zHaUcu675);{<6r>TGGwzR0RJWVpKYb?)_Hx(OmCs_TBZqq2S4RZ8RpFY{Z|`K^kw2;5A--Wq{j9)?{#C+uz5 zG23@F><>hbt5hPk%WHq&y`Qi^$JI!@`xow~@H2hCbI6Qtipk`v4mod};|7%QDIO4i z&S`LGO3Zg$oDI68-yEwC@)TR3nc(zLb5aRT#Q~=kE+~nobGq?bPNvQ!;>( literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/data/AbstractDataAdapterRegistry.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/data/AbstractDataAdapterRegistry.class new file mode 100644 index 0000000000000000000000000000000000000000..feca1055f317d51e87db506efd30a8dafe558e26 GIT binary patch literal 6118 zcmcIo`F9i775<(qdq50WG1!FFKpbMrE^1hk6bXYdIB{cxi(M!rUB=Sb9vDlCG%}bj z>5?{So9-*=nr?JSTat#bq@{FCo2JV-{i(n9@91gz-I#z@*mZZdgv{Ir>IG&CvnEm*!$u#$sygexpF zJar{18FICh9m`G*QFlsV`KUFSGn{hKR5)?VaC&Ib>eGqtv4bi8@8v&*#__UcXBCcg zdMaEy`)#9CN_8z>2?d``kL(SJ^jw$f-z%Eu=t?Jgm!d8`Hj*0a_l#0#$`nn*q1P_V z(US@x@{9~QcA}iiI95KF9PmH<*=|tg4ld0-|GF*r(7xU|*wZw*(pw*+@0T~4M9+!* zB^Y!|0Mb^@a(WdSI=hZ5MEmnuGlmAV>bL_f8rCYT4(Q%jEE==I`54;J8pC>Q)UZLJ zHJH+$w{0dKV^h+x37eTOrP*9&s+iAN=gq7vR@ml8JIJA~P;lL(S`LLRIy5X>j&11B zaF@b;x1UL4vjtPf-Po=W8#y*OJUBLZ{P3v4TOL_N#)z=g3c~5s(S?M9K5055MQhq} ztQnGcb*FDeC^KWUqesUI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3W+>SG7M*;ghPU1T*U!~1dODjrshLy{&7!|%{9rNU$6#fPf3N9*Yy<4>x3wYUHtrbe67!w=Pl1Ti&;-YJ~Wf`o#MIWV2N}Bqk z5738ddS(V!y5Ozy12X5#Ip6u_+c{_V_n)(00N&tz03L>9+2neyQn&NwXWQbYUDHce z+05HUf$PWlN~vmaec#}QZd5IO(<~VEBHtuCcUm(kGd63T;jM?v#SM5#C92DZB^8BbeBp>VXg-3 z;uE;8P}c+}4d6>x_RSEy7}YR{F$Qlmwi^V)goXg_iPe;bUbT9lA&frZo7FIYK8F4b zHSWiHY0tEC#$J(nV=z<68^vA2wuIeu`uL$$V@TcZj=DOZ+F;~gaB9|Of$cjXi-$+g zIJY6YGjw3`wCZDqp=iu~9f-$RyH{Nj292^?+NWcry6uP2+mV(7%hj?i+|(dUw9;+5 z7(R5N6bTd~oqD0;c>vECrsa^ltN}H=z)OZ6qgpMVGOV`tT9ele$p`XkJ~3?ET`&fM zlQUXe)r&FjNadw-c1f@-2`0dT&g+HRizH+S?Z~&^mL)o7*mcjB1uKRx$?RG?!E^`T zMh9Q2J@r4t6YsHRbEFcOrN;NtuLnMw6*L`a9i;cV2O+X)MmV;ZB{V4~TE5X$xeS)P|t^|S)PiTFSIZu|#3=wygsX3YbPG*EM z8J;5QoF^vFvrb--*AxGa$*;6f)cw*qDrsseph;7dzwn6i4DlA&g*Mo6H|*36VF$42 zuw9a{1)?Xk(1`8K;=)fXd*Mc(ljyT5&e2vQ&0focXjq}|Jdf0IL@K3Gl+sb`t&)#E jxLRtzZL2+fN$vS-Yp-2VdkqPy?Lm@G=)t?@y-WQC(yGHd literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/data/api/IDataAdapter.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/data/api/IDataAdapter.class new file mode 100644 index 0000000000000000000000000000000000000000..2d21ff59cd8bd5607acc87fe405274f6182e92ea GIT binary patch literal 644 zcmZva-A=+V6vt0dHa--Gi0}kv+}KN_5E7X&Au(|YyYlWZ>QXYs(iX&5^TG%4p^S$? za0$EX@ATKxe?NYHzrF$B4!Sm!7~ChqaJ^iqP<$w9gwlK=6A>zWH+&r~7bzM(LxUVs z$;VGLdYoZOq7A1EoH?$M$CyO?bvhTJVNj2R8KD-zXDS%9+}_K-qvvzBzu5o8I#@2U-Iqt z?ilz3|KT{MS5O-j)P~1PEd~ru=pO)B^o(V&h;5=0REVoNt`XOBd`5f@je~zd?Buvf Td?u?l&18zn z%s0>1{Q+QxUW9=2^i`#Ozpbp~Y_F-74n72iLiA z>gFP}3B!ad7Ac#HIGhqC9bsTp-9*^8S;AsG+5bQFEtnJf#}DOJr;0H8K{9P1LIR=X Q4+7-DItUww$ZLS^8+IB^PXGV_ literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/data/api/IDataAdapterRegistry.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/data/api/IDataAdapterRegistry.class new file mode 100644 index 0000000000000000000000000000000000000000..12670794a75d794a9d79c1bdc5d2f6a9b18e26c5 GIT binary patch literal 517 zcmZvZ%}&BV5XWb+vVvbIB4C2&&MvmJ{JIR1sx7G2K`i8VJ1@@$+=cmY9q!fm666*D`wGToS_v%v?wrB z;_ilC{UK%~e3Y>=R)27C7_>$>Ly=$_i-(tyj4T5lOBpfMhU#z4g> z+NmbRX;tArg8}!+GU-icoGwEjMPI zxyI~Yw_hi!VbC0`E_kaFTIOuil`iuGFmU~_SK6d7396ww1KOQF3c#WJZbO}z6V+gc cxB<;I?-K99{+bVn4@=ylnxj?aapBPZ2Ft;QZ~y=R literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/data/api/IDataContainer.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/data/api/IDataContainer.class new file mode 100644 index 0000000000000000000000000000000000000000..0201867dc4c6644cc062cc1c7b4a62c1e94ede4a GIT binary patch literal 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xefZ>Lz z+iI)PwyOGfmSO8wOWiR{y=w6Xwz^ww>@>Np*0{}8vtp~Iik+|VCaK-gw~dxvCPS#usOeDz5s6_4;RqOpV~8QnaE3cpv>3*U zkN7TE+qO|xi)50fV3a}gZ4qx8>MdbTp<&vbT(_b`bT) zX8eJ~kVb~+w{^R`-y}yf$&@dCQr04vhpONj!>k`R+7iP%c$Z3PrL@f8pGX|I_hWb) z3*=b80_=?h9n}hNkwd=2$q?VLdG*^h-gNUTqHnQ?$-jcGD6Nb@QXrY{-;>8X(PJ*_f&ucQxgCjA?t>BPtZ z#(u{{09%fHu}glfOMcyxe<7d%-lXS6A^=7a!WbrSmV%SO0>-gS(lq^vIiz?CS4d(a zc&5@d8bauIjv>zYfL&98? zyO<#S2p^Nu5-kLvN$=-rRd^pv%nEeJb`cs7&on(9JA*E2NDQ+cL{>r+Nf!2o)0wBZ zer%(IGSgvO*t0E+0!4yh#bXdFtF*%KDL(TUZb^n8D3(K{8GnY{-OSwlROk?&cN5J? zq6J6MBZ^~9647Rq=t~$H$8D_30LJkpeTAeMX?lx)YqIQko&e%aIi3Zb#Qm}*E% h)K7|Z1ZpIm`4h7T*zArYlZFYE0KS&byKV~Z{R?RR)}jCa literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/data/nbt/NbtContainer.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/data/nbt/NbtContainer.class new file mode 100644 index 0000000000000000000000000000000000000000..f5da558940e65be4c909e4ee1b013674df91d270 GIT binary patch literal 4391 zcmcguS#uOs7(I6~$zp8_zBJ1XybkV-)C6?0pY{B*tbGBzEaw#t{nes;SInU;fVhBNnVc+nP zRLLvaY3~fVsyJE{PW$Gt3vOau2u9}Y0(})8XT=MlRpAJIO_WyY+)80S@8sMS^Clqi zebI9lN)o}8moM5GM81IqyC9%1zb@9Q}?8+tA!1Bv;UpG0X-=E@PF5?0q;a*O*kMbv)ZV) zH!ZZGUBSvZ%ax&`F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ig6N^(0rEt1$mNViExI|3uP z4=0FE<}iwrj5qKwkYQXF0&s@dqO8xFeeTu}CUgl7w?<65}h~~maRjw9s0Z+@- yGk6g%$<@nv18>UJTX-Aq$kn@e5AVy>MSO&hf*%ej%3g6&6Z2T7;s?g&A literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/entity/Hologram.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/entity/Hologram.class index 105ccff9523278700b44a51d46315ccb0c0423f3..a3af1ae9beb942fb745c13909d242786487d0f94 100644 GIT binary patch delta 370 zcmdm=v@mHy5hJ7R zCM&qm=0v7{jEwe^6Ij&YVv{GbNHJPZ6i`8k++xu}Q?%KPHH?YT5k*xZlj!6N?COlp zsJ13DiEXy!ux16TR)sl6KNaj)eZSmdh_gc~3sQL)rZC)NWB?nWiC3jH7sCUFN9+s_ z85vNW>cpqYIBjwUp9RA8tN3i-oXsEjTo_s0G&G|z967mGz=g>LQ+zXrpt%A7UCMqW delta 378 zcmZ3Ov_EM>5hJ7h$t9Wjd6WGG^Wzj_jGmmz=?GUd zc?0KFCMOLPCrsYPH4SJK(4n$$7o_HuWR_Iw`{fn~mwN3#J=Mc=KmwCDzG}+^Wh*CI;jrR;CsO z6y=v?rlc0}FjO*hGBU(!_)K2MAu+j_6UEp?oL8A$G|=2Sc^TIi5m-xX-cz02kU`WdHyG diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/listener/handler/IPlayerHandler.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/listener/handler/IPlayerHandler.class index d0b0fa3cb7e6ee0f9a120b69b1e0d789fc60c1d1..ae72a365bf49cedce9927b53b72bda615062d95e 100644 GIT binary patch delta 42 ocmX@Za)M<-36qn?#E+^R1x5K~nJKA76PM0mv_}@0T*!DE0BC&?GXMYp delta 48 rcmX@Xa)xC>36qP)WCuo7uA2BGi{~&pqKQq;WxNdlm#A|Iffjn30?`fYZ z^`Sq2A60dBV}~RlYWt}#9`AbQn{URmGkg5!*KYuL4X;KZLEw$cl+_ST>99k|6_X9C z&Ryn6x~r^~BkCSimM2AvSD3WkHxCZD$_uxJid?uOkR*_e1X1c(exz=t#w3AZo4Z`) z2)s)d;s7BTB}FZpDG?am;Z>KareuhlE|$z@GA}AD1w(LY3@*Shfyn{}xY?|inJm(B z4RvPTz=%QsK+h0tgOwlLRAcDpSGw~ zqi)sOD(^E#VeY1M7^e_VDQ3bt!J_S9Sl|tXRTPS%);*gep0^MoYI}PzcQ(XyUzlB5 z@!~X0O&f@BubC2)v^;uHSW0e4c!0~@U#10k8x!KS)o;<|x2(;qFq#Jtd zlp13K-|g*{)15DW#$GNiMZ372E#`3|#r^x5Y8Qk+YR6o2*0~<}^Mk{0Ss!2mU+vOL zs6W)b6Ag^#Tr6ww75WLULqn*CjU4|=0UWIE$UWXe- z-h^9-(cyC&_3nV?+gabk^?i6?^d7<^BOgQB$P6qRxdczT`cF}R8LaO588Uv3d=l`& HM|}Agw-Sox literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/DataProvider.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/DataProvider.class new file mode 100644 index 0000000000000000000000000000000000000000..f05ded3175480455a50699bf1bd4242c129dc0d5 GIT binary patch literal 4905 zcmcIn=~ok16#qT8V3?ACf?GvJr4W~CU1~8AMIwb7771YKqMal|9GT3-$poc#U+lhb zr~gH3t5i9sr=NTJp?^_N@0*!SCUKxaEg#6d_wM`M`|ka{`|kbopL@RpIF26zsAK5Y zWK%5YMI$X=GZa%c3Sv&t%V4R+G%4 zAu|lFB^&cB&diL)qxM*pw5*sk4ModF2MEtKU}|tYJ~6h60m))MuPU-Z8$=JTYhY>p zKBZhmvms}df@v&qi)-;#hI}k)DN`IznS&WAPcfNtAPBBKBhO1k)r@mYB~>(a^5aBJ zz-|;R4S61mf+=fh*$S%%kkm+z7SZ1`v9zjaiaEeg-`h9K&@iND>qN$y}whMS1I|wu@o2%|E#VpGA?i8>AL55I*s6SrJrDS7T zN~uJ$_Jp36)LF?;_}H0jiaBPV?p>do9R3gKnrY~2v~MjXeQ8!Eov!`4L19 z`Z!!WKh=H#0v-$CAcJ6CD@7NF6;%#G#8Ux0$2^$yHsdryFs~M~ipG;s5C?FEpLmF2Pp?gqlB_-QUU}|t zhO+{OLCK~qZOD=-dx+0)sS2ZSeF6T@o5kZYDxei1qPuxnA^%3#r-Glll!ED^wl3N^ z)!`Jw$@RfiQIesBVo=IA3_}!vha@E#8L~aiZItMSQDBE_#I4L(7Ys@Wa>m6WN+lU; zGO!Zp8Ucw(C6`y_sN zoU&7RfkVE?P-DWWgmjIgghP4Kj>Tjt{hRJ`5Et=E0GAlXY6*FzN7r~x1V~6RG}($7 zW*#W^UIjkJ6U#b?xpAM@@%%&U+zDHy_Zb{mhsCk!bH0`9S_k2K2BNj4?V3+xgOdL>iQ0o~$)hx3P%*FP z$`hTH71L6_R5cy-GrF{IwSzKr`)w-)tz=d(X>~BXx}kU7OT-gwQmB)sVk|SkEV2liC!#E}!Lqz)J zr)iA*ipWp&VcXB01aw(2f-T^{Fihe+&2UGYB-LDQ;|iwcRxmxsL6$MQjJay4ZV%K( z7wRP!s-Ggnp+X#rU`FoXWgnOx4@}5~Nh3pc+d-8r%e==LskSBJ0cmtWs1b5O<}Hx8 z6QuA8F3v^v-@=w#=vqd$8t;&WXL~#B;DI7?1q*a0s(zum$TaL_@m z$1a++oqyOujo5N7s^Fl~UTBVe0(2r=J@T~Iwt}x+C7oPKhe2x%DA1@5rsJj}79Hu= dY4uIq#E0NtAL9#riLYpl-;1yDExyOre*st0zLfv~ literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/EntityProvider.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/EntityProvider.class new file mode 100644 index 0000000000000000000000000000000000000000..6562f56a34347c5f2d7a5e81cfcd2b2fdd080c3a GIT binary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a_A%i z1uX4tZbhg;ArM@0ul*@gmi`Ve%F5L~B$o^PkVxIB58kmdJ^H_Pmp>1@S{!(fDe?1@ zh1!r87vBndJ~Sf0A8%E*y^&_9oXK*vkMGV%^c5~denacpE405x=P&4a$#Fk=`D}4* zcFdX6p-q zeaz1f{(R;Oven;Lg=??RBI{+6FV}ja3Pf jJ1YdW!~YMa6$~rLyhYbrh(JIdbvp2IvwUurrL^@Q5orq6uzJ ZXWqcY(ry!Gg(flCgU<}vo;E&yb^w&vL|Xs= diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/ToolProvider.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/ToolProvider.class new file mode 100644 index 0000000000000000000000000000000000000000..77f046c3ea1c6bbbaf2b521e6ef2ffe43dbe36f8 GIT binary patch literal 1124 zcmbW0OH0E*5Xb+U##Uo}zn|c(RWL`<)>0M3LlL1R2XAY->e@70w%dwlKanTFgCD>T zB~H@R*DWQmv$L7`@t@h9kI%Pv00-F4!D2WJg>k#8r+x9Lr4hR8wq+=M&2Np{_f@;Y zjoZRIzNUO0cwEcKPY!K!FS}G- zI#s{BQ(~Cz56VqcG90JFCEXep$*}xa>QiSZx0(+8TW6U%RUxq%vJCk)Z99okd(nMpT zi9f&}Wjxa@`@!APo9%gL_Pq0)IqBKI|9<@e@DeXFm|&>7LfbvBuiD~FNi9^*K9R0y zD}JEuLEAey<=Q?~-avMQvRkw-J-6n$T6s)-LCy{|46hoL#|feZZ;d+ zd+!*0P=E9rKt4AW%L)7;f9?({_#IfhTfVZ}JCfWsPbSV|l?bOI4r7f9A%ZQw&$ zakz_RhC+vH-WZiY71tA$yc6+IOd89B`KmpSk%rm^YvVR^$ zEE=Qh3|pmSobl?b*%xY$?>oZu#cOk?#g#OAw3yb1vd8dx ztdr@quF%nIBgaxXnP)VeZrwQUd7cw?F|lJbog8yb*>$<@E4quVq;yfQjmjq36$$XI ztED~<5#J=WjT?~b&Ug+XTEpSzLXCkIH@FH~+`&hiH*FPPOcz47V4UQ_;$zj@By>E!@ll#XD&m&IUM2dr1@_z#AktJCUAO{ z#zBe({{&Vri78T%m|9Jv_>Dw^v20dqn zhADb6gE@*1=X#Sr#Y8})%YOG5fBzsVGj|W{|7fB BEARjS literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/VersionHandler.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/VersionHandler.class new file mode 100644 index 0000000000000000000000000000000000000000..dccb81ddc030e082f06f1c5ed2f414d4421ce24d GIT binary patch literal 986 zcmbtSU2hUW6g>k=DTtJ|7Qan=TQG4SO$2GRiSdEx1I@k<%ZSq~yJQ$J{wqy1CO-5B z^hY&4v%96iN1Dyfo%=E8%$<8Kul`*Cc!L*JlmvQ-vcV!~ zuoTC80=1EzCekjA5-6XAjO_GvqU}K7#J>}ECnT0nNVoA$(}}91jAjEh?2*gwgf$54 zH&DTjz}}Eg^LaTND|05tF>iA)Od}bG(rD)wLC=2Ei*36u-j+SKH?e=rZ}2~C)p7yc zXR`yM?@yI2#<`x;vESJW`gT$kzmv_UKFTEZQM*Sv+?360rx<}zKYV*9w!!d!>Giyq zoK~6g7I@%BMq8y_ P;s{E3nyt@@hMr#o)y@L- literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/WrapType.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/WrapType.class new file mode 100644 index 0000000000000000000000000000000000000000..6a5070bf7da1289d773d6c45d235bd647be46797 GIT binary patch literal 3912 zcmcJS+j1L45QhJ89LsXnabkxMLO2JIO~`TxPVfo^o$SbLBqJ#fMu1t%8)==DR;*S& z09U*KFTfLU#o;1Vq>2aNk+`7fo{=_E9IAvPUr5#8uT}RU50xRbKcfCih^^((Qxpps#ArLJ&wWbwxd|SX7jn}yO zXxyoTz&0M|1jRjBx>YEa1@4bNW~uJ^L4QysaMVaHU(T*%ivr&0C&>aRm5Vv9^B_|#+K9;HJnn~4Ys7Vq+wcVakiwE&@iL4kJ*x1O2b*DW!RG1vW7XO z-C|2>s~VnBn#q>b@*191+8SF@D{6R7X=S#gwyxoMrG3Vh)IQhng3`WVOKM+fcu8qr zvo#?wW6~WZ-)U^we%YdCD==$%Rm)wse22L!&eiN-&3773;Oxo^Ma$k6n2XK#o%U(h zYPYEZFC13mWg3N5sG!_$@c=5YIb&@0y(=f#ly zFsM6if%s7Q`42w==LdHQIq&Y2%v1Oc(?_dWl5Y~r4sXfn-UP1lU7N-pUt2o757JN2 z5{Dn7O;1Myy|_$M_n@9f6d@YJBr)~7kf(^L*M-d8hWcE{r-`Y@g?xsX`di4e#MIkD zK1WP_E#&jW)YC$~KurBCC2fyBkCc6)F&xP6Z@bRF`xn&Gg?In} literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/WrappedContainer.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/WrappedContainer.class new file mode 100644 index 0000000000000000000000000000000000000000..8ecf8ee40bb46bda56bb735b0c90c06fbdd76441 GIT binary patch literal 5964 zcmd5=Yj+b>6y4LL4TQ9mR}~-SVZk&71_e<`EVOBXN@xo$<>3RT$)p`R$;6pSXc3=? z;url1`V-XUDlA;fAK>ygx!iYVoJ`u()nxj?56$$x_Bm&tbM8I&{`vQ_KLEUm?_%hX zFj`h^*)pnTUcF~(wrW~(Nh_;)Qz_bVEpL=6iY-@6qox&9Q!XgBBHu8TN<}SXjk2w9 zsu@F6LhoIrrpUTdUXZ8e@2YuQLRUsBYxb~&NOEvaLNsd>)Hov8ovoip-^KBt(PXnUPedr`9_jOD^>nwGGALA5U_<$@5mH#wMFt2U>^IYk(! zF4KrH&Iu)$C_?Ovwoq2=s!6dIw*WGe8Yb#qYC2-gtk4n5zB?qG+oS-;n@UBKC&uVk zAArD-MTL~_O9tqfu}!VKkRH4(VI98#P+6oJ8X9&YVxH5#Y4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g9`^6WKBvDA&v{=V${pX&@jkrZw_kMHFZu14+3v>y zXI(!I`u&HT{=Vg4OdVgvb%7fR zICR*-O}R6D+#U~?t8ojr9rb$f9^U8L4~XEJCB{DV$L?@U=<$)ShvMk*ph1uM4fGh@ zP>%vpH`3!EvBlUqsQ#=5je6rEvpk|tQ!{}T-@W)0cT=mVtYz7Cnj7A6Sag+O%jRzf cs;KcR#y(}=XZR9d;URlO0)LHf@EH650efRM*Z=?k literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/WrappedContext.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/WrappedContext.class new file mode 100644 index 0000000000000000000000000000000000000000..f40281f55bedc04aa6546e15023c8a55fb0e05d3 GIT binary patch literal 844 zcmbtSOHTqZ5T42cf+z@xuah_MV2>t3h=@TSBK+802l=!BG#DGdPu+E ziMjb4vpuA}CM|AxB!$^i)`+z?tcf!LZi8SZ=kx>{_X#|9DZgPJk#u zCr(s0H<5v4imV3RjPCg98>C;uaE4^!#|hh{XCi$EvSj5JJiB1{oQDGC6e+R+dt{ej NKhzIGc^E~Gz5ygK_TvBm literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/WrappedKey.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/WrappedKey.class similarity index 58% rename from vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/WrappedKey.class rename to vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/WrappedKey.class index b0f742ada1fedecf268920440ab99a51a29bff0b..80fe6625f2b178e188f65a3d53f1825ad960562a 100644 GIT binary patch delta 74 zcmaFDd5=@z)W2Q(7#JAL8T8p1m>3ysCJLx<6cpu`Wu~MSO|&axw3{r*sEQDIqQmHn LBC^?maS1a3XTleU delta 80 zcmcb|`Giy8)W2Q(7#JAL8T8p1m>3!CCJLx<6{V)-q$ZbS=I2ecDPwZ*K@)qR!{mx4 Kw%Lkt2{Ql@P#RYN diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/persistence/DataDistributor.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/persistence/DataDistributor.class new file mode 100644 index 0000000000000000000000000000000000000000..6df8ee61a1bb1d2c2ea9590eb132d01713ea34cd GIT binary patch literal 5940 zcmcgwiGLJl8GgQO!i3F)q-&s18j6&X&62Rvrlk-{g;2_o1lokOM2k*#C&|KOX5F0) zr5<=ztyjHmJ*xGn2Wr)l5YT#GwQBY6@J~?d^L{h4JCKkz6`K5hyEEVQKJW9M-@fqQ z3(o`ChJPBUQy6enhd*<#6?F68Y}HgEY> zw#Y?=vTwUNJG++yd-+l-j8%NEWT0N5^@KHTWgW|%$Q~X$Vds2>WX^Mai|3Zg3N8J5 zLB%gP*#WEAtFU~iFyUH$rDQ8Om(K1SKGfU)|6x25;r06>6mse={wtWG(veUtw>=C(G5(#V)Kj~0Nq&r6pbShj|ONRTc@+1>t5@~Eo zq6=FLbStc^E$H(chxwEVq--LKH!+u%PrJFvlIIp4vGd%kus$7wBIz~myYjxA-g>Kv z1}u}O9uv!vl&3pPG{KaoJ54lWg*@#r(TeMs0CFYU^65iI846cD8`E1xuf@3m?@hQH zyA8ZqVQr1c@hIg+F=Jv6`e>F3o9VkP3iwzN>uth4xYxiwh348hB-F%y98hQqOI-Po z&6Ke+v_kxV&QSx06z;p~{23TvA=9A3ieuog!u5JYBM2(Qo=U-C6>q|Q7&37G!h}Q_ zMsnb=!ls232|O&Wn*k=!Sm6%@CUF!GnmC401!LNBD)!;=S3WW7JDv|MzvzE>GGI$x8g z?BJNcJ8u=)=S7E5@q;LdGAsl6IAuZe)*C2PRqxd(u$Z{c5ecMz&W zHtu6#B8w04fRhq#sTk`aY<88^rc+_)nq;j6+en26um0IlQEMLZt=vf_nXp<a0d=8)IiT1;ceTFIGv^WG^}F!_&rrF*R0EBN&S%iG z`AH7xd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*3P>gHM5fj88$=Ebt%TNVO)Do;{ebqIrcCvJzVH zLz1!N$sesCXJ0irPbb8#N6s)_h`=Vf?yeU1OikjHG|))g4WgAe?xyXXU*ScCuW*vT zS$h}p^2x;7m_lEyZHo?~0fx&F#_k})>v^rYGn7^FL^p$LoSNDhisu<-b=oJP=er}$ zlr+u=&28QnH0e+?e_lpt`WEqOHno7)6B~pSdultQ0VHW7ZEL4>JMkg|`d9*0x`HYl zp`spGm{^8NPKhU#G};K&ort4MLV3iIePk6>d;U%VVG4w>MhNR9VT}^jDZ)CPfR(Ah z%2deOhA9%3Buh?(u-JvU6PAk0I>2sGm!wHH;V#1a8Z%NIW*6a(BzDMJB1J<-o+G|- zR*CZ@gQP3ANQyyd5qo_k?m8*eGr| zpH>CfK~MG2SJDsS`Yr&ZzTd{3WtQ!)K;aY%-#ox4H8A`xO}oX8`yR96 zHgoAt0>V{K$==-ducUcBLWHx-1 zV6iRA66vVbEXtn5)II*yL$%Ua4p@=#RZZ}I96e#X{g_SglY~9%QTm69)SHwpPC8r_ zvf8>ovK(k;_1FExk!7VloM=8Jx1W*Qd)PzNUAT`!_&kBPM{VZ*x8=p*skkn00Ob8kwH9ii@NT)8ln`NN&Uuk@3 zqKQAiA7#8Vtbhe$Xye1q?%bJs&beRvW6J?^*TlN6E+&t?aI z8}U%1GAz8T)f@XY=YYYf&JJ`=Wr+aGt|xt|DhyU}=a6B}30fiphNUc)kzq)d&3T$k zD_Nwlz>up_Hfp_2Q$!8k^hj5}8o1m$D zgo8_?>j8oI|iZU!|O{{=~(AN#Z*5EW2q0_L5TPC&yZexq~cgSxLt+w1H3&Xt`csBpSbN`<_ N2|O@~dl=_+`xnn#h7SM$ literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/type/SkinDataType.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/type/SkinDataType.class new file mode 100644 index 0000000000000000000000000000000000000000..d9e91e58dbb8b1646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-ftW$q6E literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/wrap/SimpleSyntaxContainer.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/wrap/SimpleSyntaxContainer.class new file mode 100644 index 0000000000000000000000000000000000000000..c916014d3d7c7c8ebabf572d3c57f783773766b8 GIT binary patch literal 7240 zcmcgwYjYD-7=BLD5}K~1#TEq-0R@s!2=xNmghE@26iR7HC{h*Orc1lfTu8R1Me&B< zZAQmm;2-dVI#{MU;}7shIlk{X+fAC?IGb)qKG5vhbDsBkpZ9Xk*}wn!<1YZG@LdEU zfw6*NB`d|na?ZF{HZ7xEN#@Ohkt^%BtmIOzm@ny8vQ#cEnX^VYIjdWG@?KdlB{OEe zv|wab3YNY+T%`YLQ8|JZfuZIRuM=X)n00Uj+H&id0;hd(l+^T+nH)VwBps*}VP(v@ zf^IFA4S{fWghsZd&4OtS2%L=t!j4Z7R*WF|N6T<=)`%jE4h?PCLAGM?sWu37X=ueZ zfgNL{(fDG1#wcg?nFV6AbF7%t7pC;G$b7F3DE8qnC+!h|kbMUG{n+P`G12uyiR_mw$b zv6Q`uaLGS`q=pzy2n_o3ZzG=FpBO7XO}^b>vOC?baXdCbw+f$53`l+6z^MpM3Z(sH zNF%Nq-o#r1om3m+dfup%^qj5pDasmZ?a7Lis5DLH&30w_W0v_-J*Mfn{=I*A=%D%(2Z^-kgzrL)RsvAsT#zQP$A#iUa zDhysm9yL=`t`k52I!g-UEEJ-J5J?+#}oV9Zra+nwR zA!ycaxg4!a`of~Tn!2F*_B=#KsG$Io+bRhB)JXQArLaX&;z}rTlu80C%~gU+IA3~s z?STAwp={)fO9s=aXt>KK?`?E2&v1cs(RMD4@p(N-Llm4t^<(Lp0<&*m1G3JSHLPG! zK%+gDj_C4wKv%YiSsBTfEV|&(_X|3T9KZt&_wf;Z;Ha4QDKltzl!rgp@CiN@=w7!d zFL`!Va*}_k;d$)#e@At1K=wBwzJ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wyOO%3bRnZ{Ck(C<1v zMv-B<<_PWze?JUA9|6;F4YR)r{2V>iRpoL+$1Rko1b5YWJCM1qKYfw^M^OyK9GN+- z*2#3(gY-bRFc6$yWQm><3w#o#BvVed9J|qD)FW|EiQH50YUB$YUn*UvJG!c~&nx@M zX1Bc}=}; zH>`@sw}jrRICYl`-SwQ7U9~*D$_3Z=J?`oocHOO6@9DGj!L_1@FpTf=7T0UMv8}I{ zcdd$uVuWG!eIiKe7wFvK?O?FJWn9>F{t5++wF8YR=n z6WmD7ZrCEvV5ElxGcubD=CG#&DiS4PI#nx-fR-7>0WD2Wi^4Tn2q8Z!{Tsdrr|nf7~&l&#DOM7&#v3T zZmDacnDymQq{@;UZfm$BakTEEltg*oN=^XAu#@fzuYJ{wA%ykyGM$F74usLInGeeF zHcb+p8atQG8yUJpGRip(^SH;55PyVpa_yg2xl0}ED1cs3`i2yhO^wP$UWQJU1QFA+ z(u3i}spF=q3zL4-Wls$yC1gmpYr!vgm7e1NN{^}1v!r2JrYE`OIrXlZi@8U|EMqDX zm-vSIYpmI_uS_2QA1p{=89wHUtGybVeQf#OZ9_^X`+m?L=wcFGdd|?3l1-7u82$c2 zh$~wH8hy7dNsQ7;ndTuHNCy4I7jbM8bPf#LZ@O#;ylf!+Pi7IKr=e$ zdzn7Ab}?9s69a}zmwz;dw%W^*>Df@8HGOE-WMpPVF9{|M#FtPAY2(u vXIEP@x$9xD>k;i@c-+O}Nq-iLy)0(`!eV707Asgi#v%lR*oKhvtLN!&l5BWX literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SyntaxKey.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/wrap/SyntaxKey.class similarity index 71% rename from vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SyntaxKey.class rename to vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/wrap/SyntaxKey.class index 482c619beaa2112400561fd085ce18aeefa5f3aa..238cae95212b3bf840cda99b968cdb2f647700fb 100644 GIT binary patch delta 94 zcmcaCd0JB7)W2Q(7#JAL8FJVem>3xxCJLx<6cpu`Wu~MSO|+9_v_Tfw*k;4T}&v*6du6< delta 102 zcmX>td0A56)W2Q(7#JAL8FJVem>3zHCJLx<6{V)-q$ZbS=I2eckz}+(724Qj!^Gs` UgDSZB4bv)SrgC)ABW&z!0HEt3y#N3J diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/entity/NmsArmorStand.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/entity/NmsArmorStand.class new file mode 100644 index 0000000000000000000000000000000000000000..f0be437313fc6235f3ffd62f5e2eb71023373d24 GIT binary patch literal 284 zcmbV{J#GRq6olsi!TbaXaSCW~NsSOxC=@HDpfk$@8Lhp@ek|f@6dWLjisD6SXep-o zikWYIe(w(eGYk|Ogt=$YvAl$wufYn3sGaqk2Xhcz<)u3t(dSTBcF#ex7b`dY<>EZJ zGGt=>UZF)8o=jzQVf;~Vb|=n7p-ou4S-yPEtZilek3ysCkm)=6cpu`Wu~MSZM56W#Nw)<>4Pk|S(#ag F5dagU5n2EM delta 61 zcmdnUv6VyM)W2Q(7#JAL8T8p1m>3!CCkm)=6{V)-q$ZbS=I3p++04Y~KKTQaI+EaK Id1fI-08RxHBLDyZ diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/entity/NmsEntityLiving.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/entity/NmsEntityLiving.class new file mode 100644 index 0000000000000000000000000000000000000000..66d6bcbba63611cdbec2c49453b16dc2148fdab4 GIT binary patch literal 263 zcmbu4u?~VT6h&_pMKLB0euOS|baEm(868X<+zLEN2^7-S8h_2f5AdUmh0)dFy`0?P zzVqIn=L^6ZlMp?ISdrzXzUh?iT3XVES5i@`#np0`)>R`cZ*=WsMw*kd(mwd1GTV;! z(n*zv2pDFCaDtaY<@}fwl-dwOhRt8~3{yikuFFzpA}NU>SX`E8hUnB8?_`_Je{@!@ XiNDRz_cQR%GVd2+)Dp&i_Yi#nS7%S< literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/entity/NmsEntityType.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/entity/NmsEntityType.class new file mode 100644 index 0000000000000000000000000000000000000000..b9e29aaf1dc88d13b676d63e311284f0cdd33255 GIT binary patch literal 1193 zcmb_bU2hUW6g|UI7U;I6RMD3DT@}!{>4W+JsU?&qjeI0szz`qIu$|&Iu#nva!@tt@ zp^e7IXMdFO&KAr1;FIjb%$+;;o_p?{vp;`*y#(+YITay>qAfh#9gG}Pd~z&LIIiBe zY+*Y5*we@6pg-iEK6D0S>qt1duszG0=(WCE_N~TbC{%pgCF^|C$cGb|Pl ztM$VVMx$8UV<=VryG))i%e7{8t5vKt%Lc>V`?-Kd3ue! zQ@&T;kX)x=+vJx;)!ehqbKIIGMkoN&B+a)~+?K3}$vQTs>8}V{rl(G^)_$wxF53mk yqpGAYkbeG|Zmwutp|NWUF?z3uQ;ZzN$Xf9v%U$5n53qmdh4943e2R>}XMY1Gnlxen literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/entity/NmsPlayer.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/entity/NmsPlayer.class new file mode 100644 index 0000000000000000000000000000000000000000..75fba4aac0e8d46b8f5215c919ab41758d946b30 GIT binary patch literal 1057 zcmbVLOK;Oa5S}d%)22-eX?TWb3w18+kwf5+79t`=rD`fTZ|rHbjlH(k>s0+~9QXnJ zD8%e~(-Jj@!omJDvoqhkfBpXP69C>r7{CgHj|vShvQkHQuBAa;@Kh>{v^X_<7G-HJ z49|5olQC+J%1Cp;57Xi(5f`WfxXobeOw0sNgqrZL<1>s*05t{&|4IDWg&4}2R1*f9 z6EyqfbSh01kU=}_3^P69W2c>GRK0c?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?VuX(_yK;DWzTGYXskTIOV3RA=`-Cu-Sg}BkDmY@;(ih_hR3!D4BrVoQ@rzJAUxmb zNL!d5-wTYc>2zEk7_R4ZWm|ZL`3uQznA9(r0*5 zJ#U<4hU~uOw769hLFh76i|6Hh)hkQ6)JS6jQ%OuR?4BjilLEgGw(z+1M(kNsMd{dn z4i_-ZklNm<)wgyk&lp~xDefUxlrt3lYz`MuU>NbE@}!O(7`D%JVPBJ+6pA73dZH~& z9?*k7EjFwFHcmOxgn_h-z0lS*Fe+4sup_*3X%J78HMwu|AoPfGYoq>X5VKiq*6Tx= zH^{zOE|JV)5z9#|G0f}O{vSyW*KnPhoSUX_soSTEgSV=-Pn(Y2mg*rHSd*&T#=F~q!77&wSIORy;66T=3AZlLCHIK`LT%dgnS2X8)+NnVE zb03gdTm6o!F|2+fMM4KQrj6rtnjqpSO}-d8;0A6Ij$CmIMIBfkC9DwPDrskEjcjWt pw%epzCv6-oOG*QGNUF>fL}eC>e^j!sCbNC{#CkPhxT{h3{s7DvdT;;$ literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/ClassLookup.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/ClassLookup.class new file mode 100644 index 0000000000000000000000000000000000000000..2fd61f9d9206c2f08fae2aa9f801ce8ef1076814 GIT binary patch literal 18400 zcmcg!34D~*wLd4BWRl?nVjw^e5ZRJU2mw^K0I~=e35$j;sOT_E$mnDy&P)($tKw3% zRcmc+3q`GUtF6_b61Ga|2CdfawsoP4T5H$W+V}dZ<(2n8_ul#DPG%B=q~-TB^UeM4 zJ^Oagz2kHLI&g@Hrt|N;l*hC<8cNnCV(sx@=<0Yl8Hy)rTf@;%Fdk@5)@}*LTH6B2 z+O~LXOL$W#UK@$Uu553sZ3#p-MMAX;BY{MsK@EAy!&GubU`wDj5{PcDU9s_sP%z0< z*sx;7($y=ODjL!+!_h6VD?_!*Ldllcrt=l7#5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z@0_In~E>YpI5sygh0U+q@yi@rs@+3&%}w)|o2C@fzNU;dN%FS|@V$ zyfbH}#x)@>l+!ZnIqrgiH}Mwli+puR;O}t6f}KA2G2L$#xBE2Gp|i2HG}UZ8%@Y+~ ze*crc$-D0j-}V9Wu(YfU+vs$AGhVGbrsdi`(SdhVzTP)5fp~iq@39R}G^&;+34cvl z9u3nAYFPwA#TdR4=v|V+EjU(mUTb+@qr_zhbk@CW+p zfemz`4eMy83fxlxP9RA@pL)M0Jk0M14YVt~or~Cc2YYT|?+p$`p!h0ZK~M#^)?XUH zaT6ZpziEPhY+3lLB5)`GYzY9L_=$sIsO}I{O9iT>0yT)k0n{~ys)@V%`bq4`>opv2 z^zT~4&b=?vmHr~JU3(0*RO7rB%5vsJ~!^~_ERahEplr#D`SO}vtm3%JO&zWXm|_Yd=1 z38P!#F5=Q{Oe$ecM{oyLy?XX)c%N-|03T7EO$F4}pkstoWTQK8!Kvocm*D;o$7qFP zl+I_ktr`wBaz+EOd*)M#Qi-z+?AEh8_#ePZ4x%Hj3Q+*l%cpWWy8aK$*TbmNpp>pu t_=bH;a89v7soa^G;m-rgrQmym&4nH)v{0jlXd6@tJ literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/FakeLookup.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/FakeLookup.class new file mode 100644 index 0000000000000000000000000000000000000000..443ffd96285fe36de8b1080540e61bc6fa02f266 GIT binary patch literal 861 zcmb_a%We}f6g@YuNv4woN_dq=TQ;OD@CJ!Rt4dXsK-B>W6;)#CIHommW=1oUz-JY) zC<2KO=tm*0-Kb%~u8iczJwEr`b3MNJ{o@yam)HzYAq)~-iXxrmN`KBxsq;ciO`=sU zKbB&y(rG43k>%;!jCC$-noee!IF-rRYB7`(9eX4|jWE21)V`HPaj8Y94fhTQgjex3 z1ee~n3C$g4O=8MjLbbnj%oX<2u?|64i4dVpsE=mGjtK|-t^ZWD#p>M%bu@U5`AXl; zrX!udmm{kQt8uENJ(js~@d9k@EKG)jFG^>nNs}VLZNkPUIhVr9QEfiLMfuy;&{SsgMW_e#-B>5*7h(99%X}HEBX!0@xIP13(vr tYe5$(0b5|#)&UpeJ&bl>4{-o+DKiINaaiW;kZ@NH=aSXg$+c3U5fzrnxZ zgC<%NAN&FSDC3=(b-T8pB-NN^w>vZUo^$WH_s+NPU%moZ#@!4O3{PDim<_M#*Z3>n z4!GYi4{Vp$d}})}TQ%?C&EpMNjRm)fLtdQNR?b^W_ z!*tPU;mUt(SCR)Ybajl@~lPGWgJ>zOD>7IsL zlNFdVFpmN$Oj0n69u*VyTe_tR**xMr#u3%zZ|nB~#8XLKK8se`FYvT+h-B8IC+xH^gv zZYjcDkhq&9kq~K6;x4wa*aJLG+RaGd8D$y)4~7AgyQD}^=+s-G3Z_g2NDJsrv`WI+ zn1ty_!s`&y3kerP=S1?IR6&$ed6r_H3FSF_pJ;y;Z#JTB<7PLl=ps=|@!Xd0JE6?W FKL8>q2tWV; literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/field/UnsafeDeclaredFieldHandle.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/field/UnsafeDeclaredFieldHandle.class new file mode 100644 index 0000000000000000000000000000000000000000..8f5d0e7cc7f7ef0efc3608342fa5e3e04cbe0814 GIT binary patch literal 2214 zcmc(gTT|0O7>3^sEv0EVRY0+bcmR4pA|616VTMr|=~S2z>4oD>NVgD76DCdTc;j#I zr>G-1N|o9^Lz_Wj=dvib4z+jjsB^-FDqKjYECka4I&}s}{E_`i@gKs{9EzZNuZ0 zbuso#&L??(wS4O<$KQmuZn(t=75Ez>3sau^h`^ zWthmG7?LY9#2&j9uA&G18j=`b=*i~FNiYm)h@)5hOKZ4*5kl^4Zm+FBWf(5i8xFZv zH$yL$RgB?M0v8zuJEk;@<1&S~y9cCIO5F-&o~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hCYwUZuXEYXfJ3L z3T5svup~`Z4byPe7)E0r+eWx}h5)y$JdePKZWW#AVerM`nJ_4XiU5M*Ye2;n3=-tt zPI_beDMN3nTro+{a?Vw0C4wPb3t^a{yJ<_s2u8*7Zy`735$4}5kiLu zHKF1LCW(j#b=N(7yYnUm%uN+xM2J#~3Sy^H%5wXao-ImMt(;!W=(Zu|?xNp0Fv<*X zQkRtTa}`CI>)7W`MlV)~!$2&4{`3)|eM`kW78s&r`+}D&`@QQi>lMU2wL<=?epxo@2aDpTmx^MzS zb3vBqEkY@**>lK4M5z-|aGOLBL>6&}JnzbQ_oM`yL{eZy>xAg|_nUFYJh;(1ZWIse zxR2_%D-w5|qKQ-}iDs-xi8WE%tz(^W6iNtGh5V`DXcUPOCl_i2NU`2#z*&!6ff``X c205Q;K3#V{#agp7HFv>MKI?MaaP`^z1>t35GXMYp literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/lookup/provider/GeneralReflections.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/lookup/provider/GeneralReflections.class new file mode 100644 index 0000000000000000000000000000000000000000..379abfd39d94145e2acc0558bd01f78370ef6906 GIT binary patch literal 1304 zcmb_c+iuf95IvhTaq75~8fdwuE!U)x@FNeY5GW#1Br9A}1@X9XHqC~$9obI!E`-!d zAn^fw6k@yyZA1_c77t!~XJ^iyIWyxQKfitl@CBK&gD=5@OqlrAqgqMsZrBR4QGMh5E)l5mOX!2%RgGQ}i z!Y;#>KWTGcka;APFmRKhLgjM&aKeLAhtHC+k^^VO$HZ;iHE@Taokh^UaItU?6$Zdhbr%zG3g3;g-E`@1NoD{Uwm89V!HL Vpuu(*0ZT9n#S>IDhni-0^a~C|duRXv literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/tools/BlockTools.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/tools/BlockTools.class new file mode 100644 index 0000000000000000000000000000000000000000..51a348154660649eca12ebaf9b417867eafbe23c GIT binary patch literal 502 zcmbtRyH3ME5S&Y#7(#Hu;|J&x1YAiG9ui21!h#}E`m=qQOKe|sJ{x|E3WZpFm%RCi*JM`G2)nDii*2}P1n4beA3HQ9UkMx7`vMwChUowR literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/tools/ServerTools.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/tools/ServerTools.class new file mode 100644 index 0000000000000000000000000000000000000000..702c2c1202fbea246c1faca995c2b3f29489bd78 GIT binary patch literal 544 zcmbtR!A`!FY^$VS9Hy~8Iy$Qh^nwbhv#cl&N)CtXq zAGuyFr@Ti_6Gdo6CYH%WT3z9R%RJTxZQB8BnNu`Ib?sqc=HEWx?CRqNcgNY>z#n3 z^w24AmCaa^ALMn8(ZGMKHnxBpt->ihZ}6+h*g9(*9tlx Dk6n|Q literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/tools/SkinTools.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/tools/SkinTools.class similarity index 64% rename from vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/tools/SkinTools.class rename to vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/tools/SkinTools.class index 967e74a34deef98a7b5772962aacec160ef8e535..f5aca1c0d1e18b919c53a562ecae33b8de9590eb 100644 GIT binary patch delta 96 zcmcb>bCO5k)W2Q(7#JAL8NApTm>3ysCJLx<6cpu`Wu~MSO|&axvhzU^d7{D?I+>Hv pb+SLB26MEA&*b}za+7B;YHvQm_>hs&9H^G1v?McU^Lge*CIGxR9>D+r delta 105 zcmX@fbAd3!CCJLx<6{V)-q$ZbS=I2ecDPwe)tjMT}EcQT! zF>Ep`qbp~ARXC5GlhJwN zMKmYxWuMN()S-bcK6y45nmZnHU1IgnaB*>&T*!hZ^^cne=nkM0Ctg64$>K3!cGJMr z!okSk2{H>)X0jo#IAa{xze&96s6JT9YrvQU3?+%lpLlgprR?~=Gev1k?qsq?6`#Z} Z&g6#SyUic?Q`neXH88xgd5+i*bpYx~v3dXi delta 592 zcmaD|Go@DG)W2Q(7#JAL8Mm=BFflSXPoBuE!c~--mXn%Xl9``3xqwS_VxTu;`Q$g(GWUgl}*YKHa z&nGrHki{Nd={lC{%<)j^d93Q_(vMl?7?XgGken>drim_@#HPa(4{^j&OxZVVs_ecR zE+8ZBoH}Gg6O90)#>J4%@x~U*%i|~q0W@M9|?81v- zSO>2Ga|$>pr6ynHMKKZ-Dbjr3nPMQJHH!&Db1uI)vj;Xmi*G)~pUlSOt}%HbH@dFP I#bQ6y0S;NiB>(^b diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/utils/Tracker.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/utils/Tracker.class similarity index 90% rename from vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/utils/Tracker.class rename to vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/utils/Tracker.class index 03482dcc583b55f41ed3a78a90bd98db1d74f64a..8aff9f2a740c688ae600c18b2dce8b7f3041680d 100644 GIT binary patch delta 55 zcmX>mdq`H`)W2Q(7#JAL8J4p%FflS%O%zb!C@9J=%S=fvnrK(TWaEP@vhmRqUI6#x B67~Q9 delta 58 zcmX>kdrVf~)W2Q(7#JAL8J4p%FflUNOcYSzDoRbuNlh-v%+H%>Q^IIBaic1d(8haD FcmX_O6wLqt diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/wrapper/ConsoleReaderWrapper.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/wrapper/ConsoleReaderWrapper.class new file mode 100644 index 0000000000000000000000000000000000000000..6c69f8f4a29e5da3f7dad9bbb6761dd6e78afb5e GIT binary patch literal 584 zcmb_Z%T59@6upIk0YpLYg*$iP!Y*BCObpQkok$`E5_e@NP%=!Lwgdi_D-#!ffFEVN zQ_yJQ(oN6p>AA1d_m9^%062w1A2I|wF}KvnM2CE-h2`4NxrlkF+1S!WDCdebP`w!_*Q>#pbyW_Xyfi^~1q46+BVL*o-Lm6BZm literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/BukkitConversion.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/BukkitConversion.class deleted file mode 100644 index bc2b7bd41a2defa7acff8d7910a0ebe9c2bd669e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2700 zcmc&$+invv5FMwXrJ?s5_xmkrq2?wbHA|okR3L@6QddFZ%}LzUO|p(0r)|Us@Fjcz zydd$w2k=pdv9p^dXS20G`9M5r`0Y>2XbKvaa&{KncxN zjaG!m^NQ_gx}TSoD$`W)oifjBAw9ZQFO`H&OK%@labpCc1YU#$$u@1@GOtkPiomcV zJfTwr*5aALppcMOvYbq035;%wqQ`VyaYT;0S-Tlc%L0$V5S$x>GcZhGGJ|1m)GIlz zT$U@N?o3AJSvkv;Fl&D^s&_?=z-m}t-FZq9nDA5PbH&_;1@-e51WRC{lX9aP&|VJ< z-Obm*yrq!z5K01LTE6kL& zSjVTDB*KR6d+p?fjR$i+j5o06HV5=0=9Ht@do<61D@{)IMB7&gOLs(OwHhFTv^Au3HAtV zhNaxrECNq#PfOLH?+|xevwR7iOc*Dw>~QfHqrQqX07Mt#dBvIL=FsAYSf`&(52C;{ zqp$I?T3}V2N4_2AKjdVvKpzyVR(T-+A@J@0d3R3j?vvs+1spxVFbI_Tf5?|L zC-BADS~=c&=^lHj5WF0BE9s_jv<&_~4Zju)f!Maay{ro}!{@u_*s|$E0-v4iO4tJG znzpF{?fqL$bD&0V0?t&te*ug`)Z9cM0wcJJz*!hY`4QhDD2Er9zC-LQz74?`K4W%w z7A@w`5@4aJ1rsodE7XT6m`3cGj&HNAZ*xHKqBf6q=E8O!E?9XHE?IdQu2^{$t|3N~ z&vn$h0fujLeGAvO;f~e23-_$N4{<9KuxRBHJZR}ZMEzx;t@R^h{22K};E9j;^bZ7X BeV+gT diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/DataProvider.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/DataProvider.class deleted file mode 100644 index 2d71e45e47b77c52fb381712f9176076a0c2f6ff..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4941 zcmcInSy$Ue6#jF0f$0kAi*r9OH$buMnRTbStg`)%CX6DX!@7(*%oqPZM=l<^iPUD9F>KLM$ zY>IikV5H=0hGNP_Ud$?*oHC?2Q(R2x*_>pGhCHXrDO1rkF(#SPMMGay(y|di14D0> z0Mn#`fQBV4t;z;NYwY|`|5SYP%2@yC$k?+CyW&@+MM*4}iYm?(G+XVE^ATm(kWez3 zWEKpWp?@ve9?#;`)JQC9k5x&_hzZkBv`n;*@LU5X`p079qpKK@DCBagA{(?p^x(P% z7S|t8%2hNQaz@FU#uCF|oO~+gmo!tlo}1TYO}Xxjq?{tA$-81or$vf^A!mMnQ%Y|usto$Nd?u6aa1K)Fm>|erFfO0u(aiPJo2WjrDQ9(9!OG@T5n8$|Ma9( zMN`Z^hWgH~X@-VDJuSBrO*aeZz!ru^iQG@_+tb1&68o!CX7 z8QENQZ!vOFzITs+4G1!X;uL_fLN+NIlTuP8ss00EB$aEw8)E|{W=Ly9T~A>xSu z9%pFNjf|KqEG#IdIAHw$zd}Fr3X3fA`!U~3}dxGT_Y$lp=5KaoUoF#3mU)_J(txV+yw|?5;L5g z&oc~lu7e9XfhX_+hkTLYG?aIUxpQPQDoX-DB=@fk4Pn|VjMw7HH69iL z5|Ru}wrYl%8sqL&;d21u*k)pG%;&94tb<1GOHaBWZSwk~`o5R>|2r@FXyt5}=TuV| zZdLu-mE|bE#JozmXN#6Ex(_y|Z?j6zGOtW2@s;B;{8-^8KQOm)@LMctswpjb>G>d8 z{_eSO)>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{wFeKp&@hR3JR;?wqoZqxDu+UMfWAt c(I7G!*h(x#5HS72kp9S;!A`V3N)p}u1yzt3%K!iX diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/PacketHandler.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/PacketHandler.class deleted file mode 100644 index bf5b8d1049d233bb980292e1c5bbab1e245a672e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1427 zcmd5+&2G~`5dPLN2~9!@15EiH%@CnREmAQA!*Dnu(EdfPbLcB%igUWeuhcnu_8 z08U68cmN&>FZpdMJz=-?v!D@%6Fa~a~{=&u8{Reu^};T zkY(shaurUC1cuN3G0g+d=CKh+=|Li6byRvHRXjH;%=n?4^Ve_We6Tc^a3UHZ{#@_p zk&Mk-kq$QM5>M?Y@~tQ<7!u(x|2ai((~3(XF+5nR&?z+;+^H~v;nC7lf76wry>0LJ zOJxVW^1mN`5Hmvk?`FKwVD(I;V$ajwQQY}Iu5Sln%#GB9XE)@qGGp<^suPt;HF(~m7U%G13_D{`~Uy| diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/PlayerProvider.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/PlayerProvider.class deleted file mode 100644 index c8fd587f434207c009673cae7d80284ab9b37401..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2888 zcmb_eYf~Fl7=8|kEQD>jmQo59wXGoutYWRDp|o5qUIClC(lrXX zqLY@-9m|zY!PvBHnRd)o*VszuHuI)yIC3>B)2@}XjrpuulFq!7+p;p!(GaX%M3PD< zYTC3jS?LI9c~53Rpn3M0xn&wf*UB0RGanadT(H(`(=9quAa!tcq-wadG&32Wt8yCb&Ec_ zTPrOGBZd^8-|_>XOw=hv9%5Rc^B~|-z5;skY-mU5J{1)KwhYEK>H5|PEL1b>gf6HA z+2;XJo|(`wiO;z?&4OWCcHx06G0~56$KxgpVM@m|W|*!N?#DzW7JI1RBv^5E^ns39 zB$#BK{Lh({Xc1t$Lwc{;wtf}e2y zH6hSZVew#8E-@8PqcN{)P{EaUS{n0}zPo2o2#Z+O@s+B?^%M^Aaa{B-cEbMQSnCcq~R zV?4b3aB(E1u3zo7dk&Ii!L?|DyV zJ0-TDosxSw*Xf_bySTy;C7=&V`}+shKG<8k$~D1qcb#9Q`327_q`lGC_%IRs6RnY- z(H-4ItPXE5v>l1<;KnvL1U(3CY=Mh}&_y#Yv3J>n(dP@^+%2k5`-X9wN)#ZS zGgQT03Q(N?28h4adt$@`b<+nWdOVtdQW*>1KD!vN!%IA>p79|jV!OC65d9HD?0q4y zgSokZKd|@`p@BD8+(B~xP$as8m6gOUz6oGCw(SiQ`^yyIFA$n<@F1Glzk)XMdX3B) zG-R0Y@8K$@$l_C8kl!JKRYdU|F^`NJG@Ib}$S8RfDAwcLYm$s%_ESicv{ic2pW7!$ kovaYlioidZ(lDeU^A??NA%a1b@KjL8!|JJ@aK|Jod-u+dF_mZ0BGxltW?Mp6Y8~JZfo#?zvqV3SaXZ;|_e) zec;B`;wBKjkt%dsN(Gl%4P;yB9BhW;lmL%@L7;OUwgaIVvK1LhQ)Q@?8snkrDl}RJ z(jQ%ScZa zZF4JolwsPqe%GkXFgqBgoW#j+k`|cMY?LU&^51Zu9!4S8(xQLITA_MXDc}rAhI~hu z=DiFf3#vk`w40V~B2V|55tSlh3QYw`sHbC7e<;MAA#N>D{(XY2kBj|*5Y=hM_u@=O z9a4zUqs~9L;{(p{T=9<57UkbrR>$;D?$7YZ>>bdl(X9q-`l!cYAxD~pNlcNvqM1c9 zySM)e=Y?h&oafA$u>_ZGqE30NY(=qXsiYAn~V OP8Jq6;&C&HWa|q=k7L^a diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/VersionControl.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/VersionControl.class deleted file mode 100644 index 7551ed4dba0fe3ad0eaf227bab20c0ef01f870e0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2056 zcmbuA-A)rh7>3`Wh0=9XtYU5qlZH~l!0ZJOs7TeN)wHV zCSHISW&EaFce|Wzd$K$4?#wgK%p~9Z`TO%XfY*4H!UV$`S7^KAbyZWGE2)L**r(DJ zO~ntj-D`TMXI$G#96F+@rRUlW>Ot>{=W69SDI^(k$GpdFhr4b2!@)82V@Ox3oAr8a zbAOLvz8e0oYbD+G8p8|$I-0w>!JV#{Mw;OxnOG4MD=@JJCRS)-ohh#;TS8gAm7XtU zMdki~X2`a<=Cwh8T5~n#qPK^Jll;`Wbfw;4NEAyAhGfNSi3}3RWs${93iAwWW6Y32 z9*YKbm0_zG*EPBaYo$gS4A-*A;0nWBmCp8k_w+!heSY8wb2?s=I}NU+$%BtceIz>! zZ^xXQ=4%T*ym`bdmf})}0kr#ux$k*Sc%CCLhXKS)*Jaz~x~phMw&EKO)7Hxy1k97< zj;p1<2sJn3gQE!IZjZ|d^=b~k5Na&FC}K3dD8tvAH%BZ!oAU_$Mmd)#g9LZt@82a6 z-!MmpHQqcCdXKv;M<|AO@zD_i*;U3w_-+g2w$(j3k(!F^pfrxez6>G5-S~!=DZb=% z=cub&-nq+=srRp+U1{pkLbQHa=I%%?QwdAZr8R*9CNV`R)lbt{G8QewD;+XJ9YZv&hx zf5XxjYD~aDj0wmf96ad{rd#n2?$Y0T{l3eT@8dy`S13QkqaZ(~Ttq3zWy-5~66B|p hEf@)(_l#Q4gVnCm9L9r%tMkPQLt-pg)r-E;%YUC*aiRbK diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/VersionHandler.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/VersionHandler.class deleted file mode 100644 index 0df48d0f98e2c16df9c18dbabfc8055b1a523abb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1000 zcmbtS(M}UV6g|^!DXp~>(4rtDylqS3KAK3aK@9Ps(Fb7Pr^`@=YsIjxpVJ5bI#nk_s`#7zX80#UKJ&QcZssWB%PW_eKp!DGYQ5zQIV0C zHkd`}_(s~msLNPIR;Ni25<&Y(CKs_XRd@oeYdMoaER#|2Wq3`TKy#MEj?=`NG!}S2 zSWc%PI25Rz>QN%?)F^@SS;)vrPbb>;1wQzXWbcGz^GWJ9-f?=N>L{bxKn-hD^E+V; z0_zP_up+QF-~)Z0j)%&e$zjaa z(A#I%${coqXRdX$ReB|?^7q)>I&B_#f(A1~`X$12|L;PswimpAD1@>LjV8( diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/WrapType.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/WrapType.class deleted file mode 100644 index df6814af17dfd890ffacf1814f2a5b66e4daab58..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3911 zcmcJS+j1L45QhJ89LsXnu^k5!0)$fl*$^)TCxJ)^bh0C}k&L7`7y)K2ucdWXyUJ>P z0&4`_F%W{SDv-eu`j7 zAmLhp-u8CNcTL?f-MU`f*rwM6hSO`6oIu_L14w7A< zqYoR!!qR|JZFp|IH?Cxv>P4fN8dRzm9nU7KjA0NgKEm)ZSjqUPAH9V7)##b#HjJ7v60I(^<2SnAUe6UDoj zjUXm)l@2|eyibGuD#zOvt_H}Z^gHpc3|&XSvm~)9Mo_ca{>#-^Z#pn443h~ zhAWt-K9uOpaz6HKSKZ+8+0`fnKHx!&@HDP!h+>Yl1-7JiUBelreax2BZfY1;T7oU9 zB{fVa?Q^!Imew$(v@BavThuVEv|DURZCS$$N;BA!T0z5$N?Tz|Y9$RXDXqem)K)dT zthBG#lG@iAURByRY)S1q4X-Kfd$vXdCJef+6n2^$mR~Wc&kCF~yqf8(n!e545vS`` z5Uv~FD_Yj3z;tZ3=g7}EX1h)0cHyX+sI0`f5~s*bhAu^pwI4cp>gyT#`UGEQDqa{^ zU^~_mP~Df}$J*_k@EMQJ@%LamArXSuDbIJHDWk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2rq zl$m4YT(hZRDMTNaB8SDbvTRn_CJ`ukj0}hZy5X=M{j6s1x&=FBm2e|Opw{YJfhxOI zryxFo5edVs_;52&5-hn>ID@lE!|Aw_}!!(W)h~Q7L0GKjI)RI!u>Am$3 zy`!bI0M%Za3_U@A+{zKL#(I%N^iNPG`~m(6Y9~|Z#nB|D@m>P&(qo)09cP@XiaVa7 zr;x`C-Nq>Mn8U92`6zqckVKqbkL_; zanM!;;(Gy;#P*f=0go;SkM85q(X!LH!qIJV5g~+r5_afHdA6wZofg;pfDyce+**d; z0Zl?@oi8+u(c4bGOJV`#1axM{EgoAbRA5MGGfEOhw?jmR{Q^Es!NeTHzF?|~IQ-%~ zlSo1`?>sP#Y2wA@fN;;?>(MEZfcSniY#6p>bMUHa&l^Q6iACH?fJfHRMpo1+bz?!5 zCmez~Q7I_}+c0?se}?-Kc9k1l68;Km=B;$W-RB>xZ^AGZYSqkI8wGlr7Osw~%@4X; z2De(fHh6w`qd7&_^L&`g?C!wbZrl(l{Hqj7m}AG6-Gc7ac!iH}IbE?V)k@$YtFkqO zg{hsuBMH45Po*(kj^anSag4PU@GSr1`yGE1Y{~pe{I;hbW5@6OrwvK|ieX?kcJVjm zPT;o_;;FEU{mzpi_HaZLY;D-b{{1-M^!MNy?<=-)#}9J62haKK=biQoe)~nXdvVBF z*Nek`{}HGEsNa6cY4`crhp8TSmdliwj|;d+j5sb~*u%QSmcZ(K zirmfg;4(%Z&6M&l^#5?jH@e{I=PJZ1#T>0 z&>;sm?auUZyF6U3#!cLE#OuNb_>gNqB7&=y82i{CyUj5n$0xoViX+GUCOKx;kz;sW zIf_JGPmaUH7GoEn`m>rO>Q0Kt@`yf5$plt%@B9kxq?b`$&9ZAW*S(XlXez;$&EGcE bQ0G^Sea^lw@Bm-q8}^6*{ubZidmQ`+8>3Gr diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/WrappedContext.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/WrappedContext.class deleted file mode 100644 index 1a4b44c57518e9316c2d6c405524fe6ee0b4dd97..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 822 zcmb_axlY4C5S;}lh7j&>S9A#lTTmd8C=vuABUw-+3Khk~UcyGs+FEZQd=?cF1s}ji zA!dy!0v)07-23M6d;fTS1At@Lb76+TnG%Ml@kj^aQA;Cq%7;>kK;xa^4?#Rk&~Pp8 zA`uuFD;}ajexor-MA(Xz5o6oK_r)63oIv8C;lSuSEFH1=nnQG!C=jg z1B|+;rS2(8<(RpmG3I5bbM92Z@Ulg7%rrC4q)Mb)f87 zcDCOrbPKE;w8kC7D;G@x=knd1Lx;QjZdS^pp~PNKD2JrGoBsm3RO)Eaowo93QDE2g za+45**GX^lj)m6=yFt+;@sUf zEKqo(xcPcYmeoCO-b^t{*6LV?+XQM1LNz0BN4jk>c|)MPlMuLF$D7bB@Z@sK9dTVu zq|kT@!iGKu-avV3)GQ7eqc&qK)#v66d)O#iavm&JdlMF;^P%gt?zM6P9c<0z{ALOv z&*A?!v(Q_gf1}{PS{N>6mC)6aNT5afORGR4-8QVDP2iSFay)31CYT_TNTVf*c5Kzq zA+Wk~pvSd?%v{ou#aozLOEXSxqUbu-<7S?B1vaK*qR4a`_hC6-Nw2+IM-5iUQKycT zNXpTDI_jXy(fvB=u}Y4*bTr}?CWBnjG(39JafZY)WM}%!qsv3t$G#2^V2_5k3aqc7 zITohiFnVTfz^!UU$>7(Fy=BX0<*UO(7}W6a;*f;dMrOnzftJNo z@%=2Wod%}USUcb|OyU?G(QyJJ0@}1;m(3$%*CrVhxFiPfsEnDnUjb;a-!@!}$C$&n zI-{OEYv>q7jvmV#ZaR5^j=1RIrI_gcQUD55`T$HFV;C2x^<01RN@obDB+&;;igrri z&VWl;{TDD`W=_I}qhU&*`#Q}ZZ#i_hV3^m@Ngp=HWh+Kk+fQd@_m*Wg@QgEs3D$-iVA{B3*VcW0_sIrb} zoMzk=%8a}FugW;?X+ctp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_6M0^0;-3#eW|%en2b(nXYOK{lrapekXda?= zg5L_?c|0p{5nq!Kf3pgeaPfn>hatF6NvZpH0x2b;l@%$6#4+Sx1RRI-;@uM)j>w&p%}a71?=Ps*)>+lydNm^RFHwXZa6|JZY7f^Xd0Ofe0S;!WB|?g zL*?@ocanR)5#*jULN$KGn^pL6kU(EldP)<^%r%co__-SWf-dxHHTo_7fIq3xpYaO* Sf>(K8{_6Kv{2l+my8i*$^@Cgh diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/persistence/PersistentContainer.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/persistence/PersistentContainer.class deleted file mode 100644 index d564472feaeabd69da5c714a09aafe5dc5073777..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5718 zcmcIn`&Sg_8Gb%kScFLwyu@1~isJ5~j@mYDvq)<(Mhl`9#b|CFb_ZBlb~iJ#C?;vG zO^msjG--3GZPVM2{h>Lh$Vqcf|A78cJ$>Hq8+L{TS3SfZU}wI|`#$gUUgy96`}cnU zd>?;LqDf)2`fK zSiuk6QqHx{EItQ=@dcR-vst?z`Ts>nV&3uhy(% zwDWW*kFuMm-8qFW1E=VeChgPXmq`h?){GV=OHNSrTpl|&BtVGI5w;W_H#Z7p`*@+~ zaxa;i;%zstpf2$wjq?I3tHu=$HE%4%hMhUkKyqo_A0E}&GE2q zM=#Q%Kcnz`YSp4wiXdauJ_|{-DXbl4br`A6jJw`BXS~RK>0;_S#WBY#$a}b$2&M|Y z!udynh&ktl(WWr?Ex2D{(^4bmDvO3(dK4D)GdmS6J4yx6J@qD!7d>_VBtrSVr(f6 z%Wf-q8>3w zmo=z!3FD)#^!q*aYyGh>3P~EsCQ(#)B60ys-?W=Q;rLUOBAQDUrch|dG%8YqUsc!= zPo2SXF&w#cQ%rFFAfB~GmG-|u)3bDCMJ${;LbDX?RQiR642o>uraJp1(L zR$>1`-DJl3g=-Qgsq{$^^M-|Mc#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88Ij zz1=p&2FfFBK;ZetVE1klmJ&|j%+7goiyi9u3;VCJryDpR@EAubJwD`u?y2&aM=X!S zh}h7x1Z@!?Il2z|i~dZ8+$@CZ5PkwD38TzM(1kwW(0ob;aGid$l`eLkjJ&pim=Bef z`dyZ~Z0|Y!CopVVveM4atkm+ex9FLmWBG_YC<>NfXGBJJY#nDR4W5t&4_MP2 zgPjD*q0v%IV3J_Vs_Jx1^Ru_<8Jiw=OrMpeS8db1rErgJU`k*E7yMO054wElb$sZx zg9eS1eXu;`SyuQwi^I2OS>9Yif<{<1RjEx@$|de1oYPmTrTVF*dxjJ1m3pbY>O-Za zQJ1AgQ+o;TIyT>{liK$y4Nkgf<)m4mHJVyFT|1^fcyel0e^t=uTt2iSwP|RMH#em> z_o*qiQK}VNljpZXl}_uJ~vx1rLx%LG2>a<0#DuFt7}KF7H}mvdGyJm0DXo^RCx z&$ry<`Iei8)9}uc(@cxcU)c@jr5{#{@i~6@Y?8{2j-Od=)S!K?w2#$obj9jMcf)0= z(P~)6ievMRBz%%0;vNvRc7|0^CB(F}XKh=hIxojlZrpU*Atde{6__83s=lRf6O)cg zwJ{%5W9GJl**!}8_~$m}Vfy6Q+av4vf_s2Z9vQ6tTSz!cHZ9qQFKaA$RCfsheJ$a> JvCk>r{s*CtL&pFB diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleSyntaxContext.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleSyntaxContext.class deleted file mode 100644 index e685348e11341ea8484503277f39a5e2609ac23d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1491 zcmb`H+iuf95QhKF$;5Tqgq9Kx0oqbXii9sHDw3;8rKl=WR4#&oxZF6~bgRU+oJ|wN zOMwJbfW!mvP>5OEszTI@$|X^}v*Vr5|BPqy`_GSG0JhLDkYQ+gLfJ!q6uM#@N+rUf zJ&>MoLw=;}Q`a8^T-l*G>I+v%-?O`1aeEx{z;4Mw&=;)_p5l`|-&10u4CEMIrXju~ zVj#K+hrw`TBE$10iLi&!V}fH}cyf~LcpzgruSnBwmj|Ri0XPhWZRtt1!|iqL2? z2 z;qbo}n{q7nggW3}S3h{G-bj@vL)jB!T|!+uPWglk&n^Rd{ZEiHhbnFxxJA(^-k60O zSZ1(D%ao1-(s9LhiZXHx+@t!ZL0#DE5!6Ht4|HR!Fl=6;$!6-M8*GX4JK?9??sKna zzv-ONlsP6f*h348SYj|+(P-{V{fes>jNDTlPMy$_J&&tVNXI^2wPZBO+o^hK$H5AT z&(i-3O@bZ~vhrjbxJK6^?e>wOFJNw*(eKGuls?lgg9W&~RHq2$ zIpGfOCIp9MYeMBGYVXe}XShELs!f3^F{r#td8{U&bz0**zF}=PnC3LfOlP+qSI HTI+uSJk6Dd diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleSyntaxType.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleSyntaxType.class deleted file mode 100644 index 29d4f88dd1aa61e884ad6fab1750be39279f4517..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3269 zcmb_eZF|#H7`{(i7uIFKTA1?%si3ayfcS=vwG>C@6sV)xTGaWLwP)juG^uI24f#`g zT{6KBUVipRdHI|q%d)m$+xeksa?Z*9+~;+FoTlk181S>%p60Y}GDvv|#9ubo; z1%}D0*s=__>k#JZvA~M8N};9~N(7p0*wzkdL`pC$kBWM;`{03a^$>ypSB{HO%u8Mq zMPUiIM4Ymt0(uDzb<5Ss634>`<&szl-EQ(E;z+AFi8BoGY_6WfEanuv$Z&0#B-eex zbj-PBkc$lYTmXFB>1d&pSmq-l=Mha^75Z3VX& zZj7jEue(*;L78E?;c&y{!6q0UjYn^|zSwK?AOQyo%0#WHxQhx^*{(cdqiNY5)XGK_ zA+#15=pgFAEGZ2?s|;7iN*4nm1cj4|luc-ZI3<+S-*oI&#CqeJqeAA;J)?iE;v1>o zw6C8$%)IKIY#&xioQy=pUG=`kR)uU~XM4Z0uEC`QMSsKf&45 zD^GClFU;=a;y&gd<8prCF|=Q4NgVIcHH8FSXXu)u!#+)?>>0dEBeOmX-oyL!M1TRE zt4HQO22a@^UpgqMB!!PuXAA5r4fH^Oo+#0P4;>jq7BQgrr zd<6TWLD78`}pK3K8yEl;DQ$<<1Y^dOXG8V z;cY67Dry9OC|#OX`O?X`FKLdU9-(mWxfH(Yr!fDY6xN?ZVIAKRg&4l0{l@TpV5lGd E1-K%xmH+?% diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleWrapType.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/data/wrap/SimpleWrapType.class deleted file mode 100644 index 17c8d407d999ef0b26ddc04f46a76ff19a3b5404..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2335 zcmb_d+int36kP|f2n@YYZL6)?dgW3(YPGc;Br!BKCd6V&>Vr=Qn6}fv%w#xi>8oF) ziN@3iKfsSN?lTMn1WYL5VK{Rxd#| zwQiVt#o>oSJ*!xCn+w&^4{Lfw7?!D4x!~%#!)G)B`uF_q5zK;j$Cg1AAylQe=NLWon$ zByQ4du63Hmd74q2hqBPKcgx?45(9?YSoCq1T-;rEUE+R6;u3clzEVsJcY^jn{3V{^ zzDGSgiPBk-C=B!09qePilNZujdCfH_7AEy6Oe=u~~hlE0%Bj!AnPxQyl?x-Kh!HliaR9G7CNpgD+@i(dP* zh`x%2n6Ovq5Z+FvHrknR)SKNYw-sIptAC$gJs*A8+J+;cmskpKoFjB5+vz7k+4KwA qlj)W)D4rwUtz*LYkKe3O%QA#^PB*V_WnqOL8u2~`nGjwZj^P8EbyKnc diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsEntityLiving.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsEntityLiving.class deleted file mode 100644 index 6e019fdb0ec655a05e5a34bfec78858773b8f04c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 267 zcmbu4u?oU47=$miTCE5UK7=l2baaq9i4KB;TN?kClr)tzR(v%FAHata(~hnV|8X1# z_x0z_9*vfMHUT+f-Vsi%2ywg!A*_#1J1l>aA+C*$>dN XW%26_J%4@wF!O{FhONWMYk>F*-q2BL diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsEntityType.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsEntityType.class deleted file mode 100644 index 571d1acd77bca640146fd0fd07d4f4fce2c7df88..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1205 zcmb_bOK%cU6#gzl8KBdaQbqglT@}zc=|WvVY6;TV$Rp`c3~^yD;{~S~1~M~X_*dF4 z+GuQC`=gBKPO*#&cg*76bIv{IJFjnk{r+|V;3e`ZA`E3m__{Y3xu*E+TE1{Sy>B_f zba~g;$L63vHOR74q;kNKGEHg|e@#ToS(7E6b< z#^DE}S*pKgs8r{Ws6eQd`cZAWRjM9U42J#pbApW*P1|xTf0seY=2{HV^5CP0V<8D@ zO~VRO46)+WC6lerx;1>)a(ab>Tq{AoX$=dAN$Hvf6>)}@D$TP#>UV_OVYu{1Md#5wLvU3RdtBfuBid8i8T;9PW=?+R?iZrUWR?rH|dh-VRYip&u}^w=S6i zq&6f^$P%S90ZF(;(q54+zs>Jp?X;$xVd)gB(I2EKCs;L3vG$doBe+gyl5P;(5QIdF4D(D}(p6J~_QLcut`r%)50Y5wxy?C}RUW#|7hvZP0?#YA diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/packet/NmsPacket.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/packet/NmsPacket.class deleted file mode 100644 index e2fcdac9e769519b259ccde52289d4691ae18692..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 314 zcmb7A%T5A85UfFQc_f4nG4{~}jGiDN5F{b--i{3p?9OgxW`X@R4txL~Wf(WagPuI} zyQ{0x=da@lz$3Z|8VWB~0{OgjTK3Kaah@_`MLS*v+UYziIFOT7Dms|lQo(u~5%bJ1 z>MX&nLVv?Mrj+fPUf(xyGr^t0eMFP5Y~VxjnTs`tYsH13GMLoURw|lIrIHVY&azf9 zHmNA|eh41EZ!5HyW^Fl?E)L(GMuXXJ%Hi|h*6cqDhEcM@O|)kG570nT`xe@D>|6j@ CXkqFA diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/reflect/FakeReflect.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/reflect/FakeReflect.class deleted file mode 100644 index 09798897ee8f95b8d214f02cd91543a6befc4cb1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 9490 zcmc&(Npl-T6n<^VcC08)LK2g(g*~>ih$V!@Cg7MDNK67Tm^Hvy9@&#fBQrBfYzPFi z@B6;57m5QE5K>T36{_F>7j6_6E?l_q7bxEA?isZ;J<`}7ilicqdis6ud*6Hgx@Yq9 zKi_;002jhX?a;ztn{9e|w^DTq=0V5uOvlZaE!!+OM$yY3C{)UmhL?BDV#zFcR>k%& z^Ml5IbB`EqhctstI5qE1+nzBsIZ-ifYfAnyCN1BH?4=EZ^kDza?F_CMS~!7T2AM*o zBq=iJ8ro+ZF!EK;D&+@)ah$cNuTZjV%iGEz)!j3KBnB#DW(F86$wDV&7_{~A`yDv6 zEDNpB#$f3X>anX@9yOiojnR_H;JBem!6=Owjzz!uUaf~$1$eeESv-3lPu)@5z zM~RfC^=4o#oYoGfGFYY408vkeGf<(bU9OB-MIJy+B21&?Uay_%s5ZZsbUG^w?XU>7 z^d>A9H6Ay;-3M*cVX&fGnkh;!=oq%fZNsZNsAN}oMqh3#W~yz>ESVn8Sc-5172EZk zYQd{G=wP*PQ_qn>U&O6GMLAi^SQr5)xg@6<^mUEtO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z;G9`97>4U5Zctkx+^0BhbZrg84H6?*J0Xncn?_1n(n=hG8ztIh7%i>zQ0IGD0rNW_ zP74+~zS9Z7ZkAwIBM>Dw1ooPunhNIUR=`qj1#AkxZ-HBptLX2y@vKCv_g)kA_QLIw zVl>9bO)&0&JDXyB(hy^Yj=e!l1s>CFh*?_?YN!1|(ahhoXcdfsi8l4?p@>;jd+r#F z<1F$x5qPv__ukM7Jjy*b>g_wAh-fqPY!Msvy9m_%!H!XqsCYmLP%E5k5o2hjSUFc! zou4@BW^q^P7CLn%(UUmTkf*d(Cp@CTZ4V@mqEnGa>Qwj)7T`C_ z!>=(FV|36DP!BYzr{5!3>l8c46${rBd7Q$W%-X|4`uq{Wzorl2Qy;>kdQ-GNW251t zUZBQ3oMUi~3DwVEO;HcQy@;l2a0u>`tmFInd%k{_9m7?2SgNxQYlteiJ-2?t5xBp8 zBgU8RydeM@xe-PWG%_+Gj2>!i^oXR_jf;w!*dnC2@d!K`ZPkwj^td*tCmI_)r8RoG zvC*@7e$Pc)9m9jq3wo;;8(Y1sCHP9TQ9o9{UW(Tm8|kHZBiiT~KKi|-59;m4R_{uy Z9QIl2!x>8On)DHPFVYSzKH$ap;lCYR#YF%B diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/reflect/ReflectionProvider.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/reflect/ReflectionProvider.class deleted file mode 100644 index b868e02d30bde85c9b5f807b4450f0d5305db387..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6124 zcmcgwX;&N98GbGj49G(u1UoT~sht`Z34)y338BJvK$t?!YGG`gq|P7)kkRJR2ro&S zw&}iaY3uGy7k5e9q^&VcPJ8;PAA0%+`e&Lx_s*3x#yUiBa{5IxbLU;3_r1@1NB{co zTYm@8k2ej}35;iLH(JOQouqxuNx8ODh-Ok*JLy=e$O^JL#r!+0t$F zTzP56$*rfBY{x)Qp!JHiZbj2pb|pH!c!fFw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AravKh8xQeepeNG1fz$>v|G?Es{X8(9Q&znW z>@3%=69r8oop5>Q^&9_1Y@Rl7l@5!wx?QjC_J!TKy-};%o7LSe?bhwb2!Y3aA6E== zjZjOlJN#g`D6olj322WBJfK&7t~<&=ca(wdz{~gqy;SH>u6)u5{aFwCPvMnvFrQYz zoaD3Is!huO20pX3b<)bWN5D;G-%Z-Lz~}J=-9#hWRBOqU*uWQc+xYiT-e!<*J6KK_B4x&i!< hUhD89{Fqny?w9PkU*R|SEq=!pdDM9wf502q|3A|Q>;eD) diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/reflect/Reflections.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/reflect/Reflections.class deleted file mode 100644 index 98759c23deef0c1cf0fa59b97e09b8c9f608d4f7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1468 zcmbtU%~BIV5dJy|u;=ngLrqgnTZ+P;+lBTa5`($hEo~qhOBnX8g(Gi9v>_g*KMW@i-si$;}ypg)}HW`K6jM~|BY%Bwkj8ov`okz zT24b)HR%T~p<28+>ub;HsHXJFrM)!9Fp4Nv;nX;x1ZQ%zVQ*Nx)pY&tai~IHZK;|{Jua`?KvzW(X z5(|XcFt-0klEV$$gwaBLeMneLKPm!oKfIJYir0eH>xDUA_~vPL^UVzkDk zzM!!56;nO`3|qiVnxV&$!WGOw|3=)sA=fOfGIEahFsDDC2W44l f;2ukznTF`hV)2h!o~g<7nS5g1nh@@Xs0V)l&~tvq diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/reflect/provider/GeneralReflections.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/reflect/provider/GeneralReflections.class deleted file mode 100644 index de42afb7f2549c5d9eaff941af641979ca1f2b71..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1255 zcmb_bU2hUW6g>llrOVdZRa-x4>nD_?`{)CWNhP)+5@HHsd@&i8p$yp%GCN@XS;nMI zH1P-cql|aAizPN`l=!f-GiUBSbLP&uKYo7w4&XVe1~LpsfzVDAPLwM?DyfBv9A5^) zReYeGsT=xZt{o)?o^Z7cgW1#>t8gm&LOF*b5Q=+8ze6GeOAId;^<*IR3x;gD(q&kxhkap!p=iNEfg!(_>@O2^%|Z@&hSerjs5S9> zLUnl06AX4Ubh+2%O2+F1G?7J-`1DXl47o_?$(W&4Ui2Opg?W>fzE8FRH*k-kv0zm%tFiC^B@*K*!L>;D8Qzwg zBR=Jh7fWetC4=MI98&jq6xAxtSa0+x(EMaP3`HPM(iI=endM^lrL?sIwy3lL-P*)M zJT~x%VfWuSEIh$edge%QX~fv+suv(um7VH7|eFk z!w2L5hKVAgh*vd4^q5y-w7y+ut&()jd=T%U74KHuH}oMJzK$8b?f%PU=*R6ZGHrKxzKN|_olwS1B4;!#*`>%8JuxlZRJmj>_|x-+p5JQrog?~@t5WN4kKQrUBcMz23+@UQhmw$Z?52TimX zqL{Ya)kPxBNF=#r*o}26^06?=)vKm&A5_I~8UOQ}1BS4Y_Ew6?NIu)z(8A+htWCy~ zdOlZ{Cr;A0utB`mGqgsP*}!QCvmXRUe-iY6GcdG=OPg<$QyZ- diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/tools/ServerTools.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/tools/ServerTools.class deleted file mode 100644 index b7cd297179c16a677f5ed33f11a1bd23287344ec..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 550 zcmbtR!A=4(6r94s>WYF0-o1ebd-MP?MiNh}Bx3MfmIszBThcA?U7k!l_yK;D@f9(e zcrspQ=Dki|C$DesFRuX3aU7x`aG8;lxmntT)>b>Rxt!~a600Uot`aj}C?_pVQc9dQ znRLdaxg3yPk-hgiL?BR`sg;tc%BHeEnz2=&+|`+O7Xrmrdngd}%$On+v0Fh2Wr1qU z&)hEOBc7v1DGAhLlc;p4toHS`8MsHC3tYwj&DjwMb847rlbg1L11jGZSI1w@Sgn48#RtZa1!`+QsA0M!lGaJb<*j@Tv8U@V~d E0VhwD-v9sr diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/wrapper/ConsoleReaderWrapper.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/reflection/wrapper/ConsoleReaderWrapper.class deleted file mode 100644 index 86eb9658820acf286aa68d66f8ce72fa2b99bc84..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 588 zcmb_ZO-}+b5S_xp0-_-Jg*R{D!5%$mObpRPT_q6%iMO&8C|S0fwhR6(PbMDx0sbiC zw4l+%qnEy!>3j3}{_*+-0LQTJLx#Xj%nj8tRUuy}VYt$CCSo2cHZpV`%2~n;ReTij z&ZB{%ZT4|Hsq?m4Eo>^s7~3O(TK%k+8InyMIe7FVqwk*WSgxX0k18G zyaZV&mLUgu0+j$O-lekvR}X9uaRRkKhAiqaC9J;+dS)Utf!p98TRtIB9COo2O_E}# zwPq`D{R>I^ZXHOd2z?%F(M^*?D#M3vjz^qS=xf{gkB{6aO7(<5>EbEmiCviXVTVBd zE9q6|`-ebbsMx}0Ktb1?;8NJ>8-FeL$focP0ITEq0P<+z_VD%5qlg4CclZK@XEZWU sT9GVu4ej!hfVd9!P#aKjScOf8wH4M~(k)bYsMtp4?(Yaj_gsa>Cybbr;Q#;t diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/skin/DefaultSkinStore.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/skin/DefaultSkinStore.class index eaec4491810ff638a631ea89b7cbe2f81205e9b1..9e80ee96afaa77b27735884e12ae1fcdde90e5f9 100644 GIT binary patch delta 122 zcmZ1{y;OR_dd7f>8|)^&KgVRFF}aXMbMi|@8AkKT2N*Rb>ocV=T7twj?_)A&Wb~gL z%VI04pPQMNnp~8aR-zxAotbBCXU)ivJXw}iesTtj(dOAK`xselG&G~ZMzynLGg(2H Ta_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605 zrrZyuIo_*Klv}qLp}eDURW;AQH1XtMGOyO3U zqBX5Rg>AZFk^gTX*uw+C0K`>W%%!2wh1Mb7=M@*xps4tqW}{)+qjcDgg1%K04Dt3a zb3)bVxw3`pUJ>R%n`+)l$dP+|2qG;nS+$+4o;AjeVq)NUAu};t)bmLf#vuBv0ch)Y zVbH1FM0eMZ;i&VWnCWU&t+?cNfH+NCOr)?^n m8y$|jak~=5R4`Nf&eC9l=VzJLFAz5?kxU&Xm6JW6cKioJk=jiF diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/skin/PersistentSkinStore.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/skin/PersistentSkinStore.class index 568528f11e01fbb65fa008714a8c21813e391283..fc9b8d53fc9acbf3dbcb47eb62fc1c23e24b1f34 100644 GIT binary patch delta 444 zcmbQQa7JOmB*x&$2bokk3X1Z}GE-8ECigO`O?<(}7=bRTI@z01kSR<9U0jPP8beHV zGB4AACL6FgOKC}F&SVQ_8AkJo0xA$*9djO|GmwX{RhmVU(E?<&TuNd|qJCmQroN{O zkQGu{kZR4vpvPdq&Y;i85Qw6wmr-@{ITl{V_{n!z)FvNdQjy1^Su>20fu%S*GmnwM z5@Z3y1xc*UBEA|vS&3zd`ZH5JXMVWc&*0`LY8O6xJoSs_3$lyC!pUrl1E}M)< z91i_l2v9ubDd!Y0GPatGynhq delta 423 zcmX@3FkfN9B*xIm8#z_Eic-^ZQj<$E^YbPiFky^B6Px^iQG2p4BR5lo2Aa&o18QuV zVT=s1=n|VBFsd*z*@A>M8H*?DGs`eqOipCi0J2M%^B7$xGqS26**ck@MH6U8BZsVH zN@7W(z6+2DsVqpf=3>xeFkolUXJiOQ(=zdZ>g2O5yo^DUKeCEUe$OH_xrswY3RO4A zX)MLrnR$#1R#2DZvNkh1fVBXXqgkdI#mK;%o?61l;0IJ8JUNO@ORiWyH#09axhOHM zL_Zj464*tqJPb|@Zj20pFoRgZ_D+7x7Q&bU)~diRGC7`I3+UZW_GV^V4b90LI6*v1 ojs~V|4WLJLK%Rwa6XTr8Xbn|xi!+@uaIzDZ9b@t42Cg%#0It7+9{>OV diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/skin/Profile.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/skin/Profile.class index ab90249e0eac0a4a576ba5eb312843806c2e060b..b0ab9706878fe038627a5162baa464be65564c93 100644 GIT binary patch delta 161 zcmdm~@l0dGcP2*L$q!jICMz<_Gde<9qQW7S1*tp?HVn3m3@icu!6A$c&XW&vYXVh4 z82A|+7#Z9&U~-e+GHWxYPL^cx2dUg#$KuP#7&7?`tL=I0w>qx1Ke65y_g$>Fv~L!gFO!eKZ64!gX!dh+;W_7Ws@aXj2P1PQG8r@aP7YZ`xQj?1k(@OM%vorIo?W`FYIMP!~K%8Pm1{)2{XpsKRj4bR- dOjZ!K2^%jHQ-;Rmj~u#_3plhk&*pGp1puIpCmsL* delta 122 zcmcaEeP4QmG$XUEhR;L+mB|wrSs05ayD_RVS|GSn7!#PRkfi09j2ZnV2Qk?KmG(28 zV@#PG#~cV`uV3zXCkkk6wA{|bXgm2Mljde=<|q~b2J8#G delta 44 zcmey&_mxlJ)W2Q(7#JAL8Isu3ysCVynoU@YEfv7L$0Zt@2vO~&HQlFU&o08e8L AhX4Qo diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/bukkit/Players.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/bukkit/Players.class similarity index 84% rename from vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/bukkit/Players.class rename to vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/bukkit/Players.class index 96455cc96f7cc7212d0d71d32018bb8a7fd2e876..3ae39753260fe6a4a8c1691c088522f797e9cc7c 100644 GIT binary patch delta 39 ucmdlYvq?ta)W2Q(7#JAL8K$u_FflTiPZZGDXt{)u$3!CCkkjx{>LIdF~F8FWn!NfkS($CqX#34vxcS* iL{4II9g{d?=;UckwjkNfZ3xxCSPRHU@V?|fk}L#zb#|x#9l8jPh#VH4@PDe n4b90HSTrFbldGA;8N((|X0l~0-h6@SKO>_PLUOYp>wGo<0h=FA diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/constants/DefaultConstants.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/constants/DefaultConstants.class similarity index 52% rename from vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/constants/DefaultConstants.class rename to vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/constants/DefaultConstants.class index 8f8c79b326a6ddc49d5ce3fcc8fcda7e8d12f22c..5e31eb635d6306e323e993eb27c51666b97eb9ca 100644 GIT binary patch delta 42 ucmeyu`iWKG)W2Q(7#JAL85GzVm>3zHCkkjx7G#p%7&3{G$<+tKdkg>-)C=qY delta 46 wcmeyw`h`{C)W2Q(7#JAL85GzVm>3ycCJJaU7Ek79lHM3RiIK_82gZL407Iq>(EtDd diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/constants/MinecraftConstants.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/constants/MinecraftConstants.class new file mode 100644 index 0000000000000000000000000000000000000000..bf721f7e15a0a7d2ac8e65a4a5a1d0b1a136a62f GIT binary patch literal 548 zcmb_ZO-~y!5Pi-E2_Y#7A3{C$*7i^bp#)VRq$moo(H7KvY*Q|kcX5d$uNUolgYvUD zA#vab@S_m35m77k+RO92@tg7Z&GXCS6M#ePmXKrU8EJVErEwtdVr6BV@K6~U#NxN* z^B@Xuh2^PLng@|dtS~m=-&TU|Dpf*(p*|CH!L=|q{L-Jvz%n#Oy~$`i==~ZxXBV9; zV%T#3=!P~{=H`f@wrb@Goys!S876YkZ(dEN&Fe{D2Mec7d^Bw8OJ{a_=ooL|cb&Eq z(*1d-?JmClrEOX9qoscy^ru(md+LW?(>)kyc|O<=!ttD8?N}LQPZ;taKY0v=Zgedx z$m3lV6>KnUy7a?~H1uUW626w%&`}_?Ct{WHw`9RiRl;!Q{ud9)h01Wbh*On4x%aQl zUoz+L0W>(Rkl{UwSfjH3zHCkkjx7G#m07*fO7Gx4Gph&@@HQ5!_FSTiy# zg^0;aUddXR*56&dTGwrpO=dYKIX4LLE^ delta 214 zcmaDR@kK)5)W2Q(7#JAL8A90^m>3ycCMPm#FcwdCV3eL1T*KHm@q!kZCo}mU6NDwl zxEv-ZJ-L*HfAVHVh=lZH1y-KPEKGTfS6~WcChug@MAtvrjaiS;ZQ@0Ugxusk%!-VG rFfP~-W=4h(gg_~a6r;!F2`t)RgX9>4;cSp%UB-I2ZJVdCUSb0P)b~Db diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/net/EasyContentRegistry.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/net/EasyContentRegistry.class new file mode 100644 index 0000000000000000000000000000000000000000..38b1f012e8d5d1987b6cc655ac48cf839a40bcd2 GIT binary patch literal 2048 zcmbtVYfsZq7=8`|%DQqD5L86G;08!VMbIIjV_fGJ8JEZxb0~EbM@!lcLgF9sKkz{@ z0WXR1v%kq0-_sQ=f(FK#tUagi<$0g?Jx_o9`tl9H0A?hVF(gghRUNBfYxxQXoHh=A^o0_%0!CkfB8hLe%Z*o;wC%LnouuNAs-B~?nIIg`dp`4-4v&eHZr)HMd zbj@Xu5}EW|GCju-O?hvuZ%%S-0o-a-PPvA!TVizrbxnti4ScA=FY|+*QM2m?!~8U^oxX zT|9yqx+Qcm44<97U?&vx;10nv`8wfmjK+>1C>bjHB-}l6(u;>p!9C#}ajlfKrP~Sa z=wk36DCoySI!1y)ZkSYflP?4TnTW@hgz=z)M|e!5wNW7D7(Br)0I4W2@gPcni$uro z7sF@?EC)%U-Zli1`oh9coprhPhSbV$cPOV5(7L#bHgWqvFUxR){u@wE|1w?Gs7DQ2P>Y-1 zTVX-k>4#M5&S<})Yah4%xC;y*N8zFr4bX|(vtEz1`r5A0!cu^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/util/java/net/EasyRequestType.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/net/EasyRequestType.class new file mode 100644 index 0000000000000000000000000000000000000000..aac26de3dd89439c72979c6d23a2451a97e5baa6 GIT binary patch literal 2289 zcmb_cO;=l06y2AX`zQPp)_rc`A|j52ti^fz-gEXj_k8{K=TFZ8TtnGJk3yp2 zdhtfJSuePs)r+26Z^X;Rid(2VTVDKOp<1pvUcBiQOYvRjp%WMFl+)N-b3bjm4KKG> zb4~aZdi8C|scgqnm1bGNxRuH&B-8(!epbP^lu9g;a&?`QzSXQv5m-#6Q@NCanO)5- zXEU~fe>IUyF7YIp&16zZD*1D3i6nJ=nQVq4P;Gj(rl+9pDjZ8?)>pM0r|RNp%48EC(`VfOtZY{)^pBg$yMk}R|`&Q!>Jbq z>%%Y%42#t}79u#w#CSW!1}oI?9FHcU9jB4)REL>keZpJyYPp>hg*%5lcJc@+7RI|s zo4BnIIamn`E6A`-yy|+b=GK!=gJBLtC;weCsmiK__prv=K6FYP427G~$)ji~;m%oD zmr#5ar|e3^cPzY*Je_d}of4g$>P}B~bJs0+vywx@_^MY@vYrES6KRJ9~v{ZBHR~i0kDpcb#aK+1H#*9Zz;kx?$Ub ziygLFH$k%GG#ayA=AEhN&bsUuh99=|(z;ocjvF|zlcwdp4Ad@eR~)Zdr^pyaS>$r;p=&Ici#R%CzKwk+Dw(1&EBu zm=T+t=>eRgzd=Ba(wqGK{xej*Z^(Fx(~mK#!Am|3#xywZC%W($6B@l5Xrrh`F|&=P zGogVc|<>Rj4bCE_<3C5Z=By3G12veOSp@Bv>9T$KcI!e zheQJ~Ua&v?CfAZuCO!gA_OL))hMo9k$SVUf*uq@?wh?=tpOY?GG0r^0#}_4v?$;{q kQBoG-dieW|G3rQy!hI_C3|qfK{kL5Yikfp5540@(1ssayRsaA1 literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/java/net/EasyResponse.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/net/EasyResponse.class similarity index 74% rename from vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/java/net/EasyResponse.class rename to vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/net/EasyResponse.class index 666f51910dfb7972c5d04adb16b56407fd8757dd..b51b54e242841c75f9f78989db661119645a8f6f 100644 GIT binary patch delta 101 zcmeyO^;S#Z)W2Q(7#JAL8Md-BFflUNO%%}BXqnH*=mKO+zQj12(P6S6yXNK@OkymI tt{|}+Y$}W)lmD{WP7dG@=jLWeW=LgcNP*}C3W-gg!`=zi6u_av3jq5N8<+q9 delta 117 zcmaE>^+ikI)W2Q(7#JAL8Md-BFflUNPgdm6U@YEfkIBX`cu-V=2 zPH6Cc!Ft!;Y%R7@)IzOQu__={TCJB#@7{j(9RCB)@vbd?-*-0byWY<6_{*OCyqD+x zJnvk5_51}Qx{-dJpbkbOl`u*-sx$Rscw4;`h4n^yx>N~^^YeAHriAv@4 z!QgO^7N>d8IO2qjTD8&$_3C7ppe{yN$nA1a*`K!e9Sn;RqaNM1Ji{t*M$BNeK*xnB zs6^vIc_!?H4U>$PxVsHcA2X~`KkwL{t=pz6wn9cpEa=>Iu_soh7;N1IGEQaa&SN%g=CQ?b{A|w3Py}fhKm%iyRje) zmClKUd!RbUk+h62)-}_#cgJ@>%V?ool4;gPOfJsfi$qJ0WU8Uh&}Dwx)ZPbknil(> zk+Zp7kfwhwuFtG##D3q;sB6@=q~K%7y2-6kZ>&w!=TWYC#L2cYhNvSys~Ki&-~)`V zn$sc-@g{uFwtZ7`My13DMW7rbUbJOFvoA1OTCm(gKCTr%hb(BmH<6b&jx)NZDG@c{ zXx1o~QE}m-n>FTQ@DO6g_vDeh*!7l4Cm3Csx8dG|yq7JQS=3By?w8?7&T!+b3-PU# zK8$MxtJ!)&iy!+V0)CQFw`uFUVj-tcv9UTo!}HuiT6I}mk09iQ{HUX4cw77)Wz^pm zKcRN6JRXBI5i*p%C`egiv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4EgQdH~ViHGKZTC zr47%QO6nFvw%+J4&S(wwKtoZ>^W zE!7+DX~?z?rRq1ytDcNRg}g3SQNz4Z9LtE|x%+=_B-iC((33}#gV486ct@H@5H(+Z zAU==lE+xu|CQ9>@(QzP@Jei*ONIHWkP|gl59qz}X*)S<7w`E^(9ft&eng+hH-by@F zdSZsc;btQZ3llaS#6)H&B$;5?sV6lsxjoo(n`wei%l8|~u>0@MY(i$KP>o_!soLM_ z{Mb~0;b9uG49l~G6fLlk~`RG>rn0r}1Q1HIqS75heRm z&(P^US3zHCJJawv@~V31JWC3tY>0!@d2_n7cslA0023zHCkkjV7EjJ+mYNtO&1etiZJf5AiOJOm%-)>O H?7{*7+n^7+ diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/java/net/content/EasyJsonContent.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/net/content/EasyJsonContent.class similarity index 82% rename from vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/java/net/content/EasyJsonContent.class rename to vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/net/content/EasyJsonContent.class index d94b8f8ee0e778e05f82bce83e414266898cc2b3..4981e5e69994c5451da807dc27494730c0f01085 100644 GIT binary patch delta 48 zcmX@fe~e$?)W2Q(7#JAL8Qj?!m>3y6Ckkjxe5*JyN}ACL#GJ3p3znCJJaU7EgSoI5AS1(HX*-tIX&#@t`JS@y1to F*Z{of5jg+= diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/net/content/EasyUrlEncodedContent.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/net/content/EasyUrlEncodedContent.class new file mode 100644 index 0000000000000000000000000000000000000000..ac0be6fe1b90da5557d8b1ad40ad88afc6934d63 GIT binary patch literal 5064 zcmb_fiGLJl8Gb&pyR%t_D-a-nl~PJ`vNV>%gmaTn0y!u-FhL8G-62`JS7#?AXi;lX z+G@pHiDx|;k5*F(8wwUttJQ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&t^+YA;oVP{y#>8_L&{!txnH3*GG_P+cL@^3MgaP?9? z)pMWxTXh|(r)V6@UPGze`kdQUuX1VuO@T%h@LEDs%dy581)cFj#xvB(d0DZdavWSRIa^(s!1y)+ykuUwUj}WIkv>wN_Q`6oRDcn8g*J`Ek)S#P~$uUMI~Ft zoB$-O00+UZ9x&Ji=95oweH> zsNN*Jem>V$R_Cz2t>!KGtH!RQzUMl2^;G4s=PLG%%6Y9IvX$QKW^7@$lFB2lr#v3D=t8%XLM@KseT*!CYV@F&^ljnO zF}$CaKfs+X2(s#NjvseM7TkueA!2CsucYbEXLdp|QJV}n@u-Z6~t@Dqfz0ChQh7@k%Y@M&nm%~Rc;hC2Z7{%5af?Od(pUB}k;;?iV z0Xdo=J0uMZj;Q3tuH8y+;Y zl!gI5X^caoW!zyJQ-(F1^(G#kIx(?+HT;EUC}e&^MCh4Cf>&Yi9K9FQ`-SUBlBXZE zQjb5(;T3XMJyuon;~d5=LU(R1k7A+k4Mcj1syf^U=yG{Dosdhn{25Zes=cSoWxfTX$Gwf)2J3 zhoW0hr0bTD^x)J90-m2*KXqzi&w{1<$jDz^Mwpyi4+E8?;%@>(Va;JVcScAZ{^8vH F^FIxzNk9Mq literal 0 HcmV?d00001 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/java/net/tools/HeaderParser.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/net/tools/HeaderParser.class similarity index 80% rename from vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/java/net/tools/HeaderParser.class rename to vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/net/tools/HeaderParser.class index 181421a60d0ac919e68770311407111718e40eb5..194b3258739191a9336d772b33cfdfa4be2d089c 100644 GIT binary patch delta 41 ucmew?_fbyZ)W2Q(7#JAL8BVY>FflT?OccFflT?P885!ES_l5#N_S+Wy)+~EaU?KOhFAW diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/java/net/tools/UrlEncoder.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/net/tools/UrlEncoder.class similarity index 85% rename from vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/java/net/tools/UrlEncoder.class rename to vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/net/tools/UrlEncoder.class index abde39c60a8b3e41890370f924b26630ae494b55..607c2240e98c1a3e34f548eee290548783e92501 100644 GIT binary patch delta 117 zcmdmFyvA7I)W2Q(7#JAL8UC;{FflSXO*Z7!n4HfdH8FS@Q-jas1B_~u6&Y=SBGQ{H z8TlBQA~Yt;@`9CMz)7fW@RY zmoxG)GDc3m&n7xqhZmwydh3!CCJJawd>}T_KaI)32gu&|AeIFH0=*1$ delta 44 xcmdnZwU3!CCkkjV7Ein3!CCkkjxd?-FKAdSh<2gu&|@Dd{c{Fn^0 delta 44 xcmdnUx|vnr)W2Q(7#JAL8RXa*m>3xxCJJaU7Ein{KG8po$;k)I+j##HBLFB`4VVA` diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/tools/ReflectionTools.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/tools/ReflectionTools.class new file mode 100644 index 0000000000000000000000000000000000000000..d3bc11cd672f6b64f6f59ad9c268491538ad1af7 GIT binary patch literal 3213 zcmb_eTUQfT6#h;!$s{q}fS{>Z(V`^b5&?@A5Q_+vHsS?J#Y^oF2N(@WoSAs*tAC=t zbos;!5A=n)eBiMU{TE&R7433KzjG#+k!V*RDz2G1d+)RNx4*sjIr;tFn{5DR@uQA_ zz+};MvregE=glX!<(jsWU9*a2-Zqxq?BjfCt!%j2ifa|J4~)k~)-9C^PWFbmTrl&l zRVvQQwGK_-fYKL?;!5`F(gSJ*!eds^a>oUNsq}(?Hd(rF#t=j_ju65E`*VymTUlE& z?RjIVU<$P4N_nHOVAz&iSB09pYB>T^x&Hy`D1ojT&YZDkPS`7zHM8i_b$9A^t^t3t zU^vcb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K9ccBV! zgv}2Ah|n-hO3re1j_p1|t1;T2M<+|tMOM?8KtCqQ_9a?P^QXgQm5kT;qbQ<8KLm*~ z9uatq3EPY(<95NJEJ$Db;G)73!CCJJawd>}T_KaI)32gu&|fQ=OZ4_pj) delta 44 xcmaFD{ft}S)W2Q(7#JAL8SK~@m>3!CCkkjV7EinK diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/logging/BukkitLogType.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/logging/BukkitLogType.class similarity index 78% rename from vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/logging/BukkitLogType.class rename to vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/logging/BukkitLogType.class index e9ff616c28d9b0e69631a104535727824eb6958a..31cc9e9fdd7d17b802ae03852a393c1bce0f7e71 100644 GIT binary patch delta 47 zcmeAYZWk6f^>5cc1_lOmhCp@(CPoIki2@oEE#sIRe1MFNhdLP6 delta 56 zcmZn{?h+O_^>5cc1_lOmhCp@(CPoJPi2@po#S;&RP4x3%a`XZ7HXi6?WQ0g;E@Bd8 F2LR2h532wG diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/logging/BukkitLogger.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/logging/BukkitLogger.class similarity index 66% rename from vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/logging/BukkitLogger.class rename to vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/logging/BukkitLogger.class index cb6709143d958d6227e2a7ea435c4778c0a04e29..588a0e31e038d7723c04d0b49e1ef3477f3b43c7 100644 GIT binary patch delta 832 zcmY+CT}V@57{}k|=yo=D+;{svM<-6t99qIE!lurk4?-;(MTVf&BqN)SK0t3Qh}|SI z|2GA7pSm1 zGRBSyL6Hf>QaJBaamaa~IP`%Yq3D;3KSD@Tn`JtmyEl0~o5u|OrL!oBvHg;wtqLau z8bnlVuhDVJbehiKfw^_REaR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classes/net/sourcewriters/minecraft/vcompat/utils/logging/LoggingColors.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/logging/LoggingColors.class similarity index 89% rename from vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/logging/LoggingColors.class rename to vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/logging/LoggingColors.class index 416a98752c1bcbb422bd7319c1a7d14d08205651..0ef5ab34b1970f4a49364596d7ce856da2538061 100644 GIT binary patch delta 38 tcmbQPK2=@d)W2Q(7#JAL85P+Xm>3!CCJJb5v@~XCa_|AN7EfpA0RY#n3H<;7 delta 42 vcmbQLK3!el)W2Q(7#JAL85P+Xm>3!CCkkjV7H_mLW@mEr0kaoRW#<6^|9J}J diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/minecraft/MojangProfileServer.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/minecraft/MojangProfileServer.class similarity index 80% rename from vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/minecraft/MojangProfileServer.class rename to vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/minecraft/MojangProfileServer.class index eaddb1a121af2d103d10c6d4fade970fb8070263..84bbc7c1a131519beb899af40da7c90e24a8b2ca 100644 GIT binary patch delta 121 zcmcbweM4K|)W2Q(7#JAL8E&yNFflT?O%`O*m~6!)w=sMNBcsP;0Vd7OR!q;>7`-Pe za#~N0<Lom{{qI(Y%7hOmBaW?pJ?QDRz&esFeXo;4#w?Bw~}l9Ru3noQQ>l3|Po Y@>D0!5cc1_lOm1}}C7CPoIEi2@oEEe)CMd_au%;uF`1GuuZ)I6D}FCL1z| pOy0w&Iq|*d=HHC6jI53tnowEM$){hP^>5cc1_lOm1}}C7CPoI^i2@po#giSGMJD>lGTHmUxS|tRNHRM_BlwdU q85c7KPhQGs3sx?^`6r_^Bde2!CPK|K#=yxMES8MLn-f`3x>Ckkk6wA5o{vi1S8Hcw)_!3+TOiVHjd delta 43 wcmaFC^@>a2)W2Q(7#JAL8O+!jm>3zXCJJaU7H_oBV`Q@N0kbzxV7$Q$03R3(BLDyZ diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/validation/ValidationHelper.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/validation/ValidationHelper.class similarity index 56% rename from vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/validation/ValidationHelper.class rename to vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/validation/ValidationHelper.class index 14eef288ee733a8c05c1d1cdd7bd49a2347cabcd..4047cc8078c456eebacdf3d70b9227011ab74edc 100644 GIT binary patch delta 41 ucmZ3>wwg`g)W2Q(7#JAL8C2LAm>3ycCJJawv}|H>^8qttHZw75GXVhkJPMfr delta 44 vcmZ3@ww6uc)W2Q(7#JAL8C2LAm>3ycCkkjV7EiQjVsiI^GG#U~YBK=<84U}5 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/constants/MinecraftConstants.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/constants/MinecraftConstants.class deleted file mode 100644 index cad455303add408f1e89261f9a1c5676d3500bab..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 550 zcmb_ZO-~y!5Pi-E2_Y#7EkZqVYkR1JP=XMsQWOE%XbU1A+muV?T?}#L^`c#GP<|Gt zN*wqB{3yh1MAS;X_VPS${AN6U^ZfGo1mFPMCFB@RjkG+8(m0U!v9dBwc&LmFVsT^n zJczqmPIwTR#0p~*{(YtBu2Llw80s@I7hDT-%P;(y3@k%qbTS!@2PeOV&e?e< zix{@tKf0lfmAO4)sI6LgLZ`Bfb%u#t^qW_cY4dv0*TKSR6CVwm`ofvr9XQ5Y_+6*% zgmmBQwB5zwU)q)xKU(_det&vpE>l1Bn(qEU%idrw2*-1VwPR(J{l<|0^x0!5bfaro zK_2g_s9=L()1@Dtr=c(7k?^(5hK>TEJrS#nzax2*u)y4An_%RhLlD(DQ!<$xzU!pb0WV z?Wh+k42GzJ8q|i-f;I`Q4CxBc5|5$@UPIE3W%^A~a31Z1G@Z|788Vgd@R!I5nUG&l za1ob?55Bs}Fd3^P{xP28%VAu`6$xDo&(BE1f?Z6R8ntNkh>UJrWr!@yWnQMT$=qaW zl3}hA%t200q@hu1%+SHfmNr&&d!DZpX?UX zgx2_#INHElotnR_<-g;ocoB5r9E_t+k1Lhg=_R5MK%4)bk(C74QNLr zu6u8V1&OF1Ql&ei{hHnb-1zM-Fn}C|i&8c~4{p*bEJTZT1RjS_3q;+$pAci%$3SKe z&3*g0`xZ5!UGdzzkKv{2T`~%JxZ0>BkXXxT6_QO?JG#)}C2A`NLjt2@Ba`~};}NAA zqg5T)525fX0T{<)AHWEC2%rs=iZTuCW8xd)?`WsYLb;62Kp72QOi{)p(OE8I$d3{^ ViZUet2SaoRLPY!!3^Sfp`WMIgG_e2x diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/java/net/EasyRequest.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/java/net/EasyRequest.class deleted file mode 100644 index 03a32b29844c4089b586203b75ec894d008e953c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 11757 zcmd5?d0>=hng2b>WWLGpk&83X!axh;WYR)85}-f`5J&ALIgx?9cu-uL@v@?{dv@Wj&0BX0ChTq* zT5L}xBC+lUfze}IokYcTXIUW#ueXvttyUk`3)>^zF)P)dumzh(?pQVwrf1WtM8X9ynil&UlfiaO#k>L-<*EU>!m z7#GV%N<|P@))9@wBB>RE{EEu$B)l=+X&WdXrZq<~g%C_PQ2@W7xP?a0*5A9=PHeUI zMk%JUmUxF1-EJi!>bE=TU*-b8rsAxuDXSSF#menLF&ncK zU2{zs2&hqoi4v5mQI&}@lm<{ENVLXpiA1AT_?r23p^6=mSZDm^WTaP#p^A;`x3;#_grbrCc4(d5u|HlJYV1kG zd+qR2o}a&P;exvPOBaONtuC_fo>CO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Ad)GMfy!dZW#d-wwO742DV-vnVjkdsOsQGU&)?S9Ai&u;_)p2-+f2_B~PNwHT0X zsowC8OSVj;bgxNS&3Gs)ly$L+8s@FyP{j;Sz5i^Ia+e2TR~?M^qQLd=fi$rsY=Qbj zfbP{j8WoSn+K8j!VJNjan!LnN@qQd?{(_FS2ol+B*qM}Ds;7lXA_{+yC46IjGtE%x z$|(r@Ta7FzY}srfwlYH@odm<9dioLUaQEJM%`C+&37-6Wyqf`~$R+lB)TVI|`9^lm z40p0XVpyK09Fb{4JDwp=I;6RlTd8NtQhDLz!rZmQCB_qYT0@3ay8t8=QF4D`2EA^R z#r}%9AEmFD`$FOjs&p2dp^Q^bW0#MZPBJYa-D&WBx@~xI{Tmh-K0DXr;F=4rrY<;x zCD=4)vFz>@oFmJsi#bpF3%L0AeTk&YxI$1;`@P$`w~=ZPKVKL>>%R bag9zZUB?Ydc9Y~3j@8^E4Wj|rj_ZE_Nb)mf diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/java/net/content/EasyUrlEncodedContent.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/java/net/content/EasyUrlEncodedContent.class deleted file mode 100644 index 3b4731f63bc7cfb82dffb0d2b4ee1a8c81c5d2e6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5002 zcmb_gi+@vR8Gb&Re&X|fCrw)#Y3Wb+k(_*&_wqc?_kQo;t^d4! z9l#d++rT1)gDKkyWz)G#)E>?x96OT@4JJ}{G-LHUq0`ay;E?5na!w+d4V|=3TOnB< zO{W|?<%C+S?C6n9vLzKw$Lv_d9W~%lSgO}1t<*rMv+txGbqx3vA`9@9+ckHg~tBqgL{$l}X5NJs3b4)``(2<#-1kH1JM^hg^aa z=}Yok?uVwwkoV?o3*2`G917LY&7uj!brapD-(~P zhM)}Cj)GP5zungUUziaz>r4c&Se_b8n7EH*IPpZ5Uny&ln69X)b;Hmi?{YGU)Iive zO@z@J8cHUjmXk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~8~^|S diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/java/tools/ReflectionTools.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/utils/java/tools/ReflectionTools.class deleted file mode 100644 index 148d6d2234392e5684d3e243215006c143e2c7ac..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1454 zcmb_cOHq%A?9Ed^8r6`?KI2q-A6D1$P?Ou-q;Fymu$8$$`EX-!fXSoagGk_%Hk;;<-sP1iEqIWai#;&OMLsyz=YM=^20}tV#$myf8IKu^TN*)ebG) z(JWi3>!zk!eAiJ9)JDC@9i`>yhOO-L1FkrY29d9|T|-kHy4NVF zBhH>~Gpv{Y2i77(%x+axgWKeDF+mc0wPa`AzsmICU;sEfi879 zDdkuG#g9-+AcY|bX{yE*Br-A>W=PaD$Bn8H-gGwit_zKDF)HIaZZPzbc15o@4Q-3p z2^$#%^g9W~FvbviUr1maw*SQE9^x1BZ6x0;N6!``;gxR~AB~R9Z_c(clDyf*t?>Lz8XDwjpDT>f70DEH#s(yw^yaCxE`$;s$Bc_XJ5WAWsLT+);0a|$xHAn|u_+e|j%a$|IvD4;UAfs+NStdP-d YvLS~moG(2&oLh#m5mjvS4sL%g0PhPOdH?_b diff --git a/vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/VersionCompat.java b/vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/VersionCompat.java index 8c191ba..00d62e9 100644 --- a/vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/VersionCompat.java +++ b/vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/VersionCompat.java @@ -1,9 +1,9 @@ package net.sourcewriters.minecraft.vcompat; -import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; - -public final class VersionCompat extends VersionCompatProvider { +import net.sourcewriters.minecraft.vcompat.provider.VersionControl; +final class VersionCompat extends VersionCompatProvider { + @Override public VersionControl getControl() { return null; diff --git a/vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/VersionCompat.class b/vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/VersionCompat.class index 78077367dfb2048177a0844cdd5ca61afe2ae8d2..29c4c038f926dac2df6cb62abf6db78d8207ad3b 100644 GIT binary patch delta 45 ycmZo+X=2$R%*br7p*iuQDn~(4epzNpYSCm@Mq^$B21W*E1`uFkV3^#>SPuXYCJILY delta 47 zcmZo-X<^wQ%*gDhp*iuQDpyfzT25+mNoIcDWM@WWUPA^(24)5jU}9jL+{{=H05CZV A2><{9 From 20fd7a38fbb165e326144f5d46931b61055614c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20Endre=C3=9F?= Date: Wed, 19 Jan 2022 11:06:09 +0100 Subject: [PATCH 12/47] Implement new init classes --- .../vcompat/VersionCompatProvider.java | 18 +++++++++---- .../vcompat/provider/VersionControl.java | 2 -- .../vcompat/VersionCompatProvider.class | Bin 1034 -> 1960 bytes .../vcompat/provider/VersionControl.class | Bin 1852 -> 1693 bytes .../minecraft/vcompat/VersionCompat.java | 24 +++++++++++++++--- .../minecraft/vcompat/VersionCompat.class | Bin 514 -> 2509 bytes 6 files changed, 34 insertions(+), 10 deletions(-) diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/VersionCompatProvider.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/VersionCompatProvider.java index 9a809d2..5dce17b 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/VersionCompatProvider.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/VersionCompatProvider.java @@ -3,19 +3,27 @@ import com.syntaxphoenix.syntaxapi.utils.java.tools.Container; import net.sourcewriters.minecraft.vcompat.provider.VersionControl; +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookup; public abstract class VersionCompatProvider { - + protected static final Container PROVIDER = Container.of(); - + public static VersionCompatProvider get() { - return PROVIDER.get(); + if (PROVIDER.isPresent()) { + return PROVIDER.get(); + } + Object object = ClassLookup.of(VersionCompatProvider.class.getPackageName() + ".VersionCompat").init(); + if (object == null || !(object instanceof VersionCompatProvider)) { + throw new IllegalStateException("Can't initialize VersionCompatProvider!"); + } + return PROVIDER.replace((VersionCompatProvider) object).lock().get(); } - + /* * Impl */ - + public abstract VersionControl getControl(); } diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/VersionControl.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/VersionControl.java index 36c6e86..7a95c6c 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/VersionControl.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/VersionControl.java @@ -2,8 +2,6 @@ public abstract class VersionControl { - public static final String CLASSPATH = "net.sourcewriters.minecraft.vcompat.reflection.provider.v$version.VersionControl$version"; - protected final DataProvider dataProvider = new DataProvider(this); public DataProvider getDataProvider() { diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/VersionCompatProvider.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/VersionCompatProvider.class index 2e01411e7926e17f8947dfeadc0a654b0966f968..05be7a97be0fa92d9f11d1bf4ff35a9284062f72 100644 GIT binary patch delta 912 zcmZ`%O-~bH5Pqgh*mkq!qktwF189Y|3Z$cpl&m<#TOnC`a*w`Y~=mBWDp}dj^P5Ks|+a~4OUACuXr&k84j-Se8I5Hq_t@? zM?(;obd2LNp_$n>H#3BR#+FC$1{PIUO%pjx5D6Vu%JX|2s~Xhco4|Dy*9g-u+k&O< z9^a_2tlX9zeay^^;L(a~sftTS8zu=4|Jk;N&i)rI2~6OIj;Zoan+(%%RNN$V*Oi?S zf@hgna+t%Xo}{_$$oajPA@nDi+3)m}K?W1XQ{Gc*r>>!14bvDY-%3iy9OmUd^4u0I zEf<<EmfkAe#T_UhdCzMf5O8toHT;#I-Y=kc2MDeP$VJ~C&hKJ4aM8t>i})U{x=7AO zzCw!}g5JP?fa%r1tzF#yEWr^8busH=!9}HvtgfI_+7oD&)(;^=GLwf=V1f&d| m=#n8_Qi&mqyI7L1W%+4PI({IeLh&^b?qNmx2=}G+;K46o66#?9 delta 105 zcmZ3%-^Iao>ff$?3=9nB3@RJBrZO>0GssWg$0R=aChI{)&dIacj2PJ`pJS7^)nZ@- ws$yW^+QcBVjY0MR1LFoDkBLD9NV0+Dco;;%A`C2y3&kKgq<6ngJ)=5^9~vzBxrm99|!k_ z|Fq=5W@f&*{4?_%PId76zx)C4fcrEUrK_=jpiqQYgnoOKp;jmvjs%bG=QJAVLFdJX zpse6x|MO3@GZ9n`P{m_~!?Zr>2@WG5P8JA~FQ^fNaE|zc$vsqPLlkHWY;+OPS4k=# zLJfx`!4Zx(f_-`;=q5A7?+h}L30Iq}w=?bL(~jT-r>xeq<}>m+E-YV?uh6i3O}@dc iRLi;dpEpk-Ev!4yscf?uGQq`h0y$_ zcXe$FjawIv)fBepYS-NJ?Q@H3e$l7qAl2x5L-kz2J!g>bnk^|MLxz$-ru$u!)5r!m z$*{k1SBPres;X2<4G9c68KW3`I%i6(6G0wvj8HZ~PezbLHYie@q#Ugys}dQAQ3RyR zuNW`CBYj4}#0#b#dt=jNRYb`~sWE{R`8<)_AHob~i5TWE|F=*l&(Hzlgbg R|LH5q{ZqoiKlGl4onMSPQC$E4 diff --git a/vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/VersionCompat.java b/vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/VersionCompat.java index 00d62e9..15016f9 100644 --- a/vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/VersionCompat.java +++ b/vcompat-core/src/main/java/net/sourcewriters/minecraft/vcompat/VersionCompat.java @@ -1,12 +1,30 @@ package net.sourcewriters.minecraft.vcompat; import net.sourcewriters.minecraft.vcompat.provider.VersionControl; +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookup; +import net.sourcewriters.minecraft.vcompat.version.Versions; final class VersionCompat extends VersionCompatProvider { - + + private final VersionControl control; + + public VersionCompat() { + this.control = initControl(); + Runtime.getRuntime().addShutdownHook(new Thread(control::shutdown)); + } + + private final VersionControl initControl() { + Object object = ClassLookup + .of(VersionCompat.class.getPackageName() + ".provider.impl.v" + Versions.getServerAsString() + ".VersionControlImpl").init(); + if (object == null || !(object instanceof VersionControl)) { + throw new IllegalStateException("Can't initialize VersionControl"); + } + return (VersionControl) object; + } + @Override - public VersionControl getControl() { - return null; + public final VersionControl getControl() { + return control; } } diff --git a/vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/VersionCompat.class b/vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/VersionCompat.class index 29c4c038f926dac2df6cb62abf6db78d8207ad3b..96c0748955495559196367c65da0e0934a28c63f 100644 GIT binary patch literal 2509 zcmb_eYf~Fl7=8``HY`g6fzk`wVr@$THrraX*0j_Ti=g4s22(+-9+E?{u-T2fn^5Zi z@Pog?&S+rDjF&HdaQsP*<9l`&lF&|vS|>ASci;0~pZAtO|9SQcfE)NuK?lP%OL)3# z*PMdbb_`EAu3j-LQE>Q%r`HR1rOG`$Ph`WkGX9r>PKKMWEVks>b)zU82BlzIo@1K~ zx3kAlQw=4XZusJ9hVEO2Wq4Bzkwh}j(3!D|LPZ3<8WcoTF!X6Sffz%tWXv4cy^~13 zmgOGOJfNWq-6{rgQo#^?Z}K|VO>UL+2Q|wxDni3BPBEw@;e`~2lVtfh#&knd%+(%Bq1BRL7cyR!OZc@F~s(P7QMN{a0F0(#K!!kZ+ z=&&gXYcB-k|FJ{(-N!=>Utopil^jY(t0v64f-f1;uVl0xI|W}coNpHHoN0;@H*+5M z#J$G_QT1q|NAWc=WwZW>R-XuBpAYoHn1ZTq7~Hepk1=q(LeQe4=Y=hd(& z<TW#46AN$2|ddz z>qSnCe1jJ}+u6}zqC!Ky(j+nb)tbgoGEhG2r{BF8q(0pePEcK~ls3WTovQe6mx0Nb z%eFRpXg0%5Ge=uF9qUH9U#_%Oe5=7hl$yZ}hiI$|Rk~x)<}6D%epL%s!8XIC=dgPb z0t$8*&b^$K@*lv3tF-(gv{|SS@&qW(OwDmpN z?jTxbANoq1HE?YYH+FG5{!s(ddzhg!{uvz&%r+{D6l>ff$?3=9nB3_=sRDkh$hVB_RrU}a#Nypkz}m63rfJ$2$QugOJhO7#o| z42%rSK&1=}Oh61&1LU& Date: Wed, 19 Jan 2022 13:25:03 +0100 Subject: [PATCH 13/47] Update .gitignore --- vcompat-api/.classpath | 11 ----------- vcompat-api/.gitignore | 12 ++++++++++++ vcompat-core/.classpath | 11 ----------- vcompat-core/.gitignore | 12 ++++++++++++ 4 files changed, 24 insertions(+), 22 deletions(-) create mode 100644 vcompat-api/.gitignore create mode 100644 vcompat-core/.gitignore diff --git a/vcompat-api/.classpath b/vcompat-api/.classpath index 0fb79cf..4559ca0 100644 --- a/vcompat-api/.classpath +++ b/vcompat-api/.classpath @@ -6,11 +6,6 @@ - - - - - @@ -18,12 +13,6 @@ - - - - - - diff --git a/vcompat-api/.gitignore b/vcompat-api/.gitignore new file mode 100644 index 0000000..bc12e1e --- /dev/null +++ b/vcompat-api/.gitignore @@ -0,0 +1,12 @@ +/bin/ +/target/ +/dependencies/ +/.settings/ +/.idea/ +/.m2/ +/.classpath +/.project +/.gitlab-ci.yml +/test/ +/libraries/spigot/ +/dependency-reduced-pom.xml diff --git a/vcompat-core/.classpath b/vcompat-core/.classpath index 0fb79cf..4559ca0 100644 --- a/vcompat-core/.classpath +++ b/vcompat-core/.classpath @@ -6,11 +6,6 @@ - - - - - @@ -18,12 +13,6 @@ - - - - - - diff --git a/vcompat-core/.gitignore b/vcompat-core/.gitignore new file mode 100644 index 0000000..bc12e1e --- /dev/null +++ b/vcompat-core/.gitignore @@ -0,0 +1,12 @@ +/bin/ +/target/ +/dependencies/ +/.settings/ +/.idea/ +/.m2/ +/.classpath +/.project +/.gitlab-ci.yml +/test/ +/libraries/spigot/ +/dependency-reduced-pom.xml From baf0d46d9706682e63e237a27bbbfdb4dfc0d332 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20Endre=C3=9F?= Date: Wed, 19 Jan 2022 13:25:40 +0100 Subject: [PATCH 14/47] Delete .classpath --- vcompat-api/.classpath | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 vcompat-api/.classpath diff --git a/vcompat-api/.classpath b/vcompat-api/.classpath deleted file mode 100644 index 4559ca0..0000000 --- a/vcompat-api/.classpath +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - From 345b4c37308ccbc96d1fbd42680ce292e44cd668 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20Endre=C3=9F?= Date: Wed, 19 Jan 2022 13:25:48 +0100 Subject: [PATCH 15/47] Delete .project --- vcompat-api/.project | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 vcompat-api/.project diff --git a/vcompat-api/.project b/vcompat-api/.project deleted file mode 100644 index d8b40e2..0000000 --- a/vcompat-api/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - vcompat-api - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - From a343f9626e455dda1d6ed3d8fed2fa69b5c561b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20Endre=C3=9F?= Date: Wed, 19 Jan 2022 13:25:59 +0100 Subject: [PATCH 16/47] Delete .classpath --- vcompat-core/.classpath | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 vcompat-core/.classpath diff --git a/vcompat-core/.classpath b/vcompat-core/.classpath deleted file mode 100644 index 4559ca0..0000000 --- a/vcompat-core/.classpath +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - From 05309257fde789623d58c2adf769bc2dbf0506cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20Endre=C3=9F?= Date: Wed, 19 Jan 2022 13:26:22 +0100 Subject: [PATCH 17/47] Delete .project --- vcompat-core/.project | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 vcompat-core/.project diff --git a/vcompat-core/.project b/vcompat-core/.project deleted file mode 100644 index 86cd72d..0000000 --- a/vcompat-core/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - vcompat-core - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - From 2152bd5a1ee844673f4b0b04186eec8923731b70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20Endre=C3=9F?= Date: Wed, 19 Jan 2022 13:27:10 +0100 Subject: [PATCH 18/47] Delete org.eclipse.jdt.core.prefs --- vcompat-core/.settings/org.eclipse.jdt.core.prefs | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 vcompat-core/.settings/org.eclipse.jdt.core.prefs diff --git a/vcompat-core/.settings/org.eclipse.jdt.core.prefs b/vcompat-core/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 2af1e7b..0000000 --- a/vcompat-core/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 -org.eclipse.jdt.core.compiler.compliance=11 -org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore -org.eclipse.jdt.core.compiler.release=disabled -org.eclipse.jdt.core.compiler.source=11 From 55ef77062da6ca21224626bbef4246ddd361bf0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20Endre=C3=9F?= Date: Wed, 19 Jan 2022 13:27:12 +0100 Subject: [PATCH 19/47] Delete org.eclipse.core.resources.prefs --- vcompat-core/.settings/org.eclipse.core.resources.prefs | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 vcompat-core/.settings/org.eclipse.core.resources.prefs diff --git a/vcompat-core/.settings/org.eclipse.core.resources.prefs b/vcompat-core/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 29abf99..0000000 --- a/vcompat-core/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,6 +0,0 @@ -eclipse.preferences.version=1 -encoding//src/main/java=UTF-8 -encoding//src/main/resources=UTF-8 -encoding//src/test/java=UTF-8 -encoding//src/test/resources=UTF-8 -encoding/=UTF-8 From d3963e575c4d9df08fba194b4c6ce2c894ba4dc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20Endre=C3=9F?= Date: Wed, 19 Jan 2022 13:27:13 +0100 Subject: [PATCH 20/47] Delete org.eclipse.m2e.core.prefs --- vcompat-core/.settings/org.eclipse.m2e.core.prefs | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 vcompat-core/.settings/org.eclipse.m2e.core.prefs diff --git a/vcompat-core/.settings/org.eclipse.m2e.core.prefs b/vcompat-core/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index f897a7f..0000000 --- a/vcompat-core/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 From fe115337fdbe5b8971a5850dc5e032e469f6e08d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20Endre=C3=9F?= Date: Wed, 19 Jan 2022 13:27:14 +0100 Subject: [PATCH 21/47] Delete org.eclipse.jdt.core.prefs --- vcompat-api/.settings/org.eclipse.jdt.core.prefs | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 vcompat-api/.settings/org.eclipse.jdt.core.prefs diff --git a/vcompat-api/.settings/org.eclipse.jdt.core.prefs b/vcompat-api/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 2af1e7b..0000000 --- a/vcompat-api/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 -org.eclipse.jdt.core.compiler.compliance=11 -org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore -org.eclipse.jdt.core.compiler.release=disabled -org.eclipse.jdt.core.compiler.source=11 From 4070a67ac5fc6198ec97aee423ae65d95e340e1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20Endre=C3=9F?= Date: Wed, 19 Jan 2022 13:27:16 +0100 Subject: [PATCH 22/47] Delete org.eclipse.core.resources.prefs --- vcompat-api/.settings/org.eclipse.core.resources.prefs | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 vcompat-api/.settings/org.eclipse.core.resources.prefs diff --git a/vcompat-api/.settings/org.eclipse.core.resources.prefs b/vcompat-api/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 29abf99..0000000 --- a/vcompat-api/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,6 +0,0 @@ -eclipse.preferences.version=1 -encoding//src/main/java=UTF-8 -encoding//src/main/resources=UTF-8 -encoding//src/test/java=UTF-8 -encoding//src/test/resources=UTF-8 -encoding/=UTF-8 From e0b53199163c6c19b80edf27e206f3675c26f49f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20Endre=C3=9F?= Date: Wed, 19 Jan 2022 13:27:16 +0100 Subject: [PATCH 23/47] Delete org.eclipse.m2e.core.prefs --- vcompat-api/.settings/org.eclipse.m2e.core.prefs | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 vcompat-api/.settings/org.eclipse.m2e.core.prefs diff --git a/vcompat-api/.settings/org.eclipse.m2e.core.prefs b/vcompat-api/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index f897a7f..0000000 --- a/vcompat-api/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 From a71dda067f42e421a3ef55caee65b962d417ac23 Mon Sep 17 00:00:00 2001 From: Lauriichan Date: Wed, 19 Jan 2022 13:48:57 +0100 Subject: [PATCH 24/47] Fix project build --- vcompat-api/pom.xml | 35 +++++++++++++++++++++++++++++++++++ vcompat-core/pom.xml | 2 +- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/vcompat-api/pom.xml b/vcompat-api/pom.xml index 879b555..ee3709f 100644 --- a/vcompat-api/pom.xml +++ b/vcompat-api/pom.xml @@ -54,4 +54,39 @@ 2.0.11 + + + + + maven-shade-plugin + 3.2.4 + + + package + + shade + + + + + + + *:* + + META-INF/*.SF + META-INF/*.DSA + META-INF/*.RSA + + + + + + com.syntaxphoenix.syntaxapi + net.sourcewriters.minecraft.vcompat.shaded.syntaxapi + + + + + + \ No newline at end of file diff --git a/vcompat-core/pom.xml b/vcompat-core/pom.xml index f135fc7..8a7e1e1 100644 --- a/vcompat-core/pom.xml +++ b/vcompat-core/pom.xml @@ -20,7 +20,7 @@ maven-shade-plugin - 3.1.1 + 3.2.4 package From 783397bd3acd2a7aca48be23d8277938a6dde26a Mon Sep 17 00:00:00 2001 From: Lauriichan Date: Wed, 19 Jan 2022 13:50:07 +0100 Subject: [PATCH 25/47] Update .gitignore --- vcompat-api/.gitignore | 24 ++++++++++++------------ vcompat-core/.gitignore | 24 ++++++++++++------------ 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/vcompat-api/.gitignore b/vcompat-api/.gitignore index bc12e1e..becab63 100644 --- a/vcompat-api/.gitignore +++ b/vcompat-api/.gitignore @@ -1,12 +1,12 @@ -/bin/ -/target/ -/dependencies/ -/.settings/ -/.idea/ -/.m2/ -/.classpath -/.project -/.gitlab-ci.yml -/test/ -/libraries/spigot/ -/dependency-reduced-pom.xml +bin/ +target/ +dependencies/ +.settings/ +.idea/ +.m2/ +.classpath +.project +.gitlab-ci.yml +test/ +libraries/spigot/ +dependency-reduced-pom.xml diff --git a/vcompat-core/.gitignore b/vcompat-core/.gitignore index bc12e1e..becab63 100644 --- a/vcompat-core/.gitignore +++ b/vcompat-core/.gitignore @@ -1,12 +1,12 @@ -/bin/ -/target/ -/dependencies/ -/.settings/ -/.idea/ -/.m2/ -/.classpath -/.project -/.gitlab-ci.yml -/test/ -/libraries/spigot/ -/dependency-reduced-pom.xml +bin/ +target/ +dependencies/ +.settings/ +.idea/ +.m2/ +.classpath +.project +.gitlab-ci.yml +test/ +libraries/spigot/ +dependency-reduced-pom.xml From 3e3f3830e57bbe57d0caf5444cacf710affc92db Mon Sep 17 00:00:00 2001 From: Lauriichan Date: Wed, 19 Jan 2022 13:50:42 +0100 Subject: [PATCH 26/47] Update .gitignore --- .gitignore | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index bc12e1e..becab63 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,12 @@ -/bin/ -/target/ -/dependencies/ -/.settings/ -/.idea/ -/.m2/ -/.classpath -/.project -/.gitlab-ci.yml -/test/ -/libraries/spigot/ -/dependency-reduced-pom.xml +bin/ +target/ +dependencies/ +.settings/ +.idea/ +.m2/ +.classpath +.project +.gitlab-ci.yml +test/ +libraries/spigot/ +dependency-reduced-pom.xml From 0f7c9ffc6b1044f2da1bc01b7d068ca7b28d4f1a Mon Sep 17 00:00:00 2001 From: Lauriichan Date: Wed, 19 Jan 2022 14:06:17 +0100 Subject: [PATCH 27/47] Update .gitignore --- .gitignore | 60 +++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 48 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index becab63..6178f12 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,48 @@ -bin/ -target/ -dependencies/ -.settings/ -.idea/ -.m2/ -.classpath -.project -.gitlab-ci.yml -test/ -libraries/spigot/ -dependency-reduced-pom.xml +/bin/ +/target/ +/dependencies/ +/.settings/ +/.idea/ +/.m2/ +/.classpath +/.project +/.gitlab-ci.yml +/test/ +/libraries/spigot/ +/dependency-reduced-pom.xml +/vcompat-api/bin/ +/vcompat-api/target/ +/vcompat-api/dependencies/ +/vcompat-api/.settings/ +/vcompat-api/.idea/ +/vcompat-api/.m2/ +/vcompat-api/.classpath +/vcompat-api/.project +/vcompat-api/.gitlab-ci.yml +/vcompat-api/test/ +/vcompat-api/libraries/spigot/ +/vcompat-api/dependency-reduced-pom.xml +/vcompat-core/bin/ +/vcompat-core/target/ +/vcompat-core/dependencies/ +/vcompat-core/.settings/ +/vcompat-core/.idea/ +/vcompat-core/.m2/ +/vcompat-core/.classpath +/vcompat-core/.project +/vcompat-core/.gitlab-ci.yml +/vcompat-core/test/ +/vcompat-core/libraries/spigot/ +/vcompat-core/dependency-reduced-pom.xml +/vcompat-legacy/bin/ +/vcompat-legacy/target/ +/vcompat-legacy/dependencies/ +/vcompat-legacy/.settings/ +/vcompat-legacy/.idea/ +/vcompat-legacy/.m2/ +/vcompat-legacy/.classpath +/vcompat-legacy/.project +/vcompat-legacy/.gitlab-ci.yml +/vcompat-legacy/test/ +/vcompat-legacy/libraries/spigot/ +/vcompat-legacy/dependency-reduced-pom.xml \ No newline at end of file From 7381655f4295eac23e498e5ff2e8f0f6fd2f80aa Mon Sep 17 00:00:00 2001 From: Lauriichan Date: Wed, 19 Jan 2022 14:06:26 +0100 Subject: [PATCH 28/47] Update .gitignore --- .gitignore | 59 +++++++++++------------------------------------------- 1 file changed, 12 insertions(+), 47 deletions(-) diff --git a/.gitignore b/.gitignore index 6178f12..26dfc00 100644 --- a/.gitignore +++ b/.gitignore @@ -1,48 +1,13 @@ -/bin/ -/target/ -/dependencies/ -/.settings/ -/.idea/ -/.m2/ -/.classpath -/.project -/.gitlab-ci.yml -/test/ +*/bin/ +*/target/ +*/dependencies/ +*/.settings/ +*/.idea/ +*/.m2/ +*/.classpath +*/.project +*/.gitlab-ci.yml +*/test/ /libraries/spigot/ -/dependency-reduced-pom.xml -/vcompat-api/bin/ -/vcompat-api/target/ -/vcompat-api/dependencies/ -/vcompat-api/.settings/ -/vcompat-api/.idea/ -/vcompat-api/.m2/ -/vcompat-api/.classpath -/vcompat-api/.project -/vcompat-api/.gitlab-ci.yml -/vcompat-api/test/ -/vcompat-api/libraries/spigot/ -/vcompat-api/dependency-reduced-pom.xml -/vcompat-core/bin/ -/vcompat-core/target/ -/vcompat-core/dependencies/ -/vcompat-core/.settings/ -/vcompat-core/.idea/ -/vcompat-core/.m2/ -/vcompat-core/.classpath -/vcompat-core/.project -/vcompat-core/.gitlab-ci.yml -/vcompat-core/test/ -/vcompat-core/libraries/spigot/ -/vcompat-core/dependency-reduced-pom.xml -/vcompat-legacy/bin/ -/vcompat-legacy/target/ -/vcompat-legacy/dependencies/ -/vcompat-legacy/.settings/ -/vcompat-legacy/.idea/ -/vcompat-legacy/.m2/ -/vcompat-legacy/.classpath -/vcompat-legacy/.project -/vcompat-legacy/.gitlab-ci.yml -/vcompat-legacy/test/ -/vcompat-legacy/libraries/spigot/ -/vcompat-legacy/dependency-reduced-pom.xml \ No newline at end of file +*/dependency-reduced-pom.xml +*.class \ No newline at end of file From 803f9434f6836b02bfb4342e816cfdaba163ec35 Mon Sep 17 00:00:00 2001 From: Lauriichan Date: Wed, 19 Jan 2022 14:07:36 +0100 Subject: [PATCH 29/47] Update .gitingore --- vcompat-api/.gitignore | 24 ++++++++++++------------ vcompat-core/.gitignore | 24 ++++++++++++------------ 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/vcompat-api/.gitignore b/vcompat-api/.gitignore index becab63..e5d0d0e 100644 --- a/vcompat-api/.gitignore +++ b/vcompat-api/.gitignore @@ -1,12 +1,12 @@ -bin/ -target/ -dependencies/ -.settings/ -.idea/ -.m2/ -.classpath -.project -.gitlab-ci.yml -test/ -libraries/spigot/ -dependency-reduced-pom.xml +*/bin/ +*/target/ +*/dependencies/ +*/.settings/ +*/.idea/ +*/.m2/ +*/.classpath +*/.project +*/.gitlab-ci.yml +*/test/ +*/dependency-reduced-pom.xml +*.class \ No newline at end of file diff --git a/vcompat-core/.gitignore b/vcompat-core/.gitignore index becab63..e5d0d0e 100644 --- a/vcompat-core/.gitignore +++ b/vcompat-core/.gitignore @@ -1,12 +1,12 @@ -bin/ -target/ -dependencies/ -.settings/ -.idea/ -.m2/ -.classpath -.project -.gitlab-ci.yml -test/ -libraries/spigot/ -dependency-reduced-pom.xml +*/bin/ +*/target/ +*/dependencies/ +*/.settings/ +*/.idea/ +*/.m2/ +*/.classpath +*/.project +*/.gitlab-ci.yml +*/test/ +*/dependency-reduced-pom.xml +*.class \ No newline at end of file From a9b9530ab5f38525fc45795caa35e80dfc2e6221 Mon Sep 17 00:00:00 2001 From: Lauriichan Date: Wed, 19 Jan 2022 14:08:31 +0100 Subject: [PATCH 30/47] Fix .gitignore and add vcompat-legacy --- pom.xml | 1 + .../vcompat/VersionCompatProvider.class | Bin 1960 -> 0 bytes .../vcompat/data/AbstractDataAdapter.class | Bin 2449 -> 0 bytes .../data/AbstractDataAdapterRegistry.class | Bin 6118 -> 0 bytes .../vcompat/data/AbstractDataContainer.class | Bin 7815 -> 0 bytes .../vcompat/data/AbstractDataFactory.class | Bin 4065 -> 0 bytes .../vcompat/data/api/ChainDataType.class | Bin 8655 -> 0 bytes .../vcompat/data/api/DefaultDataType.class | Bin 2716 -> 0 bytes .../vcompat/data/api/IDataAdapter.class | Bin 644 -> 0 bytes .../data/api/IDataAdapterContext.class | Bin 253 -> 0 bytes .../data/api/IDataAdapterRegistry.class | Bin 517 -> 0 bytes .../vcompat/data/api/IDataContainer.class | Bin 2352 -> 0 bytes .../vcompat/data/api/IDataFactory.class | Bin 2031 -> 0 bytes .../vcompat/data/api/IDataType.class | Bin 11196 -> 0 bytes .../vcompat/data/nbt/NbtAdapter.class | Bin 17024 -> 0 bytes .../vcompat/data/nbt/NbtAdapterRegistry.class | Bin 3395 -> 0 bytes .../vcompat/data/nbt/NbtContainer.class | Bin 4391 -> 0 bytes .../vcompat/data/util/NumberConversion.class | Bin 2876 -> 0 bytes .../entity/Hologram$HologramBuilder.class | Bin 1469 -> 0 bytes .../minecraft/vcompat/entity/Hologram.class | Bin 12577 -> 0 bytes .../vcompat/entity/attributes/Nameable.class | Bin 237 -> 0 bytes .../vcompat/entity/handler/CustomEntity.class | Bin 1968 -> 0 bytes .../entity/handler/DefaultEntityType.class | Bin 1505 -> 0 bytes .../entity/handler/EntityBuilder.class | Bin 1475 -> 0 bytes .../entity/handler/EntityManager.class | Bin 8486 -> 0 bytes .../entity/handler/EntityRegistry.class | Bin 5554 -> 0 bytes .../vcompat/entity/handler/EntityType.class | Bin 193 -> 0 bytes .../vcompat/listener/PlayerListener.class | Bin 4475 -> 0 bytes .../listener/handler/IPlayerHandler.class | Bin 584 -> 0 bytes .../vcompat/provider/BukkitConversion.class | Bin 2737 -> 0 bytes .../vcompat/provider/DataProvider.class | Bin 4905 -> 0 bytes .../vcompat/provider/EntityProvider.class | Bin 1709 -> 0 bytes .../vcompat/provider/PlayerProvider.class | Bin 2856 -> 0 bytes .../vcompat/provider/TextureProvider.class | Bin 5525 -> 0 bytes .../vcompat/provider/ToolProvider.class | Bin 1124 -> 0 bytes .../vcompat/provider/VersionControl.class | Bin 1693 -> 0 bytes .../vcompat/provider/VersionHandler.class | Bin 986 -> 0 bytes .../vcompat/provider/data/WrapType.class | Bin 3912 -> 0 bytes .../provider/data/WrappedContainer.class | Bin 5964 -> 0 bytes .../provider/data/WrappedContext.class | Bin 844 -> 0 bytes .../vcompat/provider/data/WrappedKey.class | Bin 1246 -> 0 bytes .../data/persistence/DataDistributor.class | Bin 5940 -> 0 bytes .../data/persistence/DataObserver.class | Bin 4573 -> 0 bytes .../persistence/PersistentContainer.class | Bin 5690 -> 0 bytes .../provider/data/type/ObjectType.class | Bin 1590 -> 0 bytes .../provider/data/type/SkinDataType.class | Bin 4237 -> 0 bytes .../data/wrap/SimpleSyntaxContainer.class | Bin 7240 -> 0 bytes .../data/wrap/SimpleSyntaxContext.class | Bin 1568 -> 0 bytes .../provider/data/wrap/SimpleSyntaxType.class | Bin 3328 -> 0 bytes .../provider/data/wrap/SimpleWrapType.class | Bin 2393 -> 0 bytes .../provider/data/wrap/SyntaxKey.class | Bin 3275 -> 0 bytes .../provider/entity/NmsArmorStand.class | Bin 284 -> 0 bytes .../vcompat/provider/entity/NmsEntity.class | Bin 1073 -> 0 bytes .../provider/entity/NmsEntityLiving.class | Bin 263 -> 0 bytes .../provider/entity/NmsEntityType.class | Bin 1193 -> 0 bytes .../vcompat/provider/entity/NmsPlayer.class | Bin 1057 -> 0 bytes .../provider/lookup/ClassLookupProvider.class | Bin 5619 -> 0 bytes .../provider/lookup/ClassLookups.class | Bin 1455 -> 0 bytes .../provider/lookup/handle/ClassLookup.class | Bin 18400 -> 0 bytes .../lookup/handle/ClassLookupCache.class | Bin 4350 -> 0 bytes .../provider/lookup/handle/FakeLookup.class | Bin 861 -> 0 bytes .../lookup/handle/field/IFieldHandle.class | Bin 882 -> 0 bytes .../lookup/handle/field/SafeFieldHandle.class | Bin 2096 -> 0 bytes .../field/UnsafeDeclaredFieldHandle.class | Bin 2214 -> 0 bytes .../handle/field/UnsafeFieldHandle.class | Bin 2201 -> 0 bytes .../field/UnsafeStaticFieldHandle.class | Bin 2330 -> 0 bytes .../lookup/provider/GeneralReflections.class | Bin 1304 -> 0 bytes .../vcompat/provider/tools/BlockTools.class | Bin 502 -> 0 bytes .../vcompat/provider/tools/ServerTools.class | Bin 544 -> 0 bytes .../vcompat/provider/tools/SkinTools.class | Bin 1609 -> 0 bytes .../provider/utils/NmsBoundingBox.class | Bin 15979 -> 0 bytes .../vcompat/provider/utils/Tracker.class | Bin 3778 -> 0 bytes .../wrapper/ConsoleReaderWrapper.class | Bin 584 -> 0 bytes .../vcompat/skin/DefaultMojangProvider.class | Bin 1659 -> 0 bytes .../vcompat/skin/DefaultSkinStore.class | Bin 3493 -> 0 bytes .../minecraft/vcompat/skin/Mojang.class | Bin 20883 -> 0 bytes .../vcompat/skin/MojangProvider.class | Bin 467 -> 0 bytes .../vcompat/skin/PersistentSkinStore.class | Bin 4172 -> 0 bytes .../minecraft/vcompat/skin/Profile.class | Bin 5222 -> 0 bytes .../minecraft/vcompat/skin/SkinStore.class | Bin 3543 -> 0 bytes .../vcompat/util/bukkit/BukkitColor.class | Bin 1907 -> 0 bytes .../vcompat/util/bukkit/Players.class | Bin 3634 -> 0 bytes .../vcompat/util/bukkit/unsafe/KeyCache.class | Bin 2992 -> 0 bytes .../util/constants/DefaultConstants.class | Bin 754 -> 0 bytes .../util/constants/MinecraftConstants.class | Bin 548 -> 0 bytes .../util/java/function/TriPredicate.class | Bin 3174 -> 0 bytes .../util/java/net/EasyContentRegistry.class | Bin 2048 -> 0 bytes .../vcompat/util/java/net/EasyRequest.class | Bin 11815 -> 0 bytes .../util/java/net/EasyRequestType.class | Bin 2289 -> 0 bytes .../vcompat/util/java/net/EasyResponse.class | Bin 5485 -> 0 bytes .../util/java/net/EasyResponseCode.class | Bin 4227 -> 0 bytes .../vcompat/util/java/net/IEasyContent.class | Bin 1223 -> 0 bytes .../util/java/net/IEasyTextContent.class | Bin 1971 -> 0 bytes .../java/net/content/EasyJsonContent.class | Bin 1990 -> 0 bytes .../net/content/EasyUrlEncodedContent.class | Bin 5064 -> 0 bytes .../util/java/net/tools/HeaderParser.class | Bin 3953 -> 0 bytes .../util/java/net/tools/UrlEncoder.class | Bin 6572 -> 0 bytes .../vcompat/util/java/tools/ArrayTools.class | Bin 1339 -> 0 bytes .../vcompat/util/java/tools/OptionTools.class | Bin 689 -> 0 bytes .../util/java/tools/ReflectionTools.class | Bin 3213 -> 0 bytes .../vcompat/util/java/tools/UUIDHelper.class | Bin 1508 -> 0 bytes .../vcompat/util/logging/BukkitLogType.class | Bin 2439 -> 0 bytes .../vcompat/util/logging/BukkitLogger.class | Bin 17314 -> 0 bytes .../vcompat/util/logging/LoggingColors.class | Bin 5013 -> 0 bytes .../util/minecraft/MojangProfileServer.class | Bin 5592 -> 0 bytes .../vcompat/util/minecraft/Skin.class | Bin 6254 -> 0 bytes .../vcompat/util/minecraft/SkinModel.class | Bin 1798 -> 0 bytes .../vcompat/util/thread/PostAsync.class | Bin 1384 -> 0 bytes .../util/validation/ValidationHelper.class | Bin 811 -> 0 bytes .../ServerVersion$ServerAnalyzer.class | Bin 2377 -> 0 bytes .../vcompat/version/ServerVersion.class | Bin 5218 -> 0 bytes .../minecraft/vcompat/version/Versions.class | Bin 5639 -> 0 bytes .../minecraft/vcompat/VersionCompat.java | 5 +- .../minecraft/vcompat/VersionCompat.class | Bin 2509 -> 0 bytes vcompat-legacy/.gitignore | 12 + vcompat-legacy/pom.xml | 194 ++++++++++++ .../v1_10_R1/BukkitConversion1_10_R1.java | 231 ++++++++++++++ .../impl/v1_10_R1/EntityProvider1_10_R1.java | 47 +++ .../impl/v1_10_R1/PacketHandler1_10_R1.java | 11 + .../impl/v1_10_R1/PlayerProvider1_10_R1.java | 30 ++ .../impl/v1_10_R1/TextureProvider1_10_R1.java | 105 +++++++ .../impl/v1_10_R1/ToolProvider1_10_R1.java | 33 ++ .../impl/v1_10_R1/VersionControl1_10_R1.java | 56 ++++ .../v1_10_R1/entity/ArmorStand1_10_R1.java | 23 ++ .../impl/v1_10_R1/entity/Entity1_10_R1.java | 215 +++++++++++++ .../v1_10_R1/entity/EntityLiving1_10_R1.java | 17 + .../impl/v1_10_R1/entity/Player1_10_R1.java | 296 ++++++++++++++++++ .../reflection/NmsReflection1_10_R1.java | 34 ++ .../v1_10_R1/tools/BlockTools1_10_R1.java | 39 +++ .../v1_10_R1/tools/ServerTools1_10_R1.java | 26 ++ .../impl/v1_10_R1/tools/SkinTools1_10_R1.java | 16 + .../utils/EntityConstructors1_10_R1.java | 12 + .../wrapper/ConsoleReaderWrapper1_10_R1.java | 43 +++ .../v1_11_R1/BukkitConversion1_11_R1.java | 228 ++++++++++++++ .../impl/v1_11_R1/EntityProvider1_11_R1.java | 47 +++ .../impl/v1_11_R1/PacketHandler1_11_R1.java | 11 + .../impl/v1_11_R1/PlayerProvider1_11_R1.java | 30 ++ .../impl/v1_11_R1/TextureProvider1_11_R1.java | 103 ++++++ .../impl/v1_11_R1/ToolProvider1_11_R1.java | 33 ++ .../impl/v1_11_R1/VersionControl1_11_R1.java | 56 ++++ .../v1_11_R1/entity/ArmorStand1_11_R1.java | 23 ++ .../impl/v1_11_R1/entity/Entity1_11_R1.java | 215 +++++++++++++ .../v1_11_R1/entity/EntityLiving1_11_R1.java | 17 + .../impl/v1_11_R1/entity/Player1_11_R1.java | 295 +++++++++++++++++ .../reflection/NmsReflection1_11_R1.java | 34 ++ .../v1_11_R1/tools/BlockTools1_11_R1.java | 39 +++ .../v1_11_R1/tools/ServerTools1_11_R1.java | 26 ++ .../impl/v1_11_R1/tools/SkinTools1_11_R1.java | 16 + .../utils/EntityConstructors1_11_R1.java | 12 + .../wrapper/ConsoleReaderWrapper1_11_R1.java | 43 +++ .../v1_12_R1/BukkitConversion1_12_R1.java | 226 +++++++++++++ .../impl/v1_12_R1/EntityProvider1_12_R1.java | 47 +++ .../impl/v1_12_R1/PacketHandler1_12_R1.java | 11 + .../impl/v1_12_R1/PlayerProvider1_12_R1.java | 30 ++ .../impl/v1_12_R1/TextureProvider1_12_R1.java | 108 +++++++ .../impl/v1_12_R1/ToolProvider1_12_R1.java | 33 ++ .../impl/v1_12_R1/VersionControl1_12_R1.java | 56 ++++ .../v1_12_R1/entity/ArmorStand1_12_R1.java | 23 ++ .../impl/v1_12_R1/entity/Entity1_12_R1.java | 215 +++++++++++++ .../v1_12_R1/entity/EntityLiving1_12_R1.java | 17 + .../impl/v1_12_R1/entity/Player1_12_R1.java | 295 +++++++++++++++++ .../reflection/NmsReflection1_12_R1.java | 36 +++ .../v1_12_R1/tools/BlockTools1_12_R1.java | 39 +++ .../v1_12_R1/tools/ServerTools1_12_R1.java | 26 ++ .../impl/v1_12_R1/tools/SkinTools1_12_R1.java | 16 + .../utils/EntityConstructors1_12_R1.java | 12 + .../wrapper/ConsoleReaderWrapper1_12_R1.java | 43 +++ .../v1_13_R1/BukkitConversion1_13_R1.java | 218 +++++++++++++ .../impl/v1_13_R1/EntityProvider1_13_R1.java | 47 +++ .../impl/v1_13_R1/PacketHandler1_13_R1.java | 11 + .../impl/v1_13_R1/PlayerProvider1_13_R1.java | 30 ++ .../impl/v1_13_R1/TextureProvider1_13_R1.java | 102 ++++++ .../impl/v1_13_R1/ToolProvider1_13_R1.java | 33 ++ .../impl/v1_13_R1/VersionControl1_13_R1.java | 54 ++++ .../v1_13_R1/entity/ArmorStand1_13_R1.java | 23 ++ .../impl/v1_13_R1/entity/Entity1_13_R1.java | 216 +++++++++++++ .../v1_13_R1/entity/EntityLiving1_13_R1.java | 17 + .../impl/v1_13_R1/entity/Player1_13_R1.java | 293 +++++++++++++++++ .../v1_13_R1/tools/BlockTools1_13_R1.java | 39 +++ .../v1_13_R1/tools/ServerTools1_13_R1.java | 26 ++ .../impl/v1_13_R1/tools/SkinTools1_13_R1.java | 16 + .../utils/EntityConstructors1_13_R1.java | 12 + .../wrapper/ConsoleReaderWrapper1_13_R1.java | 43 +++ .../v1_13_R2/BukkitConversion1_13_R2.java | 218 +++++++++++++ .../impl/v1_13_R2/EntityProvider1_13_R2.java | 47 +++ .../impl/v1_13_R2/PacketHandler1_13_R2.java | 11 + .../impl/v1_13_R2/PlayerProvider1_13_R2.java | 30 ++ .../impl/v1_13_R2/TextureProvider1_13_R2.java | 102 ++++++ .../impl/v1_13_R2/ToolProvider1_13_R2.java | 33 ++ .../impl/v1_13_R2/VersionControl1_13_R2.java | 54 ++++ .../v1_13_R2/entity/ArmorStand1_13_R2.java | 23 ++ .../impl/v1_13_R2/entity/Entity1_13_R2.java | 216 +++++++++++++ .../v1_13_R2/entity/EntityLiving1_13_R2.java | 17 + .../impl/v1_13_R2/entity/Player1_13_R2.java | 293 +++++++++++++++++ .../v1_13_R2/tools/BlockTools1_13_R2.java | 39 +++ .../v1_13_R2/tools/ServerTools1_13_R2.java | 26 ++ .../impl/v1_13_R2/tools/SkinTools1_13_R2.java | 16 + .../utils/EntityConstructors1_13_R2.java | 12 + .../wrapper/ConsoleReaderWrapper1_13_R2.java | 43 +++ .../v1_14_R1/BukkitConversion1_14_R1.java | 218 +++++++++++++ .../impl/v1_14_R1/EntityProvider1_14_R1.java | 47 +++ .../impl/v1_14_R1/PacketHandler1_14_R1.java | 11 + .../impl/v1_14_R1/PlayerProvider1_14_R1.java | 20 ++ .../impl/v1_14_R1/TextureProvider1_14_R1.java | 102 ++++++ .../impl/v1_14_R1/ToolProvider1_14_R1.java | 33 ++ .../impl/v1_14_R1/VersionControl1_14_R1.java | 61 ++++ .../v1_14_R1/data/BukkitContainer1_14_R1.java | 160 ++++++++++ .../v1_14_R1/data/BukkitContext1_14_R1.java | 39 +++ .../impl/v1_14_R1/data/BukkitKey1_14_R1.java | 52 +++ .../impl/v1_14_R1/data/BukkitType1_14_R1.java | 69 ++++ .../data/SimpleBukkitType1_14_R1.java | 36 +++ .../v1_14_R1/data/SyntaxContainer1_14_R1.java | 185 +++++++++++ .../v1_14_R1/data/SyntaxContext1_14_R1.java | 38 +++ .../impl/v1_14_R1/data/SyntaxType1_14_R1.java | 76 +++++ .../v1_14_R1/data/WrappedType1_14_R1.java | 150 +++++++++ .../BukkitContainerAdapterHook1_14_R1.java | 134 ++++++++ .../v1_14_R1/entity/ArmorStand1_14_R1.java | 24 ++ .../impl/v1_14_R1/entity/Entity1_14_R1.java | 215 +++++++++++++ .../v1_14_R1/entity/EntityLiving1_14_R1.java | 17 + .../impl/v1_14_R1/entity/Player1_14_R1.java | 289 +++++++++++++++++ .../v1_14_R1/tools/BlockTools1_14_R1.java | 39 +++ .../v1_14_R1/tools/ServerTools1_14_R1.java | 27 ++ .../impl/v1_14_R1/tools/SkinTools1_14_R1.java | 16 + .../utils/EntityConstructors1_14_R1.java | 12 + .../wrapper/ConsoleReaderWrapper1_14_R1.java | 43 +++ .../v1_15_R1/BukkitConversion1_15_R1.java | 218 +++++++++++++ .../impl/v1_15_R1/EntityProvider1_15_R1.java | 47 +++ .../impl/v1_15_R1/PacketHandler1_15_R1.java | 11 + .../impl/v1_15_R1/PlayerProvider1_15_R1.java | 20 ++ .../impl/v1_15_R1/TextureProvider1_15_R1.java | 102 ++++++ .../impl/v1_15_R1/ToolProvider1_15_R1.java | 33 ++ .../impl/v1_15_R1/VersionControl1_15_R1.java | 61 ++++ .../v1_15_R1/data/BukkitContainer1_15_R1.java | 160 ++++++++++ .../v1_15_R1/data/BukkitContext1_15_R1.java | 39 +++ .../impl/v1_15_R1/data/BukkitKey1_15_R1.java | 52 +++ .../impl/v1_15_R1/data/BukkitType1_15_R1.java | 69 ++++ .../data/SimpleBukkitType1_15_R1.java | 36 +++ .../v1_15_R1/data/SyntaxContainer1_15_R1.java | 185 +++++++++++ .../v1_15_R1/data/SyntaxContext1_15_R1.java | 38 +++ .../impl/v1_15_R1/data/SyntaxType1_15_R1.java | 76 +++++ .../v1_15_R1/data/WrappedType1_15_R1.java | 150 +++++++++ .../BukkitContainerAdapterHook1_15_R1.java | 134 ++++++++ .../v1_15_R1/entity/ArmorStand1_15_R1.java | 24 ++ .../impl/v1_15_R1/entity/Entity1_15_R1.java | 215 +++++++++++++ .../v1_15_R1/entity/EntityLiving1_15_R1.java | 17 + .../impl/v1_15_R1/entity/Player1_15_R1.java | 289 +++++++++++++++++ .../v1_15_R1/tools/BlockTools1_15_R1.java | 39 +++ .../v1_15_R1/tools/ServerTools1_15_R1.java | 27 ++ .../impl/v1_15_R1/tools/SkinTools1_15_R1.java | 16 + .../utils/EntityConstructors1_15_R1.java | 12 + .../wrapper/ConsoleReaderWrapper1_15_R1.java | 43 +++ .../v1_16_R1/BukkitConversion1_16_R1.java | 218 +++++++++++++ .../impl/v1_16_R1/EntityProvider1_16_R1.java | 47 +++ .../impl/v1_16_R1/PacketHandler1_16_R1.java | 11 + .../impl/v1_16_R1/PlayerProvider1_16_R1.java | 20 ++ .../impl/v1_16_R1/TextureProvider1_16_R1.java | 102 ++++++ .../impl/v1_16_R1/ToolProvider1_16_R1.java | 33 ++ .../impl/v1_16_R1/VersionControl1_16_R1.java | 61 ++++ .../v1_16_R1/data/BukkitContainer1_16_R1.java | 161 ++++++++++ .../v1_16_R1/data/BukkitContext1_16_R1.java | 39 +++ .../impl/v1_16_R1/data/BukkitKey1_16_R1.java | 52 +++ .../impl/v1_16_R1/data/BukkitType1_16_R1.java | 69 ++++ .../data/SimpleBukkitType1_16_R1.java | 36 +++ .../v1_16_R1/data/SyntaxContainer1_16_R1.java | 185 +++++++++++ .../v1_16_R1/data/SyntaxContext1_16_R1.java | 38 +++ .../impl/v1_16_R1/data/SyntaxType1_16_R1.java | 76 +++++ .../v1_16_R1/data/WrappedType1_16_R1.java | 150 +++++++++ .../BukkitContainerAdapterHook1_16_R1.java | 134 ++++++++ .../v1_16_R1/entity/ArmorStand1_16_R1.java | 24 ++ .../impl/v1_16_R1/entity/Entity1_16_R1.java | 215 +++++++++++++ .../v1_16_R1/entity/EntityLiving1_16_R1.java | 17 + .../impl/v1_16_R1/entity/Player1_16_R1.java | 295 +++++++++++++++++ .../v1_16_R1/tools/BlockTools1_16_R1.java | 39 +++ .../v1_16_R1/tools/ServerTools1_16_R1.java | 27 ++ .../impl/v1_16_R1/tools/SkinTools1_16_R1.java | 16 + .../utils/EntityConstructors1_16_R1.java | 12 + .../wrapper/ConsoleReaderWrapper1_16_R1.java | 43 +++ .../v1_16_R2/BukkitConversion1_16_R2.java | 218 +++++++++++++ .../impl/v1_16_R2/EntityProvider1_16_R2.java | 47 +++ .../impl/v1_16_R2/PacketHandler1_16_R2.java | 11 + .../impl/v1_16_R2/PlayerProvider1_16_R2.java | 20 ++ .../impl/v1_16_R2/TextureProvider1_16_R2.java | 102 ++++++ .../impl/v1_16_R2/ToolProvider1_16_R2.java | 33 ++ .../impl/v1_16_R2/VersionControl1_16_R2.java | 61 ++++ .../v1_16_R2/data/BukkitContainer1_16_R2.java | 161 ++++++++++ .../v1_16_R2/data/BukkitContext1_16_R2.java | 39 +++ .../impl/v1_16_R2/data/BukkitKey1_16_R2.java | 52 +++ .../impl/v1_16_R2/data/BukkitType1_16_R2.java | 69 ++++ .../data/SimpleBukkitType1_16_R2.java | 36 +++ .../v1_16_R2/data/SyntaxContainer1_16_R2.java | 185 +++++++++++ .../v1_16_R2/data/SyntaxContext1_16_R2.java | 38 +++ .../impl/v1_16_R2/data/SyntaxType1_16_R2.java | 76 +++++ .../v1_16_R2/data/WrappedType1_16_R2.java | 150 +++++++++ .../BukkitContainerAdapterHook1_16_R2.java | 134 ++++++++ .../v1_16_R2/entity/ArmorStand1_16_R2.java | 24 ++ .../impl/v1_16_R2/entity/Entity1_16_R2.java | 215 +++++++++++++ .../v1_16_R2/entity/EntityLiving1_16_R2.java | 17 + .../impl/v1_16_R2/entity/Player1_16_R2.java | 295 +++++++++++++++++ .../v1_16_R2/tools/BlockTools1_16_R2.java | 39 +++ .../v1_16_R2/tools/ServerTools1_16_R2.java | 27 ++ .../impl/v1_16_R2/tools/SkinTools1_16_R2.java | 16 + .../utils/EntityConstructors1_16_R2.java | 12 + .../wrapper/ConsoleReaderWrapper1_16_R2.java | 43 +++ .../v1_16_R3/BukkitConversion1_16_R3.java | 218 +++++++++++++ .../impl/v1_16_R3/EntityProvider1_16_R3.java | 47 +++ .../impl/v1_16_R3/PacketHandler1_16_R3.java | 11 + .../impl/v1_16_R3/PlayerProvider1_16_R3.java | 20 ++ .../impl/v1_16_R3/TextureProvider1_16_R3.java | 102 ++++++ .../impl/v1_16_R3/ToolProvider1_16_R3.java | 33 ++ .../impl/v1_16_R3/VersionControl1_16_R3.java | 61 ++++ .../v1_16_R3/data/BukkitContainer1_16_R3.java | 161 ++++++++++ .../v1_16_R3/data/BukkitContext1_16_R3.java | 39 +++ .../impl/v1_16_R3/data/BukkitKey1_16_R3.java | 52 +++ .../impl/v1_16_R3/data/BukkitType1_16_R3.java | 69 ++++ .../data/SimpleBukkitType1_16_R3.java | 36 +++ .../v1_16_R3/data/SyntaxContainer1_16_R3.java | 185 +++++++++++ .../v1_16_R3/data/SyntaxContext1_16_R3.java | 38 +++ .../impl/v1_16_R3/data/SyntaxType1_16_R3.java | 76 +++++ .../v1_16_R3/data/WrappedType1_16_R3.java | 150 +++++++++ .../BukkitContainerAdapterHook1_16_R3.java | 134 ++++++++ .../v1_16_R3/entity/ArmorStand1_16_R3.java | 24 ++ .../impl/v1_16_R3/entity/Entity1_16_R3.java | 215 +++++++++++++ .../v1_16_R3/entity/EntityLiving1_16_R3.java | 17 + .../impl/v1_16_R3/entity/Player1_16_R3.java | 295 +++++++++++++++++ .../v1_16_R3/tools/BlockTools1_16_R3.java | 39 +++ .../v1_16_R3/tools/ServerTools1_16_R3.java | 27 ++ .../impl/v1_16_R3/tools/SkinTools1_16_R3.java | 16 + .../utils/EntityConstructors1_16_R3.java | 12 + .../wrapper/ConsoleReaderWrapper1_16_R3.java | 43 +++ .../impl/v1_8_R1/BukkitConversion1_8_R1.java | 232 ++++++++++++++ .../impl/v1_8_R1/EntityProvider1_8_R1.java | 47 +++ .../impl/v1_8_R1/PacketHandler1_8_R1.java | 11 + .../impl/v1_8_R1/PlayerProvider1_8_R1.java | 30 ++ .../impl/v1_8_R1/TextureProvider1_8_R1.java | 107 +++++++ .../impl/v1_8_R1/ToolProvider1_8_R1.java | 33 ++ .../impl/v1_8_R1/VersionControl1_8_R1.java | 56 ++++ .../impl/v1_8_R1/entity/ArmorStand1_8_R1.java | 33 ++ .../impl/v1_8_R1/entity/Entity1_8_R1.java | 213 +++++++++++++ .../v1_8_R1/entity/EntityLiving1_8_R1.java | 17 + .../impl/v1_8_R1/entity/Player1_8_R1.java | 295 +++++++++++++++++ .../reflection/NmsReflection1_8_R1.java | 34 ++ .../impl/v1_8_R1/tools/BlockTools1_8_R1.java | 39 +++ .../impl/v1_8_R1/tools/ServerTools1_8_R1.java | 26 ++ .../impl/v1_8_R1/tools/SkinTools1_8_R1.java | 16 + .../utils/EntityConstructors1_8_R1.java | 12 + .../wrapper/ConsoleReaderWrapper1_8_R1.java | 43 +++ .../impl/v1_8_R2/BukkitConversion1_8_R2.java | 231 ++++++++++++++ .../impl/v1_8_R2/EntityProvider1_8_R2.java | 47 +++ .../impl/v1_8_R2/PacketHandler1_8_R2.java | 11 + .../impl/v1_8_R2/PlayerProvider1_8_R2.java | 30 ++ .../impl/v1_8_R2/TextureProvider1_8_R2.java | 105 +++++++ .../impl/v1_8_R2/ToolProvider1_8_R2.java | 33 ++ .../impl/v1_8_R2/VersionControl1_8_R2.java | 56 ++++ .../impl/v1_8_R2/entity/ArmorStand1_8_R2.java | 33 ++ .../impl/v1_8_R2/entity/Entity1_8_R2.java | 213 +++++++++++++ .../v1_8_R2/entity/EntityLiving1_8_R2.java | 17 + .../impl/v1_8_R2/entity/Player1_8_R2.java | 295 +++++++++++++++++ .../reflection/NmsReflection1_8_R2.java | 34 ++ .../impl/v1_8_R2/tools/BlockTools1_8_R2.java | 39 +++ .../impl/v1_8_R2/tools/ServerTools1_8_R2.java | 26 ++ .../impl/v1_8_R2/tools/SkinTools1_8_R2.java | 16 + .../utils/EntityConstructors1_8_R2.java | 12 + .../wrapper/ConsoleReaderWrapper1_8_R2.java | 43 +++ .../impl/v1_8_R3/BukkitConversion1_8_R3.java | 231 ++++++++++++++ .../impl/v1_8_R3/EntityProvider1_8_R3.java | 47 +++ .../impl/v1_8_R3/PacketHandler1_8_R3.java | 11 + .../impl/v1_8_R3/PlayerProvider1_8_R3.java | 30 ++ .../impl/v1_8_R3/TextureProvider1_8_R3.java | 105 +++++++ .../impl/v1_8_R3/ToolProvider1_8_R3.java | 33 ++ .../impl/v1_8_R3/VersionControl1_8_R3.java | 56 ++++ .../impl/v1_8_R3/entity/ArmorStand1_8_R3.java | 33 ++ .../impl/v1_8_R3/entity/Entity1_8_R3.java | 213 +++++++++++++ .../v1_8_R3/entity/EntityLiving1_8_R3.java | 17 + .../impl/v1_8_R3/entity/Player1_8_R3.java | 295 +++++++++++++++++ .../reflection/NmsReflection1_8_R3.java | 34 ++ .../impl/v1_8_R3/tools/BlockTools1_8_R3.java | 39 +++ .../impl/v1_8_R3/tools/ServerTools1_8_R3.java | 26 ++ .../impl/v1_8_R3/tools/SkinTools1_8_R3.java | 16 + .../utils/EntityConstructors1_8_R3.java | 12 + .../wrapper/ConsoleReaderWrapper1_8_R3.java | 43 +++ .../impl/v1_9_R1/BukkitConversion1_9_R1.java | 231 ++++++++++++++ .../impl/v1_9_R1/EntityProvider1_9_R1.java | 47 +++ .../impl/v1_9_R1/PacketHandler1_9_R1.java | 11 + .../impl/v1_9_R1/PlayerProvider1_9_R1.java | 30 ++ .../impl/v1_9_R1/TextureProvider1_9_R1.java | 105 +++++++ .../impl/v1_9_R1/ToolProvider1_9_R1.java | 33 ++ .../impl/v1_9_R1/VersionControl1_9_R1.java | 56 ++++ .../impl/v1_9_R1/entity/ArmorStand1_9_R1.java | 33 ++ .../impl/v1_9_R1/entity/Entity1_9_R1.java | 213 +++++++++++++ .../v1_9_R1/entity/EntityLiving1_9_R1.java | 17 + .../impl/v1_9_R1/entity/Player1_9_R1.java | 296 ++++++++++++++++++ .../reflection/NmsReflection1_9_R1.java | 34 ++ .../impl/v1_9_R1/tools/BlockTools1_9_R1.java | 39 +++ .../impl/v1_9_R1/tools/ServerTools1_9_R1.java | 26 ++ .../impl/v1_9_R1/tools/SkinTools1_9_R1.java | 16 + .../utils/EntityConstructors1_9_R1.java | 12 + .../wrapper/ConsoleReaderWrapper1_9_R1.java | 43 +++ .../impl/v1_9_R2/BukkitConversion1_9_R2.java | 231 ++++++++++++++ .../impl/v1_9_R2/EntityProvider1_9_R2.java | 47 +++ .../impl/v1_9_R2/PacketHandler1_9_R2.java | 11 + .../impl/v1_9_R2/PlayerProvider1_9_R2.java | 30 ++ .../impl/v1_9_R2/TextureProvider1_9_R2.java | 105 +++++++ .../impl/v1_9_R2/ToolProvider1_9_R2.java | 33 ++ .../impl/v1_9_R2/VersionControl1_9_R2.java | 56 ++++ .../impl/v1_9_R2/entity/ArmorStand1_9_R2.java | 33 ++ .../impl/v1_9_R2/entity/Entity1_9_R2.java | 213 +++++++++++++ .../v1_9_R2/entity/EntityLiving1_9_R2.java | 17 + .../impl/v1_9_R2/entity/Player1_9_R2.java | 296 ++++++++++++++++++ .../reflection/NmsReflection1_9_R2.java | 34 ++ .../impl/v1_9_R2/tools/BlockTools1_9_R2.java | 39 +++ .../impl/v1_9_R2/tools/ServerTools1_9_R2.java | 26 ++ .../impl/v1_9_R2/tools/SkinTools1_9_R2.java | 16 + .../utils/EntityConstructors1_9_R2.java | 12 + .../wrapper/ConsoleReaderWrapper1_9_R2.java | 43 +++ 414 files changed, 23062 insertions(+), 1 deletion(-) delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/VersionCompatProvider.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/data/AbstractDataAdapter.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/data/AbstractDataAdapterRegistry.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/data/AbstractDataContainer.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/data/AbstractDataFactory.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/data/api/ChainDataType.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/data/api/DefaultDataType.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/data/api/IDataAdapter.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/data/api/IDataAdapterContext.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/data/api/IDataAdapterRegistry.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/data/api/IDataContainer.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/data/api/IDataFactory.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/data/api/IDataType.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/data/nbt/NbtAdapter.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/data/nbt/NbtAdapterRegistry.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/data/nbt/NbtContainer.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/data/util/NumberConversion.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/entity/Hologram$HologramBuilder.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/entity/Hologram.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/entity/attributes/Nameable.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/CustomEntity.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/DefaultEntityType.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/EntityBuilder.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/EntityManager.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/EntityRegistry.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/EntityType.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/listener/PlayerListener.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/listener/handler/IPlayerHandler.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/BukkitConversion.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/DataProvider.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/EntityProvider.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/PlayerProvider.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/TextureProvider.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/ToolProvider.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/VersionControl.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/VersionHandler.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/WrapType.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/WrappedContainer.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/WrappedContext.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/WrappedKey.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/persistence/DataDistributor.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/persistence/DataObserver.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/persistence/PersistentContainer.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/type/ObjectType.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/type/SkinDataType.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/wrap/SimpleSyntaxContainer.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/wrap/SimpleSyntaxContext.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/wrap/SimpleSyntaxType.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/wrap/SimpleWrapType.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/wrap/SyntaxKey.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/entity/NmsArmorStand.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/entity/NmsEntity.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/entity/NmsEntityLiving.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/entity/NmsEntityType.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/entity/NmsPlayer.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/lookup/ClassLookupProvider.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/lookup/ClassLookups.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/ClassLookup.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/ClassLookupCache.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/FakeLookup.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/field/IFieldHandle.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/field/SafeFieldHandle.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/field/UnsafeDeclaredFieldHandle.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/field/UnsafeFieldHandle.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/field/UnsafeStaticFieldHandle.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/lookup/provider/GeneralReflections.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/tools/BlockTools.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/tools/ServerTools.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/tools/SkinTools.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/utils/NmsBoundingBox.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/utils/Tracker.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/wrapper/ConsoleReaderWrapper.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/skin/DefaultMojangProvider.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/skin/DefaultSkinStore.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/skin/Mojang.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/skin/MojangProvider.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/skin/PersistentSkinStore.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/skin/Profile.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/skin/SkinStore.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/bukkit/BukkitColor.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/bukkit/Players.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/bukkit/unsafe/KeyCache.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/constants/DefaultConstants.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/constants/MinecraftConstants.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/function/TriPredicate.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/net/EasyContentRegistry.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/net/EasyRequest.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/net/EasyRequestType.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/net/EasyResponse.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/net/EasyResponseCode.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/net/IEasyContent.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/net/IEasyTextContent.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/net/content/EasyJsonContent.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/net/content/EasyUrlEncodedContent.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/net/tools/HeaderParser.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/net/tools/UrlEncoder.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/tools/ArrayTools.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/tools/OptionTools.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/tools/ReflectionTools.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/tools/UUIDHelper.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/logging/BukkitLogType.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/logging/BukkitLogger.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/logging/LoggingColors.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/minecraft/MojangProfileServer.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/minecraft/Skin.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/minecraft/SkinModel.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/thread/PostAsync.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/validation/ValidationHelper.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/version/ServerVersion$ServerAnalyzer.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/version/ServerVersion.class delete mode 100644 vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/version/Versions.class delete mode 100644 vcompat-core/target/classes/net/sourcewriters/minecraft/vcompat/VersionCompat.class create mode 100644 vcompat-legacy/.gitignore create mode 100644 vcompat-legacy/pom.xml create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/BukkitConversion1_10_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/EntityProvider1_10_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/PacketHandler1_10_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/PlayerProvider1_10_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/TextureProvider1_10_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/ToolProvider1_10_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/VersionControl1_10_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/entity/ArmorStand1_10_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/entity/Entity1_10_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/entity/EntityLiving1_10_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/entity/Player1_10_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/reflection/NmsReflection1_10_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/tools/BlockTools1_10_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/tools/ServerTools1_10_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/tools/SkinTools1_10_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/utils/EntityConstructors1_10_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/wrapper/ConsoleReaderWrapper1_10_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/BukkitConversion1_11_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/EntityProvider1_11_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/PacketHandler1_11_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/PlayerProvider1_11_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/TextureProvider1_11_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/ToolProvider1_11_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/VersionControl1_11_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/entity/ArmorStand1_11_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/entity/Entity1_11_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/entity/EntityLiving1_11_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/entity/Player1_11_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/reflection/NmsReflection1_11_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/tools/BlockTools1_11_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/tools/ServerTools1_11_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/tools/SkinTools1_11_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/utils/EntityConstructors1_11_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/wrapper/ConsoleReaderWrapper1_11_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/BukkitConversion1_12_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/EntityProvider1_12_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/PacketHandler1_12_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/PlayerProvider1_12_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/TextureProvider1_12_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/ToolProvider1_12_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/VersionControl1_12_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/entity/ArmorStand1_12_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/entity/Entity1_12_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/entity/EntityLiving1_12_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/entity/Player1_12_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/reflection/NmsReflection1_12_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/tools/BlockTools1_12_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/tools/ServerTools1_12_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/tools/SkinTools1_12_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/utils/EntityConstructors1_12_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/wrapper/ConsoleReaderWrapper1_12_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/BukkitConversion1_13_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/EntityProvider1_13_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/PacketHandler1_13_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/PlayerProvider1_13_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/TextureProvider1_13_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/ToolProvider1_13_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/VersionControl1_13_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/entity/ArmorStand1_13_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/entity/Entity1_13_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/entity/EntityLiving1_13_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/entity/Player1_13_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/tools/BlockTools1_13_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/tools/ServerTools1_13_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/tools/SkinTools1_13_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/utils/EntityConstructors1_13_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/wrapper/ConsoleReaderWrapper1_13_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/BukkitConversion1_13_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/EntityProvider1_13_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/PacketHandler1_13_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/PlayerProvider1_13_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/TextureProvider1_13_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/ToolProvider1_13_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/VersionControl1_13_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/entity/ArmorStand1_13_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/entity/Entity1_13_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/entity/EntityLiving1_13_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/entity/Player1_13_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/tools/BlockTools1_13_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/tools/ServerTools1_13_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/tools/SkinTools1_13_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/utils/EntityConstructors1_13_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/wrapper/ConsoleReaderWrapper1_13_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/BukkitConversion1_14_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/EntityProvider1_14_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/PacketHandler1_14_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/PlayerProvider1_14_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/TextureProvider1_14_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/ToolProvider1_14_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/VersionControl1_14_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/BukkitContainer1_14_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/BukkitContext1_14_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/BukkitKey1_14_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/BukkitType1_14_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/SimpleBukkitType1_14_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/SyntaxContainer1_14_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/SyntaxContext1_14_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/SyntaxType1_14_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/WrappedType1_14_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/hook/BukkitContainerAdapterHook1_14_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/entity/ArmorStand1_14_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/entity/Entity1_14_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/entity/EntityLiving1_14_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/entity/Player1_14_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/tools/BlockTools1_14_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/tools/ServerTools1_14_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/tools/SkinTools1_14_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/utils/EntityConstructors1_14_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/wrapper/ConsoleReaderWrapper1_14_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/BukkitConversion1_15_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/EntityProvider1_15_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/PacketHandler1_15_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/PlayerProvider1_15_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/TextureProvider1_15_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/ToolProvider1_15_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/VersionControl1_15_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/BukkitContainer1_15_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/BukkitContext1_15_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/BukkitKey1_15_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/BukkitType1_15_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/SimpleBukkitType1_15_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/SyntaxContainer1_15_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/SyntaxContext1_15_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/SyntaxType1_15_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/WrappedType1_15_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/hook/BukkitContainerAdapterHook1_15_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/entity/ArmorStand1_15_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/entity/Entity1_15_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/entity/EntityLiving1_15_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/entity/Player1_15_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/tools/BlockTools1_15_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/tools/ServerTools1_15_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/tools/SkinTools1_15_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/utils/EntityConstructors1_15_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/wrapper/ConsoleReaderWrapper1_15_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/BukkitConversion1_16_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/EntityProvider1_16_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/PacketHandler1_16_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/PlayerProvider1_16_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/TextureProvider1_16_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/ToolProvider1_16_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/VersionControl1_16_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/BukkitContainer1_16_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/BukkitContext1_16_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/BukkitKey1_16_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/BukkitType1_16_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/SimpleBukkitType1_16_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/SyntaxContainer1_16_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/SyntaxContext1_16_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/SyntaxType1_16_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/WrappedType1_16_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/hook/BukkitContainerAdapterHook1_16_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/entity/ArmorStand1_16_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/entity/Entity1_16_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/entity/EntityLiving1_16_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/entity/Player1_16_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/tools/BlockTools1_16_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/tools/ServerTools1_16_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/tools/SkinTools1_16_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/utils/EntityConstructors1_16_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/wrapper/ConsoleReaderWrapper1_16_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/BukkitConversion1_16_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/EntityProvider1_16_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/PacketHandler1_16_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/PlayerProvider1_16_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/TextureProvider1_16_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/ToolProvider1_16_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/VersionControl1_16_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/BukkitContainer1_16_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/BukkitContext1_16_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/BukkitKey1_16_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/BukkitType1_16_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/SimpleBukkitType1_16_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/SyntaxContainer1_16_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/SyntaxContext1_16_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/SyntaxType1_16_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/WrappedType1_16_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/hook/BukkitContainerAdapterHook1_16_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/entity/ArmorStand1_16_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/entity/Entity1_16_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/entity/EntityLiving1_16_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/entity/Player1_16_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/tools/BlockTools1_16_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/tools/ServerTools1_16_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/tools/SkinTools1_16_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/utils/EntityConstructors1_16_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/wrapper/ConsoleReaderWrapper1_16_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/BukkitConversion1_16_R3.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/EntityProvider1_16_R3.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/PacketHandler1_16_R3.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/PlayerProvider1_16_R3.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/TextureProvider1_16_R3.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/ToolProvider1_16_R3.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/VersionControl1_16_R3.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/BukkitContainer1_16_R3.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/BukkitContext1_16_R3.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/BukkitKey1_16_R3.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/BukkitType1_16_R3.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/SimpleBukkitType1_16_R3.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/SyntaxContainer1_16_R3.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/SyntaxContext1_16_R3.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/SyntaxType1_16_R3.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/WrappedType1_16_R3.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/hook/BukkitContainerAdapterHook1_16_R3.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/entity/ArmorStand1_16_R3.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/entity/Entity1_16_R3.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/entity/EntityLiving1_16_R3.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/entity/Player1_16_R3.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/tools/BlockTools1_16_R3.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/tools/ServerTools1_16_R3.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/tools/SkinTools1_16_R3.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/utils/EntityConstructors1_16_R3.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/wrapper/ConsoleReaderWrapper1_16_R3.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/BukkitConversion1_8_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/EntityProvider1_8_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/PacketHandler1_8_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/PlayerProvider1_8_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/TextureProvider1_8_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/ToolProvider1_8_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/VersionControl1_8_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/entity/ArmorStand1_8_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/entity/Entity1_8_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/entity/EntityLiving1_8_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/entity/Player1_8_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/reflection/NmsReflection1_8_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/tools/BlockTools1_8_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/tools/ServerTools1_8_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/tools/SkinTools1_8_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/utils/EntityConstructors1_8_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/wrapper/ConsoleReaderWrapper1_8_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/BukkitConversion1_8_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/EntityProvider1_8_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/PacketHandler1_8_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/PlayerProvider1_8_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/TextureProvider1_8_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/ToolProvider1_8_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/VersionControl1_8_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/entity/ArmorStand1_8_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/entity/Entity1_8_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/entity/EntityLiving1_8_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/entity/Player1_8_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/reflection/NmsReflection1_8_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/tools/BlockTools1_8_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/tools/ServerTools1_8_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/tools/SkinTools1_8_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/utils/EntityConstructors1_8_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/wrapper/ConsoleReaderWrapper1_8_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/BukkitConversion1_8_R3.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/EntityProvider1_8_R3.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/PacketHandler1_8_R3.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/PlayerProvider1_8_R3.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/TextureProvider1_8_R3.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/ToolProvider1_8_R3.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/VersionControl1_8_R3.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/entity/ArmorStand1_8_R3.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/entity/Entity1_8_R3.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/entity/EntityLiving1_8_R3.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/entity/Player1_8_R3.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/reflection/NmsReflection1_8_R3.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/tools/BlockTools1_8_R3.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/tools/ServerTools1_8_R3.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/tools/SkinTools1_8_R3.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/utils/EntityConstructors1_8_R3.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/wrapper/ConsoleReaderWrapper1_8_R3.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/BukkitConversion1_9_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/EntityProvider1_9_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/PacketHandler1_9_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/PlayerProvider1_9_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/TextureProvider1_9_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/ToolProvider1_9_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/VersionControl1_9_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/entity/ArmorStand1_9_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/entity/Entity1_9_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/entity/EntityLiving1_9_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/entity/Player1_9_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/reflection/NmsReflection1_9_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/tools/BlockTools1_9_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/tools/ServerTools1_9_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/tools/SkinTools1_9_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/utils/EntityConstructors1_9_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/wrapper/ConsoleReaderWrapper1_9_R1.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/BukkitConversion1_9_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/EntityProvider1_9_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/PacketHandler1_9_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/PlayerProvider1_9_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/TextureProvider1_9_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/ToolProvider1_9_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/VersionControl1_9_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/entity/ArmorStand1_9_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/entity/Entity1_9_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/entity/EntityLiving1_9_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/entity/Player1_9_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/reflection/NmsReflection1_9_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/tools/BlockTools1_9_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/tools/ServerTools1_9_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/tools/SkinTools1_9_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/utils/EntityConstructors1_9_R2.java create mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/wrapper/ConsoleReaderWrapper1_9_R2.java diff --git a/pom.xml b/pom.xml index 1ce70ec..f8244cd 100644 --- a/pom.xml +++ b/pom.xml @@ -69,5 +69,6 @@ vcompat-api vcompat-core + vcompat-legacy \ No newline at end of file diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/VersionCompatProvider.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/VersionCompatProvider.class deleted file mode 100644 index 05be7a97be0fa92d9f11d1bf4ff35a9284062f72..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1960 zcmb_dU31e$6g_L3$X1mAPAF|kOVXyqc1zThmM@#6V3Ib)ByLO%VfwOB7H5f~)kt!h z_Menrz+*pVoD9rBdFexc6T|ebEF6dOz_|5{EbZOBckem(?%BUzJbD7)0@e(q7%q7t zvP0Dl9PwiyBN2r5w)BJ(@OzQHhozF;`f?~=?Hn^~Nv{ALav zKoe8AXyFnrGYoOx7v2WL+1I)ECDDzTFhW?SP_b}Dqt8aFJ85DbR}Fl{u=plr^b;Mh zU8T0#zP-u44OiGPv9;Kw8~qx?53fz_|Jj0&%;UO+1>G7M-Q5PhW;lIN=q1+`E$%iV z9*KorNB9vbSr$tS(^c+GM-$pfa##K=CJxd3Qs*X3EaIGQ!J37eSf)A$!gsktjZ*7} z))m0=zz14yQMd4&7Ke0V2hUL~qb|vkhCEwY57A z%?*!%#1nAC1xN%$FL(eR3USWNcD=QoG!hqy=bSm`JKy;m`=5Vb{0-nPKF=d1Q1@MB zhuwbQxZek!a)Z!5^nBL|FKVy61bUA@EIk7^!xO;*`1=>r*Z(djiKJ5e(PiFm+wB zv*6;oo^2Erl4EC@-F4jTu6R(WJf5I3aTet_C z=EjksnnDeq6r z1Qy28qNNbX={%nhuQqj#vf0&d=%&Xbxj1H+ZgX&fAL~2!M|m{I=r+da8l$e~pTpsY zHaUcu675);{<6r>TGGwzR0RJWVpKYb?)_Hx(OmCs_TBZqq2S4RZ8RpFY{Z|`K^kw2;5A--Wq{j9)?{#C+uz5 zG23@F><>hbt5hPk%WHq&y`Qi^$JI!@`xow~@H2hCbI6Qtipk`v4mod};|7%QDIO4i z&S`LGO3Zg$oDI68-yEwC@)TR3nc(zLb5aRT#Q~=kE+~nobGq?bPNvQ!;>( diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/data/AbstractDataAdapterRegistry.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/data/AbstractDataAdapterRegistry.class deleted file mode 100644 index feca1055f317d51e87db506efd30a8dafe558e26..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6118 zcmcIo`F9i775<(qdq50WG1!FFKpbMrE^1hk6bXYdIB{cxi(M!rUB=Sb9vDlCG%}bj z>5?{So9-*=nr?JSTat#bq@{FCo2JV-{i(n9@91gz-I#z@*mZZdgv{Ir>IG&CvnEm*!$u#$sygexpF zJar{18FICh9m`G*QFlsV`KUFSGn{hKR5)?VaC&Ib>eGqtv4bi8@8v&*#__UcXBCcg zdMaEy`)#9CN_8z>2?d``kL(SJ^jw$f-z%Eu=t?Jgm!d8`Hj*0a_l#0#$`nn*q1P_V z(US@x@{9~QcA}iiI95KF9PmH<*=|tg4ld0-|GF*r(7xU|*wZw*(pw*+@0T~4M9+!* zB^Y!|0Mb^@a(WdSI=hZ5MEmnuGlmAV>bL_f8rCYT4(Q%jEE==I`54;J8pC>Q)UZLJ zHJH+$w{0dKV^h+x37eTOrP*9&s+iAN=gq7vR@ml8JIJA~P;lL(S`LLRIy5X>j&11B zaF@b;x1UL4vjtPf-Po=W8#y*OJUBLZ{P3v4TOL_N#)z=g3c~5s(S?M9K5055MQhq} ztQnGcb*FDeC^KWUqesUI=qs=TZ`P1hSQWTSY}Iiub}|A+mdV{3P6R&_yG|)I53wX3 zDNm1^#W7>trnZ)$e8#Yk8%0anerME~vRI=A7H-`doLDYVtX zq&Oey!wZ)=55}}x9u*c-W(8q7!Fr~!a?~+0XNHY}3r-WhM9&tDg2MKC0SVP6KSl~` z>rEs&NvDH4`h_sdNEo-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}QZd5IO(<~VEBHtuCcUm(kGd63T;jM?v#SM5#C92DZB^8BbeBp>VXg-3 z;uE;8P}c+}4d6>x_RSEy7}YR{F$Qlmwi^V)goXg_iPe;bUbT9lA&frZo7FIYK8F4b zHSWiHY0tEC#$J(nV=z<68^vA2wuIeu`uL$$V@TcZj=DOZ+F;~gaB9|Of$cjXi-$+g zIJY6YGjw3`wCZDqp=iu~9f-$RyH{Nj292^?+NWcry6uP2+mV(7%hj?i+|(dUw9;+5 z7(R5N6bTd~oqD0;c>vECrsa^ltN}H=z)OZ6qgpMVGOV`tT9ele$p`XkJ~3?ET`&fM zlQUXe)r&FjNadw-c1f@-2`0dT&g+HRizH+S?Z~&^mL)o7*mcjB1uKRx$?RG?!E^`T zMh9Q2J@r4t6YsHRbEFcOrN;NtuLnMw6*L`a9i;cV2O+X)MmV;ZB{V4~TE5X$xeS)P|t^|S)PiTFSIZu|#3=wygsX3YbPG*EM z8J;5QoF^vFvrb--*AxGa$*;6f)cw*qDrsseph;7dzwn6i4DlA&g*Mo6H|*36VF$42 zuw9a{1)?Xk(1`8K;=)fXd*Mc(ljyT5&e2vQ&0focXjq}|Jdf0IL@K3Gl+sb`t&)#E jxLRtzZL2+fN$vS-Yp-2VdkqPy?Lm@G=)t?@y-WQC(yGHd diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/data/api/IDataAdapter.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/data/api/IDataAdapter.class deleted file mode 100644 index 2d21ff59cd8bd5607acc87fe405274f6182e92ea..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 644 zcmZva-A=+V6vt0dHa--Gi0}kv+}KN_5E7X&Au(|YyYlWZ>QXYs(iX&5^TG%4p^S$? za0$EX@ATKxe?NYHzrF$B4!Sm!7~ChqaJ^iqP<$w9gwlK=6A>zWH+&r~7bzM(LxUVs z$;VGLdYoZOq7A1EoH?$M$CyO?bvhTJVNj2R8KD-zXDS%9+}_K-qvvzBzu5o8I#@2U-Iqt z?ilz3|KT{MS5O-j)P~1PEd~ru=pO)B^o(V&h;5=0REVoNt`XOBd`5f@je~zd?Buvf Td?u?l&18zn z%s0>1{Q+QxUW9=2^i`#Ozpbp~Y_F-74n72iLiA z>gFP}3B!ad7Ac#HIGhqC9bsTp-9*^8S;AsG+5bQFEtnJf#}DOJr;0H8K{9P1LIR=X Q4+7-DItUww$ZLS^8+IB^PXGV_ diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/data/api/IDataAdapterRegistry.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/data/api/IDataAdapterRegistry.class deleted file mode 100644 index 12670794a75d794a9d79c1bdc5d2f6a9b18e26c5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 517 zcmZvZ%}&BV5XWb+vVvbIB4C2&&MvmJ{JIR1sx7G2K`i8VJ1@@$+=cmY9q!fm666*D`wGToS_v%v?wrB z;_ilC{UK%~e3Y>=R)27C7_>$>Ly=$_i-(tyj4T5lOBpfMhU#z4g> z+NmbRX;tArg8}!+GU-icoGwEjMPI zxyI~Yw_hi!VbC0`E_kaFTIOuil`iuGFmU~_SK6d7396ww1KOQF3c#WJZbO}z6V+gc cxB<;I?-K99{+bVn4@=ylnxj?aapBPZ2Ft;QZ~y=R diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/data/api/IDataContainer.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/data/api/IDataContainer.class deleted file mode 100644 index 0201867dc4c6644cc062cc1c7b4a62c1e94ede4a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2352 zcmcgu-EPw`6h2-@%YJ~ZW5CA$&qmSPwgz_T(q?Zy_;&ZDzBB0fRScTU5bupnn; zpGg9%M*B#cjtYh6TIOp4)M%rwR7NP{B-r=4CngEf8jqA1NZRKSZ9V5v{Kbn5rUIIF zqkzYJugc@I8>pg=%FPwkX}s_M4@+rW6|4^en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$&@dCQr04vhpONj!>k`R+7iP%c$Z3PrL@f8pGX|I_hWb) z3*=b80_=?h9n}hNkwd=2$q?VLdG*^h-gNUTqHnQ?$-jcGD6Nb@QXrY{-;>8X(PJ*_f&ucQxgCjA?t>BPtZ z#(u{{09%fHu}glfOMcyxe<7d%-lXS6A^=7a!WbrSmV%SO0>-gS(lq^vIiz?CS4d(a zc&5@d8bauIjv>zYfL&98? zyO<#S2p^Nu5-kLvN$=-rRd^pv%nEeJb`cs7&on(9JA*E2NDQ+cL{>r+Nf!2o)0wBZ zer%(IGSgvO*t0E+0!4yh#bXdFtF*%KDL(TUZb^n8D3(K{8GnY{-OSwlROk?&cN5J? zq6J6MBZ^~9647Rq=t~$H$8D_30LJkpeTAeMX?lx)YqIQko&e%aIi3Zb#Qm}*E% h)K7|Z1ZpIm`4h7T*zArYlZFYE0KS&byKV~Z{R?RR)}jCa diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/data/nbt/NbtContainer.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/data/nbt/NbtContainer.class deleted file mode 100644 index f5da558940e65be4c909e4ee1b013674df91d270..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4391 zcmcguS#uOs7(I6~$zp8_zBJ1XybkV-)C6?0pY{B*tbGBzEaw#t{nes;SInU;fVhBNnVc+nP zRLLvaY3~fVsyJE{PW$Gt3vOau2u9}Y0(})8XT=MlRpAJIO_WyY+)80S@8sMS^Clqi zebI9lN)o}8moM5GM81IqyC9%1zb@9Q}?8+tA!1Bv;UpG0X-=E@PF5?0q;a*O*kMbv)ZV) zH!ZZGUBSvZ%ax&`FcgmXPuf$(72>dk-FQPJeL$f-b>pao0cqOi^nzm-W#ugkZ{v8`sf*4kn_~-|x@9lf zdTJ)7952~{ckpfqClxxM_+TN4LH2{39X2N`mHY&D+^mye7^g!x#je~W*!XH;1n+So z=X8#@Z!j#_xlH16>XwuCk|CT?=+;oZJmnSLTt?g6h8;UX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ft/vcompat/entity/Hologram$HologramBuilder.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/entity/Hologram$HologramBuilder.class deleted file mode 100644 index b5b9926fb6d702f3bdf07d080b745393a9dd3f67..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1469 zcmbVMOK;Oa5dJnvYbT^6B<1}oP-xOt^#LIct}06UNTsxq=tBZdn`D!^a_nNSi+bk@ z2QK^#;6NpiIC0`fA!Z#L+NKxx;@R1q{pOqbX8rrm_n!csVpcr__-^2}#aqvk z!t;&3<%qV&yV5vlyZwDG4dF;j9vXGmc6%Q0PsWSqfn|4ury;}eECJ9icRIH4jO7qF zLSY!4w;W3@Fr+Kh9fnNJ?FbE7hQ|r8V{SR5aUqWpu{g4Emo>YFi&<( zL6}*L$t&?+YI04ilxSLEUtA=m?NtoGG9^t zOm=WzB>?+)>~1Ey`%ZN@y1PoG6s_zJ=r3oEaPu_4rx0Lb5EKDWIPTzXm^4e3-9xJQ wi$L#3pi>d3Ha#=@4G&I1Qjn^Ls-sps3|EgZ71|1_WYrkZ%wn2WGvU7e7ZPxpp8x;= diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/entity/Hologram.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/entity/Hologram.class deleted file mode 100644 index a3af1ae9beb942fb745c13909d242786487d0f94..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12577 zcmdT~dwiAUeg8f=CppQ<8xn4Ta1w3`gp)uJg-C8BBp|_DfN&91^pG6j$VpB-7ZlM} ztXp@nb9PRLIu%{VYEeNYh?k;e)z+?^v)$a*uC<$O*UP$9*KVWE?E8D3_dR)&oM?dl zGd>@E-uHQ*=Xd{of4}EBdE>(uz6hXNUFSoV!lixTWK|-Tig$-^ibs;+c%rH|(iiTI zhjt~a_I1a4`$Ng9a9=W#++Vde7LDzWhkAYRDy%$*jeA0UJ<)KysyUTN#(Gz4Y6`wp zn_JsjR&P{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ApKykVqbF315d^GTMuAWXtGP?CS%dfv?$vDe1@Bd;BKGgaI z4fV7>b8USl(}Cu=6yUz0gVS8mV)|GRWqhJY|3h2;2Ff5sB`3ImhjHnr&H2R75h@$m zDo4vQH%_%!uO`S7#K&bsb;?DWD(| z#t=mAGAIb~H6U3Oj`t~VSeU2BAkkL6{n@)0Q5(rDvhaF`pKQF~?5&CQqrci{Ti;2S(XO23& zi`XZC|H)Ct2_wUs;h;(}Q3YJQr;Ox1aU^fvY@R)aKvF>UE-o#n5JBaLYiA*pT884kiI8W zm0ISn@Ll{^Ep(*}HJHOJZ@Bi$8-2QHt8=L3MB^b81S?LdOB4pwWjt(UF>q%Rhrs_X z(xX@3YU%qqwTub59G0raWOX_Jws1KvRyC+lwOFR=UBXtUg{`Kr%PFcH(@aXp%;gkc z3{xUyWsZplwba30_N+zRvVx?ICtjmY0=LzbTC2c-s%0}CJf`*2=-Uve98mRJ9qcul z|T zYBvsHYBU5Mg3ogVg@Lle$Sd>m5a12eX$P6cNPDPx=(@xSKDlTe(rm%lHzew6YIY6$ z>RQZFJFq}q$G^O{6~v&eWB zgI`8>G)CCI-as{@g!5j^;5b*s=)itD@J9aCXu{>hWoaiabHNQ80l#y*<5EH=)tWTW zN)I3v&mRmD6l_Ty>)lDu={xm1Q9WF|>s}9>B?&|53E>_Q-x_ZtTSM@wV=)RTJ z^MGbL&gvY@(oyO4x~i!B_94&{(4#TEDP#vJ!yWwFsDmyU zN^Qj@PPpm=Ol4R!s#WZKi(bW(YNO46zRf>Jtl2dJ$+<>)0?NldCo=EZJocU@Ji^>H nxG|5TX}1Q{Rby^}M{O5|>T0G8eatNZhVZqFs~vpz%KQHTrI83{ diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/entity/attributes/Nameable.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/entity/attributes/Nameable.class deleted file mode 100644 index 53b3751d024878f5ccd4726b495f29be245ea478..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 237 zcmY+9I|>3p5Jao}tsevfy@MuBXdsvfMxudWU^ct7GUCq4Ot0eA3_O5`5@!Sv)7Oux z>gVhJ05Cx(L4`20EXo(9%lPVyu=6T6mNTdKqAppHpS38qV&tZ@h%;#^?A1!=tkV-G zs1bTcebMTq?Ln>6BWFVBdX{oIAwi;2rHwtrgV($6?yRFc z@_%?}r9!1X^sx{9QB}X0U4rfM?aDwaedKn$pzX`Z-ArN~_8!>FG7187FTH{1`d)D0 zKG}aMTUwyd3B#_yMsouE6#20icn31NBQTW&>gPmmx9O>AT_sxi?(XjPmig+3El;a3 z5Ljr2(Sf_4bh}Es&Fq>g<+k*tmb4eo1xj~Sp!AwRtv-&nvd73b!?vs-k9h|(s0!rk zD|;s(aLU0n9J4#^po}Sj*(Ry_KI!et=&85wOM$BK>hF1xGUx2FpgSrSSf7N8VXm3U zgZd;OqlBi}EIKHnL~eR1&jQmb-syXXL7EA(CRZ~%+G}+md;KhxQY3rffb0u_N`YzQNXDqi>1fDKTlo2N&8?$&8PF&74c<(?thhHd8*b7?fD>|Lhi z%}gq>)Q=)>zz56P)SsK&9o}sR0~IUVq_gQU@dFv9#h%i9ApJ1n!#!L7VAcj^F6p;D zE%ywL@~wl-$&wtY4#SK);i14!^&f|QXW9MWdq*4t6OlRYr=!}YMr?FCWZf1=k{xr% z_OI;N$@oy2w>>|McHPXO!ZLdy&uLmf&b%h>PMOJIZ`dGKa%NE0s5yg^TxWTDLj4@& zY~y##HS%vzYplM(!mqr_;SAR*A%QurC)sK9T&py1hDQno9O!&368XAJ<10h>wG3b28a~Tl zT}lI6B;vv^+@uVq!L1G%7mtmv!x))D3>$wwZtVWom_NHOvBZK4GyJUlDw8*G)1Ghf r-)g>pgWFbqo5?$wyo>Mb{Tl93zQTR1Te)GSz$UgB7)L$V93K7)R*%|b diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/DefaultEntityType.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/DefaultEntityType.class deleted file mode 100644 index a049fbcd29e74b570fb2f88a653013af6aaef42f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1505 zcmb_cT~8B16g|VX-L@=W6^neRsHp9Ntf=TiD}g{kVrh+qCe^2*3}wl7OSW4~e~EuX zArYdH`0S4|-dR?kYp;~=~~HkOuLp@PnTm9dsBmoXcRH& z+|m$3R9a&i;^<`<$kQzqTJ>$=Z1QbOFeLJgD!0nqF{STq#-U({B)EHKlR>Qsx4`QZ zI-E*h%_{}o*YE(7gs{E1$RW2{f}rcEbeB35$77^bq!>@rXr);N2FK*2(qB!OJPmym)lXg-A^HNdKfo%90p$dP#~AjUWXN+y!awOq zIl^$M5<0?2=@_G53DJXb`u0;k$=Qbp#>k%VPUI;)EkDN`?aL@tpPo3u?G89X0q{YZ zXREj)#gcs&lRn&_RmO$&Z@Bk`jPuOr;JBCZ931w+F-+m14}K|oL73zbMk{X>{j8Fe u2fnU|Mq?VI)DHD`UBuKUPLg#@YWUD_PwsEivuOKP`=%kuBa=% ztL^=|*Y0p_3s+0svs>J4I6~Q#zPQ$vPD7{&EQYx~zRzukyG?tewkPVEA?zKvLNO$& zr?#@geZRmE-IPt2>#hGSsDR;5rfPD<C#KkT$T;mX5-#5>X^ zM~672=h~lwCxuTIr7LxbA(c7LP{{5uERCrHVq>$)UPHtX!dx6TkYEU9vO7^Q%*PSN zWCRNgE0@bCh7@iZw79`piX(~`!)%p${juAw3AM#*4po}0dUfvXa3zgAP+GbreTKE_ zb%#ZLNskirIzy5V*G3;sZmKEtMlk*POm?jM42$F1VQidYX^6wYzar1eHJVC{5XKf2 z#;{7^SMHgCAhdAJEIPyPU}3siI`;PV`n$r{Go=M|gGC*VoN5d~ s0*~;Rd`wwq;TF%sr7r?UztJan3RvIp3>ktAx|XH9b3`zK{6O>kKTkt_sQ>@~ diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/EntityManager.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/EntityManager.class deleted file mode 100644 index 09bb40216a8d49b9081788366b7a297d2b5fb65c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8486 zcmc&(33yc175;B#GLM7@hF}5-DipzH!%=W0ls&}Q38W;bfD12^m*kPjyzu4?G_{*b zYg@b9Md@m_ri*RCYCu%9($>~$?cUmb-}lwbfYOd?ZnM}j^&z8DmrK-&A4Oqy3xIHdvM5bqh`{z z+~H`yk?cvBPP9e+Y&VidpXq1_3smej_8QTIk?f0Z>E3O|T@4X|4U>_buu`s>q|}V` zwvL1`Y&w^C$^>R8?UtDmsER2)Y1c|b*ExfwE4kFKM`G#}v4t&^xPQlYuhM z%nj+3YY%$HHm|0da>wkGXdSahKCFYbtpjwB98S-wvj+xNQc~`4r0cH!7rd-2u1x|@^IX0&UyG^Id=uXhW%9tHD z5|J4{+GFZEYL*?uEEm!$ni! zYk%={tORqsv|EO$KyTf6U4`II*_qPV7wK4yHC*O?+a3_uUzC6ImT2nqBA_Wpn9h{A zGm{uBMTXOt9yF6K$#`x7SCaJe>6;<%Q+R7JUd~H&FWv-Zb-G4;pxqc!k~Lhyq$+|v zgTAJtB)1LA06pu3mbMeDF~)kWWX~qck)W&dYz+8*MmlNjNh?CB7@y)A z41w7>%#vd?#53KB;`Oe6$KK~P9JBnD&y=*zpcRUrrk;qBAo_H);nH$g7|^hrM3_UE zF-%7ST-k{2v?Nlj6`4@XFGXrzaELxrHpu!g9VK~ZF{v6%C&r(^9vOd(iff8uLND|E zHY?|;0#Q|o61Y0j*h}6whK3Tu0*mwFCOfGu>2C4^U4`6BbqwQWOn%o^4Y$Dg!No5) zuf727X?QsacIs}^@JbevBDgH)EwgoyvK%t-zXrG=&jonne>Zn@rX4z!CMWAI0Ipyzco9i!=X1z_v+i^4Zct#IvUzH#J zL3XK^TR~H8in&dha->idjiJbN((9Bq7G+Cb^m(Qn(D5E=O2jb-?Y-Qp?!xCygACh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P{fPk-4z_-T> zSXNK~`x#%rQeI`GmDZA|#upE6K@}cQC)*u=imanDD`pe)_Z#kn79K%3Bo%vs=~es{ z0mZWenaAcuUn~2VA1l#6!B2T@VB-9SW52~8@F#WmXZ#IMtGj>T-*`sd{RhusOoC;< LBls5*rKtHILN8s3 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/EntityRegistry.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/EntityRegistry.class deleted file mode 100644 index 0eb671cabe92e174f903397dbcce4bfb7c00afa4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5554 zcmc&%`%@d&75*+#SR*X~V}o%V6GII_h+2-F*hz(nEsA3|_z{aZwcXbu7Fe^|C94%K z?jz5pN%~5ksoV6OM?2#m+-X8eGHpF&CY|Z@Ps+6Y?%kEN3N&@4cFGLe-E;3f=R4nd z+cbuaqfTj#==GIX|;paEnWZpD`WZ@>eno zhBIrMUS?8#o-^mIlJBi(hzoRHHkOTyZ8-CpGc%XXf-kV;+~h+i^V8=p2uw^hZ6!;E zGiA%3B|?F1Q_5c1x9rRbqqK0!SmK1XyfyC_e%Uhxu5Fw#);Nmkl_fLV`0`u;d~9Sq zJ1!j=E7+D}`Qrky;naD7_=G!aCLqwEqZ7J7>zEpEqo_;AZD{4t6vJ}5T%0kzX=BEw zi(ON0!LZL8o+ZDPFo764H0%)Ax`Chsde9*?-l0Ro7FzWeEONPJ-t?t^e9aA~E;a6@ zB1u}gOUEAc(~CuOC2uknwhpHv;h-q1;UfY^8qNx7Dv3edtzk%@z2+-*>lj8#K=a*W zo@cBG3=dxltVhx_OGiJLvILbDINB@&#FO`p!Xk50#YDqCCTz{v^n&MJ2_l#z^?SPvQX? z)sG2muSK|L3xNkhBdQs1qA|*3og!uHjE=K-guQ#ta%PWPo`l^~ z=VgTbxMLJm))79Km=3m+)x~ zpJH#WkypX5<1_dyd2_ulQLf#?4JgjDtqSI3e}`xwKml4Pli2^>OM zmhm!A#q2;0r$qG}^m!dCxGIn=xQ=gFPU&Hj$C2*M>Ymnn@I@V8!k5X_Qkh)czsbDF zK2@Je^&LZ-2@ae*(KYTyg=F^Q`hzBuG(3S$HmzNz2@9s|R1!n-@D&};;j3(wo>_F4 zSrK>N8WqfjToc)#;wJN;2QNwl%-SusQJk4I_U;#$j$#ORoyOe{Z6z^)Z|e9KUgCk3 z6>?hbZ`&*TpNeW|D}iZzN5^+%LbaNYmkpbTu|!_o+>TrFKCrF+UbateLF|_~*Y!)j zXDppE{RMZnl)w-1BMsLC25Q@= zc)1f-B)xtkz5XZ8($qR|?Opr_?MSqNy$+6cQrZ!* zw@DHxCY~M|?Ea7N z@bp*3^Ps}>62E0&Q;MHc6@J!mR3QBhJ`SwmL<@gT3yiMc7!8RU#1Iz^@e(VaQKEJ! z8iz=Y3``HzQ+Y^~d^?9ciIJ3bOUi~2QF)o)1+DFo>_@r3H#hVzo zK|wT;`XiRwtCreBO9G#R!TCWDW|Z0^q1ra7w(xt*e^BLML}go5Wg8Y@6Pb`_ysFBg zQuzeGC6B!k9;w{9i9-?Ew$o|p_zv}q(v~7^Bb25hmV2v~dqc}r+PXv91|qaQ4zCKT zq(I#yBnj$Z`Y*UGcD){&zltl@ppC8v0|e{y{|k?euE(#-FvqB3H}e;)hJEU}9|zPk zuIgfd6%1y0oU&GqwBsQ0-pkpC7~aE_9*FoN$67g`VDJQc(x>-aTx{u8SR=QaQU diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/EntityType.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/entity/handler/EntityType.class deleted file mode 100644 index 9412dc841cea81d85a41afe74a629ccc70194b06..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 193 zcmYLDu?~Vj6zidK>Y{@mp^G;<7)PCq4)_BnKJf?~ZNI@!ywt47vf)NOw7q5I)V`CKrX-1>z&zEp zR++YmI$u+YSwJSlC!LePV!1l@e#Fk$WGgU@y2*pdd}h`cuG?%VATaPJ0pa^c2wMi} HF~Il_-s(0a diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/listener/PlayerListener.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/listener/PlayerListener.class deleted file mode 100644 index 42374a9cbeabdffbd77ff28bfc3fbea2596e18ba..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4475 zcmb_f`BxKH6#gFDKo~bv5L@@EENW^OD-A9XwW1JEl(x3D4q=3mFheI36l?c=wToS} z`@S!>l}dX~Pk-+J(SM;o_0)dvWs*!dM4~O{0C{ijeD~h(e(&CwKmPgUHvqTbyoM5i zh;4e|q?2;v=5g2ZOg9-Gv1~K$8b`hGSlk&IHN0@bN_wVky5XLLF>bn@{!&Akz}#cT zm=R7G_F%ZX|Ckx~G*k%GJMLh(KQ%mTd0}(Rw7qcVC4tJ0Snq+hSahermd^j+K0>Hb z*BP@0Ot)C5jJ=;pkN-NMs(P(K+wfAZDX_h$unJ(cHf@!W4H@=8f^?FhPDN45vl5C0 zKD~X)R%=lXvt{tH!yV~*>`uFiNWY~?(-W8z!0$CZ?ytz-X$>q79_-km-mPqnCoJ3Y zwi2eHu}`2Z>I|462-N9VgarZ>t?GFdw-)QrP$^weF0s@|zv&(@`V(ZYrqhWVi9W-% zQ+`mSKg4PZK0rj4FRY^q zAq^V^=I7+u=DNnXJgFgEFAH`PHfgw7U}4TA>Le08<*ZCnXBXK_eJ985_>k+^)=6_f zzAUh^A)qh06=|HhA%nP8$1Kd&(8@e>9(EhaA&NGHNIHaVI<}*YN(=g-fxz;h8>#c4 z7rB;BqB`bc9>wepSv-xEt~n_C7hA@XhR#5n8cn1IEt`!&{);sBg|HiYG;}bwfK|Kd zX*%|zlbNgHNc%3sHU=f;DvBpyo(Jk1MXC`)kA`l6Wiy!S*oXZBvokU8l&zFWY|e{3 zzrjWd`e#x+!s(EBfD7A^>x@Ugw+QTRDC(@u)T1P?0(a=x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/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/listener/handler/IPlayerHandler.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/listener/handler/IPlayerHandler.class deleted file mode 100644 index ae72a365bf49cedce9927b53b72bda615062d95e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 584 zcma)3%TB{E5S%Tcq2;?@nTjV*l>;BZM~I08HCYgP*!;{ zl{PmV?;ed@Du25wV?>1hOjc4DXqhdS!zSOEE6W zmCoR7LWqVgSA<@|>x~yhs{FG|4R?+bmq{~`Uf1<+GYV5(5=I*dukklvEAz%M;c6qo z|D6zGXA>nWUcCF%-2Fz^E{^}+^t?W2n?Ts&-vU~kZKKT?b9K>l0D5nd9maYD9(EW{ c_&E>J#V*G>+rvI1;b1*QXAMP<30vs@02@-6;s5{u diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/BukkitConversion.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/BukkitConversion.class deleted file mode 100644 index d4c9fa21fd533b7d016fb84b22a14993a547ce2a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2737 zcmd5;Sx?(Q5S|Swl$87GeP0Q*xR+FkxM^u9DpCqaM5)xbjkAP>#A|Iffjn30?`fYZ z^`Sq2A60dBV}~RlYWt}#9`AbQn{URmGkg5!*KYuL4X;KZLEw$cl+_ST>99k|6_X9C z&Ryn6x~r^~BkCSimM2AvSD3WkHxCZD$_uxJid?uOkR*_e1X1c(exz=t#w3AZo4Z`) z2)s)d;s7BTB}FZpDG?am;Z>KareuhlE|$z@GA}AD1w(LY3@*Shfyn{}xY?|inJm(B z4RvPTz=%QsK+h0tgOwlLRAcDpSGw~ zqi)sOD(^E#VeY1M7^e_VDQ3bt!J_S9Sl|tXRTPS%);*gep0^MoYI}PzcQ(XyUzlB5 z@!~X0O&f@BubC2)v^;uHSW0e4c!0~@U#10k8x!KS)o;<|x2(;qFq#Jtd zlp13K-|g*{)15DW#$GNiMZ372E#`3|#r^x5Y8Qk+YR6o2*0~<}^Mk{0Ss!2mU+vOL zs6W)b6Ag^#Tr6ww75WLULqn*CjU4|=0UWIE$UWXe- z-h^9-(cyC&_3nV?+gabk^?i6?^d7<^BOgQB$P6qRxdczT`cF}R8LaO588Uv3d=l`& HM|}Agw-Sox diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/DataProvider.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/DataProvider.class deleted file mode 100644 index f05ded3175480455a50699bf1bd4242c129dc0d5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4905 zcmcIn=~ok16#qT8V3?ACf?GvJr4W~CU1~8AMIwb7771YKqMal|9GT3-$poc#U+lhb zr~gH3t5i9sr=NTJp?^_N@0*!SCUKxaEg#6d_wM`M`|ka{`|kbopL@RpIF26zsAK5Y zWK%5YMI$X=GZa%c3Sv&t%V4R+G%4 zAu|lFB^&cB&diL)qxM*pw5*sk4ModF2MEtKU}|tYJ~6h60m))MuPU-Z8$=JTYhY>p zKBZhmvms}df@v&qi)-;#hI}k)DN`IznS&WAPcfNtAPBBKBhO1k)r@mYB~>(a^5aBJ zz-|;R4S61mf+=fh*$S%%kkm+z7SZ1`v9zjaiaEeg-`h9K&@iND>qN$y}whMS1I|wu@o2%|E#VpGA?i8>AL55I*s6SrJrDS7T zN~uJ$_Jp36)LF?;_}H0jiaBPV?p>do9R3gKnrY~2v~MjXeQ8!Eov!`4L19 z`Z!!WKh=H#0v-$CAcJ6CD@7NF6;%#G#8Ux0$2^$yHsdryFs~M~ipG;s5C?FEpLmF2Pp?gqlB_-QUU}|t zhO+{OLCK~qZOD=-dx+0)sS2ZSeF6T@o5kZYDxei1qPuxnA^%3#r-Glll!ED^wl3N^ z)!`Jw$@RfiQIesBVo=IA3_}!vha@E#8L~aiZItMSQDBE_#I4L(7Ys@Wa>m6WN+lU; zGO!Zp8Ucw(C6`y_sN zoU&7RfkVE?P-DWWgmjIgghP4Kj>Tjt{hRJ`5Et=E0GAlXY6*FzN7r~x1V~6RG}($7 zW*#W^UIjkJ6U#b?xpAM@@%%&U+zDHy_Zb{mhsCk!bH0`9S_k2K2BNj4?V3+xgOdL>iQ0o~$)hx3P%*FP z$`hTH71L6_R5cy-GrF{IwSzKr`)w-)tz=d(X>~BXx}kU7OT-gwQmB)sVk|SkEV2liC!#E}!Lqz)J zr)iA*ipWp&VcXB01aw(2f-T^{Fihe+&2UGYB-LDQ;|iwcRxmxsL6$MQjJay4ZV%K( z7wRP!s-Ggnp+X#rU`FoXWgnOx4@}5~Nh3pc+d-8r%e==LskSBJ0cmtWs1b5O<}Hx8 z6QuA8F3v^v-@=w#=vqd$8t;&WXL~#B;DI7?1q*a0s(zum$TaL_@m z$1a++oqyOujo5N7s^Fl~UTBVe0(2r=J@T~Iwt}x+C7oPKhe2x%DA1@5rsJj}79Hu= dY4uIq#E0NtAL9#riLYpl-;1yDExyOre*st0zLfv~ diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/EntityProvider.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/EntityProvider.class deleted file mode 100644 index 6562f56a34347c5f2d7a5e81cfcd2b2fdd080c3a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1709 zcmb_dU2hUW6g>l5kaeX}6u)chCm*%@XyPK#HX0vD)1(9w-3OJG;|Hcre-8kjyZ5F87>!@0rW5-#>l=cnUX<41*VP<&L9?4ET{0ip#M( z5+M(yzpvbB5RDFf)kHZ~U-7T%iedqeVF zX-9!S?D|sZvoTugy%;k*PseJ$J|07Hnj~y^rVhA}CPQVO?D63V;jRB++N5f=h;Ej4 z1}Bi*S3F6E;bXNO$${IO92^MczK!It@BMAzu_%l-I>gAUrQ>1(?2N_C*g&6+B(y(%~VVtqqR;Q$e`e24ut_H$^pW2>Ham*@jj5-$|7OegZ!?}}ot%-xkw@2=1t zBOz31)i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J^LX%6!(fJkwo_r!B`!xyEHLzLd(OvxXPXx|tAX5ugrH@GyMNo(l#cQ580 z&$yDE%b1RJB_527tQ8M-#h*0ui}KKr_qn@vAQNE{T~g( znHe*RdTi3s3_XH24V%jW7%>*-7=$P`qg^&^(NN#jJsHI|+!Mie4O_~4hcmWqraXpq zQAY>vWhm)NYR=6#)^p|zVKnUOS{c7Ycg1)kG<--$BQ`{EpN5Aen0FAKD0ZSP^%g}x z5~9r^4G)FoCFqIO^(pe#jcnG=tJrAR-&LzI|OQ;gs>d)yI!6@64Yo;?x<`LW05K{s019WXHp9qdb^StcQ!tqTUfBX__R#M{iR}&trUue7j%3YFA_^7QG%$j z4&DZzrh5K$gQc*uOoeumdsE}<+=1Q%dI zd{a8rFEk8RL0kajDOD(&|m5JwYb$%bjz7>iwbnqEPyij+=O&?;EudYEkAH67@N$#>1mAM9Oa;s)?;d=C3+Fz~A_e zwf2*DLSo#1zdP=qW$j9D%&h-T*Dsl4R~wo|X;8o5C*2OVkhi_32_A85Gr#vHe+NB&7`WtBS zdH3}c@ZnQ^ZNmi|JI}9M7@LyM`|se<0W2Ktxq}fmI_LTy@mZVg6^xVL=>)2{HtHBTJ z7`Fba;@(eA`g6TE@bh|{?-frQd?|OZPJl;QAA2d^edIJiUk>nd(C4=+uv7AW(9bDf zSSVP@b6qG7gDMVh5wRZHgCzSJUR0D{R+KyaX!~@?=9j`Z()$+lSd7AZserf3+@ii3 zhREXmhnIzm!M*B})naJ{5> zuq#rgid0LifZv>q^)h|G^D`Edf2*I7}4Y%5-p|3w5TjKvg9kXB)b?H{_Bl5 zT>qOlLqYE6mhpSI|N|oxPKfDY0e%!<@W#wtAT2?4gRIl;H5PT23_U$26>v(U>*MMfBr+AV*mUfzwB(c diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/ToolProvider.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/ToolProvider.class deleted file mode 100644 index 77f046c3ea1c6bbbaf2b521e6ef2ffe43dbe36f8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1124 zcmbW0OH0E*5Xb+U##Uo}zn|c(RWL`<)>0M3LlL1R2XAY->e@70w%dwlKanTFgCD>T zB~H@R*DWQmv$L7`@t@h9kI%Pv00-F4!D2WJg>k#8r+x9Lr4hR8wq+=M&2Np{_f@;Y zjoZRIzNUO0cwEcKPY!K!FS}G- zI#s{BQ(~Cz56VqcG90JFCEXep$*}xa>QiSZx0(+8TW6U%RUxq%vJCk)Z9)hT`Iq=e4~|DgvC%j=2Px^+#kAoy<^cg4EBHk&_*luL=nXW~v*)4-% z)kYo#hLsK#@#AFF6Z(+%JV7fR)#qN9YZ>U-q-BoenBmPrC(~&|VUlGdVxyUjnM|ju z2gF0Ay!k6;CMMH~SU!+LpPPxMT5M-^mt<`^TZF5T!S}wA=6r7PZB}d=K-8VZ2y<)u z9zPd)0c&Z%WvrzMk+s#}S;d#&73SWuzebus=Gs~7cELpCu1@ZDCMPG-P=lF9t%l)U zR`x{%`P*HT5g9Cvk0xfI&U}W-LD(}t$l%|ur+dN6pe0%lsU75~(=x0DJ%OSU#niKC zER$-(q6nxtKT&ah!~R6U@(k=DTtJ|7Qan=TQG4SO$2GRiSdEx1I@k<%ZSq~yJQ$J{wqy1CO-5B z^hY&4v%96iN1Dyfo%=E8%$<8Kul`*Cc!L*JlmvQ-vcV!~ zuoTC80=1EzCekjA5-6XAjO_GvqU}K7#J>}ECnT0nNVoA$(}}91jAjEh?2*gwgf$54 zH&DTjz}}Eg^LaTND|05tF>iA)Od}bG(rD)wLC=2Ei*36u-j+SKH?e=rZ}2~C)p7yc zXR`yM?@yI2#<`x;vESJW`gT$kzmv_UKFTEZQM*Sv+?360rx<}zKYV*9w!!d!>Giyq zoK~6g7I@%BMq8y_ P;s{E3nyt@@hMr#o)y@L- diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/WrapType.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/WrapType.class deleted file mode 100644 index 6a5070bf7da1289d773d6c45d235bd647be46797..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3912 zcmcJS+j1L45QhJ89LsXnabkxMLO2JIO~`TxPVfo^o$SbLBqJ#fMu1t%8)==DR;*S& z09U*KFTfLU#o;1Vq>2aNk+`7fo{=_E9IAvPUr5#8uT}RU50xRbKcfCih^^((Qxpps#ArLJ&wWbwxd|SX7jn}yO zXxyoTz&0M|1jRjBx>YEa1@4bNW~uJ^L4QysaMVaHU(T*%ivr&0C&>aRm5Vv9^B_|#+K9;HJnn~4Ys7Vq+wcVakiwE&@iL4kJ*x1O2b*DW!RG1vW7XO z-C|2>s~VnBn#q>b@*191+8SF@D{6R7X=S#gwyxoMrG3Vh)IQhng3`WVOKM+fcu8qr zvo#?wW6~WZ-)U^we%YdCD==$%Rm)wse22L!&eiN-&3773;Oxo^Ma$k6n2XK#o%U(h zYPYEZFC13mWg3N5sG!_$@c=5YIb&@0y(=f#ly zFsM6if%s7Q`42w==LdHQIq&Y2%v1Oc(?_dWl5Y~r4sXfn-UP1lU7N-pUt2o757JN2 z5{Dn7O;1Myy|_$M_n@9f6d@YJBr)~7kf(^L*M-d8hWcE{r-`Y@g?xsX`di4e#MIkD zK1WP_E#&jW)YC$~KurBCC2fyBkCc6)F&xP6Z@bRF`xn&Gg?In} diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/WrappedContainer.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/WrappedContainer.class deleted file mode 100644 index 8ecf8ee40bb46bda56bb735b0c90c06fbdd76441..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5964 zcmd5=Yj+b>6y4LL4TQ9mR}~-SVZk&71_e<`EVOBXN@xo$<>3RT$)p`R$;6pSXc3=? z;url1`V-XUDlA;fAK>ygx!iYVoJ`u()nxj?56$$x_Bm&tbM8I&{`vQ_KLEUm?_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XxhT&b zk`SM99*8bz;?-oI2+QF6&k3>N@C9hpFl@`_;1$(gGzwN6%eWr{kEX-*Jy0vxj3rgh zIRtZ}QdIJ`Ve+i~1P>(aDAl_p{1vp!Tj_$kPdL^<&M=m$m2@CMJRb#m8Wyh2r_B$# zB7>sVuMM6S-e^|Q^%*{_rFVAWUN3HnE&GcEidbOB=e>gN#6+3TXjxscEY*tP5v#9t zgf%lehHoYG|Myfn)8#07h=L=mp@8T4A79}38)Hl6SK_xb^#t2~;XfUS^H&T5JF$bm z33md&-4Ks`J?wWL{jiH8qA=^g9`^6WKBvDA&v{=V${pX&@jkrZw_kMHFZu14+3v>y zXI(!I`u&HT{=Vg4OdVgvb%7fR zICR*-O}R6D+#U~?t8ojr9rb$f9^U8L4~XEJCB{DV$L?@U=<$)ShvMk*ph1uM4fGh@ zP>%vpH`3!EvBlUqsQ#=5je6rEvpk|tQ!{}T-@W)0cT=mVtYz7Cnj7A6Sag+O%jRzf cs;KcR#y(}=XZR9d;URlO0)LHf@EH650efRM*Z=?k diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/WrappedContext.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/WrappedContext.class deleted file mode 100644 index f40281f55bedc04aa6546e15023c8a55fb0e05d3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 844 zcmbtSOHTqZ5T42cf+z@xuah_MV2>t3h=@TSBK+802l=!BG#DGdPu+E ziMjb4vpuA}CM|AxB!$^i)`+z?tcf!LZi8SZ=kx>{_X#|9DZgPJk#u zCr(s0H<5v4imV3RjPCg98>C;uaE4^!#|hh{XCi$EvSj5JJiB1{oQDGC6e+R+dt{ej NKhzIGc^E~Gz5ygK_TvBm diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/WrappedKey.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/WrappedKey.class deleted file mode 100644 index 80fe6625f2b178e188f65a3d53f1825ad960562a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1246 zcmb_bOK;Oa5dJnVr@;_f+VXys7H|S|4;(6yC=x25Afj?eRn8k{n{G*LYrP50zk*9a z9QXnJD8#H|gxj2=a`4RV?9BJgjAwrR{_zvQ4!DCHLo<+u$KhD}^0QV(>X?sIAbl+k z4WIboC=!N8I-ID!)Vwc@;2*V!BH4d0rw$4XSC7R+@Sz9>{6p_p`i7y@RDm)rhP+oh zU?}W{eOW;sOD>8iF;qK5u{R#|q}~_3p=4O;guWOa2(9crH5SZ~iWyp+i{#i~SU(Fs zjs6nsUI@9l-)^)BerX_0TLgVu$EsKBobQKq>8e2>%vh64(W_A)gF|6^Vl)@jHChD& zaww4lHJPDo!kLl5O@rb{_!Rkq=;$Bucp4aS5*>vyP$%h4M2e4%8piySoN~*Q1T`vP zxb0#UYZctZeFyg#_<|rV9$uV_t_3z#P$UUKCsC1JpdaLXlRR1l>ww(tCui1W?Y1C|08m)O# zVS{qc(~1HPooHc5I&^zQnvpKnzoGn<4tZ2a+Gi^-k#uJcq%YI$${9-)$+lvdd{*cs zhikOGGzN*CI+W<^R+9(yj-;i1P1-V)>!-N&9e2LaIm^79VJ^=xTMIE0!b5DPh;8Dw gh%O;+(f9Zi-g(ru45~YaYAqHuhi8d=o>sK|2c$ALTL1t6 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/persistence/DataDistributor.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/persistence/DataDistributor.class deleted file mode 100644 index 6df8ee61a1bb1d2c2ea9590eb132d01713ea34cd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5940 zcmcgwiGLJl8GgQO!i3F)q-&s18j6&X&62Rvrlk-{g;2_o1lokOM2k*#C&|KOX5F0) zr5<=ztyjHmJ*xGn2Wr)l5YT#GwQBY6@J~?d^L{h4JCKkz6`K5hyEEVQKJW9M-@fqQ z3(o`Ch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+`xnn#h7SM$ diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/type/SkinDataType.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/type/SkinDataType.class deleted file mode 100644 index d9e91e58dbb8b1646df298cdd3a495c18cc85156..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4237 zcmc&%ZBr9h6n<`A*btV2(OR+ft*r_%n7&3Oh{k}H79tWFs%^DPSa2n8-E5-$6a6h# zXYg&NBs&cr_bGu$p(^{EA31PuzPRreeQG4dCu9hf4zSGJAiX&Xb1>oE2fjI zR~vTGyl-2MY1flwt6~;yW5Y={i`86%I6n z1V--}O(R({Dx1mcYxm5eqhUZGr2_Aw8Z|39{{~SYGM~$@WOCU#f%6M{14#=E=B>?& z;WTVh;Nc!&ruVQfTdg<--DszkHa8rrCj6xu$V?Ra&2BzKb2RZew4h@kg z-ou!NLjo66Bv7Dwt!gFfigu}`SsjP*K9Afq9f6DE6G}GpL`q9KM|2#;F@Y%YWR&e{ zN#K$qY}>DGd>4SgC-9Mm4+YXHcJ_hM@i9&c>?gA;jjb(9@@sl75y-qP#hnl&c^VTM z#_7ekBDoVtM;vDu{rgm7OF*~R4{Byj@`*9f{2l|bJwa1%qfxXK6_W$WIB2(D%VQp0|t&E>J-sz$*9-4 zB)5B3tp@bYLk;Hy&Zz{j$9@5w;##t;vgKG!I%;{ZAgiFY1xGZp4C1Tw$-6rU`f-K`#G4Hp%tzNjg zk=p?22Fz7nI<7q$yDbB`LQ9VYybq z>88~QvB2<#T`m6~3Du91T2l3LjMUk>>o961o&PD-nvz{yRmU_g z%DbO+7+B-eE$_ZpT(#sgb)Wx@;j9D|_`_$!zsqQ~M`AxgDJ4iRJ~yBb*uKiVWAtpCd0IZa%@j$2jm52e zZZbBT*v8dI`1% z@I8KTZBF4w+@{GI*WJNSZd9q`7Pr4Kzz?vPh|Ri37K3<+ja(vj!#A7?C1M5tI6V0Z z!(*XWh>V5*L|8n0fz-{(vCvpJ_yl()<)9ng!!GzKM)NcYkCVa#-4bU5kZ@_wc!#%X zFScnfx?}^~IfFTD5$_lgmw6ZB&ZAi6T^J>vG=jiuT-31P{ff~HGq&8aFV2lYE{ev_ mBwix5jY`L#o&bbPgqr0(qtCvnZPfbiqi=1V5J0`9Ip-ftW$q6E diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/wrap/SimpleSyntaxContainer.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/wrap/SimpleSyntaxContainer.class deleted file mode 100644 index c916014d3d7c7c8ebabf572d3c57f783773766b8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7240 zcmcgwYjYD-7=BLD5}K~1#TEq-0R@s!2=xNmghE@26iR7HC{h*Orc1lfTu8R1Me&B< zZAQmm;2-dVI#{MU;}7shIlk{X+fAC?IGb)qKG5vhbDsBkpZ9Xk*}wn!<1YZG@LdEU zfw6*NB`d|na?ZF{HZ7xEN#@Ohkt^%BtmIOzm@ny8vQ#cEnX^VYIjdWG@?KdlB{OEe zv|wab3YNY+T%`YLQ8|JZfuZIRuM=X)n00Uj+H&id0;hd(l+^T+nH)VwBps*}VP(v@ zf^IFA4S{fWghsZd&4OtS2%L=t!j4Z7R*WF|N6T<=)`%jE4h?PCLAGM?sWu37X=ueZ zfgNL{(fDG1#wcg?nFV6AbF7%t7pC;G$b7F3DE8qnC+!h|kbMUG{n+P`G12uyiR_mw$b zv6Q`uaLGS`q=pzy2n_o3ZzG=FpBO7XO}^b>vOC?baXdCbw+f$53`l+6z^MpM3Z(sH zNF%Nq-o#r1om3m+dfup%^qj5pDasmZ?a7Lis5DLH&30w_W0v_-J*Mfn{=I*A=%D%(2Z^-kgzrL)RsvAsT#zQP$A#iUa zDhysm9yL=`t`k52I!g-UEEJ-J5J?+#}oV9Zra+nwR zA!ycaxg4!a`of~Tn!2F*_B=#KsG$Io+bRhB)JXQArLaX&;z}rTlu80C%~g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` z?GWPXA)xY=Qm#_SEfHkAW?MTXm9#B}>*Harv>!Z>ZXp05xRt{p z%5Gn8(6NLCa=B+akB90SO;KmiX{_YP235}v=|7T3iCU-Pv7)1(aFj`cZvvz#*A505 z?uF|_9?jtJSg!LX9b~FB#Gcz*SAG%oO6LzT+&qF%q;-Z)i8wyOO%3bRnZ{Ck(C<1v zMv-B<<_PWze?JUA9|6;F4YR)r{2V>iRpoL+$1Rko1b5YWJCM1qKYfw^M^OyK9GN+- z*2#3(gY-bRFc6$yWQm><3w#o#BvVed9J|qD)FW|EiQH50YUB$YUn*UvJG!c~&nx@M zX1Bc}=}; zH>`@sw}jrRICYl`-SwQ7U9~*D$_3Z=J?`oocHOO6@9DGj!L_1@FpTf=7T0UMv8}I{ zcdd$uVuWG!eIiKe7wFvK?O?FJWn9>F{t5++wF8YR=n z6WmD7ZrCEvV5ElxGcubD=CG#&DiS4PI#nx-fR-7>0WD2Wi^4Tn2q8Z!{Tsdrr|nf7~&l&#DOM7&#v3T zZmDacnDymQq{@;UZfm$BakTEEltg*oN=^XAu#@fzuYJ{wA%ykyGM$F74usLInGeeF zHcb+p8atQG8yUJpGRip(^SH;55PyVpa_yg2xl0}ED1cs3`i2yhO^wP$UWQJU1QFA+ z(u3i}spF=q3zL4-Wls$yC1gmpYr!vgm7e1NN{^}1v!r2JrYE`OIrXlZi@8U|EMqDX zm-vSIYpmI_uS_2QA1p{=89wHUtGybVeQf#OZ9_^X`+m?L=wcFGdd|?3l1-7u82$c2 zh$~wH8hy7dNsQ7;ndTuHNCy4I7jbM8bPf#LZ@O#;ylf!+Pi7IKr=e$ zdzn7Ab}?9s69a}zmwz;dw%W^*>Df@8HGOE-WMpPVF9{|M#FtPAY2(u vXIEP@x$9xD>k;i@c-+O}Nq-iLy)0(`!eV707Asgi#v%lR*oKhvtLN!&l5BWX diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/wrap/SyntaxKey.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/data/wrap/SyntaxKey.class deleted file mode 100644 index 238cae95212b3bf840cda99b968cdb2f647700fb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3275 zcmb_eYgZdp6x}yG29hZxP!Oo)RVYcoPHCa71`&wGVgs!P!FRnRlQ1Ni$(or!`33$4 ze}P|hEydaoF8%8AH>u~|8N(1r7wPiLJnr1H_r3eKRlFepBCeIOj&wWC9a_dP zt|=IyeYB{9iZ^kcA!HR89>&kFBhjj`DY2F@72}v7d2_bTUE1Tu{{bx$p6Uj}4HX^e zWa!P1-L`6#J>A~sdu8J3%UC&H-r=?(-u=OLci(Ur)-tU-?W|vgVLWRvj5PO)SVm*g zD0Jom4bIP#)-t6r9>iM}Un(RJ$j+BD!iLZ^v7_KN!`;h;oT;G*?qET|U54c4q6MLf zMd9Es?s)aoCz^_i2Y8#IgG#$h6+QM}Rfyu%3NWQ7EzEcyPD>T)+31rJ&mvS@AwW2k{m8{EirA=P-?b%J8;1M_T!oT-v*O$}rOcuyp zs^3p!ccWak4kRUgsA3Ii>N-ITuTj^hC&Ag&fN7pRNbzC}&Hg$L3$~$3vjxQB_!7zDR{)TyIm2@p5 zw@edxf#+PyrW*JPUsD&aoDMPk6|}4$>4AF&ai%hsRjO4lIFbULxBPJG62Gq@$+48bUWD2i`{MRF>hVuB*~qT>8eH%yaGxH5Mf z-BGa5Fnvzhi}X=&z%csispMr(Ow1E;8?_+n+u~fICzYNRbkVh&-k#A{@qIY?3&P3S zUvY)u1pO~CGIf51>u>i?iKFKkZJyyJ?g20Gj!)SpRU46_ zUnj~@L@-9Wjnmd9NT(YC`b3>RLG;T+`ySCn5&DNFhZHb{&LY|_{g`6aUzA37Awoy; zCrti84_=x&<=~727rCYhJ~;g*AWb78?|0}fzIBP<6TIITKNpDas>iQij(k24d`eEg zhCcbCPag5fPw+t_|GfZ2q|Q%0*@tLY|3+hcDiD9V{>RPYGmY^p=i{TRB>tw)KkaX! zBYA?Y#$YOCnGQt5qU8OM1xk>RJlyvYIiKQ28{;Mdq+w*qEZJ zGGt=>UZF)8o=jzQVf;~Vb|=n7p-ou4S-yPEtZilek{w)vw z0DqKa&t$S}C@)_2ZTGx>J>Ap&`_Io`0PqHA85Rh;i7-6TbSxwf6ZX~6 zEL7tOGjx)uOhi1PTpD36>Csppy1z1%2&|v8jM13M0sYcH=b<66JmBUtlTpkGYy{2D zbw-Q8B2wBBfg3@yO`wWaPl|6Tx4!x;BsC(Yyqpn4_&AO~tW@yoq9MnaxD1mY!Q{)5A2DDBz-!&!&%9eCYZW<(-~pve!Urp@{heC_fT$OrVCb z2P%~jPQ!uvPT&x0|F03ZH_>*&3o7kHWrwEnk3rJK0MFaE@`Q0CsR67GVkO zUX%ynPq$Ih|eDb9f&f nID80?5P!g9c;fJ>Ljup>xjPS_>F|Z;zl2v<34z!6U4Z?+F3K5( diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/entity/NmsEntityLiving.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/entity/NmsEntityLiving.class deleted file mode 100644 index 66d6bcbba63611cdbec2c49453b16dc2148fdab4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 263 zcmbu4u?~VT6h&_pMKLB0euOS|baEm(868X<+zLEN2^7-S8h_2f5AdUmh0)dFy`0?P zzVqIn=L^6ZlMp?ISdrzXzUh?iT3XVES5i@`#np0`)>R`cZ*=WsMw*kd(mwd1GTV;! z(n*zv2pDFCaDtaY<@}fwl-dwOhRt8~3{yikuFFzpA}NU>SX`E8hUnB8?_`_Je{@!@ XiNDRz_cQR%GVd2+)Dp&i_Yi#nS7%S< diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/entity/NmsEntityType.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/entity/NmsEntityType.class deleted file mode 100644 index b9e29aaf1dc88d13b676d63e311284f0cdd33255..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1193 zcmb_bU2hUW6g|UI7U;I6RMD3DT@}!{>4W+JsU?&qjeI0szz`qIu$|&Iu#nva!@tt@ zp^e7IXMdFO&KAr1;FIjb%$+;;o_p?{vp;`*y#(+YITay>qAfh#9gG}Pd~z&LIIiBe zY+*Y5*we@6pg-iEK6D0S>qt1duszG0=(WCE_N~TbC{%pgCF^|C$cGb|Pl ztM$VVMx$8UV<=VryG))i%e7{8t5vKt%Lc>V`?-Kd3ue! zQ@&T;kX)x=+vJx;)!ehqbKIIGMkoN&B+a)~+?K3}$vQTs>8}V{rl(G^)_$wxF53mk yqpGAYkbeG|Zmwutp|NWUF?z3uQ;ZzN$Xf9v%U$5n53qmdh4943e2R>}XMY1Gnlxen diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/entity/NmsPlayer.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/entity/NmsPlayer.class deleted file mode 100644 index 75fba4aac0e8d46b8f5215c919ab41758d946b30..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1057 zcmbVLOK;Oa5S}d%)22-eX?TWb3w18+kwf5+79t`=rD`fTZ|rHbjlH(k>s0+~9QXnJ zD8%e~(-Jj@!omJDvoqhkfBpXP69C>r7{CgHj|vShvQkHQuBAa;@Kh>{v^X_<7G-HJ z49|5olQC+J%1Cp;57Xi(5f`WfxXobeOw0sNgqrZL<1>s*05t{&|4IDWg&4}2R1*f9 z6EyqfbSh01kU=}_3^P69W2c>GRK0c?G|1tTFrpWWoT_2aC;NX&B_?nFU5h-&_#jh8 zP&+g+2L+nZR4N7^!W%J`MkaqX)B1Kh--w7(tcbcd%xxJHgF5jXqev<)o8F;FkwGgQ zUQJ|VG&S-vZe_7eaj%(N5mrV`BCOgvl!f_%f);>5lY%bMF4*?7%(Z^ecCNMMAGzV) z3OfS^8{~T;O@b#f#ezXC91I4wPwfTLDuJGg=RA8$%Di5cC0Z{~#iMdeyPHsdR;}nF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ZH~& z9?*k7EjFwFHcmOxgn_h-z0lS*Fe+4sup_*3X%J78HMwu|AoPfGYoq>X5VKiq*6Tx= zH^{zOE|JV)5z9#|G0f}O{vSyW*KnPhoSUX_soSTEgSV=-Pn(Y2mg*rHSd*&T#=F~q!77&wSIORy;66T=3AZlLCHIK`LT%dgnS2X8)+NnVE zb03gdTm6o!F|2+fMM4KQrj6rtnjqpSO}-d8;0A6Ij$CmIMIBfkC9DwPDrskEjcjWt pw%epzCv6-oOG*QGNUF>fL}eC>e^j!sCbNC{#CkPhxT{h3{s7DvdT;;$ diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/ClassLookup.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/ClassLookup.class deleted file mode 100644 index 2fd61f9d9206c2f08fae2aa9f801ce8ef1076814..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 18400 zcmcg!34D~*wLd4BWRl?nVjw^e5ZRJU2mw^K0I~=e35$j;sOT_E$mnDy&P)($tKw3% zRcmc+3q`GUtF6_b61Ga|2CdfawsoP4T5H$W+V}dZ<(2n8_ul#DPG%B=q~-TB^UeM4 zJ^Oagz2kHLI&g@Hrt|N;l*hC<8cNnCV(sx@=<0Yl8Hy)rTf@;%Fdk@5)@}*LTH6B2 z+O~LXOL$W#UK@$Uu553sZ3#p-MMAX;BY{MsK@EAy!&GubU`wDj5{PcDU9s_sP%z0< z*sx;7($y=ODjL!+!_h6VD?_!*Ldllcrt=l7#5fJ7j;SDabu<)bI?Y<4FyUQsV|a5k zkZg~Km5(#&jkH%AlmnJYR?2UAlO(>YjSS*sLy(rWife{1WD*5hE zB~?MBn?p%uj!ffo5o*z{t=0!oR6BGAO@z(bEA(rnm1Ij8mU4bWZ^(RaXN2O5gW{Vj z1IZSVc3MzIoJ>QrC=r{fTH~X9I!mY>ey8R+gh0lUqM7# z_}->aB$R~9o=q1zbP)|gfDA@L0R%{III$)W32#!qy&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z`4eMy83fxlxP9RA@pL)M0Jk0M14YVt~or~Cc2YYT|?+p$`p!h0ZK~M#^)?XUH zaT6ZpziEPhY+3lLB5)`GYzY9L_=$sIsO}I{O9iT>0yT)k0n{~ys)@V%`bq4`>opv2 z^zT~4&b=?vmHr~JU3(0*RO7rB%5vsJ~!^~_ERahEplr#D`SO}vtm3%JO&zWXm|_Yd=1 z38P!#F5=Q{Oe$ecM{oyLy?XX)c%N-|03T7EO$F4}pkstoWTQK8!Kvocm*D;o$7qFP zl+I_ktr`wBaz+EOd*)M#Qi-z+?AEh8_#ePZ4x%Hj3Q+*l%cpWWy8aK$*TbmNpp>pu t_=bH;a89v7soa^G;m-rgrQmym&4nH)v{0jlXd6@tJ diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/FakeLookup.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/FakeLookup.class deleted file mode 100644 index 443ffd96285fe36de8b1080540e61bc6fa02f266..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 861 zcmb_a%We}f6g@YuNv4woN_dq=TQ;OD@CJ!Rt4dXsK-B>W6;)#CIHommW=1oUz-JY) zC<2KO=tm*0-Kb%~u8iczJwEr`b3MNJ{o@yam)HzYAq)~-iXxrmN`KBxsq;ciO`=sU zKbB&y(rG43k>%;!jCC$-noee!IF-rRYB7`(9eX4|jWE21)V`HPaj8Y94fhTQgjex3 z1ee~n3C$g4O=8MjLbbnj%oX<2u?|64i4dVpsE=mGjtK|-t^ZWD#p>M%bu@U5`AXl; zrX!udmm{kQt8uENJ(js~@d9k@EKG)jFG^>nNs}VLZNkPUIhVr9QEfiLMfuy;&{SsgMW_e#-B>5*7h(99%X}HEBX!0@xIP13(vr tYe5$(0b5|#)&UpeJ&bl>4{-o+DKiINaaiW;kZ@NH=aSXg$+c3U5fzrnxZ zgC<%NAN&FSDC3=(b-T8pB-NN^w>vZUo^$WH_s+NPU%moZ#@!4O3{PDim<_M#*Z3>n z4!GYi4{Vp$d}})}TQ%?C&EpMNjRm)fLtdQNR?b^W_ z!*tPU;mUt(SCR)Ybajl@~lPGWgJ>zOD>7IsL zlNFdVFpmN$Oj0n69u*VyTe_tR**xMr#u3%zZ|nB~#8XLKK8se`FYvT+h-B8IC+xH^gv zZYjcDkhq&9kq~K6;x4wa*aJLG+RaGd8D$y)4~7AgyQD}^=+s-G3Z_g2NDJsrv`WI+ zn1ty_!s`&y3kerP=S1?IR6&$ed6r_H3FSF_pJ;y;Z#JTB<7PLl=ps=|@!Xd0JE6?W FKL8>q2tWV; diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/field/UnsafeDeclaredFieldHandle.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/lookup/handle/field/UnsafeDeclaredFieldHandle.class deleted file mode 100644 index 8f5d0e7cc7f7ef0efc3608342fa5e3e04cbe0814..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2214 zcmc(gTT|0O7>3^sEv0EVRY0+bcmR4pA|616VTMr|=~S2z>4oD>NVgD76DCdTc;j#I zr>G-1N|o9^Lz_Wj=dvib4z+jjsB^-FDqKjYECka4I&}s}{E_`i@gKs{9EzZNuZ0 zbuso#&L??(wS4O<$KQmuZn(t=75Ez>3sau^h`^ zWthmG7?LY9#2&j9uA&G18j=`b=*i~FNiYm)h@)5hOKZ4*5kl^4Zm+FBWf(5i8xFZv zH$yL$RgB?M0v8zuJEk;@<1&S~y9cCIO5F-&o~EoQHlEOsKp!znbU>Sp+AjBA8oM?p zNhQ}b?6Tomq8|>%{C%s=@VazPC(z}D$>qL1?w1X_K`KVFxrn!0GDBK16LmZs?Xpm% z45u~BV3uKkpwD^D_1=Z(*)EJ?7YLn7P|L!TKc&&q(nkdmBF!$y+}XX_h!iR%pWL?g z9K&yTGtBX3W&*wEg406`B3OA39wbn6B?X8}!XX%j>$*>^aiynvcEE>d8$t zeh}L=5Xs{&K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`3)|eM`kW78s&r`+}D&`@QQi>lMU2wL<=?epxo@2aDpTmx^MzS zb3vBqEkY@**>lK4M5z-|aGOLBL>6&}JnzbQ_oM`yL{eZy>xAg|_nUFYJh;(1ZWIse zxR2_%D-w5|qKQ-}iDs-xi8WE%tz(^W6iNtGh5V`DXcUPOCl_i2NU`2#z*&!6ff``X c205Q;K3#V{#agp7HFv>MKI?MaaP`^z1>t35GXMYp diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/lookup/provider/GeneralReflections.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/lookup/provider/GeneralReflections.class deleted file mode 100644 index 379abfd39d94145e2acc0558bd01f78370ef6906..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1304 zcmb_c+iuf95IvhTaq75~8fdwuE!U)x@FNeY5GW#1Br9A}1@X9XHqC~$9obI!E`-!d zAn^fw6k@yyZA1_c77t!~XJ^iyIWyxQKfitl@CBK&gD=5@OqlrAqgqMsZrBR4QGMh5E)l5mOX!2%RgGQ}i z!Y;#>KWTGcka;APFmRKhLgjM&aKeLAhtHC+k^^VO$HZ;iHE@Taokh^UaItU?6$Zdhbr%zG3g3;g-E`@1NoD{Uwm89V!HL Vpuu(*0ZT9n#S>IDhni-0^a~C|duRXv diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/tools/BlockTools.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/tools/BlockTools.class deleted file mode 100644 index 51a348154660649eca12ebaf9b417867eafbe23c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 502 zcmbtRyH3ME5S&Y#7(#Hu;|J&x1YAiG9ui21!h#}E`m=qQOKe|sJ{x|E3WZpFm%RCi*JM`G2)nDii*2}P1n4beA3HQ9UkMx7`vMwChUowR diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/tools/ServerTools.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/tools/ServerTools.class deleted file mode 100644 index 702c2c1202fbea246c1faca995c2b3f29489bd78..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 544 zcmbtR!A`!FY^$VS9Hy~8Iy$Qh^nwbhv#cl&N)CtXq zAGuyFr@Ti_6Gdo6CYH%WT3z9R%RJTxZQB8BnNu`Ib?sqc=HEWx?CRqNcgNY>z#n3 z^w24AmCaa^ALMn8(ZGMKHnxBpt->ihZ}6+h*g9(*9tlx Dk6n|Q diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/tools/SkinTools.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/tools/SkinTools.class deleted file mode 100644 index f5aca1c0d1e18b919c53a562ecae33b8de9590eb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1609 zcmbtUTTc@~6#fQUww9$}xp+rV#I{@(K?PjI3ksqINs1)u)3gj_V7uFFr)d9*5B>&x zfuM=;+23T0XWAkaS3^QJJC}3LeCN!W@0{;HKYs-xJ91t4mhwEOWM#IcyQ)_PLJS>Se1}^Ock|ZE?3TzWhL#!W zN;S*SoJg)Qgyy_;5k)i3mA5mdk~#@K<@(5e)IPm*dVF_od#~g(0;mOANE= z)5K^q#7Y$KyzdoO99|JV!>dHv^Yd1=yuB@zC0r#{#i}XoN4m5;bSKisIb)<%L!))BL;?vp?_;ljKU&%yOa=ebcoPU3buh;41*_2kAVq> z$&+wBfPI<>cTC*HB!fZOS|$b_k13;k>E`Vy#xQN-o;Hn;=^A&+RGwp)F>zlDO%i5g z-sSq4qZr2nUAGSzrW+rij@IyW|CHz^U=Sf{_0Si@xW;l|h#s+rVJOJ{$lwo#(v9jG z;#FYX1stTxZObU0+a`|JTTe7oZHe>M0*?J|c%zyGp?(k}sfU6_raKyq2JI}G8O`C; zJ|drJ(S#_CS`D<)2beVjn%kh8XAJEmr6!8AG-{BK1Q?=uYG@DfrQ!JbJzV^NFx#yz z`wlR`aDWuUH;gTR!T4*kyFIdpDf;bw%3t-3KlZ9vD7s`;qJ pp}pY|9#aHiOkfUADDnYx;VI?`Yk~9;upj6!s3aMl(Y^_bzW`g4##I0S diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/utils/NmsBoundingBox.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/utils/NmsBoundingBox.class deleted file mode 100644 index 2d9d1dd604e9f873ccaddee5929c538170264eeb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15979 zcmcgz3w%`Nl|Sd^F_W2_cLFydkPwh$CV{jF=mZFo00Ipl4?zN2hh#{`JSI*OUOwuh z6^$5Lr4hBYKC0LX#bOO8w$|F#KHcqO*FNm7_WjtlTH9K?R`!3s@6OGgF!AT^W*3I+149*=m)U|QM}>96aH4a8d`yW`RRNW8DEJK7UzjfZ#k z*X?SJb@zt*>w4p{UD38kyl$XB+SOOLw!5z}Hqg@+?P+g}?eS1LQ{ENfUE#W}a8G;P zx*bnO|iC!m-3iQOu8c4SJ5-j)ivEm1ytmrLZ*DRJXyWHygrkPX%bUT zJaXkgG#*(S>sgB-Oy^fOj}^s27iMFB98y~taG|uk7JA7N_TfD)_N7$jp(#w0QcK08 zsWc6q))l8X-qCL_62Bxg)W$I60 zGgEFe)W3G1dq*U`DZHaA!c@>4YYlg84#%T%ZzIznC?;z>yxv7XsT7i+8m#6;%h^OHkN_qW1+Rok!B{Wpb&I%M7Ms zw>%QdfR7~m=8mpdYiC`fT$7aP#!rMk{dA$|b7is*xVU&}HPcizk?~|LG@8X%)+i@g zCHL#ZN!AFoUc6(Ck2cc99@+$t9(CU};rIq+K*kpxaE^tD%D?T`f>4eMBUG zJE)0(WouDn!+WIvM@{;G?tiCAH)!ZClRiY#ymSw&M{+gyPT8U&KKeL)!bA5m zO?QQLH66WGHN|>%A$P&vf}Qz3x}VA4+7W5(T%m>|dQ>lSMZd%@yxB_+YGzwq%)IoF zMz$m&j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v{QfhnWAxNt2 z92rcy>VGg;^RQ%UHO~^`wMyF2nlBQsv4w(^U1W0z)rqvDwoHH%(Kt8}32@RlIFSf& z(l|H~2yoIkIFSc%(i{Twq?42Ss)h05md}s}0V@api#X3nqhceSs*DT@7@4#Xw!hf$ zB1&b^dc#MphMyvaNxO|~+H2^Fj~0u&e)U1@5cuAX_Nn8#p-xk|a4hdzWWgc}+#|A=sr!$fT=I^UYgN@?bMkpj$`ywk0coWD5|75{LsfVmN^qvJr<92y|6L z?oJ@kRUtl>K%lEa+^Y~HeBbDyxj~LzMlpGfNsz~6DlsgYZj>O_l+s*d3S?4-NIsRC zjcK&WD5pz}3dm$S^%#}3%b4NH|F5!5#S1fffFHzSSw20p7rnz?bV2YWKLne2tobxQ zvbE+UfBG5pkixB(kD*Thu=)bbsK%TElw|~6JPK?cS(L@cu`jWbHcq`OJ$x*0Dfk_M m!OMps>EM1$6~@kynE->+6rUJfxIQYgA}-os{v56bKk;8OmrFJP diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/utils/Tracker.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/utils/Tracker.class deleted file mode 100644 index 8aff9f2a740c688ae600c18b2dce8b7f3041680d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3778 zcmbVPS#uoK89jHlM&rg7vapeC8QbzA$>6q~6^&590tJQfl1M->Bycs;Gis}+d(zz_ zEGHowB#^LVPar@-7W~2kycprCP`o9T%74foNrjwyyGPT5W<(XGs-Et9zx90Q`|j1h z{&(X80AIj00~vv7&yK9nZv_?mslbWsAha5eXIBDQi>$SZ-)PFnY6kwAQ?&!D6*+Eb zEd{c&Y6k{#0)v<3nzUT$)vXK5m+eX3bu&Yc5 z=Ua_sJ6Mv-t}QTB_AAnTSO$*zP8M^~iW3UVls|ohC4pP&b~NY8Fq{wk#$v?41@=xX zOqO-rDj(}YGje=Sx|AMRbn2drS^q9!(E6htpv8L zn%INA0ykG$L124P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sb=;O8eez8C#6K{wf&JG|JaHX|H!$%I1+v&`N$?xE`$NnL|lKM$gAtr(-&W zxNa7%FkEnVKh|-T0jt0}d*9yN`%Y5REX0n%qG~8EC=#j?Y7&nA9plP>x`Z4(dIeNr zUnMFFNpi!i%MY&OStj=ETQG9hkjuVJ`Iu=jjgM;!F^z`_?(?*vpv)sPbdPF_pK1p` j!wdXXf&YqYzrpYEihlb8-oT&mCihf#{~3S9TNwF2yR-70 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/wrapper/ConsoleReaderWrapper.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/provider/wrapper/ConsoleReaderWrapper.class deleted file mode 100644 index 6c69f8f4a29e5da3f7dad9bbb6761dd6e78afb5e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 584 zcmb_Z%T59@6upIk0YpLYg*$iP!Y*BCObpQkok$`E5_e@NP%=!Lwgdi_D-#!ffFEVN zQ_yJQ(oN6p>AA1d_m9^%062w1A2I|wF}KvnM2CE-h2`4NxrlkF+1S!WDCdebP`w!_*Q>#pbyW_Xyfi^~1q46+BVL*o-Lm6BZm diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/skin/DefaultMojangProvider.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/skin/DefaultMojangProvider.class deleted file mode 100644 index 742d0bb40d93d4a6f5b5cd47070fc051799cc383..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1659 zcmbVMYflqF6g^W)TiWH-LPdNlXj>kOsGyb*350~Cq6t#PPY&(04sLhJbPMrcX(BX{ z#2?^~GTzxP?UwXI^~282-nnz`IcMhX?>|3(0a!&oiV(xPEnKtiG*n5PD(MPUH*3-s zCB-YQc~Wv}$DG!`NZZ^J72dGi*Uk~Qt8bNaBFjQW5oQ=W;wRj+C~UqtJQ5{0iU`AM z-^ksN3~@rXU0IPr5qQBvZ@AJj_xE?U@(i(KI{>C)eWWi*Mh9Olrpp@t2TEV zN-*s7%2_M)O^>wdYWa1-jjTyqy6X(7OaRs6l`S%aH=VMGV*uj@hLL0#$YhIAOi+GD zMVn_FDU1(+;hKRV#P#gDfhb}OqXjyI-A3(DsCWF(A{EJkQ{q;UE2+QzVA%aE$%R+_ zi|KiaBrH`G?xrQl_nmi)ote*mr2c8tg|d0gyH%au_5ITQ#q0G`M-fES zZ#9PH{^?(u#xPj21Xr5ba|0{7A>w=9zh;{nieb9vZCuop@R+(`fSy5wkkm~u7wX&k08LEA9%Z!{ z-}iW~c)9>XQzW2t6A!LpO$D%wHr7KtB6O{_LfW;A^aU~pxw-i!a=RL8;T#L^7dmJo zR0||1K_Vtdh8CJ@?Q9E8lh?~0>olIwOtVekDV}*e>D2t1EA-alW4h2eRy&r)J?m!3 Qu-O3bSey3?+7-gfzj5=QDF6Tf diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/skin/DefaultSkinStore.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/skin/DefaultSkinStore.class deleted file mode 100644 index 9e80ee96afaa77b27735884e12ae1fcdde90e5f9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3493 zcmbtWTXPgu5dO~YCX;L?*$_y8ghYrzazR#tg0K;UAQIgq=wgtImy_8^GGumUnVAhP z-tQN@`viZ07ap`qgJNmF3EJsGtBf+$C2f%;d&W?=A1EaNw4JS0;lTvjAhqC>*H3F;Q%s+ z3BGa6unh08Kzwj$Mj$b6=k+AwXjRdSq=J;d#yWu|(T3J$2z01uK%+n^OF~VR3bVR% zTF#mjY)97Cq&XuUgWp4A!doyX+02?^W@T0>O)G0NgJ8}2DbcXi8S??+WUhW#YeyzU8X8XQ_J z1xxj~ib0ktVabADMn1eRSQrmgZ4fY_)C*0ZtG4#a#Y+86*YUr<2GZ6j*!{4udPh|p z!#K?gy-@VZlww6czrZWP)3LPSDHSL1G^ylzjxGxVJvF|8HBDmDVy1)U--L>1@GMF0 z=`J13=si-JD_I)XOPUThZ)nofGcB0Jw1O#t&DCnCAyRP)&rwWshDn2!N@xF zR)@b_1LSk%RGeltlsUu7AGOMy_6#@P0C)C_D$atsN})=d@~fz}+9-8y0&al|ylJR| zo+dblS5&+TNgW}r@}%^%1%Vy+3Y3VNh=@ljjkdADq4VqRVopO>F^72`3C0zwe;O+j zY&KL}#3JS7+5YE&TlM_v4kGeuzk~xu0oA~v^+!cTrAf3{B;{OReu^YgrikqGdZ zZF^KqvN)-G3wEAH^P6~E!CM0TRW8F?vKRGq)=!We<($;$8(&uO4&D`LDO61Y|3s4y zcLv}mrIj~zcOYxqi=|>Fax7u_MJzQNPt&-Hy03jPpuGFu=+q67$E9iJ=yxZRYQ!7u z+(H5$s<;G)3?H;(OKAH{#cRIpQ?d!D6PBerh(kovNIn^i5z!Om#YqR2!(`#G znjro~N}CRwH0gzoS@uYuFdr8&N2u4$Y z(Vpa%4l(wHi8r&P!^?14&1ew8(FH*?2O1Ip_5WG{0+nh2NSCrta|N%{og3vnvb~Rw X@Uj2&39jOEd_ilR>zDW%-(u_kV7p(o diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/skin/Mojang.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/skin/Mojang.class deleted file mode 100644 index 351a6729c1cea5f3df5c42f24ca9d22074fb2548..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 20883 zcmc&+d0BH9**WFP~RnK&~+L2VWH zrBzW|p;d9AO2wA)$p9)8>Q*ha`)2pO+TAW+*N^Xa?tSxS$xJdK;rsr{%)EE+xxf26 z=l<@w3%v0^&mSS8nfy0{@|Zk9U(^!`^@clqSBL#kUpV6F_6L0(Veh)AXH!S0yT^<7 z8~s7g;?M?faJ@kercoQbo4lR?etO#0Zt!(PnTl5|YhBZRNz0NoE0(sl&7IFw+L|cU z9u510>zkNHG>3wbs5cm0=?(PyTvW(Z*AfIFZ;yXUw`ybx+V%8Cd|^*dIJC|m z@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h&wIC{23;8@8N0`<(Is5QZ z;Rzf8tEDL)#LzVGmrmfE#d?GlyZx{z{xDuH?*y`zJXrxtt;r{_*_&o*RNg4J+#t~2 z!8x|}uM2Z--`AgWnkjl7wU{#)HwLC&v-cCk7 z&McCax&?Sm;8&J8I=Dt?1nLL|oh-VLVGs8fasiWU#|bY13~u9m1%LDStNb;5!cY8N sJo_I1kbk7U{e*wczfj+P$#3&J>f3Ml_xuO`Bg)JDia+t6`L9&*zr9JK3IG5A diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/skin/MojangProvider.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/skin/MojangProvider.class deleted file mode 100644 index ca37f0f982fb0488972ec3f4c040efd0b0d756bd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 467 zcmb7>O-{ow5QU#ho6we@0+&cOc-ch|8&IW6K_Ep%Y>hjK98w24PPiKj4#1%h)4-;% zfsJLq`SfPy`TgVd4Zs{HAqE0-OI|j0>omPMaxXhwZ=My`pNy3^b*XG| z=jzU^$%PmS%u3ZMS+Oi{A4}3+;H)5jRT;8=x#q*KDkoGqy;6EAjuk z2#j<^iWlFD;(LKf)(5=cO*x_6AkVkC1Om+Rw*W)Vb%cN~0wMNUAG12Zgx^yf^!g!= KSQ9wzE3;4XgNaN4 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/skin/PersistentSkinStore.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/skin/PersistentSkinStore.class deleted file mode 100644 index fc9b8d53fc9acbf3dbcb47eb62fc1c23e24b1f34..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4172 zcmcInTUQfT7~O}2OcF=sA|NVN(YCoL)2bCAX_O+iC>L#LywGZgFv37c(#e3}L!bI5 zeC(4iKD1pecD1W6pXyru0sT3(`^-!(NL(GzE*2TiWxoCG{eAo7@Yg@TJp(X^hYDH* z(nZ78Dy3B`Z#=L}+psFy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j^_pbERTkq^}6#O0-%(LF8!zj8Vud4hh$lVUI-J SKypT=*@6eo=ek$tjeh~(#zQ6m diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/skin/Profile.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/skin/Profile.class deleted file mode 100644 index b0ab9706878fe038627a5162baa464be65564c93..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5222 zcmbtX`*&Pb75;8!CU-KqZRzx7D5V8NlF4IQ=sP7POuKELPyFZ`c*YQhKzdC)(at0|g(` z5JFJQuGcUR^Tq524FOb(*^L@hcXySB8Uz(Ah%p^Kxzv8c8r1hEB`%q`p4_Edrg--j z{mz(aE4aP#7`=QFQ@_BRgMe20OxV`d4>w$kt$^+54xOwWHJqVhDi_x`T#lFml|nr- z*HS!f9?ThC34udYL#>EjqeOclv0~$P4Vr|-w8grScFZ^rBmw3PIC}g*x1RM72~Oxq zGr>I-8x-7G2_hZW?+wxM0GdeYF#}2wqRCNVL{pC3= zS#b+PYh^6@P=8v3_!K>fCrzeWdQyv>h^hFrf(@1ALe{RiWky3cdK4@ow>qTVu7u#x zh$(JCxIk6u($G*>C-Ln=zlysR%$MXS?r0c5BWseAaqCkMLkd=nIZoEz9F2;C#2YYS zSS=}8=2}=zqqo{YtP9~Y7*?@oP9=41Xt)QTW!W0ZSSg)#byFFX?|PD` zVIMEGm1A8TEMx21^J8Z-Xo!-kY8^qvMo{3ejD9GH0~b zAcsRLCKN=js3kSrx-*F>M%ue==k^X(o~A3GSkz^b@5d1p4^(nu(N7JZ!%;#vrrW{+ zR`vR;IkSN`apH zZ827f(32Xzh^JT(Xi{RQVD6XCtBImT=x0?Uq2wLv*AG>ckJ;0BMnPFYb7g*dhbveb zo6|rrHQpyPTA3jk+LlNguZ1RxT;U@uP+b&6D2V6Tk98N?NU{8ahU54q!L|k117*N2 zSJJK`^Soi-Ce>JMZ5D?RzJr%kd{@E3*|OM`c8pQO((pZeUxf%65#D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J`?w%=+cDE*|4VlD*?q(ChE~Py(3rFE!2o>Na5H4 z%``{&)QLBS@TR16!Y|}KWa3SDUpC&4ROH}L@WUoJg|*LAT*Gy)ecFWU40^({^z4AC z<#IZoMPCbSs|aqj5GnYU*O{ zmDQBk%dh-vzKb=$uV}f8wes8gGZ$;Hp8q5KQh;hL*x;^u$1Fp{2q8i0x8FfqNll)~ z7m%wWMJa%d*u-yGURzv|=RfO$18Wzsc@a+v{DRg+JY9o7vF9i5dnR~T(cu>e>eo>sYx@ z-9De5$MH&^64iVlQ%fP%6@a^|0EXowgBkIdH7uhqPIDe+05ATI z)c75|IJ{#4r+e$RkM}m*+o#m-3*E-SXhUmgPjCIkTUZ~hi`FmVC4og;ticcHxQ(^J zwOfevMC*UU#Mv7m(Hd%1eq8#iN4i_*lCi@*{Q$|>OTxy{i9Vd*U38k`3rwXXXg~Q* zi=ZRPuN=uFOO9N`6sBo$1Fz4^Fvy%WI7Or@MDOI&Zw4k=I!npT-1DTYqLf{f%24Vm zrAAS|gm#1#oKTPz3Q`Jf5geQVmPqs9j)L*RUegk73~nx~)igz9Pbn~=SX^y?V7xr* z&AuenBabz0F M`F(|N@ExN60U42X_5c6? diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/bukkit/unsafe/KeyCache.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/bukkit/unsafe/KeyCache.class deleted file mode 100644 index e04615ef801bdf6b6669c9681cca83fea083aa14..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2992 zcmbtVZC4XV6n=&P31Nv46hT@+D@YP$eXCl7T1|bS1Z*3KqJ5ie2C`UERWw#Qe5J}1@-+^C5-IvM)!^EIwp z++NjhRqhMJXXu=}wp?P^Q&dOF!8~u~8G1_Qs?GhDD;TOta}U>|2rJVUELsJVZ&*axKKEW8N)Jd)4#+Jo63~QZ^5Y& zLjw#0Z5nQJuSQfP(T_n5dy!)3o>68=3}HBq{S5os*9(qi5u>JKdm2V?fH?KmZKLKo zw)sd@$rHo))Yi!JnQh-aV0ceM7rJFhsJ;uWMn$-bykaR%9D`eB?wayD+|<@c3xv8v zwI^;0Q<+`YB7w0a1@eK0BbZ?5GNgbQmcrBT$nnZq7!xS=v#G6fPonefUXfwOg zvK6oT^>C5zMGnW~IL6S|zD5jdn1)Ww$#!V@Vs_<9#S=EEybujNkbeH12qAu?RY;#P zk{`o#)K@6~O!2LPOW-sEyO6|(I2Xs+Eln6$YdDXO7!rnK``omth@(-6LXEp6@t`Ga zL*z4eWo7aj#xO2d7d2eMNeXRM_!8n{4OeiLnDm;KNr_KIJ%z!}X6^;KM+?a?xZ`eL z$>&C$xDDmDZwH5&auP8NO7Y&*(2H)l`cy*?lGIy%&7_pB>{^u!8YQ{e%?x`tR1(cY zO5-yPpW_RL-VH{n@u^p%k%t<{+?DqiC5cN6lRMprP!$@*ahqZIZ3R!FjAi*=++{c# zb-3|TD#b=a&Xi>kUuyUYUsEMXxeVu{mRkfHmE?{p?RHwe@^RqpqNJzH6%A)iNMu6; zm+2=g-l$ahkrPr_D>8*^R6hA8GbBrD^jtUPJJd&fs-ZG1b0I}vbsXRGUEZ7*e$Aml;E9|M#R&2xn` z6nG;9$=V2U)QbY4f1)he03B1;glXIf!H2WYaXs7S?kR3$b5AkbCNO{-C(wgbibDi? zI083}ITQ&17*;9LIKey?LKK~TC0SkB-!Z$LpNR-RU7;H$Cq`)e6G2L4oF(HMxtF-r zfyWpKKS~`$dHKm}l$WLN+;iNSS4YQQ;$955kG1(4B3%Jl;vov7$eM|etYLZkwS{-kWSFxAr( xhUBT|HP|v$L~Q3Os-+&RstU(YQ-CJ!)34Oo19Ib{g*7~+9of>~;Sqko$iFqp+@$~j diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/constants/DefaultConstants.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/constants/DefaultConstants.class deleted file mode 100644 index 5e31eb635d6306e323e993eb27c51666b97eb9ca..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4}*b)_#o-rExL(CzqH+{T&?Qe7M}Z8^v8kuYmPG0BjVw{*RyIedzB zhUxB5#PE0g*o!>F#UIi&WD9?(=DJ7yUi@NfNY8Q(;*t@^CT-i(DZ`L2_l=*)QP?WC z?FL=(mDvn#<&ja{b1#QWxIC-lE(s#pgB-3QL$Zybtd_&|!0t4>oiN@42{krOQUc;jU352%~SN9 zS@|6^UzJu)@EY(N3DQ`gw=xHA&_W;L4H_+k#&{EpG$S{>MI(l{M|AHDbnlXm(BlI6 zg<%Up*lHjrkfjs67Z0fLg1Sis%LQXS3Z_B~B`O5N`>&ACQhfO^pE~99__X=tQ>y$F zT+#OvG+GNNl&+K)wLkEIh95D%5}WASFVNDzl8qKH8YURBSt1$v4%jSU8Kr>X0#<0G z3R%Dv8fgK;L;H|nWnUiHuMX@@vcF2cQ%Ie^!w4|-W(4>LQmLRui9kkp^)x}$UW6Fd zAPi{?AQ}NgRU;#SsM^B_Af{swm3;_N*_SDHXuleORrV%1qV@*ml%j1Bw)IE&nC6P*oAmvJo&sg~89jGU#pl83J|1E-7=3{) QY~vAGWyzzC9W=4{ABfK$IsgCw diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/net/EasyContentRegistry.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/net/EasyContentRegistry.class deleted file mode 100644 index 38b1f012e8d5d1987b6cc655ac48cf839a40bcd2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2048 zcmbtVYfsZq7=8`|%DQqD5L86G;08!VMbIIjV_fGJ8JEZxb0~EbM@!lcLgF9sKkz{@ z0WXR1v%kq0-_sQ=f(FK#tUagi<$0g?Jx_o9`tl9H0A?hVF(gghRUNBfYxxQXoHh=A^o0_%0!CkfB8hLe%Z*o;wC%LnouuNAs-B~?nIIg`dp`4-4v&eHZr)HMd zbj@Xu5}EW|GCju-O?hvuZ%%S-0o-a-PPvA!TVizrbxnti4ScA=FY|+*QM2m?!~8U^oxX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Y)DhYltBE7|ZW_7$h|`YuI+F-OHJ7-^bXe zA&Xp&TOq&Zp4^c8M)je=D>vRXcv!_ILjt5UjmfW%HBP{Z!Mp^S@^g>(x`-`4DRnd5cb-@S_N?Z@Q7{Ft`Q(XJc6gK{S$4Fj)y qlD`G=DS3!b_Q|7c`<#4Uz95gYrGkA=$d}|P{vYrxd0L(cl>8Rem?*&j diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/net/EasyRequestType.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/net/EasyRequestType.class deleted file mode 100644 index aac26de3dd89439c72979c6d23a2451a97e5baa6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2289 zcmb_cO;=l06y2AX`zQPp)_rc`A|j52ti^fz-gEXj_k8{K=TFZ8TtnGJk3yp2 zdhtfJSuePs)r+26Z^X;Rid(2VTVDKOp<1pvUcBiQOYvRjp%WMFl+)N-b3bjm4KKG> zb4~aZdi8C|scgqnm1bGNxRuH&B-8(!epbP^lu9g;a&?`QzSXQv5m-#6Q@NCanO)5- zXEU~fe>IUyF7YIp&16zZD*1D3i6nJ=nQVq4P;Gj(rl+9pDjZ8?)>pM0r|RNp%48EC(`VfOtZY{)^pBg$yMk}R|`&Q!>Jbq z>%%Y%42#t}79u#w#CSW!1}oI?9FHcU9jB4)REL>keZpJyYPp>hg*%5lcJc@+7RI|s zo4BnIIamn`E6A`-yy|+b=GK!=gJBLtC;weCsmiK__prv=K6FYP427G~$)ji~;m%oD zmr#5ar|e3^cPzY*Je_d}of4g$>P}B~bJs0+vywx@_^MY@vYrES6KRJ9~v{ZBHR~i0kDpcb#aK+1H#*9Zz;kx?$Ub ziygLFH$k%GG#ayA=AEhN&bsUuh99=|(z;ocjvF|zlcwdp4Ad@eR~)Zdr^pyaS>$r;p=&Ici#R%CzKwk+Dw(1&EBu zm=T+t=>eRgzd=Ba(wqGK{xej*Z^(Fx(~mK#!Am|3#xywZC%W($6B@l5Xrrh`F|&=P zGogVc|<>Rj4bCE_<3C5Z=By3G12veOSp@Bv>9T$KcI!e zheQJ~Ua&v?CfAZuCO!gA_OL))hMo9k$SVUf*uq@?wh?=tpOY?GG0r^0#}_4v?$;{q kQBoG-dieW|G3rQy!hI_C3|qfK{kL5Yikfp5540@(1ssayRsaA1 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/net/EasyResponse.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/net/EasyResponse.class deleted file mode 100644 index b51b54e242841c75f9f78989db661119645a8f6f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5485 zcmcgvX>;4w6+Mrn1d9eGS&|jYNnOWv9Ep+*$99{vRAenyEX9-Cox&tX?*9ooL!mBN{f=#oLRMBM=`PT2jy_ zFxr4hY<*q60~O8c@-Oc7D2Fg@Rp4ybJGEa6sTp>wfVZ$8xn9sqnmBa*dLT zgLqJ&t;i#R(}OLE9?_>Na#xmO<9xZWYLqVOs}^DQWSyLDE$Jnb$HB{lw_%cx$Fr?( zA{t!e_IN=r3Ut*_5$NA(cB@!5eRk*6I!=vDxQp8dVs>B}XB9jlkZ!m!X_K{6F#~dZ+r+}c z#3g}|#sn^gb*_PsyceteD!}y56E^?UUA<##@uRRY)jX0K7tl*I)5(K4WZU8%yNYaOk{Q=2RZ}u_jHa%kyNZY*cu+K*A2SM~sVOw`+4|VjnyrM zP+0F+vE~Da9OV2T&2cs3c>OWQ>v!m=v-HAhUO#+XV5KE@G>)J!M>5=cCKu%&+!H3Z z`9FI;zy*Ouh8%~}I<*)D?1-}+Jw0&Be_NH^i(6W*>P1M))oagWn z`dj>tPN%~5D}nz+g$-8v;4`|Nw+#1i)^V4{En{-ba5?rWoc zNq{`1Th=1|^=7)-@ynW~xLQn>yYYK=>Yr5n1V5#Te{8NVi+ZRVf2O{C*0zn(l%>0_ z;VO7p;GwrkUr#^h5mh{xaf0pu2f1Pyiq#3)RB8C)= zVl?ie`*XA+LH9%H*U+8*2YN5PhP}7YpT7SV_N7N|VSoBn^dG&A2VSOGaU7!Seu=-A z*7XubKl*SV2C$Df4B$QVJ?$gnFdm{2VM|6rJ~5}5d^&=M32%^|Rbs}oj$nx1P$!FF zx-vVB?)3ugUA}xk8uJ&o1;(fa!qGa5_us5pe6a4~W6~m9J{?$A$@2a; zuAwb)BhCbT1$+XBBN%Ex;JBP4IC37riBRm5ay$Q`F+1sOy602{?|TW#ZG7OS9E@j& zU%{CQp1cNi_)W~mD_F=5SMZ?-VJWTsJf#Z_rLEm)1vkxb+0h4H+z+PO&6{1%4h5yZ>Z@imcBvNl-K*71U z(5E0bOHcHv0GqD0PU^4K`BX%sZ6`UQ&eH_K9`5EatDtxdO8hz!iCV26i{Nxev~EMJ zbDSaQSC_8L=W*H!hgb(gl7wz;;EYPFet%McMboi~rwD?ft_Dyuq!~LbDWOIx*s8@E zk7%0=v62B6t;DA>OO^z;GIaNI?{kvqIE|So#~2g+{B3-(R=+b5uGJXhjHz;^ALkJD zs}gl0Kux6y@@t}kZ@h_fwXic0*i=Y66~fXv7Q%j4!p_l{rRb8dBd=5CKm|Xj1K4-s>v_`c+W_Z696zJ&$MAFff_+ABuG70e;0FGJztS5{`I~qJuVUbT D<=W2m diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/net/EasyResponseCode.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/net/EasyResponseCode.class deleted file mode 100644 index 5f20f3a71f16a2bb7dc9f2e998264aa851e000ff..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4227 zcmbuB`*##)8ONVD3E8k&po9iW3Y2;&fdE^eQfUC4%)Xn9%+73QW&@$>IBX`cu-V=2 zPH6Cc!Ft!;Y%R7@)IzOQu__={TCJB#@7{j(9RCB)@vbd?-*-0byWY<6_{*OCyqD+x zJnvk5_51}Qx{-dJpbkbOl`u*-sx$Rscw4;`h4n^yx>N~^^YeAHriA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jcCoj9xG9L_Vej+vGz#~Hfou|e5V%Mn~)XwUQ)H@V{q`QXJ;erQzTFX_09D}?9O zs<287Lyhota(v2Qml;KIO^2qo*A9LnLDP6gO_2sX}S!P zg@0`9x?`jI(G|pAHs4UX;b!_VlUmI(j5GuBT6i_9N;|Cf9EsA?O&ue+#n3V}yRfvv z5L(SfaR;Ls?lN5Py2CPUBQV}rl-w$DrP_IT1Z;LHnTQLkacZ^!?nyl8OD&o-=C);}tSC-C7P+g;mEdEJ5 zPL>p3&GM?ppeZlgO5#viSF=st0VB!gAWDhy_o+Hf1%~s4|9d4;%c=$DbhJUI(_P|{ zGsG6XFF@W@jo*Frg1@djq}!a~82wu4>(N3tKD7` zkI`ITdSD+$2(yFV5dDA~?+_dOfZKb>DCRH}bBxvkT_pOX$KLNF19sxTLrhSX2;z8z zEUnJbdS8Q@o20oZ?@j0j;u;cp4S9O^7*7sVO?#^HWRc1hPk%vTWq^cy#LPZsLpZw6 XUQbDnzxqH)9P_wE%nS>}62h}z;Di~C diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/net/content/EasyJsonContent.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/net/content/EasyJsonContent.class deleted file mode 100644 index 4981e5e69994c5451da807dc27494730c0f01085..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1990 zcmbtU?@t>?5PfR{2afp};)YOKN>VUR!X+UsO`()RAp#6ka*EV^TaJSqJ>Q+qYij{?il9rvf$ zQ*KI_t zJ9|g2qbzg@EVmzIU9-P%8!BZN=-8<2Yzu6b+b8=U#q$DPk&J6@EbyqzTAX}W?rNWhP-_1dwKaT}B>o~j%Q=-1)y3^iPwE?+dLqGB&NobSfR?3;`t-*cq$n5fQHpr;z{dj}`q$G*w$B@taS=J zXeTRy!oOR05+&^uu-o9#=?LTw;;`CM-T$;{x(!P5v7+xqp;hUx=}8_lm=&13lJ6o! zGVO$XhB*tLvjo>R!PMN0)OOwX^Y{YK_@y1XN??{BYMc0Z3rzc_QN&4I-&t)qZlu3w z3ttJ$T}zjacg3uLCYZCcFO}3|dXa28IaKR5B7s{iPfZ}j^j4H~e%z9g8EOmP{-e+A z$EGKnUoi`K&C~l}_|jgT(Q)w!hdRq&Co&k(tAsmzNY6OWE?PH`=W8#m`}EL%H_jn` zI78nX48EqB!A<_}q7%@EVRNHzxu{a$vIzhTl+JLgbdCbiw|~LN1-g$OI&23~{X8{` zMiYZkBT3*xjHP@JdFr?9&_|~{S_KqZpxG2Uh;fsp&f!4{&18SRgdA-_W|~1KaF_h| zjPIwW3Y%omb?ChR4wE{3wk7{@LsCc_QWCnN#Nu%Y&^yUW-y~Vgz-|V3WCGM^>uL;^ z-eQD79{+)<)2(0e^wiMmetgMieJ-TIlk!dSW{MO=BVs%uX^I%cBEF`GUKV)?-;isW QENolZ!V2$KX=SkXH(u}m0{{R3 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/net/content/EasyUrlEncodedContent.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/net/content/EasyUrlEncodedContent.class deleted file mode 100644 index ac0be6fe1b90da5557d8b1ad40ad88afc6934d63..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5064 zcmb_fiGLJl8Gb&pyR%t_D-a-nl~PJ`vNV>%gmaTn0y!u-FhL8G-62`JS7#?AXi;lX z+G@pHiDx|;k5*F(8wwUttJQi{@%&%-iO)MT*=$HO2|vk?*_rQnkLP*5ciwsX-`8#c z*p7c`SfJ3JGVO3SJ!nPEAuDd1RyLfBr_88joV3HIqv>SEu)~9PJP|%+oHoL;I+{+| zX37pX8QC*kR-!2tO~=ewgFC9hr?Avnn=n%S;r6~$X4KXYP>9UmRkQf$G>2`^y28S) zBQ3|9+8Wv$n;I1!Yni{z{~3P0LP>##AhThdV@(QR09d3FXvD8f21x}+HQVZDZTE8Oq08&8L$ z1BR6)%N@3niWyd{!F|r^xE~u7{9T>?<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O zF}$CaKfs+X2(s#NjvseM7TkueA!2CsucYbEXLdp|QJV}n@u-Z6~t@Dqfz0ChQh7@k%Y@M&nm%~Rc;hC2Z7{%5af?Od(pUB}k;;?iV z0Xdo=J0uMZj;Q3tuH8y+;Y zl!gI5X^caoW!zyJQ-(F1^(G#kIx(?+HT;EUC}e&^MCh4Cf>&Yi9K9FQ`-SUBlBXZE zQjb5(;T3XMJyuon;~d5=LU(R1k7A+k4Mcj1syf^U=yG{Dosdhn{25Zes=cSoWxfTX$Gwf)2J3 zhoW0hr0bTD^x)J90-m2*KXqzi&w{1<$jDz^Mwpyi4+E8?;%@>(Va;JVcScAZ{^8vH F^FIxzNk9Mq diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/net/tools/HeaderParser.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/net/tools/HeaderParser.class deleted file mode 100644 index 194b3258739191a9336d772b33cfdfa4be2d089c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3953 zcmb_f3s)P*75+v@EQpOCU~Cg7aUR$K8IVm{r?wm$0|tZzcB=$p;y%`5fhA&B*sX4AOCstEdUSV9StFYUfcBJo|AVo<^|XCP1lRhShksQjR`+~KI6>f3_qUtt!#YS zIB&$|YTt3PUVOkb#!dIM;d-X4AuO;(Eyx=7Wc<{*X*1&sR3EWy%Reem)zUg55bklt z%_yo+t0RJHfz2tJ8qUw0Gu?-cb6HcMKILSL?13wO&p~cb!b4NhHV13l{u(mJ9Y@vn6~fErA>xoYfEcj z4-_Tp(1cwYZZFg2gpNCKCv{~)7{22QY%kMImgEH3je9iQ&B(18U!B!)FYaU5ZF82^ zx2+-sQY4{ak3hqkDv51AAswzmGw#>XA_1x=P5-2+L@^!vq^O3X5hI&7HM9$CS_6<& z)u9b>9s6;B#y#sv28Ril)bK!AmKJ%A;=_1Q!$H!cP?UGwOmWk&b$kSe1hn(g(y0l_ z!dQvI;Ic#%2|T3Xh`_#ENGKgg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7H(fl4ZX&4YYR=CwN9mbyh8x6^ryEHA0UyKznIgc8?W)}I#&0{}bUIBB9 zDGokUz~|NA*#f?*2G1Ap;$rF=UOK~^o0mG@pT~h%{g0OLa#d$)UjfgKQus;%zg!&R z*Yl6^>o*1bZgJ=uu1cll#aR8DOZdY)G_iniY>~t?Fc7;)^&PlRQND+bX*<6=NZmoc zPb*Tdle%eMo!9BR%=0ns5oqO(V$AP0qI3`?PLxifJb*paZRZc!4jkqv!O=tL!ZEVY zMZ|7Af*yvdm#F;=!2pqy$l@gOY&+%I+0I~)Bm4<}=KD19{=$(^VcCy5eOSZwfxv(5 o3QdPJbn*{^6GQy}H-F4_NkIsIB}xc?<4FSj7xb|KZ&%m;7o-q582|tP diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/net/tools/UrlEncoder.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/net/tools/UrlEncoder.class deleted file mode 100644 index 607c2240e98c1a3e34f548eee290548783e92501..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6572 zcmb_g33yc175;B#c{7vALS%pd!2uJ^LYP!^l!PEjfD#)b%4UdFUM4Tez+@)Qyoo@o zb-}vT4VMQJ~e;k#Qc0`S~2hM0&uZ46jwZ@`)qo%bQbm3^b zKwg7EX2`1z>nk+9O28FT6WXG1TbqEW7s#rMMH9Lj)mN*Lq-LY8e$r^>SqXvSG#Q~- zG?a|TwWuB-m-V_-O>`_%yC~VcBHSKT^<-QVxcCU!=9_eeB`fqe)vjvz|9w=ofa)lr z4mF<8=$fhKA<=LwV66q}%suIk`JqTS8rByG*osS53)t)EW(7Wh<5TV%&vXwaVzL)g zkSE}rZ^&|kr+SeIuY&1A;Yy2x2h%V^vK-6vit9^OONNqsH%^xBF{Vke5nv6s|_#Eac zI8k6i%Ks+H6JDHzlLfNl+WEEEbqO%GmlyL~B<`}9g>9r}%>C8nT{Wv;V z$I*gJV=#=PM3oDT0uwFp9R|F4Sn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5OX9IejCldej|7IgKX#z4Ez;UwbwB?zAkx_$0DkTn3UDewDzcxG?D;&W|r z5n4B{+~TnL90fa&Iefmuv5wz8Ot+%D278UoiSo5Z6yt(b|M*?4XtB5p;1H_!%bBkFG>+HWV)@1TSp#^he&`931~ zesXI`9C5oH%}Wcz;W8=5GAKC<8Y9k>+GDY5&Zp9DUxSn1A3y{0kp(MNX?9 K{xJ|EW z?Rd6tc@48>*R852*L`!l>ejZTZ#I3~F*oJ5G=0}~8s-zvlewm&Zr&KH&iA`9-Cl|&ec6rzX;bd@RctXW&Nyd}BnSOUFewDg)= zOh)|Ic0=HC`TrK>PN?%x|ac81pZ`7sV z^awfoFMHQh1c}3bD0zi_vY)f?1e`WVs{p5go)8mfxE#X6Kl;%*m;e9( diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/tools/OptionTools.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/java/tools/OptionTools.class deleted file mode 100644 index 1de805e4b473eab75226585099b21d12dcf05aa0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 689 zcmbtR!A=xG6s(?^W!QCBMp#(T#e{ePOzgb?H{^V>Oqd$<`R5O|myC#zyyYV)?V z&XkoL+T7?;y>{|M7sHWqa_np-kJO2ht|+of?u?u*@;!f!5eXzUm#O@X+!-7h?F6PC z*xb5pfpB$gUm$v1yfQ6>XtvS7l)y~NF3-lpfhqUYATt89X`xlNuS)Cj@5{&?+DhP2 z`kyv81v>iB=;P<5sZ6ffZ*lcyTKlf2n~bEg&9#FTu3;|5EG_-Zx6#GCK+{$eC63Ao z4|r45OHmo^&R?o5F#V@SpnF+wn%s3tA3s&2dj1$af!1#QI!~-$Qu5d8?|65(3p(I~ z0s%knmN+Jo%!0YGeun8UHQi$LG+1zju{|kZ?ht*zRm||l|NO3&0&cCpxF4Nwhg+Y~ zU5fe}>FuvbKB5txz7Iry`P0RZ=#=Flyz~OQgTe^~dz4(_d4Z(V`^b5&?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>;;J|UbO;!x;8_ZE3Vk?D6tXmR tXI0=6s?u3p!etdWL;u-%N?fO~1ze@wNx}`pexXA{k#!T9DMDhn_6M7CU?czl diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/logging/BukkitLogType.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/logging/BukkitLogType.class deleted file mode 100644 index 31cc9e9fdd7d17b802ae03852a393c1bce0f7e71..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2439 zcmbtUYje|95Ir}xBS$tQj^mJ)P(lff9|6%cC8Z87ArNq@(g&_P`6wIVs3=lKmLd69 zeazHMnduMckLq;y>Y^mJn5N}}<*Pfp=bSyetH1vK<4*t^_)f!wK*O^`qwf!buKhA_ zLObXi`;KRK1M696yy*J-2UchdLdP{+zt?lTo^fyR{J9gFey??OU~5PV+@dg}f8>SM z;lZA7d(NSHvksg%t?RpfV5qchei6{_KiJv&!E6cKHQ!A~T_C&Jbsf(M8v?0vr7e)& z_Mh5W-%$rFubsYl5Jmydm znA}uswX*q>^};e-i`;n<24qq_Ila=JB7h5dWH2c(ZIaQC2m2j6XjvWC7ML~tuI09^ zz~OgwSxSJfv~{Gg$V%QP&EcNY7npFKGQ^k`folm6QJnQMG-Ubp2=YUQToTB1qYllC zhUxeSWeqF;XL6|dJVBDLpGO5%fn4V(Zh=6#{1)RzWe7}l-*ir3WOq_wBj3F z@hX|tq6C543Bgh9xL+r4xWI*k+-9>`X=~UNIDgt>9d$I=;4f%j$})_$Gq7n;MU$qi z7udE(-gn#qd0$O{9+#z1&RKnFN3?LX)MZufNx{6YkMd~ZOY%x3(2l$bJ)Q*~Ycr3p z@tA~${+8Ewjy*jNOP~jB1PX^f%kax>6Akj8vSUD>Fp-c z^aN&JL+sA#zal@x>~EO=h3+P>K+j2v1oD*6H;hD!ud*9-!*`R_+7K6yb98w-O^h=# zZ$65`C8>ZhKfq&kz9sO4svfIl3YxZi%D`ZNlum#k$jwJ&{~2)SIMB| ze>LbcSqNKyJ6S$KkI7#l`Q`s0pGhM5pDU6cxtyW$3)R|d)OQyzmC{4pNvNVmv$!g$ z)}w^jsY2{j0e7(_+fl$hI`KRfuuZ2l(aqt$BJESVc$bRQ7-l8XQby8_RcK(AmW&(J zh*DzOVoY0%8&s46n6@Yd@O%}efDBPTz>X5IM*qB)+3N3j_zGYBOy`s9x-J>>QH){~ J_(n#3`wygy=Gp)N diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/logging/BukkitLogger.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/logging/BukkitLogger.class deleted file mode 100644 index 588a0e31e038d7723c04d0b49e1ef3477f3b43c7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 17314 zcmcIr349dg*?*o*HnZ6b2@nHLt^KU6*0$b!|L2|A$?WbVYzX?p%;cT-xzG2= zlb`K*gotLiMrh<>Ix!MV_~X%JtTnhL7D@zTaerqh5^RkH+7tfGtG01<~Pq@&NQ^42V-+02BNi0MNRYT=FM+nI=-PV%))Bi zuiz8WC|>7A!2%?T0Y`Cjs3Q_cBx6CQiw+XatcH9v))k9x4z&ei{w=XUR~MdOBOVP0 zn}Pw1t}+H|XM?9ffk-^mob2j~#uC9cCSJ?rKC=NFGwH3-a5T0!7>@@!@N2oD7iEn_ zf%t~zU;+q^%N?DSt3V;8CAM}27YDkSruQj)+R}=;A0}FEzyU>(;UqA+K_V3OuTpL! z-(pHQrc)20ih#B&oP^`yr8OB(L_3+jV3W8#8EH*~q7na`kf=D>sSLfK?-_Re%z>8# z1CiQZRHk$wc5%lOfdq^&DKFI-e%&k}qM7z+tTT{c^2}-tha#cGY^H*$aVwb$=SJIt zUaF+yG&+`PL^RgnZ%@X9MnuAo;T--t{Lrb2#$mn;FpaJn*U;+*$qBV$Vw$XzMjkIsrRf??gTEYH$mukLj%RX3+nHv9*1=(^ z6^>@=R7_r`GKq{O$;O9AsWxLiOef`u*2iy8ln=kz2R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D45auWrLR3QxuOsme}vokXu#D}6m|2%)HU0Pn!>8Vl)&Pj7ilfph4_~(Mn;OQTW@F zDvY^l9~Pj-+c-L(p2625F)l}_uSirnkti@gH13V(LTdt$d`RB?SYj8Y zgFG#o!t9~D@lPpWlZRfxKVdU>t_RS$a{-57!D(oA=)mg6nq-TS&3N*xpG?LwPBo~n%Oo;Osscu@@dGI%{=~Oo@?K~JWoJS%a zJrKGcIReY!^f8c-hGxA4PPGv!<@{7P|I!GN1~7QjHkypb6)AoWk85ORIlo}Uv=P6* zlkpV4WX$@L?>_k*a$Dm)!Q#XIkF;cm^B~;(D}}F?;Sco&(|jI64Lp>V;P&E5uD~A{ z4pXuk%YpTltm~CrMsJ6u(#N!9a2?&uubPFX5>JLaZY1JA_tY$-yJLkB;sWGWe$50q z777p*6iLVQdLJ;T32&G%$3dskW}#(AF3+jtHbMY;(-A1AmBJjzBpLUM5g_A(o-LcY5cp4ut;YNGPZ4?I9#U?>YkIwB4CN@0mau z-2J;R?yC7eIWR}0_`iL@jAchUAM^o3JNTm_q?6%nD83`vh?3y9ZC%x10$~L?S zGsX1oVmSA8zLblympsPe7;7XrPO+It3S8pcE?1#T8XtUf=~UnvMF;GZ1x}K K8s<8jM*Khgs_sYt diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/logging/LoggingColors.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/logging/LoggingColors.class deleted file mode 100644 index 0ef5ab34b1970f4a49364596d7ce856da2538061..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5013 zcmbtY30PcL75?u$U>LY0Kr$qRBxE58&?M7lPlzc4Okm2u&|yglDt(X#nPiy3nKwye ztk%}rTK8RJwN-1QxTUlbXiQyeO|AP<*QizNzSL^#+VPzG26zLLeEK;b^WMGx{qMQw zoO|v$cX;%<2Ok2kQ>=EvA+RrMn4Ux|86Px`$HS%(Pk2VcQDZQ!51F20gRzlO-Si~Q zaKsad4G)K-!=8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er.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/minecraft/MojangProfileServer.class deleted file mode 100644 index 84bbc7c1a131519beb899af40da7c90e24a8b2ca..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5592 zcmb_giCVFWQODP{b1z1i9f@!YRJs=Cgb;J&5nVdgfVFjDA-hcdEn}tCCMof;jo`B z+@|4nyl=4(C(sJETv>?Zno9^FX0wJZxRulxv{GZy;gppzlN|$o)FPy!j^b0+klvpi z9gS!7R{5i$9u1@}jqe^DWSmTCyQQGPRl8tlU8LanqTS&NY{eZabOz%}do+9i+Zd!_ z!*<|lH3w4`gG5rC6z6wn_#k$Yj|D(7gteCe#^@!DF`g_-3!G`|x+_~oFrpbFHri>V zW&Bk%D_FBMom#W;#DHn}(Sp4y?p&114!#=pp;bY-o$a?}1}a!x+tJ|~w>S_j*sq}- z2NbB|A~(ASmqgJi58w+d!&rNnNY6&g+m#`z`VTwuJ}IE^W{1px)c z7ZPFqSaIKbam0rYD}V^ZJsJ%36GO{noMVjl{zCWKh7BufGTo9fGhE=~qV*yOEAR;G z0!!0S1*4=%=R{3lF%(7&Ylvfn5Rg z;KxJwxQdS{2rWyH)U4qXc$ggLc{x|GnB#8DL~A(W$7A@UipLe)B+(SOb+=E%%yfpW zP{XH0^I4f@4`zf|SB_bdn%=CHU~V`>aQVZg;1`|UVF@{ua&HBV%R|jIi{&mW6G~wU zR680LTSY}Ged}UT6ao8+hLboYMo($DAlgc$`_*j;gd*#9Dj#+^hohtMq=Lh4j0^Mh z20Ek=Ci~hqG<*}^atsiQ^9FPlCDVt)@ITr4DP zK760N;e9G?TA8@X-2cIH$-d9B45sXJ_>st%A1lyn*`Su6Ct)9+S5PW@mJb(23Fl4D z$Yd?as~0u=RItfUHVIREt%Qo4f?YQlHa}iMUi7+`6*Mgi)q*!MNeI03OmW%`wdU*k8dOuW=wpz9NRG(&N>?_K z5OjM>!FKkr>paQQs8*R%XyWa zQ@o8|g;73NvC!f8>lnVNz;Lz$DYsm_BX~+c_BeqS=TFQc+!yi&d^zmNqiqIv1rOyA z2?cxsjY}N5b1e{9G!F!-7R{>y8=ZL$J$W2ku%}Xnwif$Pha-HnEC6}}eXd>XY_459 zxm(z!g>pC@JQO^W!`TH{j&F?xGBm_6!2RXospZOei{vTgTKg=_zM#M4Re1Znp=cgM zGZ>B3=a9%F-Pw>s_5yBe$YbIXrn(w~=X1C}hX-?bq^YE)WLj)|G`FX!>(QjGQ%VC2KoE=IgJ z6vb%8axwbqbz#&_j1JJ(yNJ<2dfGvM4iTdWJ?tb#-HR}KT9V<~7zr|81*2#1HP^=_ z7=3*yM$w`eJ%ew%=l3u?BDu>$^?4BF?<^H?w-n$cZ@C*|K}7+#s9n4zxuW`AQB_RW zCk3;zPoY$quIE%rEi4bGNZ!+|IcHFbvjrNeC|8t+QdT~JK|y(_REen2_pGB&IWOxc zFeOvK4R5`h0)qM?1-csN>}Yh7Aox9o_Y$7-=I}%2gh+$nPZlCx%IWmNw5+Byj~ANM z8ubm~%Pd~%3)Pg?lzC?`Gu_FmCrbJzOfYe_U|9Z+@F61Rj=MXtf;$FC5|bnu$ry_krsg$u!dFo&zJDf xbR>_zIhE4S_B9t^r}RI}l}E_uM+>+dkYNy=wFLi~uXHT$hXs5J{w?+W=l|j8eJ%h1 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/minecraft/Skin.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/minecraft/Skin.class deleted file mode 100644 index f6c636f0f70fe0d1f33d2862eb8e3d65ecb2aabd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6254 zcmbtY`Fj)R5q{T~WU(Y5ZUYWCmShl@p+OG87?T=&fQ8*a(7SWk=9_7qX%tM z+K`@UW11dmn>KA}I4uYylr$~0>3z5VN}oJ^`p&oOl@J1h;Rk=8cE6ch;)JjF;X4*0m)={H7Vfx_Lu!j1gnUSPz3=bYm znMrHd{bdYV(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N5Q}F;#Jji_srg8A)=&SY|H`U5v zQ>`2|)ymjLVk!hA|D;IBt0EB|I)fwu1=7M{nVD_Fwavh!GemM==Ml7Al{5YR{f z(@Cw_s8Mg^EoXmMRXu-cd>#m2L?~Q3hH#<$LX@GJZak#qb>}o{m0Ow+!PV4Bm&>TB zG90O0ReBMtbBY2A?-Kg3R4EBN2VEr;kzrdYu9RV0ovxH&n+}MHHLi&h{9R5HOBLA2 z7}kbol@W5db`0yotHw~rZ5Erx5X%{_W+H&)G`WI?Rx5<9W%JpU5Cykb{*wqr%F%pOsUFF zg*v}FFRF`N`;V$KS~U-F=;mL^d6cUdD5tKlXmN7vXjzx1rQFL+1GW_rUVElMcwaKxrXs%+Q3qxxVRjMbn!%PFm;`ym>UW1&*F(|=n6i?HH+>n`p#(LNWS?eS$78e zP&cd4%rn2zjZ!81OFs^|=KatA{shp*%!Da{i&f(ndaDvpv>&#(_Yi`94zF+5M| zA5$2ePPW_Q-)^@|D)`kdF)pEG9lp+8DP^lEd5BDwB2sa0k+_%0H?iwklbibK;fNdb zmmTzl5q}{svC}>C(_Ql=^1_xsgK_OSDK8?E+Dzmh2QGN$l~<0X~RyfoqnpY*}tajIT!H^*PbTd1gP7sqP~(j}ja3Q}rZo`t zpIwd1xr)YeK~yNLDPg9RB4_azS0v=JisRiijAilH+=S(z^Tc@Y@6=s_f8d{L{n!5i Dchrl4 diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/minecraft/SkinModel.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/minecraft/SkinModel.class deleted file mode 100644 index 03af13eee628574efb488bca419f6cf95daf093e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1798 zcmbtUZEw?76n<`;#Ex-FW7>4IuQq*Lwyulqi)$PHqeb z+ivtd-}YSw(+PXr@AAkKYq_aI!D*t9{N%;Nr|%{V_um0&ji*}22lz%Sm`$bQYur>p9hJ3rpBN4dtYDR)#G{Ds z_rl$M20QC(Dyo&S=Jgh}8G|ZWZtjRi`PRTUSZBDFO|a(kIBsOZ(m9I7RmiT6K}9C$RVj*p^vVUSQ%mOu3lK%f)ozPdZW#VRp9ihnVg>$INdOk;7Sf zPDr!@%7igX-?Q>WoYH)!7)!J-IH~r+xfhr_4ldFKqAG(7`K{udAWKBg{mz60~4OW`@5oONNLDfEj?JSs6 zN4W9~Mf1~xg(F-&PH#$+DrBfhg3pk!X$essMW>t#v@gJz1k=F&K}DsxDdE~1EkCAO z<_YoYUE91)h`++H%`YVM+sa1JqL#Cm!5sb0XVlGS)a8+zQ3&iSG*WrjDN6WWJ;cn` zUB!O2)fA;{D|0W=ydva{YB(wblX-<5C2IfI=G!S@-DLJlto;S{|8Y6ok~weVj(oTN E1Cs)eaR2}S diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/thread/PostAsync.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/thread/PostAsync.class deleted file mode 100644 index c8e3d83e854c68567764b15eb2faab20bda33cbd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1384 zcmbW1ZBNrs6vzK}Pc5Si7*C3d^1Mx;Dn7(OOvr@9WGFH+6W?{+#TB=fw6{Y)ir;}Z z=nIE0e5r{a%6RTw14tTT+_Lqy_nhDTpZ_`OuixLk19*bR8WIdoT`tVP3w@g(`HtXz zV748X+rG6g%#Q7~4=rJa!fBbJ>2s@L?s$RN2tK;Dh7`llfz`3hmgT-PU)2w|Ef}=w z=5Fmpd6QwGqIOlb?YVa7``i`g<_B(v!t<-#?>IJJW6;;_mg73&8AGyAtTCj@UV~@R zj{yw^!_<|Wz(5Xz3?nW-DqD7wH};g&9nWhq6bi+ElhFr;VFPJo7zQik!OO5+=l-5m zZ*hiv#j~we&GH?2A3e;hE7e&fF>YWKIw==TCtz5s{I{>-IeFR~=)hJl;7MW#Bz zM$74t5Hjd3!$4J7_WNz?FjAri%}_MFBUdI(8<>$v87Fv7E$hb|7BtK=%w6eY)DHu< zRUwDeXoiVG&pp-R-OzPq`D?|Rgq954#S)zpg!Q&V!K?AX@&0dxBJ@@F{Rqo28h02& z-@ZrlDJM^sci+Hu=yJ7cU=am|Y*h{LmLofrJDboIS#D~Y0+TfH6egQXE1kX?{Rm8V zi*%JAt&8jz44u$2fjs?Z)P{}`^+W=w!%>n+SDBVBeZ|=2l#EI-dI6ZgH45yLnxo{h z+5vK1OnyS@V*yif z0P1T5cunn)R_D))E1ja4z#HlNMaO2Sv{@=`9>Z8r&|VMnSjGy)UhvL5!%OcZo|-}4 iWxBXm>f*s=bdk^{s%wdwv3voY`x`CaArA?bz@tAaoCO&G diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/validation/ValidationHelper.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/util/validation/ValidationHelper.class deleted file mode 100644 index 4047cc8078c456eebacdf3d70b9227011ab74edc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 811 zcmb_a+invv5Is)PZo8yyvL#%~rBM2i0K$(IN`-`g3ZwuJsUo#JIa_z@;=Rc0P5TS| zh5iLkMIe=TJ_<43M5I8)6S8E_jK}B9obmS`U(Nw+VBJH7;bkH%&(p$$^2jJFP0nML z$k2#=%ST}vXTtKrD$Peit36>=n()Cd^R?8OG#+XUjYBaKT#F>)?}vvnv<$PGDpB?s zL$%!*Fw|b8d(uZ0^L5N%mSL$!RPTy-D9yGQYRM4v(opDuFv|IpV9g$=oMEf?KWgn# zSt{Q)1+jJ7yS-`EeQQ(_bw6APjT`B91|FIWYt!5}TFXf2=O!v*nb=pyq0F2#K9Di#=v!4!*wFxPfaXHoTu#zME~IaJIhA{H=Tql46RF0oYuZP&Wy}+s)>Q^GI%k0 zA}TeW_A%k5vS_@8B$byh>7QYtZ$6T6ND@=mabC5pJm0<{t}SUE-GD;hhG9)Ct~ zh8y1;QWXwqvCNpG%y~2k&mrC$zrrotCJzX32X{-B0IPIcp>o}O)}-JX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By= z(?D8+1~SYviK8vi8zqcXQcY^ApntT43blm&qb2MgEn)v?G5sSdL#rVjHZk#wLyhUi zwZD=oTNYJANYxNhHH1_RhDyowY6y<H`1&@z@;A`h zOcNVfjp3%TI>cwtx=WZ`-=v>Sb4};m^=*223vRDLlik=P$Jjl|6;1Pct|<3$1LJ=A z4+g`xLcqfMg!M9Q8JmBb7INc0W;wphrIXFGCCrZ|d0SsA;j5#`=IcxEZ|e6QZhf` zM)De)+v{wnZ?KoViRbVZFX`L3ig$I%1l{?D?nW|hyohh(JB*|st@v)(o!O8-$JH3e v|0uqv3+?;(0iV)eeo8NXhL7+|e9V;{jQ&^nHGV@|+5Ii&i{Eiw(qR1$L&Ody diff --git a/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/version/Versions.class b/vcompat-api/target/classes/net/sourcewriters/minecraft/vcompat/version/Versions.class deleted file mode 100644 index 44856611353f1c3426ca0eca7754d74cdf9e5a1b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5639 zcmb_g3tJS|8Gg_1;;_qLkOUP(#hSzg64$6THF!h7xCs}_QX&v)hIN2}Wp^{XOEhiT z*rZL@v%a3PhgAJu~O>z3+ED-}vGG z-n#+dVf;sdPhfvi&qgw-oEg`jF^#NlW+F32QjeS3cs4Q{PtBw?j+{19$;hBRW)uVj zYNoVVEt1fZ6Oq2LDLtMQ*w7R0?ds@nKQVA-u&X~7?duhIu$w|6ne)l4b}l`c(v!wH z=S@o+%O$r7Y%Y^=CN|I??R`|BwtEROmNkv!1oy9xb@dZ$39zkuH7dn)liE3oQCwZA zxFYttLq^ib9ue?|n+F8~9jUW=2!7P4P*E*#S2wNJo0}Qa%>ivJp-Z-@xRw~yOhdjq zlY#7{kr6nsDvkxSlb$-EXL}0%5r~AFS7qKHXkZl;Sf`*tVDCy?)2WYZxkT0>5kfs` zIfAMwuP_*I~9C_F_bbVB4fGfX(JmsZVf8##eD)H z0y!iE?jcTDFjQiffM^P#8LbLhN??eR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gmUfq?(W9BS(;w(dT>rSXc?^+mtf zS{HchqyM^;Zm>>vFxoq@8C}@Q@3HNC4)cRUrk_ozg=m-greG(&XBlEMpTA$ER0sb@ z%uxO(!w;Cyf&)-xyIWf6`33x(!<+VSg~K9# z9biLNi0}~40vgYaS(NN3Z^Ap6=X?N-M3J5NyL_|ju3Y;)-z5GYiuid8Kh9{C^6EYC z7jeyB1}qEqgbTQy!r!-m>&k%T+8-_8S8$^U{3i>zoA0t@);IxgDf(xh3(rpFX$#9% zq=xeT!81#$$(auASci;0~pZAtO|9SQcfE)NuK?lP%OL)3# z*PMdbb_`EAu3j-LQE>Q%r`HR1rOG`$Ph`WkGX9r>PKKMWEVks>b)zU82BlzIo@1K~ zx3kAlQw=4XZusJ9hVEO2Wq4Bzkwh}j(3!D|LPZ3<8WcoTF!X6Sffz%tWXv4cy^~13 zmgOGOJfNWq-6{rgQo#^?Z}K|VO>UL+2Q|wxDni3BPBEw@;e`~2lVtfh#&knd%+(%Bq1BRL7cyR!OZc@F~s(P7QMN{a0F0(#K!!kZ+ z=&&gXYcB-k|FJ{(-N!=>Utopil^jY(t0v64f-f1;uVl0xI|W}coNpHHoN0;@H*+5M z#J$G_QT1q|NAWc=WwZW>R-XuBpAYoHn1ZTq7~Hepk1=q(LeQe4=Y=hd(& z<TW#46AN$2|ddz z>qSnCe1jJ}+u6}zqC!Ky(j+nb)tbgoGEhG2r{BF8q(0pePEcK~ls3WTovQe6mx0Nb z%eFRpXg0%5Ge=uF9qUH9U#_%Oe5=7hl$yZ}hiI$|Rk~x)<}6D%epL%s!8XIC=dgPb z0t$8*&b^$K@*lv3tF-(gv{|SS@&qW(OwDmpN z?jTxbANoq1HE?YYH+FG5{!s(ddzhg!{uvz&% + 4.0.0 + + net.sourcewriters.minecraft + vcompat-parent + 3.0.0 + + vcompat-legacy + + + ${project.basedir}/../libraries/spigot + + + + + + bukkit + spigot-1.16.4 + 0.1 + system + ${spigot.libPath}/spigot-1.16.4.jar + + + bukkit + spigot-1.16.3 + 0.1 + system + ${spigot.libPath}/spigot-1.16.3.jar + + + bukkit + spigot-1.16.1 + 0.1 + system + ${spigot.libPath}/spigot-1.16.1.jar + + + bukkit + spigot-1.15.2 + 0.1 + system + ${spigot.libPath}/spigot-1.15.2.jar + + + bukkit + spigot-1.14.2 + 0.1 + system + ${spigot.libPath}/spigot-1.14.2.jar + + + bukkit + spigot-1.13.2 + 0.1 + system + ${spigot.libPath}/spigot-1.13.2.jar + + + bukkit + spigot-1.13 + 0.1 + system + ${spigot.libPath}/spigot-1.13.jar + + + bukkit + spigot-1.12.2 + 0.1 + system + ${spigot.libPath}/spigot-1.12.2.jar + + + bukkit + spigot-1.11 + 0.1 + system + ${spigot.libPath}/spigot-1.11.jar + + + bukkit + spigot-1.10.2 + 0.1 + system + ${spigot.libPath}/spigot-1.10.2.jar + + + bukkit + spigot-1.9.4 + 0.1 + system + ${spigot.libPath}/spigot-1.9.4.jar + + + bukkit + spigot-1.9 + 0.1 + system + ${spigot.libPath}/spigot-1.9.jar + + + bukkit + spigot-1.8.8 + 0.1 + system + ${spigot.libPath}/spigot-1.8.8.jar + + + bukkit + spigot-1.8.3 + 0.1 + system + ${spigot.libPath}/spigot-1.8.3.jar + + + bukkit + spigot-1.8 + 0.1 + system + ${spigot.libPath}/spigot-1.8.jar + + + + + + + ${project.parent.groupId} + vcompat-api + ${project.parent.version} + >provided + + + + + bukkit + spigot-1.16.4 + + + bukkit + spigot-1.16.3 + + + bukkit + spigot-1.16.1 + + + bukkit + spigot-1.15.2 + + + bukkit + spigot-1.14.2 + + + bukkit + spigot-1.13.2 + + + bukkit + spigot-1.13 + + + bukkit + spigot-1.12.2 + + + bukkit + spigot-1.11 + + + bukkit + spigot-1.10.2 + + + bukkit + spigot-1.9.4 + + + bukkit + spigot-1.9 + + + bukkit + spigot-1.8.8 + + + bukkit + spigot-1.8.3 + + + bukkit + spigot-1.8 + + + \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/BukkitConversion1_10_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/BukkitConversion1_10_R1.java new file mode 100644 index 0000000..c5574c5 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/BukkitConversion1_10_R1.java @@ -0,0 +1,231 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_10_R1; + +import java.util.List; +import java.util.Set; + +import org.bukkit.craftbukkit.v1_10_R1.inventory.CraftItemStack; +import org.bukkit.entity.EntityType; + +import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; +import com.syntaxphoenix.syntaxapi.data.DataType; +import com.syntaxphoenix.syntaxapi.nbt.NbtByte; +import com.syntaxphoenix.syntaxapi.nbt.NbtByteArray; +import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; +import com.syntaxphoenix.syntaxapi.nbt.NbtDouble; +import com.syntaxphoenix.syntaxapi.nbt.NbtEnd; +import com.syntaxphoenix.syntaxapi.nbt.NbtFloat; +import com.syntaxphoenix.syntaxapi.nbt.NbtInt; +import com.syntaxphoenix.syntaxapi.nbt.NbtIntArray; +import com.syntaxphoenix.syntaxapi.nbt.NbtList; +import com.syntaxphoenix.syntaxapi.nbt.NbtLong; +import com.syntaxphoenix.syntaxapi.nbt.NbtLongArray; +import com.syntaxphoenix.syntaxapi.nbt.NbtShort; +import com.syntaxphoenix.syntaxapi.nbt.NbtString; +import com.syntaxphoenix.syntaxapi.nbt.NbtTag; +import com.syntaxphoenix.syntaxapi.nbt.NbtType; + +import net.minecraft.server.v1_10_R1.ItemStack; +import net.minecraft.server.v1_10_R1.NBTBase; +import net.minecraft.server.v1_10_R1.NBTTagByte; +import net.minecraft.server.v1_10_R1.NBTTagByteArray; +import net.minecraft.server.v1_10_R1.NBTTagCompound; +import net.minecraft.server.v1_10_R1.NBTTagDouble; +import net.minecraft.server.v1_10_R1.NBTTagEnd; +import net.minecraft.server.v1_10_R1.NBTTagFloat; +import net.minecraft.server.v1_10_R1.NBTTagInt; +import net.minecraft.server.v1_10_R1.NBTTagIntArray; +import net.minecraft.server.v1_10_R1.NBTTagList; +import net.minecraft.server.v1_10_R1.NBTTagLong; +import net.minecraft.server.v1_10_R1.NBTTagShort; +import net.minecraft.server.v1_10_R1.NBTTagString; +import net.sourcewriters.minecraft.vcompat.reflection.BukkitConversion; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContext; +import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleWrapType; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; +import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; + +public class BukkitConversion1_10_R1 extends BukkitConversion { + + protected BukkitConversion1_10_R1(VersionControl1_10_R1 versionControl) { + super(versionControl); + } + + @Override + public EntityType toEntityType(NmsEntityType type) { + try { + return EntityType.valueOf(type.name()); + } catch (IllegalArgumentException ignore) { + return null; + } + } + + @Override + public NmsEntityType fromEntityType(EntityType type) { + try { + return NmsEntityType.valueOf(type.name()); + } catch (IllegalArgumentException ignore) { + return null; + } + } + + @Override + public NBTBase toMinecraftTag(NbtTag tag) { + switch (tag.getType()) { + case BYTE: + return new NBTTagByte((byte) tag.getValue()); + case SHORT: + return new NBTTagShort((short) tag.getValue()); + case INT: + return new NBTTagInt((int) tag.getValue()); + case LONG: + return new NBTTagLong((long) tag.getValue()); + case FLOAT: + return new NBTTagFloat((float) tag.getValue()); + case DOUBLE: + return new NBTTagDouble((double) tag.getValue()); + case STRING: + return new NBTTagString((String) tag.getValue()); + case BYTE_ARRAY: + return new NBTTagByteArray((byte[]) tag.getValue()); + case INT_ARRAY: + return new NBTTagIntArray((int[]) tag.getValue()); + case LONG_ARRAY: + NBTTagList list = new NBTTagList(); + for (long value : (long[]) tag.getValue()) { + list.add(new NBTTagLong(value)); + } + return list; + case LIST: + return toMinecraftList((NbtList) tag); + case COMPOUND: + return toMinecraftCompound((NbtCompound) tag); + case END: + return (NBTTagEnd) ReflectionProvider.DEFAULT.getReflect("nmsNBTTagEnd").init(); + default: + return null; + } + } + + @Override + public NbtTag fromMinecraftTag(Object raw) { + if (!(raw instanceof NBTBase)) { + return null; + } + NBTBase tag = (NBTBase) raw; + NbtType type = NbtType.getById(tag.getTypeId()); + switch (type) { + case BYTE: + return new NbtByte(((NBTTagByte) tag).g()); + case SHORT: + return new NbtShort(((NBTTagShort) tag).f()); + case INT: + return new NbtInt(((NBTTagInt) tag).e()); + case LONG: + return new NbtLong(((NBTTagLong) tag).d()); + case FLOAT: + return new NbtFloat(((NBTTagFloat) tag).i()); + case DOUBLE: + return new NbtDouble(((NBTTagDouble) tag).h()); + case STRING: + return new NbtString(((NBTTagString) tag).c_()); + case BYTE_ARRAY: + return new NbtByteArray(((NBTTagByteArray) tag).c()); + case INT_ARRAY: + return new NbtIntArray(((NBTTagIntArray) tag).d()); + case LONG_ARRAY: + return new NbtLongArray(new long[0]); + case LIST: + return fromMinecraftList(tag); + case COMPOUND: + return fromMinecraftCompound(tag); + case END: + return NbtEnd.INSTANCE; + default: + return null; + } + } + + @Override + public NBTTagList toMinecraftList(NbtList list) { + NBTTagList output = new NBTTagList(); + for (NbtTag tag : list) { + output.add(toMinecraftTag(tag)); + } + return output; + } + + @SuppressWarnings("unchecked") + @Override + public NbtList fromMinecraftList(Object raw) { + if (!(raw instanceof NBTTagList)) { + return null; + } + NBTTagList list = (NBTTagList) raw; + List content = (List) ReflectionProvider.DEFAULT.getReflect("nmsNBTTagList").getFieldValue("value", list); + NbtList output = new NbtList<>(NbtType.getById(list.getTypeId())); + for (NBTBase base : content) { + output.add(fromMinecraftTag(base)); + } + return output; + } + + @Override + public NBTTagCompound toMinecraftCompound(NbtCompound compound) { + NBTTagCompound output = new NBTTagCompound(); + if (compound.isEmpty()) { + return output; + } + Set keys = compound.getKeys(); + for (String key : keys) { + output.set(key, toMinecraftTag(compound.get(key))); + } + return output; + } + + @Override + public NbtCompound fromMinecraftCompound(Object raw) { + if (!(raw instanceof NBTTagCompound)) { + return null; + } + NBTTagCompound compound = (NBTTagCompound) raw; + NbtCompound output = new NbtCompound(); + if (compound.isEmpty()) { + return output; + } + Set keys = compound.c(); + for (String key : keys) { + output.set(key, fromMinecraftTag(compound.get(key))); + } + return output; + } + + @Override + public org.bukkit.inventory.ItemStack itemFromCompound(NbtCompound compound) { + return CraftItemStack.asBukkitCopy(ItemStack.createStack(toMinecraftCompound(compound))); + } + + @Override + public NbtCompound itemToCompound(org.bukkit.inventory.ItemStack itemStack) { + ItemStack nmsStack = CraftItemStack.asNMSCopy(itemStack); + NBTTagCompound stackTag; + if (!nmsStack.hasTag()) { + stackTag = nmsStack.save(new NBTTagCompound()); + } else { + stackTag = nmsStack.getTag(); + } + return fromMinecraftCompound(stackTag); + } + + @Override + public WrappedContext createContext(DataAdapterContext context) { + return new SimpleSyntaxContext(context); + } + + @Override + public WrapType wrap(DataType dataType) { + return new SimpleWrapType(dataType); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/EntityProvider1_10_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/EntityProvider1_10_R1.java new file mode 100644 index 0000000..8491a4c --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/EntityProvider1_10_R1.java @@ -0,0 +1,47 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_10_R1; + +import java.util.EnumMap; +import java.util.function.Function; + +import org.bukkit.craftbukkit.v1_10_R1.CraftWorld; + +import net.minecraft.server.v1_10_R1.World; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_10_R1.utils.EntityConstructors1_10_R1; +import net.sourcewriters.minecraft.vcompat.reflection.EntityProvider; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; + +public class EntityProvider1_10_R1 extends EntityProvider { + + private final EnumMap> entityMap = new EnumMap<>(NmsEntityType.class); + + protected EntityProvider1_10_R1(VersionControl1_10_R1 versionControl) { + super(versionControl); + } + + @SuppressWarnings("unchecked") + private final Function searchConstructor(NmsEntityType type) { + try { + return (Function) EntityConstructors1_10_R1.class.getField(type.name()).get(null); + } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException ignore) { + return null; + } + } + + private final Function getConstructor(NmsEntityType type) { + return entityMap.computeIfAbsent(type, (key -> searchConstructor(key))); + } + + @Override + public NmsEntity createEntity(org.bukkit.World world, NmsEntityType type) { + if (!(world instanceof CraftWorld)) { + return null; + } + Function function; + if ((function = getConstructor(type)) == null) { + return null; + } + return function.apply(((CraftWorld) world).getHandle()); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/PacketHandler1_10_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/PacketHandler1_10_R1.java new file mode 100644 index 0000000..ebdca14 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/PacketHandler1_10_R1.java @@ -0,0 +1,11 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_10_R1; + +import net.sourcewriters.minecraft.vcompat.reflection.PacketHandler; + +public class PacketHandler1_10_R1 extends PacketHandler { + + protected PacketHandler1_10_R1(VersionControl1_10_R1 versionControl) { + super(versionControl); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/PlayerProvider1_10_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/PlayerProvider1_10_R1.java new file mode 100644 index 0000000..6739485 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/PlayerProvider1_10_R1.java @@ -0,0 +1,30 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_10_R1; + +import java.io.File; +import java.util.UUID; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_10_R1.entity.Player1_10_R1; +import net.sourcewriters.minecraft.vcompat.reflection.DataProvider; +import net.sourcewriters.minecraft.vcompat.reflection.PlayerProvider; +import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.DataDistributor; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; + +public class PlayerProvider1_10_R1 extends PlayerProvider { + + private final DataDistributor distributor; + + protected PlayerProvider1_10_R1(VersionControl1_10_R1 versionControl) { + super(versionControl); + distributor = versionControl.getDataProvider().createDistributor(new File(Bukkit.getWorlds().get(0).getWorldFolder(), "playerdata"), + uuid -> "custom_" + uuid.toString(), DataProvider.DEFAULT_RANDOM); + } + + @Override + protected NmsPlayer createPlayer(Player player) { + return new Player1_10_R1(player, distributor.get(player.getUniqueId())); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/TextureProvider1_10_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/TextureProvider1_10_R1.java new file mode 100644 index 0000000..af5df2b --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/TextureProvider1_10_R1.java @@ -0,0 +1,105 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_10_R1; + +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_10_R1.block.CraftSkull; +import org.bukkit.craftbukkit.v1_10_R1.inventory.CraftItemStack; +import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.inventory.meta.SkullMeta; +import org.bukkit.material.MaterialData; + +import com.mojang.authlib.GameProfile; +import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; +import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.minecraft.server.v1_10_R1.GameProfileSerializer; +import net.minecraft.server.v1_10_R1.ItemStack; +import net.minecraft.server.v1_10_R1.NBTTagCompound; +import net.sourcewriters.minecraft.vcompat.reflection.TextureProvider; + +@SuppressWarnings("deprecation") +public class TextureProvider1_10_R1 extends TextureProvider { + + private final AbstractReflect craftItemStackRef = new Reflect(CraftItemStack.class).searchField("handle", "handle"); + private final AbstractReflect craftMetaSkullRef = new Reflect("org.bukkit.craftbukkit.v1_10_R1.inventory.CraftMetaSkull") + .searchField("serialized", "serializedProfile").searchField("profile", "profile"); + private final Material skullMaterial = Material.valueOf("SKULL"); + + protected TextureProvider1_10_R1(VersionControl1_10_R1 versionControl) { + super(versionControl); + } + + @Override + public GameProfile profileFromBlock(Block block) { + if (!(block instanceof CraftSkull)) { + return null; + } + return ((CraftSkull) block).getTileEntity().getGameProfile(); + } + + @Override + public GameProfile profileFromItem(org.bukkit.inventory.ItemStack itemStack) { + if (!(itemStack.getItemMeta() instanceof SkullMeta)) { + return null; + } + SkullMeta meta = (SkullMeta) itemStack.getItemMeta(); + GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue("profile", meta); + if (profile == null) { + NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue("serialized", meta); + if (compound == null) { + ItemStack stack = null; + if (itemStack instanceof CraftItemStack) { + stack = (ItemStack) craftItemStackRef.getFieldValue("handle", itemStack); + } + if (stack == null) { + stack = CraftItemStack.asNMSCopy(itemStack); + } + NBTTagCompound stackTag; + if (!stack.hasTag()) { + stackTag = stack.save(new NBTTagCompound()); + } else { + stackTag = stack.getTag(); + } + if (stackTag.hasKeyOfType("SkullOwner", 10)) { + compound = stackTag.getCompound("SkullOwner"); + } else if (stackTag.hasKeyOfType("SkullProfile", 10)) { + compound = stackTag.getCompound("SkullProfile"); + } + } + if (compound == null) { + return null; + } + profile = GameProfileSerializer.deserialize(compound); + } + return profile; + } + + @Override + public org.bukkit.inventory.ItemStack getItem(GameProfile profile) { + org.bukkit.inventory.ItemStack craftStack = CraftItemStack.asCraftCopy(new MaterialData(skullMaterial, (byte) 3).toItemStack(1)); + applyItem(craftStack, profile); + return craftStack; + } + + @Override + public boolean applyItem(org.bukkit.inventory.ItemStack itemStack, GameProfile profile) { + ItemMeta meta = itemStack.getItemMeta(); + if (!(meta instanceof SkullMeta)) { + return false; + } + SkullMeta skullMeta = (SkullMeta) meta; + craftMetaSkullRef.setFieldValue(meta, "profile", profile); + itemStack.setItemMeta(skullMeta); + return true; + } + + @Override + public boolean applyBlock(Block block, GameProfile profile) { + if (!(block instanceof CraftSkull)) { + return false; + } + ((CraftSkull) block).getTileEntity().setGameProfile(profile); + return true; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/ToolProvider1_10_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/ToolProvider1_10_R1.java new file mode 100644 index 0000000..333c05f --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/ToolProvider1_10_R1.java @@ -0,0 +1,33 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_10_R1; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_10_R1.tools.BlockTools1_10_R1; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_10_R1.tools.ServerTools1_10_R1; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_10_R1.tools.SkinTools1_10_R1; +import net.sourcewriters.minecraft.vcompat.reflection.ToolProvider; + +public class ToolProvider1_10_R1 extends ToolProvider { + + private final BlockTools1_10_R1 blockTools = new BlockTools1_10_R1(); + private final SkinTools1_10_R1 skinTools = new SkinTools1_10_R1(); + private final ServerTools1_10_R1 serverTools = new ServerTools1_10_R1(); + + protected ToolProvider1_10_R1(VersionControl1_10_R1 versionControl) { + super(versionControl); + } + + @Override + public SkinTools1_10_R1 getSkinTools() { + return skinTools; + } + + @Override + public ServerTools1_10_R1 getServerTools() { + return serverTools; + } + + @Override + public BlockTools1_10_R1 getBlockTools() { + return blockTools; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/VersionControl1_10_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/VersionControl1_10_R1.java new file mode 100644 index 0000000..9393fc1 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/VersionControl1_10_R1.java @@ -0,0 +1,56 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_10_R1; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_10_R1.reflection.NmsReflection1_10_R1; +import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; +import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; + +public class VersionControl1_10_R1 extends VersionControl { + + public static VersionControl1_10_R1 INSTANCE; + + public static VersionControl1_10_R1 init() { + return INSTANCE != null ? INSTANCE : (INSTANCE = new VersionControl1_10_R1()); + } + + private final ToolProvider1_10_R1 toolProvider = new ToolProvider1_10_R1(this); + private final TextureProvider1_10_R1 textureProvider = new TextureProvider1_10_R1(this); + private final PacketHandler1_10_R1 packetHandler = new PacketHandler1_10_R1(this); + private final EntityProvider1_10_R1 entityProvider = new EntityProvider1_10_R1(this); + private final PlayerProvider1_10_R1 playerProvider = new PlayerProvider1_10_R1(this); + private final BukkitConversion1_10_R1 bukkitConversion = new BukkitConversion1_10_R1(this); + + private VersionControl1_10_R1() { + NmsReflection1_10_R1.INSTANCE.setup(ReflectionProvider.DEFAULT); + } + + @Override + public ToolProvider1_10_R1 getToolProvider() { + return toolProvider; + } + + @Override + public EntityProvider1_10_R1 getEntityProvider() { + return entityProvider; + } + + @Override + public PlayerProvider1_10_R1 getPlayerProvider() { + return playerProvider; + } + + @Override + public TextureProvider1_10_R1 getTextureProvider() { + return textureProvider; + } + + @Override + public PacketHandler1_10_R1 getPacketHandler() { + return packetHandler; + } + + @Override + public BukkitConversion1_10_R1 getBukkitConversion() { + return bukkitConversion; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/entity/ArmorStand1_10_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/entity/ArmorStand1_10_R1.java new file mode 100644 index 0000000..f514928 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/entity/ArmorStand1_10_R1.java @@ -0,0 +1,23 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_10_R1.entity; + +import net.minecraft.server.v1_10_R1.EntityArmorStand; +import net.minecraft.server.v1_10_R1.World; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsArmorStand; + +public class ArmorStand1_10_R1 extends EntityLiving1_10_R1 implements NmsArmorStand { + + public ArmorStand1_10_R1(World world) { + super(new EntityArmorStand(world)); + } + + @Override + public void setSmall(boolean small) { + handle.setSmall(small); + } + + @Override + public boolean isSmall() { + return handle.isSmall(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/entity/Entity1_10_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/entity/Entity1_10_R1.java new file mode 100644 index 0000000..caef2d2 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/entity/Entity1_10_R1.java @@ -0,0 +1,215 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_10_R1.entity; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.UUID; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.OfflinePlayer; +import org.bukkit.craftbukkit.v1_10_R1.CraftWorld; +import org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer; +import org.bukkit.entity.Player; + +import net.minecraft.server.v1_10_R1.AxisAlignedBB; +import net.minecraft.server.v1_10_R1.Entity; +import net.minecraft.server.v1_10_R1.EntityTypes; +import net.minecraft.server.v1_10_R1.PacketPlayOutEntityDestroy; +import net.minecraft.server.v1_10_R1.PacketPlayOutEntityMetadata; +import net.minecraft.server.v1_10_R1.PacketPlayOutSpawnEntity; +import net.minecraft.server.v1_10_R1.PlayerConnection; +import net.minecraft.server.v1_10_R1.Vec3D; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.reflection.utils.NmsBoundingBox; + +public abstract class Entity1_10_R1 implements NmsEntity { + + protected final E handle; + + protected final List visible = Collections.synchronizedList(new ArrayList<>()); + + public Entity1_10_R1(E handle) { + this.handle = handle; + } + + @Override + public final E getHandle() { + return handle; + } + + @Override + public int getId() { + return handle.getId(); + } + + @Override + public UUID getUniqueId() { + return handle.getUniqueID(); + } + + @Override + public NmsBoundingBox getBoundingBox() { + AxisAlignedBB box = handle.getBoundingBox(); + return new NmsBoundingBox(box.a, box.b, box.c, box.d, box.e, box.f); + } + + @Override + public void setCustomName(String name) { + handle.setCustomName(name); + updateVisibility(); + } + + @Override + public String getCustomName() { + return handle.getCustomName(); + } + + @Override + public void setGravity(boolean gravity) { + handle.setNoGravity(!gravity); + } + + @Override + public boolean hasGravity() { + return !handle.isNoGravity(); + } + + @Override + public void setCustomNameVisible(boolean visible) { + handle.setCustomNameVisible(visible); + } + + @Override + public boolean isCustomNameVisible() { + return handle.getCustomNameVisible(); + } + + @Override + public void setInvisible(boolean invisible) { + handle.setInvisible(invisible); + } + + @Override + public boolean isInvisible() { + return handle.isInvisible(); + } + + @Override + public boolean isInteractable() { + return handle.isInteractable(); + } + + @Override + public boolean isCollidable() { + return handle.isCollidable(); + } + + @Override + public void setInvulnerable(boolean invulnerable) { + handle.setInvulnerable(invulnerable); + } + + @Override + public boolean isInvulnerable() { + return handle.isInvulnerable(null); + } + + @Override + public void setLocation(Location location) { + handle.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); + if (location.getWorld() == null || handle.getWorld().getWorld() == location.getWorld()) { + updateVisibility(); + return; + } + handle.world = ((CraftWorld) location.getWorld()).getHandle(); + updateVisibility(); + } + + @Override + public Location getLocation() { + Vec3D vector = handle.d(); + return new Location(handle.getWorld().getWorld(), vector.x, vector.y, vector.z); + } + + @Override + public void updateVisibility() { + if (visible.isEmpty()) { + return; + } + Player[] players; + synchronized (visible) { + players = visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) + .toArray(Player[]::new); + } + hide(players); + show(players); + } + + @Override + public boolean isShown(Player player) { + synchronized (visible) { + return visible.contains(player.getUniqueId()); + } + } + + @Override + public void hide(Player... players) { + if (players.length == 0) { + return; + } + PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(handle.getId()); + for (Player player : players) { + if (!isShown(player)) { + continue; + } + ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); + synchronized (visible) { + visible.remove(player.getUniqueId()); + } + } + } + + @Override + public void show(Player... players) { + if (players.length == 0) { + return; + } + PacketPlayOutSpawnEntity packet = new PacketPlayOutSpawnEntity(handle, EntityTypes.a(handle)); + PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); + PlayerConnection connection; + for (Player player : players) { + if (isShown(player)) { + continue; + } + connection = ((CraftPlayer) player).getHandle().playerConnection; + connection.sendPacket(packet); + connection.sendPacket(metadataPacket); + synchronized (visible) { + visible.add(player.getUniqueId()); + } + } + } + + @Override + public UUID[] getVisible() { + synchronized (visible) { + return visible.toArray(new UUID[0]); + } + } + + @Override + public Player[] getVisibleAsPlayer() { + synchronized (visible) { + return visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) + .toArray(Player[]::new); + } + } + + @Override + public void kill() { + hide(getVisibleAsPlayer()); + handle.die(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/entity/EntityLiving1_10_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/entity/EntityLiving1_10_R1.java new file mode 100644 index 0000000..a214f9c --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/entity/EntityLiving1_10_R1.java @@ -0,0 +1,17 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_10_R1.entity; + +import net.minecraft.server.v1_10_R1.EntityLiving; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityLiving; + +public abstract class EntityLiving1_10_R1 extends Entity1_10_R1 implements NmsEntityLiving { + + public EntityLiving1_10_R1(E handle) { + super(handle); + } + + @Override + public void setCollidable(boolean collidable) { + handle.collides = collidable; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/entity/Player1_10_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/entity/Player1_10_R1.java new file mode 100644 index 0000000..f9d9e47 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/entity/Player1_10_R1.java @@ -0,0 +1,296 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_10_R1.entity; + +import java.util.ArrayList; +import java.util.Collections; + +import org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_10_R1.util.CraftChatMessage; +import org.bukkit.entity.Player; + +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.properties.Property; +import com.mojang.authlib.properties.PropertyMap; +import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.minecraft.server.v1_10_R1.EntityPlayer; +import net.minecraft.server.v1_10_R1.EnumItemSlot; +import net.minecraft.server.v1_10_R1.IChatBaseComponent; +import net.minecraft.server.v1_10_R1.MathHelper; +import net.minecraft.server.v1_10_R1.PacketPlayInClientCommand; +import net.minecraft.server.v1_10_R1.PacketPlayInClientCommand.EnumClientCommand; +import net.minecraft.server.v1_10_R1.PacketPlayOutChat; +import net.minecraft.server.v1_10_R1.PacketPlayOutEntityDestroy; +import net.minecraft.server.v1_10_R1.PacketPlayOutEntityEquipment; +import net.minecraft.server.v1_10_R1.PacketPlayOutEntityHeadRotation; +import net.minecraft.server.v1_10_R1.PacketPlayOutEntityMetadata; +import net.minecraft.server.v1_10_R1.PacketPlayOutEntityStatus; +import net.minecraft.server.v1_10_R1.PacketPlayOutHeldItemSlot; +import net.minecraft.server.v1_10_R1.PacketPlayOutNamedEntitySpawn; +import net.minecraft.server.v1_10_R1.PacketPlayOutPlayerInfo; +import net.minecraft.server.v1_10_R1.PacketPlayOutPlayerInfo.EnumPlayerInfoAction; +import net.minecraft.server.v1_10_R1.PacketPlayOutPlayerListHeaderFooter; +import net.minecraft.server.v1_10_R1.PacketPlayOutPosition; +import net.minecraft.server.v1_10_R1.PacketPlayOutRespawn; +import net.minecraft.server.v1_10_R1.PacketPlayOutTitle; +import net.minecraft.server.v1_10_R1.PacketPlayOutTitle.EnumTitleAction; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.PersistentContainer; +import net.sourcewriters.minecraft.vcompat.reflection.data.type.SkinDataType; +import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContainer; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; +import net.sourcewriters.minecraft.vcompat.utils.bukkit.Players; +import net.sourcewriters.minecraft.vcompat.utils.minecraft.MojangProfileServer; +import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; +import net.sourcewriters.minecraft.vcompat.utils.thread.PostAsync; +import net.minecraft.server.v1_10_R1.PlayerConnection; +import net.minecraft.server.v1_10_R1.WorldServer; + +public class Player1_10_R1 extends EntityLiving1_10_R1 implements NmsPlayer { + + private String realName; + private Skin realSkin; + + private final WrappedContainer dataAdapter; + + public Player1_10_R1(Player player, PersistentContainer container) { + super(((CraftPlayer) player).getHandle()); + this.dataAdapter = new SimpleSyntaxContainer<>(container); + update(false); + } + + @Override + public CraftPlayer getBukkitPlayer() { + return handle.getBukkitEntity(); + } + + @Override + public WrappedContainer getDataAdapter() { + return dataAdapter; + } + + @Override + public void setSkin(Skin skin) { + if (skin == null || getSkin().equals(skin)) { + return; + } + getDataAdapter().set("skin", skin, SkinDataType.WRAPPED_INSTANCE); + } + + @Override + public Skin getSkin() { + return dataAdapter.getOrDefault("skin", SkinDataType.WRAPPED_INSTANCE, realSkin); + } + + @Override + public Skin getRealSkin() { + return realSkin; + } + + @Override + public void setName(String name) { + if (getName().equals(name)) { + return; + } + if (name == null) { + getDataAdapter().remove("name"); + return; + } + getDataAdapter().set("name", name, WrapType.STRING); + } + + @Override + public String getName() { + return getDataAdapter().getOrDefault("name", WrapType.STRING, realName); + } + + @Override + public String getRealName() { + return realName; + } + + @Override + public void setPlayerListHeader(String text) { + setPlayerListHeaderAndFooter(text, getPlayerListFooter()); + } + + @Override + public String getPlayerListHeader() { + return getDataAdapter().getOrDefault("header", WrapType.STRING, ""); + } + + @Override + public void setPlayerListFooter(String text) { + setPlayerListHeaderAndFooter(getPlayerListHeader(), text); + } + + @Override + public String getPlayerListFooter() { + return getDataAdapter().getOrDefault("footer", WrapType.STRING, ""); + } + + @Override + public int getPing() { + return handle.ping; + } + + @Override + public void setPlayerListHeaderAndFooter(String header, String footer) { + getDataAdapter().set("header", header, WrapType.STRING); + getDataAdapter().set("footer", footer, WrapType.STRING); + sendPlayerListInfo(header, footer); + } + + private final void sendPlayerListInfo(String header, String footer) { + if (handle.playerConnection.isDisconnected()) { + return; + } + + IChatBaseComponent headerComponent = header.isEmpty() ? null : CraftChatMessage.fromString(header, true)[0]; + IChatBaseComponent footerComponent = footer.isEmpty() ? null : CraftChatMessage.fromString(footer, true)[0]; + + PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter(); + + Reflect reflect = ReflectionProvider.DEFAULT.getReflect("nmsPacketPlayOutPlayerListHeaderFooter"); + reflect.setFieldValue(packet, "header", headerComponent); + reflect.setFieldValue(packet, "footer", footerComponent); + + handle.playerConnection.sendPacket(packet); + } + + @Override + public void setTitleTimes(int fadeIn, int stay, int fadeOut) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TIMES, null, fadeIn, stay, fadeOut)); + } + + @Override + public void sendSubtitle(String text) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.SUBTITLE, CraftChatMessage.fromString(text)[0])); + } + + @Override + public void sendTitle(String text) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TITLE, CraftChatMessage.fromString(text)[0])); + } + + @Override + public void sendActionBar(String text) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutChat(CraftChatMessage.fromString(text)[0], (byte) 2)); + } + + @Override + public void fakeRespawn() { + if (handle.playerConnection.isDisconnected()) { + return; + } + PacketPlayOutPlayerInfo remInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER, handle); + PacketPlayOutPlayerInfo addInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.ADD_PLAYER, handle); + + PacketPlayOutEntityDestroy destroyPacket = new PacketPlayOutEntityDestroy(handle.getId()); + PacketPlayOutNamedEntitySpawn spawnPacket = new PacketPlayOutNamedEntitySpawn(handle); + PacketPlayOutEntityHeadRotation rotationPacket = new PacketPlayOutEntityHeadRotation(handle, + (byte) MathHelper.d(handle.getHeadRotation() * 256F / 360F)); + + ArrayList equipmentPackets = new ArrayList<>(); + for (EnumItemSlot slot : EnumItemSlot.values()) { + equipmentPackets.add(new PacketPlayOutEntityEquipment(handle.getId(), slot, handle.getEquipment(slot))); + } + + Player self = getBukkitPlayer(); + Player[] players = Players.getOnlineWithout(getUniqueId()); + for (Player player : players) { + if (!player.canSee(self)) { + continue; + } + PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection; + connection.sendPacket(remInfoPacket); + connection.sendPacket(addInfoPacket); + connection.sendPacket(destroyPacket); + connection.sendPacket(spawnPacket); + connection.sendPacket(rotationPacket); + for (PacketPlayOutEntityEquipment equipmentPacket : equipmentPackets) { + connection.sendPacket(equipmentPacket); + } + } + + WorldServer world = (WorldServer) handle.world; + + PacketPlayOutRespawn respawnPacket = new PacketPlayOutRespawn(handle.dimension, world.getDifficulty(), + handle.world.worldData.getType(), handle.playerInteractManager.getGameMode()); + PacketPlayOutPosition positionPacket = new PacketPlayOutPosition(handle.locX, handle.locY, handle.locZ, handle.yaw, handle.pitch, + Collections.emptySet(), 0); + PacketPlayOutHeldItemSlot itemPacket = new PacketPlayOutHeldItemSlot(handle.inventory.itemInHandIndex); + PacketPlayOutEntityStatus statusPacket = new PacketPlayOutEntityStatus(handle, (byte) 28); + PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); + + PlayerConnection connection = handle.playerConnection; + connection.sendPacket(remInfoPacket); + connection.sendPacket(addInfoPacket); + connection.sendPacket(respawnPacket); + connection.sendPacket(positionPacket); + connection.sendPacket(itemPacket); + connection.sendPacket(statusPacket); + connection.sendPacket(metadataPacket); + + handle.updateAbilities(); + handle.triggerHealthUpdate(); + handle.updateInventory(handle.defaultContainer); + if (handle.activeContainer != handle.defaultContainer) { + handle.updateInventory(handle.activeContainer); + } + self.recalculatePermissions(); + } + + @Override + public void respawn() { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayInClientCommand(EnumClientCommand.PERFORM_RESPAWN)); + } + + @Override + public void update() { + update(true); + } + + private final void update(boolean flag) { + PostAsync.forcePost(() -> { + realName = MojangProfileServer.getName(getUniqueId()); + realSkin = MojangProfileServer.getSkin(realName, getUniqueId()); + }); + if (flag) { + GameProfile profile = handle.getProfile(); + + Skin skin = getSkin(); + if (skin != null) { + PropertyMap properties = profile.getProperties(); + properties.removeAll("textures"); + properties.put("textures", new Property("textures", skin.getValue(), skin.getSignature())); + } + + String name = getName(); + if (name != null) { + ReflectionProvider.DEFAULT.getReflect("mjGameProfile").setFieldValue(profile, "name", name); + } + + if (!(name == null && skin == null)) { + fakeRespawn(); + } + } + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/reflection/NmsReflection1_10_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/reflection/NmsReflection1_10_R1.java new file mode 100644 index 0000000..fd98afc --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/reflection/NmsReflection1_10_R1.java @@ -0,0 +1,34 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_10_R1.reflection; + +import net.minecraft.server.v1_10_R1.NBTTagEnd; +import net.minecraft.server.v1_10_R1.NBTTagList; +import net.minecraft.server.v1_10_R1.PacketPlayOutPlayerListHeaderFooter; +import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; +import net.sourcewriters.minecraft.vcompat.reflection.reflect.Reflections; + +public class NmsReflection1_10_R1 extends Reflections { + + public static NmsReflection1_10_R1 INSTANCE = new NmsReflection1_10_R1(); + + private NmsReflection1_10_R1() {} + + @Override + public void setup(ReflectionProvider provider) { + + // + // + // Create Reflects + // + + // + // Minecraft + + provider.createReflect("nmsPacketPlayOutPlayerListHeaderFooter", PacketPlayOutPlayerListHeaderFooter.class) + .searchField("header", "a").searchField("header", "b"); + + provider.createReflect("nmsNBTTagEnd", NBTTagEnd.class); + provider.createReflect("nmsNBTTagList", NBTTagList.class).searchField("value", "list"); + + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/tools/BlockTools1_10_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/tools/BlockTools1_10_R1.java new file mode 100644 index 0000000..21bd8ea --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/tools/BlockTools1_10_R1.java @@ -0,0 +1,39 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_10_R1.tools; + +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_10_R1.block.CraftSkull; + +import com.mojang.authlib.properties.Property; +import com.mojang.authlib.properties.PropertyMap; +import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; +import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.minecraft.server.v1_10_R1.TileEntitySkull; +import net.sourcewriters.minecraft.vcompat.reflection.tools.BlockTools; +import net.sourcewriters.minecraft.vcompat.utils.constants.MinecraftConstants; + +public class BlockTools1_10_R1 extends BlockTools { + + private final AbstractReflect craftEntityStateRef = new Reflect(CraftSkull.class).searchField("tileEntity", "tileEntity"); + + @Override + public void setHeadTexture(Block block, String texture) { + if (!(block instanceof CraftSkull)) { + return; + } + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + PropertyMap map = entitySkull.getGameProfile().getProperties(); + map.removeAll("textures"); + map.put("textures", new Property("textures", MinecraftConstants.TEXTURE_SIGNATURE, texture)); + } + + @Override + public String getHeadTexture(Block block) { + if (!(block instanceof CraftSkull)) { + return null; + } + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + return entitySkull.getGameProfile().getProperties().get("textures").iterator().next().getValue(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/tools/ServerTools1_10_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/tools/ServerTools1_10_R1.java new file mode 100644 index 0000000..562a77d --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/tools/ServerTools1_10_R1.java @@ -0,0 +1,26 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_10_R1.tools; + +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_10_R1.CraftServer; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_10_R1.wrapper.ConsoleReaderWrapper1_10_R1; +import net.sourcewriters.minecraft.vcompat.reflection.tools.ServerTools; + +public class ServerTools1_10_R1 extends ServerTools { + + @Override + public void setMotd(String text) { + ((CraftServer) Bukkit.getServer()).getServer().setMotd(text); + } + + @Override + public String getMotd() { + return ((CraftServer) Bukkit.getServer()).getServer().getMotd(); + } + + @Override + public ConsoleReaderWrapper1_10_R1 getConsole() { + return ConsoleReaderWrapper1_10_R1.INSTANCE; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/tools/SkinTools1_10_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/tools/SkinTools1_10_R1.java new file mode 100644 index 0000000..74a3b4a --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/tools/SkinTools1_10_R1.java @@ -0,0 +1,16 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_10_R1.tools; + +import org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer; +import org.bukkit.entity.Player; + +import net.sourcewriters.minecraft.vcompat.reflection.tools.SkinTools; +import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; + +public class SkinTools1_10_R1 extends SkinTools { + + @Override + public Skin skinFromPlayer(Player player) { + return skinFromGameProfile(((CraftPlayer) player).getHandle().getProfile()); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/utils/EntityConstructors1_10_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/utils/EntityConstructors1_10_R1.java new file mode 100644 index 0000000..139a92b --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/utils/EntityConstructors1_10_R1.java @@ -0,0 +1,12 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_10_R1.utils; + +import java.util.function.Function; + +import net.minecraft.server.v1_10_R1.World; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_10_R1.entity.ArmorStand1_10_R1; + +public abstract class EntityConstructors1_10_R1 { + + public static final Function ARMOR_STAND = (world -> new ArmorStand1_10_R1(world)); + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/wrapper/ConsoleReaderWrapper1_10_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/wrapper/ConsoleReaderWrapper1_10_R1.java new file mode 100644 index 0000000..bf188ef --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/wrapper/ConsoleReaderWrapper1_10_R1.java @@ -0,0 +1,43 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_10_R1.wrapper; + +import java.io.IOException; +import java.io.Writer; + +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_10_R1.CraftServer; +import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; + +import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; + +public final class ConsoleReaderWrapper1_10_R1 extends ConsoleReaderWrapper { + + public static final ConsoleReaderWrapper1_10_R1 INSTANCE = new ConsoleReaderWrapper1_10_R1(); + + private final ConsoleReader reader; + + @SuppressWarnings("resource") + private ConsoleReaderWrapper1_10_R1() { + this.reader = ((CraftServer) Bukkit.getServer()).getServer().reader; + } + + @Override + public Writer getOutput() { + return reader.getOutput(); + } + + @Override + public boolean isAnsiSupported() { + return reader.getTerminal().isAnsiSupported(); + } + + @Override + public void flush() throws IOException { + reader.flush(); + } + + @Override + public void drawLine() throws IOException { + reader.drawLine(); + } + +} diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/BukkitConversion1_11_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/BukkitConversion1_11_R1.java new file mode 100644 index 0000000..b1a2404 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/BukkitConversion1_11_R1.java @@ -0,0 +1,228 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_11_R1; + +import java.util.List; +import java.util.Set; + +import org.bukkit.craftbukkit.v1_11_R1.inventory.CraftItemStack; +import org.bukkit.entity.EntityType; + +import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; +import com.syntaxphoenix.syntaxapi.data.DataType; +import com.syntaxphoenix.syntaxapi.nbt.NbtByte; +import com.syntaxphoenix.syntaxapi.nbt.NbtByteArray; +import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; +import com.syntaxphoenix.syntaxapi.nbt.NbtDouble; +import com.syntaxphoenix.syntaxapi.nbt.NbtEnd; +import com.syntaxphoenix.syntaxapi.nbt.NbtFloat; +import com.syntaxphoenix.syntaxapi.nbt.NbtInt; +import com.syntaxphoenix.syntaxapi.nbt.NbtIntArray; +import com.syntaxphoenix.syntaxapi.nbt.NbtList; +import com.syntaxphoenix.syntaxapi.nbt.NbtLong; +import com.syntaxphoenix.syntaxapi.nbt.NbtLongArray; +import com.syntaxphoenix.syntaxapi.nbt.NbtShort; +import com.syntaxphoenix.syntaxapi.nbt.NbtString; +import com.syntaxphoenix.syntaxapi.nbt.NbtTag; +import com.syntaxphoenix.syntaxapi.nbt.NbtType; + +import net.minecraft.server.v1_11_R1.ItemStack; +import net.minecraft.server.v1_11_R1.NBTBase; +import net.minecraft.server.v1_11_R1.NBTTagByte; +import net.minecraft.server.v1_11_R1.NBTTagByteArray; +import net.minecraft.server.v1_11_R1.NBTTagCompound; +import net.minecraft.server.v1_11_R1.NBTTagDouble; +import net.minecraft.server.v1_11_R1.NBTTagEnd; +import net.minecraft.server.v1_11_R1.NBTTagFloat; +import net.minecraft.server.v1_11_R1.NBTTagInt; +import net.minecraft.server.v1_11_R1.NBTTagIntArray; +import net.minecraft.server.v1_11_R1.NBTTagList; +import net.minecraft.server.v1_11_R1.NBTTagLong; +import net.minecraft.server.v1_11_R1.NBTTagShort; +import net.minecraft.server.v1_11_R1.NBTTagString; +import net.sourcewriters.minecraft.vcompat.reflection.BukkitConversion; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContext; +import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleWrapType; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; +import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; + +public class BukkitConversion1_11_R1 extends BukkitConversion { + + protected BukkitConversion1_11_R1(VersionControl1_11_R1 versionControl) { + super(versionControl); + } + + @Override + public EntityType toEntityType(NmsEntityType type) { + try { + return EntityType.valueOf(type.name()); + } catch (IllegalArgumentException ignore) { + return null; + } + } + + @Override + public NmsEntityType fromEntityType(EntityType type) { + try { + return NmsEntityType.valueOf(type.name()); + } catch (IllegalArgumentException ignore) { + return null; + } + } + + @Override + public NBTBase toMinecraftTag(NbtTag tag) { + switch (tag.getType()) { + case BYTE: + return new NBTTagByte((byte) tag.getValue()); + case SHORT: + return new NBTTagShort((short) tag.getValue()); + case INT: + return new NBTTagInt((int) tag.getValue()); + case LONG: + return new NBTTagLong((long) tag.getValue()); + case FLOAT: + return new NBTTagFloat((float) tag.getValue()); + case DOUBLE: + return new NBTTagDouble((double) tag.getValue()); + case STRING: + return new NBTTagString((String) tag.getValue()); + case BYTE_ARRAY: + return new NBTTagByteArray((byte[]) tag.getValue()); + case INT_ARRAY: + return new NBTTagIntArray((int[]) tag.getValue()); + case LONG_ARRAY: + NBTTagList list = new NBTTagList(); + for (long value : (long[]) tag.getValue()) { + list.add(new NBTTagLong(value)); + } + return list; + case LIST: + return toMinecraftList((NbtList) tag); + case COMPOUND: + return toMinecraftCompound((NbtCompound) tag); + case END: + return (NBTTagEnd) ReflectionProvider.DEFAULT.getReflect("nmsNBTTagEnd").init(); + default: + return null; + } + } + + @Override + public NbtTag fromMinecraftTag(Object raw) { + if (!(raw instanceof NBTBase)) { + return null; + } + NBTBase tag = (NBTBase) raw; + NbtType type = NbtType.getById(tag.getTypeId()); + switch (type) { + case BYTE: + return new NbtByte(((NBTTagByte) tag).g()); + case SHORT: + return new NbtShort(((NBTTagShort) tag).f()); + case INT: + return new NbtInt(((NBTTagInt) tag).e()); + case LONG: + return new NbtLong(((NBTTagLong) tag).d()); + case FLOAT: + return new NbtFloat(((NBTTagFloat) tag).i()); + case DOUBLE: + return new NbtDouble(((NBTTagDouble) tag).asDouble()); + case STRING: + return new NbtString(((NBTTagString) tag).c_()); + case BYTE_ARRAY: + return new NbtByteArray(((NBTTagByteArray) tag).c()); + case INT_ARRAY: + return new NbtIntArray(((NBTTagIntArray) tag).d()); + case LONG_ARRAY: + return new NbtLongArray(new long[0]); + case LIST: + return fromMinecraftList(tag); + case COMPOUND: + return fromMinecraftCompound(tag); + case END: + return NbtEnd.INSTANCE; + default: + return null; + } + } + + @Override + public NBTTagList toMinecraftList(NbtList list) { + NBTTagList output = new NBTTagList(); + for (NbtTag tag : list) { + output.add(toMinecraftTag(tag)); + } + return output; + } + + @SuppressWarnings("unchecked") + @Override + public NbtList fromMinecraftList(Object raw) { + if (!(raw instanceof NBTTagList)) { + return null; + } + NBTTagList list = (NBTTagList) raw; + List content = (List) ReflectionProvider.DEFAULT.getReflect("nmsNBTTagList").getFieldValue("value", list); + NbtList output = new NbtList<>(NbtType.getById(list.getTypeId())); + for (NBTBase base : content) { + output.add(fromMinecraftTag(base)); + } + return output; + } + + @Override + public NBTTagCompound toMinecraftCompound(NbtCompound compound) { + NBTTagCompound output = new NBTTagCompound(); + if (compound.isEmpty()) { + return output; + } + Set keys = compound.getKeys(); + for (String key : keys) { + output.set(key, toMinecraftTag(compound.get(key))); + } + return output; + } + + @Override + public NbtCompound fromMinecraftCompound(Object raw) { + if (!(raw instanceof NBTTagCompound)) { + return null; + } + NBTTagCompound compound = (NBTTagCompound) raw; + NbtCompound output = new NbtCompound(); + if (compound.isEmpty()) { + return output; + } + Set keys = compound.c(); + for (String key : keys) { + output.set(key, fromMinecraftTag(compound.get(key))); + } + return output; + } + + @Override + public org.bukkit.inventory.ItemStack itemFromCompound(NbtCompound compound) { + return CraftItemStack.asBukkitCopy(new ItemStack(toMinecraftCompound(compound))); + } + + @Override + public NbtCompound itemToCompound(org.bukkit.inventory.ItemStack itemStack) { + ItemStack nmsStack = CraftItemStack.asNMSCopy(itemStack); + if (!nmsStack.hasTag()) { + nmsStack.convertStack(); + } + return fromMinecraftCompound(nmsStack.getTag()); + } + + @Override + public WrappedContext createContext(DataAdapterContext context) { + return new SimpleSyntaxContext(context); + } + + @Override + public WrapType wrap(DataType dataType) { + return new SimpleWrapType(dataType); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/EntityProvider1_11_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/EntityProvider1_11_R1.java new file mode 100644 index 0000000..e6a909d --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/EntityProvider1_11_R1.java @@ -0,0 +1,47 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_11_R1; + +import java.util.EnumMap; +import java.util.function.Function; + +import org.bukkit.craftbukkit.v1_11_R1.CraftWorld; + +import net.minecraft.server.v1_11_R1.World; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_11_R1.utils.EntityConstructors1_11_R1; +import net.sourcewriters.minecraft.vcompat.reflection.EntityProvider; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; + +public class EntityProvider1_11_R1 extends EntityProvider { + + private final EnumMap> entityMap = new EnumMap<>(NmsEntityType.class); + + protected EntityProvider1_11_R1(VersionControl1_11_R1 versionControl) { + super(versionControl); + } + + @SuppressWarnings("unchecked") + private final Function searchConstructor(NmsEntityType type) { + try { + return (Function) EntityConstructors1_11_R1.class.getField(type.name()).get(null); + } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException ignore) { + return null; + } + } + + private final Function getConstructor(NmsEntityType type) { + return entityMap.computeIfAbsent(type, (key -> searchConstructor(key))); + } + + @Override + public NmsEntity createEntity(org.bukkit.World world, NmsEntityType type) { + if (!(world instanceof CraftWorld)) { + return null; + } + Function function; + if ((function = getConstructor(type)) == null) { + return null; + } + return function.apply(((CraftWorld) world).getHandle()); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/PacketHandler1_11_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/PacketHandler1_11_R1.java new file mode 100644 index 0000000..0a4ad68 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/PacketHandler1_11_R1.java @@ -0,0 +1,11 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_11_R1; + +import net.sourcewriters.minecraft.vcompat.reflection.PacketHandler; + +public class PacketHandler1_11_R1 extends PacketHandler { + + protected PacketHandler1_11_R1(VersionControl1_11_R1 versionControl) { + super(versionControl); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/PlayerProvider1_11_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/PlayerProvider1_11_R1.java new file mode 100644 index 0000000..8f15908 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/PlayerProvider1_11_R1.java @@ -0,0 +1,30 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_11_R1; + +import java.io.File; +import java.util.UUID; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_11_R1.entity.Player1_11_R1; +import net.sourcewriters.minecraft.vcompat.reflection.DataProvider; +import net.sourcewriters.minecraft.vcompat.reflection.PlayerProvider; +import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.DataDistributor; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; + +public class PlayerProvider1_11_R1 extends PlayerProvider { + + private final DataDistributor distributor; + + protected PlayerProvider1_11_R1(VersionControl1_11_R1 versionControl) { + super(versionControl); + distributor = versionControl.getDataProvider().createDistributor(new File(Bukkit.getWorlds().get(0).getWorldFolder(), "playerdata"), + uuid -> "custom_" + uuid.toString(), DataProvider.DEFAULT_RANDOM); + } + + @Override + protected NmsPlayer createPlayer(Player player) { + return new Player1_11_R1(player, distributor.get(player.getUniqueId())); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/TextureProvider1_11_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/TextureProvider1_11_R1.java new file mode 100644 index 0000000..719c033 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/TextureProvider1_11_R1.java @@ -0,0 +1,103 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_11_R1; + +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_11_R1.block.CraftSkull; +import org.bukkit.craftbukkit.v1_11_R1.inventory.CraftItemStack; +import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.inventory.meta.SkullMeta; +import org.bukkit.material.MaterialData; + +import com.mojang.authlib.GameProfile; +import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; +import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.minecraft.server.v1_11_R1.GameProfileSerializer; +import net.minecraft.server.v1_11_R1.ItemStack; +import net.minecraft.server.v1_11_R1.NBTTagCompound; +import net.sourcewriters.minecraft.vcompat.reflection.TextureProvider; + +@SuppressWarnings("deprecation") +public class TextureProvider1_11_R1 extends TextureProvider { + + private final AbstractReflect craftItemStackRef = new Reflect(CraftItemStack.class).searchField("handle", "handle"); + private final AbstractReflect craftMetaSkullRef = new Reflect("org.bukkit.craftbukkit.v1_11_R1.inventory.CraftMetaSkull") + .searchField("serialized", "serializedProfile").searchField("profile", "profile"); + private final Material skullMaterial = Material.valueOf("SKULL"); + + protected TextureProvider1_11_R1(VersionControl1_11_R1 versionControl) { + super(versionControl); + } + + @Override + public GameProfile profileFromBlock(Block block) { + if (!(block instanceof CraftSkull)) { + return null; + } + return ((CraftSkull) block).getTileEntity().getGameProfile(); + } + + @Override + public GameProfile profileFromItem(org.bukkit.inventory.ItemStack itemStack) { + if (!(itemStack.getItemMeta() instanceof SkullMeta)) { + return null; + } + SkullMeta meta = (SkullMeta) itemStack.getItemMeta(); + GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue("profile", meta); + if (profile == null) { + NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue("serialized", meta); + if (compound == null) { + ItemStack stack = null; + if (itemStack instanceof CraftItemStack) { + stack = (ItemStack) craftItemStackRef.getFieldValue("handle", itemStack); + } + if (stack == null) { + stack = CraftItemStack.asNMSCopy(itemStack); + } + if (!stack.hasTag()) { + stack.convertStack(); + } + NBTTagCompound stackTag = stack.getTag(); + if (stackTag.hasKeyOfType("SkullOwner", 10)) { + compound = stackTag.getCompound("SkullOwner"); + } else if (stackTag.hasKeyOfType("SkullProfile", 10)) { + compound = stackTag.getCompound("SkullProfile"); + } + } + if (compound == null) { + return null; + } + profile = GameProfileSerializer.deserialize(compound); + } + return profile; + } + + @Override + public org.bukkit.inventory.ItemStack getItem(GameProfile profile) { + org.bukkit.inventory.ItemStack craftStack = CraftItemStack.asCraftCopy(new MaterialData(skullMaterial, (byte) 3).toItemStack(1)); + applyItem(craftStack, profile); + return craftStack; + } + + @Override + public boolean applyItem(org.bukkit.inventory.ItemStack itemStack, GameProfile profile) { + ItemMeta meta = itemStack.getItemMeta(); + if (!(meta instanceof SkullMeta)) { + return false; + } + SkullMeta skullMeta = (SkullMeta) meta; + craftMetaSkullRef.setFieldValue(meta, "profile", profile); + itemStack.setItemMeta(skullMeta); + return true; + } + + @Override + public boolean applyBlock(Block block, GameProfile profile) { + if (!(block instanceof CraftSkull)) { + return false; + } + ((CraftSkull) block).getTileEntity().setGameProfile(profile); + return true; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/ToolProvider1_11_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/ToolProvider1_11_R1.java new file mode 100644 index 0000000..d644819 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/ToolProvider1_11_R1.java @@ -0,0 +1,33 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_11_R1; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_11_R1.tools.BlockTools1_11_R1; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_11_R1.tools.ServerTools1_11_R1; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_11_R1.tools.SkinTools1_11_R1; +import net.sourcewriters.minecraft.vcompat.reflection.ToolProvider; + +public class ToolProvider1_11_R1 extends ToolProvider { + + private final BlockTools1_11_R1 blockTools = new BlockTools1_11_R1(); + private final SkinTools1_11_R1 skinTools = new SkinTools1_11_R1(); + private final ServerTools1_11_R1 serverTools = new ServerTools1_11_R1(); + + protected ToolProvider1_11_R1(VersionControl1_11_R1 versionControl) { + super(versionControl); + } + + @Override + public SkinTools1_11_R1 getSkinTools() { + return skinTools; + } + + @Override + public ServerTools1_11_R1 getServerTools() { + return serverTools; + } + + @Override + public BlockTools1_11_R1 getBlockTools() { + return blockTools; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/VersionControl1_11_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/VersionControl1_11_R1.java new file mode 100644 index 0000000..7eca41f --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/VersionControl1_11_R1.java @@ -0,0 +1,56 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_11_R1; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_11_R1.reflection.NmsReflection1_11_R1; +import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; +import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; + +public class VersionControl1_11_R1 extends VersionControl { + + public static VersionControl1_11_R1 INSTANCE; + + public static VersionControl1_11_R1 init() { + return INSTANCE != null ? INSTANCE : (INSTANCE = new VersionControl1_11_R1()); + } + + private final ToolProvider1_11_R1 toolProvider = new ToolProvider1_11_R1(this); + private final TextureProvider1_11_R1 textureProvider = new TextureProvider1_11_R1(this); + private final PacketHandler1_11_R1 packetHandler = new PacketHandler1_11_R1(this); + private final EntityProvider1_11_R1 entityProvider = new EntityProvider1_11_R1(this); + private final PlayerProvider1_11_R1 playerProvider = new PlayerProvider1_11_R1(this); + private final BukkitConversion1_11_R1 bukkitConversion = new BukkitConversion1_11_R1(this); + + private VersionControl1_11_R1() { + NmsReflection1_11_R1.INSTANCE.setup(ReflectionProvider.DEFAULT); + } + + @Override + public ToolProvider1_11_R1 getToolProvider() { + return toolProvider; + } + + @Override + public EntityProvider1_11_R1 getEntityProvider() { + return entityProvider; + } + + @Override + public PlayerProvider1_11_R1 getPlayerProvider() { + return playerProvider; + } + + @Override + public TextureProvider1_11_R1 getTextureProvider() { + return textureProvider; + } + + @Override + public PacketHandler1_11_R1 getPacketHandler() { + return packetHandler; + } + + @Override + public BukkitConversion1_11_R1 getBukkitConversion() { + return bukkitConversion; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/entity/ArmorStand1_11_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/entity/ArmorStand1_11_R1.java new file mode 100644 index 0000000..33b538d --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/entity/ArmorStand1_11_R1.java @@ -0,0 +1,23 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_11_R1.entity; + +import net.minecraft.server.v1_11_R1.EntityArmorStand; +import net.minecraft.server.v1_11_R1.World; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsArmorStand; + +public class ArmorStand1_11_R1 extends EntityLiving1_11_R1 implements NmsArmorStand { + + public ArmorStand1_11_R1(World world) { + super(new EntityArmorStand(world)); + } + + @Override + public void setSmall(boolean small) { + handle.setSmall(small); + } + + @Override + public boolean isSmall() { + return handle.isSmall(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/entity/Entity1_11_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/entity/Entity1_11_R1.java new file mode 100644 index 0000000..e6d930b --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/entity/Entity1_11_R1.java @@ -0,0 +1,215 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_11_R1.entity; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.UUID; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.OfflinePlayer; +import org.bukkit.craftbukkit.v1_11_R1.CraftWorld; +import org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer; +import org.bukkit.entity.Player; + +import net.minecraft.server.v1_11_R1.AxisAlignedBB; +import net.minecraft.server.v1_11_R1.Entity; +import net.minecraft.server.v1_11_R1.EntityTypes; +import net.minecraft.server.v1_11_R1.PacketPlayOutEntityDestroy; +import net.minecraft.server.v1_11_R1.PacketPlayOutEntityMetadata; +import net.minecraft.server.v1_11_R1.PacketPlayOutSpawnEntity; +import net.minecraft.server.v1_11_R1.PlayerConnection; +import net.minecraft.server.v1_11_R1.Vec3D; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.reflection.utils.NmsBoundingBox; + +public abstract class Entity1_11_R1 implements NmsEntity { + + protected final E handle; + + protected final List visible = Collections.synchronizedList(new ArrayList<>()); + + public Entity1_11_R1(E handle) { + this.handle = handle; + } + + @Override + public final E getHandle() { + return handle; + } + + @Override + public int getId() { + return handle.getId(); + } + + @Override + public UUID getUniqueId() { + return handle.getUniqueID(); + } + + @Override + public NmsBoundingBox getBoundingBox() { + AxisAlignedBB box = handle.getBoundingBox(); + return new NmsBoundingBox(box.a, box.b, box.c, box.d, box.e, box.f); + } + + @Override + public void setCustomName(String name) { + handle.setCustomName(name); + updateVisibility(); + } + + @Override + public String getCustomName() { + return handle.getCustomName(); + } + + @Override + public void setGravity(boolean gravity) { + handle.setNoGravity(!gravity); + } + + @Override + public boolean hasGravity() { + return !handle.isNoGravity(); + } + + @Override + public void setCustomNameVisible(boolean visible) { + handle.setCustomNameVisible(visible); + } + + @Override + public boolean isCustomNameVisible() { + return handle.getCustomNameVisible(); + } + + @Override + public void setInvisible(boolean invisible) { + handle.setInvisible(invisible); + } + + @Override + public boolean isInvisible() { + return handle.isInvisible(); + } + + @Override + public boolean isInteractable() { + return handle.isInteractable(); + } + + @Override + public boolean isCollidable() { + return handle.isCollidable(); + } + + @Override + public void setInvulnerable(boolean invulnerable) { + handle.setInvulnerable(invulnerable); + } + + @Override + public boolean isInvulnerable() { + return handle.aW(); + } + + @Override + public void setLocation(Location location) { + handle.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); + if (location.getWorld() == null || handle.getWorld().getWorld() == location.getWorld()) { + updateVisibility(); + return; + } + handle.world = ((CraftWorld) location.getWorld()).getHandle(); + updateVisibility(); + } + + @Override + public Location getLocation() { + Vec3D vector = handle.d(); + return new Location(handle.getWorld().getWorld(), vector.x, vector.y, vector.z); + } + + @Override + public void updateVisibility() { + if (visible.isEmpty()) { + return; + } + Player[] players; + synchronized (visible) { + players = visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) + .toArray(Player[]::new); + } + hide(players); + show(players); + } + + @Override + public boolean isShown(Player player) { + synchronized (visible) { + return visible.contains(player.getUniqueId()); + } + } + + @Override + public void hide(Player... players) { + if (players.length == 0) { + return; + } + PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(handle.getId()); + for (Player player : players) { + if (!isShown(player) && !(player instanceof CraftPlayer)) { + continue; + } + ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); + synchronized (visible) { + visible.remove(player.getUniqueId()); + } + } + } + + @Override + public void show(Player... players) { + if (players.length == 0) { + return; + } + PacketPlayOutSpawnEntity packet = new PacketPlayOutSpawnEntity(handle, EntityTypes.b.a(handle.getClass())); + PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); + PlayerConnection connection; + for (Player player : players) { + if (isShown(player)) { + continue; + } + connection = ((CraftPlayer) player).getHandle().playerConnection; + connection.sendPacket(packet); + connection.sendPacket(metadataPacket); + synchronized (visible) { + visible.add(player.getUniqueId()); + } + } + } + + @Override + public UUID[] getVisible() { + synchronized (visible) { + return visible.toArray(new UUID[0]); + } + } + + @Override + public Player[] getVisibleAsPlayer() { + synchronized (visible) { + return visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) + .toArray(Player[]::new); + } + } + + @Override + public void kill() { + hide(getVisibleAsPlayer()); + handle.die(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/entity/EntityLiving1_11_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/entity/EntityLiving1_11_R1.java new file mode 100644 index 0000000..e935246 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/entity/EntityLiving1_11_R1.java @@ -0,0 +1,17 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_11_R1.entity; + +import net.minecraft.server.v1_11_R1.EntityLiving; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityLiving; + +public abstract class EntityLiving1_11_R1 extends Entity1_11_R1 implements NmsEntityLiving { + + public EntityLiving1_11_R1(E handle) { + super(handle); + } + + @Override + public void setCollidable(boolean collidable) { + handle.collides = collidable; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/entity/Player1_11_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/entity/Player1_11_R1.java new file mode 100644 index 0000000..c9b3620 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/entity/Player1_11_R1.java @@ -0,0 +1,295 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_11_R1.entity; + +import java.util.ArrayList; +import java.util.Collections; + +import org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_11_R1.util.CraftChatMessage; +import org.bukkit.entity.Player; + +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.properties.Property; +import com.mojang.authlib.properties.PropertyMap; +import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.minecraft.server.v1_11_R1.EntityPlayer; +import net.minecraft.server.v1_11_R1.EnumItemSlot; +import net.minecraft.server.v1_11_R1.IChatBaseComponent; +import net.minecraft.server.v1_11_R1.MathHelper; +import net.minecraft.server.v1_11_R1.PacketPlayInClientCommand; +import net.minecraft.server.v1_11_R1.PacketPlayInClientCommand.EnumClientCommand; +import net.minecraft.server.v1_11_R1.PacketPlayOutEntityDestroy; +import net.minecraft.server.v1_11_R1.PacketPlayOutEntityEquipment; +import net.minecraft.server.v1_11_R1.PacketPlayOutEntityHeadRotation; +import net.minecraft.server.v1_11_R1.PacketPlayOutEntityMetadata; +import net.minecraft.server.v1_11_R1.PacketPlayOutEntityStatus; +import net.minecraft.server.v1_11_R1.PacketPlayOutHeldItemSlot; +import net.minecraft.server.v1_11_R1.PacketPlayOutNamedEntitySpawn; +import net.minecraft.server.v1_11_R1.PacketPlayOutPlayerInfo; +import net.minecraft.server.v1_11_R1.PacketPlayOutPlayerInfo.EnumPlayerInfoAction; +import net.minecraft.server.v1_11_R1.PacketPlayOutPlayerListHeaderFooter; +import net.minecraft.server.v1_11_R1.PacketPlayOutPosition; +import net.minecraft.server.v1_11_R1.PacketPlayOutRespawn; +import net.minecraft.server.v1_11_R1.PacketPlayOutTitle; +import net.minecraft.server.v1_11_R1.PacketPlayOutTitle.EnumTitleAction; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.PersistentContainer; +import net.sourcewriters.minecraft.vcompat.reflection.data.type.SkinDataType; +import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContainer; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; +import net.sourcewriters.minecraft.vcompat.utils.bukkit.Players; +import net.sourcewriters.minecraft.vcompat.utils.minecraft.MojangProfileServer; +import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; +import net.sourcewriters.minecraft.vcompat.utils.thread.PostAsync; +import net.minecraft.server.v1_11_R1.PlayerConnection; +import net.minecraft.server.v1_11_R1.WorldServer; + +public class Player1_11_R1 extends EntityLiving1_11_R1 implements NmsPlayer { + + private String realName; + private Skin realSkin; + + private final WrappedContainer dataAdapter; + + public Player1_11_R1(Player player, PersistentContainer container) { + super(((CraftPlayer) player).getHandle()); + this.dataAdapter = new SimpleSyntaxContainer<>(container); + update(false); + } + + @Override + public CraftPlayer getBukkitPlayer() { + return handle.getBukkitEntity(); + } + + @Override + public WrappedContainer getDataAdapter() { + return dataAdapter; + } + + @Override + public void setSkin(Skin skin) { + if (skin == null || getSkin().equals(skin)) { + return; + } + getDataAdapter().set("skin", skin, SkinDataType.WRAPPED_INSTANCE); + } + + @Override + public Skin getSkin() { + return dataAdapter.getOrDefault("skin", SkinDataType.WRAPPED_INSTANCE, realSkin); + } + + @Override + public Skin getRealSkin() { + return realSkin; + } + + @Override + public void setName(String name) { + if (getName().equals(name)) { + return; + } + if (name == null) { + getDataAdapter().remove("name"); + return; + } + getDataAdapter().set("name", name, WrapType.STRING); + } + + @Override + public String getName() { + return getDataAdapter().getOrDefault("name", WrapType.STRING, realName); + } + + @Override + public String getRealName() { + return realName; + } + + @Override + public void setPlayerListHeader(String text) { + setPlayerListHeaderAndFooter(text, getPlayerListFooter()); + } + + @Override + public String getPlayerListHeader() { + return getDataAdapter().getOrDefault("header", WrapType.STRING, ""); + } + + @Override + public void setPlayerListFooter(String text) { + setPlayerListHeaderAndFooter(getPlayerListHeader(), text); + } + + @Override + public String getPlayerListFooter() { + return getDataAdapter().getOrDefault("footer", WrapType.STRING, ""); + } + + @Override + public int getPing() { + return handle.ping; + } + + @Override + public void setPlayerListHeaderAndFooter(String header, String footer) { + getDataAdapter().set("header", header, WrapType.STRING); + getDataAdapter().set("footer", footer, WrapType.STRING); + sendPlayerListInfo(header, footer); + } + + private final void sendPlayerListInfo(String header, String footer) { + if (handle.playerConnection.isDisconnected()) { + return; + } + + IChatBaseComponent headerComponent = header.isEmpty() ? null : CraftChatMessage.fromString(header, true)[0]; + IChatBaseComponent footerComponent = footer.isEmpty() ? null : CraftChatMessage.fromString(footer, true)[0]; + + PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter(); + + Reflect reflect = ReflectionProvider.DEFAULT.getReflect("nmsPacketPlayOutPlayerListHeaderFooter"); + reflect.setFieldValue(packet, "header", headerComponent); + reflect.setFieldValue(packet, "footer", footerComponent); + + handle.playerConnection.sendPacket(packet); + } + + @Override + public void setTitleTimes(int fadeIn, int stay, int fadeOut) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TIMES, null, fadeIn, stay, fadeOut)); + } + + @Override + public void sendSubtitle(String text) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.SUBTITLE, CraftChatMessage.fromString(text)[0])); + } + + @Override + public void sendTitle(String text) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TITLE, CraftChatMessage.fromString(text)[0])); + } + + @Override + public void sendActionBar(String text) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.ACTIONBAR, CraftChatMessage.fromString(text)[0])); + } + + @Override + public void fakeRespawn() { + if (handle.playerConnection.isDisconnected()) { + return; + } + PacketPlayOutPlayerInfo remInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER, handle); + PacketPlayOutPlayerInfo addInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.ADD_PLAYER, handle); + + PacketPlayOutEntityDestroy destroyPacket = new PacketPlayOutEntityDestroy(handle.getId()); + PacketPlayOutNamedEntitySpawn spawnPacket = new PacketPlayOutNamedEntitySpawn(handle); + PacketPlayOutEntityHeadRotation rotationPacket = new PacketPlayOutEntityHeadRotation(handle, + (byte) MathHelper.d(handle.getHeadRotation() * 256F / 360F)); + + ArrayList equipmentPackets = new ArrayList<>(); + for (EnumItemSlot slot : EnumItemSlot.values()) { + equipmentPackets.add(new PacketPlayOutEntityEquipment(handle.getId(), slot, handle.getEquipment(slot))); + } + + Player self = getBukkitPlayer(); + Player[] players = Players.getOnlineWithout(getUniqueId()); + for (Player player : players) { + if (!player.canSee(self)) { + continue; + } + PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection; + connection.sendPacket(remInfoPacket); + connection.sendPacket(addInfoPacket); + connection.sendPacket(destroyPacket); + connection.sendPacket(spawnPacket); + connection.sendPacket(rotationPacket); + for (PacketPlayOutEntityEquipment equipmentPacket : equipmentPackets) { + connection.sendPacket(equipmentPacket); + } + } + + WorldServer world = (WorldServer) handle.world; + + PacketPlayOutRespawn respawnPacket = new PacketPlayOutRespawn(handle.dimension, world.getDifficulty(), + handle.world.worldData.getType(), handle.playerInteractManager.getGameMode()); + PacketPlayOutPosition positionPacket = new PacketPlayOutPosition(handle.locX, handle.locY, handle.locZ, handle.yaw, handle.pitch, + Collections.emptySet(), 0); + PacketPlayOutHeldItemSlot itemPacket = new PacketPlayOutHeldItemSlot(handle.inventory.itemInHandIndex); + PacketPlayOutEntityStatus statusPacket = new PacketPlayOutEntityStatus(handle, (byte) 28); + PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); + + PlayerConnection connection = handle.playerConnection; + connection.sendPacket(remInfoPacket); + connection.sendPacket(addInfoPacket); + connection.sendPacket(respawnPacket); + connection.sendPacket(positionPacket); + connection.sendPacket(itemPacket); + connection.sendPacket(statusPacket); + connection.sendPacket(metadataPacket); + + handle.updateAbilities(); + handle.triggerHealthUpdate(); + handle.updateInventory(handle.defaultContainer); + if (handle.activeContainer != handle.defaultContainer) { + handle.updateInventory(handle.activeContainer); + } + self.recalculatePermissions(); + } + + @Override + public void respawn() { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayInClientCommand(EnumClientCommand.PERFORM_RESPAWN)); + } + + @Override + public void update() { + update(true); + } + + private final void update(boolean flag) { + PostAsync.forcePost(() -> { + realName = MojangProfileServer.getName(getUniqueId()); + realSkin = MojangProfileServer.getSkin(realName, getUniqueId()); + }); + if (flag) { + GameProfile profile = handle.getProfile(); + + Skin skin = getSkin(); + if (skin != null) { + PropertyMap properties = profile.getProperties(); + properties.removeAll("textures"); + properties.put("textures", new Property("textures", skin.getValue(), skin.getSignature())); + } + + String name = getName(); + if (name != null) { + ReflectionProvider.DEFAULT.getReflect("mjGameProfile").setFieldValue(profile, "name", name); + } + + if (!(name == null && skin == null)) { + fakeRespawn(); + } + } + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/reflection/NmsReflection1_11_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/reflection/NmsReflection1_11_R1.java new file mode 100644 index 0000000..95e4bf1 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/reflection/NmsReflection1_11_R1.java @@ -0,0 +1,34 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_11_R1.reflection; + +import net.minecraft.server.v1_11_R1.NBTTagEnd; +import net.minecraft.server.v1_11_R1.NBTTagList; +import net.minecraft.server.v1_11_R1.PacketPlayOutPlayerListHeaderFooter; +import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; +import net.sourcewriters.minecraft.vcompat.reflection.reflect.Reflections; + +public class NmsReflection1_11_R1 extends Reflections { + + public static NmsReflection1_11_R1 INSTANCE = new NmsReflection1_11_R1(); + + private NmsReflection1_11_R1() {} + + @Override + public void setup(ReflectionProvider provider) { + + // + // + // Create Reflects + // + + // + // Minecraft + + provider.createReflect("nmsPacketPlayOutPlayerListHeaderFooter", PacketPlayOutPlayerListHeaderFooter.class) + .searchField("header", "a").searchField("header", "b"); + + provider.createReflect("nmsNBTTagEnd", NBTTagEnd.class); + provider.createReflect("nmsNBTTagList", NBTTagList.class).searchField("value", "list"); + + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/tools/BlockTools1_11_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/tools/BlockTools1_11_R1.java new file mode 100644 index 0000000..2f251c9 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/tools/BlockTools1_11_R1.java @@ -0,0 +1,39 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_11_R1.tools; + +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_11_R1.block.CraftSkull; + +import com.mojang.authlib.properties.Property; +import com.mojang.authlib.properties.PropertyMap; +import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; +import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.minecraft.server.v1_11_R1.TileEntitySkull; +import net.sourcewriters.minecraft.vcompat.reflection.tools.BlockTools; +import net.sourcewriters.minecraft.vcompat.utils.constants.MinecraftConstants; + +public class BlockTools1_11_R1 extends BlockTools { + + private final AbstractReflect craftEntityStateRef = new Reflect(CraftSkull.class).searchField("tileEntity", "tileEntity"); + + @Override + public void setHeadTexture(Block block, String texture) { + if (!(block instanceof CraftSkull)) { + return; + } + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + PropertyMap map = entitySkull.getGameProfile().getProperties(); + map.removeAll("textures"); + map.put("textures", new Property("textures", MinecraftConstants.TEXTURE_SIGNATURE, texture)); + } + + @Override + public String getHeadTexture(Block block) { + if (!(block instanceof CraftSkull)) { + return null; + } + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + return entitySkull.getGameProfile().getProperties().get("textures").iterator().next().getValue(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/tools/ServerTools1_11_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/tools/ServerTools1_11_R1.java new file mode 100644 index 0000000..725d6eb --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/tools/ServerTools1_11_R1.java @@ -0,0 +1,26 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_11_R1.tools; + +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_11_R1.CraftServer; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_11_R1.wrapper.ConsoleReaderWrapper1_11_R1; +import net.sourcewriters.minecraft.vcompat.reflection.tools.ServerTools; + +public class ServerTools1_11_R1 extends ServerTools { + + @Override + public void setMotd(String text) { + ((CraftServer) Bukkit.getServer()).getServer().setMotd(text); + } + + @Override + public String getMotd() { + return ((CraftServer) Bukkit.getServer()).getServer().getMotd(); + } + + @Override + public ConsoleReaderWrapper1_11_R1 getConsole() { + return ConsoleReaderWrapper1_11_R1.INSTANCE; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/tools/SkinTools1_11_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/tools/SkinTools1_11_R1.java new file mode 100644 index 0000000..24793f9 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/tools/SkinTools1_11_R1.java @@ -0,0 +1,16 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_11_R1.tools; + +import org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer; +import org.bukkit.entity.Player; + +import net.sourcewriters.minecraft.vcompat.reflection.tools.SkinTools; +import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; + +public class SkinTools1_11_R1 extends SkinTools { + + @Override + public Skin skinFromPlayer(Player player) { + return skinFromGameProfile(((CraftPlayer) player).getHandle().getProfile()); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/utils/EntityConstructors1_11_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/utils/EntityConstructors1_11_R1.java new file mode 100644 index 0000000..3a2b018 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/utils/EntityConstructors1_11_R1.java @@ -0,0 +1,12 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_11_R1.utils; + +import java.util.function.Function; + +import net.minecraft.server.v1_11_R1.World; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_11_R1.entity.ArmorStand1_11_R1; + +public abstract class EntityConstructors1_11_R1 { + + public static final Function ARMOR_STAND = (world -> new ArmorStand1_11_R1(world)); + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/wrapper/ConsoleReaderWrapper1_11_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/wrapper/ConsoleReaderWrapper1_11_R1.java new file mode 100644 index 0000000..d570129 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/wrapper/ConsoleReaderWrapper1_11_R1.java @@ -0,0 +1,43 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_11_R1.wrapper; + +import java.io.IOException; +import java.io.Writer; + +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_11_R1.CraftServer; +import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; + +import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; + +public final class ConsoleReaderWrapper1_11_R1 extends ConsoleReaderWrapper { + + public static final ConsoleReaderWrapper1_11_R1 INSTANCE = new ConsoleReaderWrapper1_11_R1(); + + private final ConsoleReader reader; + + @SuppressWarnings("resource") + private ConsoleReaderWrapper1_11_R1() { + this.reader = ((CraftServer) Bukkit.getServer()).getServer().reader; + } + + @Override + public Writer getOutput() { + return reader.getOutput(); + } + + @Override + public boolean isAnsiSupported() { + return reader.getTerminal().isAnsiSupported(); + } + + @Override + public void flush() throws IOException { + reader.flush(); + } + + @Override + public void drawLine() throws IOException { + reader.drawLine(); + } + +} diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/BukkitConversion1_12_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/BukkitConversion1_12_R1.java new file mode 100644 index 0000000..6a56a31 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/BukkitConversion1_12_R1.java @@ -0,0 +1,226 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_12_R1; + +import java.util.List; +import java.util.Set; + +import org.bukkit.craftbukkit.v1_12_R1.inventory.CraftItemStack; +import org.bukkit.entity.EntityType; + +import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; +import com.syntaxphoenix.syntaxapi.data.DataType; +import com.syntaxphoenix.syntaxapi.nbt.NbtByte; +import com.syntaxphoenix.syntaxapi.nbt.NbtByteArray; +import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; +import com.syntaxphoenix.syntaxapi.nbt.NbtDouble; +import com.syntaxphoenix.syntaxapi.nbt.NbtEnd; +import com.syntaxphoenix.syntaxapi.nbt.NbtFloat; +import com.syntaxphoenix.syntaxapi.nbt.NbtInt; +import com.syntaxphoenix.syntaxapi.nbt.NbtIntArray; +import com.syntaxphoenix.syntaxapi.nbt.NbtList; +import com.syntaxphoenix.syntaxapi.nbt.NbtLong; +import com.syntaxphoenix.syntaxapi.nbt.NbtLongArray; +import com.syntaxphoenix.syntaxapi.nbt.NbtShort; +import com.syntaxphoenix.syntaxapi.nbt.NbtString; +import com.syntaxphoenix.syntaxapi.nbt.NbtTag; +import com.syntaxphoenix.syntaxapi.nbt.NbtType; + +import net.minecraft.server.v1_12_R1.ItemStack; +import net.minecraft.server.v1_12_R1.NBTBase; +import net.minecraft.server.v1_12_R1.NBTTagByte; +import net.minecraft.server.v1_12_R1.NBTTagByteArray; +import net.minecraft.server.v1_12_R1.NBTTagCompound; +import net.minecraft.server.v1_12_R1.NBTTagDouble; +import net.minecraft.server.v1_12_R1.NBTTagEnd; +import net.minecraft.server.v1_12_R1.NBTTagFloat; +import net.minecraft.server.v1_12_R1.NBTTagInt; +import net.minecraft.server.v1_12_R1.NBTTagIntArray; +import net.minecraft.server.v1_12_R1.NBTTagList; +import net.minecraft.server.v1_12_R1.NBTTagLong; +import net.minecraft.server.v1_12_R1.NBTTagLongArray; +import net.minecraft.server.v1_12_R1.NBTTagShort; +import net.minecraft.server.v1_12_R1.NBTTagString; +import net.sourcewriters.minecraft.vcompat.reflection.BukkitConversion; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContext; +import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleWrapType; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; +import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; + +public class BukkitConversion1_12_R1 extends BukkitConversion { + + protected BukkitConversion1_12_R1(VersionControl1_12_R1 versionControl) { + super(versionControl); + } + + @Override + public EntityType toEntityType(NmsEntityType type) { + try { + return EntityType.valueOf(type.name()); + } catch (IllegalArgumentException ignore) { + return null; + } + } + + @Override + public NmsEntityType fromEntityType(EntityType type) { + try { + return NmsEntityType.valueOf(type.name()); + } catch (IllegalArgumentException ignore) { + return null; + } + } + + @Override + public NBTBase toMinecraftTag(NbtTag tag) { + switch (tag.getType()) { + case BYTE: + return new NBTTagByte((byte) tag.getValue()); + case SHORT: + return new NBTTagShort((short) tag.getValue()); + case INT: + return new NBTTagInt((int) tag.getValue()); + case LONG: + return new NBTTagLong((long) tag.getValue()); + case FLOAT: + return new NBTTagFloat((float) tag.getValue()); + case DOUBLE: + return new NBTTagDouble((double) tag.getValue()); + case STRING: + return new NBTTagString((String) tag.getValue()); + case BYTE_ARRAY: + return new NBTTagByteArray((byte[]) tag.getValue()); + case INT_ARRAY: + return new NBTTagIntArray((int[]) tag.getValue()); + case LONG_ARRAY: + return new NBTTagLongArray((long[]) tag.getValue()); + case LIST: + return toMinecraftList((NbtList) tag); + case COMPOUND: + return toMinecraftCompound((NbtCompound) tag); + case END: + return (NBTTagEnd) ReflectionProvider.DEFAULT.getReflect("nmsNBTTagEnd").init(); + default: + return null; + } + } + + @Override + public NbtTag fromMinecraftTag(Object raw) { + if (!(raw instanceof NBTBase)) { + return null; + } + NBTBase tag = (NBTBase) raw; + NbtType type = NbtType.getById(tag.getTypeId()); + switch (type) { + case BYTE: + return new NbtByte(((NBTTagByte) tag).g()); + case SHORT: + return new NbtShort(((NBTTagShort) tag).f()); + case INT: + return new NbtInt(((NBTTagInt) tag).e()); + case LONG: + return new NbtLong(((NBTTagLong) tag).d()); + case FLOAT: + return new NbtFloat(((NBTTagFloat) tag).i()); + case DOUBLE: + return new NbtDouble(((NBTTagDouble) tag).asDouble()); + case STRING: + return new NbtString(((NBTTagString) tag).c_()); + case BYTE_ARRAY: + return new NbtByteArray(((NBTTagByteArray) tag).c()); + case INT_ARRAY: + return new NbtIntArray(((NBTTagIntArray) tag).d()); + case LONG_ARRAY: + return new NbtLongArray( + (long[]) ReflectionProvider.DEFAULT.getReflect("nmsNBTTagLongArray").getFieldValue("value", ((NBTTagLongArray) tag).c())); + case LIST: + return fromMinecraftList(tag); + case COMPOUND: + return fromMinecraftCompound(tag); + case END: + return NbtEnd.INSTANCE; + default: + return null; + } + } + + @Override + public NBTTagList toMinecraftList(NbtList list) { + NBTTagList output = new NBTTagList(); + for (NbtTag tag : list) { + output.add(toMinecraftTag(tag)); + } + return output; + } + + @SuppressWarnings("unchecked") + @Override + public NbtList fromMinecraftList(Object raw) { + if (!(raw instanceof NBTTagList)) { + return null; + } + NBTTagList list = (NBTTagList) raw; + List content = (List) ReflectionProvider.DEFAULT.getReflect("nmsNBTTagList").getFieldValue("value", list); + NbtList output = new NbtList<>(NbtType.getById(list.getTypeId())); + for (NBTBase base : content) { + output.add(fromMinecraftTag(base)); + } + return output; + } + + @Override + public NBTTagCompound toMinecraftCompound(NbtCompound compound) { + NBTTagCompound output = new NBTTagCompound(); + if (compound.isEmpty()) { + return output; + } + Set keys = compound.getKeys(); + for (String key : keys) { + output.set(key, toMinecraftTag(compound.get(key))); + } + return output; + } + + @Override + public NbtCompound fromMinecraftCompound(Object raw) { + if (!(raw instanceof NBTTagCompound)) { + return null; + } + NBTTagCompound compound = (NBTTagCompound) raw; + NbtCompound output = new NbtCompound(); + if (compound.isEmpty()) { + return output; + } + Set keys = compound.c(); + for (String key : keys) { + output.set(key, fromMinecraftTag(compound.get(key))); + } + return output; + } + + @Override + public org.bukkit.inventory.ItemStack itemFromCompound(NbtCompound compound) { + return CraftItemStack.asBukkitCopy(new ItemStack(toMinecraftCompound(compound))); + } + + @Override + public NbtCompound itemToCompound(org.bukkit.inventory.ItemStack itemStack) { + ItemStack nmsStack = CraftItemStack.asNMSCopy(itemStack); + if (!nmsStack.hasTag()) { + nmsStack.convertStack(); + } + return fromMinecraftCompound(nmsStack.getTag()); + } + + @Override + public WrappedContext createContext(DataAdapterContext context) { + return new SimpleSyntaxContext(context); + } + + @Override + public WrapType wrap(DataType dataType) { + return new SimpleWrapType(dataType); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/EntityProvider1_12_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/EntityProvider1_12_R1.java new file mode 100644 index 0000000..2f98928 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/EntityProvider1_12_R1.java @@ -0,0 +1,47 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_12_R1; + +import java.util.EnumMap; +import java.util.function.Function; + +import org.bukkit.craftbukkit.v1_12_R1.CraftWorld; + +import net.minecraft.server.v1_12_R1.World; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_12_R1.utils.EntityConstructors1_12_R1; +import net.sourcewriters.minecraft.vcompat.reflection.EntityProvider; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; + +public class EntityProvider1_12_R1 extends EntityProvider { + + private final EnumMap> entityMap = new EnumMap<>(NmsEntityType.class); + + protected EntityProvider1_12_R1(VersionControl1_12_R1 versionControl) { + super(versionControl); + } + + @SuppressWarnings("unchecked") + private final Function searchConstructor(NmsEntityType type) { + try { + return (Function) EntityConstructors1_12_R1.class.getField(type.name()).get(null); + } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException ignore) { + return null; + } + } + + private final Function getConstructor(NmsEntityType type) { + return entityMap.computeIfAbsent(type, (key -> searchConstructor(key))); + } + + @Override + public NmsEntity createEntity(org.bukkit.World world, NmsEntityType type) { + if (!(world instanceof CraftWorld)) { + return null; + } + Function function; + if ((function = getConstructor(type)) == null) { + return null; + } + return function.apply(((CraftWorld) world).getHandle()); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/PacketHandler1_12_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/PacketHandler1_12_R1.java new file mode 100644 index 0000000..06f1d27 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/PacketHandler1_12_R1.java @@ -0,0 +1,11 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_12_R1; + +import net.sourcewriters.minecraft.vcompat.reflection.PacketHandler; + +public class PacketHandler1_12_R1 extends PacketHandler { + + protected PacketHandler1_12_R1(VersionControl1_12_R1 versionControl) { + super(versionControl); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/PlayerProvider1_12_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/PlayerProvider1_12_R1.java new file mode 100644 index 0000000..32da3b2 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/PlayerProvider1_12_R1.java @@ -0,0 +1,30 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_12_R1; + +import java.io.File; +import java.util.UUID; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_12_R1.entity.Player1_12_R1; +import net.sourcewriters.minecraft.vcompat.reflection.DataProvider; +import net.sourcewriters.minecraft.vcompat.reflection.PlayerProvider; +import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.DataDistributor; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; + +public class PlayerProvider1_12_R1 extends PlayerProvider { + + private final DataDistributor distributor; + + protected PlayerProvider1_12_R1(VersionControl1_12_R1 versionControl) { + super(versionControl); + distributor = versionControl.getDataProvider().createDistributor(new File(Bukkit.getWorlds().get(0).getWorldFolder(), "playerdata"), + uuid -> "custom_" + uuid.toString(), DataProvider.DEFAULT_RANDOM); + } + + @Override + protected NmsPlayer createPlayer(Player player) { + return new Player1_12_R1(player, distributor.get(player.getUniqueId())); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/TextureProvider1_12_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/TextureProvider1_12_R1.java new file mode 100644 index 0000000..f305153 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/TextureProvider1_12_R1.java @@ -0,0 +1,108 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_12_R1; + +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_12_R1.block.CraftBlockEntityState; +import org.bukkit.craftbukkit.v1_12_R1.block.CraftSkull; +import org.bukkit.craftbukkit.v1_12_R1.inventory.CraftItemStack; +import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.inventory.meta.SkullMeta; +import org.bukkit.material.MaterialData; + +import com.mojang.authlib.GameProfile; +import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; +import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.minecraft.server.v1_12_R1.GameProfileSerializer; +import net.minecraft.server.v1_12_R1.ItemStack; +import net.minecraft.server.v1_12_R1.NBTTagCompound; +import net.minecraft.server.v1_12_R1.TileEntitySkull; +import net.sourcewriters.minecraft.vcompat.reflection.TextureProvider; + +@SuppressWarnings("deprecation") +public class TextureProvider1_12_R1 extends TextureProvider { + + private final AbstractReflect craftEntityStateRef = new Reflect(CraftBlockEntityState.class).searchField("tileEntity", "tileEntity"); + private final AbstractReflect craftItemStackRef = new Reflect(CraftItemStack.class).searchField("handle", "handle"); + private final AbstractReflect craftMetaSkullRef = new Reflect("org.bukkit.craftbukkit.v1_12_R1.inventory.CraftMetaSkull") + .searchField("serialized", "serializedProfile").searchField("profile", "profile"); + private final Material skullMaterial = Material.valueOf("SKULL"); + + protected TextureProvider1_12_R1(VersionControl1_12_R1 versionControl) { + super(versionControl); + } + + @Override + public GameProfile profileFromBlock(Block block) { + if (!(block instanceof CraftSkull)) { + return null; + } + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + return entitySkull.getGameProfile(); + } + + @Override + public GameProfile profileFromItem(org.bukkit.inventory.ItemStack itemStack) { + if (!(itemStack.getItemMeta() instanceof SkullMeta)) { + return null; + } + SkullMeta meta = (SkullMeta) itemStack.getItemMeta(); + GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue("profile", meta); + if (profile == null) { + NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue("serialized", meta); + if (compound == null) { + ItemStack stack = null; + if (itemStack instanceof CraftItemStack) { + stack = (ItemStack) craftItemStackRef.getFieldValue("handle", itemStack); + } + if (stack == null) { + stack = CraftItemStack.asNMSCopy(itemStack); + } + if (!stack.hasTag()) { + stack.convertStack(); + } + NBTTagCompound stackTag = stack.getTag(); + if (stackTag.hasKeyOfType("SkullOwner", 10)) { + compound = stackTag.getCompound("SkullOwner"); + } else if (stackTag.hasKeyOfType("SkullProfile", 10)) { + compound = stackTag.getCompound("SkullProfile"); + } + } + if (compound == null) { + return null; + } + profile = GameProfileSerializer.deserialize(compound); + } + return profile; + } + + @Override + public org.bukkit.inventory.ItemStack getItem(GameProfile profile) { + org.bukkit.inventory.ItemStack craftStack = CraftItemStack.asCraftCopy(new MaterialData(skullMaterial, (byte) 3).toItemStack(1)); + applyItem(craftStack, profile); + return craftStack; + } + + @Override + public boolean applyItem(org.bukkit.inventory.ItemStack itemStack, GameProfile profile) { + ItemMeta meta = itemStack.getItemMeta(); + if (!(meta instanceof SkullMeta)) { + return false; + } + SkullMeta skullMeta = (SkullMeta) meta; + craftMetaSkullRef.setFieldValue(meta, "profile", profile); + itemStack.setItemMeta(skullMeta); + return true; + } + + @Override + public boolean applyBlock(Block block, GameProfile profile) { + if (!(block instanceof CraftSkull)) { + return false; + } + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + entitySkull.setGameProfile(profile); + return true; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/ToolProvider1_12_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/ToolProvider1_12_R1.java new file mode 100644 index 0000000..a9da0dc --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/ToolProvider1_12_R1.java @@ -0,0 +1,33 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_12_R1; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_12_R1.tools.BlockTools1_12_R1; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_12_R1.tools.ServerTools1_12_R1; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_12_R1.tools.SkinTools1_12_R1; +import net.sourcewriters.minecraft.vcompat.reflection.ToolProvider; + +public class ToolProvider1_12_R1 extends ToolProvider { + + private final BlockTools1_12_R1 blockTools = new BlockTools1_12_R1(); + private final SkinTools1_12_R1 skinTools = new SkinTools1_12_R1(); + private final ServerTools1_12_R1 serverTools = new ServerTools1_12_R1(); + + protected ToolProvider1_12_R1(VersionControl1_12_R1 versionControl) { + super(versionControl); + } + + @Override + public SkinTools1_12_R1 getSkinTools() { + return skinTools; + } + + @Override + public ServerTools1_12_R1 getServerTools() { + return serverTools; + } + + @Override + public BlockTools1_12_R1 getBlockTools() { + return blockTools; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/VersionControl1_12_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/VersionControl1_12_R1.java new file mode 100644 index 0000000..e48d23f --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/VersionControl1_12_R1.java @@ -0,0 +1,56 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_12_R1; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_12_R1.reflection.NmsReflection1_12_R1; +import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; +import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; + +public class VersionControl1_12_R1 extends VersionControl { + + public static VersionControl1_12_R1 INSTANCE; + + public static VersionControl1_12_R1 init() { + return INSTANCE != null ? INSTANCE : (INSTANCE = new VersionControl1_12_R1()); + } + + private final ToolProvider1_12_R1 toolProvider = new ToolProvider1_12_R1(this); + private final TextureProvider1_12_R1 textureProvider = new TextureProvider1_12_R1(this); + private final PacketHandler1_12_R1 packetHandler = new PacketHandler1_12_R1(this); + private final EntityProvider1_12_R1 entityProvider = new EntityProvider1_12_R1(this); + private final PlayerProvider1_12_R1 playerProvider = new PlayerProvider1_12_R1(this); + private final BukkitConversion1_12_R1 bukkitConversion = new BukkitConversion1_12_R1(this); + + private VersionControl1_12_R1() { + NmsReflection1_12_R1.INSTANCE.setup(ReflectionProvider.DEFAULT); + } + + @Override + public ToolProvider1_12_R1 getToolProvider() { + return toolProvider; + } + + @Override + public EntityProvider1_12_R1 getEntityProvider() { + return entityProvider; + } + + @Override + public PlayerProvider1_12_R1 getPlayerProvider() { + return playerProvider; + } + + @Override + public TextureProvider1_12_R1 getTextureProvider() { + return textureProvider; + } + + @Override + public PacketHandler1_12_R1 getPacketHandler() { + return packetHandler; + } + + @Override + public BukkitConversion1_12_R1 getBukkitConversion() { + return bukkitConversion; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/entity/ArmorStand1_12_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/entity/ArmorStand1_12_R1.java new file mode 100644 index 0000000..cd1e68a --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/entity/ArmorStand1_12_R1.java @@ -0,0 +1,23 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_12_R1.entity; + +import net.minecraft.server.v1_12_R1.EntityArmorStand; +import net.minecraft.server.v1_12_R1.World; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsArmorStand; + +public class ArmorStand1_12_R1 extends EntityLiving1_12_R1 implements NmsArmorStand { + + public ArmorStand1_12_R1(World world) { + super(new EntityArmorStand(world)); + } + + @Override + public void setSmall(boolean small) { + handle.setSmall(small); + } + + @Override + public boolean isSmall() { + return handle.isSmall(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/entity/Entity1_12_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/entity/Entity1_12_R1.java new file mode 100644 index 0000000..671e122 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/entity/Entity1_12_R1.java @@ -0,0 +1,215 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_12_R1.entity; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.UUID; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.OfflinePlayer; +import org.bukkit.craftbukkit.v1_12_R1.CraftWorld; +import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer; +import org.bukkit.entity.Player; + +import net.minecraft.server.v1_12_R1.AxisAlignedBB; +import net.minecraft.server.v1_12_R1.Entity; +import net.minecraft.server.v1_12_R1.EntityTypes; +import net.minecraft.server.v1_12_R1.PacketPlayOutEntityDestroy; +import net.minecraft.server.v1_12_R1.PacketPlayOutEntityMetadata; +import net.minecraft.server.v1_12_R1.PacketPlayOutSpawnEntity; +import net.minecraft.server.v1_12_R1.PlayerConnection; +import net.minecraft.server.v1_12_R1.Vec3D; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.reflection.utils.NmsBoundingBox; + +public abstract class Entity1_12_R1 implements NmsEntity { + + protected final E handle; + + protected final List visible = Collections.synchronizedList(new ArrayList<>()); + + public Entity1_12_R1(E handle) { + this.handle = handle; + } + + @Override + public final E getHandle() { + return handle; + } + + @Override + public int getId() { + return handle.getId(); + } + + @Override + public UUID getUniqueId() { + return handle.getUniqueID(); + } + + @Override + public NmsBoundingBox getBoundingBox() { + AxisAlignedBB box = handle.getBoundingBox(); + return new NmsBoundingBox(box.a, box.b, box.c, box.d, box.e, box.f); + } + + @Override + public void setCustomName(String name) { + handle.setCustomName(name); + updateVisibility(); + } + + @Override + public String getCustomName() { + return handle.getCustomName(); + } + + @Override + public void setGravity(boolean gravity) { + handle.setNoGravity(!gravity); + } + + @Override + public boolean hasGravity() { + return !handle.isNoGravity(); + } + + @Override + public void setCustomNameVisible(boolean visible) { + handle.setCustomNameVisible(visible); + } + + @Override + public boolean isCustomNameVisible() { + return handle.getCustomNameVisible(); + } + + @Override + public void setInvisible(boolean invisible) { + handle.setInvisible(invisible); + } + + @Override + public boolean isInvisible() { + return handle.isInvisible(); + } + + @Override + public boolean isInteractable() { + return handle.isInteractable(); + } + + @Override + public boolean isCollidable() { + return handle.isCollidable(); + } + + @Override + public void setInvulnerable(boolean invulnerable) { + handle.setInvulnerable(invulnerable); + } + + @Override + public boolean isInvulnerable() { + return handle.be(); + } + + @Override + public void setLocation(Location location) { + handle.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); + if (location.getWorld() == null || handle.getWorld().getWorld() == location.getWorld()) { + updateVisibility(); + return; + } + handle.world = ((CraftWorld) location.getWorld()).getHandle(); + updateVisibility(); + } + + @Override + public Location getLocation() { + Vec3D vector = handle.d(); + return new Location(handle.getWorld().getWorld(), vector.x, vector.y, vector.z); + } + + @Override + public void updateVisibility() { + if (visible.isEmpty()) { + return; + } + Player[] players; + synchronized (visible) { + players = visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) + .toArray(Player[]::new); + } + hide(players); + show(players); + } + + @Override + public boolean isShown(Player player) { + synchronized (visible) { + return visible.contains(player.getUniqueId()); + } + } + + @Override + public void hide(Player... players) { + if (players.length == 0) { + return; + } + PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(handle.getId()); + for (Player player : players) { + if (!isShown(player)) { + continue; + } + ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); + synchronized (visible) { + visible.remove(player.getUniqueId()); + } + } + } + + @Override + public void show(Player... players) { + if (players.length == 0) { + return; + } + PacketPlayOutSpawnEntity packet = new PacketPlayOutSpawnEntity(handle, EntityTypes.b.a(handle.getClass())); + PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); + PlayerConnection connection; + for (Player player : players) { + if (isShown(player)) { + continue; + } + connection = ((CraftPlayer) player).getHandle().playerConnection; + connection.sendPacket(packet); + connection.sendPacket(metadataPacket); + synchronized (visible) { + visible.add(player.getUniqueId()); + } + } + } + + @Override + public UUID[] getVisible() { + synchronized (visible) { + return visible.toArray(new UUID[0]); + } + } + + @Override + public Player[] getVisibleAsPlayer() { + synchronized (visible) { + return visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) + .toArray(Player[]::new); + } + } + + @Override + public void kill() { + hide(getVisibleAsPlayer()); + handle.die(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/entity/EntityLiving1_12_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/entity/EntityLiving1_12_R1.java new file mode 100644 index 0000000..21e3160 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/entity/EntityLiving1_12_R1.java @@ -0,0 +1,17 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_12_R1.entity; + +import net.minecraft.server.v1_12_R1.EntityLiving; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityLiving; + +public abstract class EntityLiving1_12_R1 extends Entity1_12_R1 implements NmsEntityLiving { + + public EntityLiving1_12_R1(E handle) { + super(handle); + } + + @Override + public void setCollidable(boolean collidable) { + handle.collides = collidable; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/entity/Player1_12_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/entity/Player1_12_R1.java new file mode 100644 index 0000000..b944865 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/entity/Player1_12_R1.java @@ -0,0 +1,295 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_12_R1.entity; + +import java.util.ArrayList; +import java.util.Collections; + +import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_12_R1.util.CraftChatMessage; +import org.bukkit.entity.Player; + +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.properties.Property; +import com.mojang.authlib.properties.PropertyMap; +import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.minecraft.server.v1_12_R1.EntityPlayer; +import net.minecraft.server.v1_12_R1.EnumItemSlot; +import net.minecraft.server.v1_12_R1.IChatBaseComponent; +import net.minecraft.server.v1_12_R1.MathHelper; +import net.minecraft.server.v1_12_R1.PacketPlayInClientCommand; +import net.minecraft.server.v1_12_R1.PacketPlayInClientCommand.EnumClientCommand; +import net.minecraft.server.v1_12_R1.PacketPlayOutEntityDestroy; +import net.minecraft.server.v1_12_R1.PacketPlayOutEntityEquipment; +import net.minecraft.server.v1_12_R1.PacketPlayOutEntityHeadRotation; +import net.minecraft.server.v1_12_R1.PacketPlayOutEntityMetadata; +import net.minecraft.server.v1_12_R1.PacketPlayOutEntityStatus; +import net.minecraft.server.v1_12_R1.PacketPlayOutHeldItemSlot; +import net.minecraft.server.v1_12_R1.PacketPlayOutNamedEntitySpawn; +import net.minecraft.server.v1_12_R1.PacketPlayOutPlayerInfo; +import net.minecraft.server.v1_12_R1.PacketPlayOutPlayerInfo.EnumPlayerInfoAction; +import net.minecraft.server.v1_12_R1.PacketPlayOutPlayerListHeaderFooter; +import net.minecraft.server.v1_12_R1.PacketPlayOutPosition; +import net.minecraft.server.v1_12_R1.PacketPlayOutRespawn; +import net.minecraft.server.v1_12_R1.PacketPlayOutTitle; +import net.minecraft.server.v1_12_R1.PacketPlayOutTitle.EnumTitleAction; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.PersistentContainer; +import net.sourcewriters.minecraft.vcompat.reflection.data.type.SkinDataType; +import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContainer; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; +import net.sourcewriters.minecraft.vcompat.utils.bukkit.Players; +import net.sourcewriters.minecraft.vcompat.utils.minecraft.MojangProfileServer; +import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; +import net.sourcewriters.minecraft.vcompat.utils.thread.PostAsync; +import net.minecraft.server.v1_12_R1.PlayerConnection; +import net.minecraft.server.v1_12_R1.WorldServer; + +public class Player1_12_R1 extends EntityLiving1_12_R1 implements NmsPlayer { + + private String realName; + private Skin realSkin; + + private final WrappedContainer dataAdapter; + + public Player1_12_R1(Player player, PersistentContainer container) { + super(((CraftPlayer) player).getHandle()); + this.dataAdapter = new SimpleSyntaxContainer<>(container); + update(false); + } + + @Override + public CraftPlayer getBukkitPlayer() { + return handle.getBukkitEntity(); + } + + @Override + public WrappedContainer getDataAdapter() { + return dataAdapter; + } + + @Override + public void setSkin(Skin skin) { + if (skin == null || getSkin().equals(skin)) { + return; + } + getDataAdapter().set("skin", skin, SkinDataType.WRAPPED_INSTANCE); + } + + @Override + public Skin getSkin() { + return dataAdapter.getOrDefault("skin", SkinDataType.WRAPPED_INSTANCE, realSkin); + } + + @Override + public Skin getRealSkin() { + return realSkin; + } + + @Override + public void setName(String name) { + if (getName().equals(name)) { + return; + } + if (name == null) { + getDataAdapter().remove("name"); + return; + } + getDataAdapter().set("name", name, WrapType.STRING); + } + + @Override + public String getName() { + return getDataAdapter().getOrDefault("name", WrapType.STRING, realName); + } + + @Override + public String getRealName() { + return realName; + } + + @Override + public void setPlayerListHeader(String text) { + setPlayerListHeaderAndFooter(text, getPlayerListFooter()); + } + + @Override + public String getPlayerListHeader() { + return getDataAdapter().getOrDefault("header", WrapType.STRING, ""); + } + + @Override + public void setPlayerListFooter(String text) { + setPlayerListHeaderAndFooter(getPlayerListHeader(), text); + } + + @Override + public String getPlayerListFooter() { + return getDataAdapter().getOrDefault("footer", WrapType.STRING, ""); + } + + @Override + public int getPing() { + return handle.ping; + } + + @Override + public void setPlayerListHeaderAndFooter(String header, String footer) { + getDataAdapter().set("header", header, WrapType.STRING); + getDataAdapter().set("footer", footer, WrapType.STRING); + sendPlayerListInfo(header, footer); + } + + private final void sendPlayerListInfo(String header, String footer) { + if (handle.playerConnection.isDisconnected()) { + return; + } + + IChatBaseComponent headerComponent = header.isEmpty() ? null : CraftChatMessage.fromString(header, true)[0]; + IChatBaseComponent footerComponent = footer.isEmpty() ? null : CraftChatMessage.fromString(footer, true)[0]; + + PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter(); + + Reflect reflect = ReflectionProvider.DEFAULT.getReflect("nmsPacketPlayOutPlayerListHeaderFooter"); + reflect.setFieldValue(packet, "header", headerComponent); + reflect.setFieldValue(packet, "footer", footerComponent); + + handle.playerConnection.sendPacket(packet); + } + + @Override + public void setTitleTimes(int fadeIn, int stay, int fadeOut) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TIMES, null, fadeIn, stay, fadeOut)); + } + + @Override + public void sendSubtitle(String text) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.SUBTITLE, CraftChatMessage.fromString(text)[0])); + } + + @Override + public void sendTitle(String text) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TITLE, CraftChatMessage.fromString(text)[0])); + } + + @Override + public void sendActionBar(String text) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.ACTIONBAR, CraftChatMessage.fromString(text)[0])); + } + + @Override + public void fakeRespawn() { + if (handle.playerConnection.isDisconnected()) { + return; + } + PacketPlayOutPlayerInfo remInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER, handle); + PacketPlayOutPlayerInfo addInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.ADD_PLAYER, handle); + + PacketPlayOutEntityDestroy destroyPacket = new PacketPlayOutEntityDestroy(handle.getId()); + PacketPlayOutNamedEntitySpawn spawnPacket = new PacketPlayOutNamedEntitySpawn(handle); + PacketPlayOutEntityHeadRotation rotationPacket = new PacketPlayOutEntityHeadRotation(handle, + (byte) MathHelper.d(handle.getHeadRotation() * 256F / 360F)); + + ArrayList equipmentPackets = new ArrayList<>(); + for (EnumItemSlot slot : EnumItemSlot.values()) { + equipmentPackets.add(new PacketPlayOutEntityEquipment(handle.getId(), slot, handle.getEquipment(slot))); + } + + Player self = getBukkitPlayer(); + Player[] players = Players.getOnlineWithout(getUniqueId()); + for (Player player : players) { + if (!player.canSee(self)) { + continue; + } + PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection; + connection.sendPacket(remInfoPacket); + connection.sendPacket(addInfoPacket); + connection.sendPacket(destroyPacket); + connection.sendPacket(spawnPacket); + connection.sendPacket(rotationPacket); + for (PacketPlayOutEntityEquipment equipmentPacket : equipmentPackets) { + connection.sendPacket(equipmentPacket); + } + } + + WorldServer world = (WorldServer) handle.world; + + PacketPlayOutRespawn respawnPacket = new PacketPlayOutRespawn(handle.dimension, world.getDifficulty(), + handle.world.worldData.getType(), handle.playerInteractManager.getGameMode()); + PacketPlayOutPosition positionPacket = new PacketPlayOutPosition(handle.locX, handle.locY, handle.locZ, handle.yaw, handle.pitch, + Collections.emptySet(), 0); + PacketPlayOutHeldItemSlot itemPacket = new PacketPlayOutHeldItemSlot(handle.inventory.itemInHandIndex); + PacketPlayOutEntityStatus statusPacket = new PacketPlayOutEntityStatus(handle, (byte) 28); + PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); + + PlayerConnection connection = handle.playerConnection; + connection.sendPacket(remInfoPacket); + connection.sendPacket(addInfoPacket); + connection.sendPacket(respawnPacket); + connection.sendPacket(positionPacket); + connection.sendPacket(itemPacket); + connection.sendPacket(statusPacket); + connection.sendPacket(metadataPacket); + + handle.updateAbilities(); + handle.triggerHealthUpdate(); + handle.updateInventory(handle.defaultContainer); + if (handle.activeContainer != handle.defaultContainer) { + handle.updateInventory(handle.activeContainer); + } + self.recalculatePermissions(); + } + + @Override + public void respawn() { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayInClientCommand(EnumClientCommand.PERFORM_RESPAWN)); + } + + @Override + public void update() { + update(true); + } + + private final void update(boolean flag) { + PostAsync.forcePost(() -> { + realName = MojangProfileServer.getName(getUniqueId()); + realSkin = MojangProfileServer.getSkin(realName, getUniqueId()); + }); + if (flag) { + GameProfile profile = handle.getProfile(); + + Skin skin = getSkin(); + if (skin != null) { + PropertyMap properties = profile.getProperties(); + properties.removeAll("textures"); + properties.put("textures", new Property("textures", skin.getValue(), skin.getSignature())); + } + + String name = getName(); + if (name != null) { + ReflectionProvider.DEFAULT.getReflect("mjGameProfile").setFieldValue(profile, "name", name); + } + + if (!(name == null && skin == null)) { + fakeRespawn(); + } + } + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/reflection/NmsReflection1_12_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/reflection/NmsReflection1_12_R1.java new file mode 100644 index 0000000..d9a473f --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/reflection/NmsReflection1_12_R1.java @@ -0,0 +1,36 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_12_R1.reflection; + +import net.minecraft.server.v1_12_R1.NBTTagEnd; +import net.minecraft.server.v1_12_R1.NBTTagList; +import net.minecraft.server.v1_12_R1.NBTTagLongArray; +import net.minecraft.server.v1_12_R1.PacketPlayOutPlayerListHeaderFooter; +import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; +import net.sourcewriters.minecraft.vcompat.reflection.reflect.Reflections; + +public class NmsReflection1_12_R1 extends Reflections { + + public static NmsReflection1_12_R1 INSTANCE = new NmsReflection1_12_R1(); + + private NmsReflection1_12_R1() {} + + @Override + public void setup(ReflectionProvider provider) { + + // + // + // Create Reflects + // + + // + // Minecraft + + provider.createReflect("nmsPacketPlayOutPlayerListHeaderFooter", PacketPlayOutPlayerListHeaderFooter.class) + .searchField("header", "a").searchField("header", "b"); + + provider.createReflect("nmsNBTTagEnd", NBTTagEnd.class); + provider.createReflect("nmsNBTTagLongArray", NBTTagLongArray.class).searchField("value", "b"); + provider.createReflect("nmsNBTTagList", NBTTagList.class).searchField("value", "list"); + + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/tools/BlockTools1_12_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/tools/BlockTools1_12_R1.java new file mode 100644 index 0000000..f4c9fed --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/tools/BlockTools1_12_R1.java @@ -0,0 +1,39 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_12_R1.tools; + +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_12_R1.block.CraftSkull; + +import com.mojang.authlib.properties.Property; +import com.mojang.authlib.properties.PropertyMap; +import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; +import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.minecraft.server.v1_12_R1.TileEntitySkull; +import net.sourcewriters.minecraft.vcompat.reflection.tools.BlockTools; +import net.sourcewriters.minecraft.vcompat.utils.constants.MinecraftConstants; + +public class BlockTools1_12_R1 extends BlockTools { + + private final AbstractReflect craftEntityStateRef = new Reflect(CraftSkull.class).searchField("tileEntity", "tileEntity"); + + @Override + public void setHeadTexture(Block block, String texture) { + if (!(block instanceof CraftSkull)) { + return; + } + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + PropertyMap map = entitySkull.getGameProfile().getProperties(); + map.removeAll("textures"); + map.put("textures", new Property("textures", MinecraftConstants.TEXTURE_SIGNATURE, texture)); + } + + @Override + public String getHeadTexture(Block block) { + if (!(block instanceof CraftSkull)) { + return null; + } + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + return entitySkull.getGameProfile().getProperties().get("textures").iterator().next().getValue(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/tools/ServerTools1_12_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/tools/ServerTools1_12_R1.java new file mode 100644 index 0000000..6b2f2ec --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/tools/ServerTools1_12_R1.java @@ -0,0 +1,26 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_12_R1.tools; + +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_12_R1.CraftServer; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_12_R1.wrapper.ConsoleReaderWrapper1_12_R1; +import net.sourcewriters.minecraft.vcompat.reflection.tools.ServerTools; + +public class ServerTools1_12_R1 extends ServerTools { + + @Override + public void setMotd(String text) { + ((CraftServer) Bukkit.getServer()).getServer().setMotd(text); + } + + @Override + public String getMotd() { + return ((CraftServer) Bukkit.getServer()).getServer().getMotd(); + } + + @Override + public ConsoleReaderWrapper1_12_R1 getConsole() { + return ConsoleReaderWrapper1_12_R1.INSTANCE; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/tools/SkinTools1_12_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/tools/SkinTools1_12_R1.java new file mode 100644 index 0000000..2da9ba3 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/tools/SkinTools1_12_R1.java @@ -0,0 +1,16 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_12_R1.tools; + +import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer; +import org.bukkit.entity.Player; + +import net.sourcewriters.minecraft.vcompat.reflection.tools.SkinTools; +import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; + +public class SkinTools1_12_R1 extends SkinTools { + + @Override + public Skin skinFromPlayer(Player player) { + return skinFromGameProfile(((CraftPlayer) player).getHandle().getProfile()); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/utils/EntityConstructors1_12_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/utils/EntityConstructors1_12_R1.java new file mode 100644 index 0000000..b66060d --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/utils/EntityConstructors1_12_R1.java @@ -0,0 +1,12 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_12_R1.utils; + +import java.util.function.Function; + +import net.minecraft.server.v1_12_R1.World; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_12_R1.entity.ArmorStand1_12_R1; + +public abstract class EntityConstructors1_12_R1 { + + public static final Function ARMOR_STAND = (world -> new ArmorStand1_12_R1(world)); + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/wrapper/ConsoleReaderWrapper1_12_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/wrapper/ConsoleReaderWrapper1_12_R1.java new file mode 100644 index 0000000..6694792 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/wrapper/ConsoleReaderWrapper1_12_R1.java @@ -0,0 +1,43 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_12_R1.wrapper; + +import java.io.IOException; +import java.io.Writer; + +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_12_R1.CraftServer; +import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; + +import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; + +public final class ConsoleReaderWrapper1_12_R1 extends ConsoleReaderWrapper { + + public static final ConsoleReaderWrapper1_12_R1 INSTANCE = new ConsoleReaderWrapper1_12_R1(); + + private final ConsoleReader reader; + + @SuppressWarnings("resource") + private ConsoleReaderWrapper1_12_R1() { + this.reader = ((CraftServer) Bukkit.getServer()).getServer().reader; + } + + @Override + public Writer getOutput() { + return reader.getOutput(); + } + + @Override + public boolean isAnsiSupported() { + return reader.getTerminal().isAnsiSupported(); + } + + @Override + public void flush() throws IOException { + reader.flush(); + } + + @Override + public void drawLine() throws IOException { + reader.drawLine(); + } + +} diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/BukkitConversion1_13_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/BukkitConversion1_13_R1.java new file mode 100644 index 0000000..9951502 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/BukkitConversion1_13_R1.java @@ -0,0 +1,218 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R1; + +import java.util.Set; + +import org.bukkit.craftbukkit.v1_13_R1.inventory.CraftItemStack; +import org.bukkit.entity.EntityType; + +import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; +import com.syntaxphoenix.syntaxapi.data.DataType; +import com.syntaxphoenix.syntaxapi.nbt.NbtByte; +import com.syntaxphoenix.syntaxapi.nbt.NbtByteArray; +import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; +import com.syntaxphoenix.syntaxapi.nbt.NbtDouble; +import com.syntaxphoenix.syntaxapi.nbt.NbtEnd; +import com.syntaxphoenix.syntaxapi.nbt.NbtFloat; +import com.syntaxphoenix.syntaxapi.nbt.NbtInt; +import com.syntaxphoenix.syntaxapi.nbt.NbtIntArray; +import com.syntaxphoenix.syntaxapi.nbt.NbtList; +import com.syntaxphoenix.syntaxapi.nbt.NbtLong; +import com.syntaxphoenix.syntaxapi.nbt.NbtLongArray; +import com.syntaxphoenix.syntaxapi.nbt.NbtShort; +import com.syntaxphoenix.syntaxapi.nbt.NbtString; +import com.syntaxphoenix.syntaxapi.nbt.NbtTag; +import com.syntaxphoenix.syntaxapi.nbt.NbtType; + +import net.minecraft.server.v1_13_R1.ItemStack; +import net.minecraft.server.v1_13_R1.NBTBase; +import net.minecraft.server.v1_13_R1.NBTNumber; +import net.minecraft.server.v1_13_R1.NBTTagByte; +import net.minecraft.server.v1_13_R1.NBTTagByteArray; +import net.minecraft.server.v1_13_R1.NBTTagCompound; +import net.minecraft.server.v1_13_R1.NBTTagDouble; +import net.minecraft.server.v1_13_R1.NBTTagEnd; +import net.minecraft.server.v1_13_R1.NBTTagFloat; +import net.minecraft.server.v1_13_R1.NBTTagInt; +import net.minecraft.server.v1_13_R1.NBTTagIntArray; +import net.minecraft.server.v1_13_R1.NBTTagList; +import net.minecraft.server.v1_13_R1.NBTTagLong; +import net.minecraft.server.v1_13_R1.NBTTagLongArray; +import net.minecraft.server.v1_13_R1.NBTTagShort; +import net.minecraft.server.v1_13_R1.NBTTagString; +import net.sourcewriters.minecraft.vcompat.reflection.BukkitConversion; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContext; +import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleWrapType; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; + +public class BukkitConversion1_13_R1 extends BukkitConversion { + + protected BukkitConversion1_13_R1(VersionControl1_13_R1 versionControl) { + super(versionControl); + } + + @Override + public EntityType toEntityType(NmsEntityType type) { + try { + return EntityType.valueOf(type.name()); + } catch (IllegalArgumentException ignore) { + return null; + } + } + + @Override + public NmsEntityType fromEntityType(EntityType type) { + try { + return NmsEntityType.valueOf(type.name()); + } catch (IllegalArgumentException ignore) { + return null; + } + } + + @Override + public NBTBase toMinecraftTag(NbtTag tag) { + switch (tag.getType()) { + case BYTE: + return new NBTTagByte((byte) tag.getValue()); + case SHORT: + return new NBTTagShort((short) tag.getValue()); + case INT: + return new NBTTagInt((int) tag.getValue()); + case LONG: + return new NBTTagLong((long) tag.getValue()); + case FLOAT: + return new NBTTagFloat((float) tag.getValue()); + case DOUBLE: + return new NBTTagDouble((double) tag.getValue()); + case STRING: + return new NBTTagString((String) tag.getValue()); + case BYTE_ARRAY: + return new NBTTagByteArray((byte[]) tag.getValue()); + case INT_ARRAY: + return new NBTTagIntArray((int[]) tag.getValue()); + case LONG_ARRAY: + return new NBTTagLongArray((long[]) tag.getValue()); + case LIST: + return toMinecraftList((NbtList) tag); + case COMPOUND: + return toMinecraftCompound((NbtCompound) tag); + case END: + return new NBTTagEnd(); + default: + return null; + } + } + + @Override + public NbtTag fromMinecraftTag(Object raw) { + if (!(raw instanceof NBTBase)) { + return null; + } + NBTBase tag = (NBTBase) raw; + NbtType type = NbtType.getById(tag.getTypeId()); + switch (type) { + case BYTE: + return new NbtByte(((NBTNumber) tag).g()); + case SHORT: + return new NbtShort(((NBTNumber) tag).f()); + case INT: + return new NbtInt(((NBTNumber) tag).e()); + case LONG: + return new NbtLong(((NBTNumber) tag).d()); + case FLOAT: + return new NbtFloat(((NBTNumber) tag).i()); + case DOUBLE: + return new NbtDouble(((NBTNumber) tag).asDouble()); + case STRING: + return new NbtString(((NBTTagString) tag).b_()); + case BYTE_ARRAY: + return new NbtByteArray(((NBTTagByteArray) tag).c()); + case INT_ARRAY: + return new NbtIntArray(((NBTTagIntArray) tag).d()); + case LONG_ARRAY: + return new NbtLongArray(((NBTTagLongArray) tag).d()); + case LIST: + return fromMinecraftList(tag); + case COMPOUND: + return fromMinecraftCompound(tag); + case END: + return NbtEnd.INSTANCE; + default: + return null; + } + } + + @Override + public NBTTagList toMinecraftList(NbtList list) { + NBTTagList output = new NBTTagList(); + for (NbtTag tag : list) { + output.add(toMinecraftTag(tag)); + } + return output; + } + + @Override + public NbtList fromMinecraftList(Object raw) { + if (!(raw instanceof NBTTagList)) { + return null; + } + NBTTagList list = (NBTTagList) raw; + NbtList output = new NbtList<>(NbtType.getById(list.getTypeId())); + for (NBTBase base : list) { + output.add(fromMinecraftTag(base)); + } + return output; + } + + @Override + public NBTTagCompound toMinecraftCompound(NbtCompound compound) { + NBTTagCompound output = new NBTTagCompound(); + if (compound.isEmpty()) { + return output; + } + Set keys = compound.getKeys(); + for (String key : keys) { + output.set(key, toMinecraftTag(compound.get(key))); + } + return output; + } + + @Override + public NbtCompound fromMinecraftCompound(Object raw) { + if (!(raw instanceof NBTTagCompound)) { + return null; + } + NBTTagCompound compound = (NBTTagCompound) raw; + NbtCompound output = new NbtCompound(); + if (compound.isEmpty()) { + return output; + } + Set keys = compound.getKeys(); + for (String key : keys) { + output.set(key, fromMinecraftTag(compound.get(key))); + } + return output; + } + + @Override + public org.bukkit.inventory.ItemStack itemFromCompound(NbtCompound compound) { + return CraftItemStack.asBukkitCopy(ItemStack.a(toMinecraftCompound(compound))); + } + + @Override + public NbtCompound itemToCompound(org.bukkit.inventory.ItemStack itemStack) { + return fromMinecraftCompound(CraftItemStack.asNMSCopy(itemStack).getOrCreateTag()); + } + + @Override + public WrappedContext createContext(DataAdapterContext context) { + return new SimpleSyntaxContext(context); + } + + @Override + public WrapType wrap(DataType dataType) { + return new SimpleWrapType(dataType); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/EntityProvider1_13_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/EntityProvider1_13_R1.java new file mode 100644 index 0000000..cea7280 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/EntityProvider1_13_R1.java @@ -0,0 +1,47 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R1; + +import java.util.EnumMap; +import java.util.function.Function; + +import org.bukkit.craftbukkit.v1_13_R1.CraftWorld; + +import net.minecraft.server.v1_13_R1.World; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R1.utils.EntityConstructors1_13_R1; +import net.sourcewriters.minecraft.vcompat.reflection.EntityProvider; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; + +public class EntityProvider1_13_R1 extends EntityProvider { + + private final EnumMap> entityMap = new EnumMap<>(NmsEntityType.class); + + protected EntityProvider1_13_R1(VersionControl1_13_R1 versionControl) { + super(versionControl); + } + + @SuppressWarnings("unchecked") + private final Function searchConstructor(NmsEntityType type) { + try { + return (Function) EntityConstructors1_13_R1.class.getField(type.name()).get(null); + } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException ignore) { + return null; + } + } + + private final Function getConstructor(NmsEntityType type) { + return entityMap.computeIfAbsent(type, (key -> searchConstructor(key))); + } + + @Override + public NmsEntity createEntity(org.bukkit.World world, NmsEntityType type) { + if (!(world instanceof CraftWorld)) { + return null; + } + Function function; + if ((function = getConstructor(type)) == null) { + return null; + } + return function.apply(((CraftWorld) world).getHandle()); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/PacketHandler1_13_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/PacketHandler1_13_R1.java new file mode 100644 index 0000000..a9a5199 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/PacketHandler1_13_R1.java @@ -0,0 +1,11 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R1; + +import net.sourcewriters.minecraft.vcompat.reflection.PacketHandler; + +public class PacketHandler1_13_R1 extends PacketHandler { + + protected PacketHandler1_13_R1(VersionControl1_13_R1 versionControl) { + super(versionControl); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/PlayerProvider1_13_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/PlayerProvider1_13_R1.java new file mode 100644 index 0000000..455ce44 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/PlayerProvider1_13_R1.java @@ -0,0 +1,30 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R1; + +import java.io.File; +import java.util.UUID; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R1.entity.Player1_13_R1; +import net.sourcewriters.minecraft.vcompat.reflection.DataProvider; +import net.sourcewriters.minecraft.vcompat.reflection.PlayerProvider; +import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.DataDistributor; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; + +public class PlayerProvider1_13_R1 extends PlayerProvider { + + private final DataDistributor distributor; + + protected PlayerProvider1_13_R1(VersionControl1_13_R1 versionControl) { + super(versionControl); + distributor = versionControl.getDataProvider().createDistributor(new File(Bukkit.getWorlds().get(0).getWorldFolder(), "playerdata"), + uuid -> "custom_" + uuid.toString(), DataProvider.DEFAULT_RANDOM); + } + + @Override + protected NmsPlayer createPlayer(Player player) { + return new Player1_13_R1(player, distributor.get(player.getUniqueId())); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/TextureProvider1_13_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/TextureProvider1_13_R1.java new file mode 100644 index 0000000..2d0ce51 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/TextureProvider1_13_R1.java @@ -0,0 +1,102 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R1; + +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_13_R1.block.CraftBlockEntityState; +import org.bukkit.craftbukkit.v1_13_R1.block.CraftSkull; +import org.bukkit.craftbukkit.v1_13_R1.inventory.CraftItemStack; +import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.inventory.meta.SkullMeta; + +import com.mojang.authlib.GameProfile; +import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; +import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.minecraft.server.v1_13_R1.GameProfileSerializer; +import net.minecraft.server.v1_13_R1.ItemStack; +import net.minecraft.server.v1_13_R1.NBTTagCompound; +import net.minecraft.server.v1_13_R1.TileEntitySkull; +import net.sourcewriters.minecraft.vcompat.reflection.TextureProvider; + +public class TextureProvider1_13_R1 extends TextureProvider { + + private final AbstractReflect craftEntityStateRef = new Reflect(CraftBlockEntityState.class).searchField("tileEntity", "tileEntity"); + private final AbstractReflect craftItemStackRef = new Reflect(CraftItemStack.class).searchField("handle", "handle"); + private final AbstractReflect craftMetaSkullRef = new Reflect("org.bukkit.craftbukkit.v1_13_R1.inventory.CraftMetaSkull") + .searchField("serialized", "serializedProfile").searchField("profile", "profile"); + + protected TextureProvider1_13_R1(VersionControl1_13_R1 versionControl) { + super(versionControl); + } + + @Override + public GameProfile profileFromBlock(Block block) { + if (!(block instanceof CraftSkull)) { + return null; + } + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + return entitySkull.getGameProfile(); + } + + @Override + public GameProfile profileFromItem(org.bukkit.inventory.ItemStack itemStack) { + if (!(itemStack.getItemMeta() instanceof SkullMeta)) { + return null; + } + SkullMeta meta = (SkullMeta) itemStack.getItemMeta(); + GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue("profile", meta); + if (profile == null) { + NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue("serialized", meta); + if (compound == null) { + ItemStack stack = null; + if (itemStack instanceof CraftItemStack) { + stack = (ItemStack) craftItemStackRef.getFieldValue("handle", itemStack); + } + if (stack == null) { + stack = CraftItemStack.asNMSCopy(itemStack); + } + NBTTagCompound stackTag = stack.getOrCreateTag(); + if (stackTag.hasKeyOfType("SkullOwner", 10)) { + compound = stackTag.getCompound("SkullOwner"); + } else if (stackTag.hasKeyOfType("SkullProfile", 10)) { + compound = stackTag.getCompound("SkullProfile"); + } + } + if (compound == null) { + return null; + } + profile = GameProfileSerializer.deserialize(compound); + } + return profile; + } + + @Override + public org.bukkit.inventory.ItemStack getItem(GameProfile profile) { + org.bukkit.inventory.ItemStack craftStack = CraftItemStack.asCraftCopy(new org.bukkit.inventory.ItemStack(Material.PLAYER_HEAD)); + applyItem(craftStack, profile); + return craftStack; + } + + @Override + public boolean applyItem(org.bukkit.inventory.ItemStack itemStack, GameProfile profile) { + ItemMeta meta = itemStack.getItemMeta(); + if (!(meta instanceof SkullMeta)) { + return false; + } + SkullMeta skullMeta = (SkullMeta) meta; + craftMetaSkullRef.setFieldValue(meta, "profile", profile); + itemStack.setItemMeta(skullMeta); + return true; + } + + @Override + public boolean applyBlock(Block block, GameProfile profile) { + if (!(block instanceof CraftSkull)) { + return false; + } + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + entitySkull.setGameProfile(profile); + return true; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/ToolProvider1_13_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/ToolProvider1_13_R1.java new file mode 100644 index 0000000..eeb27b6 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/ToolProvider1_13_R1.java @@ -0,0 +1,33 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R1; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R1.tools.BlockTools1_13_R1; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R1.tools.ServerTools1_13_R1; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R1.tools.SkinTools1_13_R1; +import net.sourcewriters.minecraft.vcompat.reflection.ToolProvider; + +public class ToolProvider1_13_R1 extends ToolProvider { + + private final BlockTools1_13_R1 blockTools = new BlockTools1_13_R1(); + private final SkinTools1_13_R1 skinTools = new SkinTools1_13_R1(); + private final ServerTools1_13_R1 serverTools = new ServerTools1_13_R1(); + + protected ToolProvider1_13_R1(VersionControl1_13_R1 versionControl) { + super(versionControl); + } + + @Override + public SkinTools1_13_R1 getSkinTools() { + return skinTools; + } + + @Override + public ServerTools1_13_R1 getServerTools() { + return serverTools; + } + + @Override + public BlockTools1_13_R1 getBlockTools() { + return blockTools; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/VersionControl1_13_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/VersionControl1_13_R1.java new file mode 100644 index 0000000..4308ae4 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/VersionControl1_13_R1.java @@ -0,0 +1,54 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R1; + +import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; + +public class VersionControl1_13_R1 extends VersionControl { + + public static VersionControl1_13_R1 INSTANCE; + + public static VersionControl1_13_R1 init() { + return INSTANCE != null ? INSTANCE : (INSTANCE = new VersionControl1_13_R1()); + } + + private final ToolProvider1_13_R1 toolProvider = new ToolProvider1_13_R1(this); + private final TextureProvider1_13_R1 textureProvider = new TextureProvider1_13_R1(this); + private final PacketHandler1_13_R1 packetHandler = new PacketHandler1_13_R1(this); + private final EntityProvider1_13_R1 entityProvider = new EntityProvider1_13_R1(this); + private final PlayerProvider1_13_R1 playerProvider = new PlayerProvider1_13_R1(this); + private final BukkitConversion1_13_R1 bukkitConversion = new BukkitConversion1_13_R1(this); + + private VersionControl1_13_R1() { + + } + + @Override + public ToolProvider1_13_R1 getToolProvider() { + return toolProvider; + } + + @Override + public EntityProvider1_13_R1 getEntityProvider() { + return entityProvider; + } + + @Override + public PlayerProvider1_13_R1 getPlayerProvider() { + return playerProvider; + } + + @Override + public TextureProvider1_13_R1 getTextureProvider() { + return textureProvider; + } + + @Override + public PacketHandler1_13_R1 getPacketHandler() { + return packetHandler; + } + + @Override + public BukkitConversion1_13_R1 getBukkitConversion() { + return bukkitConversion; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/entity/ArmorStand1_13_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/entity/ArmorStand1_13_R1.java new file mode 100644 index 0000000..c0f11f6 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/entity/ArmorStand1_13_R1.java @@ -0,0 +1,23 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R1.entity; + +import net.minecraft.server.v1_13_R1.EntityArmorStand; +import net.minecraft.server.v1_13_R1.World; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsArmorStand; + +public class ArmorStand1_13_R1 extends EntityLiving1_13_R1 implements NmsArmorStand { + + public ArmorStand1_13_R1(World world) { + super(new EntityArmorStand(world)); + } + + @Override + public void setSmall(boolean small) { + handle.setSmall(small); + } + + @Override + public boolean isSmall() { + return handle.isSmall(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/entity/Entity1_13_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/entity/Entity1_13_R1.java new file mode 100644 index 0000000..9b191c5 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/entity/Entity1_13_R1.java @@ -0,0 +1,216 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R1.entity; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.UUID; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.OfflinePlayer; +import org.bukkit.craftbukkit.v1_13_R1.CraftWorld; +import org.bukkit.craftbukkit.v1_13_R1.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_13_R1.util.CraftChatMessage; +import org.bukkit.entity.Player; + +import net.minecraft.server.v1_13_R1.AxisAlignedBB; +import net.minecraft.server.v1_13_R1.Entity; +import net.minecraft.server.v1_13_R1.EntityTypes; +import net.minecraft.server.v1_13_R1.PacketPlayOutEntityDestroy; +import net.minecraft.server.v1_13_R1.PacketPlayOutEntityMetadata; +import net.minecraft.server.v1_13_R1.PacketPlayOutSpawnEntity; +import net.minecraft.server.v1_13_R1.PlayerConnection; +import net.minecraft.server.v1_13_R1.Vec3D; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.reflection.utils.NmsBoundingBox; + +public abstract class Entity1_13_R1 implements NmsEntity { + + protected final E handle; + + protected final List visible = Collections.synchronizedList(new ArrayList<>()); + + public Entity1_13_R1(E handle) { + this.handle = handle; + } + + @Override + public final E getHandle() { + return handle; + } + + @Override + public int getId() { + return handle.getId(); + } + + @Override + public UUID getUniqueId() { + return handle.getUniqueID(); + } + + @Override + public NmsBoundingBox getBoundingBox() { + AxisAlignedBB box = handle.getBoundingBox(); + return new NmsBoundingBox(box.a, box.b, box.c, box.d, box.e, box.f); + } + + @Override + public void setCustomName(String name) { + handle.setCustomName(CraftChatMessage.fromStringOrNull(name)); + updateVisibility(); + } + + @Override + public String getCustomName() { + return CraftChatMessage.fromComponent(handle.getCustomName()); + } + + @Override + public void setGravity(boolean gravity) { + handle.setNoGravity(!gravity); + } + + @Override + public boolean hasGravity() { + return !handle.isNoGravity(); + } + + @Override + public void setCustomNameVisible(boolean visible) { + handle.setCustomNameVisible(visible); + } + + @Override + public boolean isCustomNameVisible() { + return handle.getCustomNameVisible(); + } + + @Override + public void setInvisible(boolean invisible) { + handle.setInvisible(invisible); + } + + @Override + public boolean isInvisible() { + return handle.isInvisible(); + } + + @Override + public boolean isInteractable() { + return handle.isInteractable(); + } + + @Override + public boolean isCollidable() { + return handle.isCollidable(); + } + + @Override + public void setInvulnerable(boolean invulnerable) { + handle.bl(); + } + + @Override + public boolean isInvulnerable() { + return handle.isInvulnerable(null); + } + + @Override + public void setLocation(Location location) { + handle.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); + if (location.getWorld() == null || handle.getWorld().getWorld() == location.getWorld()) { + updateVisibility(); + return; + } + handle.world = ((CraftWorld) location.getWorld()).getHandle(); + updateVisibility(); + } + + @Override + public Location getLocation() { + Vec3D vector = handle.bI(); + return new Location(handle.getWorld().getWorld(), vector.x, vector.y, vector.z); + } + + @Override + public void updateVisibility() { + if (visible.isEmpty()) { + return; + } + Player[] players; + synchronized (visible) { + players = visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) + .toArray(Player[]::new); + } + hide(players); + show(players); + } + + @Override + public boolean isShown(Player player) { + synchronized (visible) { + return visible.contains(player.getUniqueId()); + } + } + + @Override + public void hide(Player... players) { + if (players.length == 0) { + return; + } + PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(handle.getId()); + for (Player player : players) { + if (!isShown(player)) { + continue; + } + ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); + synchronized (visible) { + visible.remove(player.getUniqueId()); + } + } + } + + @Override + public void show(Player... players) { + if (players.length == 0) { + return; + } + PacketPlayOutSpawnEntity packet = new PacketPlayOutSpawnEntity(handle, EntityTypes.REGISTRY.a(handle.P())); + PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); + PlayerConnection connection; + for (Player player : players) { + if (isShown(player)) { + continue; + } + connection = ((CraftPlayer) player).getHandle().playerConnection; + connection.sendPacket(packet); + connection.sendPacket(metadataPacket); + synchronized (visible) { + visible.add(player.getUniqueId()); + } + } + } + + @Override + public UUID[] getVisible() { + synchronized (visible) { + return visible.toArray(new UUID[0]); + } + } + + @Override + public Player[] getVisibleAsPlayer() { + synchronized (visible) { + return visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) + .toArray(Player[]::new); + } + } + + @Override + public void kill() { + hide(getVisibleAsPlayer()); + handle.die(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/entity/EntityLiving1_13_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/entity/EntityLiving1_13_R1.java new file mode 100644 index 0000000..3b9f625 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/entity/EntityLiving1_13_R1.java @@ -0,0 +1,17 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R1.entity; + +import net.minecraft.server.v1_13_R1.EntityLiving; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityLiving; + +public abstract class EntityLiving1_13_R1 extends Entity1_13_R1 implements NmsEntityLiving { + + public EntityLiving1_13_R1(E handle) { + super(handle); + } + + @Override + public void setCollidable(boolean collidable) { + handle.collides = collidable; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/entity/Player1_13_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/entity/Player1_13_R1.java new file mode 100644 index 0000000..a17160e --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/entity/Player1_13_R1.java @@ -0,0 +1,293 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R1.entity; + +import java.util.ArrayList; +import java.util.Collections; + +import org.bukkit.craftbukkit.v1_13_R1.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_13_R1.util.CraftChatMessage; +import org.bukkit.entity.Player; + +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.properties.Property; +import com.mojang.authlib.properties.PropertyMap; + +import net.minecraft.server.v1_13_R1.EntityPlayer; +import net.minecraft.server.v1_13_R1.EnumItemSlot; +import net.minecraft.server.v1_13_R1.IChatBaseComponent; +import net.minecraft.server.v1_13_R1.MathHelper; +import net.minecraft.server.v1_13_R1.PacketPlayInClientCommand; +import net.minecraft.server.v1_13_R1.PacketPlayInClientCommand.EnumClientCommand; +import net.minecraft.server.v1_13_R1.PacketPlayOutEntityDestroy; +import net.minecraft.server.v1_13_R1.PacketPlayOutEntityEquipment; +import net.minecraft.server.v1_13_R1.PacketPlayOutEntityHeadRotation; +import net.minecraft.server.v1_13_R1.PacketPlayOutEntityMetadata; +import net.minecraft.server.v1_13_R1.PacketPlayOutEntityStatus; +import net.minecraft.server.v1_13_R1.PacketPlayOutHeldItemSlot; +import net.minecraft.server.v1_13_R1.PacketPlayOutNamedEntitySpawn; +import net.minecraft.server.v1_13_R1.PacketPlayOutPlayerInfo; +import net.minecraft.server.v1_13_R1.PacketPlayOutPlayerInfo.EnumPlayerInfoAction; +import net.minecraft.server.v1_13_R1.PacketPlayOutPlayerListHeaderFooter; +import net.minecraft.server.v1_13_R1.PacketPlayOutPosition; +import net.minecraft.server.v1_13_R1.PacketPlayOutRespawn; +import net.minecraft.server.v1_13_R1.PacketPlayOutTitle; +import net.minecraft.server.v1_13_R1.PacketPlayOutTitle.EnumTitleAction; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.PersistentContainer; +import net.sourcewriters.minecraft.vcompat.reflection.data.type.SkinDataType; +import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContainer; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; +import net.sourcewriters.minecraft.vcompat.utils.bukkit.Players; +import net.sourcewriters.minecraft.vcompat.utils.minecraft.MojangProfileServer; +import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; +import net.sourcewriters.minecraft.vcompat.utils.thread.PostAsync; +import net.minecraft.server.v1_13_R1.PlayerConnection; +import net.minecraft.server.v1_13_R1.WorldServer; + +public class Player1_13_R1 extends EntityLiving1_13_R1 implements NmsPlayer { + + private String realName; + private Skin realSkin; + + private final WrappedContainer dataAdapter; + + public Player1_13_R1(Player player, PersistentContainer container) { + super(((CraftPlayer) player).getHandle()); + this.dataAdapter = new SimpleSyntaxContainer<>(container); + update(false); + } + + @Override + public CraftPlayer getBukkitPlayer() { + return handle.getBukkitEntity(); + } + + @Override + public WrappedContainer getDataAdapter() { + return dataAdapter; + } + + @Override + public void setSkin(Skin skin) { + if (skin == null || getSkin().equals(skin)) { + return; + } + getDataAdapter().set("skin", skin, SkinDataType.WRAPPED_INSTANCE); + } + + @Override + public Skin getSkin() { + return dataAdapter.getOrDefault("skin", SkinDataType.WRAPPED_INSTANCE, realSkin); + } + + @Override + public Skin getRealSkin() { + return realSkin; + } + + @Override + public void setName(String name) { + if (getName().equals(name)) { + return; + } + if (name == null) { + getDataAdapter().remove("name"); + return; + } + getDataAdapter().set("name", name, WrapType.STRING); + } + + @Override + public String getName() { + return getDataAdapter().getOrDefault("name", WrapType.STRING, realName); + } + + @Override + public String getRealName() { + return realName; + } + + @Override + public void setPlayerListHeader(String text) { + setPlayerListHeaderAndFooter(text, getPlayerListFooter()); + } + + @Override + public String getPlayerListHeader() { + return getDataAdapter().getOrDefault("header", WrapType.STRING, ""); + } + + @Override + public void setPlayerListFooter(String text) { + setPlayerListHeaderAndFooter(getPlayerListHeader(), text); + } + + @Override + public String getPlayerListFooter() { + return getDataAdapter().getOrDefault("footer", WrapType.STRING, ""); + } + + @Override + public int getPing() { + return handle.ping; + } + + @Override + public void setPlayerListHeaderAndFooter(String header, String footer) { + getDataAdapter().set("header", header, WrapType.STRING); + getDataAdapter().set("footer", footer, WrapType.STRING); + sendPlayerListInfo(header, footer); + } + + private final void sendPlayerListInfo(String header, String footer) { + if (handle.playerConnection.isDisconnected()) { + return; + } + + IChatBaseComponent headerComponent = header.isEmpty() ? null : CraftChatMessage.fromString(header, true)[0]; + IChatBaseComponent footerComponent = footer.isEmpty() ? null : CraftChatMessage.fromString(footer, true)[0]; + + PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter(); + + packet.a = headerComponent; + packet.b = footerComponent; + + handle.playerConnection.sendPacket(packet); + } + + @Override + public void setTitleTimes(int fadeIn, int stay, int fadeOut) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TIMES, null, fadeIn, stay, fadeOut)); + } + + @Override + public void sendSubtitle(String text) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.SUBTITLE, CraftChatMessage.fromStringOrNull(text))); + } + + @Override + public void sendTitle(String text) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TITLE, CraftChatMessage.fromStringOrNull(text))); + } + + @Override + public void sendActionBar(String text) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.ACTIONBAR, CraftChatMessage.fromStringOrNull(text))); + } + + @Override + public void fakeRespawn() { + if (handle.playerConnection.isDisconnected()) { + return; + } + PacketPlayOutPlayerInfo remInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER, handle); + PacketPlayOutPlayerInfo addInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.ADD_PLAYER, handle); + + PacketPlayOutEntityDestroy destroyPacket = new PacketPlayOutEntityDestroy(handle.getId()); + PacketPlayOutNamedEntitySpawn spawnPacket = new PacketPlayOutNamedEntitySpawn(handle); + PacketPlayOutEntityHeadRotation rotationPacket = new PacketPlayOutEntityHeadRotation(handle, + (byte) MathHelper.d(handle.getHeadRotation() * 256F / 360F)); + + ArrayList equipmentPackets = new ArrayList<>(); + for (EnumItemSlot slot : EnumItemSlot.values()) { + equipmentPackets.add(new PacketPlayOutEntityEquipment(handle.getId(), slot, handle.getEquipment(slot))); + } + + Player self = getBukkitPlayer(); + Player[] players = Players.getOnlineWithout(getUniqueId()); + for (Player player : players) { + if (!player.canSee(self)) { + continue; + } + PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection; + connection.sendPacket(remInfoPacket); + connection.sendPacket(addInfoPacket); + connection.sendPacket(destroyPacket); + connection.sendPacket(spawnPacket); + connection.sendPacket(rotationPacket); + for (PacketPlayOutEntityEquipment equipmentPacket : equipmentPackets) { + connection.sendPacket(equipmentPacket); + } + } + + WorldServer world = (WorldServer) handle.world; + + PacketPlayOutRespawn respawnPacket = new PacketPlayOutRespawn(handle.dimension, world.getDifficulty(), + handle.world.worldData.getType(), handle.playerInteractManager.getGameMode()); + PacketPlayOutPosition positionPacket = new PacketPlayOutPosition(handle.locX, handle.locY, handle.locZ, handle.yaw, handle.pitch, + Collections.emptySet(), 0); + PacketPlayOutHeldItemSlot itemPacket = new PacketPlayOutHeldItemSlot(handle.inventory.itemInHandIndex); + PacketPlayOutEntityStatus statusPacket = new PacketPlayOutEntityStatus(handle, (byte) 28); + PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); + + PlayerConnection connection = handle.playerConnection; + connection.sendPacket(remInfoPacket); + connection.sendPacket(addInfoPacket); + connection.sendPacket(respawnPacket); + connection.sendPacket(positionPacket); + connection.sendPacket(itemPacket); + connection.sendPacket(statusPacket); + connection.sendPacket(metadataPacket); + + handle.updateAbilities(); + handle.triggerHealthUpdate(); + handle.updateInventory(handle.defaultContainer); + if (handle.activeContainer != handle.defaultContainer) { + handle.updateInventory(handle.activeContainer); + } + self.recalculatePermissions(); + } + + @Override + public void respawn() { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayInClientCommand(EnumClientCommand.PERFORM_RESPAWN)); + } + + @Override + public void update() { + update(true); + } + + private final void update(boolean flag) { + PostAsync.forcePost(() -> { + realName = MojangProfileServer.getName(getUniqueId()); + realSkin = MojangProfileServer.getSkin(realName, getUniqueId()); + }); + if (flag) { + GameProfile profile = handle.getProfile(); + + Skin skin = getSkin(); + if (skin != null) { + PropertyMap properties = profile.getProperties(); + properties.removeAll("textures"); + properties.put("textures", new Property("textures", skin.getValue(), skin.getSignature())); + } + + String name = getName(); + if (name != null) { + ReflectionProvider.DEFAULT.getReflect("mjGameProfile").setFieldValue(profile, "name", name); + } + + if (!(name == null && skin == null)) { + fakeRespawn(); + } + } + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/tools/BlockTools1_13_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/tools/BlockTools1_13_R1.java new file mode 100644 index 0000000..12beff1 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/tools/BlockTools1_13_R1.java @@ -0,0 +1,39 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R1.tools; + +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_13_R1.block.CraftSkull; + +import com.mojang.authlib.properties.Property; +import com.mojang.authlib.properties.PropertyMap; +import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; +import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.minecraft.server.v1_13_R1.TileEntitySkull; +import net.sourcewriters.minecraft.vcompat.reflection.tools.BlockTools; +import net.sourcewriters.minecraft.vcompat.utils.constants.MinecraftConstants; + +public class BlockTools1_13_R1 extends BlockTools { + + private final AbstractReflect craftEntityStateRef = new Reflect(CraftSkull.class).searchField("tileEntity", "tileEntity"); + + @Override + public void setHeadTexture(Block block, String texture) { + if (!(block instanceof CraftSkull)) { + return; + } + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + PropertyMap map = entitySkull.getGameProfile().getProperties(); + map.removeAll("textures"); + map.put("textures", new Property("textures", MinecraftConstants.TEXTURE_SIGNATURE, texture)); + } + + @Override + public String getHeadTexture(Block block) { + if (!(block instanceof CraftSkull)) { + return null; + } + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + return entitySkull.getGameProfile().getProperties().get("textures").iterator().next().getValue(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/tools/ServerTools1_13_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/tools/ServerTools1_13_R1.java new file mode 100644 index 0000000..419399f --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/tools/ServerTools1_13_R1.java @@ -0,0 +1,26 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R1.tools; + +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_13_R1.CraftServer; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R1.wrapper.ConsoleReaderWrapper1_13_R1; +import net.sourcewriters.minecraft.vcompat.reflection.tools.ServerTools; + +public class ServerTools1_13_R1 extends ServerTools { + + @Override + public void setMotd(String text) { + ((CraftServer) Bukkit.getServer()).getServer().setMotd(text); + } + + @Override + public String getMotd() { + return ((CraftServer) Bukkit.getServer()).getServer().getMotd(); + } + + @Override + public ConsoleReaderWrapper1_13_R1 getConsole() { + return ConsoleReaderWrapper1_13_R1.INSTANCE; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/tools/SkinTools1_13_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/tools/SkinTools1_13_R1.java new file mode 100644 index 0000000..4c68d7a --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/tools/SkinTools1_13_R1.java @@ -0,0 +1,16 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R1.tools; + +import org.bukkit.craftbukkit.v1_13_R1.entity.CraftPlayer; +import org.bukkit.entity.Player; + +import net.sourcewriters.minecraft.vcompat.reflection.tools.SkinTools; +import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; + +public class SkinTools1_13_R1 extends SkinTools { + + @Override + public Skin skinFromPlayer(Player player) { + return skinFromGameProfile(((CraftPlayer) player).getHandle().getProfile()); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/utils/EntityConstructors1_13_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/utils/EntityConstructors1_13_R1.java new file mode 100644 index 0000000..1b402c9 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/utils/EntityConstructors1_13_R1.java @@ -0,0 +1,12 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R1.utils; + +import java.util.function.Function; + +import net.minecraft.server.v1_13_R1.World; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R1.entity.ArmorStand1_13_R1; + +public abstract class EntityConstructors1_13_R1 { + + public static final Function ARMOR_STAND = (world -> new ArmorStand1_13_R1(world)); + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/wrapper/ConsoleReaderWrapper1_13_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/wrapper/ConsoleReaderWrapper1_13_R1.java new file mode 100644 index 0000000..1276143 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/wrapper/ConsoleReaderWrapper1_13_R1.java @@ -0,0 +1,43 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R1.wrapper; + +import java.io.IOException; +import java.io.Writer; + +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_13_R1.CraftServer; +import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; + +import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; + +public final class ConsoleReaderWrapper1_13_R1 extends ConsoleReaderWrapper { + + public static final ConsoleReaderWrapper1_13_R1 INSTANCE = new ConsoleReaderWrapper1_13_R1(); + + private final ConsoleReader reader; + + @SuppressWarnings("resource") + private ConsoleReaderWrapper1_13_R1() { + this.reader = ((CraftServer) Bukkit.getServer()).getServer().reader; + } + + @Override + public Writer getOutput() { + return reader.getOutput(); + } + + @Override + public boolean isAnsiSupported() { + return reader.getTerminal().isAnsiSupported(); + } + + @Override + public void flush() throws IOException { + reader.flush(); + } + + @Override + public void drawLine() throws IOException { + reader.drawLine(); + } + +} diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/BukkitConversion1_13_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/BukkitConversion1_13_R2.java new file mode 100644 index 0000000..c7b3508 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/BukkitConversion1_13_R2.java @@ -0,0 +1,218 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R2; + +import java.util.Set; + +import org.bukkit.craftbukkit.v1_13_R2.inventory.CraftItemStack; +import org.bukkit.entity.EntityType; + +import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; +import com.syntaxphoenix.syntaxapi.data.DataType; +import com.syntaxphoenix.syntaxapi.nbt.NbtByte; +import com.syntaxphoenix.syntaxapi.nbt.NbtByteArray; +import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; +import com.syntaxphoenix.syntaxapi.nbt.NbtDouble; +import com.syntaxphoenix.syntaxapi.nbt.NbtEnd; +import com.syntaxphoenix.syntaxapi.nbt.NbtFloat; +import com.syntaxphoenix.syntaxapi.nbt.NbtInt; +import com.syntaxphoenix.syntaxapi.nbt.NbtIntArray; +import com.syntaxphoenix.syntaxapi.nbt.NbtList; +import com.syntaxphoenix.syntaxapi.nbt.NbtLong; +import com.syntaxphoenix.syntaxapi.nbt.NbtLongArray; +import com.syntaxphoenix.syntaxapi.nbt.NbtShort; +import com.syntaxphoenix.syntaxapi.nbt.NbtString; +import com.syntaxphoenix.syntaxapi.nbt.NbtTag; +import com.syntaxphoenix.syntaxapi.nbt.NbtType; + +import net.minecraft.server.v1_13_R2.ItemStack; +import net.minecraft.server.v1_13_R2.NBTBase; +import net.minecraft.server.v1_13_R2.NBTNumber; +import net.minecraft.server.v1_13_R2.NBTTagByte; +import net.minecraft.server.v1_13_R2.NBTTagByteArray; +import net.minecraft.server.v1_13_R2.NBTTagCompound; +import net.minecraft.server.v1_13_R2.NBTTagDouble; +import net.minecraft.server.v1_13_R2.NBTTagEnd; +import net.minecraft.server.v1_13_R2.NBTTagFloat; +import net.minecraft.server.v1_13_R2.NBTTagInt; +import net.minecraft.server.v1_13_R2.NBTTagIntArray; +import net.minecraft.server.v1_13_R2.NBTTagList; +import net.minecraft.server.v1_13_R2.NBTTagLong; +import net.minecraft.server.v1_13_R2.NBTTagLongArray; +import net.minecraft.server.v1_13_R2.NBTTagShort; +import net.minecraft.server.v1_13_R2.NBTTagString; +import net.sourcewriters.minecraft.vcompat.reflection.BukkitConversion; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContext; +import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleWrapType; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; + +public class BukkitConversion1_13_R2 extends BukkitConversion { + + protected BukkitConversion1_13_R2(VersionControl1_13_R2 versionControl) { + super(versionControl); + } + + @Override + public EntityType toEntityType(NmsEntityType type) { + try { + return EntityType.valueOf(type.name()); + } catch (IllegalArgumentException ignore) { + return null; + } + } + + @Override + public NmsEntityType fromEntityType(EntityType type) { + try { + return NmsEntityType.valueOf(type.name()); + } catch (IllegalArgumentException ignore) { + return null; + } + } + + @Override + public NBTBase toMinecraftTag(NbtTag tag) { + switch (tag.getType()) { + case BYTE: + return new NBTTagByte((byte) tag.getValue()); + case SHORT: + return new NBTTagShort((short) tag.getValue()); + case INT: + return new NBTTagInt((int) tag.getValue()); + case LONG: + return new NBTTagLong((long) tag.getValue()); + case FLOAT: + return new NBTTagFloat((float) tag.getValue()); + case DOUBLE: + return new NBTTagDouble((double) tag.getValue()); + case STRING: + return new NBTTagString((String) tag.getValue()); + case BYTE_ARRAY: + return new NBTTagByteArray((byte[]) tag.getValue()); + case INT_ARRAY: + return new NBTTagIntArray((int[]) tag.getValue()); + case LONG_ARRAY: + return new NBTTagLongArray((long[]) tag.getValue()); + case LIST: + return toMinecraftList((NbtList) tag); + case COMPOUND: + return toMinecraftCompound((NbtCompound) tag); + case END: + return new NBTTagEnd(); + default: + return null; + } + } + + @Override + public NbtTag fromMinecraftTag(Object raw) { + if (!(raw instanceof NBTBase)) { + return null; + } + NBTBase tag = (NBTBase) raw; + NbtType type = NbtType.getById(tag.getTypeId()); + switch (type) { + case BYTE: + return new NbtByte(((NBTNumber) tag).asByte()); + case SHORT: + return new NbtShort(((NBTNumber) tag).asShort()); + case INT: + return new NbtInt(((NBTNumber) tag).asInt()); + case LONG: + return new NbtLong(((NBTNumber) tag).asLong()); + case FLOAT: + return new NbtFloat(((NBTNumber) tag).asFloat()); + case DOUBLE: + return new NbtDouble(((NBTNumber) tag).asDouble()); + case STRING: + return new NbtString(((NBTTagString) tag).asString()); + case BYTE_ARRAY: + return new NbtByteArray(((NBTTagByteArray) tag).c()); + case INT_ARRAY: + return new NbtIntArray(((NBTTagIntArray) tag).d()); + case LONG_ARRAY: + return new NbtLongArray(((NBTTagLongArray) tag).d()); + case LIST: + return fromMinecraftList(tag); + case COMPOUND: + return fromMinecraftCompound(tag); + case END: + return NbtEnd.INSTANCE; + default: + return null; + } + } + + @Override + public NBTTagList toMinecraftList(NbtList list) { + NBTTagList output = new NBTTagList(); + for (NbtTag tag : list) { + output.add(toMinecraftTag(tag)); + } + return output; + } + + @Override + public NbtList fromMinecraftList(Object raw) { + if (!(raw instanceof NBTTagList)) { + return null; + } + NBTTagList list = (NBTTagList) raw; + NbtList output = new NbtList<>(NbtType.getById(list.getTypeId())); + for (NBTBase base : list) { + output.add(fromMinecraftTag(base)); + } + return output; + } + + @Override + public NBTTagCompound toMinecraftCompound(NbtCompound compound) { + NBTTagCompound output = new NBTTagCompound(); + if (compound.isEmpty()) { + return output; + } + Set keys = compound.getKeys(); + for (String key : keys) { + output.set(key, toMinecraftTag(compound.get(key))); + } + return output; + } + + @Override + public NbtCompound fromMinecraftCompound(Object raw) { + if (!(raw instanceof NBTTagCompound)) { + return null; + } + NBTTagCompound compound = (NBTTagCompound) raw; + NbtCompound output = new NbtCompound(); + if (compound.isEmpty()) { + return output; + } + Set keys = compound.getKeys(); + for (String key : keys) { + output.set(key, fromMinecraftTag(compound.get(key))); + } + return output; + } + + @Override + public org.bukkit.inventory.ItemStack itemFromCompound(NbtCompound compound) { + return CraftItemStack.asBukkitCopy(ItemStack.a(toMinecraftCompound(compound))); + } + + @Override + public NbtCompound itemToCompound(org.bukkit.inventory.ItemStack itemStack) { + return fromMinecraftCompound(CraftItemStack.asNMSCopy(itemStack).getOrCreateTag()); + } + + @Override + public WrappedContext createContext(DataAdapterContext context) { + return new SimpleSyntaxContext(context); + } + + @Override + public WrapType wrap(DataType dataType) { + return new SimpleWrapType(dataType); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/EntityProvider1_13_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/EntityProvider1_13_R2.java new file mode 100644 index 0000000..b6c6c3c --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/EntityProvider1_13_R2.java @@ -0,0 +1,47 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R2; + +import java.util.EnumMap; +import java.util.function.Function; + +import org.bukkit.craftbukkit.v1_13_R2.CraftWorld; + +import net.minecraft.server.v1_13_R2.World; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R2.utils.EntityConstructors1_13_R2; +import net.sourcewriters.minecraft.vcompat.reflection.EntityProvider; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; + +public class EntityProvider1_13_R2 extends EntityProvider { + + private final EnumMap> entityMap = new EnumMap<>(NmsEntityType.class); + + protected EntityProvider1_13_R2(VersionControl1_13_R2 versionControl) { + super(versionControl); + } + + @SuppressWarnings("unchecked") + private final Function searchConstructor(NmsEntityType type) { + try { + return (Function) EntityConstructors1_13_R2.class.getField(type.name()).get(null); + } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException ignore) { + return null; + } + } + + private final Function getConstructor(NmsEntityType type) { + return entityMap.computeIfAbsent(type, (key -> searchConstructor(key))); + } + + @Override + public NmsEntity createEntity(org.bukkit.World world, NmsEntityType type) { + if (!(world instanceof CraftWorld)) { + return null; + } + Function function; + if ((function = getConstructor(type)) == null) { + return null; + } + return function.apply(((CraftWorld) world).getHandle()); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/PacketHandler1_13_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/PacketHandler1_13_R2.java new file mode 100644 index 0000000..c14fa95 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/PacketHandler1_13_R2.java @@ -0,0 +1,11 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R2; + +import net.sourcewriters.minecraft.vcompat.reflection.PacketHandler; + +public class PacketHandler1_13_R2 extends PacketHandler { + + protected PacketHandler1_13_R2(VersionControl1_13_R2 versionControl) { + super(versionControl); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/PlayerProvider1_13_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/PlayerProvider1_13_R2.java new file mode 100644 index 0000000..81092ce --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/PlayerProvider1_13_R2.java @@ -0,0 +1,30 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R2; + +import java.io.File; +import java.util.UUID; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R2.entity.Player1_13_R2; +import net.sourcewriters.minecraft.vcompat.reflection.DataProvider; +import net.sourcewriters.minecraft.vcompat.reflection.PlayerProvider; +import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.DataDistributor; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; + +public class PlayerProvider1_13_R2 extends PlayerProvider { + + private final DataDistributor distributor; + + protected PlayerProvider1_13_R2(VersionControl1_13_R2 versionControl) { + super(versionControl); + distributor = versionControl.getDataProvider().createDistributor(new File(Bukkit.getWorlds().get(0).getWorldFolder(), "playerdata"), + uuid -> "custom_" + uuid.toString(), DataProvider.DEFAULT_RANDOM); + } + + @Override + protected NmsPlayer createPlayer(Player player) { + return new Player1_13_R2(player, distributor.get(player.getUniqueId())); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/TextureProvider1_13_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/TextureProvider1_13_R2.java new file mode 100644 index 0000000..fb3c57b --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/TextureProvider1_13_R2.java @@ -0,0 +1,102 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R2; + +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_13_R2.block.CraftBlockEntityState; +import org.bukkit.craftbukkit.v1_13_R2.block.CraftSkull; +import org.bukkit.craftbukkit.v1_13_R2.inventory.CraftItemStack; +import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.inventory.meta.SkullMeta; + +import com.mojang.authlib.GameProfile; +import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; +import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.minecraft.server.v1_13_R2.GameProfileSerializer; +import net.minecraft.server.v1_13_R2.ItemStack; +import net.minecraft.server.v1_13_R2.NBTTagCompound; +import net.minecraft.server.v1_13_R2.TileEntitySkull; +import net.sourcewriters.minecraft.vcompat.reflection.TextureProvider; + +public class TextureProvider1_13_R2 extends TextureProvider { + + private final AbstractReflect craftEntityStateRef = new Reflect(CraftBlockEntityState.class).searchField("tileEntity", "tileEntity"); + private final AbstractReflect craftItemStackRef = new Reflect(CraftItemStack.class).searchField("handle", "handle"); + private final AbstractReflect craftMetaSkullRef = new Reflect("org.bukkit.craftbukkit.v1_13_R2.inventory.CraftMetaSkull") + .searchField("serialized", "serializedProfile").searchField("profile", "profile"); + + protected TextureProvider1_13_R2(VersionControl1_13_R2 versionControl) { + super(versionControl); + } + + @Override + public GameProfile profileFromBlock(Block block) { + if (!(block instanceof CraftSkull)) { + return null; + } + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + return entitySkull.getGameProfile(); + } + + @Override + public GameProfile profileFromItem(org.bukkit.inventory.ItemStack itemStack) { + if (!(itemStack.getItemMeta() instanceof SkullMeta)) { + return null; + } + SkullMeta meta = (SkullMeta) itemStack.getItemMeta(); + GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue("profile", meta); + if (profile == null) { + NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue("serialized", meta); + if (compound == null) { + ItemStack stack = null; + if (itemStack instanceof CraftItemStack) { + stack = (ItemStack) craftItemStackRef.getFieldValue("handle", itemStack); + } + if (stack == null) { + stack = CraftItemStack.asNMSCopy(itemStack); + } + NBTTagCompound stackTag = stack.getOrCreateTag(); + if (stackTag.hasKeyOfType("SkullOwner", 10)) { + compound = stackTag.getCompound("SkullOwner"); + } else if (stackTag.hasKeyOfType("SkullProfile", 10)) { + compound = stackTag.getCompound("SkullProfile"); + } + } + if (compound == null) { + return null; + } + profile = GameProfileSerializer.deserialize(compound); + } + return profile; + } + + @Override + public org.bukkit.inventory.ItemStack getItem(GameProfile profile) { + org.bukkit.inventory.ItemStack craftStack = CraftItemStack.asCraftCopy(new org.bukkit.inventory.ItemStack(Material.PLAYER_HEAD)); + applyItem(craftStack, profile); + return craftStack; + } + + @Override + public boolean applyItem(org.bukkit.inventory.ItemStack itemStack, GameProfile profile) { + ItemMeta meta = itemStack.getItemMeta(); + if (!(meta instanceof SkullMeta)) { + return false; + } + SkullMeta skullMeta = (SkullMeta) meta; + craftMetaSkullRef.setFieldValue(meta, "profile", profile); + itemStack.setItemMeta(skullMeta); + return true; + } + + @Override + public boolean applyBlock(Block block, GameProfile profile) { + if (!(block instanceof CraftSkull)) { + return false; + } + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + entitySkull.setGameProfile(profile); + return true; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/ToolProvider1_13_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/ToolProvider1_13_R2.java new file mode 100644 index 0000000..4e0e108 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/ToolProvider1_13_R2.java @@ -0,0 +1,33 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R2; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R2.tools.BlockTools1_13_R2; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R2.tools.ServerTools1_13_R2; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R2.tools.SkinTools1_13_R2; +import net.sourcewriters.minecraft.vcompat.reflection.ToolProvider; + +public class ToolProvider1_13_R2 extends ToolProvider { + + private final BlockTools1_13_R2 blockTools = new BlockTools1_13_R2(); + private final SkinTools1_13_R2 skinTools = new SkinTools1_13_R2(); + private final ServerTools1_13_R2 serverTools = new ServerTools1_13_R2(); + + protected ToolProvider1_13_R2(VersionControl1_13_R2 versionControl) { + super(versionControl); + } + + @Override + public SkinTools1_13_R2 getSkinTools() { + return skinTools; + } + + @Override + public ServerTools1_13_R2 getServerTools() { + return serverTools; + } + + @Override + public BlockTools1_13_R2 getBlockTools() { + return blockTools; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/VersionControl1_13_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/VersionControl1_13_R2.java new file mode 100644 index 0000000..a93aa7c --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/VersionControl1_13_R2.java @@ -0,0 +1,54 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R2; + +import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; + +public class VersionControl1_13_R2 extends VersionControl { + + public static VersionControl1_13_R2 INSTANCE; + + public static VersionControl1_13_R2 init() { + return INSTANCE != null ? INSTANCE : (INSTANCE = new VersionControl1_13_R2()); + } + + private final ToolProvider1_13_R2 toolProvider = new ToolProvider1_13_R2(this); + private final TextureProvider1_13_R2 textureProvider = new TextureProvider1_13_R2(this); + private final PacketHandler1_13_R2 packetHandler = new PacketHandler1_13_R2(this); + private final EntityProvider1_13_R2 entityProvider = new EntityProvider1_13_R2(this); + private final PlayerProvider1_13_R2 playerProvider = new PlayerProvider1_13_R2(this); + private final BukkitConversion1_13_R2 bukkitConversion = new BukkitConversion1_13_R2(this); + + private VersionControl1_13_R2() { + + } + + @Override + public ToolProvider1_13_R2 getToolProvider() { + return toolProvider; + } + + @Override + public EntityProvider1_13_R2 getEntityProvider() { + return entityProvider; + } + + @Override + public PlayerProvider1_13_R2 getPlayerProvider() { + return playerProvider; + } + + @Override + public TextureProvider1_13_R2 getTextureProvider() { + return textureProvider; + } + + @Override + public PacketHandler1_13_R2 getPacketHandler() { + return packetHandler; + } + + @Override + public BukkitConversion1_13_R2 getBukkitConversion() { + return bukkitConversion; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/entity/ArmorStand1_13_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/entity/ArmorStand1_13_R2.java new file mode 100644 index 0000000..d1131eb --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/entity/ArmorStand1_13_R2.java @@ -0,0 +1,23 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R2.entity; + +import net.minecraft.server.v1_13_R2.EntityArmorStand; +import net.minecraft.server.v1_13_R2.World; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsArmorStand; + +public class ArmorStand1_13_R2 extends EntityLiving1_13_R2 implements NmsArmorStand { + + public ArmorStand1_13_R2(World world) { + super(new EntityArmorStand(world)); + } + + @Override + public void setSmall(boolean small) { + handle.setSmall(small); + } + + @Override + public boolean isSmall() { + return handle.isSmall(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/entity/Entity1_13_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/entity/Entity1_13_R2.java new file mode 100644 index 0000000..480402b --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/entity/Entity1_13_R2.java @@ -0,0 +1,216 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R2.entity; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.UUID; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.OfflinePlayer; +import org.bukkit.craftbukkit.v1_13_R2.CraftWorld; +import org.bukkit.craftbukkit.v1_13_R2.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_13_R2.util.CraftChatMessage; +import org.bukkit.entity.Player; + +import net.minecraft.server.v1_13_R2.AxisAlignedBB; +import net.minecraft.server.v1_13_R2.Entity; +import net.minecraft.server.v1_13_R2.IRegistry; +import net.minecraft.server.v1_13_R2.PacketPlayOutEntityDestroy; +import net.minecraft.server.v1_13_R2.PacketPlayOutEntityMetadata; +import net.minecraft.server.v1_13_R2.PacketPlayOutSpawnEntity; +import net.minecraft.server.v1_13_R2.PlayerConnection; +import net.minecraft.server.v1_13_R2.Vec3D; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.reflection.utils.NmsBoundingBox; + +public abstract class Entity1_13_R2 implements NmsEntity { + + protected final E handle; + + protected final List visible = Collections.synchronizedList(new ArrayList<>()); + + public Entity1_13_R2(E handle) { + this.handle = handle; + } + + @Override + public final E getHandle() { + return handle; + } + + @Override + public int getId() { + return handle.getId(); + } + + @Override + public UUID getUniqueId() { + return handle.getUniqueID(); + } + + @Override + public NmsBoundingBox getBoundingBox() { + AxisAlignedBB box = handle.getBoundingBox(); + return new NmsBoundingBox(box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ); + } + + @Override + public void setCustomName(String name) { + handle.setCustomName(CraftChatMessage.fromStringOrNull(name)); + updateVisibility(); + } + + @Override + public String getCustomName() { + return CraftChatMessage.fromComponent(handle.getCustomName()); + } + + @Override + public void setGravity(boolean gravity) { + handle.setNoGravity(!gravity); + } + + @Override + public boolean hasGravity() { + return !handle.isNoGravity(); + } + + @Override + public void setCustomNameVisible(boolean visible) { + handle.setCustomNameVisible(visible); + } + + @Override + public boolean isCustomNameVisible() { + return handle.getCustomNameVisible(); + } + + @Override + public void setInvisible(boolean invisible) { + handle.setInvisible(invisible); + } + + @Override + public boolean isInvisible() { + return handle.isInvisible(); + } + + @Override + public boolean isInteractable() { + return handle.isInteractable(); + } + + @Override + public boolean isCollidable() { + return handle.isCollidable(); + } + + @Override + public void setInvulnerable(boolean invulnerable) { + handle.setInvulnerable(invulnerable); + } + + @Override + public boolean isInvulnerable() { + return handle.bl(); + } + + @Override + public void setLocation(Location location) { + handle.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); + if (location.getWorld() == null || handle.getWorld().getWorld() == location.getWorld()) { + updateVisibility(); + return; + } + handle.world = ((CraftWorld) location.getWorld()).getHandle(); + updateVisibility(); + } + + @Override + public Location getLocation() { + Vec3D vector = handle.bI(); + return new Location(handle.getWorld().getWorld(), vector.x, vector.y, vector.z); + } + + @Override + public void updateVisibility() { + if (visible.isEmpty()) { + return; + } + Player[] players; + synchronized (visible) { + players = visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) + .toArray(Player[]::new); + } + hide(players); + show(players); + } + + @Override + public boolean isShown(Player player) { + synchronized (visible) { + return visible.contains(player.getUniqueId()); + } + } + + @Override + public void hide(Player... players) { + if (players.length == 0) { + return; + } + PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(handle.getId()); + for (Player player : players) { + if (!isShown(player)) { + continue; + } + ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); + synchronized (visible) { + visible.remove(player.getUniqueId()); + } + } + } + + @Override + public void show(Player... players) { + if (players.length == 0) { + return; + } + PacketPlayOutSpawnEntity packet = new PacketPlayOutSpawnEntity(handle, IRegistry.ENTITY_TYPE.a(handle.P())); + PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); + PlayerConnection connection; + for (Player player : players) { + if (isShown(player)) { + continue; + } + connection = ((CraftPlayer) player).getHandle().playerConnection; + connection.sendPacket(packet); + connection.sendPacket(metadataPacket); + synchronized (visible) { + visible.add(player.getUniqueId()); + } + } + } + + @Override + public UUID[] getVisible() { + synchronized (visible) { + return visible.toArray(new UUID[0]); + } + } + + @Override + public Player[] getVisibleAsPlayer() { + synchronized (visible) { + return visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) + .toArray(Player[]::new); + } + } + + @Override + public void kill() { + hide(getVisibleAsPlayer()); + handle.die(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/entity/EntityLiving1_13_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/entity/EntityLiving1_13_R2.java new file mode 100644 index 0000000..8e1e89a --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/entity/EntityLiving1_13_R2.java @@ -0,0 +1,17 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R2.entity; + +import net.minecraft.server.v1_13_R2.EntityLiving; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityLiving; + +public abstract class EntityLiving1_13_R2 extends Entity1_13_R2 implements NmsEntityLiving { + + public EntityLiving1_13_R2(E handle) { + super(handle); + } + + @Override + public void setCollidable(boolean collidable) { + handle.collides = collidable; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/entity/Player1_13_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/entity/Player1_13_R2.java new file mode 100644 index 0000000..1a6b44b --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/entity/Player1_13_R2.java @@ -0,0 +1,293 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R2.entity; + +import java.util.ArrayList; +import java.util.Collections; + +import org.bukkit.craftbukkit.v1_13_R2.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_13_R2.util.CraftChatMessage; +import org.bukkit.entity.Player; + +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.properties.Property; +import com.mojang.authlib.properties.PropertyMap; + +import net.minecraft.server.v1_13_R2.EntityPlayer; +import net.minecraft.server.v1_13_R2.EnumItemSlot; +import net.minecraft.server.v1_13_R2.IChatBaseComponent; +import net.minecraft.server.v1_13_R2.MathHelper; +import net.minecraft.server.v1_13_R2.PacketPlayInClientCommand; +import net.minecraft.server.v1_13_R2.PacketPlayInClientCommand.EnumClientCommand; +import net.minecraft.server.v1_13_R2.PacketPlayOutEntityDestroy; +import net.minecraft.server.v1_13_R2.PacketPlayOutEntityEquipment; +import net.minecraft.server.v1_13_R2.PacketPlayOutEntityHeadRotation; +import net.minecraft.server.v1_13_R2.PacketPlayOutEntityMetadata; +import net.minecraft.server.v1_13_R2.PacketPlayOutEntityStatus; +import net.minecraft.server.v1_13_R2.PacketPlayOutHeldItemSlot; +import net.minecraft.server.v1_13_R2.PacketPlayOutNamedEntitySpawn; +import net.minecraft.server.v1_13_R2.PacketPlayOutPlayerInfo; +import net.minecraft.server.v1_13_R2.PacketPlayOutPlayerInfo.EnumPlayerInfoAction; +import net.minecraft.server.v1_13_R2.PacketPlayOutPlayerListHeaderFooter; +import net.minecraft.server.v1_13_R2.PacketPlayOutPosition; +import net.minecraft.server.v1_13_R2.PacketPlayOutRespawn; +import net.minecraft.server.v1_13_R2.PacketPlayOutTitle; +import net.minecraft.server.v1_13_R2.PacketPlayOutTitle.EnumTitleAction; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.PersistentContainer; +import net.sourcewriters.minecraft.vcompat.reflection.data.type.SkinDataType; +import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContainer; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; +import net.sourcewriters.minecraft.vcompat.utils.bukkit.Players; +import net.sourcewriters.minecraft.vcompat.utils.minecraft.MojangProfileServer; +import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; +import net.sourcewriters.minecraft.vcompat.utils.thread.PostAsync; +import net.minecraft.server.v1_13_R2.PlayerConnection; +import net.minecraft.server.v1_13_R2.WorldServer; + +public class Player1_13_R2 extends EntityLiving1_13_R2 implements NmsPlayer { + + private String realName; + private Skin realSkin; + + private final WrappedContainer dataAdapter; + + public Player1_13_R2(Player player, PersistentContainer container) { + super(((CraftPlayer) player).getHandle()); + this.dataAdapter = new SimpleSyntaxContainer<>(container); + update(false); + } + + @Override + public CraftPlayer getBukkitPlayer() { + return handle.getBukkitEntity(); + } + + @Override + public WrappedContainer getDataAdapter() { + return dataAdapter; + } + + @Override + public void setSkin(Skin skin) { + if (skin == null || getSkin().equals(skin)) { + return; + } + dataAdapter.set("skin", skin, SkinDataType.WRAPPED_INSTANCE); + } + + @Override + public Skin getSkin() { + return dataAdapter.getOrDefault("skin", SkinDataType.WRAPPED_INSTANCE, realSkin); + } + + @Override + public Skin getRealSkin() { + return realSkin; + } + + @Override + public void setName(String name) { + if (getName().equals(name)) { + return; + } + if (name == null) { + dataAdapter.remove("name"); + return; + } + dataAdapter.set("name", name, WrapType.STRING); + } + + @Override + public String getName() { + return dataAdapter.getOrDefault("name", WrapType.STRING, realName); + } + + @Override + public String getRealName() { + return realName; + } + + @Override + public void setPlayerListHeader(String text) { + setPlayerListHeaderAndFooter(text, getPlayerListFooter()); + } + + @Override + public String getPlayerListHeader() { + return dataAdapter.getOrDefault("header", WrapType.STRING, ""); + } + + @Override + public void setPlayerListFooter(String text) { + setPlayerListHeaderAndFooter(getPlayerListHeader(), text); + } + + @Override + public String getPlayerListFooter() { + return dataAdapter.getOrDefault("footer", WrapType.STRING, ""); + } + + @Override + public int getPing() { + return handle.ping; + } + + @Override + public void setPlayerListHeaderAndFooter(String header, String footer) { + dataAdapter.set("header", header, WrapType.STRING); + dataAdapter.set("footer", footer, WrapType.STRING); + sendPlayerListInfo(header, footer); + } + + private final void sendPlayerListInfo(String header, String footer) { + if (handle.playerConnection.isDisconnected()) { + return; + } + + IChatBaseComponent headerComponent = header.isEmpty() ? null : CraftChatMessage.fromString(header, true)[0]; + IChatBaseComponent footerComponent = footer.isEmpty() ? null : CraftChatMessage.fromString(footer, true)[0]; + + PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter(); + + packet.header = headerComponent; + packet.footer = footerComponent; + + handle.playerConnection.sendPacket(packet); + } + + @Override + public void setTitleTimes(int fadeIn, int stay, int fadeOut) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TIMES, null, fadeIn, stay, fadeOut)); + } + + @Override + public void sendSubtitle(String text) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.SUBTITLE, CraftChatMessage.fromStringOrNull(text))); + } + + @Override + public void sendTitle(String text) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TITLE, CraftChatMessage.fromStringOrNull(text))); + } + + @Override + public void sendActionBar(String text) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.ACTIONBAR, CraftChatMessage.fromStringOrNull(text))); + } + + @Override + public void fakeRespawn() { + if (handle.playerConnection.isDisconnected()) { + return; + } + PacketPlayOutPlayerInfo remInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER, handle); + PacketPlayOutPlayerInfo addInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.ADD_PLAYER, handle); + + PacketPlayOutEntityDestroy destroyPacket = new PacketPlayOutEntityDestroy(handle.getId()); + PacketPlayOutNamedEntitySpawn spawnPacket = new PacketPlayOutNamedEntitySpawn(handle); + PacketPlayOutEntityHeadRotation rotationPacket = new PacketPlayOutEntityHeadRotation(handle, + (byte) MathHelper.d(handle.getHeadRotation() * 256F / 360F)); + + ArrayList equipmentPackets = new ArrayList<>(); + for (EnumItemSlot slot : EnumItemSlot.values()) { + equipmentPackets.add(new PacketPlayOutEntityEquipment(handle.getId(), slot, handle.getEquipment(slot))); + } + + Player self = getBukkitPlayer(); + Player[] players = Players.getOnlineWithout(getUniqueId()); + for (Player player : players) { + if (!player.canSee(self)) { + continue; + } + PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection; + connection.sendPacket(remInfoPacket); + connection.sendPacket(addInfoPacket); + connection.sendPacket(destroyPacket); + connection.sendPacket(spawnPacket); + connection.sendPacket(rotationPacket); + for (PacketPlayOutEntityEquipment equipmentPacket : equipmentPackets) { + connection.sendPacket(equipmentPacket); + } + } + + WorldServer world = (WorldServer) handle.world; + + PacketPlayOutRespawn respawnPacket = new PacketPlayOutRespawn(handle.dimension, world.getDifficulty(), + handle.world.worldData.getType(), handle.playerInteractManager.getGameMode()); + PacketPlayOutPosition positionPacket = new PacketPlayOutPosition(handle.locX, handle.locY, handle.locZ, handle.yaw, handle.pitch, + Collections.emptySet(), 0); + PacketPlayOutHeldItemSlot itemPacket = new PacketPlayOutHeldItemSlot(handle.inventory.itemInHandIndex); + PacketPlayOutEntityStatus statusPacket = new PacketPlayOutEntityStatus(handle, (byte) 28); + PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); + + PlayerConnection connection = handle.playerConnection; + connection.sendPacket(remInfoPacket); + connection.sendPacket(addInfoPacket); + connection.sendPacket(respawnPacket); + connection.sendPacket(positionPacket); + connection.sendPacket(itemPacket); + connection.sendPacket(statusPacket); + connection.sendPacket(metadataPacket); + + handle.updateAbilities(); + handle.triggerHealthUpdate(); + handle.updateInventory(handle.defaultContainer); + if (handle.activeContainer != handle.defaultContainer) { + handle.updateInventory(handle.activeContainer); + } + self.recalculatePermissions(); + } + + @Override + public void respawn() { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayInClientCommand(EnumClientCommand.PERFORM_RESPAWN)); + } + + @Override + public void update() { + update(true); + } + + private final void update(boolean flag) { + PostAsync.forcePost(() -> { + realName = MojangProfileServer.getName(getUniqueId()); + realSkin = MojangProfileServer.getSkin(realName, getUniqueId()); + }); + if (flag) { + GameProfile profile = handle.getProfile(); + + Skin skin = getSkin(); + if (skin != null) { + PropertyMap properties = profile.getProperties(); + properties.removeAll("textures"); + properties.put("textures", new Property("textures", skin.getValue(), skin.getSignature())); + } + + String name = getName(); + if (name != null) { + ReflectionProvider.DEFAULT.getReflect("mjGameProfile").setFieldValue(profile, "name", name); + } + + if (!(name == null && skin == null)) { + fakeRespawn(); + } + } + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/tools/BlockTools1_13_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/tools/BlockTools1_13_R2.java new file mode 100644 index 0000000..7f9d5d3 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/tools/BlockTools1_13_R2.java @@ -0,0 +1,39 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R2.tools; + +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_13_R2.block.CraftSkull; + +import com.mojang.authlib.properties.Property; +import com.mojang.authlib.properties.PropertyMap; +import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; +import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.minecraft.server.v1_13_R2.TileEntitySkull; +import net.sourcewriters.minecraft.vcompat.reflection.tools.BlockTools; +import net.sourcewriters.minecraft.vcompat.utils.constants.MinecraftConstants; + +public class BlockTools1_13_R2 extends BlockTools { + + private final AbstractReflect craftEntityStateRef = new Reflect(CraftSkull.class).searchField("tileEntity", "tileEntity"); + + @Override + public void setHeadTexture(Block block, String texture) { + if (!(block instanceof CraftSkull)) { + return; + } + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + PropertyMap map = entitySkull.getGameProfile().getProperties(); + map.removeAll("textures"); + map.put("textures", new Property("textures", MinecraftConstants.TEXTURE_SIGNATURE, texture)); + } + + @Override + public String getHeadTexture(Block block) { + if (!(block instanceof CraftSkull)) { + return null; + } + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + return entitySkull.getGameProfile().getProperties().get("textures").iterator().next().getValue(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/tools/ServerTools1_13_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/tools/ServerTools1_13_R2.java new file mode 100644 index 0000000..5143156 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/tools/ServerTools1_13_R2.java @@ -0,0 +1,26 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R2.tools; + +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_13_R2.CraftServer; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R2.wrapper.ConsoleReaderWrapper1_13_R2; +import net.sourcewriters.minecraft.vcompat.reflection.tools.ServerTools; + +public class ServerTools1_13_R2 extends ServerTools { + + @Override + public void setMotd(String text) { + ((CraftServer) Bukkit.getServer()).getServer().setMotd(text); + } + + @Override + public String getMotd() { + return ((CraftServer) Bukkit.getServer()).getServer().getMotd(); + } + + @Override + public ConsoleReaderWrapper1_13_R2 getConsole() { + return ConsoleReaderWrapper1_13_R2.INSTANCE; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/tools/SkinTools1_13_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/tools/SkinTools1_13_R2.java new file mode 100644 index 0000000..c6ddf8a --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/tools/SkinTools1_13_R2.java @@ -0,0 +1,16 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R2.tools; + +import org.bukkit.craftbukkit.v1_13_R2.entity.CraftPlayer; +import org.bukkit.entity.Player; + +import net.sourcewriters.minecraft.vcompat.reflection.tools.SkinTools; +import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; + +public class SkinTools1_13_R2 extends SkinTools { + + @Override + public Skin skinFromPlayer(Player player) { + return skinFromGameProfile(((CraftPlayer) player).getHandle().getProfile()); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/utils/EntityConstructors1_13_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/utils/EntityConstructors1_13_R2.java new file mode 100644 index 0000000..a9449d4 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/utils/EntityConstructors1_13_R2.java @@ -0,0 +1,12 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R2.utils; + +import java.util.function.Function; + +import net.minecraft.server.v1_13_R2.World; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R2.entity.ArmorStand1_13_R2; + +public abstract class EntityConstructors1_13_R2 { + + public static final Function ARMOR_STAND = (world -> new ArmorStand1_13_R2(world)); + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/wrapper/ConsoleReaderWrapper1_13_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/wrapper/ConsoleReaderWrapper1_13_R2.java new file mode 100644 index 0000000..086c77c --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/wrapper/ConsoleReaderWrapper1_13_R2.java @@ -0,0 +1,43 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R2.wrapper; + +import java.io.IOException; +import java.io.Writer; + +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_13_R2.CraftServer; +import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; + +import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; + +public final class ConsoleReaderWrapper1_13_R2 extends ConsoleReaderWrapper { + + public static final ConsoleReaderWrapper1_13_R2 INSTANCE = new ConsoleReaderWrapper1_13_R2(); + + private final ConsoleReader reader; + + @SuppressWarnings("resource") + private ConsoleReaderWrapper1_13_R2() { + this.reader = ((CraftServer) Bukkit.getServer()).getServer().reader; + } + + @Override + public Writer getOutput() { + return reader.getOutput(); + } + + @Override + public boolean isAnsiSupported() { + return reader.getTerminal().isAnsiSupported(); + } + + @Override + public void flush() throws IOException { + reader.flush(); + } + + @Override + public void drawLine() throws IOException { + reader.drawLine(); + } + +} diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/BukkitConversion1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/BukkitConversion1_14_R1.java new file mode 100644 index 0000000..e69167c --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/BukkitConversion1_14_R1.java @@ -0,0 +1,218 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1; + +import java.util.Set; + +import org.bukkit.craftbukkit.v1_14_R1.inventory.CraftItemStack; +import org.bukkit.entity.EntityType; + +import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; +import com.syntaxphoenix.syntaxapi.data.DataType; +import com.syntaxphoenix.syntaxapi.nbt.NbtByte; +import com.syntaxphoenix.syntaxapi.nbt.NbtByteArray; +import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; +import com.syntaxphoenix.syntaxapi.nbt.NbtDouble; +import com.syntaxphoenix.syntaxapi.nbt.NbtEnd; +import com.syntaxphoenix.syntaxapi.nbt.NbtFloat; +import com.syntaxphoenix.syntaxapi.nbt.NbtInt; +import com.syntaxphoenix.syntaxapi.nbt.NbtIntArray; +import com.syntaxphoenix.syntaxapi.nbt.NbtList; +import com.syntaxphoenix.syntaxapi.nbt.NbtLong; +import com.syntaxphoenix.syntaxapi.nbt.NbtLongArray; +import com.syntaxphoenix.syntaxapi.nbt.NbtShort; +import com.syntaxphoenix.syntaxapi.nbt.NbtString; +import com.syntaxphoenix.syntaxapi.nbt.NbtTag; +import com.syntaxphoenix.syntaxapi.nbt.NbtType; + +import net.minecraft.server.v1_14_R1.ItemStack; +import net.minecraft.server.v1_14_R1.NBTBase; +import net.minecraft.server.v1_14_R1.NBTNumber; +import net.minecraft.server.v1_14_R1.NBTTagByte; +import net.minecraft.server.v1_14_R1.NBTTagByteArray; +import net.minecraft.server.v1_14_R1.NBTTagCompound; +import net.minecraft.server.v1_14_R1.NBTTagDouble; +import net.minecraft.server.v1_14_R1.NBTTagEnd; +import net.minecraft.server.v1_14_R1.NBTTagFloat; +import net.minecraft.server.v1_14_R1.NBTTagInt; +import net.minecraft.server.v1_14_R1.NBTTagIntArray; +import net.minecraft.server.v1_14_R1.NBTTagList; +import net.minecraft.server.v1_14_R1.NBTTagLong; +import net.minecraft.server.v1_14_R1.NBTTagLongArray; +import net.minecraft.server.v1_14_R1.NBTTagShort; +import net.minecraft.server.v1_14_R1.NBTTagString; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1.data.BukkitContext1_14_R1; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1.data.BukkitType1_14_R1; +import net.sourcewriters.minecraft.vcompat.reflection.BukkitConversion; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; + +public class BukkitConversion1_14_R1 extends BukkitConversion { + + protected BukkitConversion1_14_R1(VersionControl1_14_R1 versionControl) { + super(versionControl); + } + + @Override + public EntityType toEntityType(NmsEntityType type) { + try { + return EntityType.valueOf(type.name()); + } catch (IllegalArgumentException ignore) { + return null; + } + } + + @Override + public NmsEntityType fromEntityType(EntityType type) { + try { + return NmsEntityType.valueOf(type.name()); + } catch (IllegalArgumentException ignore) { + return null; + } + } + + @Override + public NBTBase toMinecraftTag(NbtTag tag) { + switch (tag.getType()) { + case BYTE: + return new NBTTagByte((byte) tag.getValue()); + case SHORT: + return new NBTTagShort((short) tag.getValue()); + case INT: + return new NBTTagInt((int) tag.getValue()); + case LONG: + return new NBTTagLong((long) tag.getValue()); + case FLOAT: + return new NBTTagFloat((float) tag.getValue()); + case DOUBLE: + return new NBTTagDouble((double) tag.getValue()); + case STRING: + return new NBTTagString((String) tag.getValue()); + case BYTE_ARRAY: + return new NBTTagByteArray((byte[]) tag.getValue()); + case INT_ARRAY: + return new NBTTagIntArray((int[]) tag.getValue()); + case LONG_ARRAY: + return new NBTTagLongArray((long[]) tag.getValue()); + case LIST: + return toMinecraftList((NbtList) tag); + case COMPOUND: + return toMinecraftCompound((NbtCompound) tag); + case END: + return new NBTTagEnd(); + default: + return null; + } + } + + @Override + public NbtTag fromMinecraftTag(Object raw) { + if (!(raw instanceof NBTBase)) { + return null; + } + NBTBase tag = (NBTBase) raw; + NbtType type = NbtType.getById(tag.getTypeId()); + switch (type) { + case BYTE: + return new NbtByte(((NBTNumber) tag).asByte()); + case SHORT: + return new NbtShort(((NBTNumber) tag).asShort()); + case INT: + return new NbtInt(((NBTNumber) tag).asInt()); + case LONG: + return new NbtLong(((NBTNumber) tag).asLong()); + case FLOAT: + return new NbtFloat(((NBTNumber) tag).asFloat()); + case DOUBLE: + return new NbtDouble(((NBTNumber) tag).asDouble()); + case STRING: + return new NbtString(((NBTTagString) tag).asString()); + case BYTE_ARRAY: + return new NbtByteArray(((NBTTagByteArray) tag).getBytes()); + case INT_ARRAY: + return new NbtIntArray(((NBTTagIntArray) tag).getInts()); + case LONG_ARRAY: + return new NbtLongArray(((NBTTagLongArray) tag).getLongs()); + case LIST: + return fromMinecraftList(tag); + case COMPOUND: + return fromMinecraftCompound(tag); + case END: + return NbtEnd.INSTANCE; + default: + return null; + } + } + + @Override + public NBTTagList toMinecraftList(NbtList list) { + NBTTagList output = new NBTTagList(); + for (NbtTag tag : list) { + output.add(toMinecraftTag(tag)); + } + return output; + } + + @Override + public NbtList fromMinecraftList(Object raw) { + if (!(raw instanceof NBTTagList)) { + return null; + } + NBTTagList list = (NBTTagList) raw; + NbtList output = new NbtList<>(NbtType.getById(list.getTypeId())); + for (NBTBase base : list) { + output.add(fromMinecraftTag(base)); + } + return output; + } + + @Override + public NBTTagCompound toMinecraftCompound(NbtCompound compound) { + NBTTagCompound output = new NBTTagCompound(); + if (compound.isEmpty()) { + return output; + } + Set keys = compound.getKeys(); + for (String key : keys) { + output.set(key, toMinecraftTag(compound.get(key))); + } + return output; + } + + @Override + public NbtCompound fromMinecraftCompound(Object raw) { + if (!(raw instanceof NBTTagCompound)) { + return null; + } + NBTTagCompound compound = (NBTTagCompound) raw; + NbtCompound output = new NbtCompound(); + if (compound.isEmpty()) { + return output; + } + Set keys = compound.getKeys(); + for (String key : keys) { + output.set(key, fromMinecraftTag(compound.get(key))); + } + return output; + } + + @Override + public org.bukkit.inventory.ItemStack itemFromCompound(NbtCompound compound) { + return CraftItemStack.asBukkitCopy(ItemStack.a(toMinecraftCompound(compound))); + } + + @Override + public NbtCompound itemToCompound(org.bukkit.inventory.ItemStack itemStack) { + return fromMinecraftCompound(CraftItemStack.asNMSCopy(itemStack).getOrCreateTag()); + } + + @Override + public WrappedContext createContext(DataAdapterContext context) { + return new BukkitContext1_14_R1(context); + } + + @Override + public WrapType wrap(DataType dataType) { + return new BukkitType1_14_R1<>(dataType); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/EntityProvider1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/EntityProvider1_14_R1.java new file mode 100644 index 0000000..0cb54df --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/EntityProvider1_14_R1.java @@ -0,0 +1,47 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1; + +import java.util.EnumMap; +import java.util.function.Function; + +import org.bukkit.craftbukkit.v1_14_R1.CraftWorld; + +import net.minecraft.server.v1_14_R1.World; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1.utils.EntityConstructors1_14_R1; +import net.sourcewriters.minecraft.vcompat.reflection.EntityProvider; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; + +public class EntityProvider1_14_R1 extends EntityProvider { + + private final EnumMap> entityMap = new EnumMap<>(NmsEntityType.class); + + protected EntityProvider1_14_R1(VersionControl1_14_R1 versionControl) { + super(versionControl); + } + + @SuppressWarnings("unchecked") + private final Function searchConstructor(NmsEntityType type) { + try { + return (Function) EntityConstructors1_14_R1.class.getField(type.name()).get(null); + } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException ignore) { + return null; + } + } + + private final Function getConstructor(NmsEntityType type) { + return entityMap.computeIfAbsent(type, (key -> searchConstructor(key))); + } + + @Override + public NmsEntity createEntity(org.bukkit.World world, NmsEntityType type) { + if (!(world instanceof CraftWorld)) { + return null; + } + Function function; + if ((function = getConstructor(type)) == null) { + return null; + } + return function.apply(((CraftWorld) world).getHandle()); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/PacketHandler1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/PacketHandler1_14_R1.java new file mode 100644 index 0000000..1eda3c0 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/PacketHandler1_14_R1.java @@ -0,0 +1,11 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1; + +import net.sourcewriters.minecraft.vcompat.reflection.PacketHandler; + +public class PacketHandler1_14_R1 extends PacketHandler { + + protected PacketHandler1_14_R1(VersionControl1_14_R1 versionControl) { + super(versionControl); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/PlayerProvider1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/PlayerProvider1_14_R1.java new file mode 100644 index 0000000..064c77a --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/PlayerProvider1_14_R1.java @@ -0,0 +1,20 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1; + +import org.bukkit.entity.Player; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1.entity.Player1_14_R1; +import net.sourcewriters.minecraft.vcompat.reflection.PlayerProvider; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; + +public class PlayerProvider1_14_R1 extends PlayerProvider { + + protected PlayerProvider1_14_R1(VersionControl1_14_R1 versionControl) { + super(versionControl); + } + + @Override + protected NmsPlayer createPlayer(Player player) { + return new Player1_14_R1(player); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/TextureProvider1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/TextureProvider1_14_R1.java new file mode 100644 index 0000000..526eac6 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/TextureProvider1_14_R1.java @@ -0,0 +1,102 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1; + +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_14_R1.block.CraftBlockEntityState; +import org.bukkit.craftbukkit.v1_14_R1.block.CraftSkull; +import org.bukkit.craftbukkit.v1_14_R1.inventory.CraftItemStack; +import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.inventory.meta.SkullMeta; + +import com.mojang.authlib.GameProfile; +import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; +import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.minecraft.server.v1_14_R1.GameProfileSerializer; +import net.minecraft.server.v1_14_R1.ItemStack; +import net.minecraft.server.v1_14_R1.NBTTagCompound; +import net.minecraft.server.v1_14_R1.TileEntitySkull; +import net.sourcewriters.minecraft.vcompat.reflection.TextureProvider; + +public class TextureProvider1_14_R1 extends TextureProvider { + + private final AbstractReflect craftEntityStateRef = new Reflect(CraftBlockEntityState.class).searchField("tileEntity", "tileEntity"); + private final AbstractReflect craftItemStackRef = new Reflect(CraftItemStack.class).searchField("handle", "handle"); + private final AbstractReflect craftMetaSkullRef = new Reflect("org.bukkit.craftbukkit.v1_14_R1.inventory.CraftMetaSkull") + .searchField("serialized", "serializedProfile").searchField("profile", "profile"); + + protected TextureProvider1_14_R1(VersionControl1_14_R1 versionControl) { + super(versionControl); + } + + @Override + public GameProfile profileFromBlock(Block block) { + if (!(block instanceof CraftSkull)) { + return null; + } + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + return entitySkull.gameProfile; + } + + @Override + public GameProfile profileFromItem(org.bukkit.inventory.ItemStack itemStack) { + if (!(itemStack.getItemMeta() instanceof SkullMeta)) { + return null; + } + SkullMeta meta = (SkullMeta) itemStack.getItemMeta(); + GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue("profile", meta); + if (profile == null) { + NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue("serialized", meta); + if (compound == null) { + ItemStack stack = null; + if (itemStack instanceof CraftItemStack) { + stack = (ItemStack) craftItemStackRef.getFieldValue("handle", itemStack); + } + if (stack == null) { + stack = CraftItemStack.asNMSCopy(itemStack); + } + NBTTagCompound stackTag = stack.getOrCreateTag(); + if (stackTag.hasKeyOfType("SkullOwner", 10)) { + compound = stackTag.getCompound("SkullOwner"); + } else if (stackTag.hasKeyOfType("SkullProfile", 10)) { + compound = stackTag.getCompound("SkullProfile"); + } + } + if (compound == null) { + return null; + } + profile = GameProfileSerializer.deserialize(compound); + } + return profile; + } + + @Override + public org.bukkit.inventory.ItemStack getItem(GameProfile profile) { + org.bukkit.inventory.ItemStack craftStack = CraftItemStack.asCraftCopy(new org.bukkit.inventory.ItemStack(Material.PLAYER_HEAD)); + applyItem(craftStack, profile); + return craftStack; + } + + @Override + public boolean applyItem(org.bukkit.inventory.ItemStack itemStack, GameProfile profile) { + ItemMeta meta = itemStack.getItemMeta(); + if (!(meta instanceof SkullMeta)) { + return false; + } + SkullMeta skullMeta = (SkullMeta) meta; + craftMetaSkullRef.setFieldValue(meta, "profile", profile); + itemStack.setItemMeta(skullMeta); + return true; + } + + @Override + public boolean applyBlock(Block block, GameProfile profile) { + if (!(block instanceof CraftSkull)) { + return false; + } + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + entitySkull.setGameProfile(profile); + return true; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/ToolProvider1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/ToolProvider1_14_R1.java new file mode 100644 index 0000000..db19fec --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/ToolProvider1_14_R1.java @@ -0,0 +1,33 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1.tools.BlockTools1_14_R1; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1.tools.ServerTools1_14_R1; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1.tools.SkinTools1_14_R1; +import net.sourcewriters.minecraft.vcompat.reflection.ToolProvider; + +public class ToolProvider1_14_R1 extends ToolProvider { + + private final BlockTools1_14_R1 blockTools = new BlockTools1_14_R1(); + private final SkinTools1_14_R1 skinTools = new SkinTools1_14_R1(); + private final ServerTools1_14_R1 serverTools = new ServerTools1_14_R1(); + + protected ToolProvider1_14_R1(VersionControl1_14_R1 versionControl) { + super(versionControl); + } + + @Override + public SkinTools1_14_R1 getSkinTools() { + return skinTools; + } + + @Override + public ServerTools1_14_R1 getServerTools() { + return serverTools; + } + + @Override + public BlockTools1_14_R1 getBlockTools() { + return blockTools; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/VersionControl1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/VersionControl1_14_R1.java new file mode 100644 index 0000000..8971b60 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/VersionControl1_14_R1.java @@ -0,0 +1,61 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1.data.hook.BukkitContainerAdapterHook1_14_R1; +import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; + +public class VersionControl1_14_R1 extends VersionControl { + + public static VersionControl1_14_R1 INSTANCE; + + public static VersionControl1_14_R1 init() { + return INSTANCE != null ? INSTANCE : (INSTANCE = new VersionControl1_14_R1()); + } + + private final ToolProvider1_14_R1 toolProvider = new ToolProvider1_14_R1(this); + private final TextureProvider1_14_R1 textureProvider = new TextureProvider1_14_R1(this); + private final PacketHandler1_14_R1 packetHandler = new PacketHandler1_14_R1(this); + private final EntityProvider1_14_R1 entityProvider = new EntityProvider1_14_R1(this); + private final PlayerProvider1_14_R1 playerProvider = new PlayerProvider1_14_R1(this); + private final BukkitConversion1_14_R1 bukkitConversion = new BukkitConversion1_14_R1(this); + + private VersionControl1_14_R1() { + BukkitContainerAdapterHook1_14_R1.hookEntity(); + } + + @Override + public ToolProvider1_14_R1 getToolProvider() { + return toolProvider; + } + + @Override + public EntityProvider1_14_R1 getEntityProvider() { + return entityProvider; + } + + @Override + public PlayerProvider1_14_R1 getPlayerProvider() { + return playerProvider; + } + + @Override + public TextureProvider1_14_R1 getTextureProvider() { + return textureProvider; + } + + @Override + public PacketHandler1_14_R1 getPacketHandler() { + return packetHandler; + } + + @Override + public BukkitConversion1_14_R1 getBukkitConversion() { + return bukkitConversion; + } + + @Override + public void shutdown() { + dataProvider.getDefaultDistributor().shutdown(); + BukkitContainerAdapterHook1_14_R1.unhookAll(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/BukkitContainer1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/BukkitContainer1_14_R1.java new file mode 100644 index 0000000..c3249e6 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/BukkitContainer1_14_R1.java @@ -0,0 +1,160 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1.data; + +import java.util.Arrays; +import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; + +import org.bukkit.NamespacedKey; +import org.bukkit.persistence.PersistentDataAdapterContext; +import org.bukkit.persistence.PersistentDataContainer; +import org.bukkit.persistence.PersistentDataType; + +import com.syntaxphoenix.syntaxapi.data.IDataContainer; + +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; +import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SyntaxKey; + +public final class BukkitContainer1_14_R1 extends WrappedContainer implements PersistentDataContainer { + + private final IDataContainer container; + + public BukkitContainer1_14_R1(IDataContainer container) { + this.container = container; + } + + @Override + public IDataContainer getHandle() { + return container; + } + + @Override + public IDataContainer getAsSyntaxContainer() { + return container; + } + + /* + * + */ + + @Override + public boolean has(NamespacedKey key, PersistentDataType type) { + return has(new BukkitKey1_14_R1(key), WrappedType1_14_R1.wrap(type)); + } + + @Override + public Z get(NamespacedKey key, PersistentDataType type) { + return get(new BukkitKey1_14_R1(key), WrappedType1_14_R1.wrap(type)); + } + + @Override + public Z getOrDefault(NamespacedKey key, PersistentDataType type, Z value) { + return Optional.ofNullable(get(key, type)).orElse(value); + } + + @Override + public void set(NamespacedKey key, PersistentDataType type, Z value) { + set(new BukkitKey1_14_R1(key), value, WrappedType1_14_R1.wrap(type)); + } + + @Override + public void remove(NamespacedKey key) { + remove(new BukkitKey1_14_R1(key)); + } + + public Set getKeys() { + return Arrays.stream(container.getKeys()).map(SyntaxKey::new).map(BukkitKey1_14_R1::asBukkit).collect(Collectors.toSet()); + } + + @Override + public PersistentDataAdapterContext getAdapterContext() { + return getContext(); + } + + /* + * + */ + + @Override + public BukkitContext1_14_R1 getContext() { + return new BukkitContext1_14_R1(container.getAdapterContext()); + } + + @Override + public boolean has(String key) { + return has(wrappedKey(key)); + } + + @Override + public boolean has(WrappedKey key) { + return container.has(key.getNamespacedKey()); + } + + @Override + public boolean has(String key, WrapType type) { + return has(wrappedKey(key), type); + } + + @Override + public boolean has(WrappedKey key, WrapType type) { + return container.has(key.getNamespacedKey(), type.syntaxType()); + } + + @Override + public Object get(String key) { + return get(wrappedKey(key)); + } + + @Override + public Object get(WrappedKey key) { + return container.get(key.getNamespacedKey()); + } + + @Override + public C get(String key, WrapType type) { + return get(wrappedKey(key), type); + } + + @Override + public C get(WrappedKey key, WrapType type) { + return container.get(key.getNamespacedKey(), type.syntaxType()); + } + + @Override + public void set(String key, B value, WrapType type) { + set(wrappedKey(key), value, type); + } + + @Override + public void set(WrappedKey key, B value, WrapType type) { + container.set(key.getNamespacedKey(), value, type.syntaxType()); + } + + @Override + public boolean remove(String key) { + return false; + } + + @Override + public boolean remove(WrappedKey key) { + return container.remove(key.getNamespacedKey()); + } + + @Override + public Set keySet() { + return container.getKeyspaces(); + } + + @Override + public boolean isEmpty() { + return container.isEmpty(); + } + + @Override + public int size() { + return container.size(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/BukkitContext1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/BukkitContext1_14_R1.java new file mode 100644 index 0000000..1b6becf --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/BukkitContext1_14_R1.java @@ -0,0 +1,39 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1.data; + +import org.bukkit.persistence.PersistentDataAdapterContext; +import org.bukkit.persistence.PersistentDataContainer; + +import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; +import com.syntaxphoenix.syntaxapi.data.IDataContainer; + +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; + +public final class BukkitContext1_14_R1 extends WrappedContext implements PersistentDataAdapterContext { + + private final DataAdapterContext context; + + public BukkitContext1_14_R1(DataAdapterContext context) { + this.context = context; + } + + @Override + public DataAdapterContext getHandle() { + return context; + } + + @Override + public PersistentDataContainer newPersistentDataContainer() { + return newContainer(); + } + + @Override + public IDataContainer newDataContainer() { + return context.newDataContainer(); + } + + @Override + public BukkitContainer1_14_R1 newContainer() { + return new BukkitContainer1_14_R1(context.newDataContainer()); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/BukkitKey1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/BukkitKey1_14_R1.java new file mode 100644 index 0000000..508d7be --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/BukkitKey1_14_R1.java @@ -0,0 +1,52 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1.data; + +import org.bukkit.NamespacedKey; +import org.bukkit.plugin.Plugin; + +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; + +public final class BukkitKey1_14_R1 extends WrappedKey { + + private final NamespacedKey key; + + public BukkitKey1_14_R1(Plugin plugin, String key) { + this.key = new NamespacedKey(plugin, key); + } + + @SuppressWarnings("deprecation") + public BukkitKey1_14_R1(String name, String key) { + this.key = new NamespacedKey(name, key); + } + + public BukkitKey1_14_R1(NamespacedKey key) { + this.key = key; + } + + @Override + public NamespacedKey getHandle() { + return key; + } + + @Override + public String getName() { + return key.getNamespace(); + } + + @Override + public String getKey() { + return key.getKey(); + } + + @Override + public String toString() { + return key.toString(); + } + + public static NamespacedKey asBukkit(WrappedKey key) { + if (key.getHandle() instanceof NamespacedKey) { + return (NamespacedKey) key.getHandle(); + } + return new BukkitKey1_14_R1(key.getName(), key.getKey()).getHandle(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/BukkitType1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/BukkitType1_14_R1.java new file mode 100644 index 0000000..964655b --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/BukkitType1_14_R1.java @@ -0,0 +1,69 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1.data; + +import org.bukkit.persistence.PersistentDataAdapterContext; +import org.bukkit.persistence.PersistentDataType; + +import com.syntaxphoenix.syntaxapi.data.DataType; + +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; + +public class BukkitType1_14_R1 extends WrappedType1_14_R1, P0, P1, C0, C1> + implements PersistentDataType { + + private final DataType type; + + public BukkitType1_14_R1(DataType type) { + super(type.getPrimitive(), type.getComplex()); + this.type = type; + } + + @Override + public DataType getHandle() { + return type; + } + + @Override + public Class getPrimitiveOriginal() { + return type.getPrimitive(); + } + + @Override + public Class getComplexOriginal() { + return type.getComplex(); + } + + /* + * + */ + + @Override + public Class getComplexType() { + return complexType; + } + + @Override + public Class getPrimitiveType() { + return primitiveType; + } + + @Override + public P0 toPrimitive(C0 complex, PersistentDataAdapterContext context) { + return wrapToPrimitive(complex, new SyntaxContext1_14_R1(context)); + } + + @Override + public C0 fromPrimitive(P0 primitive, PersistentDataAdapterContext context) { + return wrapToComplex(primitive, new SyntaxContext1_14_R1(context)); + } + + @Override + public P0 wrapToPrimitive(C0 complex, WrappedContext context) { + return toPrimitiveWrapped(type.toPrimitive(context, toComplexOriginal(complex))); + } + + @Override + public C0 wrapToComplex(P0 primitive, WrappedContext context) { + return toComplexWrapped(type.fromPrimitive(context, toPrimitiveOriginal(primitive))); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/SimpleBukkitType1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/SimpleBukkitType1_14_R1.java new file mode 100644 index 0000000..56d158f --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/SimpleBukkitType1_14_R1.java @@ -0,0 +1,36 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1.data; + +import org.bukkit.persistence.PersistentDataAdapterContext; +import org.bukkit.persistence.PersistentDataType; + +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; + +public class SimpleBukkitType1_14_R1 implements PersistentDataType { + + private final WrapType type; + + public SimpleBukkitType1_14_R1(WrapType type) { + this.type = type; + } + + @Override + public Class getComplexType() { + return type.getComplexWrapped(); + } + + @Override + public Class

getPrimitiveType() { + return type.getPrimitiveWrapped(); + } + + @Override + public P toPrimitive(C complex, PersistentDataAdapterContext context) { + return type.wrapToPrimitive(complex, new SyntaxContext1_14_R1(context)); + } + + @Override + public C fromPrimitive(P primitive, PersistentDataAdapterContext context) { + return type.wrapToComplex(primitive, new SyntaxContext1_14_R1(context)); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/SyntaxContainer1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/SyntaxContainer1_14_R1.java new file mode 100644 index 0000000..74ed922 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/SyntaxContainer1_14_R1.java @@ -0,0 +1,185 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1.data; + +import java.util.Set; +import java.util.stream.Collectors; + +import org.bukkit.persistence.PersistentDataContainer; + +import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; +import com.syntaxphoenix.syntaxapi.data.DataType; +import com.syntaxphoenix.syntaxapi.data.IDataContainer; +import com.syntaxphoenix.syntaxapi.utils.key.IKey; + +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; +import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SyntaxKey; + +public final class SyntaxContainer1_14_R1 extends WrappedContainer implements IDataContainer { + + private final PersistentDataContainer container; + + public SyntaxContainer1_14_R1(PersistentDataContainer container) { + this.container = container; + } + + @Override + public PersistentDataContainer getHandle() { + return container; + } + + @Override + public IDataContainer getAsSyntaxContainer() { + return new SyntaxContainer1_14_R1(container); + } + + /* + * + */ + + @Override + public boolean has(IKey key) { + throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); + } + + @Override + public boolean has(String key, DataType type) { + return has(syntaxKey(key), type); + } + + @Override + public boolean has(IKey key, DataType type) { + return has(new SyntaxKey(key), WrappedType1_14_R1.wrap(type)); + } + + @Override + public C get(String key, DataType type) { + return get(syntaxKey(key), type); + } + + @Override + public C get(IKey key, DataType type) { + return get(new SyntaxKey(key), WrappedType1_14_R1.wrap(type)); + } + + @Override + public Object get(String key) { + throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); + } + + @Override + public Object get(IKey key) { + throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); + } + + @Override + public void set(String key, E value, DataType type) { + set(wrappedKey(key), value, WrappedType1_14_R1.wrap(type)); + } + + @Override + public void set(IKey key, E value, DataType type) { + set(new SyntaxKey(key), value, WrappedType1_14_R1.wrap(type)); + } + + @Override + public boolean remove(String key) { + return remove(wrappedKey(key)); + } + + @Override + public boolean remove(IKey key) { + return remove(new SyntaxKey(key)); + } + + @Override + public IKey[] getKeys() { + return container.getKeys().stream().map(BukkitKey1_14_R1::new).map(WrappedKey::getNamespacedKey).toArray(IKey[]::new); + } + + @Override + public Set getKeyspaces() { + return container.getKeys().stream().map(org.bukkit.NamespacedKey::toString).collect(Collectors.toSet()); + } + + @Override + public DataAdapterContext getAdapterContext() { + return getContext(); + } + + /* + * + */ + + @Override + public SyntaxContext1_14_R1 getContext() { + return new SyntaxContext1_14_R1(container.getAdapterContext()); + } + + @Override + public boolean has(String key) { + throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); + } + + @Override + public boolean has(WrappedKey key) { + throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); + } + + @Override + public boolean has(String key, WrapType type) { + return has(wrappedKey(key), type); + } + + @Override + public boolean has(WrappedKey key, WrapType type) { + return container.has(BukkitKey1_14_R1.asBukkit(key), new SimpleBukkitType1_14_R1<>(type)); + } + + @Override + public Object get(WrappedKey key) { + throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); + } + + @Override + public C get(String key, WrapType type) { + return get(wrappedKey(key), type); + } + + @Override + public C get(WrappedKey key, WrapType type) { + return container.get(BukkitKey1_14_R1.asBukkit(key), new SimpleBukkitType1_14_R1<>(type)); + } + + @Override + public void set(String key, B value, WrapType type) { + set(wrappedKey(key), value, type); + } + + @Override + public void set(WrappedKey key, B value, WrapType type) { + container.set(BukkitKey1_14_R1.asBukkit(key), new SimpleBukkitType1_14_R1<>(type), value); + } + + @Override + public boolean remove(WrappedKey key) { + container.remove(BukkitKey1_14_R1.asBukkit(key)); + return true; // Will always return true as we don't know if it contained it + } + + @Override + public Set keySet() { + return getKeyspaces(); + } + + @Override + public boolean isEmpty() { + return container.isEmpty(); + } + + @Override + public int size() { + return 0; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/SyntaxContext1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/SyntaxContext1_14_R1.java new file mode 100644 index 0000000..2a7de94 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/SyntaxContext1_14_R1.java @@ -0,0 +1,38 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1.data; + +import org.bukkit.persistence.PersistentDataAdapterContext; +import org.bukkit.persistence.PersistentDataContainer; + +import com.syntaxphoenix.syntaxapi.data.IDataContainer; + +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; + +public final class SyntaxContext1_14_R1 extends WrappedContext implements PersistentDataAdapterContext { + + private final PersistentDataAdapterContext context; + + public SyntaxContext1_14_R1(PersistentDataAdapterContext context) { + this.context = context; + } + + @Override + public PersistentDataAdapterContext getHandle() { + return context; + } + + @Override + public PersistentDataContainer newPersistentDataContainer() { + return context.newPersistentDataContainer(); + } + + @Override + public IDataContainer newDataContainer() { + return newContainer(); + } + + @Override + public SyntaxContainer1_14_R1 newContainer() { + return new SyntaxContainer1_14_R1(context.newPersistentDataContainer()); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/SyntaxType1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/SyntaxType1_14_R1.java new file mode 100644 index 0000000..8855f0e --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/SyntaxType1_14_R1.java @@ -0,0 +1,76 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1.data; + +import org.bukkit.persistence.PersistentDataAdapterContext; +import org.bukkit.persistence.PersistentDataType; + +import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; +import com.syntaxphoenix.syntaxapi.data.DataType; + +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; + +public class SyntaxType1_14_R1 extends WrappedType1_14_R1, P0, P1, C0, C1> + implements DataType { + + private final PersistentDataType type; + + public SyntaxType1_14_R1(PersistentDataType type) { + super(type.getPrimitiveType(), type.getComplexType()); + this.type = type; + } + + @Override + public PersistentDataType getHandle() { + return type; + } + + @Override + public Class getPrimitiveOriginal() { + return type.getPrimitiveType(); + } + + @Override + public Class getComplexOriginal() { + return type.getComplexType(); + } + + /* + * + */ + + @Override + public Class getComplex() { + return complexType; + } + + @Override + public Class getPrimitive() { + return primitiveType; + } + + @Override + public P0 toPrimitive(DataAdapterContext context, C0 complex) { + return wrapToPrimitive(complex, new BukkitContext1_14_R1(context)); + } + + @Override + public C0 fromPrimitive(DataAdapterContext context, P0 primitive) { + return wrapToComplex(primitive, new BukkitContext1_14_R1(context)); + } + + @Override + public P0 wrapToPrimitive(C0 complex, WrappedContext context) { + if (!(context instanceof PersistentDataAdapterContext)) { + return null; + } + return toPrimitiveWrapped(type.toPrimitive(toComplexOriginal(complex), (PersistentDataAdapterContext) context)); + } + + @Override + public C0 wrapToComplex(P0 primitive, WrappedContext context) { + if (!(context instanceof PersistentDataAdapterContext)) { + return null; + } + return toComplexWrapped(type.fromPrimitive(toPrimitiveOriginal(primitive), (PersistentDataAdapterContext) context)); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/WrappedType1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/WrappedType1_14_R1.java new file mode 100644 index 0000000..6363015 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/WrappedType1_14_R1.java @@ -0,0 +1,150 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1.data; + +import java.util.Arrays; + +import org.bukkit.persistence.PersistentDataContainer; +import org.bukkit.persistence.PersistentDataType; + +import com.syntaxphoenix.syntaxapi.data.DataType; +import com.syntaxphoenix.syntaxapi.data.IDataContainer; + +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; + +public abstract class WrappedType1_14_R1 implements WrapType { + + protected final Class primitiveType; + protected final Class complexType; + + private final int primitiveWrap; + private final int complexWrap; + + @SuppressWarnings("unchecked") + protected WrappedType1_14_R1(Class primitive, Class complex) { + this.primitiveWrap = WrappedType1_14_R1.internalState(primitive); + this.complexWrap = WrappedType1_14_R1.internalState(complex); + this.primitiveType = (Class) WrappedType1_14_R1.internalWrap(primitive, primitiveWrap); + this.complexType = (Class) WrappedType1_14_R1.internalWrap(complex, complexWrap); + } + + public abstract H getHandle(); + + public Class getPrimitiveWrapped() { + return primitiveType; + } + + public Class getComplexWrapped() { + return complexType; + } + + public abstract Class getPrimitiveOriginal(); + + public abstract Class getComplexOriginal(); + + @SuppressWarnings("unchecked") + public P0 toPrimitiveWrapped(P1 primitive) { + switch (primitiveWrap) { + case 1: + return (P0) new SyntaxContainer1_14_R1((PersistentDataContainer) primitive); + case 2: + return (P0) Arrays.stream((PersistentDataContainer[]) primitive).map(SyntaxContainer1_14_R1::new) + .toArray(SyntaxContainer1_14_R1[]::new); + case 3: + return (P0) new BukkitContainer1_14_R1((IDataContainer) primitive); + case 4: + return (P0) Arrays.stream((IDataContainer[]) primitive).map(BukkitContainer1_14_R1::new) + .toArray(BukkitContainer1_14_R1[]::new); + default: + return (P0) primitive; + } + } + + @SuppressWarnings("unchecked") + public C0 toComplexWrapped(C1 complex) { + switch (complexWrap) { + case 1: + return (C0) new SyntaxContainer1_14_R1((PersistentDataContainer) complex); + case 2: + return (C0) Arrays.stream((PersistentDataContainer[]) complex).map(SyntaxContainer1_14_R1::new).toArray(SyntaxContainer1_14_R1[]::new); + case 3: + return (C0) new BukkitContainer1_14_R1((IDataContainer) complex); + case 4: + return (C0) Arrays.stream((IDataContainer[]) complex).map(BukkitContainer1_14_R1::new).toArray(BukkitContainer1_14_R1[]::new); + default: + return (C0) complex; + } + } + + @SuppressWarnings("unchecked") + public P1 toPrimitiveOriginal(P0 primitive) { + switch (primitiveWrap) { + case 1: + return (P1) new BukkitContainer1_14_R1((IDataContainer) primitive); + case 2: + return (P1) Arrays.stream((IDataContainer[]) primitive).map(BukkitContainer1_14_R1::new) + .toArray(BukkitContainer1_14_R1[]::new); + case 3: + return (P1) new SyntaxContainer1_14_R1((PersistentDataContainer) primitive); + case 4: + return (P1) Arrays.stream((PersistentDataContainer[]) primitive).map(SyntaxContainer1_14_R1::new) + .toArray(SyntaxContainer1_14_R1[]::new); + default: + return (P1) primitive; + } + } + + @SuppressWarnings("unchecked") + public C1 toComplexOriginal(C0 complex) { + switch (complexWrap) { + case 1: + return (C1) new BukkitContainer1_14_R1((IDataContainer) complex); + case 2: + return (C1) Arrays.stream((IDataContainer[]) complex).map(BukkitContainer1_14_R1::new).toArray(BukkitContainer1_14_R1[]::new); + case 3: + return (C1) new SyntaxContainer1_14_R1((PersistentDataContainer) complex); + case 4: + return (C1) Arrays.stream((PersistentDataContainer[]) complex).map(SyntaxContainer1_14_R1::new).toArray(SyntaxContainer1_14_R1[]::new); + default: + return (C1) complex; + } + } + + protected static Class internalWrap(Class clazz, int state) { + switch (state) { + case 1: + return SyntaxContainer1_14_R1.class; + case 2: + return SyntaxContainer1_14_R1[].class; + case 3: + return BukkitContainer1_14_R1.class; + case 4: + return BukkitContainer1_14_R1[].class; + default: + return clazz; + } + } + + protected static int internalState(Class clazz) { + if (clazz.isAssignableFrom(PersistentDataContainer.class)) { + return 1; + } + if (clazz.isAssignableFrom(PersistentDataContainer[].class)) { + return 2; + } + if (clazz.isAssignableFrom(IDataContainer.class)) { + return 3; + } + if (clazz.isAssignableFrom(IDataContainer[].class)) { + return 4; + } + return 0; + } + + public static BukkitType1_14_R1 wrap(DataType type) { + return new BukkitType1_14_R1<>(type); + } + + public static SyntaxType1_14_R1 wrap(PersistentDataType type) { + return new SyntaxType1_14_R1<>(type); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/hook/BukkitContainerAdapterHook1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/hook/BukkitContainerAdapterHook1_14_R1.java new file mode 100644 index 0000000..6e291ef --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/hook/BukkitContainerAdapterHook1_14_R1.java @@ -0,0 +1,134 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1.data.hook; + +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; + +import org.bukkit.craftbukkit.v1_14_R1.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_14_R1.persistence.CraftPersistentDataContainer; +import org.bukkit.craftbukkit.v1_14_R1.persistence.CraftPersistentDataTypeRegistry; +import org.bukkit.persistence.PersistentDataContainer; + +import com.syntaxphoenix.syntaxapi.data.IDataContainer; +import com.syntaxphoenix.syntaxapi.data.container.nbt.NbtContainer; +import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; +import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; +import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.minecraft.server.v1_14_R1.NBTTagCompound; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1.data.BukkitContainer1_14_R1; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1.data.SyntaxContainer1_14_R1; +import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; + +@SuppressWarnings({ + "rawtypes", + "unchecked" +}) +public final class BukkitContainerAdapterHook1_14_R1 { + + private static final BukkitContainerAdapterHook1_14_R1 HOOK = new BukkitContainerAdapterHook1_14_R1(); + + private final AbstractReflect registryRef = new Reflect(CraftPersistentDataTypeRegistry.class) + .searchMethod("create", "createAdapter", Class.class, Class.class, Function.class, Function.class) + .searchField("adapters", "adapters") + .searchField("function", "CREATE_ADAPTER"); + private final AbstractReflect entityRef = new Reflect(CraftEntity.class).searchField("registry", "DATA_TYPE_REGISTRY"); + + private BukkitContainerAdapterHook1_14_R1() {} + + private final HashMap map = new HashMap<>(); + + private CraftPersistentDataTypeRegistry getEntityRegistry() { + return (CraftPersistentDataTypeRegistry) entityRef.getFieldValue("registry"); + } + + private void uninjectAll() { + for (CraftPersistentDataTypeRegistry registry : map.keySet()) { + Map adapters = (Map) registryRef.getFieldValue("adapters", registry); + adapters.remove(BukkitContainer1_14_R1.class); + adapters.remove(SyntaxContainer1_14_R1.class); + registryRef.setFieldValue(registry, "function", map.get(registry)); + } + map.clear(); + } + + private void inject(CraftPersistentDataTypeRegistry registry) { + if (map.containsKey(registry)) { + return; + } + map.put(registry, (Function) registryRef.getFieldValue("function", registry)); + Function function = clazz -> createAdapter(registry, registryRef.getMethod("create").getReturnType(), (Class) clazz); + registryRef.setFieldValue(registry, "function", function); + } + + private E createAdapter(CraftPersistentDataTypeRegistry registry, Class adapterType, Class type) { + if (Objects.equals(BukkitContainer1_14_R1.class, type)) { + return (E) buildAdapter(registry, BukkitContainer1_14_R1.class, tag -> fromPrimitiveSyntax(tag)); + } + if (Objects.equals(SyntaxContainer1_14_R1.class, type)) { + return (E) buildAdapter(registry, SyntaxContainer1_14_R1.class, tag -> fromPrimitiveBukkit(registry, tag)); + } + return (E) map.get(registry).apply(type); + } + + private Object buildAdapter(Object handle, Class type, Function function) { + return registryRef.run(handle, "create", type, NBTTagCompound.class, (Function) input -> toPrimitive(input), + function); + } + + private NBTTagCompound toPrimitive(WrappedContainer input) { + Object handle = findFinalContainer(input).getHandle(); + if (handle instanceof PersistentDataContainer) { + if (handle instanceof CraftPersistentDataContainer) { + return ((CraftPersistentDataContainer) handle).toTagCompound(); + } + throw new IllegalArgumentException( + "Expected 'CraftPersistentDataContainer' got '" + handle.getClass().getSimpleName() + " instead'!"); + } + if (handle instanceof IDataContainer) { + if (handle instanceof NbtContainer) { + return (NBTTagCompound) VersionControl.get().getBukkitConversion().toMinecraftCompound(((NbtContainer) handle).asNbt()); + } + throw new IllegalArgumentException( + "Expected 'CraftPersistentDataContainer' got '" + handle.getClass().getSimpleName() + " instead'!"); + } + throw new IllegalArgumentException("Unknown WrappedContainer implementation!"); + } + + private BukkitContainer1_14_R1 fromPrimitiveSyntax(NBTTagCompound data) { + VersionControl control = VersionControl.get(); + NbtContainer container = new NbtContainer(control.getDataProvider().getRegistry()); + NbtCompound compound = control.getBukkitConversion().fromMinecraftCompound(data); + container.fromNbt(compound); + return new BukkitContainer1_14_R1(container); + } + + private SyntaxContainer1_14_R1 fromPrimitiveBukkit(CraftPersistentDataTypeRegistry registry, NBTTagCompound data) { + CraftPersistentDataContainer container = new CraftPersistentDataContainer(registry); + container.putAll(data); + return new SyntaxContainer1_14_R1(container); + } + + private WrappedContainer findFinalContainer(WrappedContainer container) { + WrappedContainer output = container; + while (output.getHandle() instanceof WrappedContainer) { + output = (WrappedContainer) output.getHandle(); + } + return output; + } + + public static void unhookAll() { + HOOK.uninjectAll(); + } + + public static void hookEntity() { + HOOK.inject(HOOK.getEntityRegistry()); + } + + public static void hook(CraftPersistentDataTypeRegistry registry) { + HOOK.inject(registry); + } + +} diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/entity/ArmorStand1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/entity/ArmorStand1_14_R1.java new file mode 100644 index 0000000..6b1472c --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/entity/ArmorStand1_14_R1.java @@ -0,0 +1,24 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1.entity; + +import net.minecraft.server.v1_14_R1.EntityArmorStand; +import net.minecraft.server.v1_14_R1.EntityTypes; +import net.minecraft.server.v1_14_R1.World; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsArmorStand; + +public class ArmorStand1_14_R1 extends EntityLiving1_14_R1 implements NmsArmorStand { + + public ArmorStand1_14_R1(World world) { + super(new EntityArmorStand(EntityTypes.ARMOR_STAND, world)); + } + + @Override + public void setSmall(boolean small) { + handle.setSmall(small); + } + + @Override + public boolean isSmall() { + return handle.isSmall(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/entity/Entity1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/entity/Entity1_14_R1.java new file mode 100644 index 0000000..6229156 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/entity/Entity1_14_R1.java @@ -0,0 +1,215 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1.entity; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.UUID; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.OfflinePlayer; +import org.bukkit.craftbukkit.v1_14_R1.CraftWorld; +import org.bukkit.craftbukkit.v1_14_R1.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_14_R1.util.CraftChatMessage; +import org.bukkit.entity.Player; + +import net.minecraft.server.v1_14_R1.AxisAlignedBB; +import net.minecraft.server.v1_14_R1.Entity; +import net.minecraft.server.v1_14_R1.PacketPlayOutEntityDestroy; +import net.minecraft.server.v1_14_R1.PacketPlayOutEntityMetadata; +import net.minecraft.server.v1_14_R1.PacketPlayOutSpawnEntity; +import net.minecraft.server.v1_14_R1.PlayerConnection; +import net.minecraft.server.v1_14_R1.Vec3D; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.reflection.utils.NmsBoundingBox; + +public abstract class Entity1_14_R1 implements NmsEntity { + + protected final E handle; + + protected final List visible = Collections.synchronizedList(new ArrayList<>()); + + public Entity1_14_R1(E handle) { + this.handle = handle; + } + + @Override + public final E getHandle() { + return handle; + } + + @Override + public int getId() { + return handle.getId(); + } + + @Override + public UUID getUniqueId() { + return handle.getUniqueID(); + } + + @Override + public NmsBoundingBox getBoundingBox() { + AxisAlignedBB box = handle.getBoundingBox(); + return new NmsBoundingBox(box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ); + } + + @Override + public void setCustomName(String name) { + handle.setCustomName(CraftChatMessage.fromStringOrNull(name)); + updateVisibility(); + } + + @Override + public String getCustomName() { + return CraftChatMessage.fromComponent(handle.getCustomName()); + } + + @Override + public void setGravity(boolean gravity) { + handle.setNoGravity(!gravity); + } + + @Override + public boolean hasGravity() { + return !handle.isNoGravity(); + } + + @Override + public void setCustomNameVisible(boolean visible) { + handle.setCustomNameVisible(visible); + } + + @Override + public boolean isCustomNameVisible() { + return handle.getCustomNameVisible(); + } + + @Override + public void setInvisible(boolean invisible) { + handle.setInvisible(invisible); + } + + @Override + public boolean isInvisible() { + return handle.isInvisible(); + } + + @Override + public boolean isInteractable() { + return handle.isInteractable(); + } + + @Override + public boolean isCollidable() { + return handle.isCollidable(); + } + + @Override + public void setInvulnerable(boolean invulnerable) { + handle.setInvulnerable(invulnerable); + } + + @Override + public boolean isInvulnerable() { + return handle.isInvulnerable(); + } + + @Override + public void setLocation(Location location) { + handle.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); + if (location.getWorld() == null || handle.getWorld().getWorld() == location.getWorld()) { + updateVisibility(); + return; + } + handle.world = ((CraftWorld) location.getWorld()).getHandle(); + updateVisibility(); + } + + @Override + public Location getLocation() { + Vec3D vector = handle.bO(); + return new Location(handle.getWorld().getWorld(), vector.x, vector.y, vector.z); + } + + @Override + public void updateVisibility() { + if (visible.isEmpty()) { + return; + } + Player[] players; + synchronized (visible) { + players = visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) + .toArray(Player[]::new); + } + hide(players); + show(players); + } + + @Override + public boolean isShown(Player player) { + synchronized (visible) { + return visible.contains(player.getUniqueId()); + } + } + + @Override + public void hide(Player... players) { + if (players.length == 0) { + return; + } + PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(handle.getId()); + for (Player player : players) { + if (!isShown(player)) { + continue; + } + ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); + synchronized (visible) { + visible.remove(player.getUniqueId()); + } + } + } + + @Override + public void show(Player... players) { + if (players.length == 0) { + return; + } + PacketPlayOutSpawnEntity packet = new PacketPlayOutSpawnEntity(handle); + PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); + PlayerConnection connection; + for (Player player : players) { + if (isShown(player)) { + continue; + } + connection = ((CraftPlayer) player).getHandle().playerConnection; + connection.sendPacket(packet); + connection.sendPacket(metadataPacket); + synchronized (visible) { + visible.add(player.getUniqueId()); + } + } + } + + @Override + public UUID[] getVisible() { + synchronized (visible) { + return visible.toArray(new UUID[0]); + } + } + + @Override + public Player[] getVisibleAsPlayer() { + synchronized (visible) { + return visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) + .toArray(Player[]::new); + } + } + + @Override + public void kill() { + hide(getVisibleAsPlayer()); + handle.die(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/entity/EntityLiving1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/entity/EntityLiving1_14_R1.java new file mode 100644 index 0000000..7c507da --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/entity/EntityLiving1_14_R1.java @@ -0,0 +1,17 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1.entity; + +import net.minecraft.server.v1_14_R1.EntityLiving; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityLiving; + +public abstract class EntityLiving1_14_R1 extends Entity1_14_R1 implements NmsEntityLiving { + + public EntityLiving1_14_R1(E handle) { + super(handle); + } + + @Override + public void setCollidable(boolean collidable) { + handle.collides = collidable; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/entity/Player1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/entity/Player1_14_R1.java new file mode 100644 index 0000000..fdd4cae --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/entity/Player1_14_R1.java @@ -0,0 +1,289 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1.entity; + +import java.util.ArrayList; +import java.util.Collections; + +import org.bukkit.craftbukkit.v1_14_R1.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_14_R1.util.CraftChatMessage; +import org.bukkit.entity.Player; + +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.properties.Property; +import com.mojang.authlib.properties.PropertyMap; + +import net.minecraft.server.v1_14_R1.EntityPlayer; +import net.minecraft.server.v1_14_R1.EnumItemSlot; +import net.minecraft.server.v1_14_R1.IChatBaseComponent; +import net.minecraft.server.v1_14_R1.MathHelper; +import net.minecraft.server.v1_14_R1.PacketPlayInClientCommand; +import net.minecraft.server.v1_14_R1.PacketPlayInClientCommand.EnumClientCommand; +import net.minecraft.server.v1_14_R1.PacketPlayOutEntityDestroy; +import net.minecraft.server.v1_14_R1.PacketPlayOutEntityEquipment; +import net.minecraft.server.v1_14_R1.PacketPlayOutEntityHeadRotation; +import net.minecraft.server.v1_14_R1.PacketPlayOutEntityMetadata; +import net.minecraft.server.v1_14_R1.PacketPlayOutEntityStatus; +import net.minecraft.server.v1_14_R1.PacketPlayOutHeldItemSlot; +import net.minecraft.server.v1_14_R1.PacketPlayOutNamedEntitySpawn; +import net.minecraft.server.v1_14_R1.PacketPlayOutPlayerInfo; +import net.minecraft.server.v1_14_R1.PacketPlayOutPlayerInfo.EnumPlayerInfoAction; +import net.minecraft.server.v1_14_R1.PacketPlayOutPlayerListHeaderFooter; +import net.minecraft.server.v1_14_R1.PacketPlayOutPosition; +import net.minecraft.server.v1_14_R1.PacketPlayOutRespawn; +import net.minecraft.server.v1_14_R1.PacketPlayOutTitle; +import net.minecraft.server.v1_14_R1.PacketPlayOutTitle.EnumTitleAction; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1.data.SyntaxContainer1_14_R1; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.reflection.data.type.SkinDataType; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; +import net.sourcewriters.minecraft.vcompat.utils.bukkit.Players; +import net.sourcewriters.minecraft.vcompat.utils.minecraft.MojangProfileServer; +import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; +import net.sourcewriters.minecraft.vcompat.utils.thread.PostAsync; +import net.minecraft.server.v1_14_R1.PlayerConnection; + +public class Player1_14_R1 extends EntityLiving1_14_R1 implements NmsPlayer { + + private String realName; + private Skin realSkin; + + private final WrappedContainer dataAdapter; + + public Player1_14_R1(Player player) { + super(((CraftPlayer) player).getHandle()); + dataAdapter = new SyntaxContainer1_14_R1(getBukkitPlayer().getPersistentDataContainer()); + update(false); + } + + @Override + public CraftPlayer getBukkitPlayer() { + return handle.getBukkitEntity(); + } + + @Override + public WrappedContainer getDataAdapter() { + return dataAdapter; + } + + @Override + public void setSkin(Skin skin) { + if (skin == null) { + return; + } + dataAdapter.set("skin", skin, SkinDataType.WRAPPED_INSTANCE); + } + + @Override + public Skin getSkin() { + return dataAdapter.getOrDefault("skin", SkinDataType.WRAPPED_INSTANCE, realSkin); + } + + @Override + public Skin getRealSkin() { + return realSkin; + } + + @Override + public void setName(String name) { + if (getName().equals(name)) { + return; + } + if (name == null) { + dataAdapter.remove("name"); + return; + } + dataAdapter.set("name", name, WrapType.STRING); + } + + @Override + public String getName() { + return dataAdapter.getOrDefault("name", WrapType.STRING, realName); + } + + @Override + public String getRealName() { + return realName; + } + + @Override + public void setPlayerListHeader(String text) { + setPlayerListHeaderAndFooter(text, getPlayerListFooter()); + } + + @Override + public String getPlayerListHeader() { + return dataAdapter.getOrDefault("header", WrapType.STRING, ""); + } + + @Override + public void setPlayerListFooter(String text) { + setPlayerListHeaderAndFooter(getPlayerListHeader(), text); + } + + @Override + public String getPlayerListFooter() { + return dataAdapter.getOrDefault("footer", WrapType.STRING, ""); + } + + @Override + public int getPing() { + return handle.ping; + } + + @Override + public void setPlayerListHeaderAndFooter(String header, String footer) { + dataAdapter.set("header", header, WrapType.STRING); + dataAdapter.set("footer", footer, WrapType.STRING); + sendPlayerListInfo(header, footer); + } + + private final void sendPlayerListInfo(String header, String footer) { + if (handle.playerConnection.isDisconnected()) { + return; + } + + IChatBaseComponent headerComponent = header.isEmpty() ? null : CraftChatMessage.fromStringOrNull(header, true); + IChatBaseComponent footerComponent = footer.isEmpty() ? null : CraftChatMessage.fromStringOrNull(footer, true); + + PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter(); + + packet.header = headerComponent; + packet.footer = footerComponent; + + handle.playerConnection.sendPacket(packet); + } + + @Override + public void setTitleTimes(int fadeIn, int stay, int fadeOut) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TIMES, null, fadeIn, stay, fadeOut)); + } + + @Override + public void sendSubtitle(String text) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.SUBTITLE, CraftChatMessage.fromStringOrNull(text))); + } + + @Override + public void sendTitle(String text) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TITLE, CraftChatMessage.fromStringOrNull(text))); + } + + @Override + public void sendActionBar(String text) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.ACTIONBAR, CraftChatMessage.fromStringOrNull(text))); + } + + @Override + public void fakeRespawn() { + if (handle.playerConnection.isDisconnected()) { + return; + } + PacketPlayOutPlayerInfo remInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER, handle); + PacketPlayOutPlayerInfo addInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.ADD_PLAYER, handle); + + PacketPlayOutEntityDestroy destroyPacket = new PacketPlayOutEntityDestroy(handle.getId()); + PacketPlayOutNamedEntitySpawn spawnPacket = new PacketPlayOutNamedEntitySpawn(handle); + PacketPlayOutEntityHeadRotation rotationPacket = new PacketPlayOutEntityHeadRotation(handle, + (byte) MathHelper.d(handle.getHeadRotation() * 256F / 360F)); + + ArrayList equipmentPackets = new ArrayList<>(); + for (EnumItemSlot slot : EnumItemSlot.values()) { + equipmentPackets.add(new PacketPlayOutEntityEquipment(handle.getId(), slot, handle.getEquipment(slot))); + } + + Player self = getBukkitPlayer(); + Player[] players = Players.getOnlineWithout(getUniqueId()); + for (Player player : players) { + if (!player.canSee(self)) { + continue; + } + PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection; + connection.sendPacket(remInfoPacket); + connection.sendPacket(addInfoPacket); + connection.sendPacket(destroyPacket); + connection.sendPacket(spawnPacket); + connection.sendPacket(rotationPacket); + for (PacketPlayOutEntityEquipment equipmentPacket : equipmentPackets) { + connection.sendPacket(equipmentPacket); + } + } + + PacketPlayOutRespawn respawnPacket = new PacketPlayOutRespawn(handle.dimension, handle.world.worldData.getType(), + handle.playerInteractManager.getGameMode()); + PacketPlayOutPosition positionPacket = new PacketPlayOutPosition(handle.locX, handle.locY, handle.locZ, handle.yaw, handle.pitch, + Collections.emptySet(), 0); + PacketPlayOutHeldItemSlot itemPacket = new PacketPlayOutHeldItemSlot(handle.inventory.itemInHandIndex); + PacketPlayOutEntityStatus statusPacket = new PacketPlayOutEntityStatus(handle, (byte) 28); + PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); + + PlayerConnection connection = handle.playerConnection; + connection.sendPacket(remInfoPacket); + connection.sendPacket(addInfoPacket); + connection.sendPacket(respawnPacket); + connection.sendPacket(positionPacket); + connection.sendPacket(itemPacket); + connection.sendPacket(statusPacket); + connection.sendPacket(metadataPacket); + + handle.updateAbilities(); + handle.triggerHealthUpdate(); + handle.updateInventory(handle.defaultContainer); + if (handle.activeContainer != handle.defaultContainer) { + handle.updateInventory(handle.activeContainer); + } + self.recalculatePermissions(); + } + + @Override + public void respawn() { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayInClientCommand(EnumClientCommand.PERFORM_RESPAWN)); + } + + @Override + public void update() { + update(true); + } + + private final void update(boolean flag) { + PostAsync.forcePost(() -> { + realName = MojangProfileServer.getName(getUniqueId()); + realSkin = MojangProfileServer.getSkin(realName, getUniqueId()); + }); + if (flag) { + GameProfile profile = handle.getProfile(); + + Skin skin = getSkin(); + if (skin != null) { + PropertyMap properties = profile.getProperties(); + properties.removeAll("textures"); + properties.put("textures", new Property("textures", skin.getValue(), skin.getSignature())); + } + + String name = getName(); + if (name != null) { + ReflectionProvider.DEFAULT.getReflect("mjGameProfile").setFieldValue(profile, "name", name); + } + + if (!(name == null && skin == null)) { + fakeRespawn(); + } + } + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/tools/BlockTools1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/tools/BlockTools1_14_R1.java new file mode 100644 index 0000000..77a8887 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/tools/BlockTools1_14_R1.java @@ -0,0 +1,39 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1.tools; + +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_14_R1.block.CraftSkull; + +import com.mojang.authlib.properties.Property; +import com.mojang.authlib.properties.PropertyMap; +import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; +import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.minecraft.server.v1_14_R1.TileEntitySkull; +import net.sourcewriters.minecraft.vcompat.reflection.tools.BlockTools; +import net.sourcewriters.minecraft.vcompat.utils.constants.MinecraftConstants; + +public class BlockTools1_14_R1 extends BlockTools { + + private final AbstractReflect craftEntityStateRef = new Reflect(CraftSkull.class).searchField("tileEntity", "tileEntity"); + + @Override + public void setHeadTexture(Block block, String texture) { + if (!(block instanceof CraftSkull)) { + return; + } + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + PropertyMap map = entitySkull.gameProfile.getProperties(); + map.removeAll("textures"); + map.put("textures", new Property("textures", MinecraftConstants.TEXTURE_SIGNATURE, texture)); + } + + @Override + public String getHeadTexture(Block block) { + if (!(block instanceof CraftSkull)) { + return null; + } + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + return entitySkull.gameProfile.getProperties().get("textures").iterator().next().getValue(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/tools/ServerTools1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/tools/ServerTools1_14_R1.java new file mode 100644 index 0000000..c333426 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/tools/ServerTools1_14_R1.java @@ -0,0 +1,27 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1.tools; + +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_14_R1.CraftServer; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1.wrapper.ConsoleReaderWrapper1_14_R1; +import net.sourcewriters.minecraft.vcompat.reflection.tools.ServerTools; + +public class ServerTools1_14_R1 extends ServerTools { + + @Override + public void setMotd(String text) { + ((CraftServer) Bukkit.getServer()).getServer().setMotd(text); + } + + @Override + public String getMotd() { + return ((CraftServer) Bukkit.getServer()).getServer().getMotd(); + } + + @SuppressWarnings("resource") + @Override + public ConsoleReaderWrapper1_14_R1 getConsole() { + return ConsoleReaderWrapper1_14_R1.INSTANCE; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/tools/SkinTools1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/tools/SkinTools1_14_R1.java new file mode 100644 index 0000000..1b55d02 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/tools/SkinTools1_14_R1.java @@ -0,0 +1,16 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1.tools; + +import org.bukkit.craftbukkit.v1_14_R1.entity.CraftPlayer; +import org.bukkit.entity.Player; + +import net.sourcewriters.minecraft.vcompat.reflection.tools.SkinTools; +import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; + +public class SkinTools1_14_R1 extends SkinTools { + + @Override + public Skin skinFromPlayer(Player player) { + return skinFromGameProfile(((CraftPlayer) player).getHandle().getProfile()); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/utils/EntityConstructors1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/utils/EntityConstructors1_14_R1.java new file mode 100644 index 0000000..ca18482 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/utils/EntityConstructors1_14_R1.java @@ -0,0 +1,12 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1.utils; + +import java.util.function.Function; + +import net.minecraft.server.v1_14_R1.World; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1.entity.ArmorStand1_14_R1; + +public abstract class EntityConstructors1_14_R1 { + + public static final Function ARMOR_STAND = (world -> new ArmorStand1_14_R1(world)); + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/wrapper/ConsoleReaderWrapper1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/wrapper/ConsoleReaderWrapper1_14_R1.java new file mode 100644 index 0000000..df10812 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/wrapper/ConsoleReaderWrapper1_14_R1.java @@ -0,0 +1,43 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1.wrapper; + +import java.io.IOException; +import java.io.Writer; + +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_14_R1.CraftServer; +import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; + +import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; + +public final class ConsoleReaderWrapper1_14_R1 extends ConsoleReaderWrapper { + + public static final ConsoleReaderWrapper1_14_R1 INSTANCE = new ConsoleReaderWrapper1_14_R1(); + + private final ConsoleReader reader; + + @SuppressWarnings("resource") + private ConsoleReaderWrapper1_14_R1() { + this.reader = ((CraftServer) Bukkit.getServer()).getServer().reader; + } + + @Override + public Writer getOutput() { + return reader.getOutput(); + } + + @Override + public boolean isAnsiSupported() { + return reader.getTerminal().isAnsiSupported(); + } + + @Override + public void flush() throws IOException { + reader.flush(); + } + + @Override + public void drawLine() throws IOException { + reader.drawLine(); + } + +} diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/BukkitConversion1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/BukkitConversion1_15_R1.java new file mode 100644 index 0000000..2df7731 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/BukkitConversion1_15_R1.java @@ -0,0 +1,218 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1; + +import java.util.Set; + +import org.bukkit.craftbukkit.v1_15_R1.inventory.CraftItemStack; +import org.bukkit.entity.EntityType; + +import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; +import com.syntaxphoenix.syntaxapi.data.DataType; +import com.syntaxphoenix.syntaxapi.nbt.NbtByte; +import com.syntaxphoenix.syntaxapi.nbt.NbtByteArray; +import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; +import com.syntaxphoenix.syntaxapi.nbt.NbtDouble; +import com.syntaxphoenix.syntaxapi.nbt.NbtEnd; +import com.syntaxphoenix.syntaxapi.nbt.NbtFloat; +import com.syntaxphoenix.syntaxapi.nbt.NbtInt; +import com.syntaxphoenix.syntaxapi.nbt.NbtIntArray; +import com.syntaxphoenix.syntaxapi.nbt.NbtList; +import com.syntaxphoenix.syntaxapi.nbt.NbtLong; +import com.syntaxphoenix.syntaxapi.nbt.NbtLongArray; +import com.syntaxphoenix.syntaxapi.nbt.NbtShort; +import com.syntaxphoenix.syntaxapi.nbt.NbtString; +import com.syntaxphoenix.syntaxapi.nbt.NbtTag; +import com.syntaxphoenix.syntaxapi.nbt.NbtType; + +import net.minecraft.server.v1_15_R1.ItemStack; +import net.minecraft.server.v1_15_R1.NBTBase; +import net.minecraft.server.v1_15_R1.NBTNumber; +import net.minecraft.server.v1_15_R1.NBTTagByte; +import net.minecraft.server.v1_15_R1.NBTTagByteArray; +import net.minecraft.server.v1_15_R1.NBTTagCompound; +import net.minecraft.server.v1_15_R1.NBTTagDouble; +import net.minecraft.server.v1_15_R1.NBTTagEnd; +import net.minecraft.server.v1_15_R1.NBTTagFloat; +import net.minecraft.server.v1_15_R1.NBTTagInt; +import net.minecraft.server.v1_15_R1.NBTTagIntArray; +import net.minecraft.server.v1_15_R1.NBTTagList; +import net.minecraft.server.v1_15_R1.NBTTagLong; +import net.minecraft.server.v1_15_R1.NBTTagLongArray; +import net.minecraft.server.v1_15_R1.NBTTagShort; +import net.minecraft.server.v1_15_R1.NBTTagString; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1.data.BukkitContext1_15_R1; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1.data.BukkitType1_15_R1; +import net.sourcewriters.minecraft.vcompat.reflection.BukkitConversion; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; + +public class BukkitConversion1_15_R1 extends BukkitConversion { + + protected BukkitConversion1_15_R1(VersionControl1_15_R1 versionControl) { + super(versionControl); + } + + @Override + public EntityType toEntityType(NmsEntityType type) { + try { + return EntityType.valueOf(type.name()); + } catch (IllegalArgumentException ignore) { + return null; + } + } + + @Override + public NmsEntityType fromEntityType(EntityType type) { + try { + return NmsEntityType.valueOf(type.name()); + } catch (IllegalArgumentException ignore) { + return null; + } + } + + @Override + public NBTBase toMinecraftTag(NbtTag tag) { + switch (tag.getType()) { + case BYTE: + return NBTTagByte.a((byte) tag.getValue()); + case SHORT: + return NBTTagShort.a((short) tag.getValue()); + case INT: + return NBTTagInt.a((int) tag.getValue()); + case LONG: + return NBTTagLong.a((long) tag.getValue()); + case FLOAT: + return NBTTagFloat.a((float) tag.getValue()); + case DOUBLE: + return NBTTagDouble.a((double) tag.getValue()); + case STRING: + return NBTTagString.a((String) tag.getValue()); + case BYTE_ARRAY: + return new NBTTagByteArray((byte[]) tag.getValue()); + case INT_ARRAY: + return new NBTTagIntArray((int[]) tag.getValue()); + case LONG_ARRAY: + return new NBTTagLongArray((long[]) tag.getValue()); + case LIST: + return toMinecraftList((NbtList) tag); + case COMPOUND: + return toMinecraftCompound((NbtCompound) tag); + case END: + return NBTTagEnd.b; + default: + return null; + } + } + + @Override + public NbtTag fromMinecraftTag(Object raw) { + if (!(raw instanceof NBTBase)) { + return null; + } + NBTBase tag = (NBTBase) raw; + NbtType type = NbtType.getById(tag.getTypeId()); + switch (type) { + case BYTE: + return new NbtByte(((NBTNumber) tag).asByte()); + case SHORT: + return new NbtShort(((NBTNumber) tag).asShort()); + case INT: + return new NbtInt(((NBTNumber) tag).asInt()); + case LONG: + return new NbtLong(((NBTNumber) tag).asLong()); + case FLOAT: + return new NbtFloat(((NBTNumber) tag).asFloat()); + case DOUBLE: + return new NbtDouble(((NBTNumber) tag).asDouble()); + case STRING: + return new NbtString(((NBTTagString) tag).asString()); + case BYTE_ARRAY: + return new NbtByteArray(((NBTTagByteArray) tag).getBytes()); + case INT_ARRAY: + return new NbtIntArray(((NBTTagIntArray) tag).getInts()); + case LONG_ARRAY: + return new NbtLongArray(((NBTTagLongArray) tag).getLongs()); + case LIST: + return fromMinecraftList(tag); + case COMPOUND: + return fromMinecraftCompound(tag); + case END: + return NbtEnd.INSTANCE; + default: + return null; + } + } + + @Override + public NBTTagList toMinecraftList(NbtList list) { + NBTTagList output = new NBTTagList(); + for (NbtTag tag : list) { + output.add(toMinecraftTag(tag)); + } + return output; + } + + @Override + public NbtList fromMinecraftList(Object raw) { + if (!(raw instanceof NBTTagList)) { + return null; + } + NBTTagList list = (NBTTagList) raw; + NbtList output = new NbtList<>(NbtType.getById(list.getTypeId())); + for (NBTBase base : list) { + output.add(fromMinecraftTag(base)); + } + return output; + } + + @Override + public NBTTagCompound toMinecraftCompound(NbtCompound compound) { + NBTTagCompound output = new NBTTagCompound(); + if (compound.isEmpty()) { + return output; + } + Set keys = compound.getKeys(); + for (String key : keys) { + output.set(key, toMinecraftTag(compound.get(key))); + } + return output; + } + + @Override + public NbtCompound fromMinecraftCompound(Object raw) { + if (!(raw instanceof NBTTagCompound)) { + return null; + } + NBTTagCompound compound = (NBTTagCompound) raw; + NbtCompound output = new NbtCompound(); + if (compound.isEmpty()) { + return output; + } + Set keys = compound.getKeys(); + for (String key : keys) { + output.set(key, fromMinecraftTag(compound.get(key))); + } + return output; + } + + @Override + public org.bukkit.inventory.ItemStack itemFromCompound(NbtCompound compound) { + return CraftItemStack.asBukkitCopy(ItemStack.a(toMinecraftCompound(compound))); + } + + @Override + public NbtCompound itemToCompound(org.bukkit.inventory.ItemStack itemStack) { + return fromMinecraftCompound(CraftItemStack.asNMSCopy(itemStack).getOrCreateTag()); + } + + @Override + public WrappedContext createContext(DataAdapterContext context) { + return new BukkitContext1_15_R1(context); + } + + @Override + public WrapType wrap(DataType dataType) { + return new BukkitType1_15_R1<>(dataType); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/EntityProvider1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/EntityProvider1_15_R1.java new file mode 100644 index 0000000..e24e12a --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/EntityProvider1_15_R1.java @@ -0,0 +1,47 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1; + +import java.util.EnumMap; +import java.util.function.Function; + +import org.bukkit.craftbukkit.v1_15_R1.CraftWorld; + +import net.minecraft.server.v1_15_R1.World; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1.utils.EntityConstructors1_15_R1; +import net.sourcewriters.minecraft.vcompat.reflection.EntityProvider; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; + +public class EntityProvider1_15_R1 extends EntityProvider { + + private final EnumMap> entityMap = new EnumMap<>(NmsEntityType.class); + + protected EntityProvider1_15_R1(VersionControl1_15_R1 versionControl) { + super(versionControl); + } + + @SuppressWarnings("unchecked") + private final Function searchConstructor(NmsEntityType type) { + try { + return (Function) EntityConstructors1_15_R1.class.getField(type.name()).get(null); + } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException ignore) { + return null; + } + } + + private final Function getConstructor(NmsEntityType type) { + return entityMap.computeIfAbsent(type, (key -> searchConstructor(key))); + } + + @Override + public NmsEntity createEntity(org.bukkit.World world, NmsEntityType type) { + if (!(world instanceof CraftWorld)) { + return null; + } + Function function; + if ((function = getConstructor(type)) == null) { + return null; + } + return function.apply(((CraftWorld) world).getHandle()); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/PacketHandler1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/PacketHandler1_15_R1.java new file mode 100644 index 0000000..bf7683d --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/PacketHandler1_15_R1.java @@ -0,0 +1,11 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1; + +import net.sourcewriters.minecraft.vcompat.reflection.PacketHandler; + +public class PacketHandler1_15_R1 extends PacketHandler { + + protected PacketHandler1_15_R1(VersionControl1_15_R1 versionControl) { + super(versionControl); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/PlayerProvider1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/PlayerProvider1_15_R1.java new file mode 100644 index 0000000..fef4f48 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/PlayerProvider1_15_R1.java @@ -0,0 +1,20 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1; + +import org.bukkit.entity.Player; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1.entity.Player1_15_R1; +import net.sourcewriters.minecraft.vcompat.reflection.PlayerProvider; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; + +public class PlayerProvider1_15_R1 extends PlayerProvider { + + protected PlayerProvider1_15_R1(VersionControl1_15_R1 versionControl) { + super(versionControl); + } + + @Override + protected NmsPlayer createPlayer(Player player) { + return new Player1_15_R1(player); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/TextureProvider1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/TextureProvider1_15_R1.java new file mode 100644 index 0000000..20f9877 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/TextureProvider1_15_R1.java @@ -0,0 +1,102 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1; + +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_15_R1.block.CraftBlockEntityState; +import org.bukkit.craftbukkit.v1_15_R1.block.CraftSkull; +import org.bukkit.craftbukkit.v1_15_R1.inventory.CraftItemStack; +import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.inventory.meta.SkullMeta; + +import com.mojang.authlib.GameProfile; +import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; +import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.minecraft.server.v1_15_R1.GameProfileSerializer; +import net.minecraft.server.v1_15_R1.ItemStack; +import net.minecraft.server.v1_15_R1.NBTTagCompound; +import net.minecraft.server.v1_15_R1.TileEntitySkull; +import net.sourcewriters.minecraft.vcompat.reflection.TextureProvider; + +public class TextureProvider1_15_R1 extends TextureProvider { + + private final AbstractReflect craftEntityStateRef = new Reflect(CraftBlockEntityState.class).searchField("tileEntity", "tileEntity"); + private final AbstractReflect craftItemStackRef = new Reflect(CraftItemStack.class).searchField("handle", "handle"); + private final AbstractReflect craftMetaSkullRef = new Reflect("org.bukkit.craftbukkit.v1_15_R1.inventory.CraftMetaSkull") + .searchField("serialized", "serializedProfile").searchField("profile", "profile"); + + protected TextureProvider1_15_R1(VersionControl1_15_R1 versionControl) { + super(versionControl); + } + + @Override + public GameProfile profileFromBlock(Block block) { + if (!(block instanceof CraftSkull)) { + return null; + } + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + return entitySkull.gameProfile; + } + + @Override + public GameProfile profileFromItem(org.bukkit.inventory.ItemStack itemStack) { + if (!(itemStack.getItemMeta() instanceof SkullMeta)) { + return null; + } + SkullMeta meta = (SkullMeta) itemStack.getItemMeta(); + GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue("profile", meta); + if (profile == null) { + NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue("serialized", meta); + if (compound == null) { + ItemStack stack = null; + if (itemStack instanceof CraftItemStack) { + stack = (ItemStack) craftItemStackRef.getFieldValue("handle", itemStack); + } + if (stack == null) { + stack = CraftItemStack.asNMSCopy(itemStack); + } + NBTTagCompound stackTag = stack.getOrCreateTag(); + if (stackTag.hasKeyOfType("SkullOwner", 10)) { + compound = stackTag.getCompound("SkullOwner"); + } else if (stackTag.hasKeyOfType("SkullProfile", 10)) { + compound = stackTag.getCompound("SkullProfile"); + } + } + if (compound == null) { + return null; + } + profile = GameProfileSerializer.deserialize(compound); + } + return profile; + } + + @Override + public org.bukkit.inventory.ItemStack getItem(GameProfile profile) { + org.bukkit.inventory.ItemStack craftStack = CraftItemStack.asCraftCopy(new org.bukkit.inventory.ItemStack(Material.PLAYER_HEAD)); + applyItem(craftStack, profile); + return craftStack; + } + + @Override + public boolean applyItem(org.bukkit.inventory.ItemStack itemStack, GameProfile profile) { + ItemMeta meta = itemStack.getItemMeta(); + if (!(meta instanceof SkullMeta)) { + return false; + } + SkullMeta skullMeta = (SkullMeta) meta; + craftMetaSkullRef.setFieldValue(meta, "profile", profile); + itemStack.setItemMeta(skullMeta); + return true; + } + + @Override + public boolean applyBlock(Block block, GameProfile profile) { + if (!(block instanceof CraftSkull)) { + return false; + } + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + entitySkull.setGameProfile(profile); + return true; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/ToolProvider1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/ToolProvider1_15_R1.java new file mode 100644 index 0000000..f623310 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/ToolProvider1_15_R1.java @@ -0,0 +1,33 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1.tools.BlockTools1_15_R1; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1.tools.ServerTools1_15_R1; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1.tools.SkinTools1_15_R1; +import net.sourcewriters.minecraft.vcompat.reflection.ToolProvider; + +public class ToolProvider1_15_R1 extends ToolProvider { + + private final BlockTools1_15_R1 blockTools = new BlockTools1_15_R1(); + private final SkinTools1_15_R1 skinTools = new SkinTools1_15_R1(); + private final ServerTools1_15_R1 serverTools = new ServerTools1_15_R1(); + + protected ToolProvider1_15_R1(VersionControl1_15_R1 versionControl) { + super(versionControl); + } + + @Override + public SkinTools1_15_R1 getSkinTools() { + return skinTools; + } + + @Override + public ServerTools1_15_R1 getServerTools() { + return serverTools; + } + + @Override + public BlockTools1_15_R1 getBlockTools() { + return blockTools; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/VersionControl1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/VersionControl1_15_R1.java new file mode 100644 index 0000000..18de541 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/VersionControl1_15_R1.java @@ -0,0 +1,61 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1.data.hook.BukkitContainerAdapterHook1_15_R1; +import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; + +public class VersionControl1_15_R1 extends VersionControl { + + public static VersionControl1_15_R1 INSTANCE; + + public static VersionControl1_15_R1 init() { + return INSTANCE != null ? INSTANCE : (INSTANCE = new VersionControl1_15_R1()); + } + + private final ToolProvider1_15_R1 toolProvider = new ToolProvider1_15_R1(this); + private final TextureProvider1_15_R1 textureProvider = new TextureProvider1_15_R1(this); + private final PacketHandler1_15_R1 packetHandler = new PacketHandler1_15_R1(this); + private final EntityProvider1_15_R1 entityProvider = new EntityProvider1_15_R1(this); + private final PlayerProvider1_15_R1 playerProvider = new PlayerProvider1_15_R1(this); + private final BukkitConversion1_15_R1 bukkitConversion = new BukkitConversion1_15_R1(this); + + private VersionControl1_15_R1() { + BukkitContainerAdapterHook1_15_R1.hookEntity(); + } + + @Override + public ToolProvider1_15_R1 getToolProvider() { + return toolProvider; + } + + @Override + public EntityProvider1_15_R1 getEntityProvider() { + return entityProvider; + } + + @Override + public PlayerProvider1_15_R1 getPlayerProvider() { + return playerProvider; + } + + @Override + public TextureProvider1_15_R1 getTextureProvider() { + return textureProvider; + } + + @Override + public PacketHandler1_15_R1 getPacketHandler() { + return packetHandler; + } + + @Override + public BukkitConversion1_15_R1 getBukkitConversion() { + return bukkitConversion; + } + + @Override + public void shutdown() { + dataProvider.getDefaultDistributor().shutdown(); + BukkitContainerAdapterHook1_15_R1.unhookAll(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/BukkitContainer1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/BukkitContainer1_15_R1.java new file mode 100644 index 0000000..18afda0 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/BukkitContainer1_15_R1.java @@ -0,0 +1,160 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1.data; + +import java.util.Arrays; +import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; + +import org.bukkit.NamespacedKey; +import org.bukkit.persistence.PersistentDataAdapterContext; +import org.bukkit.persistence.PersistentDataContainer; +import org.bukkit.persistence.PersistentDataType; + +import com.syntaxphoenix.syntaxapi.data.IDataContainer; + +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; +import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SyntaxKey; + +public final class BukkitContainer1_15_R1 extends WrappedContainer implements PersistentDataContainer { + + private final IDataContainer container; + + public BukkitContainer1_15_R1(IDataContainer container) { + this.container = container; + } + + @Override + public IDataContainer getHandle() { + return container; + } + + @Override + public IDataContainer getAsSyntaxContainer() { + return container; + } + + /* + * + */ + + @Override + public boolean has(NamespacedKey key, PersistentDataType type) { + return has(new BukkitKey1_15_R1(key), WrappedType1_15_R1.wrap(type)); + } + + @Override + public Z get(NamespacedKey key, PersistentDataType type) { + return get(new BukkitKey1_15_R1(key), WrappedType1_15_R1.wrap(type)); + } + + @Override + public Z getOrDefault(NamespacedKey key, PersistentDataType type, Z value) { + return Optional.ofNullable(get(key, type)).orElse(value); + } + + @Override + public void set(NamespacedKey key, PersistentDataType type, Z value) { + set(new BukkitKey1_15_R1(key), value, WrappedType1_15_R1.wrap(type)); + } + + @Override + public void remove(NamespacedKey key) { + remove(new BukkitKey1_15_R1(key)); + } + + public Set getKeys() { + return Arrays.stream(container.getKeys()).map(SyntaxKey::new).map(BukkitKey1_15_R1::asBukkit).collect(Collectors.toSet()); + } + + @Override + public PersistentDataAdapterContext getAdapterContext() { + return getContext(); + } + + /* + * + */ + + @Override + public BukkitContext1_15_R1 getContext() { + return new BukkitContext1_15_R1(container.getAdapterContext()); + } + + @Override + public boolean has(String key) { + return has(wrappedKey(key)); + } + + @Override + public boolean has(WrappedKey key) { + return container.has(key.getNamespacedKey()); + } + + @Override + public boolean has(String key, WrapType type) { + return has(wrappedKey(key), type); + } + + @Override + public boolean has(WrappedKey key, WrapType type) { + return container.has(key.getNamespacedKey(), type.syntaxType()); + } + + @Override + public Object get(String key) { + return get(wrappedKey(key)); + } + + @Override + public Object get(WrappedKey key) { + return container.get(key.getNamespacedKey()); + } + + @Override + public C get(String key, WrapType type) { + return get(wrappedKey(key), type); + } + + @Override + public C get(WrappedKey key, WrapType type) { + return container.get(key.getNamespacedKey(), type.syntaxType()); + } + + @Override + public void set(String key, B value, WrapType type) { + set(wrappedKey(key), value, type); + } + + @Override + public void set(WrappedKey key, B value, WrapType type) { + container.set(key.getNamespacedKey(), value, type.syntaxType()); + } + + @Override + public boolean remove(String key) { + return false; + } + + @Override + public boolean remove(WrappedKey key) { + return container.remove(key.getNamespacedKey()); + } + + @Override + public Set keySet() { + return container.getKeyspaces(); + } + + @Override + public boolean isEmpty() { + return container.isEmpty(); + } + + @Override + public int size() { + return container.size(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/BukkitContext1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/BukkitContext1_15_R1.java new file mode 100644 index 0000000..f90cb76 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/BukkitContext1_15_R1.java @@ -0,0 +1,39 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1.data; + +import org.bukkit.persistence.PersistentDataAdapterContext; +import org.bukkit.persistence.PersistentDataContainer; + +import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; +import com.syntaxphoenix.syntaxapi.data.IDataContainer; + +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; + +public final class BukkitContext1_15_R1 extends WrappedContext implements PersistentDataAdapterContext { + + private final DataAdapterContext context; + + public BukkitContext1_15_R1(DataAdapterContext context) { + this.context = context; + } + + @Override + public DataAdapterContext getHandle() { + return context; + } + + @Override + public PersistentDataContainer newPersistentDataContainer() { + return newContainer(); + } + + @Override + public IDataContainer newDataContainer() { + return context.newDataContainer(); + } + + @Override + public BukkitContainer1_15_R1 newContainer() { + return new BukkitContainer1_15_R1(context.newDataContainer()); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/BukkitKey1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/BukkitKey1_15_R1.java new file mode 100644 index 0000000..e9bcb39 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/BukkitKey1_15_R1.java @@ -0,0 +1,52 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1.data; + +import org.bukkit.NamespacedKey; +import org.bukkit.plugin.Plugin; + +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; + +public final class BukkitKey1_15_R1 extends WrappedKey { + + private final NamespacedKey key; + + public BukkitKey1_15_R1(Plugin plugin, String key) { + this.key = new NamespacedKey(plugin, key); + } + + @SuppressWarnings("deprecation") + public BukkitKey1_15_R1(String name, String key) { + this.key = new NamespacedKey(name, key); + } + + public BukkitKey1_15_R1(NamespacedKey key) { + this.key = key; + } + + @Override + public NamespacedKey getHandle() { + return key; + } + + @Override + public String getName() { + return key.getNamespace(); + } + + @Override + public String getKey() { + return key.getKey(); + } + + @Override + public String toString() { + return key.toString(); + } + + public static NamespacedKey asBukkit(WrappedKey key) { + if (key.getHandle() instanceof NamespacedKey) { + return (NamespacedKey) key.getHandle(); + } + return new BukkitKey1_15_R1(key.getName(), key.getKey()).getHandle(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/BukkitType1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/BukkitType1_15_R1.java new file mode 100644 index 0000000..4a020c0 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/BukkitType1_15_R1.java @@ -0,0 +1,69 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1.data; + +import org.bukkit.persistence.PersistentDataAdapterContext; +import org.bukkit.persistence.PersistentDataType; + +import com.syntaxphoenix.syntaxapi.data.DataType; + +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; + +public class BukkitType1_15_R1 extends WrappedType1_15_R1, P0, P1, C0, C1> + implements PersistentDataType { + + private final DataType type; + + public BukkitType1_15_R1(DataType type) { + super(type.getPrimitive(), type.getComplex()); + this.type = type; + } + + @Override + public DataType getHandle() { + return type; + } + + @Override + public Class getPrimitiveOriginal() { + return type.getPrimitive(); + } + + @Override + public Class getComplexOriginal() { + return type.getComplex(); + } + + /* + * + */ + + @Override + public Class getComplexType() { + return complexType; + } + + @Override + public Class getPrimitiveType() { + return primitiveType; + } + + @Override + public P0 toPrimitive(C0 complex, PersistentDataAdapterContext context) { + return wrapToPrimitive(complex, new SyntaxContext1_15_R1(context)); + } + + @Override + public C0 fromPrimitive(P0 primitive, PersistentDataAdapterContext context) { + return wrapToComplex(primitive, new SyntaxContext1_15_R1(context)); + } + + @Override + public P0 wrapToPrimitive(C0 complex, WrappedContext context) { + return toPrimitiveWrapped(type.toPrimitive(context, toComplexOriginal(complex))); + } + + @Override + public C0 wrapToComplex(P0 primitive, WrappedContext context) { + return toComplexWrapped(type.fromPrimitive(context, toPrimitiveOriginal(primitive))); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/SimpleBukkitType1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/SimpleBukkitType1_15_R1.java new file mode 100644 index 0000000..9f99c41 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/SimpleBukkitType1_15_R1.java @@ -0,0 +1,36 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1.data; + +import org.bukkit.persistence.PersistentDataAdapterContext; +import org.bukkit.persistence.PersistentDataType; + +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; + +public class SimpleBukkitType1_15_R1 implements PersistentDataType { + + private final WrapType type; + + public SimpleBukkitType1_15_R1(WrapType type) { + this.type = type; + } + + @Override + public Class getComplexType() { + return type.getComplexWrapped(); + } + + @Override + public Class

getPrimitiveType() { + return type.getPrimitiveWrapped(); + } + + @Override + public P toPrimitive(C complex, PersistentDataAdapterContext context) { + return type.wrapToPrimitive(complex, new SyntaxContext1_15_R1(context)); + } + + @Override + public C fromPrimitive(P primitive, PersistentDataAdapterContext context) { + return type.wrapToComplex(primitive, new SyntaxContext1_15_R1(context)); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/SyntaxContainer1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/SyntaxContainer1_15_R1.java new file mode 100644 index 0000000..a1b52e2 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/SyntaxContainer1_15_R1.java @@ -0,0 +1,185 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1.data; + +import java.util.Set; +import java.util.stream.Collectors; + +import org.bukkit.persistence.PersistentDataContainer; + +import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; +import com.syntaxphoenix.syntaxapi.data.DataType; +import com.syntaxphoenix.syntaxapi.data.IDataContainer; +import com.syntaxphoenix.syntaxapi.utils.key.IKey; + +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; +import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SyntaxKey; + +public final class SyntaxContainer1_15_R1 extends WrappedContainer implements IDataContainer { + + private final PersistentDataContainer container; + + public SyntaxContainer1_15_R1(PersistentDataContainer container) { + this.container = container; + } + + @Override + public PersistentDataContainer getHandle() { + return container; + } + + @Override + public IDataContainer getAsSyntaxContainer() { + return new SyntaxContainer1_15_R1(container); + } + + /* + * + */ + + @Override + public boolean has(IKey key) { + throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); + } + + @Override + public boolean has(String key, DataType type) { + return has(syntaxKey(key), type); + } + + @Override + public boolean has(IKey key, DataType type) { + return has(new SyntaxKey(key), WrappedType1_15_R1.wrap(type)); + } + + @Override + public C get(String key, DataType type) { + return get(syntaxKey(key), type); + } + + @Override + public C get(IKey key, DataType type) { + return get(new SyntaxKey(key), WrappedType1_15_R1.wrap(type)); + } + + @Override + public Object get(String key) { + throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); + } + + @Override + public Object get(IKey key) { + throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); + } + + @Override + public void set(String key, E value, DataType type) { + set(wrappedKey(key), value, WrappedType1_15_R1.wrap(type)); + } + + @Override + public void set(IKey key, E value, DataType type) { + set(new SyntaxKey(key), value, WrappedType1_15_R1.wrap(type)); + } + + @Override + public boolean remove(String key) { + return remove(wrappedKey(key)); + } + + @Override + public boolean remove(IKey key) { + return remove(new SyntaxKey(key)); + } + + @Override + public IKey[] getKeys() { + return container.getKeys().stream().map(BukkitKey1_15_R1::new).map(WrappedKey::getNamespacedKey).toArray(IKey[]::new); + } + + @Override + public Set getKeyspaces() { + return container.getKeys().stream().map(org.bukkit.NamespacedKey::toString).collect(Collectors.toSet()); + } + + @Override + public DataAdapterContext getAdapterContext() { + return getContext(); + } + + /* + * + */ + + @Override + public SyntaxContext1_15_R1 getContext() { + return new SyntaxContext1_15_R1(container.getAdapterContext()); + } + + @Override + public boolean has(String key) { + throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); + } + + @Override + public boolean has(WrappedKey key) { + throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); + } + + @Override + public boolean has(String key, WrapType type) { + return has(wrappedKey(key), type); + } + + @Override + public boolean has(WrappedKey key, WrapType type) { + return container.has(BukkitKey1_15_R1.asBukkit(key), new SimpleBukkitType1_15_R1<>(type)); + } + + @Override + public Object get(WrappedKey key) { + throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); + } + + @Override + public C get(String key, WrapType type) { + return get(wrappedKey(key), type); + } + + @Override + public C get(WrappedKey key, WrapType type) { + return container.get(BukkitKey1_15_R1.asBukkit(key), new SimpleBukkitType1_15_R1<>(type)); + } + + @Override + public void set(String key, B value, WrapType type) { + set(wrappedKey(key), value, type); + } + + @Override + public void set(WrappedKey key, B value, WrapType type) { + container.set(BukkitKey1_15_R1.asBukkit(key), new SimpleBukkitType1_15_R1<>(type), value); + } + + @Override + public boolean remove(WrappedKey key) { + container.remove(BukkitKey1_15_R1.asBukkit(key)); + return true; // Will always return true as we don't know if it contained it + } + + @Override + public Set keySet() { + return getKeyspaces(); + } + + @Override + public boolean isEmpty() { + return container.isEmpty(); + } + + @Override + public int size() { + return 0; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/SyntaxContext1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/SyntaxContext1_15_R1.java new file mode 100644 index 0000000..f243ee4 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/SyntaxContext1_15_R1.java @@ -0,0 +1,38 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1.data; + +import org.bukkit.persistence.PersistentDataAdapterContext; +import org.bukkit.persistence.PersistentDataContainer; + +import com.syntaxphoenix.syntaxapi.data.IDataContainer; + +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; + +public final class SyntaxContext1_15_R1 extends WrappedContext implements PersistentDataAdapterContext { + + private final PersistentDataAdapterContext context; + + public SyntaxContext1_15_R1(PersistentDataAdapterContext context) { + this.context = context; + } + + @Override + public PersistentDataAdapterContext getHandle() { + return context; + } + + @Override + public PersistentDataContainer newPersistentDataContainer() { + return context.newPersistentDataContainer(); + } + + @Override + public IDataContainer newDataContainer() { + return newContainer(); + } + + @Override + public SyntaxContainer1_15_R1 newContainer() { + return new SyntaxContainer1_15_R1(context.newPersistentDataContainer()); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/SyntaxType1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/SyntaxType1_15_R1.java new file mode 100644 index 0000000..f13447c --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/SyntaxType1_15_R1.java @@ -0,0 +1,76 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1.data; + +import org.bukkit.persistence.PersistentDataAdapterContext; +import org.bukkit.persistence.PersistentDataType; + +import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; +import com.syntaxphoenix.syntaxapi.data.DataType; + +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; + +public class SyntaxType1_15_R1 extends WrappedType1_15_R1, P0, P1, C0, C1> + implements DataType { + + private final PersistentDataType type; + + public SyntaxType1_15_R1(PersistentDataType type) { + super(type.getPrimitiveType(), type.getComplexType()); + this.type = type; + } + + @Override + public PersistentDataType getHandle() { + return type; + } + + @Override + public Class getPrimitiveOriginal() { + return type.getPrimitiveType(); + } + + @Override + public Class getComplexOriginal() { + return type.getComplexType(); + } + + /* + * + */ + + @Override + public Class getComplex() { + return complexType; + } + + @Override + public Class getPrimitive() { + return primitiveType; + } + + @Override + public P0 toPrimitive(DataAdapterContext context, C0 complex) { + return wrapToPrimitive(complex, new BukkitContext1_15_R1(context)); + } + + @Override + public C0 fromPrimitive(DataAdapterContext context, P0 primitive) { + return wrapToComplex(primitive, new BukkitContext1_15_R1(context)); + } + + @Override + public P0 wrapToPrimitive(C0 complex, WrappedContext context) { + if (!(context instanceof PersistentDataAdapterContext)) { + return null; + } + return toPrimitiveWrapped(type.toPrimitive(toComplexOriginal(complex), (PersistentDataAdapterContext) context)); + } + + @Override + public C0 wrapToComplex(P0 primitive, WrappedContext context) { + if (!(context instanceof PersistentDataAdapterContext)) { + return null; + } + return toComplexWrapped(type.fromPrimitive(toPrimitiveOriginal(primitive), (PersistentDataAdapterContext) context)); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/WrappedType1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/WrappedType1_15_R1.java new file mode 100644 index 0000000..0b8713a --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/WrappedType1_15_R1.java @@ -0,0 +1,150 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1.data; + +import java.util.Arrays; + +import org.bukkit.persistence.PersistentDataContainer; +import org.bukkit.persistence.PersistentDataType; + +import com.syntaxphoenix.syntaxapi.data.DataType; +import com.syntaxphoenix.syntaxapi.data.IDataContainer; + +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; + +public abstract class WrappedType1_15_R1 implements WrapType { + + protected final Class primitiveType; + protected final Class complexType; + + private final int primitiveWrap; + private final int complexWrap; + + @SuppressWarnings("unchecked") + protected WrappedType1_15_R1(Class primitive, Class complex) { + this.primitiveWrap = WrappedType1_15_R1.internalState(primitive); + this.complexWrap = WrappedType1_15_R1.internalState(complex); + this.primitiveType = (Class) WrappedType1_15_R1.internalWrap(primitive, primitiveWrap); + this.complexType = (Class) WrappedType1_15_R1.internalWrap(complex, complexWrap); + } + + public abstract H getHandle(); + + public Class getPrimitiveWrapped() { + return primitiveType; + } + + public Class getComplexWrapped() { + return complexType; + } + + public abstract Class getPrimitiveOriginal(); + + public abstract Class getComplexOriginal(); + + @SuppressWarnings("unchecked") + public P0 toPrimitiveWrapped(P1 primitive) { + switch (primitiveWrap) { + case 1: + return (P0) new SyntaxContainer1_15_R1((PersistentDataContainer) primitive); + case 2: + return (P0) Arrays.stream((PersistentDataContainer[]) primitive).map(SyntaxContainer1_15_R1::new) + .toArray(SyntaxContainer1_15_R1[]::new); + case 3: + return (P0) new BukkitContainer1_15_R1((IDataContainer) primitive); + case 4: + return (P0) Arrays.stream((IDataContainer[]) primitive).map(BukkitContainer1_15_R1::new) + .toArray(BukkitContainer1_15_R1[]::new); + default: + return (P0) primitive; + } + } + + @SuppressWarnings("unchecked") + public C0 toComplexWrapped(C1 complex) { + switch (complexWrap) { + case 1: + return (C0) new SyntaxContainer1_15_R1((PersistentDataContainer) complex); + case 2: + return (C0) Arrays.stream((PersistentDataContainer[]) complex).map(SyntaxContainer1_15_R1::new).toArray(SyntaxContainer1_15_R1[]::new); + case 3: + return (C0) new BukkitContainer1_15_R1((IDataContainer) complex); + case 4: + return (C0) Arrays.stream((IDataContainer[]) complex).map(BukkitContainer1_15_R1::new).toArray(BukkitContainer1_15_R1[]::new); + default: + return (C0) complex; + } + } + + @SuppressWarnings("unchecked") + public P1 toPrimitiveOriginal(P0 primitive) { + switch (primitiveWrap) { + case 1: + return (P1) new BukkitContainer1_15_R1((IDataContainer) primitive); + case 2: + return (P1) Arrays.stream((IDataContainer[]) primitive).map(BukkitContainer1_15_R1::new) + .toArray(BukkitContainer1_15_R1[]::new); + case 3: + return (P1) new SyntaxContainer1_15_R1((PersistentDataContainer) primitive); + case 4: + return (P1) Arrays.stream((PersistentDataContainer[]) primitive).map(SyntaxContainer1_15_R1::new) + .toArray(SyntaxContainer1_15_R1[]::new); + default: + return (P1) primitive; + } + } + + @SuppressWarnings("unchecked") + public C1 toComplexOriginal(C0 complex) { + switch (complexWrap) { + case 1: + return (C1) new BukkitContainer1_15_R1((IDataContainer) complex); + case 2: + return (C1) Arrays.stream((IDataContainer[]) complex).map(BukkitContainer1_15_R1::new).toArray(BukkitContainer1_15_R1[]::new); + case 3: + return (C1) new SyntaxContainer1_15_R1((PersistentDataContainer) complex); + case 4: + return (C1) Arrays.stream((PersistentDataContainer[]) complex).map(SyntaxContainer1_15_R1::new).toArray(SyntaxContainer1_15_R1[]::new); + default: + return (C1) complex; + } + } + + protected static Class internalWrap(Class clazz, int state) { + switch (state) { + case 1: + return SyntaxContainer1_15_R1.class; + case 2: + return SyntaxContainer1_15_R1[].class; + case 3: + return BukkitContainer1_15_R1.class; + case 4: + return BukkitContainer1_15_R1[].class; + default: + return clazz; + } + } + + protected static int internalState(Class clazz) { + if (clazz.isAssignableFrom(PersistentDataContainer.class)) { + return 1; + } + if (clazz.isAssignableFrom(PersistentDataContainer[].class)) { + return 2; + } + if (clazz.isAssignableFrom(IDataContainer.class)) { + return 3; + } + if (clazz.isAssignableFrom(IDataContainer[].class)) { + return 4; + } + return 0; + } + + public static BukkitType1_15_R1 wrap(DataType type) { + return new BukkitType1_15_R1<>(type); + } + + public static SyntaxType1_15_R1 wrap(PersistentDataType type) { + return new SyntaxType1_15_R1<>(type); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/hook/BukkitContainerAdapterHook1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/hook/BukkitContainerAdapterHook1_15_R1.java new file mode 100644 index 0000000..d55ac74 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/hook/BukkitContainerAdapterHook1_15_R1.java @@ -0,0 +1,134 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1.data.hook; + +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; + +import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_15_R1.persistence.CraftPersistentDataContainer; +import org.bukkit.craftbukkit.v1_15_R1.persistence.CraftPersistentDataTypeRegistry; +import org.bukkit.persistence.PersistentDataContainer; + +import com.syntaxphoenix.syntaxapi.data.IDataContainer; +import com.syntaxphoenix.syntaxapi.data.container.nbt.NbtContainer; +import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; +import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; +import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.minecraft.server.v1_15_R1.NBTTagCompound; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1.data.BukkitContainer1_15_R1; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1.data.SyntaxContainer1_15_R1; +import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; + +@SuppressWarnings({ + "rawtypes", + "unchecked" +}) +public final class BukkitContainerAdapterHook1_15_R1 { + + private static final BukkitContainerAdapterHook1_15_R1 HOOK = new BukkitContainerAdapterHook1_15_R1(); + + private final AbstractReflect registryRef = new Reflect(CraftPersistentDataTypeRegistry.class) + .searchMethod("create", "createAdapter", Class.class, Class.class, Function.class, Function.class) + .searchField("adapters", "adapters") + .searchField("function", "CREATE_ADAPTER"); + private final AbstractReflect entityRef = new Reflect(CraftEntity.class).searchField("registry", "DATA_TYPE_REGISTRY"); + + private BukkitContainerAdapterHook1_15_R1() {} + + private final HashMap map = new HashMap<>(); + + private CraftPersistentDataTypeRegistry getEntityRegistry() { + return (CraftPersistentDataTypeRegistry) entityRef.getFieldValue("registry"); + } + + private void uninjectAll() { + for (CraftPersistentDataTypeRegistry registry : map.keySet()) { + Map adapters = (Map) registryRef.getFieldValue("adapters", registry); + adapters.remove(BukkitContainer1_15_R1.class); + adapters.remove(SyntaxContainer1_15_R1.class); + registryRef.setFieldValue(registry, "function", map.get(registry)); + } + map.clear(); + } + + private void inject(CraftPersistentDataTypeRegistry registry) { + if (map.containsKey(registry)) { + return; + } + map.put(registry, (Function) registryRef.getFieldValue("function", registry)); + Function function = clazz -> createAdapter(registry, registryRef.getMethod("create").getReturnType(), (Class) clazz); + registryRef.setFieldValue(registry, "function", function); + } + + private E createAdapter(CraftPersistentDataTypeRegistry registry, Class adapterType, Class type) { + if (Objects.equals(BukkitContainer1_15_R1.class, type)) { + return (E) buildAdapter(registry, BukkitContainer1_15_R1.class, tag -> fromPrimitiveSyntax(tag)); + } + if (Objects.equals(SyntaxContainer1_15_R1.class, type)) { + return (E) buildAdapter(registry, SyntaxContainer1_15_R1.class, tag -> fromPrimitiveBukkit(registry, tag)); + } + return (E) map.get(registry).apply(type); + } + + private Object buildAdapter(Object handle, Class type, Function function) { + return registryRef.run(handle, "create", type, NBTTagCompound.class, (Function) input -> toPrimitive(input), + function); + } + + private NBTTagCompound toPrimitive(WrappedContainer input) { + Object handle = findFinalContainer(input).getHandle(); + if (handle instanceof PersistentDataContainer) { + if (handle instanceof CraftPersistentDataContainer) { + return ((CraftPersistentDataContainer) handle).toTagCompound(); + } + throw new IllegalArgumentException( + "Expected 'CraftPersistentDataContainer' got '" + handle.getClass().getSimpleName() + " instead'!"); + } + if (handle instanceof IDataContainer) { + if (handle instanceof NbtContainer) { + return (NBTTagCompound) VersionControl.get().getBukkitConversion().toMinecraftCompound(((NbtContainer) handle).asNbt()); + } + throw new IllegalArgumentException( + "Expected 'CraftPersistentDataContainer' got '" + handle.getClass().getSimpleName() + " instead'!"); + } + throw new IllegalArgumentException("Unknown WrappedContainer implementation!"); + } + + private BukkitContainer1_15_R1 fromPrimitiveSyntax(NBTTagCompound data) { + VersionControl control = VersionControl.get(); + NbtContainer container = new NbtContainer(control.getDataProvider().getRegistry()); + NbtCompound compound = control.getBukkitConversion().fromMinecraftCompound(data); + container.fromNbt(compound); + return new BukkitContainer1_15_R1(container); + } + + private SyntaxContainer1_15_R1 fromPrimitiveBukkit(CraftPersistentDataTypeRegistry registry, NBTTagCompound data) { + CraftPersistentDataContainer container = new CraftPersistentDataContainer(registry); + container.putAll(data); + return new SyntaxContainer1_15_R1(container); + } + + private WrappedContainer findFinalContainer(WrappedContainer container) { + WrappedContainer output = container; + while (output.getHandle() instanceof WrappedContainer) { + output = (WrappedContainer) output.getHandle(); + } + return output; + } + + public static void unhookAll() { + HOOK.uninjectAll(); + } + + public static void hookEntity() { + HOOK.inject(HOOK.getEntityRegistry()); + } + + public static void hook(CraftPersistentDataTypeRegistry registry) { + HOOK.inject(registry); + } + +} diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/entity/ArmorStand1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/entity/ArmorStand1_15_R1.java new file mode 100644 index 0000000..b538e43 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/entity/ArmorStand1_15_R1.java @@ -0,0 +1,24 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1.entity; + +import net.minecraft.server.v1_15_R1.EntityArmorStand; +import net.minecraft.server.v1_15_R1.EntityTypes; +import net.minecraft.server.v1_15_R1.World; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsArmorStand; + +public class ArmorStand1_15_R1 extends EntityLiving1_15_R1 implements NmsArmorStand { + + public ArmorStand1_15_R1(World world) { + super(new EntityArmorStand(EntityTypes.ARMOR_STAND, world)); + } + + @Override + public void setSmall(boolean small) { + handle.setSmall(small); + } + + @Override + public boolean isSmall() { + return handle.isSmall(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/entity/Entity1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/entity/Entity1_15_R1.java new file mode 100644 index 0000000..88d33b6 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/entity/Entity1_15_R1.java @@ -0,0 +1,215 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1.entity; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.UUID; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.OfflinePlayer; +import org.bukkit.craftbukkit.v1_15_R1.CraftWorld; +import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_15_R1.util.CraftChatMessage; +import org.bukkit.entity.Player; + +import net.minecraft.server.v1_15_R1.AxisAlignedBB; +import net.minecraft.server.v1_15_R1.Entity; +import net.minecraft.server.v1_15_R1.PacketPlayOutEntityDestroy; +import net.minecraft.server.v1_15_R1.PacketPlayOutEntityMetadata; +import net.minecraft.server.v1_15_R1.PacketPlayOutSpawnEntity; +import net.minecraft.server.v1_15_R1.PlayerConnection; +import net.minecraft.server.v1_15_R1.Vec3D; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.reflection.utils.NmsBoundingBox; + +public abstract class Entity1_15_R1 implements NmsEntity { + + protected final E handle; + + protected final List visible = Collections.synchronizedList(new ArrayList<>()); + + public Entity1_15_R1(E handle) { + this.handle = handle; + } + + @Override + public final E getHandle() { + return handle; + } + + @Override + public int getId() { + return handle.getId(); + } + + @Override + public UUID getUniqueId() { + return handle.getUniqueID(); + } + + @Override + public NmsBoundingBox getBoundingBox() { + AxisAlignedBB box = handle.getBoundingBox(); + return new NmsBoundingBox(box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ); + } + + @Override + public void setCustomName(String name) { + handle.setCustomName(CraftChatMessage.fromStringOrNull(name)); + updateVisibility(); + } + + @Override + public String getCustomName() { + return CraftChatMessage.fromComponent(handle.getCustomName()); + } + + @Override + public void setGravity(boolean gravity) { + handle.setNoGravity(!gravity); + } + + @Override + public boolean hasGravity() { + return !handle.isNoGravity(); + } + + @Override + public void setCustomNameVisible(boolean visible) { + handle.setCustomNameVisible(visible); + } + + @Override + public boolean isCustomNameVisible() { + return handle.getCustomNameVisible(); + } + + @Override + public void setInvisible(boolean invisible) { + handle.setInvisible(invisible); + } + + @Override + public boolean isInvisible() { + return handle.isInvisible(); + } + + @Override + public boolean isInteractable() { + return handle.isInteractable(); + } + + @Override + public boolean isCollidable() { + return handle.isCollidable(); + } + + @Override + public void setInvulnerable(boolean invulnerable) { + handle.setInvulnerable(invulnerable); + } + + @Override + public boolean isInvulnerable() { + return handle.isInvulnerable(); + } + + @Override + public void setLocation(Location location) { + handle.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); + if (location.getWorld() == null || handle.getWorld().getWorld() == location.getWorld()) { + updateVisibility(); + return; + } + handle.world = ((CraftWorld) location.getWorld()).getHandle(); + updateVisibility(); + } + + @Override + public Location getLocation() { + Vec3D vector = handle.getPositionVector(); + return new Location(handle.getWorld().getWorld(), vector.x, vector.y, vector.z); + } + + @Override + public void updateVisibility() { + if (visible.isEmpty()) { + return; + } + Player[] players; + synchronized (visible) { + players = visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) + .toArray(Player[]::new); + } + hide(players); + show(players); + } + + @Override + public boolean isShown(Player player) { + synchronized (visible) { + return visible.contains(player.getUniqueId()); + } + } + + @Override + public void hide(Player... players) { + if (players.length == 0) { + return; + } + PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(handle.getId()); + for (Player player : players) { + if (!isShown(player)) { + continue; + } + ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); + synchronized (visible) { + visible.remove(player.getUniqueId()); + } + } + } + + @Override + public void show(Player... players) { + if (players.length == 0) { + return; + } + PacketPlayOutSpawnEntity packet = new PacketPlayOutSpawnEntity(handle); + PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); + PlayerConnection connection; + for (Player player : players) { + if (isShown(player)) { + continue; + } + connection = ((CraftPlayer) player).getHandle().playerConnection; + connection.sendPacket(packet); + connection.sendPacket(metadataPacket); + synchronized (visible) { + visible.add(player.getUniqueId()); + } + } + } + + @Override + public UUID[] getVisible() { + synchronized (visible) { + return visible.toArray(new UUID[0]); + } + } + + @Override + public Player[] getVisibleAsPlayer() { + synchronized (visible) { + return visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) + .toArray(Player[]::new); + } + } + + @Override + public void kill() { + hide(getVisibleAsPlayer()); + handle.die(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/entity/EntityLiving1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/entity/EntityLiving1_15_R1.java new file mode 100644 index 0000000..3d97aba --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/entity/EntityLiving1_15_R1.java @@ -0,0 +1,17 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1.entity; + +import net.minecraft.server.v1_15_R1.EntityLiving; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityLiving; + +public abstract class EntityLiving1_15_R1 extends Entity1_15_R1 implements NmsEntityLiving { + + public EntityLiving1_15_R1(E handle) { + super(handle); + } + + @Override + public void setCollidable(boolean collidable) { + handle.collides = collidable; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/entity/Player1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/entity/Player1_15_R1.java new file mode 100644 index 0000000..5e6dd93 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/entity/Player1_15_R1.java @@ -0,0 +1,289 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1.entity; + +import java.util.ArrayList; +import java.util.Collections; + +import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_15_R1.util.CraftChatMessage; +import org.bukkit.entity.Player; + +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.properties.Property; +import com.mojang.authlib.properties.PropertyMap; + +import net.minecraft.server.v1_15_R1.EntityPlayer; +import net.minecraft.server.v1_15_R1.EnumItemSlot; +import net.minecraft.server.v1_15_R1.IChatBaseComponent; +import net.minecraft.server.v1_15_R1.MathHelper; +import net.minecraft.server.v1_15_R1.PacketPlayInClientCommand; +import net.minecraft.server.v1_15_R1.PacketPlayInClientCommand.EnumClientCommand; +import net.minecraft.server.v1_15_R1.PacketPlayOutEntityDestroy; +import net.minecraft.server.v1_15_R1.PacketPlayOutEntityEquipment; +import net.minecraft.server.v1_15_R1.PacketPlayOutEntityHeadRotation; +import net.minecraft.server.v1_15_R1.PacketPlayOutEntityMetadata; +import net.minecraft.server.v1_15_R1.PacketPlayOutEntityStatus; +import net.minecraft.server.v1_15_R1.PacketPlayOutHeldItemSlot; +import net.minecraft.server.v1_15_R1.PacketPlayOutNamedEntitySpawn; +import net.minecraft.server.v1_15_R1.PacketPlayOutPlayerInfo; +import net.minecraft.server.v1_15_R1.PacketPlayOutPlayerInfo.EnumPlayerInfoAction; +import net.minecraft.server.v1_15_R1.PacketPlayOutPlayerListHeaderFooter; +import net.minecraft.server.v1_15_R1.PacketPlayOutPosition; +import net.minecraft.server.v1_15_R1.PacketPlayOutRespawn; +import net.minecraft.server.v1_15_R1.PacketPlayOutTitle; +import net.minecraft.server.v1_15_R1.PacketPlayOutTitle.EnumTitleAction; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1.data.SyntaxContainer1_15_R1; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.reflection.data.type.SkinDataType; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; +import net.sourcewriters.minecraft.vcompat.utils.bukkit.Players; +import net.sourcewriters.minecraft.vcompat.utils.minecraft.MojangProfileServer; +import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; +import net.sourcewriters.minecraft.vcompat.utils.thread.PostAsync; +import net.minecraft.server.v1_15_R1.PlayerConnection; + +public class Player1_15_R1 extends EntityLiving1_15_R1 implements NmsPlayer { + + private String realName; + private Skin realSkin; + + private final WrappedContainer dataAdapter; + + public Player1_15_R1(Player player) { + super(((CraftPlayer) player).getHandle()); + dataAdapter = new SyntaxContainer1_15_R1(getBukkitPlayer().getPersistentDataContainer()); + update(false); + } + + @Override + public CraftPlayer getBukkitPlayer() { + return handle.getBukkitEntity(); + } + + @Override + public WrappedContainer getDataAdapter() { + return dataAdapter; + } + + @Override + public void setSkin(Skin skin) { + if (skin == null) { + return; + } + dataAdapter.set("skin", skin, SkinDataType.WRAPPED_INSTANCE); + } + + @Override + public Skin getSkin() { + return dataAdapter.getOrDefault("skin", SkinDataType.WRAPPED_INSTANCE, realSkin); + } + + @Override + public Skin getRealSkin() { + return realSkin; + } + + @Override + public void setName(String name) { + if (getName().equals(name)) { + return; + } + if (name == null) { + dataAdapter.remove("name"); + return; + } + dataAdapter.set("name", name, WrapType.STRING); + } + + @Override + public String getName() { + return dataAdapter.getOrDefault("name", WrapType.STRING, realName); + } + + @Override + public String getRealName() { + return realName; + } + + @Override + public void setPlayerListHeader(String text) { + setPlayerListHeaderAndFooter(text, getPlayerListFooter()); + } + + @Override + public String getPlayerListHeader() { + return dataAdapter.getOrDefault("header", WrapType.STRING, ""); + } + + @Override + public void setPlayerListFooter(String text) { + setPlayerListHeaderAndFooter(getPlayerListHeader(), text); + } + + @Override + public String getPlayerListFooter() { + return dataAdapter.getOrDefault("footer", WrapType.STRING, ""); + } + + @Override + public int getPing() { + return handle.ping; + } + + @Override + public void setPlayerListHeaderAndFooter(String header, String footer) { + dataAdapter.set("header", header, WrapType.STRING); + dataAdapter.set("footer", footer, WrapType.STRING); + sendPlayerListInfo(header, footer); + } + + private final void sendPlayerListInfo(String header, String footer) { + if (handle.playerConnection.isDisconnected()) { + return; + } + + IChatBaseComponent headerComponent = header.isEmpty() ? null : CraftChatMessage.fromStringOrNull(header, true); + IChatBaseComponent footerComponent = footer.isEmpty() ? null : CraftChatMessage.fromStringOrNull(footer, true); + + PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter(); + + packet.header = headerComponent; + packet.footer = footerComponent; + + handle.playerConnection.sendPacket(packet); + } + + @Override + public void setTitleTimes(int fadeIn, int stay, int fadeOut) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TIMES, null, fadeIn, stay, fadeOut)); + } + + @Override + public void sendSubtitle(String text) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.SUBTITLE, CraftChatMessage.fromStringOrNull(text))); + } + + @Override + public void sendTitle(String text) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TITLE, CraftChatMessage.fromStringOrNull(text))); + } + + @Override + public void sendActionBar(String text) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.ACTIONBAR, CraftChatMessage.fromStringOrNull(text))); + } + + @Override + public void fakeRespawn() { + if (handle.playerConnection.isDisconnected()) { + return; + } + PacketPlayOutPlayerInfo remInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER, handle); + PacketPlayOutPlayerInfo addInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.ADD_PLAYER, handle); + + PacketPlayOutEntityDestroy destroyPacket = new PacketPlayOutEntityDestroy(handle.getId()); + PacketPlayOutNamedEntitySpawn spawnPacket = new PacketPlayOutNamedEntitySpawn(handle); + PacketPlayOutEntityHeadRotation rotationPacket = new PacketPlayOutEntityHeadRotation(handle, + (byte) MathHelper.d(handle.getHeadRotation() * 256F / 360F)); + + ArrayList equipmentPackets = new ArrayList<>(); + for (EnumItemSlot slot : EnumItemSlot.values()) { + equipmentPackets.add(new PacketPlayOutEntityEquipment(handle.getId(), slot, handle.getEquipment(slot))); + } + + Player self = getBukkitPlayer(); + Player[] players = Players.getOnlineWithout(getUniqueId()); + for (Player player : players) { + if (!player.canSee(self)) { + continue; + } + PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection; + connection.sendPacket(remInfoPacket); + connection.sendPacket(addInfoPacket); + connection.sendPacket(destroyPacket); + connection.sendPacket(spawnPacket); + connection.sendPacket(rotationPacket); + for (PacketPlayOutEntityEquipment equipmentPacket : equipmentPackets) { + connection.sendPacket(equipmentPacket); + } + } + + PacketPlayOutRespawn respawnPacket = new PacketPlayOutRespawn(handle.dimension, handle.world.getSeed(), + handle.world.worldData.getType(), handle.playerInteractManager.getGameMode()); + PacketPlayOutPosition positionPacket = new PacketPlayOutPosition(handle.locX(), handle.locY(), handle.locZ(), handle.yaw, + handle.pitch, Collections.emptySet(), 0); + PacketPlayOutHeldItemSlot itemPacket = new PacketPlayOutHeldItemSlot(handle.inventory.itemInHandIndex); + PacketPlayOutEntityStatus statusPacket = new PacketPlayOutEntityStatus(handle, (byte) 28); + PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); + + PlayerConnection connection = handle.playerConnection; + connection.sendPacket(remInfoPacket); + connection.sendPacket(addInfoPacket); + connection.sendPacket(respawnPacket); + connection.sendPacket(positionPacket); + connection.sendPacket(itemPacket); + connection.sendPacket(statusPacket); + connection.sendPacket(metadataPacket); + + handle.updateAbilities(); + handle.triggerHealthUpdate(); + handle.updateInventory(handle.defaultContainer); + if (handle.activeContainer != handle.defaultContainer) { + handle.updateInventory(handle.activeContainer); + } + self.recalculatePermissions(); + } + + @Override + public void respawn() { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayInClientCommand(EnumClientCommand.PERFORM_RESPAWN)); + } + + @Override + public void update() { + update(true); + } + + private final void update(boolean flag) { + PostAsync.forcePost(() -> { + realName = MojangProfileServer.getName(getUniqueId()); + realSkin = MojangProfileServer.getSkin(realName, getUniqueId()); + }); + if (flag) { + GameProfile profile = handle.getProfile(); + + Skin skin = getSkin(); + if (skin != null) { + PropertyMap properties = profile.getProperties(); + properties.removeAll("textures"); + properties.put("textures", new Property("textures", skin.getValue(), skin.getSignature())); + } + + String name = getName(); + if (name != null) { + ReflectionProvider.DEFAULT.getReflect("mjGameProfile").setFieldValue(profile, "name", name); + } + + if (!(name == null && skin == null)) { + fakeRespawn(); + } + } + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/tools/BlockTools1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/tools/BlockTools1_15_R1.java new file mode 100644 index 0000000..b495ce8 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/tools/BlockTools1_15_R1.java @@ -0,0 +1,39 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1.tools; + +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_15_R1.block.CraftSkull; + +import com.mojang.authlib.properties.Property; +import com.mojang.authlib.properties.PropertyMap; +import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; +import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.minecraft.server.v1_15_R1.TileEntitySkull; +import net.sourcewriters.minecraft.vcompat.reflection.tools.BlockTools; +import net.sourcewriters.minecraft.vcompat.utils.constants.MinecraftConstants; + +public class BlockTools1_15_R1 extends BlockTools { + + private final AbstractReflect craftEntityStateRef = new Reflect(CraftSkull.class).searchField("tileEntity", "tileEntity"); + + @Override + public void setHeadTexture(Block block, String texture) { + if (!(block instanceof CraftSkull)) { + return; + } + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + PropertyMap map = entitySkull.gameProfile.getProperties(); + map.removeAll("textures"); + map.put("textures", new Property("textures", MinecraftConstants.TEXTURE_SIGNATURE, texture)); + } + + @Override + public String getHeadTexture(Block block) { + if (!(block instanceof CraftSkull)) { + return null; + } + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + return entitySkull.gameProfile.getProperties().get("textures").iterator().next().getValue(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/tools/ServerTools1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/tools/ServerTools1_15_R1.java new file mode 100644 index 0000000..12d799c --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/tools/ServerTools1_15_R1.java @@ -0,0 +1,27 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1.tools; + +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_15_R1.CraftServer; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1.wrapper.ConsoleReaderWrapper1_15_R1; +import net.sourcewriters.minecraft.vcompat.reflection.tools.ServerTools; + +public class ServerTools1_15_R1 extends ServerTools { + + @Override + public void setMotd(String text) { + ((CraftServer) Bukkit.getServer()).getServer().setMotd(text); + } + + @Override + public String getMotd() { + return ((CraftServer) Bukkit.getServer()).getServer().getMotd(); + } + + @SuppressWarnings("resource") + @Override + public ConsoleReaderWrapper1_15_R1 getConsole() { + return ConsoleReaderWrapper1_15_R1.INSTANCE; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/tools/SkinTools1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/tools/SkinTools1_15_R1.java new file mode 100644 index 0000000..e0e82f3 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/tools/SkinTools1_15_R1.java @@ -0,0 +1,16 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1.tools; + +import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer; +import org.bukkit.entity.Player; + +import net.sourcewriters.minecraft.vcompat.reflection.tools.SkinTools; +import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; + +public class SkinTools1_15_R1 extends SkinTools { + + @Override + public Skin skinFromPlayer(Player player) { + return skinFromGameProfile(((CraftPlayer) player).getHandle().getProfile()); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/utils/EntityConstructors1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/utils/EntityConstructors1_15_R1.java new file mode 100644 index 0000000..377f198 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/utils/EntityConstructors1_15_R1.java @@ -0,0 +1,12 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1.utils; + +import java.util.function.Function; + +import net.minecraft.server.v1_15_R1.World; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1.entity.ArmorStand1_15_R1; + +public abstract class EntityConstructors1_15_R1 { + + public static final Function ARMOR_STAND = (world -> new ArmorStand1_15_R1(world)); + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/wrapper/ConsoleReaderWrapper1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/wrapper/ConsoleReaderWrapper1_15_R1.java new file mode 100644 index 0000000..7cef3fb --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/wrapper/ConsoleReaderWrapper1_15_R1.java @@ -0,0 +1,43 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1.wrapper; + +import java.io.IOException; +import java.io.Writer; + +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_15_R1.CraftServer; +import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; + +import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; + +public final class ConsoleReaderWrapper1_15_R1 extends ConsoleReaderWrapper { + + public static final ConsoleReaderWrapper1_15_R1 INSTANCE = new ConsoleReaderWrapper1_15_R1(); + + private final ConsoleReader reader; + + @SuppressWarnings("resource") + private ConsoleReaderWrapper1_15_R1() { + this.reader = ((CraftServer) Bukkit.getServer()).getServer().reader; + } + + @Override + public Writer getOutput() { + return reader.getOutput(); + } + + @Override + public boolean isAnsiSupported() { + return reader.getTerminal().isAnsiSupported(); + } + + @Override + public void flush() throws IOException { + reader.flush(); + } + + @Override + public void drawLine() throws IOException { + reader.drawLine(); + } + +} diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/BukkitConversion1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/BukkitConversion1_16_R1.java new file mode 100644 index 0000000..6c29a2f --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/BukkitConversion1_16_R1.java @@ -0,0 +1,218 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1; + +import java.util.Set; + +import org.bukkit.craftbukkit.v1_16_R1.inventory.CraftItemStack; +import org.bukkit.entity.EntityType; + +import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; +import com.syntaxphoenix.syntaxapi.data.DataType; +import com.syntaxphoenix.syntaxapi.nbt.NbtByte; +import com.syntaxphoenix.syntaxapi.nbt.NbtByteArray; +import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; +import com.syntaxphoenix.syntaxapi.nbt.NbtDouble; +import com.syntaxphoenix.syntaxapi.nbt.NbtEnd; +import com.syntaxphoenix.syntaxapi.nbt.NbtFloat; +import com.syntaxphoenix.syntaxapi.nbt.NbtInt; +import com.syntaxphoenix.syntaxapi.nbt.NbtIntArray; +import com.syntaxphoenix.syntaxapi.nbt.NbtList; +import com.syntaxphoenix.syntaxapi.nbt.NbtLong; +import com.syntaxphoenix.syntaxapi.nbt.NbtLongArray; +import com.syntaxphoenix.syntaxapi.nbt.NbtShort; +import com.syntaxphoenix.syntaxapi.nbt.NbtString; +import com.syntaxphoenix.syntaxapi.nbt.NbtTag; +import com.syntaxphoenix.syntaxapi.nbt.NbtType; + +import net.minecraft.server.v1_16_R1.ItemStack; +import net.minecraft.server.v1_16_R1.NBTBase; +import net.minecraft.server.v1_16_R1.NBTNumber; +import net.minecraft.server.v1_16_R1.NBTTagByte; +import net.minecraft.server.v1_16_R1.NBTTagByteArray; +import net.minecraft.server.v1_16_R1.NBTTagCompound; +import net.minecraft.server.v1_16_R1.NBTTagDouble; +import net.minecraft.server.v1_16_R1.NBTTagEnd; +import net.minecraft.server.v1_16_R1.NBTTagFloat; +import net.minecraft.server.v1_16_R1.NBTTagInt; +import net.minecraft.server.v1_16_R1.NBTTagIntArray; +import net.minecraft.server.v1_16_R1.NBTTagList; +import net.minecraft.server.v1_16_R1.NBTTagLong; +import net.minecraft.server.v1_16_R1.NBTTagLongArray; +import net.minecraft.server.v1_16_R1.NBTTagShort; +import net.minecraft.server.v1_16_R1.NBTTagString; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1.data.BukkitContext1_16_R1; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1.data.BukkitType1_16_R1; +import net.sourcewriters.minecraft.vcompat.reflection.BukkitConversion; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; + +public class BukkitConversion1_16_R1 extends BukkitConversion { + + protected BukkitConversion1_16_R1(VersionControl1_16_R1 versionControl) { + super(versionControl); + } + + @Override + public EntityType toEntityType(NmsEntityType type) { + try { + return EntityType.valueOf(type.name()); + } catch (IllegalArgumentException ignore) { + return null; + } + } + + @Override + public NmsEntityType fromEntityType(EntityType type) { + try { + return NmsEntityType.valueOf(type.name()); + } catch (IllegalArgumentException ignore) { + return null; + } + } + + @Override + public NBTBase toMinecraftTag(NbtTag tag) { + switch (tag.getType()) { + case BYTE: + return NBTTagByte.a((byte) tag.getValue()); + case SHORT: + return NBTTagShort.a((short) tag.getValue()); + case INT: + return NBTTagInt.a((int) tag.getValue()); + case LONG: + return NBTTagLong.a((long) tag.getValue()); + case FLOAT: + return NBTTagFloat.a((float) tag.getValue()); + case DOUBLE: + return NBTTagDouble.a((double) tag.getValue()); + case STRING: + return NBTTagString.a((String) tag.getValue()); + case BYTE_ARRAY: + return new NBTTagByteArray((byte[]) tag.getValue()); + case INT_ARRAY: + return new NBTTagIntArray((int[]) tag.getValue()); + case LONG_ARRAY: + return new NBTTagLongArray((long[]) tag.getValue()); + case LIST: + return toMinecraftList((NbtList) tag); + case COMPOUND: + return toMinecraftCompound((NbtCompound) tag); + case END: + return NBTTagEnd.b; + default: + return null; + } + } + + @Override + public NbtTag fromMinecraftTag(Object raw) { + if (!(raw instanceof NBTBase)) { + return null; + } + NBTBase tag = (NBTBase) raw; + NbtType type = NbtType.getById(tag.getTypeId()); + switch (type) { + case BYTE: + return new NbtByte(((NBTNumber) tag).asByte()); + case SHORT: + return new NbtShort(((NBTNumber) tag).asShort()); + case INT: + return new NbtInt(((NBTNumber) tag).asInt()); + case LONG: + return new NbtLong(((NBTNumber) tag).asLong()); + case FLOAT: + return new NbtFloat(((NBTNumber) tag).asFloat()); + case DOUBLE: + return new NbtDouble(((NBTNumber) tag).asDouble()); + case STRING: + return new NbtString(((NBTTagString) tag).asString()); + case BYTE_ARRAY: + return new NbtByteArray(((NBTTagByteArray) tag).getBytes()); + case INT_ARRAY: + return new NbtIntArray(((NBTTagIntArray) tag).getInts()); + case LONG_ARRAY: + return new NbtLongArray(((NBTTagLongArray) tag).getLongs()); + case LIST: + return fromMinecraftList(tag); + case COMPOUND: + return fromMinecraftCompound(tag); + case END: + return NbtEnd.INSTANCE; + default: + return null; + } + } + + @Override + public NBTTagList toMinecraftList(NbtList list) { + NBTTagList output = new NBTTagList(); + for (NbtTag tag : list) { + output.add(toMinecraftTag(tag)); + } + return output; + } + + @Override + public NbtList fromMinecraftList(Object raw) { + if (!(raw instanceof NBTTagList)) { + return null; + } + NBTTagList list = (NBTTagList) raw; + NbtList output = new NbtList<>(NbtType.getById(list.getTypeId())); + for (NBTBase base : list) { + output.add(fromMinecraftTag(base)); + } + return output; + } + + @Override + public NBTTagCompound toMinecraftCompound(NbtCompound compound) { + NBTTagCompound output = new NBTTagCompound(); + if (compound.isEmpty()) { + return output; + } + Set keys = compound.getKeys(); + for (String key : keys) { + output.set(key, toMinecraftTag(compound.get(key))); + } + return output; + } + + @Override + public NbtCompound fromMinecraftCompound(Object raw) { + if (!(raw instanceof NBTTagCompound)) { + return null; + } + NBTTagCompound compound = (NBTTagCompound) raw; + NbtCompound output = new NbtCompound(); + if (compound.isEmpty()) { + return output; + } + Set keys = compound.getKeys(); + for (String key : keys) { + output.set(key, fromMinecraftTag(compound.get(key))); + } + return output; + } + + @Override + public org.bukkit.inventory.ItemStack itemFromCompound(NbtCompound compound) { + return CraftItemStack.asBukkitCopy(ItemStack.a(toMinecraftCompound(compound))); + } + + @Override + public NbtCompound itemToCompound(org.bukkit.inventory.ItemStack itemStack) { + return fromMinecraftCompound(CraftItemStack.asNMSCopy(itemStack).getOrCreateTag()); + } + + @Override + public WrappedContext createContext(DataAdapterContext context) { + return new BukkitContext1_16_R1(context); + } + + @Override + public WrapType wrap(DataType dataType) { + return new BukkitType1_16_R1<>(dataType); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/EntityProvider1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/EntityProvider1_16_R1.java new file mode 100644 index 0000000..5c71c1f --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/EntityProvider1_16_R1.java @@ -0,0 +1,47 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1; + +import java.util.EnumMap; +import java.util.function.Function; + +import org.bukkit.craftbukkit.v1_16_R1.CraftWorld; + +import net.minecraft.server.v1_16_R1.World; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1.utils.EntityConstructors1_16_R1; +import net.sourcewriters.minecraft.vcompat.reflection.EntityProvider; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; + +public class EntityProvider1_16_R1 extends EntityProvider { + + private final EnumMap> entityMap = new EnumMap<>(NmsEntityType.class); + + protected EntityProvider1_16_R1(VersionControl1_16_R1 versionControl) { + super(versionControl); + } + + @SuppressWarnings("unchecked") + private final Function searchConstructor(NmsEntityType type) { + try { + return (Function) EntityConstructors1_16_R1.class.getField(type.name()).get(null); + } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException ignore) { + return null; + } + } + + private final Function getConstructor(NmsEntityType type) { + return entityMap.computeIfAbsent(type, (key -> searchConstructor(key))); + } + + @Override + public NmsEntity createEntity(org.bukkit.World world, NmsEntityType type) { + if (!(world instanceof CraftWorld)) { + return null; + } + Function function; + if ((function = getConstructor(type)) == null) { + return null; + } + return function.apply(((CraftWorld) world).getHandle()); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/PacketHandler1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/PacketHandler1_16_R1.java new file mode 100644 index 0000000..c8877a3 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/PacketHandler1_16_R1.java @@ -0,0 +1,11 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1; + +import net.sourcewriters.minecraft.vcompat.reflection.PacketHandler; + +public class PacketHandler1_16_R1 extends PacketHandler { + + protected PacketHandler1_16_R1(VersionControl1_16_R1 versionControl) { + super(versionControl); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/PlayerProvider1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/PlayerProvider1_16_R1.java new file mode 100644 index 0000000..a4c371a --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/PlayerProvider1_16_R1.java @@ -0,0 +1,20 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1; + +import org.bukkit.entity.Player; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1.entity.Player1_16_R1; +import net.sourcewriters.minecraft.vcompat.reflection.PlayerProvider; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; + +public class PlayerProvider1_16_R1 extends PlayerProvider { + + protected PlayerProvider1_16_R1(VersionControl1_16_R1 versionControl) { + super(versionControl); + } + + @Override + protected NmsPlayer createPlayer(Player player) { + return new Player1_16_R1(player); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/TextureProvider1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/TextureProvider1_16_R1.java new file mode 100644 index 0000000..1498adc --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/TextureProvider1_16_R1.java @@ -0,0 +1,102 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1; + +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_16_R1.block.CraftBlockEntityState; +import org.bukkit.craftbukkit.v1_16_R1.block.CraftSkull; +import org.bukkit.craftbukkit.v1_16_R1.inventory.CraftItemStack; +import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.inventory.meta.SkullMeta; + +import com.mojang.authlib.GameProfile; +import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; +import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.minecraft.server.v1_16_R1.GameProfileSerializer; +import net.minecraft.server.v1_16_R1.ItemStack; +import net.minecraft.server.v1_16_R1.NBTTagCompound; +import net.minecraft.server.v1_16_R1.TileEntitySkull; +import net.sourcewriters.minecraft.vcompat.reflection.TextureProvider; + +public class TextureProvider1_16_R1 extends TextureProvider { + + private final AbstractReflect craftEntityStateRef = new Reflect(CraftBlockEntityState.class).searchField("tileEntity", "tileEntity"); + private final AbstractReflect craftItemStackRef = new Reflect(CraftItemStack.class).searchField("handle", "handle"); + private final AbstractReflect craftMetaSkullRef = new Reflect("org.bukkit.craftbukkit.v1_16_R1.inventory.CraftMetaSkull") + .searchField("serialized", "serializedProfile").searchField("profile", "profile"); + + protected TextureProvider1_16_R1(VersionControl1_16_R1 versionControl) { + super(versionControl); + } + + @Override + public GameProfile profileFromBlock(Block block) { + if (!(block instanceof CraftSkull)) { + return null; + } + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + return entitySkull.gameProfile; + } + + @Override + public GameProfile profileFromItem(org.bukkit.inventory.ItemStack itemStack) { + if (!(itemStack.getItemMeta() instanceof SkullMeta)) { + return null; + } + SkullMeta meta = (SkullMeta) itemStack.getItemMeta(); + GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue("profile", meta); + if (profile == null) { + NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue("serialized", meta); + if (compound == null) { + ItemStack stack = null; + if (itemStack instanceof CraftItemStack) { + stack = (ItemStack) craftItemStackRef.getFieldValue("handle", itemStack); + } + if (stack == null) { + stack = CraftItemStack.asNMSCopy(itemStack); + } + NBTTagCompound stackTag = stack.getOrCreateTag(); + if (stackTag.hasKeyOfType("SkullOwner", 10)) { + compound = stackTag.getCompound("SkullOwner"); + } else if (stackTag.hasKeyOfType("SkullProfile", 10)) { + compound = stackTag.getCompound("SkullProfile"); + } + } + if (compound == null) { + return null; + } + profile = GameProfileSerializer.deserialize(compound); + } + return profile; + } + + @Override + public org.bukkit.inventory.ItemStack getItem(GameProfile profile) { + org.bukkit.inventory.ItemStack craftStack = CraftItemStack.asCraftCopy(new org.bukkit.inventory.ItemStack(Material.PLAYER_HEAD)); + applyItem(craftStack, profile); + return craftStack; + } + + @Override + public boolean applyItem(org.bukkit.inventory.ItemStack itemStack, GameProfile profile) { + ItemMeta meta = itemStack.getItemMeta(); + if (!(meta instanceof SkullMeta)) { + return false; + } + SkullMeta skullMeta = (SkullMeta) meta; + craftMetaSkullRef.setFieldValue(meta, "profile", profile); + itemStack.setItemMeta(skullMeta); + return true; + } + + @Override + public boolean applyBlock(Block block, GameProfile profile) { + if (!(block instanceof CraftSkull)) { + return false; + } + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + entitySkull.setGameProfile(profile); + return true; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/ToolProvider1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/ToolProvider1_16_R1.java new file mode 100644 index 0000000..9d967ea --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/ToolProvider1_16_R1.java @@ -0,0 +1,33 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1.tools.BlockTools1_16_R1; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1.tools.ServerTools1_16_R1; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1.tools.SkinTools1_16_R1; +import net.sourcewriters.minecraft.vcompat.reflection.ToolProvider; + +public class ToolProvider1_16_R1 extends ToolProvider { + + private final BlockTools1_16_R1 blockTools = new BlockTools1_16_R1(); + private final SkinTools1_16_R1 skinTools = new SkinTools1_16_R1(); + private final ServerTools1_16_R1 serverTools = new ServerTools1_16_R1(); + + protected ToolProvider1_16_R1(VersionControl1_16_R1 versionControl) { + super(versionControl); + } + + @Override + public SkinTools1_16_R1 getSkinTools() { + return skinTools; + } + + @Override + public ServerTools1_16_R1 getServerTools() { + return serverTools; + } + + @Override + public BlockTools1_16_R1 getBlockTools() { + return blockTools; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/VersionControl1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/VersionControl1_16_R1.java new file mode 100644 index 0000000..8ae7c70 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/VersionControl1_16_R1.java @@ -0,0 +1,61 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1.data.hook.BukkitContainerAdapterHook1_16_R1; +import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; + +public class VersionControl1_16_R1 extends VersionControl { + + public static VersionControl1_16_R1 INSTANCE; + + public static VersionControl1_16_R1 init() { + return INSTANCE != null ? INSTANCE : (INSTANCE = new VersionControl1_16_R1()); + } + + private final ToolProvider1_16_R1 toolProvider = new ToolProvider1_16_R1(this); + private final TextureProvider1_16_R1 textureProvider = new TextureProvider1_16_R1(this); + private final PacketHandler1_16_R1 packetHandler = new PacketHandler1_16_R1(this); + private final EntityProvider1_16_R1 entityProvider = new EntityProvider1_16_R1(this); + private final PlayerProvider1_16_R1 playerProvider = new PlayerProvider1_16_R1(this); + private final BukkitConversion1_16_R1 bukkitConversion = new BukkitConversion1_16_R1(this); + + private VersionControl1_16_R1() { + BukkitContainerAdapterHook1_16_R1.hookEntity(); + } + + @Override + public ToolProvider1_16_R1 getToolProvider() { + return toolProvider; + } + + @Override + public EntityProvider1_16_R1 getEntityProvider() { + return entityProvider; + } + + @Override + public PlayerProvider1_16_R1 getPlayerProvider() { + return playerProvider; + } + + @Override + public TextureProvider1_16_R1 getTextureProvider() { + return textureProvider; + } + + @Override + public PacketHandler1_16_R1 getPacketHandler() { + return packetHandler; + } + + @Override + public BukkitConversion1_16_R1 getBukkitConversion() { + return bukkitConversion; + } + + @Override + public void shutdown() { + dataProvider.getDefaultDistributor().shutdown(); + BukkitContainerAdapterHook1_16_R1.unhookAll(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/BukkitContainer1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/BukkitContainer1_16_R1.java new file mode 100644 index 0000000..251d3a1 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/BukkitContainer1_16_R1.java @@ -0,0 +1,161 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1.data; + +import java.util.Arrays; +import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; + +import org.bukkit.NamespacedKey; +import org.bukkit.persistence.PersistentDataAdapterContext; +import org.bukkit.persistence.PersistentDataContainer; +import org.bukkit.persistence.PersistentDataType; + +import com.syntaxphoenix.syntaxapi.data.IDataContainer; + +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; +import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SyntaxKey; + +public final class BukkitContainer1_16_R1 extends WrappedContainer implements PersistentDataContainer { + + private final IDataContainer container; + + public BukkitContainer1_16_R1(IDataContainer container) { + this.container = container; + } + + @Override + public IDataContainer getHandle() { + return container; + } + + @Override + public IDataContainer getAsSyntaxContainer() { + return container; + } + + /* + * + */ + + @Override + public boolean has(NamespacedKey key, PersistentDataType type) { + return has(new BukkitKey1_16_R1(key), WrappedType1_16_R1.wrap(type)); + } + + @Override + public Z get(NamespacedKey key, PersistentDataType type) { + return get(new BukkitKey1_16_R1(key), WrappedType1_16_R1.wrap(type)); + } + + @Override + public Z getOrDefault(NamespacedKey key, PersistentDataType type, Z value) { + return Optional.ofNullable(get(key, type)).orElse(value); + } + + @Override + public void set(NamespacedKey key, PersistentDataType type, Z value) { + set(new BukkitKey1_16_R1(key), value, WrappedType1_16_R1.wrap(type)); + } + + @Override + public void remove(NamespacedKey key) { + remove(new BukkitKey1_16_R1(key)); + } + + @Override + public Set getKeys() { + return Arrays.stream(container.getKeys()).map(SyntaxKey::new).map(BukkitKey1_16_R1::asBukkit).collect(Collectors.toSet()); + } + + @Override + public PersistentDataAdapterContext getAdapterContext() { + return getContext(); + } + + /* + * + */ + + @Override + public BukkitContext1_16_R1 getContext() { + return new BukkitContext1_16_R1(container.getAdapterContext()); + } + + @Override + public boolean has(String key) { + return has(wrappedKey(key)); + } + + @Override + public boolean has(WrappedKey key) { + return container.has(key.getNamespacedKey()); + } + + @Override + public boolean has(String key, WrapType type) { + return has(wrappedKey(key), type); + } + + @Override + public boolean has(WrappedKey key, WrapType type) { + return container.has(key.getNamespacedKey(), type.syntaxType()); + } + + @Override + public Object get(String key) { + return get(wrappedKey(key)); + } + + @Override + public Object get(WrappedKey key) { + return container.get(key.getNamespacedKey()); + } + + @Override + public C get(String key, WrapType type) { + return get(wrappedKey(key), type); + } + + @Override + public C get(WrappedKey key, WrapType type) { + return container.get(key.getNamespacedKey(), type.syntaxType()); + } + + @Override + public void set(String key, B value, WrapType type) { + set(wrappedKey(key), value, type); + } + + @Override + public void set(WrappedKey key, B value, WrapType type) { + container.set(key.getNamespacedKey(), value, type.syntaxType()); + } + + @Override + public boolean remove(String key) { + return false; + } + + @Override + public boolean remove(WrappedKey key) { + return container.remove(key.getNamespacedKey()); + } + + @Override + public Set keySet() { + return container.getKeyspaces(); + } + + @Override + public boolean isEmpty() { + return container.isEmpty(); + } + + @Override + public int size() { + return container.size(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/BukkitContext1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/BukkitContext1_16_R1.java new file mode 100644 index 0000000..84b1a68 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/BukkitContext1_16_R1.java @@ -0,0 +1,39 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1.data; + +import org.bukkit.persistence.PersistentDataAdapterContext; +import org.bukkit.persistence.PersistentDataContainer; + +import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; +import com.syntaxphoenix.syntaxapi.data.IDataContainer; + +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; + +public final class BukkitContext1_16_R1 extends WrappedContext implements PersistentDataAdapterContext { + + private final DataAdapterContext context; + + public BukkitContext1_16_R1(DataAdapterContext context) { + this.context = context; + } + + @Override + public DataAdapterContext getHandle() { + return context; + } + + @Override + public PersistentDataContainer newPersistentDataContainer() { + return newContainer(); + } + + @Override + public IDataContainer newDataContainer() { + return context.newDataContainer(); + } + + @Override + public BukkitContainer1_16_R1 newContainer() { + return new BukkitContainer1_16_R1(context.newDataContainer()); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/BukkitKey1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/BukkitKey1_16_R1.java new file mode 100644 index 0000000..084b1a9 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/BukkitKey1_16_R1.java @@ -0,0 +1,52 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1.data; + +import org.bukkit.NamespacedKey; +import org.bukkit.plugin.Plugin; + +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; + +public final class BukkitKey1_16_R1 extends WrappedKey { + + private final NamespacedKey key; + + public BukkitKey1_16_R1(Plugin plugin, String key) { + this.key = new NamespacedKey(plugin, key); + } + + @SuppressWarnings("deprecation") + public BukkitKey1_16_R1(String name, String key) { + this.key = new NamespacedKey(name, key); + } + + public BukkitKey1_16_R1(NamespacedKey key) { + this.key = key; + } + + @Override + public NamespacedKey getHandle() { + return key; + } + + @Override + public String getName() { + return key.getNamespace(); + } + + @Override + public String getKey() { + return key.getKey(); + } + + @Override + public String toString() { + return key.toString(); + } + + public static NamespacedKey asBukkit(WrappedKey key) { + if (key.getHandle() instanceof NamespacedKey) { + return (NamespacedKey) key.getHandle(); + } + return new BukkitKey1_16_R1(key.getName(), key.getKey()).getHandle(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/BukkitType1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/BukkitType1_16_R1.java new file mode 100644 index 0000000..bd6856d --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/BukkitType1_16_R1.java @@ -0,0 +1,69 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1.data; + +import org.bukkit.persistence.PersistentDataAdapterContext; +import org.bukkit.persistence.PersistentDataType; + +import com.syntaxphoenix.syntaxapi.data.DataType; + +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; + +public class BukkitType1_16_R1 extends WrappedType1_16_R1, P0, P1, C0, C1> + implements PersistentDataType { + + private final DataType type; + + public BukkitType1_16_R1(DataType type) { + super(type.getPrimitive(), type.getComplex()); + this.type = type; + } + + @Override + public DataType getHandle() { + return type; + } + + @Override + public Class getPrimitiveOriginal() { + return type.getPrimitive(); + } + + @Override + public Class getComplexOriginal() { + return type.getComplex(); + } + + /* + * + */ + + @Override + public Class getComplexType() { + return complexType; + } + + @Override + public Class getPrimitiveType() { + return primitiveType; + } + + @Override + public P0 toPrimitive(C0 complex, PersistentDataAdapterContext context) { + return wrapToPrimitive(complex, new SyntaxContext1_16_R1(context)); + } + + @Override + public C0 fromPrimitive(P0 primitive, PersistentDataAdapterContext context) { + return wrapToComplex(primitive, new SyntaxContext1_16_R1(context)); + } + + @Override + public P0 wrapToPrimitive(C0 complex, WrappedContext context) { + return toPrimitiveWrapped(type.toPrimitive(context, toComplexOriginal(complex))); + } + + @Override + public C0 wrapToComplex(P0 primitive, WrappedContext context) { + return toComplexWrapped(type.fromPrimitive(context, toPrimitiveOriginal(primitive))); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/SimpleBukkitType1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/SimpleBukkitType1_16_R1.java new file mode 100644 index 0000000..db19aef --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/SimpleBukkitType1_16_R1.java @@ -0,0 +1,36 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1.data; + +import org.bukkit.persistence.PersistentDataAdapterContext; +import org.bukkit.persistence.PersistentDataType; + +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; + +public class SimpleBukkitType1_16_R1 implements PersistentDataType { + + private final WrapType type; + + public SimpleBukkitType1_16_R1(WrapType type) { + this.type = type; + } + + @Override + public Class getComplexType() { + return type.getComplexWrapped(); + } + + @Override + public Class

getPrimitiveType() { + return type.getPrimitiveWrapped(); + } + + @Override + public P toPrimitive(C complex, PersistentDataAdapterContext context) { + return type.wrapToPrimitive(complex, new SyntaxContext1_16_R1(context)); + } + + @Override + public C fromPrimitive(P primitive, PersistentDataAdapterContext context) { + return type.wrapToComplex(primitive, new SyntaxContext1_16_R1(context)); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/SyntaxContainer1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/SyntaxContainer1_16_R1.java new file mode 100644 index 0000000..86209f0 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/SyntaxContainer1_16_R1.java @@ -0,0 +1,185 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1.data; + +import java.util.Set; +import java.util.stream.Collectors; + +import org.bukkit.persistence.PersistentDataContainer; + +import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; +import com.syntaxphoenix.syntaxapi.data.DataType; +import com.syntaxphoenix.syntaxapi.data.IDataContainer; +import com.syntaxphoenix.syntaxapi.utils.key.IKey; + +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; +import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SyntaxKey; + +public final class SyntaxContainer1_16_R1 extends WrappedContainer implements IDataContainer { + + private final PersistentDataContainer container; + + public SyntaxContainer1_16_R1(PersistentDataContainer container) { + this.container = container; + } + + @Override + public PersistentDataContainer getHandle() { + return container; + } + + @Override + public IDataContainer getAsSyntaxContainer() { + return new SyntaxContainer1_16_R1(container); + } + + /* + * + */ + + @Override + public boolean has(IKey key) { + throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); + } + + @Override + public boolean has(String key, DataType type) { + return has(syntaxKey(key), type); + } + + @Override + public boolean has(IKey key, DataType type) { + return has(new SyntaxKey(key), WrappedType1_16_R1.wrap(type)); + } + + @Override + public C get(String key, DataType type) { + return get(syntaxKey(key), type); + } + + @Override + public C get(IKey key, DataType type) { + return get(new SyntaxKey(key), WrappedType1_16_R1.wrap(type)); + } + + @Override + public Object get(String key) { + throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); + } + + @Override + public Object get(IKey key) { + throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); + } + + @Override + public void set(String key, E value, DataType type) { + set(wrappedKey(key), value, WrappedType1_16_R1.wrap(type)); + } + + @Override + public void set(IKey key, E value, DataType type) { + set(new SyntaxKey(key), value, WrappedType1_16_R1.wrap(type)); + } + + @Override + public boolean remove(String key) { + return remove(wrappedKey(key)); + } + + @Override + public boolean remove(IKey key) { + return remove(new SyntaxKey(key)); + } + + @Override + public IKey[] getKeys() { + return container.getKeys().stream().map(BukkitKey1_16_R1::new).map(WrappedKey::getNamespacedKey).toArray(IKey[]::new); + } + + @Override + public Set getKeyspaces() { + return container.getKeys().stream().map(org.bukkit.NamespacedKey::toString).collect(Collectors.toSet()); + } + + @Override + public DataAdapterContext getAdapterContext() { + return getContext(); + } + + /* + * + */ + + @Override + public SyntaxContext1_16_R1 getContext() { + return new SyntaxContext1_16_R1(container.getAdapterContext()); + } + + @Override + public boolean has(String key) { + throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); + } + + @Override + public boolean has(WrappedKey key) { + throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); + } + + @Override + public boolean has(String key, WrapType type) { + return has(wrappedKey(key), type); + } + + @Override + public boolean has(WrappedKey key, WrapType type) { + return container.has(BukkitKey1_16_R1.asBukkit(key), new SimpleBukkitType1_16_R1<>(type)); + } + + @Override + public Object get(WrappedKey key) { + throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); + } + + @Override + public C get(String key, WrapType type) { + return get(wrappedKey(key), type); + } + + @Override + public C get(WrappedKey key, WrapType type) { + return container.get(BukkitKey1_16_R1.asBukkit(key), new SimpleBukkitType1_16_R1<>(type)); + } + + @Override + public void set(String key, B value, WrapType type) { + set(wrappedKey(key), value, type); + } + + @Override + public void set(WrappedKey key, B value, WrapType type) { + container.set(BukkitKey1_16_R1.asBukkit(key), new SimpleBukkitType1_16_R1<>(type), value); + } + + @Override + public boolean remove(WrappedKey key) { + container.remove(BukkitKey1_16_R1.asBukkit(key)); + return true; // Will always return true as we don't know if it contained it + } + + @Override + public Set keySet() { + return getKeyspaces(); + } + + @Override + public boolean isEmpty() { + return container.isEmpty(); + } + + @Override + public int size() { + return container.getKeys().size(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/SyntaxContext1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/SyntaxContext1_16_R1.java new file mode 100644 index 0000000..7eae0db --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/SyntaxContext1_16_R1.java @@ -0,0 +1,38 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1.data; + +import org.bukkit.persistence.PersistentDataAdapterContext; +import org.bukkit.persistence.PersistentDataContainer; + +import com.syntaxphoenix.syntaxapi.data.IDataContainer; + +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; + +public final class SyntaxContext1_16_R1 extends WrappedContext implements PersistentDataAdapterContext { + + private final PersistentDataAdapterContext context; + + public SyntaxContext1_16_R1(PersistentDataAdapterContext context) { + this.context = context; + } + + @Override + public PersistentDataAdapterContext getHandle() { + return context; + } + + @Override + public PersistentDataContainer newPersistentDataContainer() { + return context.newPersistentDataContainer(); + } + + @Override + public IDataContainer newDataContainer() { + return newContainer(); + } + + @Override + public SyntaxContainer1_16_R1 newContainer() { + return new SyntaxContainer1_16_R1(context.newPersistentDataContainer()); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/SyntaxType1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/SyntaxType1_16_R1.java new file mode 100644 index 0000000..2570a63 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/SyntaxType1_16_R1.java @@ -0,0 +1,76 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1.data; + +import org.bukkit.persistence.PersistentDataAdapterContext; +import org.bukkit.persistence.PersistentDataType; + +import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; +import com.syntaxphoenix.syntaxapi.data.DataType; + +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; + +public class SyntaxType1_16_R1 extends WrappedType1_16_R1, P0, P1, C0, C1> + implements DataType { + + private final PersistentDataType type; + + public SyntaxType1_16_R1(PersistentDataType type) { + super(type.getPrimitiveType(), type.getComplexType()); + this.type = type; + } + + @Override + public PersistentDataType getHandle() { + return type; + } + + @Override + public Class getPrimitiveOriginal() { + return type.getPrimitiveType(); + } + + @Override + public Class getComplexOriginal() { + return type.getComplexType(); + } + + /* + * + */ + + @Override + public Class getComplex() { + return complexType; + } + + @Override + public Class getPrimitive() { + return primitiveType; + } + + @Override + public P0 toPrimitive(DataAdapterContext context, C0 complex) { + return wrapToPrimitive(complex, new BukkitContext1_16_R1(context)); + } + + @Override + public C0 fromPrimitive(DataAdapterContext context, P0 primitive) { + return wrapToComplex(primitive, new BukkitContext1_16_R1(context)); + } + + @Override + public P0 wrapToPrimitive(C0 complex, WrappedContext context) { + if (!(context instanceof PersistentDataAdapterContext)) { + return null; + } + return toPrimitiveWrapped(type.toPrimitive(toComplexOriginal(complex), (PersistentDataAdapterContext) context)); + } + + @Override + public C0 wrapToComplex(P0 primitive, WrappedContext context) { + if (!(context instanceof PersistentDataAdapterContext)) { + return null; + } + return toComplexWrapped(type.fromPrimitive(toPrimitiveOriginal(primitive), (PersistentDataAdapterContext) context)); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/WrappedType1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/WrappedType1_16_R1.java new file mode 100644 index 0000000..243a20a --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/WrappedType1_16_R1.java @@ -0,0 +1,150 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1.data; + +import java.util.Arrays; + +import org.bukkit.persistence.PersistentDataContainer; +import org.bukkit.persistence.PersistentDataType; + +import com.syntaxphoenix.syntaxapi.data.DataType; +import com.syntaxphoenix.syntaxapi.data.IDataContainer; + +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; + +public abstract class WrappedType1_16_R1 implements WrapType { + + protected final Class primitiveType; + protected final Class complexType; + + private final int primitiveWrap; + private final int complexWrap; + + @SuppressWarnings("unchecked") + protected WrappedType1_16_R1(Class primitive, Class complex) { + this.primitiveWrap = WrappedType1_16_R1.internalState(primitive); + this.complexWrap = WrappedType1_16_R1.internalState(complex); + this.primitiveType = (Class) WrappedType1_16_R1.internalWrap(primitive, primitiveWrap); + this.complexType = (Class) WrappedType1_16_R1.internalWrap(complex, complexWrap); + } + + public abstract H getHandle(); + + public Class getPrimitiveWrapped() { + return primitiveType; + } + + public Class getComplexWrapped() { + return complexType; + } + + public abstract Class getPrimitiveOriginal(); + + public abstract Class getComplexOriginal(); + + @SuppressWarnings("unchecked") + public P0 toPrimitiveWrapped(P1 primitive) { + switch (primitiveWrap) { + case 1: + return (P0) new SyntaxContainer1_16_R1((PersistentDataContainer) primitive); + case 2: + return (P0) Arrays.stream((PersistentDataContainer[]) primitive).map(SyntaxContainer1_16_R1::new) + .toArray(SyntaxContainer1_16_R1[]::new); + case 3: + return (P0) new BukkitContainer1_16_R1((IDataContainer) primitive); + case 4: + return (P0) Arrays.stream((IDataContainer[]) primitive).map(BukkitContainer1_16_R1::new) + .toArray(BukkitContainer1_16_R1[]::new); + default: + return (P0) primitive; + } + } + + @SuppressWarnings("unchecked") + public C0 toComplexWrapped(C1 complex) { + switch (complexWrap) { + case 1: + return (C0) new SyntaxContainer1_16_R1((PersistentDataContainer) complex); + case 2: + return (C0) Arrays.stream((PersistentDataContainer[]) complex).map(SyntaxContainer1_16_R1::new).toArray(SyntaxContainer1_16_R1[]::new); + case 3: + return (C0) new BukkitContainer1_16_R1((IDataContainer) complex); + case 4: + return (C0) Arrays.stream((IDataContainer[]) complex).map(BukkitContainer1_16_R1::new).toArray(BukkitContainer1_16_R1[]::new); + default: + return (C0) complex; + } + } + + @SuppressWarnings("unchecked") + public P1 toPrimitiveOriginal(P0 primitive) { + switch (primitiveWrap) { + case 1: + return (P1) new BukkitContainer1_16_R1((IDataContainer) primitive); + case 2: + return (P1) Arrays.stream((IDataContainer[]) primitive).map(BukkitContainer1_16_R1::new) + .toArray(BukkitContainer1_16_R1[]::new); + case 3: + return (P1) new SyntaxContainer1_16_R1((PersistentDataContainer) primitive); + case 4: + return (P1) Arrays.stream((PersistentDataContainer[]) primitive).map(SyntaxContainer1_16_R1::new) + .toArray(SyntaxContainer1_16_R1[]::new); + default: + return (P1) primitive; + } + } + + @SuppressWarnings("unchecked") + public C1 toComplexOriginal(C0 complex) { + switch (complexWrap) { + case 1: + return (C1) new BukkitContainer1_16_R1((IDataContainer) complex); + case 2: + return (C1) Arrays.stream((IDataContainer[]) complex).map(BukkitContainer1_16_R1::new).toArray(BukkitContainer1_16_R1[]::new); + case 3: + return (C1) new SyntaxContainer1_16_R1((PersistentDataContainer) complex); + case 4: + return (C1) Arrays.stream((PersistentDataContainer[]) complex).map(SyntaxContainer1_16_R1::new).toArray(SyntaxContainer1_16_R1[]::new); + default: + return (C1) complex; + } + } + + protected static Class internalWrap(Class clazz, int state) { + switch (state) { + case 1: + return SyntaxContainer1_16_R1.class; + case 2: + return SyntaxContainer1_16_R1[].class; + case 3: + return BukkitContainer1_16_R1.class; + case 4: + return BukkitContainer1_16_R1[].class; + default: + return clazz; + } + } + + protected static int internalState(Class clazz) { + if (clazz.isAssignableFrom(PersistentDataContainer.class)) { + return 1; + } + if (clazz.isAssignableFrom(PersistentDataContainer[].class)) { + return 2; + } + if (clazz.isAssignableFrom(IDataContainer.class)) { + return 3; + } + if (clazz.isAssignableFrom(IDataContainer[].class)) { + return 4; + } + return 0; + } + + public static BukkitType1_16_R1 wrap(DataType type) { + return new BukkitType1_16_R1<>(type); + } + + public static SyntaxType1_16_R1 wrap(PersistentDataType type) { + return new SyntaxType1_16_R1<>(type); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/hook/BukkitContainerAdapterHook1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/hook/BukkitContainerAdapterHook1_16_R1.java new file mode 100644 index 0000000..0216c76 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/hook/BukkitContainerAdapterHook1_16_R1.java @@ -0,0 +1,134 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1.data.hook; + +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; + +import org.bukkit.craftbukkit.v1_16_R1.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_16_R1.persistence.CraftPersistentDataContainer; +import org.bukkit.craftbukkit.v1_16_R1.persistence.CraftPersistentDataTypeRegistry; +import org.bukkit.persistence.PersistentDataContainer; + +import com.syntaxphoenix.syntaxapi.data.IDataContainer; +import com.syntaxphoenix.syntaxapi.data.container.nbt.NbtContainer; +import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; +import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; +import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.minecraft.server.v1_16_R1.NBTTagCompound; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1.data.BukkitContainer1_16_R1; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1.data.SyntaxContainer1_16_R1; +import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; + +@SuppressWarnings({ + "rawtypes", + "unchecked" +}) +public final class BukkitContainerAdapterHook1_16_R1 { + + private static final BukkitContainerAdapterHook1_16_R1 HOOK = new BukkitContainerAdapterHook1_16_R1(); + + private final AbstractReflect registryRef = new Reflect(CraftPersistentDataTypeRegistry.class) + .searchMethod("create", "createAdapter", Class.class, Class.class, Function.class, Function.class) + .searchField("adapters", "adapters") + .searchField("function", "CREATE_ADAPTER"); + private final AbstractReflect entityRef = new Reflect(CraftEntity.class).searchField("registry", "DATA_TYPE_REGISTRY"); + + private BukkitContainerAdapterHook1_16_R1() {} + + private final HashMap map = new HashMap<>(); + + private CraftPersistentDataTypeRegistry getEntityRegistry() { + return (CraftPersistentDataTypeRegistry) entityRef.getFieldValue("registry"); + } + + private void uninjectAll() { + for (CraftPersistentDataTypeRegistry registry : map.keySet()) { + Map adapters = (Map) registryRef.getFieldValue("adapters", registry); + adapters.remove(BukkitContainer1_16_R1.class); + adapters.remove(SyntaxContainer1_16_R1.class); + registryRef.setFieldValue(registry, "function", map.get(registry)); + } + map.clear(); + } + + private void inject(CraftPersistentDataTypeRegistry registry) { + if (map.containsKey(registry)) { + return; + } + map.put(registry, (Function) registryRef.getFieldValue("function", registry)); + Function function = clazz -> createAdapter(registry, registryRef.getMethod("create").getReturnType(), (Class) clazz); + registryRef.setFieldValue(registry, "function", function); + } + + private E createAdapter(CraftPersistentDataTypeRegistry registry, Class adapterType, Class type) { + if (Objects.equals(BukkitContainer1_16_R1.class, type)) { + return (E) buildAdapter(registry, BukkitContainer1_16_R1.class, tag -> fromPrimitiveSyntax(tag)); + } + if (Objects.equals(SyntaxContainer1_16_R1.class, type)) { + return (E) buildAdapter(registry, SyntaxContainer1_16_R1.class, tag -> fromPrimitiveBukkit(registry, tag)); + } + return (E) map.get(registry).apply(type); + } + + private Object buildAdapter(Object handle, Class type, Function function) { + return registryRef.run(handle, "create", type, NBTTagCompound.class, (Function) input -> toPrimitive(input), + function); + } + + private NBTTagCompound toPrimitive(WrappedContainer input) { + Object handle = findFinalContainer(input).getHandle(); + if (handle instanceof PersistentDataContainer) { + if (handle instanceof CraftPersistentDataContainer) { + return ((CraftPersistentDataContainer) handle).toTagCompound(); + } + throw new IllegalArgumentException( + "Expected 'CraftPersistentDataContainer' got '" + handle.getClass().getSimpleName() + " instead'!"); + } + if (handle instanceof IDataContainer) { + if (handle instanceof NbtContainer) { + return (NBTTagCompound) VersionControl.get().getBukkitConversion().toMinecraftCompound(((NbtContainer) handle).asNbt()); + } + throw new IllegalArgumentException( + "Expected 'CraftPersistentDataContainer' got '" + handle.getClass().getSimpleName() + " instead'!"); + } + throw new IllegalArgumentException("Unknown WrappedContainer implementation!"); + } + + private BukkitContainer1_16_R1 fromPrimitiveSyntax(NBTTagCompound data) { + VersionControl control = VersionControl.get(); + NbtContainer container = new NbtContainer(control.getDataProvider().getRegistry()); + NbtCompound compound = control.getBukkitConversion().fromMinecraftCompound(data); + container.fromNbt(compound); + return new BukkitContainer1_16_R1(container); + } + + private SyntaxContainer1_16_R1 fromPrimitiveBukkit(CraftPersistentDataTypeRegistry registry, NBTTagCompound data) { + CraftPersistentDataContainer container = new CraftPersistentDataContainer(registry); + container.putAll(data); + return new SyntaxContainer1_16_R1(container); + } + + private WrappedContainer findFinalContainer(WrappedContainer container) { + WrappedContainer output = container; + while (output.getHandle() instanceof WrappedContainer) { + output = (WrappedContainer) output.getHandle(); + } + return output; + } + + public static void unhookAll() { + HOOK.uninjectAll(); + } + + public static void hookEntity() { + HOOK.inject(HOOK.getEntityRegistry()); + } + + public static void hook(CraftPersistentDataTypeRegistry registry) { + HOOK.inject(registry); + } + +} diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/entity/ArmorStand1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/entity/ArmorStand1_16_R1.java new file mode 100644 index 0000000..c99f3bd --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/entity/ArmorStand1_16_R1.java @@ -0,0 +1,24 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1.entity; + +import net.minecraft.server.v1_16_R1.EntityArmorStand; +import net.minecraft.server.v1_16_R1.EntityTypes; +import net.minecraft.server.v1_16_R1.World; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsArmorStand; + +public class ArmorStand1_16_R1 extends EntityLiving1_16_R1 implements NmsArmorStand { + + public ArmorStand1_16_R1(World world) { + super(new EntityArmorStand(EntityTypes.ARMOR_STAND, world)); + } + + @Override + public void setSmall(boolean small) { + handle.setSmall(small); + } + + @Override + public boolean isSmall() { + return handle.isSmall(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/entity/Entity1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/entity/Entity1_16_R1.java new file mode 100644 index 0000000..8a8ba09 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/entity/Entity1_16_R1.java @@ -0,0 +1,215 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1.entity; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.UUID; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.OfflinePlayer; +import org.bukkit.craftbukkit.v1_16_R1.CraftWorld; +import org.bukkit.craftbukkit.v1_16_R1.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_16_R1.util.CraftChatMessage; +import org.bukkit.entity.Player; + +import net.minecraft.server.v1_16_R1.AxisAlignedBB; +import net.minecraft.server.v1_16_R1.Entity; +import net.minecraft.server.v1_16_R1.PacketPlayOutEntityDestroy; +import net.minecraft.server.v1_16_R1.PacketPlayOutEntityMetadata; +import net.minecraft.server.v1_16_R1.PacketPlayOutSpawnEntity; +import net.minecraft.server.v1_16_R1.PlayerConnection; +import net.minecraft.server.v1_16_R1.Vec3D; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.reflection.utils.NmsBoundingBox; + +public abstract class Entity1_16_R1 implements NmsEntity { + + protected final E handle; + + protected final List visible = Collections.synchronizedList(new ArrayList<>()); + + public Entity1_16_R1(E handle) { + this.handle = handle; + } + + @Override + public final E getHandle() { + return handle; + } + + @Override + public int getId() { + return handle.getId(); + } + + @Override + public UUID getUniqueId() { + return handle.getUniqueID(); + } + + @Override + public NmsBoundingBox getBoundingBox() { + AxisAlignedBB box = handle.getBoundingBox(); + return new NmsBoundingBox(box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ); + } + + @Override + public void setCustomName(String name) { + handle.setCustomName(CraftChatMessage.fromStringOrNull(name)); + updateVisibility(); + } + + @Override + public String getCustomName() { + return CraftChatMessage.fromComponent(handle.getCustomName()); + } + + @Override + public void setGravity(boolean gravity) { + handle.setNoGravity(!gravity); + } + + @Override + public boolean hasGravity() { + return !handle.isNoGravity(); + } + + @Override + public void setCustomNameVisible(boolean visible) { + handle.setCustomNameVisible(visible); + } + + @Override + public boolean isCustomNameVisible() { + return handle.getCustomNameVisible(); + } + + @Override + public void setInvisible(boolean invisible) { + handle.setInvisible(invisible); + } + + @Override + public boolean isInvisible() { + return handle.isInvisible(); + } + + @Override + public boolean isInteractable() { + return handle.isInteractable(); + } + + @Override + public boolean isCollidable() { + return handle.isCollidable(); + } + + @Override + public void setInvulnerable(boolean invulnerable) { + handle.setInvulnerable(invulnerable); + } + + @Override + public boolean isInvulnerable() { + return handle.isInvulnerable(); + } + + @Override + public void setLocation(Location location) { + handle.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); + if (location.getWorld() == null || handle.getWorld().getWorld() == location.getWorld()) { + updateVisibility(); + return; + } + handle.world = ((CraftWorld) location.getWorld()).getHandle(); + updateVisibility(); + } + + @Override + public Location getLocation() { + Vec3D vector = handle.getPositionVector(); + return new Location(handle.getWorld().getWorld(), vector.x, vector.y, vector.z); + } + + @Override + public void updateVisibility() { + if (visible.isEmpty()) { + return; + } + Player[] players; + synchronized (visible) { + players = visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) + .toArray(Player[]::new); + } + hide(players); + show(players); + } + + @Override + public boolean isShown(Player player) { + synchronized (visible) { + return visible.contains(player.getUniqueId()); + } + } + + @Override + public void hide(Player... players) { + if (players.length == 0) { + return; + } + PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(handle.getId()); + for (Player player : players) { + if (!isShown(player)) { + continue; + } + ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); + synchronized (visible) { + visible.remove(player.getUniqueId()); + } + } + } + + @Override + public void show(Player... players) { + if (players.length == 0) { + return; + } + PacketPlayOutSpawnEntity packet = new PacketPlayOutSpawnEntity(handle); + PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); + PlayerConnection connection; + for (Player player : players) { + if (isShown(player)) { + continue; + } + connection = ((CraftPlayer) player).getHandle().playerConnection; + connection.sendPacket(packet); + connection.sendPacket(metadataPacket); + synchronized (visible) { + visible.add(player.getUniqueId()); + } + } + } + + @Override + public UUID[] getVisible() { + synchronized (visible) { + return visible.toArray(new UUID[0]); + } + } + + @Override + public Player[] getVisibleAsPlayer() { + synchronized (visible) { + return visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) + .toArray(Player[]::new); + } + } + + @Override + public void kill() { + hide(getVisibleAsPlayer()); + handle.die(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/entity/EntityLiving1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/entity/EntityLiving1_16_R1.java new file mode 100644 index 0000000..f165dee --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/entity/EntityLiving1_16_R1.java @@ -0,0 +1,17 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1.entity; + +import net.minecraft.server.v1_16_R1.EntityLiving; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityLiving; + +public abstract class EntityLiving1_16_R1 extends Entity1_16_R1 implements NmsEntityLiving { + + public EntityLiving1_16_R1(E handle) { + super(handle); + } + + @Override + public void setCollidable(boolean collidable) { + handle.collides = collidable; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/entity/Player1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/entity/Player1_16_R1.java new file mode 100644 index 0000000..9f5634b --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/entity/Player1_16_R1.java @@ -0,0 +1,295 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1.entity; + +import java.util.ArrayList; +import java.util.Collections; + +import org.bukkit.craftbukkit.v1_16_R1.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_16_R1.util.CraftChatMessage; +import org.bukkit.entity.Player; + +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.properties.Property; +import com.mojang.authlib.properties.PropertyMap; +import com.mojang.datafixers.util.Pair; + +import net.minecraft.server.v1_16_R1.BiomeManager; +import net.minecraft.server.v1_16_R1.EntityPlayer; +import net.minecraft.server.v1_16_R1.EnumItemSlot; +import net.minecraft.server.v1_16_R1.IChatBaseComponent; +import net.minecraft.server.v1_16_R1.ItemStack; +import net.minecraft.server.v1_16_R1.MathHelper; +import net.minecraft.server.v1_16_R1.PacketPlayInClientCommand; +import net.minecraft.server.v1_16_R1.PacketPlayInClientCommand.EnumClientCommand; +import net.minecraft.server.v1_16_R1.PacketPlayOutEntityDestroy; +import net.minecraft.server.v1_16_R1.PacketPlayOutEntityEquipment; +import net.minecraft.server.v1_16_R1.PacketPlayOutEntityHeadRotation; +import net.minecraft.server.v1_16_R1.PacketPlayOutEntityMetadata; +import net.minecraft.server.v1_16_R1.PacketPlayOutEntityStatus; +import net.minecraft.server.v1_16_R1.PacketPlayOutHeldItemSlot; +import net.minecraft.server.v1_16_R1.PacketPlayOutNamedEntitySpawn; +import net.minecraft.server.v1_16_R1.PacketPlayOutPlayerInfo; +import net.minecraft.server.v1_16_R1.PacketPlayOutPlayerInfo.EnumPlayerInfoAction; +import net.minecraft.server.v1_16_R1.PacketPlayOutPlayerListHeaderFooter; +import net.minecraft.server.v1_16_R1.PacketPlayOutPosition; +import net.minecraft.server.v1_16_R1.PacketPlayOutRespawn; +import net.minecraft.server.v1_16_R1.PacketPlayOutTitle; +import net.minecraft.server.v1_16_R1.PacketPlayOutTitle.EnumTitleAction; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1.data.SyntaxContainer1_16_R1; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.reflection.data.type.SkinDataType; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; +import net.sourcewriters.minecraft.vcompat.utils.bukkit.Players; +import net.sourcewriters.minecraft.vcompat.utils.minecraft.MojangProfileServer; +import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; +import net.sourcewriters.minecraft.vcompat.utils.thread.PostAsync; +import net.minecraft.server.v1_16_R1.PlayerConnection; +import net.minecraft.server.v1_16_R1.WorldServer; + +public class Player1_16_R1 extends EntityLiving1_16_R1 implements NmsPlayer { + + private String realName; + private Skin realSkin; + + private final WrappedContainer dataAdapter; + + public Player1_16_R1(Player player) { + super(((CraftPlayer) player).getHandle()); + dataAdapter = new SyntaxContainer1_16_R1(getBukkitPlayer().getPersistentDataContainer()); + update(false); + } + + @Override + public CraftPlayer getBukkitPlayer() { + return handle.getBukkitEntity(); + } + + @Override + public WrappedContainer getDataAdapter() { + return dataAdapter; + } + + @Override + public void setSkin(Skin skin) { + if (skin == null) { + return; + } + dataAdapter.set("skin", skin, SkinDataType.WRAPPED_INSTANCE); + } + + @Override + public Skin getSkin() { + return dataAdapter.getOrDefault("skin", SkinDataType.WRAPPED_INSTANCE, realSkin); + } + + @Override + public Skin getRealSkin() { + return realSkin; + } + + @Override + public void setName(String name) { + if (getName().equals(name)) { + return; + } + if (name == null) { + dataAdapter.remove("name"); + return; + } + dataAdapter.set("name", name, WrapType.STRING); + } + + @Override + public String getName() { + return dataAdapter.getOrDefault("name", WrapType.STRING, realName); + } + + @Override + public String getRealName() { + return realName; + } + + @Override + public void setPlayerListHeader(String text) { + setPlayerListHeaderAndFooter(text, getPlayerListFooter()); + } + + @Override + public String getPlayerListHeader() { + return dataAdapter.getOrDefault("header", WrapType.STRING, ""); + } + + @Override + public void setPlayerListFooter(String text) { + setPlayerListHeaderAndFooter(getPlayerListHeader(), text); + } + + @Override + public String getPlayerListFooter() { + return dataAdapter.getOrDefault("footer", WrapType.STRING, ""); + } + + @Override + public int getPing() { + return handle.ping; + } + + @Override + public void setPlayerListHeaderAndFooter(String header, String footer) { + dataAdapter.set("header", header, WrapType.STRING); + dataAdapter.set("footer", footer, WrapType.STRING); + sendPlayerListInfo(header, footer); + } + + private final void sendPlayerListInfo(String header, String footer) { + if (handle.playerConnection.isDisconnected()) { + return; + } + + IChatBaseComponent headerComponent = header.isEmpty() ? null : CraftChatMessage.fromStringOrNull(header, true); + IChatBaseComponent footerComponent = footer.isEmpty() ? null : CraftChatMessage.fromStringOrNull(footer, true); + + PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter(); + + packet.header = headerComponent; + packet.footer = footerComponent; + + handle.playerConnection.sendPacket(packet); + } + + @Override + public void setTitleTimes(int fadeIn, int stay, int fadeOut) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TIMES, null, fadeIn, stay, fadeOut)); + } + + @Override + public void sendSubtitle(String text) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.SUBTITLE, CraftChatMessage.fromStringOrNull(text))); + } + + @Override + public void sendTitle(String text) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TITLE, CraftChatMessage.fromStringOrNull(text))); + } + + @Override + public void sendActionBar(String text) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.ACTIONBAR, CraftChatMessage.fromStringOrNull(text))); + } + + @Override + public void fakeRespawn() { + if (handle.playerConnection.isDisconnected()) { + return; + } + PacketPlayOutPlayerInfo remInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER, handle); + PacketPlayOutPlayerInfo addInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.ADD_PLAYER, handle); + + PacketPlayOutEntityDestroy destroyPacket = new PacketPlayOutEntityDestroy(handle.getId()); + PacketPlayOutNamedEntitySpawn spawnPacket = new PacketPlayOutNamedEntitySpawn(handle); + PacketPlayOutEntityHeadRotation rotationPacket = new PacketPlayOutEntityHeadRotation(handle, + (byte) MathHelper.d(handle.getHeadRotation() * 256F / 360F)); + + ArrayList> list = new ArrayList<>(); + for (EnumItemSlot slot : EnumItemSlot.values()) { + list.add(Pair.of(slot, handle.getEquipment(slot))); + } + PacketPlayOutEntityEquipment equipmentPacket = new PacketPlayOutEntityEquipment(handle.getId(), list); + + Player self = getBukkitPlayer(); + Player[] players = Players.getOnlineWithout(getUniqueId()); + for (Player player : players) { + if (!player.canSee(self)) { + continue; + } + PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection; + connection.sendPacket(remInfoPacket); + connection.sendPacket(addInfoPacket); + connection.sendPacket(destroyPacket); + connection.sendPacket(spawnPacket); + connection.sendPacket(rotationPacket); + connection.sendPacket(equipmentPacket); + } + + WorldServer world = (WorldServer) handle.world; + + PacketPlayOutRespawn respawnPacket = new PacketPlayOutRespawn(world.getTypeKey(), world.getDimensionKey(), + BiomeManager.a(world.getSeed()), handle.playerInteractManager.getGameMode(), handle.playerInteractManager.c(), + world.isDebugWorld(), world.isFlatWorld(), true); + PacketPlayOutPosition positionPacket = new PacketPlayOutPosition(handle.locX(), handle.locY(), handle.locZ(), handle.yaw, + handle.pitch, Collections.emptySet(), 0); + PacketPlayOutHeldItemSlot itemPacket = new PacketPlayOutHeldItemSlot(handle.inventory.itemInHandIndex); + PacketPlayOutEntityStatus statusPacket = new PacketPlayOutEntityStatus(handle, (byte) 28); + PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); + + PlayerConnection connection = handle.playerConnection; + connection.sendPacket(remInfoPacket); + connection.sendPacket(addInfoPacket); + connection.sendPacket(respawnPacket); + connection.sendPacket(positionPacket); + connection.sendPacket(itemPacket); + connection.sendPacket(statusPacket); + connection.sendPacket(metadataPacket); + + handle.updateAbilities(); + handle.triggerHealthUpdate(); + handle.updateInventory(handle.defaultContainer); + if (handle.activeContainer != handle.defaultContainer) { + handle.updateInventory(handle.activeContainer); + } + self.recalculatePermissions(); + } + + @Override + public void respawn() { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayInClientCommand(EnumClientCommand.PERFORM_RESPAWN)); + } + + @Override + public void update() { + update(true); + } + + private final void update(boolean flag) { + PostAsync.forcePost(() -> { + realName = MojangProfileServer.getName(getUniqueId()); + realSkin = MojangProfileServer.getSkin(realName, getUniqueId()); + }); + if (flag) { + GameProfile profile = handle.getProfile(); + + Skin skin = getSkin(); + if (skin != null) { + PropertyMap properties = profile.getProperties(); + properties.removeAll("textures"); + properties.put("textures", new Property("textures", skin.getValue(), skin.getSignature())); + } + + String name = getName(); + if (name != null) { + ReflectionProvider.DEFAULT.getReflect("mjGameProfile").setFieldValue(profile, "name", name); + } + + if (!(name == null && skin == null)) { + fakeRespawn(); + } + } + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/tools/BlockTools1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/tools/BlockTools1_16_R1.java new file mode 100644 index 0000000..21312ca --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/tools/BlockTools1_16_R1.java @@ -0,0 +1,39 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1.tools; + +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_16_R1.block.CraftSkull; + +import com.mojang.authlib.properties.Property; +import com.mojang.authlib.properties.PropertyMap; +import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; +import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.minecraft.server.v1_16_R1.TileEntitySkull; +import net.sourcewriters.minecraft.vcompat.reflection.tools.BlockTools; +import net.sourcewriters.minecraft.vcompat.utils.constants.MinecraftConstants; + +public class BlockTools1_16_R1 extends BlockTools { + + private final AbstractReflect craftEntityStateRef = new Reflect(CraftSkull.class).searchField("tileEntity", "tileEntity"); + + @Override + public void setHeadTexture(Block block, String texture) { + if (!(block instanceof CraftSkull)) { + return; + } + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + PropertyMap map = entitySkull.gameProfile.getProperties(); + map.removeAll("textures"); + map.put("textures", new Property("textures", MinecraftConstants.TEXTURE_SIGNATURE, texture)); + } + + @Override + public String getHeadTexture(Block block) { + if (!(block instanceof CraftSkull)) { + return null; + } + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + return entitySkull.gameProfile.getProperties().get("textures").iterator().next().getValue(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/tools/ServerTools1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/tools/ServerTools1_16_R1.java new file mode 100644 index 0000000..b6310b4 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/tools/ServerTools1_16_R1.java @@ -0,0 +1,27 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1.tools; + +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_16_R1.CraftServer; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1.wrapper.ConsoleReaderWrapper1_16_R1; +import net.sourcewriters.minecraft.vcompat.reflection.tools.ServerTools; + +public class ServerTools1_16_R1 extends ServerTools { + + @Override + public void setMotd(String text) { + ((CraftServer) Bukkit.getServer()).getServer().setMotd(text); + } + + @Override + public String getMotd() { + return ((CraftServer) Bukkit.getServer()).getServer().getMotd(); + } + + @SuppressWarnings("resource") + @Override + public ConsoleReaderWrapper1_16_R1 getConsole() { + return ConsoleReaderWrapper1_16_R1.INSTANCE; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/tools/SkinTools1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/tools/SkinTools1_16_R1.java new file mode 100644 index 0000000..6806a72 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/tools/SkinTools1_16_R1.java @@ -0,0 +1,16 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1.tools; + +import org.bukkit.craftbukkit.v1_16_R1.entity.CraftPlayer; +import org.bukkit.entity.Player; + +import net.sourcewriters.minecraft.vcompat.reflection.tools.SkinTools; +import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; + +public class SkinTools1_16_R1 extends SkinTools { + + @Override + public Skin skinFromPlayer(Player player) { + return skinFromGameProfile(((CraftPlayer) player).getHandle().getProfile()); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/utils/EntityConstructors1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/utils/EntityConstructors1_16_R1.java new file mode 100644 index 0000000..b9ebf41 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/utils/EntityConstructors1_16_R1.java @@ -0,0 +1,12 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1.utils; + +import java.util.function.Function; + +import net.minecraft.server.v1_16_R1.World; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1.entity.ArmorStand1_16_R1; + +public abstract class EntityConstructors1_16_R1 { + + public static final Function ARMOR_STAND = (world -> new ArmorStand1_16_R1(world)); + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/wrapper/ConsoleReaderWrapper1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/wrapper/ConsoleReaderWrapper1_16_R1.java new file mode 100644 index 0000000..f094d6f --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/wrapper/ConsoleReaderWrapper1_16_R1.java @@ -0,0 +1,43 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1.wrapper; + +import java.io.IOException; +import java.io.Writer; + +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_16_R1.CraftServer; +import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; + +import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; + +public final class ConsoleReaderWrapper1_16_R1 extends ConsoleReaderWrapper { + + public static final ConsoleReaderWrapper1_16_R1 INSTANCE = new ConsoleReaderWrapper1_16_R1(); + + private final ConsoleReader reader; + + @SuppressWarnings("resource") + private ConsoleReaderWrapper1_16_R1() { + this.reader = ((CraftServer) Bukkit.getServer()).getServer().reader; + } + + @Override + public Writer getOutput() { + return reader.getOutput(); + } + + @Override + public boolean isAnsiSupported() { + return reader.getTerminal().isAnsiSupported(); + } + + @Override + public void flush() throws IOException { + reader.flush(); + } + + @Override + public void drawLine() throws IOException { + reader.drawLine(); + } + +} diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/BukkitConversion1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/BukkitConversion1_16_R2.java new file mode 100644 index 0000000..da31b66 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/BukkitConversion1_16_R2.java @@ -0,0 +1,218 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R2; + +import java.util.Set; + +import org.bukkit.craftbukkit.v1_16_R2.inventory.CraftItemStack; +import org.bukkit.entity.EntityType; + +import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; +import com.syntaxphoenix.syntaxapi.data.DataType; +import com.syntaxphoenix.syntaxapi.nbt.NbtByte; +import com.syntaxphoenix.syntaxapi.nbt.NbtByteArray; +import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; +import com.syntaxphoenix.syntaxapi.nbt.NbtDouble; +import com.syntaxphoenix.syntaxapi.nbt.NbtEnd; +import com.syntaxphoenix.syntaxapi.nbt.NbtFloat; +import com.syntaxphoenix.syntaxapi.nbt.NbtInt; +import com.syntaxphoenix.syntaxapi.nbt.NbtIntArray; +import com.syntaxphoenix.syntaxapi.nbt.NbtList; +import com.syntaxphoenix.syntaxapi.nbt.NbtLong; +import com.syntaxphoenix.syntaxapi.nbt.NbtLongArray; +import com.syntaxphoenix.syntaxapi.nbt.NbtShort; +import com.syntaxphoenix.syntaxapi.nbt.NbtString; +import com.syntaxphoenix.syntaxapi.nbt.NbtTag; +import com.syntaxphoenix.syntaxapi.nbt.NbtType; + +import net.minecraft.server.v1_16_R2.ItemStack; +import net.minecraft.server.v1_16_R2.NBTBase; +import net.minecraft.server.v1_16_R2.NBTNumber; +import net.minecraft.server.v1_16_R2.NBTTagByte; +import net.minecraft.server.v1_16_R2.NBTTagByteArray; +import net.minecraft.server.v1_16_R2.NBTTagCompound; +import net.minecraft.server.v1_16_R2.NBTTagDouble; +import net.minecraft.server.v1_16_R2.NBTTagEnd; +import net.minecraft.server.v1_16_R2.NBTTagFloat; +import net.minecraft.server.v1_16_R2.NBTTagInt; +import net.minecraft.server.v1_16_R2.NBTTagIntArray; +import net.minecraft.server.v1_16_R2.NBTTagList; +import net.minecraft.server.v1_16_R2.NBTTagLong; +import net.minecraft.server.v1_16_R2.NBTTagLongArray; +import net.minecraft.server.v1_16_R2.NBTTagShort; +import net.minecraft.server.v1_16_R2.NBTTagString; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R2.data.BukkitContext1_16_R2; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R2.data.BukkitType1_16_R2; +import net.sourcewriters.minecraft.vcompat.reflection.BukkitConversion; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; + +public class BukkitConversion1_16_R2 extends BukkitConversion { + + protected BukkitConversion1_16_R2(VersionControl1_16_R2 versionControl) { + super(versionControl); + } + + @Override + public EntityType toEntityType(NmsEntityType type) { + try { + return EntityType.valueOf(type.name()); + } catch (IllegalArgumentException ignore) { + return null; + } + } + + @Override + public NmsEntityType fromEntityType(EntityType type) { + try { + return NmsEntityType.valueOf(type.name()); + } catch (IllegalArgumentException ignore) { + return null; + } + } + + @Override + public NBTBase toMinecraftTag(NbtTag tag) { + switch (tag.getType()) { + case BYTE: + return NBTTagByte.a((byte) tag.getValue()); + case SHORT: + return NBTTagShort.a((short) tag.getValue()); + case INT: + return NBTTagInt.a((int) tag.getValue()); + case LONG: + return NBTTagLong.a((long) tag.getValue()); + case FLOAT: + return NBTTagFloat.a((float) tag.getValue()); + case DOUBLE: + return NBTTagDouble.a((double) tag.getValue()); + case STRING: + return NBTTagString.a((String) tag.getValue()); + case BYTE_ARRAY: + return new NBTTagByteArray((byte[]) tag.getValue()); + case INT_ARRAY: + return new NBTTagIntArray((int[]) tag.getValue()); + case LONG_ARRAY: + return new NBTTagLongArray((long[]) tag.getValue()); + case LIST: + return toMinecraftList((NbtList) tag); + case COMPOUND: + return toMinecraftCompound((NbtCompound) tag); + case END: + return NBTTagEnd.b; + default: + return null; + } + } + + @Override + public NbtTag fromMinecraftTag(Object raw) { + if (!(raw instanceof NBTBase)) { + return null; + } + NBTBase tag = (NBTBase) raw; + NbtType type = NbtType.getById(tag.getTypeId()); + switch (type) { + case BYTE: + return new NbtByte(((NBTNumber) tag).asByte()); + case SHORT: + return new NbtShort(((NBTNumber) tag).asShort()); + case INT: + return new NbtInt(((NBTNumber) tag).asInt()); + case LONG: + return new NbtLong(((NBTNumber) tag).asLong()); + case FLOAT: + return new NbtFloat(((NBTNumber) tag).asFloat()); + case DOUBLE: + return new NbtDouble(((NBTNumber) tag).asDouble()); + case STRING: + return new NbtString(((NBTTagString) tag).asString()); + case BYTE_ARRAY: + return new NbtByteArray(((NBTTagByteArray) tag).getBytes()); + case INT_ARRAY: + return new NbtIntArray(((NBTTagIntArray) tag).getInts()); + case LONG_ARRAY: + return new NbtLongArray(((NBTTagLongArray) tag).getLongs()); + case LIST: + return fromMinecraftList(tag); + case COMPOUND: + return fromMinecraftCompound(tag); + case END: + return NbtEnd.INSTANCE; + default: + return null; + } + } + + @Override + public NBTTagList toMinecraftList(NbtList list) { + NBTTagList output = new NBTTagList(); + for (NbtTag tag : list) { + output.add(toMinecraftTag(tag)); + } + return output; + } + + @Override + public NbtList fromMinecraftList(Object raw) { + if (!(raw instanceof NBTTagList)) { + return null; + } + NBTTagList list = (NBTTagList) raw; + NbtList output = new NbtList<>(NbtType.getById(list.getTypeId())); + for (NBTBase base : list) { + output.add(fromMinecraftTag(base)); + } + return output; + } + + @Override + public NBTTagCompound toMinecraftCompound(NbtCompound compound) { + NBTTagCompound output = new NBTTagCompound(); + if (compound.isEmpty()) { + return output; + } + Set keys = compound.getKeys(); + for (String key : keys) { + output.set(key, toMinecraftTag(compound.get(key))); + } + return output; + } + + @Override + public NbtCompound fromMinecraftCompound(Object raw) { + if (!(raw instanceof NBTTagCompound)) { + return null; + } + NBTTagCompound compound = (NBTTagCompound) raw; + NbtCompound output = new NbtCompound(); + if (compound.isEmpty()) { + return output; + } + Set keys = compound.getKeys(); + for (String key : keys) { + output.set(key, fromMinecraftTag(compound.get(key))); + } + return output; + } + + @Override + public org.bukkit.inventory.ItemStack itemFromCompound(NbtCompound compound) { + return CraftItemStack.asBukkitCopy(ItemStack.a(toMinecraftCompound(compound))); + } + + @Override + public NbtCompound itemToCompound(org.bukkit.inventory.ItemStack itemStack) { + return fromMinecraftCompound(CraftItemStack.asNMSCopy(itemStack).getOrCreateTag()); + } + + @Override + public WrappedContext createContext(DataAdapterContext context) { + return new BukkitContext1_16_R2(context); + } + + @Override + public WrapType wrap(DataType dataType) { + return new BukkitType1_16_R2<>(dataType); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/EntityProvider1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/EntityProvider1_16_R2.java new file mode 100644 index 0000000..63cc90d --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/EntityProvider1_16_R2.java @@ -0,0 +1,47 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R2; + +import java.util.EnumMap; +import java.util.function.Function; + +import org.bukkit.craftbukkit.v1_16_R2.CraftWorld; + +import net.minecraft.server.v1_16_R2.World; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R2.utils.EntityConstructors1_16_R2; +import net.sourcewriters.minecraft.vcompat.reflection.EntityProvider; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; + +public class EntityProvider1_16_R2 extends EntityProvider { + + private final EnumMap> entityMap = new EnumMap<>(NmsEntityType.class); + + protected EntityProvider1_16_R2(VersionControl1_16_R2 versionControl) { + super(versionControl); + } + + @SuppressWarnings("unchecked") + private final Function searchConstructor(NmsEntityType type) { + try { + return (Function) EntityConstructors1_16_R2.class.getField(type.name()).get(null); + } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException ignore) { + return null; + } + } + + private final Function getConstructor(NmsEntityType type) { + return entityMap.computeIfAbsent(type, (key -> searchConstructor(key))); + } + + @Override + public NmsEntity createEntity(org.bukkit.World world, NmsEntityType type) { + if (!(world instanceof CraftWorld)) { + return null; + } + Function function; + if ((function = getConstructor(type)) == null) { + return null; + } + return function.apply(((CraftWorld) world).getHandle()); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/PacketHandler1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/PacketHandler1_16_R2.java new file mode 100644 index 0000000..f4b391b --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/PacketHandler1_16_R2.java @@ -0,0 +1,11 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R2; + +import net.sourcewriters.minecraft.vcompat.reflection.PacketHandler; + +public class PacketHandler1_16_R2 extends PacketHandler { + + protected PacketHandler1_16_R2(VersionControl1_16_R2 versionControl) { + super(versionControl); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/PlayerProvider1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/PlayerProvider1_16_R2.java new file mode 100644 index 0000000..79f4b7f --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/PlayerProvider1_16_R2.java @@ -0,0 +1,20 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R2; + +import org.bukkit.entity.Player; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R2.entity.Player1_16_R2; +import net.sourcewriters.minecraft.vcompat.reflection.PlayerProvider; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; + +public class PlayerProvider1_16_R2 extends PlayerProvider { + + protected PlayerProvider1_16_R2(VersionControl1_16_R2 versionControl) { + super(versionControl); + } + + @Override + protected NmsPlayer createPlayer(Player player) { + return new Player1_16_R2(player); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/TextureProvider1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/TextureProvider1_16_R2.java new file mode 100644 index 0000000..582110d --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/TextureProvider1_16_R2.java @@ -0,0 +1,102 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R2; + +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_16_R2.block.CraftBlockEntityState; +import org.bukkit.craftbukkit.v1_16_R2.block.CraftSkull; +import org.bukkit.craftbukkit.v1_16_R2.inventory.CraftItemStack; +import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.inventory.meta.SkullMeta; + +import com.mojang.authlib.GameProfile; +import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; +import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.minecraft.server.v1_16_R2.GameProfileSerializer; +import net.minecraft.server.v1_16_R2.ItemStack; +import net.minecraft.server.v1_16_R2.NBTTagCompound; +import net.minecraft.server.v1_16_R2.TileEntitySkull; +import net.sourcewriters.minecraft.vcompat.reflection.TextureProvider; + +public class TextureProvider1_16_R2 extends TextureProvider { + + private final AbstractReflect craftEntityStateRef = new Reflect(CraftBlockEntityState.class).searchField("tileEntity", "tileEntity"); + private final AbstractReflect craftItemStackRef = new Reflect(CraftItemStack.class).searchField("handle", "handle"); + private final AbstractReflect craftMetaSkullRef = new Reflect("org.bukkit.craftbukkit.v1_16_R2.inventory.CraftMetaSkull") + .searchField("serialized", "serializedProfile").searchField("profile", "profile"); + + protected TextureProvider1_16_R2(VersionControl1_16_R2 versionControl) { + super(versionControl); + } + + @Override + public GameProfile profileFromBlock(Block block) { + if (!(block instanceof CraftSkull)) { + return null; + } + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + return entitySkull.gameProfile; + } + + @Override + public GameProfile profileFromItem(org.bukkit.inventory.ItemStack itemStack) { + if (!(itemStack.getItemMeta() instanceof SkullMeta)) { + return null; + } + SkullMeta meta = (SkullMeta) itemStack.getItemMeta(); + GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue("profile", meta); + if (profile == null) { + NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue("serialized", meta); + if (compound == null) { + ItemStack stack = null; + if (itemStack instanceof CraftItemStack) { + stack = (ItemStack) craftItemStackRef.getFieldValue("handle", itemStack); + } + if (stack == null) { + stack = CraftItemStack.asNMSCopy(itemStack); + } + NBTTagCompound stackTag = stack.getOrCreateTag(); + if (stackTag.hasKeyOfType("SkullOwner", 10)) { + compound = stackTag.getCompound("SkullOwner"); + } else if (stackTag.hasKeyOfType("SkullProfile", 10)) { + compound = stackTag.getCompound("SkullProfile"); + } + } + if (compound == null) { + return null; + } + profile = GameProfileSerializer.deserialize(compound); + } + return profile; + } + + @Override + public org.bukkit.inventory.ItemStack getItem(GameProfile profile) { + org.bukkit.inventory.ItemStack craftStack = CraftItemStack.asCraftCopy(new org.bukkit.inventory.ItemStack(Material.PLAYER_HEAD)); + applyItem(craftStack, profile); + return craftStack; + } + + @Override + public boolean applyItem(org.bukkit.inventory.ItemStack itemStack, GameProfile profile) { + ItemMeta meta = itemStack.getItemMeta(); + if (!(meta instanceof SkullMeta)) { + return false; + } + SkullMeta skullMeta = (SkullMeta) meta; + craftMetaSkullRef.setFieldValue(meta, "profile", profile); + itemStack.setItemMeta(skullMeta); + return true; + } + + @Override + public boolean applyBlock(Block block, GameProfile profile) { + if (!(block instanceof CraftSkull)) { + return false; + } + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + entitySkull.setGameProfile(profile); + return true; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/ToolProvider1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/ToolProvider1_16_R2.java new file mode 100644 index 0000000..7aa7f00 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/ToolProvider1_16_R2.java @@ -0,0 +1,33 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R2; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R2.tools.BlockTools1_16_R2; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R2.tools.ServerTools1_16_R2; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R2.tools.SkinTools1_16_R2; +import net.sourcewriters.minecraft.vcompat.reflection.ToolProvider; + +public class ToolProvider1_16_R2 extends ToolProvider { + + private final BlockTools1_16_R2 blockTools = new BlockTools1_16_R2(); + private final SkinTools1_16_R2 skinTools = new SkinTools1_16_R2(); + private final ServerTools1_16_R2 serverTools = new ServerTools1_16_R2(); + + protected ToolProvider1_16_R2(VersionControl1_16_R2 versionControl) { + super(versionControl); + } + + @Override + public SkinTools1_16_R2 getSkinTools() { + return skinTools; + } + + @Override + public ServerTools1_16_R2 getServerTools() { + return serverTools; + } + + @Override + public BlockTools1_16_R2 getBlockTools() { + return blockTools; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/VersionControl1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/VersionControl1_16_R2.java new file mode 100644 index 0000000..743a183 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/VersionControl1_16_R2.java @@ -0,0 +1,61 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R2; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R2.data.hook.BukkitContainerAdapterHook1_16_R2; +import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; + +public class VersionControl1_16_R2 extends VersionControl { + + public static VersionControl1_16_R2 INSTANCE; + + public static VersionControl1_16_R2 init() { + return INSTANCE != null ? INSTANCE : (INSTANCE = new VersionControl1_16_R2()); + } + + private final ToolProvider1_16_R2 toolProvider = new ToolProvider1_16_R2(this); + private final TextureProvider1_16_R2 textureProvider = new TextureProvider1_16_R2(this); + private final PacketHandler1_16_R2 packetHandler = new PacketHandler1_16_R2(this); + private final EntityProvider1_16_R2 entityProvider = new EntityProvider1_16_R2(this); + private final PlayerProvider1_16_R2 playerProvider = new PlayerProvider1_16_R2(this); + private final BukkitConversion1_16_R2 bukkitConversion = new BukkitConversion1_16_R2(this); + + private VersionControl1_16_R2() { + BukkitContainerAdapterHook1_16_R2.hookEntity(); + } + + @Override + public ToolProvider1_16_R2 getToolProvider() { + return toolProvider; + } + + @Override + public EntityProvider1_16_R2 getEntityProvider() { + return entityProvider; + } + + @Override + public PlayerProvider1_16_R2 getPlayerProvider() { + return playerProvider; + } + + @Override + public TextureProvider1_16_R2 getTextureProvider() { + return textureProvider; + } + + @Override + public PacketHandler1_16_R2 getPacketHandler() { + return packetHandler; + } + + @Override + public BukkitConversion1_16_R2 getBukkitConversion() { + return bukkitConversion; + } + + @Override + public void shutdown() { + dataProvider.getDefaultDistributor().shutdown(); + BukkitContainerAdapterHook1_16_R2.unhookAll(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/BukkitContainer1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/BukkitContainer1_16_R2.java new file mode 100644 index 0000000..ffda4e9 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/BukkitContainer1_16_R2.java @@ -0,0 +1,161 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R2.data; + +import java.util.Arrays; +import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; + +import org.bukkit.NamespacedKey; +import org.bukkit.persistence.PersistentDataAdapterContext; +import org.bukkit.persistence.PersistentDataContainer; +import org.bukkit.persistence.PersistentDataType; + +import com.syntaxphoenix.syntaxapi.data.IDataContainer; + +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; +import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SyntaxKey; + +public final class BukkitContainer1_16_R2 extends WrappedContainer implements PersistentDataContainer { + + private final IDataContainer container; + + public BukkitContainer1_16_R2(IDataContainer container) { + this.container = container; + } + + @Override + public IDataContainer getHandle() { + return container; + } + + @Override + public IDataContainer getAsSyntaxContainer() { + return container; + } + + /* + * + */ + + @Override + public boolean has(NamespacedKey key, PersistentDataType type) { + return has(new BukkitKey1_16_R2(key), WrappedType1_16_R2.wrap(type)); + } + + @Override + public Z get(NamespacedKey key, PersistentDataType type) { + return get(new BukkitKey1_16_R2(key), WrappedType1_16_R2.wrap(type)); + } + + @Override + public Z getOrDefault(NamespacedKey key, PersistentDataType type, Z value) { + return Optional.ofNullable(get(key, type)).orElse(value); + } + + @Override + public void set(NamespacedKey key, PersistentDataType type, Z value) { + set(new BukkitKey1_16_R2(key), value, WrappedType1_16_R2.wrap(type)); + } + + @Override + public void remove(NamespacedKey key) { + remove(new BukkitKey1_16_R2(key)); + } + + @Override + public Set getKeys() { + return Arrays.stream(container.getKeys()).map(SyntaxKey::new).map(BukkitKey1_16_R2::asBukkit).collect(Collectors.toSet()); + } + + @Override + public PersistentDataAdapterContext getAdapterContext() { + return getContext(); + } + + /* + * + */ + + @Override + public BukkitContext1_16_R2 getContext() { + return new BukkitContext1_16_R2(container.getAdapterContext()); + } + + @Override + public boolean has(String key) { + return has(wrappedKey(key)); + } + + @Override + public boolean has(WrappedKey key) { + return container.has(key.getNamespacedKey()); + } + + @Override + public boolean has(String key, WrapType type) { + return has(wrappedKey(key), type); + } + + @Override + public boolean has(WrappedKey key, WrapType type) { + return container.has(key.getNamespacedKey(), type.syntaxType()); + } + + @Override + public Object get(String key) { + return get(wrappedKey(key)); + } + + @Override + public Object get(WrappedKey key) { + return container.get(key.getNamespacedKey()); + } + + @Override + public C get(String key, WrapType type) { + return get(wrappedKey(key), type); + } + + @Override + public C get(WrappedKey key, WrapType type) { + return container.get(key.getNamespacedKey(), type.syntaxType()); + } + + @Override + public void set(String key, B value, WrapType type) { + set(wrappedKey(key), value, type); + } + + @Override + public void set(WrappedKey key, B value, WrapType type) { + container.set(key.getNamespacedKey(), value, type.syntaxType()); + } + + @Override + public boolean remove(String key) { + return false; + } + + @Override + public boolean remove(WrappedKey key) { + return container.remove(key.getNamespacedKey()); + } + + @Override + public Set keySet() { + return container.getKeyspaces(); + } + + @Override + public boolean isEmpty() { + return container.isEmpty(); + } + + @Override + public int size() { + return container.size(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/BukkitContext1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/BukkitContext1_16_R2.java new file mode 100644 index 0000000..323f1f8 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/BukkitContext1_16_R2.java @@ -0,0 +1,39 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R2.data; + +import org.bukkit.persistence.PersistentDataAdapterContext; +import org.bukkit.persistence.PersistentDataContainer; + +import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; +import com.syntaxphoenix.syntaxapi.data.IDataContainer; + +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; + +public final class BukkitContext1_16_R2 extends WrappedContext implements PersistentDataAdapterContext { + + private final DataAdapterContext context; + + public BukkitContext1_16_R2(DataAdapterContext context) { + this.context = context; + } + + @Override + public DataAdapterContext getHandle() { + return context; + } + + @Override + public PersistentDataContainer newPersistentDataContainer() { + return newContainer(); + } + + @Override + public IDataContainer newDataContainer() { + return context.newDataContainer(); + } + + @Override + public BukkitContainer1_16_R2 newContainer() { + return new BukkitContainer1_16_R2(context.newDataContainer()); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/BukkitKey1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/BukkitKey1_16_R2.java new file mode 100644 index 0000000..806f2ce --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/BukkitKey1_16_R2.java @@ -0,0 +1,52 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R2.data; + +import org.bukkit.NamespacedKey; +import org.bukkit.plugin.Plugin; + +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; + +public final class BukkitKey1_16_R2 extends WrappedKey { + + private final NamespacedKey key; + + public BukkitKey1_16_R2(Plugin plugin, String key) { + this.key = new NamespacedKey(plugin, key); + } + + @SuppressWarnings("deprecation") + public BukkitKey1_16_R2(String name, String key) { + this.key = new NamespacedKey(name, key); + } + + public BukkitKey1_16_R2(NamespacedKey key) { + this.key = key; + } + + @Override + public NamespacedKey getHandle() { + return key; + } + + @Override + public String getName() { + return key.getNamespace(); + } + + @Override + public String getKey() { + return key.getKey(); + } + + @Override + public String toString() { + return key.toString(); + } + + public static NamespacedKey asBukkit(WrappedKey key) { + if (key.getHandle() instanceof NamespacedKey) { + return (NamespacedKey) key.getHandle(); + } + return new BukkitKey1_16_R2(key.getName(), key.getKey()).getHandle(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/BukkitType1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/BukkitType1_16_R2.java new file mode 100644 index 0000000..7700ff7 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/BukkitType1_16_R2.java @@ -0,0 +1,69 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R2.data; + +import org.bukkit.persistence.PersistentDataAdapterContext; +import org.bukkit.persistence.PersistentDataType; + +import com.syntaxphoenix.syntaxapi.data.DataType; + +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; + +public class BukkitType1_16_R2 extends WrappedType1_16_R2, P0, P1, C0, C1> + implements PersistentDataType { + + private final DataType type; + + public BukkitType1_16_R2(DataType type) { + super(type.getPrimitive(), type.getComplex()); + this.type = type; + } + + @Override + public DataType getHandle() { + return type; + } + + @Override + public Class getPrimitiveOriginal() { + return type.getPrimitive(); + } + + @Override + public Class getComplexOriginal() { + return type.getComplex(); + } + + /* + * + */ + + @Override + public Class getComplexType() { + return complexType; + } + + @Override + public Class getPrimitiveType() { + return primitiveType; + } + + @Override + public P0 toPrimitive(C0 complex, PersistentDataAdapterContext context) { + return wrapToPrimitive(complex, new SyntaxContext1_16_R2(context)); + } + + @Override + public C0 fromPrimitive(P0 primitive, PersistentDataAdapterContext context) { + return wrapToComplex(primitive, new SyntaxContext1_16_R2(context)); + } + + @Override + public P0 wrapToPrimitive(C0 complex, WrappedContext context) { + return toPrimitiveWrapped(type.toPrimitive(context, toComplexOriginal(complex))); + } + + @Override + public C0 wrapToComplex(P0 primitive, WrappedContext context) { + return toComplexWrapped(type.fromPrimitive(context, toPrimitiveOriginal(primitive))); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/SimpleBukkitType1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/SimpleBukkitType1_16_R2.java new file mode 100644 index 0000000..3baafb0 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/SimpleBukkitType1_16_R2.java @@ -0,0 +1,36 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R2.data; + +import org.bukkit.persistence.PersistentDataAdapterContext; +import org.bukkit.persistence.PersistentDataType; + +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; + +public class SimpleBukkitType1_16_R2 implements PersistentDataType { + + private final WrapType type; + + public SimpleBukkitType1_16_R2(WrapType type) { + this.type = type; + } + + @Override + public Class getComplexType() { + return type.getComplexWrapped(); + } + + @Override + public Class

getPrimitiveType() { + return type.getPrimitiveWrapped(); + } + + @Override + public P toPrimitive(C complex, PersistentDataAdapterContext context) { + return type.wrapToPrimitive(complex, new SyntaxContext1_16_R2(context)); + } + + @Override + public C fromPrimitive(P primitive, PersistentDataAdapterContext context) { + return type.wrapToComplex(primitive, new SyntaxContext1_16_R2(context)); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/SyntaxContainer1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/SyntaxContainer1_16_R2.java new file mode 100644 index 0000000..75ce56b --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/SyntaxContainer1_16_R2.java @@ -0,0 +1,185 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R2.data; + +import java.util.Set; +import java.util.stream.Collectors; + +import org.bukkit.persistence.PersistentDataContainer; + +import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; +import com.syntaxphoenix.syntaxapi.data.DataType; +import com.syntaxphoenix.syntaxapi.data.IDataContainer; +import com.syntaxphoenix.syntaxapi.utils.key.IKey; + +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; +import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SyntaxKey; + +public final class SyntaxContainer1_16_R2 extends WrappedContainer implements IDataContainer { + + private final PersistentDataContainer container; + + public SyntaxContainer1_16_R2(PersistentDataContainer container) { + this.container = container; + } + + @Override + public PersistentDataContainer getHandle() { + return container; + } + + @Override + public IDataContainer getAsSyntaxContainer() { + return new SyntaxContainer1_16_R2(container); + } + + /* + * + */ + + @Override + public boolean has(IKey key) { + throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); + } + + @Override + public boolean has(String key, DataType type) { + return has(syntaxKey(key), type); + } + + @Override + public boolean has(IKey key, DataType type) { + return has(new SyntaxKey(key), WrappedType1_16_R2.wrap(type)); + } + + @Override + public C get(String key, DataType type) { + return get(syntaxKey(key), type); + } + + @Override + public C get(IKey key, DataType type) { + return get(new SyntaxKey(key), WrappedType1_16_R2.wrap(type)); + } + + @Override + public Object get(String key) { + throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); + } + + @Override + public Object get(IKey key) { + throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); + } + + @Override + public void set(String key, E value, DataType type) { + set(wrappedKey(key), value, WrappedType1_16_R2.wrap(type)); + } + + @Override + public void set(IKey key, E value, DataType type) { + set(new SyntaxKey(key), value, WrappedType1_16_R2.wrap(type)); + } + + @Override + public boolean remove(String key) { + return remove(wrappedKey(key)); + } + + @Override + public boolean remove(IKey key) { + return remove(new SyntaxKey(key)); + } + + @Override + public IKey[] getKeys() { + return container.getKeys().stream().map(BukkitKey1_16_R2::new).map(WrappedKey::getNamespacedKey).toArray(IKey[]::new); + } + + @Override + public Set getKeyspaces() { + return container.getKeys().stream().map(org.bukkit.NamespacedKey::toString).collect(Collectors.toSet()); + } + + @Override + public DataAdapterContext getAdapterContext() { + return getContext(); + } + + /* + * + */ + + @Override + public SyntaxContext1_16_R2 getContext() { + return new SyntaxContext1_16_R2(container.getAdapterContext()); + } + + @Override + public boolean has(String key) { + throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); + } + + @Override + public boolean has(WrappedKey key) { + throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); + } + + @Override + public boolean has(String key, WrapType type) { + return has(wrappedKey(key), type); + } + + @Override + public boolean has(WrappedKey key, WrapType type) { + return container.has(BukkitKey1_16_R2.asBukkit(key), new SimpleBukkitType1_16_R2<>(type)); + } + + @Override + public Object get(WrappedKey key) { + throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); + } + + @Override + public C get(String key, WrapType type) { + return get(wrappedKey(key), type); + } + + @Override + public C get(WrappedKey key, WrapType type) { + return container.get(BukkitKey1_16_R2.asBukkit(key), new SimpleBukkitType1_16_R2<>(type)); + } + + @Override + public void set(String key, B value, WrapType type) { + set(wrappedKey(key), value, type); + } + + @Override + public void set(WrappedKey key, B value, WrapType type) { + container.set(BukkitKey1_16_R2.asBukkit(key), new SimpleBukkitType1_16_R2<>(type), value); + } + + @Override + public boolean remove(WrappedKey key) { + container.remove(BukkitKey1_16_R2.asBukkit(key)); + return true; // Will always return true as we don't know if it contained it + } + + @Override + public Set keySet() { + return getKeyspaces(); + } + + @Override + public boolean isEmpty() { + return container.isEmpty(); + } + + @Override + public int size() { + return container.getKeys().size(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/SyntaxContext1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/SyntaxContext1_16_R2.java new file mode 100644 index 0000000..3bfc64d --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/SyntaxContext1_16_R2.java @@ -0,0 +1,38 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R2.data; + +import org.bukkit.persistence.PersistentDataAdapterContext; +import org.bukkit.persistence.PersistentDataContainer; + +import com.syntaxphoenix.syntaxapi.data.IDataContainer; + +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; + +public final class SyntaxContext1_16_R2 extends WrappedContext implements PersistentDataAdapterContext { + + private final PersistentDataAdapterContext context; + + public SyntaxContext1_16_R2(PersistentDataAdapterContext context) { + this.context = context; + } + + @Override + public PersistentDataAdapterContext getHandle() { + return context; + } + + @Override + public PersistentDataContainer newPersistentDataContainer() { + return context.newPersistentDataContainer(); + } + + @Override + public IDataContainer newDataContainer() { + return newContainer(); + } + + @Override + public SyntaxContainer1_16_R2 newContainer() { + return new SyntaxContainer1_16_R2(context.newPersistentDataContainer()); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/SyntaxType1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/SyntaxType1_16_R2.java new file mode 100644 index 0000000..0bb9d44 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/SyntaxType1_16_R2.java @@ -0,0 +1,76 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R2.data; + +import org.bukkit.persistence.PersistentDataAdapterContext; +import org.bukkit.persistence.PersistentDataType; + +import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; +import com.syntaxphoenix.syntaxapi.data.DataType; + +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; + +public class SyntaxType1_16_R2 extends WrappedType1_16_R2, P0, P1, C0, C1> + implements DataType { + + private final PersistentDataType type; + + public SyntaxType1_16_R2(PersistentDataType type) { + super(type.getPrimitiveType(), type.getComplexType()); + this.type = type; + } + + @Override + public PersistentDataType getHandle() { + return type; + } + + @Override + public Class getPrimitiveOriginal() { + return type.getPrimitiveType(); + } + + @Override + public Class getComplexOriginal() { + return type.getComplexType(); + } + + /* + * + */ + + @Override + public Class getComplex() { + return complexType; + } + + @Override + public Class getPrimitive() { + return primitiveType; + } + + @Override + public P0 toPrimitive(DataAdapterContext context, C0 complex) { + return wrapToPrimitive(complex, new BukkitContext1_16_R2(context)); + } + + @Override + public C0 fromPrimitive(DataAdapterContext context, P0 primitive) { + return wrapToComplex(primitive, new BukkitContext1_16_R2(context)); + } + + @Override + public P0 wrapToPrimitive(C0 complex, WrappedContext context) { + if (!(context instanceof PersistentDataAdapterContext)) { + return null; + } + return toPrimitiveWrapped(type.toPrimitive(toComplexOriginal(complex), (PersistentDataAdapterContext) context)); + } + + @Override + public C0 wrapToComplex(P0 primitive, WrappedContext context) { + if (!(context instanceof PersistentDataAdapterContext)) { + return null; + } + return toComplexWrapped(type.fromPrimitive(toPrimitiveOriginal(primitive), (PersistentDataAdapterContext) context)); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/WrappedType1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/WrappedType1_16_R2.java new file mode 100644 index 0000000..f29b6b4 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/WrappedType1_16_R2.java @@ -0,0 +1,150 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R2.data; + +import java.util.Arrays; + +import org.bukkit.persistence.PersistentDataContainer; +import org.bukkit.persistence.PersistentDataType; + +import com.syntaxphoenix.syntaxapi.data.DataType; +import com.syntaxphoenix.syntaxapi.data.IDataContainer; + +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; + +public abstract class WrappedType1_16_R2 implements WrapType { + + protected final Class primitiveType; + protected final Class complexType; + + private final int primitiveWrap; + private final int complexWrap; + + @SuppressWarnings("unchecked") + protected WrappedType1_16_R2(Class primitive, Class complex) { + this.primitiveWrap = WrappedType1_16_R2.internalState(primitive); + this.complexWrap = WrappedType1_16_R2.internalState(complex); + this.primitiveType = (Class) WrappedType1_16_R2.internalWrap(primitive, primitiveWrap); + this.complexType = (Class) WrappedType1_16_R2.internalWrap(complex, complexWrap); + } + + public abstract H getHandle(); + + public Class getPrimitiveWrapped() { + return primitiveType; + } + + public Class getComplexWrapped() { + return complexType; + } + + public abstract Class getPrimitiveOriginal(); + + public abstract Class getComplexOriginal(); + + @SuppressWarnings("unchecked") + public P0 toPrimitiveWrapped(P1 primitive) { + switch (primitiveWrap) { + case 1: + return (P0) new SyntaxContainer1_16_R2((PersistentDataContainer) primitive); + case 2: + return (P0) Arrays.stream((PersistentDataContainer[]) primitive).map(SyntaxContainer1_16_R2::new) + .toArray(SyntaxContainer1_16_R2[]::new); + case 3: + return (P0) new BukkitContainer1_16_R2((IDataContainer) primitive); + case 4: + return (P0) Arrays.stream((IDataContainer[]) primitive).map(BukkitContainer1_16_R2::new) + .toArray(BukkitContainer1_16_R2[]::new); + default: + return (P0) primitive; + } + } + + @SuppressWarnings("unchecked") + public C0 toComplexWrapped(C1 complex) { + switch (complexWrap) { + case 1: + return (C0) new SyntaxContainer1_16_R2((PersistentDataContainer) complex); + case 2: + return (C0) Arrays.stream((PersistentDataContainer[]) complex).map(SyntaxContainer1_16_R2::new).toArray(BukkitContainer1_16_R2[]::new); + case 3: + return (C0) new BukkitContainer1_16_R2((IDataContainer) complex); + case 4: + return (C0) Arrays.stream((IDataContainer[]) complex).map(BukkitContainer1_16_R2::new).toArray(BukkitContainer1_16_R2[]::new); + default: + return (C0) complex; + } + } + + @SuppressWarnings("unchecked") + public P1 toPrimitiveOriginal(P0 primitive) { + switch (primitiveWrap) { + case 1: + return (P1) new BukkitContainer1_16_R2((IDataContainer) primitive); + case 2: + return (P1) Arrays.stream((IDataContainer[]) primitive).map(BukkitContainer1_16_R2::new) + .toArray(BukkitContainer1_16_R2[]::new); + case 3: + return (P1) new SyntaxContainer1_16_R2((PersistentDataContainer) primitive); + case 4: + return (P1) Arrays.stream((PersistentDataContainer[]) primitive).map(SyntaxContainer1_16_R2::new) + .toArray(BukkitContainer1_16_R2[]::new); + default: + return (P1) primitive; + } + } + + @SuppressWarnings("unchecked") + public C1 toComplexOriginal(C0 complex) { + switch (complexWrap) { + case 1: + return (C1) new BukkitContainer1_16_R2((IDataContainer) complex); + case 2: + return (C1) Arrays.stream((IDataContainer[]) complex).map(BukkitContainer1_16_R2::new).toArray(BukkitContainer1_16_R2[]::new); + case 3: + return (C1) new SyntaxContainer1_16_R2((PersistentDataContainer) complex); + case 4: + return (C1) Arrays.stream((PersistentDataContainer[]) complex).map(SyntaxContainer1_16_R2::new).toArray(SyntaxContainer1_16_R2[]::new); + default: + return (C1) complex; + } + } + + protected static Class internalWrap(Class clazz, int state) { + switch (state) { + case 1: + return SyntaxContainer1_16_R2.class; + case 2: + return SyntaxContainer1_16_R2[].class; + case 3: + return BukkitContainer1_16_R2.class; + case 4: + return BukkitContainer1_16_R2[].class; + default: + return clazz; + } + } + + protected static int internalState(Class clazz) { + if (clazz.isAssignableFrom(PersistentDataContainer.class)) { + return 1; + } + if (clazz.isAssignableFrom(PersistentDataContainer[].class)) { + return 2; + } + if (clazz.isAssignableFrom(IDataContainer.class)) { + return 3; + } + if (clazz.isAssignableFrom(IDataContainer[].class)) { + return 4; + } + return 0; + } + + public static BukkitType1_16_R2 wrap(DataType type) { + return new BukkitType1_16_R2<>(type); + } + + public static SyntaxType1_16_R2 wrap(PersistentDataType type) { + return new SyntaxType1_16_R2<>(type); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/hook/BukkitContainerAdapterHook1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/hook/BukkitContainerAdapterHook1_16_R2.java new file mode 100644 index 0000000..3601b91 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/hook/BukkitContainerAdapterHook1_16_R2.java @@ -0,0 +1,134 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R2.data.hook; + +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; + +import org.bukkit.craftbukkit.v1_16_R2.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_16_R2.persistence.CraftPersistentDataContainer; +import org.bukkit.craftbukkit.v1_16_R2.persistence.CraftPersistentDataTypeRegistry; +import org.bukkit.persistence.PersistentDataContainer; + +import com.syntaxphoenix.syntaxapi.data.IDataContainer; +import com.syntaxphoenix.syntaxapi.data.container.nbt.NbtContainer; +import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; +import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; +import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.minecraft.server.v1_16_R2.NBTTagCompound; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R2.data.BukkitContainer1_16_R2; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R2.data.SyntaxContainer1_16_R2; +import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; + +@SuppressWarnings({ + "rawtypes", + "unchecked" +}) +public final class BukkitContainerAdapterHook1_16_R2 { + + private static final BukkitContainerAdapterHook1_16_R2 HOOK = new BukkitContainerAdapterHook1_16_R2(); + + private final AbstractReflect registryRef = new Reflect(CraftPersistentDataTypeRegistry.class) + .searchMethod("create", "createAdapter", Class.class, Class.class, Function.class, Function.class) + .searchField("adapters", "adapters") + .searchField("function", "CREATE_ADAPTER"); + private final AbstractReflect entityRef = new Reflect(CraftEntity.class).searchField("registry", "DATA_TYPE_REGISTRY"); + + private BukkitContainerAdapterHook1_16_R2() {} + + private final HashMap map = new HashMap<>(); + + private CraftPersistentDataTypeRegistry getEntityRegistry() { + return (CraftPersistentDataTypeRegistry) entityRef.getFieldValue("registry"); + } + + private void uninjectAll() { + for (CraftPersistentDataTypeRegistry registry : map.keySet()) { + Map adapters = (Map) registryRef.getFieldValue("adapters", registry); + adapters.remove(BukkitContainer1_16_R2.class); + adapters.remove(SyntaxContainer1_16_R2.class); + registryRef.setFieldValue(registry, "function", map.get(registry)); + } + map.clear(); + } + + private void inject(CraftPersistentDataTypeRegistry registry) { + if (map.containsKey(registry)) { + return; + } + map.put(registry, (Function) registryRef.getFieldValue("function", registry)); + Function function = clazz -> createAdapter(registry, registryRef.getMethod("create").getReturnType(), (Class) clazz); + registryRef.setFieldValue(registry, "function", function); + } + + private E createAdapter(CraftPersistentDataTypeRegistry registry, Class adapterType, Class type) { + if (Objects.equals(BukkitContainer1_16_R2.class, type)) { + return (E) buildAdapter(registry, BukkitContainer1_16_R2.class, tag -> fromPrimitiveSyntax(tag)); + } + if (Objects.equals(SyntaxContainer1_16_R2.class, type)) { + return (E) buildAdapter(registry, SyntaxContainer1_16_R2.class, tag -> fromPrimitiveBukkit(registry, tag)); + } + return (E) map.get(registry).apply(type); + } + + private Object buildAdapter(Object handle, Class type, Function function) { + return registryRef.run(handle, "create", type, NBTTagCompound.class, (Function) input -> toPrimitive(input), + function); + } + + private NBTTagCompound toPrimitive(WrappedContainer input) { + Object handle = findFinalContainer(input).getHandle(); + if (handle instanceof PersistentDataContainer) { + if (handle instanceof CraftPersistentDataContainer) { + return ((CraftPersistentDataContainer) handle).toTagCompound(); + } + throw new IllegalArgumentException( + "Expected 'CraftPersistentDataContainer' got '" + handle.getClass().getSimpleName() + " instead'!"); + } + if (handle instanceof IDataContainer) { + if (handle instanceof NbtContainer) { + return (NBTTagCompound) VersionControl.get().getBukkitConversion().toMinecraftCompound(((NbtContainer) handle).asNbt()); + } + throw new IllegalArgumentException( + "Expected 'CraftPersistentDataContainer' got '" + handle.getClass().getSimpleName() + " instead'!"); + } + throw new IllegalArgumentException("Unknown WrappedContainer implementation!"); + } + + private BukkitContainer1_16_R2 fromPrimitiveSyntax(NBTTagCompound data) { + VersionControl control = VersionControl.get(); + NbtContainer container = new NbtContainer(control.getDataProvider().getRegistry()); + NbtCompound compound = control.getBukkitConversion().fromMinecraftCompound(data); + container.fromNbt(compound); + return new BukkitContainer1_16_R2(container); + } + + private SyntaxContainer1_16_R2 fromPrimitiveBukkit(CraftPersistentDataTypeRegistry registry, NBTTagCompound data) { + CraftPersistentDataContainer container = new CraftPersistentDataContainer(registry); + container.putAll(data); + return new SyntaxContainer1_16_R2(container); + } + + private WrappedContainer findFinalContainer(WrappedContainer container) { + WrappedContainer output = container; + while (output.getHandle() instanceof WrappedContainer) { + output = (WrappedContainer) output.getHandle(); + } + return output; + } + + public static void unhookAll() { + HOOK.uninjectAll(); + } + + public static void hookEntity() { + HOOK.inject(HOOK.getEntityRegistry()); + } + + public static void hook(CraftPersistentDataTypeRegistry registry) { + HOOK.inject(registry); + } + +} diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/entity/ArmorStand1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/entity/ArmorStand1_16_R2.java new file mode 100644 index 0000000..6652206 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/entity/ArmorStand1_16_R2.java @@ -0,0 +1,24 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R2.entity; + +import net.minecraft.server.v1_16_R2.EntityArmorStand; +import net.minecraft.server.v1_16_R2.EntityTypes; +import net.minecraft.server.v1_16_R2.World; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsArmorStand; + +public class ArmorStand1_16_R2 extends EntityLiving1_16_R2 implements NmsArmorStand { + + public ArmorStand1_16_R2(World world) { + super(new EntityArmorStand(EntityTypes.ARMOR_STAND, world)); + } + + @Override + public void setSmall(boolean small) { + handle.setSmall(small); + } + + @Override + public boolean isSmall() { + return handle.isSmall(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/entity/Entity1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/entity/Entity1_16_R2.java new file mode 100644 index 0000000..565b029 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/entity/Entity1_16_R2.java @@ -0,0 +1,215 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R2.entity; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.UUID; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.OfflinePlayer; +import org.bukkit.craftbukkit.v1_16_R2.CraftWorld; +import org.bukkit.craftbukkit.v1_16_R2.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_16_R2.util.CraftChatMessage; +import org.bukkit.entity.Player; + +import net.minecraft.server.v1_16_R2.AxisAlignedBB; +import net.minecraft.server.v1_16_R2.Entity; +import net.minecraft.server.v1_16_R2.PacketPlayOutEntityDestroy; +import net.minecraft.server.v1_16_R2.PacketPlayOutEntityMetadata; +import net.minecraft.server.v1_16_R2.PacketPlayOutSpawnEntity; +import net.minecraft.server.v1_16_R2.PlayerConnection; +import net.minecraft.server.v1_16_R2.Vec3D; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.reflection.utils.NmsBoundingBox; + +public abstract class Entity1_16_R2 implements NmsEntity { + + protected final E handle; + + protected final List visible = Collections.synchronizedList(new ArrayList<>()); + + public Entity1_16_R2(E handle) { + this.handle = handle; + } + + @Override + public final E getHandle() { + return handle; + } + + @Override + public int getId() { + return handle.getId(); + } + + @Override + public UUID getUniqueId() { + return handle.getUniqueID(); + } + + @Override + public NmsBoundingBox getBoundingBox() { + AxisAlignedBB box = handle.getBoundingBox(); + return new NmsBoundingBox(box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ); + } + + @Override + public void setCustomName(String name) { + handle.setCustomName(CraftChatMessage.fromStringOrNull(name)); + updateVisibility(); + } + + @Override + public String getCustomName() { + return CraftChatMessage.fromComponent(handle.getCustomName()); + } + + @Override + public void setGravity(boolean gravity) { + handle.setNoGravity(!gravity); + } + + @Override + public boolean hasGravity() { + return !handle.isNoGravity(); + } + + @Override + public void setCustomNameVisible(boolean visible) { + handle.setCustomNameVisible(visible); + } + + @Override + public boolean isCustomNameVisible() { + return handle.getCustomNameVisible(); + } + + @Override + public void setInvisible(boolean invisible) { + handle.setInvisible(invisible); + } + + @Override + public boolean isInvisible() { + return handle.isInvisible(); + } + + @Override + public boolean isInteractable() { + return handle.isInteractable(); + } + + @Override + public boolean isCollidable() { + return handle.isCollidable(); + } + + @Override + public void setInvulnerable(boolean invulnerable) { + handle.setInvulnerable(invulnerable); + } + + @Override + public boolean isInvulnerable() { + return handle.isInvulnerable(); + } + + @Override + public void setLocation(Location location) { + handle.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); + if (location.getWorld() == null || handle.getWorld().getWorld() == location.getWorld()) { + updateVisibility(); + return; + } + handle.world = ((CraftWorld) location.getWorld()).getHandle(); + updateVisibility(); + } + + @Override + public Location getLocation() { + Vec3D vector = handle.getPositionVector(); + return new Location(handle.getWorld().getWorld(), vector.x, vector.y, vector.z); + } + + @Override + public void updateVisibility() { + if (visible.isEmpty()) { + return; + } + Player[] players; + synchronized (visible) { + players = visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) + .toArray(Player[]::new); + } + hide(players); + show(players); + } + + @Override + public boolean isShown(Player player) { + synchronized (visible) { + return visible.contains(player.getUniqueId()); + } + } + + @Override + public void hide(Player... players) { + if (players.length == 0) { + return; + } + PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(handle.getId()); + for (Player player : players) { + if (!isShown(player)) { + continue; + } + ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); + synchronized (visible) { + visible.remove(player.getUniqueId()); + } + } + } + + @Override + public void show(Player... players) { + if (players.length == 0) { + return; + } + PacketPlayOutSpawnEntity packet = new PacketPlayOutSpawnEntity(handle); + PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); + PlayerConnection connection; + for (Player player : players) { + if (isShown(player)) { + continue; + } + connection = ((CraftPlayer) player).getHandle().playerConnection; + connection.sendPacket(packet); + connection.sendPacket(metadataPacket); + synchronized (visible) { + visible.add(player.getUniqueId()); + } + } + } + + @Override + public UUID[] getVisible() { + synchronized (visible) { + return visible.toArray(new UUID[0]); + } + } + + @Override + public Player[] getVisibleAsPlayer() { + synchronized (visible) { + return visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) + .toArray(Player[]::new); + } + } + + @Override + public void kill() { + hide(getVisibleAsPlayer()); + handle.die(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/entity/EntityLiving1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/entity/EntityLiving1_16_R2.java new file mode 100644 index 0000000..3d5f130 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/entity/EntityLiving1_16_R2.java @@ -0,0 +1,17 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R2.entity; + +import net.minecraft.server.v1_16_R2.EntityLiving; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityLiving; + +public abstract class EntityLiving1_16_R2 extends Entity1_16_R2 implements NmsEntityLiving { + + public EntityLiving1_16_R2(E handle) { + super(handle); + } + + @Override + public void setCollidable(boolean collidable) { + handle.collides = collidable; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/entity/Player1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/entity/Player1_16_R2.java new file mode 100644 index 0000000..fe4634b --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/entity/Player1_16_R2.java @@ -0,0 +1,295 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R2.entity; + +import java.util.ArrayList; +import java.util.Collections; + +import org.bukkit.craftbukkit.v1_16_R2.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_16_R2.util.CraftChatMessage; +import org.bukkit.entity.Player; + +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.properties.Property; +import com.mojang.authlib.properties.PropertyMap; +import com.mojang.datafixers.util.Pair; + +import net.minecraft.server.v1_16_R2.BiomeManager; +import net.minecraft.server.v1_16_R2.EntityPlayer; +import net.minecraft.server.v1_16_R2.EnumItemSlot; +import net.minecraft.server.v1_16_R2.IChatBaseComponent; +import net.minecraft.server.v1_16_R2.ItemStack; +import net.minecraft.server.v1_16_R2.MathHelper; +import net.minecraft.server.v1_16_R2.PacketPlayInClientCommand; +import net.minecraft.server.v1_16_R2.PacketPlayInClientCommand.EnumClientCommand; +import net.minecraft.server.v1_16_R2.PacketPlayOutEntityDestroy; +import net.minecraft.server.v1_16_R2.PacketPlayOutEntityEquipment; +import net.minecraft.server.v1_16_R2.PacketPlayOutEntityHeadRotation; +import net.minecraft.server.v1_16_R2.PacketPlayOutEntityMetadata; +import net.minecraft.server.v1_16_R2.PacketPlayOutEntityStatus; +import net.minecraft.server.v1_16_R2.PacketPlayOutHeldItemSlot; +import net.minecraft.server.v1_16_R2.PacketPlayOutNamedEntitySpawn; +import net.minecraft.server.v1_16_R2.PacketPlayOutPlayerInfo; +import net.minecraft.server.v1_16_R2.PacketPlayOutPlayerInfo.EnumPlayerInfoAction; +import net.minecraft.server.v1_16_R2.PacketPlayOutPlayerListHeaderFooter; +import net.minecraft.server.v1_16_R2.PacketPlayOutPosition; +import net.minecraft.server.v1_16_R2.PacketPlayOutRespawn; +import net.minecraft.server.v1_16_R2.PacketPlayOutTitle; +import net.minecraft.server.v1_16_R2.PacketPlayOutTitle.EnumTitleAction; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R2.data.SyntaxContainer1_16_R2; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.reflection.data.type.SkinDataType; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; +import net.sourcewriters.minecraft.vcompat.utils.bukkit.Players; +import net.sourcewriters.minecraft.vcompat.utils.minecraft.MojangProfileServer; +import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; +import net.sourcewriters.minecraft.vcompat.utils.thread.PostAsync; +import net.minecraft.server.v1_16_R2.PlayerConnection; +import net.minecraft.server.v1_16_R2.WorldServer; + +public class Player1_16_R2 extends EntityLiving1_16_R2 implements NmsPlayer { + + private String realName; + private Skin realSkin; + + private final WrappedContainer dataAdapter; + + public Player1_16_R2(Player player) { + super(((CraftPlayer) player).getHandle()); + dataAdapter = new SyntaxContainer1_16_R2(getBukkitPlayer().getPersistentDataContainer()); + update(false); + } + + @Override + public CraftPlayer getBukkitPlayer() { + return handle.getBukkitEntity(); + } + + @Override + public WrappedContainer getDataAdapter() { + return dataAdapter; + } + + @Override + public void setSkin(Skin skin) { + if (skin == null) { + return; + } + dataAdapter.set("skin", skin, SkinDataType.WRAPPED_INSTANCE); + } + + @Override + public Skin getSkin() { + return dataAdapter.getOrDefault("skin", SkinDataType.WRAPPED_INSTANCE, realSkin); + } + + @Override + public Skin getRealSkin() { + return realSkin; + } + + @Override + public void setName(String name) { + if (getName().equals(name)) { + return; + } + if (name == null) { + dataAdapter.remove("name"); + return; + } + dataAdapter.set("name", name, WrapType.STRING); + } + + @Override + public String getName() { + return dataAdapter.getOrDefault("name", WrapType.STRING, realName); + } + + @Override + public String getRealName() { + return realName; + } + + @Override + public void setPlayerListHeader(String text) { + setPlayerListHeaderAndFooter(text, getPlayerListFooter()); + } + + @Override + public String getPlayerListHeader() { + return dataAdapter.getOrDefault("header", WrapType.STRING, ""); + } + + @Override + public void setPlayerListFooter(String text) { + setPlayerListHeaderAndFooter(getPlayerListHeader(), text); + } + + @Override + public String getPlayerListFooter() { + return dataAdapter.getOrDefault("footer", WrapType.STRING, ""); + } + + @Override + public int getPing() { + return handle.ping; + } + + @Override + public void setPlayerListHeaderAndFooter(String header, String footer) { + dataAdapter.set("header", header, WrapType.STRING); + dataAdapter.set("footer", footer, WrapType.STRING); + sendPlayerListInfo(header, footer); + } + + private final void sendPlayerListInfo(String header, String footer) { + if (handle.playerConnection.isDisconnected()) { + return; + } + + IChatBaseComponent headerComponent = header.isEmpty() ? null : CraftChatMessage.fromStringOrNull(header, true); + IChatBaseComponent footerComponent = footer.isEmpty() ? null : CraftChatMessage.fromStringOrNull(footer, true); + + PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter(); + + packet.header = headerComponent; + packet.footer = footerComponent; + + handle.playerConnection.sendPacket(packet); + } + + @Override + public void setTitleTimes(int fadeIn, int stay, int fadeOut) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TIMES, null, fadeIn, stay, fadeOut)); + } + + @Override + public void sendSubtitle(String text) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.SUBTITLE, CraftChatMessage.fromStringOrNull(text))); + } + + @Override + public void sendTitle(String text) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TITLE, CraftChatMessage.fromStringOrNull(text))); + } + + @Override + public void sendActionBar(String text) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.ACTIONBAR, CraftChatMessage.fromStringOrNull(text))); + } + + @Override + public void fakeRespawn() { + if (handle.playerConnection.isDisconnected()) { + return; + } + PacketPlayOutPlayerInfo remInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER, handle); + PacketPlayOutPlayerInfo addInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.ADD_PLAYER, handle); + + PacketPlayOutEntityDestroy destroyPacket = new PacketPlayOutEntityDestroy(handle.getId()); + PacketPlayOutNamedEntitySpawn spawnPacket = new PacketPlayOutNamedEntitySpawn(handle); + PacketPlayOutEntityHeadRotation rotationPacket = new PacketPlayOutEntityHeadRotation(handle, + (byte) MathHelper.d(handle.getHeadRotation() * 256F / 360F)); + + ArrayList> list = new ArrayList<>(); + for (EnumItemSlot slot : EnumItemSlot.values()) { + list.add(Pair.of(slot, handle.getEquipment(slot))); + } + PacketPlayOutEntityEquipment equipmentPacket = new PacketPlayOutEntityEquipment(handle.getId(), list); + + Player self = getBukkitPlayer(); + Player[] players = Players.getOnlineWithout(getUniqueId()); + for (Player player : players) { + if (!player.canSee(self)) { + continue; + } + PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection; + connection.sendPacket(remInfoPacket); + connection.sendPacket(addInfoPacket); + connection.sendPacket(destroyPacket); + connection.sendPacket(spawnPacket); + connection.sendPacket(rotationPacket); + connection.sendPacket(equipmentPacket); + } + + WorldServer world = (WorldServer) handle.world; + + PacketPlayOutRespawn respawnPacket = new PacketPlayOutRespawn(world.getDimensionManager(), world.getDimensionKey(), + BiomeManager.a(world.getSeed()), handle.playerInteractManager.getGameMode(), handle.playerInteractManager.c(), + world.isDebugWorld(), world.isFlatWorld(), true); + PacketPlayOutPosition positionPacket = new PacketPlayOutPosition(handle.locX(), handle.locY(), handle.locZ(), handle.yaw, + handle.pitch, Collections.emptySet(), 0); + PacketPlayOutHeldItemSlot itemPacket = new PacketPlayOutHeldItemSlot(handle.inventory.itemInHandIndex); + PacketPlayOutEntityStatus statusPacket = new PacketPlayOutEntityStatus(handle, (byte) 28); + PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); + + PlayerConnection connection = handle.playerConnection; + connection.sendPacket(remInfoPacket); + connection.sendPacket(addInfoPacket); + connection.sendPacket(respawnPacket); + connection.sendPacket(positionPacket); + connection.sendPacket(itemPacket); + connection.sendPacket(statusPacket); + connection.sendPacket(metadataPacket); + + handle.updateAbilities(); + handle.triggerHealthUpdate(); + handle.updateInventory(handle.defaultContainer); + if (handle.activeContainer != handle.defaultContainer) { + handle.updateInventory(handle.activeContainer); + } + self.recalculatePermissions(); + } + + @Override + public void respawn() { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayInClientCommand(EnumClientCommand.PERFORM_RESPAWN)); + } + + @Override + public void update() { + update(true); + } + + private final void update(boolean flag) { + PostAsync.forcePost(() -> { + realName = MojangProfileServer.getName(getUniqueId()); + realSkin = MojangProfileServer.getSkin(realName, getUniqueId()); + }); + if (flag) { + GameProfile profile = handle.getProfile(); + + Skin skin = getSkin(); + if (skin != null) { + PropertyMap properties = profile.getProperties(); + properties.removeAll("textures"); + properties.put("textures", new Property("textures", skin.getValue(), skin.getSignature())); + } + + String name = getName(); + if (name != null) { + ReflectionProvider.DEFAULT.getReflect("mjGameProfile").setFieldValue(profile, "name", name); + } + + if (!(name == null && skin == null)) { + fakeRespawn(); + } + } + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/tools/BlockTools1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/tools/BlockTools1_16_R2.java new file mode 100644 index 0000000..1472353 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/tools/BlockTools1_16_R2.java @@ -0,0 +1,39 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R2.tools; + +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_16_R2.block.CraftSkull; + +import com.mojang.authlib.properties.Property; +import com.mojang.authlib.properties.PropertyMap; +import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; +import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.minecraft.server.v1_16_R2.TileEntitySkull; +import net.sourcewriters.minecraft.vcompat.reflection.tools.BlockTools; +import net.sourcewriters.minecraft.vcompat.utils.constants.MinecraftConstants; + +public class BlockTools1_16_R2 extends BlockTools { + + private final AbstractReflect craftEntityStateRef = new Reflect(CraftSkull.class).searchField("tileEntity", "tileEntity"); + + @Override + public void setHeadTexture(Block block, String texture) { + if (!(block instanceof CraftSkull)) { + return; + } + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + PropertyMap map = entitySkull.gameProfile.getProperties(); + map.removeAll("textures"); + map.put("textures", new Property("textures", MinecraftConstants.TEXTURE_SIGNATURE, texture)); + } + + @Override + public String getHeadTexture(Block block) { + if (!(block instanceof CraftSkull)) { + return null; + } + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + return entitySkull.gameProfile.getProperties().get("textures").iterator().next().getValue(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/tools/ServerTools1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/tools/ServerTools1_16_R2.java new file mode 100644 index 0000000..1ce968a --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/tools/ServerTools1_16_R2.java @@ -0,0 +1,27 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R2.tools; + +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_16_R2.CraftServer; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R2.wrapper.ConsoleReaderWrapper1_16_R2; +import net.sourcewriters.minecraft.vcompat.reflection.tools.ServerTools; + +public class ServerTools1_16_R2 extends ServerTools { + + @Override + public void setMotd(String text) { + ((CraftServer) Bukkit.getServer()).getServer().setMotd(text); + } + + @Override + public String getMotd() { + return ((CraftServer) Bukkit.getServer()).getServer().getMotd(); + } + + @SuppressWarnings("resource") + @Override + public ConsoleReaderWrapper1_16_R2 getConsole() { + return ConsoleReaderWrapper1_16_R2.INSTANCE; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/tools/SkinTools1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/tools/SkinTools1_16_R2.java new file mode 100644 index 0000000..61217bc --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/tools/SkinTools1_16_R2.java @@ -0,0 +1,16 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R2.tools; + +import org.bukkit.craftbukkit.v1_16_R2.entity.CraftPlayer; +import org.bukkit.entity.Player; + +import net.sourcewriters.minecraft.vcompat.reflection.tools.SkinTools; +import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; + +public class SkinTools1_16_R2 extends SkinTools { + + @Override + public Skin skinFromPlayer(Player player) { + return skinFromGameProfile(((CraftPlayer) player).getHandle().getProfile()); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/utils/EntityConstructors1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/utils/EntityConstructors1_16_R2.java new file mode 100644 index 0000000..999875e --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/utils/EntityConstructors1_16_R2.java @@ -0,0 +1,12 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R2.utils; + +import java.util.function.Function; + +import net.minecraft.server.v1_16_R2.World; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R2.entity.ArmorStand1_16_R2; + +public abstract class EntityConstructors1_16_R2 { + + public static final Function ARMOR_STAND = (world -> new ArmorStand1_16_R2(world)); + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/wrapper/ConsoleReaderWrapper1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/wrapper/ConsoleReaderWrapper1_16_R2.java new file mode 100644 index 0000000..c4429b4 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/wrapper/ConsoleReaderWrapper1_16_R2.java @@ -0,0 +1,43 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R2.wrapper; + +import java.io.IOException; +import java.io.Writer; + +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_16_R2.CraftServer; +import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; + +import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; + +public final class ConsoleReaderWrapper1_16_R2 extends ConsoleReaderWrapper { + + public static final ConsoleReaderWrapper1_16_R2 INSTANCE = new ConsoleReaderWrapper1_16_R2(); + + private final ConsoleReader reader; + + @SuppressWarnings("resource") + private ConsoleReaderWrapper1_16_R2() { + this.reader = ((CraftServer) Bukkit.getServer()).getServer().reader; + } + + @Override + public Writer getOutput() { + return reader.getOutput(); + } + + @Override + public boolean isAnsiSupported() { + return reader.getTerminal().isAnsiSupported(); + } + + @Override + public void flush() throws IOException { + reader.flush(); + } + + @Override + public void drawLine() throws IOException { + reader.drawLine(); + } + +} diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/BukkitConversion1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/BukkitConversion1_16_R3.java new file mode 100644 index 0000000..0ea13e6 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/BukkitConversion1_16_R3.java @@ -0,0 +1,218 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3; + +import java.util.Set; + +import org.bukkit.craftbukkit.v1_16_R3.inventory.CraftItemStack; +import org.bukkit.entity.EntityType; + +import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; +import com.syntaxphoenix.syntaxapi.data.DataType; +import com.syntaxphoenix.syntaxapi.nbt.NbtByte; +import com.syntaxphoenix.syntaxapi.nbt.NbtByteArray; +import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; +import com.syntaxphoenix.syntaxapi.nbt.NbtDouble; +import com.syntaxphoenix.syntaxapi.nbt.NbtEnd; +import com.syntaxphoenix.syntaxapi.nbt.NbtFloat; +import com.syntaxphoenix.syntaxapi.nbt.NbtInt; +import com.syntaxphoenix.syntaxapi.nbt.NbtIntArray; +import com.syntaxphoenix.syntaxapi.nbt.NbtList; +import com.syntaxphoenix.syntaxapi.nbt.NbtLong; +import com.syntaxphoenix.syntaxapi.nbt.NbtLongArray; +import com.syntaxphoenix.syntaxapi.nbt.NbtShort; +import com.syntaxphoenix.syntaxapi.nbt.NbtString; +import com.syntaxphoenix.syntaxapi.nbt.NbtTag; +import com.syntaxphoenix.syntaxapi.nbt.NbtType; + +import net.minecraft.server.v1_16_R3.ItemStack; +import net.minecraft.server.v1_16_R3.NBTBase; +import net.minecraft.server.v1_16_R3.NBTNumber; +import net.minecraft.server.v1_16_R3.NBTTagByte; +import net.minecraft.server.v1_16_R3.NBTTagByteArray; +import net.minecraft.server.v1_16_R3.NBTTagCompound; +import net.minecraft.server.v1_16_R3.NBTTagDouble; +import net.minecraft.server.v1_16_R3.NBTTagEnd; +import net.minecraft.server.v1_16_R3.NBTTagFloat; +import net.minecraft.server.v1_16_R3.NBTTagInt; +import net.minecraft.server.v1_16_R3.NBTTagIntArray; +import net.minecraft.server.v1_16_R3.NBTTagList; +import net.minecraft.server.v1_16_R3.NBTTagLong; +import net.minecraft.server.v1_16_R3.NBTTagLongArray; +import net.minecraft.server.v1_16_R3.NBTTagShort; +import net.minecraft.server.v1_16_R3.NBTTagString; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3.data.BukkitContext1_16_R3; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3.data.BukkitType1_16_R3; +import net.sourcewriters.minecraft.vcompat.reflection.BukkitConversion; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; + +public class BukkitConversion1_16_R3 extends BukkitConversion { + + protected BukkitConversion1_16_R3(VersionControl1_16_R3 versionControl) { + super(versionControl); + } + + @Override + public EntityType toEntityType(NmsEntityType type) { + try { + return EntityType.valueOf(type.name()); + } catch (IllegalArgumentException ignore) { + return null; + } + } + + @Override + public NmsEntityType fromEntityType(EntityType type) { + try { + return NmsEntityType.valueOf(type.name()); + } catch (IllegalArgumentException ignore) { + return null; + } + } + + @Override + public NBTBase toMinecraftTag(NbtTag tag) { + switch (tag.getType()) { + case BYTE: + return NBTTagByte.a((byte) tag.getValue()); + case SHORT: + return NBTTagShort.a((short) tag.getValue()); + case INT: + return NBTTagInt.a((int) tag.getValue()); + case LONG: + return NBTTagLong.a((long) tag.getValue()); + case FLOAT: + return NBTTagFloat.a((float) tag.getValue()); + case DOUBLE: + return NBTTagDouble.a((double) tag.getValue()); + case STRING: + return NBTTagString.a((String) tag.getValue()); + case BYTE_ARRAY: + return new NBTTagByteArray((byte[]) tag.getValue()); + case INT_ARRAY: + return new NBTTagIntArray((int[]) tag.getValue()); + case LONG_ARRAY: + return new NBTTagLongArray((long[]) tag.getValue()); + case LIST: + return toMinecraftList((NbtList) tag); + case COMPOUND: + return toMinecraftCompound((NbtCompound) tag); + case END: + return NBTTagEnd.b; + default: + return null; + } + } + + @Override + public NbtTag fromMinecraftTag(Object raw) { + if (!(raw instanceof NBTBase)) { + return null; + } + NBTBase tag = (NBTBase) raw; + NbtType type = NbtType.getById(tag.getTypeId()); + switch (type) { + case BYTE: + return new NbtByte(((NBTNumber) tag).asByte()); + case SHORT: + return new NbtShort(((NBTNumber) tag).asShort()); + case INT: + return new NbtInt(((NBTNumber) tag).asInt()); + case LONG: + return new NbtLong(((NBTNumber) tag).asLong()); + case FLOAT: + return new NbtFloat(((NBTNumber) tag).asFloat()); + case DOUBLE: + return new NbtDouble(((NBTNumber) tag).asDouble()); + case STRING: + return new NbtString(((NBTTagString) tag).asString()); + case BYTE_ARRAY: + return new NbtByteArray(((NBTTagByteArray) tag).getBytes()); + case INT_ARRAY: + return new NbtIntArray(((NBTTagIntArray) tag).getInts()); + case LONG_ARRAY: + return new NbtLongArray(((NBTTagLongArray) tag).getLongs()); + case LIST: + return fromMinecraftList(tag); + case COMPOUND: + return fromMinecraftCompound(tag); + case END: + return NbtEnd.INSTANCE; + default: + return null; + } + } + + @Override + public NBTTagList toMinecraftList(NbtList list) { + NBTTagList output = new NBTTagList(); + for (NbtTag tag : list) { + output.add(toMinecraftTag(tag)); + } + return output; + } + + @Override + public NbtList fromMinecraftList(Object raw) { + if (!(raw instanceof NBTTagList)) { + return null; + } + NBTTagList list = (NBTTagList) raw; + NbtList output = new NbtList<>(NbtType.getById(list.getTypeId())); + for (NBTBase base : list) { + output.add(fromMinecraftTag(base)); + } + return output; + } + + @Override + public NBTTagCompound toMinecraftCompound(NbtCompound compound) { + NBTTagCompound output = new NBTTagCompound(); + if (compound.isEmpty()) { + return output; + } + Set keys = compound.getKeys(); + for (String key : keys) { + output.set(key, toMinecraftTag(compound.get(key))); + } + return output; + } + + @Override + public NbtCompound fromMinecraftCompound(Object raw) { + if (!(raw instanceof NBTTagCompound)) { + return null; + } + NBTTagCompound compound = (NBTTagCompound) raw; + NbtCompound output = new NbtCompound(); + if (compound.isEmpty()) { + return output; + } + Set keys = compound.getKeys(); + for (String key : keys) { + output.set(key, fromMinecraftTag(compound.get(key))); + } + return output; + } + + @Override + public org.bukkit.inventory.ItemStack itemFromCompound(NbtCompound compound) { + return CraftItemStack.asBukkitCopy(ItemStack.a(toMinecraftCompound(compound))); + } + + @Override + public NbtCompound itemToCompound(org.bukkit.inventory.ItemStack itemStack) { + return fromMinecraftCompound(CraftItemStack.asNMSCopy(itemStack).save(new NBTTagCompound())); + } + + @Override + public WrappedContext createContext(DataAdapterContext context) { + return new BukkitContext1_16_R3(context); + } + + @Override + public WrapType wrap(DataType dataType) { + return new BukkitType1_16_R3<>(dataType); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/EntityProvider1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/EntityProvider1_16_R3.java new file mode 100644 index 0000000..bf7207b --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/EntityProvider1_16_R3.java @@ -0,0 +1,47 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3; + +import java.util.EnumMap; +import java.util.function.Function; + +import org.bukkit.craftbukkit.v1_16_R3.CraftWorld; + +import net.minecraft.server.v1_16_R3.World; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3.utils.EntityConstructors1_16_R3; +import net.sourcewriters.minecraft.vcompat.reflection.EntityProvider; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; + +public class EntityProvider1_16_R3 extends EntityProvider { + + private final EnumMap> entityMap = new EnumMap<>(NmsEntityType.class); + + protected EntityProvider1_16_R3(VersionControl1_16_R3 versionControl) { + super(versionControl); + } + + @SuppressWarnings("unchecked") + private final Function searchConstructor(NmsEntityType type) { + try { + return (Function) EntityConstructors1_16_R3.class.getField(type.name()).get(null); + } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException ignore) { + return null; + } + } + + private final Function getConstructor(NmsEntityType type) { + return entityMap.computeIfAbsent(type, (key -> searchConstructor(key))); + } + + @Override + public NmsEntity createEntity(org.bukkit.World world, NmsEntityType type) { + if (!(world instanceof CraftWorld)) { + return null; + } + Function function; + if ((function = getConstructor(type)) == null) { + return null; + } + return function.apply(((CraftWorld) world).getHandle()); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/PacketHandler1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/PacketHandler1_16_R3.java new file mode 100644 index 0000000..082b1f5 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/PacketHandler1_16_R3.java @@ -0,0 +1,11 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3; + +import net.sourcewriters.minecraft.vcompat.reflection.PacketHandler; + +public class PacketHandler1_16_R3 extends PacketHandler { + + protected PacketHandler1_16_R3(VersionControl1_16_R3 versionControl) { + super(versionControl); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/PlayerProvider1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/PlayerProvider1_16_R3.java new file mode 100644 index 0000000..37f73ad --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/PlayerProvider1_16_R3.java @@ -0,0 +1,20 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3; + +import org.bukkit.entity.Player; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3.entity.Player1_16_R3; +import net.sourcewriters.minecraft.vcompat.reflection.PlayerProvider; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; + +public class PlayerProvider1_16_R3 extends PlayerProvider { + + protected PlayerProvider1_16_R3(VersionControl1_16_R3 versionControl) { + super(versionControl); + } + + @Override + protected NmsPlayer createPlayer(Player player) { + return new Player1_16_R3(player); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/TextureProvider1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/TextureProvider1_16_R3.java new file mode 100644 index 0000000..701d733 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/TextureProvider1_16_R3.java @@ -0,0 +1,102 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3; + +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_16_R3.block.CraftBlockEntityState; +import org.bukkit.craftbukkit.v1_16_R3.block.CraftSkull; +import org.bukkit.craftbukkit.v1_16_R3.inventory.CraftItemStack; +import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.inventory.meta.SkullMeta; + +import com.mojang.authlib.GameProfile; +import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; +import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.minecraft.server.v1_16_R3.GameProfileSerializer; +import net.minecraft.server.v1_16_R3.ItemStack; +import net.minecraft.server.v1_16_R3.NBTTagCompound; +import net.minecraft.server.v1_16_R3.TileEntitySkull; +import net.sourcewriters.minecraft.vcompat.reflection.TextureProvider; + +public class TextureProvider1_16_R3 extends TextureProvider { + + private final AbstractReflect craftEntityStateRef = new Reflect(CraftBlockEntityState.class).searchField("tileEntity", "tileEntity"); + private final AbstractReflect craftItemStackRef = new Reflect(CraftItemStack.class).searchField("handle", "handle"); + private final AbstractReflect craftMetaSkullRef = new Reflect("org.bukkit.craftbukkit.v1_16_R3.inventory.CraftMetaSkull") + .searchField("serialized", "serializedProfile").searchField("profile", "profile"); + + protected TextureProvider1_16_R3(VersionControl1_16_R3 versionControl) { + super(versionControl); + } + + @Override + public GameProfile profileFromBlock(Block block) { + if (!(block instanceof CraftSkull)) { + return null; + } + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + return entitySkull.gameProfile; + } + + @Override + public GameProfile profileFromItem(org.bukkit.inventory.ItemStack itemStack) { + if (!(itemStack.getItemMeta() instanceof SkullMeta)) { + return null; + } + SkullMeta meta = (SkullMeta) itemStack.getItemMeta(); + GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue("profile", meta); + if (profile == null) { + NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue("serialized", meta); + if (compound == null) { + ItemStack stack = null; + if (itemStack instanceof CraftItemStack) { + stack = (ItemStack) craftItemStackRef.getFieldValue("handle", itemStack); + } + if (stack == null) { + stack = CraftItemStack.asNMSCopy(itemStack); + } + NBTTagCompound stackTag = stack.getOrCreateTag(); + if (stackTag.hasKeyOfType("SkullOwner", 10)) { + compound = stackTag.getCompound("SkullOwner"); + } else if (stackTag.hasKeyOfType("SkullProfile", 10)) { + compound = stackTag.getCompound("SkullProfile"); + } + } + if (compound == null) { + return null; + } + profile = GameProfileSerializer.deserialize(compound); + } + return profile; + } + + @Override + public org.bukkit.inventory.ItemStack getItem(GameProfile profile) { + org.bukkit.inventory.ItemStack craftStack = CraftItemStack.asCraftCopy(new org.bukkit.inventory.ItemStack(Material.PLAYER_HEAD)); + applyItem(craftStack, profile); + return craftStack; + } + + @Override + public boolean applyItem(org.bukkit.inventory.ItemStack itemStack, GameProfile profile) { + ItemMeta meta = itemStack.getItemMeta(); + if (!(meta instanceof SkullMeta)) { + return false; + } + SkullMeta skullMeta = (SkullMeta) meta; + craftMetaSkullRef.setFieldValue(meta, "profile", profile); + itemStack.setItemMeta(skullMeta); + return true; + } + + @Override + public boolean applyBlock(Block block, GameProfile profile) { + if (!(block instanceof CraftSkull)) { + return false; + } + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + entitySkull.setGameProfile(profile); + return true; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/ToolProvider1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/ToolProvider1_16_R3.java new file mode 100644 index 0000000..939c183 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/ToolProvider1_16_R3.java @@ -0,0 +1,33 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3.tools.BlockTools1_16_R3; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3.tools.ServerTools1_16_R3; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3.tools.SkinTools1_16_R3; +import net.sourcewriters.minecraft.vcompat.reflection.ToolProvider; + +public class ToolProvider1_16_R3 extends ToolProvider { + + private final BlockTools1_16_R3 blockTools = new BlockTools1_16_R3(); + private final SkinTools1_16_R3 skinTools = new SkinTools1_16_R3(); + private final ServerTools1_16_R3 serverTools = new ServerTools1_16_R3(); + + protected ToolProvider1_16_R3(VersionControl1_16_R3 versionControl) { + super(versionControl); + } + + @Override + public SkinTools1_16_R3 getSkinTools() { + return skinTools; + } + + @Override + public ServerTools1_16_R3 getServerTools() { + return serverTools; + } + + @Override + public BlockTools1_16_R3 getBlockTools() { + return blockTools; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/VersionControl1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/VersionControl1_16_R3.java new file mode 100644 index 0000000..2b83a7a --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/VersionControl1_16_R3.java @@ -0,0 +1,61 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3.data.hook.BukkitContainerAdapterHook1_16_R3; +import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; + +public class VersionControl1_16_R3 extends VersionControl { + + public static VersionControl1_16_R3 INSTANCE; + + public static VersionControl1_16_R3 init() { + return INSTANCE != null ? INSTANCE : (INSTANCE = new VersionControl1_16_R3()); + } + + private final ToolProvider1_16_R3 toolProvider = new ToolProvider1_16_R3(this); + private final TextureProvider1_16_R3 textureProvider = new TextureProvider1_16_R3(this); + private final PacketHandler1_16_R3 packetHandler = new PacketHandler1_16_R3(this); + private final EntityProvider1_16_R3 entityProvider = new EntityProvider1_16_R3(this); + private final PlayerProvider1_16_R3 playerProvider = new PlayerProvider1_16_R3(this); + private final BukkitConversion1_16_R3 bukkitConversion = new BukkitConversion1_16_R3(this); + + private VersionControl1_16_R3() { + BukkitContainerAdapterHook1_16_R3.hookEntity(); + } + + @Override + public ToolProvider1_16_R3 getToolProvider() { + return toolProvider; + } + + @Override + public EntityProvider1_16_R3 getEntityProvider() { + return entityProvider; + } + + @Override + public PlayerProvider1_16_R3 getPlayerProvider() { + return playerProvider; + } + + @Override + public TextureProvider1_16_R3 getTextureProvider() { + return textureProvider; + } + + @Override + public PacketHandler1_16_R3 getPacketHandler() { + return packetHandler; + } + + @Override + public BukkitConversion1_16_R3 getBukkitConversion() { + return bukkitConversion; + } + + @Override + public void shutdown() { + dataProvider.getDefaultDistributor().shutdown(); + BukkitContainerAdapterHook1_16_R3.unhookAll(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/BukkitContainer1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/BukkitContainer1_16_R3.java new file mode 100644 index 0000000..30d0cb1 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/BukkitContainer1_16_R3.java @@ -0,0 +1,161 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3.data; + +import java.util.Arrays; +import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; + +import org.bukkit.NamespacedKey; +import org.bukkit.persistence.PersistentDataAdapterContext; +import org.bukkit.persistence.PersistentDataContainer; +import org.bukkit.persistence.PersistentDataType; + +import com.syntaxphoenix.syntaxapi.data.IDataContainer; + +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; +import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SyntaxKey; + +public final class BukkitContainer1_16_R3 extends WrappedContainer implements PersistentDataContainer { + + private final IDataContainer container; + + public BukkitContainer1_16_R3(IDataContainer container) { + this.container = container; + } + + @Override + public IDataContainer getHandle() { + return container; + } + + @Override + public IDataContainer getAsSyntaxContainer() { + return container; + } + + /* + * + */ + + @Override + public boolean has(NamespacedKey key, PersistentDataType type) { + return has(new BukkitKey1_16_R3(key), WrappedType1_16_R3.wrap(type)); + } + + @Override + public Z get(NamespacedKey key, PersistentDataType type) { + return get(new BukkitKey1_16_R3(key), WrappedType1_16_R3.wrap(type)); + } + + @Override + public Z getOrDefault(NamespacedKey key, PersistentDataType type, Z value) { + return Optional.ofNullable(get(key, type)).orElse(value); + } + + @Override + public void set(NamespacedKey key, PersistentDataType type, Z value) { + set(new BukkitKey1_16_R3(key), value, WrappedType1_16_R3.wrap(type)); + } + + @Override + public void remove(NamespacedKey key) { + remove(new BukkitKey1_16_R3(key)); + } + + @Override + public Set getKeys() { + return Arrays.stream(container.getKeys()).map(SyntaxKey::new).map(BukkitKey1_16_R3::asBukkit).collect(Collectors.toSet()); + } + + @Override + public PersistentDataAdapterContext getAdapterContext() { + return getContext(); + } + + /* + * + */ + + @Override + public BukkitContext1_16_R3 getContext() { + return new BukkitContext1_16_R3(container.getAdapterContext()); + } + + @Override + public boolean has(String key) { + return has(wrappedKey(key)); + } + + @Override + public boolean has(WrappedKey key) { + return container.has(key.getNamespacedKey()); + } + + @Override + public boolean has(String key, WrapType type) { + return has(wrappedKey(key), type); + } + + @Override + public boolean has(WrappedKey key, WrapType type) { + return container.has(key.getNamespacedKey(), type.syntaxType()); + } + + @Override + public Object get(String key) { + return get(wrappedKey(key)); + } + + @Override + public Object get(WrappedKey key) { + return container.get(key.getNamespacedKey()); + } + + @Override + public C get(String key, WrapType type) { + return get(wrappedKey(key), type); + } + + @Override + public C get(WrappedKey key, WrapType type) { + return container.get(key.getNamespacedKey(), type.syntaxType()); + } + + @Override + public void set(String key, B value, WrapType type) { + set(wrappedKey(key), value, type); + } + + @Override + public void set(WrappedKey key, B value, WrapType type) { + container.set(key.getNamespacedKey(), value, type.syntaxType()); + } + + @Override + public boolean remove(String key) { + return false; + } + + @Override + public boolean remove(WrappedKey key) { + return container.remove(key.getNamespacedKey()); + } + + @Override + public Set keySet() { + return container.getKeyspaces(); + } + + @Override + public boolean isEmpty() { + return container.isEmpty(); + } + + @Override + public int size() { + return container.size(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/BukkitContext1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/BukkitContext1_16_R3.java new file mode 100644 index 0000000..a5f6a97 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/BukkitContext1_16_R3.java @@ -0,0 +1,39 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3.data; + +import org.bukkit.persistence.PersistentDataAdapterContext; +import org.bukkit.persistence.PersistentDataContainer; + +import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; +import com.syntaxphoenix.syntaxapi.data.IDataContainer; + +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; + +public final class BukkitContext1_16_R3 extends WrappedContext implements PersistentDataAdapterContext { + + private final DataAdapterContext context; + + public BukkitContext1_16_R3(DataAdapterContext context) { + this.context = context; + } + + @Override + public DataAdapterContext getHandle() { + return context; + } + + @Override + public PersistentDataContainer newPersistentDataContainer() { + return newContainer(); + } + + @Override + public IDataContainer newDataContainer() { + return context.newDataContainer(); + } + + @Override + public BukkitContainer1_16_R3 newContainer() { + return new BukkitContainer1_16_R3(context.newDataContainer()); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/BukkitKey1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/BukkitKey1_16_R3.java new file mode 100644 index 0000000..4a26bf7 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/BukkitKey1_16_R3.java @@ -0,0 +1,52 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3.data; + +import org.bukkit.NamespacedKey; +import org.bukkit.plugin.Plugin; + +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; + +public final class BukkitKey1_16_R3 extends WrappedKey { + + private final NamespacedKey key; + + public BukkitKey1_16_R3(Plugin plugin, String key) { + this.key = new NamespacedKey(plugin, key); + } + + @SuppressWarnings("deprecation") + public BukkitKey1_16_R3(String name, String key) { + this.key = new NamespacedKey(name, key); + } + + public BukkitKey1_16_R3(NamespacedKey key) { + this.key = key; + } + + @Override + public NamespacedKey getHandle() { + return key; + } + + @Override + public String getName() { + return key.getNamespace(); + } + + @Override + public String getKey() { + return key.getKey(); + } + + @Override + public String toString() { + return key.toString(); + } + + public static NamespacedKey asBukkit(WrappedKey key) { + if (key.getHandle() instanceof NamespacedKey) { + return (NamespacedKey) key.getHandle(); + } + return new BukkitKey1_16_R3(key.getName(), key.getKey()).getHandle(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/BukkitType1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/BukkitType1_16_R3.java new file mode 100644 index 0000000..e0030d2 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/BukkitType1_16_R3.java @@ -0,0 +1,69 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3.data; + +import org.bukkit.persistence.PersistentDataAdapterContext; +import org.bukkit.persistence.PersistentDataType; + +import com.syntaxphoenix.syntaxapi.data.DataType; + +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; + +public class BukkitType1_16_R3 extends WrappedType1_16_R3, P0, P1, C0, C1> + implements PersistentDataType { + + private final DataType type; + + public BukkitType1_16_R3(DataType type) { + super(type.getPrimitive(), type.getComplex()); + this.type = type; + } + + @Override + public DataType getHandle() { + return type; + } + + @Override + public Class getPrimitiveOriginal() { + return type.getPrimitive(); + } + + @Override + public Class getComplexOriginal() { + return type.getComplex(); + } + + /* + * + */ + + @Override + public Class getComplexType() { + return complexType; + } + + @Override + public Class getPrimitiveType() { + return primitiveType; + } + + @Override + public P0 toPrimitive(C0 complex, PersistentDataAdapterContext context) { + return wrapToPrimitive(complex, new SyntaxContext1_16_R3(context)); + } + + @Override + public C0 fromPrimitive(P0 primitive, PersistentDataAdapterContext context) { + return wrapToComplex(primitive, new SyntaxContext1_16_R3(context)); + } + + @Override + public P0 wrapToPrimitive(C0 complex, WrappedContext context) { + return toPrimitiveWrapped(type.toPrimitive(context, toComplexOriginal(complex))); + } + + @Override + public C0 wrapToComplex(P0 primitive, WrappedContext context) { + return toComplexWrapped(type.fromPrimitive(context, toPrimitiveOriginal(primitive))); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/SimpleBukkitType1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/SimpleBukkitType1_16_R3.java new file mode 100644 index 0000000..f717fc5 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/SimpleBukkitType1_16_R3.java @@ -0,0 +1,36 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3.data; + +import org.bukkit.persistence.PersistentDataAdapterContext; +import org.bukkit.persistence.PersistentDataType; + +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; + +public class SimpleBukkitType1_16_R3 implements PersistentDataType { + + private final WrapType type; + + public SimpleBukkitType1_16_R3(WrapType type) { + this.type = type; + } + + @Override + public Class getComplexType() { + return type.getComplexWrapped(); + } + + @Override + public Class

getPrimitiveType() { + return type.getPrimitiveWrapped(); + } + + @Override + public P toPrimitive(C complex, PersistentDataAdapterContext context) { + return type.wrapToPrimitive(complex, new SyntaxContext1_16_R3(context)); + } + + @Override + public C fromPrimitive(P primitive, PersistentDataAdapterContext context) { + return type.wrapToComplex(primitive, new SyntaxContext1_16_R3(context)); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/SyntaxContainer1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/SyntaxContainer1_16_R3.java new file mode 100644 index 0000000..b7686e1 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/SyntaxContainer1_16_R3.java @@ -0,0 +1,185 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3.data; + +import java.util.Set; +import java.util.stream.Collectors; + +import org.bukkit.persistence.PersistentDataContainer; + +import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; +import com.syntaxphoenix.syntaxapi.data.DataType; +import com.syntaxphoenix.syntaxapi.data.IDataContainer; +import com.syntaxphoenix.syntaxapi.utils.key.IKey; + +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; +import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SyntaxKey; + +public final class SyntaxContainer1_16_R3 extends WrappedContainer implements IDataContainer { + + private final PersistentDataContainer container; + + public SyntaxContainer1_16_R3(PersistentDataContainer container) { + this.container = container; + } + + @Override + public PersistentDataContainer getHandle() { + return container; + } + + @Override + public IDataContainer getAsSyntaxContainer() { + return new SyntaxContainer1_16_R3(container); + } + + /* + * + */ + + @Override + public boolean has(IKey key) { + throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); + } + + @Override + public boolean has(String key, DataType type) { + return has(syntaxKey(key), type); + } + + @Override + public boolean has(IKey key, DataType type) { + return has(new SyntaxKey(key), WrappedType1_16_R3.wrap(type)); + } + + @Override + public C get(String key, DataType type) { + return get(syntaxKey(key), type); + } + + @Override + public C get(IKey key, DataType type) { + return get(new SyntaxKey(key), WrappedType1_16_R3.wrap(type)); + } + + @Override + public Object get(String key) { + throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); + } + + @Override + public Object get(IKey key) { + throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); + } + + @Override + public void set(String key, E value, DataType type) { + set(wrappedKey(key), value, WrappedType1_16_R3.wrap(type)); + } + + @Override + public void set(IKey key, E value, DataType type) { + set(new SyntaxKey(key), value, WrappedType1_16_R3.wrap(type)); + } + + @Override + public boolean remove(String key) { + return remove(wrappedKey(key)); + } + + @Override + public boolean remove(IKey key) { + return remove(new SyntaxKey(key)); + } + + @Override + public IKey[] getKeys() { + return container.getKeys().stream().map(BukkitKey1_16_R3::new).map(WrappedKey::getNamespacedKey).toArray(IKey[]::new); + } + + @Override + public Set getKeyspaces() { + return container.getKeys().stream().map(org.bukkit.NamespacedKey::toString).collect(Collectors.toSet()); + } + + @Override + public DataAdapterContext getAdapterContext() { + return getContext(); + } + + /* + * + */ + + @Override + public SyntaxContext1_16_R3 getContext() { + return new SyntaxContext1_16_R3(container.getAdapterContext()); + } + + @Override + public boolean has(String key) { + throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); + } + + @Override + public boolean has(WrappedKey key) { + throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); + } + + @Override + public boolean has(String key, WrapType type) { + return has(wrappedKey(key), type); + } + + @Override + public boolean has(WrappedKey key, WrapType type) { + return container.has(BukkitKey1_16_R3.asBukkit(key), new SimpleBukkitType1_16_R3<>(type)); + } + + @Override + public Object get(WrappedKey key) { + throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); + } + + @Override + public C get(String key, WrapType type) { + return get(wrappedKey(key), type); + } + + @Override + public C get(WrappedKey key, WrapType type) { + return container.get(BukkitKey1_16_R3.asBukkit(key), new SimpleBukkitType1_16_R3<>(type)); + } + + @Override + public void set(String key, B value, WrapType type) { + set(wrappedKey(key), value, type); + } + + @Override + public void set(WrappedKey key, B value, WrapType type) { + container.set(BukkitKey1_16_R3.asBukkit(key), new SimpleBukkitType1_16_R3<>(type), value); + } + + @Override + public boolean remove(WrappedKey key) { + container.remove(BukkitKey1_16_R3.asBukkit(key)); + return true; // Will always return true as we don't know if it contained it + } + + @Override + public Set keySet() { + return getKeyspaces(); + } + + @Override + public boolean isEmpty() { + return container.isEmpty(); + } + + @Override + public int size() { + return container.getKeys().size(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/SyntaxContext1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/SyntaxContext1_16_R3.java new file mode 100644 index 0000000..c336960 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/SyntaxContext1_16_R3.java @@ -0,0 +1,38 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3.data; + +import org.bukkit.persistence.PersistentDataAdapterContext; +import org.bukkit.persistence.PersistentDataContainer; + +import com.syntaxphoenix.syntaxapi.data.IDataContainer; + +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; + +public final class SyntaxContext1_16_R3 extends WrappedContext implements PersistentDataAdapterContext { + + private final PersistentDataAdapterContext context; + + public SyntaxContext1_16_R3(PersistentDataAdapterContext context) { + this.context = context; + } + + @Override + public PersistentDataAdapterContext getHandle() { + return context; + } + + @Override + public PersistentDataContainer newPersistentDataContainer() { + return context.newPersistentDataContainer(); + } + + @Override + public IDataContainer newDataContainer() { + return newContainer(); + } + + @Override + public SyntaxContainer1_16_R3 newContainer() { + return new SyntaxContainer1_16_R3(context.newPersistentDataContainer()); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/SyntaxType1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/SyntaxType1_16_R3.java new file mode 100644 index 0000000..f5b6e42 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/SyntaxType1_16_R3.java @@ -0,0 +1,76 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3.data; + +import org.bukkit.persistence.PersistentDataAdapterContext; +import org.bukkit.persistence.PersistentDataType; + +import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; +import com.syntaxphoenix.syntaxapi.data.DataType; + +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; + +public class SyntaxType1_16_R3 extends WrappedType1_16_R3, P0, P1, C0, C1> + implements DataType { + + private final PersistentDataType type; + + public SyntaxType1_16_R3(PersistentDataType type) { + super(type.getPrimitiveType(), type.getComplexType()); + this.type = type; + } + + @Override + public PersistentDataType getHandle() { + return type; + } + + @Override + public Class getPrimitiveOriginal() { + return type.getPrimitiveType(); + } + + @Override + public Class getComplexOriginal() { + return type.getComplexType(); + } + + /* + * + */ + + @Override + public Class getComplex() { + return complexType; + } + + @Override + public Class getPrimitive() { + return primitiveType; + } + + @Override + public P0 toPrimitive(DataAdapterContext context, C0 complex) { + return wrapToPrimitive(complex, new BukkitContext1_16_R3(context)); + } + + @Override + public C0 fromPrimitive(DataAdapterContext context, P0 primitive) { + return wrapToComplex(primitive, new BukkitContext1_16_R3(context)); + } + + @Override + public P0 wrapToPrimitive(C0 complex, WrappedContext context) { + if (!(context instanceof PersistentDataAdapterContext)) { + return null; + } + return toPrimitiveWrapped(type.toPrimitive(toComplexOriginal(complex), (PersistentDataAdapterContext) context)); + } + + @Override + public C0 wrapToComplex(P0 primitive, WrappedContext context) { + if (!(context instanceof PersistentDataAdapterContext)) { + return null; + } + return toComplexWrapped(type.fromPrimitive(toPrimitiveOriginal(primitive), (PersistentDataAdapterContext) context)); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/WrappedType1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/WrappedType1_16_R3.java new file mode 100644 index 0000000..d2ffa11 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/WrappedType1_16_R3.java @@ -0,0 +1,150 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3.data; + +import java.util.Arrays; + +import org.bukkit.persistence.PersistentDataContainer; +import org.bukkit.persistence.PersistentDataType; + +import com.syntaxphoenix.syntaxapi.data.DataType; +import com.syntaxphoenix.syntaxapi.data.IDataContainer; + +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; + +public abstract class WrappedType1_16_R3 implements WrapType { + + protected final Class primitiveType; + protected final Class complexType; + + private final int primitiveWrap; + private final int complexWrap; + + @SuppressWarnings("unchecked") + protected WrappedType1_16_R3(Class primitive, Class complex) { + this.primitiveWrap = WrappedType1_16_R3.internalState(primitive); + this.complexWrap = WrappedType1_16_R3.internalState(complex); + this.primitiveType = (Class) WrappedType1_16_R3.internalWrap(primitive, primitiveWrap); + this.complexType = (Class) WrappedType1_16_R3.internalWrap(complex, complexWrap); + } + + public abstract H getHandle(); + + public Class getPrimitiveWrapped() { + return primitiveType; + } + + public Class getComplexWrapped() { + return complexType; + } + + public abstract Class getPrimitiveOriginal(); + + public abstract Class getComplexOriginal(); + + @SuppressWarnings("unchecked") + public P0 toPrimitiveWrapped(P1 primitive) { + switch (primitiveWrap) { + case 1: + return (P0) new SyntaxContainer1_16_R3((PersistentDataContainer) primitive); + case 2: + return (P0) Arrays.stream((PersistentDataContainer[]) primitive).map(SyntaxContainer1_16_R3::new) + .toArray(SyntaxContainer1_16_R3[]::new); + case 3: + return (P0) new BukkitContainer1_16_R3((IDataContainer) primitive); + case 4: + return (P0) Arrays.stream((IDataContainer[]) primitive).map(BukkitContainer1_16_R3::new) + .toArray(BukkitContainer1_16_R3[]::new); + default: + return (P0) primitive; + } + } + + @SuppressWarnings("unchecked") + public C0 toComplexWrapped(C1 complex) { + switch (complexWrap) { + case 1: + return (C0) new SyntaxContainer1_16_R3((PersistentDataContainer) complex); + case 2: + return (C0) Arrays.stream((PersistentDataContainer[]) complex).map(SyntaxContainer1_16_R3::new).toArray(SyntaxContainer1_16_R3[]::new); + case 3: + return (C0) new BukkitContainer1_16_R3((IDataContainer) complex); + case 4: + return (C0) Arrays.stream((IDataContainer[]) complex).map(BukkitContainer1_16_R3::new).toArray(BukkitContainer1_16_R3[]::new); + default: + return (C0) complex; + } + } + + @SuppressWarnings("unchecked") + public P1 toPrimitiveOriginal(P0 primitive) { + switch (primitiveWrap) { + case 1: + return (P1) new BukkitContainer1_16_R3((IDataContainer) primitive); + case 2: + return (P1) Arrays.stream((IDataContainer[]) primitive).map(BukkitContainer1_16_R3::new) + .toArray(BukkitContainer1_16_R3[]::new); + case 3: + return (P1) new SyntaxContainer1_16_R3((PersistentDataContainer) primitive); + case 4: + return (P1) Arrays.stream((PersistentDataContainer[]) primitive).map(SyntaxContainer1_16_R3::new) + .toArray(SyntaxContainer1_16_R3[]::new); + default: + return (P1) primitive; + } + } + + @SuppressWarnings("unchecked") + public C1 toComplexOriginal(C0 complex) { + switch (complexWrap) { + case 1: + return (C1) new BukkitContainer1_16_R3((IDataContainer) complex); + case 2: + return (C1) Arrays.stream((IDataContainer[]) complex).map(BukkitContainer1_16_R3::new).toArray(BukkitContainer1_16_R3[]::new); + case 3: + return (C1) new SyntaxContainer1_16_R3((PersistentDataContainer) complex); + case 4: + return (C1) Arrays.stream((PersistentDataContainer[]) complex).map(SyntaxContainer1_16_R3::new).toArray(SyntaxContainer1_16_R3[]::new); + default: + return (C1) complex; + } + } + + protected static Class internalWrap(Class clazz, int state) { + switch (state) { + case 1: + return SyntaxContainer1_16_R3.class; + case 2: + return SyntaxContainer1_16_R3[].class; + case 3: + return BukkitContainer1_16_R3.class; + case 4: + return BukkitContainer1_16_R3[].class; + default: + return clazz; + } + } + + protected static int internalState(Class clazz) { + if (clazz.isAssignableFrom(PersistentDataContainer.class)) { + return 1; + } + if (clazz.isAssignableFrom(PersistentDataContainer[].class)) { + return 2; + } + if (clazz.isAssignableFrom(IDataContainer.class)) { + return 3; + } + if (clazz.isAssignableFrom(IDataContainer[].class)) { + return 4; + } + return 0; + } + + public static BukkitType1_16_R3 wrap(DataType type) { + return new BukkitType1_16_R3<>(type); + } + + public static SyntaxType1_16_R3 wrap(PersistentDataType type) { + return new SyntaxType1_16_R3<>(type); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/hook/BukkitContainerAdapterHook1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/hook/BukkitContainerAdapterHook1_16_R3.java new file mode 100644 index 0000000..aba4996 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/hook/BukkitContainerAdapterHook1_16_R3.java @@ -0,0 +1,134 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3.data.hook; + +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; + +import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_16_R3.persistence.CraftPersistentDataContainer; +import org.bukkit.craftbukkit.v1_16_R3.persistence.CraftPersistentDataTypeRegistry; +import org.bukkit.persistence.PersistentDataContainer; + +import com.syntaxphoenix.syntaxapi.data.IDataContainer; +import com.syntaxphoenix.syntaxapi.data.container.nbt.NbtContainer; +import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; +import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; +import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.minecraft.server.v1_16_R3.NBTTagCompound; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3.data.BukkitContainer1_16_R3; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3.data.SyntaxContainer1_16_R3; +import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; + +@SuppressWarnings({ + "rawtypes", + "unchecked" +}) +public final class BukkitContainerAdapterHook1_16_R3 { + + private static final BukkitContainerAdapterHook1_16_R3 HOOK = new BukkitContainerAdapterHook1_16_R3(); + + private final AbstractReflect registryRef = new Reflect(CraftPersistentDataTypeRegistry.class) + .searchMethod("create", "createAdapter", Class.class, Class.class, Function.class, Function.class) + .searchField("adapters", "adapters") + .searchField("function", "CREATE_ADAPTER"); + private final AbstractReflect entityRef = new Reflect(CraftEntity.class).searchField("registry", "DATA_TYPE_REGISTRY"); + + private BukkitContainerAdapterHook1_16_R3() {} + + private final HashMap map = new HashMap<>(); + + private CraftPersistentDataTypeRegistry getEntityRegistry() { + return (CraftPersistentDataTypeRegistry) entityRef.getFieldValue("registry"); + } + + private void uninjectAll() { + for (CraftPersistentDataTypeRegistry registry : map.keySet()) { + Map adapters = (Map) registryRef.getFieldValue("adapters", registry); + adapters.remove(BukkitContainer1_16_R3.class); + adapters.remove(SyntaxContainer1_16_R3.class); + registryRef.setFieldValue(registry, "function", map.get(registry)); + } + map.clear(); + } + + private void inject(CraftPersistentDataTypeRegistry registry) { + if (map.containsKey(registry)) { + return; + } + map.put(registry, (Function) registryRef.getFieldValue("function", registry)); + Function function = clazz -> createAdapter(registry, registryRef.getMethod("create").getReturnType(), (Class) clazz); + registryRef.setFieldValue(registry, "function", function); + } + + private E createAdapter(CraftPersistentDataTypeRegistry registry, Class adapterType, Class type) { + if (Objects.equals(BukkitContainer1_16_R3.class, type)) { + return (E) buildAdapter(registry, BukkitContainer1_16_R3.class, tag -> fromPrimitiveSyntax(tag)); + } + if (Objects.equals(SyntaxContainer1_16_R3.class, type)) { + return (E) buildAdapter(registry, SyntaxContainer1_16_R3.class, tag -> fromPrimitiveBukkit(registry, tag)); + } + return (E) map.get(registry).apply(type); + } + + private Object buildAdapter(Object handle, Class type, Function function) { + return registryRef.run(handle, "create", type, NBTTagCompound.class, (Function) input -> toPrimitive(input), + function); + } + + private NBTTagCompound toPrimitive(WrappedContainer input) { + Object handle = findFinalContainer(input).getHandle(); + if (handle instanceof PersistentDataContainer) { + if (handle instanceof CraftPersistentDataContainer) { + return ((CraftPersistentDataContainer) handle).toTagCompound(); + } + throw new IllegalArgumentException( + "Expected 'CraftPersistentDataContainer' got '" + handle.getClass().getSimpleName() + " instead'!"); + } + if (handle instanceof IDataContainer) { + if (handle instanceof NbtContainer) { + return (NBTTagCompound) VersionControl.get().getBukkitConversion().toMinecraftCompound(((NbtContainer) handle).asNbt()); + } + throw new IllegalArgumentException( + "Expected 'CraftPersistentDataContainer' got '" + handle.getClass().getSimpleName() + " instead'!"); + } + throw new IllegalArgumentException("Unknown WrappedContainer implementation!"); + } + + private BukkitContainer1_16_R3 fromPrimitiveSyntax(NBTTagCompound data) { + VersionControl control = VersionControl.get(); + NbtContainer container = new NbtContainer(control.getDataProvider().getRegistry()); + NbtCompound compound = control.getBukkitConversion().fromMinecraftCompound(data); + container.fromNbt(compound); + return new BukkitContainer1_16_R3(container); + } + + private SyntaxContainer1_16_R3 fromPrimitiveBukkit(CraftPersistentDataTypeRegistry registry, NBTTagCompound data) { + CraftPersistentDataContainer container = new CraftPersistentDataContainer(registry); + container.putAll(data); + return new SyntaxContainer1_16_R3(container); + } + + private WrappedContainer findFinalContainer(WrappedContainer container) { + WrappedContainer output = container; + while (output.getHandle() instanceof WrappedContainer) { + output = (WrappedContainer) output.getHandle(); + } + return output; + } + + public static void unhookAll() { + HOOK.uninjectAll(); + } + + public static void hookEntity() { + HOOK.inject(HOOK.getEntityRegistry()); + } + + public static void hook(CraftPersistentDataTypeRegistry registry) { + HOOK.inject(registry); + } + +} diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/entity/ArmorStand1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/entity/ArmorStand1_16_R3.java new file mode 100644 index 0000000..5d32b68 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/entity/ArmorStand1_16_R3.java @@ -0,0 +1,24 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3.entity; + +import net.minecraft.server.v1_16_R3.EntityArmorStand; +import net.minecraft.server.v1_16_R3.EntityTypes; +import net.minecraft.server.v1_16_R3.World; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsArmorStand; + +public class ArmorStand1_16_R3 extends EntityLiving1_16_R3 implements NmsArmorStand { + + public ArmorStand1_16_R3(World world) { + super(new EntityArmorStand(EntityTypes.ARMOR_STAND, world)); + } + + @Override + public void setSmall(boolean small) { + handle.setSmall(small); + } + + @Override + public boolean isSmall() { + return handle.isSmall(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/entity/Entity1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/entity/Entity1_16_R3.java new file mode 100644 index 0000000..b0d9522 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/entity/Entity1_16_R3.java @@ -0,0 +1,215 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3.entity; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.UUID; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.OfflinePlayer; +import org.bukkit.craftbukkit.v1_16_R3.CraftWorld; +import org.bukkit.craftbukkit.v1_16_R3.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_16_R3.util.CraftChatMessage; +import org.bukkit.entity.Player; + +import net.minecraft.server.v1_16_R3.AxisAlignedBB; +import net.minecraft.server.v1_16_R3.Entity; +import net.minecraft.server.v1_16_R3.PacketPlayOutEntityDestroy; +import net.minecraft.server.v1_16_R3.PacketPlayOutEntityMetadata; +import net.minecraft.server.v1_16_R3.PacketPlayOutSpawnEntity; +import net.minecraft.server.v1_16_R3.PlayerConnection; +import net.minecraft.server.v1_16_R3.Vec3D; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.reflection.utils.NmsBoundingBox; + +public abstract class Entity1_16_R3 implements NmsEntity { + + protected final E handle; + + protected final List visible = Collections.synchronizedList(new ArrayList<>()); + + public Entity1_16_R3(E handle) { + this.handle = handle; + } + + @Override + public final E getHandle() { + return handle; + } + + @Override + public int getId() { + return handle.getId(); + } + + @Override + public UUID getUniqueId() { + return handle.getUniqueID(); + } + + @Override + public NmsBoundingBox getBoundingBox() { + AxisAlignedBB box = handle.getBoundingBox(); + return new NmsBoundingBox(box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ); + } + + @Override + public void setCustomName(String name) { + handle.setCustomName(CraftChatMessage.fromStringOrNull(name)); + updateVisibility(); + } + + @Override + public String getCustomName() { + return CraftChatMessage.fromComponent(handle.getCustomName()); + } + + @Override + public void setGravity(boolean gravity) { + handle.setNoGravity(!gravity); + } + + @Override + public boolean hasGravity() { + return !handle.isNoGravity(); + } + + @Override + public void setCustomNameVisible(boolean visible) { + handle.setCustomNameVisible(visible); + } + + @Override + public boolean isCustomNameVisible() { + return handle.getCustomNameVisible(); + } + + @Override + public void setInvisible(boolean invisible) { + handle.setInvisible(invisible); + } + + @Override + public boolean isInvisible() { + return handle.isInvisible(); + } + + @Override + public boolean isInteractable() { + return handle.isInteractable(); + } + + @Override + public boolean isCollidable() { + return handle.isCollidable(); + } + + @Override + public void setInvulnerable(boolean invulnerable) { + handle.setInvulnerable(invulnerable); + } + + @Override + public boolean isInvulnerable() { + return handle.isInvulnerable(); + } + + @Override + public void setLocation(Location location) { + handle.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); + if (location.getWorld() == null || handle.getWorld().getWorld() == location.getWorld()) { + updateVisibility(); + return; + } + handle.world = ((CraftWorld) location.getWorld()).getHandle(); + updateVisibility(); + } + + @Override + public Location getLocation() { + Vec3D vector = handle.getPositionVector(); + return new Location(handle.getWorld().getWorld(), vector.x, vector.y, vector.z); + } + + @Override + public void updateVisibility() { + if (visible.isEmpty()) { + return; + } + Player[] players; + synchronized (visible) { + players = visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) + .toArray(Player[]::new); + } + hide(players); + show(players); + } + + @Override + public boolean isShown(Player player) { + synchronized (visible) { + return visible.contains(player.getUniqueId()); + } + } + + @Override + public void hide(Player... players) { + if (players.length == 0) { + return; + } + PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(handle.getId()); + for (Player player : players) { + if (!isShown(player)) { + continue; + } + ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); + synchronized (visible) { + visible.remove(player.getUniqueId()); + } + } + } + + @Override + public void show(Player... players) { + if (players.length == 0) { + return; + } + PacketPlayOutSpawnEntity packet = new PacketPlayOutSpawnEntity(handle); + PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); + PlayerConnection connection; + for (Player player : players) { + if (isShown(player)) { + continue; + } + connection = ((CraftPlayer) player).getHandle().playerConnection; + connection.sendPacket(packet); + connection.sendPacket(metadataPacket); + synchronized (visible) { + visible.add(player.getUniqueId()); + } + } + } + + @Override + public UUID[] getVisible() { + synchronized (visible) { + return visible.toArray(new UUID[0]); + } + } + + @Override + public Player[] getVisibleAsPlayer() { + synchronized (visible) { + return visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) + .toArray(Player[]::new); + } + } + + @Override + public void kill() { + hide(getVisibleAsPlayer()); + handle.die(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/entity/EntityLiving1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/entity/EntityLiving1_16_R3.java new file mode 100644 index 0000000..d18a1fe --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/entity/EntityLiving1_16_R3.java @@ -0,0 +1,17 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3.entity; + +import net.minecraft.server.v1_16_R3.EntityLiving; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityLiving; + +public abstract class EntityLiving1_16_R3 extends Entity1_16_R3 implements NmsEntityLiving { + + public EntityLiving1_16_R3(E handle) { + super(handle); + } + + @Override + public void setCollidable(boolean collidable) { + handle.collides = collidable; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/entity/Player1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/entity/Player1_16_R3.java new file mode 100644 index 0000000..4a6a2da --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/entity/Player1_16_R3.java @@ -0,0 +1,295 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3.entity; + +import java.util.ArrayList; +import java.util.Collections; + +import org.bukkit.craftbukkit.v1_16_R3.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_16_R3.util.CraftChatMessage; +import org.bukkit.entity.Player; + +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.properties.Property; +import com.mojang.authlib.properties.PropertyMap; +import com.mojang.datafixers.util.Pair; + +import net.minecraft.server.v1_16_R3.BiomeManager; +import net.minecraft.server.v1_16_R3.EntityPlayer; +import net.minecraft.server.v1_16_R3.EnumItemSlot; +import net.minecraft.server.v1_16_R3.IChatBaseComponent; +import net.minecraft.server.v1_16_R3.ItemStack; +import net.minecraft.server.v1_16_R3.MathHelper; +import net.minecraft.server.v1_16_R3.PacketPlayInClientCommand; +import net.minecraft.server.v1_16_R3.PacketPlayInClientCommand.EnumClientCommand; +import net.minecraft.server.v1_16_R3.PacketPlayOutEntityDestroy; +import net.minecraft.server.v1_16_R3.PacketPlayOutEntityEquipment; +import net.minecraft.server.v1_16_R3.PacketPlayOutEntityHeadRotation; +import net.minecraft.server.v1_16_R3.PacketPlayOutEntityMetadata; +import net.minecraft.server.v1_16_R3.PacketPlayOutEntityStatus; +import net.minecraft.server.v1_16_R3.PacketPlayOutHeldItemSlot; +import net.minecraft.server.v1_16_R3.PacketPlayOutNamedEntitySpawn; +import net.minecraft.server.v1_16_R3.PacketPlayOutPlayerInfo; +import net.minecraft.server.v1_16_R3.PacketPlayOutPlayerInfo.EnumPlayerInfoAction; +import net.minecraft.server.v1_16_R3.PacketPlayOutPlayerListHeaderFooter; +import net.minecraft.server.v1_16_R3.PacketPlayOutPosition; +import net.minecraft.server.v1_16_R3.PacketPlayOutRespawn; +import net.minecraft.server.v1_16_R3.PacketPlayOutTitle; +import net.minecraft.server.v1_16_R3.PacketPlayOutTitle.EnumTitleAction; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3.data.SyntaxContainer1_16_R3; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.reflection.data.type.SkinDataType; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; +import net.sourcewriters.minecraft.vcompat.utils.bukkit.Players; +import net.sourcewriters.minecraft.vcompat.utils.minecraft.MojangProfileServer; +import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; +import net.sourcewriters.minecraft.vcompat.utils.thread.PostAsync; +import net.minecraft.server.v1_16_R3.PlayerConnection; +import net.minecraft.server.v1_16_R3.WorldServer; + +public class Player1_16_R3 extends EntityLiving1_16_R3 implements NmsPlayer { + + private String realName; + private Skin realSkin; + + private final WrappedContainer dataAdapter; + + public Player1_16_R3(Player player) { + super(((CraftPlayer) player).getHandle()); + dataAdapter = new SyntaxContainer1_16_R3(getBukkitPlayer().getPersistentDataContainer()); + update(false); + } + + @Override + public CraftPlayer getBukkitPlayer() { + return handle.getBukkitEntity(); + } + + @Override + public WrappedContainer getDataAdapter() { + return dataAdapter; + } + + @Override + public void setSkin(Skin skin) { + if (skin == null) { + return; + } + dataAdapter.set("skin", skin, SkinDataType.WRAPPED_INSTANCE); + } + + @Override + public Skin getSkin() { + return dataAdapter.getOrDefault("skin", SkinDataType.WRAPPED_INSTANCE, realSkin); + } + + @Override + public Skin getRealSkin() { + return realSkin; + } + + @Override + public void setName(String name) { + if (getName().equals(name)) { + return; + } + if (name == null) { + dataAdapter.remove("name"); + return; + } + dataAdapter.set("name", name, WrapType.STRING); + } + + @Override + public String getName() { + return dataAdapter.getOrDefault("name", WrapType.STRING, realName); + } + + @Override + public String getRealName() { + return realName; + } + + @Override + public void setPlayerListHeader(String text) { + setPlayerListHeaderAndFooter(text, getPlayerListFooter()); + } + + @Override + public String getPlayerListHeader() { + return dataAdapter.getOrDefault("header", WrapType.STRING, ""); + } + + @Override + public void setPlayerListFooter(String text) { + setPlayerListHeaderAndFooter(getPlayerListHeader(), text); + } + + @Override + public String getPlayerListFooter() { + return dataAdapter.getOrDefault("footer", WrapType.STRING, ""); + } + + @Override + public int getPing() { + return handle.ping; + } + + @Override + public void setPlayerListHeaderAndFooter(String header, String footer) { + dataAdapter.set("header", header, WrapType.STRING); + dataAdapter.set("footer", footer, WrapType.STRING); + sendPlayerListInfo(header, footer); + } + + private final void sendPlayerListInfo(String header, String footer) { + if (handle.playerConnection.isDisconnected()) { + return; + } + + IChatBaseComponent headerComponent = header.isEmpty() ? null : CraftChatMessage.fromStringOrNull(header, true); + IChatBaseComponent footerComponent = footer.isEmpty() ? null : CraftChatMessage.fromStringOrNull(footer, true); + + PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter(); + + packet.header = headerComponent; + packet.footer = footerComponent; + + handle.playerConnection.sendPacket(packet); + } + + @Override + public void setTitleTimes(int fadeIn, int stay, int fadeOut) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TIMES, null, fadeIn, stay, fadeOut)); + } + + @Override + public void sendSubtitle(String text) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.SUBTITLE, CraftChatMessage.fromStringOrNull(text))); + } + + @Override + public void sendTitle(String text) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TITLE, CraftChatMessage.fromStringOrNull(text))); + } + + @Override + public void sendActionBar(String text) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.ACTIONBAR, CraftChatMessage.fromStringOrNull(text))); + } + + @Override + public void fakeRespawn() { + if (handle.playerConnection.isDisconnected()) { + return; + } + PacketPlayOutPlayerInfo remInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER, handle); + PacketPlayOutPlayerInfo addInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.ADD_PLAYER, handle); + + PacketPlayOutEntityDestroy destroyPacket = new PacketPlayOutEntityDestroy(handle.getId()); + PacketPlayOutNamedEntitySpawn spawnPacket = new PacketPlayOutNamedEntitySpawn(handle); + PacketPlayOutEntityHeadRotation rotationPacket = new PacketPlayOutEntityHeadRotation(handle, + (byte) MathHelper.d(handle.getHeadRotation() * 256F / 360F)); + + ArrayList> list = new ArrayList<>(); + for (EnumItemSlot slot : EnumItemSlot.values()) { + list.add(Pair.of(slot, handle.getEquipment(slot))); + } + PacketPlayOutEntityEquipment equipmentPacket = new PacketPlayOutEntityEquipment(handle.getId(), list); + + Player self = getBukkitPlayer(); + Player[] players = Players.getOnlineWithout(getUniqueId()); + for (Player player : players) { + if (!player.canSee(self)) { + continue; + } + PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection; + connection.sendPacket(remInfoPacket); + connection.sendPacket(addInfoPacket); + connection.sendPacket(destroyPacket); + connection.sendPacket(spawnPacket); + connection.sendPacket(rotationPacket); + connection.sendPacket(equipmentPacket); + } + + WorldServer world = (WorldServer) handle.world; + + PacketPlayOutRespawn respawnPacket = new PacketPlayOutRespawn(world.getDimensionManager(), world.getDimensionKey(), + BiomeManager.a(world.getSeed()), handle.playerInteractManager.getGameMode(), handle.playerInteractManager.c(), + world.isDebugWorld(), world.isFlatWorld(), true); + PacketPlayOutPosition positionPacket = new PacketPlayOutPosition(handle.locX(), handle.locY(), handle.locZ(), handle.yaw, + handle.pitch, Collections.emptySet(), 0); + PacketPlayOutHeldItemSlot itemPacket = new PacketPlayOutHeldItemSlot(handle.inventory.itemInHandIndex); + PacketPlayOutEntityStatus statusPacket = new PacketPlayOutEntityStatus(handle, (byte) 28); + PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); + + PlayerConnection connection = handle.playerConnection; + connection.sendPacket(remInfoPacket); + connection.sendPacket(addInfoPacket); + connection.sendPacket(respawnPacket); + connection.sendPacket(positionPacket); + connection.sendPacket(itemPacket); + connection.sendPacket(statusPacket); + connection.sendPacket(metadataPacket); + + handle.updateAbilities(); + handle.triggerHealthUpdate(); + handle.updateInventory(handle.defaultContainer); + if (handle.activeContainer != handle.defaultContainer) { + handle.updateInventory(handle.activeContainer); + } + self.recalculatePermissions(); + } + + @Override + public void respawn() { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayInClientCommand(EnumClientCommand.PERFORM_RESPAWN)); + } + + @Override + public void update() { + update(true); + } + + private final void update(boolean flag) { + PostAsync.forcePost(() -> { + realName = MojangProfileServer.getName(getUniqueId()); + realSkin = MojangProfileServer.getSkin(realName, getUniqueId()); + }); + if (flag) { + GameProfile profile = handle.getProfile(); + + Skin skin = getSkin(); + if (skin != null) { + PropertyMap properties = profile.getProperties(); + properties.removeAll("textures"); + properties.put("textures", new Property("textures", skin.getValue(), skin.getSignature())); + } + + String name = getName(); + if (name != null) { + ReflectionProvider.DEFAULT.getReflect("mjGameProfile").setFieldValue(profile, "name", name); + } + + if (!(name == null && skin == null)) { + fakeRespawn(); + } + } + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/tools/BlockTools1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/tools/BlockTools1_16_R3.java new file mode 100644 index 0000000..d997e1a --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/tools/BlockTools1_16_R3.java @@ -0,0 +1,39 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3.tools; + +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_16_R3.block.CraftSkull; + +import com.mojang.authlib.properties.Property; +import com.mojang.authlib.properties.PropertyMap; +import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; +import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.minecraft.server.v1_16_R3.TileEntitySkull; +import net.sourcewriters.minecraft.vcompat.reflection.tools.BlockTools; +import net.sourcewriters.minecraft.vcompat.utils.constants.MinecraftConstants; + +public class BlockTools1_16_R3 extends BlockTools { + + private final AbstractReflect craftEntityStateRef = new Reflect(CraftSkull.class).searchField("tileEntity", "tileEntity"); + + @Override + public void setHeadTexture(Block block, String texture) { + if (!(block instanceof CraftSkull)) { + return; + } + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + PropertyMap map = entitySkull.gameProfile.getProperties(); + map.removeAll("textures"); + map.put("textures", new Property("textures", MinecraftConstants.TEXTURE_SIGNATURE, texture)); + } + + @Override + public String getHeadTexture(Block block) { + if (!(block instanceof CraftSkull)) { + return null; + } + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + return entitySkull.gameProfile.getProperties().get("textures").iterator().next().getValue(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/tools/ServerTools1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/tools/ServerTools1_16_R3.java new file mode 100644 index 0000000..6142354 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/tools/ServerTools1_16_R3.java @@ -0,0 +1,27 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3.tools; + +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_16_R3.CraftServer; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3.wrapper.ConsoleReaderWrapper1_16_R3; +import net.sourcewriters.minecraft.vcompat.reflection.tools.ServerTools; + +public class ServerTools1_16_R3 extends ServerTools { + + @Override + public void setMotd(String text) { + ((CraftServer) Bukkit.getServer()).getServer().setMotd(text); + } + + @Override + public String getMotd() { + return ((CraftServer) Bukkit.getServer()).getServer().getMotd(); + } + + @SuppressWarnings("resource") + @Override + public ConsoleReaderWrapper1_16_R3 getConsole() { + return ConsoleReaderWrapper1_16_R3.INSTANCE; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/tools/SkinTools1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/tools/SkinTools1_16_R3.java new file mode 100644 index 0000000..f623b72 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/tools/SkinTools1_16_R3.java @@ -0,0 +1,16 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3.tools; + +import org.bukkit.craftbukkit.v1_16_R3.entity.CraftPlayer; +import org.bukkit.entity.Player; + +import net.sourcewriters.minecraft.vcompat.reflection.tools.SkinTools; +import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; + +public class SkinTools1_16_R3 extends SkinTools { + + @Override + public Skin skinFromPlayer(Player player) { + return skinFromGameProfile(((CraftPlayer) player).getHandle().getProfile()); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/utils/EntityConstructors1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/utils/EntityConstructors1_16_R3.java new file mode 100644 index 0000000..780e0b7 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/utils/EntityConstructors1_16_R3.java @@ -0,0 +1,12 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3.utils; + +import java.util.function.Function; + +import net.minecraft.server.v1_16_R3.World; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3.entity.ArmorStand1_16_R3; + +public abstract class EntityConstructors1_16_R3 { + + public static final Function ARMOR_STAND = (world -> new ArmorStand1_16_R3(world)); + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/wrapper/ConsoleReaderWrapper1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/wrapper/ConsoleReaderWrapper1_16_R3.java new file mode 100644 index 0000000..ef5c6a7 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/wrapper/ConsoleReaderWrapper1_16_R3.java @@ -0,0 +1,43 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3.wrapper; + +import java.io.IOException; +import java.io.Writer; + +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_16_R3.CraftServer; +import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; + +import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; + +public final class ConsoleReaderWrapper1_16_R3 extends ConsoleReaderWrapper { + + public static final ConsoleReaderWrapper1_16_R3 INSTANCE = new ConsoleReaderWrapper1_16_R3(); + + private final ConsoleReader reader; + + @SuppressWarnings("resource") + private ConsoleReaderWrapper1_16_R3() { + this.reader = ((CraftServer) Bukkit.getServer()).getServer().reader; + } + + @Override + public Writer getOutput() { + return reader.getOutput(); + } + + @Override + public boolean isAnsiSupported() { + return reader.getTerminal().isAnsiSupported(); + } + + @Override + public void flush() throws IOException { + reader.flush(); + } + + @Override + public void drawLine() throws IOException { + reader.drawLine(); + } + +} diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/BukkitConversion1_8_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/BukkitConversion1_8_R1.java new file mode 100644 index 0000000..b944695 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/BukkitConversion1_8_R1.java @@ -0,0 +1,232 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R1; + +import java.util.List; +import java.util.Set; + +import org.bukkit.craftbukkit.v1_8_R1.inventory.CraftItemStack; +import org.bukkit.entity.EntityType; + +import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; +import com.syntaxphoenix.syntaxapi.data.DataType; +import com.syntaxphoenix.syntaxapi.nbt.NbtByte; +import com.syntaxphoenix.syntaxapi.nbt.NbtByteArray; +import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; +import com.syntaxphoenix.syntaxapi.nbt.NbtDouble; +import com.syntaxphoenix.syntaxapi.nbt.NbtEnd; +import com.syntaxphoenix.syntaxapi.nbt.NbtFloat; +import com.syntaxphoenix.syntaxapi.nbt.NbtInt; +import com.syntaxphoenix.syntaxapi.nbt.NbtIntArray; +import com.syntaxphoenix.syntaxapi.nbt.NbtList; +import com.syntaxphoenix.syntaxapi.nbt.NbtLong; +import com.syntaxphoenix.syntaxapi.nbt.NbtLongArray; +import com.syntaxphoenix.syntaxapi.nbt.NbtShort; +import com.syntaxphoenix.syntaxapi.nbt.NbtString; +import com.syntaxphoenix.syntaxapi.nbt.NbtTag; +import com.syntaxphoenix.syntaxapi.nbt.NbtType; + +import net.minecraft.server.v1_8_R1.ItemStack; +import net.minecraft.server.v1_8_R1.NBTBase; +import net.minecraft.server.v1_8_R1.NBTTagByte; +import net.minecraft.server.v1_8_R1.NBTTagByteArray; +import net.minecraft.server.v1_8_R1.NBTTagCompound; +import net.minecraft.server.v1_8_R1.NBTTagDouble; +import net.minecraft.server.v1_8_R1.NBTTagEnd; +import net.minecraft.server.v1_8_R1.NBTTagFloat; +import net.minecraft.server.v1_8_R1.NBTTagInt; +import net.minecraft.server.v1_8_R1.NBTTagIntArray; +import net.minecraft.server.v1_8_R1.NBTTagList; +import net.minecraft.server.v1_8_R1.NBTTagLong; +import net.minecraft.server.v1_8_R1.NBTTagShort; +import net.minecraft.server.v1_8_R1.NBTTagString; +import net.sourcewriters.minecraft.vcompat.reflection.BukkitConversion; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContext; +import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleWrapType; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; +import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; + +public class BukkitConversion1_8_R1 extends BukkitConversion { + + protected BukkitConversion1_8_R1(VersionControl1_8_R1 versionControl) { + super(versionControl); + } + + @Override + public EntityType toEntityType(NmsEntityType type) { + try { + return EntityType.valueOf(type.name()); + } catch (IllegalArgumentException ignore) { + return null; + } + } + + @Override + public NmsEntityType fromEntityType(EntityType type) { + try { + return NmsEntityType.valueOf(type.name()); + } catch (IllegalArgumentException ignore) { + return null; + } + } + + @Override + public NBTBase toMinecraftTag(NbtTag tag) { + switch (tag.getType()) { + case BYTE: + return new NBTTagByte((byte) tag.getValue()); + case SHORT: + return new NBTTagShort((short) tag.getValue()); + case INT: + return new NBTTagInt((int) tag.getValue()); + case LONG: + return new NBTTagLong((long) tag.getValue()); + case FLOAT: + return new NBTTagFloat((float) tag.getValue()); + case DOUBLE: + return new NBTTagDouble((double) tag.getValue()); + case STRING: + return new NBTTagString((String) tag.getValue()); + case BYTE_ARRAY: + return new NBTTagByteArray((byte[]) tag.getValue()); + case INT_ARRAY: + return new NBTTagIntArray((int[]) tag.getValue()); + case LONG_ARRAY: + NBTTagList list = new NBTTagList(); + for (long value : (long[]) tag.getValue()) { + list.add(new NBTTagLong(value)); + } + return list; + case LIST: + return toMinecraftList((NbtList) tag); + case COMPOUND: + return toMinecraftCompound((NbtCompound) tag); + case END: + return (NBTTagEnd) ReflectionProvider.DEFAULT.getReflect("nmsNBTTagEnd").init(); + default: + return null; + } + } + + @Override + public NbtTag fromMinecraftTag(Object raw) { + if (!(raw instanceof NBTBase)) { + return null; + } + NBTBase tag = (NBTBase) raw; + NbtType type = NbtType.getById(tag.getTypeId()); + switch (type) { + case BYTE: + return new NbtByte(((NBTTagByte) tag).f()); + case SHORT: + return new NbtShort(((NBTTagShort) tag).e()); + case INT: + return new NbtInt(((NBTTagInt) tag).d()); + case LONG: + return new NbtLong(((NBTTagLong) tag).c()); + case FLOAT: + return new NbtFloat(((NBTTagFloat) tag).h()); + case DOUBLE: + return new NbtDouble(((NBTTagDouble) tag).g()); + case STRING: + return new NbtString(((NBTTagString) tag).a_()); + case BYTE_ARRAY: + return new NbtByteArray(((NBTTagByteArray) tag).c()); + case INT_ARRAY: + return new NbtIntArray(((NBTTagIntArray) tag).c()); + case LONG_ARRAY: + return new NbtLongArray(new long[0]); + case LIST: + return fromMinecraftList(tag); + case COMPOUND: + return fromMinecraftCompound(tag); + case END: + return NbtEnd.INSTANCE; + default: + return null; + } + } + + @Override + public NBTTagList toMinecraftList(NbtList list) { + NBTTagList output = new NBTTagList(); + for (NbtTag tag : list) { + output.add(toMinecraftTag(tag)); + } + return output; + } + + @SuppressWarnings("unchecked") + @Override + public NbtList fromMinecraftList(Object raw) { + if (!(raw instanceof NBTTagList)) { + return null; + } + NBTTagList list = (NBTTagList) raw; + List content = (List) ReflectionProvider.DEFAULT.getReflect("nmsNBTTagList").getFieldValue("value", list); + NbtList output = new NbtList<>(NbtType.getById(list.getTypeId())); + for (NBTBase base : content) { + output.add(fromMinecraftTag(base)); + } + return output; + } + + @Override + public NBTTagCompound toMinecraftCompound(NbtCompound compound) { + NBTTagCompound output = new NBTTagCompound(); + if (compound.isEmpty()) { + return output; + } + Set keys = compound.getKeys(); + for (String key : keys) { + output.set(key, toMinecraftTag(compound.get(key))); + } + return output; + } + + @SuppressWarnings("unchecked") + @Override + public NbtCompound fromMinecraftCompound(Object raw) { + if (!(raw instanceof NBTTagCompound)) { + return null; + } + NBTTagCompound compound = (NBTTagCompound) raw; + NbtCompound output = new NbtCompound(); + if (compound.isEmpty()) { + return output; + } + Set keys = compound.c(); + for (String key : keys) { + output.set(key, fromMinecraftTag(compound.get(key))); + } + return output; + } + + @Override + public org.bukkit.inventory.ItemStack itemFromCompound(NbtCompound compound) { + return CraftItemStack.asBukkitCopy(ItemStack.createStack(toMinecraftCompound(compound))); + } + + @Override + public NbtCompound itemToCompound(org.bukkit.inventory.ItemStack itemStack) { + ItemStack nmsStack = CraftItemStack.asNMSCopy(itemStack); + NBTTagCompound stackTag; + if (!nmsStack.hasTag()) { + stackTag = nmsStack.save(new NBTTagCompound()); + } else { + stackTag = nmsStack.getTag(); + } + return fromMinecraftCompound(stackTag); + } + + @Override + public WrappedContext createContext(DataAdapterContext context) { + return new SimpleSyntaxContext(context); + } + + @Override + public WrapType wrap(DataType dataType) { + return new SimpleWrapType(dataType); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/EntityProvider1_8_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/EntityProvider1_8_R1.java new file mode 100644 index 0000000..6dd8870 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/EntityProvider1_8_R1.java @@ -0,0 +1,47 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R1; + +import java.util.EnumMap; +import java.util.function.Function; + +import org.bukkit.craftbukkit.v1_8_R1.CraftWorld; + +import net.minecraft.server.v1_8_R1.World; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R1.utils.EntityConstructors1_8_R1; +import net.sourcewriters.minecraft.vcompat.reflection.EntityProvider; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; + +public class EntityProvider1_8_R1 extends EntityProvider { + + private final EnumMap> entityMap = new EnumMap<>(NmsEntityType.class); + + protected EntityProvider1_8_R1(VersionControl1_8_R1 versionControl) { + super(versionControl); + } + + @SuppressWarnings("unchecked") + private final Function searchConstructor(NmsEntityType type) { + try { + return (Function) EntityConstructors1_8_R1.class.getField(type.name()).get(null); + } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException ignore) { + return null; + } + } + + private final Function getConstructor(NmsEntityType type) { + return entityMap.computeIfAbsent(type, (key -> searchConstructor(key))); + } + + @Override + public NmsEntity createEntity(org.bukkit.World world, NmsEntityType type) { + if (!(world instanceof CraftWorld)) { + return null; + } + Function function; + if ((function = getConstructor(type)) == null) { + return null; + } + return function.apply(((CraftWorld) world).getHandle()); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/PacketHandler1_8_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/PacketHandler1_8_R1.java new file mode 100644 index 0000000..da9b0fc --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/PacketHandler1_8_R1.java @@ -0,0 +1,11 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R1; + +import net.sourcewriters.minecraft.vcompat.reflection.PacketHandler; + +public class PacketHandler1_8_R1 extends PacketHandler { + + protected PacketHandler1_8_R1(VersionControl1_8_R1 versionControl) { + super(versionControl); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/PlayerProvider1_8_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/PlayerProvider1_8_R1.java new file mode 100644 index 0000000..0a9ccdc --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/PlayerProvider1_8_R1.java @@ -0,0 +1,30 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R1; + +import java.io.File; +import java.util.UUID; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R1.entity.Player1_8_R1; +import net.sourcewriters.minecraft.vcompat.reflection.DataProvider; +import net.sourcewriters.minecraft.vcompat.reflection.PlayerProvider; +import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.DataDistributor; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; + +public class PlayerProvider1_8_R1 extends PlayerProvider { + + private final DataDistributor distributor; + + protected PlayerProvider1_8_R1(VersionControl1_8_R1 versionControl) { + super(versionControl); + distributor = versionControl.getDataProvider().createDistributor(new File(Bukkit.getWorlds().get(0).getWorldFolder(), "playerdata"), + uuid -> "custom_" + uuid.toString(), DataProvider.DEFAULT_RANDOM); + } + + @Override + protected NmsPlayer createPlayer(Player player) { + return new Player1_8_R1(player, distributor.get(player.getUniqueId())); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/TextureProvider1_8_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/TextureProvider1_8_R1.java new file mode 100644 index 0000000..3f7ea09 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/TextureProvider1_8_R1.java @@ -0,0 +1,107 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R1; + +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_8_R1.block.CraftSkull; +import org.bukkit.craftbukkit.v1_8_R1.inventory.CraftItemStack; +import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.inventory.meta.SkullMeta; +import org.bukkit.material.MaterialData; + +import com.mojang.authlib.GameProfile; +import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; +import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.minecraft.server.v1_8_R1.GameProfileSerializer; +import net.minecraft.server.v1_8_R1.ItemStack; +import net.minecraft.server.v1_8_R1.NBTTagCompound; +import net.minecraft.server.v1_8_R1.TileEntitySkull; +import net.sourcewriters.minecraft.vcompat.reflection.TextureProvider; + +@SuppressWarnings("deprecation") +public class TextureProvider1_8_R1 extends TextureProvider { + + private final AbstractReflect craftItemStackRef = new Reflect(CraftItemStack.class).searchField("handle", "handle"); + private final AbstractReflect craftMetaSkullRef = new Reflect("org.bukkit.craftbukkit.v1_8_R1.inventory.CraftMetaSkull") + .searchField("serialized", "serializedProfile").searchField("profile", "profile"); + private final AbstractReflect craftSkullRef = new Reflect(CraftSkull.class).searchField("tileEntity", "skull"); + private final Material skullMaterial = Material.valueOf("SKULL"); + + protected TextureProvider1_8_R1(VersionControl1_8_R1 versionControl) { + super(versionControl); + } + + @Override + public GameProfile profileFromBlock(Block block) { + if (!(block instanceof CraftSkull)) { + return null; + } + return ((TileEntitySkull) craftSkullRef.getFieldValue("tileEntity", block)).getGameProfile(); + } + + @Override + public GameProfile profileFromItem(org.bukkit.inventory.ItemStack itemStack) { + if (!(itemStack.getItemMeta() instanceof SkullMeta)) { + return null; + } + SkullMeta meta = (SkullMeta) itemStack.getItemMeta(); + GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue("profile", meta); + if (profile == null) { + NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue("serialized", meta); + if (compound == null) { + ItemStack stack = null; + if (itemStack instanceof CraftItemStack) { + stack = (ItemStack) craftItemStackRef.getFieldValue("handle", itemStack); + } + if (stack == null) { + stack = CraftItemStack.asNMSCopy(itemStack); + } + NBTTagCompound stackTag; + if (!stack.hasTag()) { + stackTag = stack.save(new NBTTagCompound()); + } else { + stackTag = stack.getTag(); + } + if (stackTag.hasKeyOfType("SkullOwner", 10)) { + compound = stackTag.getCompound("SkullOwner"); + } else if (stackTag.hasKeyOfType("SkullProfile", 10)) { + compound = stackTag.getCompound("SkullProfile"); + } + } + if (compound == null) { + return null; + } + profile = GameProfileSerializer.deserialize(compound); + } + return profile; + } + + @Override + public org.bukkit.inventory.ItemStack getItem(GameProfile profile) { + org.bukkit.inventory.ItemStack craftStack = CraftItemStack.asCraftCopy(new MaterialData(skullMaterial, (byte) 3).toItemStack(1)); + applyItem(craftStack, profile); + return craftStack; + } + + @Override + public boolean applyItem(org.bukkit.inventory.ItemStack itemStack, GameProfile profile) { + ItemMeta meta = itemStack.getItemMeta(); + if (!(meta instanceof SkullMeta)) { + return false; + } + SkullMeta skullMeta = (SkullMeta) meta; + craftMetaSkullRef.setFieldValue(meta, "profile", profile); + itemStack.setItemMeta(skullMeta); + return true; + } + + @Override + public boolean applyBlock(Block block, GameProfile profile) { + if (!(block instanceof CraftSkull)) { + return false; + } + ((TileEntitySkull) craftSkullRef.getFieldValue("tileEntity", block)).setGameProfile(profile); + return true; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/ToolProvider1_8_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/ToolProvider1_8_R1.java new file mode 100644 index 0000000..c38ad95 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/ToolProvider1_8_R1.java @@ -0,0 +1,33 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R1; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R1.tools.BlockTools1_8_R1; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R1.tools.ServerTools1_8_R1; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R1.tools.SkinTools1_8_R1; +import net.sourcewriters.minecraft.vcompat.reflection.ToolProvider; + +public class ToolProvider1_8_R1 extends ToolProvider { + + private final BlockTools1_8_R1 blockTools = new BlockTools1_8_R1(); + private final SkinTools1_8_R1 skinTools = new SkinTools1_8_R1(); + private final ServerTools1_8_R1 serverTools = new ServerTools1_8_R1(); + + protected ToolProvider1_8_R1(VersionControl1_8_R1 versionControl) { + super(versionControl); + } + + @Override + public SkinTools1_8_R1 getSkinTools() { + return skinTools; + } + + @Override + public ServerTools1_8_R1 getServerTools() { + return serverTools; + } + + @Override + public BlockTools1_8_R1 getBlockTools() { + return blockTools; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/VersionControl1_8_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/VersionControl1_8_R1.java new file mode 100644 index 0000000..bfa2780 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/VersionControl1_8_R1.java @@ -0,0 +1,56 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R1; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R1.reflection.NmsReflection1_8_R1; +import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; +import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; + +public class VersionControl1_8_R1 extends VersionControl { + + public static VersionControl1_8_R1 INSTANCE; + + public static VersionControl1_8_R1 init() { + return INSTANCE != null ? INSTANCE : (INSTANCE = new VersionControl1_8_R1()); + } + + private final ToolProvider1_8_R1 toolProvider = new ToolProvider1_8_R1(this); + private final TextureProvider1_8_R1 textureProvider = new TextureProvider1_8_R1(this); + private final PacketHandler1_8_R1 packetHandler = new PacketHandler1_8_R1(this); + private final EntityProvider1_8_R1 entityProvider = new EntityProvider1_8_R1(this); + private final PlayerProvider1_8_R1 playerProvider = new PlayerProvider1_8_R1(this); + private final BukkitConversion1_8_R1 bukkitConversion = new BukkitConversion1_8_R1(this); + + private VersionControl1_8_R1() { + NmsReflection1_8_R1.INSTANCE.setup(ReflectionProvider.DEFAULT); + } + + @Override + public ToolProvider1_8_R1 getToolProvider() { + return toolProvider; + } + + @Override + public EntityProvider1_8_R1 getEntityProvider() { + return entityProvider; + } + + @Override + public PlayerProvider1_8_R1 getPlayerProvider() { + return playerProvider; + } + + @Override + public TextureProvider1_8_R1 getTextureProvider() { + return textureProvider; + } + + @Override + public PacketHandler1_8_R1 getPacketHandler() { + return packetHandler; + } + + @Override + public BukkitConversion1_8_R1 getBukkitConversion() { + return bukkitConversion; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/entity/ArmorStand1_8_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/entity/ArmorStand1_8_R1.java new file mode 100644 index 0000000..686d91e --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/entity/ArmorStand1_8_R1.java @@ -0,0 +1,33 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R1.entity; + +import net.minecraft.server.v1_8_R1.EntityArmorStand; +import net.minecraft.server.v1_8_R1.World; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsArmorStand; + +public class ArmorStand1_8_R1 extends EntityLiving1_8_R1 implements NmsArmorStand { + + public ArmorStand1_8_R1(World world) { + super(new EntityArmorStand(world)); + } + + @Override + public boolean hasGravity() { + return handle.hasGravity(); + } + + @Override + public void setGravity(boolean gravity) { + handle.setGravity(gravity); + } + + @Override + public void setSmall(boolean small) { + handle.setSmall(small); + } + + @Override + public boolean isSmall() { + return handle.isSmall(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/entity/Entity1_8_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/entity/Entity1_8_R1.java new file mode 100644 index 0000000..383e562 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/entity/Entity1_8_R1.java @@ -0,0 +1,213 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R1.entity; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.UUID; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.OfflinePlayer; +import org.bukkit.craftbukkit.v1_8_R1.CraftWorld; +import org.bukkit.craftbukkit.v1_8_R1.entity.CraftPlayer; +import org.bukkit.entity.Player; + +import net.minecraft.server.v1_8_R1.AxisAlignedBB; +import net.minecraft.server.v1_8_R1.Entity; +import net.minecraft.server.v1_8_R1.EntityTypes; +import net.minecraft.server.v1_8_R1.PacketPlayOutEntityDestroy; +import net.minecraft.server.v1_8_R1.PacketPlayOutEntityMetadata; +import net.minecraft.server.v1_8_R1.PacketPlayOutSpawnEntity; +import net.minecraft.server.v1_8_R1.PlayerConnection; +import net.minecraft.server.v1_8_R1.Vec3D; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.reflection.utils.NmsBoundingBox; + +public abstract class Entity1_8_R1 implements NmsEntity { + + protected final E handle; + + protected final List visible = Collections.synchronizedList(new ArrayList<>()); + + public Entity1_8_R1(E handle) { + this.handle = handle; + } + + @Override + public final E getHandle() { + return handle; + } + + @Override + public int getId() { + return handle.getId(); + } + + @Override + public UUID getUniqueId() { + return handle.getUniqueID(); + } + + @Override + public NmsBoundingBox getBoundingBox() { + AxisAlignedBB box = handle.getBoundingBox(); + return new NmsBoundingBox(box.a, box.b, box.c, box.d, box.e, box.f); + } + + @Override + public void setCustomName(String name) { + handle.setCustomName(name); + updateVisibility(); + } + + @Override + public String getCustomName() { + return handle.getCustomName(); + } + + @Override + public void setCustomNameVisible(boolean visible) { + handle.setCustomNameVisible(visible); + } + + @Override + public boolean isCustomNameVisible() { + return handle.getCustomNameVisible(); + } + + @Override + public void setInvisible(boolean invisible) { + handle.setInvisible(invisible); + } + + @Override + public boolean isInvisible() { + return handle.isInvisible(); + } + + @Override + public boolean isInteractable() { + return handle.ad(); + } + + @Override + public boolean isCollidable() { + return handle.ae(); + } + + @Override + public void setInvulnerable(boolean invulnerable) { + handle.h(invulnerable); + } + + @Override + public boolean isInvulnerable() { + return handle.isInvulnerable(null); + } + + @Override + public boolean hasGravity() { + return true; + } + + @Override + public void setGravity(boolean gravity) {} + + @Override + public void setLocation(Location location) { + handle.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); + if (location.getWorld() == null || handle.getWorld().getWorld() == location.getWorld()) { + updateVisibility(); + return; + } + handle.world = ((CraftWorld) location.getWorld()).getHandle(); + updateVisibility(); + } + + @Override + public Location getLocation() { + Vec3D vector = handle.d(); + return new Location(handle.getWorld().getWorld(), vector.a, vector.b, vector.c); + } + + @Override + public void updateVisibility() { + if (visible.isEmpty()) { + return; + } + Player[] players; + synchronized (visible) { + players = visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) + .toArray(Player[]::new); + } + hide(players); + show(players); + } + + @Override + public boolean isShown(Player player) { + synchronized (visible) { + return visible.contains(player.getUniqueId()); + } + } + + @Override + public void hide(Player... players) { + if (players.length == 0) { + return; + } + PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(handle.getId()); + for (Player player : players) { + if (!isShown(player)) { + continue; + } + ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); + synchronized (visible) { + visible.remove(player.getUniqueId()); + } + } + } + + @Override + public void show(Player... players) { + if (players.length == 0) { + return; + } + PacketPlayOutSpawnEntity packet = new PacketPlayOutSpawnEntity(handle, EntityTypes.a(handle)); + PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); + PlayerConnection connection; + for (Player player : players) { + if (isShown(player)) { + continue; + } + connection = ((CraftPlayer) player).getHandle().playerConnection; + connection.sendPacket(packet); + connection.sendPacket(metadataPacket); + synchronized (visible) { + visible.add(player.getUniqueId()); + } + } + } + + @Override + public UUID[] getVisible() { + synchronized (visible) { + return visible.toArray(new UUID[0]); + } + } + + @Override + public Player[] getVisibleAsPlayer() { + synchronized (visible) { + return visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) + .toArray(Player[]::new); + } + } + + @Override + public void kill() { + hide(getVisibleAsPlayer()); + handle.die(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/entity/EntityLiving1_8_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/entity/EntityLiving1_8_R1.java new file mode 100644 index 0000000..b0b10df --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/entity/EntityLiving1_8_R1.java @@ -0,0 +1,17 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R1.entity; + +import net.minecraft.server.v1_8_R1.EntityLiving; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityLiving; + +public abstract class EntityLiving1_8_R1 extends Entity1_8_R1 implements NmsEntityLiving { + + public EntityLiving1_8_R1(E handle) { + super(handle); + } + + @Override + public void setCollidable(boolean collidable) { + + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/entity/Player1_8_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/entity/Player1_8_R1.java new file mode 100644 index 0000000..279d901 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/entity/Player1_8_R1.java @@ -0,0 +1,295 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R1.entity; + +import java.util.ArrayList; +import java.util.Collections; + +import org.bukkit.craftbukkit.v1_8_R1.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R1.util.CraftChatMessage; +import org.bukkit.entity.Player; + +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.properties.Property; +import com.mojang.authlib.properties.PropertyMap; +import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.minecraft.server.v1_8_R1.EntityPlayer; +import net.minecraft.server.v1_8_R1.EnumClientCommand; +import net.minecraft.server.v1_8_R1.EnumPlayerInfoAction; +import net.minecraft.server.v1_8_R1.EnumTitleAction; +import net.minecraft.server.v1_8_R1.IChatBaseComponent; +import net.minecraft.server.v1_8_R1.MathHelper; +import net.minecraft.server.v1_8_R1.PacketPlayInClientCommand; +import net.minecraft.server.v1_8_R1.PacketPlayOutChat; +import net.minecraft.server.v1_8_R1.PacketPlayOutEntityDestroy; +import net.minecraft.server.v1_8_R1.PacketPlayOutEntityEquipment; +import net.minecraft.server.v1_8_R1.PacketPlayOutEntityHeadRotation; +import net.minecraft.server.v1_8_R1.PacketPlayOutEntityMetadata; +import net.minecraft.server.v1_8_R1.PacketPlayOutEntityStatus; +import net.minecraft.server.v1_8_R1.PacketPlayOutHeldItemSlot; +import net.minecraft.server.v1_8_R1.PacketPlayOutNamedEntitySpawn; +import net.minecraft.server.v1_8_R1.PacketPlayOutPlayerInfo; +import net.minecraft.server.v1_8_R1.PacketPlayOutPlayerListHeaderFooter; +import net.minecraft.server.v1_8_R1.PacketPlayOutPosition; +import net.minecraft.server.v1_8_R1.PacketPlayOutRespawn; +import net.minecraft.server.v1_8_R1.PacketPlayOutTitle; +import net.minecraft.server.v1_8_R1.PlayerConnection; +import net.minecraft.server.v1_8_R1.WorldServer; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.PersistentContainer; +import net.sourcewriters.minecraft.vcompat.reflection.data.type.SkinDataType; +import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContainer; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; +import net.sourcewriters.minecraft.vcompat.utils.bukkit.Players; +import net.sourcewriters.minecraft.vcompat.utils.minecraft.MojangProfileServer; +import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; +import net.sourcewriters.minecraft.vcompat.utils.thread.PostAsync; + +public class Player1_8_R1 extends EntityLiving1_8_R1 implements NmsPlayer { + + private String realName; + private Skin realSkin; + + private final WrappedContainer dataAdapter; + + public Player1_8_R1(Player player, PersistentContainer container) { + super(((CraftPlayer) player).getHandle()); + this.dataAdapter = new SimpleSyntaxContainer<>(container); + update(false); + } + + @Override + public CraftPlayer getBukkitPlayer() { + return handle.getBukkitEntity(); + } + + @Override + public WrappedContainer getDataAdapter() { + return dataAdapter; + } + + @Override + public void setSkin(Skin skin) { + if (skin == null || getSkin().equals(skin)) { + return; + } + getDataAdapter().set("skin", skin, SkinDataType.WRAPPED_INSTANCE); + } + + @Override + public Skin getSkin() { + return dataAdapter.getOrDefault("skin", SkinDataType.WRAPPED_INSTANCE, realSkin); + } + + @Override + public Skin getRealSkin() { + return realSkin; + } + + @Override + public void setName(String name) { + if (getName().equals(name)) { + return; + } + if (name == null) { + getDataAdapter().remove("name"); + return; + } + getDataAdapter().set("name", name, WrapType.STRING); + } + + @Override + public String getName() { + return getDataAdapter().getOrDefault("name", WrapType.STRING, realName); + } + + @Override + public String getRealName() { + return realName; + } + + @Override + public void setPlayerListHeader(String text) { + setPlayerListHeaderAndFooter(text, getPlayerListFooter()); + } + + @Override + public String getPlayerListHeader() { + return getDataAdapter().getOrDefault("header", WrapType.STRING, ""); + } + + @Override + public void setPlayerListFooter(String text) { + setPlayerListHeaderAndFooter(getPlayerListHeader(), text); + } + + @Override + public String getPlayerListFooter() { + return getDataAdapter().getOrDefault("footer", WrapType.STRING, ""); + } + + @Override + public int getPing() { + return handle.ping; + } + + @Override + public void setPlayerListHeaderAndFooter(String header, String footer) { + getDataAdapter().set("header", header, WrapType.STRING); + getDataAdapter().set("footer", footer, WrapType.STRING); + sendPlayerListInfo(header, footer); + } + + private final void sendPlayerListInfo(String header, String footer) { + if (handle.playerConnection.isDisconnected()) { + return; + } + + IChatBaseComponent headerComponent = header.isEmpty() ? null : CraftChatMessage.fromString(header, true)[0]; + IChatBaseComponent footerComponent = footer.isEmpty() ? null : CraftChatMessage.fromString(footer, true)[0]; + + PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter(); + + Reflect reflect = ReflectionProvider.DEFAULT.getReflect("nmsPacketPlayOutPlayerListHeaderFooter"); + reflect.setFieldValue(packet, "header", headerComponent); + reflect.setFieldValue(packet, "footer", footerComponent); + + handle.playerConnection.sendPacket(packet); + } + + @Override + public void setTitleTimes(int fadeIn, int stay, int fadeOut) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TIMES, null, fadeIn, stay, fadeOut)); + } + + @Override + public void sendSubtitle(String text) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.SUBTITLE, CraftChatMessage.fromString(text)[0])); + } + + @Override + public void sendTitle(String text) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TITLE, CraftChatMessage.fromString(text)[0])); + } + + @Override + public void sendActionBar(String text) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutChat(CraftChatMessage.fromString(text)[0], (byte) 2)); + } + + @Override + public void fakeRespawn() { + if (handle.playerConnection.isDisconnected()) { + return; + } + PacketPlayOutPlayerInfo remInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER, handle); + PacketPlayOutPlayerInfo addInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.ADD_PLAYER, handle); + + PacketPlayOutEntityDestroy destroyPacket = new PacketPlayOutEntityDestroy(handle.getId()); + PacketPlayOutNamedEntitySpawn spawnPacket = new PacketPlayOutNamedEntitySpawn(handle); + PacketPlayOutEntityHeadRotation rotationPacket = new PacketPlayOutEntityHeadRotation(handle, + (byte) MathHelper.d(handle.getHeadRotation() * 256F / 360F)); + + ArrayList equipmentPackets = new ArrayList<>(); + for (int slot = 0; slot < 5; slot++) { + equipmentPackets.add(new PacketPlayOutEntityEquipment(handle.getId(), slot, handle.getEquipment(slot))); + } + + Player self = getBukkitPlayer(); + Player[] players = Players.getOnlineWithout(getUniqueId()); + for (Player player : players) { + if (!player.canSee(self)) { + continue; + } + PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection; + connection.sendPacket(remInfoPacket); + connection.sendPacket(addInfoPacket); + connection.sendPacket(destroyPacket); + connection.sendPacket(spawnPacket); + connection.sendPacket(rotationPacket); + for (PacketPlayOutEntityEquipment equipmentPacket : equipmentPackets) { + connection.sendPacket(equipmentPacket); + } + } + + WorldServer world = (WorldServer) handle.world; + + PacketPlayOutRespawn respawnPacket = new PacketPlayOutRespawn(handle.dimension, world.getDifficulty(), + handle.world.worldData.getType(), handle.playerInteractManager.getGameMode()); + PacketPlayOutPosition positionPacket = new PacketPlayOutPosition(handle.locX, handle.locY, handle.locZ, handle.yaw, handle.pitch, + Collections.emptySet()); + PacketPlayOutHeldItemSlot itemPacket = new PacketPlayOutHeldItemSlot(handle.inventory.itemInHandIndex); + PacketPlayOutEntityStatus statusPacket = new PacketPlayOutEntityStatus(handle, (byte) 28); + PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); + + PlayerConnection connection = handle.playerConnection; + connection.sendPacket(remInfoPacket); + connection.sendPacket(addInfoPacket); + connection.sendPacket(respawnPacket); + connection.sendPacket(positionPacket); + connection.sendPacket(itemPacket); + connection.sendPacket(statusPacket); + connection.sendPacket(metadataPacket); + + handle.updateAbilities(); + handle.triggerHealthUpdate(); + handle.updateInventory(handle.defaultContainer); + if (handle.activeContainer != handle.defaultContainer) { + handle.updateInventory(handle.activeContainer); + } + self.recalculatePermissions(); + } + + @Override + public void respawn() { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayInClientCommand(EnumClientCommand.PERFORM_RESPAWN)); + } + + @Override + public void update() { + update(true); + } + + private final void update(boolean flag) { + PostAsync.forcePost(() -> { + realName = MojangProfileServer.getName(getUniqueId()); + realSkin = MojangProfileServer.getSkin(realName, getUniqueId()); + }); + if (flag) { + GameProfile profile = handle.getProfile(); + + Skin skin = getSkin(); + if (skin != null) { + PropertyMap properties = profile.getProperties(); + properties.removeAll("textures"); + properties.put("textures", new Property("textures", skin.getValue(), skin.getSignature())); + } + + String name = getName(); + if (name != null) { + ReflectionProvider.DEFAULT.getReflect("mjGameProfile").setFieldValue(profile, "name", name); + } + + if (!(name == null && skin == null)) { + fakeRespawn(); + } + } + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/reflection/NmsReflection1_8_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/reflection/NmsReflection1_8_R1.java new file mode 100644 index 0000000..f4b7cba --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/reflection/NmsReflection1_8_R1.java @@ -0,0 +1,34 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R1.reflection; + +import net.minecraft.server.v1_8_R1.NBTTagEnd; +import net.minecraft.server.v1_8_R1.NBTTagList; +import net.minecraft.server.v1_8_R1.PacketPlayOutPlayerListHeaderFooter; +import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; +import net.sourcewriters.minecraft.vcompat.reflection.reflect.Reflections; + +public class NmsReflection1_8_R1 extends Reflections { + + public static NmsReflection1_8_R1 INSTANCE = new NmsReflection1_8_R1(); + + private NmsReflection1_8_R1() {} + + @Override + public void setup(ReflectionProvider provider) { + + // + // + // Create Reflects + // + + // + // Minecraft + + provider.createReflect("nmsPacketPlayOutPlayerListHeaderFooter", PacketPlayOutPlayerListHeaderFooter.class) + .searchField("header", "a").searchField("header", "b"); + + provider.createReflect("nmsNBTTagEnd", NBTTagEnd.class); + provider.createReflect("nmsNBTTagList", NBTTagList.class).searchField("value", "list"); + + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/tools/BlockTools1_8_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/tools/BlockTools1_8_R1.java new file mode 100644 index 0000000..55da3af --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/tools/BlockTools1_8_R1.java @@ -0,0 +1,39 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R1.tools; + +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_8_R1.block.CraftSkull; + +import com.mojang.authlib.properties.Property; +import com.mojang.authlib.properties.PropertyMap; +import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; +import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.minecraft.server.v1_8_R1.TileEntitySkull; +import net.sourcewriters.minecraft.vcompat.reflection.tools.BlockTools; +import net.sourcewriters.minecraft.vcompat.utils.constants.MinecraftConstants; + +public class BlockTools1_8_R1 extends BlockTools { + + private final AbstractReflect craftEntityStateRef = new Reflect(CraftSkull.class).searchField("tileEntity", "tileEntity"); + + @Override + public void setHeadTexture(Block block, String texture) { + if (!(block instanceof CraftSkull)) { + return; + } + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + PropertyMap map = entitySkull.getGameProfile().getProperties(); + map.removeAll("textures"); + map.put("textures", new Property("textures", MinecraftConstants.TEXTURE_SIGNATURE, texture)); + } + + @Override + public String getHeadTexture(Block block) { + if (!(block instanceof CraftSkull)) { + return null; + } + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + return entitySkull.getGameProfile().getProperties().get("textures").iterator().next().getValue(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/tools/ServerTools1_8_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/tools/ServerTools1_8_R1.java new file mode 100644 index 0000000..27ae802 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/tools/ServerTools1_8_R1.java @@ -0,0 +1,26 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R1.tools; + +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_8_R1.CraftServer; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R1.wrapper.ConsoleReaderWrapper1_8_R1; +import net.sourcewriters.minecraft.vcompat.reflection.tools.ServerTools; + +public class ServerTools1_8_R1 extends ServerTools { + + @Override + public void setMotd(String text) { + ((CraftServer) Bukkit.getServer()).getServer().setMotd(text); + } + + @Override + public String getMotd() { + return ((CraftServer) Bukkit.getServer()).getServer().getMotd(); + } + + @Override + public ConsoleReaderWrapper1_8_R1 getConsole() { + return ConsoleReaderWrapper1_8_R1.INSTANCE; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/tools/SkinTools1_8_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/tools/SkinTools1_8_R1.java new file mode 100644 index 0000000..960def5 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/tools/SkinTools1_8_R1.java @@ -0,0 +1,16 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R1.tools; + +import org.bukkit.craftbukkit.v1_8_R1.entity.CraftPlayer; +import org.bukkit.entity.Player; + +import net.sourcewriters.minecraft.vcompat.reflection.tools.SkinTools; +import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; + +public class SkinTools1_8_R1 extends SkinTools { + + @Override + public Skin skinFromPlayer(Player player) { + return skinFromGameProfile(((CraftPlayer) player).getHandle().getProfile()); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/utils/EntityConstructors1_8_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/utils/EntityConstructors1_8_R1.java new file mode 100644 index 0000000..e4c2efe --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/utils/EntityConstructors1_8_R1.java @@ -0,0 +1,12 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R1.utils; + +import java.util.function.Function; + +import net.minecraft.server.v1_8_R1.World; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R1.entity.ArmorStand1_8_R1; + +public abstract class EntityConstructors1_8_R1 { + + public static final Function ARMOR_STAND = (world -> new ArmorStand1_8_R1(world)); + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/wrapper/ConsoleReaderWrapper1_8_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/wrapper/ConsoleReaderWrapper1_8_R1.java new file mode 100644 index 0000000..1167cd5 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/wrapper/ConsoleReaderWrapper1_8_R1.java @@ -0,0 +1,43 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R1.wrapper; + +import java.io.IOException; +import java.io.Writer; + +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_8_R1.CraftServer; +import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; + +import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; + +public final class ConsoleReaderWrapper1_8_R1 extends ConsoleReaderWrapper { + + public static final ConsoleReaderWrapper1_8_R1 INSTANCE = new ConsoleReaderWrapper1_8_R1(); + + private final ConsoleReader reader; + + @SuppressWarnings("resource") + private ConsoleReaderWrapper1_8_R1() { + this.reader = ((CraftServer) Bukkit.getServer()).getServer().reader; + } + + @Override + public Writer getOutput() { + return reader.getOutput(); + } + + @Override + public boolean isAnsiSupported() { + return reader.getTerminal().isAnsiSupported(); + } + + @Override + public void flush() throws IOException { + reader.flush(); + } + + @Override + public void drawLine() throws IOException { + reader.drawLine(); + } + +} diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/BukkitConversion1_8_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/BukkitConversion1_8_R2.java new file mode 100644 index 0000000..7d04a50 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/BukkitConversion1_8_R2.java @@ -0,0 +1,231 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R2; + +import java.util.List; +import java.util.Set; + +import org.bukkit.craftbukkit.v1_8_R2.inventory.CraftItemStack; +import org.bukkit.entity.EntityType; + +import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; +import com.syntaxphoenix.syntaxapi.data.DataType; +import com.syntaxphoenix.syntaxapi.nbt.NbtByte; +import com.syntaxphoenix.syntaxapi.nbt.NbtByteArray; +import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; +import com.syntaxphoenix.syntaxapi.nbt.NbtDouble; +import com.syntaxphoenix.syntaxapi.nbt.NbtEnd; +import com.syntaxphoenix.syntaxapi.nbt.NbtFloat; +import com.syntaxphoenix.syntaxapi.nbt.NbtInt; +import com.syntaxphoenix.syntaxapi.nbt.NbtIntArray; +import com.syntaxphoenix.syntaxapi.nbt.NbtList; +import com.syntaxphoenix.syntaxapi.nbt.NbtLong; +import com.syntaxphoenix.syntaxapi.nbt.NbtLongArray; +import com.syntaxphoenix.syntaxapi.nbt.NbtShort; +import com.syntaxphoenix.syntaxapi.nbt.NbtString; +import com.syntaxphoenix.syntaxapi.nbt.NbtTag; +import com.syntaxphoenix.syntaxapi.nbt.NbtType; + +import net.minecraft.server.v1_8_R2.ItemStack; +import net.minecraft.server.v1_8_R2.NBTBase; +import net.minecraft.server.v1_8_R2.NBTTagByte; +import net.minecraft.server.v1_8_R2.NBTTagByteArray; +import net.minecraft.server.v1_8_R2.NBTTagCompound; +import net.minecraft.server.v1_8_R2.NBTTagDouble; +import net.minecraft.server.v1_8_R2.NBTTagEnd; +import net.minecraft.server.v1_8_R2.NBTTagFloat; +import net.minecraft.server.v1_8_R2.NBTTagInt; +import net.minecraft.server.v1_8_R2.NBTTagIntArray; +import net.minecraft.server.v1_8_R2.NBTTagList; +import net.minecraft.server.v1_8_R2.NBTTagLong; +import net.minecraft.server.v1_8_R2.NBTTagShort; +import net.minecraft.server.v1_8_R2.NBTTagString; +import net.sourcewriters.minecraft.vcompat.reflection.BukkitConversion; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContext; +import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleWrapType; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; +import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; + +public class BukkitConversion1_8_R2 extends BukkitConversion { + + protected BukkitConversion1_8_R2(VersionControl1_8_R2 versionControl) { + super(versionControl); + } + + @Override + public EntityType toEntityType(NmsEntityType type) { + try { + return EntityType.valueOf(type.name()); + } catch (IllegalArgumentException ignore) { + return null; + } + } + + @Override + public NmsEntityType fromEntityType(EntityType type) { + try { + return NmsEntityType.valueOf(type.name()); + } catch (IllegalArgumentException ignore) { + return null; + } + } + + @Override + public NBTBase toMinecraftTag(NbtTag tag) { + switch (tag.getType()) { + case BYTE: + return new NBTTagByte((byte) tag.getValue()); + case SHORT: + return new NBTTagShort((short) tag.getValue()); + case INT: + return new NBTTagInt((int) tag.getValue()); + case LONG: + return new NBTTagLong((long) tag.getValue()); + case FLOAT: + return new NBTTagFloat((float) tag.getValue()); + case DOUBLE: + return new NBTTagDouble((double) tag.getValue()); + case STRING: + return new NBTTagString((String) tag.getValue()); + case BYTE_ARRAY: + return new NBTTagByteArray((byte[]) tag.getValue()); + case INT_ARRAY: + return new NBTTagIntArray((int[]) tag.getValue()); + case LONG_ARRAY: + NBTTagList list = new NBTTagList(); + for (long value : (long[]) tag.getValue()) { + list.add(new NBTTagLong(value)); + } + return list; + case LIST: + return toMinecraftList((NbtList) tag); + case COMPOUND: + return toMinecraftCompound((NbtCompound) tag); + case END: + return (NBTTagEnd) ReflectionProvider.DEFAULT.getReflect("nmsNBTTagEnd").init(); + default: + return null; + } + } + + @Override + public NbtTag fromMinecraftTag(Object raw) { + if (!(raw instanceof NBTBase)) { + return null; + } + NBTBase tag = (NBTBase) raw; + NbtType type = NbtType.getById(tag.getTypeId()); + switch (type) { + case BYTE: + return new NbtByte(((NBTTagByte) tag).f()); + case SHORT: + return new NbtShort(((NBTTagShort) tag).e()); + case INT: + return new NbtInt(((NBTTagInt) tag).d()); + case LONG: + return new NbtLong(((NBTTagLong) tag).c()); + case FLOAT: + return new NbtFloat(((NBTTagFloat) tag).h()); + case DOUBLE: + return new NbtDouble(((NBTTagDouble) tag).g()); + case STRING: + return new NbtString(((NBTTagString) tag).a_()); + case BYTE_ARRAY: + return new NbtByteArray(((NBTTagByteArray) tag).c()); + case INT_ARRAY: + return new NbtIntArray(((NBTTagIntArray) tag).c()); + case LONG_ARRAY: + return new NbtLongArray(new long[0]); + case LIST: + return fromMinecraftList(tag); + case COMPOUND: + return fromMinecraftCompound(tag); + case END: + return NbtEnd.INSTANCE; + default: + return null; + } + } + + @Override + public NBTTagList toMinecraftList(NbtList list) { + NBTTagList output = new NBTTagList(); + for (NbtTag tag : list) { + output.add(toMinecraftTag(tag)); + } + return output; + } + + @SuppressWarnings("unchecked") + @Override + public NbtList fromMinecraftList(Object raw) { + if (!(raw instanceof NBTTagList)) { + return null; + } + NBTTagList list = (NBTTagList) raw; + List content = (List) ReflectionProvider.DEFAULT.getReflect("nmsNBTTagList").getFieldValue("value", list); + NbtList output = new NbtList<>(NbtType.getById(list.getTypeId())); + for (NBTBase base : content) { + output.add(fromMinecraftTag(base)); + } + return output; + } + + @Override + public NBTTagCompound toMinecraftCompound(NbtCompound compound) { + NBTTagCompound output = new NBTTagCompound(); + if (compound.isEmpty()) { + return output; + } + Set keys = compound.getKeys(); + for (String key : keys) { + output.set(key, toMinecraftTag(compound.get(key))); + } + return output; + } + + @Override + public NbtCompound fromMinecraftCompound(Object raw) { + if (!(raw instanceof NBTTagCompound)) { + return null; + } + NBTTagCompound compound = (NBTTagCompound) raw; + NbtCompound output = new NbtCompound(); + if (compound.isEmpty()) { + return output; + } + Set keys = compound.c(); + for (String key : keys) { + output.set(key, fromMinecraftTag(compound.get(key))); + } + return output; + } + + @Override + public org.bukkit.inventory.ItemStack itemFromCompound(NbtCompound compound) { + return CraftItemStack.asBukkitCopy(ItemStack.createStack(toMinecraftCompound(compound))); + } + + @Override + public NbtCompound itemToCompound(org.bukkit.inventory.ItemStack itemStack) { + ItemStack nmsStack = CraftItemStack.asNMSCopy(itemStack); + NBTTagCompound stackTag; + if (!nmsStack.hasTag()) { + stackTag = nmsStack.save(new NBTTagCompound()); + } else { + stackTag = nmsStack.getTag(); + } + return fromMinecraftCompound(stackTag); + } + + @Override + public WrappedContext createContext(DataAdapterContext context) { + return new SimpleSyntaxContext(context); + } + + @Override + public WrapType wrap(DataType dataType) { + return new SimpleWrapType(dataType); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/EntityProvider1_8_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/EntityProvider1_8_R2.java new file mode 100644 index 0000000..5685a2a --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/EntityProvider1_8_R2.java @@ -0,0 +1,47 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R2; + +import java.util.EnumMap; +import java.util.function.Function; + +import org.bukkit.craftbukkit.v1_8_R2.CraftWorld; + +import net.minecraft.server.v1_8_R2.World; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R2.utils.EntityConstructors1_8_R2; +import net.sourcewriters.minecraft.vcompat.reflection.EntityProvider; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; + +public class EntityProvider1_8_R2 extends EntityProvider { + + private final EnumMap> entityMap = new EnumMap<>(NmsEntityType.class); + + protected EntityProvider1_8_R2(VersionControl1_8_R2 versionControl) { + super(versionControl); + } + + @SuppressWarnings("unchecked") + private final Function searchConstructor(NmsEntityType type) { + try { + return (Function) EntityConstructors1_8_R2.class.getField(type.name()).get(null); + } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException ignore) { + return null; + } + } + + private final Function getConstructor(NmsEntityType type) { + return entityMap.computeIfAbsent(type, (key -> searchConstructor(key))); + } + + @Override + public NmsEntity createEntity(org.bukkit.World world, NmsEntityType type) { + if (!(world instanceof CraftWorld)) { + return null; + } + Function function; + if ((function = getConstructor(type)) == null) { + return null; + } + return function.apply(((CraftWorld) world).getHandle()); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/PacketHandler1_8_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/PacketHandler1_8_R2.java new file mode 100644 index 0000000..cf2113d --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/PacketHandler1_8_R2.java @@ -0,0 +1,11 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R2; + +import net.sourcewriters.minecraft.vcompat.reflection.PacketHandler; + +public class PacketHandler1_8_R2 extends PacketHandler { + + protected PacketHandler1_8_R2(VersionControl1_8_R2 versionControl) { + super(versionControl); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/PlayerProvider1_8_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/PlayerProvider1_8_R2.java new file mode 100644 index 0000000..2bd325b --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/PlayerProvider1_8_R2.java @@ -0,0 +1,30 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R2; + +import java.io.File; +import java.util.UUID; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R2.entity.Player1_8_R2; +import net.sourcewriters.minecraft.vcompat.reflection.DataProvider; +import net.sourcewriters.minecraft.vcompat.reflection.PlayerProvider; +import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.DataDistributor; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; + +public class PlayerProvider1_8_R2 extends PlayerProvider { + + private final DataDistributor distributor; + + protected PlayerProvider1_8_R2(VersionControl1_8_R2 versionControl) { + super(versionControl); + distributor = versionControl.getDataProvider().createDistributor(new File(Bukkit.getWorlds().get(0).getWorldFolder(), "playerdata"), + uuid -> "custom_" + uuid.toString(), DataProvider.DEFAULT_RANDOM); + } + + @Override + protected NmsPlayer createPlayer(Player player) { + return new Player1_8_R2(player, distributor.get(player.getUniqueId())); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/TextureProvider1_8_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/TextureProvider1_8_R2.java new file mode 100644 index 0000000..7fbf11e --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/TextureProvider1_8_R2.java @@ -0,0 +1,105 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R2; + +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_8_R2.block.CraftSkull; +import org.bukkit.craftbukkit.v1_8_R2.inventory.CraftItemStack; +import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.inventory.meta.SkullMeta; +import org.bukkit.material.MaterialData; + +import com.mojang.authlib.GameProfile; +import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; +import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.minecraft.server.v1_8_R2.GameProfileSerializer; +import net.minecraft.server.v1_8_R2.ItemStack; +import net.minecraft.server.v1_8_R2.NBTTagCompound; +import net.sourcewriters.minecraft.vcompat.reflection.TextureProvider; + +@SuppressWarnings("deprecation") +public class TextureProvider1_8_R2 extends TextureProvider { + + private final AbstractReflect craftItemStackRef = new Reflect(CraftItemStack.class).searchField("handle", "handle"); + private final AbstractReflect craftMetaSkullRef = new Reflect("org.bukkit.craftbukkit.v1_8_R2.inventory.CraftMetaSkull") + .searchField("serialized", "serializedProfile").searchField("profile", "profile"); + private final Material skullMaterial = Material.valueOf("SKULL"); + + protected TextureProvider1_8_R2(VersionControl1_8_R2 versionControl) { + super(versionControl); + } + + @Override + public GameProfile profileFromBlock(Block block) { + if (!(block instanceof CraftSkull)) { + return null; + } + return ((CraftSkull) block).getTileEntity().getGameProfile(); + } + + @Override + public GameProfile profileFromItem(org.bukkit.inventory.ItemStack itemStack) { + if (!(itemStack.getItemMeta() instanceof SkullMeta)) { + return null; + } + SkullMeta meta = (SkullMeta) itemStack.getItemMeta(); + GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue("profile", meta); + if (profile == null) { + NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue("serialized", meta); + if (compound == null) { + ItemStack stack = null; + if (itemStack instanceof CraftItemStack) { + stack = (ItemStack) craftItemStackRef.getFieldValue("handle", itemStack); + } + if (stack == null) { + stack = CraftItemStack.asNMSCopy(itemStack); + } + NBTTagCompound stackTag; + if (!stack.hasTag()) { + stackTag = stack.save(new NBTTagCompound()); + } else { + stackTag = stack.getTag(); + } + if (stackTag.hasKeyOfType("SkullOwner", 10)) { + compound = stackTag.getCompound("SkullOwner"); + } else if (stackTag.hasKeyOfType("SkullProfile", 10)) { + compound = stackTag.getCompound("SkullProfile"); + } + } + if (compound == null) { + return null; + } + profile = GameProfileSerializer.deserialize(compound); + } + return profile; + } + + @Override + public org.bukkit.inventory.ItemStack getItem(GameProfile profile) { + org.bukkit.inventory.ItemStack craftStack = CraftItemStack.asCraftCopy(new MaterialData(skullMaterial, (byte) 3).toItemStack(1)); + applyItem(craftStack, profile); + return craftStack; + } + + @Override + public boolean applyItem(org.bukkit.inventory.ItemStack itemStack, GameProfile profile) { + ItemMeta meta = itemStack.getItemMeta(); + if (!(meta instanceof SkullMeta)) { + return false; + } + SkullMeta skullMeta = (SkullMeta) meta; + craftMetaSkullRef.setFieldValue(meta, "profile", profile); + itemStack.setItemMeta(skullMeta); + return true; + } + + @Override + public boolean applyBlock(Block block, GameProfile profile) { + if (!(block instanceof CraftSkull)) { + return false; + } + ((CraftSkull) block).getTileEntity().setGameProfile(profile); + return true; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/ToolProvider1_8_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/ToolProvider1_8_R2.java new file mode 100644 index 0000000..49ae726 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/ToolProvider1_8_R2.java @@ -0,0 +1,33 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R2; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R2.tools.BlockTools1_8_R2; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R2.tools.ServerTools1_8_R2; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R2.tools.SkinTools1_8_R2; +import net.sourcewriters.minecraft.vcompat.reflection.ToolProvider; + +public class ToolProvider1_8_R2 extends ToolProvider { + + private final BlockTools1_8_R2 blockTools = new BlockTools1_8_R2(); + private final SkinTools1_8_R2 skinTools = new SkinTools1_8_R2(); + private final ServerTools1_8_R2 serverTools = new ServerTools1_8_R2(); + + protected ToolProvider1_8_R2(VersionControl1_8_R2 versionControl) { + super(versionControl); + } + + @Override + public SkinTools1_8_R2 getSkinTools() { + return skinTools; + } + + @Override + public ServerTools1_8_R2 getServerTools() { + return serverTools; + } + + @Override + public BlockTools1_8_R2 getBlockTools() { + return blockTools; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/VersionControl1_8_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/VersionControl1_8_R2.java new file mode 100644 index 0000000..f287999 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/VersionControl1_8_R2.java @@ -0,0 +1,56 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R2; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R2.reflection.NmsReflection1_8_R2; +import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; +import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; + +public class VersionControl1_8_R2 extends VersionControl { + + public static VersionControl1_8_R2 INSTANCE; + + public static VersionControl1_8_R2 init() { + return INSTANCE != null ? INSTANCE : (INSTANCE = new VersionControl1_8_R2()); + } + + private final ToolProvider1_8_R2 toolProvider = new ToolProvider1_8_R2(this); + private final TextureProvider1_8_R2 textureProvider = new TextureProvider1_8_R2(this); + private final PacketHandler1_8_R2 packetHandler = new PacketHandler1_8_R2(this); + private final EntityProvider1_8_R2 entityProvider = new EntityProvider1_8_R2(this); + private final PlayerProvider1_8_R2 playerProvider = new PlayerProvider1_8_R2(this); + private final BukkitConversion1_8_R2 bukkitConversion = new BukkitConversion1_8_R2(this); + + private VersionControl1_8_R2() { + NmsReflection1_8_R2.INSTANCE.setup(ReflectionProvider.DEFAULT); + } + + @Override + public ToolProvider1_8_R2 getToolProvider() { + return toolProvider; + } + + @Override + public EntityProvider1_8_R2 getEntityProvider() { + return entityProvider; + } + + @Override + public PlayerProvider1_8_R2 getPlayerProvider() { + return playerProvider; + } + + @Override + public TextureProvider1_8_R2 getTextureProvider() { + return textureProvider; + } + + @Override + public PacketHandler1_8_R2 getPacketHandler() { + return packetHandler; + } + + @Override + public BukkitConversion1_8_R2 getBukkitConversion() { + return bukkitConversion; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/entity/ArmorStand1_8_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/entity/ArmorStand1_8_R2.java new file mode 100644 index 0000000..0904d5a --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/entity/ArmorStand1_8_R2.java @@ -0,0 +1,33 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R2.entity; + +import net.minecraft.server.v1_8_R2.EntityArmorStand; +import net.minecraft.server.v1_8_R2.World; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsArmorStand; + +public class ArmorStand1_8_R2 extends EntityLiving1_8_R2 implements NmsArmorStand { + + public ArmorStand1_8_R2(World world) { + super(new EntityArmorStand(world)); + } + + @Override + public boolean hasGravity() { + return handle.hasGravity(); + } + + @Override + public void setGravity(boolean gravity) { + handle.setGravity(gravity); + } + + @Override + public void setSmall(boolean small) { + handle.setSmall(small); + } + + @Override + public boolean isSmall() { + return handle.isSmall(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/entity/Entity1_8_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/entity/Entity1_8_R2.java new file mode 100644 index 0000000..888a495 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/entity/Entity1_8_R2.java @@ -0,0 +1,213 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R2.entity; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.UUID; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.OfflinePlayer; +import org.bukkit.craftbukkit.v1_8_R2.CraftWorld; +import org.bukkit.craftbukkit.v1_8_R2.entity.CraftPlayer; +import org.bukkit.entity.Player; + +import net.minecraft.server.v1_8_R2.AxisAlignedBB; +import net.minecraft.server.v1_8_R2.Entity; +import net.minecraft.server.v1_8_R2.EntityTypes; +import net.minecraft.server.v1_8_R2.PacketPlayOutEntityDestroy; +import net.minecraft.server.v1_8_R2.PacketPlayOutEntityMetadata; +import net.minecraft.server.v1_8_R2.PacketPlayOutSpawnEntity; +import net.minecraft.server.v1_8_R2.PlayerConnection; +import net.minecraft.server.v1_8_R2.Vec3D; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.reflection.utils.NmsBoundingBox; + +public abstract class Entity1_8_R2 implements NmsEntity { + + protected final E handle; + + protected final List visible = Collections.synchronizedList(new ArrayList<>()); + + public Entity1_8_R2(E handle) { + this.handle = handle; + } + + @Override + public final E getHandle() { + return handle; + } + + @Override + public int getId() { + return handle.getId(); + } + + @Override + public UUID getUniqueId() { + return handle.getUniqueID(); + } + + @Override + public NmsBoundingBox getBoundingBox() { + AxisAlignedBB box = handle.getBoundingBox(); + return new NmsBoundingBox(box.a, box.b, box.c, box.d, box.e, box.f); + } + + @Override + public void setCustomName(String name) { + handle.setCustomName(name); + updateVisibility(); + } + + @Override + public String getCustomName() { + return handle.getCustomName(); + } + + @Override + public void setCustomNameVisible(boolean visible) { + handle.setCustomNameVisible(visible); + } + + @Override + public boolean isCustomNameVisible() { + return handle.getCustomNameVisible(); + } + + @Override + public void setInvisible(boolean invisible) { + handle.setInvisible(invisible); + } + + @Override + public boolean isInvisible() { + return handle.isInvisible(); + } + + @Override + public boolean isInteractable() { + return handle.ad(); + } + + @Override + public boolean isCollidable() { + return handle.ae(); + } + + @Override + public void setInvulnerable(boolean invulnerable) { + handle.h(invulnerable); + } + + @Override + public boolean isInvulnerable() { + return handle.isInvulnerable(null); + } + + @Override + public boolean hasGravity() { + return true; + } + + @Override + public void setGravity(boolean gravity) {} + + @Override + public void setLocation(Location location) { + handle.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); + if (location.getWorld() == null || handle.getWorld().getWorld() == location.getWorld()) { + updateVisibility(); + return; + } + handle.world = ((CraftWorld) location.getWorld()).getHandle(); + updateVisibility(); + } + + @Override + public Location getLocation() { + Vec3D vector = handle.d(); + return new Location(handle.getWorld().getWorld(), vector.a, vector.b, vector.c); + } + + @Override + public void updateVisibility() { + if (visible.isEmpty()) { + return; + } + Player[] players; + synchronized (visible) { + players = visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) + .toArray(Player[]::new); + } + hide(players); + show(players); + } + + @Override + public boolean isShown(Player player) { + synchronized (visible) { + return visible.contains(player.getUniqueId()); + } + } + + @Override + public void hide(Player... players) { + if (players.length == 0) { + return; + } + PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(handle.getId()); + for (Player player : players) { + if (!isShown(player)) { + continue; + } + ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); + synchronized (visible) { + visible.remove(player.getUniqueId()); + } + } + } + + @Override + public void show(Player... players) { + if (players.length == 0) { + return; + } + PacketPlayOutSpawnEntity packet = new PacketPlayOutSpawnEntity(handle, EntityTypes.a(handle)); + PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); + PlayerConnection connection; + for (Player player : players) { + if (isShown(player)) { + continue; + } + connection = ((CraftPlayer) player).getHandle().playerConnection; + connection.sendPacket(packet); + connection.sendPacket(metadataPacket); + synchronized (visible) { + visible.add(player.getUniqueId()); + } + } + } + + @Override + public UUID[] getVisible() { + synchronized (visible) { + return visible.toArray(new UUID[0]); + } + } + + @Override + public Player[] getVisibleAsPlayer() { + synchronized (visible) { + return visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) + .toArray(Player[]::new); + } + } + + @Override + public void kill() { + hide(getVisibleAsPlayer()); + handle.die(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/entity/EntityLiving1_8_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/entity/EntityLiving1_8_R2.java new file mode 100644 index 0000000..b6bfa8d --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/entity/EntityLiving1_8_R2.java @@ -0,0 +1,17 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R2.entity; + +import net.minecraft.server.v1_8_R2.EntityLiving; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityLiving; + +public abstract class EntityLiving1_8_R2 extends Entity1_8_R2 implements NmsEntityLiving { + + public EntityLiving1_8_R2(E handle) { + super(handle); + } + + @Override + public void setCollidable(boolean collidable) { + + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/entity/Player1_8_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/entity/Player1_8_R2.java new file mode 100644 index 0000000..3c95884 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/entity/Player1_8_R2.java @@ -0,0 +1,295 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R2.entity; + +import java.util.ArrayList; +import java.util.Collections; + +import org.bukkit.craftbukkit.v1_8_R2.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R2.util.CraftChatMessage; +import org.bukkit.entity.Player; + +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.properties.Property; +import com.mojang.authlib.properties.PropertyMap; +import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.minecraft.server.v1_8_R2.EntityPlayer; +import net.minecraft.server.v1_8_R2.IChatBaseComponent; +import net.minecraft.server.v1_8_R2.MathHelper; +import net.minecraft.server.v1_8_R2.PacketPlayInClientCommand; +import net.minecraft.server.v1_8_R2.PacketPlayInClientCommand.EnumClientCommand; +import net.minecraft.server.v1_8_R2.PacketPlayOutChat; +import net.minecraft.server.v1_8_R2.PacketPlayOutEntityDestroy; +import net.minecraft.server.v1_8_R2.PacketPlayOutEntityEquipment; +import net.minecraft.server.v1_8_R2.PacketPlayOutEntityHeadRotation; +import net.minecraft.server.v1_8_R2.PacketPlayOutEntityMetadata; +import net.minecraft.server.v1_8_R2.PacketPlayOutEntityStatus; +import net.minecraft.server.v1_8_R2.PacketPlayOutHeldItemSlot; +import net.minecraft.server.v1_8_R2.PacketPlayOutNamedEntitySpawn; +import net.minecraft.server.v1_8_R2.PacketPlayOutPlayerInfo; +import net.minecraft.server.v1_8_R2.PacketPlayOutPlayerInfo.EnumPlayerInfoAction; +import net.minecraft.server.v1_8_R2.PacketPlayOutPlayerListHeaderFooter; +import net.minecraft.server.v1_8_R2.PacketPlayOutPosition; +import net.minecraft.server.v1_8_R2.PacketPlayOutRespawn; +import net.minecraft.server.v1_8_R2.PacketPlayOutTitle; +import net.minecraft.server.v1_8_R2.PacketPlayOutTitle.EnumTitleAction; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.PersistentContainer; +import net.sourcewriters.minecraft.vcompat.reflection.data.type.SkinDataType; +import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContainer; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; +import net.sourcewriters.minecraft.vcompat.utils.bukkit.Players; +import net.sourcewriters.minecraft.vcompat.utils.minecraft.MojangProfileServer; +import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; +import net.sourcewriters.minecraft.vcompat.utils.thread.PostAsync; +import net.minecraft.server.v1_8_R2.PlayerConnection; +import net.minecraft.server.v1_8_R2.WorldServer; + +public class Player1_8_R2 extends EntityLiving1_8_R2 implements NmsPlayer { + + private String realName; + private Skin realSkin; + + private final WrappedContainer dataAdapter; + + public Player1_8_R2(Player player, PersistentContainer container) { + super(((CraftPlayer) player).getHandle()); + this.dataAdapter = new SimpleSyntaxContainer<>(container); + update(false); + } + + @Override + public CraftPlayer getBukkitPlayer() { + return handle.getBukkitEntity(); + } + + @Override + public WrappedContainer getDataAdapter() { + return dataAdapter; + } + + @Override + public void setSkin(Skin skin) { + if (skin == null || getSkin().equals(skin)) { + return; + } + getDataAdapter().set("skin", skin, SkinDataType.WRAPPED_INSTANCE); + } + + @Override + public Skin getSkin() { + return dataAdapter.getOrDefault("skin", SkinDataType.WRAPPED_INSTANCE, realSkin); + } + + @Override + public Skin getRealSkin() { + return realSkin; + } + + @Override + public void setName(String name) { + if (getName().equals(name)) { + return; + } + if (name == null) { + getDataAdapter().remove("name"); + return; + } + getDataAdapter().set("name", name, WrapType.STRING); + } + + @Override + public String getName() { + return getDataAdapter().getOrDefault("name", WrapType.STRING, realName); + } + + @Override + public String getRealName() { + return realName; + } + + @Override + public void setPlayerListHeader(String text) { + setPlayerListHeaderAndFooter(text, getPlayerListFooter()); + } + + @Override + public String getPlayerListHeader() { + return getDataAdapter().getOrDefault("header", WrapType.STRING, ""); + } + + @Override + public void setPlayerListFooter(String text) { + setPlayerListHeaderAndFooter(getPlayerListHeader(), text); + } + + @Override + public String getPlayerListFooter() { + return getDataAdapter().getOrDefault("footer", WrapType.STRING, ""); + } + + @Override + public int getPing() { + return handle.ping; + } + + @Override + public void setPlayerListHeaderAndFooter(String header, String footer) { + getDataAdapter().set("header", header, WrapType.STRING); + getDataAdapter().set("footer", footer, WrapType.STRING); + sendPlayerListInfo(header, footer); + } + + private final void sendPlayerListInfo(String header, String footer) { + if (handle.playerConnection.isDisconnected()) { + return; + } + + IChatBaseComponent headerComponent = header.isEmpty() ? null : CraftChatMessage.fromString(header, true)[0]; + IChatBaseComponent footerComponent = footer.isEmpty() ? null : CraftChatMessage.fromString(footer, true)[0]; + + PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter(); + + Reflect reflect = ReflectionProvider.DEFAULT.getReflect("nmsPacketPlayOutPlayerListHeaderFooter"); + reflect.setFieldValue(packet, "header", headerComponent); + reflect.setFieldValue(packet, "footer", footerComponent); + + handle.playerConnection.sendPacket(packet); + } + + @Override + public void setTitleTimes(int fadeIn, int stay, int fadeOut) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TIMES, null, fadeIn, stay, fadeOut)); + } + + @Override + public void sendSubtitle(String text) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.SUBTITLE, CraftChatMessage.fromString(text)[0])); + } + + @Override + public void sendTitle(String text) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TITLE, CraftChatMessage.fromString(text)[0])); + } + + @Override + public void sendActionBar(String text) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutChat(CraftChatMessage.fromString(text)[0], (byte) 2)); + } + + @Override + public void fakeRespawn() { + if (handle.playerConnection.isDisconnected()) { + return; + } + PacketPlayOutPlayerInfo remInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER, handle); + PacketPlayOutPlayerInfo addInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.ADD_PLAYER, handle); + + PacketPlayOutEntityDestroy destroyPacket = new PacketPlayOutEntityDestroy(handle.getId()); + PacketPlayOutNamedEntitySpawn spawnPacket = new PacketPlayOutNamedEntitySpawn(handle); + PacketPlayOutEntityHeadRotation rotationPacket = new PacketPlayOutEntityHeadRotation(handle, + (byte) MathHelper.d(handle.getHeadRotation() * 256F / 360F)); + + ArrayList equipmentPackets = new ArrayList<>(); + for (int slot = 0; slot < 5; slot++) { + equipmentPackets.add(new PacketPlayOutEntityEquipment(handle.getId(), slot, handle.getEquipment(slot))); + } + + Player self = getBukkitPlayer(); + Player[] players = Players.getOnlineWithout(getUniqueId()); + for (Player player : players) { + if (!player.canSee(self)) { + continue; + } + PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection; + connection.sendPacket(remInfoPacket); + connection.sendPacket(addInfoPacket); + connection.sendPacket(destroyPacket); + connection.sendPacket(spawnPacket); + connection.sendPacket(rotationPacket); + for (PacketPlayOutEntityEquipment equipmentPacket : equipmentPackets) { + connection.sendPacket(equipmentPacket); + } + } + + WorldServer world = (WorldServer) handle.world; + + PacketPlayOutRespawn respawnPacket = new PacketPlayOutRespawn(handle.dimension, world.getDifficulty(), + handle.world.worldData.getType(), handle.playerInteractManager.getGameMode()); + PacketPlayOutPosition positionPacket = new PacketPlayOutPosition(handle.locX, handle.locY, handle.locZ, handle.yaw, handle.pitch, + Collections.emptySet()); + PacketPlayOutHeldItemSlot itemPacket = new PacketPlayOutHeldItemSlot(handle.inventory.itemInHandIndex); + PacketPlayOutEntityStatus statusPacket = new PacketPlayOutEntityStatus(handle, (byte) 28); + PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); + + PlayerConnection connection = handle.playerConnection; + connection.sendPacket(remInfoPacket); + connection.sendPacket(addInfoPacket); + connection.sendPacket(respawnPacket); + connection.sendPacket(positionPacket); + connection.sendPacket(itemPacket); + connection.sendPacket(statusPacket); + connection.sendPacket(metadataPacket); + + handle.updateAbilities(); + handle.triggerHealthUpdate(); + handle.updateInventory(handle.defaultContainer); + if (handle.activeContainer != handle.defaultContainer) { + handle.updateInventory(handle.activeContainer); + } + self.recalculatePermissions(); + } + + @Override + public void respawn() { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayInClientCommand(EnumClientCommand.PERFORM_RESPAWN)); + } + + @Override + public void update() { + update(true); + } + + private final void update(boolean flag) { + PostAsync.forcePost(() -> { + realName = MojangProfileServer.getName(getUniqueId()); + realSkin = MojangProfileServer.getSkin(realName, getUniqueId()); + }); + if (flag) { + GameProfile profile = handle.getProfile(); + + Skin skin = getSkin(); + if (skin != null) { + PropertyMap properties = profile.getProperties(); + properties.removeAll("textures"); + properties.put("textures", new Property("textures", skin.getValue(), skin.getSignature())); + } + + String name = getName(); + if (name != null) { + ReflectionProvider.DEFAULT.getReflect("mjGameProfile").setFieldValue(profile, "name", name); + } + + if (!(name == null && skin == null)) { + fakeRespawn(); + } + } + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/reflection/NmsReflection1_8_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/reflection/NmsReflection1_8_R2.java new file mode 100644 index 0000000..4f4e10d --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/reflection/NmsReflection1_8_R2.java @@ -0,0 +1,34 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R2.reflection; + +import net.minecraft.server.v1_8_R2.NBTTagEnd; +import net.minecraft.server.v1_8_R2.NBTTagList; +import net.minecraft.server.v1_8_R2.PacketPlayOutPlayerListHeaderFooter; +import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; +import net.sourcewriters.minecraft.vcompat.reflection.reflect.Reflections; + +public class NmsReflection1_8_R2 extends Reflections { + + public static NmsReflection1_8_R2 INSTANCE = new NmsReflection1_8_R2(); + + private NmsReflection1_8_R2() {} + + @Override + public void setup(ReflectionProvider provider) { + + // + // + // Create Reflects + // + + // + // Minecraft + + provider.createReflect("nmsPacketPlayOutPlayerListHeaderFooter", PacketPlayOutPlayerListHeaderFooter.class) + .searchField("header", "a").searchField("header", "b"); + + provider.createReflect("nmsNBTTagEnd", NBTTagEnd.class); + provider.createReflect("nmsNBTTagList", NBTTagList.class).searchField("value", "list"); + + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/tools/BlockTools1_8_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/tools/BlockTools1_8_R2.java new file mode 100644 index 0000000..5fbde74 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/tools/BlockTools1_8_R2.java @@ -0,0 +1,39 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R2.tools; + +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_8_R2.block.CraftSkull; + +import com.mojang.authlib.properties.Property; +import com.mojang.authlib.properties.PropertyMap; +import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; +import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.minecraft.server.v1_8_R2.TileEntitySkull; +import net.sourcewriters.minecraft.vcompat.reflection.tools.BlockTools; +import net.sourcewriters.minecraft.vcompat.utils.constants.MinecraftConstants; + +public class BlockTools1_8_R2 extends BlockTools { + + private final AbstractReflect craftEntityStateRef = new Reflect(CraftSkull.class).searchField("tileEntity", "tileEntity"); + + @Override + public void setHeadTexture(Block block, String texture) { + if (!(block instanceof CraftSkull)) { + return; + } + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + PropertyMap map = entitySkull.getGameProfile().getProperties(); + map.removeAll("textures"); + map.put("textures", new Property("textures", MinecraftConstants.TEXTURE_SIGNATURE, texture)); + } + + @Override + public String getHeadTexture(Block block) { + if (!(block instanceof CraftSkull)) { + return null; + } + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + return entitySkull.getGameProfile().getProperties().get("textures").iterator().next().getValue(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/tools/ServerTools1_8_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/tools/ServerTools1_8_R2.java new file mode 100644 index 0000000..9bfff0c --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/tools/ServerTools1_8_R2.java @@ -0,0 +1,26 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R2.tools; + +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_8_R2.CraftServer; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R2.wrapper.ConsoleReaderWrapper1_8_R2; +import net.sourcewriters.minecraft.vcompat.reflection.tools.ServerTools; + +public class ServerTools1_8_R2 extends ServerTools { + + @Override + public void setMotd(String text) { + ((CraftServer) Bukkit.getServer()).getServer().setMotd(text); + } + + @Override + public String getMotd() { + return ((CraftServer) Bukkit.getServer()).getServer().getMotd(); + } + + @Override + public ConsoleReaderWrapper1_8_R2 getConsole() { + return ConsoleReaderWrapper1_8_R2.INSTANCE; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/tools/SkinTools1_8_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/tools/SkinTools1_8_R2.java new file mode 100644 index 0000000..e103e33 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/tools/SkinTools1_8_R2.java @@ -0,0 +1,16 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R2.tools; + +import org.bukkit.craftbukkit.v1_8_R2.entity.CraftPlayer; +import org.bukkit.entity.Player; + +import net.sourcewriters.minecraft.vcompat.reflection.tools.SkinTools; +import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; + +public class SkinTools1_8_R2 extends SkinTools { + + @Override + public Skin skinFromPlayer(Player player) { + return skinFromGameProfile(((CraftPlayer) player).getHandle().getProfile()); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/utils/EntityConstructors1_8_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/utils/EntityConstructors1_8_R2.java new file mode 100644 index 0000000..ef8be73 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/utils/EntityConstructors1_8_R2.java @@ -0,0 +1,12 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R2.utils; + +import java.util.function.Function; + +import net.minecraft.server.v1_8_R2.World; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R2.entity.ArmorStand1_8_R2; + +public abstract class EntityConstructors1_8_R2 { + + public static final Function ARMOR_STAND = (world -> new ArmorStand1_8_R2(world)); + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/wrapper/ConsoleReaderWrapper1_8_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/wrapper/ConsoleReaderWrapper1_8_R2.java new file mode 100644 index 0000000..78278bb --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/wrapper/ConsoleReaderWrapper1_8_R2.java @@ -0,0 +1,43 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R2.wrapper; + +import java.io.IOException; +import java.io.Writer; + +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_8_R2.CraftServer; +import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; + +import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; + +public final class ConsoleReaderWrapper1_8_R2 extends ConsoleReaderWrapper { + + public static final ConsoleReaderWrapper1_8_R2 INSTANCE = new ConsoleReaderWrapper1_8_R2(); + + private final ConsoleReader reader; + + @SuppressWarnings("resource") + private ConsoleReaderWrapper1_8_R2() { + this.reader = ((CraftServer) Bukkit.getServer()).getServer().reader; + } + + @Override + public Writer getOutput() { + return reader.getOutput(); + } + + @Override + public boolean isAnsiSupported() { + return reader.getTerminal().isAnsiSupported(); + } + + @Override + public void flush() throws IOException { + reader.flush(); + } + + @Override + public void drawLine() throws IOException { + reader.drawLine(); + } + +} diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/BukkitConversion1_8_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/BukkitConversion1_8_R3.java new file mode 100644 index 0000000..23ee751 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/BukkitConversion1_8_R3.java @@ -0,0 +1,231 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R3; + +import java.util.List; +import java.util.Set; + +import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack; +import org.bukkit.entity.EntityType; + +import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; +import com.syntaxphoenix.syntaxapi.data.DataType; +import com.syntaxphoenix.syntaxapi.nbt.NbtByte; +import com.syntaxphoenix.syntaxapi.nbt.NbtByteArray; +import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; +import com.syntaxphoenix.syntaxapi.nbt.NbtDouble; +import com.syntaxphoenix.syntaxapi.nbt.NbtEnd; +import com.syntaxphoenix.syntaxapi.nbt.NbtFloat; +import com.syntaxphoenix.syntaxapi.nbt.NbtInt; +import com.syntaxphoenix.syntaxapi.nbt.NbtIntArray; +import com.syntaxphoenix.syntaxapi.nbt.NbtList; +import com.syntaxphoenix.syntaxapi.nbt.NbtLong; +import com.syntaxphoenix.syntaxapi.nbt.NbtLongArray; +import com.syntaxphoenix.syntaxapi.nbt.NbtShort; +import com.syntaxphoenix.syntaxapi.nbt.NbtString; +import com.syntaxphoenix.syntaxapi.nbt.NbtTag; +import com.syntaxphoenix.syntaxapi.nbt.NbtType; + +import net.minecraft.server.v1_8_R3.ItemStack; +import net.minecraft.server.v1_8_R3.NBTBase; +import net.minecraft.server.v1_8_R3.NBTTagByte; +import net.minecraft.server.v1_8_R3.NBTTagByteArray; +import net.minecraft.server.v1_8_R3.NBTTagCompound; +import net.minecraft.server.v1_8_R3.NBTTagDouble; +import net.minecraft.server.v1_8_R3.NBTTagEnd; +import net.minecraft.server.v1_8_R3.NBTTagFloat; +import net.minecraft.server.v1_8_R3.NBTTagInt; +import net.minecraft.server.v1_8_R3.NBTTagIntArray; +import net.minecraft.server.v1_8_R3.NBTTagList; +import net.minecraft.server.v1_8_R3.NBTTagLong; +import net.minecraft.server.v1_8_R3.NBTTagShort; +import net.minecraft.server.v1_8_R3.NBTTagString; +import net.sourcewriters.minecraft.vcompat.reflection.BukkitConversion; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContext; +import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleWrapType; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; +import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; + +public class BukkitConversion1_8_R3 extends BukkitConversion { + + protected BukkitConversion1_8_R3(VersionControl1_8_R3 versionControl) { + super(versionControl); + } + + @Override + public EntityType toEntityType(NmsEntityType type) { + try { + return EntityType.valueOf(type.name()); + } catch (IllegalArgumentException ignore) { + return null; + } + } + + @Override + public NmsEntityType fromEntityType(EntityType type) { + try { + return NmsEntityType.valueOf(type.name()); + } catch (IllegalArgumentException ignore) { + return null; + } + } + + @Override + public NBTBase toMinecraftTag(NbtTag tag) { + switch (tag.getType()) { + case BYTE: + return new NBTTagByte((byte) tag.getValue()); + case SHORT: + return new NBTTagShort((short) tag.getValue()); + case INT: + return new NBTTagInt((int) tag.getValue()); + case LONG: + return new NBTTagLong((long) tag.getValue()); + case FLOAT: + return new NBTTagFloat((float) tag.getValue()); + case DOUBLE: + return new NBTTagDouble((double) tag.getValue()); + case STRING: + return new NBTTagString((String) tag.getValue()); + case BYTE_ARRAY: + return new NBTTagByteArray((byte[]) tag.getValue()); + case INT_ARRAY: + return new NBTTagIntArray((int[]) tag.getValue()); + case LONG_ARRAY: + NBTTagList list = new NBTTagList(); + for (long value : (long[]) tag.getValue()) { + list.add(new NBTTagLong(value)); + } + return list; + case LIST: + return toMinecraftList((NbtList) tag); + case COMPOUND: + return toMinecraftCompound((NbtCompound) tag); + case END: + return (NBTTagEnd) ReflectionProvider.DEFAULT.getReflect("nmsNBTTagEnd").init(); + default: + return null; + } + } + + @Override + public NbtTag fromMinecraftTag(Object raw) { + if (!(raw instanceof NBTBase)) { + return null; + } + NBTBase tag = (NBTBase) raw; + NbtType type = NbtType.getById(tag.getTypeId()); + switch (type) { + case BYTE: + return new NbtByte(((NBTTagByte) tag).f()); + case SHORT: + return new NbtShort(((NBTTagShort) tag).e()); + case INT: + return new NbtInt(((NBTTagInt) tag).d()); + case LONG: + return new NbtLong(((NBTTagLong) tag).c()); + case FLOAT: + return new NbtFloat(((NBTTagFloat) tag).h()); + case DOUBLE: + return new NbtDouble(((NBTTagDouble) tag).g()); + case STRING: + return new NbtString(((NBTTagString) tag).a_()); + case BYTE_ARRAY: + return new NbtByteArray(((NBTTagByteArray) tag).c()); + case INT_ARRAY: + return new NbtIntArray(((NBTTagIntArray) tag).c()); + case LONG_ARRAY: + return new NbtLongArray(new long[0]); + case LIST: + return fromMinecraftList(tag); + case COMPOUND: + return fromMinecraftCompound(tag); + case END: + return NbtEnd.INSTANCE; + default: + return null; + } + } + + @Override + public NBTTagList toMinecraftList(NbtList list) { + NBTTagList output = new NBTTagList(); + for (NbtTag tag : list) { + output.add(toMinecraftTag(tag)); + } + return output; + } + + @SuppressWarnings("unchecked") + @Override + public NbtList fromMinecraftList(Object raw) { + if (!(raw instanceof NBTTagList)) { + return null; + } + NBTTagList list = (NBTTagList) raw; + List content = (List) ReflectionProvider.DEFAULT.getReflect("nmsNBTTagList").getFieldValue("value", list); + NbtList output = new NbtList<>(NbtType.getById(list.getTypeId())); + for (NBTBase base : content) { + output.add(fromMinecraftTag(base)); + } + return output; + } + + @Override + public NBTTagCompound toMinecraftCompound(NbtCompound compound) { + NBTTagCompound output = new NBTTagCompound(); + if (compound.isEmpty()) { + return output; + } + Set keys = compound.getKeys(); + for (String key : keys) { + output.set(key, toMinecraftTag(compound.get(key))); + } + return output; + } + + @Override + public NbtCompound fromMinecraftCompound(Object raw) { + if (!(raw instanceof NBTTagCompound)) { + return null; + } + NBTTagCompound compound = (NBTTagCompound) raw; + NbtCompound output = new NbtCompound(); + if (compound.isEmpty()) { + return output; + } + Set keys = compound.c(); + for (String key : keys) { + output.set(key, fromMinecraftTag(compound.get(key))); + } + return output; + } + + @Override + public org.bukkit.inventory.ItemStack itemFromCompound(NbtCompound compound) { + return CraftItemStack.asBukkitCopy(ItemStack.createStack(toMinecraftCompound(compound))); + } + + @Override + public NbtCompound itemToCompound(org.bukkit.inventory.ItemStack itemStack) { + ItemStack nmsStack = CraftItemStack.asNMSCopy(itemStack); + NBTTagCompound stackTag; + if (!nmsStack.hasTag()) { + stackTag = nmsStack.save(new NBTTagCompound()); + } else { + stackTag = nmsStack.getTag(); + } + return fromMinecraftCompound(stackTag); + } + + @Override + public WrappedContext createContext(DataAdapterContext context) { + return new SimpleSyntaxContext(context); + } + + @Override + public WrapType wrap(DataType dataType) { + return new SimpleWrapType(dataType); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/EntityProvider1_8_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/EntityProvider1_8_R3.java new file mode 100644 index 0000000..b1bdae2 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/EntityProvider1_8_R3.java @@ -0,0 +1,47 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R3; + +import java.util.EnumMap; +import java.util.function.Function; + +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; + +import net.minecraft.server.v1_8_R3.World; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R3.utils.EntityConstructors1_8_R3; +import net.sourcewriters.minecraft.vcompat.reflection.EntityProvider; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; + +public class EntityProvider1_8_R3 extends EntityProvider { + + private final EnumMap> entityMap = new EnumMap<>(NmsEntityType.class); + + protected EntityProvider1_8_R3(VersionControl1_8_R3 versionControl) { + super(versionControl); + } + + @SuppressWarnings("unchecked") + private final Function searchConstructor(NmsEntityType type) { + try { + return (Function) EntityConstructors1_8_R3.class.getField(type.name()).get(null); + } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException ignore) { + return null; + } + } + + private final Function getConstructor(NmsEntityType type) { + return entityMap.computeIfAbsent(type, (key -> searchConstructor(key))); + } + + @Override + public NmsEntity createEntity(org.bukkit.World world, NmsEntityType type) { + if (!(world instanceof CraftWorld)) { + return null; + } + Function function; + if ((function = getConstructor(type)) == null) { + return null; + } + return function.apply(((CraftWorld) world).getHandle()); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/PacketHandler1_8_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/PacketHandler1_8_R3.java new file mode 100644 index 0000000..3e43abe --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/PacketHandler1_8_R3.java @@ -0,0 +1,11 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R3; + +import net.sourcewriters.minecraft.vcompat.reflection.PacketHandler; + +public class PacketHandler1_8_R3 extends PacketHandler { + + protected PacketHandler1_8_R3(VersionControl1_8_R3 versionControl) { + super(versionControl); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/PlayerProvider1_8_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/PlayerProvider1_8_R3.java new file mode 100644 index 0000000..549cf83 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/PlayerProvider1_8_R3.java @@ -0,0 +1,30 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R3; + +import java.io.File; +import java.util.UUID; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R3.entity.Player1_8_R3; +import net.sourcewriters.minecraft.vcompat.reflection.DataProvider; +import net.sourcewriters.minecraft.vcompat.reflection.PlayerProvider; +import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.DataDistributor; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; + +public class PlayerProvider1_8_R3 extends PlayerProvider { + + private final DataDistributor distributor; + + protected PlayerProvider1_8_R3(VersionControl1_8_R3 versionControl) { + super(versionControl); + distributor = versionControl.getDataProvider().createDistributor(new File(Bukkit.getWorlds().get(0).getWorldFolder(), "playerdata"), + uuid -> "custom_" + uuid.toString(), DataProvider.DEFAULT_RANDOM); + } + + @Override + protected NmsPlayer createPlayer(Player player) { + return new Player1_8_R3(player, distributor.get(player.getUniqueId())); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/TextureProvider1_8_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/TextureProvider1_8_R3.java new file mode 100644 index 0000000..b71c538 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/TextureProvider1_8_R3.java @@ -0,0 +1,105 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R3; + +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_8_R3.block.CraftSkull; +import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack; +import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.inventory.meta.SkullMeta; +import org.bukkit.material.MaterialData; + +import com.mojang.authlib.GameProfile; +import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; +import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.minecraft.server.v1_8_R3.GameProfileSerializer; +import net.minecraft.server.v1_8_R3.ItemStack; +import net.minecraft.server.v1_8_R3.NBTTagCompound; +import net.sourcewriters.minecraft.vcompat.reflection.TextureProvider; + +@SuppressWarnings("deprecation") +public class TextureProvider1_8_R3 extends TextureProvider { + + private final AbstractReflect craftItemStackRef = new Reflect(CraftItemStack.class).searchField("handle", "handle"); + private final AbstractReflect craftMetaSkullRef = new Reflect("org.bukkit.craftbukkit.v1_8_R3.inventory.CraftMetaSkull") + .searchField("serialized", "serializedProfile").searchField("profile", "profile"); + private final Material skullMaterial = Material.valueOf("SKULL"); + + protected TextureProvider1_8_R3(VersionControl1_8_R3 versionControl) { + super(versionControl); + } + + @Override + public GameProfile profileFromBlock(Block block) { + if (!(block instanceof CraftSkull)) { + return null; + } + return ((CraftSkull) block).getTileEntity().getGameProfile(); + } + + @Override + public GameProfile profileFromItem(org.bukkit.inventory.ItemStack itemStack) { + if (!(itemStack.getItemMeta() instanceof SkullMeta)) { + return null; + } + SkullMeta meta = (SkullMeta) itemStack.getItemMeta(); + GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue("profile", meta); + if (profile == null) { + NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue("serialized", meta); + if (compound == null) { + ItemStack stack = null; + if (itemStack instanceof CraftItemStack) { + stack = (ItemStack) craftItemStackRef.getFieldValue("handle", itemStack); + } + if (stack == null) { + stack = CraftItemStack.asNMSCopy(itemStack); + } + NBTTagCompound stackTag; + if (!stack.hasTag()) { + stackTag = stack.save(new NBTTagCompound()); + } else { + stackTag = stack.getTag(); + } + if (stackTag.hasKeyOfType("SkullOwner", 10)) { + compound = stackTag.getCompound("SkullOwner"); + } else if (stackTag.hasKeyOfType("SkullProfile", 10)) { + compound = stackTag.getCompound("SkullProfile"); + } + } + if (compound == null) { + return null; + } + profile = GameProfileSerializer.deserialize(compound); + } + return profile; + } + + @Override + public org.bukkit.inventory.ItemStack getItem(GameProfile profile) { + org.bukkit.inventory.ItemStack craftStack = CraftItemStack.asCraftCopy(new MaterialData(skullMaterial, (byte) 3).toItemStack(1)); + applyItem(craftStack, profile); + return craftStack; + } + + @Override + public boolean applyItem(org.bukkit.inventory.ItemStack itemStack, GameProfile profile) { + ItemMeta meta = itemStack.getItemMeta(); + if (!(meta instanceof SkullMeta)) { + return false; + } + SkullMeta skullMeta = (SkullMeta) meta; + craftMetaSkullRef.setFieldValue(meta, "profile", profile); + itemStack.setItemMeta(skullMeta); + return true; + } + + @Override + public boolean applyBlock(Block block, GameProfile profile) { + if (!(block instanceof CraftSkull)) { + return false; + } + ((CraftSkull) block).getTileEntity().setGameProfile(profile); + return true; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/ToolProvider1_8_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/ToolProvider1_8_R3.java new file mode 100644 index 0000000..4ad4886 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/ToolProvider1_8_R3.java @@ -0,0 +1,33 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R3; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R3.tools.BlockTools1_8_R3; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R3.tools.ServerTools1_8_R3; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R3.tools.SkinTools1_8_R3; +import net.sourcewriters.minecraft.vcompat.reflection.ToolProvider; + +public class ToolProvider1_8_R3 extends ToolProvider { + + private final BlockTools1_8_R3 blockTools = new BlockTools1_8_R3(); + private final SkinTools1_8_R3 skinTools = new SkinTools1_8_R3(); + private final ServerTools1_8_R3 serverTools = new ServerTools1_8_R3(); + + protected ToolProvider1_8_R3(VersionControl1_8_R3 versionControl) { + super(versionControl); + } + + @Override + public SkinTools1_8_R3 getSkinTools() { + return skinTools; + } + + @Override + public ServerTools1_8_R3 getServerTools() { + return serverTools; + } + + @Override + public BlockTools1_8_R3 getBlockTools() { + return blockTools; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/VersionControl1_8_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/VersionControl1_8_R3.java new file mode 100644 index 0000000..272a0e2 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/VersionControl1_8_R3.java @@ -0,0 +1,56 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R3; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R3.reflection.NmsReflection1_8_R3; +import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; +import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; + +public class VersionControl1_8_R3 extends VersionControl { + + public static VersionControl1_8_R3 INSTANCE; + + public static VersionControl1_8_R3 init() { + return INSTANCE != null ? INSTANCE : (INSTANCE = new VersionControl1_8_R3()); + } + + private final ToolProvider1_8_R3 toolProvider = new ToolProvider1_8_R3(this); + private final TextureProvider1_8_R3 textureProvider = new TextureProvider1_8_R3(this); + private final PacketHandler1_8_R3 packetHandler = new PacketHandler1_8_R3(this); + private final EntityProvider1_8_R3 entityProvider = new EntityProvider1_8_R3(this); + private final PlayerProvider1_8_R3 playerProvider = new PlayerProvider1_8_R3(this); + private final BukkitConversion1_8_R3 bukkitConversion = new BukkitConversion1_8_R3(this); + + private VersionControl1_8_R3() { + NmsReflection1_8_R3.INSTANCE.setup(ReflectionProvider.DEFAULT); + } + + @Override + public ToolProvider1_8_R3 getToolProvider() { + return toolProvider; + } + + @Override + public EntityProvider1_8_R3 getEntityProvider() { + return entityProvider; + } + + @Override + public PlayerProvider1_8_R3 getPlayerProvider() { + return playerProvider; + } + + @Override + public TextureProvider1_8_R3 getTextureProvider() { + return textureProvider; + } + + @Override + public PacketHandler1_8_R3 getPacketHandler() { + return packetHandler; + } + + @Override + public BukkitConversion1_8_R3 getBukkitConversion() { + return bukkitConversion; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/entity/ArmorStand1_8_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/entity/ArmorStand1_8_R3.java new file mode 100644 index 0000000..47dd4ad --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/entity/ArmorStand1_8_R3.java @@ -0,0 +1,33 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R3.entity; + +import net.minecraft.server.v1_8_R3.EntityArmorStand; +import net.minecraft.server.v1_8_R3.World; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsArmorStand; + +public class ArmorStand1_8_R3 extends EntityLiving1_8_R3 implements NmsArmorStand { + + public ArmorStand1_8_R3(World world) { + super(new EntityArmorStand(world)); + } + + @Override + public boolean hasGravity() { + return handle.hasGravity(); + } + + @Override + public void setGravity(boolean gravity) { + handle.setGravity(gravity); + } + + @Override + public void setSmall(boolean small) { + handle.setSmall(small); + } + + @Override + public boolean isSmall() { + return handle.isSmall(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/entity/Entity1_8_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/entity/Entity1_8_R3.java new file mode 100644 index 0000000..ed5dd42 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/entity/Entity1_8_R3.java @@ -0,0 +1,213 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R3.entity; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.UUID; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.OfflinePlayer; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; +import org.bukkit.entity.Player; + +import net.minecraft.server.v1_8_R3.AxisAlignedBB; +import net.minecraft.server.v1_8_R3.Entity; +import net.minecraft.server.v1_8_R3.EntityTypes; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityMetadata; +import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntity; +import net.minecraft.server.v1_8_R3.PlayerConnection; +import net.minecraft.server.v1_8_R3.Vec3D; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.reflection.utils.NmsBoundingBox; + +public abstract class Entity1_8_R3 implements NmsEntity { + + protected final E handle; + + protected final List visible = Collections.synchronizedList(new ArrayList<>()); + + public Entity1_8_R3(E handle) { + this.handle = handle; + } + + @Override + public final E getHandle() { + return handle; + } + + @Override + public int getId() { + return handle.getId(); + } + + @Override + public UUID getUniqueId() { + return handle.getUniqueID(); + } + + @Override + public NmsBoundingBox getBoundingBox() { + AxisAlignedBB box = handle.getBoundingBox(); + return new NmsBoundingBox(box.a, box.b, box.c, box.d, box.e, box.f); + } + + @Override + public void setCustomName(String name) { + handle.setCustomName(name); + updateVisibility(); + } + + @Override + public String getCustomName() { + return handle.getCustomName(); + } + + @Override + public void setCustomNameVisible(boolean visible) { + handle.setCustomNameVisible(visible); + } + + @Override + public boolean isCustomNameVisible() { + return handle.getCustomNameVisible(); + } + + @Override + public void setInvisible(boolean invisible) { + handle.setInvisible(invisible); + } + + @Override + public boolean isInvisible() { + return handle.isInvisible(); + } + + @Override + public boolean isInteractable() { + return handle.ad(); + } + + @Override + public boolean isCollidable() { + return handle.ae(); + } + + @Override + public void setInvulnerable(boolean invulnerable) { + handle.h(invulnerable); + } + + @Override + public boolean isInvulnerable() { + return handle.isInvulnerable(null); + } + + @Override + public boolean hasGravity() { + return true; + } + + @Override + public void setGravity(boolean gravity) {} + + @Override + public void setLocation(Location location) { + handle.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); + if (location.getWorld() == null || handle.getWorld().getWorld() == location.getWorld()) { + updateVisibility(); + return; + } + handle.world = ((CraftWorld) location.getWorld()).getHandle(); + updateVisibility(); + } + + @Override + public Location getLocation() { + Vec3D vector = handle.d(); + return new Location(handle.getWorld().getWorld(), vector.a, vector.b, vector.c); + } + + @Override + public void updateVisibility() { + if (visible.isEmpty()) { + return; + } + Player[] players; + synchronized (visible) { + players = visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) + .toArray(Player[]::new); + } + hide(players); + show(players); + } + + @Override + public boolean isShown(Player player) { + synchronized (visible) { + return visible.contains(player.getUniqueId()); + } + } + + @Override + public void hide(Player... players) { + if (players.length == 0) { + return; + } + PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(handle.getId()); + for (Player player : players) { + if (!isShown(player)) { + continue; + } + ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); + synchronized (visible) { + visible.remove(player.getUniqueId()); + } + } + } + + @Override + public void show(Player... players) { + if (players.length == 0) { + return; + } + PacketPlayOutSpawnEntity packet = new PacketPlayOutSpawnEntity(handle, EntityTypes.a(handle)); + PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); + PlayerConnection connection; + for (Player player : players) { + if (isShown(player)) { + continue; + } + connection = ((CraftPlayer) player).getHandle().playerConnection; + connection.sendPacket(packet); + connection.sendPacket(metadataPacket); + synchronized (visible) { + visible.add(player.getUniqueId()); + } + } + } + + @Override + public UUID[] getVisible() { + synchronized (visible) { + return visible.toArray(new UUID[0]); + } + } + + @Override + public Player[] getVisibleAsPlayer() { + synchronized (visible) { + return visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) + .toArray(Player[]::new); + } + } + + @Override + public void kill() { + hide(getVisibleAsPlayer()); + handle.die(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/entity/EntityLiving1_8_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/entity/EntityLiving1_8_R3.java new file mode 100644 index 0000000..8d09942 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/entity/EntityLiving1_8_R3.java @@ -0,0 +1,17 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R3.entity; + +import net.minecraft.server.v1_8_R3.EntityLiving; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityLiving; + +public abstract class EntityLiving1_8_R3 extends Entity1_8_R3 implements NmsEntityLiving { + + public EntityLiving1_8_R3(E handle) { + super(handle); + } + + @Override + public void setCollidable(boolean collidable) { + + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/entity/Player1_8_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/entity/Player1_8_R3.java new file mode 100644 index 0000000..36cb86f --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/entity/Player1_8_R3.java @@ -0,0 +1,295 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R3.entity; + +import java.util.ArrayList; +import java.util.Collections; + +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R3.util.CraftChatMessage; +import org.bukkit.entity.Player; + +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.properties.Property; +import com.mojang.authlib.properties.PropertyMap; +import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.minecraft.server.v1_8_R3.EntityPlayer; +import net.minecraft.server.v1_8_R3.IChatBaseComponent; +import net.minecraft.server.v1_8_R3.MathHelper; +import net.minecraft.server.v1_8_R3.PacketPlayInClientCommand; +import net.minecraft.server.v1_8_R3.PacketPlayInClientCommand.EnumClientCommand; +import net.minecraft.server.v1_8_R3.PacketPlayOutChat; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityEquipment; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityHeadRotation; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityMetadata; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityStatus; +import net.minecraft.server.v1_8_R3.PacketPlayOutHeldItemSlot; +import net.minecraft.server.v1_8_R3.PacketPlayOutNamedEntitySpawn; +import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo; +import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo.EnumPlayerInfoAction; +import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerListHeaderFooter; +import net.minecraft.server.v1_8_R3.PacketPlayOutPosition; +import net.minecraft.server.v1_8_R3.PacketPlayOutRespawn; +import net.minecraft.server.v1_8_R3.PacketPlayOutTitle; +import net.minecraft.server.v1_8_R3.PacketPlayOutTitle.EnumTitleAction; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.PersistentContainer; +import net.sourcewriters.minecraft.vcompat.reflection.data.type.SkinDataType; +import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContainer; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; +import net.sourcewriters.minecraft.vcompat.utils.bukkit.Players; +import net.sourcewriters.minecraft.vcompat.utils.minecraft.MojangProfileServer; +import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; +import net.sourcewriters.minecraft.vcompat.utils.thread.PostAsync; +import net.minecraft.server.v1_8_R3.PlayerConnection; +import net.minecraft.server.v1_8_R3.WorldServer; + +public class Player1_8_R3 extends EntityLiving1_8_R3 implements NmsPlayer { + + private String realName; + private Skin realSkin; + + private final WrappedContainer dataAdapter; + + public Player1_8_R3(Player player, PersistentContainer container) { + super(((CraftPlayer) player).getHandle()); + this.dataAdapter = new SimpleSyntaxContainer<>(container); + update(false); + } + + @Override + public CraftPlayer getBukkitPlayer() { + return handle.getBukkitEntity(); + } + + @Override + public WrappedContainer getDataAdapter() { + return dataAdapter; + } + + @Override + public void setSkin(Skin skin) { + if (skin == null || getSkin().equals(skin)) { + return; + } + getDataAdapter().set("skin", skin, SkinDataType.WRAPPED_INSTANCE); + } + + @Override + public Skin getSkin() { + return dataAdapter.getOrDefault("skin", SkinDataType.WRAPPED_INSTANCE, realSkin); + } + + @Override + public Skin getRealSkin() { + return realSkin; + } + + @Override + public void setName(String name) { + if (getName().equals(name)) { + return; + } + if (name == null) { + getDataAdapter().remove("name"); + return; + } + getDataAdapter().set("name", name, WrapType.STRING); + } + + @Override + public String getName() { + return getDataAdapter().getOrDefault("name", WrapType.STRING, realName); + } + + @Override + public String getRealName() { + return realName; + } + + @Override + public void setPlayerListHeader(String text) { + setPlayerListHeaderAndFooter(text, getPlayerListFooter()); + } + + @Override + public String getPlayerListHeader() { + return getDataAdapter().getOrDefault("header", WrapType.STRING, ""); + } + + @Override + public void setPlayerListFooter(String text) { + setPlayerListHeaderAndFooter(getPlayerListHeader(), text); + } + + @Override + public String getPlayerListFooter() { + return getDataAdapter().getOrDefault("footer", WrapType.STRING, ""); + } + + @Override + public int getPing() { + return handle.ping; + } + + @Override + public void setPlayerListHeaderAndFooter(String header, String footer) { + getDataAdapter().set("header", header, WrapType.STRING); + getDataAdapter().set("footer", footer, WrapType.STRING); + sendPlayerListInfo(header, footer); + } + + private final void sendPlayerListInfo(String header, String footer) { + if (handle.playerConnection.isDisconnected()) { + return; + } + + IChatBaseComponent headerComponent = header.isEmpty() ? null : CraftChatMessage.fromString(header, true)[0]; + IChatBaseComponent footerComponent = footer.isEmpty() ? null : CraftChatMessage.fromString(footer, true)[0]; + + PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter(); + + Reflect reflect = ReflectionProvider.DEFAULT.getReflect("nmsPacketPlayOutPlayerListHeaderFooter"); + reflect.setFieldValue(packet, "header", headerComponent); + reflect.setFieldValue(packet, "footer", footerComponent); + + handle.playerConnection.sendPacket(packet); + } + + @Override + public void setTitleTimes(int fadeIn, int stay, int fadeOut) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TIMES, null, fadeIn, stay, fadeOut)); + } + + @Override + public void sendSubtitle(String text) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.SUBTITLE, CraftChatMessage.fromString(text)[0])); + } + + @Override + public void sendTitle(String text) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TITLE, CraftChatMessage.fromString(text)[0])); + } + + @Override + public void sendActionBar(String text) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutChat(CraftChatMessage.fromString(text)[0], (byte) 2)); + } + + @Override + public void fakeRespawn() { + if (handle.playerConnection.isDisconnected()) { + return; + } + PacketPlayOutPlayerInfo remInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER, handle); + PacketPlayOutPlayerInfo addInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.ADD_PLAYER, handle); + + PacketPlayOutEntityDestroy destroyPacket = new PacketPlayOutEntityDestroy(handle.getId()); + PacketPlayOutNamedEntitySpawn spawnPacket = new PacketPlayOutNamedEntitySpawn(handle); + PacketPlayOutEntityHeadRotation rotationPacket = new PacketPlayOutEntityHeadRotation(handle, + (byte) MathHelper.d(handle.getHeadRotation() * 256F / 360F)); + + ArrayList equipmentPackets = new ArrayList<>(); + for (int slot = 0; slot < 5; slot++) { + equipmentPackets.add(new PacketPlayOutEntityEquipment(handle.getId(), slot, handle.getEquipment(slot))); + } + + Player self = getBukkitPlayer(); + Player[] players = Players.getOnlineWithout(getUniqueId()); + for (Player player : players) { + if (!player.canSee(self)) { + continue; + } + PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection; + connection.sendPacket(remInfoPacket); + connection.sendPacket(addInfoPacket); + connection.sendPacket(destroyPacket); + connection.sendPacket(spawnPacket); + connection.sendPacket(rotationPacket); + for (PacketPlayOutEntityEquipment equipmentPacket : equipmentPackets) { + connection.sendPacket(equipmentPacket); + } + } + + WorldServer world = (WorldServer) handle.world; + + PacketPlayOutRespawn respawnPacket = new PacketPlayOutRespawn(handle.dimension, world.getDifficulty(), + handle.world.worldData.getType(), handle.playerInteractManager.getGameMode()); + PacketPlayOutPosition positionPacket = new PacketPlayOutPosition(handle.locX, handle.locY, handle.locZ, handle.yaw, handle.pitch, + Collections.emptySet()); + PacketPlayOutHeldItemSlot itemPacket = new PacketPlayOutHeldItemSlot(handle.inventory.itemInHandIndex); + PacketPlayOutEntityStatus statusPacket = new PacketPlayOutEntityStatus(handle, (byte) 28); + PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); + + PlayerConnection connection = handle.playerConnection; + connection.sendPacket(remInfoPacket); + connection.sendPacket(addInfoPacket); + connection.sendPacket(respawnPacket); + connection.sendPacket(positionPacket); + connection.sendPacket(itemPacket); + connection.sendPacket(statusPacket); + connection.sendPacket(metadataPacket); + + handle.updateAbilities(); + handle.triggerHealthUpdate(); + handle.updateInventory(handle.defaultContainer); + if (handle.activeContainer != handle.defaultContainer) { + handle.updateInventory(handle.activeContainer); + } + self.recalculatePermissions(); + } + + @Override + public void respawn() { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayInClientCommand(EnumClientCommand.PERFORM_RESPAWN)); + } + + @Override + public void update() { + update(true); + } + + private final void update(boolean flag) { + PostAsync.forcePost(() -> { + realName = MojangProfileServer.getName(getUniqueId()); + realSkin = MojangProfileServer.getSkin(realName, getUniqueId()); + }); + if (flag) { + GameProfile profile = handle.getProfile(); + + Skin skin = getSkin(); + if (skin != null) { + PropertyMap properties = profile.getProperties(); + properties.removeAll("textures"); + properties.put("textures", new Property("textures", skin.getValue(), skin.getSignature())); + } + + String name = getName(); + if (name != null) { + ReflectionProvider.DEFAULT.getReflect("mjGameProfile").setFieldValue(profile, "name", name); + } + + if (!(name == null && skin == null)) { + fakeRespawn(); + } + } + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/reflection/NmsReflection1_8_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/reflection/NmsReflection1_8_R3.java new file mode 100644 index 0000000..2f3fc35 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/reflection/NmsReflection1_8_R3.java @@ -0,0 +1,34 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R3.reflection; + +import net.minecraft.server.v1_8_R3.NBTTagEnd; +import net.minecraft.server.v1_8_R3.NBTTagList; +import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerListHeaderFooter; +import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; +import net.sourcewriters.minecraft.vcompat.reflection.reflect.Reflections; + +public class NmsReflection1_8_R3 extends Reflections { + + public static NmsReflection1_8_R3 INSTANCE = new NmsReflection1_8_R3(); + + private NmsReflection1_8_R3() {} + + @Override + public void setup(ReflectionProvider provider) { + + // + // + // Create Reflects + // + + // + // Minecraft + + provider.createReflect("nmsPacketPlayOutPlayerListHeaderFooter", PacketPlayOutPlayerListHeaderFooter.class) + .searchField("header", "a").searchField("header", "b"); + + provider.createReflect("nmsNBTTagEnd", NBTTagEnd.class); + provider.createReflect("nmsNBTTagList", NBTTagList.class).searchField("value", "list"); + + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/tools/BlockTools1_8_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/tools/BlockTools1_8_R3.java new file mode 100644 index 0000000..9b5f13e --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/tools/BlockTools1_8_R3.java @@ -0,0 +1,39 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R3.tools; + +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_8_R3.block.CraftSkull; + +import com.mojang.authlib.properties.Property; +import com.mojang.authlib.properties.PropertyMap; +import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; +import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.minecraft.server.v1_8_R3.TileEntitySkull; +import net.sourcewriters.minecraft.vcompat.reflection.tools.BlockTools; +import net.sourcewriters.minecraft.vcompat.utils.constants.MinecraftConstants; + +public class BlockTools1_8_R3 extends BlockTools { + + private final AbstractReflect craftEntityStateRef = new Reflect(CraftSkull.class).searchField("tileEntity", "tileEntity"); + + @Override + public void setHeadTexture(Block block, String texture) { + if (!(block instanceof CraftSkull)) { + return; + } + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + PropertyMap map = entitySkull.getGameProfile().getProperties(); + map.removeAll("textures"); + map.put("textures", new Property("textures", MinecraftConstants.TEXTURE_SIGNATURE, texture)); + } + + @Override + public String getHeadTexture(Block block) { + if (!(block instanceof CraftSkull)) { + return null; + } + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + return entitySkull.getGameProfile().getProperties().get("textures").iterator().next().getValue(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/tools/ServerTools1_8_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/tools/ServerTools1_8_R3.java new file mode 100644 index 0000000..b6ae36c --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/tools/ServerTools1_8_R3.java @@ -0,0 +1,26 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R3.tools; + +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_8_R3.CraftServer; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R3.wrapper.ConsoleReaderWrapper1_8_R3; +import net.sourcewriters.minecraft.vcompat.reflection.tools.ServerTools; + +public class ServerTools1_8_R3 extends ServerTools { + + @Override + public void setMotd(String text) { + ((CraftServer) Bukkit.getServer()).getServer().setMotd(text); + } + + @Override + public String getMotd() { + return ((CraftServer) Bukkit.getServer()).getServer().getMotd(); + } + + @Override + public ConsoleReaderWrapper1_8_R3 getConsole() { + return ConsoleReaderWrapper1_8_R3.INSTANCE; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/tools/SkinTools1_8_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/tools/SkinTools1_8_R3.java new file mode 100644 index 0000000..3dfcadb --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/tools/SkinTools1_8_R3.java @@ -0,0 +1,16 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R3.tools; + +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; +import org.bukkit.entity.Player; + +import net.sourcewriters.minecraft.vcompat.reflection.tools.SkinTools; +import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; + +public class SkinTools1_8_R3 extends SkinTools { + + @Override + public Skin skinFromPlayer(Player player) { + return skinFromGameProfile(((CraftPlayer) player).getHandle().getProfile()); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/utils/EntityConstructors1_8_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/utils/EntityConstructors1_8_R3.java new file mode 100644 index 0000000..078ed2c --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/utils/EntityConstructors1_8_R3.java @@ -0,0 +1,12 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R3.utils; + +import java.util.function.Function; + +import net.minecraft.server.v1_8_R3.World; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R3.entity.ArmorStand1_8_R3; + +public abstract class EntityConstructors1_8_R3 { + + public static final Function ARMOR_STAND = (world -> new ArmorStand1_8_R3(world)); + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/wrapper/ConsoleReaderWrapper1_8_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/wrapper/ConsoleReaderWrapper1_8_R3.java new file mode 100644 index 0000000..f8911ed --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/wrapper/ConsoleReaderWrapper1_8_R3.java @@ -0,0 +1,43 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R3.wrapper; + +import java.io.IOException; +import java.io.Writer; + +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_8_R3.CraftServer; +import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; + +import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; + +public final class ConsoleReaderWrapper1_8_R3 extends ConsoleReaderWrapper { + + public static final ConsoleReaderWrapper1_8_R3 INSTANCE = new ConsoleReaderWrapper1_8_R3(); + + private final ConsoleReader reader; + + @SuppressWarnings("resource") + private ConsoleReaderWrapper1_8_R3() { + this.reader = ((CraftServer) Bukkit.getServer()).getServer().reader; + } + + @Override + public Writer getOutput() { + return reader.getOutput(); + } + + @Override + public boolean isAnsiSupported() { + return reader.getTerminal().isAnsiSupported(); + } + + @Override + public void flush() throws IOException { + reader.flush(); + } + + @Override + public void drawLine() throws IOException { + reader.drawLine(); + } + +} diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/BukkitConversion1_9_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/BukkitConversion1_9_R1.java new file mode 100644 index 0000000..5dd2308 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/BukkitConversion1_9_R1.java @@ -0,0 +1,231 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R1; + +import java.util.List; +import java.util.Set; + +import org.bukkit.craftbukkit.v1_9_R1.inventory.CraftItemStack; +import org.bukkit.entity.EntityType; + +import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; +import com.syntaxphoenix.syntaxapi.data.DataType; +import com.syntaxphoenix.syntaxapi.nbt.NbtByte; +import com.syntaxphoenix.syntaxapi.nbt.NbtByteArray; +import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; +import com.syntaxphoenix.syntaxapi.nbt.NbtDouble; +import com.syntaxphoenix.syntaxapi.nbt.NbtEnd; +import com.syntaxphoenix.syntaxapi.nbt.NbtFloat; +import com.syntaxphoenix.syntaxapi.nbt.NbtInt; +import com.syntaxphoenix.syntaxapi.nbt.NbtIntArray; +import com.syntaxphoenix.syntaxapi.nbt.NbtList; +import com.syntaxphoenix.syntaxapi.nbt.NbtLong; +import com.syntaxphoenix.syntaxapi.nbt.NbtLongArray; +import com.syntaxphoenix.syntaxapi.nbt.NbtShort; +import com.syntaxphoenix.syntaxapi.nbt.NbtString; +import com.syntaxphoenix.syntaxapi.nbt.NbtTag; +import com.syntaxphoenix.syntaxapi.nbt.NbtType; + +import net.minecraft.server.v1_9_R1.ItemStack; +import net.minecraft.server.v1_9_R1.NBTBase; +import net.minecraft.server.v1_9_R1.NBTTagByte; +import net.minecraft.server.v1_9_R1.NBTTagByteArray; +import net.minecraft.server.v1_9_R1.NBTTagCompound; +import net.minecraft.server.v1_9_R1.NBTTagDouble; +import net.minecraft.server.v1_9_R1.NBTTagEnd; +import net.minecraft.server.v1_9_R1.NBTTagFloat; +import net.minecraft.server.v1_9_R1.NBTTagInt; +import net.minecraft.server.v1_9_R1.NBTTagIntArray; +import net.minecraft.server.v1_9_R1.NBTTagList; +import net.minecraft.server.v1_9_R1.NBTTagLong; +import net.minecraft.server.v1_9_R1.NBTTagShort; +import net.minecraft.server.v1_9_R1.NBTTagString; +import net.sourcewriters.minecraft.vcompat.reflection.BukkitConversion; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContext; +import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleWrapType; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; +import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; + +public class BukkitConversion1_9_R1 extends BukkitConversion { + + protected BukkitConversion1_9_R1(VersionControl1_9_R1 versionControl) { + super(versionControl); + } + + @Override + public EntityType toEntityType(NmsEntityType type) { + try { + return EntityType.valueOf(type.name()); + } catch (IllegalArgumentException ignore) { + return null; + } + } + + @Override + public NmsEntityType fromEntityType(EntityType type) { + try { + return NmsEntityType.valueOf(type.name()); + } catch (IllegalArgumentException ignore) { + return null; + } + } + + @Override + public NBTBase toMinecraftTag(NbtTag tag) { + switch (tag.getType()) { + case BYTE: + return new NBTTagByte((byte) tag.getValue()); + case SHORT: + return new NBTTagShort((short) tag.getValue()); + case INT: + return new NBTTagInt((int) tag.getValue()); + case LONG: + return new NBTTagLong((long) tag.getValue()); + case FLOAT: + return new NBTTagFloat((float) tag.getValue()); + case DOUBLE: + return new NBTTagDouble((double) tag.getValue()); + case STRING: + return new NBTTagString((String) tag.getValue()); + case BYTE_ARRAY: + return new NBTTagByteArray((byte[]) tag.getValue()); + case INT_ARRAY: + return new NBTTagIntArray((int[]) tag.getValue()); + case LONG_ARRAY: + NBTTagList list = new NBTTagList(); + for (long value : (long[]) tag.getValue()) { + list.add(new NBTTagLong(value)); + } + return list; + case LIST: + return toMinecraftList((NbtList) tag); + case COMPOUND: + return toMinecraftCompound((NbtCompound) tag); + case END: + return (NBTTagEnd) ReflectionProvider.DEFAULT.getReflect("nmsNBTTagEnd").init(); + default: + return null; + } + } + + @Override + public NbtTag fromMinecraftTag(Object raw) { + if (!(raw instanceof NBTBase)) { + return null; + } + NBTBase tag = (NBTBase) raw; + NbtType type = NbtType.getById(tag.getTypeId()); + switch (type) { + case BYTE: + return new NbtByte(((NBTTagByte) tag).f()); + case SHORT: + return new NbtShort(((NBTTagShort) tag).e()); + case INT: + return new NbtInt(((NBTTagInt) tag).d()); + case LONG: + return new NbtLong(((NBTTagLong) tag).c()); + case FLOAT: + return new NbtFloat(((NBTTagFloat) tag).h()); + case DOUBLE: + return new NbtDouble(((NBTTagDouble) tag).g()); + case STRING: + return new NbtString(((NBTTagString) tag).a_()); + case BYTE_ARRAY: + return new NbtByteArray(((NBTTagByteArray) tag).c()); + case INT_ARRAY: + return new NbtIntArray(((NBTTagIntArray) tag).c()); + case LONG_ARRAY: + return new NbtLongArray(new long[0]); + case LIST: + return fromMinecraftList(tag); + case COMPOUND: + return fromMinecraftCompound(tag); + case END: + return NbtEnd.INSTANCE; + default: + return null; + } + } + + @Override + public NBTTagList toMinecraftList(NbtList list) { + NBTTagList output = new NBTTagList(); + for (NbtTag tag : list) { + output.add(toMinecraftTag(tag)); + } + return output; + } + + @SuppressWarnings("unchecked") + @Override + public NbtList fromMinecraftList(Object raw) { + if (!(raw instanceof NBTTagList)) { + return null; + } + NBTTagList list = (NBTTagList) raw; + List content = (List) ReflectionProvider.DEFAULT.getReflect("nmsNBTTagList").getFieldValue("value", list); + NbtList output = new NbtList<>(NbtType.getById(list.getTypeId())); + for (NBTBase base : content) { + output.add(fromMinecraftTag(base)); + } + return output; + } + + @Override + public NBTTagCompound toMinecraftCompound(NbtCompound compound) { + NBTTagCompound output = new NBTTagCompound(); + if (compound.isEmpty()) { + return output; + } + Set keys = compound.getKeys(); + for (String key : keys) { + output.set(key, toMinecraftTag(compound.get(key))); + } + return output; + } + + @Override + public NbtCompound fromMinecraftCompound(Object raw) { + if (!(raw instanceof NBTTagCompound)) { + return null; + } + NBTTagCompound compound = (NBTTagCompound) raw; + NbtCompound output = new NbtCompound(); + if (compound.isEmpty()) { + return output; + } + Set keys = compound.c(); + for (String key : keys) { + output.set(key, fromMinecraftTag(compound.get(key))); + } + return output; + } + + @Override + public org.bukkit.inventory.ItemStack itemFromCompound(NbtCompound compound) { + return CraftItemStack.asBukkitCopy(ItemStack.createStack(toMinecraftCompound(compound))); + } + + @Override + public NbtCompound itemToCompound(org.bukkit.inventory.ItemStack itemStack) { + ItemStack nmsStack = CraftItemStack.asNMSCopy(itemStack); + NBTTagCompound stackTag; + if (!nmsStack.hasTag()) { + stackTag = nmsStack.save(new NBTTagCompound()); + } else { + stackTag = nmsStack.getTag(); + } + return fromMinecraftCompound(stackTag); + } + + @Override + public WrappedContext createContext(DataAdapterContext context) { + return new SimpleSyntaxContext(context); + } + + @Override + public WrapType wrap(DataType dataType) { + return new SimpleWrapType(dataType); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/EntityProvider1_9_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/EntityProvider1_9_R1.java new file mode 100644 index 0000000..7025948 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/EntityProvider1_9_R1.java @@ -0,0 +1,47 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R1; + +import java.util.EnumMap; +import java.util.function.Function; + +import org.bukkit.craftbukkit.v1_9_R1.CraftWorld; + +import net.minecraft.server.v1_9_R1.World; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R1.utils.EntityConstructors1_9_R1; +import net.sourcewriters.minecraft.vcompat.reflection.EntityProvider; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; + +public class EntityProvider1_9_R1 extends EntityProvider { + + private final EnumMap> entityMap = new EnumMap<>(NmsEntityType.class); + + protected EntityProvider1_9_R1(VersionControl1_9_R1 versionControl) { + super(versionControl); + } + + @SuppressWarnings("unchecked") + private final Function searchConstructor(NmsEntityType type) { + try { + return (Function) EntityConstructors1_9_R1.class.getField(type.name()).get(null); + } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException ignore) { + return null; + } + } + + private final Function getConstructor(NmsEntityType type) { + return entityMap.computeIfAbsent(type, (key -> searchConstructor(key))); + } + + @Override + public NmsEntity createEntity(org.bukkit.World world, NmsEntityType type) { + if (!(world instanceof CraftWorld)) { + return null; + } + Function function; + if ((function = getConstructor(type)) == null) { + return null; + } + return function.apply(((CraftWorld) world).getHandle()); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/PacketHandler1_9_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/PacketHandler1_9_R1.java new file mode 100644 index 0000000..44b7c70 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/PacketHandler1_9_R1.java @@ -0,0 +1,11 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R1; + +import net.sourcewriters.minecraft.vcompat.reflection.PacketHandler; + +public class PacketHandler1_9_R1 extends PacketHandler { + + protected PacketHandler1_9_R1(VersionControl1_9_R1 versionControl) { + super(versionControl); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/PlayerProvider1_9_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/PlayerProvider1_9_R1.java new file mode 100644 index 0000000..b044ff4 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/PlayerProvider1_9_R1.java @@ -0,0 +1,30 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R1; + +import java.io.File; +import java.util.UUID; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R1.entity.Player1_9_R1; +import net.sourcewriters.minecraft.vcompat.reflection.DataProvider; +import net.sourcewriters.minecraft.vcompat.reflection.PlayerProvider; +import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.DataDistributor; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; + +public class PlayerProvider1_9_R1 extends PlayerProvider { + + private final DataDistributor distributor; + + protected PlayerProvider1_9_R1(VersionControl1_9_R1 versionControl) { + super(versionControl); + distributor = versionControl.getDataProvider().createDistributor(new File(Bukkit.getWorlds().get(0).getWorldFolder(), "playerdata"), + uuid -> "custom_" + uuid.toString(), DataProvider.DEFAULT_RANDOM); + } + + @Override + protected NmsPlayer createPlayer(Player player) { + return new Player1_9_R1(player, distributor.get(player.getUniqueId())); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/TextureProvider1_9_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/TextureProvider1_9_R1.java new file mode 100644 index 0000000..2f106d3 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/TextureProvider1_9_R1.java @@ -0,0 +1,105 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R1; + +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_9_R1.block.CraftSkull; +import org.bukkit.craftbukkit.v1_9_R1.inventory.CraftItemStack; +import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.inventory.meta.SkullMeta; +import org.bukkit.material.MaterialData; + +import com.mojang.authlib.GameProfile; +import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; +import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.minecraft.server.v1_9_R1.GameProfileSerializer; +import net.minecraft.server.v1_9_R1.ItemStack; +import net.minecraft.server.v1_9_R1.NBTTagCompound; +import net.sourcewriters.minecraft.vcompat.reflection.TextureProvider; + +@SuppressWarnings("deprecation") +public class TextureProvider1_9_R1 extends TextureProvider { + + private final AbstractReflect craftItemStackRef = new Reflect(CraftItemStack.class).searchField("handle", "handle"); + private final AbstractReflect craftMetaSkullRef = new Reflect("org.bukkit.craftbukkit.v1_9_R1.inventory.CraftMetaSkull") + .searchField("serialized", "serializedProfile").searchField("profile", "profile"); + private final Material skullMaterial = Material.valueOf("SKULL"); + + protected TextureProvider1_9_R1(VersionControl1_9_R1 versionControl) { + super(versionControl); + } + + @Override + public GameProfile profileFromBlock(Block block) { + if (!(block instanceof CraftSkull)) { + return null; + } + return ((CraftSkull) block).getTileEntity().getGameProfile(); + } + + @Override + public GameProfile profileFromItem(org.bukkit.inventory.ItemStack itemStack) { + if (!(itemStack.getItemMeta() instanceof SkullMeta)) { + return null; + } + SkullMeta meta = (SkullMeta) itemStack.getItemMeta(); + GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue("profile", meta); + if (profile == null) { + NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue("serialized", meta); + if (compound == null) { + ItemStack stack = null; + if (itemStack instanceof CraftItemStack) { + stack = (ItemStack) craftItemStackRef.getFieldValue("handle", itemStack); + } + if (stack == null) { + stack = CraftItemStack.asNMSCopy(itemStack); + } + NBTTagCompound stackTag; + if (!stack.hasTag()) { + stackTag = stack.save(new NBTTagCompound()); + } else { + stackTag = stack.getTag(); + } + if (stackTag.hasKeyOfType("SkullOwner", 10)) { + compound = stackTag.getCompound("SkullOwner"); + } else if (stackTag.hasKeyOfType("SkullProfile", 10)) { + compound = stackTag.getCompound("SkullProfile"); + } + } + if (compound == null) { + return null; + } + profile = GameProfileSerializer.deserialize(compound); + } + return profile; + } + + @Override + public org.bukkit.inventory.ItemStack getItem(GameProfile profile) { + org.bukkit.inventory.ItemStack craftStack = CraftItemStack.asCraftCopy(new MaterialData(skullMaterial, (byte) 3).toItemStack(1)); + applyItem(craftStack, profile); + return craftStack; + } + + @Override + public boolean applyItem(org.bukkit.inventory.ItemStack itemStack, GameProfile profile) { + ItemMeta meta = itemStack.getItemMeta(); + if (!(meta instanceof SkullMeta)) { + return false; + } + SkullMeta skullMeta = (SkullMeta) meta; + craftMetaSkullRef.setFieldValue(meta, "profile", profile); + itemStack.setItemMeta(skullMeta); + return true; + } + + @Override + public boolean applyBlock(Block block, GameProfile profile) { + if (!(block instanceof CraftSkull)) { + return false; + } + ((CraftSkull) block).getTileEntity().setGameProfile(profile); + return true; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/ToolProvider1_9_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/ToolProvider1_9_R1.java new file mode 100644 index 0000000..f7d8979 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/ToolProvider1_9_R1.java @@ -0,0 +1,33 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R1; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R1.tools.BlockTools1_9_R1; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R1.tools.ServerTools1_9_R1; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R1.tools.SkinTools1_9_R1; +import net.sourcewriters.minecraft.vcompat.reflection.ToolProvider; + +public class ToolProvider1_9_R1 extends ToolProvider { + + private final BlockTools1_9_R1 blockTools = new BlockTools1_9_R1(); + private final SkinTools1_9_R1 skinTools = new SkinTools1_9_R1(); + private final ServerTools1_9_R1 serverTools = new ServerTools1_9_R1(); + + protected ToolProvider1_9_R1(VersionControl1_9_R1 versionControl) { + super(versionControl); + } + + @Override + public SkinTools1_9_R1 getSkinTools() { + return skinTools; + } + + @Override + public ServerTools1_9_R1 getServerTools() { + return serverTools; + } + + @Override + public BlockTools1_9_R1 getBlockTools() { + return blockTools; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/VersionControl1_9_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/VersionControl1_9_R1.java new file mode 100644 index 0000000..bd9158e --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/VersionControl1_9_R1.java @@ -0,0 +1,56 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R1; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R1.reflection.NmsReflection1_9_R1; +import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; +import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; + +public class VersionControl1_9_R1 extends VersionControl { + + public static VersionControl1_9_R1 INSTANCE; + + public static VersionControl1_9_R1 init() { + return INSTANCE != null ? INSTANCE : (INSTANCE = new VersionControl1_9_R1()); + } + + private final ToolProvider1_9_R1 toolProvider = new ToolProvider1_9_R1(this); + private final TextureProvider1_9_R1 textureProvider = new TextureProvider1_9_R1(this); + private final PacketHandler1_9_R1 packetHandler = new PacketHandler1_9_R1(this); + private final EntityProvider1_9_R1 entityProvider = new EntityProvider1_9_R1(this); + private final PlayerProvider1_9_R1 playerProvider = new PlayerProvider1_9_R1(this); + private final BukkitConversion1_9_R1 bukkitConversion = new BukkitConversion1_9_R1(this); + + private VersionControl1_9_R1() { + NmsReflection1_9_R1.INSTANCE.setup(ReflectionProvider.DEFAULT); + } + + @Override + public ToolProvider1_9_R1 getToolProvider() { + return toolProvider; + } + + @Override + public EntityProvider1_9_R1 getEntityProvider() { + return entityProvider; + } + + @Override + public PlayerProvider1_9_R1 getPlayerProvider() { + return playerProvider; + } + + @Override + public TextureProvider1_9_R1 getTextureProvider() { + return textureProvider; + } + + @Override + public PacketHandler1_9_R1 getPacketHandler() { + return packetHandler; + } + + @Override + public BukkitConversion1_9_R1 getBukkitConversion() { + return bukkitConversion; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/entity/ArmorStand1_9_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/entity/ArmorStand1_9_R1.java new file mode 100644 index 0000000..3fcd382 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/entity/ArmorStand1_9_R1.java @@ -0,0 +1,33 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R1.entity; + +import net.minecraft.server.v1_9_R1.EntityArmorStand; +import net.minecraft.server.v1_9_R1.World; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsArmorStand; + +public class ArmorStand1_9_R1 extends EntityLiving1_9_R1 implements NmsArmorStand { + + public ArmorStand1_9_R1(World world) { + super(new EntityArmorStand(world)); + } + + @Override + public boolean hasGravity() { + return handle.hasGravity(); + } + + @Override + public void setGravity(boolean gravity) { + handle.setGravity(gravity); + } + + @Override + public void setSmall(boolean small) { + handle.setSmall(small); + } + + @Override + public boolean isSmall() { + return handle.isSmall(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/entity/Entity1_9_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/entity/Entity1_9_R1.java new file mode 100644 index 0000000..289fe09 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/entity/Entity1_9_R1.java @@ -0,0 +1,213 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R1.entity; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.UUID; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.OfflinePlayer; +import org.bukkit.craftbukkit.v1_9_R1.CraftWorld; +import org.bukkit.craftbukkit.v1_9_R1.entity.CraftPlayer; +import org.bukkit.entity.Player; + +import net.minecraft.server.v1_9_R1.AxisAlignedBB; +import net.minecraft.server.v1_9_R1.Entity; +import net.minecraft.server.v1_9_R1.EntityTypes; +import net.minecraft.server.v1_9_R1.PacketPlayOutEntityDestroy; +import net.minecraft.server.v1_9_R1.PacketPlayOutEntityMetadata; +import net.minecraft.server.v1_9_R1.PacketPlayOutSpawnEntity; +import net.minecraft.server.v1_9_R1.PlayerConnection; +import net.minecraft.server.v1_9_R1.Vec3D; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.reflection.utils.NmsBoundingBox; + +public abstract class Entity1_9_R1 implements NmsEntity { + + protected final E handle; + + protected final List visible = Collections.synchronizedList(new ArrayList<>()); + + public Entity1_9_R1(E handle) { + this.handle = handle; + } + + @Override + public final E getHandle() { + return handle; + } + + @Override + public int getId() { + return handle.getId(); + } + + @Override + public UUID getUniqueId() { + return handle.getUniqueID(); + } + + @Override + public NmsBoundingBox getBoundingBox() { + AxisAlignedBB box = handle.getBoundingBox(); + return new NmsBoundingBox(box.a, box.b, box.c, box.d, box.e, box.f); + } + + @Override + public void setCustomName(String name) { + handle.setCustomName(name); + updateVisibility(); + } + + @Override + public String getCustomName() { + return handle.getCustomName(); + } + + @Override + public void setCustomNameVisible(boolean visible) { + handle.setCustomNameVisible(visible); + } + + @Override + public boolean isCustomNameVisible() { + return handle.getCustomNameVisible(); + } + + @Override + public void setInvisible(boolean invisible) { + handle.setInvisible(invisible); + } + + @Override + public boolean isInvisible() { + return handle.isInvisible(); + } + + @Override + public boolean isInteractable() { + return handle.isInteractable(); + } + + @Override + public boolean isCollidable() { + return handle.isCollidable(); + } + + @Override + public void setInvulnerable(boolean invulnerable) { + handle.h(invulnerable); + } + + @Override + public boolean isInvulnerable() { + return handle.isInvulnerable(null); + } + + @Override + public boolean hasGravity() { + return true; + } + + @Override + public void setGravity(boolean gravity) {} + + @Override + public void setLocation(Location location) { + handle.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); + if (location.getWorld() == null || handle.getWorld().getWorld() == location.getWorld()) { + updateVisibility(); + return; + } + handle.world = ((CraftWorld) location.getWorld()).getHandle(); + updateVisibility(); + } + + @Override + public Location getLocation() { + Vec3D vector = handle.d(); + return new Location(handle.getWorld().getWorld(), vector.x, vector.y, vector.z); + } + + @Override + public void updateVisibility() { + if (visible.isEmpty()) { + return; + } + Player[] players; + synchronized (visible) { + players = visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) + .toArray(Player[]::new); + } + hide(players); + show(players); + } + + @Override + public boolean isShown(Player player) { + synchronized (visible) { + return visible.contains(player.getUniqueId()); + } + } + + @Override + public void hide(Player... players) { + if (players.length == 0) { + return; + } + PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(handle.getId()); + for (Player player : players) { + if (!isShown(player)) { + continue; + } + ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); + synchronized (visible) { + visible.remove(player.getUniqueId()); + } + } + } + + @Override + public void show(Player... players) { + if (players.length == 0) { + return; + } + PacketPlayOutSpawnEntity packet = new PacketPlayOutSpawnEntity(handle, EntityTypes.a(handle)); + PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); + PlayerConnection connection; + for (Player player : players) { + if (isShown(player)) { + continue; + } + connection = ((CraftPlayer) player).getHandle().playerConnection; + connection.sendPacket(packet); + connection.sendPacket(metadataPacket); + synchronized (visible) { + visible.add(player.getUniqueId()); + } + } + } + + @Override + public UUID[] getVisible() { + synchronized (visible) { + return visible.toArray(new UUID[0]); + } + } + + @Override + public Player[] getVisibleAsPlayer() { + synchronized (visible) { + return visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) + .toArray(Player[]::new); + } + } + + @Override + public void kill() { + hide(getVisibleAsPlayer()); + handle.die(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/entity/EntityLiving1_9_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/entity/EntityLiving1_9_R1.java new file mode 100644 index 0000000..56214e4 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/entity/EntityLiving1_9_R1.java @@ -0,0 +1,17 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R1.entity; + +import net.minecraft.server.v1_9_R1.EntityLiving; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityLiving; + +public abstract class EntityLiving1_9_R1 extends Entity1_9_R1 implements NmsEntityLiving { + + public EntityLiving1_9_R1(E handle) { + super(handle); + } + + @Override + public void setCollidable(boolean collidable) { + handle.collides = collidable; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/entity/Player1_9_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/entity/Player1_9_R1.java new file mode 100644 index 0000000..1975fea --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/entity/Player1_9_R1.java @@ -0,0 +1,296 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R1.entity; + +import java.util.ArrayList; +import java.util.Collections; + +import org.bukkit.craftbukkit.v1_9_R1.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_9_R1.util.CraftChatMessage; +import org.bukkit.entity.Player; + +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.properties.Property; +import com.mojang.authlib.properties.PropertyMap; +import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.minecraft.server.v1_9_R1.EntityPlayer; +import net.minecraft.server.v1_9_R1.EnumItemSlot; +import net.minecraft.server.v1_9_R1.IChatBaseComponent; +import net.minecraft.server.v1_9_R1.MathHelper; +import net.minecraft.server.v1_9_R1.PacketPlayInClientCommand; +import net.minecraft.server.v1_9_R1.PacketPlayInClientCommand.EnumClientCommand; +import net.minecraft.server.v1_9_R1.PacketPlayOutChat; +import net.minecraft.server.v1_9_R1.PacketPlayOutEntityDestroy; +import net.minecraft.server.v1_9_R1.PacketPlayOutEntityEquipment; +import net.minecraft.server.v1_9_R1.PacketPlayOutEntityHeadRotation; +import net.minecraft.server.v1_9_R1.PacketPlayOutEntityMetadata; +import net.minecraft.server.v1_9_R1.PacketPlayOutEntityStatus; +import net.minecraft.server.v1_9_R1.PacketPlayOutHeldItemSlot; +import net.minecraft.server.v1_9_R1.PacketPlayOutNamedEntitySpawn; +import net.minecraft.server.v1_9_R1.PacketPlayOutPlayerInfo; +import net.minecraft.server.v1_9_R1.PacketPlayOutPlayerInfo.EnumPlayerInfoAction; +import net.minecraft.server.v1_9_R1.PacketPlayOutPlayerListHeaderFooter; +import net.minecraft.server.v1_9_R1.PacketPlayOutPosition; +import net.minecraft.server.v1_9_R1.PacketPlayOutRespawn; +import net.minecraft.server.v1_9_R1.PacketPlayOutTitle; +import net.minecraft.server.v1_9_R1.PacketPlayOutTitle.EnumTitleAction; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.PersistentContainer; +import net.sourcewriters.minecraft.vcompat.reflection.data.type.SkinDataType; +import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContainer; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; +import net.sourcewriters.minecraft.vcompat.utils.bukkit.Players; +import net.sourcewriters.minecraft.vcompat.utils.minecraft.MojangProfileServer; +import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; +import net.sourcewriters.minecraft.vcompat.utils.thread.PostAsync; +import net.minecraft.server.v1_9_R1.PlayerConnection; +import net.minecraft.server.v1_9_R1.WorldServer; + +public class Player1_9_R1 extends EntityLiving1_9_R1 implements NmsPlayer { + + private String realName; + private Skin realSkin; + + private final WrappedContainer dataAdapter; + + public Player1_9_R1(Player player, PersistentContainer container) { + super(((CraftPlayer) player).getHandle()); + this.dataAdapter = new SimpleSyntaxContainer<>(container); + update(false); + } + + @Override + public CraftPlayer getBukkitPlayer() { + return handle.getBukkitEntity(); + } + + @Override + public WrappedContainer getDataAdapter() { + return dataAdapter; + } + + @Override + public void setSkin(Skin skin) { + if (skin == null || getSkin().equals(skin)) { + return; + } + getDataAdapter().set("skin", skin, SkinDataType.WRAPPED_INSTANCE); + } + + @Override + public Skin getSkin() { + return dataAdapter.getOrDefault("skin", SkinDataType.WRAPPED_INSTANCE, realSkin); + } + + @Override + public Skin getRealSkin() { + return realSkin; + } + + @Override + public void setName(String name) { + if (getName().equals(name)) { + return; + } + if (name == null) { + getDataAdapter().remove("name"); + return; + } + getDataAdapter().set("name", name, WrapType.STRING); + } + + @Override + public String getName() { + return getDataAdapter().getOrDefault("name", WrapType.STRING, realName); + } + + @Override + public String getRealName() { + return realName; + } + + @Override + public void setPlayerListHeader(String text) { + setPlayerListHeaderAndFooter(text, getPlayerListFooter()); + } + + @Override + public String getPlayerListHeader() { + return getDataAdapter().getOrDefault("header", WrapType.STRING, ""); + } + + @Override + public void setPlayerListFooter(String text) { + setPlayerListHeaderAndFooter(getPlayerListHeader(), text); + } + + @Override + public String getPlayerListFooter() { + return getDataAdapter().getOrDefault("footer", WrapType.STRING, ""); + } + + @Override + public int getPing() { + return handle.ping; + } + + @Override + public void setPlayerListHeaderAndFooter(String header, String footer) { + getDataAdapter().set("header", header, WrapType.STRING); + getDataAdapter().set("footer", footer, WrapType.STRING); + sendPlayerListInfo(header, footer); + } + + private final void sendPlayerListInfo(String header, String footer) { + if (handle.playerConnection.isDisconnected()) { + return; + } + + IChatBaseComponent headerComponent = header.isEmpty() ? null : CraftChatMessage.fromString(header, true)[0]; + IChatBaseComponent footerComponent = footer.isEmpty() ? null : CraftChatMessage.fromString(footer, true)[0]; + + PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter(); + + Reflect reflect = ReflectionProvider.DEFAULT.getReflect("nmsPacketPlayOutPlayerListHeaderFooter"); + reflect.setFieldValue(packet, "header", headerComponent); + reflect.setFieldValue(packet, "footer", footerComponent); + + handle.playerConnection.sendPacket(packet); + } + + @Override + public void setTitleTimes(int fadeIn, int stay, int fadeOut) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TIMES, null, fadeIn, stay, fadeOut)); + } + + @Override + public void sendSubtitle(String text) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.SUBTITLE, CraftChatMessage.fromString(text)[0])); + } + + @Override + public void sendTitle(String text) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TITLE, CraftChatMessage.fromString(text)[0])); + } + + @Override + public void sendActionBar(String text) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutChat(CraftChatMessage.fromString(text)[0], (byte) 2)); + } + + @Override + public void fakeRespawn() { + if (handle.playerConnection.isDisconnected()) { + return; + } + PacketPlayOutPlayerInfo remInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER, handle); + PacketPlayOutPlayerInfo addInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.ADD_PLAYER, handle); + + PacketPlayOutEntityDestroy destroyPacket = new PacketPlayOutEntityDestroy(handle.getId()); + PacketPlayOutNamedEntitySpawn spawnPacket = new PacketPlayOutNamedEntitySpawn(handle); + PacketPlayOutEntityHeadRotation rotationPacket = new PacketPlayOutEntityHeadRotation(handle, + (byte) MathHelper.d(handle.getHeadRotation() * 256F / 360F)); + + ArrayList equipmentPackets = new ArrayList<>(); + for (EnumItemSlot slot : EnumItemSlot.values()) { + equipmentPackets.add(new PacketPlayOutEntityEquipment(handle.getId(), slot, handle.getEquipment(slot))); + } + + Player self = getBukkitPlayer(); + Player[] players = Players.getOnlineWithout(getUniqueId()); + for (Player player : players) { + if (!player.canSee(self)) { + continue; + } + PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection; + connection.sendPacket(remInfoPacket); + connection.sendPacket(addInfoPacket); + connection.sendPacket(destroyPacket); + connection.sendPacket(spawnPacket); + connection.sendPacket(rotationPacket); + for (PacketPlayOutEntityEquipment equipmentPacket : equipmentPackets) { + connection.sendPacket(equipmentPacket); + } + } + + WorldServer world = (WorldServer) handle.world; + + PacketPlayOutRespawn respawnPacket = new PacketPlayOutRespawn(handle.dimension, world.getDifficulty(), + handle.world.worldData.getType(), handle.playerInteractManager.getGameMode()); + PacketPlayOutPosition positionPacket = new PacketPlayOutPosition(handle.locX, handle.locY, handle.locZ, handle.yaw, handle.pitch, + Collections.emptySet(), 0); + PacketPlayOutHeldItemSlot itemPacket = new PacketPlayOutHeldItemSlot(handle.inventory.itemInHandIndex); + PacketPlayOutEntityStatus statusPacket = new PacketPlayOutEntityStatus(handle, (byte) 28); + PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); + + PlayerConnection connection = handle.playerConnection; + connection.sendPacket(remInfoPacket); + connection.sendPacket(addInfoPacket); + connection.sendPacket(respawnPacket); + connection.sendPacket(positionPacket); + connection.sendPacket(itemPacket); + connection.sendPacket(statusPacket); + connection.sendPacket(metadataPacket); + + handle.updateAbilities(); + handle.triggerHealthUpdate(); + handle.updateInventory(handle.defaultContainer); + if (handle.activeContainer != handle.defaultContainer) { + handle.updateInventory(handle.activeContainer); + } + self.recalculatePermissions(); + } + + @Override + public void respawn() { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayInClientCommand(EnumClientCommand.PERFORM_RESPAWN)); + } + + @Override + public void update() { + update(true); + } + + private final void update(boolean flag) { + PostAsync.forcePost(() -> { + realName = MojangProfileServer.getName(getUniqueId()); + realSkin = MojangProfileServer.getSkin(realName, getUniqueId()); + }); + if (flag) { + GameProfile profile = handle.getProfile(); + + Skin skin = getSkin(); + if (skin != null) { + PropertyMap properties = profile.getProperties(); + properties.removeAll("textures"); + properties.put("textures", new Property("textures", skin.getValue(), skin.getSignature())); + } + + String name = getName(); + if (name != null) { + ReflectionProvider.DEFAULT.getReflect("mjGameProfile").setFieldValue(profile, "name", name); + } + + if (!(name == null && skin == null)) { + fakeRespawn(); + } + } + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/reflection/NmsReflection1_9_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/reflection/NmsReflection1_9_R1.java new file mode 100644 index 0000000..3764520 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/reflection/NmsReflection1_9_R1.java @@ -0,0 +1,34 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R1.reflection; + +import net.minecraft.server.v1_9_R1.NBTTagEnd; +import net.minecraft.server.v1_9_R1.NBTTagList; +import net.minecraft.server.v1_9_R1.PacketPlayOutPlayerListHeaderFooter; +import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; +import net.sourcewriters.minecraft.vcompat.reflection.reflect.Reflections; + +public class NmsReflection1_9_R1 extends Reflections { + + public static NmsReflection1_9_R1 INSTANCE = new NmsReflection1_9_R1(); + + private NmsReflection1_9_R1() {} + + @Override + public void setup(ReflectionProvider provider) { + + // + // + // Create Reflects + // + + // + // Minecraft + + provider.createReflect("nmsPacketPlayOutPlayerListHeaderFooter", PacketPlayOutPlayerListHeaderFooter.class) + .searchField("header", "a").searchField("header", "b"); + + provider.createReflect("nmsNBTTagEnd", NBTTagEnd.class); + provider.createReflect("nmsNBTTagList", NBTTagList.class).searchField("value", "list"); + + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/tools/BlockTools1_9_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/tools/BlockTools1_9_R1.java new file mode 100644 index 0000000..8c49f1e --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/tools/BlockTools1_9_R1.java @@ -0,0 +1,39 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R1.tools; + +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_9_R1.block.CraftSkull; + +import com.mojang.authlib.properties.Property; +import com.mojang.authlib.properties.PropertyMap; +import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; +import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.minecraft.server.v1_9_R1.TileEntitySkull; +import net.sourcewriters.minecraft.vcompat.reflection.tools.BlockTools; +import net.sourcewriters.minecraft.vcompat.utils.constants.MinecraftConstants; + +public class BlockTools1_9_R1 extends BlockTools { + + private final AbstractReflect craftEntityStateRef = new Reflect(CraftSkull.class).searchField("tileEntity", "tileEntity"); + + @Override + public void setHeadTexture(Block block, String texture) { + if (!(block instanceof CraftSkull)) { + return; + } + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + PropertyMap map = entitySkull.getGameProfile().getProperties(); + map.removeAll("textures"); + map.put("textures", new Property("textures", MinecraftConstants.TEXTURE_SIGNATURE, texture)); + } + + @Override + public String getHeadTexture(Block block) { + if (!(block instanceof CraftSkull)) { + return null; + } + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + return entitySkull.getGameProfile().getProperties().get("textures").iterator().next().getValue(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/tools/ServerTools1_9_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/tools/ServerTools1_9_R1.java new file mode 100644 index 0000000..fd2d07e --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/tools/ServerTools1_9_R1.java @@ -0,0 +1,26 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R1.tools; + +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_9_R1.CraftServer; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R1.wrapper.ConsoleReaderWrapper1_9_R1; +import net.sourcewriters.minecraft.vcompat.reflection.tools.ServerTools; + +public class ServerTools1_9_R1 extends ServerTools { + + @Override + public void setMotd(String text) { + ((CraftServer) Bukkit.getServer()).getServer().setMotd(text); + } + + @Override + public String getMotd() { + return ((CraftServer) Bukkit.getServer()).getServer().getMotd(); + } + + @Override + public ConsoleReaderWrapper1_9_R1 getConsole() { + return ConsoleReaderWrapper1_9_R1.INSTANCE; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/tools/SkinTools1_9_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/tools/SkinTools1_9_R1.java new file mode 100644 index 0000000..906c94a --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/tools/SkinTools1_9_R1.java @@ -0,0 +1,16 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R1.tools; + +import org.bukkit.craftbukkit.v1_9_R1.entity.CraftPlayer; +import org.bukkit.entity.Player; + +import net.sourcewriters.minecraft.vcompat.reflection.tools.SkinTools; +import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; + +public class SkinTools1_9_R1 extends SkinTools { + + @Override + public Skin skinFromPlayer(Player player) { + return skinFromGameProfile(((CraftPlayer) player).getHandle().getProfile()); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/utils/EntityConstructors1_9_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/utils/EntityConstructors1_9_R1.java new file mode 100644 index 0000000..b66892c --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/utils/EntityConstructors1_9_R1.java @@ -0,0 +1,12 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R1.utils; + +import java.util.function.Function; + +import net.minecraft.server.v1_9_R1.World; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R1.entity.ArmorStand1_9_R1; + +public abstract class EntityConstructors1_9_R1 { + + public static final Function ARMOR_STAND = (world -> new ArmorStand1_9_R1(world)); + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/wrapper/ConsoleReaderWrapper1_9_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/wrapper/ConsoleReaderWrapper1_9_R1.java new file mode 100644 index 0000000..75b19f3 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/wrapper/ConsoleReaderWrapper1_9_R1.java @@ -0,0 +1,43 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R1.wrapper; + +import java.io.IOException; +import java.io.Writer; + +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_9_R1.CraftServer; +import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; + +import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; + +public final class ConsoleReaderWrapper1_9_R1 extends ConsoleReaderWrapper { + + public static final ConsoleReaderWrapper1_9_R1 INSTANCE = new ConsoleReaderWrapper1_9_R1(); + + private final ConsoleReader reader; + + @SuppressWarnings("resource") + private ConsoleReaderWrapper1_9_R1() { + this.reader = ((CraftServer) Bukkit.getServer()).getServer().reader; + } + + @Override + public Writer getOutput() { + return reader.getOutput(); + } + + @Override + public boolean isAnsiSupported() { + return reader.getTerminal().isAnsiSupported(); + } + + @Override + public void flush() throws IOException { + reader.flush(); + } + + @Override + public void drawLine() throws IOException { + reader.drawLine(); + } + +} diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/BukkitConversion1_9_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/BukkitConversion1_9_R2.java new file mode 100644 index 0000000..5f75039 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/BukkitConversion1_9_R2.java @@ -0,0 +1,231 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R2; + +import java.util.List; +import java.util.Set; + +import org.bukkit.craftbukkit.v1_9_R2.inventory.CraftItemStack; +import org.bukkit.entity.EntityType; + +import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; +import com.syntaxphoenix.syntaxapi.data.DataType; +import com.syntaxphoenix.syntaxapi.nbt.NbtByte; +import com.syntaxphoenix.syntaxapi.nbt.NbtByteArray; +import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; +import com.syntaxphoenix.syntaxapi.nbt.NbtDouble; +import com.syntaxphoenix.syntaxapi.nbt.NbtEnd; +import com.syntaxphoenix.syntaxapi.nbt.NbtFloat; +import com.syntaxphoenix.syntaxapi.nbt.NbtInt; +import com.syntaxphoenix.syntaxapi.nbt.NbtIntArray; +import com.syntaxphoenix.syntaxapi.nbt.NbtList; +import com.syntaxphoenix.syntaxapi.nbt.NbtLong; +import com.syntaxphoenix.syntaxapi.nbt.NbtLongArray; +import com.syntaxphoenix.syntaxapi.nbt.NbtShort; +import com.syntaxphoenix.syntaxapi.nbt.NbtString; +import com.syntaxphoenix.syntaxapi.nbt.NbtTag; +import com.syntaxphoenix.syntaxapi.nbt.NbtType; + +import net.minecraft.server.v1_9_R2.ItemStack; +import net.minecraft.server.v1_9_R2.NBTBase; +import net.minecraft.server.v1_9_R2.NBTTagByte; +import net.minecraft.server.v1_9_R2.NBTTagByteArray; +import net.minecraft.server.v1_9_R2.NBTTagCompound; +import net.minecraft.server.v1_9_R2.NBTTagDouble; +import net.minecraft.server.v1_9_R2.NBTTagEnd; +import net.minecraft.server.v1_9_R2.NBTTagFloat; +import net.minecraft.server.v1_9_R2.NBTTagInt; +import net.minecraft.server.v1_9_R2.NBTTagIntArray; +import net.minecraft.server.v1_9_R2.NBTTagList; +import net.minecraft.server.v1_9_R2.NBTTagLong; +import net.minecraft.server.v1_9_R2.NBTTagShort; +import net.minecraft.server.v1_9_R2.NBTTagString; +import net.sourcewriters.minecraft.vcompat.reflection.BukkitConversion; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContext; +import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleWrapType; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; +import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; + +public class BukkitConversion1_9_R2 extends BukkitConversion { + + protected BukkitConversion1_9_R2(VersionControl1_9_R2 versionControl) { + super(versionControl); + } + + @Override + public EntityType toEntityType(NmsEntityType type) { + try { + return EntityType.valueOf(type.name()); + } catch (IllegalArgumentException ignore) { + return null; + } + } + + @Override + public NmsEntityType fromEntityType(EntityType type) { + try { + return NmsEntityType.valueOf(type.name()); + } catch (IllegalArgumentException ignore) { + return null; + } + } + + @Override + public NBTBase toMinecraftTag(NbtTag tag) { + switch (tag.getType()) { + case BYTE: + return new NBTTagByte((byte) tag.getValue()); + case SHORT: + return new NBTTagShort((short) tag.getValue()); + case INT: + return new NBTTagInt((int) tag.getValue()); + case LONG: + return new NBTTagLong((long) tag.getValue()); + case FLOAT: + return new NBTTagFloat((float) tag.getValue()); + case DOUBLE: + return new NBTTagDouble((double) tag.getValue()); + case STRING: + return new NBTTagString((String) tag.getValue()); + case BYTE_ARRAY: + return new NBTTagByteArray((byte[]) tag.getValue()); + case INT_ARRAY: + return new NBTTagIntArray((int[]) tag.getValue()); + case LONG_ARRAY: + NBTTagList list = new NBTTagList(); + for (long value : (long[]) tag.getValue()) { + list.add(new NBTTagLong(value)); + } + return list; + case LIST: + return toMinecraftList((NbtList) tag); + case COMPOUND: + return toMinecraftCompound((NbtCompound) tag); + case END: + return (NBTTagEnd) ReflectionProvider.DEFAULT.getReflect("nmsNBTTagEnd").init(); + default: + return null; + } + } + + @Override + public NbtTag fromMinecraftTag(Object raw) { + if (!(raw instanceof NBTBase)) { + return null; + } + NBTBase tag = (NBTBase) raw; + NbtType type = NbtType.getById(tag.getTypeId()); + switch (type) { + case BYTE: + return new NbtByte(((NBTTagByte) tag).f()); + case SHORT: + return new NbtShort(((NBTTagShort) tag).e()); + case INT: + return new NbtInt(((NBTTagInt) tag).d()); + case LONG: + return new NbtLong(((NBTTagLong) tag).c()); + case FLOAT: + return new NbtFloat(((NBTTagFloat) tag).h()); + case DOUBLE: + return new NbtDouble(((NBTTagDouble) tag).g()); + case STRING: + return new NbtString(((NBTTagString) tag).a_()); + case BYTE_ARRAY: + return new NbtByteArray(((NBTTagByteArray) tag).c()); + case INT_ARRAY: + return new NbtIntArray(((NBTTagIntArray) tag).c()); + case LONG_ARRAY: + return new NbtLongArray(new long[0]); + case LIST: + return fromMinecraftList(tag); + case COMPOUND: + return fromMinecraftCompound(tag); + case END: + return NbtEnd.INSTANCE; + default: + return null; + } + } + + @Override + public NBTTagList toMinecraftList(NbtList list) { + NBTTagList output = new NBTTagList(); + for (NbtTag tag : list) { + output.add(toMinecraftTag(tag)); + } + return output; + } + + @SuppressWarnings("unchecked") + @Override + public NbtList fromMinecraftList(Object raw) { + if (!(raw instanceof NBTTagList)) { + return null; + } + NBTTagList list = (NBTTagList) raw; + List content = (List) ReflectionProvider.DEFAULT.getReflect("nmsNBTTagList").getFieldValue("value", list); + NbtList output = new NbtList<>(NbtType.getById(list.getTypeId())); + for (NBTBase base : content) { + output.add(fromMinecraftTag(base)); + } + return output; + } + + @Override + public NBTTagCompound toMinecraftCompound(NbtCompound compound) { + NBTTagCompound output = new NBTTagCompound(); + if (compound.isEmpty()) { + return output; + } + Set keys = compound.getKeys(); + for (String key : keys) { + output.set(key, toMinecraftTag(compound.get(key))); + } + return output; + } + + @Override + public NbtCompound fromMinecraftCompound(Object raw) { + if (!(raw instanceof NBTTagCompound)) { + return null; + } + NBTTagCompound compound = (NBTTagCompound) raw; + NbtCompound output = new NbtCompound(); + if (compound.isEmpty()) { + return output; + } + Set keys = compound.c(); + for (String key : keys) { + output.set(key, fromMinecraftTag(compound.get(key))); + } + return output; + } + + @Override + public org.bukkit.inventory.ItemStack itemFromCompound(NbtCompound compound) { + return CraftItemStack.asBukkitCopy(ItemStack.createStack(toMinecraftCompound(compound))); + } + + @Override + public NbtCompound itemToCompound(org.bukkit.inventory.ItemStack itemStack) { + ItemStack nmsStack = CraftItemStack.asNMSCopy(itemStack); + NBTTagCompound stackTag; + if (!nmsStack.hasTag()) { + stackTag = nmsStack.save(new NBTTagCompound()); + } else { + stackTag = nmsStack.getTag(); + } + return fromMinecraftCompound(stackTag); + } + + @Override + public WrappedContext createContext(DataAdapterContext context) { + return new SimpleSyntaxContext(context); + } + + @Override + public WrapType wrap(DataType dataType) { + return new SimpleWrapType(dataType); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/EntityProvider1_9_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/EntityProvider1_9_R2.java new file mode 100644 index 0000000..a98d760 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/EntityProvider1_9_R2.java @@ -0,0 +1,47 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R2; + +import java.util.EnumMap; +import java.util.function.Function; + +import org.bukkit.craftbukkit.v1_9_R2.CraftWorld; + +import net.minecraft.server.v1_9_R2.World; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R2.utils.EntityConstructors1_9_R2; +import net.sourcewriters.minecraft.vcompat.reflection.EntityProvider; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; + +public class EntityProvider1_9_R2 extends EntityProvider { + + private final EnumMap> entityMap = new EnumMap<>(NmsEntityType.class); + + protected EntityProvider1_9_R2(VersionControl1_9_R2 versionControl) { + super(versionControl); + } + + @SuppressWarnings("unchecked") + private final Function searchConstructor(NmsEntityType type) { + try { + return (Function) EntityConstructors1_9_R2.class.getField(type.name()).get(null); + } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException ignore) { + return null; + } + } + + private final Function getConstructor(NmsEntityType type) { + return entityMap.computeIfAbsent(type, (key -> searchConstructor(key))); + } + + @Override + public NmsEntity createEntity(org.bukkit.World world, NmsEntityType type) { + if (!(world instanceof CraftWorld)) { + return null; + } + Function function; + if ((function = getConstructor(type)) == null) { + return null; + } + return function.apply(((CraftWorld) world).getHandle()); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/PacketHandler1_9_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/PacketHandler1_9_R2.java new file mode 100644 index 0000000..adb21f7 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/PacketHandler1_9_R2.java @@ -0,0 +1,11 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R2; + +import net.sourcewriters.minecraft.vcompat.reflection.PacketHandler; + +public class PacketHandler1_9_R2 extends PacketHandler { + + protected PacketHandler1_9_R2(VersionControl1_9_R2 versionControl) { + super(versionControl); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/PlayerProvider1_9_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/PlayerProvider1_9_R2.java new file mode 100644 index 0000000..ae61347 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/PlayerProvider1_9_R2.java @@ -0,0 +1,30 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R2; + +import java.io.File; +import java.util.UUID; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R2.entity.Player1_9_R2; +import net.sourcewriters.minecraft.vcompat.reflection.DataProvider; +import net.sourcewriters.minecraft.vcompat.reflection.PlayerProvider; +import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.DataDistributor; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; + +public class PlayerProvider1_9_R2 extends PlayerProvider { + + private final DataDistributor distributor; + + protected PlayerProvider1_9_R2(VersionControl1_9_R2 versionControl) { + super(versionControl); + distributor = versionControl.getDataProvider().createDistributor(new File(Bukkit.getWorlds().get(0).getWorldFolder(), "playerdata"), + uuid -> "custom_" + uuid.toString(), DataProvider.DEFAULT_RANDOM); + } + + @Override + protected NmsPlayer createPlayer(Player player) { + return new Player1_9_R2(player, distributor.get(player.getUniqueId())); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/TextureProvider1_9_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/TextureProvider1_9_R2.java new file mode 100644 index 0000000..34d8646 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/TextureProvider1_9_R2.java @@ -0,0 +1,105 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R2; + +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_9_R2.block.CraftSkull; +import org.bukkit.craftbukkit.v1_9_R2.inventory.CraftItemStack; +import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.inventory.meta.SkullMeta; +import org.bukkit.material.MaterialData; + +import com.mojang.authlib.GameProfile; +import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; +import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.minecraft.server.v1_9_R2.GameProfileSerializer; +import net.minecraft.server.v1_9_R2.ItemStack; +import net.minecraft.server.v1_9_R2.NBTTagCompound; +import net.sourcewriters.minecraft.vcompat.reflection.TextureProvider; + +@SuppressWarnings("deprecation") +public class TextureProvider1_9_R2 extends TextureProvider { + + private final AbstractReflect craftItemStackRef = new Reflect(CraftItemStack.class).searchField("handle", "handle"); + private final AbstractReflect craftMetaSkullRef = new Reflect("org.bukkit.craftbukkit.v1_9_R2.inventory.CraftMetaSkull") + .searchField("serialized", "serializedProfile").searchField("profile", "profile"); + private final Material skullMaterial = Material.valueOf("SKULL"); + + protected TextureProvider1_9_R2(VersionControl1_9_R2 versionControl) { + super(versionControl); + } + + @Override + public GameProfile profileFromBlock(Block block) { + if (!(block instanceof CraftSkull)) { + return null; + } + return ((CraftSkull) block).getTileEntity().getGameProfile(); + } + + @Override + public GameProfile profileFromItem(org.bukkit.inventory.ItemStack itemStack) { + if (!(itemStack.getItemMeta() instanceof SkullMeta)) { + return null; + } + SkullMeta meta = (SkullMeta) itemStack.getItemMeta(); + GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue("profile", meta); + if (profile == null) { + NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue("serialized", meta); + if (compound == null) { + ItemStack stack = null; + if (itemStack instanceof CraftItemStack) { + stack = (ItemStack) craftItemStackRef.getFieldValue("handle", itemStack); + } + if (stack == null) { + stack = CraftItemStack.asNMSCopy(itemStack); + } + NBTTagCompound stackTag; + if (!stack.hasTag()) { + stackTag = stack.save(new NBTTagCompound()); + } else { + stackTag = stack.getTag(); + } + if (stackTag.hasKeyOfType("SkullOwner", 10)) { + compound = stackTag.getCompound("SkullOwner"); + } else if (stackTag.hasKeyOfType("SkullProfile", 10)) { + compound = stackTag.getCompound("SkullProfile"); + } + } + if (compound == null) { + return null; + } + profile = GameProfileSerializer.deserialize(compound); + } + return profile; + } + + @Override + public org.bukkit.inventory.ItemStack getItem(GameProfile profile) { + org.bukkit.inventory.ItemStack craftStack = CraftItemStack.asCraftCopy(new MaterialData(skullMaterial, (byte) 3).toItemStack(1)); + applyItem(craftStack, profile); + return craftStack; + } + + @Override + public boolean applyItem(org.bukkit.inventory.ItemStack itemStack, GameProfile profile) { + ItemMeta meta = itemStack.getItemMeta(); + if (!(meta instanceof SkullMeta)) { + return false; + } + SkullMeta skullMeta = (SkullMeta) meta; + craftMetaSkullRef.setFieldValue(meta, "profile", profile); + itemStack.setItemMeta(skullMeta); + return true; + } + + @Override + public boolean applyBlock(Block block, GameProfile profile) { + if (!(block instanceof CraftSkull)) { + return false; + } + ((CraftSkull) block).getTileEntity().setGameProfile(profile); + return true; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/ToolProvider1_9_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/ToolProvider1_9_R2.java new file mode 100644 index 0000000..7cdbd5f --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/ToolProvider1_9_R2.java @@ -0,0 +1,33 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R2; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R2.tools.BlockTools1_9_R2; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R2.tools.ServerTools1_9_R2; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R2.tools.SkinTools1_9_R2; +import net.sourcewriters.minecraft.vcompat.reflection.ToolProvider; + +public class ToolProvider1_9_R2 extends ToolProvider { + + private final BlockTools1_9_R2 blockTools = new BlockTools1_9_R2(); + private final SkinTools1_9_R2 skinTools = new SkinTools1_9_R2(); + private final ServerTools1_9_R2 serverTools = new ServerTools1_9_R2(); + + protected ToolProvider1_9_R2(VersionControl1_9_R2 versionControl) { + super(versionControl); + } + + @Override + public SkinTools1_9_R2 getSkinTools() { + return skinTools; + } + + @Override + public ServerTools1_9_R2 getServerTools() { + return serverTools; + } + + @Override + public BlockTools1_9_R2 getBlockTools() { + return blockTools; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/VersionControl1_9_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/VersionControl1_9_R2.java new file mode 100644 index 0000000..61cf059 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/VersionControl1_9_R2.java @@ -0,0 +1,56 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R2; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R2.reflection.NmsReflection1_9_R2; +import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; +import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; + +public class VersionControl1_9_R2 extends VersionControl { + + public static VersionControl1_9_R2 INSTANCE; + + public static VersionControl1_9_R2 init() { + return INSTANCE != null ? INSTANCE : (INSTANCE = new VersionControl1_9_R2()); + } + + private final ToolProvider1_9_R2 toolProvider = new ToolProvider1_9_R2(this); + private final TextureProvider1_9_R2 textureProvider = new TextureProvider1_9_R2(this); + private final PacketHandler1_9_R2 packetHandler = new PacketHandler1_9_R2(this); + private final EntityProvider1_9_R2 entityProvider = new EntityProvider1_9_R2(this); + private final PlayerProvider1_9_R2 playerProvider = new PlayerProvider1_9_R2(this); + private final BukkitConversion1_9_R2 bukkitConversion = new BukkitConversion1_9_R2(this); + + private VersionControl1_9_R2() { + NmsReflection1_9_R2.INSTANCE.setup(ReflectionProvider.DEFAULT); + } + + @Override + public ToolProvider1_9_R2 getToolProvider() { + return toolProvider; + } + + @Override + public EntityProvider1_9_R2 getEntityProvider() { + return entityProvider; + } + + @Override + public PlayerProvider1_9_R2 getPlayerProvider() { + return playerProvider; + } + + @Override + public TextureProvider1_9_R2 getTextureProvider() { + return textureProvider; + } + + @Override + public PacketHandler1_9_R2 getPacketHandler() { + return packetHandler; + } + + @Override + public BukkitConversion1_9_R2 getBukkitConversion() { + return bukkitConversion; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/entity/ArmorStand1_9_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/entity/ArmorStand1_9_R2.java new file mode 100644 index 0000000..ef1d103 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/entity/ArmorStand1_9_R2.java @@ -0,0 +1,33 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R2.entity; + +import net.minecraft.server.v1_9_R2.EntityArmorStand; +import net.minecraft.server.v1_9_R2.World; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsArmorStand; + +public class ArmorStand1_9_R2 extends EntityLiving1_9_R2 implements NmsArmorStand { + + public ArmorStand1_9_R2(World world) { + super(new EntityArmorStand(world)); + } + + @Override + public boolean hasGravity() { + return handle.hasGravity(); + } + + @Override + public void setGravity(boolean gravity) { + handle.setGravity(gravity); + } + + @Override + public void setSmall(boolean small) { + handle.setSmall(small); + } + + @Override + public boolean isSmall() { + return handle.isSmall(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/entity/Entity1_9_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/entity/Entity1_9_R2.java new file mode 100644 index 0000000..4b0e715 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/entity/Entity1_9_R2.java @@ -0,0 +1,213 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R2.entity; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.UUID; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.OfflinePlayer; +import org.bukkit.craftbukkit.v1_9_R2.CraftWorld; +import org.bukkit.craftbukkit.v1_9_R2.entity.CraftPlayer; +import org.bukkit.entity.Player; + +import net.minecraft.server.v1_9_R2.AxisAlignedBB; +import net.minecraft.server.v1_9_R2.Entity; +import net.minecraft.server.v1_9_R2.EntityTypes; +import net.minecraft.server.v1_9_R2.PacketPlayOutEntityDestroy; +import net.minecraft.server.v1_9_R2.PacketPlayOutEntityMetadata; +import net.minecraft.server.v1_9_R2.PacketPlayOutSpawnEntity; +import net.minecraft.server.v1_9_R2.PlayerConnection; +import net.minecraft.server.v1_9_R2.Vec3D; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.reflection.utils.NmsBoundingBox; + +public abstract class Entity1_9_R2 implements NmsEntity { + + protected final E handle; + + protected final List visible = Collections.synchronizedList(new ArrayList<>()); + + public Entity1_9_R2(E handle) { + this.handle = handle; + } + + @Override + public final E getHandle() { + return handle; + } + + @Override + public int getId() { + return handle.getId(); + } + + @Override + public UUID getUniqueId() { + return handle.getUniqueID(); + } + + @Override + public NmsBoundingBox getBoundingBox() { + AxisAlignedBB box = handle.getBoundingBox(); + return new NmsBoundingBox(box.a, box.b, box.c, box.d, box.e, box.f); + } + + @Override + public void setCustomName(String name) { + handle.setCustomName(name); + updateVisibility(); + } + + @Override + public String getCustomName() { + return handle.getCustomName(); + } + + @Override + public void setCustomNameVisible(boolean visible) { + handle.setCustomNameVisible(visible); + } + + @Override + public boolean isCustomNameVisible() { + return handle.getCustomNameVisible(); + } + + @Override + public void setInvisible(boolean invisible) { + handle.setInvisible(invisible); + } + + @Override + public boolean isInvisible() { + return handle.isInvisible(); + } + + @Override + public boolean isInteractable() { + return handle.isInteractable(); + } + + @Override + public boolean isCollidable() { + return handle.isCollidable(); + } + + @Override + public void setInvulnerable(boolean invulnerable) { + handle.setInvulnerable(invulnerable); + } + + @Override + public boolean isInvulnerable() { + return handle.isInvulnerable(null); + } + + @Override + public boolean hasGravity() { + return true; + } + + @Override + public void setGravity(boolean gravity) {} + + @Override + public void setLocation(Location location) { + handle.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); + if (location.getWorld() == null || handle.getWorld().getWorld() == location.getWorld()) { + updateVisibility(); + return; + } + handle.world = ((CraftWorld) location.getWorld()).getHandle(); + updateVisibility(); + } + + @Override + public Location getLocation() { + Vec3D vector = handle.d(); + return new Location(handle.getWorld().getWorld(), vector.x, vector.y, vector.z); + } + + @Override + public void updateVisibility() { + if (visible.isEmpty()) { + return; + } + Player[] players; + synchronized (visible) { + players = visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) + .toArray(Player[]::new); + } + hide(players); + show(players); + } + + @Override + public boolean isShown(Player player) { + synchronized (visible) { + return visible.contains(player.getUniqueId()); + } + } + + @Override + public void hide(Player... players) { + if (players.length == 0) { + return; + } + PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(handle.getId()); + for (Player player : players) { + if (!isShown(player)) { + continue; + } + ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); + synchronized (visible) { + visible.remove(player.getUniqueId()); + } + } + } + + @Override + public void show(Player... players) { + if (players.length == 0) { + return; + } + PacketPlayOutSpawnEntity packet = new PacketPlayOutSpawnEntity(handle, EntityTypes.a(handle)); + PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); + PlayerConnection connection; + for (Player player : players) { + if (isShown(player)) { + continue; + } + connection = ((CraftPlayer) player).getHandle().playerConnection; + connection.sendPacket(packet); + connection.sendPacket(metadataPacket); + synchronized (visible) { + visible.add(player.getUniqueId()); + } + } + } + + @Override + public UUID[] getVisible() { + synchronized (visible) { + return visible.toArray(new UUID[0]); + } + } + + @Override + public Player[] getVisibleAsPlayer() { + synchronized (visible) { + return visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) + .toArray(Player[]::new); + } + } + + @Override + public void kill() { + hide(getVisibleAsPlayer()); + handle.die(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/entity/EntityLiving1_9_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/entity/EntityLiving1_9_R2.java new file mode 100644 index 0000000..108ce63 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/entity/EntityLiving1_9_R2.java @@ -0,0 +1,17 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R2.entity; + +import net.minecraft.server.v1_9_R2.EntityLiving; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityLiving; + +public abstract class EntityLiving1_9_R2 extends Entity1_9_R2 implements NmsEntityLiving { + + public EntityLiving1_9_R2(E handle) { + super(handle); + } + + @Override + public void setCollidable(boolean collidable) { + handle.collides = collidable; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/entity/Player1_9_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/entity/Player1_9_R2.java new file mode 100644 index 0000000..8af125c --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/entity/Player1_9_R2.java @@ -0,0 +1,296 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R2.entity; + +import java.util.ArrayList; +import java.util.Collections; + +import org.bukkit.craftbukkit.v1_9_R2.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_9_R2.util.CraftChatMessage; +import org.bukkit.entity.Player; + +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.properties.Property; +import com.mojang.authlib.properties.PropertyMap; +import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.minecraft.server.v1_9_R2.EntityPlayer; +import net.minecraft.server.v1_9_R2.EnumItemSlot; +import net.minecraft.server.v1_9_R2.IChatBaseComponent; +import net.minecraft.server.v1_9_R2.MathHelper; +import net.minecraft.server.v1_9_R2.PacketPlayInClientCommand; +import net.minecraft.server.v1_9_R2.PacketPlayInClientCommand.EnumClientCommand; +import net.minecraft.server.v1_9_R2.PacketPlayOutChat; +import net.minecraft.server.v1_9_R2.PacketPlayOutEntityDestroy; +import net.minecraft.server.v1_9_R2.PacketPlayOutEntityEquipment; +import net.minecraft.server.v1_9_R2.PacketPlayOutEntityHeadRotation; +import net.minecraft.server.v1_9_R2.PacketPlayOutEntityMetadata; +import net.minecraft.server.v1_9_R2.PacketPlayOutEntityStatus; +import net.minecraft.server.v1_9_R2.PacketPlayOutHeldItemSlot; +import net.minecraft.server.v1_9_R2.PacketPlayOutNamedEntitySpawn; +import net.minecraft.server.v1_9_R2.PacketPlayOutPlayerInfo; +import net.minecraft.server.v1_9_R2.PacketPlayOutPlayerInfo.EnumPlayerInfoAction; +import net.minecraft.server.v1_9_R2.PacketPlayOutPlayerListHeaderFooter; +import net.minecraft.server.v1_9_R2.PacketPlayOutPosition; +import net.minecraft.server.v1_9_R2.PacketPlayOutRespawn; +import net.minecraft.server.v1_9_R2.PacketPlayOutTitle; +import net.minecraft.server.v1_9_R2.PacketPlayOutTitle.EnumTitleAction; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; +import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.PersistentContainer; +import net.sourcewriters.minecraft.vcompat.reflection.data.type.SkinDataType; +import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContainer; +import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; +import net.sourcewriters.minecraft.vcompat.utils.bukkit.Players; +import net.sourcewriters.minecraft.vcompat.utils.minecraft.MojangProfileServer; +import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; +import net.sourcewriters.minecraft.vcompat.utils.thread.PostAsync; +import net.minecraft.server.v1_9_R2.PlayerConnection; +import net.minecraft.server.v1_9_R2.WorldServer; + +public class Player1_9_R2 extends EntityLiving1_9_R2 implements NmsPlayer { + + private String realName; + private Skin realSkin; + + private final WrappedContainer dataAdapter; + + public Player1_9_R2(Player player, PersistentContainer container) { + super(((CraftPlayer) player).getHandle()); + this.dataAdapter = new SimpleSyntaxContainer<>(container); + update(false); + } + + @Override + public CraftPlayer getBukkitPlayer() { + return handle.getBukkitEntity(); + } + + @Override + public WrappedContainer getDataAdapter() { + return dataAdapter; + } + + @Override + public void setSkin(Skin skin) { + if (skin == null || getSkin().equals(skin)) { + return; + } + getDataAdapter().set("skin", skin, SkinDataType.WRAPPED_INSTANCE); + } + + @Override + public Skin getSkin() { + return dataAdapter.getOrDefault("skin", SkinDataType.WRAPPED_INSTANCE, realSkin); + } + + @Override + public Skin getRealSkin() { + return realSkin; + } + + @Override + public void setName(String name) { + if (getName().equals(name)) { + return; + } + if (name == null) { + getDataAdapter().remove("name"); + return; + } + getDataAdapter().set("name", name, WrapType.STRING); + } + + @Override + public String getName() { + return getDataAdapter().getOrDefault("name", WrapType.STRING, realName); + } + + @Override + public String getRealName() { + return realName; + } + + @Override + public void setPlayerListHeader(String text) { + setPlayerListHeaderAndFooter(text, getPlayerListFooter()); + } + + @Override + public String getPlayerListHeader() { + return getDataAdapter().getOrDefault("header", WrapType.STRING, ""); + } + + @Override + public void setPlayerListFooter(String text) { + setPlayerListHeaderAndFooter(getPlayerListHeader(), text); + } + + @Override + public String getPlayerListFooter() { + return getDataAdapter().getOrDefault("footer", WrapType.STRING, ""); + } + + @Override + public int getPing() { + return handle.ping; + } + + @Override + public void setPlayerListHeaderAndFooter(String header, String footer) { + getDataAdapter().set("header", header, WrapType.STRING); + getDataAdapter().set("footer", footer, WrapType.STRING); + sendPlayerListInfo(header, footer); + } + + private final void sendPlayerListInfo(String header, String footer) { + if (handle.playerConnection.isDisconnected()) { + return; + } + + IChatBaseComponent headerComponent = header.isEmpty() ? null : CraftChatMessage.fromString(header, true)[0]; + IChatBaseComponent footerComponent = footer.isEmpty() ? null : CraftChatMessage.fromString(footer, true)[0]; + + PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter(); + + Reflect reflect = ReflectionProvider.DEFAULT.getReflect("nmsPacketPlayOutPlayerListHeaderFooter"); + reflect.setFieldValue(packet, "header", headerComponent); + reflect.setFieldValue(packet, "footer", footerComponent); + + handle.playerConnection.sendPacket(packet); + } + + @Override + public void setTitleTimes(int fadeIn, int stay, int fadeOut) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TIMES, null, fadeIn, stay, fadeOut)); + } + + @Override + public void sendSubtitle(String text) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.SUBTITLE, CraftChatMessage.fromString(text)[0])); + } + + @Override + public void sendTitle(String text) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutTitle(EnumTitleAction.TITLE, CraftChatMessage.fromString(text)[0])); + } + + @Override + public void sendActionBar(String text) { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayOutChat(CraftChatMessage.fromString(text)[0], (byte) 2)); + } + + @Override + public void fakeRespawn() { + if (handle.playerConnection.isDisconnected()) { + return; + } + PacketPlayOutPlayerInfo remInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER, handle); + PacketPlayOutPlayerInfo addInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.ADD_PLAYER, handle); + + PacketPlayOutEntityDestroy destroyPacket = new PacketPlayOutEntityDestroy(handle.getId()); + PacketPlayOutNamedEntitySpawn spawnPacket = new PacketPlayOutNamedEntitySpawn(handle); + PacketPlayOutEntityHeadRotation rotationPacket = new PacketPlayOutEntityHeadRotation(handle, + (byte) MathHelper.d(handle.getHeadRotation() * 256F / 360F)); + + ArrayList equipmentPackets = new ArrayList<>(); + for (EnumItemSlot slot : EnumItemSlot.values()) { + equipmentPackets.add(new PacketPlayOutEntityEquipment(handle.getId(), slot, handle.getEquipment(slot))); + } + + Player self = getBukkitPlayer(); + Player[] players = Players.getOnlineWithout(getUniqueId()); + for (Player player : players) { + if (!player.canSee(self)) { + continue; + } + PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection; + connection.sendPacket(remInfoPacket); + connection.sendPacket(addInfoPacket); + connection.sendPacket(destroyPacket); + connection.sendPacket(spawnPacket); + connection.sendPacket(rotationPacket); + for (PacketPlayOutEntityEquipment equipmentPacket : equipmentPackets) { + connection.sendPacket(equipmentPacket); + } + } + + WorldServer world = (WorldServer) handle.world; + + PacketPlayOutRespawn respawnPacket = new PacketPlayOutRespawn(handle.dimension, world.getDifficulty(), + handle.world.worldData.getType(), handle.playerInteractManager.getGameMode()); + PacketPlayOutPosition positionPacket = new PacketPlayOutPosition(handle.locX, handle.locY, handle.locZ, handle.yaw, handle.pitch, + Collections.emptySet(), 0); + PacketPlayOutHeldItemSlot itemPacket = new PacketPlayOutHeldItemSlot(handle.inventory.itemInHandIndex); + PacketPlayOutEntityStatus statusPacket = new PacketPlayOutEntityStatus(handle, (byte) 28); + PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(handle.getId(), handle.getDataWatcher(), true); + + PlayerConnection connection = handle.playerConnection; + connection.sendPacket(remInfoPacket); + connection.sendPacket(addInfoPacket); + connection.sendPacket(respawnPacket); + connection.sendPacket(positionPacket); + connection.sendPacket(itemPacket); + connection.sendPacket(statusPacket); + connection.sendPacket(metadataPacket); + + handle.updateAbilities(); + handle.triggerHealthUpdate(); + handle.updateInventory(handle.defaultContainer); + if (handle.activeContainer != handle.defaultContainer) { + handle.updateInventory(handle.activeContainer); + } + self.recalculatePermissions(); + } + + @Override + public void respawn() { + if (handle.playerConnection.isDisconnected()) { + return; + } + handle.playerConnection.sendPacket(new PacketPlayInClientCommand(EnumClientCommand.PERFORM_RESPAWN)); + } + + @Override + public void update() { + update(true); + } + + private final void update(boolean flag) { + PostAsync.forcePost(() -> { + realName = MojangProfileServer.getName(getUniqueId()); + realSkin = MojangProfileServer.getSkin(realName, getUniqueId()); + }); + if (flag) { + GameProfile profile = handle.getProfile(); + + Skin skin = getSkin(); + if (skin != null) { + PropertyMap properties = profile.getProperties(); + properties.removeAll("textures"); + properties.put("textures", new Property("textures", skin.getValue(), skin.getSignature())); + } + + String name = getName(); + if (name != null) { + ReflectionProvider.DEFAULT.getReflect("mjGameProfile").setFieldValue(profile, "name", name); + } + + if (!(name == null && skin == null)) { + fakeRespawn(); + } + } + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/reflection/NmsReflection1_9_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/reflection/NmsReflection1_9_R2.java new file mode 100644 index 0000000..0b3cce9 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/reflection/NmsReflection1_9_R2.java @@ -0,0 +1,34 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R2.reflection; + +import net.minecraft.server.v1_9_R2.NBTTagEnd; +import net.minecraft.server.v1_9_R2.NBTTagList; +import net.minecraft.server.v1_9_R2.PacketPlayOutPlayerListHeaderFooter; +import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; +import net.sourcewriters.minecraft.vcompat.reflection.reflect.Reflections; + +public class NmsReflection1_9_R2 extends Reflections { + + public static NmsReflection1_9_R2 INSTANCE = new NmsReflection1_9_R2(); + + private NmsReflection1_9_R2() {} + + @Override + public void setup(ReflectionProvider provider) { + + // + // + // Create Reflects + // + + // + // Minecraft + + provider.createReflect("nmsPacketPlayOutPlayerListHeaderFooter", PacketPlayOutPlayerListHeaderFooter.class) + .searchField("header", "a").searchField("header", "b"); + + provider.createReflect("nmsNBTTagEnd", NBTTagEnd.class); + provider.createReflect("nmsNBTTagList", NBTTagList.class).searchField("value", "list"); + + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/tools/BlockTools1_9_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/tools/BlockTools1_9_R2.java new file mode 100644 index 0000000..33cf32a --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/tools/BlockTools1_9_R2.java @@ -0,0 +1,39 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R2.tools; + +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_9_R2.block.CraftSkull; + +import com.mojang.authlib.properties.Property; +import com.mojang.authlib.properties.PropertyMap; +import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; +import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.minecraft.server.v1_9_R2.TileEntitySkull; +import net.sourcewriters.minecraft.vcompat.reflection.tools.BlockTools; +import net.sourcewriters.minecraft.vcompat.utils.constants.MinecraftConstants; + +public class BlockTools1_9_R2 extends BlockTools { + + private final AbstractReflect craftEntityStateRef = new Reflect(CraftSkull.class).searchField("tileEntity", "tileEntity"); + + @Override + public void setHeadTexture(Block block, String texture) { + if (!(block instanceof CraftSkull)) { + return; + } + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + PropertyMap map = entitySkull.getGameProfile().getProperties(); + map.removeAll("textures"); + map.put("textures", new Property("textures", MinecraftConstants.TEXTURE_SIGNATURE, texture)); + } + + @Override + public String getHeadTexture(Block block) { + if (!(block instanceof CraftSkull)) { + return null; + } + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + return entitySkull.getGameProfile().getProperties().get("textures").iterator().next().getValue(); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/tools/ServerTools1_9_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/tools/ServerTools1_9_R2.java new file mode 100644 index 0000000..ed5e573 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/tools/ServerTools1_9_R2.java @@ -0,0 +1,26 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R2.tools; + +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_9_R2.CraftServer; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R2.wrapper.ConsoleReaderWrapper1_9_R2; +import net.sourcewriters.minecraft.vcompat.reflection.tools.ServerTools; + +public class ServerTools1_9_R2 extends ServerTools { + + @Override + public void setMotd(String text) { + ((CraftServer) Bukkit.getServer()).getServer().setMotd(text); + } + + @Override + public String getMotd() { + return ((CraftServer) Bukkit.getServer()).getServer().getMotd(); + } + + @Override + public ConsoleReaderWrapper1_9_R2 getConsole() { + return ConsoleReaderWrapper1_9_R2.INSTANCE; + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/tools/SkinTools1_9_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/tools/SkinTools1_9_R2.java new file mode 100644 index 0000000..9bb3700 --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/tools/SkinTools1_9_R2.java @@ -0,0 +1,16 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R2.tools; + +import org.bukkit.craftbukkit.v1_9_R2.entity.CraftPlayer; +import org.bukkit.entity.Player; + +import net.sourcewriters.minecraft.vcompat.reflection.tools.SkinTools; +import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; + +public class SkinTools1_9_R2 extends SkinTools { + + @Override + public Skin skinFromPlayer(Player player) { + return skinFromGameProfile(((CraftPlayer) player).getHandle().getProfile()); + } + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/utils/EntityConstructors1_9_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/utils/EntityConstructors1_9_R2.java new file mode 100644 index 0000000..90328cb --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/utils/EntityConstructors1_9_R2.java @@ -0,0 +1,12 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R2.utils; + +import java.util.function.Function; + +import net.minecraft.server.v1_9_R2.World; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R2.entity.ArmorStand1_9_R2; + +public abstract class EntityConstructors1_9_R2 { + + public static final Function ARMOR_STAND = (world -> new ArmorStand1_9_R2(world)); + +} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/wrapper/ConsoleReaderWrapper1_9_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/wrapper/ConsoleReaderWrapper1_9_R2.java new file mode 100644 index 0000000..167bc2a --- /dev/null +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/wrapper/ConsoleReaderWrapper1_9_R2.java @@ -0,0 +1,43 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R2.wrapper; + +import java.io.IOException; +import java.io.Writer; + +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_9_R2.CraftServer; +import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; + +import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; + +public final class ConsoleReaderWrapper1_9_R2 extends ConsoleReaderWrapper { + + public static final ConsoleReaderWrapper1_9_R2 INSTANCE = new ConsoleReaderWrapper1_9_R2(); + + private final ConsoleReader reader; + + @SuppressWarnings("resource") + private ConsoleReaderWrapper1_9_R2() { + this.reader = ((CraftServer) Bukkit.getServer()).getServer().reader; + } + + @Override + public Writer getOutput() { + return reader.getOutput(); + } + + @Override + public boolean isAnsiSupported() { + return reader.getTerminal().isAnsiSupported(); + } + + @Override + public void flush() throws IOException { + reader.flush(); + } + + @Override + public void drawLine() throws IOException { + reader.drawLine(); + } + +} From 2cbbaa9361d503709a76d0828150a77944d3ba3e Mon Sep 17 00:00:00 2001 From: Lauriichan Date: Wed, 19 Jan 2022 15:26:48 +0100 Subject: [PATCH 31/47] Update vCompat Legacy --- .../vcompat/VersionCompatProvider.java | 7 +++ .../provider/data/WrappedContainer.java | 2 +- .../data/wrap/SimpleSyntaxContainer.java | 2 +- .../v1_10_R1/BukkitConversion1_10_R1.java | 56 +++++++++--------- .../impl/v1_10_R1/EntityProvider1_10_R1.java | 6 +- .../impl/v1_10_R1/PacketHandler1_10_R1.java | 11 ---- .../impl/v1_10_R1/PlayerProvider1_10_R1.java | 8 +-- .../impl/v1_10_R1/TextureProvider1_10_R1.java | 16 ++--- .../impl/v1_10_R1/ToolProvider1_10_R1.java | 2 +- .../impl/v1_10_R1/VersionControl1_10_R1.java | 12 +--- .../v1_10_R1/entity/ArmorStand1_10_R1.java | 2 +- .../impl/v1_10_R1/entity/Entity1_10_R1.java | 4 +- .../v1_10_R1/entity/EntityLiving1_10_R1.java | 2 +- .../impl/v1_10_R1/entity/Player1_10_R1.java | 28 ++++----- .../reflection/NmsReflection1_10_R1.java | 14 ++--- .../v1_10_R1/tools/BlockTools1_10_R1.java | 14 ++--- .../v1_10_R1/tools/ServerTools1_10_R1.java | 2 +- .../impl/v1_10_R1/tools/SkinTools1_10_R1.java | 4 +- .../wrapper/ConsoleReaderWrapper1_10_R1.java | 9 ++- .../v1_11_R1/BukkitConversion1_11_R1.java | 56 +++++++++--------- .../impl/v1_11_R1/EntityProvider1_11_R1.java | 6 +- .../impl/v1_11_R1/PacketHandler1_11_R1.java | 11 ---- .../impl/v1_11_R1/PlayerProvider1_11_R1.java | 8 +-- .../impl/v1_11_R1/TextureProvider1_11_R1.java | 16 ++--- .../impl/v1_11_R1/ToolProvider1_11_R1.java | 2 +- .../impl/v1_11_R1/VersionControl1_11_R1.java | 12 +--- .../v1_11_R1/entity/ArmorStand1_11_R1.java | 2 +- .../impl/v1_11_R1/entity/Entity1_11_R1.java | 4 +- .../v1_11_R1/entity/EntityLiving1_11_R1.java | 2 +- .../impl/v1_11_R1/entity/Player1_11_R1.java | 28 ++++----- .../reflection/NmsReflection1_11_R1.java | 14 ++--- .../v1_11_R1/tools/BlockTools1_11_R1.java | 14 ++--- .../v1_11_R1/tools/ServerTools1_11_R1.java | 2 +- .../impl/v1_11_R1/tools/SkinTools1_11_R1.java | 4 +- .../wrapper/ConsoleReaderWrapper1_11_R1.java | 9 ++- .../v1_12_R1/BukkitConversion1_12_R1.java | 58 +++++++++---------- .../impl/v1_12_R1/EntityProvider1_12_R1.java | 6 +- .../impl/v1_12_R1/PacketHandler1_12_R1.java | 11 ---- .../impl/v1_12_R1/PlayerProvider1_12_R1.java | 8 +-- .../impl/v1_12_R1/TextureProvider1_12_R1.java | 22 +++---- .../impl/v1_12_R1/ToolProvider1_12_R1.java | 2 +- .../impl/v1_12_R1/VersionControl1_12_R1.java | 12 +--- .../v1_12_R1/entity/ArmorStand1_12_R1.java | 2 +- .../impl/v1_12_R1/entity/Entity1_12_R1.java | 4 +- .../v1_12_R1/entity/EntityLiving1_12_R1.java | 2 +- .../impl/v1_12_R1/entity/Player1_12_R1.java | 28 ++++----- .../reflection/NmsReflection1_12_R1.java | 16 ++--- .../v1_12_R1/tools/BlockTools1_12_R1.java | 14 ++--- .../v1_12_R1/tools/ServerTools1_12_R1.java | 2 +- .../impl/v1_12_R1/tools/SkinTools1_12_R1.java | 4 +- .../wrapper/ConsoleReaderWrapper1_12_R1.java | 9 ++- .../v1_13_R1/BukkitConversion1_13_R1.java | 50 ++++++++-------- .../impl/v1_13_R1/EntityProvider1_13_R1.java | 6 +- .../impl/v1_13_R1/PacketHandler1_13_R1.java | 11 ---- .../impl/v1_13_R1/PlayerProvider1_13_R1.java | 8 +-- .../impl/v1_13_R1/TextureProvider1_13_R1.java | 22 +++---- .../impl/v1_13_R1/ToolProvider1_13_R1.java | 2 +- .../impl/v1_13_R1/VersionControl1_13_R1.java | 10 +--- .../v1_13_R1/entity/ArmorStand1_13_R1.java | 2 +- .../impl/v1_13_R1/entity/Entity1_13_R1.java | 4 +- .../v1_13_R1/entity/EntityLiving1_13_R1.java | 2 +- .../impl/v1_13_R1/entity/Player1_13_R1.java | 24 ++++---- .../v1_13_R1/tools/BlockTools1_13_R1.java | 14 ++--- .../v1_13_R1/tools/ServerTools1_13_R1.java | 2 +- .../impl/v1_13_R1/tools/SkinTools1_13_R1.java | 4 +- .../wrapper/ConsoleReaderWrapper1_13_R1.java | 9 ++- .../v1_13_R2/BukkitConversion1_13_R2.java | 50 ++++++++-------- .../impl/v1_13_R2/EntityProvider1_13_R2.java | 6 +- .../impl/v1_13_R2/PacketHandler1_13_R2.java | 11 ---- .../impl/v1_13_R2/PlayerProvider1_13_R2.java | 8 +-- .../impl/v1_13_R2/TextureProvider1_13_R2.java | 22 +++---- .../impl/v1_13_R2/ToolProvider1_13_R2.java | 2 +- .../impl/v1_13_R2/VersionControl1_13_R2.java | 8 +-- .../v1_13_R2/entity/ArmorStand1_13_R2.java | 2 +- .../impl/v1_13_R2/entity/Entity1_13_R2.java | 4 +- .../v1_13_R2/entity/EntityLiving1_13_R2.java | 2 +- .../impl/v1_13_R2/entity/Player1_13_R2.java | 24 ++++---- .../v1_13_R2/tools/BlockTools1_13_R2.java | 14 ++--- .../v1_13_R2/tools/ServerTools1_13_R2.java | 2 +- .../impl/v1_13_R2/tools/SkinTools1_13_R2.java | 4 +- .../wrapper/ConsoleReaderWrapper1_13_R2.java | 9 ++- .../v1_14_R1/BukkitConversion1_14_R1.java | 46 +++++++-------- .../impl/v1_14_R1/EntityProvider1_14_R1.java | 6 +- .../impl/v1_14_R1/PacketHandler1_14_R1.java | 2 +- .../impl/v1_14_R1/PlayerProvider1_14_R1.java | 4 +- .../impl/v1_14_R1/TextureProvider1_14_R1.java | 22 +++---- .../impl/v1_14_R1/ToolProvider1_14_R1.java | 2 +- .../impl/v1_14_R1/VersionControl1_14_R1.java | 2 +- .../v1_14_R1/data/BukkitContainer1_14_R1.java | 14 ++--- .../v1_14_R1/data/BukkitContext1_14_R1.java | 18 +++--- .../impl/v1_14_R1/data/BukkitKey1_14_R1.java | 2 +- .../impl/v1_14_R1/data/BukkitType1_14_R1.java | 12 ++-- .../data/SimpleBukkitType1_14_R1.java | 2 +- .../v1_14_R1/data/SyntaxContainer1_14_R1.java | 34 +++++------ .../v1_14_R1/data/SyntaxContext1_14_R1.java | 8 +-- .../impl/v1_14_R1/data/SyntaxType1_14_R1.java | 12 ++-- .../v1_14_R1/data/WrappedType1_14_R1.java | 8 +-- .../BukkitContainerAdapterHook1_14_R1.java | 28 ++++----- .../v1_14_R1/entity/ArmorStand1_14_R1.java | 2 +- .../impl/v1_14_R1/entity/Entity1_14_R1.java | 4 +- .../v1_14_R1/entity/EntityLiving1_14_R1.java | 2 +- .../impl/v1_14_R1/entity/Player1_14_R1.java | 20 +++---- .../v1_14_R1/tools/BlockTools1_14_R1.java | 14 ++--- .../v1_14_R1/tools/ServerTools1_14_R1.java | 2 +- .../impl/v1_14_R1/tools/SkinTools1_14_R1.java | 4 +- .../wrapper/ConsoleReaderWrapper1_14_R1.java | 2 +- .../v1_15_R1/BukkitConversion1_15_R1.java | 46 +++++++-------- .../impl/v1_15_R1/EntityProvider1_15_R1.java | 6 +- .../impl/v1_15_R1/PacketHandler1_15_R1.java | 2 +- .../impl/v1_15_R1/PlayerProvider1_15_R1.java | 4 +- .../impl/v1_15_R1/TextureProvider1_15_R1.java | 22 +++---- .../impl/v1_15_R1/ToolProvider1_15_R1.java | 2 +- .../impl/v1_15_R1/VersionControl1_15_R1.java | 2 +- .../v1_15_R1/data/BukkitContainer1_15_R1.java | 14 ++--- .../v1_15_R1/data/BukkitContext1_15_R1.java | 18 +++--- .../impl/v1_15_R1/data/BukkitKey1_15_R1.java | 2 +- .../impl/v1_15_R1/data/BukkitType1_15_R1.java | 12 ++-- .../data/SimpleBukkitType1_15_R1.java | 2 +- .../v1_15_R1/data/SyntaxContainer1_15_R1.java | 34 +++++------ .../v1_15_R1/data/SyntaxContext1_15_R1.java | 8 +-- .../impl/v1_15_R1/data/SyntaxType1_15_R1.java | 12 ++-- .../v1_15_R1/data/WrappedType1_15_R1.java | 8 +-- .../BukkitContainerAdapterHook1_15_R1.java | 28 ++++----- .../v1_15_R1/entity/ArmorStand1_15_R1.java | 2 +- .../impl/v1_15_R1/entity/Entity1_15_R1.java | 4 +- .../v1_15_R1/entity/EntityLiving1_15_R1.java | 2 +- .../impl/v1_15_R1/entity/Player1_15_R1.java | 20 +++---- .../v1_15_R1/tools/BlockTools1_15_R1.java | 14 ++--- .../v1_15_R1/tools/ServerTools1_15_R1.java | 2 +- .../impl/v1_15_R1/tools/SkinTools1_15_R1.java | 4 +- .../wrapper/ConsoleReaderWrapper1_15_R1.java | 2 +- .../v1_16_R1/BukkitConversion1_16_R1.java | 46 +++++++-------- .../impl/v1_16_R1/EntityProvider1_16_R1.java | 6 +- .../impl/v1_16_R1/PacketHandler1_16_R1.java | 2 +- .../impl/v1_16_R1/PlayerProvider1_16_R1.java | 4 +- .../impl/v1_16_R1/TextureProvider1_16_R1.java | 22 +++---- .../impl/v1_16_R1/ToolProvider1_16_R1.java | 2 +- .../impl/v1_16_R1/VersionControl1_16_R1.java | 2 +- .../v1_16_R1/data/BukkitContainer1_16_R1.java | 14 ++--- .../v1_16_R1/data/BukkitContext1_16_R1.java | 18 +++--- .../impl/v1_16_R1/data/BukkitKey1_16_R1.java | 2 +- .../impl/v1_16_R1/data/BukkitType1_16_R1.java | 12 ++-- .../data/SimpleBukkitType1_16_R1.java | 2 +- .../v1_16_R1/data/SyntaxContainer1_16_R1.java | 34 +++++------ .../v1_16_R1/data/SyntaxContext1_16_R1.java | 8 +-- .../impl/v1_16_R1/data/SyntaxType1_16_R1.java | 12 ++-- .../v1_16_R1/data/WrappedType1_16_R1.java | 8 +-- .../BukkitContainerAdapterHook1_16_R1.java | 28 ++++----- .../v1_16_R1/entity/ArmorStand1_16_R1.java | 2 +- .../impl/v1_16_R1/entity/Entity1_16_R1.java | 4 +- .../v1_16_R1/entity/EntityLiving1_16_R1.java | 2 +- .../impl/v1_16_R1/entity/Player1_16_R1.java | 20 +++---- .../v1_16_R1/tools/BlockTools1_16_R1.java | 14 ++--- .../v1_16_R1/tools/ServerTools1_16_R1.java | 2 +- .../impl/v1_16_R1/tools/SkinTools1_16_R1.java | 4 +- .../wrapper/ConsoleReaderWrapper1_16_R1.java | 2 +- .../v1_16_R2/BukkitConversion1_16_R2.java | 46 +++++++-------- .../impl/v1_16_R2/EntityProvider1_16_R2.java | 6 +- .../impl/v1_16_R2/PacketHandler1_16_R2.java | 2 +- .../impl/v1_16_R2/PlayerProvider1_16_R2.java | 4 +- .../impl/v1_16_R2/TextureProvider1_16_R2.java | 22 +++---- .../impl/v1_16_R2/ToolProvider1_16_R2.java | 2 +- .../impl/v1_16_R2/VersionControl1_16_R2.java | 2 +- .../v1_16_R2/data/BukkitContainer1_16_R2.java | 14 ++--- .../v1_16_R2/data/BukkitContext1_16_R2.java | 18 +++--- .../impl/v1_16_R2/data/BukkitKey1_16_R2.java | 2 +- .../impl/v1_16_R2/data/BukkitType1_16_R2.java | 12 ++-- .../data/SimpleBukkitType1_16_R2.java | 2 +- .../v1_16_R2/data/SyntaxContainer1_16_R2.java | 34 +++++------ .../v1_16_R2/data/SyntaxContext1_16_R2.java | 8 +-- .../impl/v1_16_R2/data/SyntaxType1_16_R2.java | 12 ++-- .../v1_16_R2/data/WrappedType1_16_R2.java | 8 +-- .../BukkitContainerAdapterHook1_16_R2.java | 29 +++++----- .../v1_16_R2/entity/ArmorStand1_16_R2.java | 2 +- .../impl/v1_16_R2/entity/Entity1_16_R2.java | 4 +- .../v1_16_R2/entity/EntityLiving1_16_R2.java | 2 +- .../impl/v1_16_R2/entity/Player1_16_R2.java | 21 +++---- .../v1_16_R2/tools/BlockTools1_16_R2.java | 14 ++--- .../v1_16_R2/tools/ServerTools1_16_R2.java | 2 +- .../impl/v1_16_R2/tools/SkinTools1_16_R2.java | 4 +- .../wrapper/ConsoleReaderWrapper1_16_R2.java | 2 +- .../v1_16_R3/BukkitConversion1_16_R3.java | 46 +++++++-------- .../impl/v1_16_R3/EntityProvider1_16_R3.java | 6 +- .../impl/v1_16_R3/PacketHandler1_16_R3.java | 2 +- .../impl/v1_16_R3/PlayerProvider1_16_R3.java | 4 +- .../impl/v1_16_R3/TextureProvider1_16_R3.java | 22 +++---- .../impl/v1_16_R3/ToolProvider1_16_R3.java | 2 +- .../impl/v1_16_R3/VersionControl1_16_R3.java | 2 +- .../v1_16_R3/data/BukkitContainer1_16_R3.java | 14 ++--- .../v1_16_R3/data/BukkitContext1_16_R3.java | 18 +++--- .../impl/v1_16_R3/data/BukkitKey1_16_R3.java | 2 +- .../impl/v1_16_R3/data/BukkitType1_16_R3.java | 12 ++-- .../data/SimpleBukkitType1_16_R3.java | 2 +- .../v1_16_R3/data/SyntaxContainer1_16_R3.java | 34 +++++------ .../v1_16_R3/data/SyntaxContext1_16_R3.java | 8 +-- .../impl/v1_16_R3/data/SyntaxType1_16_R3.java | 12 ++-- .../v1_16_R3/data/WrappedType1_16_R3.java | 8 +-- .../BukkitContainerAdapterHook1_16_R3.java | 28 ++++----- .../v1_16_R3/entity/ArmorStand1_16_R3.java | 2 +- .../impl/v1_16_R3/entity/Entity1_16_R3.java | 4 +- .../v1_16_R3/entity/EntityLiving1_16_R3.java | 2 +- .../impl/v1_16_R3/entity/Player1_16_R3.java | 20 +++---- .../v1_16_R3/tools/BlockTools1_16_R3.java | 14 ++--- .../v1_16_R3/tools/ServerTools1_16_R3.java | 2 +- .../impl/v1_16_R3/tools/SkinTools1_16_R3.java | 4 +- .../wrapper/ConsoleReaderWrapper1_16_R3.java | 2 +- .../impl/v1_8_R1/BukkitConversion1_8_R1.java | 56 +++++++++--------- .../impl/v1_8_R1/EntityProvider1_8_R1.java | 6 +- .../impl/v1_8_R1/PacketHandler1_8_R1.java | 2 +- .../impl/v1_8_R1/PlayerProvider1_8_R1.java | 8 +-- .../impl/v1_8_R1/TextureProvider1_8_R1.java | 22 +++---- .../impl/v1_8_R1/ToolProvider1_8_R1.java | 2 +- .../impl/v1_8_R1/VersionControl1_8_R1.java | 6 +- .../impl/v1_8_R1/entity/ArmorStand1_8_R1.java | 2 +- .../impl/v1_8_R1/entity/Entity1_8_R1.java | 4 +- .../v1_8_R1/entity/EntityLiving1_8_R1.java | 2 +- .../impl/v1_8_R1/entity/Player1_8_R1.java | 28 ++++----- .../reflection/NmsReflection1_8_R1.java | 14 ++--- .../impl/v1_8_R1/tools/BlockTools1_8_R1.java | 14 ++--- .../impl/v1_8_R1/tools/ServerTools1_8_R1.java | 2 +- .../impl/v1_8_R1/tools/SkinTools1_8_R1.java | 4 +- .../wrapper/ConsoleReaderWrapper1_8_R1.java | 2 +- .../impl/v1_8_R2/BukkitConversion1_8_R2.java | 56 +++++++++--------- .../impl/v1_8_R2/EntityProvider1_8_R2.java | 6 +- .../impl/v1_8_R2/PacketHandler1_8_R2.java | 2 +- .../impl/v1_8_R2/PlayerProvider1_8_R2.java | 8 +-- .../impl/v1_8_R2/TextureProvider1_8_R2.java | 16 ++--- .../impl/v1_8_R2/ToolProvider1_8_R2.java | 2 +- .../impl/v1_8_R2/VersionControl1_8_R2.java | 6 +- .../impl/v1_8_R2/entity/ArmorStand1_8_R2.java | 2 +- .../impl/v1_8_R2/entity/Entity1_8_R2.java | 4 +- .../v1_8_R2/entity/EntityLiving1_8_R2.java | 2 +- .../impl/v1_8_R2/entity/Player1_8_R2.java | 28 ++++----- .../reflection/NmsReflection1_8_R2.java | 14 ++--- .../impl/v1_8_R2/tools/BlockTools1_8_R2.java | 14 ++--- .../impl/v1_8_R2/tools/ServerTools1_8_R2.java | 2 +- .../impl/v1_8_R2/tools/SkinTools1_8_R2.java | 4 +- .../wrapper/ConsoleReaderWrapper1_8_R2.java | 2 +- .../impl/v1_8_R3/BukkitConversion1_8_R3.java | 56 +++++++++--------- .../impl/v1_8_R3/EntityProvider1_8_R3.java | 6 +- .../impl/v1_8_R3/PacketHandler1_8_R3.java | 2 +- .../impl/v1_8_R3/PlayerProvider1_8_R3.java | 8 +-- .../impl/v1_8_R3/TextureProvider1_8_R3.java | 16 ++--- .../impl/v1_8_R3/ToolProvider1_8_R3.java | 2 +- .../impl/v1_8_R3/VersionControl1_8_R3.java | 6 +- .../impl/v1_8_R3/entity/ArmorStand1_8_R3.java | 2 +- .../impl/v1_8_R3/entity/Entity1_8_R3.java | 4 +- .../v1_8_R3/entity/EntityLiving1_8_R3.java | 2 +- .../impl/v1_8_R3/entity/Player1_8_R3.java | 28 ++++----- .../reflection/NmsReflection1_8_R3.java | 14 ++--- .../impl/v1_8_R3/tools/BlockTools1_8_R3.java | 14 ++--- .../impl/v1_8_R3/tools/ServerTools1_8_R3.java | 2 +- .../impl/v1_8_R3/tools/SkinTools1_8_R3.java | 4 +- .../wrapper/ConsoleReaderWrapper1_8_R3.java | 2 +- .../impl/v1_9_R1/BukkitConversion1_9_R1.java | 56 +++++++++--------- .../impl/v1_9_R1/EntityProvider1_9_R1.java | 6 +- .../impl/v1_9_R1/PacketHandler1_9_R1.java | 2 +- .../impl/v1_9_R1/PlayerProvider1_9_R1.java | 8 +-- .../impl/v1_9_R1/TextureProvider1_9_R1.java | 16 ++--- .../impl/v1_9_R1/ToolProvider1_9_R1.java | 2 +- .../impl/v1_9_R1/VersionControl1_9_R1.java | 6 +- .../impl/v1_9_R1/entity/ArmorStand1_9_R1.java | 2 +- .../impl/v1_9_R1/entity/Entity1_9_R1.java | 4 +- .../v1_9_R1/entity/EntityLiving1_9_R1.java | 2 +- .../impl/v1_9_R1/entity/Player1_9_R1.java | 28 ++++----- .../reflection/NmsReflection1_9_R1.java | 14 ++--- .../impl/v1_9_R1/tools/BlockTools1_9_R1.java | 14 ++--- .../impl/v1_9_R1/tools/ServerTools1_9_R1.java | 2 +- .../impl/v1_9_R1/tools/SkinTools1_9_R1.java | 4 +- .../wrapper/ConsoleReaderWrapper1_9_R1.java | 2 +- .../impl/v1_9_R2/BukkitConversion1_9_R2.java | 56 +++++++++--------- .../impl/v1_9_R2/EntityProvider1_9_R2.java | 6 +- .../impl/v1_9_R2/PacketHandler1_9_R2.java | 2 +- .../impl/v1_9_R2/PlayerProvider1_9_R2.java | 8 +-- .../impl/v1_9_R2/TextureProvider1_9_R2.java | 16 ++--- .../impl/v1_9_R2/ToolProvider1_9_R2.java | 2 +- .../impl/v1_9_R2/VersionControl1_9_R2.java | 6 +- .../impl/v1_9_R2/entity/ArmorStand1_9_R2.java | 2 +- .../impl/v1_9_R2/entity/Entity1_9_R2.java | 4 +- .../v1_9_R2/entity/EntityLiving1_9_R2.java | 2 +- .../impl/v1_9_R2/entity/Player1_9_R2.java | 28 ++++----- .../reflection/NmsReflection1_9_R2.java | 14 ++--- .../impl/v1_9_R2/tools/BlockTools1_9_R2.java | 14 ++--- .../impl/v1_9_R2/tools/ServerTools1_9_R2.java | 2 +- .../impl/v1_9_R2/tools/SkinTools1_9_R2.java | 4 +- .../wrapper/ConsoleReaderWrapper1_9_R2.java | 2 +- 286 files changed, 1543 insertions(+), 1594 deletions(-) delete mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/PacketHandler1_10_R1.java delete mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/PacketHandler1_11_R1.java delete mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/PacketHandler1_12_R1.java delete mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/PacketHandler1_13_R1.java delete mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/PacketHandler1_13_R2.java diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/VersionCompatProvider.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/VersionCompatProvider.java index 5dce17b..40d6a04 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/VersionCompatProvider.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/VersionCompatProvider.java @@ -3,6 +3,7 @@ import com.syntaxphoenix.syntaxapi.utils.java.tools.Container; import net.sourcewriters.minecraft.vcompat.provider.VersionControl; +import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookupProvider; import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookup; public abstract class VersionCompatProvider { @@ -19,11 +20,17 @@ public static VersionCompatProvider get() { } return PROVIDER.replace((VersionCompatProvider) object).lock().get(); } + + protected final ClassLookupProvider lookupProvider = new ClassLookupProvider(); /* * Impl */ public abstract VersionControl getControl(); + + public final ClassLookupProvider getLookupProvider() { + return lookupProvider; + } } diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/data/WrappedContainer.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/data/WrappedContainer.java index 656f7e7..53fa597 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/data/WrappedContainer.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/data/WrappedContainer.java @@ -16,7 +16,7 @@ public abstract class WrappedContainer { public abstract Object getHandle(); - public abstract WrappedContext getContext(); + public abstract WrappedContext getWrapContext(); public abstract IDataContainer getAsSyntaxContainer(); diff --git a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/data/wrap/SimpleSyntaxContainer.java b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/data/wrap/SimpleSyntaxContainer.java index 6d82ebc..5edc9de 100644 --- a/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/data/wrap/SimpleSyntaxContainer.java +++ b/vcompat-api/src/main/java/net/sourcewriters/minecraft/vcompat/provider/data/wrap/SimpleSyntaxContainer.java @@ -30,7 +30,7 @@ public E getAsSyntaxContainer() { */ @Override - public SimpleSyntaxContext getContext() { + public SimpleSyntaxContext getWrapContext() { return new SimpleSyntaxContext(container.getContext()); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/BukkitConversion1_10_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/BukkitConversion1_10_R1.java index c5574c5..32c966a 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/BukkitConversion1_10_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/BukkitConversion1_10_R1.java @@ -6,23 +6,24 @@ import org.bukkit.craftbukkit.v1_10_R1.inventory.CraftItemStack; import org.bukkit.entity.EntityType; -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.nbt.NbtByte; -import com.syntaxphoenix.syntaxapi.nbt.NbtByteArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; -import com.syntaxphoenix.syntaxapi.nbt.NbtDouble; -import com.syntaxphoenix.syntaxapi.nbt.NbtEnd; -import com.syntaxphoenix.syntaxapi.nbt.NbtFloat; -import com.syntaxphoenix.syntaxapi.nbt.NbtInt; -import com.syntaxphoenix.syntaxapi.nbt.NbtIntArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtList; -import com.syntaxphoenix.syntaxapi.nbt.NbtLong; -import com.syntaxphoenix.syntaxapi.nbt.NbtLongArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtShort; -import com.syntaxphoenix.syntaxapi.nbt.NbtString; -import com.syntaxphoenix.syntaxapi.nbt.NbtTag; -import com.syntaxphoenix.syntaxapi.nbt.NbtType; +import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterContext; +import net.sourcewriters.minecraft.vcompat.data.api.IDataType; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtByte; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtByteArray; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtCompound; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtDouble; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtEnd; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtFloat; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtInt; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtIntArray; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtList; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtLong; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtLongArray; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtShort; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtString; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtTag; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtType; import net.minecraft.server.v1_10_R1.ItemStack; import net.minecraft.server.v1_10_R1.NBTBase; @@ -38,13 +39,12 @@ import net.minecraft.server.v1_10_R1.NBTTagLong; import net.minecraft.server.v1_10_R1.NBTTagShort; import net.minecraft.server.v1_10_R1.NBTTagString; -import net.sourcewriters.minecraft.vcompat.reflection.BukkitConversion; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContext; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleWrapType; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; +import net.sourcewriters.minecraft.vcompat.provider.BukkitConversion; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SimpleSyntaxContext; +import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SimpleWrapType; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityType; public class BukkitConversion1_10_R1 extends BukkitConversion { @@ -102,7 +102,7 @@ public NBTBase toMinecraftTag(NbtTag tag) { case COMPOUND: return toMinecraftCompound((NbtCompound) tag); case END: - return (NBTTagEnd) ReflectionProvider.DEFAULT.getReflect("nmsNBTTagEnd").init(); + return (NBTTagEnd) VersionCompatProvider.get().getLookupProvider().getLookup("nmsNBTTagEnd").init(); default: return null; } @@ -163,7 +163,7 @@ public NbtList fromMinecraftList(Object raw) { return null; } NBTTagList list = (NBTTagList) raw; - List content = (List) ReflectionProvider.DEFAULT.getReflect("nmsNBTTagList").getFieldValue("value", list); + List content = (List) VersionCompatProvider.get().getLookupProvider().getLookup("nmsNBTTagList").getFieldValue(list, "value"); NbtList output = new NbtList<>(NbtType.getById(list.getTypeId())); for (NBTBase base : content) { output.add(fromMinecraftTag(base)); @@ -219,12 +219,12 @@ public NbtCompound itemToCompound(org.bukkit.inventory.ItemStack itemStack) { } @Override - public WrappedContext createContext(DataAdapterContext context) { + public WrappedContext createContext(IDataAdapterContext context) { return new SimpleSyntaxContext(context); } @Override - public WrapType wrap(DataType dataType) { + public WrapType wrap(IDataType dataType) { return new SimpleWrapType(dataType); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/EntityProvider1_10_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/EntityProvider1_10_R1.java index 8491a4c..6c3e98b 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/EntityProvider1_10_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/EntityProvider1_10_R1.java @@ -7,9 +7,9 @@ import net.minecraft.server.v1_10_R1.World; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_10_R1.utils.EntityConstructors1_10_R1; -import net.sourcewriters.minecraft.vcompat.reflection.EntityProvider; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; +import net.sourcewriters.minecraft.vcompat.provider.EntityProvider; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityType; public class EntityProvider1_10_R1 extends EntityProvider { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/PacketHandler1_10_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/PacketHandler1_10_R1.java deleted file mode 100644 index ebdca14..0000000 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/PacketHandler1_10_R1.java +++ /dev/null @@ -1,11 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.provider.impl.v1_10_R1; - -import net.sourcewriters.minecraft.vcompat.reflection.PacketHandler; - -public class PacketHandler1_10_R1 extends PacketHandler { - - protected PacketHandler1_10_R1(VersionControl1_10_R1 versionControl) { - super(versionControl); - } - -} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/PlayerProvider1_10_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/PlayerProvider1_10_R1.java index 6739485..165c32a 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/PlayerProvider1_10_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/PlayerProvider1_10_R1.java @@ -7,10 +7,10 @@ import org.bukkit.entity.Player; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_10_R1.entity.Player1_10_R1; -import net.sourcewriters.minecraft.vcompat.reflection.DataProvider; -import net.sourcewriters.minecraft.vcompat.reflection.PlayerProvider; -import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.DataDistributor; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.provider.DataProvider; +import net.sourcewriters.minecraft.vcompat.provider.PlayerProvider; +import net.sourcewriters.minecraft.vcompat.provider.data.persistence.DataDistributor; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsPlayer; public class PlayerProvider1_10_R1 extends PlayerProvider { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/TextureProvider1_10_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/TextureProvider1_10_R1.java index af5df2b..eea1e46 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/TextureProvider1_10_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/TextureProvider1_10_R1.java @@ -9,19 +9,19 @@ import org.bukkit.material.MaterialData; import com.mojang.authlib.GameProfile; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookup; import net.minecraft.server.v1_10_R1.GameProfileSerializer; import net.minecraft.server.v1_10_R1.ItemStack; import net.minecraft.server.v1_10_R1.NBTTagCompound; -import net.sourcewriters.minecraft.vcompat.reflection.TextureProvider; +import net.sourcewriters.minecraft.vcompat.provider.TextureProvider; @SuppressWarnings("deprecation") public class TextureProvider1_10_R1 extends TextureProvider { - private final AbstractReflect craftItemStackRef = new Reflect(CraftItemStack.class).searchField("handle", "handle"); - private final AbstractReflect craftMetaSkullRef = new Reflect("org.bukkit.craftbukkit.v1_10_R1.inventory.CraftMetaSkull") + private final ClassLookup craftItemStackRef = ClassLookup.of(CraftItemStack.class).searchField("handle", "handle"); + private final ClassLookup craftMetaSkullRef = ClassLookup.of("org.bukkit.craftbukkit.v1_10_R1.inventory.CraftMetaSkull") .searchField("serialized", "serializedProfile").searchField("profile", "profile"); private final Material skullMaterial = Material.valueOf("SKULL"); @@ -43,13 +43,13 @@ public GameProfile profileFromItem(org.bukkit.inventory.ItemStack itemStack) { return null; } SkullMeta meta = (SkullMeta) itemStack.getItemMeta(); - GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue("profile", meta); + GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue(meta, "profile"); if (profile == null) { - NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue("serialized", meta); + NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue(meta, "serialized"); if (compound == null) { ItemStack stack = null; if (itemStack instanceof CraftItemStack) { - stack = (ItemStack) craftItemStackRef.getFieldValue("handle", itemStack); + stack = (ItemStack) craftItemStackRef.getFieldValue(itemStack, "handle"); } if (stack == null) { stack = CraftItemStack.asNMSCopy(itemStack); diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/ToolProvider1_10_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/ToolProvider1_10_R1.java index 333c05f..fca01d9 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/ToolProvider1_10_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/ToolProvider1_10_R1.java @@ -3,7 +3,7 @@ import net.sourcewriters.minecraft.vcompat.provider.impl.v1_10_R1.tools.BlockTools1_10_R1; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_10_R1.tools.ServerTools1_10_R1; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_10_R1.tools.SkinTools1_10_R1; -import net.sourcewriters.minecraft.vcompat.reflection.ToolProvider; +import net.sourcewriters.minecraft.vcompat.provider.ToolProvider; public class ToolProvider1_10_R1 extends ToolProvider { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/VersionControl1_10_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/VersionControl1_10_R1.java index 9393fc1..42a75b5 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/VersionControl1_10_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/VersionControl1_10_R1.java @@ -1,8 +1,8 @@ package net.sourcewriters.minecraft.vcompat.provider.impl.v1_10_R1; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_10_R1.reflection.NmsReflection1_10_R1; -import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; +import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; +import net.sourcewriters.minecraft.vcompat.provider.VersionControl; public class VersionControl1_10_R1 extends VersionControl { @@ -14,13 +14,12 @@ public static VersionControl1_10_R1 init() { private final ToolProvider1_10_R1 toolProvider = new ToolProvider1_10_R1(this); private final TextureProvider1_10_R1 textureProvider = new TextureProvider1_10_R1(this); - private final PacketHandler1_10_R1 packetHandler = new PacketHandler1_10_R1(this); private final EntityProvider1_10_R1 entityProvider = new EntityProvider1_10_R1(this); private final PlayerProvider1_10_R1 playerProvider = new PlayerProvider1_10_R1(this); private final BukkitConversion1_10_R1 bukkitConversion = new BukkitConversion1_10_R1(this); private VersionControl1_10_R1() { - NmsReflection1_10_R1.INSTANCE.setup(ReflectionProvider.DEFAULT); + NmsReflection1_10_R1.INSTANCE.setup(VersionCompatProvider.get().getLookupProvider()); } @Override @@ -43,11 +42,6 @@ public TextureProvider1_10_R1 getTextureProvider() { return textureProvider; } - @Override - public PacketHandler1_10_R1 getPacketHandler() { - return packetHandler; - } - @Override public BukkitConversion1_10_R1 getBukkitConversion() { return bukkitConversion; diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/entity/ArmorStand1_10_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/entity/ArmorStand1_10_R1.java index f514928..9c6d319 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/entity/ArmorStand1_10_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/entity/ArmorStand1_10_R1.java @@ -2,7 +2,7 @@ import net.minecraft.server.v1_10_R1.EntityArmorStand; import net.minecraft.server.v1_10_R1.World; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsArmorStand; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsArmorStand; public class ArmorStand1_10_R1 extends EntityLiving1_10_R1 implements NmsArmorStand { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/entity/Entity1_10_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/entity/Entity1_10_R1.java index caef2d2..5918f46 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/entity/Entity1_10_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/entity/Entity1_10_R1.java @@ -20,8 +20,8 @@ import net.minecraft.server.v1_10_R1.PacketPlayOutSpawnEntity; import net.minecraft.server.v1_10_R1.PlayerConnection; import net.minecraft.server.v1_10_R1.Vec3D; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.utils.NmsBoundingBox; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.provider.utils.NmsBoundingBox; public abstract class Entity1_10_R1 implements NmsEntity { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/entity/EntityLiving1_10_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/entity/EntityLiving1_10_R1.java index a214f9c..09faf89 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/entity/EntityLiving1_10_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/entity/EntityLiving1_10_R1.java @@ -1,7 +1,7 @@ package net.sourcewriters.minecraft.vcompat.provider.impl.v1_10_R1.entity; import net.minecraft.server.v1_10_R1.EntityLiving; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityLiving; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityLiving; public abstract class EntityLiving1_10_R1 extends Entity1_10_R1 implements NmsEntityLiving { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/entity/Player1_10_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/entity/Player1_10_R1.java index f9d9e47..a28a3a8 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/entity/Player1_10_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/entity/Player1_10_R1.java @@ -10,7 +10,7 @@ import com.mojang.authlib.GameProfile; import com.mojang.authlib.properties.Property; import com.mojang.authlib.properties.PropertyMap; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookup; import net.minecraft.server.v1_10_R1.EntityPlayer; import net.minecraft.server.v1_10_R1.EnumItemSlot; @@ -33,17 +33,17 @@ import net.minecraft.server.v1_10_R1.PacketPlayOutRespawn; import net.minecraft.server.v1_10_R1.PacketPlayOutTitle; import net.minecraft.server.v1_10_R1.PacketPlayOutTitle.EnumTitleAction; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.PersistentContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.type.SkinDataType; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContainer; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; -import net.sourcewriters.minecraft.vcompat.utils.bukkit.Players; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.MojangProfileServer; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; -import net.sourcewriters.minecraft.vcompat.utils.thread.PostAsync; +import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.provider.data.persistence.PersistentContainer; +import net.sourcewriters.minecraft.vcompat.provider.data.type.SkinDataType; +import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SimpleSyntaxContainer; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.util.bukkit.Players; +import net.sourcewriters.minecraft.vcompat.util.minecraft.MojangProfileServer; +import net.sourcewriters.minecraft.vcompat.util.minecraft.Skin; +import net.sourcewriters.minecraft.vcompat.util.thread.PostAsync; import net.minecraft.server.v1_10_R1.PlayerConnection; import net.minecraft.server.v1_10_R1.WorldServer; @@ -152,7 +152,7 @@ private final void sendPlayerListInfo(String header, String footer) { PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter(); - Reflect reflect = ReflectionProvider.DEFAULT.getReflect("nmsPacketPlayOutPlayerListHeaderFooter"); + ClassLookup reflect = VersionCompatProvider.get().getLookupProvider().getLookup("nmsPacketPlayOutPlayerListHeaderFooter"); reflect.setFieldValue(packet, "header", headerComponent); reflect.setFieldValue(packet, "footer", footerComponent); @@ -284,7 +284,7 @@ private final void update(boolean flag) { String name = getName(); if (name != null) { - ReflectionProvider.DEFAULT.getReflect("mjGameProfile").setFieldValue(profile, "name", name); + VersionCompatProvider.get().getLookupProvider().getLookup("mjGameProfile").setFieldValue(profile, "name", name); } if (!(name == null && skin == null)) { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/reflection/NmsReflection1_10_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/reflection/NmsReflection1_10_R1.java index fd98afc..79b4e6f 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/reflection/NmsReflection1_10_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/reflection/NmsReflection1_10_R1.java @@ -3,17 +3,17 @@ import net.minecraft.server.v1_10_R1.NBTTagEnd; import net.minecraft.server.v1_10_R1.NBTTagList; import net.minecraft.server.v1_10_R1.PacketPlayOutPlayerListHeaderFooter; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.Reflections; +import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookupProvider; +import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookups; -public class NmsReflection1_10_R1 extends Reflections { +public class NmsReflection1_10_R1 extends ClassLookups { public static NmsReflection1_10_R1 INSTANCE = new NmsReflection1_10_R1(); private NmsReflection1_10_R1() {} @Override - public void setup(ReflectionProvider provider) { + public void setup(ClassLookupProvider provider) { // // @@ -23,11 +23,11 @@ public void setup(ReflectionProvider provider) { // // Minecraft - provider.createReflect("nmsPacketPlayOutPlayerListHeaderFooter", PacketPlayOutPlayerListHeaderFooter.class) + provider.createLookup("nmsPacketPlayOutPlayerListHeaderFooter", PacketPlayOutPlayerListHeaderFooter.class) .searchField("header", "a").searchField("header", "b"); - provider.createReflect("nmsNBTTagEnd", NBTTagEnd.class); - provider.createReflect("nmsNBTTagList", NBTTagList.class).searchField("value", "list"); + provider.createLookup("nmsNBTTagEnd", NBTTagEnd.class); + provider.createLookup("nmsNBTTagList", NBTTagList.class).searchField("value", "list"); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/tools/BlockTools1_10_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/tools/BlockTools1_10_R1.java index 21bd8ea..8bafd8e 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/tools/BlockTools1_10_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/tools/BlockTools1_10_R1.java @@ -5,23 +5,23 @@ import com.mojang.authlib.properties.Property; import com.mojang.authlib.properties.PropertyMap; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookup; import net.minecraft.server.v1_10_R1.TileEntitySkull; -import net.sourcewriters.minecraft.vcompat.reflection.tools.BlockTools; -import net.sourcewriters.minecraft.vcompat.utils.constants.MinecraftConstants; +import net.sourcewriters.minecraft.vcompat.provider.tools.BlockTools; +import net.sourcewriters.minecraft.vcompat.util.constants.MinecraftConstants; public class BlockTools1_10_R1 extends BlockTools { - private final AbstractReflect craftEntityStateRef = new Reflect(CraftSkull.class).searchField("tileEntity", "tileEntity"); + private final ClassLookup craftEntityStateRef = ClassLookup.of(CraftSkull.class).searchField("tileEntity", "tileEntity"); @Override public void setHeadTexture(Block block, String texture) { if (!(block instanceof CraftSkull)) { return; } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue(block, "tileEntity"); PropertyMap map = entitySkull.getGameProfile().getProperties(); map.removeAll("textures"); map.put("textures", new Property("textures", MinecraftConstants.TEXTURE_SIGNATURE, texture)); @@ -32,7 +32,7 @@ public String getHeadTexture(Block block) { if (!(block instanceof CraftSkull)) { return null; } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue(block, "tileEntity"); return entitySkull.getGameProfile().getProperties().get("textures").iterator().next().getValue(); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/tools/ServerTools1_10_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/tools/ServerTools1_10_R1.java index 562a77d..3991040 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/tools/ServerTools1_10_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/tools/ServerTools1_10_R1.java @@ -4,7 +4,7 @@ import org.bukkit.craftbukkit.v1_10_R1.CraftServer; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_10_R1.wrapper.ConsoleReaderWrapper1_10_R1; -import net.sourcewriters.minecraft.vcompat.reflection.tools.ServerTools; +import net.sourcewriters.minecraft.vcompat.provider.tools.ServerTools; public class ServerTools1_10_R1 extends ServerTools { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/tools/SkinTools1_10_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/tools/SkinTools1_10_R1.java index 74a3b4a..9b5d5a4 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/tools/SkinTools1_10_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/tools/SkinTools1_10_R1.java @@ -3,8 +3,8 @@ import org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer; import org.bukkit.entity.Player; -import net.sourcewriters.minecraft.vcompat.reflection.tools.SkinTools; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; +import net.sourcewriters.minecraft.vcompat.provider.tools.SkinTools; +import net.sourcewriters.minecraft.vcompat.util.minecraft.Skin; public class SkinTools1_10_R1 extends SkinTools { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/wrapper/ConsoleReaderWrapper1_10_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/wrapper/ConsoleReaderWrapper1_10_R1.java index bf188ef..02b9985 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/wrapper/ConsoleReaderWrapper1_10_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_10_R1/wrapper/ConsoleReaderWrapper1_10_R1.java @@ -5,9 +5,10 @@ import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_10_R1.CraftServer; +import org.bukkit.craftbukkit.Main; import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; -import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; +import net.sourcewriters.minecraft.vcompat.provider.wrapper.ConsoleReaderWrapper; public final class ConsoleReaderWrapper1_10_R1 extends ConsoleReaderWrapper { @@ -15,7 +16,6 @@ public final class ConsoleReaderWrapper1_10_R1 extends ConsoleReaderWrapper { private final ConsoleReader reader; - @SuppressWarnings("resource") private ConsoleReaderWrapper1_10_R1() { this.reader = ((CraftServer) Bukkit.getServer()).getServer().reader; } @@ -40,4 +40,9 @@ public void drawLine() throws IOException { reader.drawLine(); } + @Override + public boolean isJLineSupported() { + return Main.useJline; + } + } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/BukkitConversion1_11_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/BukkitConversion1_11_R1.java index b1a2404..348b109 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/BukkitConversion1_11_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/BukkitConversion1_11_R1.java @@ -6,23 +6,24 @@ import org.bukkit.craftbukkit.v1_11_R1.inventory.CraftItemStack; import org.bukkit.entity.EntityType; -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.nbt.NbtByte; -import com.syntaxphoenix.syntaxapi.nbt.NbtByteArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; -import com.syntaxphoenix.syntaxapi.nbt.NbtDouble; -import com.syntaxphoenix.syntaxapi.nbt.NbtEnd; -import com.syntaxphoenix.syntaxapi.nbt.NbtFloat; -import com.syntaxphoenix.syntaxapi.nbt.NbtInt; -import com.syntaxphoenix.syntaxapi.nbt.NbtIntArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtList; -import com.syntaxphoenix.syntaxapi.nbt.NbtLong; -import com.syntaxphoenix.syntaxapi.nbt.NbtLongArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtShort; -import com.syntaxphoenix.syntaxapi.nbt.NbtString; -import com.syntaxphoenix.syntaxapi.nbt.NbtTag; -import com.syntaxphoenix.syntaxapi.nbt.NbtType; +import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterContext; +import net.sourcewriters.minecraft.vcompat.data.api.IDataType; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtByte; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtByteArray; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtCompound; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtDouble; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtEnd; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtFloat; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtInt; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtIntArray; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtList; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtLong; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtLongArray; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtShort; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtString; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtTag; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtType; import net.minecraft.server.v1_11_R1.ItemStack; import net.minecraft.server.v1_11_R1.NBTBase; @@ -38,13 +39,12 @@ import net.minecraft.server.v1_11_R1.NBTTagLong; import net.minecraft.server.v1_11_R1.NBTTagShort; import net.minecraft.server.v1_11_R1.NBTTagString; -import net.sourcewriters.minecraft.vcompat.reflection.BukkitConversion; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContext; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleWrapType; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; +import net.sourcewriters.minecraft.vcompat.provider.BukkitConversion; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SimpleSyntaxContext; +import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SimpleWrapType; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityType; public class BukkitConversion1_11_R1 extends BukkitConversion { @@ -102,7 +102,7 @@ public NBTBase toMinecraftTag(NbtTag tag) { case COMPOUND: return toMinecraftCompound((NbtCompound) tag); case END: - return (NBTTagEnd) ReflectionProvider.DEFAULT.getReflect("nmsNBTTagEnd").init(); + return (NBTTagEnd) VersionCompatProvider.get().getLookupProvider().getLookup("nmsNBTTagEnd").init(); default: return null; } @@ -163,7 +163,7 @@ public NbtList fromMinecraftList(Object raw) { return null; } NBTTagList list = (NBTTagList) raw; - List content = (List) ReflectionProvider.DEFAULT.getReflect("nmsNBTTagList").getFieldValue("value", list); + List content = (List) VersionCompatProvider.get().getLookupProvider().getLookup("nmsNBTTagList").getFieldValue(list, "value"); NbtList output = new NbtList<>(NbtType.getById(list.getTypeId())); for (NBTBase base : content) { output.add(fromMinecraftTag(base)); @@ -216,12 +216,12 @@ public NbtCompound itemToCompound(org.bukkit.inventory.ItemStack itemStack) { } @Override - public WrappedContext createContext(DataAdapterContext context) { + public WrappedContext createContext(IDataAdapterContext context) { return new SimpleSyntaxContext(context); } @Override - public WrapType wrap(DataType dataType) { + public WrapType wrap(IDataType dataType) { return new SimpleWrapType(dataType); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/EntityProvider1_11_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/EntityProvider1_11_R1.java index e6a909d..1ee1c68 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/EntityProvider1_11_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/EntityProvider1_11_R1.java @@ -7,9 +7,9 @@ import net.minecraft.server.v1_11_R1.World; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_11_R1.utils.EntityConstructors1_11_R1; -import net.sourcewriters.minecraft.vcompat.reflection.EntityProvider; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; +import net.sourcewriters.minecraft.vcompat.provider.EntityProvider; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityType; public class EntityProvider1_11_R1 extends EntityProvider { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/PacketHandler1_11_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/PacketHandler1_11_R1.java deleted file mode 100644 index 0a4ad68..0000000 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/PacketHandler1_11_R1.java +++ /dev/null @@ -1,11 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.provider.impl.v1_11_R1; - -import net.sourcewriters.minecraft.vcompat.reflection.PacketHandler; - -public class PacketHandler1_11_R1 extends PacketHandler { - - protected PacketHandler1_11_R1(VersionControl1_11_R1 versionControl) { - super(versionControl); - } - -} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/PlayerProvider1_11_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/PlayerProvider1_11_R1.java index 8f15908..1d80788 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/PlayerProvider1_11_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/PlayerProvider1_11_R1.java @@ -7,10 +7,10 @@ import org.bukkit.entity.Player; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_11_R1.entity.Player1_11_R1; -import net.sourcewriters.minecraft.vcompat.reflection.DataProvider; -import net.sourcewriters.minecraft.vcompat.reflection.PlayerProvider; -import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.DataDistributor; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.provider.DataProvider; +import net.sourcewriters.minecraft.vcompat.provider.PlayerProvider; +import net.sourcewriters.minecraft.vcompat.provider.data.persistence.DataDistributor; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsPlayer; public class PlayerProvider1_11_R1 extends PlayerProvider { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/TextureProvider1_11_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/TextureProvider1_11_R1.java index 719c033..ee263d1 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/TextureProvider1_11_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/TextureProvider1_11_R1.java @@ -9,19 +9,19 @@ import org.bukkit.material.MaterialData; import com.mojang.authlib.GameProfile; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookup; import net.minecraft.server.v1_11_R1.GameProfileSerializer; import net.minecraft.server.v1_11_R1.ItemStack; import net.minecraft.server.v1_11_R1.NBTTagCompound; -import net.sourcewriters.minecraft.vcompat.reflection.TextureProvider; +import net.sourcewriters.minecraft.vcompat.provider.TextureProvider; @SuppressWarnings("deprecation") public class TextureProvider1_11_R1 extends TextureProvider { - private final AbstractReflect craftItemStackRef = new Reflect(CraftItemStack.class).searchField("handle", "handle"); - private final AbstractReflect craftMetaSkullRef = new Reflect("org.bukkit.craftbukkit.v1_11_R1.inventory.CraftMetaSkull") + private final ClassLookup craftItemStackRef = ClassLookup.of(CraftItemStack.class).searchField("handle", "handle"); + private final ClassLookup craftMetaSkullRef = ClassLookup.of("org.bukkit.craftbukkit.v1_11_R1.inventory.CraftMetaSkull") .searchField("serialized", "serializedProfile").searchField("profile", "profile"); private final Material skullMaterial = Material.valueOf("SKULL"); @@ -43,13 +43,13 @@ public GameProfile profileFromItem(org.bukkit.inventory.ItemStack itemStack) { return null; } SkullMeta meta = (SkullMeta) itemStack.getItemMeta(); - GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue("profile", meta); + GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue(meta, "profile"); if (profile == null) { - NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue("serialized", meta); + NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue(meta, "serialized"); if (compound == null) { ItemStack stack = null; if (itemStack instanceof CraftItemStack) { - stack = (ItemStack) craftItemStackRef.getFieldValue("handle", itemStack); + stack = (ItemStack) craftItemStackRef.getFieldValue(itemStack, "handle"); } if (stack == null) { stack = CraftItemStack.asNMSCopy(itemStack); diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/ToolProvider1_11_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/ToolProvider1_11_R1.java index d644819..e35c518 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/ToolProvider1_11_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/ToolProvider1_11_R1.java @@ -3,7 +3,7 @@ import net.sourcewriters.minecraft.vcompat.provider.impl.v1_11_R1.tools.BlockTools1_11_R1; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_11_R1.tools.ServerTools1_11_R1; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_11_R1.tools.SkinTools1_11_R1; -import net.sourcewriters.minecraft.vcompat.reflection.ToolProvider; +import net.sourcewriters.minecraft.vcompat.provider.ToolProvider; public class ToolProvider1_11_R1 extends ToolProvider { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/VersionControl1_11_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/VersionControl1_11_R1.java index 7eca41f..08a6494 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/VersionControl1_11_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/VersionControl1_11_R1.java @@ -1,8 +1,8 @@ package net.sourcewriters.minecraft.vcompat.provider.impl.v1_11_R1; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_11_R1.reflection.NmsReflection1_11_R1; -import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; +import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; +import net.sourcewriters.minecraft.vcompat.provider.VersionControl; public class VersionControl1_11_R1 extends VersionControl { @@ -14,13 +14,12 @@ public static VersionControl1_11_R1 init() { private final ToolProvider1_11_R1 toolProvider = new ToolProvider1_11_R1(this); private final TextureProvider1_11_R1 textureProvider = new TextureProvider1_11_R1(this); - private final PacketHandler1_11_R1 packetHandler = new PacketHandler1_11_R1(this); private final EntityProvider1_11_R1 entityProvider = new EntityProvider1_11_R1(this); private final PlayerProvider1_11_R1 playerProvider = new PlayerProvider1_11_R1(this); private final BukkitConversion1_11_R1 bukkitConversion = new BukkitConversion1_11_R1(this); private VersionControl1_11_R1() { - NmsReflection1_11_R1.INSTANCE.setup(ReflectionProvider.DEFAULT); + NmsReflection1_11_R1.INSTANCE.setup(VersionCompatProvider.get().getLookupProvider()); } @Override @@ -43,11 +42,6 @@ public TextureProvider1_11_R1 getTextureProvider() { return textureProvider; } - @Override - public PacketHandler1_11_R1 getPacketHandler() { - return packetHandler; - } - @Override public BukkitConversion1_11_R1 getBukkitConversion() { return bukkitConversion; diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/entity/ArmorStand1_11_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/entity/ArmorStand1_11_R1.java index 33b538d..d91b85c 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/entity/ArmorStand1_11_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/entity/ArmorStand1_11_R1.java @@ -2,7 +2,7 @@ import net.minecraft.server.v1_11_R1.EntityArmorStand; import net.minecraft.server.v1_11_R1.World; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsArmorStand; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsArmorStand; public class ArmorStand1_11_R1 extends EntityLiving1_11_R1 implements NmsArmorStand { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/entity/Entity1_11_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/entity/Entity1_11_R1.java index e6d930b..a576851 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/entity/Entity1_11_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/entity/Entity1_11_R1.java @@ -20,8 +20,8 @@ import net.minecraft.server.v1_11_R1.PacketPlayOutSpawnEntity; import net.minecraft.server.v1_11_R1.PlayerConnection; import net.minecraft.server.v1_11_R1.Vec3D; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.utils.NmsBoundingBox; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.provider.utils.NmsBoundingBox; public abstract class Entity1_11_R1 implements NmsEntity { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/entity/EntityLiving1_11_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/entity/EntityLiving1_11_R1.java index e935246..94dc7ec 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/entity/EntityLiving1_11_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/entity/EntityLiving1_11_R1.java @@ -1,7 +1,7 @@ package net.sourcewriters.minecraft.vcompat.provider.impl.v1_11_R1.entity; import net.minecraft.server.v1_11_R1.EntityLiving; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityLiving; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityLiving; public abstract class EntityLiving1_11_R1 extends Entity1_11_R1 implements NmsEntityLiving { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/entity/Player1_11_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/entity/Player1_11_R1.java index c9b3620..0465baa 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/entity/Player1_11_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/entity/Player1_11_R1.java @@ -10,7 +10,7 @@ import com.mojang.authlib.GameProfile; import com.mojang.authlib.properties.Property; import com.mojang.authlib.properties.PropertyMap; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookup; import net.minecraft.server.v1_11_R1.EntityPlayer; import net.minecraft.server.v1_11_R1.EnumItemSlot; @@ -32,17 +32,17 @@ import net.minecraft.server.v1_11_R1.PacketPlayOutRespawn; import net.minecraft.server.v1_11_R1.PacketPlayOutTitle; import net.minecraft.server.v1_11_R1.PacketPlayOutTitle.EnumTitleAction; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.PersistentContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.type.SkinDataType; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContainer; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; -import net.sourcewriters.minecraft.vcompat.utils.bukkit.Players; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.MojangProfileServer; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; -import net.sourcewriters.minecraft.vcompat.utils.thread.PostAsync; +import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.provider.data.persistence.PersistentContainer; +import net.sourcewriters.minecraft.vcompat.provider.data.type.SkinDataType; +import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SimpleSyntaxContainer; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.util.bukkit.Players; +import net.sourcewriters.minecraft.vcompat.util.minecraft.MojangProfileServer; +import net.sourcewriters.minecraft.vcompat.util.minecraft.Skin; +import net.sourcewriters.minecraft.vcompat.util.thread.PostAsync; import net.minecraft.server.v1_11_R1.PlayerConnection; import net.minecraft.server.v1_11_R1.WorldServer; @@ -151,7 +151,7 @@ private final void sendPlayerListInfo(String header, String footer) { PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter(); - Reflect reflect = ReflectionProvider.DEFAULT.getReflect("nmsPacketPlayOutPlayerListHeaderFooter"); + ClassLookup reflect = VersionCompatProvider.get().getLookupProvider().getLookup("nmsPacketPlayOutPlayerListHeaderFooter"); reflect.setFieldValue(packet, "header", headerComponent); reflect.setFieldValue(packet, "footer", footerComponent); @@ -283,7 +283,7 @@ private final void update(boolean flag) { String name = getName(); if (name != null) { - ReflectionProvider.DEFAULT.getReflect("mjGameProfile").setFieldValue(profile, "name", name); + VersionCompatProvider.get().getLookupProvider().getLookup("mjGameProfile").setFieldValue(profile, "name", name); } if (!(name == null && skin == null)) { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/reflection/NmsReflection1_11_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/reflection/NmsReflection1_11_R1.java index 95e4bf1..36012d0 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/reflection/NmsReflection1_11_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/reflection/NmsReflection1_11_R1.java @@ -3,17 +3,17 @@ import net.minecraft.server.v1_11_R1.NBTTagEnd; import net.minecraft.server.v1_11_R1.NBTTagList; import net.minecraft.server.v1_11_R1.PacketPlayOutPlayerListHeaderFooter; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.Reflections; +import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookupProvider; +import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookups; -public class NmsReflection1_11_R1 extends Reflections { +public class NmsReflection1_11_R1 extends ClassLookups { public static NmsReflection1_11_R1 INSTANCE = new NmsReflection1_11_R1(); private NmsReflection1_11_R1() {} @Override - public void setup(ReflectionProvider provider) { + public void setup(ClassLookupProvider provider) { // // @@ -23,11 +23,11 @@ public void setup(ReflectionProvider provider) { // // Minecraft - provider.createReflect("nmsPacketPlayOutPlayerListHeaderFooter", PacketPlayOutPlayerListHeaderFooter.class) + provider.createLookup("nmsPacketPlayOutPlayerListHeaderFooter", PacketPlayOutPlayerListHeaderFooter.class) .searchField("header", "a").searchField("header", "b"); - provider.createReflect("nmsNBTTagEnd", NBTTagEnd.class); - provider.createReflect("nmsNBTTagList", NBTTagList.class).searchField("value", "list"); + provider.createLookup("nmsNBTTagEnd", NBTTagEnd.class); + provider.createLookup("nmsNBTTagList", NBTTagList.class).searchField("value", "list"); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/tools/BlockTools1_11_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/tools/BlockTools1_11_R1.java index 2f251c9..029f1d4 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/tools/BlockTools1_11_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/tools/BlockTools1_11_R1.java @@ -5,23 +5,23 @@ import com.mojang.authlib.properties.Property; import com.mojang.authlib.properties.PropertyMap; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookup; import net.minecraft.server.v1_11_R1.TileEntitySkull; -import net.sourcewriters.minecraft.vcompat.reflection.tools.BlockTools; -import net.sourcewriters.minecraft.vcompat.utils.constants.MinecraftConstants; +import net.sourcewriters.minecraft.vcompat.provider.tools.BlockTools; +import net.sourcewriters.minecraft.vcompat.util.constants.MinecraftConstants; public class BlockTools1_11_R1 extends BlockTools { - private final AbstractReflect craftEntityStateRef = new Reflect(CraftSkull.class).searchField("tileEntity", "tileEntity"); + private final ClassLookup craftEntityStateRef = ClassLookup.of(CraftSkull.class).searchField("tileEntity", "tileEntity"); @Override public void setHeadTexture(Block block, String texture) { if (!(block instanceof CraftSkull)) { return; } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue(block, "tileEntity"); PropertyMap map = entitySkull.getGameProfile().getProperties(); map.removeAll("textures"); map.put("textures", new Property("textures", MinecraftConstants.TEXTURE_SIGNATURE, texture)); @@ -32,7 +32,7 @@ public String getHeadTexture(Block block) { if (!(block instanceof CraftSkull)) { return null; } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue(block, "tileEntity"); return entitySkull.getGameProfile().getProperties().get("textures").iterator().next().getValue(); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/tools/ServerTools1_11_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/tools/ServerTools1_11_R1.java index 725d6eb..a57cdfd 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/tools/ServerTools1_11_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/tools/ServerTools1_11_R1.java @@ -4,7 +4,7 @@ import org.bukkit.craftbukkit.v1_11_R1.CraftServer; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_11_R1.wrapper.ConsoleReaderWrapper1_11_R1; -import net.sourcewriters.minecraft.vcompat.reflection.tools.ServerTools; +import net.sourcewriters.minecraft.vcompat.provider.tools.ServerTools; public class ServerTools1_11_R1 extends ServerTools { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/tools/SkinTools1_11_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/tools/SkinTools1_11_R1.java index 24793f9..6539288 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/tools/SkinTools1_11_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/tools/SkinTools1_11_R1.java @@ -3,8 +3,8 @@ import org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer; import org.bukkit.entity.Player; -import net.sourcewriters.minecraft.vcompat.reflection.tools.SkinTools; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; +import net.sourcewriters.minecraft.vcompat.provider.tools.SkinTools; +import net.sourcewriters.minecraft.vcompat.util.minecraft.Skin; public class SkinTools1_11_R1 extends SkinTools { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/wrapper/ConsoleReaderWrapper1_11_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/wrapper/ConsoleReaderWrapper1_11_R1.java index d570129..fae0c3a 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/wrapper/ConsoleReaderWrapper1_11_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_11_R1/wrapper/ConsoleReaderWrapper1_11_R1.java @@ -5,9 +5,10 @@ import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_11_R1.CraftServer; +import org.bukkit.craftbukkit.Main; import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; -import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; +import net.sourcewriters.minecraft.vcompat.provider.wrapper.ConsoleReaderWrapper; public final class ConsoleReaderWrapper1_11_R1 extends ConsoleReaderWrapper { @@ -15,7 +16,6 @@ public final class ConsoleReaderWrapper1_11_R1 extends ConsoleReaderWrapper { private final ConsoleReader reader; - @SuppressWarnings("resource") private ConsoleReaderWrapper1_11_R1() { this.reader = ((CraftServer) Bukkit.getServer()).getServer().reader; } @@ -40,4 +40,9 @@ public void drawLine() throws IOException { reader.drawLine(); } + @Override + public boolean isJLineSupported() { + return Main.useJline; + } + } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/BukkitConversion1_12_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/BukkitConversion1_12_R1.java index 6a56a31..b3e9809 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/BukkitConversion1_12_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/BukkitConversion1_12_R1.java @@ -6,23 +6,24 @@ import org.bukkit.craftbukkit.v1_12_R1.inventory.CraftItemStack; import org.bukkit.entity.EntityType; -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.nbt.NbtByte; -import com.syntaxphoenix.syntaxapi.nbt.NbtByteArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; -import com.syntaxphoenix.syntaxapi.nbt.NbtDouble; -import com.syntaxphoenix.syntaxapi.nbt.NbtEnd; -import com.syntaxphoenix.syntaxapi.nbt.NbtFloat; -import com.syntaxphoenix.syntaxapi.nbt.NbtInt; -import com.syntaxphoenix.syntaxapi.nbt.NbtIntArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtList; -import com.syntaxphoenix.syntaxapi.nbt.NbtLong; -import com.syntaxphoenix.syntaxapi.nbt.NbtLongArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtShort; -import com.syntaxphoenix.syntaxapi.nbt.NbtString; -import com.syntaxphoenix.syntaxapi.nbt.NbtTag; -import com.syntaxphoenix.syntaxapi.nbt.NbtType; +import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterContext; +import net.sourcewriters.minecraft.vcompat.data.api.IDataType; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtByte; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtByteArray; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtCompound; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtDouble; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtEnd; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtFloat; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtInt; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtIntArray; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtList; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtLong; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtLongArray; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtShort; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtString; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtTag; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtType; import net.minecraft.server.v1_12_R1.ItemStack; import net.minecraft.server.v1_12_R1.NBTBase; @@ -39,13 +40,12 @@ import net.minecraft.server.v1_12_R1.NBTTagLongArray; import net.minecraft.server.v1_12_R1.NBTTagShort; import net.minecraft.server.v1_12_R1.NBTTagString; -import net.sourcewriters.minecraft.vcompat.reflection.BukkitConversion; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContext; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleWrapType; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; +import net.sourcewriters.minecraft.vcompat.provider.BukkitConversion; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SimpleSyntaxContext; +import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SimpleWrapType; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityType; public class BukkitConversion1_12_R1 extends BukkitConversion { @@ -99,7 +99,7 @@ public NBTBase toMinecraftTag(NbtTag tag) { case COMPOUND: return toMinecraftCompound((NbtCompound) tag); case END: - return (NBTTagEnd) ReflectionProvider.DEFAULT.getReflect("nmsNBTTagEnd").init(); + return (NBTTagEnd) VersionCompatProvider.get().getLookupProvider().getLookup("nmsNBTTagEnd").init(); default: return null; } @@ -133,7 +133,7 @@ public NbtTag fromMinecraftTag(Object raw) { return new NbtIntArray(((NBTTagIntArray) tag).d()); case LONG_ARRAY: return new NbtLongArray( - (long[]) ReflectionProvider.DEFAULT.getReflect("nmsNBTTagLongArray").getFieldValue("value", ((NBTTagLongArray) tag).c())); + (long[]) VersionCompatProvider.get().getLookupProvider().getLookup("nmsNBTTagLongArray").getFieldValue(((NBTTagLongArray) tag).c(), "value")); case LIST: return fromMinecraftList(tag); case COMPOUND: @@ -161,7 +161,7 @@ public NbtList fromMinecraftList(Object raw) { return null; } NBTTagList list = (NBTTagList) raw; - List content = (List) ReflectionProvider.DEFAULT.getReflect("nmsNBTTagList").getFieldValue("value", list); + List content = (List) VersionCompatProvider.get().getLookupProvider().getLookup("nmsNBTTagList").getFieldValue(list, "value"); NbtList output = new NbtList<>(NbtType.getById(list.getTypeId())); for (NBTBase base : content) { output.add(fromMinecraftTag(base)); @@ -214,12 +214,12 @@ public NbtCompound itemToCompound(org.bukkit.inventory.ItemStack itemStack) { } @Override - public WrappedContext createContext(DataAdapterContext context) { + public WrappedContext createContext(IDataAdapterContext context) { return new SimpleSyntaxContext(context); } @Override - public WrapType wrap(DataType dataType) { + public WrapType wrap(IDataType dataType) { return new SimpleWrapType(dataType); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/EntityProvider1_12_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/EntityProvider1_12_R1.java index 2f98928..7348357 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/EntityProvider1_12_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/EntityProvider1_12_R1.java @@ -7,9 +7,9 @@ import net.minecraft.server.v1_12_R1.World; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_12_R1.utils.EntityConstructors1_12_R1; -import net.sourcewriters.minecraft.vcompat.reflection.EntityProvider; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; +import net.sourcewriters.minecraft.vcompat.provider.EntityProvider; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityType; public class EntityProvider1_12_R1 extends EntityProvider { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/PacketHandler1_12_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/PacketHandler1_12_R1.java deleted file mode 100644 index 06f1d27..0000000 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/PacketHandler1_12_R1.java +++ /dev/null @@ -1,11 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.provider.impl.v1_12_R1; - -import net.sourcewriters.minecraft.vcompat.reflection.PacketHandler; - -public class PacketHandler1_12_R1 extends PacketHandler { - - protected PacketHandler1_12_R1(VersionControl1_12_R1 versionControl) { - super(versionControl); - } - -} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/PlayerProvider1_12_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/PlayerProvider1_12_R1.java index 32da3b2..de78a7f 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/PlayerProvider1_12_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/PlayerProvider1_12_R1.java @@ -7,10 +7,10 @@ import org.bukkit.entity.Player; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_12_R1.entity.Player1_12_R1; -import net.sourcewriters.minecraft.vcompat.reflection.DataProvider; -import net.sourcewriters.minecraft.vcompat.reflection.PlayerProvider; -import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.DataDistributor; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.provider.DataProvider; +import net.sourcewriters.minecraft.vcompat.provider.PlayerProvider; +import net.sourcewriters.minecraft.vcompat.provider.data.persistence.DataDistributor; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsPlayer; public class PlayerProvider1_12_R1 extends PlayerProvider { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/TextureProvider1_12_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/TextureProvider1_12_R1.java index f305153..623ce0b 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/TextureProvider1_12_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/TextureProvider1_12_R1.java @@ -10,21 +10,21 @@ import org.bukkit.material.MaterialData; import com.mojang.authlib.GameProfile; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookup; import net.minecraft.server.v1_12_R1.GameProfileSerializer; import net.minecraft.server.v1_12_R1.ItemStack; import net.minecraft.server.v1_12_R1.NBTTagCompound; import net.minecraft.server.v1_12_R1.TileEntitySkull; -import net.sourcewriters.minecraft.vcompat.reflection.TextureProvider; +import net.sourcewriters.minecraft.vcompat.provider.TextureProvider; @SuppressWarnings("deprecation") public class TextureProvider1_12_R1 extends TextureProvider { - private final AbstractReflect craftEntityStateRef = new Reflect(CraftBlockEntityState.class).searchField("tileEntity", "tileEntity"); - private final AbstractReflect craftItemStackRef = new Reflect(CraftItemStack.class).searchField("handle", "handle"); - private final AbstractReflect craftMetaSkullRef = new Reflect("org.bukkit.craftbukkit.v1_12_R1.inventory.CraftMetaSkull") + private final ClassLookup craftEntityStateRef = ClassLookup.of(CraftBlockEntityState.class).searchField("tileEntity", "tileEntity"); + private final ClassLookup craftItemStackRef = ClassLookup.of(CraftItemStack.class).searchField("handle", "handle"); + private final ClassLookup craftMetaSkullRef = ClassLookup.of("org.bukkit.craftbukkit.v1_12_R1.inventory.CraftMetaSkull") .searchField("serialized", "serializedProfile").searchField("profile", "profile"); private final Material skullMaterial = Material.valueOf("SKULL"); @@ -37,7 +37,7 @@ public GameProfile profileFromBlock(Block block) { if (!(block instanceof CraftSkull)) { return null; } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue(block, "tileEntity"); return entitySkull.getGameProfile(); } @@ -47,13 +47,13 @@ public GameProfile profileFromItem(org.bukkit.inventory.ItemStack itemStack) { return null; } SkullMeta meta = (SkullMeta) itemStack.getItemMeta(); - GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue("profile", meta); + GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue(meta, "profile"); if (profile == null) { - NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue("serialized", meta); + NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue(meta, "serialized"); if (compound == null) { ItemStack stack = null; if (itemStack instanceof CraftItemStack) { - stack = (ItemStack) craftItemStackRef.getFieldValue("handle", itemStack); + stack = (ItemStack) craftItemStackRef.getFieldValue(itemStack, "handle"); } if (stack == null) { stack = CraftItemStack.asNMSCopy(itemStack); @@ -100,7 +100,7 @@ public boolean applyBlock(Block block, GameProfile profile) { if (!(block instanceof CraftSkull)) { return false; } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue(block, "tileEntity"); entitySkull.setGameProfile(profile); return true; } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/ToolProvider1_12_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/ToolProvider1_12_R1.java index a9da0dc..1c4950e 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/ToolProvider1_12_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/ToolProvider1_12_R1.java @@ -3,7 +3,7 @@ import net.sourcewriters.minecraft.vcompat.provider.impl.v1_12_R1.tools.BlockTools1_12_R1; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_12_R1.tools.ServerTools1_12_R1; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_12_R1.tools.SkinTools1_12_R1; -import net.sourcewriters.minecraft.vcompat.reflection.ToolProvider; +import net.sourcewriters.minecraft.vcompat.provider.ToolProvider; public class ToolProvider1_12_R1 extends ToolProvider { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/VersionControl1_12_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/VersionControl1_12_R1.java index e48d23f..04fb6ae 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/VersionControl1_12_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/VersionControl1_12_R1.java @@ -1,8 +1,8 @@ package net.sourcewriters.minecraft.vcompat.provider.impl.v1_12_R1; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_12_R1.reflection.NmsReflection1_12_R1; -import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; +import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; +import net.sourcewriters.minecraft.vcompat.provider.VersionControl; public class VersionControl1_12_R1 extends VersionControl { @@ -14,13 +14,12 @@ public static VersionControl1_12_R1 init() { private final ToolProvider1_12_R1 toolProvider = new ToolProvider1_12_R1(this); private final TextureProvider1_12_R1 textureProvider = new TextureProvider1_12_R1(this); - private final PacketHandler1_12_R1 packetHandler = new PacketHandler1_12_R1(this); private final EntityProvider1_12_R1 entityProvider = new EntityProvider1_12_R1(this); private final PlayerProvider1_12_R1 playerProvider = new PlayerProvider1_12_R1(this); private final BukkitConversion1_12_R1 bukkitConversion = new BukkitConversion1_12_R1(this); private VersionControl1_12_R1() { - NmsReflection1_12_R1.INSTANCE.setup(ReflectionProvider.DEFAULT); + NmsReflection1_12_R1.INSTANCE.setup(VersionCompatProvider.get().getLookupProvider()); } @Override @@ -43,11 +42,6 @@ public TextureProvider1_12_R1 getTextureProvider() { return textureProvider; } - @Override - public PacketHandler1_12_R1 getPacketHandler() { - return packetHandler; - } - @Override public BukkitConversion1_12_R1 getBukkitConversion() { return bukkitConversion; diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/entity/ArmorStand1_12_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/entity/ArmorStand1_12_R1.java index cd1e68a..f43b5e8 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/entity/ArmorStand1_12_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/entity/ArmorStand1_12_R1.java @@ -2,7 +2,7 @@ import net.minecraft.server.v1_12_R1.EntityArmorStand; import net.minecraft.server.v1_12_R1.World; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsArmorStand; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsArmorStand; public class ArmorStand1_12_R1 extends EntityLiving1_12_R1 implements NmsArmorStand { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/entity/Entity1_12_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/entity/Entity1_12_R1.java index 671e122..0190559 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/entity/Entity1_12_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/entity/Entity1_12_R1.java @@ -20,8 +20,8 @@ import net.minecraft.server.v1_12_R1.PacketPlayOutSpawnEntity; import net.minecraft.server.v1_12_R1.PlayerConnection; import net.minecraft.server.v1_12_R1.Vec3D; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.utils.NmsBoundingBox; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.provider.utils.NmsBoundingBox; public abstract class Entity1_12_R1 implements NmsEntity { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/entity/EntityLiving1_12_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/entity/EntityLiving1_12_R1.java index 21e3160..2683f29 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/entity/EntityLiving1_12_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/entity/EntityLiving1_12_R1.java @@ -1,7 +1,7 @@ package net.sourcewriters.minecraft.vcompat.provider.impl.v1_12_R1.entity; import net.minecraft.server.v1_12_R1.EntityLiving; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityLiving; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityLiving; public abstract class EntityLiving1_12_R1 extends Entity1_12_R1 implements NmsEntityLiving { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/entity/Player1_12_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/entity/Player1_12_R1.java index b944865..925d78a 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/entity/Player1_12_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/entity/Player1_12_R1.java @@ -10,7 +10,7 @@ import com.mojang.authlib.GameProfile; import com.mojang.authlib.properties.Property; import com.mojang.authlib.properties.PropertyMap; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookup; import net.minecraft.server.v1_12_R1.EntityPlayer; import net.minecraft.server.v1_12_R1.EnumItemSlot; @@ -32,17 +32,17 @@ import net.minecraft.server.v1_12_R1.PacketPlayOutRespawn; import net.minecraft.server.v1_12_R1.PacketPlayOutTitle; import net.minecraft.server.v1_12_R1.PacketPlayOutTitle.EnumTitleAction; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.PersistentContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.type.SkinDataType; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContainer; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; -import net.sourcewriters.minecraft.vcompat.utils.bukkit.Players; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.MojangProfileServer; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; -import net.sourcewriters.minecraft.vcompat.utils.thread.PostAsync; +import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.provider.data.persistence.PersistentContainer; +import net.sourcewriters.minecraft.vcompat.provider.data.type.SkinDataType; +import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SimpleSyntaxContainer; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.util.bukkit.Players; +import net.sourcewriters.minecraft.vcompat.util.minecraft.MojangProfileServer; +import net.sourcewriters.minecraft.vcompat.util.minecraft.Skin; +import net.sourcewriters.minecraft.vcompat.util.thread.PostAsync; import net.minecraft.server.v1_12_R1.PlayerConnection; import net.minecraft.server.v1_12_R1.WorldServer; @@ -151,7 +151,7 @@ private final void sendPlayerListInfo(String header, String footer) { PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter(); - Reflect reflect = ReflectionProvider.DEFAULT.getReflect("nmsPacketPlayOutPlayerListHeaderFooter"); + ClassLookup reflect = VersionCompatProvider.get().getLookupProvider().getLookup("nmsPacketPlayOutPlayerListHeaderFooter"); reflect.setFieldValue(packet, "header", headerComponent); reflect.setFieldValue(packet, "footer", footerComponent); @@ -283,7 +283,7 @@ private final void update(boolean flag) { String name = getName(); if (name != null) { - ReflectionProvider.DEFAULT.getReflect("mjGameProfile").setFieldValue(profile, "name", name); + VersionCompatProvider.get().getLookupProvider().getLookup("mjGameProfile").setFieldValue(profile, "name", name); } if (!(name == null && skin == null)) { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/reflection/NmsReflection1_12_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/reflection/NmsReflection1_12_R1.java index d9a473f..7c2794f 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/reflection/NmsReflection1_12_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/reflection/NmsReflection1_12_R1.java @@ -4,17 +4,17 @@ import net.minecraft.server.v1_12_R1.NBTTagList; import net.minecraft.server.v1_12_R1.NBTTagLongArray; import net.minecraft.server.v1_12_R1.PacketPlayOutPlayerListHeaderFooter; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.Reflections; +import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookupProvider; +import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookups; -public class NmsReflection1_12_R1 extends Reflections { +public class NmsReflection1_12_R1 extends ClassLookups { public static NmsReflection1_12_R1 INSTANCE = new NmsReflection1_12_R1(); private NmsReflection1_12_R1() {} @Override - public void setup(ReflectionProvider provider) { + public void setup(ClassLookupProvider provider) { // // @@ -24,12 +24,12 @@ public void setup(ReflectionProvider provider) { // // Minecraft - provider.createReflect("nmsPacketPlayOutPlayerListHeaderFooter", PacketPlayOutPlayerListHeaderFooter.class) + provider.createLookup("nmsPacketPlayOutPlayerListHeaderFooter", PacketPlayOutPlayerListHeaderFooter.class) .searchField("header", "a").searchField("header", "b"); - provider.createReflect("nmsNBTTagEnd", NBTTagEnd.class); - provider.createReflect("nmsNBTTagLongArray", NBTTagLongArray.class).searchField("value", "b"); - provider.createReflect("nmsNBTTagList", NBTTagList.class).searchField("value", "list"); + provider.createLookup("nmsNBTTagEnd", NBTTagEnd.class); + provider.createLookup("nmsNBTTagLongArray", NBTTagLongArray.class).searchField("value", "b"); + provider.createLookup("nmsNBTTagList", NBTTagList.class).searchField("value", "list"); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/tools/BlockTools1_12_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/tools/BlockTools1_12_R1.java index f4c9fed..043205c 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/tools/BlockTools1_12_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/tools/BlockTools1_12_R1.java @@ -5,23 +5,23 @@ import com.mojang.authlib.properties.Property; import com.mojang.authlib.properties.PropertyMap; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookup; import net.minecraft.server.v1_12_R1.TileEntitySkull; -import net.sourcewriters.minecraft.vcompat.reflection.tools.BlockTools; -import net.sourcewriters.minecraft.vcompat.utils.constants.MinecraftConstants; +import net.sourcewriters.minecraft.vcompat.provider.tools.BlockTools; +import net.sourcewriters.minecraft.vcompat.util.constants.MinecraftConstants; public class BlockTools1_12_R1 extends BlockTools { - private final AbstractReflect craftEntityStateRef = new Reflect(CraftSkull.class).searchField("tileEntity", "tileEntity"); + private final ClassLookup craftEntityStateRef = ClassLookup.of(CraftSkull.class).searchField("tileEntity", "tileEntity"); @Override public void setHeadTexture(Block block, String texture) { if (!(block instanceof CraftSkull)) { return; } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue(block, "tileEntity"); PropertyMap map = entitySkull.getGameProfile().getProperties(); map.removeAll("textures"); map.put("textures", new Property("textures", MinecraftConstants.TEXTURE_SIGNATURE, texture)); @@ -32,7 +32,7 @@ public String getHeadTexture(Block block) { if (!(block instanceof CraftSkull)) { return null; } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue(block, "tileEntity"); return entitySkull.getGameProfile().getProperties().get("textures").iterator().next().getValue(); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/tools/ServerTools1_12_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/tools/ServerTools1_12_R1.java index 6b2f2ec..a97ade4 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/tools/ServerTools1_12_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/tools/ServerTools1_12_R1.java @@ -4,7 +4,7 @@ import org.bukkit.craftbukkit.v1_12_R1.CraftServer; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_12_R1.wrapper.ConsoleReaderWrapper1_12_R1; -import net.sourcewriters.minecraft.vcompat.reflection.tools.ServerTools; +import net.sourcewriters.minecraft.vcompat.provider.tools.ServerTools; public class ServerTools1_12_R1 extends ServerTools { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/tools/SkinTools1_12_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/tools/SkinTools1_12_R1.java index 2da9ba3..35524d6 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/tools/SkinTools1_12_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/tools/SkinTools1_12_R1.java @@ -3,8 +3,8 @@ import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer; import org.bukkit.entity.Player; -import net.sourcewriters.minecraft.vcompat.reflection.tools.SkinTools; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; +import net.sourcewriters.minecraft.vcompat.provider.tools.SkinTools; +import net.sourcewriters.minecraft.vcompat.util.minecraft.Skin; public class SkinTools1_12_R1 extends SkinTools { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/wrapper/ConsoleReaderWrapper1_12_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/wrapper/ConsoleReaderWrapper1_12_R1.java index 6694792..722fab7 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/wrapper/ConsoleReaderWrapper1_12_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_12_R1/wrapper/ConsoleReaderWrapper1_12_R1.java @@ -5,9 +5,10 @@ import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_12_R1.CraftServer; +import org.bukkit.craftbukkit.Main; import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; -import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; +import net.sourcewriters.minecraft.vcompat.provider.wrapper.ConsoleReaderWrapper; public final class ConsoleReaderWrapper1_12_R1 extends ConsoleReaderWrapper { @@ -15,7 +16,6 @@ public final class ConsoleReaderWrapper1_12_R1 extends ConsoleReaderWrapper { private final ConsoleReader reader; - @SuppressWarnings("resource") private ConsoleReaderWrapper1_12_R1() { this.reader = ((CraftServer) Bukkit.getServer()).getServer().reader; } @@ -40,4 +40,9 @@ public void drawLine() throws IOException { reader.drawLine(); } + @Override + public boolean isJLineSupported() { + return Main.useJline; + } + } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/BukkitConversion1_13_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/BukkitConversion1_13_R1.java index 9951502..6d13776 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/BukkitConversion1_13_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/BukkitConversion1_13_R1.java @@ -5,23 +5,23 @@ import org.bukkit.craftbukkit.v1_13_R1.inventory.CraftItemStack; import org.bukkit.entity.EntityType; -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.nbt.NbtByte; -import com.syntaxphoenix.syntaxapi.nbt.NbtByteArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; -import com.syntaxphoenix.syntaxapi.nbt.NbtDouble; -import com.syntaxphoenix.syntaxapi.nbt.NbtEnd; -import com.syntaxphoenix.syntaxapi.nbt.NbtFloat; -import com.syntaxphoenix.syntaxapi.nbt.NbtInt; -import com.syntaxphoenix.syntaxapi.nbt.NbtIntArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtList; -import com.syntaxphoenix.syntaxapi.nbt.NbtLong; -import com.syntaxphoenix.syntaxapi.nbt.NbtLongArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtShort; -import com.syntaxphoenix.syntaxapi.nbt.NbtString; -import com.syntaxphoenix.syntaxapi.nbt.NbtTag; -import com.syntaxphoenix.syntaxapi.nbt.NbtType; +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterContext; +import net.sourcewriters.minecraft.vcompat.data.api.IDataType; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtByte; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtByteArray; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtCompound; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtDouble; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtEnd; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtFloat; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtInt; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtIntArray; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtList; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtLong; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtLongArray; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtShort; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtString; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtTag; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtType; import net.minecraft.server.v1_13_R1.ItemStack; import net.minecraft.server.v1_13_R1.NBTBase; @@ -39,12 +39,12 @@ import net.minecraft.server.v1_13_R1.NBTTagLongArray; import net.minecraft.server.v1_13_R1.NBTTagShort; import net.minecraft.server.v1_13_R1.NBTTagString; -import net.sourcewriters.minecraft.vcompat.reflection.BukkitConversion; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContext; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleWrapType; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; +import net.sourcewriters.minecraft.vcompat.provider.BukkitConversion; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SimpleSyntaxContext; +import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SimpleWrapType; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityType; public class BukkitConversion1_13_R1 extends BukkitConversion { @@ -206,12 +206,12 @@ public NbtCompound itemToCompound(org.bukkit.inventory.ItemStack itemStack) { } @Override - public WrappedContext createContext(DataAdapterContext context) { + public WrappedContext createContext(IDataAdapterContext context) { return new SimpleSyntaxContext(context); } @Override - public WrapType wrap(DataType dataType) { + public WrapType wrap(IDataType dataType) { return new SimpleWrapType(dataType); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/EntityProvider1_13_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/EntityProvider1_13_R1.java index cea7280..9beb064 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/EntityProvider1_13_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/EntityProvider1_13_R1.java @@ -7,9 +7,9 @@ import net.minecraft.server.v1_13_R1.World; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R1.utils.EntityConstructors1_13_R1; -import net.sourcewriters.minecraft.vcompat.reflection.EntityProvider; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; +import net.sourcewriters.minecraft.vcompat.provider.EntityProvider; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityType; public class EntityProvider1_13_R1 extends EntityProvider { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/PacketHandler1_13_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/PacketHandler1_13_R1.java deleted file mode 100644 index a9a5199..0000000 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/PacketHandler1_13_R1.java +++ /dev/null @@ -1,11 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R1; - -import net.sourcewriters.minecraft.vcompat.reflection.PacketHandler; - -public class PacketHandler1_13_R1 extends PacketHandler { - - protected PacketHandler1_13_R1(VersionControl1_13_R1 versionControl) { - super(versionControl); - } - -} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/PlayerProvider1_13_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/PlayerProvider1_13_R1.java index 455ce44..92a3341 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/PlayerProvider1_13_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/PlayerProvider1_13_R1.java @@ -7,10 +7,10 @@ import org.bukkit.entity.Player; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R1.entity.Player1_13_R1; -import net.sourcewriters.minecraft.vcompat.reflection.DataProvider; -import net.sourcewriters.minecraft.vcompat.reflection.PlayerProvider; -import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.DataDistributor; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.provider.DataProvider; +import net.sourcewriters.minecraft.vcompat.provider.PlayerProvider; +import net.sourcewriters.minecraft.vcompat.provider.data.persistence.DataDistributor; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsPlayer; public class PlayerProvider1_13_R1 extends PlayerProvider { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/TextureProvider1_13_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/TextureProvider1_13_R1.java index 2d0ce51..ea5511e 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/TextureProvider1_13_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/TextureProvider1_13_R1.java @@ -9,20 +9,20 @@ import org.bukkit.inventory.meta.SkullMeta; import com.mojang.authlib.GameProfile; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookup; import net.minecraft.server.v1_13_R1.GameProfileSerializer; import net.minecraft.server.v1_13_R1.ItemStack; import net.minecraft.server.v1_13_R1.NBTTagCompound; import net.minecraft.server.v1_13_R1.TileEntitySkull; -import net.sourcewriters.minecraft.vcompat.reflection.TextureProvider; +import net.sourcewriters.minecraft.vcompat.provider.TextureProvider; public class TextureProvider1_13_R1 extends TextureProvider { - private final AbstractReflect craftEntityStateRef = new Reflect(CraftBlockEntityState.class).searchField("tileEntity", "tileEntity"); - private final AbstractReflect craftItemStackRef = new Reflect(CraftItemStack.class).searchField("handle", "handle"); - private final AbstractReflect craftMetaSkullRef = new Reflect("org.bukkit.craftbukkit.v1_13_R1.inventory.CraftMetaSkull") + private final ClassLookup craftEntityStateRef = ClassLookup.of(CraftBlockEntityState.class).searchField("tileEntity", "tileEntity"); + private final ClassLookup craftItemStackRef = ClassLookup.of(CraftItemStack.class).searchField("handle", "handle"); + private final ClassLookup craftMetaSkullRef = ClassLookup.of("org.bukkit.craftbukkit.v1_13_R1.inventory.CraftMetaSkull") .searchField("serialized", "serializedProfile").searchField("profile", "profile"); protected TextureProvider1_13_R1(VersionControl1_13_R1 versionControl) { @@ -34,7 +34,7 @@ public GameProfile profileFromBlock(Block block) { if (!(block instanceof CraftSkull)) { return null; } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue(block, "tileEntity"); return entitySkull.getGameProfile(); } @@ -44,13 +44,13 @@ public GameProfile profileFromItem(org.bukkit.inventory.ItemStack itemStack) { return null; } SkullMeta meta = (SkullMeta) itemStack.getItemMeta(); - GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue("profile", meta); + GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue(meta, "profile"); if (profile == null) { - NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue("serialized", meta); + NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue(meta, "serialized"); if (compound == null) { ItemStack stack = null; if (itemStack instanceof CraftItemStack) { - stack = (ItemStack) craftItemStackRef.getFieldValue("handle", itemStack); + stack = (ItemStack) craftItemStackRef.getFieldValue(itemStack, "handle"); } if (stack == null) { stack = CraftItemStack.asNMSCopy(itemStack); @@ -94,7 +94,7 @@ public boolean applyBlock(Block block, GameProfile profile) { if (!(block instanceof CraftSkull)) { return false; } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue(block, "tileEntity"); entitySkull.setGameProfile(profile); return true; } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/ToolProvider1_13_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/ToolProvider1_13_R1.java index eeb27b6..1ccbb73 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/ToolProvider1_13_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/ToolProvider1_13_R1.java @@ -3,7 +3,7 @@ import net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R1.tools.BlockTools1_13_R1; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R1.tools.ServerTools1_13_R1; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R1.tools.SkinTools1_13_R1; -import net.sourcewriters.minecraft.vcompat.reflection.ToolProvider; +import net.sourcewriters.minecraft.vcompat.provider.ToolProvider; public class ToolProvider1_13_R1 extends ToolProvider { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/VersionControl1_13_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/VersionControl1_13_R1.java index 4308ae4..814999e 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/VersionControl1_13_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/VersionControl1_13_R1.java @@ -1,6 +1,6 @@ package net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R1; -import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; +import net.sourcewriters.minecraft.vcompat.provider.VersionControl; public class VersionControl1_13_R1 extends VersionControl { @@ -12,7 +12,6 @@ public static VersionControl1_13_R1 init() { private final ToolProvider1_13_R1 toolProvider = new ToolProvider1_13_R1(this); private final TextureProvider1_13_R1 textureProvider = new TextureProvider1_13_R1(this); - private final PacketHandler1_13_R1 packetHandler = new PacketHandler1_13_R1(this); private final EntityProvider1_13_R1 entityProvider = new EntityProvider1_13_R1(this); private final PlayerProvider1_13_R1 playerProvider = new PlayerProvider1_13_R1(this); private final BukkitConversion1_13_R1 bukkitConversion = new BukkitConversion1_13_R1(this); @@ -40,12 +39,7 @@ public PlayerProvider1_13_R1 getPlayerProvider() { public TextureProvider1_13_R1 getTextureProvider() { return textureProvider; } - - @Override - public PacketHandler1_13_R1 getPacketHandler() { - return packetHandler; - } - + @Override public BukkitConversion1_13_R1 getBukkitConversion() { return bukkitConversion; diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/entity/ArmorStand1_13_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/entity/ArmorStand1_13_R1.java index c0f11f6..e18f20d 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/entity/ArmorStand1_13_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/entity/ArmorStand1_13_R1.java @@ -2,7 +2,7 @@ import net.minecraft.server.v1_13_R1.EntityArmorStand; import net.minecraft.server.v1_13_R1.World; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsArmorStand; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsArmorStand; public class ArmorStand1_13_R1 extends EntityLiving1_13_R1 implements NmsArmorStand { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/entity/Entity1_13_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/entity/Entity1_13_R1.java index 9b191c5..a712aa5 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/entity/Entity1_13_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/entity/Entity1_13_R1.java @@ -21,8 +21,8 @@ import net.minecraft.server.v1_13_R1.PacketPlayOutSpawnEntity; import net.minecraft.server.v1_13_R1.PlayerConnection; import net.minecraft.server.v1_13_R1.Vec3D; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.utils.NmsBoundingBox; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.provider.utils.NmsBoundingBox; public abstract class Entity1_13_R1 implements NmsEntity { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/entity/EntityLiving1_13_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/entity/EntityLiving1_13_R1.java index 3b9f625..a884037 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/entity/EntityLiving1_13_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/entity/EntityLiving1_13_R1.java @@ -1,7 +1,7 @@ package net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R1.entity; import net.minecraft.server.v1_13_R1.EntityLiving; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityLiving; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityLiving; public abstract class EntityLiving1_13_R1 extends Entity1_13_R1 implements NmsEntityLiving { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/entity/Player1_13_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/entity/Player1_13_R1.java index a17160e..d99164d 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/entity/Player1_13_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/entity/Player1_13_R1.java @@ -31,17 +31,17 @@ import net.minecraft.server.v1_13_R1.PacketPlayOutRespawn; import net.minecraft.server.v1_13_R1.PacketPlayOutTitle; import net.minecraft.server.v1_13_R1.PacketPlayOutTitle.EnumTitleAction; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.PersistentContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.type.SkinDataType; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContainer; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; -import net.sourcewriters.minecraft.vcompat.utils.bukkit.Players; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.MojangProfileServer; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; -import net.sourcewriters.minecraft.vcompat.utils.thread.PostAsync; +import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.provider.data.persistence.PersistentContainer; +import net.sourcewriters.minecraft.vcompat.provider.data.type.SkinDataType; +import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SimpleSyntaxContainer; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.util.bukkit.Players; +import net.sourcewriters.minecraft.vcompat.util.minecraft.MojangProfileServer; +import net.sourcewriters.minecraft.vcompat.util.minecraft.Skin; +import net.sourcewriters.minecraft.vcompat.util.thread.PostAsync; import net.minecraft.server.v1_13_R1.PlayerConnection; import net.minecraft.server.v1_13_R1.WorldServer; @@ -281,7 +281,7 @@ private final void update(boolean flag) { String name = getName(); if (name != null) { - ReflectionProvider.DEFAULT.getReflect("mjGameProfile").setFieldValue(profile, "name", name); + VersionCompatProvider.get().getLookupProvider().getLookup("mjGameProfile").setFieldValue(profile, "name", name); } if (!(name == null && skin == null)) { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/tools/BlockTools1_13_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/tools/BlockTools1_13_R1.java index 12beff1..b24b913 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/tools/BlockTools1_13_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/tools/BlockTools1_13_R1.java @@ -5,23 +5,23 @@ import com.mojang.authlib.properties.Property; import com.mojang.authlib.properties.PropertyMap; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookup; import net.minecraft.server.v1_13_R1.TileEntitySkull; -import net.sourcewriters.minecraft.vcompat.reflection.tools.BlockTools; -import net.sourcewriters.minecraft.vcompat.utils.constants.MinecraftConstants; +import net.sourcewriters.minecraft.vcompat.provider.tools.BlockTools; +import net.sourcewriters.minecraft.vcompat.util.constants.MinecraftConstants; public class BlockTools1_13_R1 extends BlockTools { - private final AbstractReflect craftEntityStateRef = new Reflect(CraftSkull.class).searchField("tileEntity", "tileEntity"); + private final ClassLookup craftEntityStateRef = ClassLookup.of(CraftSkull.class).searchField("tileEntity", "tileEntity"); @Override public void setHeadTexture(Block block, String texture) { if (!(block instanceof CraftSkull)) { return; } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue(block, "tileEntity"); PropertyMap map = entitySkull.getGameProfile().getProperties(); map.removeAll("textures"); map.put("textures", new Property("textures", MinecraftConstants.TEXTURE_SIGNATURE, texture)); @@ -32,7 +32,7 @@ public String getHeadTexture(Block block) { if (!(block instanceof CraftSkull)) { return null; } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue(block, "tileEntity"); return entitySkull.getGameProfile().getProperties().get("textures").iterator().next().getValue(); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/tools/ServerTools1_13_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/tools/ServerTools1_13_R1.java index 419399f..b8dd087 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/tools/ServerTools1_13_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/tools/ServerTools1_13_R1.java @@ -4,7 +4,7 @@ import org.bukkit.craftbukkit.v1_13_R1.CraftServer; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R1.wrapper.ConsoleReaderWrapper1_13_R1; -import net.sourcewriters.minecraft.vcompat.reflection.tools.ServerTools; +import net.sourcewriters.minecraft.vcompat.provider.tools.ServerTools; public class ServerTools1_13_R1 extends ServerTools { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/tools/SkinTools1_13_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/tools/SkinTools1_13_R1.java index 4c68d7a..79b6e32 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/tools/SkinTools1_13_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/tools/SkinTools1_13_R1.java @@ -3,8 +3,8 @@ import org.bukkit.craftbukkit.v1_13_R1.entity.CraftPlayer; import org.bukkit.entity.Player; -import net.sourcewriters.minecraft.vcompat.reflection.tools.SkinTools; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; +import net.sourcewriters.minecraft.vcompat.provider.tools.SkinTools; +import net.sourcewriters.minecraft.vcompat.util.minecraft.Skin; public class SkinTools1_13_R1 extends SkinTools { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/wrapper/ConsoleReaderWrapper1_13_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/wrapper/ConsoleReaderWrapper1_13_R1.java index 1276143..4849ded 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/wrapper/ConsoleReaderWrapper1_13_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R1/wrapper/ConsoleReaderWrapper1_13_R1.java @@ -5,9 +5,10 @@ import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_13_R1.CraftServer; +import org.bukkit.craftbukkit.Main; import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; -import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; +import net.sourcewriters.minecraft.vcompat.provider.wrapper.ConsoleReaderWrapper; public final class ConsoleReaderWrapper1_13_R1 extends ConsoleReaderWrapper { @@ -15,7 +16,6 @@ public final class ConsoleReaderWrapper1_13_R1 extends ConsoleReaderWrapper { private final ConsoleReader reader; - @SuppressWarnings("resource") private ConsoleReaderWrapper1_13_R1() { this.reader = ((CraftServer) Bukkit.getServer()).getServer().reader; } @@ -40,4 +40,9 @@ public void drawLine() throws IOException { reader.drawLine(); } + @Override + public boolean isJLineSupported() { + return Main.useJline; + } + } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/BukkitConversion1_13_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/BukkitConversion1_13_R2.java index c7b3508..245ec77 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/BukkitConversion1_13_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/BukkitConversion1_13_R2.java @@ -5,23 +5,23 @@ import org.bukkit.craftbukkit.v1_13_R2.inventory.CraftItemStack; import org.bukkit.entity.EntityType; -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.nbt.NbtByte; -import com.syntaxphoenix.syntaxapi.nbt.NbtByteArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; -import com.syntaxphoenix.syntaxapi.nbt.NbtDouble; -import com.syntaxphoenix.syntaxapi.nbt.NbtEnd; -import com.syntaxphoenix.syntaxapi.nbt.NbtFloat; -import com.syntaxphoenix.syntaxapi.nbt.NbtInt; -import com.syntaxphoenix.syntaxapi.nbt.NbtIntArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtList; -import com.syntaxphoenix.syntaxapi.nbt.NbtLong; -import com.syntaxphoenix.syntaxapi.nbt.NbtLongArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtShort; -import com.syntaxphoenix.syntaxapi.nbt.NbtString; -import com.syntaxphoenix.syntaxapi.nbt.NbtTag; -import com.syntaxphoenix.syntaxapi.nbt.NbtType; +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterContext; +import net.sourcewriters.minecraft.vcompat.data.api.IDataType; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtByte; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtByteArray; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtCompound; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtDouble; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtEnd; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtFloat; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtInt; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtIntArray; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtList; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtLong; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtLongArray; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtShort; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtString; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtTag; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtType; import net.minecraft.server.v1_13_R2.ItemStack; import net.minecraft.server.v1_13_R2.NBTBase; @@ -39,12 +39,12 @@ import net.minecraft.server.v1_13_R2.NBTTagLongArray; import net.minecraft.server.v1_13_R2.NBTTagShort; import net.minecraft.server.v1_13_R2.NBTTagString; -import net.sourcewriters.minecraft.vcompat.reflection.BukkitConversion; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContext; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleWrapType; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; +import net.sourcewriters.minecraft.vcompat.provider.BukkitConversion; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SimpleSyntaxContext; +import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SimpleWrapType; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityType; public class BukkitConversion1_13_R2 extends BukkitConversion { @@ -206,12 +206,12 @@ public NbtCompound itemToCompound(org.bukkit.inventory.ItemStack itemStack) { } @Override - public WrappedContext createContext(DataAdapterContext context) { + public WrappedContext createContext(IDataAdapterContext context) { return new SimpleSyntaxContext(context); } @Override - public WrapType wrap(DataType dataType) { + public WrapType wrap(IDataType dataType) { return new SimpleWrapType(dataType); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/EntityProvider1_13_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/EntityProvider1_13_R2.java index b6c6c3c..3b0637e 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/EntityProvider1_13_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/EntityProvider1_13_R2.java @@ -7,9 +7,9 @@ import net.minecraft.server.v1_13_R2.World; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R2.utils.EntityConstructors1_13_R2; -import net.sourcewriters.minecraft.vcompat.reflection.EntityProvider; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; +import net.sourcewriters.minecraft.vcompat.provider.EntityProvider; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityType; public class EntityProvider1_13_R2 extends EntityProvider { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/PacketHandler1_13_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/PacketHandler1_13_R2.java deleted file mode 100644 index c14fa95..0000000 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/PacketHandler1_13_R2.java +++ /dev/null @@ -1,11 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R2; - -import net.sourcewriters.minecraft.vcompat.reflection.PacketHandler; - -public class PacketHandler1_13_R2 extends PacketHandler { - - protected PacketHandler1_13_R2(VersionControl1_13_R2 versionControl) { - super(versionControl); - } - -} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/PlayerProvider1_13_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/PlayerProvider1_13_R2.java index 81092ce..c7bbb65 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/PlayerProvider1_13_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/PlayerProvider1_13_R2.java @@ -7,10 +7,10 @@ import org.bukkit.entity.Player; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R2.entity.Player1_13_R2; -import net.sourcewriters.minecraft.vcompat.reflection.DataProvider; -import net.sourcewriters.minecraft.vcompat.reflection.PlayerProvider; -import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.DataDistributor; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.provider.DataProvider; +import net.sourcewriters.minecraft.vcompat.provider.PlayerProvider; +import net.sourcewriters.minecraft.vcompat.provider.data.persistence.DataDistributor; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsPlayer; public class PlayerProvider1_13_R2 extends PlayerProvider { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/TextureProvider1_13_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/TextureProvider1_13_R2.java index fb3c57b..086f5d3 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/TextureProvider1_13_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/TextureProvider1_13_R2.java @@ -9,20 +9,20 @@ import org.bukkit.inventory.meta.SkullMeta; import com.mojang.authlib.GameProfile; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookup; import net.minecraft.server.v1_13_R2.GameProfileSerializer; import net.minecraft.server.v1_13_R2.ItemStack; import net.minecraft.server.v1_13_R2.NBTTagCompound; import net.minecraft.server.v1_13_R2.TileEntitySkull; -import net.sourcewriters.minecraft.vcompat.reflection.TextureProvider; +import net.sourcewriters.minecraft.vcompat.provider.TextureProvider; public class TextureProvider1_13_R2 extends TextureProvider { - private final AbstractReflect craftEntityStateRef = new Reflect(CraftBlockEntityState.class).searchField("tileEntity", "tileEntity"); - private final AbstractReflect craftItemStackRef = new Reflect(CraftItemStack.class).searchField("handle", "handle"); - private final AbstractReflect craftMetaSkullRef = new Reflect("org.bukkit.craftbukkit.v1_13_R2.inventory.CraftMetaSkull") + private final ClassLookup craftEntityStateRef = ClassLookup.of(CraftBlockEntityState.class).searchField("tileEntity", "tileEntity"); + private final ClassLookup craftItemStackRef = ClassLookup.of(CraftItemStack.class).searchField("handle", "handle"); + private final ClassLookup craftMetaSkullRef = ClassLookup.of("org.bukkit.craftbukkit.v1_13_R2.inventory.CraftMetaSkull") .searchField("serialized", "serializedProfile").searchField("profile", "profile"); protected TextureProvider1_13_R2(VersionControl1_13_R2 versionControl) { @@ -34,7 +34,7 @@ public GameProfile profileFromBlock(Block block) { if (!(block instanceof CraftSkull)) { return null; } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue(block, "tileEntity"); return entitySkull.getGameProfile(); } @@ -44,13 +44,13 @@ public GameProfile profileFromItem(org.bukkit.inventory.ItemStack itemStack) { return null; } SkullMeta meta = (SkullMeta) itemStack.getItemMeta(); - GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue("profile", meta); + GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue(meta, "profile"); if (profile == null) { - NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue("serialized", meta); + NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue(meta, "serialized"); if (compound == null) { ItemStack stack = null; if (itemStack instanceof CraftItemStack) { - stack = (ItemStack) craftItemStackRef.getFieldValue("handle", itemStack); + stack = (ItemStack) craftItemStackRef.getFieldValue(itemStack, "handle"); } if (stack == null) { stack = CraftItemStack.asNMSCopy(itemStack); @@ -94,7 +94,7 @@ public boolean applyBlock(Block block, GameProfile profile) { if (!(block instanceof CraftSkull)) { return false; } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue(block, "tileEntity"); entitySkull.setGameProfile(profile); return true; } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/ToolProvider1_13_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/ToolProvider1_13_R2.java index 4e0e108..2b12b9a 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/ToolProvider1_13_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/ToolProvider1_13_R2.java @@ -3,7 +3,7 @@ import net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R2.tools.BlockTools1_13_R2; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R2.tools.ServerTools1_13_R2; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R2.tools.SkinTools1_13_R2; -import net.sourcewriters.minecraft.vcompat.reflection.ToolProvider; +import net.sourcewriters.minecraft.vcompat.provider.ToolProvider; public class ToolProvider1_13_R2 extends ToolProvider { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/VersionControl1_13_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/VersionControl1_13_R2.java index a93aa7c..6f5abd1 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/VersionControl1_13_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/VersionControl1_13_R2.java @@ -1,6 +1,6 @@ package net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R2; -import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; +import net.sourcewriters.minecraft.vcompat.provider.VersionControl; public class VersionControl1_13_R2 extends VersionControl { @@ -12,7 +12,6 @@ public static VersionControl1_13_R2 init() { private final ToolProvider1_13_R2 toolProvider = new ToolProvider1_13_R2(this); private final TextureProvider1_13_R2 textureProvider = new TextureProvider1_13_R2(this); - private final PacketHandler1_13_R2 packetHandler = new PacketHandler1_13_R2(this); private final EntityProvider1_13_R2 entityProvider = new EntityProvider1_13_R2(this); private final PlayerProvider1_13_R2 playerProvider = new PlayerProvider1_13_R2(this); private final BukkitConversion1_13_R2 bukkitConversion = new BukkitConversion1_13_R2(this); @@ -41,11 +40,6 @@ public TextureProvider1_13_R2 getTextureProvider() { return textureProvider; } - @Override - public PacketHandler1_13_R2 getPacketHandler() { - return packetHandler; - } - @Override public BukkitConversion1_13_R2 getBukkitConversion() { return bukkitConversion; diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/entity/ArmorStand1_13_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/entity/ArmorStand1_13_R2.java index d1131eb..5ceba46 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/entity/ArmorStand1_13_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/entity/ArmorStand1_13_R2.java @@ -2,7 +2,7 @@ import net.minecraft.server.v1_13_R2.EntityArmorStand; import net.minecraft.server.v1_13_R2.World; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsArmorStand; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsArmorStand; public class ArmorStand1_13_R2 extends EntityLiving1_13_R2 implements NmsArmorStand { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/entity/Entity1_13_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/entity/Entity1_13_R2.java index 480402b..aa7e80a 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/entity/Entity1_13_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/entity/Entity1_13_R2.java @@ -21,8 +21,8 @@ import net.minecraft.server.v1_13_R2.PacketPlayOutSpawnEntity; import net.minecraft.server.v1_13_R2.PlayerConnection; import net.minecraft.server.v1_13_R2.Vec3D; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.utils.NmsBoundingBox; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.provider.utils.NmsBoundingBox; public abstract class Entity1_13_R2 implements NmsEntity { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/entity/EntityLiving1_13_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/entity/EntityLiving1_13_R2.java index 8e1e89a..f8c9dfb 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/entity/EntityLiving1_13_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/entity/EntityLiving1_13_R2.java @@ -1,7 +1,7 @@ package net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R2.entity; import net.minecraft.server.v1_13_R2.EntityLiving; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityLiving; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityLiving; public abstract class EntityLiving1_13_R2 extends Entity1_13_R2 implements NmsEntityLiving { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/entity/Player1_13_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/entity/Player1_13_R2.java index 1a6b44b..bb284e1 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/entity/Player1_13_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/entity/Player1_13_R2.java @@ -31,17 +31,17 @@ import net.minecraft.server.v1_13_R2.PacketPlayOutRespawn; import net.minecraft.server.v1_13_R2.PacketPlayOutTitle; import net.minecraft.server.v1_13_R2.PacketPlayOutTitle.EnumTitleAction; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.PersistentContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.type.SkinDataType; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContainer; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; -import net.sourcewriters.minecraft.vcompat.utils.bukkit.Players; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.MojangProfileServer; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; -import net.sourcewriters.minecraft.vcompat.utils.thread.PostAsync; +import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.provider.data.persistence.PersistentContainer; +import net.sourcewriters.minecraft.vcompat.provider.data.type.SkinDataType; +import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SimpleSyntaxContainer; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.util.bukkit.Players; +import net.sourcewriters.minecraft.vcompat.util.minecraft.MojangProfileServer; +import net.sourcewriters.minecraft.vcompat.util.minecraft.Skin; +import net.sourcewriters.minecraft.vcompat.util.thread.PostAsync; import net.minecraft.server.v1_13_R2.PlayerConnection; import net.minecraft.server.v1_13_R2.WorldServer; @@ -281,7 +281,7 @@ private final void update(boolean flag) { String name = getName(); if (name != null) { - ReflectionProvider.DEFAULT.getReflect("mjGameProfile").setFieldValue(profile, "name", name); + VersionCompatProvider.get().getLookupProvider().getLookup("mjGameProfile").setFieldValue(profile, "name", name); } if (!(name == null && skin == null)) { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/tools/BlockTools1_13_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/tools/BlockTools1_13_R2.java index 7f9d5d3..e6bddd4 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/tools/BlockTools1_13_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/tools/BlockTools1_13_R2.java @@ -5,23 +5,23 @@ import com.mojang.authlib.properties.Property; import com.mojang.authlib.properties.PropertyMap; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookup; import net.minecraft.server.v1_13_R2.TileEntitySkull; -import net.sourcewriters.minecraft.vcompat.reflection.tools.BlockTools; -import net.sourcewriters.minecraft.vcompat.utils.constants.MinecraftConstants; +import net.sourcewriters.minecraft.vcompat.provider.tools.BlockTools; +import net.sourcewriters.minecraft.vcompat.util.constants.MinecraftConstants; public class BlockTools1_13_R2 extends BlockTools { - private final AbstractReflect craftEntityStateRef = new Reflect(CraftSkull.class).searchField("tileEntity", "tileEntity"); + private final ClassLookup craftEntityStateRef = ClassLookup.of(CraftSkull.class).searchField("tileEntity", "tileEntity"); @Override public void setHeadTexture(Block block, String texture) { if (!(block instanceof CraftSkull)) { return; } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue(block, "tileEntity"); PropertyMap map = entitySkull.getGameProfile().getProperties(); map.removeAll("textures"); map.put("textures", new Property("textures", MinecraftConstants.TEXTURE_SIGNATURE, texture)); @@ -32,7 +32,7 @@ public String getHeadTexture(Block block) { if (!(block instanceof CraftSkull)) { return null; } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue(block, "tileEntity"); return entitySkull.getGameProfile().getProperties().get("textures").iterator().next().getValue(); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/tools/ServerTools1_13_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/tools/ServerTools1_13_R2.java index 5143156..ae4c120 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/tools/ServerTools1_13_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/tools/ServerTools1_13_R2.java @@ -4,7 +4,7 @@ import org.bukkit.craftbukkit.v1_13_R2.CraftServer; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_13_R2.wrapper.ConsoleReaderWrapper1_13_R2; -import net.sourcewriters.minecraft.vcompat.reflection.tools.ServerTools; +import net.sourcewriters.minecraft.vcompat.provider.tools.ServerTools; public class ServerTools1_13_R2 extends ServerTools { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/tools/SkinTools1_13_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/tools/SkinTools1_13_R2.java index c6ddf8a..5dab1de 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/tools/SkinTools1_13_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/tools/SkinTools1_13_R2.java @@ -3,8 +3,8 @@ import org.bukkit.craftbukkit.v1_13_R2.entity.CraftPlayer; import org.bukkit.entity.Player; -import net.sourcewriters.minecraft.vcompat.reflection.tools.SkinTools; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; +import net.sourcewriters.minecraft.vcompat.provider.tools.SkinTools; +import net.sourcewriters.minecraft.vcompat.util.minecraft.Skin; public class SkinTools1_13_R2 extends SkinTools { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/wrapper/ConsoleReaderWrapper1_13_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/wrapper/ConsoleReaderWrapper1_13_R2.java index 086c77c..88e962e 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/wrapper/ConsoleReaderWrapper1_13_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_13_R2/wrapper/ConsoleReaderWrapper1_13_R2.java @@ -5,9 +5,10 @@ import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_13_R2.CraftServer; +import org.bukkit.craftbukkit.Main; import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; -import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; +import net.sourcewriters.minecraft.vcompat.provider.wrapper.ConsoleReaderWrapper; public final class ConsoleReaderWrapper1_13_R2 extends ConsoleReaderWrapper { @@ -15,7 +16,6 @@ public final class ConsoleReaderWrapper1_13_R2 extends ConsoleReaderWrapper { private final ConsoleReader reader; - @SuppressWarnings("resource") private ConsoleReaderWrapper1_13_R2() { this.reader = ((CraftServer) Bukkit.getServer()).getServer().reader; } @@ -40,4 +40,9 @@ public void drawLine() throws IOException { reader.drawLine(); } + @Override + public boolean isJLineSupported() { + return Main.useJline; + } + } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/BukkitConversion1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/BukkitConversion1_14_R1.java index e69167c..4154049 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/BukkitConversion1_14_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/BukkitConversion1_14_R1.java @@ -5,23 +5,23 @@ import org.bukkit.craftbukkit.v1_14_R1.inventory.CraftItemStack; import org.bukkit.entity.EntityType; -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.nbt.NbtByte; -import com.syntaxphoenix.syntaxapi.nbt.NbtByteArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; -import com.syntaxphoenix.syntaxapi.nbt.NbtDouble; -import com.syntaxphoenix.syntaxapi.nbt.NbtEnd; -import com.syntaxphoenix.syntaxapi.nbt.NbtFloat; -import com.syntaxphoenix.syntaxapi.nbt.NbtInt; -import com.syntaxphoenix.syntaxapi.nbt.NbtIntArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtList; -import com.syntaxphoenix.syntaxapi.nbt.NbtLong; -import com.syntaxphoenix.syntaxapi.nbt.NbtLongArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtShort; -import com.syntaxphoenix.syntaxapi.nbt.NbtString; -import com.syntaxphoenix.syntaxapi.nbt.NbtTag; -import com.syntaxphoenix.syntaxapi.nbt.NbtType; +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterContext; +import net.sourcewriters.minecraft.vcompat.data.api.IDataType; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtByte; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtByteArray; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtCompound; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtDouble; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtEnd; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtFloat; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtInt; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtIntArray; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtList; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtLong; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtLongArray; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtShort; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtString; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtTag; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtType; import net.minecraft.server.v1_14_R1.ItemStack; import net.minecraft.server.v1_14_R1.NBTBase; @@ -41,10 +41,10 @@ import net.minecraft.server.v1_14_R1.NBTTagString; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1.data.BukkitContext1_14_R1; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1.data.BukkitType1_14_R1; -import net.sourcewriters.minecraft.vcompat.reflection.BukkitConversion; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; +import net.sourcewriters.minecraft.vcompat.provider.BukkitConversion; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityType; public class BukkitConversion1_14_R1 extends BukkitConversion { @@ -206,12 +206,12 @@ public NbtCompound itemToCompound(org.bukkit.inventory.ItemStack itemStack) { } @Override - public WrappedContext createContext(DataAdapterContext context) { + public WrappedContext createContext(IDataAdapterContext context) { return new BukkitContext1_14_R1(context); } @Override - public WrapType wrap(DataType dataType) { + public WrapType wrap(IDataType dataType) { return new BukkitType1_14_R1<>(dataType); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/EntityProvider1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/EntityProvider1_14_R1.java index 0cb54df..4d0555a 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/EntityProvider1_14_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/EntityProvider1_14_R1.java @@ -7,9 +7,9 @@ import net.minecraft.server.v1_14_R1.World; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1.utils.EntityConstructors1_14_R1; -import net.sourcewriters.minecraft.vcompat.reflection.EntityProvider; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; +import net.sourcewriters.minecraft.vcompat.provider.EntityProvider; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityType; public class EntityProvider1_14_R1 extends EntityProvider { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/PacketHandler1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/PacketHandler1_14_R1.java index 1eda3c0..a35b3df 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/PacketHandler1_14_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/PacketHandler1_14_R1.java @@ -1,6 +1,6 @@ package net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1; -import net.sourcewriters.minecraft.vcompat.reflection.PacketHandler; +import net.sourcewriters.minecraft.vcompat.provider.PacketHandler; public class PacketHandler1_14_R1 extends PacketHandler { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/PlayerProvider1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/PlayerProvider1_14_R1.java index 064c77a..772b752 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/PlayerProvider1_14_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/PlayerProvider1_14_R1.java @@ -3,8 +3,8 @@ import org.bukkit.entity.Player; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1.entity.Player1_14_R1; -import net.sourcewriters.minecraft.vcompat.reflection.PlayerProvider; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.provider.PlayerProvider; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsPlayer; public class PlayerProvider1_14_R1 extends PlayerProvider { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/TextureProvider1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/TextureProvider1_14_R1.java index 526eac6..4b42cbe 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/TextureProvider1_14_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/TextureProvider1_14_R1.java @@ -9,20 +9,20 @@ import org.bukkit.inventory.meta.SkullMeta; import com.mojang.authlib.GameProfile; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookup; import net.minecraft.server.v1_14_R1.GameProfileSerializer; import net.minecraft.server.v1_14_R1.ItemStack; import net.minecraft.server.v1_14_R1.NBTTagCompound; import net.minecraft.server.v1_14_R1.TileEntitySkull; -import net.sourcewriters.minecraft.vcompat.reflection.TextureProvider; +import net.sourcewriters.minecraft.vcompat.provider.TextureProvider; public class TextureProvider1_14_R1 extends TextureProvider { - private final AbstractReflect craftEntityStateRef = new Reflect(CraftBlockEntityState.class).searchField("tileEntity", "tileEntity"); - private final AbstractReflect craftItemStackRef = new Reflect(CraftItemStack.class).searchField("handle", "handle"); - private final AbstractReflect craftMetaSkullRef = new Reflect("org.bukkit.craftbukkit.v1_14_R1.inventory.CraftMetaSkull") + private final ClassLookup craftEntityStateRef = ClassLookup.of(CraftBlockEntityState.class).searchField("tileEntity", "tileEntity"); + private final ClassLookup craftItemStackRef = ClassLookup.of(CraftItemStack.class).searchField("handle", "handle"); + private final ClassLookup craftMetaSkullRef = ClassLookup.of("org.bukkit.craftbukkit.v1_14_R1.inventory.CraftMetaSkull") .searchField("serialized", "serializedProfile").searchField("profile", "profile"); protected TextureProvider1_14_R1(VersionControl1_14_R1 versionControl) { @@ -34,7 +34,7 @@ public GameProfile profileFromBlock(Block block) { if (!(block instanceof CraftSkull)) { return null; } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue(block, "tileEntity"); return entitySkull.gameProfile; } @@ -44,13 +44,13 @@ public GameProfile profileFromItem(org.bukkit.inventory.ItemStack itemStack) { return null; } SkullMeta meta = (SkullMeta) itemStack.getItemMeta(); - GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue("profile", meta); + GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue(meta, "profile"); if (profile == null) { - NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue("serialized", meta); + NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue(meta, "serialized"); if (compound == null) { ItemStack stack = null; if (itemStack instanceof CraftItemStack) { - stack = (ItemStack) craftItemStackRef.getFieldValue("handle", itemStack); + stack = (ItemStack) craftItemStackRef.getFieldValue(itemStack, "handle"); } if (stack == null) { stack = CraftItemStack.asNMSCopy(itemStack); @@ -94,7 +94,7 @@ public boolean applyBlock(Block block, GameProfile profile) { if (!(block instanceof CraftSkull)) { return false; } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue(block, "tileEntity"); entitySkull.setGameProfile(profile); return true; } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/ToolProvider1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/ToolProvider1_14_R1.java index db19fec..9efa743 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/ToolProvider1_14_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/ToolProvider1_14_R1.java @@ -3,7 +3,7 @@ import net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1.tools.BlockTools1_14_R1; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1.tools.ServerTools1_14_R1; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1.tools.SkinTools1_14_R1; -import net.sourcewriters.minecraft.vcompat.reflection.ToolProvider; +import net.sourcewriters.minecraft.vcompat.provider.ToolProvider; public class ToolProvider1_14_R1 extends ToolProvider { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/VersionControl1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/VersionControl1_14_R1.java index 8971b60..8e37265 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/VersionControl1_14_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/VersionControl1_14_R1.java @@ -1,7 +1,7 @@ package net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1.data.hook.BukkitContainerAdapterHook1_14_R1; -import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; +import net.sourcewriters.minecraft.vcompat.provider.VersionControl; public class VersionControl1_14_R1 extends VersionControl { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/BukkitContainer1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/BukkitContainer1_14_R1.java index c3249e6..499b864 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/BukkitContainer1_14_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/BukkitContainer1_14_R1.java @@ -10,12 +10,12 @@ import org.bukkit.persistence.PersistentDataContainer; import org.bukkit.persistence.PersistentDataType; -import com.syntaxphoenix.syntaxapi.data.IDataContainer; +import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SyntaxKey; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedKey; +import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SyntaxKey; public final class BukkitContainer1_14_R1 extends WrappedContainer implements PersistentDataContainer { @@ -70,7 +70,7 @@ public Set getKeys() { @Override public PersistentDataAdapterContext getAdapterContext() { - return getContext(); + return getWrapContext(); } /* @@ -78,7 +78,7 @@ public PersistentDataAdapterContext getAdapterContext() { */ @Override - public BukkitContext1_14_R1 getContext() { + public BukkitContext1_14_R1 getWrapContext() { return new BukkitContext1_14_R1(container.getAdapterContext()); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/BukkitContext1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/BukkitContext1_14_R1.java index 1b6becf..c7cccc9 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/BukkitContext1_14_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/BukkitContext1_14_R1.java @@ -3,21 +3,21 @@ import org.bukkit.persistence.PersistentDataAdapterContext; import org.bukkit.persistence.PersistentDataContainer; -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.IDataContainer; +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterContext; +import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContext; -public final class BukkitContext1_14_R1 extends WrappedContext implements PersistentDataAdapterContext { +public final class BukkitContext1_14_R1 extends WrappedContext implements PersistentDataAdapterContext { - private final DataAdapterContext context; + private final IDataAdapterContext context; - public BukkitContext1_14_R1(DataAdapterContext context) { + public BukkitContext1_14_R1(IDataAdapterContext context) { this.context = context; } @Override - public DataAdapterContext getHandle() { + public IDataAdapterContext getHandle() { return context; } @@ -27,12 +27,12 @@ public PersistentDataContainer newPersistentDataContainer() { } @Override - public IDataContainer newDataContainer() { + public IDataContainer newContainer() { return context.newDataContainer(); } @Override - public BukkitContainer1_14_R1 newContainer() { + public BukkitContainer1_14_R1 newWrapContainer() { return new BukkitContainer1_14_R1(context.newDataContainer()); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/BukkitKey1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/BukkitKey1_14_R1.java index 508d7be..a2ca0d8 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/BukkitKey1_14_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/BukkitKey1_14_R1.java @@ -3,7 +3,7 @@ import org.bukkit.NamespacedKey; import org.bukkit.plugin.Plugin; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedKey; public final class BukkitKey1_14_R1 extends WrappedKey { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/BukkitType1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/BukkitType1_14_R1.java index 964655b..8ab5c26 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/BukkitType1_14_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/BukkitType1_14_R1.java @@ -3,22 +3,22 @@ import org.bukkit.persistence.PersistentDataAdapterContext; import org.bukkit.persistence.PersistentDataType; -import com.syntaxphoenix.syntaxapi.data.DataType; +import net.sourcewriters.minecraft.vcompat.data.api.IDataType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContext; -public class BukkitType1_14_R1 extends WrappedType1_14_R1, P0, P1, C0, C1> +public class BukkitType1_14_R1 extends WrappedType1_14_R1, P0, P1, C0, C1> implements PersistentDataType { - private final DataType type; + private final IDataType type; - public BukkitType1_14_R1(DataType type) { + public BukkitType1_14_R1(IDataType type) { super(type.getPrimitive(), type.getComplex()); this.type = type; } @Override - public DataType getHandle() { + public IDataType getHandle() { return type; } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/SimpleBukkitType1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/SimpleBukkitType1_14_R1.java index 56d158f..ded3c08 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/SimpleBukkitType1_14_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/SimpleBukkitType1_14_R1.java @@ -3,7 +3,7 @@ import org.bukkit.persistence.PersistentDataAdapterContext; import org.bukkit.persistence.PersistentDataType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; public class SimpleBukkitType1_14_R1 implements PersistentDataType { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/SyntaxContainer1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/SyntaxContainer1_14_R1.java index 74ed922..28bab7b 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/SyntaxContainer1_14_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/SyntaxContainer1_14_R1.java @@ -5,15 +5,15 @@ import org.bukkit.persistence.PersistentDataContainer; -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.data.IDataContainer; -import com.syntaxphoenix.syntaxapi.utils.key.IKey; +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterContext; +import net.sourcewriters.minecraft.vcompat.data.api.IDataType; +import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.utils.key.IKey; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SyntaxKey; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedKey; +import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SyntaxKey; public final class SyntaxContainer1_14_R1 extends WrappedContainer implements IDataContainer { @@ -43,22 +43,22 @@ public boolean has(IKey key) { } @Override - public boolean has(String key, DataType type) { + public boolean has(String key, IDataType type) { return has(syntaxKey(key), type); } @Override - public boolean has(IKey key, DataType type) { + public boolean has(IKey key, IDataType type) { return has(new SyntaxKey(key), WrappedType1_14_R1.wrap(type)); } @Override - public C get(String key, DataType type) { + public C get(String key, IDataType type) { return get(syntaxKey(key), type); } @Override - public C get(IKey key, DataType type) { + public C get(IKey key, IDataType type) { return get(new SyntaxKey(key), WrappedType1_14_R1.wrap(type)); } @@ -73,12 +73,12 @@ public Object get(IKey key) { } @Override - public void set(String key, E value, DataType type) { + public void set(String key, E value, IDataType type) { set(wrappedKey(key), value, WrappedType1_14_R1.wrap(type)); } @Override - public void set(IKey key, E value, DataType type) { + public void set(IKey key, E value, IDataType type) { set(new SyntaxKey(key), value, WrappedType1_14_R1.wrap(type)); } @@ -103,8 +103,8 @@ public Set getKeyspaces() { } @Override - public DataAdapterContext getAdapterContext() { - return getContext(); + public IDataAdapterContext getContext() { + return getWrapContext(); } /* @@ -112,7 +112,7 @@ public DataAdapterContext getAdapterContext() { */ @Override - public SyntaxContext1_14_R1 getContext() { + public SyntaxContext1_14_R1 getWrapContext() { return new SyntaxContext1_14_R1(container.getAdapterContext()); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/SyntaxContext1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/SyntaxContext1_14_R1.java index 2a7de94..68d310b 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/SyntaxContext1_14_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/SyntaxContext1_14_R1.java @@ -3,9 +3,9 @@ import org.bukkit.persistence.PersistentDataAdapterContext; import org.bukkit.persistence.PersistentDataContainer; -import com.syntaxphoenix.syntaxapi.data.IDataContainer; +import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContext; public final class SyntaxContext1_14_R1 extends WrappedContext implements PersistentDataAdapterContext { @@ -26,12 +26,12 @@ public PersistentDataContainer newPersistentDataContainer() { } @Override - public IDataContainer newDataContainer() { + public IDataContainer newContainer() { return newContainer(); } @Override - public SyntaxContainer1_14_R1 newContainer() { + public SyntaxContainer1_14_R1 newWrapContainer() { return new SyntaxContainer1_14_R1(context.newPersistentDataContainer()); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/SyntaxType1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/SyntaxType1_14_R1.java index 8855f0e..3135a14 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/SyntaxType1_14_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/SyntaxType1_14_R1.java @@ -3,13 +3,13 @@ import org.bukkit.persistence.PersistentDataAdapterContext; import org.bukkit.persistence.PersistentDataType; -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterContext; +import net.sourcewriters.minecraft.vcompat.data.api.IDataType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContext; public class SyntaxType1_14_R1 extends WrappedType1_14_R1, P0, P1, C0, C1> - implements DataType { + implements IDataType { private final PersistentDataType type; @@ -48,12 +48,12 @@ public Class getPrimitive() { } @Override - public P0 toPrimitive(DataAdapterContext context, C0 complex) { + public P0 toPrimitive(IDataAdapterContext context, C0 complex) { return wrapToPrimitive(complex, new BukkitContext1_14_R1(context)); } @Override - public C0 fromPrimitive(DataAdapterContext context, P0 primitive) { + public C0 fromPrimitive(IDataAdapterContext context, P0 primitive) { return wrapToComplex(primitive, new BukkitContext1_14_R1(context)); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/WrappedType1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/WrappedType1_14_R1.java index 6363015..a0f61a8 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/WrappedType1_14_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/WrappedType1_14_R1.java @@ -5,10 +5,10 @@ import org.bukkit.persistence.PersistentDataContainer; import org.bukkit.persistence.PersistentDataType; -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.data.IDataContainer; +import net.sourcewriters.minecraft.vcompat.data.api.IDataType; +import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; public abstract class WrappedType1_14_R1 implements WrapType { @@ -139,7 +139,7 @@ protected static int internalState(Class clazz) { return 0; } - public static BukkitType1_14_R1 wrap(DataType type) { + public static BukkitType1_14_R1 wrap(IDataType type) { return new BukkitType1_14_R1<>(type); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/hook/BukkitContainerAdapterHook1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/hook/BukkitContainerAdapterHook1_14_R1.java index 6e291ef..43bcb0a 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/hook/BukkitContainerAdapterHook1_14_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/hook/BukkitContainerAdapterHook1_14_R1.java @@ -10,17 +10,17 @@ import org.bukkit.craftbukkit.v1_14_R1.persistence.CraftPersistentDataTypeRegistry; import org.bukkit.persistence.PersistentDataContainer; -import com.syntaxphoenix.syntaxapi.data.IDataContainer; -import com.syntaxphoenix.syntaxapi.data.container.nbt.NbtContainer; -import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; +import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; +import net.sourcewriters.minecraft.vcompat.data.nbt.NbtContainer; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtCompound; + +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookup; import net.minecraft.server.v1_14_R1.NBTTagCompound; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1.data.BukkitContainer1_14_R1; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1.data.SyntaxContainer1_14_R1; -import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.provider.VersionControl; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContainer; @SuppressWarnings({ "rawtypes", @@ -30,11 +30,11 @@ public final class BukkitContainerAdapterHook1_14_R1 { private static final BukkitContainerAdapterHook1_14_R1 HOOK = new BukkitContainerAdapterHook1_14_R1(); - private final AbstractReflect registryRef = new Reflect(CraftPersistentDataTypeRegistry.class) + private final ClassLookup registryRef = ClassLookup.of(CraftPersistentDataTypeRegistry.class) .searchMethod("create", "createAdapter", Class.class, Class.class, Function.class, Function.class) .searchField("adapters", "adapters") .searchField("function", "CREATE_ADAPTER"); - private final AbstractReflect entityRef = new Reflect(CraftEntity.class).searchField("registry", "DATA_TYPE_REGISTRY"); + private final ClassLookup entityRef = ClassLookup.of(CraftEntity.class).searchField("registry", "DATA_TYPE_REGISTRY"); private BukkitContainerAdapterHook1_14_R1() {} @@ -46,7 +46,7 @@ private CraftPersistentDataTypeRegistry getEntityRegistry() { private void uninjectAll() { for (CraftPersistentDataTypeRegistry registry : map.keySet()) { - Map adapters = (Map) registryRef.getFieldValue("adapters", registry); + Map adapters = (Map) registryRef.getFieldValue(registry, "adapters"); adapters.remove(BukkitContainer1_14_R1.class); adapters.remove(SyntaxContainer1_14_R1.class); registryRef.setFieldValue(registry, "function", map.get(registry)); @@ -58,8 +58,8 @@ private void inject(CraftPersistentDataTypeRegistry registry) { if (map.containsKey(registry)) { return; } - map.put(registry, (Function) registryRef.getFieldValue("function", registry)); - Function function = clazz -> createAdapter(registry, registryRef.getMethod("create").getReturnType(), (Class) clazz); + map.put(registry, (Function) registryRef.getFieldValue(registry, "function")); + Function function = clazz -> createAdapter(registry, registryRef.getMethod("create").type().returnType(), (Class) clazz); registryRef.setFieldValue(registry, "function", function); } @@ -89,7 +89,7 @@ private NBTTagCompound toPrimitive(WrappedContainer input) { } if (handle instanceof IDataContainer) { if (handle instanceof NbtContainer) { - return (NBTTagCompound) VersionControl.get().getBukkitConversion().toMinecraftCompound(((NbtContainer) handle).asNbt()); + return (NBTTagCompound) VersionCompatProvider.get().getControl().getBukkitConversion().toMinecraftCompound(((NbtContainer) handle).asNbt()); } throw new IllegalArgumentException( "Expected 'CraftPersistentDataContainer' got '" + handle.getClass().getSimpleName() + " instead'!"); @@ -98,7 +98,7 @@ private NBTTagCompound toPrimitive(WrappedContainer input) { } private BukkitContainer1_14_R1 fromPrimitiveSyntax(NBTTagCompound data) { - VersionControl control = VersionControl.get(); + VersionControl control = VersionCompatProvider.get().getControl(); NbtContainer container = new NbtContainer(control.getDataProvider().getRegistry()); NbtCompound compound = control.getBukkitConversion().fromMinecraftCompound(data); container.fromNbt(compound); diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/entity/ArmorStand1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/entity/ArmorStand1_14_R1.java index 6b1472c..3c7959e 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/entity/ArmorStand1_14_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/entity/ArmorStand1_14_R1.java @@ -3,7 +3,7 @@ import net.minecraft.server.v1_14_R1.EntityArmorStand; import net.minecraft.server.v1_14_R1.EntityTypes; import net.minecraft.server.v1_14_R1.World; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsArmorStand; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsArmorStand; public class ArmorStand1_14_R1 extends EntityLiving1_14_R1 implements NmsArmorStand { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/entity/Entity1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/entity/Entity1_14_R1.java index 6229156..9bcc628 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/entity/Entity1_14_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/entity/Entity1_14_R1.java @@ -20,8 +20,8 @@ import net.minecraft.server.v1_14_R1.PacketPlayOutSpawnEntity; import net.minecraft.server.v1_14_R1.PlayerConnection; import net.minecraft.server.v1_14_R1.Vec3D; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.utils.NmsBoundingBox; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.provider.utils.NmsBoundingBox; public abstract class Entity1_14_R1 implements NmsEntity { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/entity/EntityLiving1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/entity/EntityLiving1_14_R1.java index 7c507da..886b5b2 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/entity/EntityLiving1_14_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/entity/EntityLiving1_14_R1.java @@ -1,7 +1,7 @@ package net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1.entity; import net.minecraft.server.v1_14_R1.EntityLiving; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityLiving; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityLiving; public abstract class EntityLiving1_14_R1 extends Entity1_14_R1 implements NmsEntityLiving { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/entity/Player1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/entity/Player1_14_R1.java index fdd4cae..31333f3 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/entity/Player1_14_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/entity/Player1_14_R1.java @@ -32,15 +32,15 @@ import net.minecraft.server.v1_14_R1.PacketPlayOutTitle; import net.minecraft.server.v1_14_R1.PacketPlayOutTitle.EnumTitleAction; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1.data.SyntaxContainer1_14_R1; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.type.SkinDataType; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; -import net.sourcewriters.minecraft.vcompat.utils.bukkit.Players; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.MojangProfileServer; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; -import net.sourcewriters.minecraft.vcompat.utils.thread.PostAsync; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.provider.data.type.SkinDataType; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookupProvider; +import net.sourcewriters.minecraft.vcompat.util.bukkit.Players; +import net.sourcewriters.minecraft.vcompat.util.minecraft.MojangProfileServer; +import net.sourcewriters.minecraft.vcompat.util.minecraft.Skin; +import net.sourcewriters.minecraft.vcompat.util.thread.PostAsync; import net.minecraft.server.v1_14_R1.PlayerConnection; public class Player1_14_R1 extends EntityLiving1_14_R1 implements NmsPlayer { @@ -277,7 +277,7 @@ private final void update(boolean flag) { String name = getName(); if (name != null) { - ReflectionProvider.DEFAULT.getReflect("mjGameProfile").setFieldValue(profile, "name", name); + VersionCompatProvider.get().getLookupProvider().getLookup("mjGameProfile").setFieldValue(profile, "name", name); } if (!(name == null && skin == null)) { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/tools/BlockTools1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/tools/BlockTools1_14_R1.java index 77a8887..3b452bf 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/tools/BlockTools1_14_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/tools/BlockTools1_14_R1.java @@ -5,23 +5,23 @@ import com.mojang.authlib.properties.Property; import com.mojang.authlib.properties.PropertyMap; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookup; import net.minecraft.server.v1_14_R1.TileEntitySkull; -import net.sourcewriters.minecraft.vcompat.reflection.tools.BlockTools; -import net.sourcewriters.minecraft.vcompat.utils.constants.MinecraftConstants; +import net.sourcewriters.minecraft.vcompat.provider.tools.BlockTools; +import net.sourcewriters.minecraft.vcompat.util.constants.MinecraftConstants; public class BlockTools1_14_R1 extends BlockTools { - private final AbstractReflect craftEntityStateRef = new Reflect(CraftSkull.class).searchField("tileEntity", "tileEntity"); + private final ClassLookup craftEntityStateRef = ClassLookup.of(CraftSkull.class).searchField("tileEntity", "tileEntity"); @Override public void setHeadTexture(Block block, String texture) { if (!(block instanceof CraftSkull)) { return; } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue(block, "tileEntity"); PropertyMap map = entitySkull.gameProfile.getProperties(); map.removeAll("textures"); map.put("textures", new Property("textures", MinecraftConstants.TEXTURE_SIGNATURE, texture)); @@ -32,7 +32,7 @@ public String getHeadTexture(Block block) { if (!(block instanceof CraftSkull)) { return null; } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue(block, "tileEntity"); return entitySkull.gameProfile.getProperties().get("textures").iterator().next().getValue(); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/tools/ServerTools1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/tools/ServerTools1_14_R1.java index c333426..a8a7e0a 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/tools/ServerTools1_14_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/tools/ServerTools1_14_R1.java @@ -4,7 +4,7 @@ import org.bukkit.craftbukkit.v1_14_R1.CraftServer; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1.wrapper.ConsoleReaderWrapper1_14_R1; -import net.sourcewriters.minecraft.vcompat.reflection.tools.ServerTools; +import net.sourcewriters.minecraft.vcompat.provider.tools.ServerTools; public class ServerTools1_14_R1 extends ServerTools { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/tools/SkinTools1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/tools/SkinTools1_14_R1.java index 1b55d02..aec8e00 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/tools/SkinTools1_14_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/tools/SkinTools1_14_R1.java @@ -3,8 +3,8 @@ import org.bukkit.craftbukkit.v1_14_R1.entity.CraftPlayer; import org.bukkit.entity.Player; -import net.sourcewriters.minecraft.vcompat.reflection.tools.SkinTools; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; +import net.sourcewriters.minecraft.vcompat.provider.tools.SkinTools; +import net.sourcewriters.minecraft.vcompat.util.minecraft.Skin; public class SkinTools1_14_R1 extends SkinTools { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/wrapper/ConsoleReaderWrapper1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/wrapper/ConsoleReaderWrapper1_14_R1.java index df10812..185611f 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/wrapper/ConsoleReaderWrapper1_14_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/wrapper/ConsoleReaderWrapper1_14_R1.java @@ -7,7 +7,7 @@ import org.bukkit.craftbukkit.v1_14_R1.CraftServer; import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; -import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; +import net.sourcewriters.minecraft.vcompat.provider.wrapper.ConsoleReaderWrapper; public final class ConsoleReaderWrapper1_14_R1 extends ConsoleReaderWrapper { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/BukkitConversion1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/BukkitConversion1_15_R1.java index 2df7731..454cc21 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/BukkitConversion1_15_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/BukkitConversion1_15_R1.java @@ -5,23 +5,23 @@ import org.bukkit.craftbukkit.v1_15_R1.inventory.CraftItemStack; import org.bukkit.entity.EntityType; -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.nbt.NbtByte; -import com.syntaxphoenix.syntaxapi.nbt.NbtByteArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; -import com.syntaxphoenix.syntaxapi.nbt.NbtDouble; -import com.syntaxphoenix.syntaxapi.nbt.NbtEnd; -import com.syntaxphoenix.syntaxapi.nbt.NbtFloat; -import com.syntaxphoenix.syntaxapi.nbt.NbtInt; -import com.syntaxphoenix.syntaxapi.nbt.NbtIntArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtList; -import com.syntaxphoenix.syntaxapi.nbt.NbtLong; -import com.syntaxphoenix.syntaxapi.nbt.NbtLongArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtShort; -import com.syntaxphoenix.syntaxapi.nbt.NbtString; -import com.syntaxphoenix.syntaxapi.nbt.NbtTag; -import com.syntaxphoenix.syntaxapi.nbt.NbtType; +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterContext; +import net.sourcewriters.minecraft.vcompat.data.api.IDataType; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtByte; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtByteArray; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtCompound; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtDouble; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtEnd; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtFloat; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtInt; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtIntArray; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtList; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtLong; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtLongArray; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtShort; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtString; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtTag; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtType; import net.minecraft.server.v1_15_R1.ItemStack; import net.minecraft.server.v1_15_R1.NBTBase; @@ -41,10 +41,10 @@ import net.minecraft.server.v1_15_R1.NBTTagString; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1.data.BukkitContext1_15_R1; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1.data.BukkitType1_15_R1; -import net.sourcewriters.minecraft.vcompat.reflection.BukkitConversion; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; +import net.sourcewriters.minecraft.vcompat.provider.BukkitConversion; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityType; public class BukkitConversion1_15_R1 extends BukkitConversion { @@ -206,12 +206,12 @@ public NbtCompound itemToCompound(org.bukkit.inventory.ItemStack itemStack) { } @Override - public WrappedContext createContext(DataAdapterContext context) { + public WrappedContext createContext(IDataAdapterContext context) { return new BukkitContext1_15_R1(context); } @Override - public WrapType wrap(DataType dataType) { + public WrapType wrap(IDataType dataType) { return new BukkitType1_15_R1<>(dataType); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/EntityProvider1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/EntityProvider1_15_R1.java index e24e12a..05f7b59 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/EntityProvider1_15_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/EntityProvider1_15_R1.java @@ -7,9 +7,9 @@ import net.minecraft.server.v1_15_R1.World; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1.utils.EntityConstructors1_15_R1; -import net.sourcewriters.minecraft.vcompat.reflection.EntityProvider; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; +import net.sourcewriters.minecraft.vcompat.provider.EntityProvider; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityType; public class EntityProvider1_15_R1 extends EntityProvider { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/PacketHandler1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/PacketHandler1_15_R1.java index bf7683d..8489885 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/PacketHandler1_15_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/PacketHandler1_15_R1.java @@ -1,6 +1,6 @@ package net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1; -import net.sourcewriters.minecraft.vcompat.reflection.PacketHandler; +import net.sourcewriters.minecraft.vcompat.provider.PacketHandler; public class PacketHandler1_15_R1 extends PacketHandler { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/PlayerProvider1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/PlayerProvider1_15_R1.java index fef4f48..e41e5af 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/PlayerProvider1_15_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/PlayerProvider1_15_R1.java @@ -3,8 +3,8 @@ import org.bukkit.entity.Player; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1.entity.Player1_15_R1; -import net.sourcewriters.minecraft.vcompat.reflection.PlayerProvider; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.provider.PlayerProvider; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsPlayer; public class PlayerProvider1_15_R1 extends PlayerProvider { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/TextureProvider1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/TextureProvider1_15_R1.java index 20f9877..d02bafc 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/TextureProvider1_15_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/TextureProvider1_15_R1.java @@ -9,20 +9,20 @@ import org.bukkit.inventory.meta.SkullMeta; import com.mojang.authlib.GameProfile; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookup; import net.minecraft.server.v1_15_R1.GameProfileSerializer; import net.minecraft.server.v1_15_R1.ItemStack; import net.minecraft.server.v1_15_R1.NBTTagCompound; import net.minecraft.server.v1_15_R1.TileEntitySkull; -import net.sourcewriters.minecraft.vcompat.reflection.TextureProvider; +import net.sourcewriters.minecraft.vcompat.provider.TextureProvider; public class TextureProvider1_15_R1 extends TextureProvider { - private final AbstractReflect craftEntityStateRef = new Reflect(CraftBlockEntityState.class).searchField("tileEntity", "tileEntity"); - private final AbstractReflect craftItemStackRef = new Reflect(CraftItemStack.class).searchField("handle", "handle"); - private final AbstractReflect craftMetaSkullRef = new Reflect("org.bukkit.craftbukkit.v1_15_R1.inventory.CraftMetaSkull") + private final ClassLookup craftEntityStateRef = ClassLookup.of(CraftBlockEntityState.class).searchField("tileEntity", "tileEntity"); + private final ClassLookup craftItemStackRef = ClassLookup.of(CraftItemStack.class).searchField("handle", "handle"); + private final ClassLookup craftMetaSkullRef = ClassLookup.of("org.bukkit.craftbukkit.v1_15_R1.inventory.CraftMetaSkull") .searchField("serialized", "serializedProfile").searchField("profile", "profile"); protected TextureProvider1_15_R1(VersionControl1_15_R1 versionControl) { @@ -34,7 +34,7 @@ public GameProfile profileFromBlock(Block block) { if (!(block instanceof CraftSkull)) { return null; } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue(block, "tileEntity"); return entitySkull.gameProfile; } @@ -44,13 +44,13 @@ public GameProfile profileFromItem(org.bukkit.inventory.ItemStack itemStack) { return null; } SkullMeta meta = (SkullMeta) itemStack.getItemMeta(); - GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue("profile", meta); + GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue(meta, "profile"); if (profile == null) { - NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue("serialized", meta); + NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue(meta, "serialized"); if (compound == null) { ItemStack stack = null; if (itemStack instanceof CraftItemStack) { - stack = (ItemStack) craftItemStackRef.getFieldValue("handle", itemStack); + stack = (ItemStack) craftItemStackRef.getFieldValue(itemStack, "handle"); } if (stack == null) { stack = CraftItemStack.asNMSCopy(itemStack); @@ -94,7 +94,7 @@ public boolean applyBlock(Block block, GameProfile profile) { if (!(block instanceof CraftSkull)) { return false; } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue(block, "tileEntity"); entitySkull.setGameProfile(profile); return true; } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/ToolProvider1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/ToolProvider1_15_R1.java index f623310..87d30c4 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/ToolProvider1_15_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/ToolProvider1_15_R1.java @@ -3,7 +3,7 @@ import net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1.tools.BlockTools1_15_R1; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1.tools.ServerTools1_15_R1; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1.tools.SkinTools1_15_R1; -import net.sourcewriters.minecraft.vcompat.reflection.ToolProvider; +import net.sourcewriters.minecraft.vcompat.provider.ToolProvider; public class ToolProvider1_15_R1 extends ToolProvider { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/VersionControl1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/VersionControl1_15_R1.java index 18de541..17a06b8 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/VersionControl1_15_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/VersionControl1_15_R1.java @@ -1,7 +1,7 @@ package net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1.data.hook.BukkitContainerAdapterHook1_15_R1; -import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; +import net.sourcewriters.minecraft.vcompat.provider.VersionControl; public class VersionControl1_15_R1 extends VersionControl { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/BukkitContainer1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/BukkitContainer1_15_R1.java index 18afda0..615fee6 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/BukkitContainer1_15_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/BukkitContainer1_15_R1.java @@ -10,12 +10,12 @@ import org.bukkit.persistence.PersistentDataContainer; import org.bukkit.persistence.PersistentDataType; -import com.syntaxphoenix.syntaxapi.data.IDataContainer; +import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SyntaxKey; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedKey; +import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SyntaxKey; public final class BukkitContainer1_15_R1 extends WrappedContainer implements PersistentDataContainer { @@ -70,7 +70,7 @@ public Set getKeys() { @Override public PersistentDataAdapterContext getAdapterContext() { - return getContext(); + return getWrapContext(); } /* @@ -78,7 +78,7 @@ public PersistentDataAdapterContext getAdapterContext() { */ @Override - public BukkitContext1_15_R1 getContext() { + public BukkitContext1_15_R1 getWrapContext() { return new BukkitContext1_15_R1(container.getAdapterContext()); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/BukkitContext1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/BukkitContext1_15_R1.java index f90cb76..7bc8369 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/BukkitContext1_15_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/BukkitContext1_15_R1.java @@ -3,21 +3,21 @@ import org.bukkit.persistence.PersistentDataAdapterContext; import org.bukkit.persistence.PersistentDataContainer; -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.IDataContainer; +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterContext; +import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContext; -public final class BukkitContext1_15_R1 extends WrappedContext implements PersistentDataAdapterContext { +public final class BukkitContext1_15_R1 extends WrappedContext implements PersistentDataAdapterContext { - private final DataAdapterContext context; + private final IDataAdapterContext context; - public BukkitContext1_15_R1(DataAdapterContext context) { + public BukkitContext1_15_R1(IDataAdapterContext context) { this.context = context; } @Override - public DataAdapterContext getHandle() { + public IDataAdapterContext getHandle() { return context; } @@ -27,12 +27,12 @@ public PersistentDataContainer newPersistentDataContainer() { } @Override - public IDataContainer newDataContainer() { + public IDataContainer newContainer() { return context.newDataContainer(); } @Override - public BukkitContainer1_15_R1 newContainer() { + public BukkitContainer1_15_R1 newWrapContainer() { return new BukkitContainer1_15_R1(context.newDataContainer()); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/BukkitKey1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/BukkitKey1_15_R1.java index e9bcb39..e05451d 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/BukkitKey1_15_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/BukkitKey1_15_R1.java @@ -3,7 +3,7 @@ import org.bukkit.NamespacedKey; import org.bukkit.plugin.Plugin; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedKey; public final class BukkitKey1_15_R1 extends WrappedKey { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/BukkitType1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/BukkitType1_15_R1.java index 4a020c0..f02ddb9 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/BukkitType1_15_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/BukkitType1_15_R1.java @@ -3,22 +3,22 @@ import org.bukkit.persistence.PersistentDataAdapterContext; import org.bukkit.persistence.PersistentDataType; -import com.syntaxphoenix.syntaxapi.data.DataType; +import net.sourcewriters.minecraft.vcompat.data.api.IDataType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContext; -public class BukkitType1_15_R1 extends WrappedType1_15_R1, P0, P1, C0, C1> +public class BukkitType1_15_R1 extends WrappedType1_15_R1, P0, P1, C0, C1> implements PersistentDataType { - private final DataType type; + private final IDataType type; - public BukkitType1_15_R1(DataType type) { + public BukkitType1_15_R1(IDataType type) { super(type.getPrimitive(), type.getComplex()); this.type = type; } @Override - public DataType getHandle() { + public IDataType getHandle() { return type; } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/SimpleBukkitType1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/SimpleBukkitType1_15_R1.java index 9f99c41..5067321 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/SimpleBukkitType1_15_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/SimpleBukkitType1_15_R1.java @@ -3,7 +3,7 @@ import org.bukkit.persistence.PersistentDataAdapterContext; import org.bukkit.persistence.PersistentDataType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; public class SimpleBukkitType1_15_R1 implements PersistentDataType { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/SyntaxContainer1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/SyntaxContainer1_15_R1.java index a1b52e2..f7e6b89 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/SyntaxContainer1_15_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/SyntaxContainer1_15_R1.java @@ -5,15 +5,15 @@ import org.bukkit.persistence.PersistentDataContainer; -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.data.IDataContainer; -import com.syntaxphoenix.syntaxapi.utils.key.IKey; +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterContext; +import net.sourcewriters.minecraft.vcompat.data.api.IDataType; +import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.utils.key.IKey; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SyntaxKey; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedKey; +import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SyntaxKey; public final class SyntaxContainer1_15_R1 extends WrappedContainer implements IDataContainer { @@ -43,22 +43,22 @@ public boolean has(IKey key) { } @Override - public boolean has(String key, DataType type) { + public boolean has(String key, IDataType type) { return has(syntaxKey(key), type); } @Override - public boolean has(IKey key, DataType type) { + public boolean has(IKey key, IDataType type) { return has(new SyntaxKey(key), WrappedType1_15_R1.wrap(type)); } @Override - public C get(String key, DataType type) { + public C get(String key, IDataType type) { return get(syntaxKey(key), type); } @Override - public C get(IKey key, DataType type) { + public C get(IKey key, IDataType type) { return get(new SyntaxKey(key), WrappedType1_15_R1.wrap(type)); } @@ -73,12 +73,12 @@ public Object get(IKey key) { } @Override - public void set(String key, E value, DataType type) { + public void set(String key, E value, IDataType type) { set(wrappedKey(key), value, WrappedType1_15_R1.wrap(type)); } @Override - public void set(IKey key, E value, DataType type) { + public void set(IKey key, E value, IDataType type) { set(new SyntaxKey(key), value, WrappedType1_15_R1.wrap(type)); } @@ -103,8 +103,8 @@ public Set getKeyspaces() { } @Override - public DataAdapterContext getAdapterContext() { - return getContext(); + public IDataAdapterContext getContext() { + return getWrapContext(); } /* @@ -112,7 +112,7 @@ public DataAdapterContext getAdapterContext() { */ @Override - public SyntaxContext1_15_R1 getContext() { + public SyntaxContext1_15_R1 getWrapContext() { return new SyntaxContext1_15_R1(container.getAdapterContext()); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/SyntaxContext1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/SyntaxContext1_15_R1.java index f243ee4..9c19bf8 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/SyntaxContext1_15_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/SyntaxContext1_15_R1.java @@ -3,9 +3,9 @@ import org.bukkit.persistence.PersistentDataAdapterContext; import org.bukkit.persistence.PersistentDataContainer; -import com.syntaxphoenix.syntaxapi.data.IDataContainer; +import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContext; public final class SyntaxContext1_15_R1 extends WrappedContext implements PersistentDataAdapterContext { @@ -26,12 +26,12 @@ public PersistentDataContainer newPersistentDataContainer() { } @Override - public IDataContainer newDataContainer() { + public IDataContainer newContainer() { return newContainer(); } @Override - public SyntaxContainer1_15_R1 newContainer() { + public SyntaxContainer1_15_R1 newWrapContainer() { return new SyntaxContainer1_15_R1(context.newPersistentDataContainer()); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/SyntaxType1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/SyntaxType1_15_R1.java index f13447c..e8c8624 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/SyntaxType1_15_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/SyntaxType1_15_R1.java @@ -3,13 +3,13 @@ import org.bukkit.persistence.PersistentDataAdapterContext; import org.bukkit.persistence.PersistentDataType; -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterContext; +import net.sourcewriters.minecraft.vcompat.data.api.IDataType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContext; public class SyntaxType1_15_R1 extends WrappedType1_15_R1, P0, P1, C0, C1> - implements DataType { + implements IDataType { private final PersistentDataType type; @@ -48,12 +48,12 @@ public Class getPrimitive() { } @Override - public P0 toPrimitive(DataAdapterContext context, C0 complex) { + public P0 toPrimitive(IDataAdapterContext context, C0 complex) { return wrapToPrimitive(complex, new BukkitContext1_15_R1(context)); } @Override - public C0 fromPrimitive(DataAdapterContext context, P0 primitive) { + public C0 fromPrimitive(IDataAdapterContext context, P0 primitive) { return wrapToComplex(primitive, new BukkitContext1_15_R1(context)); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/WrappedType1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/WrappedType1_15_R1.java index 0b8713a..b73c72c 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/WrappedType1_15_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/WrappedType1_15_R1.java @@ -5,10 +5,10 @@ import org.bukkit.persistence.PersistentDataContainer; import org.bukkit.persistence.PersistentDataType; -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.data.IDataContainer; +import net.sourcewriters.minecraft.vcompat.data.api.IDataType; +import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; public abstract class WrappedType1_15_R1 implements WrapType { @@ -139,7 +139,7 @@ protected static int internalState(Class clazz) { return 0; } - public static BukkitType1_15_R1 wrap(DataType type) { + public static BukkitType1_15_R1 wrap(IDataType type) { return new BukkitType1_15_R1<>(type); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/hook/BukkitContainerAdapterHook1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/hook/BukkitContainerAdapterHook1_15_R1.java index d55ac74..dfa1462 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/hook/BukkitContainerAdapterHook1_15_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/hook/BukkitContainerAdapterHook1_15_R1.java @@ -10,17 +10,17 @@ import org.bukkit.craftbukkit.v1_15_R1.persistence.CraftPersistentDataTypeRegistry; import org.bukkit.persistence.PersistentDataContainer; -import com.syntaxphoenix.syntaxapi.data.IDataContainer; -import com.syntaxphoenix.syntaxapi.data.container.nbt.NbtContainer; -import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; +import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; +import net.sourcewriters.minecraft.vcompat.data.nbt.NbtContainer; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtCompound; + +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookup; import net.minecraft.server.v1_15_R1.NBTTagCompound; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1.data.BukkitContainer1_15_R1; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1.data.SyntaxContainer1_15_R1; -import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.provider.VersionControl; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContainer; @SuppressWarnings({ "rawtypes", @@ -30,11 +30,11 @@ public final class BukkitContainerAdapterHook1_15_R1 { private static final BukkitContainerAdapterHook1_15_R1 HOOK = new BukkitContainerAdapterHook1_15_R1(); - private final AbstractReflect registryRef = new Reflect(CraftPersistentDataTypeRegistry.class) + private final ClassLookup registryRef = ClassLookup.of(CraftPersistentDataTypeRegistry.class) .searchMethod("create", "createAdapter", Class.class, Class.class, Function.class, Function.class) .searchField("adapters", "adapters") .searchField("function", "CREATE_ADAPTER"); - private final AbstractReflect entityRef = new Reflect(CraftEntity.class).searchField("registry", "DATA_TYPE_REGISTRY"); + private final ClassLookup entityRef = ClassLookup.of(CraftEntity.class).searchField("registry", "DATA_TYPE_REGISTRY"); private BukkitContainerAdapterHook1_15_R1() {} @@ -46,7 +46,7 @@ private CraftPersistentDataTypeRegistry getEntityRegistry() { private void uninjectAll() { for (CraftPersistentDataTypeRegistry registry : map.keySet()) { - Map adapters = (Map) registryRef.getFieldValue("adapters", registry); + Map adapters = (Map) registryRef.getFieldValue(registry, "adapters"); adapters.remove(BukkitContainer1_15_R1.class); adapters.remove(SyntaxContainer1_15_R1.class); registryRef.setFieldValue(registry, "function", map.get(registry)); @@ -58,8 +58,8 @@ private void inject(CraftPersistentDataTypeRegistry registry) { if (map.containsKey(registry)) { return; } - map.put(registry, (Function) registryRef.getFieldValue("function", registry)); - Function function = clazz -> createAdapter(registry, registryRef.getMethod("create").getReturnType(), (Class) clazz); + map.put(registry, (Function) registryRef.getFieldValue(registry, "function")); + Function function = clazz -> createAdapter(registry, registryRef.getMethod("create").type().returnType(), (Class) clazz); registryRef.setFieldValue(registry, "function", function); } @@ -89,7 +89,7 @@ private NBTTagCompound toPrimitive(WrappedContainer input) { } if (handle instanceof IDataContainer) { if (handle instanceof NbtContainer) { - return (NBTTagCompound) VersionControl.get().getBukkitConversion().toMinecraftCompound(((NbtContainer) handle).asNbt()); + return (NBTTagCompound) VersionCompatProvider.get().getControl().getBukkitConversion().toMinecraftCompound(((NbtContainer) handle).asNbt()); } throw new IllegalArgumentException( "Expected 'CraftPersistentDataContainer' got '" + handle.getClass().getSimpleName() + " instead'!"); @@ -98,7 +98,7 @@ private NBTTagCompound toPrimitive(WrappedContainer input) { } private BukkitContainer1_15_R1 fromPrimitiveSyntax(NBTTagCompound data) { - VersionControl control = VersionControl.get(); + VersionControl control = VersionCompatProvider.get().getControl(); NbtContainer container = new NbtContainer(control.getDataProvider().getRegistry()); NbtCompound compound = control.getBukkitConversion().fromMinecraftCompound(data); container.fromNbt(compound); diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/entity/ArmorStand1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/entity/ArmorStand1_15_R1.java index b538e43..dc9cf47 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/entity/ArmorStand1_15_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/entity/ArmorStand1_15_R1.java @@ -3,7 +3,7 @@ import net.minecraft.server.v1_15_R1.EntityArmorStand; import net.minecraft.server.v1_15_R1.EntityTypes; import net.minecraft.server.v1_15_R1.World; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsArmorStand; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsArmorStand; public class ArmorStand1_15_R1 extends EntityLiving1_15_R1 implements NmsArmorStand { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/entity/Entity1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/entity/Entity1_15_R1.java index 88d33b6..1ae91da 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/entity/Entity1_15_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/entity/Entity1_15_R1.java @@ -20,8 +20,8 @@ import net.minecraft.server.v1_15_R1.PacketPlayOutSpawnEntity; import net.minecraft.server.v1_15_R1.PlayerConnection; import net.minecraft.server.v1_15_R1.Vec3D; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.utils.NmsBoundingBox; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.provider.utils.NmsBoundingBox; public abstract class Entity1_15_R1 implements NmsEntity { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/entity/EntityLiving1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/entity/EntityLiving1_15_R1.java index 3d97aba..d4c5a6f 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/entity/EntityLiving1_15_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/entity/EntityLiving1_15_R1.java @@ -1,7 +1,7 @@ package net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1.entity; import net.minecraft.server.v1_15_R1.EntityLiving; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityLiving; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityLiving; public abstract class EntityLiving1_15_R1 extends Entity1_15_R1 implements NmsEntityLiving { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/entity/Player1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/entity/Player1_15_R1.java index 5e6dd93..38cae4f 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/entity/Player1_15_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/entity/Player1_15_R1.java @@ -32,15 +32,15 @@ import net.minecraft.server.v1_15_R1.PacketPlayOutTitle; import net.minecraft.server.v1_15_R1.PacketPlayOutTitle.EnumTitleAction; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1.data.SyntaxContainer1_15_R1; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.type.SkinDataType; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; -import net.sourcewriters.minecraft.vcompat.utils.bukkit.Players; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.MojangProfileServer; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; -import net.sourcewriters.minecraft.vcompat.utils.thread.PostAsync; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.provider.data.type.SkinDataType; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookupProvider; +import net.sourcewriters.minecraft.vcompat.util.bukkit.Players; +import net.sourcewriters.minecraft.vcompat.util.minecraft.MojangProfileServer; +import net.sourcewriters.minecraft.vcompat.util.minecraft.Skin; +import net.sourcewriters.minecraft.vcompat.util.thread.PostAsync; import net.minecraft.server.v1_15_R1.PlayerConnection; public class Player1_15_R1 extends EntityLiving1_15_R1 implements NmsPlayer { @@ -277,7 +277,7 @@ private final void update(boolean flag) { String name = getName(); if (name != null) { - ReflectionProvider.DEFAULT.getReflect("mjGameProfile").setFieldValue(profile, "name", name); + VersionCompatProvider.get().getLookupProvider().getLookup("mjGameProfile").setFieldValue(profile, "name", name); } if (!(name == null && skin == null)) { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/tools/BlockTools1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/tools/BlockTools1_15_R1.java index b495ce8..bfdf2a2 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/tools/BlockTools1_15_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/tools/BlockTools1_15_R1.java @@ -5,23 +5,23 @@ import com.mojang.authlib.properties.Property; import com.mojang.authlib.properties.PropertyMap; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookup; import net.minecraft.server.v1_15_R1.TileEntitySkull; -import net.sourcewriters.minecraft.vcompat.reflection.tools.BlockTools; -import net.sourcewriters.minecraft.vcompat.utils.constants.MinecraftConstants; +import net.sourcewriters.minecraft.vcompat.provider.tools.BlockTools; +import net.sourcewriters.minecraft.vcompat.util.constants.MinecraftConstants; public class BlockTools1_15_R1 extends BlockTools { - private final AbstractReflect craftEntityStateRef = new Reflect(CraftSkull.class).searchField("tileEntity", "tileEntity"); + private final ClassLookup craftEntityStateRef = ClassLookup.of(CraftSkull.class).searchField("tileEntity", "tileEntity"); @Override public void setHeadTexture(Block block, String texture) { if (!(block instanceof CraftSkull)) { return; } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue(block, "tileEntity"); PropertyMap map = entitySkull.gameProfile.getProperties(); map.removeAll("textures"); map.put("textures", new Property("textures", MinecraftConstants.TEXTURE_SIGNATURE, texture)); @@ -32,7 +32,7 @@ public String getHeadTexture(Block block) { if (!(block instanceof CraftSkull)) { return null; } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue(block, "tileEntity"); return entitySkull.gameProfile.getProperties().get("textures").iterator().next().getValue(); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/tools/ServerTools1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/tools/ServerTools1_15_R1.java index 12d799c..b6faa6a 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/tools/ServerTools1_15_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/tools/ServerTools1_15_R1.java @@ -4,7 +4,7 @@ import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1.wrapper.ConsoleReaderWrapper1_15_R1; -import net.sourcewriters.minecraft.vcompat.reflection.tools.ServerTools; +import net.sourcewriters.minecraft.vcompat.provider.tools.ServerTools; public class ServerTools1_15_R1 extends ServerTools { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/tools/SkinTools1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/tools/SkinTools1_15_R1.java index e0e82f3..c016962 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/tools/SkinTools1_15_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/tools/SkinTools1_15_R1.java @@ -3,8 +3,8 @@ import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer; import org.bukkit.entity.Player; -import net.sourcewriters.minecraft.vcompat.reflection.tools.SkinTools; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; +import net.sourcewriters.minecraft.vcompat.provider.tools.SkinTools; +import net.sourcewriters.minecraft.vcompat.util.minecraft.Skin; public class SkinTools1_15_R1 extends SkinTools { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/wrapper/ConsoleReaderWrapper1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/wrapper/ConsoleReaderWrapper1_15_R1.java index 7cef3fb..7c725d8 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/wrapper/ConsoleReaderWrapper1_15_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/wrapper/ConsoleReaderWrapper1_15_R1.java @@ -7,7 +7,7 @@ import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; -import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; +import net.sourcewriters.minecraft.vcompat.provider.wrapper.ConsoleReaderWrapper; public final class ConsoleReaderWrapper1_15_R1 extends ConsoleReaderWrapper { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/BukkitConversion1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/BukkitConversion1_16_R1.java index 6c29a2f..65577d0 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/BukkitConversion1_16_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/BukkitConversion1_16_R1.java @@ -5,23 +5,23 @@ import org.bukkit.craftbukkit.v1_16_R1.inventory.CraftItemStack; import org.bukkit.entity.EntityType; -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.nbt.NbtByte; -import com.syntaxphoenix.syntaxapi.nbt.NbtByteArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; -import com.syntaxphoenix.syntaxapi.nbt.NbtDouble; -import com.syntaxphoenix.syntaxapi.nbt.NbtEnd; -import com.syntaxphoenix.syntaxapi.nbt.NbtFloat; -import com.syntaxphoenix.syntaxapi.nbt.NbtInt; -import com.syntaxphoenix.syntaxapi.nbt.NbtIntArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtList; -import com.syntaxphoenix.syntaxapi.nbt.NbtLong; -import com.syntaxphoenix.syntaxapi.nbt.NbtLongArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtShort; -import com.syntaxphoenix.syntaxapi.nbt.NbtString; -import com.syntaxphoenix.syntaxapi.nbt.NbtTag; -import com.syntaxphoenix.syntaxapi.nbt.NbtType; +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterContext; +import net.sourcewriters.minecraft.vcompat.data.api.IDataType; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtByte; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtByteArray; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtCompound; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtDouble; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtEnd; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtFloat; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtInt; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtIntArray; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtList; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtLong; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtLongArray; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtShort; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtString; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtTag; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtType; import net.minecraft.server.v1_16_R1.ItemStack; import net.minecraft.server.v1_16_R1.NBTBase; @@ -41,10 +41,10 @@ import net.minecraft.server.v1_16_R1.NBTTagString; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1.data.BukkitContext1_16_R1; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1.data.BukkitType1_16_R1; -import net.sourcewriters.minecraft.vcompat.reflection.BukkitConversion; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; +import net.sourcewriters.minecraft.vcompat.provider.BukkitConversion; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityType; public class BukkitConversion1_16_R1 extends BukkitConversion { @@ -206,12 +206,12 @@ public NbtCompound itemToCompound(org.bukkit.inventory.ItemStack itemStack) { } @Override - public WrappedContext createContext(DataAdapterContext context) { + public WrappedContext createContext(IDataAdapterContext context) { return new BukkitContext1_16_R1(context); } @Override - public WrapType wrap(DataType dataType) { + public WrapType wrap(IDataType dataType) { return new BukkitType1_16_R1<>(dataType); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/EntityProvider1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/EntityProvider1_16_R1.java index 5c71c1f..a052d49 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/EntityProvider1_16_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/EntityProvider1_16_R1.java @@ -7,9 +7,9 @@ import net.minecraft.server.v1_16_R1.World; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1.utils.EntityConstructors1_16_R1; -import net.sourcewriters.minecraft.vcompat.reflection.EntityProvider; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; +import net.sourcewriters.minecraft.vcompat.provider.EntityProvider; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityType; public class EntityProvider1_16_R1 extends EntityProvider { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/PacketHandler1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/PacketHandler1_16_R1.java index c8877a3..ce86b23 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/PacketHandler1_16_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/PacketHandler1_16_R1.java @@ -1,6 +1,6 @@ package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1; -import net.sourcewriters.minecraft.vcompat.reflection.PacketHandler; +import net.sourcewriters.minecraft.vcompat.provider.PacketHandler; public class PacketHandler1_16_R1 extends PacketHandler { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/PlayerProvider1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/PlayerProvider1_16_R1.java index a4c371a..f7ca594 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/PlayerProvider1_16_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/PlayerProvider1_16_R1.java @@ -3,8 +3,8 @@ import org.bukkit.entity.Player; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1.entity.Player1_16_R1; -import net.sourcewriters.minecraft.vcompat.reflection.PlayerProvider; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.provider.PlayerProvider; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsPlayer; public class PlayerProvider1_16_R1 extends PlayerProvider { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/TextureProvider1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/TextureProvider1_16_R1.java index 1498adc..91a23c1 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/TextureProvider1_16_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/TextureProvider1_16_R1.java @@ -9,20 +9,20 @@ import org.bukkit.inventory.meta.SkullMeta; import com.mojang.authlib.GameProfile; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookup; import net.minecraft.server.v1_16_R1.GameProfileSerializer; import net.minecraft.server.v1_16_R1.ItemStack; import net.minecraft.server.v1_16_R1.NBTTagCompound; import net.minecraft.server.v1_16_R1.TileEntitySkull; -import net.sourcewriters.minecraft.vcompat.reflection.TextureProvider; +import net.sourcewriters.minecraft.vcompat.provider.TextureProvider; public class TextureProvider1_16_R1 extends TextureProvider { - private final AbstractReflect craftEntityStateRef = new Reflect(CraftBlockEntityState.class).searchField("tileEntity", "tileEntity"); - private final AbstractReflect craftItemStackRef = new Reflect(CraftItemStack.class).searchField("handle", "handle"); - private final AbstractReflect craftMetaSkullRef = new Reflect("org.bukkit.craftbukkit.v1_16_R1.inventory.CraftMetaSkull") + private final ClassLookup craftEntityStateRef = ClassLookup.of(CraftBlockEntityState.class).searchField("tileEntity", "tileEntity"); + private final ClassLookup craftItemStackRef = ClassLookup.of(CraftItemStack.class).searchField("handle", "handle"); + private final ClassLookup craftMetaSkullRef = ClassLookup.of("org.bukkit.craftbukkit.v1_16_R1.inventory.CraftMetaSkull") .searchField("serialized", "serializedProfile").searchField("profile", "profile"); protected TextureProvider1_16_R1(VersionControl1_16_R1 versionControl) { @@ -34,7 +34,7 @@ public GameProfile profileFromBlock(Block block) { if (!(block instanceof CraftSkull)) { return null; } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue(block, "tileEntity"); return entitySkull.gameProfile; } @@ -44,13 +44,13 @@ public GameProfile profileFromItem(org.bukkit.inventory.ItemStack itemStack) { return null; } SkullMeta meta = (SkullMeta) itemStack.getItemMeta(); - GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue("profile", meta); + GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue(meta, "profile"); if (profile == null) { - NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue("serialized", meta); + NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue(meta, "serialized"); if (compound == null) { ItemStack stack = null; if (itemStack instanceof CraftItemStack) { - stack = (ItemStack) craftItemStackRef.getFieldValue("handle", itemStack); + stack = (ItemStack) craftItemStackRef.getFieldValue(itemStack, "handle"); } if (stack == null) { stack = CraftItemStack.asNMSCopy(itemStack); @@ -94,7 +94,7 @@ public boolean applyBlock(Block block, GameProfile profile) { if (!(block instanceof CraftSkull)) { return false; } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue(block, "tileEntity"); entitySkull.setGameProfile(profile); return true; } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/ToolProvider1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/ToolProvider1_16_R1.java index 9d967ea..4ec592c 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/ToolProvider1_16_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/ToolProvider1_16_R1.java @@ -3,7 +3,7 @@ import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1.tools.BlockTools1_16_R1; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1.tools.ServerTools1_16_R1; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1.tools.SkinTools1_16_R1; -import net.sourcewriters.minecraft.vcompat.reflection.ToolProvider; +import net.sourcewriters.minecraft.vcompat.provider.ToolProvider; public class ToolProvider1_16_R1 extends ToolProvider { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/VersionControl1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/VersionControl1_16_R1.java index 8ae7c70..b9bdcfd 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/VersionControl1_16_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/VersionControl1_16_R1.java @@ -1,7 +1,7 @@ package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1.data.hook.BukkitContainerAdapterHook1_16_R1; -import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; +import net.sourcewriters.minecraft.vcompat.provider.VersionControl; public class VersionControl1_16_R1 extends VersionControl { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/BukkitContainer1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/BukkitContainer1_16_R1.java index 251d3a1..72fc071 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/BukkitContainer1_16_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/BukkitContainer1_16_R1.java @@ -10,12 +10,12 @@ import org.bukkit.persistence.PersistentDataContainer; import org.bukkit.persistence.PersistentDataType; -import com.syntaxphoenix.syntaxapi.data.IDataContainer; +import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SyntaxKey; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedKey; +import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SyntaxKey; public final class BukkitContainer1_16_R1 extends WrappedContainer implements PersistentDataContainer { @@ -71,7 +71,7 @@ public Set getKeys() { @Override public PersistentDataAdapterContext getAdapterContext() { - return getContext(); + return getWrapContext(); } /* @@ -79,7 +79,7 @@ public PersistentDataAdapterContext getAdapterContext() { */ @Override - public BukkitContext1_16_R1 getContext() { + public BukkitContext1_16_R1 getWrapContext() { return new BukkitContext1_16_R1(container.getAdapterContext()); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/BukkitContext1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/BukkitContext1_16_R1.java index 84b1a68..a31341e 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/BukkitContext1_16_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/BukkitContext1_16_R1.java @@ -3,21 +3,21 @@ import org.bukkit.persistence.PersistentDataAdapterContext; import org.bukkit.persistence.PersistentDataContainer; -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.IDataContainer; +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterContext; +import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContext; -public final class BukkitContext1_16_R1 extends WrappedContext implements PersistentDataAdapterContext { +public final class BukkitContext1_16_R1 extends WrappedContext implements PersistentDataAdapterContext { - private final DataAdapterContext context; + private final IDataAdapterContext context; - public BukkitContext1_16_R1(DataAdapterContext context) { + public BukkitContext1_16_R1(IDataAdapterContext context) { this.context = context; } @Override - public DataAdapterContext getHandle() { + public IDataAdapterContext getHandle() { return context; } @@ -27,12 +27,12 @@ public PersistentDataContainer newPersistentDataContainer() { } @Override - public IDataContainer newDataContainer() { + public IDataContainer newContainer() { return context.newDataContainer(); } @Override - public BukkitContainer1_16_R1 newContainer() { + public BukkitContainer1_16_R1 newWrapContainer() { return new BukkitContainer1_16_R1(context.newDataContainer()); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/BukkitKey1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/BukkitKey1_16_R1.java index 084b1a9..cf8e934 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/BukkitKey1_16_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/BukkitKey1_16_R1.java @@ -3,7 +3,7 @@ import org.bukkit.NamespacedKey; import org.bukkit.plugin.Plugin; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedKey; public final class BukkitKey1_16_R1 extends WrappedKey { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/BukkitType1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/BukkitType1_16_R1.java index bd6856d..53b0a86 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/BukkitType1_16_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/BukkitType1_16_R1.java @@ -3,22 +3,22 @@ import org.bukkit.persistence.PersistentDataAdapterContext; import org.bukkit.persistence.PersistentDataType; -import com.syntaxphoenix.syntaxapi.data.DataType; +import net.sourcewriters.minecraft.vcompat.data.api.IDataType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContext; -public class BukkitType1_16_R1 extends WrappedType1_16_R1, P0, P1, C0, C1> +public class BukkitType1_16_R1 extends WrappedType1_16_R1, P0, P1, C0, C1> implements PersistentDataType { - private final DataType type; + private final IDataType type; - public BukkitType1_16_R1(DataType type) { + public BukkitType1_16_R1(IDataType type) { super(type.getPrimitive(), type.getComplex()); this.type = type; } @Override - public DataType getHandle() { + public IDataType getHandle() { return type; } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/SimpleBukkitType1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/SimpleBukkitType1_16_R1.java index db19aef..0e2fcf2 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/SimpleBukkitType1_16_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/SimpleBukkitType1_16_R1.java @@ -3,7 +3,7 @@ import org.bukkit.persistence.PersistentDataAdapterContext; import org.bukkit.persistence.PersistentDataType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; public class SimpleBukkitType1_16_R1 implements PersistentDataType { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/SyntaxContainer1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/SyntaxContainer1_16_R1.java index 86209f0..a17d742 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/SyntaxContainer1_16_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/SyntaxContainer1_16_R1.java @@ -5,15 +5,15 @@ import org.bukkit.persistence.PersistentDataContainer; -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.data.IDataContainer; -import com.syntaxphoenix.syntaxapi.utils.key.IKey; +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterContext; +import net.sourcewriters.minecraft.vcompat.data.api.IDataType; +import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.utils.key.IKey; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SyntaxKey; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedKey; +import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SyntaxKey; public final class SyntaxContainer1_16_R1 extends WrappedContainer implements IDataContainer { @@ -43,22 +43,22 @@ public boolean has(IKey key) { } @Override - public boolean has(String key, DataType type) { + public boolean has(String key, IDataType type) { return has(syntaxKey(key), type); } @Override - public boolean has(IKey key, DataType type) { + public boolean has(IKey key, IDataType type) { return has(new SyntaxKey(key), WrappedType1_16_R1.wrap(type)); } @Override - public C get(String key, DataType type) { + public C get(String key, IDataType type) { return get(syntaxKey(key), type); } @Override - public C get(IKey key, DataType type) { + public C get(IKey key, IDataType type) { return get(new SyntaxKey(key), WrappedType1_16_R1.wrap(type)); } @@ -73,12 +73,12 @@ public Object get(IKey key) { } @Override - public void set(String key, E value, DataType type) { + public void set(String key, E value, IDataType type) { set(wrappedKey(key), value, WrappedType1_16_R1.wrap(type)); } @Override - public void set(IKey key, E value, DataType type) { + public void set(IKey key, E value, IDataType type) { set(new SyntaxKey(key), value, WrappedType1_16_R1.wrap(type)); } @@ -103,8 +103,8 @@ public Set getKeyspaces() { } @Override - public DataAdapterContext getAdapterContext() { - return getContext(); + public IDataAdapterContext getContext() { + return getWrapContext(); } /* @@ -112,7 +112,7 @@ public DataAdapterContext getAdapterContext() { */ @Override - public SyntaxContext1_16_R1 getContext() { + public SyntaxContext1_16_R1 getWrapContext() { return new SyntaxContext1_16_R1(container.getAdapterContext()); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/SyntaxContext1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/SyntaxContext1_16_R1.java index 7eae0db..e0e13dc 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/SyntaxContext1_16_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/SyntaxContext1_16_R1.java @@ -3,9 +3,9 @@ import org.bukkit.persistence.PersistentDataAdapterContext; import org.bukkit.persistence.PersistentDataContainer; -import com.syntaxphoenix.syntaxapi.data.IDataContainer; +import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContext; public final class SyntaxContext1_16_R1 extends WrappedContext implements PersistentDataAdapterContext { @@ -26,12 +26,12 @@ public PersistentDataContainer newPersistentDataContainer() { } @Override - public IDataContainer newDataContainer() { + public IDataContainer newContainer() { return newContainer(); } @Override - public SyntaxContainer1_16_R1 newContainer() { + public SyntaxContainer1_16_R1 newWrapContainer() { return new SyntaxContainer1_16_R1(context.newPersistentDataContainer()); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/SyntaxType1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/SyntaxType1_16_R1.java index 2570a63..4f0fb07 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/SyntaxType1_16_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/SyntaxType1_16_R1.java @@ -3,13 +3,13 @@ import org.bukkit.persistence.PersistentDataAdapterContext; import org.bukkit.persistence.PersistentDataType; -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterContext; +import net.sourcewriters.minecraft.vcompat.data.api.IDataType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContext; public class SyntaxType1_16_R1 extends WrappedType1_16_R1, P0, P1, C0, C1> - implements DataType { + implements IDataType { private final PersistentDataType type; @@ -48,12 +48,12 @@ public Class getPrimitive() { } @Override - public P0 toPrimitive(DataAdapterContext context, C0 complex) { + public P0 toPrimitive(IDataAdapterContext context, C0 complex) { return wrapToPrimitive(complex, new BukkitContext1_16_R1(context)); } @Override - public C0 fromPrimitive(DataAdapterContext context, P0 primitive) { + public C0 fromPrimitive(IDataAdapterContext context, P0 primitive) { return wrapToComplex(primitive, new BukkitContext1_16_R1(context)); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/WrappedType1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/WrappedType1_16_R1.java index 243a20a..9c95f97 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/WrappedType1_16_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/WrappedType1_16_R1.java @@ -5,10 +5,10 @@ import org.bukkit.persistence.PersistentDataContainer; import org.bukkit.persistence.PersistentDataType; -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.data.IDataContainer; +import net.sourcewriters.minecraft.vcompat.data.api.IDataType; +import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; public abstract class WrappedType1_16_R1 implements WrapType { @@ -139,7 +139,7 @@ protected static int internalState(Class clazz) { return 0; } - public static BukkitType1_16_R1 wrap(DataType type) { + public static BukkitType1_16_R1 wrap(IDataType type) { return new BukkitType1_16_R1<>(type); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/hook/BukkitContainerAdapterHook1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/hook/BukkitContainerAdapterHook1_16_R1.java index 0216c76..d3b8929 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/hook/BukkitContainerAdapterHook1_16_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/hook/BukkitContainerAdapterHook1_16_R1.java @@ -10,17 +10,17 @@ import org.bukkit.craftbukkit.v1_16_R1.persistence.CraftPersistentDataTypeRegistry; import org.bukkit.persistence.PersistentDataContainer; -import com.syntaxphoenix.syntaxapi.data.IDataContainer; -import com.syntaxphoenix.syntaxapi.data.container.nbt.NbtContainer; -import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; +import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; +import net.sourcewriters.minecraft.vcompat.data.nbt.NbtContainer; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtCompound; + +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookup; import net.minecraft.server.v1_16_R1.NBTTagCompound; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1.data.BukkitContainer1_16_R1; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1.data.SyntaxContainer1_16_R1; -import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.provider.VersionControl; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContainer; @SuppressWarnings({ "rawtypes", @@ -30,11 +30,11 @@ public final class BukkitContainerAdapterHook1_16_R1 { private static final BukkitContainerAdapterHook1_16_R1 HOOK = new BukkitContainerAdapterHook1_16_R1(); - private final AbstractReflect registryRef = new Reflect(CraftPersistentDataTypeRegistry.class) + private final ClassLookup registryRef = ClassLookup.of(CraftPersistentDataTypeRegistry.class) .searchMethod("create", "createAdapter", Class.class, Class.class, Function.class, Function.class) .searchField("adapters", "adapters") .searchField("function", "CREATE_ADAPTER"); - private final AbstractReflect entityRef = new Reflect(CraftEntity.class).searchField("registry", "DATA_TYPE_REGISTRY"); + private final ClassLookup entityRef = ClassLookup.of(CraftEntity.class).searchField("registry", "DATA_TYPE_REGISTRY"); private BukkitContainerAdapterHook1_16_R1() {} @@ -46,7 +46,7 @@ private CraftPersistentDataTypeRegistry getEntityRegistry() { private void uninjectAll() { for (CraftPersistentDataTypeRegistry registry : map.keySet()) { - Map adapters = (Map) registryRef.getFieldValue("adapters", registry); + Map adapters = (Map) registryRef.getFieldValue(registry, "adapters"); adapters.remove(BukkitContainer1_16_R1.class); adapters.remove(SyntaxContainer1_16_R1.class); registryRef.setFieldValue(registry, "function", map.get(registry)); @@ -58,8 +58,8 @@ private void inject(CraftPersistentDataTypeRegistry registry) { if (map.containsKey(registry)) { return; } - map.put(registry, (Function) registryRef.getFieldValue("function", registry)); - Function function = clazz -> createAdapter(registry, registryRef.getMethod("create").getReturnType(), (Class) clazz); + map.put(registry, (Function) registryRef.getFieldValue(registry, "function")); + Function function = clazz -> createAdapter(registry, registryRef.getMethod("create").type().returnType(), (Class) clazz); registryRef.setFieldValue(registry, "function", function); } @@ -89,7 +89,7 @@ private NBTTagCompound toPrimitive(WrappedContainer input) { } if (handle instanceof IDataContainer) { if (handle instanceof NbtContainer) { - return (NBTTagCompound) VersionControl.get().getBukkitConversion().toMinecraftCompound(((NbtContainer) handle).asNbt()); + return (NBTTagCompound) VersionCompatProvider.get().getControl().getBukkitConversion().toMinecraftCompound(((NbtContainer) handle).asNbt()); } throw new IllegalArgumentException( "Expected 'CraftPersistentDataContainer' got '" + handle.getClass().getSimpleName() + " instead'!"); @@ -98,7 +98,7 @@ private NBTTagCompound toPrimitive(WrappedContainer input) { } private BukkitContainer1_16_R1 fromPrimitiveSyntax(NBTTagCompound data) { - VersionControl control = VersionControl.get(); + VersionControl control = VersionCompatProvider.get().getControl(); NbtContainer container = new NbtContainer(control.getDataProvider().getRegistry()); NbtCompound compound = control.getBukkitConversion().fromMinecraftCompound(data); container.fromNbt(compound); diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/entity/ArmorStand1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/entity/ArmorStand1_16_R1.java index c99f3bd..36a9ed5 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/entity/ArmorStand1_16_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/entity/ArmorStand1_16_R1.java @@ -3,7 +3,7 @@ import net.minecraft.server.v1_16_R1.EntityArmorStand; import net.minecraft.server.v1_16_R1.EntityTypes; import net.minecraft.server.v1_16_R1.World; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsArmorStand; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsArmorStand; public class ArmorStand1_16_R1 extends EntityLiving1_16_R1 implements NmsArmorStand { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/entity/Entity1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/entity/Entity1_16_R1.java index 8a8ba09..62159fa 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/entity/Entity1_16_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/entity/Entity1_16_R1.java @@ -20,8 +20,8 @@ import net.minecraft.server.v1_16_R1.PacketPlayOutSpawnEntity; import net.minecraft.server.v1_16_R1.PlayerConnection; import net.minecraft.server.v1_16_R1.Vec3D; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.utils.NmsBoundingBox; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.provider.utils.NmsBoundingBox; public abstract class Entity1_16_R1 implements NmsEntity { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/entity/EntityLiving1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/entity/EntityLiving1_16_R1.java index f165dee..0e00a74 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/entity/EntityLiving1_16_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/entity/EntityLiving1_16_R1.java @@ -1,7 +1,7 @@ package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1.entity; import net.minecraft.server.v1_16_R1.EntityLiving; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityLiving; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityLiving; public abstract class EntityLiving1_16_R1 extends Entity1_16_R1 implements NmsEntityLiving { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/entity/Player1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/entity/Player1_16_R1.java index 9f5634b..e6062f4 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/entity/Player1_16_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/entity/Player1_16_R1.java @@ -35,15 +35,15 @@ import net.minecraft.server.v1_16_R1.PacketPlayOutTitle; import net.minecraft.server.v1_16_R1.PacketPlayOutTitle.EnumTitleAction; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1.data.SyntaxContainer1_16_R1; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.type.SkinDataType; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; -import net.sourcewriters.minecraft.vcompat.utils.bukkit.Players; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.MojangProfileServer; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; -import net.sourcewriters.minecraft.vcompat.utils.thread.PostAsync; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.provider.data.type.SkinDataType; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookupProvider; +import net.sourcewriters.minecraft.vcompat.util.bukkit.Players; +import net.sourcewriters.minecraft.vcompat.util.minecraft.MojangProfileServer; +import net.sourcewriters.minecraft.vcompat.util.minecraft.Skin; +import net.sourcewriters.minecraft.vcompat.util.thread.PostAsync; import net.minecraft.server.v1_16_R1.PlayerConnection; import net.minecraft.server.v1_16_R1.WorldServer; @@ -283,7 +283,7 @@ private final void update(boolean flag) { String name = getName(); if (name != null) { - ReflectionProvider.DEFAULT.getReflect("mjGameProfile").setFieldValue(profile, "name", name); + VersionCompatProvider.get().getLookupProvider().getLookup("mjGameProfile").setFieldValue(profile, "name", name); } if (!(name == null && skin == null)) { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/tools/BlockTools1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/tools/BlockTools1_16_R1.java index 21312ca..012e4a7 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/tools/BlockTools1_16_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/tools/BlockTools1_16_R1.java @@ -5,23 +5,23 @@ import com.mojang.authlib.properties.Property; import com.mojang.authlib.properties.PropertyMap; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookup; import net.minecraft.server.v1_16_R1.TileEntitySkull; -import net.sourcewriters.minecraft.vcompat.reflection.tools.BlockTools; -import net.sourcewriters.minecraft.vcompat.utils.constants.MinecraftConstants; +import net.sourcewriters.minecraft.vcompat.provider.tools.BlockTools; +import net.sourcewriters.minecraft.vcompat.util.constants.MinecraftConstants; public class BlockTools1_16_R1 extends BlockTools { - private final AbstractReflect craftEntityStateRef = new Reflect(CraftSkull.class).searchField("tileEntity", "tileEntity"); + private final ClassLookup craftEntityStateRef = ClassLookup.of(CraftSkull.class).searchField("tileEntity", "tileEntity"); @Override public void setHeadTexture(Block block, String texture) { if (!(block instanceof CraftSkull)) { return; } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue(block, "tileEntity"); PropertyMap map = entitySkull.gameProfile.getProperties(); map.removeAll("textures"); map.put("textures", new Property("textures", MinecraftConstants.TEXTURE_SIGNATURE, texture)); @@ -32,7 +32,7 @@ public String getHeadTexture(Block block) { if (!(block instanceof CraftSkull)) { return null; } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue(block, "tileEntity"); return entitySkull.gameProfile.getProperties().get("textures").iterator().next().getValue(); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/tools/ServerTools1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/tools/ServerTools1_16_R1.java index b6310b4..4bfbe90 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/tools/ServerTools1_16_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/tools/ServerTools1_16_R1.java @@ -4,7 +4,7 @@ import org.bukkit.craftbukkit.v1_16_R1.CraftServer; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1.wrapper.ConsoleReaderWrapper1_16_R1; -import net.sourcewriters.minecraft.vcompat.reflection.tools.ServerTools; +import net.sourcewriters.minecraft.vcompat.provider.tools.ServerTools; public class ServerTools1_16_R1 extends ServerTools { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/tools/SkinTools1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/tools/SkinTools1_16_R1.java index 6806a72..a47e1fa 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/tools/SkinTools1_16_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/tools/SkinTools1_16_R1.java @@ -3,8 +3,8 @@ import org.bukkit.craftbukkit.v1_16_R1.entity.CraftPlayer; import org.bukkit.entity.Player; -import net.sourcewriters.minecraft.vcompat.reflection.tools.SkinTools; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; +import net.sourcewriters.minecraft.vcompat.provider.tools.SkinTools; +import net.sourcewriters.minecraft.vcompat.util.minecraft.Skin; public class SkinTools1_16_R1 extends SkinTools { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/wrapper/ConsoleReaderWrapper1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/wrapper/ConsoleReaderWrapper1_16_R1.java index f094d6f..faacf0f 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/wrapper/ConsoleReaderWrapper1_16_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/wrapper/ConsoleReaderWrapper1_16_R1.java @@ -7,7 +7,7 @@ import org.bukkit.craftbukkit.v1_16_R1.CraftServer; import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; -import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; +import net.sourcewriters.minecraft.vcompat.provider.wrapper.ConsoleReaderWrapper; public final class ConsoleReaderWrapper1_16_R1 extends ConsoleReaderWrapper { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/BukkitConversion1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/BukkitConversion1_16_R2.java index da31b66..920c01a 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/BukkitConversion1_16_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/BukkitConversion1_16_R2.java @@ -5,23 +5,23 @@ import org.bukkit.craftbukkit.v1_16_R2.inventory.CraftItemStack; import org.bukkit.entity.EntityType; -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.nbt.NbtByte; -import com.syntaxphoenix.syntaxapi.nbt.NbtByteArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; -import com.syntaxphoenix.syntaxapi.nbt.NbtDouble; -import com.syntaxphoenix.syntaxapi.nbt.NbtEnd; -import com.syntaxphoenix.syntaxapi.nbt.NbtFloat; -import com.syntaxphoenix.syntaxapi.nbt.NbtInt; -import com.syntaxphoenix.syntaxapi.nbt.NbtIntArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtList; -import com.syntaxphoenix.syntaxapi.nbt.NbtLong; -import com.syntaxphoenix.syntaxapi.nbt.NbtLongArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtShort; -import com.syntaxphoenix.syntaxapi.nbt.NbtString; -import com.syntaxphoenix.syntaxapi.nbt.NbtTag; -import com.syntaxphoenix.syntaxapi.nbt.NbtType; +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterContext; +import net.sourcewriters.minecraft.vcompat.data.api.IDataType; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtByte; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtByteArray; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtCompound; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtDouble; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtEnd; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtFloat; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtInt; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtIntArray; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtList; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtLong; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtLongArray; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtShort; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtString; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtTag; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtType; import net.minecraft.server.v1_16_R2.ItemStack; import net.minecraft.server.v1_16_R2.NBTBase; @@ -41,10 +41,10 @@ import net.minecraft.server.v1_16_R2.NBTTagString; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R2.data.BukkitContext1_16_R2; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R2.data.BukkitType1_16_R2; -import net.sourcewriters.minecraft.vcompat.reflection.BukkitConversion; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; +import net.sourcewriters.minecraft.vcompat.provider.BukkitConversion; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityType; public class BukkitConversion1_16_R2 extends BukkitConversion { @@ -206,12 +206,12 @@ public NbtCompound itemToCompound(org.bukkit.inventory.ItemStack itemStack) { } @Override - public WrappedContext createContext(DataAdapterContext context) { + public WrappedContext createContext(IDataAdapterContext context) { return new BukkitContext1_16_R2(context); } @Override - public WrapType wrap(DataType dataType) { + public WrapType wrap(IDataType dataType) { return new BukkitType1_16_R2<>(dataType); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/EntityProvider1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/EntityProvider1_16_R2.java index 63cc90d..01feb08 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/EntityProvider1_16_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/EntityProvider1_16_R2.java @@ -7,9 +7,9 @@ import net.minecraft.server.v1_16_R2.World; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R2.utils.EntityConstructors1_16_R2; -import net.sourcewriters.minecraft.vcompat.reflection.EntityProvider; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; +import net.sourcewriters.minecraft.vcompat.provider.EntityProvider; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityType; public class EntityProvider1_16_R2 extends EntityProvider { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/PacketHandler1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/PacketHandler1_16_R2.java index f4b391b..61094fc 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/PacketHandler1_16_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/PacketHandler1_16_R2.java @@ -1,6 +1,6 @@ package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R2; -import net.sourcewriters.minecraft.vcompat.reflection.PacketHandler; +import net.sourcewriters.minecraft.vcompat.provider.PacketHandler; public class PacketHandler1_16_R2 extends PacketHandler { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/PlayerProvider1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/PlayerProvider1_16_R2.java index 79f4b7f..10ec0b6 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/PlayerProvider1_16_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/PlayerProvider1_16_R2.java @@ -3,8 +3,8 @@ import org.bukkit.entity.Player; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R2.entity.Player1_16_R2; -import net.sourcewriters.minecraft.vcompat.reflection.PlayerProvider; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.provider.PlayerProvider; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsPlayer; public class PlayerProvider1_16_R2 extends PlayerProvider { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/TextureProvider1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/TextureProvider1_16_R2.java index 582110d..cc7d1dc 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/TextureProvider1_16_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/TextureProvider1_16_R2.java @@ -9,20 +9,20 @@ import org.bukkit.inventory.meta.SkullMeta; import com.mojang.authlib.GameProfile; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookup; import net.minecraft.server.v1_16_R2.GameProfileSerializer; import net.minecraft.server.v1_16_R2.ItemStack; import net.minecraft.server.v1_16_R2.NBTTagCompound; import net.minecraft.server.v1_16_R2.TileEntitySkull; -import net.sourcewriters.minecraft.vcompat.reflection.TextureProvider; +import net.sourcewriters.minecraft.vcompat.provider.TextureProvider; public class TextureProvider1_16_R2 extends TextureProvider { - private final AbstractReflect craftEntityStateRef = new Reflect(CraftBlockEntityState.class).searchField("tileEntity", "tileEntity"); - private final AbstractReflect craftItemStackRef = new Reflect(CraftItemStack.class).searchField("handle", "handle"); - private final AbstractReflect craftMetaSkullRef = new Reflect("org.bukkit.craftbukkit.v1_16_R2.inventory.CraftMetaSkull") + private final ClassLookup craftEntityStateRef = ClassLookup.of(CraftBlockEntityState.class).searchField("tileEntity", "tileEntity"); + private final ClassLookup craftItemStackRef = ClassLookup.of(CraftItemStack.class).searchField("handle", "handle"); + private final ClassLookup craftMetaSkullRef = ClassLookup.of("org.bukkit.craftbukkit.v1_16_R2.inventory.CraftMetaSkull") .searchField("serialized", "serializedProfile").searchField("profile", "profile"); protected TextureProvider1_16_R2(VersionControl1_16_R2 versionControl) { @@ -34,7 +34,7 @@ public GameProfile profileFromBlock(Block block) { if (!(block instanceof CraftSkull)) { return null; } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue(block, "tileEntity"); return entitySkull.gameProfile; } @@ -44,13 +44,13 @@ public GameProfile profileFromItem(org.bukkit.inventory.ItemStack itemStack) { return null; } SkullMeta meta = (SkullMeta) itemStack.getItemMeta(); - GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue("profile", meta); + GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue(meta, "profile"); if (profile == null) { - NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue("serialized", meta); + NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue(meta, "serialized"); if (compound == null) { ItemStack stack = null; if (itemStack instanceof CraftItemStack) { - stack = (ItemStack) craftItemStackRef.getFieldValue("handle", itemStack); + stack = (ItemStack) craftItemStackRef.getFieldValue(itemStack, "handle"); } if (stack == null) { stack = CraftItemStack.asNMSCopy(itemStack); @@ -94,7 +94,7 @@ public boolean applyBlock(Block block, GameProfile profile) { if (!(block instanceof CraftSkull)) { return false; } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue(block, "tileEntity"); entitySkull.setGameProfile(profile); return true; } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/ToolProvider1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/ToolProvider1_16_R2.java index 7aa7f00..e8969d9 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/ToolProvider1_16_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/ToolProvider1_16_R2.java @@ -3,7 +3,7 @@ import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R2.tools.BlockTools1_16_R2; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R2.tools.ServerTools1_16_R2; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R2.tools.SkinTools1_16_R2; -import net.sourcewriters.minecraft.vcompat.reflection.ToolProvider; +import net.sourcewriters.minecraft.vcompat.provider.ToolProvider; public class ToolProvider1_16_R2 extends ToolProvider { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/VersionControl1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/VersionControl1_16_R2.java index 743a183..f650aac 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/VersionControl1_16_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/VersionControl1_16_R2.java @@ -1,7 +1,7 @@ package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R2; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R2.data.hook.BukkitContainerAdapterHook1_16_R2; -import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; +import net.sourcewriters.minecraft.vcompat.provider.VersionControl; public class VersionControl1_16_R2 extends VersionControl { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/BukkitContainer1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/BukkitContainer1_16_R2.java index ffda4e9..d9cf9e2 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/BukkitContainer1_16_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/BukkitContainer1_16_R2.java @@ -10,12 +10,12 @@ import org.bukkit.persistence.PersistentDataContainer; import org.bukkit.persistence.PersistentDataType; -import com.syntaxphoenix.syntaxapi.data.IDataContainer; +import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SyntaxKey; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedKey; +import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SyntaxKey; public final class BukkitContainer1_16_R2 extends WrappedContainer implements PersistentDataContainer { @@ -71,7 +71,7 @@ public Set getKeys() { @Override public PersistentDataAdapterContext getAdapterContext() { - return getContext(); + return getWrapContext(); } /* @@ -79,7 +79,7 @@ public PersistentDataAdapterContext getAdapterContext() { */ @Override - public BukkitContext1_16_R2 getContext() { + public BukkitContext1_16_R2 getWrapContext() { return new BukkitContext1_16_R2(container.getAdapterContext()); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/BukkitContext1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/BukkitContext1_16_R2.java index 323f1f8..080f254 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/BukkitContext1_16_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/BukkitContext1_16_R2.java @@ -3,21 +3,21 @@ import org.bukkit.persistence.PersistentDataAdapterContext; import org.bukkit.persistence.PersistentDataContainer; -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.IDataContainer; +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterContext; +import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContext; -public final class BukkitContext1_16_R2 extends WrappedContext implements PersistentDataAdapterContext { +public final class BukkitContext1_16_R2 extends WrappedContext implements PersistentDataAdapterContext { - private final DataAdapterContext context; + private final IDataAdapterContext context; - public BukkitContext1_16_R2(DataAdapterContext context) { + public BukkitContext1_16_R2(IDataAdapterContext context) { this.context = context; } @Override - public DataAdapterContext getHandle() { + public IDataAdapterContext getHandle() { return context; } @@ -27,12 +27,12 @@ public PersistentDataContainer newPersistentDataContainer() { } @Override - public IDataContainer newDataContainer() { + public IDataContainer newContainer() { return context.newDataContainer(); } @Override - public BukkitContainer1_16_R2 newContainer() { + public BukkitContainer1_16_R2 newWrapContainer() { return new BukkitContainer1_16_R2(context.newDataContainer()); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/BukkitKey1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/BukkitKey1_16_R2.java index 806f2ce..ff8a9a4 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/BukkitKey1_16_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/BukkitKey1_16_R2.java @@ -3,7 +3,7 @@ import org.bukkit.NamespacedKey; import org.bukkit.plugin.Plugin; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedKey; public final class BukkitKey1_16_R2 extends WrappedKey { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/BukkitType1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/BukkitType1_16_R2.java index 7700ff7..2a4ddff 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/BukkitType1_16_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/BukkitType1_16_R2.java @@ -3,22 +3,22 @@ import org.bukkit.persistence.PersistentDataAdapterContext; import org.bukkit.persistence.PersistentDataType; -import com.syntaxphoenix.syntaxapi.data.DataType; +import net.sourcewriters.minecraft.vcompat.data.api.IDataType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContext; -public class BukkitType1_16_R2 extends WrappedType1_16_R2, P0, P1, C0, C1> +public class BukkitType1_16_R2 extends WrappedType1_16_R2, P0, P1, C0, C1> implements PersistentDataType { - private final DataType type; + private final IDataType type; - public BukkitType1_16_R2(DataType type) { + public BukkitType1_16_R2(IDataType type) { super(type.getPrimitive(), type.getComplex()); this.type = type; } @Override - public DataType getHandle() { + public IDataType getHandle() { return type; } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/SimpleBukkitType1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/SimpleBukkitType1_16_R2.java index 3baafb0..e970778 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/SimpleBukkitType1_16_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/SimpleBukkitType1_16_R2.java @@ -3,7 +3,7 @@ import org.bukkit.persistence.PersistentDataAdapterContext; import org.bukkit.persistence.PersistentDataType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; public class SimpleBukkitType1_16_R2 implements PersistentDataType { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/SyntaxContainer1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/SyntaxContainer1_16_R2.java index 75ce56b..5a9151d 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/SyntaxContainer1_16_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/SyntaxContainer1_16_R2.java @@ -5,15 +5,15 @@ import org.bukkit.persistence.PersistentDataContainer; -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.data.IDataContainer; -import com.syntaxphoenix.syntaxapi.utils.key.IKey; +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterContext; +import net.sourcewriters.minecraft.vcompat.data.api.IDataType; +import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.utils.key.IKey; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SyntaxKey; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedKey; +import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SyntaxKey; public final class SyntaxContainer1_16_R2 extends WrappedContainer implements IDataContainer { @@ -43,22 +43,22 @@ public boolean has(IKey key) { } @Override - public boolean has(String key, DataType type) { + public boolean has(String key, IDataType type) { return has(syntaxKey(key), type); } @Override - public boolean has(IKey key, DataType type) { + public boolean has(IKey key, IDataType type) { return has(new SyntaxKey(key), WrappedType1_16_R2.wrap(type)); } @Override - public C get(String key, DataType type) { + public C get(String key, IDataType type) { return get(syntaxKey(key), type); } @Override - public C get(IKey key, DataType type) { + public C get(IKey key, IDataType type) { return get(new SyntaxKey(key), WrappedType1_16_R2.wrap(type)); } @@ -73,12 +73,12 @@ public Object get(IKey key) { } @Override - public void set(String key, E value, DataType type) { + public void set(String key, E value, IDataType type) { set(wrappedKey(key), value, WrappedType1_16_R2.wrap(type)); } @Override - public void set(IKey key, E value, DataType type) { + public void set(IKey key, E value, IDataType type) { set(new SyntaxKey(key), value, WrappedType1_16_R2.wrap(type)); } @@ -103,8 +103,8 @@ public Set getKeyspaces() { } @Override - public DataAdapterContext getAdapterContext() { - return getContext(); + public IDataAdapterContext getContext() { + return getWrapContext(); } /* @@ -112,7 +112,7 @@ public DataAdapterContext getAdapterContext() { */ @Override - public SyntaxContext1_16_R2 getContext() { + public SyntaxContext1_16_R2 getWrapContext() { return new SyntaxContext1_16_R2(container.getAdapterContext()); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/SyntaxContext1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/SyntaxContext1_16_R2.java index 3bfc64d..a5f00ff 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/SyntaxContext1_16_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/SyntaxContext1_16_R2.java @@ -3,9 +3,9 @@ import org.bukkit.persistence.PersistentDataAdapterContext; import org.bukkit.persistence.PersistentDataContainer; -import com.syntaxphoenix.syntaxapi.data.IDataContainer; +import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContext; public final class SyntaxContext1_16_R2 extends WrappedContext implements PersistentDataAdapterContext { @@ -26,12 +26,12 @@ public PersistentDataContainer newPersistentDataContainer() { } @Override - public IDataContainer newDataContainer() { + public IDataContainer newContainer() { return newContainer(); } @Override - public SyntaxContainer1_16_R2 newContainer() { + public SyntaxContainer1_16_R2 newWrapContainer() { return new SyntaxContainer1_16_R2(context.newPersistentDataContainer()); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/SyntaxType1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/SyntaxType1_16_R2.java index 0bb9d44..898c6b9 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/SyntaxType1_16_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/SyntaxType1_16_R2.java @@ -3,13 +3,13 @@ import org.bukkit.persistence.PersistentDataAdapterContext; import org.bukkit.persistence.PersistentDataType; -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterContext; +import net.sourcewriters.minecraft.vcompat.data.api.IDataType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContext; public class SyntaxType1_16_R2 extends WrappedType1_16_R2, P0, P1, C0, C1> - implements DataType { + implements IDataType { private final PersistentDataType type; @@ -48,12 +48,12 @@ public Class getPrimitive() { } @Override - public P0 toPrimitive(DataAdapterContext context, C0 complex) { + public P0 toPrimitive(IDataAdapterContext context, C0 complex) { return wrapToPrimitive(complex, new BukkitContext1_16_R2(context)); } @Override - public C0 fromPrimitive(DataAdapterContext context, P0 primitive) { + public C0 fromPrimitive(IDataAdapterContext context, P0 primitive) { return wrapToComplex(primitive, new BukkitContext1_16_R2(context)); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/WrappedType1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/WrappedType1_16_R2.java index f29b6b4..68b3ceb 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/WrappedType1_16_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/WrappedType1_16_R2.java @@ -5,10 +5,10 @@ import org.bukkit.persistence.PersistentDataContainer; import org.bukkit.persistence.PersistentDataType; -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.data.IDataContainer; +import net.sourcewriters.minecraft.vcompat.data.api.IDataType; +import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; public abstract class WrappedType1_16_R2 implements WrapType { @@ -139,7 +139,7 @@ protected static int internalState(Class clazz) { return 0; } - public static BukkitType1_16_R2 wrap(DataType type) { + public static BukkitType1_16_R2 wrap(IDataType type) { return new BukkitType1_16_R2<>(type); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/hook/BukkitContainerAdapterHook1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/hook/BukkitContainerAdapterHook1_16_R2.java index 3601b91..1e320cb 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/hook/BukkitContainerAdapterHook1_16_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/hook/BukkitContainerAdapterHook1_16_R2.java @@ -10,17 +10,18 @@ import org.bukkit.craftbukkit.v1_16_R2.persistence.CraftPersistentDataTypeRegistry; import org.bukkit.persistence.PersistentDataContainer; -import com.syntaxphoenix.syntaxapi.data.IDataContainer; -import com.syntaxphoenix.syntaxapi.data.container.nbt.NbtContainer; -import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; +import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; +import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; +import net.sourcewriters.minecraft.vcompat.data.nbt.NbtContainer; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtCompound; + +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookup; import net.minecraft.server.v1_16_R2.NBTTagCompound; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R2.data.BukkitContainer1_16_R2; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R2.data.SyntaxContainer1_16_R2; -import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.provider.VersionControl; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContainer; @SuppressWarnings({ "rawtypes", @@ -30,11 +31,11 @@ public final class BukkitContainerAdapterHook1_16_R2 { private static final BukkitContainerAdapterHook1_16_R2 HOOK = new BukkitContainerAdapterHook1_16_R2(); - private final AbstractReflect registryRef = new Reflect(CraftPersistentDataTypeRegistry.class) + private final ClassLookup registryRef = ClassLookup.of(CraftPersistentDataTypeRegistry.class) .searchMethod("create", "createAdapter", Class.class, Class.class, Function.class, Function.class) .searchField("adapters", "adapters") .searchField("function", "CREATE_ADAPTER"); - private final AbstractReflect entityRef = new Reflect(CraftEntity.class).searchField("registry", "DATA_TYPE_REGISTRY"); + private final ClassLookup entityRef = ClassLookup.of(CraftEntity.class).searchField("registry", "DATA_TYPE_REGISTRY"); private BukkitContainerAdapterHook1_16_R2() {} @@ -46,7 +47,7 @@ private CraftPersistentDataTypeRegistry getEntityRegistry() { private void uninjectAll() { for (CraftPersistentDataTypeRegistry registry : map.keySet()) { - Map adapters = (Map) registryRef.getFieldValue("adapters", registry); + Map adapters = (Map) registryRef.getFieldValue(registry, "adapters"); adapters.remove(BukkitContainer1_16_R2.class); adapters.remove(SyntaxContainer1_16_R2.class); registryRef.setFieldValue(registry, "function", map.get(registry)); @@ -58,8 +59,8 @@ private void inject(CraftPersistentDataTypeRegistry registry) { if (map.containsKey(registry)) { return; } - map.put(registry, (Function) registryRef.getFieldValue("function", registry)); - Function function = clazz -> createAdapter(registry, registryRef.getMethod("create").getReturnType(), (Class) clazz); + map.put(registry, (Function) registryRef.getFieldValue(registry, "function")); + Function function = clazz -> createAdapter(registry, registryRef.getMethod("create").type().returnType(), (Class) clazz); registryRef.setFieldValue(registry, "function", function); } @@ -89,7 +90,7 @@ private NBTTagCompound toPrimitive(WrappedContainer input) { } if (handle instanceof IDataContainer) { if (handle instanceof NbtContainer) { - return (NBTTagCompound) VersionControl.get().getBukkitConversion().toMinecraftCompound(((NbtContainer) handle).asNbt()); + return (NBTTagCompound) VersionCompatProvider.get().getControl().getBukkitConversion().toMinecraftCompound(((NbtContainer) handle).asNbt()); } throw new IllegalArgumentException( "Expected 'CraftPersistentDataContainer' got '" + handle.getClass().getSimpleName() + " instead'!"); @@ -98,7 +99,7 @@ private NBTTagCompound toPrimitive(WrappedContainer input) { } private BukkitContainer1_16_R2 fromPrimitiveSyntax(NBTTagCompound data) { - VersionControl control = VersionControl.get(); + VersionControl control = VersionCompatProvider.get().getControl(); NbtContainer container = new NbtContainer(control.getDataProvider().getRegistry()); NbtCompound compound = control.getBukkitConversion().fromMinecraftCompound(data); container.fromNbt(compound); diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/entity/ArmorStand1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/entity/ArmorStand1_16_R2.java index 6652206..42635fc 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/entity/ArmorStand1_16_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/entity/ArmorStand1_16_R2.java @@ -3,7 +3,7 @@ import net.minecraft.server.v1_16_R2.EntityArmorStand; import net.minecraft.server.v1_16_R2.EntityTypes; import net.minecraft.server.v1_16_R2.World; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsArmorStand; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsArmorStand; public class ArmorStand1_16_R2 extends EntityLiving1_16_R2 implements NmsArmorStand { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/entity/Entity1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/entity/Entity1_16_R2.java index 565b029..241386e 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/entity/Entity1_16_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/entity/Entity1_16_R2.java @@ -20,8 +20,8 @@ import net.minecraft.server.v1_16_R2.PacketPlayOutSpawnEntity; import net.minecraft.server.v1_16_R2.PlayerConnection; import net.minecraft.server.v1_16_R2.Vec3D; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.utils.NmsBoundingBox; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.provider.utils.NmsBoundingBox; public abstract class Entity1_16_R2 implements NmsEntity { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/entity/EntityLiving1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/entity/EntityLiving1_16_R2.java index 3d5f130..1ffa94a 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/entity/EntityLiving1_16_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/entity/EntityLiving1_16_R2.java @@ -1,7 +1,7 @@ package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R2.entity; import net.minecraft.server.v1_16_R2.EntityLiving; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityLiving; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityLiving; public abstract class EntityLiving1_16_R2 extends Entity1_16_R2 implements NmsEntityLiving { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/entity/Player1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/entity/Player1_16_R2.java index fe4634b..03a043d 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/entity/Player1_16_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/entity/Player1_16_R2.java @@ -35,15 +35,16 @@ import net.minecraft.server.v1_16_R2.PacketPlayOutTitle; import net.minecraft.server.v1_16_R2.PacketPlayOutTitle.EnumTitleAction; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R2.data.SyntaxContainer1_16_R2; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.type.SkinDataType; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; -import net.sourcewriters.minecraft.vcompat.utils.bukkit.Players; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.MojangProfileServer; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; -import net.sourcewriters.minecraft.vcompat.utils.thread.PostAsync; +import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.provider.data.type.SkinDataType; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookupProvider; +import net.sourcewriters.minecraft.vcompat.util.bukkit.Players; +import net.sourcewriters.minecraft.vcompat.util.minecraft.MojangProfileServer; +import net.sourcewriters.minecraft.vcompat.util.minecraft.Skin; +import net.sourcewriters.minecraft.vcompat.util.thread.PostAsync; import net.minecraft.server.v1_16_R2.PlayerConnection; import net.minecraft.server.v1_16_R2.WorldServer; @@ -283,7 +284,7 @@ private final void update(boolean flag) { String name = getName(); if (name != null) { - ReflectionProvider.DEFAULT.getReflect("mjGameProfile").setFieldValue(profile, "name", name); + VersionCompatProvider.get().getLookupProvider().getLookup("mjGameProfile").setFieldValue(profile, "name", name); } if (!(name == null && skin == null)) { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/tools/BlockTools1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/tools/BlockTools1_16_R2.java index 1472353..3804321 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/tools/BlockTools1_16_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/tools/BlockTools1_16_R2.java @@ -5,23 +5,23 @@ import com.mojang.authlib.properties.Property; import com.mojang.authlib.properties.PropertyMap; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookup; import net.minecraft.server.v1_16_R2.TileEntitySkull; -import net.sourcewriters.minecraft.vcompat.reflection.tools.BlockTools; -import net.sourcewriters.minecraft.vcompat.utils.constants.MinecraftConstants; +import net.sourcewriters.minecraft.vcompat.provider.tools.BlockTools; +import net.sourcewriters.minecraft.vcompat.util.constants.MinecraftConstants; public class BlockTools1_16_R2 extends BlockTools { - private final AbstractReflect craftEntityStateRef = new Reflect(CraftSkull.class).searchField("tileEntity", "tileEntity"); + private final ClassLookup craftEntityStateRef = ClassLookup.of(CraftSkull.class).searchField("tileEntity", "tileEntity"); @Override public void setHeadTexture(Block block, String texture) { if (!(block instanceof CraftSkull)) { return; } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue(block, "tileEntity"); PropertyMap map = entitySkull.gameProfile.getProperties(); map.removeAll("textures"); map.put("textures", new Property("textures", MinecraftConstants.TEXTURE_SIGNATURE, texture)); @@ -32,7 +32,7 @@ public String getHeadTexture(Block block) { if (!(block instanceof CraftSkull)) { return null; } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue(block, "tileEntity"); return entitySkull.gameProfile.getProperties().get("textures").iterator().next().getValue(); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/tools/ServerTools1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/tools/ServerTools1_16_R2.java index 1ce968a..6a9f284 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/tools/ServerTools1_16_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/tools/ServerTools1_16_R2.java @@ -4,7 +4,7 @@ import org.bukkit.craftbukkit.v1_16_R2.CraftServer; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R2.wrapper.ConsoleReaderWrapper1_16_R2; -import net.sourcewriters.minecraft.vcompat.reflection.tools.ServerTools; +import net.sourcewriters.minecraft.vcompat.provider.tools.ServerTools; public class ServerTools1_16_R2 extends ServerTools { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/tools/SkinTools1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/tools/SkinTools1_16_R2.java index 61217bc..003ab81 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/tools/SkinTools1_16_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/tools/SkinTools1_16_R2.java @@ -3,8 +3,8 @@ import org.bukkit.craftbukkit.v1_16_R2.entity.CraftPlayer; import org.bukkit.entity.Player; -import net.sourcewriters.minecraft.vcompat.reflection.tools.SkinTools; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; +import net.sourcewriters.minecraft.vcompat.provider.tools.SkinTools; +import net.sourcewriters.minecraft.vcompat.util.minecraft.Skin; public class SkinTools1_16_R2 extends SkinTools { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/wrapper/ConsoleReaderWrapper1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/wrapper/ConsoleReaderWrapper1_16_R2.java index c4429b4..c0fe714 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/wrapper/ConsoleReaderWrapper1_16_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/wrapper/ConsoleReaderWrapper1_16_R2.java @@ -7,7 +7,7 @@ import org.bukkit.craftbukkit.v1_16_R2.CraftServer; import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; -import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; +import net.sourcewriters.minecraft.vcompat.provider.wrapper.ConsoleReaderWrapper; public final class ConsoleReaderWrapper1_16_R2 extends ConsoleReaderWrapper { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/BukkitConversion1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/BukkitConversion1_16_R3.java index 0ea13e6..d07346f 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/BukkitConversion1_16_R3.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/BukkitConversion1_16_R3.java @@ -5,23 +5,23 @@ import org.bukkit.craftbukkit.v1_16_R3.inventory.CraftItemStack; import org.bukkit.entity.EntityType; -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.nbt.NbtByte; -import com.syntaxphoenix.syntaxapi.nbt.NbtByteArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; -import com.syntaxphoenix.syntaxapi.nbt.NbtDouble; -import com.syntaxphoenix.syntaxapi.nbt.NbtEnd; -import com.syntaxphoenix.syntaxapi.nbt.NbtFloat; -import com.syntaxphoenix.syntaxapi.nbt.NbtInt; -import com.syntaxphoenix.syntaxapi.nbt.NbtIntArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtList; -import com.syntaxphoenix.syntaxapi.nbt.NbtLong; -import com.syntaxphoenix.syntaxapi.nbt.NbtLongArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtShort; -import com.syntaxphoenix.syntaxapi.nbt.NbtString; -import com.syntaxphoenix.syntaxapi.nbt.NbtTag; -import com.syntaxphoenix.syntaxapi.nbt.NbtType; +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterContext; +import net.sourcewriters.minecraft.vcompat.data.api.IDataType; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtByte; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtByteArray; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtCompound; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtDouble; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtEnd; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtFloat; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtInt; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtIntArray; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtList; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtLong; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtLongArray; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtShort; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtString; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtTag; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtType; import net.minecraft.server.v1_16_R3.ItemStack; import net.minecraft.server.v1_16_R3.NBTBase; @@ -41,10 +41,10 @@ import net.minecraft.server.v1_16_R3.NBTTagString; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3.data.BukkitContext1_16_R3; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3.data.BukkitType1_16_R3; -import net.sourcewriters.minecraft.vcompat.reflection.BukkitConversion; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; +import net.sourcewriters.minecraft.vcompat.provider.BukkitConversion; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityType; public class BukkitConversion1_16_R3 extends BukkitConversion { @@ -206,12 +206,12 @@ public NbtCompound itemToCompound(org.bukkit.inventory.ItemStack itemStack) { } @Override - public WrappedContext createContext(DataAdapterContext context) { + public WrappedContext createContext(IDataAdapterContext context) { return new BukkitContext1_16_R3(context); } @Override - public WrapType wrap(DataType dataType) { + public WrapType wrap(IDataType dataType) { return new BukkitType1_16_R3<>(dataType); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/EntityProvider1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/EntityProvider1_16_R3.java index bf7207b..bdbcdc3 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/EntityProvider1_16_R3.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/EntityProvider1_16_R3.java @@ -7,9 +7,9 @@ import net.minecraft.server.v1_16_R3.World; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3.utils.EntityConstructors1_16_R3; -import net.sourcewriters.minecraft.vcompat.reflection.EntityProvider; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; +import net.sourcewriters.minecraft.vcompat.provider.EntityProvider; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityType; public class EntityProvider1_16_R3 extends EntityProvider { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/PacketHandler1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/PacketHandler1_16_R3.java index 082b1f5..088ef97 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/PacketHandler1_16_R3.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/PacketHandler1_16_R3.java @@ -1,6 +1,6 @@ package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3; -import net.sourcewriters.minecraft.vcompat.reflection.PacketHandler; +import net.sourcewriters.minecraft.vcompat.provider.PacketHandler; public class PacketHandler1_16_R3 extends PacketHandler { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/PlayerProvider1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/PlayerProvider1_16_R3.java index 37f73ad..95cf279 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/PlayerProvider1_16_R3.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/PlayerProvider1_16_R3.java @@ -3,8 +3,8 @@ import org.bukkit.entity.Player; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3.entity.Player1_16_R3; -import net.sourcewriters.minecraft.vcompat.reflection.PlayerProvider; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.provider.PlayerProvider; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsPlayer; public class PlayerProvider1_16_R3 extends PlayerProvider { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/TextureProvider1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/TextureProvider1_16_R3.java index 701d733..4a2f7a7 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/TextureProvider1_16_R3.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/TextureProvider1_16_R3.java @@ -9,20 +9,20 @@ import org.bukkit.inventory.meta.SkullMeta; import com.mojang.authlib.GameProfile; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookup; import net.minecraft.server.v1_16_R3.GameProfileSerializer; import net.minecraft.server.v1_16_R3.ItemStack; import net.minecraft.server.v1_16_R3.NBTTagCompound; import net.minecraft.server.v1_16_R3.TileEntitySkull; -import net.sourcewriters.minecraft.vcompat.reflection.TextureProvider; +import net.sourcewriters.minecraft.vcompat.provider.TextureProvider; public class TextureProvider1_16_R3 extends TextureProvider { - private final AbstractReflect craftEntityStateRef = new Reflect(CraftBlockEntityState.class).searchField("tileEntity", "tileEntity"); - private final AbstractReflect craftItemStackRef = new Reflect(CraftItemStack.class).searchField("handle", "handle"); - private final AbstractReflect craftMetaSkullRef = new Reflect("org.bukkit.craftbukkit.v1_16_R3.inventory.CraftMetaSkull") + private final ClassLookup craftEntityStateRef = ClassLookup.of(CraftBlockEntityState.class).searchField("tileEntity", "tileEntity"); + private final ClassLookup craftItemStackRef = ClassLookup.of(CraftItemStack.class).searchField("handle", "handle"); + private final ClassLookup craftMetaSkullRef = ClassLookup.of("org.bukkit.craftbukkit.v1_16_R3.inventory.CraftMetaSkull") .searchField("serialized", "serializedProfile").searchField("profile", "profile"); protected TextureProvider1_16_R3(VersionControl1_16_R3 versionControl) { @@ -34,7 +34,7 @@ public GameProfile profileFromBlock(Block block) { if (!(block instanceof CraftSkull)) { return null; } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue(block, "tileEntity"); return entitySkull.gameProfile; } @@ -44,13 +44,13 @@ public GameProfile profileFromItem(org.bukkit.inventory.ItemStack itemStack) { return null; } SkullMeta meta = (SkullMeta) itemStack.getItemMeta(); - GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue("profile", meta); + GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue(meta, "profile"); if (profile == null) { - NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue("serialized", meta); + NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue(meta, "serialized"); if (compound == null) { ItemStack stack = null; if (itemStack instanceof CraftItemStack) { - stack = (ItemStack) craftItemStackRef.getFieldValue("handle", itemStack); + stack = (ItemStack) craftItemStackRef.getFieldValue(itemStack, "handle"); } if (stack == null) { stack = CraftItemStack.asNMSCopy(itemStack); @@ -94,7 +94,7 @@ public boolean applyBlock(Block block, GameProfile profile) { if (!(block instanceof CraftSkull)) { return false; } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue(block, "tileEntity"); entitySkull.setGameProfile(profile); return true; } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/ToolProvider1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/ToolProvider1_16_R3.java index 939c183..2e9b1a8 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/ToolProvider1_16_R3.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/ToolProvider1_16_R3.java @@ -3,7 +3,7 @@ import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3.tools.BlockTools1_16_R3; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3.tools.ServerTools1_16_R3; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3.tools.SkinTools1_16_R3; -import net.sourcewriters.minecraft.vcompat.reflection.ToolProvider; +import net.sourcewriters.minecraft.vcompat.provider.ToolProvider; public class ToolProvider1_16_R3 extends ToolProvider { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/VersionControl1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/VersionControl1_16_R3.java index 2b83a7a..6aad43e 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/VersionControl1_16_R3.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/VersionControl1_16_R3.java @@ -1,7 +1,7 @@ package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3.data.hook.BukkitContainerAdapterHook1_16_R3; -import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; +import net.sourcewriters.minecraft.vcompat.provider.VersionControl; public class VersionControl1_16_R3 extends VersionControl { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/BukkitContainer1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/BukkitContainer1_16_R3.java index 30d0cb1..b43648f 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/BukkitContainer1_16_R3.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/BukkitContainer1_16_R3.java @@ -10,12 +10,12 @@ import org.bukkit.persistence.PersistentDataContainer; import org.bukkit.persistence.PersistentDataType; -import com.syntaxphoenix.syntaxapi.data.IDataContainer; +import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SyntaxKey; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedKey; +import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SyntaxKey; public final class BukkitContainer1_16_R3 extends WrappedContainer implements PersistentDataContainer { @@ -71,7 +71,7 @@ public Set getKeys() { @Override public PersistentDataAdapterContext getAdapterContext() { - return getContext(); + return getWrapContext(); } /* @@ -79,7 +79,7 @@ public PersistentDataAdapterContext getAdapterContext() { */ @Override - public BukkitContext1_16_R3 getContext() { + public BukkitContext1_16_R3 getWrapContext() { return new BukkitContext1_16_R3(container.getAdapterContext()); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/BukkitContext1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/BukkitContext1_16_R3.java index a5f6a97..2c529fb 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/BukkitContext1_16_R3.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/BukkitContext1_16_R3.java @@ -3,21 +3,21 @@ import org.bukkit.persistence.PersistentDataAdapterContext; import org.bukkit.persistence.PersistentDataContainer; -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.IDataContainer; +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterContext; +import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContext; -public final class BukkitContext1_16_R3 extends WrappedContext implements PersistentDataAdapterContext { +public final class BukkitContext1_16_R3 extends WrappedContext implements PersistentDataAdapterContext { - private final DataAdapterContext context; + private final IDataAdapterContext context; - public BukkitContext1_16_R3(DataAdapterContext context) { + public BukkitContext1_16_R3(IDataAdapterContext context) { this.context = context; } @Override - public DataAdapterContext getHandle() { + public IDataAdapterContext getHandle() { return context; } @@ -27,12 +27,12 @@ public PersistentDataContainer newPersistentDataContainer() { } @Override - public IDataContainer newDataContainer() { + public IDataContainer newContainer() { return context.newDataContainer(); } @Override - public BukkitContainer1_16_R3 newContainer() { + public BukkitContainer1_16_R3 newWrapContainer() { return new BukkitContainer1_16_R3(context.newDataContainer()); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/BukkitKey1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/BukkitKey1_16_R3.java index 4a26bf7..be4dcc2 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/BukkitKey1_16_R3.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/BukkitKey1_16_R3.java @@ -3,7 +3,7 @@ import org.bukkit.NamespacedKey; import org.bukkit.plugin.Plugin; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedKey; public final class BukkitKey1_16_R3 extends WrappedKey { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/BukkitType1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/BukkitType1_16_R3.java index e0030d2..9bd3f77 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/BukkitType1_16_R3.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/BukkitType1_16_R3.java @@ -3,22 +3,22 @@ import org.bukkit.persistence.PersistentDataAdapterContext; import org.bukkit.persistence.PersistentDataType; -import com.syntaxphoenix.syntaxapi.data.DataType; +import net.sourcewriters.minecraft.vcompat.data.api.IDataType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContext; -public class BukkitType1_16_R3 extends WrappedType1_16_R3, P0, P1, C0, C1> +public class BukkitType1_16_R3 extends WrappedType1_16_R3, P0, P1, C0, C1> implements PersistentDataType { - private final DataType type; + private final IDataType type; - public BukkitType1_16_R3(DataType type) { + public BukkitType1_16_R3(IDataType type) { super(type.getPrimitive(), type.getComplex()); this.type = type; } @Override - public DataType getHandle() { + public IDataType getHandle() { return type; } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/SimpleBukkitType1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/SimpleBukkitType1_16_R3.java index f717fc5..fd48aac 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/SimpleBukkitType1_16_R3.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/SimpleBukkitType1_16_R3.java @@ -3,7 +3,7 @@ import org.bukkit.persistence.PersistentDataAdapterContext; import org.bukkit.persistence.PersistentDataType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; public class SimpleBukkitType1_16_R3 implements PersistentDataType { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/SyntaxContainer1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/SyntaxContainer1_16_R3.java index b7686e1..d9e7437 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/SyntaxContainer1_16_R3.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/SyntaxContainer1_16_R3.java @@ -5,15 +5,15 @@ import org.bukkit.persistence.PersistentDataContainer; -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.data.IDataContainer; -import com.syntaxphoenix.syntaxapi.utils.key.IKey; +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterContext; +import net.sourcewriters.minecraft.vcompat.data.api.IDataType; +import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.utils.key.IKey; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedKey; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SyntaxKey; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedKey; +import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SyntaxKey; public final class SyntaxContainer1_16_R3 extends WrappedContainer implements IDataContainer { @@ -43,22 +43,22 @@ public boolean has(IKey key) { } @Override - public boolean has(String key, DataType type) { + public boolean has(String key, IDataType type) { return has(syntaxKey(key), type); } @Override - public boolean has(IKey key, DataType type) { + public boolean has(IKey key, IDataType type) { return has(new SyntaxKey(key), WrappedType1_16_R3.wrap(type)); } @Override - public C get(String key, DataType type) { + public C get(String key, IDataType type) { return get(syntaxKey(key), type); } @Override - public C get(IKey key, DataType type) { + public C get(IKey key, IDataType type) { return get(new SyntaxKey(key), WrappedType1_16_R3.wrap(type)); } @@ -73,12 +73,12 @@ public Object get(IKey key) { } @Override - public void set(String key, E value, DataType type) { + public void set(String key, E value, IDataType type) { set(wrappedKey(key), value, WrappedType1_16_R3.wrap(type)); } @Override - public void set(IKey key, E value, DataType type) { + public void set(IKey key, E value, IDataType type) { set(new SyntaxKey(key), value, WrappedType1_16_R3.wrap(type)); } @@ -103,8 +103,8 @@ public Set getKeyspaces() { } @Override - public DataAdapterContext getAdapterContext() { - return getContext(); + public IDataAdapterContext getContext() { + return getWrapContext(); } /* @@ -112,7 +112,7 @@ public DataAdapterContext getAdapterContext() { */ @Override - public SyntaxContext1_16_R3 getContext() { + public SyntaxContext1_16_R3 getWrapContext() { return new SyntaxContext1_16_R3(container.getAdapterContext()); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/SyntaxContext1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/SyntaxContext1_16_R3.java index c336960..a75b06d 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/SyntaxContext1_16_R3.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/SyntaxContext1_16_R3.java @@ -3,9 +3,9 @@ import org.bukkit.persistence.PersistentDataAdapterContext; import org.bukkit.persistence.PersistentDataContainer; -import com.syntaxphoenix.syntaxapi.data.IDataContainer; +import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContext; public final class SyntaxContext1_16_R3 extends WrappedContext implements PersistentDataAdapterContext { @@ -26,12 +26,12 @@ public PersistentDataContainer newPersistentDataContainer() { } @Override - public IDataContainer newDataContainer() { + public IDataContainer newContainer() { return newContainer(); } @Override - public SyntaxContainer1_16_R3 newContainer() { + public SyntaxContainer1_16_R3 newWrapContainer() { return new SyntaxContainer1_16_R3(context.newPersistentDataContainer()); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/SyntaxType1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/SyntaxType1_16_R3.java index f5b6e42..51881f6 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/SyntaxType1_16_R3.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/SyntaxType1_16_R3.java @@ -3,13 +3,13 @@ import org.bukkit.persistence.PersistentDataAdapterContext; import org.bukkit.persistence.PersistentDataType; -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterContext; +import net.sourcewriters.minecraft.vcompat.data.api.IDataType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContext; public class SyntaxType1_16_R3 extends WrappedType1_16_R3, P0, P1, C0, C1> - implements DataType { + implements IDataType { private final PersistentDataType type; @@ -48,12 +48,12 @@ public Class getPrimitive() { } @Override - public P0 toPrimitive(DataAdapterContext context, C0 complex) { + public P0 toPrimitive(IDataAdapterContext context, C0 complex) { return wrapToPrimitive(complex, new BukkitContext1_16_R3(context)); } @Override - public C0 fromPrimitive(DataAdapterContext context, P0 primitive) { + public C0 fromPrimitive(IDataAdapterContext context, P0 primitive) { return wrapToComplex(primitive, new BukkitContext1_16_R3(context)); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/WrappedType1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/WrappedType1_16_R3.java index d2ffa11..7074c5f 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/WrappedType1_16_R3.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/WrappedType1_16_R3.java @@ -5,10 +5,10 @@ import org.bukkit.persistence.PersistentDataContainer; import org.bukkit.persistence.PersistentDataType; -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.data.IDataContainer; +import net.sourcewriters.minecraft.vcompat.data.api.IDataType; +import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; public abstract class WrappedType1_16_R3 implements WrapType { @@ -139,7 +139,7 @@ protected static int internalState(Class clazz) { return 0; } - public static BukkitType1_16_R3 wrap(DataType type) { + public static BukkitType1_16_R3 wrap(IDataType type) { return new BukkitType1_16_R3<>(type); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/hook/BukkitContainerAdapterHook1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/hook/BukkitContainerAdapterHook1_16_R3.java index aba4996..39bc049 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/hook/BukkitContainerAdapterHook1_16_R3.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/hook/BukkitContainerAdapterHook1_16_R3.java @@ -10,17 +10,17 @@ import org.bukkit.craftbukkit.v1_16_R3.persistence.CraftPersistentDataTypeRegistry; import org.bukkit.persistence.PersistentDataContainer; -import com.syntaxphoenix.syntaxapi.data.IDataContainer; -import com.syntaxphoenix.syntaxapi.data.container.nbt.NbtContainer; -import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; +import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; +import net.sourcewriters.minecraft.vcompat.data.nbt.NbtContainer; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtCompound; + +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookup; import net.minecraft.server.v1_16_R3.NBTTagCompound; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3.data.BukkitContainer1_16_R3; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3.data.SyntaxContainer1_16_R3; -import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.provider.VersionControl; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContainer; @SuppressWarnings({ "rawtypes", @@ -30,11 +30,11 @@ public final class BukkitContainerAdapterHook1_16_R3 { private static final BukkitContainerAdapterHook1_16_R3 HOOK = new BukkitContainerAdapterHook1_16_R3(); - private final AbstractReflect registryRef = new Reflect(CraftPersistentDataTypeRegistry.class) + private final ClassLookup registryRef = ClassLookup.of(CraftPersistentDataTypeRegistry.class) .searchMethod("create", "createAdapter", Class.class, Class.class, Function.class, Function.class) .searchField("adapters", "adapters") .searchField("function", "CREATE_ADAPTER"); - private final AbstractReflect entityRef = new Reflect(CraftEntity.class).searchField("registry", "DATA_TYPE_REGISTRY"); + private final ClassLookup entityRef = ClassLookup.of(CraftEntity.class).searchField("registry", "DATA_TYPE_REGISTRY"); private BukkitContainerAdapterHook1_16_R3() {} @@ -46,7 +46,7 @@ private CraftPersistentDataTypeRegistry getEntityRegistry() { private void uninjectAll() { for (CraftPersistentDataTypeRegistry registry : map.keySet()) { - Map adapters = (Map) registryRef.getFieldValue("adapters", registry); + Map adapters = (Map) registryRef.getFieldValue(registry, "adapters"); adapters.remove(BukkitContainer1_16_R3.class); adapters.remove(SyntaxContainer1_16_R3.class); registryRef.setFieldValue(registry, "function", map.get(registry)); @@ -58,8 +58,8 @@ private void inject(CraftPersistentDataTypeRegistry registry) { if (map.containsKey(registry)) { return; } - map.put(registry, (Function) registryRef.getFieldValue("function", registry)); - Function function = clazz -> createAdapter(registry, registryRef.getMethod("create").getReturnType(), (Class) clazz); + map.put(registry, (Function) registryRef.getFieldValue(registry, "function")); + Function function = clazz -> createAdapter(registry, registryRef.getMethod("create").type().returnType(), (Class) clazz); registryRef.setFieldValue(registry, "function", function); } @@ -89,7 +89,7 @@ private NBTTagCompound toPrimitive(WrappedContainer input) { } if (handle instanceof IDataContainer) { if (handle instanceof NbtContainer) { - return (NBTTagCompound) VersionControl.get().getBukkitConversion().toMinecraftCompound(((NbtContainer) handle).asNbt()); + return (NBTTagCompound) VersionCompatProvider.get().getControl().getBukkitConversion().toMinecraftCompound(((NbtContainer) handle).asNbt()); } throw new IllegalArgumentException( "Expected 'CraftPersistentDataContainer' got '" + handle.getClass().getSimpleName() + " instead'!"); @@ -98,7 +98,7 @@ private NBTTagCompound toPrimitive(WrappedContainer input) { } private BukkitContainer1_16_R3 fromPrimitiveSyntax(NBTTagCompound data) { - VersionControl control = VersionControl.get(); + VersionControl control = VersionCompatProvider.get().getControl(); NbtContainer container = new NbtContainer(control.getDataProvider().getRegistry()); NbtCompound compound = control.getBukkitConversion().fromMinecraftCompound(data); container.fromNbt(compound); diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/entity/ArmorStand1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/entity/ArmorStand1_16_R3.java index 5d32b68..a0ba43f 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/entity/ArmorStand1_16_R3.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/entity/ArmorStand1_16_R3.java @@ -3,7 +3,7 @@ import net.minecraft.server.v1_16_R3.EntityArmorStand; import net.minecraft.server.v1_16_R3.EntityTypes; import net.minecraft.server.v1_16_R3.World; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsArmorStand; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsArmorStand; public class ArmorStand1_16_R3 extends EntityLiving1_16_R3 implements NmsArmorStand { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/entity/Entity1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/entity/Entity1_16_R3.java index b0d9522..199e019 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/entity/Entity1_16_R3.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/entity/Entity1_16_R3.java @@ -20,8 +20,8 @@ import net.minecraft.server.v1_16_R3.PacketPlayOutSpawnEntity; import net.minecraft.server.v1_16_R3.PlayerConnection; import net.minecraft.server.v1_16_R3.Vec3D; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.utils.NmsBoundingBox; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.provider.utils.NmsBoundingBox; public abstract class Entity1_16_R3 implements NmsEntity { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/entity/EntityLiving1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/entity/EntityLiving1_16_R3.java index d18a1fe..204f165 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/entity/EntityLiving1_16_R3.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/entity/EntityLiving1_16_R3.java @@ -1,7 +1,7 @@ package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3.entity; import net.minecraft.server.v1_16_R3.EntityLiving; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityLiving; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityLiving; public abstract class EntityLiving1_16_R3 extends Entity1_16_R3 implements NmsEntityLiving { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/entity/Player1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/entity/Player1_16_R3.java index 4a6a2da..32036ad 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/entity/Player1_16_R3.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/entity/Player1_16_R3.java @@ -35,15 +35,15 @@ import net.minecraft.server.v1_16_R3.PacketPlayOutTitle; import net.minecraft.server.v1_16_R3.PacketPlayOutTitle.EnumTitleAction; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3.data.SyntaxContainer1_16_R3; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.type.SkinDataType; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; -import net.sourcewriters.minecraft.vcompat.utils.bukkit.Players; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.MojangProfileServer; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; -import net.sourcewriters.minecraft.vcompat.utils.thread.PostAsync; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.provider.data.type.SkinDataType; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookupProvider; +import net.sourcewriters.minecraft.vcompat.util.bukkit.Players; +import net.sourcewriters.minecraft.vcompat.util.minecraft.MojangProfileServer; +import net.sourcewriters.minecraft.vcompat.util.minecraft.Skin; +import net.sourcewriters.minecraft.vcompat.util.thread.PostAsync; import net.minecraft.server.v1_16_R3.PlayerConnection; import net.minecraft.server.v1_16_R3.WorldServer; @@ -283,7 +283,7 @@ private final void update(boolean flag) { String name = getName(); if (name != null) { - ReflectionProvider.DEFAULT.getReflect("mjGameProfile").setFieldValue(profile, "name", name); + VersionCompatProvider.get().getLookupProvider().getLookup("mjGameProfile").setFieldValue(profile, "name", name); } if (!(name == null && skin == null)) { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/tools/BlockTools1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/tools/BlockTools1_16_R3.java index d997e1a..2d5378d 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/tools/BlockTools1_16_R3.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/tools/BlockTools1_16_R3.java @@ -5,23 +5,23 @@ import com.mojang.authlib.properties.Property; import com.mojang.authlib.properties.PropertyMap; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookup; import net.minecraft.server.v1_16_R3.TileEntitySkull; -import net.sourcewriters.minecraft.vcompat.reflection.tools.BlockTools; -import net.sourcewriters.minecraft.vcompat.utils.constants.MinecraftConstants; +import net.sourcewriters.minecraft.vcompat.provider.tools.BlockTools; +import net.sourcewriters.minecraft.vcompat.util.constants.MinecraftConstants; public class BlockTools1_16_R3 extends BlockTools { - private final AbstractReflect craftEntityStateRef = new Reflect(CraftSkull.class).searchField("tileEntity", "tileEntity"); + private final ClassLookup craftEntityStateRef = ClassLookup.of(CraftSkull.class).searchField("tileEntity", "tileEntity"); @Override public void setHeadTexture(Block block, String texture) { if (!(block instanceof CraftSkull)) { return; } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue(block, "tileEntity"); PropertyMap map = entitySkull.gameProfile.getProperties(); map.removeAll("textures"); map.put("textures", new Property("textures", MinecraftConstants.TEXTURE_SIGNATURE, texture)); @@ -32,7 +32,7 @@ public String getHeadTexture(Block block) { if (!(block instanceof CraftSkull)) { return null; } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue(block, "tileEntity"); return entitySkull.gameProfile.getProperties().get("textures").iterator().next().getValue(); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/tools/ServerTools1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/tools/ServerTools1_16_R3.java index 6142354..c8d3077 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/tools/ServerTools1_16_R3.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/tools/ServerTools1_16_R3.java @@ -4,7 +4,7 @@ import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3.wrapper.ConsoleReaderWrapper1_16_R3; -import net.sourcewriters.minecraft.vcompat.reflection.tools.ServerTools; +import net.sourcewriters.minecraft.vcompat.provider.tools.ServerTools; public class ServerTools1_16_R3 extends ServerTools { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/tools/SkinTools1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/tools/SkinTools1_16_R3.java index f623b72..e84e806 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/tools/SkinTools1_16_R3.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/tools/SkinTools1_16_R3.java @@ -3,8 +3,8 @@ import org.bukkit.craftbukkit.v1_16_R3.entity.CraftPlayer; import org.bukkit.entity.Player; -import net.sourcewriters.minecraft.vcompat.reflection.tools.SkinTools; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; +import net.sourcewriters.minecraft.vcompat.provider.tools.SkinTools; +import net.sourcewriters.minecraft.vcompat.util.minecraft.Skin; public class SkinTools1_16_R3 extends SkinTools { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/wrapper/ConsoleReaderWrapper1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/wrapper/ConsoleReaderWrapper1_16_R3.java index ef5c6a7..e9dca73 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/wrapper/ConsoleReaderWrapper1_16_R3.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/wrapper/ConsoleReaderWrapper1_16_R3.java @@ -7,7 +7,7 @@ import org.bukkit.craftbukkit.v1_16_R3.CraftServer; import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; -import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; +import net.sourcewriters.minecraft.vcompat.provider.wrapper.ConsoleReaderWrapper; public final class ConsoleReaderWrapper1_16_R3 extends ConsoleReaderWrapper { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/BukkitConversion1_8_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/BukkitConversion1_8_R1.java index b944695..54acfe1 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/BukkitConversion1_8_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/BukkitConversion1_8_R1.java @@ -6,23 +6,23 @@ import org.bukkit.craftbukkit.v1_8_R1.inventory.CraftItemStack; import org.bukkit.entity.EntityType; -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.nbt.NbtByte; -import com.syntaxphoenix.syntaxapi.nbt.NbtByteArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; -import com.syntaxphoenix.syntaxapi.nbt.NbtDouble; -import com.syntaxphoenix.syntaxapi.nbt.NbtEnd; -import com.syntaxphoenix.syntaxapi.nbt.NbtFloat; -import com.syntaxphoenix.syntaxapi.nbt.NbtInt; -import com.syntaxphoenix.syntaxapi.nbt.NbtIntArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtList; -import com.syntaxphoenix.syntaxapi.nbt.NbtLong; -import com.syntaxphoenix.syntaxapi.nbt.NbtLongArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtShort; -import com.syntaxphoenix.syntaxapi.nbt.NbtString; -import com.syntaxphoenix.syntaxapi.nbt.NbtTag; -import com.syntaxphoenix.syntaxapi.nbt.NbtType; +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterContext; +import net.sourcewriters.minecraft.vcompat.data.api.IDataType; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtByte; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtByteArray; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtCompound; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtDouble; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtEnd; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtFloat; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtInt; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtIntArray; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtList; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtLong; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtLongArray; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtShort; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtString; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtTag; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtType; import net.minecraft.server.v1_8_R1.ItemStack; import net.minecraft.server.v1_8_R1.NBTBase; @@ -38,13 +38,13 @@ import net.minecraft.server.v1_8_R1.NBTTagLong; import net.minecraft.server.v1_8_R1.NBTTagShort; import net.minecraft.server.v1_8_R1.NBTTagString; -import net.sourcewriters.minecraft.vcompat.reflection.BukkitConversion; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContext; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleWrapType; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; +import net.sourcewriters.minecraft.vcompat.provider.BukkitConversion; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SimpleSyntaxContext; +import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SimpleWrapType; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityType; +import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookupProvider; public class BukkitConversion1_8_R1 extends BukkitConversion { @@ -102,7 +102,7 @@ public NBTBase toMinecraftTag(NbtTag tag) { case COMPOUND: return toMinecraftCompound((NbtCompound) tag); case END: - return (NBTTagEnd) ReflectionProvider.DEFAULT.getReflect("nmsNBTTagEnd").init(); + return (NBTTagEnd) VersionCompatProvider.get().getLookupProvider().getLookup("nmsNBTTagEnd").init(); default: return null; } @@ -163,7 +163,7 @@ public NbtList fromMinecraftList(Object raw) { return null; } NBTTagList list = (NBTTagList) raw; - List content = (List) ReflectionProvider.DEFAULT.getReflect("nmsNBTTagList").getFieldValue("value", list); + List content = (List) VersionCompatProvider.get().getLookupProvider().getLookup("nmsNBTTagList").getFieldValue(list, "value"); NbtList output = new NbtList<>(NbtType.getById(list.getTypeId())); for (NBTBase base : content) { output.add(fromMinecraftTag(base)); @@ -220,12 +220,12 @@ public NbtCompound itemToCompound(org.bukkit.inventory.ItemStack itemStack) { } @Override - public WrappedContext createContext(DataAdapterContext context) { + public WrappedContext createContext(IDataAdapterContext context) { return new SimpleSyntaxContext(context); } @Override - public WrapType wrap(DataType dataType) { + public WrapType wrap(IDataType dataType) { return new SimpleWrapType(dataType); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/EntityProvider1_8_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/EntityProvider1_8_R1.java index 6dd8870..5e3ef22 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/EntityProvider1_8_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/EntityProvider1_8_R1.java @@ -7,9 +7,9 @@ import net.minecraft.server.v1_8_R1.World; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R1.utils.EntityConstructors1_8_R1; -import net.sourcewriters.minecraft.vcompat.reflection.EntityProvider; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; +import net.sourcewriters.minecraft.vcompat.provider.EntityProvider; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityType; public class EntityProvider1_8_R1 extends EntityProvider { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/PacketHandler1_8_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/PacketHandler1_8_R1.java index da9b0fc..dc51297 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/PacketHandler1_8_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/PacketHandler1_8_R1.java @@ -1,6 +1,6 @@ package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R1; -import net.sourcewriters.minecraft.vcompat.reflection.PacketHandler; +import net.sourcewriters.minecraft.vcompat.provider.PacketHandler; public class PacketHandler1_8_R1 extends PacketHandler { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/PlayerProvider1_8_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/PlayerProvider1_8_R1.java index 0a9ccdc..1d8e6ad 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/PlayerProvider1_8_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/PlayerProvider1_8_R1.java @@ -7,10 +7,10 @@ import org.bukkit.entity.Player; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R1.entity.Player1_8_R1; -import net.sourcewriters.minecraft.vcompat.reflection.DataProvider; -import net.sourcewriters.minecraft.vcompat.reflection.PlayerProvider; -import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.DataDistributor; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.provider.DataProvider; +import net.sourcewriters.minecraft.vcompat.provider.PlayerProvider; +import net.sourcewriters.minecraft.vcompat.provider.data.persistence.DataDistributor; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsPlayer; public class PlayerProvider1_8_R1 extends PlayerProvider { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/TextureProvider1_8_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/TextureProvider1_8_R1.java index 3f7ea09..a115c63 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/TextureProvider1_8_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/TextureProvider1_8_R1.java @@ -9,22 +9,22 @@ import org.bukkit.material.MaterialData; import com.mojang.authlib.GameProfile; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookup; import net.minecraft.server.v1_8_R1.GameProfileSerializer; import net.minecraft.server.v1_8_R1.ItemStack; import net.minecraft.server.v1_8_R1.NBTTagCompound; import net.minecraft.server.v1_8_R1.TileEntitySkull; -import net.sourcewriters.minecraft.vcompat.reflection.TextureProvider; +import net.sourcewriters.minecraft.vcompat.provider.TextureProvider; @SuppressWarnings("deprecation") public class TextureProvider1_8_R1 extends TextureProvider { - private final AbstractReflect craftItemStackRef = new Reflect(CraftItemStack.class).searchField("handle", "handle"); - private final AbstractReflect craftMetaSkullRef = new Reflect("org.bukkit.craftbukkit.v1_8_R1.inventory.CraftMetaSkull") + private final ClassLookup craftItemStackRef = ClassLookup.of(CraftItemStack.class).searchField("handle", "handle"); + private final ClassLookup craftMetaSkullRef = ClassLookup.of("org.bukkit.craftbukkit.v1_8_R1.inventory.CraftMetaSkull") .searchField("serialized", "serializedProfile").searchField("profile", "profile"); - private final AbstractReflect craftSkullRef = new Reflect(CraftSkull.class).searchField("tileEntity", "skull"); + private final ClassLookup craftSkullRef = ClassLookup.of(CraftSkull.class).searchField("tileEntity", "skull"); private final Material skullMaterial = Material.valueOf("SKULL"); protected TextureProvider1_8_R1(VersionControl1_8_R1 versionControl) { @@ -36,7 +36,7 @@ public GameProfile profileFromBlock(Block block) { if (!(block instanceof CraftSkull)) { return null; } - return ((TileEntitySkull) craftSkullRef.getFieldValue("tileEntity", block)).getGameProfile(); + return ((TileEntitySkull) craftSkullRef.getFieldValue(block, "tileEntity")).getGameProfile(); } @Override @@ -45,13 +45,13 @@ public GameProfile profileFromItem(org.bukkit.inventory.ItemStack itemStack) { return null; } SkullMeta meta = (SkullMeta) itemStack.getItemMeta(); - GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue("profile", meta); + GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue(meta, "profile"); if (profile == null) { - NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue("serialized", meta); + NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue(meta, "serialized"); if (compound == null) { ItemStack stack = null; if (itemStack instanceof CraftItemStack) { - stack = (ItemStack) craftItemStackRef.getFieldValue("handle", itemStack); + stack = (ItemStack) craftItemStackRef.getFieldValue(itemStack, "handle"); } if (stack == null) { stack = CraftItemStack.asNMSCopy(itemStack); @@ -100,7 +100,7 @@ public boolean applyBlock(Block block, GameProfile profile) { if (!(block instanceof CraftSkull)) { return false; } - ((TileEntitySkull) craftSkullRef.getFieldValue("tileEntity", block)).setGameProfile(profile); + ((TileEntitySkull) craftSkullRef.getFieldValue(block, "tileEntity")).setGameProfile(profile); return true; } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/ToolProvider1_8_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/ToolProvider1_8_R1.java index c38ad95..1bbf70b 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/ToolProvider1_8_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/ToolProvider1_8_R1.java @@ -3,7 +3,7 @@ import net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R1.tools.BlockTools1_8_R1; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R1.tools.ServerTools1_8_R1; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R1.tools.SkinTools1_8_R1; -import net.sourcewriters.minecraft.vcompat.reflection.ToolProvider; +import net.sourcewriters.minecraft.vcompat.provider.ToolProvider; public class ToolProvider1_8_R1 extends ToolProvider { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/VersionControl1_8_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/VersionControl1_8_R1.java index bfa2780..471ddf8 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/VersionControl1_8_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/VersionControl1_8_R1.java @@ -1,8 +1,8 @@ package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R1; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R1.reflection.NmsReflection1_8_R1; -import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; +import net.sourcewriters.minecraft.vcompat.provider.VersionControl; +import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookupProvider; public class VersionControl1_8_R1 extends VersionControl { @@ -20,7 +20,7 @@ public static VersionControl1_8_R1 init() { private final BukkitConversion1_8_R1 bukkitConversion = new BukkitConversion1_8_R1(this); private VersionControl1_8_R1() { - NmsReflection1_8_R1.INSTANCE.setup(ReflectionProvider.DEFAULT); + NmsReflection1_8_R1.INSTANCE.setup(VersionCompatProvider.get().getLookupProvider()); } @Override diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/entity/ArmorStand1_8_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/entity/ArmorStand1_8_R1.java index 686d91e..895e35a 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/entity/ArmorStand1_8_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/entity/ArmorStand1_8_R1.java @@ -2,7 +2,7 @@ import net.minecraft.server.v1_8_R1.EntityArmorStand; import net.minecraft.server.v1_8_R1.World; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsArmorStand; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsArmorStand; public class ArmorStand1_8_R1 extends EntityLiving1_8_R1 implements NmsArmorStand { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/entity/Entity1_8_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/entity/Entity1_8_R1.java index 383e562..e8078dd 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/entity/Entity1_8_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/entity/Entity1_8_R1.java @@ -20,8 +20,8 @@ import net.minecraft.server.v1_8_R1.PacketPlayOutSpawnEntity; import net.minecraft.server.v1_8_R1.PlayerConnection; import net.minecraft.server.v1_8_R1.Vec3D; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.utils.NmsBoundingBox; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.provider.utils.NmsBoundingBox; public abstract class Entity1_8_R1 implements NmsEntity { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/entity/EntityLiving1_8_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/entity/EntityLiving1_8_R1.java index b0b10df..3f61638 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/entity/EntityLiving1_8_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/entity/EntityLiving1_8_R1.java @@ -1,7 +1,7 @@ package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R1.entity; import net.minecraft.server.v1_8_R1.EntityLiving; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityLiving; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityLiving; public abstract class EntityLiving1_8_R1 extends Entity1_8_R1 implements NmsEntityLiving { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/entity/Player1_8_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/entity/Player1_8_R1.java index 279d901..a182768 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/entity/Player1_8_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/entity/Player1_8_R1.java @@ -10,7 +10,7 @@ import com.mojang.authlib.GameProfile; import com.mojang.authlib.properties.Property; import com.mojang.authlib.properties.PropertyMap; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookup; import net.minecraft.server.v1_8_R1.EntityPlayer; import net.minecraft.server.v1_8_R1.EnumClientCommand; @@ -34,17 +34,17 @@ import net.minecraft.server.v1_8_R1.PacketPlayOutTitle; import net.minecraft.server.v1_8_R1.PlayerConnection; import net.minecraft.server.v1_8_R1.WorldServer; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.PersistentContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.type.SkinDataType; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContainer; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; -import net.sourcewriters.minecraft.vcompat.utils.bukkit.Players; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.MojangProfileServer; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; -import net.sourcewriters.minecraft.vcompat.utils.thread.PostAsync; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.provider.data.persistence.PersistentContainer; +import net.sourcewriters.minecraft.vcompat.provider.data.type.SkinDataType; +import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SimpleSyntaxContainer; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookupProvider; +import net.sourcewriters.minecraft.vcompat.util.bukkit.Players; +import net.sourcewriters.minecraft.vcompat.util.minecraft.MojangProfileServer; +import net.sourcewriters.minecraft.vcompat.util.minecraft.Skin; +import net.sourcewriters.minecraft.vcompat.util.thread.PostAsync; public class Player1_8_R1 extends EntityLiving1_8_R1 implements NmsPlayer { @@ -151,7 +151,7 @@ private final void sendPlayerListInfo(String header, String footer) { PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter(); - Reflect reflect = ReflectionProvider.DEFAULT.getReflect("nmsPacketPlayOutPlayerListHeaderFooter"); + ClassLookup reflect = VersionCompatProvider.get().getLookupProvider().getLookup("nmsPacketPlayOutPlayerListHeaderFooter"); reflect.setFieldValue(packet, "header", headerComponent); reflect.setFieldValue(packet, "footer", footerComponent); @@ -283,7 +283,7 @@ private final void update(boolean flag) { String name = getName(); if (name != null) { - ReflectionProvider.DEFAULT.getReflect("mjGameProfile").setFieldValue(profile, "name", name); + VersionCompatProvider.get().getLookupProvider().getLookup("mjGameProfile").setFieldValue(profile, "name", name); } if (!(name == null && skin == null)) { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/reflection/NmsReflection1_8_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/reflection/NmsReflection1_8_R1.java index f4b7cba..7300b0b 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/reflection/NmsReflection1_8_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/reflection/NmsReflection1_8_R1.java @@ -3,17 +3,17 @@ import net.minecraft.server.v1_8_R1.NBTTagEnd; import net.minecraft.server.v1_8_R1.NBTTagList; import net.minecraft.server.v1_8_R1.PacketPlayOutPlayerListHeaderFooter; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.Reflections; +import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookupProvider; +import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookups; -public class NmsReflection1_8_R1 extends Reflections { +public class NmsReflection1_8_R1 extends ClassLookups { public static NmsReflection1_8_R1 INSTANCE = new NmsReflection1_8_R1(); private NmsReflection1_8_R1() {} @Override - public void setup(ReflectionProvider provider) { + public void setup(ClassLookupProvider provider) { // // @@ -23,11 +23,11 @@ public void setup(ReflectionProvider provider) { // // Minecraft - provider.createReflect("nmsPacketPlayOutPlayerListHeaderFooter", PacketPlayOutPlayerListHeaderFooter.class) + provider.createLookup("nmsPacketPlayOutPlayerListHeaderFooter", PacketPlayOutPlayerListHeaderFooter.class) .searchField("header", "a").searchField("header", "b"); - provider.createReflect("nmsNBTTagEnd", NBTTagEnd.class); - provider.createReflect("nmsNBTTagList", NBTTagList.class).searchField("value", "list"); + provider.createLookup("nmsNBTTagEnd", NBTTagEnd.class); + provider.createLookup("nmsNBTTagList", NBTTagList.class).searchField("value", "list"); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/tools/BlockTools1_8_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/tools/BlockTools1_8_R1.java index 55da3af..2354abb 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/tools/BlockTools1_8_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/tools/BlockTools1_8_R1.java @@ -5,23 +5,23 @@ import com.mojang.authlib.properties.Property; import com.mojang.authlib.properties.PropertyMap; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookup; import net.minecraft.server.v1_8_R1.TileEntitySkull; -import net.sourcewriters.minecraft.vcompat.reflection.tools.BlockTools; -import net.sourcewriters.minecraft.vcompat.utils.constants.MinecraftConstants; +import net.sourcewriters.minecraft.vcompat.provider.tools.BlockTools; +import net.sourcewriters.minecraft.vcompat.util.constants.MinecraftConstants; public class BlockTools1_8_R1 extends BlockTools { - private final AbstractReflect craftEntityStateRef = new Reflect(CraftSkull.class).searchField("tileEntity", "tileEntity"); + private final ClassLookup craftEntityStateRef = ClassLookup.of(CraftSkull.class).searchField("tileEntity", "tileEntity"); @Override public void setHeadTexture(Block block, String texture) { if (!(block instanceof CraftSkull)) { return; } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue(block, "tileEntity"); PropertyMap map = entitySkull.getGameProfile().getProperties(); map.removeAll("textures"); map.put("textures", new Property("textures", MinecraftConstants.TEXTURE_SIGNATURE, texture)); @@ -32,7 +32,7 @@ public String getHeadTexture(Block block) { if (!(block instanceof CraftSkull)) { return null; } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue(block, "tileEntity"); return entitySkull.getGameProfile().getProperties().get("textures").iterator().next().getValue(); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/tools/ServerTools1_8_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/tools/ServerTools1_8_R1.java index 27ae802..898c39e 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/tools/ServerTools1_8_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/tools/ServerTools1_8_R1.java @@ -4,7 +4,7 @@ import org.bukkit.craftbukkit.v1_8_R1.CraftServer; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R1.wrapper.ConsoleReaderWrapper1_8_R1; -import net.sourcewriters.minecraft.vcompat.reflection.tools.ServerTools; +import net.sourcewriters.minecraft.vcompat.provider.tools.ServerTools; public class ServerTools1_8_R1 extends ServerTools { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/tools/SkinTools1_8_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/tools/SkinTools1_8_R1.java index 960def5..e2a0b8d 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/tools/SkinTools1_8_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/tools/SkinTools1_8_R1.java @@ -3,8 +3,8 @@ import org.bukkit.craftbukkit.v1_8_R1.entity.CraftPlayer; import org.bukkit.entity.Player; -import net.sourcewriters.minecraft.vcompat.reflection.tools.SkinTools; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; +import net.sourcewriters.minecraft.vcompat.provider.tools.SkinTools; +import net.sourcewriters.minecraft.vcompat.util.minecraft.Skin; public class SkinTools1_8_R1 extends SkinTools { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/wrapper/ConsoleReaderWrapper1_8_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/wrapper/ConsoleReaderWrapper1_8_R1.java index 1167cd5..1051315 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/wrapper/ConsoleReaderWrapper1_8_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/wrapper/ConsoleReaderWrapper1_8_R1.java @@ -7,7 +7,7 @@ import org.bukkit.craftbukkit.v1_8_R1.CraftServer; import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; -import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; +import net.sourcewriters.minecraft.vcompat.provider.wrapper.ConsoleReaderWrapper; public final class ConsoleReaderWrapper1_8_R1 extends ConsoleReaderWrapper { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/BukkitConversion1_8_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/BukkitConversion1_8_R2.java index 7d04a50..c6d0433 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/BukkitConversion1_8_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/BukkitConversion1_8_R2.java @@ -6,23 +6,23 @@ import org.bukkit.craftbukkit.v1_8_R2.inventory.CraftItemStack; import org.bukkit.entity.EntityType; -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.nbt.NbtByte; -import com.syntaxphoenix.syntaxapi.nbt.NbtByteArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; -import com.syntaxphoenix.syntaxapi.nbt.NbtDouble; -import com.syntaxphoenix.syntaxapi.nbt.NbtEnd; -import com.syntaxphoenix.syntaxapi.nbt.NbtFloat; -import com.syntaxphoenix.syntaxapi.nbt.NbtInt; -import com.syntaxphoenix.syntaxapi.nbt.NbtIntArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtList; -import com.syntaxphoenix.syntaxapi.nbt.NbtLong; -import com.syntaxphoenix.syntaxapi.nbt.NbtLongArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtShort; -import com.syntaxphoenix.syntaxapi.nbt.NbtString; -import com.syntaxphoenix.syntaxapi.nbt.NbtTag; -import com.syntaxphoenix.syntaxapi.nbt.NbtType; +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterContext; +import net.sourcewriters.minecraft.vcompat.data.api.IDataType; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtByte; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtByteArray; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtCompound; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtDouble; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtEnd; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtFloat; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtInt; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtIntArray; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtList; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtLong; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtLongArray; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtShort; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtString; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtTag; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtType; import net.minecraft.server.v1_8_R2.ItemStack; import net.minecraft.server.v1_8_R2.NBTBase; @@ -38,13 +38,13 @@ import net.minecraft.server.v1_8_R2.NBTTagLong; import net.minecraft.server.v1_8_R2.NBTTagShort; import net.minecraft.server.v1_8_R2.NBTTagString; -import net.sourcewriters.minecraft.vcompat.reflection.BukkitConversion; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContext; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleWrapType; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; +import net.sourcewriters.minecraft.vcompat.provider.BukkitConversion; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SimpleSyntaxContext; +import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SimpleWrapType; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityType; +import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookupProvider; public class BukkitConversion1_8_R2 extends BukkitConversion { @@ -102,7 +102,7 @@ public NBTBase toMinecraftTag(NbtTag tag) { case COMPOUND: return toMinecraftCompound((NbtCompound) tag); case END: - return (NBTTagEnd) ReflectionProvider.DEFAULT.getReflect("nmsNBTTagEnd").init(); + return (NBTTagEnd) VersionCompatProvider.get().getLookupProvider().getLookup("nmsNBTTagEnd").init(); default: return null; } @@ -163,7 +163,7 @@ public NbtList fromMinecraftList(Object raw) { return null; } NBTTagList list = (NBTTagList) raw; - List content = (List) ReflectionProvider.DEFAULT.getReflect("nmsNBTTagList").getFieldValue("value", list); + List content = (List) VersionCompatProvider.get().getLookupProvider().getLookup("nmsNBTTagList").getFieldValue(list, "value"); NbtList output = new NbtList<>(NbtType.getById(list.getTypeId())); for (NBTBase base : content) { output.add(fromMinecraftTag(base)); @@ -219,12 +219,12 @@ public NbtCompound itemToCompound(org.bukkit.inventory.ItemStack itemStack) { } @Override - public WrappedContext createContext(DataAdapterContext context) { + public WrappedContext createContext(IDataAdapterContext context) { return new SimpleSyntaxContext(context); } @Override - public WrapType wrap(DataType dataType) { + public WrapType wrap(IDataType dataType) { return new SimpleWrapType(dataType); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/EntityProvider1_8_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/EntityProvider1_8_R2.java index 5685a2a..1d9ff33 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/EntityProvider1_8_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/EntityProvider1_8_R2.java @@ -7,9 +7,9 @@ import net.minecraft.server.v1_8_R2.World; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R2.utils.EntityConstructors1_8_R2; -import net.sourcewriters.minecraft.vcompat.reflection.EntityProvider; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; +import net.sourcewriters.minecraft.vcompat.provider.EntityProvider; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityType; public class EntityProvider1_8_R2 extends EntityProvider { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/PacketHandler1_8_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/PacketHandler1_8_R2.java index cf2113d..fb8becf 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/PacketHandler1_8_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/PacketHandler1_8_R2.java @@ -1,6 +1,6 @@ package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R2; -import net.sourcewriters.minecraft.vcompat.reflection.PacketHandler; +import net.sourcewriters.minecraft.vcompat.provider.PacketHandler; public class PacketHandler1_8_R2 extends PacketHandler { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/PlayerProvider1_8_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/PlayerProvider1_8_R2.java index 2bd325b..db0facb 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/PlayerProvider1_8_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/PlayerProvider1_8_R2.java @@ -7,10 +7,10 @@ import org.bukkit.entity.Player; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R2.entity.Player1_8_R2; -import net.sourcewriters.minecraft.vcompat.reflection.DataProvider; -import net.sourcewriters.minecraft.vcompat.reflection.PlayerProvider; -import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.DataDistributor; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.provider.DataProvider; +import net.sourcewriters.minecraft.vcompat.provider.PlayerProvider; +import net.sourcewriters.minecraft.vcompat.provider.data.persistence.DataDistributor; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsPlayer; public class PlayerProvider1_8_R2 extends PlayerProvider { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/TextureProvider1_8_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/TextureProvider1_8_R2.java index 7fbf11e..a03b96b 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/TextureProvider1_8_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/TextureProvider1_8_R2.java @@ -9,19 +9,19 @@ import org.bukkit.material.MaterialData; import com.mojang.authlib.GameProfile; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookup; import net.minecraft.server.v1_8_R2.GameProfileSerializer; import net.minecraft.server.v1_8_R2.ItemStack; import net.minecraft.server.v1_8_R2.NBTTagCompound; -import net.sourcewriters.minecraft.vcompat.reflection.TextureProvider; +import net.sourcewriters.minecraft.vcompat.provider.TextureProvider; @SuppressWarnings("deprecation") public class TextureProvider1_8_R2 extends TextureProvider { - private final AbstractReflect craftItemStackRef = new Reflect(CraftItemStack.class).searchField("handle", "handle"); - private final AbstractReflect craftMetaSkullRef = new Reflect("org.bukkit.craftbukkit.v1_8_R2.inventory.CraftMetaSkull") + private final ClassLookup craftItemStackRef = ClassLookup.of(CraftItemStack.class).searchField("handle", "handle"); + private final ClassLookup craftMetaSkullRef = ClassLookup.of("org.bukkit.craftbukkit.v1_8_R2.inventory.CraftMetaSkull") .searchField("serialized", "serializedProfile").searchField("profile", "profile"); private final Material skullMaterial = Material.valueOf("SKULL"); @@ -43,13 +43,13 @@ public GameProfile profileFromItem(org.bukkit.inventory.ItemStack itemStack) { return null; } SkullMeta meta = (SkullMeta) itemStack.getItemMeta(); - GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue("profile", meta); + GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue(meta, "profile"); if (profile == null) { - NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue("serialized", meta); + NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue(meta, "serialized"); if (compound == null) { ItemStack stack = null; if (itemStack instanceof CraftItemStack) { - stack = (ItemStack) craftItemStackRef.getFieldValue("handle", itemStack); + stack = (ItemStack) craftItemStackRef.getFieldValue(itemStack, "handle"); } if (stack == null) { stack = CraftItemStack.asNMSCopy(itemStack); diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/ToolProvider1_8_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/ToolProvider1_8_R2.java index 49ae726..9300d3c 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/ToolProvider1_8_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/ToolProvider1_8_R2.java @@ -3,7 +3,7 @@ import net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R2.tools.BlockTools1_8_R2; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R2.tools.ServerTools1_8_R2; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R2.tools.SkinTools1_8_R2; -import net.sourcewriters.minecraft.vcompat.reflection.ToolProvider; +import net.sourcewriters.minecraft.vcompat.provider.ToolProvider; public class ToolProvider1_8_R2 extends ToolProvider { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/VersionControl1_8_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/VersionControl1_8_R2.java index f287999..748d7a3 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/VersionControl1_8_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/VersionControl1_8_R2.java @@ -1,8 +1,8 @@ package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R2; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R2.reflection.NmsReflection1_8_R2; -import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; +import net.sourcewriters.minecraft.vcompat.provider.VersionControl; +import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookupProvider; public class VersionControl1_8_R2 extends VersionControl { @@ -20,7 +20,7 @@ public static VersionControl1_8_R2 init() { private final BukkitConversion1_8_R2 bukkitConversion = new BukkitConversion1_8_R2(this); private VersionControl1_8_R2() { - NmsReflection1_8_R2.INSTANCE.setup(ReflectionProvider.DEFAULT); + NmsReflection1_8_R2.INSTANCE.setup(VersionCompatProvider.get().getLookupProvider()); } @Override diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/entity/ArmorStand1_8_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/entity/ArmorStand1_8_R2.java index 0904d5a..206fa21 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/entity/ArmorStand1_8_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/entity/ArmorStand1_8_R2.java @@ -2,7 +2,7 @@ import net.minecraft.server.v1_8_R2.EntityArmorStand; import net.minecraft.server.v1_8_R2.World; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsArmorStand; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsArmorStand; public class ArmorStand1_8_R2 extends EntityLiving1_8_R2 implements NmsArmorStand { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/entity/Entity1_8_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/entity/Entity1_8_R2.java index 888a495..1afdb3d 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/entity/Entity1_8_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/entity/Entity1_8_R2.java @@ -20,8 +20,8 @@ import net.minecraft.server.v1_8_R2.PacketPlayOutSpawnEntity; import net.minecraft.server.v1_8_R2.PlayerConnection; import net.minecraft.server.v1_8_R2.Vec3D; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.utils.NmsBoundingBox; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.provider.utils.NmsBoundingBox; public abstract class Entity1_8_R2 implements NmsEntity { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/entity/EntityLiving1_8_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/entity/EntityLiving1_8_R2.java index b6bfa8d..d8fd14b 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/entity/EntityLiving1_8_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/entity/EntityLiving1_8_R2.java @@ -1,7 +1,7 @@ package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R2.entity; import net.minecraft.server.v1_8_R2.EntityLiving; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityLiving; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityLiving; public abstract class EntityLiving1_8_R2 extends Entity1_8_R2 implements NmsEntityLiving { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/entity/Player1_8_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/entity/Player1_8_R2.java index 3c95884..b850c3c 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/entity/Player1_8_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/entity/Player1_8_R2.java @@ -10,7 +10,7 @@ import com.mojang.authlib.GameProfile; import com.mojang.authlib.properties.Property; import com.mojang.authlib.properties.PropertyMap; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookup; import net.minecraft.server.v1_8_R2.EntityPlayer; import net.minecraft.server.v1_8_R2.IChatBaseComponent; @@ -32,17 +32,17 @@ import net.minecraft.server.v1_8_R2.PacketPlayOutRespawn; import net.minecraft.server.v1_8_R2.PacketPlayOutTitle; import net.minecraft.server.v1_8_R2.PacketPlayOutTitle.EnumTitleAction; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.PersistentContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.type.SkinDataType; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContainer; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; -import net.sourcewriters.minecraft.vcompat.utils.bukkit.Players; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.MojangProfileServer; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; -import net.sourcewriters.minecraft.vcompat.utils.thread.PostAsync; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.provider.data.persistence.PersistentContainer; +import net.sourcewriters.minecraft.vcompat.provider.data.type.SkinDataType; +import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SimpleSyntaxContainer; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookupProvider; +import net.sourcewriters.minecraft.vcompat.util.bukkit.Players; +import net.sourcewriters.minecraft.vcompat.util.minecraft.MojangProfileServer; +import net.sourcewriters.minecraft.vcompat.util.minecraft.Skin; +import net.sourcewriters.minecraft.vcompat.util.thread.PostAsync; import net.minecraft.server.v1_8_R2.PlayerConnection; import net.minecraft.server.v1_8_R2.WorldServer; @@ -151,7 +151,7 @@ private final void sendPlayerListInfo(String header, String footer) { PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter(); - Reflect reflect = ReflectionProvider.DEFAULT.getReflect("nmsPacketPlayOutPlayerListHeaderFooter"); + ClassLookup reflect = VersionCompatProvider.get().getLookupProvider().getLookup("nmsPacketPlayOutPlayerListHeaderFooter"); reflect.setFieldValue(packet, "header", headerComponent); reflect.setFieldValue(packet, "footer", footerComponent); @@ -283,7 +283,7 @@ private final void update(boolean flag) { String name = getName(); if (name != null) { - ReflectionProvider.DEFAULT.getReflect("mjGameProfile").setFieldValue(profile, "name", name); + VersionCompatProvider.get().getLookupProvider().getLookup("mjGameProfile").setFieldValue(profile, "name", name); } if (!(name == null && skin == null)) { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/reflection/NmsReflection1_8_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/reflection/NmsReflection1_8_R2.java index 4f4e10d..8d972c3 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/reflection/NmsReflection1_8_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/reflection/NmsReflection1_8_R2.java @@ -3,17 +3,17 @@ import net.minecraft.server.v1_8_R2.NBTTagEnd; import net.minecraft.server.v1_8_R2.NBTTagList; import net.minecraft.server.v1_8_R2.PacketPlayOutPlayerListHeaderFooter; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.Reflections; +import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookupProvider; +import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookups; -public class NmsReflection1_8_R2 extends Reflections { +public class NmsReflection1_8_R2 extends ClassLookups { public static NmsReflection1_8_R2 INSTANCE = new NmsReflection1_8_R2(); private NmsReflection1_8_R2() {} @Override - public void setup(ReflectionProvider provider) { + public void setup(ClassLookupProvider provider) { // // @@ -23,11 +23,11 @@ public void setup(ReflectionProvider provider) { // // Minecraft - provider.createReflect("nmsPacketPlayOutPlayerListHeaderFooter", PacketPlayOutPlayerListHeaderFooter.class) + provider.createLookup("nmsPacketPlayOutPlayerListHeaderFooter", PacketPlayOutPlayerListHeaderFooter.class) .searchField("header", "a").searchField("header", "b"); - provider.createReflect("nmsNBTTagEnd", NBTTagEnd.class); - provider.createReflect("nmsNBTTagList", NBTTagList.class).searchField("value", "list"); + provider.createLookup("nmsNBTTagEnd", NBTTagEnd.class); + provider.createLookup("nmsNBTTagList", NBTTagList.class).searchField("value", "list"); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/tools/BlockTools1_8_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/tools/BlockTools1_8_R2.java index 5fbde74..a8fce17 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/tools/BlockTools1_8_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/tools/BlockTools1_8_R2.java @@ -5,23 +5,23 @@ import com.mojang.authlib.properties.Property; import com.mojang.authlib.properties.PropertyMap; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookup; import net.minecraft.server.v1_8_R2.TileEntitySkull; -import net.sourcewriters.minecraft.vcompat.reflection.tools.BlockTools; -import net.sourcewriters.minecraft.vcompat.utils.constants.MinecraftConstants; +import net.sourcewriters.minecraft.vcompat.provider.tools.BlockTools; +import net.sourcewriters.minecraft.vcompat.util.constants.MinecraftConstants; public class BlockTools1_8_R2 extends BlockTools { - private final AbstractReflect craftEntityStateRef = new Reflect(CraftSkull.class).searchField("tileEntity", "tileEntity"); + private final ClassLookup craftEntityStateRef = ClassLookup.of(CraftSkull.class).searchField("tileEntity", "tileEntity"); @Override public void setHeadTexture(Block block, String texture) { if (!(block instanceof CraftSkull)) { return; } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue(block, "tileEntity"); PropertyMap map = entitySkull.getGameProfile().getProperties(); map.removeAll("textures"); map.put("textures", new Property("textures", MinecraftConstants.TEXTURE_SIGNATURE, texture)); @@ -32,7 +32,7 @@ public String getHeadTexture(Block block) { if (!(block instanceof CraftSkull)) { return null; } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue(block, "tileEntity"); return entitySkull.getGameProfile().getProperties().get("textures").iterator().next().getValue(); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/tools/ServerTools1_8_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/tools/ServerTools1_8_R2.java index 9bfff0c..da32424 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/tools/ServerTools1_8_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/tools/ServerTools1_8_R2.java @@ -4,7 +4,7 @@ import org.bukkit.craftbukkit.v1_8_R2.CraftServer; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R2.wrapper.ConsoleReaderWrapper1_8_R2; -import net.sourcewriters.minecraft.vcompat.reflection.tools.ServerTools; +import net.sourcewriters.minecraft.vcompat.provider.tools.ServerTools; public class ServerTools1_8_R2 extends ServerTools { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/tools/SkinTools1_8_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/tools/SkinTools1_8_R2.java index e103e33..8a4518d 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/tools/SkinTools1_8_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/tools/SkinTools1_8_R2.java @@ -3,8 +3,8 @@ import org.bukkit.craftbukkit.v1_8_R2.entity.CraftPlayer; import org.bukkit.entity.Player; -import net.sourcewriters.minecraft.vcompat.reflection.tools.SkinTools; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; +import net.sourcewriters.minecraft.vcompat.provider.tools.SkinTools; +import net.sourcewriters.minecraft.vcompat.util.minecraft.Skin; public class SkinTools1_8_R2 extends SkinTools { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/wrapper/ConsoleReaderWrapper1_8_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/wrapper/ConsoleReaderWrapper1_8_R2.java index 78278bb..888c25b 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/wrapper/ConsoleReaderWrapper1_8_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/wrapper/ConsoleReaderWrapper1_8_R2.java @@ -7,7 +7,7 @@ import org.bukkit.craftbukkit.v1_8_R2.CraftServer; import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; -import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; +import net.sourcewriters.minecraft.vcompat.provider.wrapper.ConsoleReaderWrapper; public final class ConsoleReaderWrapper1_8_R2 extends ConsoleReaderWrapper { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/BukkitConversion1_8_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/BukkitConversion1_8_R3.java index 23ee751..7e6c222 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/BukkitConversion1_8_R3.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/BukkitConversion1_8_R3.java @@ -6,23 +6,23 @@ import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack; import org.bukkit.entity.EntityType; -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.nbt.NbtByte; -import com.syntaxphoenix.syntaxapi.nbt.NbtByteArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; -import com.syntaxphoenix.syntaxapi.nbt.NbtDouble; -import com.syntaxphoenix.syntaxapi.nbt.NbtEnd; -import com.syntaxphoenix.syntaxapi.nbt.NbtFloat; -import com.syntaxphoenix.syntaxapi.nbt.NbtInt; -import com.syntaxphoenix.syntaxapi.nbt.NbtIntArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtList; -import com.syntaxphoenix.syntaxapi.nbt.NbtLong; -import com.syntaxphoenix.syntaxapi.nbt.NbtLongArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtShort; -import com.syntaxphoenix.syntaxapi.nbt.NbtString; -import com.syntaxphoenix.syntaxapi.nbt.NbtTag; -import com.syntaxphoenix.syntaxapi.nbt.NbtType; +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterContext; +import net.sourcewriters.minecraft.vcompat.data.api.IDataType; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtByte; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtByteArray; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtCompound; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtDouble; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtEnd; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtFloat; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtInt; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtIntArray; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtList; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtLong; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtLongArray; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtShort; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtString; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtTag; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtType; import net.minecraft.server.v1_8_R3.ItemStack; import net.minecraft.server.v1_8_R3.NBTBase; @@ -38,13 +38,13 @@ import net.minecraft.server.v1_8_R3.NBTTagLong; import net.minecraft.server.v1_8_R3.NBTTagShort; import net.minecraft.server.v1_8_R3.NBTTagString; -import net.sourcewriters.minecraft.vcompat.reflection.BukkitConversion; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContext; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleWrapType; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; +import net.sourcewriters.minecraft.vcompat.provider.BukkitConversion; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SimpleSyntaxContext; +import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SimpleWrapType; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityType; +import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookupProvider; public class BukkitConversion1_8_R3 extends BukkitConversion { @@ -102,7 +102,7 @@ public NBTBase toMinecraftTag(NbtTag tag) { case COMPOUND: return toMinecraftCompound((NbtCompound) tag); case END: - return (NBTTagEnd) ReflectionProvider.DEFAULT.getReflect("nmsNBTTagEnd").init(); + return (NBTTagEnd) VersionCompatProvider.get().getLookupProvider().getLookup("nmsNBTTagEnd").init(); default: return null; } @@ -163,7 +163,7 @@ public NbtList fromMinecraftList(Object raw) { return null; } NBTTagList list = (NBTTagList) raw; - List content = (List) ReflectionProvider.DEFAULT.getReflect("nmsNBTTagList").getFieldValue("value", list); + List content = (List) VersionCompatProvider.get().getLookupProvider().getLookup("nmsNBTTagList").getFieldValue(list, "value"); NbtList output = new NbtList<>(NbtType.getById(list.getTypeId())); for (NBTBase base : content) { output.add(fromMinecraftTag(base)); @@ -219,12 +219,12 @@ public NbtCompound itemToCompound(org.bukkit.inventory.ItemStack itemStack) { } @Override - public WrappedContext createContext(DataAdapterContext context) { + public WrappedContext createContext(IDataAdapterContext context) { return new SimpleSyntaxContext(context); } @Override - public WrapType wrap(DataType dataType) { + public WrapType wrap(IDataType dataType) { return new SimpleWrapType(dataType); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/EntityProvider1_8_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/EntityProvider1_8_R3.java index b1bdae2..c6a86e1 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/EntityProvider1_8_R3.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/EntityProvider1_8_R3.java @@ -7,9 +7,9 @@ import net.minecraft.server.v1_8_R3.World; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R3.utils.EntityConstructors1_8_R3; -import net.sourcewriters.minecraft.vcompat.reflection.EntityProvider; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; +import net.sourcewriters.minecraft.vcompat.provider.EntityProvider; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityType; public class EntityProvider1_8_R3 extends EntityProvider { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/PacketHandler1_8_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/PacketHandler1_8_R3.java index 3e43abe..392b34e 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/PacketHandler1_8_R3.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/PacketHandler1_8_R3.java @@ -1,6 +1,6 @@ package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R3; -import net.sourcewriters.minecraft.vcompat.reflection.PacketHandler; +import net.sourcewriters.minecraft.vcompat.provider.PacketHandler; public class PacketHandler1_8_R3 extends PacketHandler { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/PlayerProvider1_8_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/PlayerProvider1_8_R3.java index 549cf83..9fb94ad 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/PlayerProvider1_8_R3.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/PlayerProvider1_8_R3.java @@ -7,10 +7,10 @@ import org.bukkit.entity.Player; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R3.entity.Player1_8_R3; -import net.sourcewriters.minecraft.vcompat.reflection.DataProvider; -import net.sourcewriters.minecraft.vcompat.reflection.PlayerProvider; -import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.DataDistributor; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.provider.DataProvider; +import net.sourcewriters.minecraft.vcompat.provider.PlayerProvider; +import net.sourcewriters.minecraft.vcompat.provider.data.persistence.DataDistributor; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsPlayer; public class PlayerProvider1_8_R3 extends PlayerProvider { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/TextureProvider1_8_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/TextureProvider1_8_R3.java index b71c538..2d625de 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/TextureProvider1_8_R3.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/TextureProvider1_8_R3.java @@ -9,19 +9,19 @@ import org.bukkit.material.MaterialData; import com.mojang.authlib.GameProfile; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookup; import net.minecraft.server.v1_8_R3.GameProfileSerializer; import net.minecraft.server.v1_8_R3.ItemStack; import net.minecraft.server.v1_8_R3.NBTTagCompound; -import net.sourcewriters.minecraft.vcompat.reflection.TextureProvider; +import net.sourcewriters.minecraft.vcompat.provider.TextureProvider; @SuppressWarnings("deprecation") public class TextureProvider1_8_R3 extends TextureProvider { - private final AbstractReflect craftItemStackRef = new Reflect(CraftItemStack.class).searchField("handle", "handle"); - private final AbstractReflect craftMetaSkullRef = new Reflect("org.bukkit.craftbukkit.v1_8_R3.inventory.CraftMetaSkull") + private final ClassLookup craftItemStackRef = ClassLookup.of(CraftItemStack.class).searchField("handle", "handle"); + private final ClassLookup craftMetaSkullRef = ClassLookup.of("org.bukkit.craftbukkit.v1_8_R3.inventory.CraftMetaSkull") .searchField("serialized", "serializedProfile").searchField("profile", "profile"); private final Material skullMaterial = Material.valueOf("SKULL"); @@ -43,13 +43,13 @@ public GameProfile profileFromItem(org.bukkit.inventory.ItemStack itemStack) { return null; } SkullMeta meta = (SkullMeta) itemStack.getItemMeta(); - GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue("profile", meta); + GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue(meta, "profile"); if (profile == null) { - NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue("serialized", meta); + NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue(meta, "serialized"); if (compound == null) { ItemStack stack = null; if (itemStack instanceof CraftItemStack) { - stack = (ItemStack) craftItemStackRef.getFieldValue("handle", itemStack); + stack = (ItemStack) craftItemStackRef.getFieldValue(itemStack, "handle"); } if (stack == null) { stack = CraftItemStack.asNMSCopy(itemStack); diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/ToolProvider1_8_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/ToolProvider1_8_R3.java index 4ad4886..e98d054 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/ToolProvider1_8_R3.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/ToolProvider1_8_R3.java @@ -3,7 +3,7 @@ import net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R3.tools.BlockTools1_8_R3; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R3.tools.ServerTools1_8_R3; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R3.tools.SkinTools1_8_R3; -import net.sourcewriters.minecraft.vcompat.reflection.ToolProvider; +import net.sourcewriters.minecraft.vcompat.provider.ToolProvider; public class ToolProvider1_8_R3 extends ToolProvider { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/VersionControl1_8_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/VersionControl1_8_R3.java index 272a0e2..d5665ef 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/VersionControl1_8_R3.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/VersionControl1_8_R3.java @@ -1,8 +1,8 @@ package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R3; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R3.reflection.NmsReflection1_8_R3; -import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; +import net.sourcewriters.minecraft.vcompat.provider.VersionControl; +import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookupProvider; public class VersionControl1_8_R3 extends VersionControl { @@ -20,7 +20,7 @@ public static VersionControl1_8_R3 init() { private final BukkitConversion1_8_R3 bukkitConversion = new BukkitConversion1_8_R3(this); private VersionControl1_8_R3() { - NmsReflection1_8_R3.INSTANCE.setup(ReflectionProvider.DEFAULT); + NmsReflection1_8_R3.INSTANCE.setup(VersionCompatProvider.get().getLookupProvider()); } @Override diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/entity/ArmorStand1_8_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/entity/ArmorStand1_8_R3.java index 47dd4ad..f8ecda7 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/entity/ArmorStand1_8_R3.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/entity/ArmorStand1_8_R3.java @@ -2,7 +2,7 @@ import net.minecraft.server.v1_8_R3.EntityArmorStand; import net.minecraft.server.v1_8_R3.World; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsArmorStand; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsArmorStand; public class ArmorStand1_8_R3 extends EntityLiving1_8_R3 implements NmsArmorStand { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/entity/Entity1_8_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/entity/Entity1_8_R3.java index ed5dd42..56ce8fb 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/entity/Entity1_8_R3.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/entity/Entity1_8_R3.java @@ -20,8 +20,8 @@ import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntity; import net.minecraft.server.v1_8_R3.PlayerConnection; import net.minecraft.server.v1_8_R3.Vec3D; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.utils.NmsBoundingBox; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.provider.utils.NmsBoundingBox; public abstract class Entity1_8_R3 implements NmsEntity { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/entity/EntityLiving1_8_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/entity/EntityLiving1_8_R3.java index 8d09942..1b650ce 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/entity/EntityLiving1_8_R3.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/entity/EntityLiving1_8_R3.java @@ -1,7 +1,7 @@ package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R3.entity; import net.minecraft.server.v1_8_R3.EntityLiving; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityLiving; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityLiving; public abstract class EntityLiving1_8_R3 extends Entity1_8_R3 implements NmsEntityLiving { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/entity/Player1_8_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/entity/Player1_8_R3.java index 36cb86f..b5a6e28 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/entity/Player1_8_R3.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/entity/Player1_8_R3.java @@ -10,7 +10,7 @@ import com.mojang.authlib.GameProfile; import com.mojang.authlib.properties.Property; import com.mojang.authlib.properties.PropertyMap; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookup; import net.minecraft.server.v1_8_R3.EntityPlayer; import net.minecraft.server.v1_8_R3.IChatBaseComponent; @@ -32,17 +32,17 @@ import net.minecraft.server.v1_8_R3.PacketPlayOutRespawn; import net.minecraft.server.v1_8_R3.PacketPlayOutTitle; import net.minecraft.server.v1_8_R3.PacketPlayOutTitle.EnumTitleAction; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.PersistentContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.type.SkinDataType; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContainer; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; -import net.sourcewriters.minecraft.vcompat.utils.bukkit.Players; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.MojangProfileServer; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; -import net.sourcewriters.minecraft.vcompat.utils.thread.PostAsync; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.provider.data.persistence.PersistentContainer; +import net.sourcewriters.minecraft.vcompat.provider.data.type.SkinDataType; +import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SimpleSyntaxContainer; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookupProvider; +import net.sourcewriters.minecraft.vcompat.util.bukkit.Players; +import net.sourcewriters.minecraft.vcompat.util.minecraft.MojangProfileServer; +import net.sourcewriters.minecraft.vcompat.util.minecraft.Skin; +import net.sourcewriters.minecraft.vcompat.util.thread.PostAsync; import net.minecraft.server.v1_8_R3.PlayerConnection; import net.minecraft.server.v1_8_R3.WorldServer; @@ -151,7 +151,7 @@ private final void sendPlayerListInfo(String header, String footer) { PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter(); - Reflect reflect = ReflectionProvider.DEFAULT.getReflect("nmsPacketPlayOutPlayerListHeaderFooter"); + ClassLookup reflect = VersionCompatProvider.get().getLookupProvider().getLookup("nmsPacketPlayOutPlayerListHeaderFooter"); reflect.setFieldValue(packet, "header", headerComponent); reflect.setFieldValue(packet, "footer", footerComponent); @@ -283,7 +283,7 @@ private final void update(boolean flag) { String name = getName(); if (name != null) { - ReflectionProvider.DEFAULT.getReflect("mjGameProfile").setFieldValue(profile, "name", name); + VersionCompatProvider.get().getLookupProvider().getLookup("mjGameProfile").setFieldValue(profile, "name", name); } if (!(name == null && skin == null)) { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/reflection/NmsReflection1_8_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/reflection/NmsReflection1_8_R3.java index 2f3fc35..7921409 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/reflection/NmsReflection1_8_R3.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/reflection/NmsReflection1_8_R3.java @@ -3,17 +3,17 @@ import net.minecraft.server.v1_8_R3.NBTTagEnd; import net.minecraft.server.v1_8_R3.NBTTagList; import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerListHeaderFooter; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.Reflections; +import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookupProvider; +import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookups; -public class NmsReflection1_8_R3 extends Reflections { +public class NmsReflection1_8_R3 extends ClassLookups { public static NmsReflection1_8_R3 INSTANCE = new NmsReflection1_8_R3(); private NmsReflection1_8_R3() {} @Override - public void setup(ReflectionProvider provider) { + public void setup(ClassLookupProvider provider) { // // @@ -23,11 +23,11 @@ public void setup(ReflectionProvider provider) { // // Minecraft - provider.createReflect("nmsPacketPlayOutPlayerListHeaderFooter", PacketPlayOutPlayerListHeaderFooter.class) + provider.createLookup("nmsPacketPlayOutPlayerListHeaderFooter", PacketPlayOutPlayerListHeaderFooter.class) .searchField("header", "a").searchField("header", "b"); - provider.createReflect("nmsNBTTagEnd", NBTTagEnd.class); - provider.createReflect("nmsNBTTagList", NBTTagList.class).searchField("value", "list"); + provider.createLookup("nmsNBTTagEnd", NBTTagEnd.class); + provider.createLookup("nmsNBTTagList", NBTTagList.class).searchField("value", "list"); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/tools/BlockTools1_8_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/tools/BlockTools1_8_R3.java index 9b5f13e..b64af2d 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/tools/BlockTools1_8_R3.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/tools/BlockTools1_8_R3.java @@ -5,23 +5,23 @@ import com.mojang.authlib.properties.Property; import com.mojang.authlib.properties.PropertyMap; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookup; import net.minecraft.server.v1_8_R3.TileEntitySkull; -import net.sourcewriters.minecraft.vcompat.reflection.tools.BlockTools; -import net.sourcewriters.minecraft.vcompat.utils.constants.MinecraftConstants; +import net.sourcewriters.minecraft.vcompat.provider.tools.BlockTools; +import net.sourcewriters.minecraft.vcompat.util.constants.MinecraftConstants; public class BlockTools1_8_R3 extends BlockTools { - private final AbstractReflect craftEntityStateRef = new Reflect(CraftSkull.class).searchField("tileEntity", "tileEntity"); + private final ClassLookup craftEntityStateRef = ClassLookup.of(CraftSkull.class).searchField("tileEntity", "tileEntity"); @Override public void setHeadTexture(Block block, String texture) { if (!(block instanceof CraftSkull)) { return; } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue(block, "tileEntity"); PropertyMap map = entitySkull.getGameProfile().getProperties(); map.removeAll("textures"); map.put("textures", new Property("textures", MinecraftConstants.TEXTURE_SIGNATURE, texture)); @@ -32,7 +32,7 @@ public String getHeadTexture(Block block) { if (!(block instanceof CraftSkull)) { return null; } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue(block, "tileEntity"); return entitySkull.getGameProfile().getProperties().get("textures").iterator().next().getValue(); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/tools/ServerTools1_8_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/tools/ServerTools1_8_R3.java index b6ae36c..15e19bf 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/tools/ServerTools1_8_R3.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/tools/ServerTools1_8_R3.java @@ -4,7 +4,7 @@ import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R3.wrapper.ConsoleReaderWrapper1_8_R3; -import net.sourcewriters.minecraft.vcompat.reflection.tools.ServerTools; +import net.sourcewriters.minecraft.vcompat.provider.tools.ServerTools; public class ServerTools1_8_R3 extends ServerTools { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/tools/SkinTools1_8_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/tools/SkinTools1_8_R3.java index 3dfcadb..d6e29b5 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/tools/SkinTools1_8_R3.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/tools/SkinTools1_8_R3.java @@ -3,8 +3,8 @@ import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Player; -import net.sourcewriters.minecraft.vcompat.reflection.tools.SkinTools; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; +import net.sourcewriters.minecraft.vcompat.provider.tools.SkinTools; +import net.sourcewriters.minecraft.vcompat.util.minecraft.Skin; public class SkinTools1_8_R3 extends SkinTools { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/wrapper/ConsoleReaderWrapper1_8_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/wrapper/ConsoleReaderWrapper1_8_R3.java index f8911ed..83fa0b5 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/wrapper/ConsoleReaderWrapper1_8_R3.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/wrapper/ConsoleReaderWrapper1_8_R3.java @@ -7,7 +7,7 @@ import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; -import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; +import net.sourcewriters.minecraft.vcompat.provider.wrapper.ConsoleReaderWrapper; public final class ConsoleReaderWrapper1_8_R3 extends ConsoleReaderWrapper { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/BukkitConversion1_9_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/BukkitConversion1_9_R1.java index 5dd2308..7949754 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/BukkitConversion1_9_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/BukkitConversion1_9_R1.java @@ -6,23 +6,23 @@ import org.bukkit.craftbukkit.v1_9_R1.inventory.CraftItemStack; import org.bukkit.entity.EntityType; -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.nbt.NbtByte; -import com.syntaxphoenix.syntaxapi.nbt.NbtByteArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; -import com.syntaxphoenix.syntaxapi.nbt.NbtDouble; -import com.syntaxphoenix.syntaxapi.nbt.NbtEnd; -import com.syntaxphoenix.syntaxapi.nbt.NbtFloat; -import com.syntaxphoenix.syntaxapi.nbt.NbtInt; -import com.syntaxphoenix.syntaxapi.nbt.NbtIntArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtList; -import com.syntaxphoenix.syntaxapi.nbt.NbtLong; -import com.syntaxphoenix.syntaxapi.nbt.NbtLongArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtShort; -import com.syntaxphoenix.syntaxapi.nbt.NbtString; -import com.syntaxphoenix.syntaxapi.nbt.NbtTag; -import com.syntaxphoenix.syntaxapi.nbt.NbtType; +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterContext; +import net.sourcewriters.minecraft.vcompat.data.api.IDataType; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtByte; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtByteArray; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtCompound; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtDouble; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtEnd; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtFloat; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtInt; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtIntArray; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtList; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtLong; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtLongArray; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtShort; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtString; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtTag; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtType; import net.minecraft.server.v1_9_R1.ItemStack; import net.minecraft.server.v1_9_R1.NBTBase; @@ -38,13 +38,13 @@ import net.minecraft.server.v1_9_R1.NBTTagLong; import net.minecraft.server.v1_9_R1.NBTTagShort; import net.minecraft.server.v1_9_R1.NBTTagString; -import net.sourcewriters.minecraft.vcompat.reflection.BukkitConversion; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContext; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleWrapType; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; +import net.sourcewriters.minecraft.vcompat.provider.BukkitConversion; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SimpleSyntaxContext; +import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SimpleWrapType; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityType; +import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookupProvider; public class BukkitConversion1_9_R1 extends BukkitConversion { @@ -102,7 +102,7 @@ public NBTBase toMinecraftTag(NbtTag tag) { case COMPOUND: return toMinecraftCompound((NbtCompound) tag); case END: - return (NBTTagEnd) ReflectionProvider.DEFAULT.getReflect("nmsNBTTagEnd").init(); + return (NBTTagEnd) VersionCompatProvider.get().getLookupProvider().getLookup("nmsNBTTagEnd").init(); default: return null; } @@ -163,7 +163,7 @@ public NbtList fromMinecraftList(Object raw) { return null; } NBTTagList list = (NBTTagList) raw; - List content = (List) ReflectionProvider.DEFAULT.getReflect("nmsNBTTagList").getFieldValue("value", list); + List content = (List) VersionCompatProvider.get().getLookupProvider().getLookup("nmsNBTTagList").getFieldValue(list, "value"); NbtList output = new NbtList<>(NbtType.getById(list.getTypeId())); for (NBTBase base : content) { output.add(fromMinecraftTag(base)); @@ -219,12 +219,12 @@ public NbtCompound itemToCompound(org.bukkit.inventory.ItemStack itemStack) { } @Override - public WrappedContext createContext(DataAdapterContext context) { + public WrappedContext createContext(IDataAdapterContext context) { return new SimpleSyntaxContext(context); } @Override - public WrapType wrap(DataType dataType) { + public WrapType wrap(IDataType dataType) { return new SimpleWrapType(dataType); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/EntityProvider1_9_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/EntityProvider1_9_R1.java index 7025948..debcece 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/EntityProvider1_9_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/EntityProvider1_9_R1.java @@ -7,9 +7,9 @@ import net.minecraft.server.v1_9_R1.World; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R1.utils.EntityConstructors1_9_R1; -import net.sourcewriters.minecraft.vcompat.reflection.EntityProvider; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; +import net.sourcewriters.minecraft.vcompat.provider.EntityProvider; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityType; public class EntityProvider1_9_R1 extends EntityProvider { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/PacketHandler1_9_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/PacketHandler1_9_R1.java index 44b7c70..1d13853 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/PacketHandler1_9_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/PacketHandler1_9_R1.java @@ -1,6 +1,6 @@ package net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R1; -import net.sourcewriters.minecraft.vcompat.reflection.PacketHandler; +import net.sourcewriters.minecraft.vcompat.provider.PacketHandler; public class PacketHandler1_9_R1 extends PacketHandler { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/PlayerProvider1_9_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/PlayerProvider1_9_R1.java index b044ff4..5b7f881 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/PlayerProvider1_9_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/PlayerProvider1_9_R1.java @@ -7,10 +7,10 @@ import org.bukkit.entity.Player; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R1.entity.Player1_9_R1; -import net.sourcewriters.minecraft.vcompat.reflection.DataProvider; -import net.sourcewriters.minecraft.vcompat.reflection.PlayerProvider; -import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.DataDistributor; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.provider.DataProvider; +import net.sourcewriters.minecraft.vcompat.provider.PlayerProvider; +import net.sourcewriters.minecraft.vcompat.provider.data.persistence.DataDistributor; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsPlayer; public class PlayerProvider1_9_R1 extends PlayerProvider { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/TextureProvider1_9_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/TextureProvider1_9_R1.java index 2f106d3..37203b8 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/TextureProvider1_9_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/TextureProvider1_9_R1.java @@ -9,19 +9,19 @@ import org.bukkit.material.MaterialData; import com.mojang.authlib.GameProfile; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookup; import net.minecraft.server.v1_9_R1.GameProfileSerializer; import net.minecraft.server.v1_9_R1.ItemStack; import net.minecraft.server.v1_9_R1.NBTTagCompound; -import net.sourcewriters.minecraft.vcompat.reflection.TextureProvider; +import net.sourcewriters.minecraft.vcompat.provider.TextureProvider; @SuppressWarnings("deprecation") public class TextureProvider1_9_R1 extends TextureProvider { - private final AbstractReflect craftItemStackRef = new Reflect(CraftItemStack.class).searchField("handle", "handle"); - private final AbstractReflect craftMetaSkullRef = new Reflect("org.bukkit.craftbukkit.v1_9_R1.inventory.CraftMetaSkull") + private final ClassLookup craftItemStackRef = ClassLookup.of(CraftItemStack.class).searchField("handle", "handle"); + private final ClassLookup craftMetaSkullRef = ClassLookup.of("org.bukkit.craftbukkit.v1_9_R1.inventory.CraftMetaSkull") .searchField("serialized", "serializedProfile").searchField("profile", "profile"); private final Material skullMaterial = Material.valueOf("SKULL"); @@ -43,13 +43,13 @@ public GameProfile profileFromItem(org.bukkit.inventory.ItemStack itemStack) { return null; } SkullMeta meta = (SkullMeta) itemStack.getItemMeta(); - GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue("profile", meta); + GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue(meta, "profile"); if (profile == null) { - NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue("serialized", meta); + NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue(meta, "serialized"); if (compound == null) { ItemStack stack = null; if (itemStack instanceof CraftItemStack) { - stack = (ItemStack) craftItemStackRef.getFieldValue("handle", itemStack); + stack = (ItemStack) craftItemStackRef.getFieldValue(itemStack, "handle"); } if (stack == null) { stack = CraftItemStack.asNMSCopy(itemStack); diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/ToolProvider1_9_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/ToolProvider1_9_R1.java index f7d8979..a53241a 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/ToolProvider1_9_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/ToolProvider1_9_R1.java @@ -3,7 +3,7 @@ import net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R1.tools.BlockTools1_9_R1; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R1.tools.ServerTools1_9_R1; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R1.tools.SkinTools1_9_R1; -import net.sourcewriters.minecraft.vcompat.reflection.ToolProvider; +import net.sourcewriters.minecraft.vcompat.provider.ToolProvider; public class ToolProvider1_9_R1 extends ToolProvider { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/VersionControl1_9_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/VersionControl1_9_R1.java index bd9158e..5b588b2 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/VersionControl1_9_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/VersionControl1_9_R1.java @@ -1,8 +1,8 @@ package net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R1; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R1.reflection.NmsReflection1_9_R1; -import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; +import net.sourcewriters.minecraft.vcompat.provider.VersionControl; +import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookupProvider; public class VersionControl1_9_R1 extends VersionControl { @@ -20,7 +20,7 @@ public static VersionControl1_9_R1 init() { private final BukkitConversion1_9_R1 bukkitConversion = new BukkitConversion1_9_R1(this); private VersionControl1_9_R1() { - NmsReflection1_9_R1.INSTANCE.setup(ReflectionProvider.DEFAULT); + NmsReflection1_9_R1.INSTANCE.setup(VersionCompatProvider.get().getLookupProvider()); } @Override diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/entity/ArmorStand1_9_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/entity/ArmorStand1_9_R1.java index 3fcd382..6483dae 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/entity/ArmorStand1_9_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/entity/ArmorStand1_9_R1.java @@ -2,7 +2,7 @@ import net.minecraft.server.v1_9_R1.EntityArmorStand; import net.minecraft.server.v1_9_R1.World; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsArmorStand; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsArmorStand; public class ArmorStand1_9_R1 extends EntityLiving1_9_R1 implements NmsArmorStand { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/entity/Entity1_9_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/entity/Entity1_9_R1.java index 289fe09..885e2f2 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/entity/Entity1_9_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/entity/Entity1_9_R1.java @@ -20,8 +20,8 @@ import net.minecraft.server.v1_9_R1.PacketPlayOutSpawnEntity; import net.minecraft.server.v1_9_R1.PlayerConnection; import net.minecraft.server.v1_9_R1.Vec3D; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.utils.NmsBoundingBox; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.provider.utils.NmsBoundingBox; public abstract class Entity1_9_R1 implements NmsEntity { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/entity/EntityLiving1_9_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/entity/EntityLiving1_9_R1.java index 56214e4..a87019e 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/entity/EntityLiving1_9_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/entity/EntityLiving1_9_R1.java @@ -1,7 +1,7 @@ package net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R1.entity; import net.minecraft.server.v1_9_R1.EntityLiving; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityLiving; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityLiving; public abstract class EntityLiving1_9_R1 extends Entity1_9_R1 implements NmsEntityLiving { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/entity/Player1_9_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/entity/Player1_9_R1.java index 1975fea..665f650 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/entity/Player1_9_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/entity/Player1_9_R1.java @@ -10,7 +10,7 @@ import com.mojang.authlib.GameProfile; import com.mojang.authlib.properties.Property; import com.mojang.authlib.properties.PropertyMap; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookup; import net.minecraft.server.v1_9_R1.EntityPlayer; import net.minecraft.server.v1_9_R1.EnumItemSlot; @@ -33,17 +33,17 @@ import net.minecraft.server.v1_9_R1.PacketPlayOutRespawn; import net.minecraft.server.v1_9_R1.PacketPlayOutTitle; import net.minecraft.server.v1_9_R1.PacketPlayOutTitle.EnumTitleAction; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.PersistentContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.type.SkinDataType; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContainer; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; -import net.sourcewriters.minecraft.vcompat.utils.bukkit.Players; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.MojangProfileServer; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; -import net.sourcewriters.minecraft.vcompat.utils.thread.PostAsync; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.provider.data.persistence.PersistentContainer; +import net.sourcewriters.minecraft.vcompat.provider.data.type.SkinDataType; +import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SimpleSyntaxContainer; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookupProvider; +import net.sourcewriters.minecraft.vcompat.util.bukkit.Players; +import net.sourcewriters.minecraft.vcompat.util.minecraft.MojangProfileServer; +import net.sourcewriters.minecraft.vcompat.util.minecraft.Skin; +import net.sourcewriters.minecraft.vcompat.util.thread.PostAsync; import net.minecraft.server.v1_9_R1.PlayerConnection; import net.minecraft.server.v1_9_R1.WorldServer; @@ -152,7 +152,7 @@ private final void sendPlayerListInfo(String header, String footer) { PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter(); - Reflect reflect = ReflectionProvider.DEFAULT.getReflect("nmsPacketPlayOutPlayerListHeaderFooter"); + ClassLookup reflect = VersionCompatProvider.get().getLookupProvider().getLookup("nmsPacketPlayOutPlayerListHeaderFooter"); reflect.setFieldValue(packet, "header", headerComponent); reflect.setFieldValue(packet, "footer", footerComponent); @@ -284,7 +284,7 @@ private final void update(boolean flag) { String name = getName(); if (name != null) { - ReflectionProvider.DEFAULT.getReflect("mjGameProfile").setFieldValue(profile, "name", name); + VersionCompatProvider.get().getLookupProvider().getLookup("mjGameProfile").setFieldValue(profile, "name", name); } if (!(name == null && skin == null)) { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/reflection/NmsReflection1_9_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/reflection/NmsReflection1_9_R1.java index 3764520..ba8c1ab 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/reflection/NmsReflection1_9_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/reflection/NmsReflection1_9_R1.java @@ -3,17 +3,17 @@ import net.minecraft.server.v1_9_R1.NBTTagEnd; import net.minecraft.server.v1_9_R1.NBTTagList; import net.minecraft.server.v1_9_R1.PacketPlayOutPlayerListHeaderFooter; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.Reflections; +import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookupProvider; +import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookups; -public class NmsReflection1_9_R1 extends Reflections { +public class NmsReflection1_9_R1 extends ClassLookups { public static NmsReflection1_9_R1 INSTANCE = new NmsReflection1_9_R1(); private NmsReflection1_9_R1() {} @Override - public void setup(ReflectionProvider provider) { + public void setup(ClassLookupProvider provider) { // // @@ -23,11 +23,11 @@ public void setup(ReflectionProvider provider) { // // Minecraft - provider.createReflect("nmsPacketPlayOutPlayerListHeaderFooter", PacketPlayOutPlayerListHeaderFooter.class) + provider.createLookup("nmsPacketPlayOutPlayerListHeaderFooter", PacketPlayOutPlayerListHeaderFooter.class) .searchField("header", "a").searchField("header", "b"); - provider.createReflect("nmsNBTTagEnd", NBTTagEnd.class); - provider.createReflect("nmsNBTTagList", NBTTagList.class).searchField("value", "list"); + provider.createLookup("nmsNBTTagEnd", NBTTagEnd.class); + provider.createLookup("nmsNBTTagList", NBTTagList.class).searchField("value", "list"); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/tools/BlockTools1_9_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/tools/BlockTools1_9_R1.java index 8c49f1e..2a46bd8 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/tools/BlockTools1_9_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/tools/BlockTools1_9_R1.java @@ -5,23 +5,23 @@ import com.mojang.authlib.properties.Property; import com.mojang.authlib.properties.PropertyMap; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookup; import net.minecraft.server.v1_9_R1.TileEntitySkull; -import net.sourcewriters.minecraft.vcompat.reflection.tools.BlockTools; -import net.sourcewriters.minecraft.vcompat.utils.constants.MinecraftConstants; +import net.sourcewriters.minecraft.vcompat.provider.tools.BlockTools; +import net.sourcewriters.minecraft.vcompat.util.constants.MinecraftConstants; public class BlockTools1_9_R1 extends BlockTools { - private final AbstractReflect craftEntityStateRef = new Reflect(CraftSkull.class).searchField("tileEntity", "tileEntity"); + private final ClassLookup craftEntityStateRef = ClassLookup.of(CraftSkull.class).searchField("tileEntity", "tileEntity"); @Override public void setHeadTexture(Block block, String texture) { if (!(block instanceof CraftSkull)) { return; } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue(block, "tileEntity"); PropertyMap map = entitySkull.getGameProfile().getProperties(); map.removeAll("textures"); map.put("textures", new Property("textures", MinecraftConstants.TEXTURE_SIGNATURE, texture)); @@ -32,7 +32,7 @@ public String getHeadTexture(Block block) { if (!(block instanceof CraftSkull)) { return null; } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue(block, "tileEntity"); return entitySkull.getGameProfile().getProperties().get("textures").iterator().next().getValue(); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/tools/ServerTools1_9_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/tools/ServerTools1_9_R1.java index fd2d07e..e474e39 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/tools/ServerTools1_9_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/tools/ServerTools1_9_R1.java @@ -4,7 +4,7 @@ import org.bukkit.craftbukkit.v1_9_R1.CraftServer; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R1.wrapper.ConsoleReaderWrapper1_9_R1; -import net.sourcewriters.minecraft.vcompat.reflection.tools.ServerTools; +import net.sourcewriters.minecraft.vcompat.provider.tools.ServerTools; public class ServerTools1_9_R1 extends ServerTools { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/tools/SkinTools1_9_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/tools/SkinTools1_9_R1.java index 906c94a..aac029b 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/tools/SkinTools1_9_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/tools/SkinTools1_9_R1.java @@ -3,8 +3,8 @@ import org.bukkit.craftbukkit.v1_9_R1.entity.CraftPlayer; import org.bukkit.entity.Player; -import net.sourcewriters.minecraft.vcompat.reflection.tools.SkinTools; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; +import net.sourcewriters.minecraft.vcompat.provider.tools.SkinTools; +import net.sourcewriters.minecraft.vcompat.util.minecraft.Skin; public class SkinTools1_9_R1 extends SkinTools { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/wrapper/ConsoleReaderWrapper1_9_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/wrapper/ConsoleReaderWrapper1_9_R1.java index 75b19f3..47937f6 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/wrapper/ConsoleReaderWrapper1_9_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/wrapper/ConsoleReaderWrapper1_9_R1.java @@ -7,7 +7,7 @@ import org.bukkit.craftbukkit.v1_9_R1.CraftServer; import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; -import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; +import net.sourcewriters.minecraft.vcompat.provider.wrapper.ConsoleReaderWrapper; public final class ConsoleReaderWrapper1_9_R1 extends ConsoleReaderWrapper { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/BukkitConversion1_9_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/BukkitConversion1_9_R2.java index 5f75039..8908486 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/BukkitConversion1_9_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/BukkitConversion1_9_R2.java @@ -6,23 +6,23 @@ import org.bukkit.craftbukkit.v1_9_R2.inventory.CraftItemStack; import org.bukkit.entity.EntityType; -import com.syntaxphoenix.syntaxapi.data.DataAdapterContext; -import com.syntaxphoenix.syntaxapi.data.DataType; -import com.syntaxphoenix.syntaxapi.nbt.NbtByte; -import com.syntaxphoenix.syntaxapi.nbt.NbtByteArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtCompound; -import com.syntaxphoenix.syntaxapi.nbt.NbtDouble; -import com.syntaxphoenix.syntaxapi.nbt.NbtEnd; -import com.syntaxphoenix.syntaxapi.nbt.NbtFloat; -import com.syntaxphoenix.syntaxapi.nbt.NbtInt; -import com.syntaxphoenix.syntaxapi.nbt.NbtIntArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtList; -import com.syntaxphoenix.syntaxapi.nbt.NbtLong; -import com.syntaxphoenix.syntaxapi.nbt.NbtLongArray; -import com.syntaxphoenix.syntaxapi.nbt.NbtShort; -import com.syntaxphoenix.syntaxapi.nbt.NbtString; -import com.syntaxphoenix.syntaxapi.nbt.NbtTag; -import com.syntaxphoenix.syntaxapi.nbt.NbtType; +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterContext; +import net.sourcewriters.minecraft.vcompat.data.api.IDataType; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtByte; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtByteArray; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtCompound; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtDouble; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtEnd; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtFloat; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtInt; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtIntArray; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtList; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtLong; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtLongArray; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtShort; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtString; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtTag; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtType; import net.minecraft.server.v1_9_R2.ItemStack; import net.minecraft.server.v1_9_R2.NBTBase; @@ -38,13 +38,13 @@ import net.minecraft.server.v1_9_R2.NBTTagLong; import net.minecraft.server.v1_9_R2.NBTTagShort; import net.minecraft.server.v1_9_R2.NBTTagString; -import net.sourcewriters.minecraft.vcompat.reflection.BukkitConversion; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContext; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContext; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleWrapType; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; +import net.sourcewriters.minecraft.vcompat.provider.BukkitConversion; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SimpleSyntaxContext; +import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SimpleWrapType; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityType; +import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookupProvider; public class BukkitConversion1_9_R2 extends BukkitConversion { @@ -102,7 +102,7 @@ public NBTBase toMinecraftTag(NbtTag tag) { case COMPOUND: return toMinecraftCompound((NbtCompound) tag); case END: - return (NBTTagEnd) ReflectionProvider.DEFAULT.getReflect("nmsNBTTagEnd").init(); + return (NBTTagEnd) VersionCompatProvider.get().getLookupProvider().getLookup("nmsNBTTagEnd").init(); default: return null; } @@ -163,7 +163,7 @@ public NbtList fromMinecraftList(Object raw) { return null; } NBTTagList list = (NBTTagList) raw; - List content = (List) ReflectionProvider.DEFAULT.getReflect("nmsNBTTagList").getFieldValue("value", list); + List content = (List) VersionCompatProvider.get().getLookupProvider().getLookup("nmsNBTTagList").getFieldValue(list, "value"); NbtList output = new NbtList<>(NbtType.getById(list.getTypeId())); for (NBTBase base : content) { output.add(fromMinecraftTag(base)); @@ -219,12 +219,12 @@ public NbtCompound itemToCompound(org.bukkit.inventory.ItemStack itemStack) { } @Override - public WrappedContext createContext(DataAdapterContext context) { + public WrappedContext createContext(IDataAdapterContext context) { return new SimpleSyntaxContext(context); } @Override - public WrapType wrap(DataType dataType) { + public WrapType wrap(IDataType dataType) { return new SimpleWrapType(dataType); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/EntityProvider1_9_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/EntityProvider1_9_R2.java index a98d760..43bd86a 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/EntityProvider1_9_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/EntityProvider1_9_R2.java @@ -7,9 +7,9 @@ import net.minecraft.server.v1_9_R2.World; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R2.utils.EntityConstructors1_9_R2; -import net.sourcewriters.minecraft.vcompat.reflection.EntityProvider; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityType; +import net.sourcewriters.minecraft.vcompat.provider.EntityProvider; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityType; public class EntityProvider1_9_R2 extends EntityProvider { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/PacketHandler1_9_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/PacketHandler1_9_R2.java index adb21f7..f37bb30 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/PacketHandler1_9_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/PacketHandler1_9_R2.java @@ -1,6 +1,6 @@ package net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R2; -import net.sourcewriters.minecraft.vcompat.reflection.PacketHandler; +import net.sourcewriters.minecraft.vcompat.provider.PacketHandler; public class PacketHandler1_9_R2 extends PacketHandler { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/PlayerProvider1_9_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/PlayerProvider1_9_R2.java index ae61347..f694240 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/PlayerProvider1_9_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/PlayerProvider1_9_R2.java @@ -7,10 +7,10 @@ import org.bukkit.entity.Player; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R2.entity.Player1_9_R2; -import net.sourcewriters.minecraft.vcompat.reflection.DataProvider; -import net.sourcewriters.minecraft.vcompat.reflection.PlayerProvider; -import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.DataDistributor; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.provider.DataProvider; +import net.sourcewriters.minecraft.vcompat.provider.PlayerProvider; +import net.sourcewriters.minecraft.vcompat.provider.data.persistence.DataDistributor; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsPlayer; public class PlayerProvider1_9_R2 extends PlayerProvider { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/TextureProvider1_9_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/TextureProvider1_9_R2.java index 34d8646..4292f91 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/TextureProvider1_9_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/TextureProvider1_9_R2.java @@ -9,19 +9,19 @@ import org.bukkit.material.MaterialData; import com.mojang.authlib.GameProfile; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookup; import net.minecraft.server.v1_9_R2.GameProfileSerializer; import net.minecraft.server.v1_9_R2.ItemStack; import net.minecraft.server.v1_9_R2.NBTTagCompound; -import net.sourcewriters.minecraft.vcompat.reflection.TextureProvider; +import net.sourcewriters.minecraft.vcompat.provider.TextureProvider; @SuppressWarnings("deprecation") public class TextureProvider1_9_R2 extends TextureProvider { - private final AbstractReflect craftItemStackRef = new Reflect(CraftItemStack.class).searchField("handle", "handle"); - private final AbstractReflect craftMetaSkullRef = new Reflect("org.bukkit.craftbukkit.v1_9_R2.inventory.CraftMetaSkull") + private final ClassLookup craftItemStackRef = ClassLookup.of(CraftItemStack.class).searchField("handle", "handle"); + private final ClassLookup craftMetaSkullRef = ClassLookup.of("org.bukkit.craftbukkit.v1_9_R2.inventory.CraftMetaSkull") .searchField("serialized", "serializedProfile").searchField("profile", "profile"); private final Material skullMaterial = Material.valueOf("SKULL"); @@ -43,13 +43,13 @@ public GameProfile profileFromItem(org.bukkit.inventory.ItemStack itemStack) { return null; } SkullMeta meta = (SkullMeta) itemStack.getItemMeta(); - GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue("profile", meta); + GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue(meta, "profile"); if (profile == null) { - NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue("serialized", meta); + NBTTagCompound compound = (NBTTagCompound) craftMetaSkullRef.getFieldValue(meta, "serialized"); if (compound == null) { ItemStack stack = null; if (itemStack instanceof CraftItemStack) { - stack = (ItemStack) craftItemStackRef.getFieldValue("handle", itemStack); + stack = (ItemStack) craftItemStackRef.getFieldValue(itemStack, "handle"); } if (stack == null) { stack = CraftItemStack.asNMSCopy(itemStack); diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/ToolProvider1_9_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/ToolProvider1_9_R2.java index 7cdbd5f..026d98e 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/ToolProvider1_9_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/ToolProvider1_9_R2.java @@ -3,7 +3,7 @@ import net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R2.tools.BlockTools1_9_R2; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R2.tools.ServerTools1_9_R2; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R2.tools.SkinTools1_9_R2; -import net.sourcewriters.minecraft.vcompat.reflection.ToolProvider; +import net.sourcewriters.minecraft.vcompat.provider.ToolProvider; public class ToolProvider1_9_R2 extends ToolProvider { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/VersionControl1_9_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/VersionControl1_9_R2.java index 61cf059..fd297ac 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/VersionControl1_9_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/VersionControl1_9_R2.java @@ -1,8 +1,8 @@ package net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R2; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R2.reflection.NmsReflection1_9_R2; -import net.sourcewriters.minecraft.vcompat.reflection.VersionControl; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; +import net.sourcewriters.minecraft.vcompat.provider.VersionControl; +import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookupProvider; public class VersionControl1_9_R2 extends VersionControl { @@ -20,7 +20,7 @@ public static VersionControl1_9_R2 init() { private final BukkitConversion1_9_R2 bukkitConversion = new BukkitConversion1_9_R2(this); private VersionControl1_9_R2() { - NmsReflection1_9_R2.INSTANCE.setup(ReflectionProvider.DEFAULT); + NmsReflection1_9_R2.INSTANCE.setup(VersionCompatProvider.get().getLookupProvider()); } @Override diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/entity/ArmorStand1_9_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/entity/ArmorStand1_9_R2.java index ef1d103..adf88c3 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/entity/ArmorStand1_9_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/entity/ArmorStand1_9_R2.java @@ -2,7 +2,7 @@ import net.minecraft.server.v1_9_R2.EntityArmorStand; import net.minecraft.server.v1_9_R2.World; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsArmorStand; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsArmorStand; public class ArmorStand1_9_R2 extends EntityLiving1_9_R2 implements NmsArmorStand { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/entity/Entity1_9_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/entity/Entity1_9_R2.java index 4b0e715..af5332f 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/entity/Entity1_9_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/entity/Entity1_9_R2.java @@ -20,8 +20,8 @@ import net.minecraft.server.v1_9_R2.PacketPlayOutSpawnEntity; import net.minecraft.server.v1_9_R2.PlayerConnection; import net.minecraft.server.v1_9_R2.Vec3D; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntity; -import net.sourcewriters.minecraft.vcompat.reflection.utils.NmsBoundingBox; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.provider.utils.NmsBoundingBox; public abstract class Entity1_9_R2 implements NmsEntity { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/entity/EntityLiving1_9_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/entity/EntityLiving1_9_R2.java index 108ce63..e1c2164 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/entity/EntityLiving1_9_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/entity/EntityLiving1_9_R2.java @@ -1,7 +1,7 @@ package net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R2.entity; import net.minecraft.server.v1_9_R2.EntityLiving; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsEntityLiving; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityLiving; public abstract class EntityLiving1_9_R2 extends Entity1_9_R2 implements NmsEntityLiving { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/entity/Player1_9_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/entity/Player1_9_R2.java index 8af125c..84d5ad2 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/entity/Player1_9_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/entity/Player1_9_R2.java @@ -10,7 +10,7 @@ import com.mojang.authlib.GameProfile; import com.mojang.authlib.properties.Property; import com.mojang.authlib.properties.PropertyMap; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookup; import net.minecraft.server.v1_9_R2.EntityPlayer; import net.minecraft.server.v1_9_R2.EnumItemSlot; @@ -33,17 +33,17 @@ import net.minecraft.server.v1_9_R2.PacketPlayOutRespawn; import net.minecraft.server.v1_9_R2.PacketPlayOutTitle; import net.minecraft.server.v1_9_R2.PacketPlayOutTitle.EnumTitleAction; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrapType; -import net.sourcewriters.minecraft.vcompat.reflection.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.PersistentContainer; -import net.sourcewriters.minecraft.vcompat.reflection.data.type.SkinDataType; -import net.sourcewriters.minecraft.vcompat.reflection.data.wrap.SimpleSyntaxContainer; -import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; -import net.sourcewriters.minecraft.vcompat.utils.bukkit.Players; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.MojangProfileServer; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; -import net.sourcewriters.minecraft.vcompat.utils.thread.PostAsync; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.provider.data.persistence.PersistentContainer; +import net.sourcewriters.minecraft.vcompat.provider.data.type.SkinDataType; +import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SimpleSyntaxContainer; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookupProvider; +import net.sourcewriters.minecraft.vcompat.util.bukkit.Players; +import net.sourcewriters.minecraft.vcompat.util.minecraft.MojangProfileServer; +import net.sourcewriters.minecraft.vcompat.util.minecraft.Skin; +import net.sourcewriters.minecraft.vcompat.util.thread.PostAsync; import net.minecraft.server.v1_9_R2.PlayerConnection; import net.minecraft.server.v1_9_R2.WorldServer; @@ -152,7 +152,7 @@ private final void sendPlayerListInfo(String header, String footer) { PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter(); - Reflect reflect = ReflectionProvider.DEFAULT.getReflect("nmsPacketPlayOutPlayerListHeaderFooter"); + ClassLookup reflect = VersionCompatProvider.get().getLookupProvider().getLookup("nmsPacketPlayOutPlayerListHeaderFooter"); reflect.setFieldValue(packet, "header", headerComponent); reflect.setFieldValue(packet, "footer", footerComponent); @@ -284,7 +284,7 @@ private final void update(boolean flag) { String name = getName(); if (name != null) { - ReflectionProvider.DEFAULT.getReflect("mjGameProfile").setFieldValue(profile, "name", name); + VersionCompatProvider.get().getLookupProvider().getLookup("mjGameProfile").setFieldValue(profile, "name", name); } if (!(name == null && skin == null)) { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/reflection/NmsReflection1_9_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/reflection/NmsReflection1_9_R2.java index 0b3cce9..5ad9a82 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/reflection/NmsReflection1_9_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/reflection/NmsReflection1_9_R2.java @@ -3,17 +3,17 @@ import net.minecraft.server.v1_9_R2.NBTTagEnd; import net.minecraft.server.v1_9_R2.NBTTagList; import net.minecraft.server.v1_9_R2.PacketPlayOutPlayerListHeaderFooter; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.ReflectionProvider; -import net.sourcewriters.minecraft.vcompat.reflection.reflect.Reflections; +import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookupProvider; +import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookups; -public class NmsReflection1_9_R2 extends Reflections { +public class NmsReflection1_9_R2 extends ClassLookups { public static NmsReflection1_9_R2 INSTANCE = new NmsReflection1_9_R2(); private NmsReflection1_9_R2() {} @Override - public void setup(ReflectionProvider provider) { + public void setup(ClassLookupProvider provider) { // // @@ -23,11 +23,11 @@ public void setup(ReflectionProvider provider) { // // Minecraft - provider.createReflect("nmsPacketPlayOutPlayerListHeaderFooter", PacketPlayOutPlayerListHeaderFooter.class) + provider.createLookup("nmsPacketPlayOutPlayerListHeaderFooter", PacketPlayOutPlayerListHeaderFooter.class) .searchField("header", "a").searchField("header", "b"); - provider.createReflect("nmsNBTTagEnd", NBTTagEnd.class); - provider.createReflect("nmsNBTTagList", NBTTagList.class).searchField("value", "list"); + provider.createLookup("nmsNBTTagEnd", NBTTagEnd.class); + provider.createLookup("nmsNBTTagList", NBTTagList.class).searchField("value", "list"); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/tools/BlockTools1_9_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/tools/BlockTools1_9_R2.java index 33cf32a..2a27a5a 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/tools/BlockTools1_9_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/tools/BlockTools1_9_R2.java @@ -5,23 +5,23 @@ import com.mojang.authlib.properties.Property; import com.mojang.authlib.properties.PropertyMap; -import com.syntaxphoenix.syntaxapi.reflection.AbstractReflect; -import com.syntaxphoenix.syntaxapi.reflection.Reflect; + +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookup; import net.minecraft.server.v1_9_R2.TileEntitySkull; -import net.sourcewriters.minecraft.vcompat.reflection.tools.BlockTools; -import net.sourcewriters.minecraft.vcompat.utils.constants.MinecraftConstants; +import net.sourcewriters.minecraft.vcompat.provider.tools.BlockTools; +import net.sourcewriters.minecraft.vcompat.util.constants.MinecraftConstants; public class BlockTools1_9_R2 extends BlockTools { - private final AbstractReflect craftEntityStateRef = new Reflect(CraftSkull.class).searchField("tileEntity", "tileEntity"); + private final ClassLookup craftEntityStateRef = ClassLookup.of(CraftSkull.class).searchField("tileEntity", "tileEntity"); @Override public void setHeadTexture(Block block, String texture) { if (!(block instanceof CraftSkull)) { return; } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue(block, "tileEntity"); PropertyMap map = entitySkull.getGameProfile().getProperties(); map.removeAll("textures"); map.put("textures", new Property("textures", MinecraftConstants.TEXTURE_SIGNATURE, texture)); @@ -32,7 +32,7 @@ public String getHeadTexture(Block block) { if (!(block instanceof CraftSkull)) { return null; } - TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue("tileEntity", block); + TileEntitySkull entitySkull = (TileEntitySkull) craftEntityStateRef.getFieldValue(block, "tileEntity"); return entitySkull.getGameProfile().getProperties().get("textures").iterator().next().getValue(); } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/tools/ServerTools1_9_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/tools/ServerTools1_9_R2.java index ed5e573..b0a32f1 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/tools/ServerTools1_9_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/tools/ServerTools1_9_R2.java @@ -4,7 +4,7 @@ import org.bukkit.craftbukkit.v1_9_R2.CraftServer; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R2.wrapper.ConsoleReaderWrapper1_9_R2; -import net.sourcewriters.minecraft.vcompat.reflection.tools.ServerTools; +import net.sourcewriters.minecraft.vcompat.provider.tools.ServerTools; public class ServerTools1_9_R2 extends ServerTools { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/tools/SkinTools1_9_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/tools/SkinTools1_9_R2.java index 9bb3700..aa92c0d 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/tools/SkinTools1_9_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/tools/SkinTools1_9_R2.java @@ -3,8 +3,8 @@ import org.bukkit.craftbukkit.v1_9_R2.entity.CraftPlayer; import org.bukkit.entity.Player; -import net.sourcewriters.minecraft.vcompat.reflection.tools.SkinTools; -import net.sourcewriters.minecraft.vcompat.utils.minecraft.Skin; +import net.sourcewriters.minecraft.vcompat.provider.tools.SkinTools; +import net.sourcewriters.minecraft.vcompat.util.minecraft.Skin; public class SkinTools1_9_R2 extends SkinTools { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/wrapper/ConsoleReaderWrapper1_9_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/wrapper/ConsoleReaderWrapper1_9_R2.java index 167bc2a..2c83673 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/wrapper/ConsoleReaderWrapper1_9_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/wrapper/ConsoleReaderWrapper1_9_R2.java @@ -7,7 +7,7 @@ import org.bukkit.craftbukkit.v1_9_R2.CraftServer; import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; -import net.sourcewriters.minecraft.vcompat.reflection.wrapper.ConsoleReaderWrapper; +import net.sourcewriters.minecraft.vcompat.provider.wrapper.ConsoleReaderWrapper; public final class ConsoleReaderWrapper1_9_R2 extends ConsoleReaderWrapper { From dcd52ec5db5ab12353e1ac043f2e61b0e274d426 Mon Sep 17 00:00:00 2001 From: Lauriichan Date: Wed, 19 Jan 2022 16:05:48 +0100 Subject: [PATCH 32/47] Fully implemented 1_8_R1 - 1_16_R3 support again --- vcompat-core/pom.xml | 6 ++++++ .../provider/impl/v1_14_R1/PacketHandler1_14_R1.java | 11 ----------- .../provider/impl/v1_14_R1/VersionControl1_14_R1.java | 6 ------ .../impl/v1_14_R1/data/BukkitContainer1_14_R1.java | 2 +- .../impl/v1_14_R1/data/BukkitContext1_14_R1.java | 6 +++--- .../impl/v1_14_R1/data/SyntaxContainer1_14_R1.java | 7 +++++++ .../data/hook/BukkitContainerAdapterHook1_14_R1.java | 1 + .../provider/impl/v1_14_R1/entity/Player1_14_R1.java | 2 +- .../impl/v1_14_R1/tools/ServerTools1_14_R1.java | 1 - .../v1_14_R1/wrapper/ConsoleReaderWrapper1_14_R1.java | 6 ++++++ .../provider/impl/v1_15_R1/PacketHandler1_15_R1.java | 11 ----------- .../provider/impl/v1_15_R1/VersionControl1_15_R1.java | 6 ------ .../impl/v1_15_R1/data/BukkitContainer1_15_R1.java | 2 +- .../impl/v1_15_R1/data/BukkitContext1_15_R1.java | 6 +++--- .../impl/v1_15_R1/data/SyntaxContainer1_15_R1.java | 7 +++++++ .../data/hook/BukkitContainerAdapterHook1_15_R1.java | 1 + .../provider/impl/v1_15_R1/entity/Player1_15_R1.java | 2 +- .../impl/v1_15_R1/tools/ServerTools1_15_R1.java | 1 - .../v1_15_R1/wrapper/ConsoleReaderWrapper1_15_R1.java | 6 ++++++ .../provider/impl/v1_16_R1/PacketHandler1_16_R1.java | 11 ----------- .../provider/impl/v1_16_R1/VersionControl1_16_R1.java | 6 ------ .../impl/v1_16_R1/data/BukkitContainer1_16_R1.java | 2 +- .../impl/v1_16_R1/data/BukkitContext1_16_R1.java | 6 +++--- .../impl/v1_16_R1/data/SyntaxContainer1_16_R1.java | 7 +++++++ .../data/hook/BukkitContainerAdapterHook1_16_R1.java | 1 + .../provider/impl/v1_16_R1/entity/Player1_16_R1.java | 2 +- .../impl/v1_16_R1/tools/ServerTools1_16_R1.java | 1 - .../v1_16_R1/wrapper/ConsoleReaderWrapper1_16_R1.java | 6 ++++++ .../provider/impl/v1_16_R2/PacketHandler1_16_R2.java | 11 ----------- .../provider/impl/v1_16_R2/VersionControl1_16_R2.java | 6 ------ .../impl/v1_16_R2/data/BukkitContainer1_16_R2.java | 2 +- .../impl/v1_16_R2/data/BukkitContext1_16_R2.java | 6 +++--- .../impl/v1_16_R2/data/SyntaxContainer1_16_R2.java | 7 +++++++ .../provider/impl/v1_16_R2/entity/Player1_16_R2.java | 1 - .../impl/v1_16_R2/tools/ServerTools1_16_R2.java | 1 - .../v1_16_R2/wrapper/ConsoleReaderWrapper1_16_R2.java | 6 ++++++ .../provider/impl/v1_16_R3/PacketHandler1_16_R3.java | 11 ----------- .../provider/impl/v1_16_R3/VersionControl1_16_R3.java | 6 ------ .../impl/v1_16_R3/data/BukkitContainer1_16_R3.java | 2 +- .../impl/v1_16_R3/data/BukkitContext1_16_R3.java | 6 +++--- .../impl/v1_16_R3/data/SyntaxContainer1_16_R3.java | 7 +++++++ .../data/hook/BukkitContainerAdapterHook1_16_R3.java | 1 + .../provider/impl/v1_16_R3/entity/Player1_16_R3.java | 2 +- .../impl/v1_16_R3/tools/ServerTools1_16_R3.java | 1 - .../v1_16_R3/wrapper/ConsoleReaderWrapper1_16_R3.java | 6 ++++++ .../provider/impl/v1_8_R1/BukkitConversion1_8_R1.java | 2 +- .../provider/impl/v1_8_R1/PacketHandler1_8_R1.java | 11 ----------- .../provider/impl/v1_8_R1/VersionControl1_8_R1.java | 8 +------- .../provider/impl/v1_8_R1/entity/Player1_8_R1.java | 2 +- .../v1_8_R1/wrapper/ConsoleReaderWrapper1_8_R1.java | 7 ++++++- .../provider/impl/v1_8_R2/BukkitConversion1_8_R2.java | 2 +- .../provider/impl/v1_8_R2/PacketHandler1_8_R2.java | 11 ----------- .../provider/impl/v1_8_R2/VersionControl1_8_R2.java | 8 +------- .../provider/impl/v1_8_R2/entity/Player1_8_R2.java | 2 +- .../v1_8_R2/wrapper/ConsoleReaderWrapper1_8_R2.java | 7 ++++++- .../provider/impl/v1_8_R3/BukkitConversion1_8_R3.java | 2 +- .../provider/impl/v1_8_R3/PacketHandler1_8_R3.java | 11 ----------- .../provider/impl/v1_8_R3/VersionControl1_8_R3.java | 8 +------- .../provider/impl/v1_8_R3/entity/Player1_8_R3.java | 2 +- .../v1_8_R3/wrapper/ConsoleReaderWrapper1_8_R3.java | 7 ++++++- .../provider/impl/v1_9_R1/BukkitConversion1_9_R1.java | 2 +- .../provider/impl/v1_9_R1/PacketHandler1_9_R1.java | 11 ----------- .../provider/impl/v1_9_R1/VersionControl1_9_R1.java | 8 +------- .../provider/impl/v1_9_R1/entity/Player1_9_R1.java | 2 +- .../v1_9_R1/wrapper/ConsoleReaderWrapper1_9_R1.java | 7 ++++++- .../provider/impl/v1_9_R2/BukkitConversion1_9_R2.java | 2 +- .../provider/impl/v1_9_R2/PacketHandler1_9_R2.java | 11 ----------- .../provider/impl/v1_9_R2/VersionControl1_9_R2.java | 8 +------- .../provider/impl/v1_9_R2/entity/Player1_9_R2.java | 2 +- .../v1_9_R2/wrapper/ConsoleReaderWrapper1_9_R2.java | 7 ++++++- 70 files changed, 144 insertions(+), 220 deletions(-) delete mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/PacketHandler1_14_R1.java delete mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/PacketHandler1_15_R1.java delete mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/PacketHandler1_16_R1.java delete mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/PacketHandler1_16_R2.java delete mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/PacketHandler1_16_R3.java delete mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/PacketHandler1_8_R1.java delete mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/PacketHandler1_8_R2.java delete mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/PacketHandler1_8_R3.java delete mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/PacketHandler1_9_R1.java delete mode 100644 vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/PacketHandler1_9_R2.java diff --git a/vcompat-core/pom.xml b/vcompat-core/pom.xml index 8a7e1e1..5921abf 100644 --- a/vcompat-core/pom.xml +++ b/vcompat-core/pom.xml @@ -14,6 +14,12 @@ vcompat-api ${project.parent.version} + + + ${project.parent.groupId} + vcompat-legacy + ${project.parent.version} + diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/PacketHandler1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/PacketHandler1_14_R1.java deleted file mode 100644 index a35b3df..0000000 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/PacketHandler1_14_R1.java +++ /dev/null @@ -1,11 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1; - -import net.sourcewriters.minecraft.vcompat.provider.PacketHandler; - -public class PacketHandler1_14_R1 extends PacketHandler { - - protected PacketHandler1_14_R1(VersionControl1_14_R1 versionControl) { - super(versionControl); - } - -} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/VersionControl1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/VersionControl1_14_R1.java index 8e37265..f097f6c 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/VersionControl1_14_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/VersionControl1_14_R1.java @@ -13,7 +13,6 @@ public static VersionControl1_14_R1 init() { private final ToolProvider1_14_R1 toolProvider = new ToolProvider1_14_R1(this); private final TextureProvider1_14_R1 textureProvider = new TextureProvider1_14_R1(this); - private final PacketHandler1_14_R1 packetHandler = new PacketHandler1_14_R1(this); private final EntityProvider1_14_R1 entityProvider = new EntityProvider1_14_R1(this); private final PlayerProvider1_14_R1 playerProvider = new PlayerProvider1_14_R1(this); private final BukkitConversion1_14_R1 bukkitConversion = new BukkitConversion1_14_R1(this); @@ -42,11 +41,6 @@ public TextureProvider1_14_R1 getTextureProvider() { return textureProvider; } - @Override - public PacketHandler1_14_R1 getPacketHandler() { - return packetHandler; - } - @Override public BukkitConversion1_14_R1 getBukkitConversion() { return bukkitConversion; diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/BukkitContainer1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/BukkitContainer1_14_R1.java index 499b864..25a915c 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/BukkitContainer1_14_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/BukkitContainer1_14_R1.java @@ -79,7 +79,7 @@ public PersistentDataAdapterContext getAdapterContext() { @Override public BukkitContext1_14_R1 getWrapContext() { - return new BukkitContext1_14_R1(container.getAdapterContext()); + return new BukkitContext1_14_R1(container.getContext()); } @Override diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/BukkitContext1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/BukkitContext1_14_R1.java index c7cccc9..d5195f4 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/BukkitContext1_14_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/BukkitContext1_14_R1.java @@ -23,17 +23,17 @@ public IDataAdapterContext getHandle() { @Override public PersistentDataContainer newPersistentDataContainer() { - return newContainer(); + return newWrapContainer(); } @Override public IDataContainer newContainer() { - return context.newDataContainer(); + return context.newContainer(); } @Override public BukkitContainer1_14_R1 newWrapContainer() { - return new BukkitContainer1_14_R1(context.newDataContainer()); + return new BukkitContainer1_14_R1(context.newContainer()); } } \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/SyntaxContainer1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/SyntaxContainer1_14_R1.java index 28bab7b..43a2e17 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/SyntaxContainer1_14_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/SyntaxContainer1_14_R1.java @@ -5,7 +5,9 @@ import org.bukkit.persistence.PersistentDataContainer; +import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterContext; +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterRegistry; import net.sourcewriters.minecraft.vcompat.data.api.IDataType; import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.utils.key.IKey; @@ -32,6 +34,11 @@ public PersistentDataContainer getHandle() { public IDataContainer getAsSyntaxContainer() { return new SyntaxContainer1_14_R1(container); } + + @Override + public IDataAdapterRegistry getRegistry() { + return VersionCompatProvider.get().getControl().getDataProvider().getRegistry(); + } /* * diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/hook/BukkitContainerAdapterHook1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/hook/BukkitContainerAdapterHook1_14_R1.java index 43bcb0a..5541f61 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/hook/BukkitContainerAdapterHook1_14_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/data/hook/BukkitContainerAdapterHook1_14_R1.java @@ -10,6 +10,7 @@ import org.bukkit.craftbukkit.v1_14_R1.persistence.CraftPersistentDataTypeRegistry; import org.bukkit.persistence.PersistentDataContainer; +import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; import net.sourcewriters.minecraft.vcompat.data.nbt.NbtContainer; import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtCompound; diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/entity/Player1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/entity/Player1_14_R1.java index 31333f3..91255bd 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/entity/Player1_14_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/entity/Player1_14_R1.java @@ -32,11 +32,11 @@ import net.minecraft.server.v1_14_R1.PacketPlayOutTitle; import net.minecraft.server.v1_14_R1.PacketPlayOutTitle.EnumTitleAction; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_14_R1.data.SyntaxContainer1_14_R1; +import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContainer; import net.sourcewriters.minecraft.vcompat.provider.data.type.SkinDataType; import net.sourcewriters.minecraft.vcompat.provider.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookupProvider; import net.sourcewriters.minecraft.vcompat.util.bukkit.Players; import net.sourcewriters.minecraft.vcompat.util.minecraft.MojangProfileServer; import net.sourcewriters.minecraft.vcompat.util.minecraft.Skin; diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/tools/ServerTools1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/tools/ServerTools1_14_R1.java index a8a7e0a..4bfa15e 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/tools/ServerTools1_14_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/tools/ServerTools1_14_R1.java @@ -18,7 +18,6 @@ public String getMotd() { return ((CraftServer) Bukkit.getServer()).getServer().getMotd(); } - @SuppressWarnings("resource") @Override public ConsoleReaderWrapper1_14_R1 getConsole() { return ConsoleReaderWrapper1_14_R1.INSTANCE; diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/wrapper/ConsoleReaderWrapper1_14_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/wrapper/ConsoleReaderWrapper1_14_R1.java index 185611f..5ae6514 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/wrapper/ConsoleReaderWrapper1_14_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_14_R1/wrapper/ConsoleReaderWrapper1_14_R1.java @@ -5,6 +5,7 @@ import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_14_R1.CraftServer; +import org.bukkit.craftbukkit.Main; import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; import net.sourcewriters.minecraft.vcompat.provider.wrapper.ConsoleReaderWrapper; @@ -40,4 +41,9 @@ public void drawLine() throws IOException { reader.drawLine(); } + @Override + public boolean isJLineSupported() { + return Main.useJline; + } + } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/PacketHandler1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/PacketHandler1_15_R1.java deleted file mode 100644 index 8489885..0000000 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/PacketHandler1_15_R1.java +++ /dev/null @@ -1,11 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1; - -import net.sourcewriters.minecraft.vcompat.provider.PacketHandler; - -public class PacketHandler1_15_R1 extends PacketHandler { - - protected PacketHandler1_15_R1(VersionControl1_15_R1 versionControl) { - super(versionControl); - } - -} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/VersionControl1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/VersionControl1_15_R1.java index 17a06b8..60299ae 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/VersionControl1_15_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/VersionControl1_15_R1.java @@ -13,7 +13,6 @@ public static VersionControl1_15_R1 init() { private final ToolProvider1_15_R1 toolProvider = new ToolProvider1_15_R1(this); private final TextureProvider1_15_R1 textureProvider = new TextureProvider1_15_R1(this); - private final PacketHandler1_15_R1 packetHandler = new PacketHandler1_15_R1(this); private final EntityProvider1_15_R1 entityProvider = new EntityProvider1_15_R1(this); private final PlayerProvider1_15_R1 playerProvider = new PlayerProvider1_15_R1(this); private final BukkitConversion1_15_R1 bukkitConversion = new BukkitConversion1_15_R1(this); @@ -42,11 +41,6 @@ public TextureProvider1_15_R1 getTextureProvider() { return textureProvider; } - @Override - public PacketHandler1_15_R1 getPacketHandler() { - return packetHandler; - } - @Override public BukkitConversion1_15_R1 getBukkitConversion() { return bukkitConversion; diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/BukkitContainer1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/BukkitContainer1_15_R1.java index 615fee6..b06a248 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/BukkitContainer1_15_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/BukkitContainer1_15_R1.java @@ -79,7 +79,7 @@ public PersistentDataAdapterContext getAdapterContext() { @Override public BukkitContext1_15_R1 getWrapContext() { - return new BukkitContext1_15_R1(container.getAdapterContext()); + return new BukkitContext1_15_R1(container.getContext()); } @Override diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/BukkitContext1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/BukkitContext1_15_R1.java index 7bc8369..adf112c 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/BukkitContext1_15_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/BukkitContext1_15_R1.java @@ -23,17 +23,17 @@ public IDataAdapterContext getHandle() { @Override public PersistentDataContainer newPersistentDataContainer() { - return newContainer(); + return newWrapContainer(); } @Override public IDataContainer newContainer() { - return context.newDataContainer(); + return context.newContainer(); } @Override public BukkitContainer1_15_R1 newWrapContainer() { - return new BukkitContainer1_15_R1(context.newDataContainer()); + return new BukkitContainer1_15_R1(context.newContainer()); } } \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/SyntaxContainer1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/SyntaxContainer1_15_R1.java index f7e6b89..8a43ede 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/SyntaxContainer1_15_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/SyntaxContainer1_15_R1.java @@ -5,7 +5,9 @@ import org.bukkit.persistence.PersistentDataContainer; +import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterContext; +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterRegistry; import net.sourcewriters.minecraft.vcompat.data.api.IDataType; import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.utils.key.IKey; @@ -32,6 +34,11 @@ public PersistentDataContainer getHandle() { public IDataContainer getAsSyntaxContainer() { return new SyntaxContainer1_15_R1(container); } + + @Override + public IDataAdapterRegistry getRegistry() { + return VersionCompatProvider.get().getControl().getDataProvider().getRegistry(); + } /* * diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/hook/BukkitContainerAdapterHook1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/hook/BukkitContainerAdapterHook1_15_R1.java index dfa1462..236deb4 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/hook/BukkitContainerAdapterHook1_15_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/data/hook/BukkitContainerAdapterHook1_15_R1.java @@ -10,6 +10,7 @@ import org.bukkit.craftbukkit.v1_15_R1.persistence.CraftPersistentDataTypeRegistry; import org.bukkit.persistence.PersistentDataContainer; +import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; import net.sourcewriters.minecraft.vcompat.data.nbt.NbtContainer; import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtCompound; diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/entity/Player1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/entity/Player1_15_R1.java index 38cae4f..7b9e9f4 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/entity/Player1_15_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/entity/Player1_15_R1.java @@ -32,11 +32,11 @@ import net.minecraft.server.v1_15_R1.PacketPlayOutTitle; import net.minecraft.server.v1_15_R1.PacketPlayOutTitle.EnumTitleAction; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_15_R1.data.SyntaxContainer1_15_R1; +import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContainer; import net.sourcewriters.minecraft.vcompat.provider.data.type.SkinDataType; import net.sourcewriters.minecraft.vcompat.provider.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookupProvider; import net.sourcewriters.minecraft.vcompat.util.bukkit.Players; import net.sourcewriters.minecraft.vcompat.util.minecraft.MojangProfileServer; import net.sourcewriters.minecraft.vcompat.util.minecraft.Skin; diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/tools/ServerTools1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/tools/ServerTools1_15_R1.java index b6faa6a..1c9c05e 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/tools/ServerTools1_15_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/tools/ServerTools1_15_R1.java @@ -18,7 +18,6 @@ public String getMotd() { return ((CraftServer) Bukkit.getServer()).getServer().getMotd(); } - @SuppressWarnings("resource") @Override public ConsoleReaderWrapper1_15_R1 getConsole() { return ConsoleReaderWrapper1_15_R1.INSTANCE; diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/wrapper/ConsoleReaderWrapper1_15_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/wrapper/ConsoleReaderWrapper1_15_R1.java index 7c725d8..d941580 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/wrapper/ConsoleReaderWrapper1_15_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_15_R1/wrapper/ConsoleReaderWrapper1_15_R1.java @@ -5,6 +5,7 @@ import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; +import org.bukkit.craftbukkit.Main; import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; import net.sourcewriters.minecraft.vcompat.provider.wrapper.ConsoleReaderWrapper; @@ -40,4 +41,9 @@ public void drawLine() throws IOException { reader.drawLine(); } + @Override + public boolean isJLineSupported() { + return Main.useJline; + } + } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/PacketHandler1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/PacketHandler1_16_R1.java deleted file mode 100644 index ce86b23..0000000 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/PacketHandler1_16_R1.java +++ /dev/null @@ -1,11 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1; - -import net.sourcewriters.minecraft.vcompat.provider.PacketHandler; - -public class PacketHandler1_16_R1 extends PacketHandler { - - protected PacketHandler1_16_R1(VersionControl1_16_R1 versionControl) { - super(versionControl); - } - -} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/VersionControl1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/VersionControl1_16_R1.java index b9bdcfd..f5e434a 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/VersionControl1_16_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/VersionControl1_16_R1.java @@ -13,7 +13,6 @@ public static VersionControl1_16_R1 init() { private final ToolProvider1_16_R1 toolProvider = new ToolProvider1_16_R1(this); private final TextureProvider1_16_R1 textureProvider = new TextureProvider1_16_R1(this); - private final PacketHandler1_16_R1 packetHandler = new PacketHandler1_16_R1(this); private final EntityProvider1_16_R1 entityProvider = new EntityProvider1_16_R1(this); private final PlayerProvider1_16_R1 playerProvider = new PlayerProvider1_16_R1(this); private final BukkitConversion1_16_R1 bukkitConversion = new BukkitConversion1_16_R1(this); @@ -42,11 +41,6 @@ public TextureProvider1_16_R1 getTextureProvider() { return textureProvider; } - @Override - public PacketHandler1_16_R1 getPacketHandler() { - return packetHandler; - } - @Override public BukkitConversion1_16_R1 getBukkitConversion() { return bukkitConversion; diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/BukkitContainer1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/BukkitContainer1_16_R1.java index 72fc071..8cd64d0 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/BukkitContainer1_16_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/BukkitContainer1_16_R1.java @@ -80,7 +80,7 @@ public PersistentDataAdapterContext getAdapterContext() { @Override public BukkitContext1_16_R1 getWrapContext() { - return new BukkitContext1_16_R1(container.getAdapterContext()); + return new BukkitContext1_16_R1(container.getContext()); } @Override diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/BukkitContext1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/BukkitContext1_16_R1.java index a31341e..6289141 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/BukkitContext1_16_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/BukkitContext1_16_R1.java @@ -23,17 +23,17 @@ public IDataAdapterContext getHandle() { @Override public PersistentDataContainer newPersistentDataContainer() { - return newContainer(); + return newWrapContainer(); } @Override public IDataContainer newContainer() { - return context.newDataContainer(); + return context.newContainer(); } @Override public BukkitContainer1_16_R1 newWrapContainer() { - return new BukkitContainer1_16_R1(context.newDataContainer()); + return new BukkitContainer1_16_R1(context.newContainer()); } } \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/SyntaxContainer1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/SyntaxContainer1_16_R1.java index a17d742..9af14aa 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/SyntaxContainer1_16_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/SyntaxContainer1_16_R1.java @@ -5,7 +5,9 @@ import org.bukkit.persistence.PersistentDataContainer; +import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterContext; +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterRegistry; import net.sourcewriters.minecraft.vcompat.data.api.IDataType; import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.utils.key.IKey; @@ -32,6 +34,11 @@ public PersistentDataContainer getHandle() { public IDataContainer getAsSyntaxContainer() { return new SyntaxContainer1_16_R1(container); } + + @Override + public IDataAdapterRegistry getRegistry() { + return VersionCompatProvider.get().getControl().getDataProvider().getRegistry(); + } /* * diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/hook/BukkitContainerAdapterHook1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/hook/BukkitContainerAdapterHook1_16_R1.java index d3b8929..26c0bb6 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/hook/BukkitContainerAdapterHook1_16_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/data/hook/BukkitContainerAdapterHook1_16_R1.java @@ -10,6 +10,7 @@ import org.bukkit.craftbukkit.v1_16_R1.persistence.CraftPersistentDataTypeRegistry; import org.bukkit.persistence.PersistentDataContainer; +import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; import net.sourcewriters.minecraft.vcompat.data.nbt.NbtContainer; import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtCompound; diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/entity/Player1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/entity/Player1_16_R1.java index e6062f4..0335c58 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/entity/Player1_16_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/entity/Player1_16_R1.java @@ -35,11 +35,11 @@ import net.minecraft.server.v1_16_R1.PacketPlayOutTitle; import net.minecraft.server.v1_16_R1.PacketPlayOutTitle.EnumTitleAction; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R1.data.SyntaxContainer1_16_R1; +import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContainer; import net.sourcewriters.minecraft.vcompat.provider.data.type.SkinDataType; import net.sourcewriters.minecraft.vcompat.provider.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookupProvider; import net.sourcewriters.minecraft.vcompat.util.bukkit.Players; import net.sourcewriters.minecraft.vcompat.util.minecraft.MojangProfileServer; import net.sourcewriters.minecraft.vcompat.util.minecraft.Skin; diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/tools/ServerTools1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/tools/ServerTools1_16_R1.java index 4bfbe90..7238264 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/tools/ServerTools1_16_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/tools/ServerTools1_16_R1.java @@ -18,7 +18,6 @@ public String getMotd() { return ((CraftServer) Bukkit.getServer()).getServer().getMotd(); } - @SuppressWarnings("resource") @Override public ConsoleReaderWrapper1_16_R1 getConsole() { return ConsoleReaderWrapper1_16_R1.INSTANCE; diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/wrapper/ConsoleReaderWrapper1_16_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/wrapper/ConsoleReaderWrapper1_16_R1.java index faacf0f..3132551 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/wrapper/ConsoleReaderWrapper1_16_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R1/wrapper/ConsoleReaderWrapper1_16_R1.java @@ -5,6 +5,7 @@ import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_16_R1.CraftServer; +import org.bukkit.craftbukkit.Main; import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; import net.sourcewriters.minecraft.vcompat.provider.wrapper.ConsoleReaderWrapper; @@ -40,4 +41,9 @@ public void drawLine() throws IOException { reader.drawLine(); } + @Override + public boolean isJLineSupported() { + return Main.useJline; + } + } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/PacketHandler1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/PacketHandler1_16_R2.java deleted file mode 100644 index 61094fc..0000000 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/PacketHandler1_16_R2.java +++ /dev/null @@ -1,11 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R2; - -import net.sourcewriters.minecraft.vcompat.provider.PacketHandler; - -public class PacketHandler1_16_R2 extends PacketHandler { - - protected PacketHandler1_16_R2(VersionControl1_16_R2 versionControl) { - super(versionControl); - } - -} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/VersionControl1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/VersionControl1_16_R2.java index f650aac..c0fab18 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/VersionControl1_16_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/VersionControl1_16_R2.java @@ -13,7 +13,6 @@ public static VersionControl1_16_R2 init() { private final ToolProvider1_16_R2 toolProvider = new ToolProvider1_16_R2(this); private final TextureProvider1_16_R2 textureProvider = new TextureProvider1_16_R2(this); - private final PacketHandler1_16_R2 packetHandler = new PacketHandler1_16_R2(this); private final EntityProvider1_16_R2 entityProvider = new EntityProvider1_16_R2(this); private final PlayerProvider1_16_R2 playerProvider = new PlayerProvider1_16_R2(this); private final BukkitConversion1_16_R2 bukkitConversion = new BukkitConversion1_16_R2(this); @@ -42,11 +41,6 @@ public TextureProvider1_16_R2 getTextureProvider() { return textureProvider; } - @Override - public PacketHandler1_16_R2 getPacketHandler() { - return packetHandler; - } - @Override public BukkitConversion1_16_R2 getBukkitConversion() { return bukkitConversion; diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/BukkitContainer1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/BukkitContainer1_16_R2.java index d9cf9e2..6031195 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/BukkitContainer1_16_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/BukkitContainer1_16_R2.java @@ -80,7 +80,7 @@ public PersistentDataAdapterContext getAdapterContext() { @Override public BukkitContext1_16_R2 getWrapContext() { - return new BukkitContext1_16_R2(container.getAdapterContext()); + return new BukkitContext1_16_R2(container.getContext()); } @Override diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/BukkitContext1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/BukkitContext1_16_R2.java index 080f254..d906b21 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/BukkitContext1_16_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/BukkitContext1_16_R2.java @@ -23,17 +23,17 @@ public IDataAdapterContext getHandle() { @Override public PersistentDataContainer newPersistentDataContainer() { - return newContainer(); + return newWrapContainer(); } @Override public IDataContainer newContainer() { - return context.newDataContainer(); + return context.newContainer(); } @Override public BukkitContainer1_16_R2 newWrapContainer() { - return new BukkitContainer1_16_R2(context.newDataContainer()); + return new BukkitContainer1_16_R2(context.newContainer()); } } \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/SyntaxContainer1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/SyntaxContainer1_16_R2.java index 5a9151d..da834bf 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/SyntaxContainer1_16_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/data/SyntaxContainer1_16_R2.java @@ -5,7 +5,9 @@ import org.bukkit.persistence.PersistentDataContainer; +import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterContext; +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterRegistry; import net.sourcewriters.minecraft.vcompat.data.api.IDataType; import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.utils.key.IKey; @@ -32,6 +34,11 @@ public PersistentDataContainer getHandle() { public IDataContainer getAsSyntaxContainer() { return new SyntaxContainer1_16_R2(container); } + + @Override + public IDataAdapterRegistry getRegistry() { + return VersionCompatProvider.get().getControl().getDataProvider().getRegistry(); + } /* * diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/entity/Player1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/entity/Player1_16_R2.java index 03a043d..075ab58 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/entity/Player1_16_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/entity/Player1_16_R2.java @@ -40,7 +40,6 @@ import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContainer; import net.sourcewriters.minecraft.vcompat.provider.data.type.SkinDataType; import net.sourcewriters.minecraft.vcompat.provider.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookupProvider; import net.sourcewriters.minecraft.vcompat.util.bukkit.Players; import net.sourcewriters.minecraft.vcompat.util.minecraft.MojangProfileServer; import net.sourcewriters.minecraft.vcompat.util.minecraft.Skin; diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/tools/ServerTools1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/tools/ServerTools1_16_R2.java index 6a9f284..426b042 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/tools/ServerTools1_16_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/tools/ServerTools1_16_R2.java @@ -18,7 +18,6 @@ public String getMotd() { return ((CraftServer) Bukkit.getServer()).getServer().getMotd(); } - @SuppressWarnings("resource") @Override public ConsoleReaderWrapper1_16_R2 getConsole() { return ConsoleReaderWrapper1_16_R2.INSTANCE; diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/wrapper/ConsoleReaderWrapper1_16_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/wrapper/ConsoleReaderWrapper1_16_R2.java index c0fe714..edbd08f 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/wrapper/ConsoleReaderWrapper1_16_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R2/wrapper/ConsoleReaderWrapper1_16_R2.java @@ -5,6 +5,7 @@ import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_16_R2.CraftServer; +import org.bukkit.craftbukkit.Main; import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; import net.sourcewriters.minecraft.vcompat.provider.wrapper.ConsoleReaderWrapper; @@ -40,4 +41,9 @@ public void drawLine() throws IOException { reader.drawLine(); } + @Override + public boolean isJLineSupported() { + return Main.useJline; + } + } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/PacketHandler1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/PacketHandler1_16_R3.java deleted file mode 100644 index 088ef97..0000000 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/PacketHandler1_16_R3.java +++ /dev/null @@ -1,11 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3; - -import net.sourcewriters.minecraft.vcompat.provider.PacketHandler; - -public class PacketHandler1_16_R3 extends PacketHandler { - - protected PacketHandler1_16_R3(VersionControl1_16_R3 versionControl) { - super(versionControl); - } - -} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/VersionControl1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/VersionControl1_16_R3.java index 6aad43e..8c5ac69 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/VersionControl1_16_R3.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/VersionControl1_16_R3.java @@ -13,7 +13,6 @@ public static VersionControl1_16_R3 init() { private final ToolProvider1_16_R3 toolProvider = new ToolProvider1_16_R3(this); private final TextureProvider1_16_R3 textureProvider = new TextureProvider1_16_R3(this); - private final PacketHandler1_16_R3 packetHandler = new PacketHandler1_16_R3(this); private final EntityProvider1_16_R3 entityProvider = new EntityProvider1_16_R3(this); private final PlayerProvider1_16_R3 playerProvider = new PlayerProvider1_16_R3(this); private final BukkitConversion1_16_R3 bukkitConversion = new BukkitConversion1_16_R3(this); @@ -42,11 +41,6 @@ public TextureProvider1_16_R3 getTextureProvider() { return textureProvider; } - @Override - public PacketHandler1_16_R3 getPacketHandler() { - return packetHandler; - } - @Override public BukkitConversion1_16_R3 getBukkitConversion() { return bukkitConversion; diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/BukkitContainer1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/BukkitContainer1_16_R3.java index b43648f..fcde11c 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/BukkitContainer1_16_R3.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/BukkitContainer1_16_R3.java @@ -80,7 +80,7 @@ public PersistentDataAdapterContext getAdapterContext() { @Override public BukkitContext1_16_R3 getWrapContext() { - return new BukkitContext1_16_R3(container.getAdapterContext()); + return new BukkitContext1_16_R3(container.getContext()); } @Override diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/BukkitContext1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/BukkitContext1_16_R3.java index 2c529fb..ae36749 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/BukkitContext1_16_R3.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/BukkitContext1_16_R3.java @@ -23,17 +23,17 @@ public IDataAdapterContext getHandle() { @Override public PersistentDataContainer newPersistentDataContainer() { - return newContainer(); + return newWrapContainer(); } @Override public IDataContainer newContainer() { - return context.newDataContainer(); + return context.newContainer(); } @Override public BukkitContainer1_16_R3 newWrapContainer() { - return new BukkitContainer1_16_R3(context.newDataContainer()); + return new BukkitContainer1_16_R3(context.newContainer()); } } \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/SyntaxContainer1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/SyntaxContainer1_16_R3.java index d9e7437..829729a 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/SyntaxContainer1_16_R3.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/SyntaxContainer1_16_R3.java @@ -5,7 +5,9 @@ import org.bukkit.persistence.PersistentDataContainer; +import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterContext; +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterRegistry; import net.sourcewriters.minecraft.vcompat.data.api.IDataType; import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.utils.key.IKey; @@ -32,6 +34,11 @@ public PersistentDataContainer getHandle() { public IDataContainer getAsSyntaxContainer() { return new SyntaxContainer1_16_R3(container); } + + @Override + public IDataAdapterRegistry getRegistry() { + return VersionCompatProvider.get().getControl().getDataProvider().getRegistry(); + } /* * diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/hook/BukkitContainerAdapterHook1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/hook/BukkitContainerAdapterHook1_16_R3.java index 39bc049..bceb96f 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/hook/BukkitContainerAdapterHook1_16_R3.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/data/hook/BukkitContainerAdapterHook1_16_R3.java @@ -10,6 +10,7 @@ import org.bukkit.craftbukkit.v1_16_R3.persistence.CraftPersistentDataTypeRegistry; import org.bukkit.persistence.PersistentDataContainer; +import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; import net.sourcewriters.minecraft.vcompat.data.nbt.NbtContainer; import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtCompound; diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/entity/Player1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/entity/Player1_16_R3.java index 32036ad..8398bf1 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/entity/Player1_16_R3.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/entity/Player1_16_R3.java @@ -35,11 +35,11 @@ import net.minecraft.server.v1_16_R3.PacketPlayOutTitle; import net.minecraft.server.v1_16_R3.PacketPlayOutTitle.EnumTitleAction; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_16_R3.data.SyntaxContainer1_16_R3; +import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContainer; import net.sourcewriters.minecraft.vcompat.provider.data.type.SkinDataType; import net.sourcewriters.minecraft.vcompat.provider.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookupProvider; import net.sourcewriters.minecraft.vcompat.util.bukkit.Players; import net.sourcewriters.minecraft.vcompat.util.minecraft.MojangProfileServer; import net.sourcewriters.minecraft.vcompat.util.minecraft.Skin; diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/tools/ServerTools1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/tools/ServerTools1_16_R3.java index c8d3077..230707f 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/tools/ServerTools1_16_R3.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/tools/ServerTools1_16_R3.java @@ -18,7 +18,6 @@ public String getMotd() { return ((CraftServer) Bukkit.getServer()).getServer().getMotd(); } - @SuppressWarnings("resource") @Override public ConsoleReaderWrapper1_16_R3 getConsole() { return ConsoleReaderWrapper1_16_R3.INSTANCE; diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/wrapper/ConsoleReaderWrapper1_16_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/wrapper/ConsoleReaderWrapper1_16_R3.java index e9dca73..d3ad010 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/wrapper/ConsoleReaderWrapper1_16_R3.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_16_R3/wrapper/ConsoleReaderWrapper1_16_R3.java @@ -5,6 +5,7 @@ import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_16_R3.CraftServer; +import org.bukkit.craftbukkit.Main; import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; import net.sourcewriters.minecraft.vcompat.provider.wrapper.ConsoleReaderWrapper; @@ -40,4 +41,9 @@ public void drawLine() throws IOException { reader.drawLine(); } + @Override + public boolean isJLineSupported() { + return Main.useJline; + } + } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/BukkitConversion1_8_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/BukkitConversion1_8_R1.java index 54acfe1..97c70da 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/BukkitConversion1_8_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/BukkitConversion1_8_R1.java @@ -6,6 +6,7 @@ import org.bukkit.craftbukkit.v1_8_R1.inventory.CraftItemStack; import org.bukkit.entity.EntityType; +import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterContext; import net.sourcewriters.minecraft.vcompat.data.api.IDataType; import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtByte; @@ -44,7 +45,6 @@ import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SimpleSyntaxContext; import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SimpleWrapType; import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityType; -import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookupProvider; public class BukkitConversion1_8_R1 extends BukkitConversion { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/PacketHandler1_8_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/PacketHandler1_8_R1.java deleted file mode 100644 index dc51297..0000000 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/PacketHandler1_8_R1.java +++ /dev/null @@ -1,11 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R1; - -import net.sourcewriters.minecraft.vcompat.provider.PacketHandler; - -public class PacketHandler1_8_R1 extends PacketHandler { - - protected PacketHandler1_8_R1(VersionControl1_8_R1 versionControl) { - super(versionControl); - } - -} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/VersionControl1_8_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/VersionControl1_8_R1.java index 471ddf8..56e2eed 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/VersionControl1_8_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/VersionControl1_8_R1.java @@ -1,8 +1,8 @@ package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R1; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R1.reflection.NmsReflection1_8_R1; +import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; import net.sourcewriters.minecraft.vcompat.provider.VersionControl; -import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookupProvider; public class VersionControl1_8_R1 extends VersionControl { @@ -14,7 +14,6 @@ public static VersionControl1_8_R1 init() { private final ToolProvider1_8_R1 toolProvider = new ToolProvider1_8_R1(this); private final TextureProvider1_8_R1 textureProvider = new TextureProvider1_8_R1(this); - private final PacketHandler1_8_R1 packetHandler = new PacketHandler1_8_R1(this); private final EntityProvider1_8_R1 entityProvider = new EntityProvider1_8_R1(this); private final PlayerProvider1_8_R1 playerProvider = new PlayerProvider1_8_R1(this); private final BukkitConversion1_8_R1 bukkitConversion = new BukkitConversion1_8_R1(this); @@ -43,11 +42,6 @@ public TextureProvider1_8_R1 getTextureProvider() { return textureProvider; } - @Override - public PacketHandler1_8_R1 getPacketHandler() { - return packetHandler; - } - @Override public BukkitConversion1_8_R1 getBukkitConversion() { return bukkitConversion; diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/entity/Player1_8_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/entity/Player1_8_R1.java index a182768..a2a11bb 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/entity/Player1_8_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/entity/Player1_8_R1.java @@ -34,13 +34,13 @@ import net.minecraft.server.v1_8_R1.PacketPlayOutTitle; import net.minecraft.server.v1_8_R1.PlayerConnection; import net.minecraft.server.v1_8_R1.WorldServer; +import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContainer; import net.sourcewriters.minecraft.vcompat.provider.data.persistence.PersistentContainer; import net.sourcewriters.minecraft.vcompat.provider.data.type.SkinDataType; import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SimpleSyntaxContainer; import net.sourcewriters.minecraft.vcompat.provider.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookupProvider; import net.sourcewriters.minecraft.vcompat.util.bukkit.Players; import net.sourcewriters.minecraft.vcompat.util.minecraft.MojangProfileServer; import net.sourcewriters.minecraft.vcompat.util.minecraft.Skin; diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/wrapper/ConsoleReaderWrapper1_8_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/wrapper/ConsoleReaderWrapper1_8_R1.java index 1051315..3937a59 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/wrapper/ConsoleReaderWrapper1_8_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R1/wrapper/ConsoleReaderWrapper1_8_R1.java @@ -5,6 +5,7 @@ import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_8_R1.CraftServer; +import org.bukkit.craftbukkit.Main; import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; import net.sourcewriters.minecraft.vcompat.provider.wrapper.ConsoleReaderWrapper; @@ -15,7 +16,6 @@ public final class ConsoleReaderWrapper1_8_R1 extends ConsoleReaderWrapper { private final ConsoleReader reader; - @SuppressWarnings("resource") private ConsoleReaderWrapper1_8_R1() { this.reader = ((CraftServer) Bukkit.getServer()).getServer().reader; } @@ -40,4 +40,9 @@ public void drawLine() throws IOException { reader.drawLine(); } + @Override + public boolean isJLineSupported() { + return Main.useJline; + } + } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/BukkitConversion1_8_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/BukkitConversion1_8_R2.java index c6d0433..89395a9 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/BukkitConversion1_8_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/BukkitConversion1_8_R2.java @@ -6,6 +6,7 @@ import org.bukkit.craftbukkit.v1_8_R2.inventory.CraftItemStack; import org.bukkit.entity.EntityType; +import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterContext; import net.sourcewriters.minecraft.vcompat.data.api.IDataType; import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtByte; @@ -44,7 +45,6 @@ import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SimpleSyntaxContext; import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SimpleWrapType; import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityType; -import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookupProvider; public class BukkitConversion1_8_R2 extends BukkitConversion { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/PacketHandler1_8_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/PacketHandler1_8_R2.java deleted file mode 100644 index fb8becf..0000000 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/PacketHandler1_8_R2.java +++ /dev/null @@ -1,11 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R2; - -import net.sourcewriters.minecraft.vcompat.provider.PacketHandler; - -public class PacketHandler1_8_R2 extends PacketHandler { - - protected PacketHandler1_8_R2(VersionControl1_8_R2 versionControl) { - super(versionControl); - } - -} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/VersionControl1_8_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/VersionControl1_8_R2.java index 748d7a3..b677820 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/VersionControl1_8_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/VersionControl1_8_R2.java @@ -1,8 +1,8 @@ package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R2; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R2.reflection.NmsReflection1_8_R2; +import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; import net.sourcewriters.minecraft.vcompat.provider.VersionControl; -import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookupProvider; public class VersionControl1_8_R2 extends VersionControl { @@ -14,7 +14,6 @@ public static VersionControl1_8_R2 init() { private final ToolProvider1_8_R2 toolProvider = new ToolProvider1_8_R2(this); private final TextureProvider1_8_R2 textureProvider = new TextureProvider1_8_R2(this); - private final PacketHandler1_8_R2 packetHandler = new PacketHandler1_8_R2(this); private final EntityProvider1_8_R2 entityProvider = new EntityProvider1_8_R2(this); private final PlayerProvider1_8_R2 playerProvider = new PlayerProvider1_8_R2(this); private final BukkitConversion1_8_R2 bukkitConversion = new BukkitConversion1_8_R2(this); @@ -43,11 +42,6 @@ public TextureProvider1_8_R2 getTextureProvider() { return textureProvider; } - @Override - public PacketHandler1_8_R2 getPacketHandler() { - return packetHandler; - } - @Override public BukkitConversion1_8_R2 getBukkitConversion() { return bukkitConversion; diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/entity/Player1_8_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/entity/Player1_8_R2.java index b850c3c..6534c7f 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/entity/Player1_8_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/entity/Player1_8_R2.java @@ -32,13 +32,13 @@ import net.minecraft.server.v1_8_R2.PacketPlayOutRespawn; import net.minecraft.server.v1_8_R2.PacketPlayOutTitle; import net.minecraft.server.v1_8_R2.PacketPlayOutTitle.EnumTitleAction; +import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContainer; import net.sourcewriters.minecraft.vcompat.provider.data.persistence.PersistentContainer; import net.sourcewriters.minecraft.vcompat.provider.data.type.SkinDataType; import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SimpleSyntaxContainer; import net.sourcewriters.minecraft.vcompat.provider.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookupProvider; import net.sourcewriters.minecraft.vcompat.util.bukkit.Players; import net.sourcewriters.minecraft.vcompat.util.minecraft.MojangProfileServer; import net.sourcewriters.minecraft.vcompat.util.minecraft.Skin; diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/wrapper/ConsoleReaderWrapper1_8_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/wrapper/ConsoleReaderWrapper1_8_R2.java index 888c25b..31be001 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/wrapper/ConsoleReaderWrapper1_8_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R2/wrapper/ConsoleReaderWrapper1_8_R2.java @@ -5,6 +5,7 @@ import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_8_R2.CraftServer; +import org.bukkit.craftbukkit.Main; import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; import net.sourcewriters.minecraft.vcompat.provider.wrapper.ConsoleReaderWrapper; @@ -15,7 +16,6 @@ public final class ConsoleReaderWrapper1_8_R2 extends ConsoleReaderWrapper { private final ConsoleReader reader; - @SuppressWarnings("resource") private ConsoleReaderWrapper1_8_R2() { this.reader = ((CraftServer) Bukkit.getServer()).getServer().reader; } @@ -40,4 +40,9 @@ public void drawLine() throws IOException { reader.drawLine(); } + @Override + public boolean isJLineSupported() { + return Main.useJline; + } + } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/BukkitConversion1_8_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/BukkitConversion1_8_R3.java index 7e6c222..e657adf 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/BukkitConversion1_8_R3.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/BukkitConversion1_8_R3.java @@ -6,6 +6,7 @@ import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack; import org.bukkit.entity.EntityType; +import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterContext; import net.sourcewriters.minecraft.vcompat.data.api.IDataType; import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtByte; @@ -44,7 +45,6 @@ import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SimpleSyntaxContext; import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SimpleWrapType; import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityType; -import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookupProvider; public class BukkitConversion1_8_R3 extends BukkitConversion { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/PacketHandler1_8_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/PacketHandler1_8_R3.java deleted file mode 100644 index 392b34e..0000000 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/PacketHandler1_8_R3.java +++ /dev/null @@ -1,11 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R3; - -import net.sourcewriters.minecraft.vcompat.provider.PacketHandler; - -public class PacketHandler1_8_R3 extends PacketHandler { - - protected PacketHandler1_8_R3(VersionControl1_8_R3 versionControl) { - super(versionControl); - } - -} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/VersionControl1_8_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/VersionControl1_8_R3.java index d5665ef..0b179b9 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/VersionControl1_8_R3.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/VersionControl1_8_R3.java @@ -1,8 +1,8 @@ package net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R3; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_8_R3.reflection.NmsReflection1_8_R3; +import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; import net.sourcewriters.minecraft.vcompat.provider.VersionControl; -import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookupProvider; public class VersionControl1_8_R3 extends VersionControl { @@ -14,7 +14,6 @@ public static VersionControl1_8_R3 init() { private final ToolProvider1_8_R3 toolProvider = new ToolProvider1_8_R3(this); private final TextureProvider1_8_R3 textureProvider = new TextureProvider1_8_R3(this); - private final PacketHandler1_8_R3 packetHandler = new PacketHandler1_8_R3(this); private final EntityProvider1_8_R3 entityProvider = new EntityProvider1_8_R3(this); private final PlayerProvider1_8_R3 playerProvider = new PlayerProvider1_8_R3(this); private final BukkitConversion1_8_R3 bukkitConversion = new BukkitConversion1_8_R3(this); @@ -43,11 +42,6 @@ public TextureProvider1_8_R3 getTextureProvider() { return textureProvider; } - @Override - public PacketHandler1_8_R3 getPacketHandler() { - return packetHandler; - } - @Override public BukkitConversion1_8_R3 getBukkitConversion() { return bukkitConversion; diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/entity/Player1_8_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/entity/Player1_8_R3.java index b5a6e28..f27c9f5 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/entity/Player1_8_R3.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/entity/Player1_8_R3.java @@ -32,13 +32,13 @@ import net.minecraft.server.v1_8_R3.PacketPlayOutRespawn; import net.minecraft.server.v1_8_R3.PacketPlayOutTitle; import net.minecraft.server.v1_8_R3.PacketPlayOutTitle.EnumTitleAction; +import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContainer; import net.sourcewriters.minecraft.vcompat.provider.data.persistence.PersistentContainer; import net.sourcewriters.minecraft.vcompat.provider.data.type.SkinDataType; import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SimpleSyntaxContainer; import net.sourcewriters.minecraft.vcompat.provider.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookupProvider; import net.sourcewriters.minecraft.vcompat.util.bukkit.Players; import net.sourcewriters.minecraft.vcompat.util.minecraft.MojangProfileServer; import net.sourcewriters.minecraft.vcompat.util.minecraft.Skin; diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/wrapper/ConsoleReaderWrapper1_8_R3.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/wrapper/ConsoleReaderWrapper1_8_R3.java index 83fa0b5..3e5d899 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/wrapper/ConsoleReaderWrapper1_8_R3.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_8_R3/wrapper/ConsoleReaderWrapper1_8_R3.java @@ -5,6 +5,7 @@ import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_8_R3.CraftServer; +import org.bukkit.craftbukkit.Main; import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; import net.sourcewriters.minecraft.vcompat.provider.wrapper.ConsoleReaderWrapper; @@ -15,7 +16,6 @@ public final class ConsoleReaderWrapper1_8_R3 extends ConsoleReaderWrapper { private final ConsoleReader reader; - @SuppressWarnings("resource") private ConsoleReaderWrapper1_8_R3() { this.reader = ((CraftServer) Bukkit.getServer()).getServer().reader; } @@ -40,4 +40,9 @@ public void drawLine() throws IOException { reader.drawLine(); } + @Override + public boolean isJLineSupported() { + return Main.useJline; + } + } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/BukkitConversion1_9_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/BukkitConversion1_9_R1.java index 7949754..c2be451 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/BukkitConversion1_9_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/BukkitConversion1_9_R1.java @@ -6,6 +6,7 @@ import org.bukkit.craftbukkit.v1_9_R1.inventory.CraftItemStack; import org.bukkit.entity.EntityType; +import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterContext; import net.sourcewriters.minecraft.vcompat.data.api.IDataType; import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtByte; @@ -44,7 +45,6 @@ import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SimpleSyntaxContext; import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SimpleWrapType; import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityType; -import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookupProvider; public class BukkitConversion1_9_R1 extends BukkitConversion { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/PacketHandler1_9_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/PacketHandler1_9_R1.java deleted file mode 100644 index 1d13853..0000000 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/PacketHandler1_9_R1.java +++ /dev/null @@ -1,11 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R1; - -import net.sourcewriters.minecraft.vcompat.provider.PacketHandler; - -public class PacketHandler1_9_R1 extends PacketHandler { - - protected PacketHandler1_9_R1(VersionControl1_9_R1 versionControl) { - super(versionControl); - } - -} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/VersionControl1_9_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/VersionControl1_9_R1.java index 5b588b2..d72952a 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/VersionControl1_9_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/VersionControl1_9_R1.java @@ -1,8 +1,8 @@ package net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R1; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R1.reflection.NmsReflection1_9_R1; +import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; import net.sourcewriters.minecraft.vcompat.provider.VersionControl; -import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookupProvider; public class VersionControl1_9_R1 extends VersionControl { @@ -14,7 +14,6 @@ public static VersionControl1_9_R1 init() { private final ToolProvider1_9_R1 toolProvider = new ToolProvider1_9_R1(this); private final TextureProvider1_9_R1 textureProvider = new TextureProvider1_9_R1(this); - private final PacketHandler1_9_R1 packetHandler = new PacketHandler1_9_R1(this); private final EntityProvider1_9_R1 entityProvider = new EntityProvider1_9_R1(this); private final PlayerProvider1_9_R1 playerProvider = new PlayerProvider1_9_R1(this); private final BukkitConversion1_9_R1 bukkitConversion = new BukkitConversion1_9_R1(this); @@ -43,11 +42,6 @@ public TextureProvider1_9_R1 getTextureProvider() { return textureProvider; } - @Override - public PacketHandler1_9_R1 getPacketHandler() { - return packetHandler; - } - @Override public BukkitConversion1_9_R1 getBukkitConversion() { return bukkitConversion; diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/entity/Player1_9_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/entity/Player1_9_R1.java index 665f650..bde2d13 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/entity/Player1_9_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/entity/Player1_9_R1.java @@ -33,13 +33,13 @@ import net.minecraft.server.v1_9_R1.PacketPlayOutRespawn; import net.minecraft.server.v1_9_R1.PacketPlayOutTitle; import net.minecraft.server.v1_9_R1.PacketPlayOutTitle.EnumTitleAction; +import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContainer; import net.sourcewriters.minecraft.vcompat.provider.data.persistence.PersistentContainer; import net.sourcewriters.minecraft.vcompat.provider.data.type.SkinDataType; import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SimpleSyntaxContainer; import net.sourcewriters.minecraft.vcompat.provider.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookupProvider; import net.sourcewriters.minecraft.vcompat.util.bukkit.Players; import net.sourcewriters.minecraft.vcompat.util.minecraft.MojangProfileServer; import net.sourcewriters.minecraft.vcompat.util.minecraft.Skin; diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/wrapper/ConsoleReaderWrapper1_9_R1.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/wrapper/ConsoleReaderWrapper1_9_R1.java index 47937f6..dcfef31 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/wrapper/ConsoleReaderWrapper1_9_R1.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R1/wrapper/ConsoleReaderWrapper1_9_R1.java @@ -5,6 +5,7 @@ import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_9_R1.CraftServer; +import org.bukkit.craftbukkit.Main; import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; import net.sourcewriters.minecraft.vcompat.provider.wrapper.ConsoleReaderWrapper; @@ -15,7 +16,6 @@ public final class ConsoleReaderWrapper1_9_R1 extends ConsoleReaderWrapper { private final ConsoleReader reader; - @SuppressWarnings("resource") private ConsoleReaderWrapper1_9_R1() { this.reader = ((CraftServer) Bukkit.getServer()).getServer().reader; } @@ -40,4 +40,9 @@ public void drawLine() throws IOException { reader.drawLine(); } + @Override + public boolean isJLineSupported() { + return Main.useJline; + } + } diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/BukkitConversion1_9_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/BukkitConversion1_9_R2.java index 8908486..5207510 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/BukkitConversion1_9_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/BukkitConversion1_9_R2.java @@ -6,6 +6,7 @@ import org.bukkit.craftbukkit.v1_9_R2.inventory.CraftItemStack; import org.bukkit.entity.EntityType; +import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterContext; import net.sourcewriters.minecraft.vcompat.data.api.IDataType; import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtByte; @@ -44,7 +45,6 @@ import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SimpleSyntaxContext; import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SimpleWrapType; import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityType; -import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookupProvider; public class BukkitConversion1_9_R2 extends BukkitConversion { diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/PacketHandler1_9_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/PacketHandler1_9_R2.java deleted file mode 100644 index f37bb30..0000000 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/PacketHandler1_9_R2.java +++ /dev/null @@ -1,11 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R2; - -import net.sourcewriters.minecraft.vcompat.provider.PacketHandler; - -public class PacketHandler1_9_R2 extends PacketHandler { - - protected PacketHandler1_9_R2(VersionControl1_9_R2 versionControl) { - super(versionControl); - } - -} \ No newline at end of file diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/VersionControl1_9_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/VersionControl1_9_R2.java index fd297ac..3c3e64e 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/VersionControl1_9_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/VersionControl1_9_R2.java @@ -1,8 +1,8 @@ package net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R2; import net.sourcewriters.minecraft.vcompat.provider.impl.v1_9_R2.reflection.NmsReflection1_9_R2; +import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; import net.sourcewriters.minecraft.vcompat.provider.VersionControl; -import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookupProvider; public class VersionControl1_9_R2 extends VersionControl { @@ -14,7 +14,6 @@ public static VersionControl1_9_R2 init() { private final ToolProvider1_9_R2 toolProvider = new ToolProvider1_9_R2(this); private final TextureProvider1_9_R2 textureProvider = new TextureProvider1_9_R2(this); - private final PacketHandler1_9_R2 packetHandler = new PacketHandler1_9_R2(this); private final EntityProvider1_9_R2 entityProvider = new EntityProvider1_9_R2(this); private final PlayerProvider1_9_R2 playerProvider = new PlayerProvider1_9_R2(this); private final BukkitConversion1_9_R2 bukkitConversion = new BukkitConversion1_9_R2(this); @@ -43,11 +42,6 @@ public TextureProvider1_9_R2 getTextureProvider() { return textureProvider; } - @Override - public PacketHandler1_9_R2 getPacketHandler() { - return packetHandler; - } - @Override public BukkitConversion1_9_R2 getBukkitConversion() { return bukkitConversion; diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/entity/Player1_9_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/entity/Player1_9_R2.java index 84d5ad2..8a13933 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/entity/Player1_9_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/entity/Player1_9_R2.java @@ -33,13 +33,13 @@ import net.minecraft.server.v1_9_R2.PacketPlayOutRespawn; import net.minecraft.server.v1_9_R2.PacketPlayOutTitle; import net.minecraft.server.v1_9_R2.PacketPlayOutTitle.EnumTitleAction; +import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContainer; import net.sourcewriters.minecraft.vcompat.provider.data.persistence.PersistentContainer; import net.sourcewriters.minecraft.vcompat.provider.data.type.SkinDataType; import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SimpleSyntaxContainer; import net.sourcewriters.minecraft.vcompat.provider.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.provider.lookup.ClassLookupProvider; import net.sourcewriters.minecraft.vcompat.util.bukkit.Players; import net.sourcewriters.minecraft.vcompat.util.minecraft.MojangProfileServer; import net.sourcewriters.minecraft.vcompat.util.minecraft.Skin; diff --git a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/wrapper/ConsoleReaderWrapper1_9_R2.java b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/wrapper/ConsoleReaderWrapper1_9_R2.java index 2c83673..ecca520 100644 --- a/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/wrapper/ConsoleReaderWrapper1_9_R2.java +++ b/vcompat-legacy/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_9_R2/wrapper/ConsoleReaderWrapper1_9_R2.java @@ -5,6 +5,7 @@ import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_9_R2.CraftServer; +import org.bukkit.craftbukkit.Main; import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; import net.sourcewriters.minecraft.vcompat.provider.wrapper.ConsoleReaderWrapper; @@ -15,7 +16,6 @@ public final class ConsoleReaderWrapper1_9_R2 extends ConsoleReaderWrapper { private final ConsoleReader reader; - @SuppressWarnings("resource") private ConsoleReaderWrapper1_9_R2() { this.reader = ((CraftServer) Bukkit.getServer()).getServer().reader; } @@ -40,4 +40,9 @@ public void drawLine() throws IOException { reader.drawLine(); } + @Override + public boolean isJLineSupported() { + return Main.useJline; + } + } From 950fe9cb9d1eecf54f828c82a2a023c83b122dab Mon Sep 17 00:00:00 2001 From: Lauriichan Date: Wed, 19 Jan 2022 16:18:56 +0100 Subject: [PATCH 33/47] Fix project build --- .gitignore | 3 +- vcompat-core/pom.xml | 16 ++-- vcompat-legacy/.gitignore | 3 +- vcompat-legacy/pom.xml | 164 ++++++++++++-------------------------- 4 files changed, 62 insertions(+), 124 deletions(-) diff --git a/.gitignore b/.gitignore index 26dfc00..96b24a1 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,5 @@ */test/ /libraries/spigot/ */dependency-reduced-pom.xml -*.class \ No newline at end of file +*.class +*.jar \ No newline at end of file diff --git a/vcompat-core/pom.xml b/vcompat-core/pom.xml index 5921abf..fbd37bc 100644 --- a/vcompat-core/pom.xml +++ b/vcompat-core/pom.xml @@ -8,17 +8,17 @@ 3.0.0 vcompat-core - - - ${project.parent.groupId} - vcompat-api - ${project.parent.version} - + + + net.sourcewriters.minecraft + vcompat-api + 3.0.0 + - ${project.parent.groupId} + net.sourcewriters.minecraft vcompat-legacy - ${project.parent.version} + 3.0.0 diff --git a/vcompat-legacy/.gitignore b/vcompat-legacy/.gitignore index e5d0d0e..226a4f4 100644 --- a/vcompat-legacy/.gitignore +++ b/vcompat-legacy/.gitignore @@ -9,4 +9,5 @@ */.gitlab-ci.yml */test/ */dependency-reduced-pom.xml -*.class \ No newline at end of file +*.class +*.jar \ No newline at end of file diff --git a/vcompat-legacy/pom.xml b/vcompat-legacy/pom.xml index 85b3c09..3db1c25 100644 --- a/vcompat-legacy/pom.xml +++ b/vcompat-legacy/pom.xml @@ -8,187 +8,123 @@ vcompat-legacy - ${project.basedir}/../libraries/spigot + ${project.basedir}\..\libraries\spigot - - - - bukkit - spigot-1.16.4 - 0.1 - system - ${spigot.libPath}/spigot-1.16.4.jar - - - bukkit - spigot-1.16.3 - 0.1 - system - ${spigot.libPath}/spigot-1.16.3.jar - - - bukkit - spigot-1.16.1 - 0.1 - system - ${spigot.libPath}/spigot-1.16.1.jar - - - bukkit - spigot-1.15.2 - 0.1 - system - ${spigot.libPath}/spigot-1.15.2.jar - - - bukkit - spigot-1.14.2 - 0.1 - system - ${spigot.libPath}/spigot-1.14.2.jar - - - bukkit - spigot-1.13.2 - 0.1 - system - ${spigot.libPath}/spigot-1.13.2.jar - - - bukkit - spigot-1.13 - 0.1 - system - ${spigot.libPath}/spigot-1.13.jar - - - bukkit - spigot-1.12.2 - 0.1 - system - ${spigot.libPath}/spigot-1.12.2.jar - - - bukkit - spigot-1.11 - 0.1 - system - ${spigot.libPath}/spigot-1.11.jar - - - bukkit - spigot-1.10.2 - 0.1 - system - ${spigot.libPath}/spigot-1.10.2.jar - - - bukkit - spigot-1.9.4 - 0.1 - system - ${spigot.libPath}/spigot-1.9.4.jar - - - bukkit - spigot-1.9 - 0.1 - system - ${spigot.libPath}/spigot-1.9.jar - - - bukkit - spigot-1.8.8 - 0.1 - system - ${spigot.libPath}/spigot-1.8.8.jar - - - bukkit - spigot-1.8.3 - 0.1 - system - ${spigot.libPath}/spigot-1.8.3.jar - - - bukkit - spigot-1.8 - 0.1 - system - ${spigot.libPath}/spigot-1.8.jar - - - - - ${project.parent.groupId} + net.sourcewriters.minecraft vcompat-api - ${project.parent.version} - >provided + 3.0.0 + provided + bukkit spigot-1.16.4 + 0.1 + system + ${spigot.libPath}\spigot-1.16.4.jar bukkit spigot-1.16.3 + 0.1 + system + ${spigot.libPath}\spigot-1.16.3.jar bukkit spigot-1.16.1 + 0.1 + system + ${spigot.libPath}\spigot-1.16.1.jar bukkit spigot-1.15.2 + 0.1 + system + ${spigot.libPath}\spigot-1.15.2.jar bukkit spigot-1.14.2 + 0.1 + system + ${spigot.libPath}\spigot-1.14.2.jar bukkit spigot-1.13.2 + 0.1 + system + ${spigot.libPath}\spigot-1.13.2.jar bukkit spigot-1.13 + 0.1 + system + ${spigot.libPath}\spigot-1.13.jar bukkit spigot-1.12.2 + 0.1 + system + ${spigot.libPath}\spigot-1.12.2.jar bukkit spigot-1.11 + 0.1 + system + ${spigot.libPath}\spigot-1.11.jar bukkit spigot-1.10.2 + 0.1 + system + ${spigot.libPath}\spigot-1.10.2.jar bukkit spigot-1.9.4 + 0.1 + system + ${spigot.libPath}\spigot-1.9.4.jar bukkit spigot-1.9 + 0.1 + system + ${spigot.libPath}\spigot-1.9.jar bukkit spigot-1.8.8 + 0.1 + system + ${spigot.libPath}\spigot-1.8.8.jar bukkit spigot-1.8.3 + 0.1 + system + ${spigot.libPath}\spigot-1.8.3.jar bukkit spigot-1.8 + 0.1 + system + ${spigot.libPath}\spigot-1.8.jar \ No newline at end of file From b72539a5be70c43ea73473e78b7fc276fadf2b8d Mon Sep 17 00:00:00 2001 From: Lauriichan Date: Wed, 19 Jan 2022 17:48:51 +0100 Subject: [PATCH 34/47] Add 1_17_R1 and 1_18_R1 support --- pom.xml | 6 +- vcompat-1_17_R1/pom.xml | 70 +++++ .../v1_17_R1/BukkitConversion1_17_R1.java | 209 +++++++++++++ .../impl/v1_17_R1/EntityProvider1_17_R1.java | 48 +++ .../impl/v1_17_R1/PlayerProvider1_17_R1.java | 20 ++ .../impl/v1_17_R1/TextureProvider1_17_R1.java | 101 ++++++ .../impl/v1_17_R1/ToolProvider1_17_R1.java | 33 ++ .../impl/v1_17_R1/VersionControl1_17_R1.java | 55 ++++ .../v1_17_R1/data/BukkitContainer1_17_R1.java | 160 ++++++++++ .../v1_17_R1/data/BukkitContext1_17_R1.java | 38 +++ .../impl/v1_17_R1/data/BukkitKey1_17_R1.java | 52 ++++ .../impl/v1_17_R1/data/BukkitType1_17_R1.java | 68 ++++ .../data/SimpleBukkitType1_17_R1.java | 36 +++ .../v1_17_R1/data/SyntaxContainer1_17_R1.java | 191 ++++++++++++ .../v1_17_R1/data/SyntaxContext1_17_R1.java | 37 +++ .../impl/v1_17_R1/data/SyntaxType1_17_R1.java | 75 +++++ .../v1_17_R1/data/WrappedType1_17_R1.java | 149 +++++++++ .../BukkitContainerAdapterHook1_17_R1.java | 133 ++++++++ .../v1_17_R1/entity/ArmorStand1_17_R1.java | 24 ++ .../impl/v1_17_R1/entity/Entity1_17_R1.java | 215 +++++++++++++ .../v1_17_R1/entity/EntityLiving1_17_R1.java | 17 + .../impl/v1_17_R1/entity/Player1_17_R1.java | 293 ++++++++++++++++++ .../v1_17_R1/tools/BlockTools1_17_R1.java | 38 +++ .../v1_17_R1/tools/ServerTools1_17_R1.java | 26 ++ .../impl/v1_17_R1/tools/SkinTools1_17_R1.java | 16 + .../utils/EntityConstructors1_17_R1.java | 12 + .../wrapper/ConsoleReaderWrapper1_17_R1.java | 50 +++ vcompat-1_18_R1/pom.xml | 96 ++++++ .../v1_18_R1/BukkitConversion1_17_R1.java | 209 +++++++++++++ .../impl/v1_18_R1/EntityProvider1_17_R1.java | 47 +++ .../impl/v1_18_R1/PlayerProvider1_17_R1.java | 20 ++ .../impl/v1_18_R1/TextureProvider1_17_R1.java | 101 ++++++ .../impl/v1_18_R1/ToolProvider1_17_R1.java | 33 ++ .../impl/v1_18_R1/VersionControl1_17_R1.java | 55 ++++ .../v1_18_R1/data/BukkitContainer1_17_R1.java | 160 ++++++++++ .../v1_18_R1/data/BukkitContext1_17_R1.java | 38 +++ .../impl/v1_18_R1/data/BukkitKey1_17_R1.java | 52 ++++ .../impl/v1_18_R1/data/BukkitType1_17_R1.java | 68 ++++ .../data/SimpleBukkitType1_17_R1.java | 36 +++ .../v1_18_R1/data/SyntaxContainer1_17_R1.java | 191 ++++++++++++ .../v1_18_R1/data/SyntaxContext1_17_R1.java | 37 +++ .../impl/v1_18_R1/data/SyntaxType1_17_R1.java | 75 +++++ .../v1_18_R1/data/WrappedType1_17_R1.java | 149 +++++++++ .../BukkitContainerAdapterHook1_17_R1.java | 133 ++++++++ .../v1_18_R1/entity/ArmorStand1_17_R1.java | 24 ++ .../impl/v1_18_R1/entity/Entity1_17_R1.java | 215 +++++++++++++ .../v1_18_R1/entity/EntityLiving1_17_R1.java | 17 + .../impl/v1_18_R1/entity/Player1_17_R1.java | 293 ++++++++++++++++++ .../v1_18_R1/tools/BlockTools1_17_R1.java | 38 +++ .../v1_18_R1/tools/ServerTools1_17_R1.java | 26 ++ .../impl/v1_18_R1/tools/SkinTools1_17_R1.java | 16 + .../utils/EntityConstructors1_17_R1.java | 12 + .../wrapper/ConsoleReaderWrapper1_17_R1.java | 51 +++ vcompat-api/pom.xml | 16 +- vcompat-core/pom.xml | 16 + vcompat-legacy/pom.xml | 2 +- 56 files changed, 4390 insertions(+), 8 deletions(-) create mode 100644 vcompat-1_17_R1/pom.xml create mode 100644 vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/BukkitConversion1_17_R1.java create mode 100644 vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/EntityProvider1_17_R1.java create mode 100644 vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/PlayerProvider1_17_R1.java create mode 100644 vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/TextureProvider1_17_R1.java create mode 100644 vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/ToolProvider1_17_R1.java create mode 100644 vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/VersionControl1_17_R1.java create mode 100644 vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/data/BukkitContainer1_17_R1.java create mode 100644 vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/data/BukkitContext1_17_R1.java create mode 100644 vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/data/BukkitKey1_17_R1.java create mode 100644 vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/data/BukkitType1_17_R1.java create mode 100644 vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/data/SimpleBukkitType1_17_R1.java create mode 100644 vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/data/SyntaxContainer1_17_R1.java create mode 100644 vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/data/SyntaxContext1_17_R1.java create mode 100644 vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/data/SyntaxType1_17_R1.java create mode 100644 vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/data/WrappedType1_17_R1.java create mode 100644 vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/data/hook/BukkitContainerAdapterHook1_17_R1.java create mode 100644 vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/entity/ArmorStand1_17_R1.java create mode 100644 vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/entity/Entity1_17_R1.java create mode 100644 vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/entity/EntityLiving1_17_R1.java create mode 100644 vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/entity/Player1_17_R1.java create mode 100644 vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/tools/BlockTools1_17_R1.java create mode 100644 vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/tools/ServerTools1_17_R1.java create mode 100644 vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/tools/SkinTools1_17_R1.java create mode 100644 vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/utils/EntityConstructors1_17_R1.java create mode 100644 vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/wrapper/ConsoleReaderWrapper1_17_R1.java create mode 100644 vcompat-1_18_R1/pom.xml create mode 100644 vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/BukkitConversion1_17_R1.java create mode 100644 vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/EntityProvider1_17_R1.java create mode 100644 vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/PlayerProvider1_17_R1.java create mode 100644 vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/TextureProvider1_17_R1.java create mode 100644 vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/ToolProvider1_17_R1.java create mode 100644 vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/VersionControl1_17_R1.java create mode 100644 vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/BukkitContainer1_17_R1.java create mode 100644 vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/BukkitContext1_17_R1.java create mode 100644 vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/BukkitKey1_17_R1.java create mode 100644 vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/BukkitType1_17_R1.java create mode 100644 vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/SimpleBukkitType1_17_R1.java create mode 100644 vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/SyntaxContainer1_17_R1.java create mode 100644 vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/SyntaxContext1_17_R1.java create mode 100644 vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/SyntaxType1_17_R1.java create mode 100644 vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/WrappedType1_17_R1.java create mode 100644 vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/hook/BukkitContainerAdapterHook1_17_R1.java create mode 100644 vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/entity/ArmorStand1_17_R1.java create mode 100644 vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/entity/Entity1_17_R1.java create mode 100644 vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/entity/EntityLiving1_17_R1.java create mode 100644 vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/entity/Player1_17_R1.java create mode 100644 vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/tools/BlockTools1_17_R1.java create mode 100644 vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/tools/ServerTools1_17_R1.java create mode 100644 vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/tools/SkinTools1_17_R1.java create mode 100644 vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/utils/EntityConstructors1_17_R1.java create mode 100644 vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/wrapper/ConsoleReaderWrapper1_17_R1.java diff --git a/pom.xml b/pom.xml index f8244cd..256aa19 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ vcompat-parent 3.0.0 pom - + UTF-8 @@ -23,7 +23,9 @@ + + com.mojang authlib @@ -70,5 +72,7 @@ vcompat-api vcompat-core vcompat-legacy + vcompat-1_17_R1 + vcompat-1_18_R1 \ No newline at end of file diff --git a/vcompat-1_17_R1/pom.xml b/vcompat-1_17_R1/pom.xml new file mode 100644 index 0000000..abc54fe --- /dev/null +++ b/vcompat-1_17_R1/pom.xml @@ -0,0 +1,70 @@ + + 4.0.0 + + net.sourcewriters.minecraft + vcompat-parent + 3.0.0 + + vcompat-1_17_R1 + + + ${project.basedir}\..\libraries\spigot + + + + + net.sourcewriters.minecraft + vcompat-api + 3.0.0 + provided + + + + + + spigot + remapped + 0.1 + system + ${spigot.libPath}\spigot-1.17.1.jar + + + + + + + net.md-5 + specialsource-maven-plugin + 1.2.2 + + + package + + remap + + remap-obf + + org.spigotmc:minecraft-server:1.17.1-R0.1-SNAPSHOT:txt:maps-mojang + true + org.spigotmc:spigot:1.17.1-R0.1-SNAPSHOT:jar:remapped-mojang + true + remapped-obf + + + + package + + remap + + remap-spigot + + ${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar + org.spigotmc:minecraft-server:1.17.1-R0.1-SNAPSHOT:csrg:maps-spigot + org.spigotmc:spigot:1.17.1-R0.1-SNAPSHOT:jar:remapped-obf + + + + + + + \ No newline at end of file diff --git a/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/BukkitConversion1_17_R1.java b/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/BukkitConversion1_17_R1.java new file mode 100644 index 0000000..d5816f4 --- /dev/null +++ b/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/BukkitConversion1_17_R1.java @@ -0,0 +1,209 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_17_R1; + +import org.bukkit.craftbukkit.v1_17_R1.inventory.CraftItemStack; +import org.bukkit.entity.EntityType; + +import net.minecraft.nbt.ByteArrayTag; +import net.minecraft.nbt.ByteTag; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.DoubleTag; +import net.minecraft.nbt.EndTag; +import net.minecraft.nbt.FloatTag; +import net.minecraft.nbt.IntArrayTag; +import net.minecraft.nbt.IntTag; +import net.minecraft.nbt.ListTag; +import net.minecraft.nbt.LongArrayTag; +import net.minecraft.nbt.LongTag; +import net.minecraft.nbt.ShortTag; +import net.minecraft.nbt.StringTag; +import net.minecraft.nbt.Tag; +import net.minecraft.world.item.ItemStack; +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterContext; +import net.sourcewriters.minecraft.vcompat.data.api.IDataType; +import net.sourcewriters.minecraft.vcompat.provider.BukkitConversion; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityType; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_17_R1.data.BukkitContext1_17_R1; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_17_R1.data.BukkitType1_17_R1; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtByte; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtByteArray; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtCompound; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtDouble; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtEnd; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtFloat; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtInt; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtIntArray; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtList; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtLong; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtLongArray; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtShort; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtString; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtTag; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtType; + +public class BukkitConversion1_17_R1 extends BukkitConversion { + + protected BukkitConversion1_17_R1(VersionControl1_17_R1 versionControl) { + super(versionControl); + } + + @Override + public EntityType toEntityType(NmsEntityType type) { + try { + return EntityType.valueOf(type.name()); + } catch (IllegalArgumentException ignore) { + return null; + } + } + + @Override + public NmsEntityType fromEntityType(EntityType type) { + try { + return NmsEntityType.valueOf(type.name()); + } catch (IllegalArgumentException ignore) { + return null; + } + } + + @Override + public Tag toMinecraftTag(NbtTag tag) { + switch (tag.getType()) { + case END: + return EndTag.INSTANCE; + case BYTE: + return ByteTag.valueOf(((NbtByte) tag).getValue()); + case BYTE_ARRAY: + return new ByteArrayTag(((NbtByteArray) tag).getValue()); + case DOUBLE: + return DoubleTag.valueOf(((NbtDouble) tag).getValue()); + case FLOAT: + return FloatTag.valueOf(((NbtFloat) tag).getValue()); + case INT: + return IntTag.valueOf(((NbtInt) tag).getValue()); + case INT_ARRAY: + return new IntArrayTag(((NbtIntArray) tag).getValue()); + case LONG: + return LongTag.valueOf(((NbtLong) tag).getValue()); + case LONG_ARRAY: + return new LongArrayTag(((NbtLongArray) tag).getValue()); + case SHORT: + return ShortTag.valueOf(((NbtShort) tag).getValue()); + case STRING: + return StringTag.valueOf(((NbtString) tag).getValue()); + case LIST: + return toMinecraftList((NbtList) tag); + case COMPOUND: + return toMinecraftCompound((NbtCompound) tag); + default: + return null; + } + } + + @Override + public NbtTag fromMinecraftTag(Object tag) { + if (tag != null && tag instanceof Tag) { + return fromMinecraftTag0((Tag) tag); + } + return null; + } + + public NbtTag fromMinecraftTag0(Tag tag) { + switch (NbtType.getById(tag.getId())) { + case END: + return NbtEnd.INSTANCE; + case BYTE: + return new NbtByte(((ByteTag) tag).getAsByte()); + case BYTE_ARRAY: + return new NbtByteArray(((ByteArrayTag) tag).getAsByteArray()); + case DOUBLE: + return new NbtDouble(((DoubleTag) tag).getAsDouble()); + case FLOAT: + return new NbtFloat(((FloatTag) tag).getAsFloat()); + case INT: + return new NbtInt(((IntTag) tag).getAsInt()); + case INT_ARRAY: + return new NbtIntArray(((IntArrayTag) tag).getAsIntArray()); + case LONG: + return new NbtLong(((LongTag) tag).getAsLong()); + case LONG_ARRAY: + return new NbtLongArray(((LongArrayTag) tag).getAsLongArray()); + case SHORT: + return new NbtShort(((ShortTag) tag).getAsShort()); + case STRING: + return new NbtString(((StringTag) tag).getAsString()); + case LIST: + return fromMinecraftList(tag); + case COMPOUND: + return fromMinecraftCompound(tag); + default: + return null; + } + } + + @Override + public ListTag toMinecraftList(NbtList list) { + ListTag output = new ListTag(); + for (NbtTag tag : list) { + output.add(toMinecraftTag(tag)); + } + return output; + } + + @Override + public NbtList fromMinecraftList(Object raw) { + if (!(raw instanceof ListTag)) { + return null; + } + ListTag list = (ListTag) raw; + NbtList output = new NbtList<>(NbtType.getById(list.getElementType())); + for (Tag base : list) { + output.add(fromMinecraftTag(base)); + } + return output; + } + + @Override + public CompoundTag toMinecraftCompound(NbtCompound compound) { + NbtCompound compoundTag = compound; + CompoundTag targetCompound = new CompoundTag(); + for (String key : compoundTag.getKeys()) { + targetCompound.put(key, toMinecraftTag(compoundTag.get(key))); + } + return targetCompound; + } + + @Override + public NbtCompound fromMinecraftCompound(Object raw) { + if (!(raw instanceof CompoundTag)) { + return null; + } + CompoundTag compoundTag = (CompoundTag) raw; + NbtCompound targetCompound = new NbtCompound(); + for (String key : compoundTag.getAllKeys()) { + targetCompound.set(key, fromMinecraftTag(compoundTag.get(key))); + } + return targetCompound; + } + + @Override + public org.bukkit.inventory.ItemStack itemFromCompound(NbtCompound compound) { + return CraftItemStack.asBukkitCopy(ItemStack.of(toMinecraftCompound(compound))); + } + + @Override + public NbtCompound itemToCompound(org.bukkit.inventory.ItemStack itemStack) { + return fromMinecraftCompound(CraftItemStack.asNMSCopy(itemStack).save(new CompoundTag())); + } + + @Override + public WrappedContext createContext(IDataAdapterContext context) { + return new BukkitContext1_17_R1(context); + } + + @Override + public WrapType wrap(IDataType dataType) { + return new BukkitType1_17_R1<>(dataType); + } + +} \ No newline at end of file diff --git a/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/EntityProvider1_17_R1.java b/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/EntityProvider1_17_R1.java new file mode 100644 index 0000000..d21abe9 --- /dev/null +++ b/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/EntityProvider1_17_R1.java @@ -0,0 +1,48 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_17_R1; + +import java.util.EnumMap; +import java.util.function.Function; + +import org.bukkit.craftbukkit.v1_17_R1.CraftWorld; + +import net.minecraft.world.level.Level; +import net.sourcewriters.minecraft.vcompat.provider.EntityProvider; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityType; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_17_R1.utils.EntityConstructors1_17_R1; + + +public class EntityProvider1_17_R1 extends EntityProvider { + + private final EnumMap> entityMap = new EnumMap<>(NmsEntityType.class); + + protected EntityProvider1_17_R1(VersionControl1_17_R1 versionControl) { + super(versionControl); + } + + @SuppressWarnings("unchecked") + private final Function searchConstructor(NmsEntityType type) { + try { + return (Function) EntityConstructors1_17_R1.class.getField(type.name()).get(null); + } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException ignore) { + return null; + } + } + + private final Function getConstructor(NmsEntityType type) { + return entityMap.computeIfAbsent(type, (key -> searchConstructor(key))); + } + + @Override + public NmsEntity createEntity(org.bukkit.World world, NmsEntityType type) { + if (!(world instanceof CraftWorld)) { + return null; + } + Function function; + if ((function = getConstructor(type)) == null) { + return null; + } + return function.apply(((CraftWorld) world).getHandle()); + } + +} \ No newline at end of file diff --git a/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/PlayerProvider1_17_R1.java b/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/PlayerProvider1_17_R1.java new file mode 100644 index 0000000..fe5165b --- /dev/null +++ b/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/PlayerProvider1_17_R1.java @@ -0,0 +1,20 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_17_R1; + +import org.bukkit.entity.Player; + +import net.sourcewriters.minecraft.vcompat.provider.PlayerProvider; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_17_R1.entity.Player1_17_R1; + +public class PlayerProvider1_17_R1 extends PlayerProvider { + + protected PlayerProvider1_17_R1(VersionControl1_17_R1 versionControl) { + super(versionControl); + } + + @Override + protected NmsPlayer createPlayer(Player player) { + return new Player1_17_R1(player); + } + +} \ No newline at end of file diff --git a/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/TextureProvider1_17_R1.java b/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/TextureProvider1_17_R1.java new file mode 100644 index 0000000..027c11b --- /dev/null +++ b/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/TextureProvider1_17_R1.java @@ -0,0 +1,101 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_17_R1; + +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_17_R1.block.CraftBlockEntityState; +import org.bukkit.craftbukkit.v1_17_R1.block.CraftSkull; +import org.bukkit.craftbukkit.v1_17_R1.inventory.CraftItemStack; +import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.inventory.meta.SkullMeta; + +import com.mojang.authlib.GameProfile; + +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.NbtUtils; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.entity.SkullBlockEntity; +import net.sourcewriters.minecraft.vcompat.provider.TextureProvider; +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookup; + +public class TextureProvider1_17_R1 extends TextureProvider { + + private final ClassLookup craftEntityStateRef = ClassLookup.of(CraftBlockEntityState.class).searchField("tileEntity", "tileEntity"); + private final ClassLookup craftItemStackRef = ClassLookup.of(CraftItemStack.class).searchField("handle", "handle"); + private final ClassLookup craftMetaSkullRef = ClassLookup.of("org.bukkit.craftbukkit.v1_17_R1.inventory.CraftMetaSkull") + .searchField("serialized", "serializedProfile").searchField("profile", "profile"); + + protected TextureProvider1_17_R1(VersionControl1_17_R1 versionControl) { + super(versionControl); + } + + @Override + public GameProfile profileFromBlock(Block block) { + if (!(block instanceof CraftSkull)) { + return null; + } + SkullBlockEntity entitySkull = (SkullBlockEntity) craftEntityStateRef.getFieldValue(block, "tileEntity"); + return entitySkull.owner; + } + + @Override + public GameProfile profileFromItem(org.bukkit.inventory.ItemStack itemStack) { + if (!(itemStack.getItemMeta() instanceof SkullMeta)) { + return null; + } + SkullMeta meta = (SkullMeta) itemStack.getItemMeta(); + GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue(meta, "profile"); + if (profile == null) { + CompoundTag compound = (CompoundTag) craftMetaSkullRef.getFieldValue(meta, "serialized"); + if (compound == null) { + ItemStack stack = null; + if (itemStack instanceof CraftItemStack) { + stack = (ItemStack) craftItemStackRef.getFieldValue(itemStack, "handle"); + } + if (stack == null) { + stack = CraftItemStack.asNMSCopy(itemStack); + } + CompoundTag stackTag = stack.getOrCreateTag(); + if (stackTag.contains("SkullOwner", 10)) { + compound = stackTag.getCompound("SkullOwner"); + } else if (stackTag.contains("SkullProfile", 10)) { + compound = stackTag.getCompound("SkullProfile"); + } + } + if (compound == null) { + return null; + } + profile = NbtUtils.readGameProfile(compound); + } + return profile; + } + + @Override + public org.bukkit.inventory.ItemStack getItem(GameProfile profile) { + org.bukkit.inventory.ItemStack craftStack = CraftItemStack.asCraftCopy(new org.bukkit.inventory.ItemStack(Material.PLAYER_HEAD)); + applyItem(craftStack, profile); + return craftStack; + } + + @Override + public boolean applyItem(org.bukkit.inventory.ItemStack itemStack, GameProfile profile) { + ItemMeta meta = itemStack.getItemMeta(); + if (!(meta instanceof SkullMeta)) { + return false; + } + SkullMeta skullMeta = (SkullMeta) meta; + craftMetaSkullRef.setFieldValue(meta, "profile", profile); + itemStack.setItemMeta(skullMeta); + return true; + } + + @Override + public boolean applyBlock(Block block, GameProfile profile) { + if (!(block instanceof CraftSkull)) { + return false; + } + SkullBlockEntity entitySkull = (SkullBlockEntity) craftEntityStateRef.getFieldValue(block, "tileEntity"); + entitySkull.setOwner(profile); + return true; + } + +} \ No newline at end of file diff --git a/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/ToolProvider1_17_R1.java b/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/ToolProvider1_17_R1.java new file mode 100644 index 0000000..834d3da --- /dev/null +++ b/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/ToolProvider1_17_R1.java @@ -0,0 +1,33 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_17_R1; + +import net.sourcewriters.minecraft.vcompat.provider.ToolProvider; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_17_R1.tools.BlockTools1_17_R1; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_17_R1.tools.ServerTools1_17_R1; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_17_R1.tools.SkinTools1_17_R1; + +public class ToolProvider1_17_R1 extends ToolProvider { + + private final BlockTools1_17_R1 blockTools = new BlockTools1_17_R1(); + private final SkinTools1_17_R1 skinTools = new SkinTools1_17_R1(); + private final ServerTools1_17_R1 serverTools = new ServerTools1_17_R1(); + + protected ToolProvider1_17_R1(VersionControl1_17_R1 versionControl) { + super(versionControl); + } + + @Override + public SkinTools1_17_R1 getSkinTools() { + return skinTools; + } + + @Override + public ServerTools1_17_R1 getServerTools() { + return serverTools; + } + + @Override + public BlockTools1_17_R1 getBlockTools() { + return blockTools; + } + +} \ No newline at end of file diff --git a/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/VersionControl1_17_R1.java b/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/VersionControl1_17_R1.java new file mode 100644 index 0000000..46edc5c --- /dev/null +++ b/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/VersionControl1_17_R1.java @@ -0,0 +1,55 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_17_R1; + +import net.sourcewriters.minecraft.vcompat.provider.VersionControl; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_17_R1.data.hook.BukkitContainerAdapterHook1_17_R1; + +public class VersionControl1_17_R1 extends VersionControl { + + public static VersionControl1_17_R1 INSTANCE; + + public static VersionControl1_17_R1 init() { + return INSTANCE != null ? INSTANCE : (INSTANCE = new VersionControl1_17_R1()); + } + + private final ToolProvider1_17_R1 toolProvider = new ToolProvider1_17_R1(this); + private final TextureProvider1_17_R1 textureProvider = new TextureProvider1_17_R1(this); + private final EntityProvider1_17_R1 entityProvider = new EntityProvider1_17_R1(this); + private final PlayerProvider1_17_R1 playerProvider = new PlayerProvider1_17_R1(this); + private final BukkitConversion1_17_R1 bukkitConversion = new BukkitConversion1_17_R1(this); + + private VersionControl1_17_R1() { + BukkitContainerAdapterHook1_17_R1.hookEntity(); + } + + @Override + public ToolProvider1_17_R1 getToolProvider() { + return toolProvider; + } + + @Override + public EntityProvider1_17_R1 getEntityProvider() { + return entityProvider; + } + + @Override + public PlayerProvider1_17_R1 getPlayerProvider() { + return playerProvider; + } + + @Override + public TextureProvider1_17_R1 getTextureProvider() { + return textureProvider; + } + + @Override + public BukkitConversion1_17_R1 getBukkitConversion() { + return bukkitConversion; + } + + @Override + public void shutdown() { + dataProvider.getDefaultDistributor().shutdown(); + BukkitContainerAdapterHook1_17_R1.unhookAll(); + } + +} \ No newline at end of file diff --git a/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/data/BukkitContainer1_17_R1.java b/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/data/BukkitContainer1_17_R1.java new file mode 100644 index 0000000..9cbca99 --- /dev/null +++ b/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/data/BukkitContainer1_17_R1.java @@ -0,0 +1,160 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_17_R1.data; + +import java.util.Arrays; +import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; + +import org.bukkit.NamespacedKey; +import org.bukkit.persistence.PersistentDataAdapterContext; +import org.bukkit.persistence.PersistentDataContainer; +import org.bukkit.persistence.PersistentDataType; + +import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedKey; +import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SyntaxKey; + +public final class BukkitContainer1_17_R1 extends WrappedContainer implements PersistentDataContainer { + + private final IDataContainer container; + + public BukkitContainer1_17_R1(IDataContainer container) { + this.container = container; + } + + @Override + public IDataContainer getHandle() { + return container; + } + + @Override + public IDataContainer getAsSyntaxContainer() { + return container; + } + + /* + * + */ + + @Override + public boolean has(NamespacedKey key, PersistentDataType type) { + return has(new BukkitKey1_17_R1(key), WrappedType1_17_R1.wrap(type)); + } + + @Override + public Z get(NamespacedKey key, PersistentDataType type) { + return get(new BukkitKey1_17_R1(key), WrappedType1_17_R1.wrap(type)); + } + + @Override + public Z getOrDefault(NamespacedKey key, PersistentDataType type, Z value) { + return Optional.ofNullable(get(key, type)).orElse(value); + } + + @Override + public void set(NamespacedKey key, PersistentDataType type, Z value) { + set(new BukkitKey1_17_R1(key), value, WrappedType1_17_R1.wrap(type)); + } + + @Override + public void remove(NamespacedKey key) { + remove(new BukkitKey1_17_R1(key)); + } + + @Override + public Set getKeys() { + return Arrays.stream(container.getKeys()).map(SyntaxKey::new).map(BukkitKey1_17_R1::asBukkit).collect(Collectors.toSet()); + } + + @Override + public PersistentDataAdapterContext getAdapterContext() { + return getWrapContext(); + } + + /* + * + */ + + @Override + public BukkitContext1_17_R1 getWrapContext() { + return new BukkitContext1_17_R1(container.getContext()); + } + + @Override + public boolean has(String key) { + return has(wrappedKey(key)); + } + + @Override + public boolean has(WrappedKey key) { + return container.has(key.getNamespacedKey()); + } + + @Override + public boolean has(String key, WrapType type) { + return has(wrappedKey(key), type); + } + + @Override + public boolean has(WrappedKey key, WrapType type) { + return container.has(key.getNamespacedKey(), type.syntaxType()); + } + + @Override + public Object get(String key) { + return get(wrappedKey(key)); + } + + @Override + public Object get(WrappedKey key) { + return container.get(key.getNamespacedKey()); + } + + @Override + public C get(String key, WrapType type) { + return get(wrappedKey(key), type); + } + + @Override + public C get(WrappedKey key, WrapType type) { + return container.get(key.getNamespacedKey(), type.syntaxType()); + } + + @Override + public void set(String key, B value, WrapType type) { + set(wrappedKey(key), value, type); + } + + @Override + public void set(WrappedKey key, B value, WrapType type) { + container.set(key.getNamespacedKey(), value, type.syntaxType()); + } + + @Override + public boolean remove(String key) { + return false; + } + + @Override + public boolean remove(WrappedKey key) { + return container.remove(key.getNamespacedKey()); + } + + @Override + public Set keySet() { + return container.getKeyspaces(); + } + + @Override + public boolean isEmpty() { + return container.isEmpty(); + } + + @Override + public int size() { + return container.size(); + } + +} \ No newline at end of file diff --git a/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/data/BukkitContext1_17_R1.java b/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/data/BukkitContext1_17_R1.java new file mode 100644 index 0000000..251e230 --- /dev/null +++ b/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/data/BukkitContext1_17_R1.java @@ -0,0 +1,38 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_17_R1.data; + +import org.bukkit.persistence.PersistentDataAdapterContext; +import org.bukkit.persistence.PersistentDataContainer; + +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterContext; +import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContext; + +public final class BukkitContext1_17_R1 extends WrappedContext implements PersistentDataAdapterContext { + + private final IDataAdapterContext context; + + public BukkitContext1_17_R1(IDataAdapterContext context) { + this.context = context; + } + + @Override + public IDataAdapterContext getHandle() { + return context; + } + + @Override + public PersistentDataContainer newPersistentDataContainer() { + return newWrapContainer(); + } + + @Override + public IDataContainer newContainer() { + return context.newContainer(); + } + + @Override + public BukkitContainer1_17_R1 newWrapContainer() { + return new BukkitContainer1_17_R1(context.newContainer()); + } + +} \ No newline at end of file diff --git a/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/data/BukkitKey1_17_R1.java b/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/data/BukkitKey1_17_R1.java new file mode 100644 index 0000000..d03318e --- /dev/null +++ b/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/data/BukkitKey1_17_R1.java @@ -0,0 +1,52 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_17_R1.data; + +import org.bukkit.NamespacedKey; +import org.bukkit.plugin.Plugin; + +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedKey; + +public final class BukkitKey1_17_R1 extends WrappedKey { + + private final NamespacedKey key; + + public BukkitKey1_17_R1(Plugin plugin, String key) { + this.key = new NamespacedKey(plugin, key); + } + + @SuppressWarnings("deprecation") + public BukkitKey1_17_R1(String name, String key) { + this.key = new NamespacedKey(name, key); + } + + public BukkitKey1_17_R1(NamespacedKey key) { + this.key = key; + } + + @Override + public NamespacedKey getHandle() { + return key; + } + + @Override + public String getName() { + return key.getNamespace(); + } + + @Override + public String getKey() { + return key.getKey(); + } + + @Override + public String toString() { + return key.toString(); + } + + public static NamespacedKey asBukkit(WrappedKey key) { + if (key.getHandle() instanceof NamespacedKey) { + return (NamespacedKey) key.getHandle(); + } + return new BukkitKey1_17_R1(key.getName(), key.getKey()).getHandle(); + } + +} \ No newline at end of file diff --git a/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/data/BukkitType1_17_R1.java b/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/data/BukkitType1_17_R1.java new file mode 100644 index 0000000..045d9f0 --- /dev/null +++ b/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/data/BukkitType1_17_R1.java @@ -0,0 +1,68 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_17_R1.data; + +import org.bukkit.persistence.PersistentDataAdapterContext; +import org.bukkit.persistence.PersistentDataType; + +import net.sourcewriters.minecraft.vcompat.data.api.IDataType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContext; + +public class BukkitType1_17_R1 extends WrappedType1_17_R1, P0, P1, C0, C1> + implements PersistentDataType { + + private final IDataType type; + + public BukkitType1_17_R1(IDataType type) { + super(type.getPrimitive(), type.getComplex()); + this.type = type; + } + + @Override + public IDataType getHandle() { + return type; + } + + @Override + public Class getPrimitiveOriginal() { + return type.getPrimitive(); + } + + @Override + public Class getComplexOriginal() { + return type.getComplex(); + } + + /* + * + */ + + @Override + public Class getComplexType() { + return complexType; + } + + @Override + public Class getPrimitiveType() { + return primitiveType; + } + + @Override + public P0 toPrimitive(C0 complex, PersistentDataAdapterContext context) { + return wrapToPrimitive(complex, new SyntaxContext1_17_R1(context)); + } + + @Override + public C0 fromPrimitive(P0 primitive, PersistentDataAdapterContext context) { + return wrapToComplex(primitive, new SyntaxContext1_17_R1(context)); + } + + @Override + public P0 wrapToPrimitive(C0 complex, WrappedContext context) { + return toPrimitiveWrapped(type.toPrimitive(context, toComplexOriginal(complex))); + } + + @Override + public C0 wrapToComplex(P0 primitive, WrappedContext context) { + return toComplexWrapped(type.fromPrimitive(context, toPrimitiveOriginal(primitive))); + } + +} \ No newline at end of file diff --git a/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/data/SimpleBukkitType1_17_R1.java b/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/data/SimpleBukkitType1_17_R1.java new file mode 100644 index 0000000..dd3335b --- /dev/null +++ b/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/data/SimpleBukkitType1_17_R1.java @@ -0,0 +1,36 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_17_R1.data; + +import org.bukkit.persistence.PersistentDataAdapterContext; +import org.bukkit.persistence.PersistentDataType; + +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; + +public class SimpleBukkitType1_17_R1 implements PersistentDataType { + + private final WrapType type; + + public SimpleBukkitType1_17_R1(WrapType type) { + this.type = type; + } + + @Override + public Class getComplexType() { + return type.getComplexWrapped(); + } + + @Override + public Class

getPrimitiveType() { + return type.getPrimitiveWrapped(); + } + + @Override + public P toPrimitive(C complex, PersistentDataAdapterContext context) { + return type.wrapToPrimitive(complex, new SyntaxContext1_17_R1(context)); + } + + @Override + public C fromPrimitive(P primitive, PersistentDataAdapterContext context) { + return type.wrapToComplex(primitive, new SyntaxContext1_17_R1(context)); + } + +} \ No newline at end of file diff --git a/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/data/SyntaxContainer1_17_R1.java b/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/data/SyntaxContainer1_17_R1.java new file mode 100644 index 0000000..30cece4 --- /dev/null +++ b/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/data/SyntaxContainer1_17_R1.java @@ -0,0 +1,191 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_17_R1.data; + +import java.util.Set; +import java.util.stream.Collectors; + +import org.bukkit.persistence.PersistentDataContainer; + +import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterContext; +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterRegistry; +import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; +import net.sourcewriters.minecraft.vcompat.data.api.IDataType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedKey; +import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SyntaxKey; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.utils.key.IKey; + +public final class SyntaxContainer1_17_R1 extends WrappedContainer implements IDataContainer { + + private final PersistentDataContainer container; + + public SyntaxContainer1_17_R1(PersistentDataContainer container) { + this.container = container; + } + + @Override + public PersistentDataContainer getHandle() { + return container; + } + + @Override + public IDataContainer getAsSyntaxContainer() { + return new SyntaxContainer1_17_R1(container); + } + + @Override + public IDataAdapterRegistry getRegistry() { + return VersionCompatProvider.get().getControl().getDataProvider().getRegistry(); + } + + /* + * + */ + + @Override + public boolean has(IKey key) { + throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); + } + + @Override + public boolean has(String key, IDataType type) { + return has(syntaxKey(key), type); + } + + @Override + public boolean has(IKey key, IDataType type) { + return has(new SyntaxKey(key), WrappedType1_17_R1.wrap(type)); + } + + @Override + public C get(String key, IDataType type) { + return get(syntaxKey(key), type); + } + + @Override + public C get(IKey key, IDataType type) { + return get(new SyntaxKey(key), WrappedType1_17_R1.wrap(type)); + } + + @Override + public Object get(String key) { + throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); + } + + @Override + public Object get(IKey key) { + throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); + } + + @Override + public void set(String key, E value, IDataType type) { + set(wrappedKey(key), value, WrappedType1_17_R1.wrap(type)); + } + + @Override + public void set(IKey key, E value, IDataType type) { + set(new SyntaxKey(key), value, WrappedType1_17_R1.wrap(type)); + } + + @Override + public boolean remove(String key) { + return remove(wrappedKey(key)); + } + + @Override + public boolean remove(IKey key) { + return remove(new SyntaxKey(key)); + } + + @Override + public IKey[] getKeys() { + return container.getKeys().stream().map(BukkitKey1_17_R1::new).map(WrappedKey::getNamespacedKey).toArray(IKey[]::new); + } + + @Override + public Set getKeyspaces() { + return container.getKeys().stream().map(org.bukkit.NamespacedKey::toString).collect(Collectors.toSet()); + } + + @Override + public IDataAdapterContext getContext() { + return getWrapContext(); + } + + /* + * + */ + + @Override + public SyntaxContext1_17_R1 getWrapContext() { + return new SyntaxContext1_17_R1(container.getAdapterContext()); + } + + @Override + public boolean has(String key) { + throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); + } + + @Override + public boolean has(WrappedKey key) { + throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); + } + + @Override + public boolean has(String key, WrapType type) { + return has(wrappedKey(key), type); + } + + @Override + public boolean has(WrappedKey key, WrapType type) { + return container.has(BukkitKey1_17_R1.asBukkit(key), new SimpleBukkitType1_17_R1<>(type)); + } + + @Override + public Object get(WrappedKey key) { + throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); + } + + @Override + public C get(String key, WrapType type) { + return get(wrappedKey(key), type); + } + + @Override + public C get(WrappedKey key, WrapType type) { + return container.get(BukkitKey1_17_R1.asBukkit(key), new SimpleBukkitType1_17_R1<>(type)); + } + + @Override + public void set(String key, B value, WrapType type) { + set(wrappedKey(key), value, type); + } + + @Override + public void set(WrappedKey key, B value, WrapType type) { + container.set(BukkitKey1_17_R1.asBukkit(key), new SimpleBukkitType1_17_R1<>(type), value); + } + + @Override + public boolean remove(WrappedKey key) { + container.remove(BukkitKey1_17_R1.asBukkit(key)); + return true; // Will always return true as we don't know if it contained it + } + + @Override + public Set keySet() { + return getKeyspaces(); + } + + @Override + public boolean isEmpty() { + return container.isEmpty(); + } + + @Override + public int size() { + return container.getKeys().size(); + } + +} \ No newline at end of file diff --git a/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/data/SyntaxContext1_17_R1.java b/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/data/SyntaxContext1_17_R1.java new file mode 100644 index 0000000..b2a7c61 --- /dev/null +++ b/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/data/SyntaxContext1_17_R1.java @@ -0,0 +1,37 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_17_R1.data; + +import org.bukkit.persistence.PersistentDataAdapterContext; +import org.bukkit.persistence.PersistentDataContainer; + +import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContext; + +public final class SyntaxContext1_17_R1 extends WrappedContext implements PersistentDataAdapterContext { + + private final PersistentDataAdapterContext context; + + public SyntaxContext1_17_R1(PersistentDataAdapterContext context) { + this.context = context; + } + + @Override + public PersistentDataAdapterContext getHandle() { + return context; + } + + @Override + public PersistentDataContainer newPersistentDataContainer() { + return context.newPersistentDataContainer(); + } + + @Override + public IDataContainer newContainer() { + return newWrapContainer(); + } + + @Override + public SyntaxContainer1_17_R1 newWrapContainer() { + return new SyntaxContainer1_17_R1(context.newPersistentDataContainer()); + } + +} \ No newline at end of file diff --git a/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/data/SyntaxType1_17_R1.java b/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/data/SyntaxType1_17_R1.java new file mode 100644 index 0000000..32be70a --- /dev/null +++ b/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/data/SyntaxType1_17_R1.java @@ -0,0 +1,75 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_17_R1.data; + +import org.bukkit.persistence.PersistentDataAdapterContext; +import org.bukkit.persistence.PersistentDataType; + +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterContext; +import net.sourcewriters.minecraft.vcompat.data.api.IDataType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContext; + +public class SyntaxType1_17_R1 extends WrappedType1_17_R1, P0, P1, C0, C1> + implements IDataType { + + private final PersistentDataType type; + + public SyntaxType1_17_R1(PersistentDataType type) { + super(type.getPrimitiveType(), type.getComplexType()); + this.type = type; + } + + @Override + public PersistentDataType getHandle() { + return type; + } + + @Override + public Class getPrimitiveOriginal() { + return type.getPrimitiveType(); + } + + @Override + public Class getComplexOriginal() { + return type.getComplexType(); + } + + /* + * + */ + + @Override + public Class getComplex() { + return complexType; + } + + @Override + public Class getPrimitive() { + return primitiveType; + } + + @Override + public P0 toPrimitive(IDataAdapterContext context, C0 complex) { + return wrapToPrimitive(complex, new BukkitContext1_17_R1(context)); + } + + @Override + public C0 fromPrimitive(IDataAdapterContext context, P0 primitive) { + return wrapToComplex(primitive, new BukkitContext1_17_R1(context)); + } + + @Override + public P0 wrapToPrimitive(C0 complex, WrappedContext context) { + if (!(context instanceof PersistentDataAdapterContext)) { + return null; + } + return toPrimitiveWrapped(type.toPrimitive(toComplexOriginal(complex), (PersistentDataAdapterContext) context)); + } + + @Override + public C0 wrapToComplex(P0 primitive, WrappedContext context) { + if (!(context instanceof PersistentDataAdapterContext)) { + return null; + } + return toComplexWrapped(type.fromPrimitive(toPrimitiveOriginal(primitive), (PersistentDataAdapterContext) context)); + } + +} \ No newline at end of file diff --git a/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/data/WrappedType1_17_R1.java b/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/data/WrappedType1_17_R1.java new file mode 100644 index 0000000..9870087 --- /dev/null +++ b/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/data/WrappedType1_17_R1.java @@ -0,0 +1,149 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_17_R1.data; + +import java.util.Arrays; + +import org.bukkit.persistence.PersistentDataContainer; +import org.bukkit.persistence.PersistentDataType; + +import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; +import net.sourcewriters.minecraft.vcompat.data.api.IDataType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; + +public abstract class WrappedType1_17_R1 implements WrapType { + + protected final Class primitiveType; + protected final Class complexType; + + private final int primitiveWrap; + private final int complexWrap; + + @SuppressWarnings("unchecked") + protected WrappedType1_17_R1(Class primitive, Class complex) { + this.primitiveWrap = WrappedType1_17_R1.internalState(primitive); + this.complexWrap = WrappedType1_17_R1.internalState(complex); + this.primitiveType = (Class) WrappedType1_17_R1.internalWrap(primitive, primitiveWrap); + this.complexType = (Class) WrappedType1_17_R1.internalWrap(complex, complexWrap); + } + + public abstract H getHandle(); + + public Class getPrimitiveWrapped() { + return primitiveType; + } + + public Class getComplexWrapped() { + return complexType; + } + + public abstract Class getPrimitiveOriginal(); + + public abstract Class getComplexOriginal(); + + @SuppressWarnings("unchecked") + public P0 toPrimitiveWrapped(P1 primitive) { + switch (primitiveWrap) { + case 1: + return (P0) new SyntaxContainer1_17_R1((PersistentDataContainer) primitive); + case 2: + return (P0) Arrays.stream((PersistentDataContainer[]) primitive).map(SyntaxContainer1_17_R1::new) + .toArray(SyntaxContainer1_17_R1[]::new); + case 3: + return (P0) new BukkitContainer1_17_R1((IDataContainer) primitive); + case 4: + return (P0) Arrays.stream((IDataContainer[]) primitive).map(BukkitContainer1_17_R1::new) + .toArray(BukkitContainer1_17_R1[]::new); + default: + return (P0) primitive; + } + } + + @SuppressWarnings("unchecked") + public C0 toComplexWrapped(C1 complex) { + switch (complexWrap) { + case 1: + return (C0) new SyntaxContainer1_17_R1((PersistentDataContainer) complex); + case 2: + return (C0) Arrays.stream((PersistentDataContainer[]) complex).map(SyntaxContainer1_17_R1::new).toArray(SyntaxContainer1_17_R1[]::new); + case 3: + return (C0) new BukkitContainer1_17_R1((IDataContainer) complex); + case 4: + return (C0) Arrays.stream((IDataContainer[]) complex).map(BukkitContainer1_17_R1::new).toArray(BukkitContainer1_17_R1[]::new); + default: + return (C0) complex; + } + } + + @SuppressWarnings("unchecked") + public P1 toPrimitiveOriginal(P0 primitive) { + switch (primitiveWrap) { + case 1: + return (P1) new BukkitContainer1_17_R1((IDataContainer) primitive); + case 2: + return (P1) Arrays.stream((IDataContainer[]) primitive).map(BukkitContainer1_17_R1::new) + .toArray(BukkitContainer1_17_R1[]::new); + case 3: + return (P1) new SyntaxContainer1_17_R1((PersistentDataContainer) primitive); + case 4: + return (P1) Arrays.stream((PersistentDataContainer[]) primitive).map(SyntaxContainer1_17_R1::new) + .toArray(SyntaxContainer1_17_R1[]::new); + default: + return (P1) primitive; + } + } + + @SuppressWarnings("unchecked") + public C1 toComplexOriginal(C0 complex) { + switch (complexWrap) { + case 1: + return (C1) new BukkitContainer1_17_R1((IDataContainer) complex); + case 2: + return (C1) Arrays.stream((IDataContainer[]) complex).map(BukkitContainer1_17_R1::new).toArray(BukkitContainer1_17_R1[]::new); + case 3: + return (C1) new SyntaxContainer1_17_R1((PersistentDataContainer) complex); + case 4: + return (C1) Arrays.stream((PersistentDataContainer[]) complex).map(SyntaxContainer1_17_R1::new).toArray(SyntaxContainer1_17_R1[]::new); + default: + return (C1) complex; + } + } + + protected static Class internalWrap(Class clazz, int state) { + switch (state) { + case 1: + return SyntaxContainer1_17_R1.class; + case 2: + return SyntaxContainer1_17_R1[].class; + case 3: + return BukkitContainer1_17_R1.class; + case 4: + return BukkitContainer1_17_R1[].class; + default: + return clazz; + } + } + + protected static int internalState(Class clazz) { + if (clazz.isAssignableFrom(PersistentDataContainer.class)) { + return 1; + } + if (clazz.isAssignableFrom(PersistentDataContainer[].class)) { + return 2; + } + if (clazz.isAssignableFrom(IDataContainer.class)) { + return 3; + } + if (clazz.isAssignableFrom(IDataContainer[].class)) { + return 4; + } + return 0; + } + + public static BukkitType1_17_R1 wrap(IDataType type) { + return new BukkitType1_17_R1<>(type); + } + + public static SyntaxType1_17_R1 wrap(PersistentDataType type) { + return new SyntaxType1_17_R1<>(type); + } + +} \ No newline at end of file diff --git a/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/data/hook/BukkitContainerAdapterHook1_17_R1.java b/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/data/hook/BukkitContainerAdapterHook1_17_R1.java new file mode 100644 index 0000000..28d86a3 --- /dev/null +++ b/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/data/hook/BukkitContainerAdapterHook1_17_R1.java @@ -0,0 +1,133 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_17_R1.data.hook; + +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; + +import org.bukkit.craftbukkit.v1_17_R1.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_17_R1.persistence.CraftPersistentDataContainer; +import org.bukkit.craftbukkit.v1_17_R1.persistence.CraftPersistentDataTypeRegistry; +import org.bukkit.persistence.PersistentDataContainer; + +import net.minecraft.nbt.CompoundTag; +import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; +import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; +import net.sourcewriters.minecraft.vcompat.data.nbt.NbtContainer; +import net.sourcewriters.minecraft.vcompat.provider.VersionControl; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_17_R1.data.BukkitContainer1_17_R1; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_17_R1.data.SyntaxContainer1_17_R1; +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookup; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtCompound; + +@SuppressWarnings({ + "rawtypes", + "unchecked" +}) +public final class BukkitContainerAdapterHook1_17_R1 { + + private static final BukkitContainerAdapterHook1_17_R1 HOOK = new BukkitContainerAdapterHook1_17_R1(); + + private final ClassLookup registryRef = ClassLookup.of(CraftPersistentDataTypeRegistry.class) + .searchMethod("create", "createAdapter", Class.class, Class.class, Function.class, Function.class) + .searchField("adapters", "adapters") + .searchField("function", "CREATE_ADAPTER"); + private final ClassLookup entityRef = ClassLookup.of(CraftEntity.class).searchField("registry", "DATA_TYPE_REGISTRY"); + + private BukkitContainerAdapterHook1_17_R1() {} + + private final HashMap map = new HashMap<>(); + + private CraftPersistentDataTypeRegistry getEntityRegistry() { + return (CraftPersistentDataTypeRegistry) entityRef.getFieldValue("registry"); + } + + private void uninjectAll() { + for (CraftPersistentDataTypeRegistry registry : map.keySet()) { + Map adapters = (Map) registryRef.getFieldValue(registry, "adapters"); + adapters.remove(BukkitContainer1_17_R1.class); + adapters.remove(SyntaxContainer1_17_R1.class); + registryRef.setFieldValue(registry, "function", map.get(registry)); + } + map.clear(); + } + + private void inject(CraftPersistentDataTypeRegistry registry) { + if (map.containsKey(registry)) { + return; + } + map.put(registry, (Function) registryRef.getFieldValue(registry, "function")); + Function function = clazz -> createAdapter(registry, registryRef.getMethod("create").type().returnType(), (Class) clazz); + registryRef.setFieldValue(registry, "function", function); + } + + private E createAdapter(CraftPersistentDataTypeRegistry registry, Class adapterType, Class type) { + if (Objects.equals(BukkitContainer1_17_R1.class, type)) { + return (E) buildAdapter(registry, BukkitContainer1_17_R1.class, tag -> fromPrimitiveSyntax(tag)); + } + if (Objects.equals(SyntaxContainer1_17_R1.class, type)) { + return (E) buildAdapter(registry, SyntaxContainer1_17_R1.class, tag -> fromPrimitiveBukkit(registry, tag)); + } + return (E) map.get(registry).apply(type); + } + + private Object buildAdapter(Object handle, Class type, Function function) { + return registryRef.run(handle, "create", type, CompoundTag.class, (Function) input -> toPrimitive(input), + function); + } + + private CompoundTag toPrimitive(WrappedContainer input) { + Object handle = findFinalContainer(input).getHandle(); + if (handle instanceof PersistentDataContainer) { + if (handle instanceof CraftPersistentDataContainer) { + return ((CraftPersistentDataContainer) handle).toTagCompound(); + } + throw new IllegalArgumentException( + "Expected 'CraftPersistentDataContainer' got '" + handle.getClass().getSimpleName() + " instead'!"); + } + if (handle instanceof IDataContainer) { + if (handle instanceof NbtContainer) { + return (CompoundTag) VersionCompatProvider.get().getControl().getBukkitConversion().toMinecraftCompound(((NbtContainer) handle).asNbt()); + } + throw new IllegalArgumentException( + "Expected 'CraftPersistentDataContainer' got '" + handle.getClass().getSimpleName() + " instead'!"); + } + throw new IllegalArgumentException("Unknown WrappedContainer implementation!"); + } + + private BukkitContainer1_17_R1 fromPrimitiveSyntax(CompoundTag data) { + VersionControl control = VersionCompatProvider.get().getControl(); + NbtContainer container = new NbtContainer(control.getDataProvider().getRegistry()); + NbtCompound compound = control.getBukkitConversion().fromMinecraftCompound(data); + container.fromNbt(compound); + return new BukkitContainer1_17_R1(container); + } + + private SyntaxContainer1_17_R1 fromPrimitiveBukkit(CraftPersistentDataTypeRegistry registry, CompoundTag data) { + CraftPersistentDataContainer container = new CraftPersistentDataContainer(registry); + container.putAll(data); + return new SyntaxContainer1_17_R1(container); + } + + private WrappedContainer findFinalContainer(WrappedContainer container) { + WrappedContainer output = container; + while (output.getHandle() instanceof WrappedContainer) { + output = (WrappedContainer) output.getHandle(); + } + return output; + } + + public static void unhookAll() { + HOOK.uninjectAll(); + } + + public static void hookEntity() { + HOOK.inject(HOOK.getEntityRegistry()); + } + + public static void hook(CraftPersistentDataTypeRegistry registry) { + HOOK.inject(registry); + } + +} diff --git a/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/entity/ArmorStand1_17_R1.java b/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/entity/ArmorStand1_17_R1.java new file mode 100644 index 0000000..347a35a --- /dev/null +++ b/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/entity/ArmorStand1_17_R1.java @@ -0,0 +1,24 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_17_R1.entity; + +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.decoration.ArmorStand; +import net.minecraft.world.level.Level; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsArmorStand; + +public class ArmorStand1_17_R1 extends EntityLiving1_17_R1 implements NmsArmorStand { + + public ArmorStand1_17_R1(Level world) { + super(new ArmorStand(EntityType.ARMOR_STAND, world)); + } + + @Override + public void setSmall(boolean small) { + handle.setSmall(small); + } + + @Override + public boolean isSmall() { + return handle.isSmall(); + } + +} \ No newline at end of file diff --git a/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/entity/Entity1_17_R1.java b/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/entity/Entity1_17_R1.java new file mode 100644 index 0000000..b919a15 --- /dev/null +++ b/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/entity/Entity1_17_R1.java @@ -0,0 +1,215 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_17_R1.entity; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.UUID; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.OfflinePlayer; +import org.bukkit.craftbukkit.v1_17_R1.CraftWorld; +import org.bukkit.craftbukkit.v1_17_R1.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_17_R1.util.CraftChatMessage; +import org.bukkit.entity.Player; + +import net.minecraft.network.protocol.game.ClientboundAddEntityPacket; +import net.minecraft.network.protocol.game.ClientboundRemoveEntitiesPacket; +import net.minecraft.network.protocol.game.ClientboundSetEntityDataPacket; +import net.minecraft.server.network.ServerGamePacketListenerImpl; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.phys.AABB; +import net.minecraft.world.phys.Vec3; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.provider.utils.NmsBoundingBox; + +public abstract class Entity1_17_R1 implements NmsEntity { + + protected final E handle; + + protected final List visible = Collections.synchronizedList(new ArrayList<>()); + + public Entity1_17_R1(E handle) { + this.handle = handle; + } + + @Override + public final E getHandle() { + return handle; + } + + @Override + public int getId() { + return handle.getId(); + } + + @Override + public UUID getUniqueId() { + return handle.getUUID(); + } + + @Override + public NmsBoundingBox getBoundingBox() { + AABB box = handle.getBoundingBox(); + return new NmsBoundingBox(box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ); + } + + @Override + public void setCustomName(String name) { + handle.setCustomName(CraftChatMessage.fromStringOrNull(name)); + updateVisibility(); + } + + @Override + public String getCustomName() { + return CraftChatMessage.fromComponent(handle.getCustomName()); + } + + @Override + public void setGravity(boolean gravity) { + handle.setNoGravity(!gravity); + } + + @Override + public boolean hasGravity() { + return !handle.isNoGravity(); + } + + @Override + public void setCustomNameVisible(boolean visible) { + handle.setCustomNameVisible(visible); + } + + @Override + public boolean isCustomNameVisible() { + return handle.isCustomNameVisible(); + } + + @Override + public void setInvisible(boolean invisible) { + handle.setInvisible(invisible); + } + + @Override + public boolean isInvisible() { + return handle.isInvisible(); + } + + @Override + public boolean isInteractable() { + return handle.isPushable(); + } + + @Override + public boolean isCollidable() { + return handle.canBeCollidedWith(); + } + + @Override + public void setInvulnerable(boolean invulnerable) { + handle.setInvulnerable(invulnerable); + } + + @Override + public boolean isInvulnerable() { + return handle.isInvulnerable(); + } + + @Override + public void setLocation(Location location) { + handle.moveTo(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); + if (location.getWorld() == null || handle.getCommandSenderWorld().getWorld() == location.getWorld()) { + updateVisibility(); + return; + } + handle.level = ((CraftWorld) location.getWorld()).getHandle(); + updateVisibility(); + } + + @Override + public Location getLocation() { + Vec3 vector = handle.position(); + return new Location(handle.getCommandSenderWorld().getWorld(), vector.x, vector.y, vector.z); + } + + @Override + public void updateVisibility() { + if (visible.isEmpty()) { + return; + } + Player[] players; + synchronized (visible) { + players = visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) + .toArray(Player[]::new); + } + hide(players); + show(players); + } + + @Override + public boolean isShown(Player player) { + synchronized (visible) { + return visible.contains(player.getUniqueId()); + } + } + + @Override + public void hide(Player... players) { + if (players.length == 0) { + return; + } + ClientboundRemoveEntitiesPacket packet = new ClientboundRemoveEntitiesPacket(handle.getId()); + for (Player player : players) { + if (!isShown(player)) { + continue; + } + ((CraftPlayer) player).getHandle().connection.send(packet); + synchronized (visible) { + visible.remove(player.getUniqueId()); + } + } + } + + @Override + public void show(Player... players) { + if (players.length == 0) { + return; + } + ClientboundAddEntityPacket packet = new ClientboundAddEntityPacket(handle); + ClientboundSetEntityDataPacket metadataPacket = new ClientboundSetEntityDataPacket(handle.getId(), handle.getEntityData(), true); + ServerGamePacketListenerImpl connection; + for (Player player : players) { + if (isShown(player)) { + continue; + } + connection = ((CraftPlayer) player).getHandle().connection; + connection.send(packet); + connection.send(metadataPacket); + synchronized (visible) { + visible.add(player.getUniqueId()); + } + } + } + + @Override + public UUID[] getVisible() { + synchronized (visible) { + return visible.toArray(new UUID[0]); + } + } + + @Override + public Player[] getVisibleAsPlayer() { + synchronized (visible) { + return visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) + .toArray(Player[]::new); + } + } + + @Override + public void kill() { + hide(getVisibleAsPlayer()); + handle.kill(); + } + +} \ No newline at end of file diff --git a/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/entity/EntityLiving1_17_R1.java b/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/entity/EntityLiving1_17_R1.java new file mode 100644 index 0000000..0c502ff --- /dev/null +++ b/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/entity/EntityLiving1_17_R1.java @@ -0,0 +1,17 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_17_R1.entity; + +import net.minecraft.world.entity.LivingEntity; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityLiving; + +public abstract class EntityLiving1_17_R1 extends Entity1_17_R1 implements NmsEntityLiving { + + public EntityLiving1_17_R1(E handle) { + super(handle); + } + + @Override + public void setCollidable(boolean collidable) { + handle.collides = collidable; + } + +} \ No newline at end of file diff --git a/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/entity/Player1_17_R1.java b/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/entity/Player1_17_R1.java new file mode 100644 index 0000000..1145314 --- /dev/null +++ b/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/entity/Player1_17_R1.java @@ -0,0 +1,293 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_17_R1.entity; + +import java.util.ArrayList; +import java.util.Collections; + +import org.bukkit.craftbukkit.v1_17_R1.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_17_R1.util.CraftChatMessage; +import org.bukkit.entity.Player; + +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.properties.Property; +import com.mojang.authlib.properties.PropertyMap; +import com.mojang.datafixers.util.Pair; + +import net.minecraft.network.chat.Component; +import net.minecraft.network.protocol.game.ClientboundAddPlayerPacket; +import net.minecraft.network.protocol.game.ClientboundEntityEventPacket; +import net.minecraft.network.protocol.game.ClientboundPlayerInfoPacket; +import net.minecraft.network.protocol.game.ClientboundPlayerPositionPacket; +import net.minecraft.network.protocol.game.ClientboundRemoveEntitiesPacket; +import net.minecraft.network.protocol.game.ClientboundRespawnPacket; +import net.minecraft.network.protocol.game.ClientboundRotateHeadPacket; +import net.minecraft.network.protocol.game.ClientboundSetActionBarTextPacket; +import net.minecraft.network.protocol.game.ClientboundSetCarriedItemPacket; +import net.minecraft.network.protocol.game.ClientboundSetEntityDataPacket; +import net.minecraft.network.protocol.game.ClientboundSetEquipmentPacket; +import net.minecraft.network.protocol.game.ClientboundSetSubtitleTextPacket; +import net.minecraft.network.protocol.game.ClientboundSetTitleTextPacket; +import net.minecraft.network.protocol.game.ClientboundSetTitlesAnimationPacket; +import net.minecraft.network.protocol.game.ClientboundTabListPacket; +import net.minecraft.network.protocol.game.ServerboundClientCommandPacket; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.server.network.ServerGamePacketListenerImpl; +import net.minecraft.util.Mth; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.biome.BiomeManager; +import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.provider.data.type.SkinDataType; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_17_R1.data.SyntaxContainer1_17_R1; +import net.sourcewriters.minecraft.vcompat.util.bukkit.Players; +import net.sourcewriters.minecraft.vcompat.util.minecraft.MojangProfileServer; +import net.sourcewriters.minecraft.vcompat.util.minecraft.Skin; +import net.sourcewriters.minecraft.vcompat.util.thread.PostAsync; + +public class Player1_17_R1 extends EntityLiving1_17_R1 implements NmsPlayer { + + private String realName; + private Skin realSkin; + + private final WrappedContainer dataAdapter; + + public Player1_17_R1(Player player) { + super(((CraftPlayer) player).getHandle()); + dataAdapter = new SyntaxContainer1_17_R1(getBukkitPlayer().getPersistentDataContainer()); + update(false); + } + + @Override + public CraftPlayer getBukkitPlayer() { + return handle.getBukkitEntity(); + } + + @Override + public WrappedContainer getDataAdapter() { + return dataAdapter; + } + + @Override + public void setSkin(Skin skin) { + if (skin == null) { + return; + } + dataAdapter.set("skin", skin, SkinDataType.WRAPPED_INSTANCE); + } + + @Override + public Skin getSkin() { + return dataAdapter.getOrDefault("skin", SkinDataType.WRAPPED_INSTANCE, realSkin); + } + + @Override + public Skin getRealSkin() { + return realSkin; + } + + @Override + public void setName(String name) { + if (getName().equals(name)) { + return; + } + if (name == null) { + dataAdapter.remove("name"); + return; + } + dataAdapter.set("name", name, WrapType.STRING); + } + + @Override + public String getName() { + return dataAdapter.getOrDefault("name", WrapType.STRING, realName); + } + + @Override + public String getRealName() { + return realName; + } + + @Override + public void setPlayerListHeader(String text) { + setPlayerListHeaderAndFooter(text, getPlayerListFooter()); + } + + @Override + public String getPlayerListHeader() { + return dataAdapter.getOrDefault("header", WrapType.STRING, ""); + } + + @Override + public void setPlayerListFooter(String text) { + setPlayerListHeaderAndFooter(getPlayerListHeader(), text); + } + + @Override + public String getPlayerListFooter() { + return dataAdapter.getOrDefault("footer", WrapType.STRING, ""); + } + + @Override + public int getPing() { + return handle.latency; + } + + @Override + public void setPlayerListHeaderAndFooter(String header, String footer) { + dataAdapter.set("header", header, WrapType.STRING); + dataAdapter.set("footer", footer, WrapType.STRING); + sendPlayerListInfo(header, footer); + } + + private final void sendPlayerListInfo(String header, String footer) { + if (handle.hasDisconnected()) { + return; + } + + Component headerComponent = header.isEmpty() ? null : CraftChatMessage.fromStringOrNull(header, true); + Component footerComponent = footer.isEmpty() ? null : CraftChatMessage.fromStringOrNull(footer, true); + + handle.connection.send(new ClientboundTabListPacket(headerComponent, footerComponent)); + } + + @Override + public void setTitleTimes(int fadeIn, int stay, int fadeOut) { + if (handle.hasDisconnected()) { + return; + } + handle.connection.send(new ClientboundSetTitlesAnimationPacket(fadeIn, stay, fadeOut)); + } + + @Override + public void sendSubtitle(String text) { + if (handle.hasDisconnected()) { + return; + } + handle.connection.send(new ClientboundSetSubtitleTextPacket(CraftChatMessage.fromStringOrNull(text))); + } + + @Override + public void sendTitle(String text) { + if (handle.hasDisconnected()) { + return; + } + handle.connection.send(new ClientboundSetTitleTextPacket(CraftChatMessage.fromStringOrNull(text))); + } + + @Override + public void sendActionBar(String text) { + if (handle.hasDisconnected()) { + return; + } + handle.connection.send(new ClientboundSetActionBarTextPacket(CraftChatMessage.fromStringOrNull(text))); + } + + @Override + public void fakeRespawn() { + if (handle.hasDisconnected()) { + return; + } + ClientboundPlayerInfoPacket remInfoPacket = new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.REMOVE_PLAYER, + handle); + ClientboundPlayerInfoPacket addInfoPacket = new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.ADD_PLAYER, handle); + + ClientboundRemoveEntitiesPacket destroyPacket = new ClientboundRemoveEntitiesPacket(handle.getId()); + ClientboundAddPlayerPacket spawnPacket = new ClientboundAddPlayerPacket(handle); + ClientboundRotateHeadPacket rotationPacket = new ClientboundRotateHeadPacket(handle, + (byte) Mth.floor(handle.getYHeadRot() * 256F / 360F)); + + ArrayList> list = new ArrayList<>(); + for (EquipmentSlot slot : EquipmentSlot.values()) { + list.add(Pair.of(slot, handle.getItemBySlot(slot))); + } + ClientboundSetEquipmentPacket equipmentPacket = new ClientboundSetEquipmentPacket(handle.getId(), list); + + Player self = getBukkitPlayer(); + Player[] players = Players.getOnlineWithout(getUniqueId()); + for (Player player : players) { + if (!player.canSee(self)) { + continue; + } + ServerGamePacketListenerImpl connection = ((CraftPlayer) player).getHandle().connection; + connection.send(remInfoPacket); + connection.send(addInfoPacket); + connection.send(destroyPacket); + connection.send(spawnPacket); + connection.send(rotationPacket); + connection.send(equipmentPacket); + } + + ServerLevel world = (ServerLevel) handle.level; + + ClientboundRespawnPacket respawnPacket = new ClientboundRespawnPacket(world.dimensionType(), world.dimension(), + BiomeManager.obfuscateSeed(world.getSeed()), handle.gameMode.getGameModeForPlayer(), + handle.gameMode.getPreviousGameModeForPlayer(), world.isDebug(), world.isFlat(), true); + ClientboundPlayerPositionPacket positionPacket = new ClientboundPlayerPositionPacket(handle.getX(), handle.getY(), handle.getZ(), + handle.xRotO, handle.yRotO, Collections.emptySet(), 0, false); + ClientboundSetCarriedItemPacket itemPacket = new ClientboundSetCarriedItemPacket(handle.getInventory().selected); + ClientboundEntityEventPacket statusPacket = new ClientboundEntityEventPacket(handle, (byte) 28); + ClientboundSetEntityDataPacket metadataPacket = new ClientboundSetEntityDataPacket(handle.getId(), handle.getEntityData(), true); + + ServerGamePacketListenerImpl connection = handle.connection; + connection.send(remInfoPacket); + connection.send(addInfoPacket); + connection.send(respawnPacket); + connection.send(positionPacket); + connection.send(itemPacket); + connection.send(statusPacket); + connection.send(metadataPacket); + + handle.onUpdateAbilities(); + handle.resetSentInfo(); + handle.inventoryMenu.broadcastChanges(); + handle.inventoryMenu.sendAllDataToRemote(); + if (handle.containerMenu != handle.inventoryMenu) { + handle.containerMenu.broadcastChanges(); + handle.containerMenu.sendAllDataToRemote(); + } + self.recalculatePermissions(); + } + + @Override + public void respawn() { + if (handle.connection.isDisconnected()) { + return; + } + handle.connection.send(new ServerboundClientCommandPacket(ServerboundClientCommandPacket.Action.PERFORM_RESPAWN)); + } + + @Override + public void update() { + update(true); + } + + private final void update(boolean flag) { + PostAsync.forcePost(() -> { + realName = MojangProfileServer.getName(getUniqueId()); + realSkin = MojangProfileServer.getSkin(realName, getUniqueId()); + }); + if (flag) { + GameProfile profile = handle.getGameProfile(); + + Skin skin = getSkin(); + if (skin != null) { + PropertyMap properties = profile.getProperties(); + properties.removeAll("textures"); + properties.put("textures", new Property("textures", skin.getValue(), skin.getSignature())); + } + + String name = getName(); + if (name != null) { + VersionCompatProvider.get().getLookupProvider().getLookup("mjGameProfile").setFieldValue(profile, "name", name); + } + + if (!(name == null && skin == null)) { + fakeRespawn(); + } + } + } + +} \ No newline at end of file diff --git a/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/tools/BlockTools1_17_R1.java b/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/tools/BlockTools1_17_R1.java new file mode 100644 index 0000000..8beb61e --- /dev/null +++ b/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/tools/BlockTools1_17_R1.java @@ -0,0 +1,38 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_17_R1.tools; + +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_17_R1.block.CraftSkull; + +import com.mojang.authlib.properties.Property; +import com.mojang.authlib.properties.PropertyMap; + +import net.minecraft.world.level.block.entity.SkullBlockEntity; +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookup; +import net.sourcewriters.minecraft.vcompat.provider.tools.BlockTools; +import net.sourcewriters.minecraft.vcompat.util.constants.MinecraftConstants; + +public class BlockTools1_17_R1 extends BlockTools { + + private final ClassLookup craftEntityStateRef = ClassLookup.of(CraftSkull.class).searchField("tileEntity", "tileEntity"); + + @Override + public void setHeadTexture(Block block, String texture) { + if (!(block instanceof CraftSkull)) { + return; + } + SkullBlockEntity entitySkull = (SkullBlockEntity) craftEntityStateRef.getFieldValue(block, "tileEntity"); + PropertyMap map = entitySkull.owner.getProperties(); + map.removeAll("textures"); + map.put("textures", new Property("textures", MinecraftConstants.TEXTURE_SIGNATURE, texture)); + } + + @Override + public String getHeadTexture(Block block) { + if (!(block instanceof CraftSkull)) { + return null; + } + SkullBlockEntity entitySkull = (SkullBlockEntity) craftEntityStateRef.getFieldValue(block, "tileEntity"); + return entitySkull.owner.getProperties().get("textures").iterator().next().getValue(); + } + +} \ No newline at end of file diff --git a/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/tools/ServerTools1_17_R1.java b/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/tools/ServerTools1_17_R1.java new file mode 100644 index 0000000..6777320 --- /dev/null +++ b/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/tools/ServerTools1_17_R1.java @@ -0,0 +1,26 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_17_R1.tools; + +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_17_R1.CraftServer; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_17_R1.wrapper.ConsoleReaderWrapper1_17_R1; +import net.sourcewriters.minecraft.vcompat.provider.tools.ServerTools; + +public class ServerTools1_17_R1 extends ServerTools { + + @Override + public void setMotd(String text) { + ((CraftServer) Bukkit.getServer()).getServer().setMotd(text); + } + + @Override + public String getMotd() { + return ((CraftServer) Bukkit.getServer()).getServer().getMotd(); + } + + @Override + public ConsoleReaderWrapper1_17_R1 getConsole() { + return ConsoleReaderWrapper1_17_R1.INSTANCE; + } + +} \ No newline at end of file diff --git a/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/tools/SkinTools1_17_R1.java b/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/tools/SkinTools1_17_R1.java new file mode 100644 index 0000000..69c1d2f --- /dev/null +++ b/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/tools/SkinTools1_17_R1.java @@ -0,0 +1,16 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_17_R1.tools; + +import org.bukkit.craftbukkit.v1_17_R1.entity.CraftPlayer; +import org.bukkit.entity.Player; + +import net.sourcewriters.minecraft.vcompat.provider.tools.SkinTools; +import net.sourcewriters.minecraft.vcompat.util.minecraft.Skin; + +public class SkinTools1_17_R1 extends SkinTools { + + @Override + public Skin skinFromPlayer(Player player) { + return skinFromGameProfile(((CraftPlayer) player).getHandle().getGameProfile()); + } + +} \ No newline at end of file diff --git a/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/utils/EntityConstructors1_17_R1.java b/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/utils/EntityConstructors1_17_R1.java new file mode 100644 index 0000000..a80891f --- /dev/null +++ b/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/utils/EntityConstructors1_17_R1.java @@ -0,0 +1,12 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_17_R1.utils; + +import java.util.function.Function; + +import net.minecraft.world.level.Level; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_17_R1.entity.ArmorStand1_17_R1; + +public abstract class EntityConstructors1_17_R1 { + + public static final Function ARMOR_STAND = (world -> new ArmorStand1_17_R1(world)); + +} \ No newline at end of file diff --git a/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/wrapper/ConsoleReaderWrapper1_17_R1.java b/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/wrapper/ConsoleReaderWrapper1_17_R1.java new file mode 100644 index 0000000..ab2759b --- /dev/null +++ b/vcompat-1_17_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_17_R1/wrapper/ConsoleReaderWrapper1_17_R1.java @@ -0,0 +1,50 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_17_R1.wrapper; + +import java.io.IOException; +import java.io.Writer; + +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_17_R1.CraftServer; + +import net.sourcewriters.minecraft.vcompat.provider.wrapper.ConsoleReaderWrapper; + +import org.bukkit.craftbukkit.Main; +import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; + +public final class ConsoleReaderWrapper1_17_R1 extends ConsoleReaderWrapper { + + public static final ConsoleReaderWrapper1_17_R1 INSTANCE = new ConsoleReaderWrapper1_17_R1(); + + private final ConsoleReader reader; + + @SuppressWarnings("resource") + private ConsoleReaderWrapper1_17_R1() { + this.reader = ((CraftServer) Bukkit.getServer()).getServer().reader; + } + + @Override + public Writer getOutput() { + return reader.getOutput(); + } + + @Override + public boolean isAnsiSupported() { + return reader.getTerminal().isAnsiSupported(); + } + + @Override + public void flush() throws IOException { + reader.flush(); + } + + @Override + public void drawLine() throws IOException { + reader.drawLine(); + } + + @Override + public boolean isJLineSupported() { + return Main.useJline; + } + +} diff --git a/vcompat-1_18_R1/pom.xml b/vcompat-1_18_R1/pom.xml new file mode 100644 index 0000000..e73ec3f --- /dev/null +++ b/vcompat-1_18_R1/pom.xml @@ -0,0 +1,96 @@ + + 4.0.0 + + net.sourcewriters.minecraft + vcompat-parent + 3.0.0 + + vcompat-1_18_R1 + + + ${project.basedir}\..\libraries\spigot + + + + + minecraft-libraries + Minecraft Libraries + https://libraries.minecraft.net + + + + + + net.sourcewriters.minecraft + vcompat-api + 3.0.0 + provided + + + + + + spigot + remapped + 0.1 + system + ${spigot.libPath}\spigot-1.18.1.jar + + + it.unimi.dsi + fastutil + 8.5.6 + provided + + + com.mojang + datafixerupper + 1.0.20 + provided + + + jline + jline + 2.12.1 + provided + + + + + + + net.md-5 + specialsource-maven-plugin + 1.2.2 + + + package + + remap + + remap-obf + + org.spigotmc:minecraft-server:1.18.1-R0.1-SNAPSHOT:txt:maps-mojang + true + org.spigotmc:spigot:1.18.1-R0.1-SNAPSHOT:jar:remapped-mojang + true + remapped-obf + + + + package + + remap + + remap-spigot + + ${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar + org.spigotmc:minecraft-server:1.18.1-R0.1-SNAPSHOT:csrg:maps-spigot + org.spigotmc:spigot:1.18.1-R0.1-SNAPSHOT:jar:remapped-obf + + + + + + + \ No newline at end of file diff --git a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/BukkitConversion1_17_R1.java b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/BukkitConversion1_17_R1.java new file mode 100644 index 0000000..f7f4b43 --- /dev/null +++ b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/BukkitConversion1_17_R1.java @@ -0,0 +1,209 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1; + +import org.bukkit.craftbukkit.v1_18_R1.inventory.CraftItemStack; +import org.bukkit.entity.EntityType; + +import net.minecraft.nbt.ByteArrayTag; +import net.minecraft.nbt.ByteTag; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.DoubleTag; +import net.minecraft.nbt.EndTag; +import net.minecraft.nbt.FloatTag; +import net.minecraft.nbt.IntArrayTag; +import net.minecraft.nbt.IntTag; +import net.minecraft.nbt.ListTag; +import net.minecraft.nbt.LongArrayTag; +import net.minecraft.nbt.LongTag; +import net.minecraft.nbt.ShortTag; +import net.minecraft.nbt.StringTag; +import net.minecraft.nbt.Tag; +import net.minecraft.world.item.ItemStack; +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterContext; +import net.sourcewriters.minecraft.vcompat.data.api.IDataType; +import net.sourcewriters.minecraft.vcompat.provider.BukkitConversion; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContext; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityType; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.data.BukkitContext1_17_R1; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.data.BukkitType1_17_R1; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtByte; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtByteArray; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtCompound; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtDouble; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtEnd; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtFloat; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtInt; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtIntArray; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtList; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtLong; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtLongArray; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtShort; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtString; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtTag; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtType; + +public class BukkitConversion1_17_R1 extends BukkitConversion { + + protected BukkitConversion1_17_R1(VersionControl1_17_R1 versionControl) { + super(versionControl); + } + + @Override + public EntityType toEntityType(NmsEntityType type) { + try { + return EntityType.valueOf(type.name()); + } catch (IllegalArgumentException ignore) { + return null; + } + } + + @Override + public NmsEntityType fromEntityType(EntityType type) { + try { + return NmsEntityType.valueOf(type.name()); + } catch (IllegalArgumentException ignore) { + return null; + } + } + + @Override + public Tag toMinecraftTag(NbtTag tag) { + switch (tag.getType()) { + case END: + return EndTag.INSTANCE; + case BYTE: + return ByteTag.valueOf(((NbtByte) tag).getValue()); + case BYTE_ARRAY: + return new ByteArrayTag(((NbtByteArray) tag).getValue()); + case DOUBLE: + return DoubleTag.valueOf(((NbtDouble) tag).getValue()); + case FLOAT: + return FloatTag.valueOf(((NbtFloat) tag).getValue()); + case INT: + return IntTag.valueOf(((NbtInt) tag).getValue()); + case INT_ARRAY: + return new IntArrayTag(((NbtIntArray) tag).getValue()); + case LONG: + return LongTag.valueOf(((NbtLong) tag).getValue()); + case LONG_ARRAY: + return new LongArrayTag(((NbtLongArray) tag).getValue()); + case SHORT: + return ShortTag.valueOf(((NbtShort) tag).getValue()); + case STRING: + return StringTag.valueOf(((NbtString) tag).getValue()); + case LIST: + return toMinecraftList((NbtList) tag); + case COMPOUND: + return toMinecraftCompound((NbtCompound) tag); + default: + return null; + } + } + + @Override + public NbtTag fromMinecraftTag(Object tag) { + if (tag != null && tag instanceof Tag) { + return fromMinecraftTag0((Tag) tag); + } + return null; + } + + public NbtTag fromMinecraftTag0(Tag tag) { + switch (NbtType.getById(tag.getId())) { + case END: + return NbtEnd.INSTANCE; + case BYTE: + return new NbtByte(((ByteTag) tag).getAsByte()); + case BYTE_ARRAY: + return new NbtByteArray(((ByteArrayTag) tag).getAsByteArray()); + case DOUBLE: + return new NbtDouble(((DoubleTag) tag).getAsDouble()); + case FLOAT: + return new NbtFloat(((FloatTag) tag).getAsFloat()); + case INT: + return new NbtInt(((IntTag) tag).getAsInt()); + case INT_ARRAY: + return new NbtIntArray(((IntArrayTag) tag).getAsIntArray()); + case LONG: + return new NbtLong(((LongTag) tag).getAsLong()); + case LONG_ARRAY: + return new NbtLongArray(((LongArrayTag) tag).getAsLongArray()); + case SHORT: + return new NbtShort(((ShortTag) tag).getAsShort()); + case STRING: + return new NbtString(((StringTag) tag).getAsString()); + case LIST: + return fromMinecraftList(tag); + case COMPOUND: + return fromMinecraftCompound(tag); + default: + return null; + } + } + + @Override + public ListTag toMinecraftList(NbtList list) { + ListTag output = new ListTag(); + for (NbtTag tag : list) { + output.add(toMinecraftTag(tag)); + } + return output; + } + + @Override + public NbtList fromMinecraftList(Object raw) { + if (!(raw instanceof ListTag)) { + return null; + } + ListTag list = (ListTag) raw; + NbtList output = new NbtList<>(NbtType.getById(list.getElementType())); + for (Tag base : list) { + output.add(fromMinecraftTag(base)); + } + return output; + } + + @Override + public CompoundTag toMinecraftCompound(NbtCompound compound) { + NbtCompound compoundTag = compound; + CompoundTag targetCompound = new CompoundTag(); + for (String key : compoundTag.getKeys()) { + targetCompound.put(key, toMinecraftTag(compoundTag.get(key))); + } + return targetCompound; + } + + @Override + public NbtCompound fromMinecraftCompound(Object raw) { + if (!(raw instanceof CompoundTag)) { + return null; + } + CompoundTag compoundTag = (CompoundTag) raw; + NbtCompound targetCompound = new NbtCompound(); + for (String key : compoundTag.getAllKeys()) { + targetCompound.set(key, fromMinecraftTag(compoundTag.get(key))); + } + return targetCompound; + } + + @Override + public org.bukkit.inventory.ItemStack itemFromCompound(NbtCompound compound) { + return CraftItemStack.asBukkitCopy(ItemStack.of(toMinecraftCompound(compound))); + } + + @Override + public NbtCompound itemToCompound(org.bukkit.inventory.ItemStack itemStack) { + return fromMinecraftCompound(CraftItemStack.asNMSCopy(itemStack).save(new CompoundTag())); + } + + @Override + public WrappedContext createContext(IDataAdapterContext context) { + return new BukkitContext1_17_R1(context); + } + + @Override + public WrapType wrap(IDataType dataType) { + return new BukkitType1_17_R1<>(dataType); + } + +} \ No newline at end of file diff --git a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/EntityProvider1_17_R1.java b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/EntityProvider1_17_R1.java new file mode 100644 index 0000000..3529788 --- /dev/null +++ b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/EntityProvider1_17_R1.java @@ -0,0 +1,47 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1; + +import java.util.EnumMap; +import java.util.function.Function; + +import org.bukkit.craftbukkit.v1_18_R1.CraftWorld; + +import net.minecraft.world.level.Level; +import net.sourcewriters.minecraft.vcompat.provider.EntityProvider; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityType; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.utils.EntityConstructors1_17_R1; + +public class EntityProvider1_17_R1 extends EntityProvider { + + private final EnumMap> entityMap = new EnumMap<>(NmsEntityType.class); + + protected EntityProvider1_17_R1(VersionControl1_17_R1 versionControl) { + super(versionControl); + } + + @SuppressWarnings("unchecked") + private final Function searchConstructor(NmsEntityType type) { + try { + return (Function) EntityConstructors1_17_R1.class.getField(type.name()).get(null); + } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException ignore) { + return null; + } + } + + private final Function getConstructor(NmsEntityType type) { + return entityMap.computeIfAbsent(type, (key -> searchConstructor(key))); + } + + @Override + public NmsEntity createEntity(org.bukkit.World world, NmsEntityType type) { + if (!(world instanceof CraftWorld)) { + return null; + } + Function function; + if ((function = getConstructor(type)) == null) { + return null; + } + return function.apply(((CraftWorld) world).getHandle()); + } + +} \ No newline at end of file diff --git a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/PlayerProvider1_17_R1.java b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/PlayerProvider1_17_R1.java new file mode 100644 index 0000000..971441c --- /dev/null +++ b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/PlayerProvider1_17_R1.java @@ -0,0 +1,20 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1; + +import org.bukkit.entity.Player; + +import net.sourcewriters.minecraft.vcompat.provider.PlayerProvider; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.entity.Player1_17_R1; + +public class PlayerProvider1_17_R1 extends PlayerProvider { + + protected PlayerProvider1_17_R1(VersionControl1_17_R1 versionControl) { + super(versionControl); + } + + @Override + protected NmsPlayer createPlayer(Player player) { + return new Player1_17_R1(player); + } + +} \ No newline at end of file diff --git a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/TextureProvider1_17_R1.java b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/TextureProvider1_17_R1.java new file mode 100644 index 0000000..7e21642 --- /dev/null +++ b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/TextureProvider1_17_R1.java @@ -0,0 +1,101 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1; + +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_18_R1.block.CraftBlockEntityState; +import org.bukkit.craftbukkit.v1_18_R1.block.CraftSkull; +import org.bukkit.craftbukkit.v1_18_R1.inventory.CraftItemStack; +import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.inventory.meta.SkullMeta; + +import com.mojang.authlib.GameProfile; + +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.NbtUtils; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.entity.SkullBlockEntity; +import net.sourcewriters.minecraft.vcompat.provider.TextureProvider; +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookup; + +public class TextureProvider1_17_R1 extends TextureProvider { + + private final ClassLookup craftEntityStateRef = ClassLookup.of(CraftBlockEntityState.class).searchField("tileEntity", "tileEntity"); + private final ClassLookup craftItemStackRef = ClassLookup.of(CraftItemStack.class).searchField("handle", "handle"); + private final ClassLookup craftMetaSkullRef = ClassLookup.of("org.bukkit.craftbukkit.v1_17_R1.inventory.CraftMetaSkull") + .searchField("serialized", "serializedProfile").searchField("profile", "profile"); + + protected TextureProvider1_17_R1(VersionControl1_17_R1 versionControl) { + super(versionControl); + } + + @Override + public GameProfile profileFromBlock(Block block) { + if (!(block instanceof CraftSkull)) { + return null; + } + SkullBlockEntity entitySkull = (SkullBlockEntity) craftEntityStateRef.getFieldValue(block, "tileEntity"); + return entitySkull.owner; + } + + @Override + public GameProfile profileFromItem(org.bukkit.inventory.ItemStack itemStack) { + if (!(itemStack.getItemMeta() instanceof SkullMeta)) { + return null; + } + SkullMeta meta = (SkullMeta) itemStack.getItemMeta(); + GameProfile profile = (GameProfile) craftMetaSkullRef.getFieldValue(meta, "profile"); + if (profile == null) { + CompoundTag compound = (CompoundTag) craftMetaSkullRef.getFieldValue(meta, "serialized"); + if (compound == null) { + ItemStack stack = null; + if (itemStack instanceof CraftItemStack) { + stack = (ItemStack) craftItemStackRef.getFieldValue(itemStack, "handle"); + } + if (stack == null) { + stack = CraftItemStack.asNMSCopy(itemStack); + } + CompoundTag stackTag = stack.getOrCreateTag(); + if (stackTag.contains("SkullOwner", 10)) { + compound = stackTag.getCompound("SkullOwner"); + } else if (stackTag.contains("SkullProfile", 10)) { + compound = stackTag.getCompound("SkullProfile"); + } + } + if (compound == null) { + return null; + } + profile = NbtUtils.readGameProfile(compound); + } + return profile; + } + + @Override + public org.bukkit.inventory.ItemStack getItem(GameProfile profile) { + org.bukkit.inventory.ItemStack craftStack = CraftItemStack.asCraftCopy(new org.bukkit.inventory.ItemStack(Material.PLAYER_HEAD)); + applyItem(craftStack, profile); + return craftStack; + } + + @Override + public boolean applyItem(org.bukkit.inventory.ItemStack itemStack, GameProfile profile) { + ItemMeta meta = itemStack.getItemMeta(); + if (!(meta instanceof SkullMeta)) { + return false; + } + SkullMeta skullMeta = (SkullMeta) meta; + craftMetaSkullRef.setFieldValue(meta, "profile", profile); + itemStack.setItemMeta(skullMeta); + return true; + } + + @Override + public boolean applyBlock(Block block, GameProfile profile) { + if (!(block instanceof CraftSkull)) { + return false; + } + SkullBlockEntity entitySkull = (SkullBlockEntity) craftEntityStateRef.getFieldValue(block, "tileEntity"); + entitySkull.setOwner(profile); + return true; + } + +} \ No newline at end of file diff --git a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/ToolProvider1_17_R1.java b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/ToolProvider1_17_R1.java new file mode 100644 index 0000000..bf6828b --- /dev/null +++ b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/ToolProvider1_17_R1.java @@ -0,0 +1,33 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1; + +import net.sourcewriters.minecraft.vcompat.provider.ToolProvider; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.tools.BlockTools1_17_R1; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.tools.ServerTools1_17_R1; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.tools.SkinTools1_17_R1; + +public class ToolProvider1_17_R1 extends ToolProvider { + + private final BlockTools1_17_R1 blockTools = new BlockTools1_17_R1(); + private final SkinTools1_17_R1 skinTools = new SkinTools1_17_R1(); + private final ServerTools1_17_R1 serverTools = new ServerTools1_17_R1(); + + protected ToolProvider1_17_R1(VersionControl1_17_R1 versionControl) { + super(versionControl); + } + + @Override + public SkinTools1_17_R1 getSkinTools() { + return skinTools; + } + + @Override + public ServerTools1_17_R1 getServerTools() { + return serverTools; + } + + @Override + public BlockTools1_17_R1 getBlockTools() { + return blockTools; + } + +} \ No newline at end of file diff --git a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/VersionControl1_17_R1.java b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/VersionControl1_17_R1.java new file mode 100644 index 0000000..f4e8632 --- /dev/null +++ b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/VersionControl1_17_R1.java @@ -0,0 +1,55 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1; + +import net.sourcewriters.minecraft.vcompat.provider.VersionControl; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.data.hook.BukkitContainerAdapterHook1_17_R1; + +public class VersionControl1_17_R1 extends VersionControl { + + public static VersionControl1_17_R1 INSTANCE; + + public static VersionControl1_17_R1 init() { + return INSTANCE != null ? INSTANCE : (INSTANCE = new VersionControl1_17_R1()); + } + + private final ToolProvider1_17_R1 toolProvider = new ToolProvider1_17_R1(this); + private final TextureProvider1_17_R1 textureProvider = new TextureProvider1_17_R1(this); + private final EntityProvider1_17_R1 entityProvider = new EntityProvider1_17_R1(this); + private final PlayerProvider1_17_R1 playerProvider = new PlayerProvider1_17_R1(this); + private final BukkitConversion1_17_R1 bukkitConversion = new BukkitConversion1_17_R1(this); + + private VersionControl1_17_R1() { + BukkitContainerAdapterHook1_17_R1.hookEntity(); + } + + @Override + public ToolProvider1_17_R1 getToolProvider() { + return toolProvider; + } + + @Override + public EntityProvider1_17_R1 getEntityProvider() { + return entityProvider; + } + + @Override + public PlayerProvider1_17_R1 getPlayerProvider() { + return playerProvider; + } + + @Override + public TextureProvider1_17_R1 getTextureProvider() { + return textureProvider; + } + + @Override + public BukkitConversion1_17_R1 getBukkitConversion() { + return bukkitConversion; + } + + @Override + public void shutdown() { + dataProvider.getDefaultDistributor().shutdown(); + BukkitContainerAdapterHook1_17_R1.unhookAll(); + } + +} \ No newline at end of file diff --git a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/BukkitContainer1_17_R1.java b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/BukkitContainer1_17_R1.java new file mode 100644 index 0000000..d1be941 --- /dev/null +++ b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/BukkitContainer1_17_R1.java @@ -0,0 +1,160 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.data; + +import java.util.Arrays; +import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; + +import org.bukkit.NamespacedKey; +import org.bukkit.persistence.PersistentDataAdapterContext; +import org.bukkit.persistence.PersistentDataContainer; +import org.bukkit.persistence.PersistentDataType; + +import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedKey; +import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SyntaxKey; + +public final class BukkitContainer1_17_R1 extends WrappedContainer implements PersistentDataContainer { + + private final IDataContainer container; + + public BukkitContainer1_17_R1(IDataContainer container) { + this.container = container; + } + + @Override + public IDataContainer getHandle() { + return container; + } + + @Override + public IDataContainer getAsSyntaxContainer() { + return container; + } + + /* + * + */ + + @Override + public boolean has(NamespacedKey key, PersistentDataType type) { + return has(new BukkitKey1_17_R1(key), WrappedType1_17_R1.wrap(type)); + } + + @Override + public Z get(NamespacedKey key, PersistentDataType type) { + return get(new BukkitKey1_17_R1(key), WrappedType1_17_R1.wrap(type)); + } + + @Override + public Z getOrDefault(NamespacedKey key, PersistentDataType type, Z value) { + return Optional.ofNullable(get(key, type)).orElse(value); + } + + @Override + public void set(NamespacedKey key, PersistentDataType type, Z value) { + set(new BukkitKey1_17_R1(key), value, WrappedType1_17_R1.wrap(type)); + } + + @Override + public void remove(NamespacedKey key) { + remove(new BukkitKey1_17_R1(key)); + } + + @Override + public Set getKeys() { + return Arrays.stream(container.getKeys()).map(SyntaxKey::new).map(BukkitKey1_17_R1::asBukkit).collect(Collectors.toSet()); + } + + @Override + public PersistentDataAdapterContext getAdapterContext() { + return getWrapContext(); + } + + /* + * + */ + + @Override + public BukkitContext1_17_R1 getWrapContext() { + return new BukkitContext1_17_R1(container.getContext()); + } + + @Override + public boolean has(String key) { + return has(wrappedKey(key)); + } + + @Override + public boolean has(WrappedKey key) { + return container.has(key.getNamespacedKey()); + } + + @Override + public boolean has(String key, WrapType type) { + return has(wrappedKey(key), type); + } + + @Override + public boolean has(WrappedKey key, WrapType type) { + return container.has(key.getNamespacedKey(), type.syntaxType()); + } + + @Override + public Object get(String key) { + return get(wrappedKey(key)); + } + + @Override + public Object get(WrappedKey key) { + return container.get(key.getNamespacedKey()); + } + + @Override + public C get(String key, WrapType type) { + return get(wrappedKey(key), type); + } + + @Override + public C get(WrappedKey key, WrapType type) { + return container.get(key.getNamespacedKey(), type.syntaxType()); + } + + @Override + public void set(String key, B value, WrapType type) { + set(wrappedKey(key), value, type); + } + + @Override + public void set(WrappedKey key, B value, WrapType type) { + container.set(key.getNamespacedKey(), value, type.syntaxType()); + } + + @Override + public boolean remove(String key) { + return false; + } + + @Override + public boolean remove(WrappedKey key) { + return container.remove(key.getNamespacedKey()); + } + + @Override + public Set keySet() { + return container.getKeyspaces(); + } + + @Override + public boolean isEmpty() { + return container.isEmpty(); + } + + @Override + public int size() { + return container.size(); + } + +} \ No newline at end of file diff --git a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/BukkitContext1_17_R1.java b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/BukkitContext1_17_R1.java new file mode 100644 index 0000000..53fba24 --- /dev/null +++ b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/BukkitContext1_17_R1.java @@ -0,0 +1,38 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.data; + +import org.bukkit.persistence.PersistentDataAdapterContext; +import org.bukkit.persistence.PersistentDataContainer; + +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterContext; +import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContext; + +public final class BukkitContext1_17_R1 extends WrappedContext implements PersistentDataAdapterContext { + + private final IDataAdapterContext context; + + public BukkitContext1_17_R1(IDataAdapterContext context) { + this.context = context; + } + + @Override + public IDataAdapterContext getHandle() { + return context; + } + + @Override + public PersistentDataContainer newPersistentDataContainer() { + return newWrapContainer(); + } + + @Override + public IDataContainer newContainer() { + return context.newContainer(); + } + + @Override + public BukkitContainer1_17_R1 newWrapContainer() { + return new BukkitContainer1_17_R1(context.newContainer()); + } + +} \ No newline at end of file diff --git a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/BukkitKey1_17_R1.java b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/BukkitKey1_17_R1.java new file mode 100644 index 0000000..428ed1b --- /dev/null +++ b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/BukkitKey1_17_R1.java @@ -0,0 +1,52 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.data; + +import org.bukkit.NamespacedKey; +import org.bukkit.plugin.Plugin; + +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedKey; + +public final class BukkitKey1_17_R1 extends WrappedKey { + + private final NamespacedKey key; + + public BukkitKey1_17_R1(Plugin plugin, String key) { + this.key = new NamespacedKey(plugin, key); + } + + @SuppressWarnings("deprecation") + public BukkitKey1_17_R1(String name, String key) { + this.key = new NamespacedKey(name, key); + } + + public BukkitKey1_17_R1(NamespacedKey key) { + this.key = key; + } + + @Override + public NamespacedKey getHandle() { + return key; + } + + @Override + public String getName() { + return key.getNamespace(); + } + + @Override + public String getKey() { + return key.getKey(); + } + + @Override + public String toString() { + return key.toString(); + } + + public static NamespacedKey asBukkit(WrappedKey key) { + if (key.getHandle() instanceof NamespacedKey) { + return (NamespacedKey) key.getHandle(); + } + return new BukkitKey1_17_R1(key.getName(), key.getKey()).getHandle(); + } + +} \ No newline at end of file diff --git a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/BukkitType1_17_R1.java b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/BukkitType1_17_R1.java new file mode 100644 index 0000000..606f806 --- /dev/null +++ b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/BukkitType1_17_R1.java @@ -0,0 +1,68 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.data; + +import org.bukkit.persistence.PersistentDataAdapterContext; +import org.bukkit.persistence.PersistentDataType; + +import net.sourcewriters.minecraft.vcompat.data.api.IDataType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContext; + +public class BukkitType1_17_R1 extends WrappedType1_17_R1, P0, P1, C0, C1> + implements PersistentDataType { + + private final IDataType type; + + public BukkitType1_17_R1(IDataType type) { + super(type.getPrimitive(), type.getComplex()); + this.type = type; + } + + @Override + public IDataType getHandle() { + return type; + } + + @Override + public Class getPrimitiveOriginal() { + return type.getPrimitive(); + } + + @Override + public Class getComplexOriginal() { + return type.getComplex(); + } + + /* + * + */ + + @Override + public Class getComplexType() { + return complexType; + } + + @Override + public Class getPrimitiveType() { + return primitiveType; + } + + @Override + public P0 toPrimitive(C0 complex, PersistentDataAdapterContext context) { + return wrapToPrimitive(complex, new SyntaxContext1_17_R1(context)); + } + + @Override + public C0 fromPrimitive(P0 primitive, PersistentDataAdapterContext context) { + return wrapToComplex(primitive, new SyntaxContext1_17_R1(context)); + } + + @Override + public P0 wrapToPrimitive(C0 complex, WrappedContext context) { + return toPrimitiveWrapped(type.toPrimitive(context, toComplexOriginal(complex))); + } + + @Override + public C0 wrapToComplex(P0 primitive, WrappedContext context) { + return toComplexWrapped(type.fromPrimitive(context, toPrimitiveOriginal(primitive))); + } + +} \ No newline at end of file diff --git a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/SimpleBukkitType1_17_R1.java b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/SimpleBukkitType1_17_R1.java new file mode 100644 index 0000000..de377fc --- /dev/null +++ b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/SimpleBukkitType1_17_R1.java @@ -0,0 +1,36 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.data; + +import org.bukkit.persistence.PersistentDataAdapterContext; +import org.bukkit.persistence.PersistentDataType; + +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; + +public class SimpleBukkitType1_17_R1 implements PersistentDataType { + + private final WrapType type; + + public SimpleBukkitType1_17_R1(WrapType type) { + this.type = type; + } + + @Override + public Class getComplexType() { + return type.getComplexWrapped(); + } + + @Override + public Class

getPrimitiveType() { + return type.getPrimitiveWrapped(); + } + + @Override + public P toPrimitive(C complex, PersistentDataAdapterContext context) { + return type.wrapToPrimitive(complex, new SyntaxContext1_17_R1(context)); + } + + @Override + public C fromPrimitive(P primitive, PersistentDataAdapterContext context) { + return type.wrapToComplex(primitive, new SyntaxContext1_17_R1(context)); + } + +} \ No newline at end of file diff --git a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/SyntaxContainer1_17_R1.java b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/SyntaxContainer1_17_R1.java new file mode 100644 index 0000000..0137372 --- /dev/null +++ b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/SyntaxContainer1_17_R1.java @@ -0,0 +1,191 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.data; + +import java.util.Set; +import java.util.stream.Collectors; + +import org.bukkit.persistence.PersistentDataContainer; + +import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterContext; +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterRegistry; +import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; +import net.sourcewriters.minecraft.vcompat.data.api.IDataType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedKey; +import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SyntaxKey; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.utils.key.IKey; + +public final class SyntaxContainer1_17_R1 extends WrappedContainer implements IDataContainer { + + private final PersistentDataContainer container; + + public SyntaxContainer1_17_R1(PersistentDataContainer container) { + this.container = container; + } + + @Override + public PersistentDataContainer getHandle() { + return container; + } + + @Override + public IDataContainer getAsSyntaxContainer() { + return new SyntaxContainer1_17_R1(container); + } + + @Override + public IDataAdapterRegistry getRegistry() { + return VersionCompatProvider.get().getControl().getDataProvider().getRegistry(); + } + + /* + * + */ + + @Override + public boolean has(IKey key) { + throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); + } + + @Override + public boolean has(String key, IDataType type) { + return has(syntaxKey(key), type); + } + + @Override + public boolean has(IKey key, IDataType type) { + return has(new SyntaxKey(key), WrappedType1_17_R1.wrap(type)); + } + + @Override + public C get(String key, IDataType type) { + return get(syntaxKey(key), type); + } + + @Override + public C get(IKey key, IDataType type) { + return get(new SyntaxKey(key), WrappedType1_17_R1.wrap(type)); + } + + @Override + public Object get(String key) { + throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); + } + + @Override + public Object get(IKey key) { + throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); + } + + @Override + public void set(String key, E value, IDataType type) { + set(wrappedKey(key), value, WrappedType1_17_R1.wrap(type)); + } + + @Override + public void set(IKey key, E value, IDataType type) { + set(new SyntaxKey(key), value, WrappedType1_17_R1.wrap(type)); + } + + @Override + public boolean remove(String key) { + return remove(wrappedKey(key)); + } + + @Override + public boolean remove(IKey key) { + return remove(new SyntaxKey(key)); + } + + @Override + public IKey[] getKeys() { + return container.getKeys().stream().map(BukkitKey1_17_R1::new).map(WrappedKey::getNamespacedKey).toArray(IKey[]::new); + } + + @Override + public Set getKeyspaces() { + return container.getKeys().stream().map(org.bukkit.NamespacedKey::toString).collect(Collectors.toSet()); + } + + @Override + public IDataAdapterContext getContext() { + return getWrapContext(); + } + + /* + * + */ + + @Override + public SyntaxContext1_17_R1 getWrapContext() { + return new SyntaxContext1_17_R1(container.getAdapterContext()); + } + + @Override + public boolean has(String key) { + throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); + } + + @Override + public boolean has(WrappedKey key) { + throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); + } + + @Override + public boolean has(String key, WrapType type) { + return has(wrappedKey(key), type); + } + + @Override + public boolean has(WrappedKey key, WrapType type) { + return container.has(BukkitKey1_17_R1.asBukkit(key), new SimpleBukkitType1_17_R1<>(type)); + } + + @Override + public Object get(WrappedKey key) { + throw new UnsupportedOperationException("Can't be used with PersistentDataContainer of Bukkit"); + } + + @Override + public C get(String key, WrapType type) { + return get(wrappedKey(key), type); + } + + @Override + public C get(WrappedKey key, WrapType type) { + return container.get(BukkitKey1_17_R1.asBukkit(key), new SimpleBukkitType1_17_R1<>(type)); + } + + @Override + public void set(String key, B value, WrapType type) { + set(wrappedKey(key), value, type); + } + + @Override + public void set(WrappedKey key, B value, WrapType type) { + container.set(BukkitKey1_17_R1.asBukkit(key), new SimpleBukkitType1_17_R1<>(type), value); + } + + @Override + public boolean remove(WrappedKey key) { + container.remove(BukkitKey1_17_R1.asBukkit(key)); + return true; // Will always return true as we don't know if it contained it + } + + @Override + public Set keySet() { + return getKeyspaces(); + } + + @Override + public boolean isEmpty() { + return container.isEmpty(); + } + + @Override + public int size() { + return container.getKeys().size(); + } + +} \ No newline at end of file diff --git a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/SyntaxContext1_17_R1.java b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/SyntaxContext1_17_R1.java new file mode 100644 index 0000000..eb8ede7 --- /dev/null +++ b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/SyntaxContext1_17_R1.java @@ -0,0 +1,37 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.data; + +import org.bukkit.persistence.PersistentDataAdapterContext; +import org.bukkit.persistence.PersistentDataContainer; + +import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContext; + +public final class SyntaxContext1_17_R1 extends WrappedContext implements PersistentDataAdapterContext { + + private final PersistentDataAdapterContext context; + + public SyntaxContext1_17_R1(PersistentDataAdapterContext context) { + this.context = context; + } + + @Override + public PersistentDataAdapterContext getHandle() { + return context; + } + + @Override + public PersistentDataContainer newPersistentDataContainer() { + return context.newPersistentDataContainer(); + } + + @Override + public IDataContainer newContainer() { + return newWrapContainer(); + } + + @Override + public SyntaxContainer1_17_R1 newWrapContainer() { + return new SyntaxContainer1_17_R1(context.newPersistentDataContainer()); + } + +} \ No newline at end of file diff --git a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/SyntaxType1_17_R1.java b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/SyntaxType1_17_R1.java new file mode 100644 index 0000000..394b47b --- /dev/null +++ b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/SyntaxType1_17_R1.java @@ -0,0 +1,75 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.data; + +import org.bukkit.persistence.PersistentDataAdapterContext; +import org.bukkit.persistence.PersistentDataType; + +import net.sourcewriters.minecraft.vcompat.data.api.IDataAdapterContext; +import net.sourcewriters.minecraft.vcompat.data.api.IDataType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContext; + +public class SyntaxType1_17_R1 extends WrappedType1_17_R1, P0, P1, C0, C1> + implements IDataType { + + private final PersistentDataType type; + + public SyntaxType1_17_R1(PersistentDataType type) { + super(type.getPrimitiveType(), type.getComplexType()); + this.type = type; + } + + @Override + public PersistentDataType getHandle() { + return type; + } + + @Override + public Class getPrimitiveOriginal() { + return type.getPrimitiveType(); + } + + @Override + public Class getComplexOriginal() { + return type.getComplexType(); + } + + /* + * + */ + + @Override + public Class getComplex() { + return complexType; + } + + @Override + public Class getPrimitive() { + return primitiveType; + } + + @Override + public P0 toPrimitive(IDataAdapterContext context, C0 complex) { + return wrapToPrimitive(complex, new BukkitContext1_17_R1(context)); + } + + @Override + public C0 fromPrimitive(IDataAdapterContext context, P0 primitive) { + return wrapToComplex(primitive, new BukkitContext1_17_R1(context)); + } + + @Override + public P0 wrapToPrimitive(C0 complex, WrappedContext context) { + if (!(context instanceof PersistentDataAdapterContext)) { + return null; + } + return toPrimitiveWrapped(type.toPrimitive(toComplexOriginal(complex), (PersistentDataAdapterContext) context)); + } + + @Override + public C0 wrapToComplex(P0 primitive, WrappedContext context) { + if (!(context instanceof PersistentDataAdapterContext)) { + return null; + } + return toComplexWrapped(type.fromPrimitive(toPrimitiveOriginal(primitive), (PersistentDataAdapterContext) context)); + } + +} \ No newline at end of file diff --git a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/WrappedType1_17_R1.java b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/WrappedType1_17_R1.java new file mode 100644 index 0000000..48b62fe --- /dev/null +++ b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/WrappedType1_17_R1.java @@ -0,0 +1,149 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.data; + +import java.util.Arrays; + +import org.bukkit.persistence.PersistentDataContainer; +import org.bukkit.persistence.PersistentDataType; + +import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; +import net.sourcewriters.minecraft.vcompat.data.api.IDataType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; + +public abstract class WrappedType1_17_R1 implements WrapType { + + protected final Class primitiveType; + protected final Class complexType; + + private final int primitiveWrap; + private final int complexWrap; + + @SuppressWarnings("unchecked") + protected WrappedType1_17_R1(Class primitive, Class complex) { + this.primitiveWrap = WrappedType1_17_R1.internalState(primitive); + this.complexWrap = WrappedType1_17_R1.internalState(complex); + this.primitiveType = (Class) WrappedType1_17_R1.internalWrap(primitive, primitiveWrap); + this.complexType = (Class) WrappedType1_17_R1.internalWrap(complex, complexWrap); + } + + public abstract H getHandle(); + + public Class getPrimitiveWrapped() { + return primitiveType; + } + + public Class getComplexWrapped() { + return complexType; + } + + public abstract Class getPrimitiveOriginal(); + + public abstract Class getComplexOriginal(); + + @SuppressWarnings("unchecked") + public P0 toPrimitiveWrapped(P1 primitive) { + switch (primitiveWrap) { + case 1: + return (P0) new SyntaxContainer1_17_R1((PersistentDataContainer) primitive); + case 2: + return (P0) Arrays.stream((PersistentDataContainer[]) primitive).map(SyntaxContainer1_17_R1::new) + .toArray(SyntaxContainer1_17_R1[]::new); + case 3: + return (P0) new BukkitContainer1_17_R1((IDataContainer) primitive); + case 4: + return (P0) Arrays.stream((IDataContainer[]) primitive).map(BukkitContainer1_17_R1::new) + .toArray(BukkitContainer1_17_R1[]::new); + default: + return (P0) primitive; + } + } + + @SuppressWarnings("unchecked") + public C0 toComplexWrapped(C1 complex) { + switch (complexWrap) { + case 1: + return (C0) new SyntaxContainer1_17_R1((PersistentDataContainer) complex); + case 2: + return (C0) Arrays.stream((PersistentDataContainer[]) complex).map(SyntaxContainer1_17_R1::new).toArray(SyntaxContainer1_17_R1[]::new); + case 3: + return (C0) new BukkitContainer1_17_R1((IDataContainer) complex); + case 4: + return (C0) Arrays.stream((IDataContainer[]) complex).map(BukkitContainer1_17_R1::new).toArray(BukkitContainer1_17_R1[]::new); + default: + return (C0) complex; + } + } + + @SuppressWarnings("unchecked") + public P1 toPrimitiveOriginal(P0 primitive) { + switch (primitiveWrap) { + case 1: + return (P1) new BukkitContainer1_17_R1((IDataContainer) primitive); + case 2: + return (P1) Arrays.stream((IDataContainer[]) primitive).map(BukkitContainer1_17_R1::new) + .toArray(BukkitContainer1_17_R1[]::new); + case 3: + return (P1) new SyntaxContainer1_17_R1((PersistentDataContainer) primitive); + case 4: + return (P1) Arrays.stream((PersistentDataContainer[]) primitive).map(SyntaxContainer1_17_R1::new) + .toArray(SyntaxContainer1_17_R1[]::new); + default: + return (P1) primitive; + } + } + + @SuppressWarnings("unchecked") + public C1 toComplexOriginal(C0 complex) { + switch (complexWrap) { + case 1: + return (C1) new BukkitContainer1_17_R1((IDataContainer) complex); + case 2: + return (C1) Arrays.stream((IDataContainer[]) complex).map(BukkitContainer1_17_R1::new).toArray(BukkitContainer1_17_R1[]::new); + case 3: + return (C1) new SyntaxContainer1_17_R1((PersistentDataContainer) complex); + case 4: + return (C1) Arrays.stream((PersistentDataContainer[]) complex).map(SyntaxContainer1_17_R1::new).toArray(SyntaxContainer1_17_R1[]::new); + default: + return (C1) complex; + } + } + + protected static Class internalWrap(Class clazz, int state) { + switch (state) { + case 1: + return SyntaxContainer1_17_R1.class; + case 2: + return SyntaxContainer1_17_R1[].class; + case 3: + return BukkitContainer1_17_R1.class; + case 4: + return BukkitContainer1_17_R1[].class; + default: + return clazz; + } + } + + protected static int internalState(Class clazz) { + if (clazz.isAssignableFrom(PersistentDataContainer.class)) { + return 1; + } + if (clazz.isAssignableFrom(PersistentDataContainer[].class)) { + return 2; + } + if (clazz.isAssignableFrom(IDataContainer.class)) { + return 3; + } + if (clazz.isAssignableFrom(IDataContainer[].class)) { + return 4; + } + return 0; + } + + public static BukkitType1_17_R1 wrap(IDataType type) { + return new BukkitType1_17_R1<>(type); + } + + public static SyntaxType1_17_R1 wrap(PersistentDataType type) { + return new SyntaxType1_17_R1<>(type); + } + +} \ No newline at end of file diff --git a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/hook/BukkitContainerAdapterHook1_17_R1.java b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/hook/BukkitContainerAdapterHook1_17_R1.java new file mode 100644 index 0000000..5058997 --- /dev/null +++ b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/hook/BukkitContainerAdapterHook1_17_R1.java @@ -0,0 +1,133 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.data.hook; + +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; + +import org.bukkit.craftbukkit.v1_18_R1.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_18_R1.persistence.CraftPersistentDataContainer; +import org.bukkit.craftbukkit.v1_18_R1.persistence.CraftPersistentDataTypeRegistry; +import org.bukkit.persistence.PersistentDataContainer; + +import net.minecraft.nbt.CompoundTag; +import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; +import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; +import net.sourcewriters.minecraft.vcompat.data.nbt.NbtContainer; +import net.sourcewriters.minecraft.vcompat.provider.VersionControl; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.data.BukkitContainer1_17_R1; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.data.SyntaxContainer1_17_R1; +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookup; +import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtCompound; + +@SuppressWarnings({ + "rawtypes", + "unchecked" +}) +public final class BukkitContainerAdapterHook1_17_R1 { + + private static final BukkitContainerAdapterHook1_17_R1 HOOK = new BukkitContainerAdapterHook1_17_R1(); + + private final ClassLookup registryRef = ClassLookup.of(CraftPersistentDataTypeRegistry.class) + .searchMethod("create", "createAdapter", Class.class, Class.class, Function.class, Function.class) + .searchField("adapters", "adapters") + .searchField("function", "CREATE_ADAPTER"); + private final ClassLookup entityRef = ClassLookup.of(CraftEntity.class).searchField("registry", "DATA_TYPE_REGISTRY"); + + private BukkitContainerAdapterHook1_17_R1() {} + + private final HashMap map = new HashMap<>(); + + private CraftPersistentDataTypeRegistry getEntityRegistry() { + return (CraftPersistentDataTypeRegistry) entityRef.getFieldValue("registry"); + } + + private void uninjectAll() { + for (CraftPersistentDataTypeRegistry registry : map.keySet()) { + Map adapters = (Map) registryRef.getFieldValue(registry, "adapters"); + adapters.remove(BukkitContainer1_17_R1.class); + adapters.remove(SyntaxContainer1_17_R1.class); + registryRef.setFieldValue(registry, "function", map.get(registry)); + } + map.clear(); + } + + private void inject(CraftPersistentDataTypeRegistry registry) { + if (map.containsKey(registry)) { + return; + } + map.put(registry, (Function) registryRef.getFieldValue(registry, "function")); + Function function = clazz -> createAdapter(registry, registryRef.getMethod("create").type().returnType(), (Class) clazz); + registryRef.setFieldValue(registry, "function", function); + } + + private E createAdapter(CraftPersistentDataTypeRegistry registry, Class adapterType, Class type) { + if (Objects.equals(BukkitContainer1_17_R1.class, type)) { + return (E) buildAdapter(registry, BukkitContainer1_17_R1.class, tag -> fromPrimitiveSyntax(tag)); + } + if (Objects.equals(SyntaxContainer1_17_R1.class, type)) { + return (E) buildAdapter(registry, SyntaxContainer1_17_R1.class, tag -> fromPrimitiveBukkit(registry, tag)); + } + return (E) map.get(registry).apply(type); + } + + private Object buildAdapter(Object handle, Class type, Function function) { + return registryRef.run(handle, "create", type, CompoundTag.class, (Function) input -> toPrimitive(input), + function); + } + + private CompoundTag toPrimitive(WrappedContainer input) { + Object handle = findFinalContainer(input).getHandle(); + if (handle instanceof PersistentDataContainer) { + if (handle instanceof CraftPersistentDataContainer) { + return ((CraftPersistentDataContainer) handle).toTagCompound(); + } + throw new IllegalArgumentException( + "Expected 'CraftPersistentDataContainer' got '" + handle.getClass().getSimpleName() + " instead'!"); + } + if (handle instanceof IDataContainer) { + if (handle instanceof NbtContainer) { + return (CompoundTag) VersionCompatProvider.get().getControl().getBukkitConversion().toMinecraftCompound(((NbtContainer) handle).asNbt()); + } + throw new IllegalArgumentException( + "Expected 'CraftPersistentDataContainer' got '" + handle.getClass().getSimpleName() + " instead'!"); + } + throw new IllegalArgumentException("Unknown WrappedContainer implementation!"); + } + + private BukkitContainer1_17_R1 fromPrimitiveSyntax(CompoundTag data) { + VersionControl control = VersionCompatProvider.get().getControl(); + NbtContainer container = new NbtContainer(control.getDataProvider().getRegistry()); + NbtCompound compound = control.getBukkitConversion().fromMinecraftCompound(data); + container.fromNbt(compound); + return new BukkitContainer1_17_R1(container); + } + + private SyntaxContainer1_17_R1 fromPrimitiveBukkit(CraftPersistentDataTypeRegistry registry, CompoundTag data) { + CraftPersistentDataContainer container = new CraftPersistentDataContainer(registry); + container.putAll(data); + return new SyntaxContainer1_17_R1(container); + } + + private WrappedContainer findFinalContainer(WrappedContainer container) { + WrappedContainer output = container; + while (output.getHandle() instanceof WrappedContainer) { + output = (WrappedContainer) output.getHandle(); + } + return output; + } + + public static void unhookAll() { + HOOK.uninjectAll(); + } + + public static void hookEntity() { + HOOK.inject(HOOK.getEntityRegistry()); + } + + public static void hook(CraftPersistentDataTypeRegistry registry) { + HOOK.inject(registry); + } + +} diff --git a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/entity/ArmorStand1_17_R1.java b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/entity/ArmorStand1_17_R1.java new file mode 100644 index 0000000..54b8bd9 --- /dev/null +++ b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/entity/ArmorStand1_17_R1.java @@ -0,0 +1,24 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.entity; + +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.decoration.ArmorStand; +import net.minecraft.world.level.Level; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsArmorStand; + +public class ArmorStand1_17_R1 extends EntityLiving1_17_R1 implements NmsArmorStand { + + public ArmorStand1_17_R1(Level world) { + super(new ArmorStand(EntityType.ARMOR_STAND, world)); + } + + @Override + public void setSmall(boolean small) { + handle.setSmall(small); + } + + @Override + public boolean isSmall() { + return handle.isSmall(); + } + +} \ No newline at end of file diff --git a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/entity/Entity1_17_R1.java b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/entity/Entity1_17_R1.java new file mode 100644 index 0000000..c6118f2 --- /dev/null +++ b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/entity/Entity1_17_R1.java @@ -0,0 +1,215 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.entity; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.UUID; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.OfflinePlayer; +import org.bukkit.craftbukkit.v1_18_R1.CraftWorld; +import org.bukkit.craftbukkit.v1_18_R1.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_18_R1.util.CraftChatMessage; +import org.bukkit.entity.Player; + +import net.minecraft.network.protocol.game.ClientboundAddEntityPacket; +import net.minecraft.network.protocol.game.ClientboundRemoveEntitiesPacket; +import net.minecraft.network.protocol.game.ClientboundSetEntityDataPacket; +import net.minecraft.server.network.ServerGamePacketListenerImpl; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.phys.AABB; +import net.minecraft.world.phys.Vec3; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntity; +import net.sourcewriters.minecraft.vcompat.provider.utils.NmsBoundingBox; + +public abstract class Entity1_17_R1 implements NmsEntity { + + protected final E handle; + + protected final List visible = Collections.synchronizedList(new ArrayList<>()); + + public Entity1_17_R1(E handle) { + this.handle = handle; + } + + @Override + public final E getHandle() { + return handle; + } + + @Override + public int getId() { + return handle.getId(); + } + + @Override + public UUID getUniqueId() { + return handle.getUUID(); + } + + @Override + public NmsBoundingBox getBoundingBox() { + AABB box = handle.getBoundingBox(); + return new NmsBoundingBox(box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ); + } + + @Override + public void setCustomName(String name) { + handle.setCustomName(CraftChatMessage.fromStringOrNull(name)); + updateVisibility(); + } + + @Override + public String getCustomName() { + return CraftChatMessage.fromComponent(handle.getCustomName()); + } + + @Override + public void setGravity(boolean gravity) { + handle.setNoGravity(!gravity); + } + + @Override + public boolean hasGravity() { + return !handle.isNoGravity(); + } + + @Override + public void setCustomNameVisible(boolean visible) { + handle.setCustomNameVisible(visible); + } + + @Override + public boolean isCustomNameVisible() { + return handle.isCustomNameVisible(); + } + + @Override + public void setInvisible(boolean invisible) { + handle.setInvisible(invisible); + } + + @Override + public boolean isInvisible() { + return handle.isInvisible(); + } + + @Override + public boolean isInteractable() { + return handle.isPushable(); + } + + @Override + public boolean isCollidable() { + return handle.canBeCollidedWith(); + } + + @Override + public void setInvulnerable(boolean invulnerable) { + handle.setInvulnerable(invulnerable); + } + + @Override + public boolean isInvulnerable() { + return handle.isInvulnerable(); + } + + @Override + public void setLocation(Location location) { + handle.moveTo(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); + if (location.getWorld() == null || handle.getCommandSenderWorld().getWorld() == location.getWorld()) { + updateVisibility(); + return; + } + handle.level = ((CraftWorld) location.getWorld()).getHandle(); + updateVisibility(); + } + + @Override + public Location getLocation() { + Vec3 vector = handle.position(); + return new Location(handle.getCommandSenderWorld().getWorld(), vector.x, vector.y, vector.z); + } + + @Override + public void updateVisibility() { + if (visible.isEmpty()) { + return; + } + Player[] players; + synchronized (visible) { + players = visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) + .toArray(Player[]::new); + } + hide(players); + show(players); + } + + @Override + public boolean isShown(Player player) { + synchronized (visible) { + return visible.contains(player.getUniqueId()); + } + } + + @Override + public void hide(Player... players) { + if (players.length == 0) { + return; + } + ClientboundRemoveEntitiesPacket packet = new ClientboundRemoveEntitiesPacket(handle.getId()); + for (Player player : players) { + if (!isShown(player)) { + continue; + } + ((CraftPlayer) player).getHandle().connection.send(packet); + synchronized (visible) { + visible.remove(player.getUniqueId()); + } + } + } + + @Override + public void show(Player... players) { + if (players.length == 0) { + return; + } + ClientboundAddEntityPacket packet = new ClientboundAddEntityPacket(handle); + ClientboundSetEntityDataPacket metadataPacket = new ClientboundSetEntityDataPacket(handle.getId(), handle.getEntityData(), true); + ServerGamePacketListenerImpl connection; + for (Player player : players) { + if (isShown(player)) { + continue; + } + connection = ((CraftPlayer) player).getHandle().connection; + connection.send(packet); + connection.send(metadataPacket); + synchronized (visible) { + visible.add(player.getUniqueId()); + } + } + } + + @Override + public UUID[] getVisible() { + synchronized (visible) { + return visible.toArray(new UUID[0]); + } + } + + @Override + public Player[] getVisibleAsPlayer() { + synchronized (visible) { + return visible.stream().map(Bukkit::getOfflinePlayer).filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer) + .toArray(Player[]::new); + } + } + + @Override + public void kill() { + hide(getVisibleAsPlayer()); + handle.kill(); + } + +} \ No newline at end of file diff --git a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/entity/EntityLiving1_17_R1.java b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/entity/EntityLiving1_17_R1.java new file mode 100644 index 0000000..e99260c --- /dev/null +++ b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/entity/EntityLiving1_17_R1.java @@ -0,0 +1,17 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.entity; + +import net.minecraft.world.entity.LivingEntity; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityLiving; + +public abstract class EntityLiving1_17_R1 extends Entity1_17_R1 implements NmsEntityLiving { + + public EntityLiving1_17_R1(E handle) { + super(handle); + } + + @Override + public void setCollidable(boolean collidable) { + handle.collides = collidable; + } + +} \ No newline at end of file diff --git a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/entity/Player1_17_R1.java b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/entity/Player1_17_R1.java new file mode 100644 index 0000000..389f8f7 --- /dev/null +++ b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/entity/Player1_17_R1.java @@ -0,0 +1,293 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.entity; + +import java.util.ArrayList; +import java.util.Collections; + +import org.bukkit.craftbukkit.v1_18_R1.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_18_R1.util.CraftChatMessage; +import org.bukkit.entity.Player; + +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.properties.Property; +import com.mojang.authlib.properties.PropertyMap; +import com.mojang.datafixers.util.Pair; + +import net.minecraft.network.chat.Component; +import net.minecraft.network.protocol.game.ClientboundAddPlayerPacket; +import net.minecraft.network.protocol.game.ClientboundEntityEventPacket; +import net.minecraft.network.protocol.game.ClientboundPlayerInfoPacket; +import net.minecraft.network.protocol.game.ClientboundPlayerPositionPacket; +import net.minecraft.network.protocol.game.ClientboundRemoveEntitiesPacket; +import net.minecraft.network.protocol.game.ClientboundRespawnPacket; +import net.minecraft.network.protocol.game.ClientboundRotateHeadPacket; +import net.minecraft.network.protocol.game.ClientboundSetActionBarTextPacket; +import net.minecraft.network.protocol.game.ClientboundSetCarriedItemPacket; +import net.minecraft.network.protocol.game.ClientboundSetEntityDataPacket; +import net.minecraft.network.protocol.game.ClientboundSetEquipmentPacket; +import net.minecraft.network.protocol.game.ClientboundSetSubtitleTextPacket; +import net.minecraft.network.protocol.game.ClientboundSetTitleTextPacket; +import net.minecraft.network.protocol.game.ClientboundSetTitlesAnimationPacket; +import net.minecraft.network.protocol.game.ClientboundTabListPacket; +import net.minecraft.network.protocol.game.ServerboundClientCommandPacket; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.server.network.ServerGamePacketListenerImpl; +import net.minecraft.util.Mth; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.biome.BiomeManager; +import net.sourcewriters.minecraft.vcompat.VersionCompatProvider; +import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; +import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContainer; +import net.sourcewriters.minecraft.vcompat.provider.data.type.SkinDataType; +import net.sourcewriters.minecraft.vcompat.provider.entity.NmsPlayer; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.data.SyntaxContainer1_17_R1; +import net.sourcewriters.minecraft.vcompat.util.bukkit.Players; +import net.sourcewriters.minecraft.vcompat.util.minecraft.MojangProfileServer; +import net.sourcewriters.minecraft.vcompat.util.minecraft.Skin; +import net.sourcewriters.minecraft.vcompat.util.thread.PostAsync; + +public class Player1_17_R1 extends EntityLiving1_17_R1 implements NmsPlayer { + + private String realName; + private Skin realSkin; + + private final WrappedContainer dataAdapter; + + public Player1_17_R1(Player player) { + super(((CraftPlayer) player).getHandle()); + dataAdapter = new SyntaxContainer1_17_R1(getBukkitPlayer().getPersistentDataContainer()); + update(false); + } + + @Override + public CraftPlayer getBukkitPlayer() { + return handle.getBukkitEntity(); + } + + @Override + public WrappedContainer getDataAdapter() { + return dataAdapter; + } + + @Override + public void setSkin(Skin skin) { + if (skin == null) { + return; + } + dataAdapter.set("skin", skin, SkinDataType.WRAPPED_INSTANCE); + } + + @Override + public Skin getSkin() { + return dataAdapter.getOrDefault("skin", SkinDataType.WRAPPED_INSTANCE, realSkin); + } + + @Override + public Skin getRealSkin() { + return realSkin; + } + + @Override + public void setName(String name) { + if (getName().equals(name)) { + return; + } + if (name == null) { + dataAdapter.remove("name"); + return; + } + dataAdapter.set("name", name, WrapType.STRING); + } + + @Override + public String getName() { + return dataAdapter.getOrDefault("name", WrapType.STRING, realName); + } + + @Override + public String getRealName() { + return realName; + } + + @Override + public void setPlayerListHeader(String text) { + setPlayerListHeaderAndFooter(text, getPlayerListFooter()); + } + + @Override + public String getPlayerListHeader() { + return dataAdapter.getOrDefault("header", WrapType.STRING, ""); + } + + @Override + public void setPlayerListFooter(String text) { + setPlayerListHeaderAndFooter(getPlayerListHeader(), text); + } + + @Override + public String getPlayerListFooter() { + return dataAdapter.getOrDefault("footer", WrapType.STRING, ""); + } + + @Override + public int getPing() { + return handle.latency; + } + + @Override + public void setPlayerListHeaderAndFooter(String header, String footer) { + dataAdapter.set("header", header, WrapType.STRING); + dataAdapter.set("footer", footer, WrapType.STRING); + sendPlayerListInfo(header, footer); + } + + private final void sendPlayerListInfo(String header, String footer) { + if (handle.hasDisconnected()) { + return; + } + + Component headerComponent = header.isEmpty() ? null : CraftChatMessage.fromStringOrNull(header, true); + Component footerComponent = footer.isEmpty() ? null : CraftChatMessage.fromStringOrNull(footer, true); + + handle.connection.send(new ClientboundTabListPacket(headerComponent, footerComponent)); + } + + @Override + public void setTitleTimes(int fadeIn, int stay, int fadeOut) { + if (handle.hasDisconnected()) { + return; + } + handle.connection.send(new ClientboundSetTitlesAnimationPacket(fadeIn, stay, fadeOut)); + } + + @Override + public void sendSubtitle(String text) { + if (handle.hasDisconnected()) { + return; + } + handle.connection.send(new ClientboundSetSubtitleTextPacket(CraftChatMessage.fromStringOrNull(text))); + } + + @Override + public void sendTitle(String text) { + if (handle.hasDisconnected()) { + return; + } + handle.connection.send(new ClientboundSetTitleTextPacket(CraftChatMessage.fromStringOrNull(text))); + } + + @Override + public void sendActionBar(String text) { + if (handle.hasDisconnected()) { + return; + } + handle.connection.send(new ClientboundSetActionBarTextPacket(CraftChatMessage.fromStringOrNull(text))); + } + + @Override + public void fakeRespawn() { + if (handle.hasDisconnected()) { + return; + } + ClientboundPlayerInfoPacket remInfoPacket = new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.REMOVE_PLAYER, + handle); + ClientboundPlayerInfoPacket addInfoPacket = new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.ADD_PLAYER, handle); + + ClientboundRemoveEntitiesPacket destroyPacket = new ClientboundRemoveEntitiesPacket(handle.getId()); + ClientboundAddPlayerPacket spawnPacket = new ClientboundAddPlayerPacket(handle); + ClientboundRotateHeadPacket rotationPacket = new ClientboundRotateHeadPacket(handle, + (byte) Mth.floor(handle.getYHeadRot() * 256F / 360F)); + + ArrayList> list = new ArrayList<>(); + for (EquipmentSlot slot : EquipmentSlot.values()) { + list.add(Pair.of(slot, handle.getItemBySlot(slot))); + } + ClientboundSetEquipmentPacket equipmentPacket = new ClientboundSetEquipmentPacket(handle.getId(), list); + + Player self = getBukkitPlayer(); + Player[] players = Players.getOnlineWithout(getUniqueId()); + for (Player player : players) { + if (!player.canSee(self)) { + continue; + } + ServerGamePacketListenerImpl connection = ((CraftPlayer) player).getHandle().connection; + connection.send(remInfoPacket); + connection.send(addInfoPacket); + connection.send(destroyPacket); + connection.send(spawnPacket); + connection.send(rotationPacket); + connection.send(equipmentPacket); + } + + ServerLevel world = (ServerLevel) handle.level; + + ClientboundRespawnPacket respawnPacket = new ClientboundRespawnPacket(world.dimensionType(), world.dimension(), + BiomeManager.obfuscateSeed(world.getSeed()), handle.gameMode.getGameModeForPlayer(), + handle.gameMode.getPreviousGameModeForPlayer(), world.isDebug(), world.isFlat(), true); + ClientboundPlayerPositionPacket positionPacket = new ClientboundPlayerPositionPacket(handle.getX(), handle.getY(), handle.getZ(), + handle.xRotO, handle.yRotO, Collections.emptySet(), 0, false); + ClientboundSetCarriedItemPacket itemPacket = new ClientboundSetCarriedItemPacket(handle.getInventory().selected); + ClientboundEntityEventPacket statusPacket = new ClientboundEntityEventPacket(handle, (byte) 28); + ClientboundSetEntityDataPacket metadataPacket = new ClientboundSetEntityDataPacket(handle.getId(), handle.getEntityData(), true); + + ServerGamePacketListenerImpl connection = handle.connection; + connection.send(remInfoPacket); + connection.send(addInfoPacket); + connection.send(respawnPacket); + connection.send(positionPacket); + connection.send(itemPacket); + connection.send(statusPacket); + connection.send(metadataPacket); + + handle.onUpdateAbilities(); + handle.resetSentInfo(); + handle.inventoryMenu.broadcastChanges(); + handle.inventoryMenu.sendAllDataToRemote(); + if (handle.containerMenu != handle.inventoryMenu) { + handle.containerMenu.broadcastChanges(); + handle.containerMenu.sendAllDataToRemote(); + } + self.recalculatePermissions(); + } + + @Override + public void respawn() { + if (handle.connection.isDisconnected()) { + return; + } + handle.connection.send(new ServerboundClientCommandPacket(ServerboundClientCommandPacket.Action.PERFORM_RESPAWN)); + } + + @Override + public void update() { + update(true); + } + + private final void update(boolean flag) { + PostAsync.forcePost(() -> { + realName = MojangProfileServer.getName(getUniqueId()); + realSkin = MojangProfileServer.getSkin(realName, getUniqueId()); + }); + if (flag) { + GameProfile profile = handle.getGameProfile(); + + Skin skin = getSkin(); + if (skin != null) { + PropertyMap properties = profile.getProperties(); + properties.removeAll("textures"); + properties.put("textures", new Property("textures", skin.getValue(), skin.getSignature())); + } + + String name = getName(); + if (name != null) { + VersionCompatProvider.get().getLookupProvider().getLookup("mjGameProfile").setFieldValue(profile, "name", name); + } + + if (!(name == null && skin == null)) { + fakeRespawn(); + } + } + } + +} \ No newline at end of file diff --git a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/tools/BlockTools1_17_R1.java b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/tools/BlockTools1_17_R1.java new file mode 100644 index 0000000..f43e9ed --- /dev/null +++ b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/tools/BlockTools1_17_R1.java @@ -0,0 +1,38 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.tools; + +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_18_R1.block.CraftSkull; + +import com.mojang.authlib.properties.Property; +import com.mojang.authlib.properties.PropertyMap; + +import net.minecraft.world.level.block.entity.SkullBlockEntity; +import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookup; +import net.sourcewriters.minecraft.vcompat.provider.tools.BlockTools; +import net.sourcewriters.minecraft.vcompat.util.constants.MinecraftConstants; + +public class BlockTools1_17_R1 extends BlockTools { + + private final ClassLookup craftEntityStateRef = ClassLookup.of(CraftSkull.class).searchField("tileEntity", "tileEntity"); + + @Override + public void setHeadTexture(Block block, String texture) { + if (!(block instanceof CraftSkull)) { + return; + } + SkullBlockEntity entitySkull = (SkullBlockEntity) craftEntityStateRef.getFieldValue(block, "tileEntity"); + PropertyMap map = entitySkull.owner.getProperties(); + map.removeAll("textures"); + map.put("textures", new Property("textures", MinecraftConstants.TEXTURE_SIGNATURE, texture)); + } + + @Override + public String getHeadTexture(Block block) { + if (!(block instanceof CraftSkull)) { + return null; + } + SkullBlockEntity entitySkull = (SkullBlockEntity) craftEntityStateRef.getFieldValue(block, "tileEntity"); + return entitySkull.owner.getProperties().get("textures").iterator().next().getValue(); + } + +} \ No newline at end of file diff --git a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/tools/ServerTools1_17_R1.java b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/tools/ServerTools1_17_R1.java new file mode 100644 index 0000000..845bd27 --- /dev/null +++ b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/tools/ServerTools1_17_R1.java @@ -0,0 +1,26 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.tools; + +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_18_R1.CraftServer; + +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.wrapper.ConsoleReaderWrapper1_17_R1; +import net.sourcewriters.minecraft.vcompat.provider.tools.ServerTools; + +public class ServerTools1_17_R1 extends ServerTools { + + @Override + public void setMotd(String text) { + ((CraftServer) Bukkit.getServer()).getServer().setMotd(text); + } + + @Override + public String getMotd() { + return ((CraftServer) Bukkit.getServer()).getServer().getMotd(); + } + + @Override + public ConsoleReaderWrapper1_17_R1 getConsole() { + return ConsoleReaderWrapper1_17_R1.INSTANCE; + } + +} \ No newline at end of file diff --git a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/tools/SkinTools1_17_R1.java b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/tools/SkinTools1_17_R1.java new file mode 100644 index 0000000..e3734b7 --- /dev/null +++ b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/tools/SkinTools1_17_R1.java @@ -0,0 +1,16 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.tools; + +import org.bukkit.craftbukkit.v1_18_R1.entity.CraftPlayer; +import org.bukkit.entity.Player; + +import net.sourcewriters.minecraft.vcompat.provider.tools.SkinTools; +import net.sourcewriters.minecraft.vcompat.util.minecraft.Skin; + +public class SkinTools1_17_R1 extends SkinTools { + + @Override + public Skin skinFromPlayer(Player player) { + return skinFromGameProfile(((CraftPlayer) player).getHandle().getGameProfile()); + } + +} \ No newline at end of file diff --git a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/utils/EntityConstructors1_17_R1.java b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/utils/EntityConstructors1_17_R1.java new file mode 100644 index 0000000..8300962 --- /dev/null +++ b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/utils/EntityConstructors1_17_R1.java @@ -0,0 +1,12 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.utils; + +import java.util.function.Function; + +import net.minecraft.world.level.Level; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.entity.ArmorStand1_17_R1; + +public abstract class EntityConstructors1_17_R1 { + + public static final Function ARMOR_STAND = (world -> new ArmorStand1_17_R1(world)); + +} \ No newline at end of file diff --git a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/wrapper/ConsoleReaderWrapper1_17_R1.java b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/wrapper/ConsoleReaderWrapper1_17_R1.java new file mode 100644 index 0000000..e51c7e9 --- /dev/null +++ b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/wrapper/ConsoleReaderWrapper1_17_R1.java @@ -0,0 +1,51 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.wrapper; + +import java.io.IOException; +import java.io.Writer; + +import org.bukkit.Bukkit; + +import net.sourcewriters.minecraft.vcompat.provider.wrapper.ConsoleReaderWrapper; + +import org.bukkit.craftbukkit.Main; +import org.bukkit.craftbukkit.v1_18_R1.CraftServer; + +import jline.console.ConsoleReader; + +public final class ConsoleReaderWrapper1_17_R1 extends ConsoleReaderWrapper { + + public static final ConsoleReaderWrapper1_17_R1 INSTANCE = new ConsoleReaderWrapper1_17_R1(); + + private final ConsoleReader reader; + + @SuppressWarnings("resource") + private ConsoleReaderWrapper1_17_R1() { + this.reader = ((CraftServer) Bukkit.getServer()).getServer().reader; + } + + @Override + public Writer getOutput() { + return reader.getOutput(); + } + + @Override + public boolean isAnsiSupported() { + return reader.getTerminal().isAnsiSupported(); + } + + @Override + public void flush() throws IOException { + reader.flush(); + } + + @Override + public void drawLine() throws IOException { + reader.drawLine(); + } + + @Override + public boolean isJLineSupported() { + return Main.useJline; + } + +} diff --git a/vcompat-api/pom.xml b/vcompat-api/pom.xml index ee3709f..b21e03b 100644 --- a/vcompat-api/pom.xml +++ b/vcompat-api/pom.xml @@ -10,14 +10,9 @@ vcompat-api - - jline - jline - 2.12.1 - provided - + com.syntaxphoenix.syntaxapi java @@ -53,6 +48,15 @@ json-lib 2.0.11 + + + + + jline + jline + 2.12.1 + provided + diff --git a/vcompat-core/pom.xml b/vcompat-core/pom.xml index fbd37bc..cbaaac2 100644 --- a/vcompat-core/pom.xml +++ b/vcompat-core/pom.xml @@ -10,16 +10,32 @@ vcompat-core + + + net.sourcewriters.minecraft vcompat-api 3.0.0 + + + net.sourcewriters.minecraft vcompat-legacy 3.0.0 + + net.sourcewriters.minecraft + vcompat-1_17_R1 + 3.0.0 + + + net.sourcewriters.minecraft + vcompat-1_18_R1 + 3.0.0 + diff --git a/vcompat-legacy/pom.xml b/vcompat-legacy/pom.xml index 3db1c25..e6b7f13 100644 --- a/vcompat-legacy/pom.xml +++ b/vcompat-legacy/pom.xml @@ -19,7 +19,7 @@ provided - + bukkit From 0be0c2403aed448af98f7f52b45f728089dae310 Mon Sep 17 00:00:00 2001 From: Lauriichan Date: Wed, 19 Jan 2022 17:51:55 +0100 Subject: [PATCH 35/47] Update pom.xml --- vcompat-core/pom.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/vcompat-core/pom.xml b/vcompat-core/pom.xml index cbaaac2..dc578f2 100644 --- a/vcompat-core/pom.xml +++ b/vcompat-core/pom.xml @@ -62,6 +62,12 @@ + + + com.syntaxphoenix.syntaxapi + net.sourcewriters.minecraft.vcompat.shaded.syntaxapi + + From af9baf17394e834beddb6e081e1ce734d3727410 Mon Sep 17 00:00:00 2001 From: Lauriichan Date: Wed, 19 Jan 2022 17:54:48 +0100 Subject: [PATCH 36/47] Updated github stuff --- .github/workflows/build-maven.yml | 4 ++-- README.md | 11 ++++------- vcompat-core/pom.xml | 10 +++++++++- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build-maven.yml b/.github/workflows/build-maven.yml index a9775ef..8caec5f 100644 --- a/.github/workflows/build-maven.yml +++ b/.github/workflows/build-maven.yml @@ -11,10 +11,10 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Set up JDK 1.8 + - name: Set up JDK 11 uses: actions/setup-java@v1 with: - java-version: 1.8 + java-version: 11 server-id: github settings-path: ${{ github.workspace }} diff --git a/README.md b/README.md index 71f86c8..7d4eb26 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,6 @@ [![Stargazers][stars-shield]][stars-url] [![Issues][issues-shield]][issues-url] [![MIT License][license-shield]][license-url] -[![Code quality: Java][lgtm-quality-shield]][lgtm-quality-url] @@ -88,7 +87,7 @@ ### Built With * [Spigot](https://hub.spigotmc.org/stash/projects/SPIGOT/repos/spigot/browse) -* [SyntaxApi](https://github.com/SyntaxPhoenix/syntaxapi) +* [SyntaxApi](https://github.com/SyntaxPhoenix/SyntaxApi) ## Getting Started @@ -104,7 +103,7 @@ Please notice that you need to authenticate with GitHub Packages ([Maven](https: net.sourcewriters.minecraft vcompat - 2.1.8 + 3.0.0 provided @@ -118,7 +117,7 @@ plugins { } dependencies { - compileOnly group: 'net.sourcewriters.minecraft', name: 'vcompat', version: '2.1.8' + compileOnly group: 'net.sourcewriters.minecraft', name: 'vcompat', version: '3.0.0' } ``` @@ -181,6 +180,4 @@ Project Link: [https://github.com/SourceWriters/vCompat](https://github.com/Sour [issues-shield]: https://img.shields.io/github/issues/SourceWriters/vCompat.svg?style=flat-square [issues-url]: https://github.com/SourceWriters/vCompat/issues [license-shield]: https://img.shields.io/github/license/SourceWriters/vCompat.svg?style=flat-square -[license-url]: https://github.com/SourceWriters/vCompat/blob/master/LICENSE -[lgtm-quality-shield]: https://img.shields.io/lgtm/grade/java/g/SourceWriters/vCompat.svg?style=flat-square -[lgtm-quality-url]: https://lgtm.com/projects/g/SourceWriters/vCompat/context:java +[license-url]: https://github.com/SourceWriters/vCompat/blob/master/LICENSE \ No newline at end of file diff --git a/vcompat-core/pom.xml b/vcompat-core/pom.xml index dc578f2..213d038 100644 --- a/vcompat-core/pom.xml +++ b/vcompat-core/pom.xml @@ -7,7 +7,15 @@ vcompat-parent 3.0.0 - vcompat-core + vcompat + + + + github + GitHub OWNER Apache Maven Packages + https://maven.pkg.github.com/SourceWriters/vCompat + + From d5a9abd29f545441af2f12ad3e4e79872c95a532 Mon Sep 17 00:00:00 2001 From: Lauriichan Date: Wed, 19 Jan 2022 18:12:41 +0100 Subject: [PATCH 37/47] Fix paths --- vcompat-1_17_R1/pom.xml | 4 ++-- vcompat-1_18_R1/pom.xml | 4 ++-- vcompat-legacy/pom.xml | 32 ++++++++++++++++---------------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/vcompat-1_17_R1/pom.xml b/vcompat-1_17_R1/pom.xml index abc54fe..5259727 100644 --- a/vcompat-1_17_R1/pom.xml +++ b/vcompat-1_17_R1/pom.xml @@ -8,7 +8,7 @@ vcompat-1_17_R1 - ${project.basedir}\..\libraries\spigot + ${project.basedir}/../libraries/spigot @@ -26,7 +26,7 @@ remapped 0.1 system - ${spigot.libPath}\spigot-1.17.1.jar + ${spigot.libPath}/spigot-1.17.1.jar diff --git a/vcompat-1_18_R1/pom.xml b/vcompat-1_18_R1/pom.xml index e73ec3f..2fef1b8 100644 --- a/vcompat-1_18_R1/pom.xml +++ b/vcompat-1_18_R1/pom.xml @@ -8,7 +8,7 @@ vcompat-1_18_R1 - ${project.basedir}\..\libraries\spigot + ${project.basedir}/../libraries/spigot @@ -34,7 +34,7 @@ remapped 0.1 system - ${spigot.libPath}\spigot-1.18.1.jar + ${spigot.libPath}/spigot-1.18.1.jar it.unimi.dsi diff --git a/vcompat-legacy/pom.xml b/vcompat-legacy/pom.xml index e6b7f13..654cf49 100644 --- a/vcompat-legacy/pom.xml +++ b/vcompat-legacy/pom.xml @@ -8,7 +8,7 @@ vcompat-legacy - ${project.basedir}\..\libraries\spigot + ${project.basedir}/../libraries/spigot @@ -26,105 +26,105 @@ spigot-1.16.4 0.1 system - ${spigot.libPath}\spigot-1.16.4.jar + ${spigot.libPath}/spigot-1.16.4.jar bukkit spigot-1.16.3 0.1 system - ${spigot.libPath}\spigot-1.16.3.jar + ${spigot.libPath}/spigot-1.16.3.jar bukkit spigot-1.16.1 0.1 system - ${spigot.libPath}\spigot-1.16.1.jar + ${spigot.libPath}/spigot-1.16.1.jar bukkit spigot-1.15.2 0.1 system - ${spigot.libPath}\spigot-1.15.2.jar + ${spigot.libPath}/spigot-1.15.2.jar bukkit spigot-1.14.2 0.1 system - ${spigot.libPath}\spigot-1.14.2.jar + ${spigot.libPath}/spigot-1.14.2.jar bukkit spigot-1.13.2 0.1 system - ${spigot.libPath}\spigot-1.13.2.jar + ${spigot.libPath}/spigot-1.13.2.jar bukkit spigot-1.13 0.1 system - ${spigot.libPath}\spigot-1.13.jar + ${spigot.libPath}/spigot-1.13.jar bukkit spigot-1.12.2 0.1 system - ${spigot.libPath}\spigot-1.12.2.jar + ${spigot.libPath}/spigot-1.12.2.jar bukkit spigot-1.11 0.1 system - ${spigot.libPath}\spigot-1.11.jar + ${spigot.libPath}/spigot-1.11.jar bukkit spigot-1.10.2 0.1 system - ${spigot.libPath}\spigot-1.10.2.jar + ${spigot.libPath}/spigot-1.10.2.jar bukkit spigot-1.9.4 0.1 system - ${spigot.libPath}\spigot-1.9.4.jar + ${spigot.libPath}/spigot-1.9.4.jar bukkit spigot-1.9 0.1 system - ${spigot.libPath}\spigot-1.9.jar + ${spigot.libPath}/spigot-1.9.jar bukkit spigot-1.8.8 0.1 system - ${spigot.libPath}\spigot-1.8.8.jar + ${spigot.libPath}/spigot-1.8.8.jar bukkit spigot-1.8.3 0.1 system - ${spigot.libPath}\spigot-1.8.3.jar + ${spigot.libPath}/spigot-1.8.3.jar bukkit spigot-1.8 0.1 system - ${spigot.libPath}\spigot-1.8.jar + ${spigot.libPath}/spigot-1.8.jar \ No newline at end of file From 76a5f467e801e07d2dfadbe967b1a25f7ab6961b Mon Sep 17 00:00:00 2001 From: Lauriichan Date: Wed, 19 Jan 2022 18:30:51 +0100 Subject: [PATCH 38/47] Try to fix github build --- scripts/data/mappings.txt | 2 + scripts/data/{versions.txt => servers.txt} | 0 scripts/download-mapping.sh | 17 +++ .../{build-spigot.sh => download-spigot.sh} | 6 +- scripts/lgtm-compile.sh | 1 - vcompat-1_17_R1/pom.xml | 130 +++++++++++++----- vcompat-1_18_R1/pom.xml | 129 ++++++++++++----- 7 files changed, 205 insertions(+), 80 deletions(-) create mode 100644 scripts/data/mappings.txt rename scripts/data/{versions.txt => servers.txt} (100%) create mode 100644 scripts/download-mapping.sh rename scripts/{build-spigot.sh => download-spigot.sh} (72%) delete mode 100644 scripts/lgtm-compile.sh diff --git a/scripts/data/mappings.txt b/scripts/data/mappings.txt new file mode 100644 index 0000000..4628557 --- /dev/null +++ b/scripts/data/mappings.txt @@ -0,0 +1,2 @@ +1.17.1 +1.18.1 \ No newline at end of file diff --git a/scripts/data/versions.txt b/scripts/data/servers.txt similarity index 100% rename from scripts/data/versions.txt rename to scripts/data/servers.txt diff --git a/scripts/download-mapping.sh b/scripts/download-mapping.sh new file mode 100644 index 0000000..4af9159 --- /dev/null +++ b/scripts/download-mapping.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +mkdir -p $1/libraries/mapping +mkdir -p $1/libraries/spigot +echo "Downloading Server Mapping files..." +versions=$1/scripts/data/mappings.txt +while read line; do + if [ -z "$line" ]; then + continue + fi + echo "Downloading Server Mappings (.txt) $line" + curl "http://test.playuniverse.org/host/download/github/mapping/mapping-$line.txt" --output "$1/libraries/mapping/mapping-$line.txt" + echo "Downloading Server Mappings (.csrg) $line" + curl "http://test.playuniverse.org/host/download/github/mapping/mapping-$line.csrg" --output "$1/libraries/mapping/mapping-$line.csrg" + echo "Downloading Server Mappings (.jar) $line" + curl "http://test.playuniverse.org/host/download/github/mapping/spigot-$line-obf.jar" --output "$1/libraries/spigot/spigot-$line-obf.jar" +done < $versions +echo "Download complete!" diff --git a/scripts/build-spigot.sh b/scripts/download-spigot.sh similarity index 72% rename from scripts/build-spigot.sh rename to scripts/download-spigot.sh index 944c2e9..9484c46 100644 --- a/scripts/build-spigot.sh +++ b/scripts/download-spigot.sh @@ -1,12 +1,12 @@ #!/usr/bin/env bash mkdir -p $1/libraries/spigot -echo "Downloading Spigot files..." -versions=$1/scripts/data/versions.txt +echo "Downloading Server files..." +versions=$1/scripts/data/servers.txt while read line; do if [ -z "$line" ]; then continue fi - echo "Downloading Spigot $line" + echo "Downloading Server $line" curl "http://test.playuniverse.org/host/download/github/spigot-$line.jar" --output "$1/libraries/spigot/spigot-$line.jar" done < $versions echo "Download complete!" diff --git a/scripts/lgtm-compile.sh b/scripts/lgtm-compile.sh deleted file mode 100644 index 797784c..0000000 --- a/scripts/lgtm-compile.sh +++ /dev/null @@ -1 +0,0 @@ -mvn install \ No newline at end of file diff --git a/vcompat-1_17_R1/pom.xml b/vcompat-1_17_R1/pom.xml index 5259727..3bf7965 100644 --- a/vcompat-1_17_R1/pom.xml +++ b/vcompat-1_17_R1/pom.xml @@ -8,7 +8,9 @@ vcompat-1_17_R1 + ${project.basedir}/../libraries/mapping ${project.basedir}/../libraries/spigot + 1.17.1 @@ -26,45 +28,97 @@ remapped 0.1 system - ${spigot.libPath}/spigot-1.17.1.jar + ${spigot.libPath}/spigot-${minecraft.version}.jar - - - - net.md-5 - specialsource-maven-plugin - 1.2.2 - - - package - - remap - - remap-obf - - org.spigotmc:minecraft-server:1.17.1-R0.1-SNAPSHOT:txt:maps-mojang - true - org.spigotmc:spigot:1.17.1-R0.1-SNAPSHOT:jar:remapped-mojang - true - remapped-obf - - - - package - - remap - - remap-spigot - - ${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar - org.spigotmc:minecraft-server:1.17.1-R0.1-SNAPSHOT:csrg:maps-spigot - org.spigotmc:spigot:1.17.1-R0.1-SNAPSHOT:jar:remapped-obf - - - - - - + + + build-remote + + false + + + + + net.md-5 + specialsource-maven-plugin + 1.2.2 + + + package + + remap + + remap-obf + + ${mapping.libPath}/mapping-${minecraft.version}.txt + true + ${spigot.libPath}/spigot-${minecraft.version}.jar + true + remapped-obf + + + + package + + remap + + remap-spigot + + ${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar + ${mapping.libPath}/mapping-${minecraft.version}.csrg + ${spigot.libPath}/spigot-${minecraft.version}-obf.jar + + + + + + + + + build-local + + false + + + + + net.md-5 + specialsource-maven-plugin + 1.2.2 + + + package + + remap + + remap-obf + + org.spigotmc:minecraft-server:${minecraft.version}-R0.1-SNAPSHOT:txt:maps-mojang + true + org.spigotmc:spigot:${minecraft.version}-R0.1-SNAPSHOT:jar:remapped-mojang + true + remapped-obf + + + + package + + remap + + remap-spigot + + ${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar + org.spigotmc:minecraft-server:${minecraft.version}-R0.1-SNAPSHOT:csrg:maps-spigot + org.spigotmc:spigot:${minecraft.version}-R0.1-SNAPSHOT:jar:remapped-obf + + + + + + + + + \ No newline at end of file diff --git a/vcompat-1_18_R1/pom.xml b/vcompat-1_18_R1/pom.xml index 2fef1b8..b5ca197 100644 --- a/vcompat-1_18_R1/pom.xml +++ b/vcompat-1_18_R1/pom.xml @@ -8,7 +8,9 @@ vcompat-1_18_R1 + ${project.basedir}/../libraries/mapping ${project.basedir}/../libraries/spigot + 1.18.1 @@ -34,7 +36,7 @@ remapped 0.1 system - ${spigot.libPath}/spigot-1.18.1.jar + ${spigot.libPath}/spigot-${minecraft.version}.jar it.unimi.dsi @@ -56,41 +58,92 @@ - - - - net.md-5 - specialsource-maven-plugin - 1.2.2 - - - package - - remap - - remap-obf - - org.spigotmc:minecraft-server:1.18.1-R0.1-SNAPSHOT:txt:maps-mojang - true - org.spigotmc:spigot:1.18.1-R0.1-SNAPSHOT:jar:remapped-mojang - true - remapped-obf - - - - package - - remap - - remap-spigot - - ${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar - org.spigotmc:minecraft-server:1.18.1-R0.1-SNAPSHOT:csrg:maps-spigot - org.spigotmc:spigot:1.18.1-R0.1-SNAPSHOT:jar:remapped-obf - - - - - - + + + build-remote + + false + + + + + net.md-5 + specialsource-maven-plugin + 1.2.2 + + + package + + remap + + remap-obf + + ${mapping.libPath}/mapping-${minecraft.version}.txt + true + ${spigot.libPath}/spigot-${minecraft.version}.jar + true + remapped-obf + + + + package + + remap + + remap-spigot + + ${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar + ${mapping.libPath}/mapping-${minecraft.version}.csrg + ${spigot.libPath}/spigot-${minecraft.version}-obf.jar + + + + + + + + + build-local + + false + + + + + net.md-5 + specialsource-maven-plugin + 1.2.2 + + + package + + remap + + remap-obf + + org.spigotmc:minecraft-server:${minecraft.version}-R0.1-SNAPSHOT:txt:maps-mojang + true + org.spigotmc:spigot:${minecraft.version}-R0.1-SNAPSHOT:jar:remapped-mojang + true + remapped-obf + + + + package + + remap + + remap-spigot + + ${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar + org.spigotmc:minecraft-server:${minecraft.version}-R0.1-SNAPSHOT:csrg:maps-spigot + org.spigotmc:spigot:${minecraft.version}-R0.1-SNAPSHOT:jar:remapped-obf + + + + + + + + \ No newline at end of file From 46e83f0c9151f219eaf2cb85b6bc188f9e6ccd79 Mon Sep 17 00:00:00 2001 From: Lauriichan Date: Wed, 19 Jan 2022 18:33:06 +0100 Subject: [PATCH 39/47] Refactor workflow --- .github/workflows/build-maven.yml | 15 ++++++++++----- .m2/settings.xml | 1 + 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-maven.yml b/.github/workflows/build-maven.yml index 8caec5f..a6395a2 100644 --- a/.github/workflows/build-maven.yml +++ b/.github/workflows/build-maven.yml @@ -18,15 +18,20 @@ jobs: server-id: github settings-path: ${{ github.workspace }} - - name: Build Spigot dependencies + - name: Download Server dependencies run: | - chmod +x "${{ github.workspace }}/scripts/build-spigot.sh" - ${{ github.workspace }}/scripts/build-spigot.sh "${{ github.workspace }}" + chmod +x "${{ github.workspace }}/scripts/download-spigot.sh" + ${{ github.workspace }}/scripts/download-spigot.sh "${{ github.workspace }}" + + - name: Download Mapping dependencies + run: | + chmod +x "${{ github.workspace }}/scripts/download-mapping.sh" + ${{ github.workspace }}/scripts/download-mapping.sh "${{ github.workspace }}" - name: Building maven project - run: mvn -B package + run: mvn -B package -P build-remote - name: Publish to GitHub Packages - run: mvn deploy -s ${{ github.workspace }}/settings.xml + run: mvn deploy -P build-remote -s ${{ github.workspace }}/settings.xml env: GITHUB_TOKEN: ${{ github.token }} diff --git a/.m2/settings.xml b/.m2/settings.xml index 008261e..e4c2378 100644 --- a/.m2/settings.xml +++ b/.m2/settings.xml @@ -5,6 +5,7 @@ github + build-remote From a494c71500ed09eeb1f50a6fbaf7d2978a6b2c4e Mon Sep 17 00:00:00 2001 From: Lauriichan Date: Wed, 19 Jan 2022 18:44:04 +0100 Subject: [PATCH 40/47] Fix 1.18.1 download --- scripts/data/mappings.txt | 2 +- scripts/data/servers.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/data/mappings.txt b/scripts/data/mappings.txt index 4628557..d3698f4 100644 --- a/scripts/data/mappings.txt +++ b/scripts/data/mappings.txt @@ -1,2 +1,2 @@ 1.17.1 -1.18.1 \ No newline at end of file +1.18.1 diff --git a/scripts/data/servers.txt b/scripts/data/servers.txt index 272d720..5c6e4ff 100644 --- a/scripts/data/servers.txt +++ b/scripts/data/servers.txt @@ -14,4 +14,4 @@ 1.16.3 1.16.4 1.17.1 -1.18.1 \ No newline at end of file +1.18.1 From e917e7880d2a7aa73abeadd099e9fe755030b647 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20Endre=C3=9F?= Date: Thu, 20 Jan 2022 09:46:49 +0100 Subject: [PATCH 41/47] Update .gitignore --- .gitignore | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 96b24a1..d62c125 100644 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,10 @@ */.project */.gitlab-ci.yml */test/ -/libraries/spigot/ */dependency-reduced-pom.xml *.class -*.jar \ No newline at end of file +*.jar +/libraries/spigot/ +/.settings/ +/.project +/.classpath \ No newline at end of file From 7b7698f78b58606d626b6da03685b77933ed169c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20Endre=C3=9F?= Date: Thu, 20 Jan 2022 09:58:51 +0100 Subject: [PATCH 42/47] Rename all 1_18_R1 to match the version --- ...7_R1.java => BukkitConversion1_18_R1.java} | 12 ++-- ..._17_R1.java => EntityProvider1_18_R1.java} | 8 +-- ..._17_R1.java => PlayerProvider1_18_R1.java} | 8 +-- ...17_R1.java => TextureProvider1_18_R1.java} | 4 +- .../impl/v1_18_R1/ToolProvider1_17_R1.java | 33 --------- .../impl/v1_18_R1/ToolProvider1_18_R1.java | 33 +++++++++ .../impl/v1_18_R1/VersionControl1_17_R1.java | 55 --------------- .../impl/v1_18_R1/VersionControl1_18_R1.java | 55 +++++++++++++++ ...17_R1.java => BukkitContainer1_18_R1.java} | 18 ++--- ...1_17_R1.java => BukkitContext1_18_R1.java} | 8 +-- ...tKey1_17_R1.java => BukkitKey1_18_R1.java} | 10 +-- ...ype1_17_R1.java => BukkitType1_18_R1.java} | 8 +-- ...7_R1.java => SimpleBukkitType1_18_R1.java} | 8 +-- ...17_R1.java => SyntaxContainer1_18_R1.java} | 28 ++++---- ...1_17_R1.java => SyntaxContext1_18_R1.java} | 8 +-- ...ype1_17_R1.java => SyntaxType1_18_R1.java} | 8 +-- ...pe1_17_R1.java => WrappedType1_18_R1.java} | 68 +++++++++---------- ...=> BukkitContainerAdapterHook1_18_R1.java} | 30 ++++---- ...and1_17_R1.java => ArmorStand1_18_R1.java} | 4 +- ...{Entity1_17_R1.java => Entity1_18_R1.java} | 4 +- ...g1_17_R1.java => EntityLiving1_18_R1.java} | 4 +- ...{Player1_17_R1.java => Player1_18_R1.java} | 8 +-- ...ols1_17_R1.java => BlockTools1_18_R1.java} | 2 +- ...ls1_17_R1.java => ServerTools1_18_R1.java} | 8 +-- ...ools1_17_R1.java => SkinTools1_18_R1.java} | 2 +- ...R1.java => EntityConstructors1_18_R1.java} | 6 +- ....java => ConsoleReaderWrapper1_18_R1.java} | 6 +- 27 files changed, 223 insertions(+), 223 deletions(-) rename vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/{BukkitConversion1_17_R1.java => BukkitConversion1_18_R1.java} (96%) rename vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/{EntityProvider1_17_R1.java => EntityProvider1_18_R1.java} (87%) rename vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/{PlayerProvider1_17_R1.java => PlayerProvider1_18_R1.java} (67%) rename vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/{TextureProvider1_17_R1.java => TextureProvider1_18_R1.java} (96%) delete mode 100644 vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/ToolProvider1_17_R1.java create mode 100644 vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/ToolProvider1_18_R1.java delete mode 100644 vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/VersionControl1_17_R1.java create mode 100644 vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/VersionControl1_18_R1.java rename vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/{BukkitContainer1_17_R1.java => BukkitContainer1_18_R1.java} (87%) rename vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/{BukkitContext1_17_R1.java => BukkitContext1_18_R1.java} (78%) rename vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/{BukkitKey1_17_R1.java => BukkitKey1_18_R1.java} (77%) rename vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/{BukkitType1_17_R1.java => BukkitType1_18_R1.java} (84%) rename vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/{SimpleBukkitType1_17_R1.java => SimpleBukkitType1_18_R1.java} (84%) rename vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/{SyntaxContainer1_17_R1.java => SyntaxContainer1_18_R1.java} (82%) rename vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/{SyntaxContext1_17_R1.java => SyntaxContext1_18_R1.java} (78%) rename vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/{SyntaxType1_17_R1.java => SyntaxType1_18_R1.java} (86%) rename vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/{WrappedType1_17_R1.java => WrappedType1_18_R1.java} (63%) rename vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/hook/{BukkitContainerAdapterHook1_17_R1.java => BukkitContainerAdapterHook1_18_R1.java} (86%) rename vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/entity/{ArmorStand1_17_R1.java => ArmorStand1_18_R1.java} (84%) rename vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/entity/{Entity1_17_R1.java => Entity1_18_R1.java} (98%) rename vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/entity/{EntityLiving1_17_R1.java => EntityLiving1_18_R1.java} (67%) rename vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/entity/{Player1_17_R1.java => Player1_18_R1.java} (98%) rename vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/tools/{BlockTools1_17_R1.java => BlockTools1_18_R1.java} (96%) rename vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/tools/{ServerTools1_17_R1.java => ServerTools1_18_R1.java} (74%) rename vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/tools/{SkinTools1_17_R1.java => SkinTools1_18_R1.java} (90%) rename vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/utils/{EntityConstructors1_17_R1.java => EntityConstructors1_18_R1.java} (53%) rename vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/wrapper/{ConsoleReaderWrapper1_17_R1.java => ConsoleReaderWrapper1_18_R1.java} (83%) diff --git a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/BukkitConversion1_17_R1.java b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/BukkitConversion1_18_R1.java similarity index 96% rename from vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/BukkitConversion1_17_R1.java rename to vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/BukkitConversion1_18_R1.java index f7f4b43..dd6dd0d 100644 --- a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/BukkitConversion1_17_R1.java +++ b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/BukkitConversion1_18_R1.java @@ -24,8 +24,8 @@ import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContext; import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityType; -import net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.data.BukkitContext1_17_R1; -import net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.data.BukkitType1_17_R1; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.data.BukkitContext1_18_R1; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.data.BukkitType1_18_R1; import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtByte; import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtByteArray; import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtCompound; @@ -42,9 +42,9 @@ import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtTag; import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtType; -public class BukkitConversion1_17_R1 extends BukkitConversion { +public class BukkitConversion1_18_R1 extends BukkitConversion { - protected BukkitConversion1_17_R1(VersionControl1_17_R1 versionControl) { + protected BukkitConversion1_18_R1(VersionControl1_18_R1 versionControl) { super(versionControl); } @@ -198,12 +198,12 @@ public NbtCompound itemToCompound(org.bukkit.inventory.ItemStack itemStack) { @Override public WrappedContext createContext(IDataAdapterContext context) { - return new BukkitContext1_17_R1(context); + return new BukkitContext1_18_R1(context); } @Override public WrapType wrap(IDataType dataType) { - return new BukkitType1_17_R1<>(dataType); + return new BukkitType1_18_R1<>(dataType); } } \ No newline at end of file diff --git a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/EntityProvider1_17_R1.java b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/EntityProvider1_18_R1.java similarity index 87% rename from vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/EntityProvider1_17_R1.java rename to vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/EntityProvider1_18_R1.java index 3529788..c8b45fc 100644 --- a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/EntityProvider1_17_R1.java +++ b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/EntityProvider1_18_R1.java @@ -9,20 +9,20 @@ import net.sourcewriters.minecraft.vcompat.provider.EntityProvider; import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntity; import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityType; -import net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.utils.EntityConstructors1_17_R1; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.utils.EntityConstructors1_18_R1; -public class EntityProvider1_17_R1 extends EntityProvider { +public class EntityProvider1_18_R1 extends EntityProvider { private final EnumMap> entityMap = new EnumMap<>(NmsEntityType.class); - protected EntityProvider1_17_R1(VersionControl1_17_R1 versionControl) { + protected EntityProvider1_18_R1(VersionControl1_18_R1 versionControl) { super(versionControl); } @SuppressWarnings("unchecked") private final Function searchConstructor(NmsEntityType type) { try { - return (Function) EntityConstructors1_17_R1.class.getField(type.name()).get(null); + return (Function) EntityConstructors1_18_R1.class.getField(type.name()).get(null); } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException ignore) { return null; } diff --git a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/PlayerProvider1_17_R1.java b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/PlayerProvider1_18_R1.java similarity index 67% rename from vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/PlayerProvider1_17_R1.java rename to vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/PlayerProvider1_18_R1.java index 971441c..6a24059 100644 --- a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/PlayerProvider1_17_R1.java +++ b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/PlayerProvider1_18_R1.java @@ -4,17 +4,17 @@ import net.sourcewriters.minecraft.vcompat.provider.PlayerProvider; import net.sourcewriters.minecraft.vcompat.provider.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.entity.Player1_17_R1; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.entity.Player1_18_R1; -public class PlayerProvider1_17_R1 extends PlayerProvider { +public class PlayerProvider1_18_R1 extends PlayerProvider { - protected PlayerProvider1_17_R1(VersionControl1_17_R1 versionControl) { + protected PlayerProvider1_18_R1(VersionControl1_18_R1 versionControl) { super(versionControl); } @Override protected NmsPlayer createPlayer(Player player) { - return new Player1_17_R1(player); + return new Player1_18_R1(player); } } \ No newline at end of file diff --git a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/TextureProvider1_17_R1.java b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/TextureProvider1_18_R1.java similarity index 96% rename from vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/TextureProvider1_17_R1.java rename to vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/TextureProvider1_18_R1.java index 7e21642..33d39ac 100644 --- a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/TextureProvider1_17_R1.java +++ b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/TextureProvider1_18_R1.java @@ -17,14 +17,14 @@ import net.sourcewriters.minecraft.vcompat.provider.TextureProvider; import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookup; -public class TextureProvider1_17_R1 extends TextureProvider { +public class TextureProvider1_18_R1 extends TextureProvider { private final ClassLookup craftEntityStateRef = ClassLookup.of(CraftBlockEntityState.class).searchField("tileEntity", "tileEntity"); private final ClassLookup craftItemStackRef = ClassLookup.of(CraftItemStack.class).searchField("handle", "handle"); private final ClassLookup craftMetaSkullRef = ClassLookup.of("org.bukkit.craftbukkit.v1_17_R1.inventory.CraftMetaSkull") .searchField("serialized", "serializedProfile").searchField("profile", "profile"); - protected TextureProvider1_17_R1(VersionControl1_17_R1 versionControl) { + protected TextureProvider1_18_R1(VersionControl1_18_R1 versionControl) { super(versionControl); } diff --git a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/ToolProvider1_17_R1.java b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/ToolProvider1_17_R1.java deleted file mode 100644 index bf6828b..0000000 --- a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/ToolProvider1_17_R1.java +++ /dev/null @@ -1,33 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1; - -import net.sourcewriters.minecraft.vcompat.provider.ToolProvider; -import net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.tools.BlockTools1_17_R1; -import net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.tools.ServerTools1_17_R1; -import net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.tools.SkinTools1_17_R1; - -public class ToolProvider1_17_R1 extends ToolProvider { - - private final BlockTools1_17_R1 blockTools = new BlockTools1_17_R1(); - private final SkinTools1_17_R1 skinTools = new SkinTools1_17_R1(); - private final ServerTools1_17_R1 serverTools = new ServerTools1_17_R1(); - - protected ToolProvider1_17_R1(VersionControl1_17_R1 versionControl) { - super(versionControl); - } - - @Override - public SkinTools1_17_R1 getSkinTools() { - return skinTools; - } - - @Override - public ServerTools1_17_R1 getServerTools() { - return serverTools; - } - - @Override - public BlockTools1_17_R1 getBlockTools() { - return blockTools; - } - -} \ No newline at end of file diff --git a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/ToolProvider1_18_R1.java b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/ToolProvider1_18_R1.java new file mode 100644 index 0000000..6970e27 --- /dev/null +++ b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/ToolProvider1_18_R1.java @@ -0,0 +1,33 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1; + +import net.sourcewriters.minecraft.vcompat.provider.ToolProvider; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.tools.BlockTools1_18_R1; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.tools.ServerTools1_18_R1; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.tools.SkinTools1_18_R1; + +public class ToolProvider1_18_R1 extends ToolProvider { + + private final BlockTools1_18_R1 blockTools = new BlockTools1_18_R1(); + private final SkinTools1_18_R1 skinTools = new SkinTools1_18_R1(); + private final ServerTools1_18_R1 serverTools = new ServerTools1_18_R1(); + + protected ToolProvider1_18_R1(VersionControl1_18_R1 versionControl) { + super(versionControl); + } + + @Override + public SkinTools1_18_R1 getSkinTools() { + return skinTools; + } + + @Override + public ServerTools1_18_R1 getServerTools() { + return serverTools; + } + + @Override + public BlockTools1_18_R1 getBlockTools() { + return blockTools; + } + +} \ No newline at end of file diff --git a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/VersionControl1_17_R1.java b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/VersionControl1_17_R1.java deleted file mode 100644 index f4e8632..0000000 --- a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/VersionControl1_17_R1.java +++ /dev/null @@ -1,55 +0,0 @@ -package net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1; - -import net.sourcewriters.minecraft.vcompat.provider.VersionControl; -import net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.data.hook.BukkitContainerAdapterHook1_17_R1; - -public class VersionControl1_17_R1 extends VersionControl { - - public static VersionControl1_17_R1 INSTANCE; - - public static VersionControl1_17_R1 init() { - return INSTANCE != null ? INSTANCE : (INSTANCE = new VersionControl1_17_R1()); - } - - private final ToolProvider1_17_R1 toolProvider = new ToolProvider1_17_R1(this); - private final TextureProvider1_17_R1 textureProvider = new TextureProvider1_17_R1(this); - private final EntityProvider1_17_R1 entityProvider = new EntityProvider1_17_R1(this); - private final PlayerProvider1_17_R1 playerProvider = new PlayerProvider1_17_R1(this); - private final BukkitConversion1_17_R1 bukkitConversion = new BukkitConversion1_17_R1(this); - - private VersionControl1_17_R1() { - BukkitContainerAdapterHook1_17_R1.hookEntity(); - } - - @Override - public ToolProvider1_17_R1 getToolProvider() { - return toolProvider; - } - - @Override - public EntityProvider1_17_R1 getEntityProvider() { - return entityProvider; - } - - @Override - public PlayerProvider1_17_R1 getPlayerProvider() { - return playerProvider; - } - - @Override - public TextureProvider1_17_R1 getTextureProvider() { - return textureProvider; - } - - @Override - public BukkitConversion1_17_R1 getBukkitConversion() { - return bukkitConversion; - } - - @Override - public void shutdown() { - dataProvider.getDefaultDistributor().shutdown(); - BukkitContainerAdapterHook1_17_R1.unhookAll(); - } - -} \ No newline at end of file diff --git a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/VersionControl1_18_R1.java b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/VersionControl1_18_R1.java new file mode 100644 index 0000000..87eb8b3 --- /dev/null +++ b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/VersionControl1_18_R1.java @@ -0,0 +1,55 @@ +package net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1; + +import net.sourcewriters.minecraft.vcompat.provider.VersionControl; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.data.hook.BukkitContainerAdapterHook1_18_R1; + +public class VersionControl1_18_R1 extends VersionControl { + + public static VersionControl1_18_R1 INSTANCE; + + public static VersionControl1_18_R1 init() { + return INSTANCE != null ? INSTANCE : (INSTANCE = new VersionControl1_18_R1()); + } + + private final ToolProvider1_18_R1 toolProvider = new ToolProvider1_18_R1(this); + private final TextureProvider1_18_R1 textureProvider = new TextureProvider1_18_R1(this); + private final EntityProvider1_18_R1 entityProvider = new EntityProvider1_18_R1(this); + private final PlayerProvider1_18_R1 playerProvider = new PlayerProvider1_18_R1(this); + private final BukkitConversion1_18_R1 bukkitConversion = new BukkitConversion1_18_R1(this); + + private VersionControl1_18_R1() { + BukkitContainerAdapterHook1_18_R1.hookEntity(); + } + + @Override + public ToolProvider1_18_R1 getToolProvider() { + return toolProvider; + } + + @Override + public EntityProvider1_18_R1 getEntityProvider() { + return entityProvider; + } + + @Override + public PlayerProvider1_18_R1 getPlayerProvider() { + return playerProvider; + } + + @Override + public TextureProvider1_18_R1 getTextureProvider() { + return textureProvider; + } + + @Override + public BukkitConversion1_18_R1 getBukkitConversion() { + return bukkitConversion; + } + + @Override + public void shutdown() { + dataProvider.getDefaultDistributor().shutdown(); + BukkitContainerAdapterHook1_18_R1.unhookAll(); + } + +} \ No newline at end of file diff --git a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/BukkitContainer1_17_R1.java b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/BukkitContainer1_18_R1.java similarity index 87% rename from vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/BukkitContainer1_17_R1.java rename to vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/BukkitContainer1_18_R1.java index d1be941..8fa244a 100644 --- a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/BukkitContainer1_17_R1.java +++ b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/BukkitContainer1_18_R1.java @@ -16,11 +16,11 @@ import net.sourcewriters.minecraft.vcompat.provider.data.WrappedKey; import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SyntaxKey; -public final class BukkitContainer1_17_R1 extends WrappedContainer implements PersistentDataContainer { +public final class BukkitContainer1_18_R1 extends WrappedContainer implements PersistentDataContainer { private final IDataContainer container; - public BukkitContainer1_17_R1(IDataContainer container) { + public BukkitContainer1_18_R1(IDataContainer container) { this.container = container; } @@ -40,12 +40,12 @@ public IDataContainer getAsSyntaxContainer() { @Override public boolean has(NamespacedKey key, PersistentDataType type) { - return has(new BukkitKey1_17_R1(key), WrappedType1_17_R1.wrap(type)); + return has(new BukkitKey1_18_R1(key), WrappedType1_18_R1.wrap(type)); } @Override public Z get(NamespacedKey key, PersistentDataType type) { - return get(new BukkitKey1_17_R1(key), WrappedType1_17_R1.wrap(type)); + return get(new BukkitKey1_18_R1(key), WrappedType1_18_R1.wrap(type)); } @Override @@ -55,17 +55,17 @@ public Z getOrDefault(NamespacedKey key, PersistentDataType type, Z @Override public void set(NamespacedKey key, PersistentDataType type, Z value) { - set(new BukkitKey1_17_R1(key), value, WrappedType1_17_R1.wrap(type)); + set(new BukkitKey1_18_R1(key), value, WrappedType1_18_R1.wrap(type)); } @Override public void remove(NamespacedKey key) { - remove(new BukkitKey1_17_R1(key)); + remove(new BukkitKey1_18_R1(key)); } @Override public Set getKeys() { - return Arrays.stream(container.getKeys()).map(SyntaxKey::new).map(BukkitKey1_17_R1::asBukkit).collect(Collectors.toSet()); + return Arrays.stream(container.getKeys()).map(SyntaxKey::new).map(BukkitKey1_18_R1::asBukkit).collect(Collectors.toSet()); } @Override @@ -78,8 +78,8 @@ public PersistentDataAdapterContext getAdapterContext() { */ @Override - public BukkitContext1_17_R1 getWrapContext() { - return new BukkitContext1_17_R1(container.getContext()); + public BukkitContext1_18_R1 getWrapContext() { + return new BukkitContext1_18_R1(container.getContext()); } @Override diff --git a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/BukkitContext1_17_R1.java b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/BukkitContext1_18_R1.java similarity index 78% rename from vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/BukkitContext1_17_R1.java rename to vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/BukkitContext1_18_R1.java index 53fba24..f9b09b1 100644 --- a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/BukkitContext1_17_R1.java +++ b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/BukkitContext1_18_R1.java @@ -7,11 +7,11 @@ import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContext; -public final class BukkitContext1_17_R1 extends WrappedContext implements PersistentDataAdapterContext { +public final class BukkitContext1_18_R1 extends WrappedContext implements PersistentDataAdapterContext { private final IDataAdapterContext context; - public BukkitContext1_17_R1(IDataAdapterContext context) { + public BukkitContext1_18_R1(IDataAdapterContext context) { this.context = context; } @@ -31,8 +31,8 @@ public IDataContainer newContainer() { } @Override - public BukkitContainer1_17_R1 newWrapContainer() { - return new BukkitContainer1_17_R1(context.newContainer()); + public BukkitContainer1_18_R1 newWrapContainer() { + return new BukkitContainer1_18_R1(context.newContainer()); } } \ No newline at end of file diff --git a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/BukkitKey1_17_R1.java b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/BukkitKey1_18_R1.java similarity index 77% rename from vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/BukkitKey1_17_R1.java rename to vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/BukkitKey1_18_R1.java index 428ed1b..4e6d179 100644 --- a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/BukkitKey1_17_R1.java +++ b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/BukkitKey1_18_R1.java @@ -5,20 +5,20 @@ import net.sourcewriters.minecraft.vcompat.provider.data.WrappedKey; -public final class BukkitKey1_17_R1 extends WrappedKey { +public final class BukkitKey1_18_R1 extends WrappedKey { private final NamespacedKey key; - public BukkitKey1_17_R1(Plugin plugin, String key) { + public BukkitKey1_18_R1(Plugin plugin, String key) { this.key = new NamespacedKey(plugin, key); } @SuppressWarnings("deprecation") - public BukkitKey1_17_R1(String name, String key) { + public BukkitKey1_18_R1(String name, String key) { this.key = new NamespacedKey(name, key); } - public BukkitKey1_17_R1(NamespacedKey key) { + public BukkitKey1_18_R1(NamespacedKey key) { this.key = key; } @@ -46,7 +46,7 @@ public static NamespacedKey asBukkit(WrappedKey key) { if (key.getHandle() instanceof NamespacedKey) { return (NamespacedKey) key.getHandle(); } - return new BukkitKey1_17_R1(key.getName(), key.getKey()).getHandle(); + return new BukkitKey1_18_R1(key.getName(), key.getKey()).getHandle(); } } \ No newline at end of file diff --git a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/BukkitType1_17_R1.java b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/BukkitType1_18_R1.java similarity index 84% rename from vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/BukkitType1_17_R1.java rename to vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/BukkitType1_18_R1.java index 606f806..f8573fe 100644 --- a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/BukkitType1_17_R1.java +++ b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/BukkitType1_18_R1.java @@ -6,12 +6,12 @@ import net.sourcewriters.minecraft.vcompat.data.api.IDataType; import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContext; -public class BukkitType1_17_R1 extends WrappedType1_17_R1, P0, P1, C0, C1> +public class BukkitType1_18_R1 extends WrappedType1_18_R1, P0, P1, C0, C1> implements PersistentDataType { private final IDataType type; - public BukkitType1_17_R1(IDataType type) { + public BukkitType1_18_R1(IDataType type) { super(type.getPrimitive(), type.getComplex()); this.type = type; } @@ -47,12 +47,12 @@ public Class getPrimitiveType() { @Override public P0 toPrimitive(C0 complex, PersistentDataAdapterContext context) { - return wrapToPrimitive(complex, new SyntaxContext1_17_R1(context)); + return wrapToPrimitive(complex, new SyntaxContext1_18_R1(context)); } @Override public C0 fromPrimitive(P0 primitive, PersistentDataAdapterContext context) { - return wrapToComplex(primitive, new SyntaxContext1_17_R1(context)); + return wrapToComplex(primitive, new SyntaxContext1_18_R1(context)); } @Override diff --git a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/SimpleBukkitType1_17_R1.java b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/SimpleBukkitType1_18_R1.java similarity index 84% rename from vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/SimpleBukkitType1_17_R1.java rename to vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/SimpleBukkitType1_18_R1.java index de377fc..4be725a 100644 --- a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/SimpleBukkitType1_17_R1.java +++ b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/SimpleBukkitType1_18_R1.java @@ -5,11 +5,11 @@ import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; -public class SimpleBukkitType1_17_R1 implements PersistentDataType { +public class SimpleBukkitType1_18_R1 implements PersistentDataType { private final WrapType type; - public SimpleBukkitType1_17_R1(WrapType type) { + public SimpleBukkitType1_18_R1(WrapType type) { this.type = type; } @@ -25,12 +25,12 @@ public Class

getPrimitiveType() { @Override public P toPrimitive(C complex, PersistentDataAdapterContext context) { - return type.wrapToPrimitive(complex, new SyntaxContext1_17_R1(context)); + return type.wrapToPrimitive(complex, new SyntaxContext1_18_R1(context)); } @Override public C fromPrimitive(P primitive, PersistentDataAdapterContext context) { - return type.wrapToComplex(primitive, new SyntaxContext1_17_R1(context)); + return type.wrapToComplex(primitive, new SyntaxContext1_18_R1(context)); } } \ No newline at end of file diff --git a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/SyntaxContainer1_17_R1.java b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/SyntaxContainer1_18_R1.java similarity index 82% rename from vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/SyntaxContainer1_17_R1.java rename to vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/SyntaxContainer1_18_R1.java index 0137372..d37883d 100644 --- a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/SyntaxContainer1_17_R1.java +++ b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/SyntaxContainer1_18_R1.java @@ -16,11 +16,11 @@ import net.sourcewriters.minecraft.vcompat.provider.data.wrap.SyntaxKey; import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.utils.key.IKey; -public final class SyntaxContainer1_17_R1 extends WrappedContainer implements IDataContainer { +public final class SyntaxContainer1_18_R1 extends WrappedContainer implements IDataContainer { private final PersistentDataContainer container; - public SyntaxContainer1_17_R1(PersistentDataContainer container) { + public SyntaxContainer1_18_R1(PersistentDataContainer container) { this.container = container; } @@ -31,7 +31,7 @@ public PersistentDataContainer getHandle() { @Override public IDataContainer getAsSyntaxContainer() { - return new SyntaxContainer1_17_R1(container); + return new SyntaxContainer1_18_R1(container); } @Override @@ -55,7 +55,7 @@ public boolean has(String key, IDataType type) { @Override public boolean has(IKey key, IDataType type) { - return has(new SyntaxKey(key), WrappedType1_17_R1.wrap(type)); + return has(new SyntaxKey(key), WrappedType1_18_R1.wrap(type)); } @Override @@ -65,7 +65,7 @@ public C get(String key, IDataType type) { @Override public C get(IKey key, IDataType type) { - return get(new SyntaxKey(key), WrappedType1_17_R1.wrap(type)); + return get(new SyntaxKey(key), WrappedType1_18_R1.wrap(type)); } @Override @@ -80,12 +80,12 @@ public Object get(IKey key) { @Override public void set(String key, E value, IDataType type) { - set(wrappedKey(key), value, WrappedType1_17_R1.wrap(type)); + set(wrappedKey(key), value, WrappedType1_18_R1.wrap(type)); } @Override public void set(IKey key, E value, IDataType type) { - set(new SyntaxKey(key), value, WrappedType1_17_R1.wrap(type)); + set(new SyntaxKey(key), value, WrappedType1_18_R1.wrap(type)); } @Override @@ -100,7 +100,7 @@ public boolean remove(IKey key) { @Override public IKey[] getKeys() { - return container.getKeys().stream().map(BukkitKey1_17_R1::new).map(WrappedKey::getNamespacedKey).toArray(IKey[]::new); + return container.getKeys().stream().map(BukkitKey1_18_R1::new).map(WrappedKey::getNamespacedKey).toArray(IKey[]::new); } @Override @@ -118,8 +118,8 @@ public IDataAdapterContext getContext() { */ @Override - public SyntaxContext1_17_R1 getWrapContext() { - return new SyntaxContext1_17_R1(container.getAdapterContext()); + public SyntaxContext1_18_R1 getWrapContext() { + return new SyntaxContext1_18_R1(container.getAdapterContext()); } @Override @@ -139,7 +139,7 @@ public boolean has(String key, WrapType type) { @Override public boolean has(WrappedKey key, WrapType type) { - return container.has(BukkitKey1_17_R1.asBukkit(key), new SimpleBukkitType1_17_R1<>(type)); + return container.has(BukkitKey1_18_R1.asBukkit(key), new SimpleBukkitType1_18_R1<>(type)); } @Override @@ -154,7 +154,7 @@ public C get(String key, WrapType type) { @Override public C get(WrappedKey key, WrapType type) { - return container.get(BukkitKey1_17_R1.asBukkit(key), new SimpleBukkitType1_17_R1<>(type)); + return container.get(BukkitKey1_18_R1.asBukkit(key), new SimpleBukkitType1_18_R1<>(type)); } @Override @@ -164,12 +164,12 @@ public void set(String key, B value, WrapType type) { @Override public void set(WrappedKey key, B value, WrapType type) { - container.set(BukkitKey1_17_R1.asBukkit(key), new SimpleBukkitType1_17_R1<>(type), value); + container.set(BukkitKey1_18_R1.asBukkit(key), new SimpleBukkitType1_18_R1<>(type), value); } @Override public boolean remove(WrappedKey key) { - container.remove(BukkitKey1_17_R1.asBukkit(key)); + container.remove(BukkitKey1_18_R1.asBukkit(key)); return true; // Will always return true as we don't know if it contained it } diff --git a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/SyntaxContext1_17_R1.java b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/SyntaxContext1_18_R1.java similarity index 78% rename from vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/SyntaxContext1_17_R1.java rename to vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/SyntaxContext1_18_R1.java index eb8ede7..aa5e9b1 100644 --- a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/SyntaxContext1_17_R1.java +++ b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/SyntaxContext1_18_R1.java @@ -6,11 +6,11 @@ import net.sourcewriters.minecraft.vcompat.data.api.IDataContainer; import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContext; -public final class SyntaxContext1_17_R1 extends WrappedContext implements PersistentDataAdapterContext { +public final class SyntaxContext1_18_R1 extends WrappedContext implements PersistentDataAdapterContext { private final PersistentDataAdapterContext context; - public SyntaxContext1_17_R1(PersistentDataAdapterContext context) { + public SyntaxContext1_18_R1(PersistentDataAdapterContext context) { this.context = context; } @@ -30,8 +30,8 @@ public IDataContainer newContainer() { } @Override - public SyntaxContainer1_17_R1 newWrapContainer() { - return new SyntaxContainer1_17_R1(context.newPersistentDataContainer()); + public SyntaxContainer1_18_R1 newWrapContainer() { + return new SyntaxContainer1_18_R1(context.newPersistentDataContainer()); } } \ No newline at end of file diff --git a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/SyntaxType1_17_R1.java b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/SyntaxType1_18_R1.java similarity index 86% rename from vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/SyntaxType1_17_R1.java rename to vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/SyntaxType1_18_R1.java index 394b47b..7759f65 100644 --- a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/SyntaxType1_17_R1.java +++ b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/SyntaxType1_18_R1.java @@ -7,12 +7,12 @@ import net.sourcewriters.minecraft.vcompat.data.api.IDataType; import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContext; -public class SyntaxType1_17_R1 extends WrappedType1_17_R1, P0, P1, C0, C1> +public class SyntaxType1_18_R1 extends WrappedType1_18_R1, P0, P1, C0, C1> implements IDataType { private final PersistentDataType type; - public SyntaxType1_17_R1(PersistentDataType type) { + public SyntaxType1_18_R1(PersistentDataType type) { super(type.getPrimitiveType(), type.getComplexType()); this.type = type; } @@ -48,12 +48,12 @@ public Class getPrimitive() { @Override public P0 toPrimitive(IDataAdapterContext context, C0 complex) { - return wrapToPrimitive(complex, new BukkitContext1_17_R1(context)); + return wrapToPrimitive(complex, new BukkitContext1_18_R1(context)); } @Override public C0 fromPrimitive(IDataAdapterContext context, P0 primitive) { - return wrapToComplex(primitive, new BukkitContext1_17_R1(context)); + return wrapToComplex(primitive, new BukkitContext1_18_R1(context)); } @Override diff --git a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/WrappedType1_17_R1.java b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/WrappedType1_18_R1.java similarity index 63% rename from vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/WrappedType1_17_R1.java rename to vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/WrappedType1_18_R1.java index 48b62fe..3766fd2 100644 --- a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/WrappedType1_17_R1.java +++ b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/WrappedType1_18_R1.java @@ -9,7 +9,7 @@ import net.sourcewriters.minecraft.vcompat.data.api.IDataType; import net.sourcewriters.minecraft.vcompat.provider.data.WrapType; -public abstract class WrappedType1_17_R1 implements WrapType { +public abstract class WrappedType1_18_R1 implements WrapType { protected final Class primitiveType; protected final Class complexType; @@ -18,11 +18,11 @@ public abstract class WrappedType1_17_R1 implements WrapType< private final int complexWrap; @SuppressWarnings("unchecked") - protected WrappedType1_17_R1(Class primitive, Class complex) { - this.primitiveWrap = WrappedType1_17_R1.internalState(primitive); - this.complexWrap = WrappedType1_17_R1.internalState(complex); - this.primitiveType = (Class) WrappedType1_17_R1.internalWrap(primitive, primitiveWrap); - this.complexType = (Class) WrappedType1_17_R1.internalWrap(complex, complexWrap); + protected WrappedType1_18_R1(Class primitive, Class complex) { + this.primitiveWrap = WrappedType1_18_R1.internalState(primitive); + this.complexWrap = WrappedType1_18_R1.internalState(complex); + this.primitiveType = (Class) WrappedType1_18_R1.internalWrap(primitive, primitiveWrap); + this.complexType = (Class) WrappedType1_18_R1.internalWrap(complex, complexWrap); } public abstract H getHandle(); @@ -43,15 +43,15 @@ public Class getComplexWrapped() { public P0 toPrimitiveWrapped(P1 primitive) { switch (primitiveWrap) { case 1: - return (P0) new SyntaxContainer1_17_R1((PersistentDataContainer) primitive); + return (P0) new SyntaxContainer1_18_R1((PersistentDataContainer) primitive); case 2: - return (P0) Arrays.stream((PersistentDataContainer[]) primitive).map(SyntaxContainer1_17_R1::new) - .toArray(SyntaxContainer1_17_R1[]::new); + return (P0) Arrays.stream((PersistentDataContainer[]) primitive).map(SyntaxContainer1_18_R1::new) + .toArray(SyntaxContainer1_18_R1[]::new); case 3: - return (P0) new BukkitContainer1_17_R1((IDataContainer) primitive); + return (P0) new BukkitContainer1_18_R1((IDataContainer) primitive); case 4: - return (P0) Arrays.stream((IDataContainer[]) primitive).map(BukkitContainer1_17_R1::new) - .toArray(BukkitContainer1_17_R1[]::new); + return (P0) Arrays.stream((IDataContainer[]) primitive).map(BukkitContainer1_18_R1::new) + .toArray(BukkitContainer1_18_R1[]::new); default: return (P0) primitive; } @@ -61,13 +61,13 @@ public P0 toPrimitiveWrapped(P1 primitive) { public C0 toComplexWrapped(C1 complex) { switch (complexWrap) { case 1: - return (C0) new SyntaxContainer1_17_R1((PersistentDataContainer) complex); + return (C0) new SyntaxContainer1_18_R1((PersistentDataContainer) complex); case 2: - return (C0) Arrays.stream((PersistentDataContainer[]) complex).map(SyntaxContainer1_17_R1::new).toArray(SyntaxContainer1_17_R1[]::new); + return (C0) Arrays.stream((PersistentDataContainer[]) complex).map(SyntaxContainer1_18_R1::new).toArray(SyntaxContainer1_18_R1[]::new); case 3: - return (C0) new BukkitContainer1_17_R1((IDataContainer) complex); + return (C0) new BukkitContainer1_18_R1((IDataContainer) complex); case 4: - return (C0) Arrays.stream((IDataContainer[]) complex).map(BukkitContainer1_17_R1::new).toArray(BukkitContainer1_17_R1[]::new); + return (C0) Arrays.stream((IDataContainer[]) complex).map(BukkitContainer1_18_R1::new).toArray(BukkitContainer1_18_R1[]::new); default: return (C0) complex; } @@ -77,15 +77,15 @@ public C0 toComplexWrapped(C1 complex) { public P1 toPrimitiveOriginal(P0 primitive) { switch (primitiveWrap) { case 1: - return (P1) new BukkitContainer1_17_R1((IDataContainer) primitive); + return (P1) new BukkitContainer1_18_R1((IDataContainer) primitive); case 2: - return (P1) Arrays.stream((IDataContainer[]) primitive).map(BukkitContainer1_17_R1::new) - .toArray(BukkitContainer1_17_R1[]::new); + return (P1) Arrays.stream((IDataContainer[]) primitive).map(BukkitContainer1_18_R1::new) + .toArray(BukkitContainer1_18_R1[]::new); case 3: - return (P1) new SyntaxContainer1_17_R1((PersistentDataContainer) primitive); + return (P1) new SyntaxContainer1_18_R1((PersistentDataContainer) primitive); case 4: - return (P1) Arrays.stream((PersistentDataContainer[]) primitive).map(SyntaxContainer1_17_R1::new) - .toArray(SyntaxContainer1_17_R1[]::new); + return (P1) Arrays.stream((PersistentDataContainer[]) primitive).map(SyntaxContainer1_18_R1::new) + .toArray(SyntaxContainer1_18_R1[]::new); default: return (P1) primitive; } @@ -95,13 +95,13 @@ public P1 toPrimitiveOriginal(P0 primitive) { public C1 toComplexOriginal(C0 complex) { switch (complexWrap) { case 1: - return (C1) new BukkitContainer1_17_R1((IDataContainer) complex); + return (C1) new BukkitContainer1_18_R1((IDataContainer) complex); case 2: - return (C1) Arrays.stream((IDataContainer[]) complex).map(BukkitContainer1_17_R1::new).toArray(BukkitContainer1_17_R1[]::new); + return (C1) Arrays.stream((IDataContainer[]) complex).map(BukkitContainer1_18_R1::new).toArray(BukkitContainer1_18_R1[]::new); case 3: - return (C1) new SyntaxContainer1_17_R1((PersistentDataContainer) complex); + return (C1) new SyntaxContainer1_18_R1((PersistentDataContainer) complex); case 4: - return (C1) Arrays.stream((PersistentDataContainer[]) complex).map(SyntaxContainer1_17_R1::new).toArray(SyntaxContainer1_17_R1[]::new); + return (C1) Arrays.stream((PersistentDataContainer[]) complex).map(SyntaxContainer1_18_R1::new).toArray(SyntaxContainer1_18_R1[]::new); default: return (C1) complex; } @@ -110,13 +110,13 @@ public C1 toComplexOriginal(C0 complex) { protected static Class internalWrap(Class clazz, int state) { switch (state) { case 1: - return SyntaxContainer1_17_R1.class; + return SyntaxContainer1_18_R1.class; case 2: - return SyntaxContainer1_17_R1[].class; + return SyntaxContainer1_18_R1[].class; case 3: - return BukkitContainer1_17_R1.class; + return BukkitContainer1_18_R1.class; case 4: - return BukkitContainer1_17_R1[].class; + return BukkitContainer1_18_R1[].class; default: return clazz; } @@ -138,12 +138,12 @@ protected static int internalState(Class clazz) { return 0; } - public static BukkitType1_17_R1 wrap(IDataType type) { - return new BukkitType1_17_R1<>(type); + public static BukkitType1_18_R1 wrap(IDataType type) { + return new BukkitType1_18_R1<>(type); } - public static SyntaxType1_17_R1 wrap(PersistentDataType type) { - return new SyntaxType1_17_R1<>(type); + public static SyntaxType1_18_R1 wrap(PersistentDataType type) { + return new SyntaxType1_18_R1<>(type); } } \ No newline at end of file diff --git a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/hook/BukkitContainerAdapterHook1_17_R1.java b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/hook/BukkitContainerAdapterHook1_18_R1.java similarity index 86% rename from vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/hook/BukkitContainerAdapterHook1_17_R1.java rename to vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/hook/BukkitContainerAdapterHook1_18_R1.java index 5058997..acb914c 100644 --- a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/hook/BukkitContainerAdapterHook1_17_R1.java +++ b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/data/hook/BukkitContainerAdapterHook1_18_R1.java @@ -16,8 +16,8 @@ import net.sourcewriters.minecraft.vcompat.data.nbt.NbtContainer; import net.sourcewriters.minecraft.vcompat.provider.VersionControl; import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContainer; -import net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.data.BukkitContainer1_17_R1; -import net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.data.SyntaxContainer1_17_R1; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.data.BukkitContainer1_18_R1; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.data.SyntaxContainer1_18_R1; import net.sourcewriters.minecraft.vcompat.provider.lookup.handle.ClassLookup; import net.sourcewriters.minecraft.vcompat.shaded.syntaxapi.nbt.NbtCompound; @@ -25,9 +25,9 @@ "rawtypes", "unchecked" }) -public final class BukkitContainerAdapterHook1_17_R1 { +public final class BukkitContainerAdapterHook1_18_R1 { - private static final BukkitContainerAdapterHook1_17_R1 HOOK = new BukkitContainerAdapterHook1_17_R1(); + private static final BukkitContainerAdapterHook1_18_R1 HOOK = new BukkitContainerAdapterHook1_18_R1(); private final ClassLookup registryRef = ClassLookup.of(CraftPersistentDataTypeRegistry.class) .searchMethod("create", "createAdapter", Class.class, Class.class, Function.class, Function.class) @@ -35,7 +35,7 @@ public final class BukkitContainerAdapterHook1_17_R1 { .searchField("function", "CREATE_ADAPTER"); private final ClassLookup entityRef = ClassLookup.of(CraftEntity.class).searchField("registry", "DATA_TYPE_REGISTRY"); - private BukkitContainerAdapterHook1_17_R1() {} + private BukkitContainerAdapterHook1_18_R1() {} private final HashMap map = new HashMap<>(); @@ -46,8 +46,8 @@ private CraftPersistentDataTypeRegistry getEntityRegistry() { private void uninjectAll() { for (CraftPersistentDataTypeRegistry registry : map.keySet()) { Map adapters = (Map) registryRef.getFieldValue(registry, "adapters"); - adapters.remove(BukkitContainer1_17_R1.class); - adapters.remove(SyntaxContainer1_17_R1.class); + adapters.remove(BukkitContainer1_18_R1.class); + adapters.remove(SyntaxContainer1_18_R1.class); registryRef.setFieldValue(registry, "function", map.get(registry)); } map.clear(); @@ -63,11 +63,11 @@ private void inject(CraftPersistentDataTypeRegistry registry) { } private E createAdapter(CraftPersistentDataTypeRegistry registry, Class adapterType, Class type) { - if (Objects.equals(BukkitContainer1_17_R1.class, type)) { - return (E) buildAdapter(registry, BukkitContainer1_17_R1.class, tag -> fromPrimitiveSyntax(tag)); + if (Objects.equals(BukkitContainer1_18_R1.class, type)) { + return (E) buildAdapter(registry, BukkitContainer1_18_R1.class, tag -> fromPrimitiveSyntax(tag)); } - if (Objects.equals(SyntaxContainer1_17_R1.class, type)) { - return (E) buildAdapter(registry, SyntaxContainer1_17_R1.class, tag -> fromPrimitiveBukkit(registry, tag)); + if (Objects.equals(SyntaxContainer1_18_R1.class, type)) { + return (E) buildAdapter(registry, SyntaxContainer1_18_R1.class, tag -> fromPrimitiveBukkit(registry, tag)); } return (E) map.get(registry).apply(type); } @@ -96,18 +96,18 @@ private CompoundTag toPrimitive(WrappedContainer input) { throw new IllegalArgumentException("Unknown WrappedContainer implementation!"); } - private BukkitContainer1_17_R1 fromPrimitiveSyntax(CompoundTag data) { + private BukkitContainer1_18_R1 fromPrimitiveSyntax(CompoundTag data) { VersionControl control = VersionCompatProvider.get().getControl(); NbtContainer container = new NbtContainer(control.getDataProvider().getRegistry()); NbtCompound compound = control.getBukkitConversion().fromMinecraftCompound(data); container.fromNbt(compound); - return new BukkitContainer1_17_R1(container); + return new BukkitContainer1_18_R1(container); } - private SyntaxContainer1_17_R1 fromPrimitiveBukkit(CraftPersistentDataTypeRegistry registry, CompoundTag data) { + private SyntaxContainer1_18_R1 fromPrimitiveBukkit(CraftPersistentDataTypeRegistry registry, CompoundTag data) { CraftPersistentDataContainer container = new CraftPersistentDataContainer(registry); container.putAll(data); - return new SyntaxContainer1_17_R1(container); + return new SyntaxContainer1_18_R1(container); } private WrappedContainer findFinalContainer(WrappedContainer container) { diff --git a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/entity/ArmorStand1_17_R1.java b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/entity/ArmorStand1_18_R1.java similarity index 84% rename from vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/entity/ArmorStand1_17_R1.java rename to vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/entity/ArmorStand1_18_R1.java index 54b8bd9..4f2a3c9 100644 --- a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/entity/ArmorStand1_17_R1.java +++ b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/entity/ArmorStand1_18_R1.java @@ -5,9 +5,9 @@ import net.minecraft.world.level.Level; import net.sourcewriters.minecraft.vcompat.provider.entity.NmsArmorStand; -public class ArmorStand1_17_R1 extends EntityLiving1_17_R1 implements NmsArmorStand { +public class ArmorStand1_18_R1 extends EntityLiving1_18_R1 implements NmsArmorStand { - public ArmorStand1_17_R1(Level world) { + public ArmorStand1_18_R1(Level world) { super(new ArmorStand(EntityType.ARMOR_STAND, world)); } diff --git a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/entity/Entity1_17_R1.java b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/entity/Entity1_18_R1.java similarity index 98% rename from vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/entity/Entity1_17_R1.java rename to vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/entity/Entity1_18_R1.java index c6118f2..c9f5151 100644 --- a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/entity/Entity1_17_R1.java +++ b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/entity/Entity1_18_R1.java @@ -23,13 +23,13 @@ import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntity; import net.sourcewriters.minecraft.vcompat.provider.utils.NmsBoundingBox; -public abstract class Entity1_17_R1 implements NmsEntity { +public abstract class Entity1_18_R1 implements NmsEntity { protected final E handle; protected final List visible = Collections.synchronizedList(new ArrayList<>()); - public Entity1_17_R1(E handle) { + public Entity1_18_R1(E handle) { this.handle = handle; } diff --git a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/entity/EntityLiving1_17_R1.java b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/entity/EntityLiving1_18_R1.java similarity index 67% rename from vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/entity/EntityLiving1_17_R1.java rename to vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/entity/EntityLiving1_18_R1.java index e99260c..eaa5142 100644 --- a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/entity/EntityLiving1_17_R1.java +++ b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/entity/EntityLiving1_18_R1.java @@ -3,9 +3,9 @@ import net.minecraft.world.entity.LivingEntity; import net.sourcewriters.minecraft.vcompat.provider.entity.NmsEntityLiving; -public abstract class EntityLiving1_17_R1 extends Entity1_17_R1 implements NmsEntityLiving { +public abstract class EntityLiving1_18_R1 extends Entity1_18_R1 implements NmsEntityLiving { - public EntityLiving1_17_R1(E handle) { + public EntityLiving1_18_R1(E handle) { super(handle); } diff --git a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/entity/Player1_17_R1.java b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/entity/Player1_18_R1.java similarity index 98% rename from vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/entity/Player1_17_R1.java rename to vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/entity/Player1_18_R1.java index 389f8f7..a3ac23a 100644 --- a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/entity/Player1_17_R1.java +++ b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/entity/Player1_18_R1.java @@ -41,22 +41,22 @@ import net.sourcewriters.minecraft.vcompat.provider.data.WrappedContainer; import net.sourcewriters.minecraft.vcompat.provider.data.type.SkinDataType; import net.sourcewriters.minecraft.vcompat.provider.entity.NmsPlayer; -import net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.data.SyntaxContainer1_17_R1; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.data.SyntaxContainer1_18_R1; import net.sourcewriters.minecraft.vcompat.util.bukkit.Players; import net.sourcewriters.minecraft.vcompat.util.minecraft.MojangProfileServer; import net.sourcewriters.minecraft.vcompat.util.minecraft.Skin; import net.sourcewriters.minecraft.vcompat.util.thread.PostAsync; -public class Player1_17_R1 extends EntityLiving1_17_R1 implements NmsPlayer { +public class Player1_18_R1 extends EntityLiving1_18_R1 implements NmsPlayer { private String realName; private Skin realSkin; private final WrappedContainer dataAdapter; - public Player1_17_R1(Player player) { + public Player1_18_R1(Player player) { super(((CraftPlayer) player).getHandle()); - dataAdapter = new SyntaxContainer1_17_R1(getBukkitPlayer().getPersistentDataContainer()); + dataAdapter = new SyntaxContainer1_18_R1(getBukkitPlayer().getPersistentDataContainer()); update(false); } diff --git a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/tools/BlockTools1_17_R1.java b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/tools/BlockTools1_18_R1.java similarity index 96% rename from vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/tools/BlockTools1_17_R1.java rename to vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/tools/BlockTools1_18_R1.java index f43e9ed..7f81b89 100644 --- a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/tools/BlockTools1_17_R1.java +++ b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/tools/BlockTools1_18_R1.java @@ -11,7 +11,7 @@ import net.sourcewriters.minecraft.vcompat.provider.tools.BlockTools; import net.sourcewriters.minecraft.vcompat.util.constants.MinecraftConstants; -public class BlockTools1_17_R1 extends BlockTools { +public class BlockTools1_18_R1 extends BlockTools { private final ClassLookup craftEntityStateRef = ClassLookup.of(CraftSkull.class).searchField("tileEntity", "tileEntity"); diff --git a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/tools/ServerTools1_17_R1.java b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/tools/ServerTools1_18_R1.java similarity index 74% rename from vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/tools/ServerTools1_17_R1.java rename to vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/tools/ServerTools1_18_R1.java index 845bd27..4a18f4f 100644 --- a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/tools/ServerTools1_17_R1.java +++ b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/tools/ServerTools1_18_R1.java @@ -3,10 +3,10 @@ import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_18_R1.CraftServer; -import net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.wrapper.ConsoleReaderWrapper1_17_R1; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.wrapper.ConsoleReaderWrapper1_18_R1; import net.sourcewriters.minecraft.vcompat.provider.tools.ServerTools; -public class ServerTools1_17_R1 extends ServerTools { +public class ServerTools1_18_R1 extends ServerTools { @Override public void setMotd(String text) { @@ -19,8 +19,8 @@ public String getMotd() { } @Override - public ConsoleReaderWrapper1_17_R1 getConsole() { - return ConsoleReaderWrapper1_17_R1.INSTANCE; + public ConsoleReaderWrapper1_18_R1 getConsole() { + return ConsoleReaderWrapper1_18_R1.INSTANCE; } } \ No newline at end of file diff --git a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/tools/SkinTools1_17_R1.java b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/tools/SkinTools1_18_R1.java similarity index 90% rename from vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/tools/SkinTools1_17_R1.java rename to vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/tools/SkinTools1_18_R1.java index e3734b7..77332cc 100644 --- a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/tools/SkinTools1_17_R1.java +++ b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/tools/SkinTools1_18_R1.java @@ -6,7 +6,7 @@ import net.sourcewriters.minecraft.vcompat.provider.tools.SkinTools; import net.sourcewriters.minecraft.vcompat.util.minecraft.Skin; -public class SkinTools1_17_R1 extends SkinTools { +public class SkinTools1_18_R1 extends SkinTools { @Override public Skin skinFromPlayer(Player player) { diff --git a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/utils/EntityConstructors1_17_R1.java b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/utils/EntityConstructors1_18_R1.java similarity index 53% rename from vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/utils/EntityConstructors1_17_R1.java rename to vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/utils/EntityConstructors1_18_R1.java index 8300962..910cb06 100644 --- a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/utils/EntityConstructors1_17_R1.java +++ b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/utils/EntityConstructors1_18_R1.java @@ -3,10 +3,10 @@ import java.util.function.Function; import net.minecraft.world.level.Level; -import net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.entity.ArmorStand1_17_R1; +import net.sourcewriters.minecraft.vcompat.provider.impl.v1_18_R1.entity.ArmorStand1_18_R1; -public abstract class EntityConstructors1_17_R1 { +public abstract class EntityConstructors1_18_R1 { - public static final Function ARMOR_STAND = (world -> new ArmorStand1_17_R1(world)); + public static final Function ARMOR_STAND = (world -> new ArmorStand1_18_R1(world)); } \ No newline at end of file diff --git a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/wrapper/ConsoleReaderWrapper1_17_R1.java b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/wrapper/ConsoleReaderWrapper1_18_R1.java similarity index 83% rename from vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/wrapper/ConsoleReaderWrapper1_17_R1.java rename to vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/wrapper/ConsoleReaderWrapper1_18_R1.java index e51c7e9..3500896 100644 --- a/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/wrapper/ConsoleReaderWrapper1_17_R1.java +++ b/vcompat-1_18_R1/src/main/java/net/sourcewriters/minecraft/vcompat/provider/impl/v1_18_R1/wrapper/ConsoleReaderWrapper1_18_R1.java @@ -12,14 +12,14 @@ import jline.console.ConsoleReader; -public final class ConsoleReaderWrapper1_17_R1 extends ConsoleReaderWrapper { +public final class ConsoleReaderWrapper1_18_R1 extends ConsoleReaderWrapper { - public static final ConsoleReaderWrapper1_17_R1 INSTANCE = new ConsoleReaderWrapper1_17_R1(); + public static final ConsoleReaderWrapper1_18_R1 INSTANCE = new ConsoleReaderWrapper1_18_R1(); private final ConsoleReader reader; @SuppressWarnings("resource") - private ConsoleReaderWrapper1_17_R1() { + private ConsoleReaderWrapper1_18_R1() { this.reader = ((CraftServer) Bukkit.getServer()).getServer().reader; } From 98c55bf862225c1afcd39f1f1aac4e043db220c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20Endre=C3=9F?= Date: Thu, 20 Jan 2022 10:04:18 +0100 Subject: [PATCH 43/47] Update build-maven.yml --- .github/workflows/build-maven.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-maven.yml b/.github/workflows/build-maven.yml index a6395a2..042259f 100644 --- a/.github/workflows/build-maven.yml +++ b/.github/workflows/build-maven.yml @@ -11,10 +11,10 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Set up JDK 11 + - name: Set up JDK 17 uses: actions/setup-java@v1 with: - java-version: 11 + java-version: 17 server-id: github settings-path: ${{ github.workspace }} From d8fa5da38e0afc1c6ea62a4745b8612c98bb5a6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20Endre=C3=9F?= Date: Thu, 20 Jan 2022 10:11:32 +0100 Subject: [PATCH 44/47] Update specialsource-maven-plugin --- vcompat-1_17_R1/pom.xml | 2 +- vcompat-1_18_R1/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/vcompat-1_17_R1/pom.xml b/vcompat-1_17_R1/pom.xml index 3bf7965..da2991f 100644 --- a/vcompat-1_17_R1/pom.xml +++ b/vcompat-1_17_R1/pom.xml @@ -43,7 +43,7 @@ net.md-5 specialsource-maven-plugin - 1.2.2 + 1.2.4 package diff --git a/vcompat-1_18_R1/pom.xml b/vcompat-1_18_R1/pom.xml index b5ca197..248d19c 100644 --- a/vcompat-1_18_R1/pom.xml +++ b/vcompat-1_18_R1/pom.xml @@ -69,7 +69,7 @@ net.md-5 specialsource-maven-plugin - 1.2.2 + 1.2.4 package From 276ef5ba04256d21b3cb4672166f85fc349a791b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20Endre=C3=9F?= Date: Thu, 20 Jan 2022 10:36:47 +0100 Subject: [PATCH 45/47] Install mappings script --- .github/workflows/build-maven.yml | 5 + scripts/install-mapping.sh | 19 +++ vcompat-1_17_R1/pom.xml | 185 +++++++++-------------- vcompat-1_18_R1/pom.xml | 237 ++++++++++++------------------ 4 files changed, 186 insertions(+), 260 deletions(-) create mode 100644 scripts/install-mapping.sh diff --git a/.github/workflows/build-maven.yml b/.github/workflows/build-maven.yml index 042259f..79d62e4 100644 --- a/.github/workflows/build-maven.yml +++ b/.github/workflows/build-maven.yml @@ -28,6 +28,11 @@ jobs: chmod +x "${{ github.workspace }}/scripts/download-mapping.sh" ${{ github.workspace }}/scripts/download-mapping.sh "${{ github.workspace }}" + - name: Install Mapping dependencies + run: | + chmod +x "${{ github.workspace }}/scripts/install-mapping.sh" + ${{ github.workspace }}/scripts/install-mapping.sh "${{ github.workspace }}" + - name: Building maven project run: mvn -B package -P build-remote diff --git a/scripts/install-mapping.sh b/scripts/install-mapping.sh new file mode 100644 index 0000000..9d2711f --- /dev/null +++ b/scripts/install-mapping.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +mkdir -p $1/libraries/mapping +mkdir -p $1/libraries/spigot +echo "Install Server Mapping files..." +versions=$1/scripts/data/mappings.txt +while read line; do + if [ -z "$line" ]; then + continue + fi + echo "Install Server Mappings (.jar / remapped) $line" + mvn install:install-file -Dfile=$1/libraries/spigot/spigot-$line.jar -DgroupId=org.spigotmc -DartifactId=spigot -Dversion=$line-R0.1-SNAPSHOT -Dclassifier=remapped-mojang + echo "Install Server Mappings (.jar / obfuscated) $line" + mvn install:install-file -Dfile=$1/libraries/spigot/spigot-$line-obf.jar -DgroupId=org.spigotmc -DartifactId=spigot -Dversion=$line-R0.1-SNAPSHOT -Dclassifier=remapped-obf + echo "Install Server Mappings (.txt) $line" + mvn install:install-file -Dfile=$1/libraries/mapping/mapping-$line.txt -DgroupId=org.spigotmc -DartifactId=minecraft-server -Dversion=$line-R0.1-SNAPSHOT -Dclassifier=maps-mojang + echo "Install Server Mappings (.csrg) $line" + mvn install:install-file -Dfile=$1/libraries/mapping/mapping-$line.csrg -DgroupId=org.spigotmc -DartifactId=minecraft-server -Dversion=$line-R0.1-SNAPSHOT -Dclassifier=maps-spigot +done < $versions +echo "Installation complete!" diff --git a/vcompat-1_17_R1/pom.xml b/vcompat-1_17_R1/pom.xml index da2991f..3ff304f 100644 --- a/vcompat-1_17_R1/pom.xml +++ b/vcompat-1_17_R1/pom.xml @@ -1,124 +1,75 @@ - - 4.0.0 - - net.sourcewriters.minecraft - vcompat-parent - 3.0.0 - - vcompat-1_17_R1 + + 4.0.0 + + net.sourcewriters.minecraft + vcompat-parent + 3.0.0 + + vcompat-1_17_R1 - - ${project.basedir}/../libraries/mapping - ${project.basedir}/../libraries/spigot - 1.17.1 - + + ${project.basedir}/../libraries/mapping + ${project.basedir}/../libraries/spigot + 1.17.1 + - - - net.sourcewriters.minecraft - vcompat-api - 3.0.0 - provided - + + + net.sourcewriters.minecraft + vcompat-api + 3.0.0 + provided + - + - - spigot - remapped - 0.1 - system - ${spigot.libPath}/spigot-${minecraft.version}.jar - - + + spigot + remapped + 0.1 + system + ${spigot.libPath}/spigot-${minecraft.version}.jar + + - - - build-remote - - false - - - - - net.md-5 - specialsource-maven-plugin - 1.2.4 - - - package - - remap - - remap-obf - - ${mapping.libPath}/mapping-${minecraft.version}.txt - true - ${spigot.libPath}/spigot-${minecraft.version}.jar - true - remapped-obf - - - - package - - remap - - remap-spigot - - ${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar - ${mapping.libPath}/mapping-${minecraft.version}.csrg - ${spigot.libPath}/spigot-${minecraft.version}-obf.jar - - - - - - - - - build-local - - false - - - - - net.md-5 - specialsource-maven-plugin - 1.2.2 - - - package - - remap - - remap-obf - - org.spigotmc:minecraft-server:${minecraft.version}-R0.1-SNAPSHOT:txt:maps-mojang - true - org.spigotmc:spigot:${minecraft.version}-R0.1-SNAPSHOT:jar:remapped-mojang - true - remapped-obf - - - - package - - remap - - remap-spigot - - ${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar - org.spigotmc:minecraft-server:${minecraft.version}-R0.1-SNAPSHOT:csrg:maps-spigot - org.spigotmc:spigot:${minecraft.version}-R0.1-SNAPSHOT:jar:remapped-obf - - - - - - - - + + + + net.md-5 + specialsource-maven-plugin + 1.2.2 + + + package + + remap + + remap-obf + + org.spigotmc:minecraft-server:${minecraft.version}-R0.1-SNAPSHOT:txt:maps-mojang + true + org.spigotmc:spigot:${minecraft.version}-R0.1-SNAPSHOT:jar:remapped-mojang + true + remapped-obf + + + + package + + remap + + remap-spigot + + ${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar + org.spigotmc:minecraft-server:${minecraft.version}-R0.1-SNAPSHOT:csrg:maps-spigot + org.spigotmc:spigot:${minecraft.version}-R0.1-SNAPSHOT:jar:remapped-obf + + + + + + \ No newline at end of file diff --git a/vcompat-1_18_R1/pom.xml b/vcompat-1_18_R1/pom.xml index 248d19c..6c0e105 100644 --- a/vcompat-1_18_R1/pom.xml +++ b/vcompat-1_18_R1/pom.xml @@ -1,149 +1,100 @@ - - 4.0.0 - - net.sourcewriters.minecraft - vcompat-parent - 3.0.0 - - vcompat-1_18_R1 + + 4.0.0 + + net.sourcewriters.minecraft + vcompat-parent + 3.0.0 + + vcompat-1_18_R1 - - ${project.basedir}/../libraries/mapping - ${project.basedir}/../libraries/spigot - 1.18.1 - + + ${project.basedir}/../libraries/mapping + ${project.basedir}/../libraries/spigot + 1.18.1 + - - - minecraft-libraries - Minecraft Libraries - https://libraries.minecraft.net - - + + + minecraft-libraries + Minecraft Libraries + https://libraries.minecraft.net + + - - - net.sourcewriters.minecraft - vcompat-api - 3.0.0 - provided - + + + net.sourcewriters.minecraft + vcompat-api + 3.0.0 + provided + - + - - spigot - remapped - 0.1 - system - ${spigot.libPath}/spigot-${minecraft.version}.jar - - - it.unimi.dsi - fastutil - 8.5.6 - provided - - - com.mojang - datafixerupper - 1.0.20 - provided - - - jline - jline - 2.12.1 - provided - - - - - - build-remote - - false - - - - - net.md-5 - specialsource-maven-plugin - 1.2.4 - - - package - - remap - - remap-obf - - ${mapping.libPath}/mapping-${minecraft.version}.txt - true - ${spigot.libPath}/spigot-${minecraft.version}.jar - true - remapped-obf - - - - package - - remap - - remap-spigot - - ${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar - ${mapping.libPath}/mapping-${minecraft.version}.csrg - ${spigot.libPath}/spigot-${minecraft.version}-obf.jar - - - - - - - - - build-local - - false - - - - - net.md-5 - specialsource-maven-plugin - 1.2.2 - - - package - - remap - - remap-obf - - org.spigotmc:minecraft-server:${minecraft.version}-R0.1-SNAPSHOT:txt:maps-mojang - true - org.spigotmc:spigot:${minecraft.version}-R0.1-SNAPSHOT:jar:remapped-mojang - true - remapped-obf - - - - package - - remap - - remap-spigot - - ${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar - org.spigotmc:minecraft-server:${minecraft.version}-R0.1-SNAPSHOT:csrg:maps-spigot - org.spigotmc:spigot:${minecraft.version}-R0.1-SNAPSHOT:jar:remapped-obf - - - - - - - - + + spigot + remapped + 0.1 + system + ${spigot.libPath}/spigot-${minecraft.version}.jar + + + it.unimi.dsi + fastutil + 8.5.6 + provided + + + com.mojang + datafixerupper + 1.0.20 + provided + + + jline + jline + 2.12.1 + provided + + + + + + + net.md-5 + specialsource-maven-plugin + 1.2.2 + + + package + + remap + + remap-obf + + org.spigotmc:minecraft-server:${minecraft.version}-R0.1-SNAPSHOT:txt:maps-mojang + true + org.spigotmc:spigot:${minecraft.version}-R0.1-SNAPSHOT:jar:remapped-mojang + true + remapped-obf + + + + package + + remap + + remap-spigot + + ${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar + org.spigotmc:minecraft-server:${minecraft.version}-R0.1-SNAPSHOT:csrg:maps-spigot + org.spigotmc:spigot:${minecraft.version}-R0.1-SNAPSHOT:jar:remapped-obf + + + + + + \ No newline at end of file From ab023255418ef95abc3952f77f8081f9d4f0a0cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20Endre=C3=9F?= Date: Thu, 20 Jan 2022 10:46:41 +0100 Subject: [PATCH 46/47] Update install-mapping.sh --- scripts/install-mapping.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/install-mapping.sh b/scripts/install-mapping.sh index 9d2711f..a1bc9be 100644 --- a/scripts/install-mapping.sh +++ b/scripts/install-mapping.sh @@ -8,12 +8,12 @@ while read line; do continue fi echo "Install Server Mappings (.jar / remapped) $line" - mvn install:install-file -Dfile=$1/libraries/spigot/spigot-$line.jar -DgroupId=org.spigotmc -DartifactId=spigot -Dversion=$line-R0.1-SNAPSHOT -Dclassifier=remapped-mojang + mvn install:install-file -Dfile=$1/libraries/spigot/spigot-$line.jar -Dpackaging=jar -DgroupId=org.spigotmc -DartifactId=spigot -Dversion=$line-R0.1-SNAPSHOT -Dclassifier=remapped-mojang echo "Install Server Mappings (.jar / obfuscated) $line" - mvn install:install-file -Dfile=$1/libraries/spigot/spigot-$line-obf.jar -DgroupId=org.spigotmc -DartifactId=spigot -Dversion=$line-R0.1-SNAPSHOT -Dclassifier=remapped-obf + mvn install:install-file -Dfile=$1/libraries/spigot/spigot-$line-obf.jar -Dpackaging=jar -DgroupId=org.spigotmc -DartifactId=spigot -Dversion=$line-R0.1-SNAPSHOT -Dclassifier=remapped-obf echo "Install Server Mappings (.txt) $line" - mvn install:install-file -Dfile=$1/libraries/mapping/mapping-$line.txt -DgroupId=org.spigotmc -DartifactId=minecraft-server -Dversion=$line-R0.1-SNAPSHOT -Dclassifier=maps-mojang + mvn install:install-file -Dfile=$1/libraries/mapping/mapping-$line.txt -Dpackaging=txt -DgroupId=org.spigotmc -DartifactId=minecraft-server -Dversion=$line-R0.1-SNAPSHOT -Dclassifier=maps-mojang echo "Install Server Mappings (.csrg) $line" - mvn install:install-file -Dfile=$1/libraries/mapping/mapping-$line.csrg -DgroupId=org.spigotmc -DartifactId=minecraft-server -Dversion=$line-R0.1-SNAPSHOT -Dclassifier=maps-spigot + mvn install:install-file -Dfile=$1/libraries/mapping/mapping-$line.csrg -Dpackaging=csrg -DgroupId=org.spigotmc -DartifactId=minecraft-server -Dversion=$line-R0.1-SNAPSHOT -Dclassifier=maps-spigot done < $versions echo "Installation complete!" From a2c1ef51af0b22af2caf1d2c78a321457d2891af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20Endre=C3=9F?= Date: Thu, 20 Jan 2022 11:06:13 +0100 Subject: [PATCH 47/47] Update build-maven.yml --- .github/workflows/build-maven.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-maven.yml b/.github/workflows/build-maven.yml index 79d62e4..7745ca3 100644 --- a/.github/workflows/build-maven.yml +++ b/.github/workflows/build-maven.yml @@ -34,9 +34,9 @@ jobs: ${{ github.workspace }}/scripts/install-mapping.sh "${{ github.workspace }}" - name: Building maven project - run: mvn -B package -P build-remote + run: mvn -B package - name: Publish to GitHub Packages - run: mvn deploy -P build-remote -s ${{ github.workspace }}/settings.xml + run: mvn deploy -s ${{ github.workspace }}/settings.xml env: GITHUB_TOKEN: ${{ github.token }}