turt2live

Untitled

Mar 4th, 2012
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public MyPlugin extends JavaPlugin{
  2.     public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args){
  3.         if(commandLabel.equalsIgnoreCase("someCommandName")){
  4.             Random random = new Random();
  5.             int indexToKill = random.nextInt(Bukkit.getOnlinePlayers().length - 1);
  6.             Player playerToKill = Bukkit.getOnlinePlayers()[indexToKill];
  7.             if(playerToKill.hasPermission("killrandom.notKill") || playerToKill.isOp()){
  8.                 // Do not kill
  9.             }else{
  10.                 playerToKill.setHealth(0);
  11.             }
  12.             return true;
  13.         }
  14.         return false;
  15.     }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment