Fix UseItem.InventorySlot.SlotEnforce

pull/1/head
JaTiTV 5 months ago
parent
commit
02cf238cd2
  1. 11
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/ItemChange.java
  2. 8
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/Commands.java
  3. 8
      CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/system/Give_UseItem.java

11
CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/Listener/ItemChange.java

@ -14,11 +14,16 @@ import org.bukkit.scheduler.BukkitRunnable; @@ -14,11 +14,16 @@ import org.bukkit.scheduler.BukkitRunnable;
public class ItemChange {
public static void itemChange(Player player) {
Integer slot;
if (Select_Database.selectSlot(player) == null) {
if (SelectConfig.UseItem_InventorySlotEnforce){
slot = SelectConfig.UseItem_InventorySlot;
} else {
slot = Select_Database.selectSlot(player);
if (Select_Database.selectSlot(player) == null) {
slot = SelectConfig.UseItem_InventorySlot;
} else {
slot = Select_Database.selectSlot(player);
}
}
if (!SelectConfig.UseItem_Enable) {
return;
}
@ -55,7 +60,9 @@ public class ItemChange { @@ -55,7 +60,9 @@ public class ItemChange {
}
}
if (!SelectConfig.UseItem_AllowToggle || Select_Database.selectItemStatus(player)) {
send.debugmsg(Main.plugin, "1");
if (SelectConfig.UseItem_InventorySlotEnforce || player.getInventory().getItem(slot - 1) == null) {
send.debugmsg(Main.plugin, "2");
Give_UseItem.onGive(player);
if (SelectConfig.Cursor_ToGUIItem_OnLogin) {
if (SelectConfig.Cursor_ToGUIItem_OnlyOnFirstLogin) {

8
CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/cmdManagement/Commands.java

@ -128,10 +128,14 @@ public class Commands { @@ -128,10 +128,14 @@ public class Commands {
}
}
Integer slot = null;
if (Select_Database.selectSlot(player) == null) {
if (SelectConfig.UseItem_InventorySlotEnforce){
slot = SelectConfig.UseItem_InventorySlot;
} else {
slot = Select_Database.selectSlot(player);
if (Select_Database.selectSlot(player) == null) {
slot = SelectConfig.UseItem_InventorySlot;
} else {
slot = Select_Database.selectSlot(player);
}
}
send.debug(plugin,String.valueOf(slot));
if (player.getInventory().getItem(slot - 1) == null) {

8
CommandGUI V2/src/main/java/de/jatitv/commandguiv2/Spigot/system/Give_UseItem.java

@ -26,10 +26,14 @@ public class Give_UseItem { @@ -26,10 +26,14 @@ public class Give_UseItem {
public static void onGive(Player player) {
Integer slot;
if (Select_Database.selectSlot(player) == null) {
if (SelectConfig.UseItem_InventorySlotEnforce){
slot = SelectConfig.UseItem_InventorySlot;
} else {
slot = Select_Database.selectSlot(player);
if (Select_Database.selectSlot(player) == null) {
slot = SelectConfig.UseItem_InventorySlot;
} else {
slot = Select_Database.selectSlot(player);
}
}
if (SelectConfig.UseItem_InventorySlot_FreeSlot) {
player.getInventory().addItem(itemStack(player));

Loading…
Cancel
Save