mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-11-27 13:07:29 +01:00
Better handle disabling of the regions feature.
This commit is contained in:
parent
b43bc4a57a
commit
88c0bdfffb
@ -182,6 +182,11 @@ public void reload() {
|
||||
private RegionManager load(World world) {
|
||||
checkNotNull(world);
|
||||
|
||||
WorldConfiguration config = plugin.getGlobalStateManager().get(world);
|
||||
if (!config.useRegions) {
|
||||
return null;
|
||||
}
|
||||
|
||||
RegionManager manager;
|
||||
|
||||
synchronized (lock) {
|
||||
|
@ -247,9 +247,16 @@ protected static void checkRegionDoesNotExist(RegionManager manager, String id,
|
||||
* @throws CommandException thrown if the manager is null
|
||||
*/
|
||||
protected static RegionManager checkRegionManager(WorldGuardPlugin plugin, World world) throws CommandException {
|
||||
if (!plugin.getGlobalStateManager().get(world).useRegions) {
|
||||
throw new CommandException("Region support is disabled in the target world. " +
|
||||
"It can be enabled per-world in WorldGuard's configuration files. " +
|
||||
"However, you may need to restart your server afterwards.");
|
||||
}
|
||||
|
||||
RegionManager manager = plugin.getRegionContainer().get(world);
|
||||
if (manager == null) {
|
||||
throw new CommandException("Either region support is disabled or region data failed to load in the target world.");
|
||||
throw new CommandException("Region data failed to load for this world. " +
|
||||
"Please ask a server administrator to read the logs to identify the reason.");
|
||||
}
|
||||
return manager;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user