mirror of
https://github.com/HibiscusMC/HMCCosmetics.git
synced 2025-12-28 19:39:14 +00:00
Fixed placeholder cosmetic items
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -23,6 +23,8 @@ set-other-off-hand: "%prefix% <gradient:#6D9DC5:#45CDE9>You have set the off han
|
||||
set-other-chest-plate: "%prefix% <gradient:#6D9DC5:#45CDE9>You have set the chest plate of %player% to %type%"
|
||||
set-other-pants: "%prefix% <gradient:#6D9DC5:#45CDE9>You have set the pants of %player% to %type%"
|
||||
set-other-boots: "%prefix% <gradient:#6D9DC5:#45CDE9>You have set the boots of %player% to %type%"
|
||||
hid-cosmetics: "%prefix% <gradient:#6D9DC5:#45CDE9>You have hidden your cosmetics"
|
||||
shown-cosmetics: "%prefix% <gradient:#6D9DC5:#45CDE9>You have shown your cosmetics"
|
||||
opened-wardrobe:
|
||||
type: title
|
||||
message: "<black>"
|
||||
|
||||
Binary file not shown.
@@ -337,7 +337,27 @@ public class CosmeticsCommand extends CommandBase {
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@SubCommand("hide")
|
||||
public void hide(final Player player) {
|
||||
final Optional<User> 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) {
|
||||
|
||||
@@ -115,7 +115,7 @@ public class ItemSerializer implements TypeSerializer<GuiItem> {
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
@@ -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",
|
||||
"""
|
||||
|
||||
@@ -16,6 +16,7 @@ public class User extends BaseUser<UUID> {
|
||||
|
||||
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<UUID> {
|
||||
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<UUID> {
|
||||
public boolean isWardrobeActive() {
|
||||
return this.wardrobe.isActive();
|
||||
}
|
||||
|
||||
public boolean isHidden() {
|
||||
return hidden;
|
||||
}
|
||||
|
||||
public void setHidden(final boolean hidden) {
|
||||
this.hidden = hidden;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@ set-other-off-hand: "%prefix% <gradient:#6D9DC5:#45CDE9>You have set the off han
|
||||
set-other-chest-plate: "%prefix% <gradient:#6D9DC5:#45CDE9>You have set the chest plate of %player% to %type%"
|
||||
set-other-pants: "%prefix% <gradient:#6D9DC5:#45CDE9>You have set the pants of %player% to %type%"
|
||||
set-other-boots: "%prefix% <gradient:#6D9DC5:#45CDE9>You have set the boots of %player% to %type%"
|
||||
hid-cosmetics: "%prefix% <gradient:#6D9DC5:#45CDE9>You have hidden your cosmetics"
|
||||
shown-cosmetics: "%prefix% <gradient:#6D9DC5:#45CDE9>You have shown your cosmetics"
|
||||
opened-wardrobe:
|
||||
type: title
|
||||
message: "<black>"
|
||||
|
||||
Reference in New Issue
Block a user