Search in sources :

Example 1 with GlobalProtectedRegion

use of com.sk89q.worldguard.protection.regions.GlobalProtectedRegion in project EliteMobs by MagmaGuy.

the class WorldGuardCompatibility method protectWorldMinidugeonArea.

public static void protectWorldMinidugeonArea(Location location, Minidungeon minidungeon) {
    try {
        RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
        RegionManager regions = container.get(BukkitAdapter.adapt(location.getWorld()));
        ProtectedRegion global = regions.getRegion("__global__");
        if (global == null) {
            // But we want a __global__, so let's create one
            global = new GlobalProtectedRegion("__global__");
            regions.addRegion(global);
        }
        protectMinidungeonArea(global, minidungeon);
        DefaultDomain members = global.getMembers();
        members.addPlayer(UUID.fromString("198c4123-cafc-45df-ba79-02a421eb8ce7"));
        global.setOwners(members);
    } catch (Exception ex) {
        new WarningMessage("Failed to protect minidungeon world area!");
    }
}
Also used : WarningMessage(com.magmaguy.elitemobs.utils.WarningMessage) GlobalProtectedRegion(com.sk89q.worldguard.protection.regions.GlobalProtectedRegion) 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) DefaultDomain(com.sk89q.worldguard.domains.DefaultDomain) FlagConflictException(com.sk89q.worldguard.protection.flags.registry.FlagConflictException)

Example 2 with GlobalProtectedRegion

use of com.sk89q.worldguard.protection.regions.GlobalProtectedRegion in project EliteMobs by MagmaGuy.

the class WorldGuardCompatibility method protectWorldMinidugeonArea.

public static void protectWorldMinidugeonArea(Location location) {
    try {
        RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
        RegionManager regions = container.get(BukkitAdapter.adapt(location.getWorld()));
        ProtectedRegion global = regions.getRegion("__global__");
        if (global == null) {
            // But we want a __global__, so let's create one
            global = new GlobalProtectedRegion("__global__");
            regions.addRegion(global);
        }
        protectMinidungeonArea(global);
        DefaultDomain members = global.getMembers();
        members.addPlayer(UUID.fromString("198c4123-cafc-45df-ba79-02a421eb8ce7"));
        global.setOwners(members);
    } catch (Exception ex) {
        new WarningMessage("Failed to protect minidungeon world area!");
    }
}
Also used : WarningMessage(com.magmaguy.elitemobs.utils.WarningMessage) GlobalProtectedRegion(com.sk89q.worldguard.protection.regions.GlobalProtectedRegion) 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) DefaultDomain(com.sk89q.worldguard.domains.DefaultDomain) FlagConflictException(com.sk89q.worldguard.protection.flags.registry.FlagConflictException)

Aggregations

WarningMessage (com.magmaguy.elitemobs.utils.WarningMessage)2 DefaultDomain (com.sk89q.worldguard.domains.DefaultDomain)2 FlagConflictException (com.sk89q.worldguard.protection.flags.registry.FlagConflictException)2 RegionManager (com.sk89q.worldguard.protection.managers.RegionManager)2 GlobalProtectedRegion (com.sk89q.worldguard.protection.regions.GlobalProtectedRegion)2 ProtectedRegion (com.sk89q.worldguard.protection.regions.ProtectedRegion)2 RegionContainer (com.sk89q.worldguard.protection.regions.RegionContainer)2