Interface KonquestAPI
public interface KonquestAPI
The Konquest API. This is the primary means of accessing Konquest objects and methods. Most of the methods are helpers.
Use the manager classes to interact with specific portions of Konquest.
-
Method Summary
Modifier and TypeMethodDescriptionGets the allied primary color, from core.yml.Gets the allied secondary color, from core.yml.Gets the barbarian primary color, from core.yml.Gets the barbarian secondary color, from core.yml.Gets the camp manager, for all things camp related.getDisplayPrimaryColor
(KonquestKingdom displayKingdom, KonquestKingdom contextKingdom) Gets the primary display color based on relationships.getDisplayPrimaryColor
(KonquestOfflinePlayer displayPlayer, KonquestOfflinePlayer contextPlayer) Gets the primary display color based on relationships.getDisplayPrimaryColor
(KonquestOfflinePlayer displayPlayer, KonquestTerritory contextTerritory) Gets the primary display color based on relationships.getDisplaySecondaryColor
(KonquestKingdom displayKingdom, KonquestKingdom contextKingdom) Gets the secondary display color based on relationships.getDisplaySecondaryColor
(KonquestOfflinePlayer displayPlayer, KonquestOfflinePlayer contextPlayer) Gets the secondary display color based on relationships.getDisplaySecondaryColor
(KonquestOfflinePlayer displayPlayer, KonquestTerritory contextTerritory) Gets the secondary display color based on relationships.Gets the enemy primary color, from core.yml.Gets the enemy secondary color, from core.yml.Gets the friendly primary color, from core.yml.Gets the friendly secondary color, from core.yml.Gets the kingdom manager, for all things kingdom/town related.Gets the neutral primary color, from core.yml.Gets the neutral secondary color, from core.yml.Gets the peaceful primary color, from core.yml.Gets the peaceful secondary color, from core.yml.Gets the player manager, for all things player related.Gets the plot manager, for all things town plot related.org.bukkit.Location
getRandomWildLocation
(org.bukkit.World world) Gets a random location in the wild, constrained by radius and offset in Konquest's configuration.Gets the ruin manager, for all things ruin related.org.bukkit.Location
getSafeRandomCenteredLocation
(org.bukkit.Location center, int radius) Gets a random safe location in a surrounding chunk to the given center location.org.bukkit.scoreboard.Scoreboard
Gets the primary Konquest scoreboard with teams.Gets the shield manager, for all things town shield and armor related.Gets the territory manager, for all things land/territory related.Gets the trade primary color, from core.yml.Gets the trade secondary color, from core.yml.Gets the upgrade manager, for all things town upgrade related.boolean
isWorldIgnored
(org.bukkit.Location loc) Checks if a location is in an ignored world.boolean
isWorldIgnored
(org.bukkit.World world) Checks if a world is ignored.boolean
isWorldValid
(org.bukkit.Location loc) Checks if a location is in a valid world.boolean
isWorldValid
(org.bukkit.World world) Checks if a world is valid.static Point
toPoint
(org.bukkit.Location loc) Utility method to convert a location to a point representation of the chunk that contains the location.int
Checks for name conflicts and constraints against all Konquest names.
-
Method Details
-
getFriendlyPrimaryColor
String getFriendlyPrimaryColor()Gets the friendly primary color, from core.yml.- Returns:
- The friendly primary color
-
getFriendlySecondaryColor
String getFriendlySecondaryColor()Gets the friendly secondary color, from core.yml.- Returns:
- The friendly secondary color
-
getEnemyPrimaryColor
String getEnemyPrimaryColor()Gets the enemy primary color, from core.yml.- Returns:
- The enemy primary color
-
getEnemySecondaryColor
String getEnemySecondaryColor()Gets the enemy secondary color, from core.yml.- Returns:
- The enemy secondary color
-
getTradePrimaryColor
String getTradePrimaryColor()Gets the trade primary color, from core.yml.- Returns:
- The trade primary color
-
getTradeSecondaryColor
String getTradeSecondaryColor()Gets the trade secondary color, from core.yml.- Returns:
- The trade secondary color
-
getPeacefulPrimaryColor
String getPeacefulPrimaryColor()Gets the peaceful primary color, from core.yml.- Returns:
- The peaceful primary color
-
getPeacefulSecondaryColor
String getPeacefulSecondaryColor()Gets the peaceful secondary color, from core.yml.- Returns:
- The peaceful secondary color
-
getAlliedPrimaryColor
String getAlliedPrimaryColor()Gets the allied primary color, from core.yml.- Returns:
- The allied primary color
-
getAlliedSecondaryColor
String getAlliedSecondaryColor()Gets the allied secondary color, from core.yml.- Returns:
- The allied secondary color
-
getBarbarianPrimaryColor
String getBarbarianPrimaryColor()Gets the barbarian primary color, from core.yml.- Returns:
- The barbarian primary color
-
getBarbarianSecondaryColor
String getBarbarianSecondaryColor()Gets the barbarian secondary color, from core.yml.- Returns:
- The barbarian secondary color
-
getNeutralPrimaryColor
String getNeutralPrimaryColor()Gets the neutral primary color, from core.yml.- Returns:
- The neutral primary color
-
getNeutralSecondaryColor
String getNeutralSecondaryColor()Gets the neutral secondary color, from core.yml.- Returns:
- The neutral secondary color
-
getScoreboard
org.bukkit.scoreboard.Scoreboard getScoreboard()Gets the primary Konquest scoreboard with teams.- Returns:
- The primary scoreboard
-
validateNameConstraints
Checks for name conflicts and constraints against all Konquest names.- Parameters:
name
- The name of an object (town, ruin, etc)- Returns:
- Status code
0 - Success, no issue found
1 - Error, name is not strictly alphanumeric
2 - Error, name has more than 20 characters
3 - Error, name is an existing player
4 - Error, name is a kingdom
5 - Error, name is a town
6 - Error, name is a ruin
7 - Error, name is a guild [deprecated]
8 - Error, name is a sanctuary
9 - Error, name is a template
10 - Error, name is reserved word
-
getPlayerManager
KonquestPlayerManager getPlayerManager()Gets the player manager, for all things player related.- Returns:
- The player manager
-
getKingdomManager
KonquestKingdomManager getKingdomManager()Gets the kingdom manager, for all things kingdom/town related.- Returns:
- The kingdom manager
-
getTerritoryManager
KonquestTerritoryManager getTerritoryManager()Gets the territory manager, for all things land/territory related.- Returns:
- The territory manager
-
getCampManager
KonquestCampManager getCampManager()Gets the camp manager, for all things camp related.- Returns:
- The camp manager
-
getUpgradeManager
KonquestUpgradeManager getUpgradeManager()Gets the upgrade manager, for all things town upgrade related.- Returns:
- The upgrade manager
-
getShieldManager
KonquestShieldManager getShieldManager()Gets the shield manager, for all things town shield and armor related.- Returns:
- The shield manager
-
getRuinManager
KonquestRuinManager getRuinManager()Gets the ruin manager, for all things ruin related.- Returns:
- The ruin manager
-
getPlotManager
KonquestPlotManager getPlotManager()Gets the plot manager, for all things town plot related.- Returns:
- The ruin manager
-
isWorldValid
boolean isWorldValid(org.bukkit.Location loc) Checks if a location is in a valid world. Invalid worlds prevent some Konquest commands.- Parameters:
loc
- A location- Returns:
- True if the location is in a valid world, else false
-
isWorldValid
boolean isWorldValid(org.bukkit.World world) Checks if a world is valid. Invalid worlds prevent some Konquest commands.- Parameters:
world
- A world- Returns:
- True if the world is valid, else false
-
isWorldIgnored
boolean isWorldIgnored(org.bukkit.Location loc) Checks if a location is in an ignored world. Ignored worlds prevent most Konquest commands and features.- Parameters:
loc
- A location- Returns:
- True if the location is in an ignored world, else false
-
isWorldIgnored
boolean isWorldIgnored(org.bukkit.World world) Checks if a world is ignored. Ignored worlds prevent most Konquest commands and features.- Parameters:
world
- A world- Returns:
- True if the world is ignored, else false
-
getRandomWildLocation
org.bukkit.Location getRandomWildLocation(org.bukkit.World world) Gets a random location in the wild, constrained by radius and offset in Konquest's configuration.- Parameters:
world
- The world to generate the random location- Returns:
- A random location in the wild
-
getSafeRandomCenteredLocation
org.bukkit.Location getSafeRandomCenteredLocation(org.bukkit.Location center, int radius) Gets a random safe location in a surrounding chunk to the given center location. A safe location is one that should not kill the player. The resulting location will not be in the same chunk as the center location.- Parameters:
center
- The location to center the new location aroundradius
- The distance in blocks from the center to search for a random location- Returns:
- The safe random location
-
getDisplayPrimaryColor
Gets the primary display color based on relationships. This color is set in the Konquest configuration. There is a color for eachrelationship
.- Parameters:
displayKingdom
- The observing kingdom that should see the colorcontextKingdom
- The target kingdom whose relationship to the observer determines the color- Returns:
- The primary display color
-
getDisplayPrimaryColor
String getDisplayPrimaryColor(KonquestOfflinePlayer displayPlayer, KonquestOfflinePlayer contextPlayer) Gets the primary display color based on relationships. This color is set in the Konquest configuration. There is a color for eachrelationship
.- Parameters:
displayPlayer
- The observing player who should see the colorcontextPlayer
- The target player whose relationship to the observer determines the color- Returns:
- The primary display color
-
getDisplayPrimaryColor
String getDisplayPrimaryColor(KonquestOfflinePlayer displayPlayer, KonquestTerritory contextTerritory) Gets the primary display color based on relationships. This color is set in the Konquest configuration. There is a color for eachrelationship
.- Parameters:
displayPlayer
- The observing player who should see the colorcontextTerritory
- The target town whose relationship to the observer determines the color- Returns:
- The primary display color
-
getDisplaySecondaryColor
Gets the secondary display color based on relationships. This color is set in the Konquest configuration. There is a color for eachrelationship
.- Parameters:
displayKingdom
- The observing kingdom that should see the colorcontextKingdom
- The target kingdom whose relationship to the observer determines the color- Returns:
- The secondary display color
-
getDisplaySecondaryColor
String getDisplaySecondaryColor(KonquestOfflinePlayer displayPlayer, KonquestOfflinePlayer contextPlayer) Gets the secondary display color based on relationships. This color is set in the Konquest configuration. There is a color for eachrelationship
.- Parameters:
displayPlayer
- The observing player who should see the colorcontextPlayer
- The target player whose relationship to the observer determines the color- Returns:
- The secondary display color
-
getDisplaySecondaryColor
String getDisplaySecondaryColor(KonquestOfflinePlayer displayPlayer, KonquestTerritory contextTerritory) Gets the secondary display color based on relationships. This color is set in the Konquest configuration. There is a color for eachrelationship
.- Parameters:
displayPlayer
- The observing player who should see the colorcontextTerritory
- The target town whose relationship to the observer determines the color- Returns:
- The secondary display color
-
toPoint
Utility method to convert a location to a point representation of the chunk that contains the location. The point's "x" field is the chunk's X coordinate, and the point's "y" field is the chunk's Z coordinate. Note that the point does not preserve the World of the location, so keep track of that separately.- Parameters:
loc
- The location to convert into a point- Returns:
- A point representing the chunk containing the location
-