View difference between Paste ID: JAsEzvVW and 6YmjtpnK
SHOW: | | - or go back to the newest paste.
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-
			playerToKill.setHealth(0);
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
}