mirror of
https://github.com/HibiscusMC/HMCCosmetics.git
synced 2025-12-31 12:56:39 +00:00
Merge remote-tracking branch 'origin/remapped' into remapped
This commit is contained in:
@@ -15,6 +15,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.inventory.meta.LeatherArmorMeta;
|
||||
import org.bukkit.inventory.meta.MapMeta;
|
||||
import org.bukkit.inventory.meta.PotionMeta;
|
||||
|
||||
public class DyeMenu {
|
||||
@@ -36,9 +37,12 @@ public class DyeMenu {
|
||||
if (item == null) return;
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
if (meta == null) return;
|
||||
Color color = meta instanceof LeatherArmorMeta ? ((LeatherArmorMeta) meta).getColor() :
|
||||
meta instanceof PotionMeta ? ((PotionMeta) meta).getColor() : null;
|
||||
|
||||
Color color = meta instanceof LeatherArmorMeta leatherMeta ? leatherMeta.getColor() :
|
||||
meta instanceof PotionMeta potionMeta ? potionMeta.getColor() :
|
||||
meta instanceof MapMeta mapMeta ? mapMeta.getColor() : null;
|
||||
if (color == null) return;
|
||||
|
||||
//user.removeCosmeticSlot(cosmetic);
|
||||
user.addPlayerCosmetic(cosmetic, color);
|
||||
player.setItemOnCursor(new ItemStack(Material.AIR));
|
||||
|
||||
@@ -23,8 +23,7 @@ import org.bukkit.entity.ArmorStand;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.inventory.meta.LeatherArmorMeta;
|
||||
import org.bukkit.inventory.meta.*;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
import java.util.*;
|
||||
@@ -210,9 +209,14 @@ public class CosmeticUser {
|
||||
}
|
||||
if (item.hasItemMeta()) {
|
||||
ItemMeta itemMeta = item.getItemMeta();
|
||||
if (itemMeta instanceof LeatherArmorMeta) {
|
||||
if (colors.containsKey(cosmetic.getSlot())) {
|
||||
((LeatherArmorMeta) itemMeta).setColor(colors.get(cosmetic.getSlot()));
|
||||
if (colors.containsKey(cosmetic.getSlot())) {
|
||||
Color color = colors.get(cosmetic.getSlot());
|
||||
if (itemMeta instanceof LeatherArmorMeta leatherMeta) {
|
||||
leatherMeta.setColor(color);
|
||||
} else if (itemMeta instanceof PotionMeta potionMeta) {
|
||||
potionMeta.setColor(color);
|
||||
} else if (itemMeta instanceof MapMeta mapMeta) {
|
||||
mapMeta.setColor(color);
|
||||
}
|
||||
}
|
||||
item.setItemMeta(itemMeta);
|
||||
|
||||
Reference in New Issue
Block a user