修复部分神秘情况下GunData.from NPE的问题

This commit is contained in:
Light_Quanta 2025-04-05 18:28:32 +08:00
parent 825cd772e6
commit 0ba0e22e82
No known key found for this signature in database
GPG key ID: 11A39A1B8C890959

View file

@ -60,10 +60,12 @@ public class GunData {
}
public static GunData from(ItemStack stack) {
if (!dataCache.containsKey(stack)) {
dataCache.put(stack, new GunData(stack));
var value = dataCache.get(stack);
if (value == null) {
value = new GunData(stack);
dataCache.put(stack, value);
}
return dataCache.get(stack);
return value;
}
public GunItem item() {