diff --git a/.gitignore b/.gitignore index 012559b9..339d17e9 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ /common/build/ /1.16/build/ /1.17/build/ -/1.18/build/ \ No newline at end of file +/1.18/build/ +/nms/build/ \ No newline at end of file diff --git a/1.16/build/libs/1.16.jar b/1.16/build/libs/1.16.jar index 456d1bdd..2cd4a89d 100644 Binary files a/1.16/build/libs/1.16.jar and b/1.16/build/libs/1.16.jar differ diff --git a/1.17/build/libs/1.17.jar b/1.17/build/libs/1.17.jar index c5a33b8a..234465f9 100644 Binary files a/1.17/build/libs/1.17.jar and b/1.17/build/libs/1.17.jar differ diff --git a/1.18/build/libs/1.18.jar b/1.18/build/libs/1.18.jar index 332fcbfe..226448a8 100644 Binary files a/1.18/build/libs/1.18.jar and b/1.18/build/libs/1.18.jar differ diff --git a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/HMCCosmetics.class b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/HMCCosmetics.class index 34f7875e..b19e0e44 100644 Binary files a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/HMCCosmetics.class and b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/HMCCosmetics.class differ diff --git a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/api/HMCCosmeticsAPI.class b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/api/HMCCosmeticsAPI.class index 0c4739ef..b2fd391c 100644 Binary files a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/api/HMCCosmeticsAPI.class and b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/api/HMCCosmeticsAPI.class differ diff --git a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/api/event/CosmeticChangeEvent.class b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/api/event/CosmeticChangeEvent.class index a018fa96..948f29c1 100644 Binary files a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/api/event/CosmeticChangeEvent.class and b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/api/event/CosmeticChangeEvent.class differ diff --git a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/command/CosmeticsCommand.class b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/command/CosmeticsCommand.class index a8d671ca..16f6389d 100644 Binary files a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/command/CosmeticsCommand.class and b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/command/CosmeticsCommand.class differ diff --git a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/config/ItemSerializer.class b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/config/ItemSerializer.class index 640b58d0..3554a0d6 100644 Binary files a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/config/ItemSerializer.class and b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/config/ItemSerializer.class differ diff --git a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/config/WardrobeSettings.class b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/config/WardrobeSettings.class index 9334643b..6a6e076c 100644 Binary files a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/config/WardrobeSettings.class and b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/config/WardrobeSettings.class differ diff --git a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/database/Database.class b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/database/Database.class index fcc01a9e..16d454bf 100644 Binary files a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/database/Database.class and b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/database/Database.class differ diff --git a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/database/dao/UserDAO.class b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/database/dao/UserDAO.class index 8332eb72..37fcb864 100644 Binary files a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/database/dao/UserDAO.class and b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/database/dao/UserDAO.class differ diff --git a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/gui/ArmorItem$1.class b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/gui/ArmorItem$1.class index 892e5006..e3a7b37c 100644 Binary files a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/gui/ArmorItem$1.class and b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/gui/ArmorItem$1.class differ diff --git a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/gui/ArmorItem$Type.class b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/gui/ArmorItem$Type.class index f9cd2ac7..29e49c88 100644 Binary files a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/gui/ArmorItem$Type.class and b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/gui/ArmorItem$Type.class differ diff --git a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/gui/ArmorItem.class b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/gui/ArmorItem.class index 3c4fdbf3..c0c4cf98 100644 Binary files a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/gui/ArmorItem.class and b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/gui/ArmorItem.class differ diff --git a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/gui/CosmeticGui.class b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/gui/CosmeticGui.class index e2b48ec2..5015f707 100644 Binary files a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/gui/CosmeticGui.class and b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/gui/CosmeticGui.class differ diff --git a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/gui/DyeSelectorGui.class b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/gui/DyeSelectorGui.class index ece3b922..d92a051b 100644 Binary files a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/gui/DyeSelectorGui.class and b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/gui/DyeSelectorGui.class differ diff --git a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/hook/HookManager.class b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/hook/HookManager.class index ee9a4fc5..77ba2649 100644 Binary files a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/hook/HookManager.class and b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/hook/HookManager.class differ diff --git a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/listener/ClickListener.class b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/listener/ClickListener.class index 31301214..cad356de 100644 Binary files a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/listener/ClickListener.class and b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/listener/ClickListener.class differ diff --git a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/listener/JoinListener.class b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/listener/JoinListener.class index 4fb30479..1520afb8 100644 Binary files a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/listener/JoinListener.class and b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/listener/JoinListener.class differ diff --git a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/listener/RespawnListener.class b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/listener/RespawnListener.class index 5a7d0575..073903b7 100644 Binary files a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/listener/RespawnListener.class and b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/listener/RespawnListener.class differ diff --git a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/listener/TeleportListener.class b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/listener/TeleportListener.class index 2a51fb52..05ba0c0a 100644 Binary files a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/listener/TeleportListener.class and b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/listener/TeleportListener.class differ diff --git a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/message/Messages$1.class b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/message/Messages$1.class index 10488128..375db034 100644 Binary files a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/message/Messages$1.class and b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/message/Messages$1.class differ diff --git a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/message/Messages.class b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/message/Messages.class index a9779757..e98d4bbe 100644 Binary files a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/message/Messages.class and b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/message/Messages.class differ diff --git a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/message/Placeholder.class b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/message/Placeholder.class index 208a69e7..ebd70062 100644 Binary files a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/message/Placeholder.class and b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/message/Placeholder.class differ diff --git a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/user/User.class b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/user/User.class index c89b34c2..01b92a7f 100644 Binary files a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/user/User.class and b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/user/User.class differ diff --git a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/user/UserManager$1.class b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/user/UserManager$1.class index b5a9cf87..f51a5042 100644 Binary files a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/user/UserManager$1.class and b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/user/UserManager$1.class differ diff --git a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/user/UserManager.class b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/user/UserManager.class index bddfed68..658bffc7 100644 Binary files a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/user/UserManager.class and b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/user/UserManager.class differ diff --git a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/user/Wardrobe.class b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/user/Wardrobe.class index 1c952ed5..66034a57 100644 Binary files a/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/user/Wardrobe.class and b/common/build/classes/java/main/io/github/fisher2911/hmccosmetics/user/Wardrobe.class differ diff --git a/common/build/libs/HMCCosmetics.jar b/common/build/libs/HMCCosmetics.jar index 565392d1..f2c4f1aa 100644 Binary files a/common/build/libs/HMCCosmetics.jar and b/common/build/libs/HMCCosmetics.jar differ diff --git a/common/build/resources/main/messages.yml b/common/build/resources/main/messages.yml index 2461a04e..b6ca47d2 100644 --- a/common/build/resources/main/messages.yml +++ b/common/build/resources/main/messages.yml @@ -23,6 +23,8 @@ set-other-off-hand: "%prefix% You have set the off han set-other-chest-plate: "%prefix% You have set the chest plate of %player% to %type%" set-other-pants: "%prefix% You have set the pants of %player% to %type%" set-other-boots: "%prefix% You have set the boots of %player% to %type%" +hid-cosmetics: "%prefix% You have hidden your cosmetics" +shown-cosmetics: "%prefix% You have shown your cosmetics" opened-wardrobe: type: title message: "" diff --git a/common/build/tmp/compileJava/previous-compilation-data.bin b/common/build/tmp/compileJava/previous-compilation-data.bin index 259d1b58..11dad134 100644 Binary files a/common/build/tmp/compileJava/previous-compilation-data.bin and b/common/build/tmp/compileJava/previous-compilation-data.bin differ diff --git a/common/src/main/java/io/github/fisher2911/hmccosmetics/command/CosmeticsCommand.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/command/CosmeticsCommand.java index fe8b01f4..5cac9d1a 100644 --- a/common/src/main/java/io/github/fisher2911/hmccosmetics/command/CosmeticsCommand.java +++ b/common/src/main/java/io/github/fisher2911/hmccosmetics/command/CosmeticsCommand.java @@ -337,7 +337,27 @@ public class CosmeticsCommand extends CommandBase { ); } } - }; + } + } + + @SubCommand("hide") + public void hide(final Player player) { + final Optional optionalUser = this.userManager.get(player.getUniqueId()); + if (optionalUser.isEmpty()) return; + final User user = optionalUser.get(); + if (user.isHidden()) { + user.setHidden(false); + this.messageHandler.sendMessage( + player, + Messages.SHOWN_COSMETICS + ); + return; + } + user.setHidden(true); + this.messageHandler.sendMessage( + player, + Messages.HID_COSMETICS + ); } private void setNpcCosmetic(final CitizensHook hook, final CommandSender sender, final int npcId, final ArmorItem item) { diff --git a/common/src/main/java/io/github/fisher2911/hmccosmetics/config/ItemSerializer.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/config/ItemSerializer.java index ac6a581f..12bbe0a5 100644 --- a/common/src/main/java/io/github/fisher2911/hmccosmetics/config/ItemSerializer.java +++ b/common/src/main/java/io/github/fisher2911/hmccosmetics/config/ItemSerializer.java @@ -115,7 +115,7 @@ public class ItemSerializer implements TypeSerializer { } } - final String name = StringUtils.parseStringToString(nameNode.getString()); + final String name = StringUtils.parseStringToString(Utils.replaceIfNull("", nameNode.getString())); final boolean unbreakable = unbreakableNode.getBoolean(); final boolean glowing = glowingNode.getBoolean(); diff --git a/common/src/main/java/io/github/fisher2911/hmccosmetics/gui/DyeSelectorGui.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/gui/DyeSelectorGui.java index 332335ad..e1d662fe 100644 --- a/common/src/main/java/io/github/fisher2911/hmccosmetics/gui/DyeSelectorGui.java +++ b/common/src/main/java/io/github/fisher2911/hmccosmetics/gui/DyeSelectorGui.java @@ -56,20 +56,6 @@ public class DyeSelectorGui extends CosmeticGui { this.selectedCosmetic = selected == null ? this.selectedCosmetic : selected; } - for (final var entry : this.cosmeticsSlots.entrySet()) { - gui.setItem( - entry.getKey(), - new GuiItem( - this.applyPlaceholders( - user, - player, - user.getPlayerArmor().getItem(entry.getValue()), - true - ) - ) - ); - } - for (final var entry : this.guiItemMap.entrySet()) { final GuiItem guiItem = entry.getValue(); @@ -87,6 +73,21 @@ public class DyeSelectorGui extends CosmeticGui { gui.setItem(entry.getKey(), guiItem); } + for (final var entry : this.cosmeticsSlots.entrySet()) { + + final ArmorItem guiItem = user.getPlayerArmor().getItem(entry.getValue()).copy(); + + final ItemStack itemStack = guiItem.getItemStack(); + + if (itemStack == null || guiItem.isEmpty()) continue; + + guiItem.setItemStack( + ItemBuilder.from(itemStack.clone()).papiPlaceholders(player).build() + ); + + gui.setItem(entry.getKey(), guiItem); + } + final PlayerArmor playerArmor = user.getPlayerArmor(); this.select(this.selectedCosmetic, user, player); @@ -129,8 +130,11 @@ public class DyeSelectorGui extends CosmeticGui { armorItem.setDye(colorItem.getColor().asRGB()); - if (user.isWardrobeActive()) - this.plugin.getUserManager().setItem(user, armorItem); + if (user.isWardrobeActive()) { + this.plugin.getUserManager().setItem(user.getWardrobe(), armorItem); + } else { + this.plugin.getUserManager().setItem(user, armorItem); + } this.updateSelected(user, player); }); @@ -182,11 +186,14 @@ public class DyeSelectorGui extends CosmeticGui { return; } + final ArmorItem armorItem = user.getPlayerArmor().getItem(type); + if (armorItem.isEmpty()) return; + this.gui.updateItem( this.selectedCosmetic, ItemBuilder.from( this.applyPlaceholders( - user, player, user.getPlayerArmor().getItem(type), true + user, player, armorItem, true ) ).build()); } diff --git a/common/src/main/java/io/github/fisher2911/hmccosmetics/message/Messages.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/message/Messages.java index b742fff2..30603499 100644 --- a/common/src/main/java/io/github/fisher2911/hmccosmetics/message/Messages.java +++ b/common/src/main/java/io/github/fisher2911/hmccosmetics/message/Messages.java @@ -54,6 +54,10 @@ public class Messages { public static final Message SET_NPC_COSMETIC = new Message("set-npc-cosmetic", ChatColor.GREEN + "Set " + Placeholder.TYPE + " of " + Placeholder.ID + " to " + Placeholder.ITEM); + public static final Message HID_COSMETICS = + new Message("hid-cosmetics", ChatColor.GREEN + "You have hidden your cosmetics"); + public static final Message SHOWN_COSMETICS = + new Message("showed-cosmetics", ChatColor.GREEN + "You have shown your cosmetics"); public static final Message HELP_COMMAND = new Message("help-command", """ diff --git a/common/src/main/java/io/github/fisher2911/hmccosmetics/user/User.java b/common/src/main/java/io/github/fisher2911/hmccosmetics/user/User.java index 8d9e45b1..7fd7892a 100644 --- a/common/src/main/java/io/github/fisher2911/hmccosmetics/user/User.java +++ b/common/src/main/java/io/github/fisher2911/hmccosmetics/user/User.java @@ -16,6 +16,7 @@ public class User extends BaseUser { protected Wardrobe wardrobe; private CosmeticGui openGui; + private boolean hidden; public User(final UUID uuid, final int entityId, final PlayerArmor playerArmor, final Wardrobe wardrobe, final int armorStandId) { super(uuid, entityId, playerArmor, armorStandId); @@ -37,6 +38,7 @@ public class User extends BaseUser { public boolean shouldShow(final Player other) { final Player player = this.getPlayer(); if (player == null) return false; + if (player.getUniqueId().equals(other.getUniqueId()) && this.hidden) return false; return player.getGameMode() != GameMode.SPECTATOR && (!player.hasPotionEffect(PotionEffectType.INVISIBILITY) && other.canSee(player) && @@ -77,4 +79,12 @@ public class User extends BaseUser { public boolean isWardrobeActive() { return this.wardrobe.isActive(); } + + public boolean isHidden() { + return hidden; + } + + public void setHidden(final boolean hidden) { + this.hidden = hidden; + } } diff --git a/common/src/main/resources/messages.yml b/common/src/main/resources/messages.yml index 2461a04e..b6ca47d2 100644 --- a/common/src/main/resources/messages.yml +++ b/common/src/main/resources/messages.yml @@ -23,6 +23,8 @@ set-other-off-hand: "%prefix% You have set the off han set-other-chest-plate: "%prefix% You have set the chest plate of %player% to %type%" set-other-pants: "%prefix% You have set the pants of %player% to %type%" set-other-boots: "%prefix% You have set the boots of %player% to %type%" +hid-cosmetics: "%prefix% You have hidden your cosmetics" +shown-cosmetics: "%prefix% You have shown your cosmetics" opened-wardrobe: type: title message: "" diff --git a/nms/build/libs/nms.jar b/nms/build/libs/nms.jar index 71c8894e..a10169de 100644 Binary files a/nms/build/libs/nms.jar and b/nms/build/libs/nms.jar differ