Skip to content

Commit

Permalink
actually fix the commands and remove gray npc names because adventure…
Browse files Browse the repository at this point in the history
… is complaining
  • Loading branch information
Pyrbu committed Apr 20, 2023
1 parent 1d25739 commit 5225410
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/io/github/znetworkw/znpcservers/npc/NPC.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,13 @@
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;

import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

@SuppressWarnings("deprecation")
public class NPC {
private static final ConcurrentMap<Integer, NPC> NPC_MAP = new ConcurrentHashMap<>();
private final Set<ZUser> viewers = new HashSet<>();
Expand Down Expand Up @@ -72,7 +70,7 @@ public static Collection<NPC> 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());
Expand Down

0 comments on commit 5225410

Please sign in to comment.