Skip to content

Commit bc6767c

Browse files
committed
(fix) runtime error thrown on showing air
1 parent d66ba41 commit bc6767c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/main/java/cat/nyaa/ukit/show/ShowFunction.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import cat.nyaa.ukit.utils.SubCommandExecutor;
77
import cat.nyaa.ukit.utils.SubTabCompleter;
88
import land.melon.lab.simplelanguageloader.utils.ItemUtils;
9+
import land.melon.lab.simplelanguageloader.utils.LocaleUtils;
910
import land.melon.lab.simplelanguageloader.utils.Pair;
1011
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
1112
import org.bukkit.command.Command;
@@ -40,7 +41,9 @@ public boolean invokeCommand(CommandSender commandSender, Command command, Strin
4041
Pair.of("player",
4142
EssentialsPluginUtils.nickWithHoverOrNormalName(senderPlayer.getUniqueId())
4243
),
43-
Pair.of("item", ItemUtils.itemTextWithHover(itemInHand)),
44+
Pair.of("item", itemInHand.getType().isAir() || itemInHand.getAmount() == 0 ?
45+
LocaleUtils.getTranslatableItemComponent(itemInHand) : // to fix runtime error thrown by packet clientbound/minecraft:system_chat validity check
46+
ItemUtils.itemTextWithHover(itemInHand)), // amount must be within range [1;99], Item must not be minecraft:air
4447
Pair.of("amount", itemInHand.getAmount())
4548
);
4649

0 commit comments

Comments
 (0)