square-fullZone API

Overview

The Zone API provides a clean interface for external plugins to interact with PhantomDungeons dungeon zone system. Access zone configurations, manage stages, query mob data, and integrate with the dungeon progression system.

circle-info

Zones are the core progression system - players advance through zones and stages, fighting increasingly difficult mobs.

Getting Started

1

Get the API Instance

In your plugin's onEnable, grab the API instance.

import me.fergs.phantomdungeons.modules.zone.api.ZoneAPI;

// Get the singleton instance
ZoneAPI zoneAPI = ZoneAPI.get();
circle-exclamation
2

Cache for Performance

Store it in your main plugin class.

public class MyPlugin extends JavaPlugin {
    private ZoneAPI zoneAPI;
    
    @Override
    public void onEnable() {
        try {
            this.zoneAPI = ZoneAPI.get();
        } catch (IllegalStateException e) {
            getLogger().warning("PhantomDungeons not loaded!");
        }
    }
}
3

Safe Null Checks

Always check availability before using.

if (zoneAPI == null) {
    getLogger().warning("Zone API not available!");
    return;
}

Zone Operations

Getting Zone Data

Retrieve zone configurations and information.

// Get zone by ID
ZoneConfigurationModel zone = zoneAPI.getZone("barn-zone");

if (zone != null) {
    player.sendMessage("§7Zone: §a" + zone.getZoneId());
    player.sendMessage("§7World: §e" + zone.getWorld());
    player.sendMessage("§7Max Mobs: §c" + zone.getMaxMobs());
    player.sendMessage("§7Respawn Time: §b" + zone.getMobRespawnTime() + "s");
}

// Check if zone exists
if (zoneAPI.zoneExists("barn-zone")) {
    player.sendMessage("§aZone found!");
}

Getting All Zones

Access all loaded zones.

circle-check

Zone Count

Get total number of zones.

Stage Operations

Stages represent difficulty tiers within zones. Each stage has different mobs, spawn rates, and rewards.

Getting Stage Data

Getting All Stages for Zone

Stage Counts and Limits

Mob Operations

Getting Mob Data

Getting All Mobs

AFK Mobs

AFK mobs are special mobs that spawn when players are idle.

Total Mob Count

Frequently Asked Questions

chevron-rightWhat's the difference between zones and stages?hashtag

Zones are large dungeon areas with physical boundaries in the world. Stages are difficulty tiers within a zone - think of them as "levels" within a dungeon. Players progress through stages within a zone before moving to the next zone.

Example: Barn Zone might have 5 stages, each with progressively harder chickens and cows.

chevron-rightHow are mob spawn locations determined?hashtag

Spawn locations are defined in the zone configuration file using the selection wand (/dungeonsadmin zone locationwand). Administrators mark spawn points, and mobs randomly spawn at these locations.

chevron-rightCan zones overlap?hashtag

No. Zones have defined boundaries (minPos/maxPos) and should not overlap. Each zone represents a distinct dungeon area.

chevron-rightCan I create zones programmatically?hashtag

The Zone API is read-only for external plugins. Zones must be configured via YAML files and admin commands. This ensures consistency and prevents conflicts.

chevron-rightHow do I get player's current zone and stage?hashtag

Use the Player Manager API to access player dungeon data:

PlayerDungeonData data = playerManager.getPlayerData(player);String currentZone = data.getCurrentZone();int currentStage = data.getCurrentStage();

chevron-rightAre mob rewards dynamic?hashtag

Yes! Mob rewards support PlaceholderAPI and math expressions. Rewards can scale based on player levels, multipliers, boosters, and more. Each reward has requirements and chance percentages.

chevron-rightCan I listen for zone events?hashtag

While the Zone API doesn't provide events directly, you can use Bukkit's PlayerMoveEvent and check if players enter/exit zone boundaries using the zone's minPos and maxPos.

sack-dollarEconomy APIchevron-rightbottle-waterBoosters APIchevron-rightcodepenEnchants APIchevron-rightrectangle-terminalLevelling APIchevron-rightswordSword APIchevron-right

Last updated