9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-25 09:59:20 +00:00

修复wrapped物品缓存

This commit is contained in:
XiaoMoMi
2025-04-21 21:57:09 +08:00
parent 2bfbd00f67
commit 25ea0aa52c
2 changed files with 4 additions and 2 deletions

View File

@@ -128,8 +128,7 @@ public class BukkitCustomItem implements CustomItem<ItemStack> {
for (ItemDataModifier<ItemStack> modifier : dataModifiers()) {
modifier.apply(wrapped, context);
}
wrapped.load();
return wrapped;
return BukkitCraftEngine.instance().itemManager().wrap(wrapped.load());
}
@Override

View File

@@ -1,8 +1,10 @@
package net.momirealms.craftengine.bukkit.plugin.command.feature;
import net.momirealms.craftengine.bukkit.item.BukkitItemManager;
import net.momirealms.craftengine.bukkit.plugin.command.BukkitCommandFeature;
import net.momirealms.craftengine.core.plugin.CraftEngine;
import net.momirealms.craftengine.core.plugin.command.CraftEngineCommandManager;
import net.momirealms.craftengine.core.util.Key;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.incendo.cloud.Command;
@@ -19,6 +21,7 @@ public class TestCommand extends BukkitCommandFeature<CommandSender> {
.senderType(Player.class)
.handler(context -> {
Player player = context.sender();
player.getInventory().addItem(BukkitItemManager.instance().createWrappedItem(Key.from("default:topaz"), null).getItem());
});
}