From 1ef701b022dd8de833d8885c4ebd3dc66805073c Mon Sep 17 00:00:00 2001 From: WildInterloper <156627888+WildInterloper@users.noreply.github.com> Date: Fri, 29 Mar 2024 00:53:32 -0400 Subject: [PATCH] v1.1.8 - Added additional checks to prevent items & armor from being overwritten in players inventories and instead moved when spawning in the prisoner armor and kits etc. Also added assets (buttons) --- assets/button-community.png | Bin 0 -> 5050 bytes assets/button-discord.png | Bin 0 -> 3675 bytes assets/button-source.png | Bin 0 -> 4805 bytes assets/button-wiki.png | Bin 0 -> 3308 bytes pom.xml | 2 +- .../nvus_prison_setup/Kit/KitManager.java | 124 +++++++++++++++--- .../Listeners/PlayerArmor.java | 100 ++++++++++---- .../Listeners/PlayerSpawn.java | 106 +++++++++------ 8 files changed, 244 insertions(+), 88 deletions(-) create mode 100644 assets/button-community.png create mode 100644 assets/button-discord.png create mode 100644 assets/button-source.png create mode 100644 assets/button-wiki.png diff --git a/assets/button-community.png b/assets/button-community.png new file mode 100644 index 0000000000000000000000000000000000000000..6ca03cb446b31d0e42979d960c45cc4270239e3d GIT binary patch literal 5050 zcmV;r6GiNaP){{44rK#2fxhUk z*Vi;P9Rt4+);gV8`r_hKwuc_FsRZHHYN?=bn2ujx^bh;)7rWXxJy&(bXMpWEviuI^+<{VDk#hfD!m^4qD2+8 zqoWlXpho9(Dh8;aFw5wiPR0)%s?h-D>bN+?4OLK>Wz=zT0OcAWRb?S{Wa340ik&eL&7>z~%CMG7Bn3zDX*Q3+PhB={50AwTddc6RQj*bGd z5sIP+fZ*RqkP?^0;7GqRk5#xWklj&#!=Gs+pNK_kBu-~x;E3NPO;Mpu(IQC_9*+lr zp`jrF%sL}+dJ6!0v#i>L*Uf}?Qa+!U2+7+QGrbiQW|NqXgdkzjni$uaxqPGz0K-x< z`V133pD$>H0pl_y=&@PleXC}*0f1q*3(+mRqk+*808zZI-YGdbWEK{Zkd}ttWJ2`$ za19O7-P%gai4(X(jQUoQl$l9RNeKz*>FA9{d|od@Jw04*YNGw)kA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V$rhv5SM2b`jkc87ya Q1^@s607*qoM6N<$f__WK?EnA( literal 0 HcmV?d00001 diff --git a/assets/button-discord.png b/assets/button-discord.png new file mode 100644 index 0000000000000000000000000000000000000000..b1745ba49257a82dd9652214bc3daa0889224eea GIT binary patch literal 3675 zcmV-h4y5skP)M2TF>D1HA_4m#7%&j* zK(Gyt@$2HZ^?F}s=Kk3AvTK`{fNkPrK9Z&J%=7%7-#qi3=Qs1b>(-gD>hG&UYkM@Q@HTU$FPj)w)c!|7aRC@J~S`ot4foyl}>yw#XjC~h~yyLY?1 z&CL(jx3(UGkf3%roeK@c#b>OWHdzIo?%sN-F|SY+h2fn$hrMUdmejYlUX}oKX7et~ z#*J1%RY8{TwT~L}2m!Ec+-UW;x98o^*d)x@N62M7iOh9ygCc8reJ zNI<>b>D0ueaaZV_PCSPX*GoXP7$2{NI*q$RjE@JXmH@jD8>_WY8h3>d8w+5UfHX}^ z8Z$(i1Zd$-W5$pGE!=6$7@D9oW|Uya3k2q@z|Xt7Io{rZFYxt5td~S8v$H6=&pu0@ zY0Lz3+Csf|_H*7mc7n168JG?Fua(#3cJnX)`#w)ETgv+4qFM4#<8GNVL5=(U{P(dY ze!QZFT1WOB**J2kovoiVusYX)F(zha9n_c+=Ikx6XK)BrRVlaI?zp^iyA4%U=^Y#* zD=G1Y=@zeAMc%SyQ}ze^etaGeuC6Y=Jbs*O-Q7{giywTD-23kb;K26n4EOcjk)Pj0 zR&CluqTNow=i`4iZ=SVs=B$NMCdyEhJ1t;Srlyx&iNuuVl$Jq6&UlAAV<)wN5es;d}5*JRL z0wBMv?A!AO9C5R#%-%JhyN=C?GGrM-bFO4X;e(5pXz3e3CkS{$X<~Fb{E9+RY6|P~ z7a>l}(TcQjn=RCqXP>3<-FFcL0i(r&v#N?sue^diCkIiID1GQ5j_uw}lFbG{SxpUP zH8oTH{mrDWu%AmPT2Z7A#d5*wPY?@ zgsQ6eeLg|TfQ8CkN)rnhI)F!HWn>gMpi`y zmgHn~l7!do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ni8)`Fr}6D(-nCE~-&_PVL21k&6N2hRmbKp@*O&=< zC7?_7`_s^V{a52|2#$PoNkF6O^Od75?bf&(f(t1cCE#_P*ZU(yYoRpm0$p%M=<5Q& z_JV?s118g&+nuMRp%I0uBDviM{-LGiAqhZG)q2t6IUUgJlQdCjd@WQJ$>(zks#*_| zzV)K$bRPyJ$*PG;Q0GG7E?E$26rBzgZhN|}#&-l&MF4b) tf~cwo1epG7RFP=k%hR|4xBOn-{{vbm5FqYx5X}Gp002ovPDHLkV1j{|9x4C; literal 0 HcmV?d00001 diff --git a/assets/button-source.png b/assets/button-source.png new file mode 100644 index 0000000000000000000000000000000000000000..68fbb80fdc53abb55af6267d8cc55f637361d499 GIT binary patch literal 4805 zcmV;$5<2aPP)MVM$0xpaV%*Tt*P= z*a-pFHmS<8T5{QOQa<9OV#iMHrZ$y$y(w3KjqSyISRn*wox~91U>id?1jt~6SK^Wo zNCF`cl1BG2dh_P(A2S+{gv1dc`QZJkUe#z`zv=Jm?yvjnuluzG#-KbSqXZ}e<^nN5 z)L7{>G(Lk|0h)nI;FYqPnxmr=2*H1pXJjObR_hj1adC+;CkM&lK(tz?NLCGvslnUR zgQv9>_lXk>R95a*dwa{uYHFH>?+1*cJR_sXn3Jymkyb-vit+aK(f#`C zE_YSc7t3mD4ujt)$}=(&joI1NVQbce38MJPN~xhS#i(8{-J3RbyN@5wDXXbDF9C=a z%NFaZRbhgvf}(uVGHPf{DFR?!wJJ<*XxIYGlgcwPN{spWC4$k2su_gFZHiztV$9Dk zDevtqk$^HoMuuh(8n-=$j0^_$?JJXjxjLIobDK17dvrD%z+4H45lkj+q|mtS5lkk4 z7zv2d3_?RAK$HY%u9JpF5E7udP8u3POqo&09uHnsozQOxfI+XnH3Dg9jDyd8@^~gS zllrzc5@*dqFG=Gkx`x51{(FOigB+@;pg27pQCoS}m?WlTq=-yOVa3XosH*xmUjTw2 zaPHhWy1Kgw*ET9@OcGOK6oMdJx6ymOUOXNTI-PDzgYbI22!enh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hd0elu-n5inM~+(KG$eyNT#Q!j|&%?IB}wy+}v5@=H>=Q z8BrAZ*I)dCnXRqZZy*wL;o?P_E?uI#w>R*vMu^EoWJCn1NlBQ3A}Yf)x3qA+sfn)c zZWONu}q7O9%c#a(L8HFxCf6_7mXv@xK&BG6)sw%Q9 zbN>8!8X6kt>gr}_$c@LNAP69eI!q=b4u^w;gan-a2uZL}JoodTlYQmN4H<=o#?7J} zJvudWis8L5s;Z*X=}1maCMhZDstNb#Jx;^V1h0G!x!rJ`_bD_qCc>0NpU&;w%c~Yk zVD%F|K8#>2#=FG;?X6*8q&7}k#5}=`RTcN5*eSN$C@$~5>5`dtpWx9cZ|MM6O5t?CW+;*rc($J7g zP}MTB!y{)p>f-wsz@G>OZ0lbSXNVW7=nxfpgbcZQH3pvAe4AT z5f#u3MB{UZs`}2q@_Ny!>TUtb%4%u?Cs>Tx;>$BKN`Nw8E)WA~>lhlJ7p?%!Kqc@> fSxwE+(Fy(^p%X9|Mz#8s00000NkvXXu0mjfHjGMR literal 0 HcmV?d00001 diff --git a/assets/button-wiki.png b/assets/button-wiki.png new file mode 100644 index 0000000000000000000000000000000000000000..29ed8cc065a1bb32303032b1fc0766e03fb6ce8b GIT binary patch literal 3308 zcmVC={h00009a7bBm000ie z000ie0hKEb8vpIY{`~nixzCzk!;7Z+FTrW z+jJAO*kBuUgA~#NLAzMA4_g%5hoVn?X&<&P-84vo0#S^v1Gr5c6fGL(wrj_(WW|o7 zwPjP5t^1X_Qlu!7GjsNV5-nR7Cuk^JS^j_lIGl67bLRZ{eRIyogOON;mQbh>XaX95 zAW*zoxjY-nI4}&f035CjKxBG)yTp>-o-iJd!Nm-(KeV)Ckigdi;1adF4uNQ#jnO0?01c3HLM4 zcqAdfFz$CB^L$Dq!2QfKo^)^T3E)d=ODNQ6t*>vCtX4!`$W4c2wPLNWZ)}Oh8dac4 z3x)DRZep}hh{TyQO)Ai!c)j`Xx`|P|UVsJ_2ue0v-ZM8blFbGXRDt5WkY5Oj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oo@;NsvEfS-sU;K=>Y+n9YhVe} zG%?ciJW}IjYtV^utQmRd0VGL62!RlS-nV{B<&D1p5~i#mY*x~mlN*Ecw04f;usPTL z3+!$#U%A5I$Or%dpN}Jp|AH*%OlvFAxj6u;tE#B3tju1!8V=Lb-w(i}4Gnk}pRboX zIv8F|&3*Op$I%wEM`Mu)?TbnE(qNGK+S)a3eBS8o?HMtZ#p!#lF-?=Xw9c-*J9y|{ z{~fp2gDlI)k_1TfoPC#y#4UuZV9F}7c!~=jeoRmI2yVw`6Y~EX#-&ReyVF1d+=@)+ zl_9SF+mG1&ji=aNS5Kh8i_LB)uDXc2w-Ff_;%3Ju^mN`tQ!Kb`b|fJ-te=~e4c|8_ z0RhQmA*mDo{aai=+eW(YCcme.NVus NVus_Prison - 1.1.6 + 1.1.8 jar NVus_PrisonSetup diff --git a/src/main/java/me/nvus/nvus_prison_setup/Kit/KitManager.java b/src/main/java/me/nvus/nvus_prison_setup/Kit/KitManager.java index 745487b..92e654b 100644 --- a/src/main/java/me/nvus/nvus_prison_setup/Kit/KitManager.java +++ b/src/main/java/me/nvus/nvus_prison_setup/Kit/KitManager.java @@ -9,6 +9,7 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -65,44 +66,125 @@ public class KitManager { ItemStack item = new ItemStack(material); ItemMeta meta = item.getItemMeta(); - - // Set the display name if available + // Configure item meta (name, lore, enchantments)... if (itemSpec.containsKey("name")) { - String name = ChatColor.translateAlternateColorCodes('&', (String) itemSpec.get("name")); - meta.setDisplayName(name); + meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', (String) itemSpec.get("name"))); } - - // Set lore if available if (itemSpec.containsKey("lore")) { List lore = new ArrayList<>(); - for (String line : (List) itemSpec.get("lore")) { - lore.add(ChatColor.translateAlternateColorCodes('&', line)); - } + ((List) itemSpec.get("lore")).forEach(line -> lore.add(ChatColor.translateAlternateColorCodes('&', line))); meta.setLore(lore); } - - // Set enchantments if available if (itemSpec.containsKey("enchantments")) { - Map enchantments = (Map) itemSpec.get("enchantments"); - for (Map.Entry enchantmentEntry : enchantments.entrySet()) { - Enchantment enchantment = Enchantment.getByName(enchantmentEntry.getKey()); - if (enchantment != null) { - meta.addEnchant(enchantment, enchantmentEntry.getValue(), true); - } - } + ((Map) itemSpec.get("enchantments")).forEach((enchant, level) -> meta.addEnchant(Enchantment.getByName(enchant.toUpperCase()), level, true)); } - item.setItemMeta(meta); - // Set item in specified quickbar slot, if available if (itemSpec.containsKey("slot")) { - player.getInventory().setItem((Integer) itemSpec.get("slot"), item); + int slot = (Integer) itemSpec.get("slot"); + ItemStack existingItem = player.getInventory().getItem(slot); + + if (existingItem != null && existingItem.getType() != Material.AIR && !isPrisonerKitItem(existingItem)) { + moveItemToAvailableSlot(player, existingItem); + } + + player.getInventory().setItem(slot, item); } else { player.getInventory().addItem(item); } } } + private void moveItemToAvailableSlot(Player player, ItemStack item) { + // Attempt to move the existing item to an available slot + HashMap overflow = player.getInventory().addItem(item); + if (!overflow.isEmpty()) { + // Check Ender Chest + if (player.getEnderChest().firstEmpty() != -1) { + player.getEnderChest().addItem(overflow.get(0)); + player.sendMessage(ChatColor.YELLOW + "Your inventory was full, so an item was moved to your Ender Chest."); + } else { + // Drop the item at the player's location + player.getWorld().dropItemNaturally(player.getLocation(), overflow.get(0)); + player.sendMessage(ChatColor.RED + "Your inventory and Ender Chest were full, so an item was dropped on the ground."); + } + } + } + + + + + + +// public void givePrisonerKit(Player player) { +// if (!configManager.getBoolean("config.yml", "PrisonerKit", false)) { +// return; +// } +// +// FileConfiguration config = configManager.getConfig("config.yml"); +// List> kitItems = config.getMapList("PrisonerKitItems"); +// +// for (Map itemSpec : kitItems) { +// Material material = Material.matchMaterial((String) itemSpec.get("item")); +// if (material == null) continue; +// +// ItemStack item = new ItemStack(material); +// ItemMeta meta = item.getItemMeta(); +// +// // Configure item meta (name, lore, enchantments)... +// // This part remains the same as in your original method +// +// item.setItemMeta(meta); +// +// // Attempt to set the item in the specified slot +// if (itemSpec.containsKey("slot")) { +// int slot = (Integer) itemSpec.get("slot"); +// ItemStack existingItem = player.getInventory().getItem(slot); +// +// // If the slot is occupied, try to find a new place for the existing item +// if (existingItem != null && existingItem.getType() != Material.AIR) { +// HashMap failedItems = player.getInventory().addItem(existingItem); +// +// // If inventory is full, try ender chest or drop to the ground +// if (!failedItems.isEmpty()) { +// failedItems.forEach((integer, itemStack) -> { +// if (player.getEnderChest().firstEmpty() != -1) { +// player.getEnderChest().addItem(itemStack); +// player.sendMessage(ChatColor.YELLOW + "Some items were moved to your Ender Chest due to a full inventory."); +// } else { +// player.getWorld().dropItemNaturally(player.getLocation(), itemStack); +// player.sendMessage(ChatColor.RED + "Your inventory and Ender Chest are full. Some items were dropped on the ground."); +// } +// }); +// } +// +// // Now we can safely place the kit item in the intended slot +// player.getInventory().setItem(slot, item); +// } else { +// // Slot is empty, just place the item there +// player.getInventory().setItem(slot, item); +// } +// } else { +// // No specific slot defined, just add to inventory +// HashMap failedItems = player.getInventory().addItem(item); +// +// // Handle full inventory as above +// if (!failedItems.isEmpty()) { +// failedItems.forEach((integer, itemStack) -> { +// if (player.getEnderChest().firstEmpty() != -1) { +// player.getEnderChest().addItem(itemStack); +// player.sendMessage(ChatColor.YELLOW + "Some items were moved to your Ender Chest due to a full inventory."); +// } else { +// player.getWorld().dropItemNaturally(player.getLocation(), itemStack); +// player.sendMessage(ChatColor.RED + "Your inventory and Ender Chest are full. Some items were dropped on the ground."); +// } +// }); +// } +// } +// } +// } + + } diff --git a/src/main/java/me/nvus/nvus_prison_setup/Listeners/PlayerArmor.java b/src/main/java/me/nvus/nvus_prison_setup/Listeners/PlayerArmor.java index 6f8f082..8183aec 100644 --- a/src/main/java/me/nvus/nvus_prison_setup/Listeners/PlayerArmor.java +++ b/src/main/java/me/nvus/nvus_prison_setup/Listeners/PlayerArmor.java @@ -15,6 +15,8 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; import org.bukkit.inventory.meta.LeatherArmorMeta; +import java.util.HashMap; + public class PlayerArmor implements Listener { private final ConfigManager configManager; @@ -27,47 +29,62 @@ public class PlayerArmor implements Listener { Player player = event.getPlayer(); if (player.hasPermission("nvus.prisoner") && configManager.getConfig("config.yml").getBoolean("PrisonerArmor")) { PlayerInventory inv = player.getInventory(); - inv.setArmorContents(new ItemStack[]{ - createArmor(Material.LEATHER_BOOTS, "Prisoner Boots"), - createArmor(Material.LEATHER_LEGGINGS, "Prisoner Leggings"), - createArmor(Material.LEATHER_CHESTPLATE, "Prisoner Chestplate"), - createArmor(Material.LEATHER_HELMET, "Prisoner Helmet") - }); + ItemStack[] currentArmor = inv.getArmorContents(); + + for (int slot = 0; slot < currentArmor.length; slot++) { + ItemStack armorPiece = currentArmor[slot]; + + // Check if current armor piece is not a prisoner armor, if it's null or AIR (empty slot), or if it's already a prisoner armor piece + if (armorPiece != null && armorPiece.getType() != Material.AIR && !isPrisonerArmorItem(armorPiece)) { + // Move the non-prisoner armor piece safely before replacing + moveArmorToAvailableSlot(player, armorPiece, slot); + } + } + + // After safely moving existing armor, equip new prisoner armor + equipPrisonerArmor(player); player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&cPer The Warden: &6&lYou have been equipped with standard issue prisoner armor!")); } } + @EventHandler(priority = EventPriority.LOWEST) public void onInventoryClick(InventoryClickEvent event) { + if (!(event.getWhoClicked() instanceof Player)) return; + Player player = (Player) event.getWhoClicked(); if (!player.hasPermission("nvus.prisoner")) return; - if (event.getClickedInventory() != null && (event.getClickedInventory().getType() == InventoryType.PLAYER || event.getClickedInventory().getType() == InventoryType.CRAFTING)) { - if (event.getSlotType() == InventoryType.SlotType.ARMOR || isArmorItem(event.getCurrentItem()) || isArmorItem(event.getCursor())) { - - boolean restrictArmor = configManager.getConfig("config.yml").getBoolean("RestrictArmor"); - if (restrictArmor) { - event.setCancelled(true); - player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&c&lPer The Warden: &c You cannot change your armor!")); - } - // If restrictArmor is false, allows the player to change armor freely. + int slot = event.getSlot(); + // Correct the slot checks for the inventory interaction + boolean isArmorInteraction = (slot >= 5 && slot <= 8) // Player inventory armor slots (1.8+) + || (event.getClickedInventory() instanceof PlayerInventory && (slot == 39 || slot == 38 || slot == 37 || slot == 36)); // Correct slots for armor + if (isArmorInteraction && (isPrisonerArmorItem(event.getCurrentItem()) || isPrisonerArmorItem(event.getCursor()))) { + boolean restrictArmor = configManager.getConfig("config.yml").getBoolean("RestrictArmor"); + if (restrictArmor) { + event.setCancelled(true); + player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&c&lPer The Warden: &c You cannot change your armor!")); } + // If restrictArmor is false, allows the player to change armor freely. } } + private boolean isArmorSlot(int slot) { + // Correct the method to align with how armor slots are identified in an InventoryClickEvent + return slot == 39 || slot == 38 || slot == 37 || slot == 36; // The slots for helmet, chestplate, leggings, and boots respectively. + } + + // Checks if the given item is a piece of prisoner armor. - private boolean isArmorItem(ItemStack item) { - if (item == null) { - return false; - } - Material type = item.getType(); - return type == Material.LEATHER_HELMET || type == Material.LEATHER_CHESTPLATE || - type == Material.LEATHER_LEGGINGS || type == Material.LEATHER_BOOTS || - // Add checks for other armor materials if prisoners can have those - type == Material.CHAINMAIL_BOOTS || type == Material.IRON_HELMET; - // We can later add additional armor sets here if we allow customization of what is considered "prisoner armor". + private boolean isPrisonerArmorItem(ItemStack item) { + if (item == null || !item.hasItemMeta()) return false; + + String itemName = item.getItemMeta().getDisplayName(); + // Adjust these checks based on how you identify prisoner armor items. + return itemName != null && (itemName.contains("Prisoner Boots") || itemName.contains("Prisoner Leggings") + || itemName.contains("Prisoner Chestplate") || itemName.contains("Prisoner Helmet")); } private ItemStack createArmor(Material material, String name) { @@ -80,4 +97,37 @@ public class PlayerArmor implements Listener { } return item; } + + private void equipPrisonerArmor(Player player) { + ItemStack[] prisonerArmor = new ItemStack[]{ + createArmor(Material.LEATHER_BOOTS, "Prisoner Boots"), + createArmor(Material.LEATHER_LEGGINGS, "Prisoner Leggings"), + createArmor(Material.LEATHER_CHESTPLATE, "Prisoner Chestplate"), + createArmor(Material.LEATHER_HELMET, "Prisoner Helmet") + }; + player.getInventory().setArmorContents(prisonerArmor); + } + + private void moveArmorToAvailableSlot(Player player, ItemStack armorPiece, int armorSlot) { + // Try to add the non-prisoner armor piece to the main inventory + HashMap overflow = player.getInventory().addItem(armorPiece); + if (!overflow.isEmpty()) { + // Inventory was full, try the Ender Chest next + if (player.getEnderChest().firstEmpty() != -1) { + player.getEnderChest().addItem(overflow.get(0)); + player.sendMessage(ChatColor.YELLOW + "Your inventory was full, so your " + armorPiece.getType() + " was moved to your Ender Chest."); + } else { + // Ender Chest was also full, drop the item at the player's location + player.getWorld().dropItemNaturally(player.getLocation(), overflow.get(0)); + player.sendMessage(ChatColor.RED + "Your inventory and Ender Chest were full, so your " + armorPiece.getType() + " was dropped on the ground."); + } + } + // Clear the original armor slot now that we've moved the item + player.getInventory().setItem(armorSlot + 36, new ItemStack(Material.AIR)); + } + + + + + } diff --git a/src/main/java/me/nvus/nvus_prison_setup/Listeners/PlayerSpawn.java b/src/main/java/me/nvus/nvus_prison_setup/Listeners/PlayerSpawn.java index f8a1e21..9bd8611 100644 --- a/src/main/java/me/nvus/nvus_prison_setup/Listeners/PlayerSpawn.java +++ b/src/main/java/me/nvus/nvus_prison_setup/Listeners/PlayerSpawn.java @@ -12,8 +12,11 @@ import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.LeatherArmorMeta; +import java.util.HashMap; + public class PlayerSpawn implements Listener { private final ConfigManager configManager; @@ -55,51 +58,72 @@ public class PlayerSpawn implements Listener { } private void equipPrisonerArmor(Player player) { - // Create Prisoner Helmet - ItemStack leatherHelmetPrison = new ItemStack(Material.LEATHER_HELMET); - LeatherArmorMeta helmetMeta = (LeatherArmorMeta) leatherHelmetPrison.getItemMeta(); - if (helmetMeta != null) { - helmetMeta.setColor(Color.ORANGE); - helmetMeta.setDisplayName(ChatColor.GOLD + "Prisoner Helmet"); - leatherHelmetPrison.setItemMeta(helmetMeta); - } + handleNonPrisonerArmorItems(player); // Ensure non-prisoner armor is handled before equipping new armor - // Create Prisoner Chestplate - ItemStack leatherChestplatePrison = new ItemStack(Material.LEATHER_CHESTPLATE); - LeatherArmorMeta chestplateMeta = (LeatherArmorMeta) leatherChestplatePrison.getItemMeta(); - if (chestplateMeta != null) { - chestplateMeta.setColor(Color.ORANGE); - chestplateMeta.setDisplayName(ChatColor.GOLD + "Prisoner Chestplate"); - leatherChestplatePrison.setItemMeta(chestplateMeta); - } + // Define and equip standard prisoner armor + ItemStack[] standardPrisonerArmor = new ItemStack[]{ + createArmor(Material.LEATHER_BOOTS, "Prisoner Boots"), + createArmor(Material.LEATHER_LEGGINGS, "Prisoner Leggings"), + createArmor(Material.LEATHER_CHESTPLATE, "Prisoner Chestplate"), + createArmor(Material.LEATHER_HELMET, "Prisoner Helmet") + }; - // Create Prisoner Leggings - ItemStack leatherLeggingsPrison = new ItemStack(Material.LEATHER_LEGGINGS); - LeatherArmorMeta leggingsMeta = (LeatherArmorMeta) leatherLeggingsPrison.getItemMeta(); - if (leggingsMeta != null) { - leggingsMeta.setColor(Color.ORANGE); - leggingsMeta.setDisplayName(ChatColor.GOLD + "Prisoner Leggings"); - leatherLeggingsPrison.setItemMeta(leggingsMeta); - } - - // Create Prisoner Boots - ItemStack leatherBootsPrison = new ItemStack(Material.LEATHER_BOOTS); - LeatherArmorMeta bootsMeta = (LeatherArmorMeta) leatherBootsPrison.getItemMeta(); - if (bootsMeta != null) { - bootsMeta.setColor(Color.ORANGE); - bootsMeta.setDisplayName(ChatColor.GOLD + "Prisoner Boots"); - leatherBootsPrison.setItemMeta(bootsMeta); - } - - // Equip Prisoner Armor - player.getInventory().setHelmet(leatherHelmetPrison); - player.getInventory().setChestplate(leatherChestplatePrison); - player.getInventory().setLeggings(leatherLeggingsPrison); - player.getInventory().setBoots(leatherBootsPrison); - - player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&c&lPer The Warden: &6You've been given the default prisoner armor!")); + player.getInventory().setArmorContents(standardPrisonerArmor); + player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&cPer The Warden: &6&lYou have been equipped with standard issue prisoner armor!")); } + private ItemStack createArmor(Material material, String name) { + ItemStack item = new ItemStack(material); + LeatherArmorMeta meta = (LeatherArmorMeta) item.getItemMeta(); + if (meta != null) { + meta.setDisplayName(name); + meta.setColor(Color.ORANGE); // Set the color for leather armor + item.setItemMeta(meta); + } + return item; + } + + private void handleNonPrisonerArmorItems(Player player) { + ItemStack[] armorContents = player.getInventory().getArmorContents(); + + for (int i = 0; i < armorContents.length; i++) { + ItemStack armorPiece = armorContents[i]; + // Check if the armor piece is not part of the prisoner kit + if (armorPiece != null && armorPiece.getType() != Material.AIR && !isPrisonerArmorItem(armorPiece)) { + moveArmorToAvailableSlot(player, armorPiece); + armorContents[i] = new ItemStack(Material.AIR); // Remove the non-prisoner armor from the armor slot + } + } + + // Update the player's armor contents after removals + player.getInventory().setArmorContents(armorContents); + } + + private boolean isPrisonerArmorItem(ItemStack item) { + if (item == null || !item.hasItemMeta()) return false; + ItemMeta meta = item.getItemMeta(); + String itemName = meta.getDisplayName(); + // Adjust the check based on your naming convention for prisoner armor + return itemName != null && itemName.contains("Prisoner"); + } + + private void moveArmorToAvailableSlot(Player player, ItemStack armorPiece) { + // Attempt to move the existing armor piece to an available slot + HashMap overflow = player.getInventory().addItem(armorPiece); + if (!overflow.isEmpty()) { + // Check Ender Chest + if (player.getEnderChest().firstEmpty() != -1) { + player.getEnderChest().addItem(overflow.get(0)); + player.sendMessage(ChatColor.YELLOW + "Your inventory was full, so your armor was moved to your Ender Chest."); + } else { + // Drop the item at the player's location + player.getWorld().dropItemNaturally(player.getLocation(), overflow.get(0)); + player.sendMessage(ChatColor.RED + "Your inventory and Ender Chest were full, so your armor was dropped on the ground."); + } + } + } + + // Destroy armor upon death etc. private void destroyDefaultPrisonerArmor(Player player) {