Advertisement
DSHunterMC

Untitled

Nov 26th, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.43 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. //-------------------- Agui gui ---------------------------------------------------------------
  31. agui = Bukkit.createInventory(p, 54, ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "" + ChatColor.ITALIC + "Admin" +
  32. ChatColor.DARK_PURPLE + "" + ChatColor.BOLD + "" + ChatColor.ITALIC + "GUI");
  33. agui.setItem(45, ReloadButton);
  34.  
  35. //--------------------------- Agui gui ----------------------------------------
  36. if(cmd.getName().equalsIgnoreCase("AguiGui")) {
  37. if(p.hasPermission("hhf.agui.gui")) {
  38. p.openInventory(agui);
  39. }else {
  40. if(!p.hasPermission("hhf.agui.get")) {
  41. 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!");
  42. }
  43. }
  44. }
  45.  
  46.  
  47. return true;
  48. }
  49.  
  50. @EventHandler
  51. public void AGUI(PlayerInteractEvent e) {
  52. Player p = e.getPlayer();
  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(ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "" + ChatColor.ITALIC + "Admin")) {
  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