9
0
mirror of https://github.com/HibiscusMC/HMCCosmetics.git synced 2025-12-28 19:39:14 +00:00

Fix for backpack color not being set

This commit is contained in:
HeroBrineGoat
2022-01-18 20:39:41 -05:00
parent 02a3c96137
commit 8455492322
2 changed files with 22 additions and 19 deletions

View File

@@ -44,23 +44,7 @@ public class PlayerArmor {
}
public void setHat(final ArmorItem hat) {
if (dye == -1 || !ColorBuilder.canBeColored(hat.getItemStack())) {
this.hat = hat;
return;
}
final ColorBuilder colorBuilder =
ColorBuilder.from(hat.getItemStack()).
color(Color.fromRGB(this.dye));
this.hat = new ArmorItem(
colorBuilder.build(),
hat.getAction(),
hat.getId(),
hat.getLockedLore(),
hat.getPermission(),
hat.getType(),
hat.isDyeable()
);
this.hat = this.color(hat);
}
public ArmorItem getBackpack() {
@@ -68,7 +52,26 @@ public class PlayerArmor {
}
public void setBackpack(final ArmorItem backpack) {
this.backpack = backpack;
this.backpack = this.color(backpack);
}
private ArmorItem color(final ArmorItem armorItem) {
if (this.dye == -1 || !ColorBuilder.canBeColored(armorItem.getItemStack())) {
return armorItem;
}
final ColorBuilder colorBuilder =
ColorBuilder.from(armorItem.getItemStack()).
color(Color.fromRGB(this.dye));
return new ArmorItem(
colorBuilder.build(),
armorItem.getAction(),
armorItem.getId(),
armorItem.getLockedLore(),
armorItem.getPermission(),
armorItem.getType(),
armorItem.isDyeable()
);
}
public int getDye() {

View File

@@ -141,7 +141,7 @@ public class User {
}
if (hat.getId().equals(this.playerArmor.getHat().getId())) {
this.setHat(ArmorItem.empty(ArmorItem.Type.BACKPACK), plugin);
this.setHat(ArmorItem.empty(ArmorItem.Type.HAT), plugin);
messageHandler.sendMessage(
player,