9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-28 19:39:11 +00:00

改进调用库的方法

This commit is contained in:
jhqwqmc
2025-12-18 22:12:50 +08:00
parent 664eeeca0a
commit 61433478cf
3 changed files with 7 additions and 7 deletions

View File

@@ -62,12 +62,12 @@ public class ExternalModifier<I> implements ItemDataModifier<I> {
try {
ItemManager<I> itemManager = CraftEngine.instance().itemManager();
Player player = context.player();
Optional<I> another = this.provider.build(this.id, player == null ? null : player.platformPlayer(), adapt(context));
if (another.isEmpty()) {
I another = this.provider.buildOrNull(this.id, player == null ? null : player.platformPlayer(), adapt(context));
if (another == null) {
CraftEngine.instance().logger().warn("'" + this.id + "' could not be found in " + provider.plugin());
return item;
}
Item<I> anotherWrapped = itemManager.wrap(another.get());
Item<I> anotherWrapped = itemManager.wrap(another);
item.merge(anotherWrapped);
return item;
} catch (Throwable e) {