紧急修复 NBT 版本兼容漏洞导致物品描述丢失
This commit is contained in:
parent
92d43026fa
commit
3eeab6a620
@ -229,7 +229,14 @@ public class NMSHandlerImpl extends NMSHandler {
|
|||||||
case 9:
|
case 9:
|
||||||
Object nmsList = new NBTTagList();
|
Object nmsList = new NBTTagList();
|
||||||
for (me.skymc.taboolib.common.nms.nbt.NBTBase value : base.asList()) {
|
for (me.skymc.taboolib.common.nms.nbt.NBTBase value : base.asList()) {
|
||||||
((List) SimpleReflection.getFieldValue(NBTTagList.class, nmsList, "list")).add(toNBTBase(value));
|
// 1.14+
|
||||||
|
if (TabooLib.getVersionNumber() >= 11400) {
|
||||||
|
((net.minecraft.server.v1_14_R1.NBTTagList) nmsList).add(((net.minecraft.server.v1_14_R1.NBTTagList) nmsList).size(), (net.minecraft.server.v1_14_R1.NBTBase) toNBTBase(value));
|
||||||
|
}
|
||||||
|
// 1.13-
|
||||||
|
else {
|
||||||
|
((NBTTagList) nmsList).add((NBTBase) toNBTBase(value));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return nmsList;
|
return nmsList;
|
||||||
case 10:
|
case 10:
|
||||||
|
@ -160,7 +160,9 @@ public class ItemUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static List<String> asString(List<String> args, Player placeholderPlayer) {
|
public static List<String> asString(List<String> args, Player placeholderPlayer) {
|
||||||
IntStream.range(0, args.size()).forEach(i -> args.set(i, asString(args.get(i), placeholderPlayer)));
|
for (int i = 0; i < args.size(); i++) {
|
||||||
|
args.set(i, asString(args.get(i), placeholderPlayer));
|
||||||
|
}
|
||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -392,7 +394,7 @@ public class ItemUtils {
|
|||||||
a.put("Amount", new NBTBase(NumberConversions.toDouble(num.substring(0, num.length() - 1)) / 100D));
|
a.put("Amount", new NBTBase(NumberConversions.toDouble(num.substring(0, num.length() - 1)) / 100D));
|
||||||
a.put("Operation", new NBTBase(1));
|
a.put("Operation", new NBTBase(1));
|
||||||
} else {
|
} else {
|
||||||
a.put("Amount", new NBTBase(NumberConversions.toDouble(num) / 100D));
|
a.put("Amount", new NBTBase(NumberConversions.toDouble(num)));
|
||||||
a.put("Operation", new NBTBase(0));
|
a.put("Operation", new NBTBase(0));
|
||||||
}
|
}
|
||||||
a.put("AttributeName", new NBTBase(asAttribute(name)));
|
a.put("AttributeName", new NBTBase(asAttribute(name)));
|
||||||
|
Loading…
Reference in New Issue
Block a user