use of com.sk89q.worldguard.protection.flags.registry.FlagRegistry in project EliteMobs by MagmaGuy.
the class WorldGuardCompatibility method initialize.
public static boolean initialize() {
// Enable WorldGuard
if (Bukkit.getPluginManager().getPlugin("WorldGuard") == null)
return false;
Bukkit.getLogger().info("[EliteMobs] WorldGuard detected.");
FlagRegistry registry = null;
try {
registry = WorldGuard.getInstance().getFlagRegistry();
} catch (Exception ex) {
new WarningMessage("Something went wrong while loading WorldGuard. Are you using the right WorldGuard version?");
return false;
}
Bukkit.getLogger().info("[EliteMobs] Enabling flags:");
try {
ELITEMOBS_SPAWN_FLAG = new StateFlag("elitemob-spawning", true);
registry.register(ELITEMOBS_SPAWN_FLAG);
Bukkit.getLogger().info("[EliteMobs] - elitemob-spawning");
} catch (FlagConflictException | IllegalStateException e) {
Bukkit.getLogger().warning("[EliteMobs] Warning: flag elitemob-spawning already exists! This is normal if you've just now reloaded EliteMobs.");
ELITEMOBS_SPAWN_FLAG = (StateFlag) registry.get("elitemob-spawning");
}
try {
ELITEMOBS_ONLY_SPAWN_FLAG = new StateFlag("elitemob-only-spawning", false);
registry.register(ELITEMOBS_ONLY_SPAWN_FLAG);
Bukkit.getLogger().info("[EliteMobs] - elitemob-only-spawning");
} catch (FlagConflictException | IllegalStateException e) {
Bukkit.getLogger().warning("[EliteMobs] Warning: flag elitemob-only-spawning already exists! This is normal if you've just now reloaded EliteMobs.");
ELITEMOBS_ONLY_SPAWN_FLAG = (StateFlag) registry.get("elitemob-only-spawning");
}
try {
ELITEMOBS_ANTIEXPLOIT = new StateFlag("elitemobs-antiexploit", true);
registry.register(ELITEMOBS_ANTIEXPLOIT);
Bukkit.getLogger().info("[EliteMobs] - elitemobs-antiexploit");
} catch (FlagConflictException | IllegalStateException e) {
Bukkit.getLogger().warning("[EliteMobs] Warning: flag elitemob-antiexploit already exists! This is normal if you've just now reloaded EliteMobs.");
ELITEMOBS_ANTIEXPLOIT = (StateFlag) registry.get("elitemobs-antiexploit");
}
try {
ELITEMOBS_DUNGEON = new StateFlag("elitemobs-dungeon", false);
registry.register(ELITEMOBS_DUNGEON);
Bukkit.getLogger().info("[EliteMobs] - elitemobs-dungeon");
} catch (FlagConflictException | IllegalStateException e) {
Bukkit.getLogger().warning("[EliteMobs] Warning: flag elitemob-dungeon already exists! This is normal if you've just now reloaded EliteMobs.");
ELITEMOBS_DUNGEON = (StateFlag) registry.get("elitemobs-dungeon");
}
try {
ELITEMOBS_EVENTS = new StateFlag("elitemobs-events", true);
registry.register(ELITEMOBS_EVENTS);
Bukkit.getLogger().info("[EliteMobs] - elitemobs-events");
} catch (FlagConflictException | IllegalStateException e) {
Bukkit.getLogger().warning("[EliteMobs] Warning: flag elitemob-events already exists! This is normal if you've just now reloaded EliteMobs.");
ELITEMOBS_EVENTS = (StateFlag) registry.get("elitemobs-events");
}
try {
ELITEMOBS_MINIMUM_LEVEL = new IntegerFlag("elitemobs-minimum-level");
registry.register(ELITEMOBS_MINIMUM_LEVEL);
Bukkit.getLogger().info("[EliteMobs] - elitemobs-minimum-level");
} catch (FlagConflictException | IllegalStateException e) {
Bukkit.getLogger().warning("[EliteMobs] Warning: flag elitemob-minimum-level already exists! This is normal if you've just now reloaded EliteMobs.");
ELITEMOBS_MINIMUM_LEVEL = (IntegerFlag) registry.get("elitemobs-minimum-level");
}
try {
ELITEMOBS_MAXIMUM_LEVEL = new IntegerFlag("elitemobs-maximum-level");
registry.register(ELITEMOBS_MAXIMUM_LEVEL);
Bukkit.getLogger().info("[EliteMobs] - elitemobs-maximum-level");
} catch (FlagConflictException | IllegalStateException e) {
Bukkit.getLogger().warning("[EliteMobs] Warning: flag elitemob-maximum-level already exists! This is normal if you've just now reloaded EliteMobs.");
ELITEMOBS_MAXIMUM_LEVEL = (IntegerFlag) registry.get("elitemobs-maximum-level");
}
try {
ELITEMOBS_EXPLOSION_REGEN = new StateFlag("elitemobs-explosion-regen", true);
registry.register(ELITEMOBS_EXPLOSION_REGEN);
Bukkit.getLogger().info("[EliteMobs] - elitemobs-explosion-regen");
} catch (FlagConflictException | IllegalStateException e) {
Bukkit.getLogger().warning("[EliteMobs] Warning: flag elitemob-explosion-regen already exists! This is normal if you've just now reloaded EliteMobs.");
ELITEMOBS_EXPLOSION_REGEN = (StateFlag) registry.get("elitemobs-explosion-regen");
}
return true;
}
Aggregations