diff --git a/src/main/java/io/github/znetworkw/znpcservers/commands/CommandInvoker.java b/src/main/java/io/github/znetworkw/znpcservers/commands/CommandInvoker.java index 814621b..90fb902 100644 --- a/src/main/java/io/github/znetworkw/znpcservers/commands/CommandInvoker.java +++ b/src/main/java/io/github/znetworkw/znpcservers/commands/CommandInvoker.java @@ -20,7 +20,7 @@ public class CommandInvoker { public void execute(CommandSender sender, Object command) throws CommandException { // Check if the sender is not a player - if (!(sender instanceof Player player)) + if (!(sender.getCommandSender() instanceof Player player)) throw new CommandException("Only players may execute this command."); // Check if the permission is not empty and the player does not have the permission diff --git a/src/main/java/io/github/znetworkw/znpcservers/npc/NPC.java b/src/main/java/io/github/znetworkw/znpcservers/npc/NPC.java index 8e52fea..d977591 100644 --- a/src/main/java/io/github/znetworkw/znpcservers/npc/NPC.java +++ b/src/main/java/io/github/znetworkw/znpcservers/npc/NPC.java @@ -13,7 +13,6 @@ import io.github.znetworkw.znpcservers.user.ZUser; import io.github.znetworkw.znpcservers.utility.Utils; import io.github.znetworkw.znpcservers.utility.location.ZLocation; import lol.pyr.znpcsplus.ZNPCsPlus; -import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.entity.Player; @@ -21,7 +20,6 @@ import java.util.*; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; -@SuppressWarnings("deprecation") public class NPC { private static final ConcurrentMap NPC_MAP = new ConcurrentHashMap<>(); private final Set viewers = new HashSet<>(); @@ -72,7 +70,7 @@ public class NPC { public void onLoad() { if (NPC_MAP.containsKey(getNpcPojo().getId())) throw new IllegalStateException("npc with id " + getNpcPojo().getId() + " already exists."); - this.gameProfile = new GameProfile(UUID.randomUUID(), ChatColor.GRAY + "[ZNPC] " + this.npcName); + this.gameProfile = new GameProfile(UUID.randomUUID(), "[ZNPC] " + this.npcName); this.gameProfile.getProperties().put("textures", new Property("textures", this.npcPojo.getSkin(), this.npcPojo.getSignature())); changeType(this.npcPojo.getNpcType()); updateProfile(this.gameProfile.getProperties());