Fix UseItem.InventorySlot.SlotEnforce
This commit is contained in:
parent
c395d2fa67
commit
02cf238cd2
@ -14,11 +14,16 @@ import org.bukkit.scheduler.BukkitRunnable;
|
|||||||
public class ItemChange {
|
public class ItemChange {
|
||||||
public static void itemChange(Player player) {
|
public static void itemChange(Player player) {
|
||||||
Integer slot;
|
Integer slot;
|
||||||
|
if (SelectConfig.UseItem_InventorySlotEnforce){
|
||||||
|
slot = SelectConfig.UseItem_InventorySlot;
|
||||||
|
} else {
|
||||||
if (Select_Database.selectSlot(player) == null) {
|
if (Select_Database.selectSlot(player) == null) {
|
||||||
slot = SelectConfig.UseItem_InventorySlot;
|
slot = SelectConfig.UseItem_InventorySlot;
|
||||||
} else {
|
} else {
|
||||||
slot = Select_Database.selectSlot(player);
|
slot = Select_Database.selectSlot(player);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!SelectConfig.UseItem_Enable) {
|
if (!SelectConfig.UseItem_Enable) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -55,7 +60,9 @@ public class ItemChange {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!SelectConfig.UseItem_AllowToggle || Select_Database.selectItemStatus(player)) {
|
if (!SelectConfig.UseItem_AllowToggle || Select_Database.selectItemStatus(player)) {
|
||||||
|
send.debugmsg(Main.plugin, "1");
|
||||||
if (SelectConfig.UseItem_InventorySlotEnforce || player.getInventory().getItem(slot - 1) == null) {
|
if (SelectConfig.UseItem_InventorySlotEnforce || player.getInventory().getItem(slot - 1) == null) {
|
||||||
|
send.debugmsg(Main.plugin, "2");
|
||||||
Give_UseItem.onGive(player);
|
Give_UseItem.onGive(player);
|
||||||
if (SelectConfig.Cursor_ToGUIItem_OnLogin) {
|
if (SelectConfig.Cursor_ToGUIItem_OnLogin) {
|
||||||
if (SelectConfig.Cursor_ToGUIItem_OnlyOnFirstLogin) {
|
if (SelectConfig.Cursor_ToGUIItem_OnlyOnFirstLogin) {
|
||||||
|
@ -128,11 +128,15 @@ public class Commands {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Integer slot = null;
|
Integer slot = null;
|
||||||
|
if (SelectConfig.UseItem_InventorySlotEnforce){
|
||||||
|
slot = SelectConfig.UseItem_InventorySlot;
|
||||||
|
} else {
|
||||||
if (Select_Database.selectSlot(player) == null) {
|
if (Select_Database.selectSlot(player) == null) {
|
||||||
slot = SelectConfig.UseItem_InventorySlot;
|
slot = SelectConfig.UseItem_InventorySlot;
|
||||||
} else {
|
} else {
|
||||||
slot = Select_Database.selectSlot(player);
|
slot = Select_Database.selectSlot(player);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
send.debug(plugin,String.valueOf(slot));
|
send.debug(plugin,String.valueOf(slot));
|
||||||
if (player.getInventory().getItem(slot - 1) == null) {
|
if (player.getInventory().getItem(slot - 1) == null) {
|
||||||
Select_Database.setItemStatusTrue(player);
|
Select_Database.setItemStatusTrue(player);
|
||||||
|
@ -26,11 +26,15 @@ public class Give_UseItem {
|
|||||||
|
|
||||||
public static void onGive(Player player) {
|
public static void onGive(Player player) {
|
||||||
Integer slot;
|
Integer slot;
|
||||||
|
if (SelectConfig.UseItem_InventorySlotEnforce){
|
||||||
|
slot = SelectConfig.UseItem_InventorySlot;
|
||||||
|
} else {
|
||||||
if (Select_Database.selectSlot(player) == null) {
|
if (Select_Database.selectSlot(player) == null) {
|
||||||
slot = SelectConfig.UseItem_InventorySlot;
|
slot = SelectConfig.UseItem_InventorySlot;
|
||||||
} else {
|
} else {
|
||||||
slot = Select_Database.selectSlot(player);
|
slot = Select_Database.selectSlot(player);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (SelectConfig.UseItem_InventorySlot_FreeSlot) {
|
if (SelectConfig.UseItem_InventorySlot_FreeSlot) {
|
||||||
player.getInventory().addItem(itemStack(player));
|
player.getInventory().addItem(itemStack(player));
|
||||||
} else player.getInventory().setItem(slot - 1, itemStack(player));
|
} else player.getInventory().setItem(slot - 1, itemStack(player));
|
||||||
|
Loading…
Reference in New Issue
Block a user