Interface KonquestKingdomManager


public interface KonquestKingdomManager
A manager for kingdoms and towns in Konquest.
Author:
Rumsfield
  • Method Details

    • addKingdom

      boolean addKingdom(org.bukkit.Location loc, String name)
      Add a new kingdom at the given location with the given name. The kingdom will create a new capital territory in the chunk of the location.
      Parameters:
      loc - The center location of the new kingdom's capital
      name - The name of the new kingdom
      Returns:
      True when the new kingdom is successfully created, else false
    • removeKingdom

      boolean removeKingdom(String name)
      Remove a kingdom with the given name. All kingdom members will be exiled to barbarians. All towns in the kingdom will be removed, with monuments replaced with air. The kingdom capital will be removed.
      Parameters:
      name - The name of the kingdom to remove, case-sensitive
      Returns:
      True when the kingdom is successfully removed, else false
    • renameKingdom

      boolean renameKingdom(String oldName, String newName)
      Rename a kingdom.
      Parameters:
      oldName - The current name of the kingdom, case-sensitive
      newName - The new name for the kingdom
      Returns:
      True when the new name is valid and successfully applied to the kingdom, else false
    • assignPlayerKingdom

      int assignPlayerKingdom(KonquestPlayer player, String kingdomName, boolean force)
      Assign a player to a kingdom and teleport them to the capital spawn point. Optionally checks for join permissions based on Konquest configuration. Optionally enforces maximum kingdom membership difference based on Konquest configuration.
      Parameters:
      player - The player to assign
      kingdomName - The kingdom name, case-sensitive
      force - Ignore permission and max membership limits when true
      Returns:
      status
      0 - success
      1 - kingdom name does not exist
      2 - the kingdom is full (config option max_player_diff)
      3 - missing permission
      4 - cancelled
      -1 - internal error
    • assignOfflinePlayerKingdom

      int assignOfflinePlayerKingdom(KonquestOfflinePlayer offlinePlayer, String kingdomName, boolean force)
      Assign an offline player to a kingdom. Optionally enforces maximum kingdom membership difference based on Konquest configuration.
      Parameters:
      offlinePlayer - The offline player to assign
      kingdomName - The kingdom name, case-sensitive
      force - Ignore max membership limits when true
      Returns:
      status
      0 - success
      1 - kingdom name does not exist
      2 - the kingdom is full (config option max_player_diff)
      -1 - internal error
    • exilePlayer

      boolean exilePlayer(KonquestPlayer player, boolean teleport, boolean clearStats, boolean isFull)
      Exiles a player to the Barbarians and teleports to a random Wild location. Sets their exileKingdom value to their current Kingdom. Removes all stats and disables prefix.
      Parameters:
      player - The player to exile
      teleport - Teleport the player based on Konquest configuration when true
      clearStats - Remove all player stats and prefix when true
      isFull - Perform a full exile such that the player has no exile kingdom, like they just joined the server
      Returns:
      True when the player was successfully exiled, else false
    • exileOfflinePlayer

      boolean exileOfflinePlayer(KonquestOfflinePlayer offlinePlayer, boolean isFull)
      Forcibly exiles an offline player by updating their database information. The next time they log on, they will be a barbarian.
      Parameters:
      offlinePlayer - The player to exile
      isFull - Perform a full exile such that the player has no exile kingdom, like they just joined the server
      Returns:
      True when the player was successfully exiled, else false
    • addTown

      int addTown(org.bukkit.Location loc, String name, String kingdomName)
      Create a new town centered at the given location, with the given name, for the given kingdom name. The town will copy a new monument from the kingdom monument template into the chunk of the given location. The town will create an intial territory based on the Konquest configuration.
      Parameters:
      loc - The center location of the town
      name - The name of the town
      kingdomName - The name of the kingdom that the town belongs to, case-sensitive
      Returns:
      Status code
      0 - success
      1 - error, initial territory chunks conflict with another territory
      3 - error, bad name
      4 - error, invalid monument template
      5 - error, bad town placement, invalid world
      6 - error, bad town placement, too close to another territory
      7 - error, bad town placement, too far from other territories
      12 - error, town init fail, bad town height
      13 - error, town init fail, too much air
      14 - error, town init fail, bad chunks
      21 - error, town init fail, invalid monument
      22 - error, town init fail, bad monument gradient
      23 - error, town init fail, monument placed on bedrock
    • removeTown

      boolean removeTown(String name, String kingdomName)
      Remove a town. The territory will be deleted, and the town monument will be replaced with air.
      Parameters:
      name - The name of the town to remove
      kingdomName - The name of the kingdom that the town belongs to
      Returns:
      True when the town is successfully removed, else false
    • renameTown

      boolean renameTown(String oldName, String newName, String kingdomName)
      Rename a town.
      Parameters:
      oldName - The current name of the town to be renamed
      newName - The new name for the town
      kingdomName - The name of the kingdom that the town belongs to
      Returns:
      True when the town is successfully renamed, else false
    • captureTownForPlayer

      boolean captureTownForPlayer(String name, String oldKingdomName, KonquestPlayer conquerPlayer)
      Transfers ownership of a town to the given player's kingdom. The player that captures the town will become the new town lord. The player's kingdom will assume ownership of the town.
      Parameters:
      name - The name of the town to capture
      oldKingdomName - The name of the town's current kingdom
      conquerPlayer - The player to capture the town for
      Returns:
      True when the town is successfully captured, else false
    • claimChunk

      int claimChunk(org.bukkit.Location loc)
      Claims the chunk at the given location for the nearest adjacent territory. Adds the chunk to the chunk map of the territory. The territory is chosen by finding the closest territory center location to the given location.
      Parameters:
      loc - The location to claim
      Returns:
      Status code
      0 - success
      1 - error, no adjacent territory
      2 - error, exceeds max distance
      3 - error, already claimed
    • unclaimChunk

      boolean unclaimChunk(org.bukkit.Location loc)
      Unclaims the chunk at the given location from its associated territory. Removes the chunk from the chunk map of the territory.
      Parameters:
      loc - The location to unclaim
      Returns:
      True if the chunk was successfully unclaimed, else false
    • isChunkClaimed

      boolean isChunkClaimed(org.bukkit.Location loc)
      Checks whether the chunk at the given location is claimed by a territory.
      Parameters:
      loc - The location to check
      Returns:
      True when the location is inside of claimed territory, else false
    • getChunkTerritory

      KonquestTerritory getChunkTerritory(org.bukkit.Location loc)
      Gets the territory at the given location. If no territory exists, returns null.
      Parameters:
      loc - The location to request the territory
      Returns:
      The territory at the given location, or null if no territory exists
    • getDistanceToClosestTerritory

      int getDistanceToClosestTerritory(org.bukkit.Location loc)
      Finds the distance in chunks (16 blocks) from the given location to the nearest territory. Checks kingdom capitals, towns, and ruins. Does not include camps.
      Parameters:
      loc - The location to search
      Returns:
      The distance in chunks to the nearest territory, or Integer.MAX_VALUE if not found
    • getKingdomNames

      ArrayList<String> getKingdomNames()
      Gets a list of all kingdom names.
      Returns:
      The list of kingdom names
    • getKingdoms

      ArrayList<? extends KonquestKingdom> getKingdoms()
      Gets a list of all kingdoms.
      Returns:
      The list of kingdoms
    • isKingdom

      boolean isKingdom(String name)
      Checks whether the given name is a kingdom. Excludes the default barbarians kingdom.
      Parameters:
      name - The name of the kingdom
      Returns:
      True when the name matches a kingdom, else false
    • getKingdom

      KonquestKingdom getKingdom(String name)
      Gets a kingdom by name. Returns the barbarian kingdom by default.
      Parameters:
      name - The name of the kingdom
      Returns:
      The kingdom, or barbarians when not found
    • isTown

      boolean isTown(String name)
      Checks whether the given name is a town.
      Parameters:
      name - The name of the town
      Returns:
      True when the name matches a town, else false
    • getBarbarians

      KonquestKingdom getBarbarians()
      Gets the barbarians kingdom. This is a default kingdom created internally by Konquest for barbarian players.
      Returns:
      The barbarians kingdom
    • getNeutrals

      KonquestKingdom getNeutrals()
      Gets the neutrals kingdom. This is a default kingdom created internally by Konquest for ruin territories and other territories that do not belong to a kingdom.
      Returns:
      The neutrals kingdom
    • getPlayerLordshipTowns

      List<? extends KonquestTown> getPlayerLordshipTowns(KonquestOfflinePlayer player)
      Gets the towns which the given player is the lord of.
      Parameters:
      player - The player
      Returns:
      List of towns
    • getPlayerKnightTowns

      List<? extends KonquestTown> getPlayerKnightTowns(KonquestOfflinePlayer player)
      Gets the towns which the given player is a knight of.
      Parameters:
      player - The player
      Returns:
      List of towns
    • getPlayerResidenceTowns

      List<? extends KonquestTown> getPlayerResidenceTowns(KonquestOfflinePlayer player)
      Gets the towns which the given player is a resident of.
      Parameters:
      player - The player
      Returns:
      List of towns
    • getTownCriticalBlock

      org.bukkit.Material getTownCriticalBlock()
      Gets the monument critical block material. This is the block type that must be destroyed within town monuments in order to capture the town.
      Returns:
      The critical material
    • getMaxCriticalHits

      int getMaxCriticalHits()
      Gets the maximum number of critical hits for each town monument. When this number of critical blocks are destroyed, the town will be captured.
      Returns:
      The number of maximum critical hits