From d9afe239739f9de591f9756e8e373b7b7e333413 Mon Sep 17 00:00:00 2001 From: LT_Name <572413378@qq.com> Date: Wed, 10 Jan 2024 19:06:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9C=A8mot=E6=A0=B8?= =?UTF-8?q?=E5=BF=83=E4=B8=8A=E4=BD=BF=E7=94=A8=E6=97=A0=E6=B3=95=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E5=AD=97=E7=AC=A6=E4=B8=B2id=E7=89=A9=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/smallaswater/npc/utils/Utils.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/com/smallaswater/npc/utils/Utils.java b/src/main/java/com/smallaswater/npc/utils/Utils.java index 679f8fe..b8609b3 100644 --- a/src/main/java/com/smallaswater/npc/utils/Utils.java +++ b/src/main/java/com/smallaswater/npc/utils/Utils.java @@ -1,8 +1,10 @@ package com.smallaswater.npc.utils; +import cn.lanink.gamecore.utils.NukkitTypeUtils; import cn.nukkit.Player; import cn.nukkit.Server; import cn.nukkit.item.Item; +import cn.nukkit.item.StringItem; import cn.nukkit.level.Location; import cn.nukkit.plugin.Plugin; import com.smallaswater.npc.RsNPC; @@ -28,6 +30,11 @@ private Utils() { * @return 保存用字符串ID */ public static String item2String(Item item) { + if (NukkitTypeUtils.getNukkitType() == NukkitTypeUtils.NukkitType.MOT) { + if (item instanceof StringItem) { + return item.getNamespaceId(); + } + } return item.getId() + ":" + item.getDamage(); }