Advertisement
DSHunterMC

Untitled

Nov 25th, 2017
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. package ItemStacksAndInventories;
  2.  
  3.  
  4. import org.bukkit.Bukkit;
  5. import org.bukkit.ChatColor;
  6. import org.bukkit.Material;
  7. import org.bukkit.command.Command;
  8. import org.bukkit.command.CommandExecutor;
  9. import org.bukkit.command.CommandSender;
  10. import org.bukkit.entity.Player;
  11. import org.bukkit.event.EventHandler;
  12. import org.bukkit.event.Listener;
  13. import org.bukkit.event.block.Action;
  14. import org.bukkit.event.inventory.InventoryClickEvent;
  15. import org.bukkit.event.player.PlayerInteractEvent;
  16. import org.bukkit.inventory.Inventory;
  17.  
  18.  
  19.  
  20. public class AdminGUI extends AdminGuiItemStacks implements CommandExecutor,Listener {
  21.  
  22. public Inventory agui;
  23.  
  24. @Override
  25. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
  26. Player p = (Player) sender;
  27. if(cmd.getName().equalsIgnoreCase("AguiGui")) {
  28. if(p.hasPermission("hhf.agui.gui")) {
  29. p.openInventory(agui);
  30. }
  31. }
  32.  
  33.  
  34. return true;
  35. }
  36. @SuppressWarnings("deprecation")
  37. @EventHandler
  38. public void AGUI(PlayerInteractEvent e) {
  39. Player p = e.getPlayer();
  40.  
  41. agui = Bukkit.createInventory(p, 54, ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "" + ChatColor.ITALIC + "Admin" +
  42. ChatColor.DARK_PURPLE + "" + ChatColor.BOLD + "" + ChatColor.ITALIC + "GUI");
  43.  
  44. agui.setItem(45, ReloadButton);
  45.  
  46. if(p.hasPermission("hhf.agui.open")) {
  47. if(p.getInventory().getItemInHand().getType() == Material.END_CRYSTAL){
  48. if(e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK) {
  49. p.openInventory(agui);
  50.  
  51. }
  52. }
  53. }
  54. }
  55.  
  56. @EventHandler
  57. public void AGUI2(InventoryClickEvent e) {
  58. Player p = (Player) e.getWhoClicked();
  59.  
  60. if(e.getInventory().getName().equals(agui.getName())) {
  61. e.setCancelled(true);
  62. }
  63.  
  64. if(e.getCurrentItem() == null) {
  65. return;
  66. }
  67.  
  68. if(e.getSlot() == 45) {
  69. p.performCommand("plugins");
  70. }
  71.  
  72. }
  73.  
  74.  
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement