@Override public void exec( CommandSender sender, String commandName, String[] args, Player player, boolean isPlayer) { if (args.length == 0) { sender.sendMessage(ChatColor.RED + "I can't kill anyone if you don't tell me whom"); return; } Player target = null; try { target = J2MC_Manager.getVisibility().getPlayer(args[0], null); } catch (final BadPlayerMatchException e) { sender.sendMessage(ChatColor.RED + e.getMessage()); return; } final boolean weather = target.getWorld().isThundering(); // J2MC_Manager.getPermissions().setPermissions("j2mc.damage.take", true); // this.j2.damage.addToTimer(target.getName()); target.getWorld().strikeLightningEffect(target.getLocation()); target.damage(20); target.setFireTicks(200); J2MC_Manager.getCore() .adminAndLog(ChatColor.RED + sender.getName() + " has zapped " + target.getName()); target.sendMessage(ChatColor.RED + "You have been judged"); target.getWorld().setStorm(weather); }
@Override public List<String> onTabComplete( CommandSender sender, Command command, String alias, String[] args) { if (args.length == 0) { return new ArrayList<String>(); } try { return J2MC_Manager.getVisibility().getPotentialMatches(args[(args.length - 1)], sender); } catch (BadPlayerMatchException e) { return new ArrayList<String>(); } }