Zones API
The EdToolsZonesAPI
manages player sessions in instanced zones, such as private mines or farms.
Get API Instance
EdToolsZonesAPI zonesAPI = EdToolsAPI.getInstance().getZonesAPI();
Methods
joinGlobalSession(Player player, String zoneId)
joinGlobalSession(Player player, String zoneId)
Adds a player to a shared, global session for a specific zone. All players in a global session for the same zone see each other.
player
: The player to add.zoneId
: The ID of the zone to join.
joinAloneSession(Player player, String zoneId)
joinAloneSession(Player player, String zoneId)
Adds a player to a private, instanced session for a zone. The player will be alone in their version of the zone.
player
: The player to add.zoneId
: The ID of the zone to join.
leaveSession(Player player)
leaveSession(Player player)
Removes a player from their current zone session, teleporting them back to their original location.
player
: The player to remove from a session.
isPlayerInSession(Player player)
isPlayerInSession(Player player)
Checks if a player is currently in any zone session.
player
: The player to check.Returns:
true
if the player is in a session,false
otherwise.
getPlayerZoneId(Player player)
getPlayerZoneId(Player player)
Gets the player zone ID. Returns null if player is in no zone.
player
: The player to check.Returns: The zone id where the player is.
null
if player is in no zone
getPlayerZoneSessionType(Player player)
getPlayerZoneSessionType(Player player)
Gets the player zone session type. It can be 'alone' or 'global'. Null if player is in no zone
player
: The player to check.Returns: The zone session type where the player is.
null
if player is in no zone
setPlayerBlocksTypeZone(Player player, String zoneId, String blocksType)
setPlayerBlocksTypeZone(Player player, String zoneId, String blocksType)
Sets the type of blocks that should regenerate in a zone for a specific player. This is useful for zones with multiple block options (e.g., different ores).
player
: The player.zoneId
: The ID of the zone.blocksType
: The key/ID of the block type (from zone config).
getPlayerBlocksTypeZone(Player player, String zoneId)
getPlayerBlocksTypeZone(Player player, String zoneId)
Retrieves the currently selected block type for a player in a specific zone.
player
: The player.zoneId
: The ID of the zone.Returns: A
String
identifying the selected block type.
getPlayerLoadedBlocks(Player player)
getPlayerLoadedBlocks(Player player)
Retrieves the currently loaded blocks in the current player session. Returns null
if player is in no session.
player
: The player.Returns: A
Map<Vector, Material>
representing each position with its material. Returnsnull
if player isn't in any session.
mineBlockAsPlayer(Player player, Vector position, String toolId, boolean affectEnchants, boolean affectSell, boolean affectBlockCurrencies, boolean affectLuckyBlocks)
mineBlockAsPlayer(Player player, Vector position, String toolId, boolean affectEnchants, boolean affectSell, boolean affectBlockCurrencies, boolean affectLuckyBlocks)
Retrieves the currently loaded blocks in the current player session. Returns null
if player is in no session.
player
: The player.position
: The zone session position. Must be a valid position.tooldId
: The tool of the player that will be used to mine the block.affectEnchants
: If it will affect the tool enchants.affectSell
: If it will affect the sell implementation. (if true it will add the item to the backpack or autosell it depending on the player's permissions)affectBlockCurrencies
: If it will add block currencies.affectLuckyBlocks
: If it will increment lucky blocks progress.Returns: A
APIPair<Material, String>
. The first value represents the material broken and the second value represents the item id ofitem-prices.yml
to be sold
Last updated
Was this helpful?