actually fix the commands and remove gray npc names because adventure is complaining

This commit is contained in:
Pyrbu 2023-04-20 20:00:46 +01:00
parent 1d2573947a
commit 5225410814
2 changed files with 2 additions and 4 deletions

View file

@ -20,7 +20,7 @@ public class CommandInvoker {
public void execute(CommandSender sender, Object command) throws CommandException { public void execute(CommandSender sender, Object command) throws CommandException {
// Check if the sender is not a player // 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."); throw new CommandException("Only players may execute this command.");
// Check if the permission is not empty and the player does not have the permission // Check if the permission is not empty and the player does not have the permission

View file

@ -13,7 +13,6 @@ import io.github.znetworkw.znpcservers.user.ZUser;
import io.github.znetworkw.znpcservers.utility.Utils; import io.github.znetworkw.znpcservers.utility.Utils;
import io.github.znetworkw.znpcservers.utility.location.ZLocation; import io.github.znetworkw.znpcservers.utility.location.ZLocation;
import lol.pyr.znpcsplus.ZNPCsPlus; import lol.pyr.znpcsplus.ZNPCsPlus;
import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -21,7 +20,6 @@ import java.util.*;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ConcurrentMap;
@SuppressWarnings("deprecation")
public class NPC { public class NPC {
private static final ConcurrentMap<Integer, NPC> NPC_MAP = new ConcurrentHashMap<>(); private static final ConcurrentMap<Integer, NPC> NPC_MAP = new ConcurrentHashMap<>();
private final Set<ZUser> viewers = new HashSet<>(); private final Set<ZUser> viewers = new HashSet<>();
@ -72,7 +70,7 @@ public class NPC {
public void onLoad() { public void onLoad() {
if (NPC_MAP.containsKey(getNpcPojo().getId())) throw new IllegalStateException("npc with id " + getNpcPojo().getId() + " already exists."); 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())); this.gameProfile.getProperties().put("textures", new Property("textures", this.npcPojo.getSkin(), this.npcPojo.getSignature()));
changeType(this.npcPojo.getNpcType()); changeType(this.npcPojo.getNpcType());
updateProfile(this.gameProfile.getProperties()); updateProfile(this.gameProfile.getProperties());