Search in sources :

Example 1 with BlockVector3

use of com.sk89q.worldedit.math.BlockVector3 in project EliteMobs by MagmaGuy.

the class WorldGuardCompatibility method defineMinidungeon.

/**
 * Automatically creates a worldguard region protected as an EliteMobs minidungeon using two x y z vectors for the
 * locations of the diagonally opposed locations
 *
 * @param corner1
 * @param corner2
 */
public static void defineMinidungeon(Location corner1, Location corner2, Location anchorLocation, String schematicName, Minidungeon minidungeon) {
    try {
        RegionContainer regionContainer = WorldGuard.getInstance().getPlatform().getRegionContainer();
        RegionManager regionManager = regionContainer.get(BukkitAdapter.adapt(anchorLocation.getWorld()));
        BlockVector3 min = BlockVector3.at(corner1.getBlockX(), corner1.getBlockY(), corner1.getBlockZ());
        BlockVector3 max = BlockVector3.at(corner2.getBlockX(), corner2.getBlockY(), corner2.getBlockZ());
        ProtectedRegion region = new ProtectedCuboidRegion(schematicName.replace(".schem", ""), min, max);
        protectMinidungeonArea(region, minidungeon);
        regionManager.addRegion(region);
    } catch (Exception ex) {
        new WarningMessage("Failed to add Minidungeon WorldGuard zone!");
    }
}
Also used : WarningMessage(com.magmaguy.elitemobs.utils.WarningMessage) RegionContainer(com.sk89q.worldguard.protection.regions.RegionContainer) ProtectedRegion(com.sk89q.worldguard.protection.regions.ProtectedRegion) GlobalProtectedRegion(com.sk89q.worldguard.protection.regions.GlobalProtectedRegion) RegionManager(com.sk89q.worldguard.protection.managers.RegionManager) ProtectedCuboidRegion(com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion) BlockVector3(com.sk89q.worldedit.math.BlockVector3) FlagConflictException(com.sk89q.worldguard.protection.flags.registry.FlagConflictException)

Aggregations

WarningMessage (com.magmaguy.elitemobs.utils.WarningMessage)1 BlockVector3 (com.sk89q.worldedit.math.BlockVector3)1 FlagConflictException (com.sk89q.worldguard.protection.flags.registry.FlagConflictException)1 RegionManager (com.sk89q.worldguard.protection.managers.RegionManager)1 GlobalProtectedRegion (com.sk89q.worldguard.protection.regions.GlobalProtectedRegion)1 ProtectedCuboidRegion (com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion)1 ProtectedRegion (com.sk89q.worldguard.protection.regions.ProtectedRegion)1 RegionContainer (com.sk89q.worldguard.protection.regions.RegionContainer)1