fix equipment property

This commit is contained in:
D3v1s0m 2023-08-09 12:55:55 +05:30
parent 73d2ddbc0b
commit 40323c57e5
No known key found for this signature in database
GPG Key ID: FA1F770C7B1D40C1

@ -3,6 +3,7 @@ package lol.pyr.znpcsplus.commands.property;
import com.github.retrooper.packetevents.protocol.world.states.WrappedBlockState; import com.github.retrooper.packetevents.protocol.world.states.WrappedBlockState;
import com.github.retrooper.packetevents.protocol.world.states.type.StateType; import com.github.retrooper.packetevents.protocol.world.states.type.StateType;
import com.github.retrooper.packetevents.protocol.world.states.type.StateTypes; import com.github.retrooper.packetevents.protocol.world.states.type.StateTypes;
import io.github.retrooper.packetevents.util.SpigotConversionUtil;
import lol.pyr.director.adventure.command.CommandContext; import lol.pyr.director.adventure.command.CommandContext;
import lol.pyr.director.adventure.command.CommandHandler; import lol.pyr.director.adventure.command.CommandHandler;
import lol.pyr.director.common.command.CommandExecutionException; import lol.pyr.director.common.command.CommandExecutionException;
@ -16,7 +17,7 @@ import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor; import net.kyori.adventure.text.format.NamedTextColor;
import org.bukkit.Color; import org.bukkit.Color;
import org.bukkit.DyeColor; import org.bukkit.DyeColor;
import org.bukkit.inventory.ItemStack; import com.github.retrooper.packetevents.protocol.item.ItemStack;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@ -42,12 +43,12 @@ public class PropertySetCommand implements CommandHandler {
Object value; Object value;
String valueName; String valueName;
if (type == ItemStack.class) { if (type == ItemStack.class) {
ItemStack bukkitStack = context.ensureSenderIsPlayer().getInventory().getItemInHand(); org.bukkit.inventory.ItemStack bukkitStack = context.ensureSenderIsPlayer().getInventory().getItemInHand();
if (bukkitStack.getAmount() == 0) { if (bukkitStack.getAmount() == 0) {
value = null; value = null;
valueName = "EMPTY"; valueName = "EMPTY";
} else { } else {
value = bukkitStack; value = SpigotConversionUtil.fromBukkitItemStack(bukkitStack);
valueName = bukkitStack.toString(); valueName = bukkitStack.toString();
} }
} }