Interface KonquestKingdomManager


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

    • 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
    • assignPlayerKingdom

      int assignPlayerKingdom(UUID id, String kingdomName, boolean force)
      Primary method for adding a player member to a kingdom. 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:
      id - The player to assign, by UUID
      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
      5 - joining is denied, player is already member
      6 - joining is denied, player is a kingdom master
      7 - joining is denied, failed switch criteria
      8 - joining is denied, cool-down
      9 - Unknown player ID
      -1 - internal error
    • exilePlayerBarbarian

      int exilePlayerBarbarian(UUID id, boolean teleport, boolean clearStats, boolean isFull, boolean force)
      Exiles a player to be a Barbarian. Sets their exileKingdom value to their current Kingdom. (Optionally) Teleports to a random Wild location. (Optionally) Removes all stats and disables prefix. (Optionally) Resets their exileKingdom to Barbarians, making them look like a new player to Konquest. Applies exile cool-down timer.
      Parameters:
      id - The id of 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
      force - Ignore most checks when true
      Returns:
      status
      0 - success
      1 - Player is already a barbarian
      4 - cancelled by event
      6 - Exile denied, player is a kingdom master
      8 - Cool-down remaining
      9 - Unknown player ID
      -1 - internal error
    • createTown

      int createTown(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 initial 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, invalid 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, could not add land chunks
      14 - error, town init fail, too much air below town
      15 - error, town init fail, too much water below town
      16 - error, town init fail, containers below monument
      17 - error, town init fail, invalid monument template
      21 - error, town init fail, invalid monument
      22 - error, town init fail, land height gradient is too high
      23 - error, town init fail, location is on bedrock or outside of gradient range
    • 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

      KonquestTown 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:
      The captured town when successful, else null
    • 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
    • getDiplomacy

      KonquestDiplomacyType getDiplomacy(KonquestKingdom kingdom1, KonquestKingdom kingdom2)
      Get the shared diplomatic type of two kingdoms. Performs error checking to ensure both kingdoms have the same active relation. If there is a mismatch, they are reset to default (peace).
      Parameters:
      kingdom1 - The reference kingdom
      kingdom2 - The target kingdom
      Returns:
      The diplomatic type
    • getRelationRole

      KonquestRelationshipType getRelationRole(KonquestKingdom kingdom1, KonquestKingdom kingdom2)
      Get the relationship type of two kingdoms.
      Parameters:
      kingdom1 - The reference kingdom
      kingdom2 - The target kingdom
      Returns:
      The relationship type