#Target to Listener class
1 messages · Page 1 of 1 (latest)
I added an item with custom name in gui and then checked for the "target" through Items name
if (e.getInventory().getHolder() instanceof PlayerListHolder) {
//make sure they clicked on a player head
if (e.getCurrentItem().getType() == Material.PLAYER_HEAD) {
//Get player they clicked on from item name
Player target = player.getServer().getPlayerExact(ChatColor.stripColor(e.getCurrentItem().getItemMeta().getDisplayName()));
AdminMenuUtils.openPlayerMenu(player, target, plugin);
}
e.setCancelled(true);
}