Small bugfix

This commit is contained in:
JaTiTV 2022-05-03 19:23:17 +02:00
parent 777c6876fc
commit 36de2ff0ca
5 changed files with 22 additions and 20 deletions

View File

@ -6,7 +6,7 @@
<groupId>net.t2code</groupId> <groupId>net.t2code</groupId>
<artifactId>CommandGUI_V2</artifactId> <artifactId>CommandGUI_V2</artifactId>
<version>2.7.0</version> <version>2.7.1</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>CommandGUI</name> <name>CommandGUI</name>

View File

@ -43,19 +43,20 @@ public class ItemChange {
} }
} }
} }
send.debug(Main.plugin,"GiveOnlyOnFirstJoin: " +player.getName()); send.debug(Main.plugin, "GiveOnlyOnFirstJoin: " + player.getName());
return; return;
} }
if (!SelectConfig.UseItem_GiveOnEveryJoin) { if (!SelectConfig.UseItem_GiveOnEveryJoin) {
send.debug(Main.plugin,"!GiveOnEveryJoin: " +player.getName()); send.debug(Main.plugin, "!GiveOnEveryJoin: " + player.getName());
return; return;
} }
new BukkitRunnable() { new BukkitRunnable() {
@Override @Override
public void run() { public void run() {
if (player == null) return;
if (!SelectConfig.UseItem_AllowToggle || Events.useItemHashMap.get(player)) { if (!SelectConfig.UseItem_AllowToggle || Events.useItemHashMap.get(player)) {
if (SelectConfig.UseItem_InventorySlotEnforce || player.getInventory().getItem(slot - 1) == null) { if (SelectConfig.UseItem_InventorySlotEnforce || player.getInventory().getItem(slot - 1) == null) {
send.debug(Main.plugin,"Give: " +player.getName()); send.debug(Main.plugin, "Give: " + player.getName());
UseItem.giveUseItem(player); UseItem.giveUseItem(player);
if (setCursor) { if (setCursor) {
setCursor(player, slot); setCursor(player, slot);
@ -79,37 +80,37 @@ public class ItemChange {
} }
private static void setCursor(Player player, int slot) { private static void setCursor(Player player, int slot) {
send.debug(Main.plugin,"setCursor 1 Player: "+player.getName()); send.debug(Main.plugin, "setCursor 1 Player: " + player.getName());
if (!SelectConfig.Cursor_ToGUIItem_OnLogin) { if (!SelectConfig.Cursor_ToGUIItem_OnLogin) {
return; return;
} }
send.debug(Main.plugin,"setCursor 2 Player: "+player.getName()); send.debug(Main.plugin, "setCursor 2 Player: " + player.getName());
if (SelectConfig.Cursor_ToGUIItem_OnlyOnFirstLogin) { if (SelectConfig.Cursor_ToGUIItem_OnlyOnFirstLogin) {
if (!player.hasPlayedBefore()) { if (!player.hasPlayedBefore()) {
player.getInventory().setHeldItemSlot(slot - 1); player.getInventory().setHeldItemSlot(slot - 1);
send.debug(Main.plugin,"setCursor 3 Player: "+player.getName()); send.debug(Main.plugin, "setCursor 3 Player: " + player.getName());
} }
return; return;
} }
send.debug(Main.plugin,"setCursor 4 Player: "+player.getName()); send.debug(Main.plugin, "setCursor 4 Player: " + player.getName());
if (!SelectConfig.Bungee) { if (!SelectConfig.Bungee) {
player.getInventory().setHeldItemSlot(slot - 1); player.getInventory().setHeldItemSlot(slot - 1);
send.debug(Main.plugin,"setCursor 5 Player: "+player.getName()); send.debug(Main.plugin, "setCursor 5 Player: " + player.getName());
return; return;
} }
send.debug(Main.plugin,"setCursor 6 Player: "+player.getName()); send.debug(Main.plugin, "setCursor 6 Player: " + player.getName());
if (SelectConfig.UseItem_ServerChange) { if (SelectConfig.UseItem_ServerChange) {
player.getInventory().setHeldItemSlot(slot - 1); player.getInventory().setHeldItemSlot(slot - 1);
send.debug(Main.plugin,"setCursor 7 Player: "+player.getName()); send.debug(Main.plugin, "setCursor 7 Player: " + player.getName());
return; return;
} }
send.debug(Main.plugin,"setCursor 8 Player: "+player.getName()); send.debug(Main.plugin, "setCursor 8 Player: " + player.getName());
send.debug(Main.plugin,"setCursor bungeejoinplayers: " +Main.bungeejoinplayers); send.debug(Main.plugin, "setCursor bungeejoinplayers: " + Main.bungeejoinplayers);
send.debug(Main.plugin,"setCursor Player: " +player.getName()); send.debug(Main.plugin, "setCursor Player: " + player.getName());
if (Main.bungeejoinplayers.contains(player.getName())) { if (Main.bungeejoinplayers.contains(player.getName())) {
player.getInventory().setHeldItemSlot(slot - 1); player.getInventory().setHeldItemSlot(slot - 1);
send.debug(Main.plugin,"setCursor 9 Player: "+player.getName()); send.debug(Main.plugin, "setCursor 9 Player: " + player.getName());
Main.bungeejoinplayers.remove(player.getName()); Main.bungeejoinplayers.remove(player.getName());
} }
} }

View File

@ -160,10 +160,12 @@ public class Events implements Listener {
private static void openGUI(PlayerInteractEvent e, Player player) { private static void openGUI(PlayerInteractEvent e, Player player) {
e.setCancelled(true); e.setCancelled(true);
if (SelectConfig.disableInfoBySneak && player.isSneaking()) { if (!SelectConfig.disableInfoBySneak){
if ( player.isSneaking()) {
Commands.info(player); Commands.info(player);
return; return;
} }
}
if (!legacy()) { if (!legacy()) {
if (!topInventoryIsEmpty(player)) return; if (!topInventoryIsEmpty(player)) return;

View File

@ -65,7 +65,6 @@ public class Commands {
CmdExecuter_GUITab.arg1.clear(); CmdExecuter_GUITab.arg1.clear();
CmdExecuter_GUITab.arg1.put("admin", "commandgui.admin;commandgui.giveitem.other;commandgui.command.info"); CmdExecuter_GUITab.arg1.put("admin", "commandgui.admin;commandgui.giveitem.other;commandgui.command.info");
ConfigCreate.configCreate();
SelectConfig.onSelect(); SelectConfig.onSelect();
Main.plugin.reloadConfig(); Main.plugin.reloadConfig();

View File

@ -61,7 +61,7 @@ public class SelectConfig {
public static String UseItemWorldMode; public static String UseItemWorldMode;
public static List<String> UseItemWorldList; public static List<String> UseItemWorldList;
public static Boolean disableInfoBySneak; public static Boolean disableInfoBySneak = false;
public static Boolean UseItem_InventorySlot_FreeSlot; public static Boolean UseItem_InventorySlot_FreeSlot;
public static Integer UseItem_InventorySlot; public static Integer UseItem_InventorySlot;