mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-20 03:35:51 +00:00
Slimefun book GUI dupe fix
Adds a player to a List when they have the guide open and cancels all inventory clicks until the menu is closed.
This commit is contained in:
parent
5b51953423
commit
19f4666235
@ -236,6 +236,7 @@ public class SlimefunGuide {
|
||||
}
|
||||
});
|
||||
|
||||
Variables.usingGuide.add(p.getUniqueId());
|
||||
menu.open(p);
|
||||
}
|
||||
|
||||
@ -328,6 +329,7 @@ public class SlimefunGuide {
|
||||
});
|
||||
}
|
||||
|
||||
Variables.usingGuide.add(p.getUniqueId());
|
||||
menu.open(p);
|
||||
}
|
||||
|
||||
@ -646,6 +648,7 @@ public class SlimefunGuide {
|
||||
}
|
||||
});
|
||||
|
||||
Variables.usingGuide.add(p.getUniqueId());
|
||||
menu.open(p);
|
||||
}
|
||||
}
|
||||
@ -925,6 +928,7 @@ public class SlimefunGuide {
|
||||
}
|
||||
}
|
||||
|
||||
Variables.usingGuide.add(p.getUniqueId());
|
||||
menu.open(p);
|
||||
}
|
||||
|
||||
@ -1317,6 +1321,7 @@ public class SlimefunGuide {
|
||||
}
|
||||
}
|
||||
|
||||
Variables.usingGuide.add(p.getUniqueId());
|
||||
menu.build().open(p);
|
||||
}
|
||||
|
||||
|
@ -23,5 +23,6 @@ public class Variables {
|
||||
public static List<UUID> blocks = new ArrayList<UUID>();
|
||||
public static List<UUID> cancelPlace = new ArrayList<UUID>();
|
||||
public static Map<UUID, ItemStack> arrows = new HashMap<UUID, ItemStack>();
|
||||
public static List<UUID> usingGuide = new ArrayList<UUID>();
|
||||
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
||||
import org.bukkit.event.inventory.CraftItemEvent;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||
import org.bukkit.event.inventory.InventoryMoveItemEvent;
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
@ -386,4 +387,18 @@ public class ItemListener implements Listener {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onClose(InventoryCloseEvent e) {
|
||||
if (Variables.usingGuide.contains(e.getPlayer().getUniqueId())) {
|
||||
Variables.usingGuide.remove(e.getPlayer().getUniqueId());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void inventoryClickEvent(final InventoryClickEvent e) {
|
||||
if (Variables.usingGuide.contains(e.getWhoClicked().getUniqueId())) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user