diff --git a/pom.xml b/pom.xml index 27632e7..407ff43 100644 --- a/pom.xml +++ b/pom.xml @@ -195,7 +195,7 @@ org.inventivetalent reflectionhelper - 1.18.4-SNAPSHOT + 1.18.7-SNAPSHOT diff --git a/src/main/java/de/epiceric/shopchest/ShopChest.java b/src/main/java/de/epiceric/shopchest/ShopChest.java index ed283ea..22779f4 100644 --- a/src/main/java/de/epiceric/shopchest/ShopChest.java +++ b/src/main/java/de/epiceric/shopchest/ShopChest.java @@ -182,7 +182,7 @@ public class ShopChest extends JavaPlugin { case "v1_16_R2": case "v1_16_R3": case "v1_17_R1": - //case "v1_18_R1": + case "v1_18_R1": break; default: debug("Server version not officially supported: " + Utils.getServerVersion() + "!"); diff --git a/src/main/java/de/epiceric/shopchest/utils/UpdateChecker.java b/src/main/java/de/epiceric/shopchest/utils/UpdateChecker.java index cac473d..bafa53f 100644 --- a/src/main/java/de/epiceric/shopchest/utils/UpdateChecker.java +++ b/src/main/java/de/epiceric/shopchest/utils/UpdateChecker.java @@ -48,7 +48,7 @@ public class UpdateChecker { return UpdateCheckerResult.ERROR; } - if (compareVersion(version) == -1) { + if (compareVersion(version) == 1) { plugin.debug("No update found"); return UpdateCheckerResult.FALSE; } else { diff --git a/src/main/java/de/epiceric/shopchest/utils/Utils.java b/src/main/java/de/epiceric/shopchest/utils/Utils.java index 287a03e..2309f06 100644 --- a/src/main/java/de/epiceric/shopchest/utils/Utils.java +++ b/src/main/java/de/epiceric/shopchest/utils/Utils.java @@ -57,7 +57,6 @@ public class Utils { static Class entityClass = nmsClassResolver.resolveSilent("world.entity.Entity"); static Class entityArmorStandClass = nmsClassResolver.resolveSilent("world.entity.decoration.EntityArmorStand"); static Class entityItemClass = nmsClassResolver.resolveSilent("world.entity.item.EntityItem"); - static Class itemEntityClass = nmsClassResolver.resolveSilent("world.entity.item.ItemEntity"); static Class dataWatcherClass = nmsClassResolver.resolveSilent("network.syncher.DataWatcher"); static Class dataWatcherObjectClass = nmsClassResolver.resolveSilent("network.syncher.DataWatcherObject"); static Class chatSerializerClass = nmsClassResolver.resolveSilent("ChatSerializer", "network.chat.IChatBaseComponent$ChatSerializer"); @@ -418,7 +417,12 @@ public class Utils { a.invoke(dataWatcher, 4, (byte) 1); // silent a.invoke(dataWatcher, 10, nmsItemStack == null ? armorStandFlags : nmsItemStack); // item / armor stand flags } else { - Method register = dataWatcherClass.getMethod("register", dataWatcherObjectClass, Object.class); + Method register; + if (majorVersion < 18) { + register = dataWatcherClass.getMethod("register", dataWatcherObjectClass, Object.class); + } else { + register = dataWatcherClass.getMethod("a",dataWatcherObjectClass, Object.class); + } String[] dataWatcherObjectFieldNames; if ("v1_9_R1".equals(version)) { @@ -456,7 +460,7 @@ public class Utils { Field fSilent = entityClass.getDeclaredField(dataWatcherObjectFieldNames[4]); Field fNoGravity = majorVersion >= 10 ? entityClass.getDeclaredField(dataWatcherObjectFieldNames[5]) : null; //Field fItem = entityItemClass.getDeclaredField(dataWatcherObjectFieldNames[6]); - Field fItem = itemEntityClass.getDeclaredField(dataWatcherObjectFieldNames[6]); + Field fItem = entityItemClass.getDeclaredField(dataWatcherObjectFieldNames[6]); Field fArmorStandFlags = entityArmorStandClass.getDeclaredField(dataWatcherObjectFieldNames[7]); fEntityFlags.setAccessible(true); @@ -636,7 +640,11 @@ public class Utils { Field fConnection = (new FieldResolver(nmsPlayer.getClass())).resolve("playerConnection", "b"); Object playerConnection = fConnection.get(nmsPlayer); - playerConnection.getClass().getMethod("sendPacket", packetClass).invoke(playerConnection, packet); + if (getMajorVersion() < 18) { + playerConnection.getClass().getMethod("sendPacket", packetClass).invoke(playerConnection, packet); + } else { + + } return true; } catch (NoSuchMethodException | NoSuchFieldException | IllegalAccessException | InvocationTargetException e) {