mirror of
https://github.com/Xiao-MoMi/Custom-Fishing.git
synced 2026-01-03 14:22:10 +00:00
1.2.18
This commit is contained in:
@@ -19,6 +19,7 @@ package net.momirealms.customfishing.util;
|
||||
|
||||
import de.tr7zw.changeme.nbtapi.NBTCompound;
|
||||
import de.tr7zw.changeme.nbtapi.NBTItem;
|
||||
import de.tr7zw.changeme.nbtapi.NBTListCompound;
|
||||
import org.bukkit.configuration.MemorySection;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
@@ -41,10 +42,12 @@ public class NBTUtil {
|
||||
NBTCompound newCompound = nbtCompound.addCompound(key);
|
||||
setTags(memorySection.getValues(false), newCompound);
|
||||
}
|
||||
else if (map.get(key) instanceof List list){
|
||||
else if (map.get(key) instanceof List<?> list){
|
||||
for (Object o : list) {
|
||||
if (o instanceof String value) {
|
||||
setListValue(key, value, nbtCompound);
|
||||
} else if (o instanceof Map<?,?> map1) {
|
||||
setCompoundList(key, map1, nbtCompound);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -54,6 +57,11 @@ public class NBTUtil {
|
||||
}
|
||||
}
|
||||
|
||||
private static void setCompoundList(String key, Map<?,?> map, NBTCompound nbtCompound) {
|
||||
NBTListCompound nbtListCompound = nbtCompound.getCompoundList(key).addCompound();
|
||||
setTags((Map<String, Object>) map, nbtListCompound);
|
||||
}
|
||||
|
||||
private static void setListValue(String key, String value, NBTCompound nbtCompound) {
|
||||
if (value.startsWith("(String) ")) {
|
||||
nbtCompound.getStringList(key).add(value.substring(9));
|
||||
|
||||
Reference in New Issue
Block a user