1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-26 04:25:15 +01:00

Fix for clickedInventory method not exists in 1.8 or oldest servers

This commit is contained in:
montlikadani 2020-08-22 20:46:34 +02:00
parent 94f4a46cd3
commit 176eb70dd3

View File

@ -626,12 +626,13 @@ public class JobsListener implements Listener {
ItemStack newArmorPiece = event.getCursor();
ItemStack oldArmorPiece = event.getCurrentItem();
if (numberkey) {
if (event.getClickedInventory().getType() == InventoryType.PLAYER) {
ItemStack hotbarItem = event.getClickedInventory().getItem(event.getHotbarButton());
org.bukkit.inventory.Inventory clicked = Version.isCurrentHigher(Version.v1_8_R1) ? event.getInventory() : event.getClickedInventory();
if (clicked != null && clicked.getType() == InventoryType.PLAYER) {
ItemStack hotbarItem = clicked.getItem(event.getHotbarButton());
if (hotbarItem != null) {
newArmorType = ArmorTypes.matchType(hotbarItem);
newArmorPiece = hotbarItem;
oldArmorPiece = event.getClickedInventory().getItem(event.getSlot());
oldArmorPiece = clicked.getItem(event.getSlot());
} else
newArmorType = ArmorTypes.matchType(oldArmorPiece != null && oldArmorPiece.getType() != Material.AIR ? oldArmorPiece : event.getCursor());
}