Package konquest.api.manager
Interface KonquestKingdomManager
public interface KonquestKingdomManager
A manager for kingdoms and towns in Konquest.
- Author:
- Rumsfield
-
Method Summary
Modifier and TypeMethodDescriptionbooleanaddKingdom(org.bukkit.Location loc, String name) Add a new kingdom at the given location with the given name.intCreate a new town centered at the given location, with the given name, for the given kingdom name.intassignOfflinePlayerKingdom(KonquestOfflinePlayer offlinePlayer, String kingdomName, boolean force) Assign an offline player to a kingdom.intassignPlayerKingdom(KonquestPlayer player, String kingdomName, boolean force) Assign a player to a kingdom and teleport them to the capital spawn point.booleancaptureTownForPlayer(String name, String oldKingdomName, KonquestPlayer conquerPlayer) Transfers ownership of a town to the given player's kingdom.intclaimChunk(org.bukkit.Location loc) Claims the chunk at the given location for the nearest adjacent territory.booleanexileOfflinePlayer(KonquestOfflinePlayer offlinePlayer, boolean isFull) Forcibly exiles an offline player by updating their database information.booleanexilePlayer(KonquestPlayer player, boolean teleport, boolean clearStats, boolean isFull) Exiles a player to the Barbarians and teleports to a random Wild location.Gets the barbarians kingdom.getChunkTerritory(org.bukkit.Location loc) Gets the territory at the given location.intgetDistanceToClosestTerritory(org.bukkit.Location loc) Finds the distance in chunks (16 blocks) from the given location to the nearest territory.getKingdom(String name) Gets a kingdom by name.Gets a list of all kingdom names.ArrayList<? extends KonquestKingdom>Gets a list of all kingdoms.intGets 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.org.bukkit.MaterialGets the monument critical block material.booleanisChunkClaimed(org.bukkit.Location loc) Checks whether the chunk at the given location is claimed by a territory.booleanChecks whether the given name is a kingdom.booleanChecks whether the given name is a town.booleanremoveKingdom(String name) Remove a kingdom with the given name.booleanremoveTown(String name, String kingdomName) Remove a town.booleanrenameKingdom(String oldName, String newName) Rename a kingdom.booleanrenameTown(String oldName, String newName, String kingdomName) Rename a town.booleanunclaimChunk(org.bukkit.Location loc) Unclaims the chunk at the given location from its associated territory.
-
Method Details
-
addKingdom
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 capitalname- The name of the new kingdom- Returns:
- True when the new kingdom is successfully created, else false
-
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
-
renameKingdom
Rename a kingdom.- Parameters:
oldName- The current name of the kingdom, case-sensitivenewName- The new name for the kingdom- Returns:
- True when the new name is valid and successfully applied to the kingdom, else false
-
assignPlayerKingdom
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 assignkingdomName- 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
-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 assignkingdomName- The kingdom name, case-sensitiveforce- 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
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 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 server- Returns:
- True when the player was successfully exiled, else false
-
exileOfflinePlayer
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 exileisFull- 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
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 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, 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
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:
- 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
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
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
-