Пример #1
0
/** @author Frank Baumann, Daniel Saukel */
public class WorldUnloadTask extends BukkitRunnable {

  DungeonsXL plugin = DungeonsXL.getInstance();

  @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);
        }
      }
    }
  }
}
Пример #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);
        }
      }
    }
  }
Пример #3
0
/** @author Daniel Saukel */
public class TestCommand extends BRCommand {

  DungeonsXL plugin = DungeonsXL.getInstance();

  public TestCommand() {
    setCommand("test");
    setMinArgs(0);
    setMaxArgs(0);
    setHelp(DMessages.HELP_CMD_TEST.getMessage());
    setPermission(DPermissions.TEST.getNode());
    setPlayerCommand(true);
  }

  @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);
    }
  }
}