diff --git a/pom.xml b/pom.xml index 719f348b..622f6c0b 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ pl.polskistevek EpicGuard - 2.2.0 + 2.1.0 UTF-8 diff --git a/src/main/java/pl/polskistevek/guard/bukkit/GuardPluginBukkit.java b/src/main/java/pl/polskistevek/guard/bukkit/GuardPluginBukkit.java index ea768fe3..195e9138 100644 --- a/src/main/java/pl/polskistevek/guard/bukkit/GuardPluginBukkit.java +++ b/src/main/java/pl/polskistevek/guard/bukkit/GuardPluginBukkit.java @@ -119,7 +119,7 @@ public void onEnable() { // Creating GUI's GuiMain.i = Bukkit.createInventory(null, 45, "EpicGuard Management Menu"); - GuiPlayers.inv = Bukkit.createInventory(null, 45, "EpicGuard Player Manager"); + GuiPlayers.inv = Bukkit.createInventory(null, 36, "EpicGuard Player Manager"); Logger.info("Succesfully loaded! Took: " + (System.currentTimeMillis() - ms) + "ms", false); } catch (Exception e) { diff --git a/src/main/java/pl/polskistevek/guard/bukkit/gui/GuiPlayers.java b/src/main/java/pl/polskistevek/guard/bukkit/gui/GuiPlayers.java index 9e77bfbf..2b8780e5 100644 --- a/src/main/java/pl/polskistevek/guard/bukkit/gui/GuiPlayers.java +++ b/src/main/java/pl/polskistevek/guard/bukkit/gui/GuiPlayers.java @@ -48,7 +48,9 @@ public static void show(Player p) { } else { itemStack = new ItemBuilder(Material.IRON_HELMET).setTitle("&a" + player.getName()).addLores(lore).build(); } + ItemStack back = new ItemBuilder(Material.ARROW).setTitle("&cBack to main menu").addLore("").addLore("&7Click to go back.").build(); inv.setItem(i, itemStack); + inv.setItem(35, back); i++; } p.openInventory(inv); diff --git a/src/main/java/pl/polskistevek/guard/bukkit/listener/InventoryClickListener.java b/src/main/java/pl/polskistevek/guard/bukkit/listener/InventoryClickListener.java index c6e5f39d..5ecee8bd 100644 --- a/src/main/java/pl/polskistevek/guard/bukkit/listener/InventoryClickListener.java +++ b/src/main/java/pl/polskistevek/guard/bukkit/listener/InventoryClickListener.java @@ -5,18 +5,19 @@ import org.bukkit.event.Listener; import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.inventory.meta.ItemMeta; +import pl.polskistevek.guard.bukkit.gui.GuiMain; import pl.polskistevek.guard.bukkit.gui.GuiPlayers; public class InventoryClickListener implements Listener { @EventHandler - public void onClick(InventoryClickEvent e) { - Player p = (Player) e.getWhoClicked(); - if (e.getView().getTitle().equals("EpicGuard Management Menu")) { - e.setCancelled(true); - if (e.getCurrentItem() == null) { + public void onClick(InventoryClickEvent event) { + Player p = (Player) event.getWhoClicked(); + if (event.getView().getTitle().equals("EpicGuard Management Menu")) { + event.setCancelled(true); + if (event.getCurrentItem() == null) { return; } - ItemMeta im = e.getCurrentItem().getItemMeta(); + ItemMeta im = event.getCurrentItem().getItemMeta(); if (im == null) { return; } @@ -27,8 +28,17 @@ public void onClick(InventoryClickEvent e) { p.getOpenInventory().close(); } } - if (e.getView().getTitle().equals("EpicGuard Player Manager")) { - e.setCancelled(true); + if (event.getView().getTitle().equals("EpicGuard Player Manager")) { + if (event.getCurrentItem() == null) { + return; + } + if (event.getCurrentItem().getItemMeta() == null) { + return; + } + if (event.getCurrentItem().getItemMeta().getDisplayName().contains("Back to main menu")){ + GuiMain.show(p); + } + event.setCancelled(true); } } } diff --git a/src/main/java/pl/polskistevek/guard/bukkit/task/ActionBarTask.java b/src/main/java/pl/polskistevek/guard/bukkit/task/ActionBarTask.java index 29f45b08..3b8ee973 100644 --- a/src/main/java/pl/polskistevek/guard/bukkit/task/ActionBarTask.java +++ b/src/main/java/pl/polskistevek/guard/bukkit/task/ActionBarTask.java @@ -3,6 +3,7 @@ import org.bukkit.Bukkit; import org.bukkit.entity.Player; import pl.polskistevek.guard.bukkit.gui.GuiMain; +import pl.polskistevek.guard.bukkit.gui.GuiPlayers; import pl.polskistevek.guard.bukkit.manager.AttackManager; import pl.polskistevek.guard.bukkit.util.MessagesBukkit; import pl.polskistevek.guard.bukkit.util.Notificator; @@ -17,7 +18,7 @@ public void run() { GuiMain.show(p); } if (p.getOpenInventory().getTitle().equals("EpicGuard Player Manager")) { - GuiMain.show(p); + GuiPlayers.show(p); } } if (AttackManager.connectPerSecond == 0) { diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index a5045573..abad7358 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,6 +1,6 @@ name: EpicGuard version: 2.1.0 -main: pl.polskistevek.guard.bukkit.BukkitMain +main: pl.polskistevek.guard.bukkit.GuardPluginBukkit softdepend: [ProtocolLib] author: PolskiStevek description: Increase your server security. Fast and effective, Block bots, griefers, Bungeecord Supported!