Advertisement
uyuyuy99

Plugin Command Setup

Feb 4th, 2013
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.71 KB | None | 0 0
  1. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
  2.         String cmdName = cmd.getName().toLowerCase();
  3.        
  4.         Player player = null;
  5.         String playerName = null;
  6.        
  7.         //If player is null, command was sent from the server
  8.         if (sender instanceof Player) {
  9.             player = (Player) sender;
  10.             playerName = player.getName();
  11.         }
  12.        
  13.         if (cmdName.equals("command1")) {
  14.             //Do stuff
  15.         }
  16.        
  17.         else if (cmdName.equals("command2")) {
  18.             //Do stuff
  19.         }
  20.        
  21.         else if (cmdName.equals("command3")) {
  22.             //Do stuff
  23.         }
  24.        
  25.         else {
  26.             //Unhandled command
  27.             return true;
  28.         }
  29.        
  30.         return false;
  31.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement