From 5225410814f2b8c73c9378087642d5d10d599bdd Mon Sep 17 00:00:00 2001 From: Pyrbu Date: Thu, 20 Apr 2023 20:00:46 +0100 Subject: [PATCH] actually fix the commands and remove gray npc names because adventure is complaining --- .../github/znetworkw/znpcservers/commands/CommandInvoker.java | 2 +- src/main/java/io/github/znetworkw/znpcservers/npc/NPC.java | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) 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 814621b4..90fb902f 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 CommandInvoker(Command command, Method commandMethod, String permission) 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 8e52fea2..d9775918 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.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.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 static Collection all() { 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());