mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-11-15 07:05:32 +01:00
Minor cleanup.
This commit is contained in:
parent
024a51549d
commit
ec4c53da77
@ -33,12 +33,10 @@
|
||||
import com.sk89q.squirrelid.resolver.CombinedProfileService;
|
||||
import com.sk89q.squirrelid.resolver.HttpRepositoryService;
|
||||
import com.sk89q.squirrelid.resolver.ProfileService;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.util.task.SimpleSupervisor;
|
||||
import com.sk89q.worldedit.util.task.Supervisor;
|
||||
import com.sk89q.worldedit.util.task.Task;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldguard.internal.platform.WorldGuardPlatform;
|
||||
import com.sk89q.worldguard.protection.flags.Flags;
|
||||
import com.sk89q.worldguard.protection.flags.registry.FlagRegistry;
|
||||
@ -54,7 +52,7 @@
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class WorldGuard {
|
||||
public final class WorldGuard {
|
||||
|
||||
public static final Logger logger = Logger.getLogger(WorldGuard.class.getCanonicalName());
|
||||
|
||||
@ -89,7 +87,7 @@ public void setup() {
|
||||
try {
|
||||
profileCache = new SQLiteCache(new File(cacheDir, "profiles.sqlite"));
|
||||
} catch (IOException e) {
|
||||
WorldGuard.logger.log(Level.WARNING, "Failed to initialize SQLite profile cache");
|
||||
logger.log(Level.WARNING, "Failed to initialize SQLite profile cache");
|
||||
profileCache = new HashMapCache();
|
||||
}
|
||||
|
||||
@ -194,7 +192,7 @@ public void disable() {
|
||||
executorService.shutdown();
|
||||
|
||||
try {
|
||||
WorldGuard.logger.log(Level.INFO, "Shutting down executor and waiting for any pending tasks...");
|
||||
logger.log(Level.INFO, "Shutting down executor and waiting for any pending tasks...");
|
||||
|
||||
List<Task<?>> tasks = supervisor.getTasks();
|
||||
if (!tasks.isEmpty()) {
|
||||
@ -203,7 +201,7 @@ public void disable() {
|
||||
builder.append("\n");
|
||||
builder.append(task.getName());
|
||||
}
|
||||
WorldGuard.logger.log(Level.INFO, builder.toString());
|
||||
logger.log(Level.INFO, builder.toString());
|
||||
}
|
||||
|
||||
Futures.successfulAsList(tasks).get();
|
||||
@ -211,7 +209,7 @@ public void disable() {
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
} catch (ExecutionException e) {
|
||||
WorldGuard.logger.log(Level.WARNING, "Some tasks failed while waiting for remaining tasks to finish", e);
|
||||
logger.log(Level.WARNING, "Some tasks failed while waiting for remaining tasks to finish", e);
|
||||
}
|
||||
|
||||
platform.unload();
|
||||
|
@ -388,16 +388,10 @@ public void info(CommandContext args, Actor sender) throws CommandException {
|
||||
WorldGuard.getInstance().getExecutorService().submit(printout),
|
||||
CommandUtils.messageComponentFunction(sender)::apply);
|
||||
|
||||
// If it takes too long...
|
||||
FutureProgressListener.addProgressListener(
|
||||
future, sender, "(Please wait... fetching region information...)");
|
||||
|
||||
// Send a response message
|
||||
Futures.addCallback(future,
|
||||
new Builder(sender)
|
||||
.exceptionConverter(worldGuard.getExceptionConverter())
|
||||
.onFailure("Failed to fetch region information")
|
||||
.build());
|
||||
AsyncCommandHelper.wrap(future, WorldGuard.getInstance().getSupervisor(), sender, WorldGuard.getInstance().getExceptionConverter())
|
||||
.registerWithSupervisor("Fetching region info")
|
||||
.sendMessageAfterDelay("(Please wait... fetching region information...)")
|
||||
.thenTellErrorsOnly("Failed to fetch region information");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -62,8 +62,6 @@ public class BukkitWorldConfiguration extends YamlWorldConfiguration {
|
||||
|
||||
private static final TargetMatcherParser matcherParser = new TargetMatcherParser();
|
||||
|
||||
@Unreported private WorldGuardPlugin plugin;
|
||||
|
||||
@Unreported private String worldName;
|
||||
|
||||
@Unreported private ChestProtection chestProtection = new BukkitSignChestProtection();
|
||||
@ -86,7 +84,6 @@ public BukkitWorldConfiguration(WorldGuardPlugin plugin, String worldName, YAMLP
|
||||
File configFile = new File(baseFolder, "config.yml");
|
||||
blacklistFile = new File(baseFolder, "blacklist.txt");
|
||||
|
||||
this.plugin = plugin;
|
||||
this.worldName = worldName;
|
||||
this.parentConfig = parentConfig;
|
||||
|
||||
@ -105,7 +102,7 @@ private TargetMatcherSet getTargetMatchers(String node) {
|
||||
TargetMatcherSet set = new TargetMatcherSet();
|
||||
List<String> inputs = parentConfig.getStringList(node, null);
|
||||
|
||||
if (inputs == null || inputs.size() == 0) {
|
||||
if (inputs == null || inputs.isEmpty()) {
|
||||
parentConfig.setProperty(node, new ArrayList<String>());
|
||||
return set;
|
||||
}
|
||||
@ -129,8 +126,7 @@ public void loadConfiguration() {
|
||||
try {
|
||||
config.load();
|
||||
} catch (IOException e) {
|
||||
log.severe("Error reading configuration for world " + worldName + ": ");
|
||||
e.printStackTrace();
|
||||
log.log(Level.SEVERE, "Error reading configuration for world " + worldName + ": ", e);
|
||||
} catch (ParserException e) {
|
||||
log.severe("Error parsing configuration for world " + worldName + ". ");
|
||||
throw e;
|
||||
@ -369,7 +365,7 @@ public void loadConfiguration() {
|
||||
if (disableFireSpread) {
|
||||
log.log(Level.INFO, "(" + worldName + ") All fire spread is disabled.");
|
||||
} else {
|
||||
if (disableFireSpreadBlocks.size() > 0) {
|
||||
if (!disableFireSpreadBlocks.isEmpty()) {
|
||||
log.log(Level.INFO, "(" + worldName
|
||||
+ ") Fire spread is limited to "
|
||||
+ disableFireSpreadBlocks.size() + " block types.");
|
||||
|
Loading…
Reference in New Issue
Block a user