use of com.sk89q.worldguard.config.ConfigurationManager in project WorldGuard by EngineHub.
the class RegionContainer method autoMigrate.
/**
* Execute auto-migration.
*/
protected void autoMigrate() {
ConfigurationManager config = WorldGuard.getInstance().getPlatform().getGlobalStateManager();
if (config.migrateRegionsToUuid) {
RegionDriver driver = getDriver();
UUIDMigration migrator = new UUIDMigration(driver, WorldGuard.getInstance().getProfileService(), WorldGuard.getInstance().getFlagRegistry());
migrator.setKeepUnresolvedNames(config.keepUnresolvedNames);
try {
migrate(migrator);
WorldGuard.logger.info("Regions saved after UUID migration! This won't happen again unless " + "you change the relevant configuration option in WorldGuard's config.");
config.disableUuidMigration();
} catch (MigrationException e) {
WorldGuard.logger.log(Level.WARNING, "Failed to execute the migration", e);
}
}
}
use of com.sk89q.worldguard.config.ConfigurationManager in project WorldGuard by EngineHub.
the class RegionContainer method initialize.
/**
* Initialize the region container.
*/
public void initialize() {
ConfigurationManager config = WorldGuard.getInstance().getPlatform().getGlobalStateManager();
container = new RegionContainerImpl(config.selectedRegionStoreDriver, WorldGuard.getInstance().getFlagRegistry());
loadWorlds();
// Migrate to UUIDs
autoMigrate();
}
use of com.sk89q.worldguard.config.ConfigurationManager in project WorldGuard by EngineHub.
the class Session method initialize.
/**
* Initialize the session.
*
* @param player The player
*/
public void initialize(LocalPlayer player) {
RegionQuery query = WorldGuard.getInstance().getPlatform().getRegionContainer().createQuery();
Location location = player.getLocation();
ApplicableRegionSet set = query.getApplicableRegions(location);
lastValid = location;
lastRegionSet = set.getRegions();
ConfigurationManager cfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager();
disableBypass = cfg.disableDefaultBypass;
if (cfg.announceBypassStatus && player.hasPermission("worldguard.region.toggle-bypass")) {
player.printInfo(TextComponent.of("You are " + (disableBypass ? "not" : "") + " bypassing region protection. " + "You can toggle this with /rg bypass", TextColor.DARK_PURPLE));
}
for (Handler handler : handlers.values()) {
handler.initialize(player, location, set);
}
}
use of com.sk89q.worldguard.config.ConfigurationManager in project WorldGuard by EngineHub.
the class WorldGuardBlockListener method onBlockExplode.
@EventHandler(ignoreCancelled = true)
public void onBlockExplode(BlockExplodeEvent event) {
ConfigurationManager cfg = getConfig();
if (cfg.activityHaltToggle) {
event.setCancelled(true);
return;
}
WorldConfiguration wcfg = getWorldConfig(event.getBlock().getWorld());
if (wcfg.blockOtherExplosions) {
event.setCancelled(true);
}
}
use of com.sk89q.worldguard.config.ConfigurationManager in project WorldGuard by EngineHub.
the class WorldGuardBlockListener method onLeavesDecay.
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onLeavesDecay(LeavesDecayEvent event) {
ConfigurationManager cfg = getConfig();
if (cfg.activityHaltToggle) {
event.setCancelled(true);
return;
}
WorldConfiguration wcfg = getWorldConfig(event.getBlock().getWorld());
if (wcfg.disableLeafDecay) {
event.setCancelled(true);
return;
}
if (wcfg.useRegions) {
if (!StateFlag.test(WorldGuard.getInstance().getPlatform().getRegionContainer().createQuery().queryState(BukkitAdapter.adapt(event.getBlock().getLocation()), (RegionAssociable) null, Flags.LEAF_DECAY))) {
event.setCancelled(true);
}
}
}
Aggregations