Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.clip.ezprestige.gui;
- import java.util.HashMap;
- import org.bukkit.entity.Player;
- import me.clip.ezprestige.EZPrestige;
- public class InventoryMenuHandler {
- EZPrestige plugin;
- public InventoryMenuHandler(EZPrestige instance) {
- plugin = instance;
- }
- private static HashMap<String, EZInventoryMenu> inGUI = new HashMap<String, EZInventoryMenu>();
- public boolean hasGUI(Player p) {
- if (inGUI == null) {
- return false;
- }
- return inGUI.containsKey(p.getName()) && inGUI.get(p.getName()) != null;
- }
- public EZInventoryMenu getGUI(Player p) {
- if (!hasGUI(p)) {
- return new EZInventoryMenu(p.getName());
- }
- return inGUI.get(p.getName());
- }
- public void openGUI(Player p, EZInventoryMenu gui) {
- gui.openInventory(p);
- inGUI.put(p.getName(), gui);
- }
- public void closeGUI(Player p, boolean close) {
- if (!hasGUI(p)) {
- return;
- }
- if (close) {
- getGUI(p).clear();
- p.closeInventory();
- }
- inGUI.remove(p.getName());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement