Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ItemStacksAndInventories;
- import org.bukkit.Bukkit;
- import org.bukkit.ChatColor;
- import org.bukkit.Material;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandExecutor;
- import org.bukkit.command.CommandSender;
- import org.bukkit.entity.Player;
- import org.bukkit.event.EventHandler;
- import org.bukkit.event.Listener;
- import org.bukkit.event.block.Action;
- import org.bukkit.event.inventory.InventoryClickEvent;
- import org.bukkit.event.player.PlayerInteractEvent;
- import org.bukkit.inventory.Inventory;
- public class AdminGUI extends AdminGuiItemStacks implements CommandExecutor,Listener {
- public Inventory agui;
- @Override
- public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
- Player p = (Player) sender;
- //-------------------- Agui gui ---------------------------------------------------------------
- agui = Bukkit.createInventory(p, 54, ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "" + ChatColor.ITALIC + "Admin" +
- ChatColor.DARK_PURPLE + "" + ChatColor.BOLD + "" + ChatColor.ITALIC + "GUI");
- agui.setItem(45, ReloadButton);
- //--------------------------- Agui gui ----------------------------------------
- if(cmd.getName().equalsIgnoreCase("AguiGui")) {
- if(p.hasPermission("hhf.agui.gui")) {
- p.openInventory(agui);
- }else {
- if(!p.hasPermission("hhf.agui.get")) {
- p.sendMessage(ChatColor.DARK_RED + "" + ChatColor.BOLD + "HHF" + ChatColor.RED + " - I'm sorry, but I believe this command is not accessable to you. Please contact the server admin to check if this is an error!");
- }
- }
- }
- return true;
- }
- @EventHandler
- public void AGUI(PlayerInteractEvent e) {
- Player p = e.getPlayer();
- if(p.hasPermission("hhf.agui.open")) {
- if(p.getInventory().getItemInMainHand().getType() == Material.END_CRYSTAL) {
- if(e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK) {
- p.openInventory(agui);
- }
- }
- }
- }
- @EventHandler
- public void AGUI2(InventoryClickEvent e) {
- Player p = (Player) e.getWhoClicked();
- if(e.getInventory().getName().equals(ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "" + ChatColor.ITALIC + "Admin")) {
- e.setCancelled(true);
- }
- if(e.getCurrentItem() == null) {
- return;
- }
- if(e.getSlot() == 45) {
- p.performCommand("plugins");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement