Update ItemChange.java

This commit is contained in:
JaTiTV 2022-12-31 18:33:27 +01:00
parent 9059790a65
commit 754f486d1b

View File

@ -9,12 +9,14 @@ import org.bukkit.scheduler.BukkitRunnable;
public class ItemChange {
public static void itemChange(Player player, Boolean setCursor) {
T2Csend.debug(Main.getPlugin(), "Join: " + player.getName());
Integer slot;
if ((Boolean) Config.useItemInventorySlotEnforce.value) {
slot =(Integer) Config.useItemInventorySlot.value;
} else {
slot = Events.useItemSlotHashMap.get(player.getName());
}
T2Csend.debug(Main.getPlugin(), "Slot " + slot + " for player: " + player.getName());
if (!(Boolean)Config.useItemEnable.value) {
return;
@ -22,6 +24,7 @@ public class ItemChange {
UseItem.removeItem(player);
if (UseItem.protection(player, false)) return;
if ((Boolean)Config.useItemGiveOnlyOnFirstJoin.value) {
T2Csend.debug(Main.getPlugin(), "OnlyOnFirstJoin: " + player.getName());
if (!(Boolean)Config.useItemAllowToggle.value || Events.useItemHashMap.get(player.getName())) {
if (!player.hasPlayedBefore()) {
new BukkitRunnable() {
@ -68,8 +71,8 @@ public class ItemChange {
if (empty) {
UseItem.addUseItem(player);
}
}
}
}else T2Csend.debug(Main.getPlugin(), "give skip [1]: " + player.getName());
} else T2Csend.debug(Main.getPlugin(), "give skip [2]: " + player.getName());
}
}.runTaskLater(Main.getPlugin(), 1L * 1);
}