Advertisement
RoboticPlayer

AdminGUI

Oct 6th, 2015
22
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.99 KB | None | 0 0
  1. package me.roboticplayer.superadmin.commands;
  2.  
  3. import org.bukkit.ChatColor;
  4. import org.bukkit.command.Command;
  5. import org.bukkit.command.CommandExecutor;
  6. import org.bukkit.command.CommandSender;
  7. import org.bukkit.entity.Player;
  8.  
  9. import me.roboticplayer.superadmin.inventories.MainGUI;
  10.  
  11. public class AdminGUI implements CommandExecutor {
  12.  
  13.     private MainGUI gui;
  14.  
  15.     public AdminGUI(MainGUI instance) {
  16.         gui = instance;
  17.     }
  18.  
  19.     @Override
  20.     public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
  21.         if (cmd.getName().equalsIgnoreCase("admingui")) {
  22.             if (!(sender instanceof Player)) {
  23.                 sender.sendMessage(ChatColor.RED + "The console cannot use this command!");
  24.                 return true;
  25.             }
  26.  
  27.             if (!(sender.hasPermission("superadmin.gui"))) {
  28.                 sender.sendMessage(ChatColor.DARK_RED + "You do not have permission to perform this command!");
  29.                 return true;
  30.             }
  31.             ((Player) sender).openInventory(gui.getMainInv());
  32.         }
  33.         return true;
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement