Advertisement
DSHunterMC

Untitled

Nov 26th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.20 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.  
  21. public class AdminGUI extends AdminGuiItemStacks implements CommandExecutor,Listener {
  22.  
  23. public Inventory agui;
  24.  
  25.  
  26. @Override
  27. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
  28. Player p = (Player) sender;
  29.  
  30. if(cmd.getName().equalsIgnoreCase("AguiGui")) {
  31. if(p.hasPermission("hhf.agui.gui")) {
  32. p.openInventory(agui);
  33. }else {
  34. if(!p.hasPermission("hhf.agui.get")) {
  35. 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!");
  36. }
  37. }
  38. }
  39.  
  40.  
  41. return true;
  42. }
  43.  
  44. @EventHandler
  45. public void AGUI(PlayerInteractEvent e) {
  46. Player p = e.getPlayer();
  47.  
  48. agui = Bukkit.createInventory(null, 54, ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "" + ChatColor.ITALIC + "Admin" +
  49. ChatColor.DARK_PURPLE + "" + ChatColor.BOLD + "" + ChatColor.ITALIC + "GUI");
  50.  
  51. agui.setItem(45, ReloadButton);
  52.  
  53.  
  54. if(p.hasPermission("hhf.agui.open")) {
  55. if(p.getInventory().getItemInMainHand().getType() == Material.END_CRYSTAL) {
  56. if(e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK) {
  57. p.openInventory(agui);
  58.  
  59. }
  60. }
  61. }
  62. }
  63.  
  64.  
  65. @EventHandler
  66. public void AGUI2(InventoryClickEvent e) {
  67. Player p = (Player) e.getWhoClicked();
  68.  
  69. if(e.getInventory().getName().equals(agui.getName())) {
  70. e.setCancelled(true);
  71. }
  72.  
  73. if(e.getCurrentItem() == null) {
  74. return;
  75. }
  76.  
  77. if(e.getSlot() == 45) {
  78. p.performCommand("plugins");
  79. }
  80.  
  81. }
  82.  
  83.  
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement