mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-05 12:36:40 +00:00
Fix more NBT mutability issues
This commit is contained in:
@ -112,7 +112,7 @@ public class BlockBagChangeSet extends AbstractDelegateChangeSet {
|
||||
@Override
|
||||
public void addTileCreate(CompoundTag nbt) {
|
||||
if (nbt.containsKey("items")) {
|
||||
Map<String, Tag> map = nbt.getValue();
|
||||
Map<String, Tag> map = new HashMap<>(nbt.getValue());
|
||||
map.remove("items");
|
||||
}
|
||||
super.addTileCreate(nbt);
|
||||
|
@ -13,6 +13,7 @@ import com.sk89q.worldedit.world.NbtValued;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import javax.annotation.Nullable;
|
||||
@ -55,10 +56,11 @@ public class StripNBTExtent extends AbstractDelegateExtent {
|
||||
return block;
|
||||
}
|
||||
CompoundTag nbt = localBlock.getNbtData();
|
||||
Map<String, Tag> value = nbt.getValue();
|
||||
Map<String, Tag> value = new HashMap<>(nbt.getValue());
|
||||
for (String key : strip) {
|
||||
value.remove(key);
|
||||
}
|
||||
localBlock.setNbtData(new CompoundTag(value));
|
||||
return (B) localBlock;
|
||||
}
|
||||
|
||||
@ -67,10 +69,11 @@ public class StripNBTExtent extends AbstractDelegateExtent {
|
||||
return entity;
|
||||
}
|
||||
CompoundTag nbt = entity.getNbtData();
|
||||
Map<String, Tag> value = nbt.getValue();
|
||||
Map<String, Tag> value = new HashMap<>(nbt.getValue());
|
||||
for (String key : strip) {
|
||||
value.remove(key);
|
||||
}
|
||||
entity.setNbtData(new CompoundTag(value));
|
||||
return entity;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user