Fix clicking in Inv not selecting ac
This commit is contained in:
parent
27c6393873
commit
e9a88869ed
1 changed files with 10 additions and 1 deletions
|
|
@ -6,6 +6,7 @@ import org.bukkit.entity.Player;
|
|||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
|
||||
/**
|
||||
* @author NieGestorben
|
||||
|
|
@ -16,9 +17,15 @@ public class InvClick implements Listener {
|
|||
@EventHandler
|
||||
public void onInvClick(InventoryClickEvent e) {
|
||||
Player player = (Player) e.getWhoClicked();
|
||||
if (e.getCurrentItem() == null) {
|
||||
if (e.getCurrentItem() == null || !e.getClickedInventory().getName().equals("Anticheats") || e.getClickedInventory().getType() == InventoryType.PLAYER) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.getCurrentItem().getType() == Material.STAINED_GLASS_PANE) {
|
||||
e.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
AnticheatManager.INSTANCE.getConfig().getStringList("name-list").forEach(name -> {
|
||||
Material material = Material.valueOf(AnticheatManager.INSTANCE.getConfig().getString("anticheats." + name + ".material"));
|
||||
String acName = AnticheatManager.INSTANCE.getConfig().getString("anticheats." + name + ".name");
|
||||
|
|
@ -26,6 +33,8 @@ public class InvClick implements Listener {
|
|||
player.performCommand("acsel " + name);
|
||||
}
|
||||
});
|
||||
e.getClickedInventory().clear();
|
||||
player.closeInventory();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue