mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-08 09:27:58 +01:00
Fix potential race condition
This commit is contained in:
parent
2b74d7697c
commit
508659fd30
@ -262,7 +262,7 @@ public abstract class ItemMetaBuilder {
|
|||||||
public static @NotNull ItemMetaBuilder fromNBT(@NotNull ItemMetaBuilder src, @NotNull NBTCompound nbtCompound) {
|
public static @NotNull ItemMetaBuilder fromNBT(@NotNull ItemMetaBuilder src, @NotNull NBTCompound nbtCompound) {
|
||||||
ItemMetaBuilder dest = src.getSupplier().get();
|
ItemMetaBuilder dest = src.getSupplier().get();
|
||||||
dest.nbt = nbtCompound.deepClone();
|
dest.nbt = nbtCompound.deepClone();
|
||||||
NBTUtils.loadDataIntoMeta(dest, nbtCompound);
|
NBTUtils.loadDataIntoMeta(dest, dest.nbt);
|
||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ public final class ItemStack implements HoverEventSource<HoverEvent.ShowItem> {
|
|||||||
.amount(amount)
|
.amount(amount)
|
||||||
.meta(metaBuilder -> {
|
.meta(metaBuilder -> {
|
||||||
metaBuilder.nbt = nbtCompound.deepClone();
|
metaBuilder.nbt = nbtCompound.deepClone();
|
||||||
NBTUtils.loadDataIntoMeta(metaBuilder, nbtCompound);
|
NBTUtils.loadDataIntoMeta(metaBuilder, metaBuilder.nbt);
|
||||||
return metaBuilder;
|
return metaBuilder;
|
||||||
}).build();
|
}).build();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user