From ae4103b8cbde51d214e458a5250553e01aaeabd0 Mon Sep 17 00:00:00 2001 From: Pyrbu Date: Wed, 14 Jun 2023 14:23:37 +0200 Subject: [PATCH] downgrade spigot api version to 1.8.8 to improve backwards compatibility --- plugin/build.gradle | 2 +- .../java/lol/pyr/znpcsplus/commands/PropertiesCommand.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugin/build.gradle b/plugin/build.gradle index f560576..1589c5d 100644 --- a/plugin/build.gradle +++ b/plugin/build.gradle @@ -13,7 +13,7 @@ processResources { } dependencies { - compileOnly "org.spigotmc:spigot-api:1.19.4-R0.1-SNAPSHOT" + compileOnly "org.spigotmc:spigot-api:1.8.8-R0.1-SNAPSHOT" compileOnly "me.clip:placeholderapi:2.11.1" compileOnly "com.mojang:authlib:1.5.21" diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/commands/PropertiesCommand.java b/plugin/src/main/java/lol/pyr/znpcsplus/commands/PropertiesCommand.java index ba03152..2378063 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/commands/PropertiesCommand.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/commands/PropertiesCommand.java @@ -1,5 +1,6 @@ package lol.pyr.znpcsplus.commands; +import com.github.retrooper.packetevents.protocol.item.ItemStack; import io.github.retrooper.packetevents.util.SpigotConversionUtil; import lol.pyr.director.adventure.command.CommandContext; import lol.pyr.director.adventure.command.CommandHandler; @@ -11,7 +12,6 @@ import lol.pyr.znpcsplus.npc.NpcImpl; import lol.pyr.znpcsplus.npc.NpcRegistryImpl; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.format.NamedTextColor; -import com.github.retrooper.packetevents.protocol.item.ItemStack; import java.util.Collections; import java.util.List; @@ -35,8 +35,8 @@ public class PropertiesCommand implements CommandHandler { Object value; String valueName; if (type == ItemStack.class) { - org.bukkit.inventory.ItemStack bukkitStack = context.ensureSenderIsPlayer().getInventory().getItemInMainHand(); - if (bukkitStack.getType().isAir()) { + org.bukkit.inventory.ItemStack bukkitStack = context.ensureSenderIsPlayer().getInventory().getItemInHand(); + if (bukkitStack.getAmount() == 0) { value = null; valueName = "EMPTY"; } else {