Interface KonquestKingdomManager
public interface KonquestKingdomManager
A manager for kingdoms and towns in Konquest.
-
Method Summary
Modifier and TypeMethodDescriptionint
assignPlayerKingdom
(UUID id, String kingdomName, boolean force) Primary method for adding a player member to a kingdom.captureTownForPlayer
(String name, String oldKingdomName, KonquestPlayer conquerPlayer) Transfers ownership of a town to the given player's kingdom.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.int
exilePlayerBarbarian
(UUID id, boolean teleport, boolean clearStats, boolean isFull, boolean force) Exiles a player to be a Barbarian.Gets the barbarians' kingdom.getDiplomacy
(KonquestKingdom kingdom1, KonquestKingdom kingdom2) Get the shared diplomatic type of two kingdoms.getKingdom
(String name) Gets a kingdom by name.Gets a list of all kingdom names.ArrayList<? extends KonquestKingdom>
Gets a list of all kingdoms.int
Gets the maximum number of critical hits for each town monument.Gets the neutrals' kingdom.List<? extends KonquestTown>
Gets the towns which the given player is a knight of.List<? extends KonquestTown>
Gets the towns which the given player is the lord of.List<? extends KonquestTown>
Gets the towns which the given player is a resident of.getRelationRole
(KonquestKingdom kingdom1, KonquestKingdom kingdom2) Get the relationship type of two kingdoms.org.bukkit.Material
Gets the monument critical block material.boolean
Checks whether the given name is a kingdom.boolean
Checks whether the given name is a town.boolean
removeKingdom
(String name) Remove a kingdom with the given name.boolean
removeTown
(String name, String kingdomName) Remove a town.boolean
renameTown
(String oldName, String newName, String kingdomName) Rename a town.
-
Method Details
-
removeKingdom
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
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 UUIDkingdomName
- The kingdom name, case-sensitiveforce
- 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 exileteleport
- Teleport the player based on Konquest configuration when trueclearStats
- Remove all player stats and prefix when trueisFull
- Perform a full exile such that the player has no exile kingdom, like they just joined the serverforce
- 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
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 townname
- The name of the townkingdomName
- 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
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 removekingdomName
- The name of the kingdom that the town belongs to- Returns:
- True when the town is successfully removed, else false
-
renameTown
Rename a town.- Parameters:
oldName
- The current name of the town to be renamednewName
- The new name for the townkingdomName
- The name of the kingdom that the town belongs to- Returns:
- True when the town is successfully renamed, else false
-
captureTownForPlayer
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 captureoldKingdomName
- The name of the town's current kingdomconquerPlayer
- The player to capture the town for- Returns:
- The captured town when successful, else null
-
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
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
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
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
Gets the towns which the given player is the lord of.- Parameters:
player
- The player- Returns:
- List of towns
-
getPlayerKnightTowns
Gets the towns which the given player is a knight of.- Parameters:
player
- The player- Returns:
- List of towns
-
getPlayerResidenceTowns
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
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 kingdomkingdom2
- The target kingdom- Returns:
- The diplomatic type
-
getRelationRole
Get the relationship type of two kingdoms.- Parameters:
kingdom1
- The reference kingdomkingdom2
- The target kingdom- Returns:
- The relationship type
-