9
0
mirror of https://github.com/HibiscusMC/HMCCosmetics.git synced 2026-01-04 15:41:45 +00:00

Fixed double wardrobe message

This commit is contained in:
MasterOfTheFish
2022-02-20 23:15:02 -05:00
parent e4cba947d3
commit b7c80437e2
4 changed files with 13 additions and 2 deletions

View File

@@ -23,6 +23,7 @@ import me.mattstudios.mf.annotations.Permission;
import me.mattstudios.mf.annotations.SubCommand;
import me.mattstudios.mf.base.CommandBase;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -298,7 +299,7 @@ public class CosmeticsCommand extends CommandBase {
public void applyNpc(
final CommandSender sender,
@Completion("#npc-args") final String arg,
/*@Completion("#npcs")*/ final Integer npcId,
@Completion("#npcs") final Integer npcId,
@Completion("#types") final String typeStr,
@me.mattstudios.mf.annotations.Optional @Completion("#ids") final String itemId
) {
@@ -311,6 +312,13 @@ public class CosmeticsCommand extends CommandBase {
);
return;
}
if (npcId == null) {
this.messageHandler.sendMessage(
sender,
new Message("illegal-npc-id", ChatColor.RED + "Invalid NPC id specified: " + npcId)
);
return;
}
final ArmorItem armorItem = this.plugin.getCosmeticManager().getArmorItem(itemId);
if (armorItem == null) {
this.messageHandler.sendMessage(

View File

@@ -133,6 +133,7 @@ public class CitizensHook implements Hook, Listener {
private void loadNpc(final NPC npc) {
if (Bukkit.getPlayer(npc.getUniqueId()) != null) return;
if (npc.getEntity() == null) return;
Bukkit.getScheduler().runTaskLater(this.plugin,
() -> Threads.getInstance().execute(() -> this.database.loadNPCUser(

View File

@@ -27,6 +27,8 @@ public class PlayerShiftListener implements Listener {
final Player player = event.getPlayer();
final Optional<User> userOptional = this.userManager.get(player.getUniqueId());
if (!event.isSneaking()) return;
if (userOptional.isEmpty()) return;
final User user = userOptional.get();