Example #1
0
  @Override
  public void onExecute(String[] args, CommandSender sender) {
    Player player = (Player) sender;

    DGroup dGroup = DGroup.getByPlayer(player);
    if (dGroup == null) {
      MessageUtil.sendMessage(sender, DMessages.ERROR_JOIN_GROUP.getMessage());
      return;
    }

    if (!dGroup.getCaptain().equals(player)) {
      MessageUtil.sendMessage(sender, DMessages.ERROR_NOT_CAPTAIN.getMessage());
      return;
    }

    DGameWorld gameWorld = dGroup.getGameWorld();
    if (gameWorld == null) {
      MessageUtil.sendMessage(sender, DMessages.ERROR_NOT_IN_DUNGEON.getMessage());
      return;
    }

    Game game = gameWorld.getGame();
    if (game != null) {
      MessageUtil.sendMessage(sender, DMessages.ERROR_LEAVE_DUNGEON.getMessage());
      return;
    }

    for (Player groupPlayer : dGroup.getPlayers()) {
      DGamePlayer.getByPlayer(groupPlayer).ready(GameTypeDefault.TEST);
    }
  }
Example #2
0
  @Override
  public void run() {
    for (DGameWorld gameWorld : plugin.getDWorlds().getGameWorlds()) {
      if (gameWorld.exists()) {
        if (gameWorld.getWorld().getPlayers().isEmpty()) {
          if (DGamePlayer.getByWorld(gameWorld.getWorld()).isEmpty()) {
            gameWorld.delete();
          }
        }
      }
    }

    for (DEditWorld editWorld : plugin.getDWorlds().getEditWorlds()) {
      if (editWorld.exists()) {
        if (editWorld.getWorld().getPlayers().isEmpty()) {
          editWorld.delete(true);
        }
      }
    }
  }