Update 5.21

This commit is contained in:
sky 2020-03-13 14:19:38 +08:00
parent 32ee9705ac
commit 6623ae5594
4 changed files with 36 additions and 15 deletions

View File

@ -6,7 +6,7 @@ plugins {
}
group = 'me.skymc'
version = '5.2'
version = '5.21'
sourceCompatibility = 1.8
targetCompatibility = 1.8
@ -19,8 +19,8 @@ tasks.withType(ScalaCompile) {
}
repositories {
maven { url "http://ptms.ink:8081/repository/codemc-nms/" }
maven { url "http://ptms.ink:8081/repository/maven-releases/" }
maven { url "http://repo.ptms.ink/repository/codemc-nms/" }
maven { url "http://repo.ptms.ink/repository/maven-releases/" }
maven { url "http://repo.extendedclip.com/content/repositories/placeholderapi/" }
mavenCentral()
}
@ -34,6 +34,7 @@ dependencies {
compile 'ink.ptms.core:v11500:11500:all'
compile 'ink.ptms.core:v11400:11400:all'
compile 'ink.ptms.core:v11300:11300:all'
compile 'ink.ptms.core:v10900:10900:all'
compile 'ink.ptms.core:v10800:10800:all'
compile 'net.md_5.bungee:BungeeCord:1:all'
compile 'org.apache.commons:commons-lang3:3.8'

View File

@ -110,16 +110,32 @@ class THologramHandler implements Listener {
List item = THologramHandler.getPacketName().read("b", List.class);
for (Object element : item) {
SimpleReflection.checkAndSave(element.getClass());
Object a = SimpleReflection.getFieldValue(element.getClass(), element, "a");
Object c = SimpleReflection.getFieldValue(element.getClass(), element, "c");
try {
Object i = Ref.getUnsafe().allocateInstance(element.getClass());
SimpleReflection.setFieldValue(element.getClass(), i, "a", a);
SimpleReflection.setFieldValue(element.getClass(), i, "b", name);
SimpleReflection.setFieldValue(element.getClass(), i, "c", c);
copy.add(i);
} catch (InstantiationException e) {
e.printStackTrace();
if (Version.isAfter(Version.v1_9)) {
Object a = SimpleReflection.getFieldValue(element.getClass(), element, "a");
Object c = SimpleReflection.getFieldValue(element.getClass(), element, "c");
try {
Object i = Ref.getUnsafe().allocateInstance(element.getClass());
SimpleReflection.setFieldValue(element.getClass(), i, "a", a);
SimpleReflection.setFieldValue(element.getClass(), i, "b", name);
SimpleReflection.setFieldValue(element.getClass(), i, "c", c);
copy.add(i);
} catch (InstantiationException e) {
e.printStackTrace();
}
} else {
Object a = SimpleReflection.getFieldValue(element.getClass(), element, "a");
Object b = SimpleReflection.getFieldValue(element.getClass(), element, "b");
Object d = SimpleReflection.getFieldValue(element.getClass(), element, "d");
try {
Object i = Ref.getUnsafe().allocateInstance(element.getClass());
SimpleReflection.setFieldValue(element.getClass(), i, "a", a);
SimpleReflection.setFieldValue(element.getClass(), i, "b", b);
SimpleReflection.setFieldValue(element.getClass(), i, "c", name);
SimpleReflection.setFieldValue(element.getClass(), i, "d", d);
copy.add(i);
} catch (InstantiationException e) {
e.printStackTrace();
}
}
}
packet.write("b", copy);

View File

@ -472,7 +472,7 @@ public class NMSImpl extends NMS {
} else {
Object createEntity = ((CraftWorld) location.getWorld()).createEntity(location, entity);
try {
e.accept((T) createEntity);
e.accept((T) ((net.minecraft.server.v1_13_R2.Entity) createEntity).getBukkitEntity());
} catch (Throwable t) {
t.printStackTrace();
}

View File

@ -89,6 +89,10 @@ public class TSerializer {
}
public static String write(TSerializable serializable) {
return writeJson(serializable).toString();
}
public static JsonObject writeJson(TSerializable serializable) {
JsonObject jsonObject = new JsonObject();
JsonObject serializeObject = new JsonObject();
for (Field declaredField : serializable.getClass().getDeclaredFields()) {
@ -147,7 +151,7 @@ public class TSerializer {
}
}
jsonObject.add("serializeObject", serializeObject);
return jsonObject.toString();
return jsonObject;
}
public static void readMap(Map map, String serializedString, TSerializerElementGeneral elementKey, TSerializerElementGeneral elementValue) {