public AxisCommand(CommandSender sender, String[] args) throws NotIngameException, NoOnlinePlayerException, IngameException { super(sender, args, true, false); if (FPSCaste.getFPSPlayer(sender.getName()).getTeam() != null) { // joined a game if (FPSCaste.getFPSPlayer(sender.getName()).getTeam() != teamName.SPECTATOR) { // cannot be ingame if you want to /join throw new IngameException(); } } }
@Override public void init(Map map) { super.init(map); new BukkitRunnable() { @Override public void run() { for (GameObject o : gameObjects) { if (o instanceof DominationFlag) { DominationFlag flag = (DominationFlag) o; if (flag.getHolder() != teamName.SPECTATOR) { addScore(1, flag.getHolder()); } if (ended) { cancel(); } } } } }.runTaskTimer(FPSCaste.getInstance(), 0, 100); }
@Override public boolean handle() { FPSCaste.getFPSPlayer(this.getSender().getName()).join(teamName.AXIS); return true; }
@Override public void handleNear(String name) { DominationFlag f = (DominationFlag) getClosest(name); f.takeOver(100, FPSCaste.getFPSPlayer(name).getTeam(), name, "Capturing flag " + f.getName()); }