Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

Commit

Permalink
Fixed player manager.
Browse files Browse the repository at this point in the history
Former-commit-id: 7d351d7
  • Loading branch information
PolskiStevek committed Dec 14, 2019
1 parent 91ca936 commit 9a8be34
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 12 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>pl.polskistevek</groupId>
<artifactId>EpicGuard</artifactId>
<version>2.2.0</version>
<version>2.1.0</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -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!
Expand Down

0 comments on commit 9a8be34

Please sign in to comment.