mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2024-11-22 10:36:06 +01:00
Optimized some log messages and change some Level.INFO messages to Level.CONFIG for the new silent start mode. Fixes #697.
This commit is contained in:
parent
aedbfd7bab
commit
b033d59b8a
@ -7,6 +7,7 @@
|
||||
|
||||
package com.onarandombox.MultiverseCore;
|
||||
|
||||
import com.dumptruckman.minecraft.util.Logging;
|
||||
import com.onarandombox.MultiverseCore.api.BlockSafety;
|
||||
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
|
||||
import com.onarandombox.MultiverseCore.api.SafeTTeleporter;
|
||||
@ -631,16 +632,16 @@ public class MVWorld extends SerializationConfig implements MultiverseWorld {
|
||||
// Not sure how it will work in the nether...
|
||||
//Location newSpawn = this.spawnLocation.getWorld().getHighestBlockAt(this.spawnLocation).getLocation();
|
||||
if (newSpawn != null) {
|
||||
this.plugin.log(Level.INFO, String.format("New Spawn for '%s' is located at: %s",
|
||||
this.getName(), plugin.getLocationManipulation().locationToString(newSpawn)));
|
||||
Logging.info("New Spawn for '%s' is located at: %s",
|
||||
this.getName(), plugin.getLocationManipulation().locationToString(newSpawn));
|
||||
return newSpawn;
|
||||
} else {
|
||||
// If it's a standard end world, let's check in a better place:
|
||||
Location newerSpawn;
|
||||
newerSpawn = bs.getTopBlock(new Location(w, 0, 0, 0));
|
||||
if (newerSpawn != null) {
|
||||
this.plugin.log(Level.INFO, String.format("New Spawn for '%s' is located at: %s",
|
||||
this.getName(), plugin.getLocationManipulation().locationToString(newerSpawn)));
|
||||
Logging.info("New Spawn for '%s' is located at: %s",
|
||||
this.getName(), plugin.getLocationManipulation().locationToString(newerSpawn));
|
||||
return newerSpawn;
|
||||
} else {
|
||||
this.plugin.log(Level.SEVERE, "Safe spawn NOT found!!!");
|
||||
|
@ -47,6 +47,7 @@ import com.onarandombox.MultiverseCore.commands.ReloadCommand;
|
||||
import com.onarandombox.MultiverseCore.commands.RemoveCommand;
|
||||
import com.onarandombox.MultiverseCore.commands.ScriptCommand;
|
||||
import com.onarandombox.MultiverseCore.commands.SetSpawnCommand;
|
||||
import com.onarandombox.MultiverseCore.commands.SilentCommand;
|
||||
import com.onarandombox.MultiverseCore.commands.SpawnCommand;
|
||||
import com.onarandombox.MultiverseCore.commands.TeleportCommand;
|
||||
import com.onarandombox.MultiverseCore.commands.UnloadCommand;
|
||||
@ -274,8 +275,6 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core, Listen
|
||||
public void onEnable() {
|
||||
this.messaging = new MVMessaging();
|
||||
this.banker = new AllPay(this, LOG_TAG + " ");
|
||||
// Output a little snippet to show it's enabled.
|
||||
this.log(Level.INFO, "- Version " + this.getDescription().getVersion() + " (API v" + PROTOCOL + ") Enabled - By " + getAuthors());
|
||||
// Load the defaultWorldGenerators
|
||||
this.worldManager.getDefaultWorldGenerators();
|
||||
|
||||
@ -304,9 +303,10 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core, Listen
|
||||
// Setup & Load our Configuration files.
|
||||
loadConfigs();
|
||||
if (this.multiverseConfig != null) {
|
||||
Logging.setDebugLevel(getMVConfig().getGlobalDebug());
|
||||
Logging.setShowingConfig(!getMVConfig().getSilentStart());
|
||||
this.worldManager.loadDefaultWorlds();
|
||||
this.worldManager.loadWorlds(true);
|
||||
Logging.setDebugLevel(getMVConfig().getGlobalDebug());
|
||||
} else {
|
||||
this.log(Level.SEVERE, "Your configs were not loaded. Very little will function in Multiverse.");
|
||||
}
|
||||
@ -345,6 +345,9 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core, Listen
|
||||
// Listen out for vault.
|
||||
getServer().getPluginManager().registerEvents(this, this);
|
||||
this.setupVaultEconomy();
|
||||
|
||||
// Output a little snippet to show it's enabled.
|
||||
Logging.config("Version %s (API v%s) Enabled - By %s", this.getDescription().getVersion(), PROTOCOL, getAuthors());
|
||||
}
|
||||
|
||||
private boolean setupVaultEconomy() {
|
||||
@ -545,47 +548,47 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core, Listen
|
||||
*/
|
||||
private void migrate22Values() {
|
||||
if (this.multiverseConfig.isSet("worldnameprefix")) {
|
||||
this.log(Level.INFO, "Migrating 'worldnameprefix'...");
|
||||
Logging.config("Migrating 'worldnameprefix'...");
|
||||
this.getMVConfig().setPrefixChat(this.multiverseConfig.getBoolean("worldnameprefix"));
|
||||
this.multiverseConfig.set("worldnameprefix", null);
|
||||
}
|
||||
if (this.multiverseConfig.isSet("firstspawnworld")) {
|
||||
this.log(Level.INFO, "Migrating 'firstspawnworld'...");
|
||||
Logging.config("Migrating 'firstspawnworld'...");
|
||||
this.getMVConfig().setFirstSpawnWorld(this.multiverseConfig.getString("firstspawnworld"));
|
||||
this.multiverseConfig.set("firstspawnworld", null);
|
||||
}
|
||||
if (this.multiverseConfig.isSet("enforceaccess")) {
|
||||
this.log(Level.INFO, "Migrating 'enforceaccess'...");
|
||||
Logging.config("Migrating 'enforceaccess'...");
|
||||
this.getMVConfig().setEnforceAccess(this.multiverseConfig.getBoolean("enforceaccess"));
|
||||
this.multiverseConfig.set("enforceaccess", null);
|
||||
}
|
||||
if (this.multiverseConfig.isSet("displaypermerrors")) {
|
||||
this.log(Level.INFO, "Migrating 'displaypermerrors'...");
|
||||
Logging.config("Migrating 'displaypermerrors'...");
|
||||
this.getMVConfig().setDisplayPermErrors(this.multiverseConfig.getBoolean("displaypermerrors"));
|
||||
this.multiverseConfig.set("displaypermerrors", null);
|
||||
}
|
||||
if (this.multiverseConfig.isSet("teleportintercept")) {
|
||||
this.log(Level.INFO, "Migrating 'teleportintercept'...");
|
||||
Logging.config("Migrating 'teleportintercept'...");
|
||||
this.getMVConfig().setTeleportIntercept(this.multiverseConfig.getBoolean("teleportintercept"));
|
||||
this.multiverseConfig.set("teleportintercept", null);
|
||||
}
|
||||
if (this.multiverseConfig.isSet("firstspawnoverride")) {
|
||||
this.log(Level.INFO, "Migrating 'firstspawnoverride'...");
|
||||
Logging.config("Migrating 'firstspawnoverride'...");
|
||||
this.getMVConfig().setFirstSpawnOverride(this.multiverseConfig.getBoolean("firstspawnoverride"));
|
||||
this.multiverseConfig.set("firstspawnoverride", null);
|
||||
}
|
||||
if (this.multiverseConfig.isSet("messagecooldown")) {
|
||||
this.log(Level.INFO, "Migrating 'messagecooldown'...");
|
||||
Logging.config("Migrating 'messagecooldown'...");
|
||||
this.getMVConfig().setMessageCooldown(this.multiverseConfig.getInt("messagecooldown"));
|
||||
this.multiverseConfig.set("messagecooldown", null);
|
||||
}
|
||||
if (this.multiverseConfig.isSet("debug")) {
|
||||
this.log(Level.INFO, "Migrating 'debug'...");
|
||||
Logging.config("Migrating 'debug'...");
|
||||
this.getMVConfig().setGlobalDebug(this.multiverseConfig.getInt("debug"));
|
||||
this.multiverseConfig.set("debug", null);
|
||||
}
|
||||
if (this.multiverseConfig.isSet("version")) {
|
||||
this.log(Level.INFO, "Migrating 'version'...");
|
||||
Logging.config("Migrating 'version'...");
|
||||
this.multiverseConfig.set("version", null);
|
||||
}
|
||||
}
|
||||
@ -845,6 +848,7 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core, Listen
|
||||
// Misc Commands
|
||||
this.commandHandler.registerCommand(new EnvironmentCommand(this));
|
||||
this.commandHandler.registerCommand(new DebugCommand(this));
|
||||
this.commandHandler.registerCommand(new SilentCommand(this));
|
||||
this.commandHandler.registerCommand(new GeneratorCommand(this));
|
||||
this.commandHandler.registerCommand(new CheckCommand(this));
|
||||
this.commandHandler.registerCommand(new ScriptCommand(this));
|
||||
@ -858,7 +862,6 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core, Listen
|
||||
this.saveMVConfigs();
|
||||
this.banker = null;
|
||||
this.bank = null;
|
||||
log(Level.INFO, "- Disabled");
|
||||
Logging.shutdown();
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import com.dumptruckman.minecraft.util.Logging;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -15,7 +16,6 @@ import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
/**
|
||||
* Returns a list of loaded generator plugins.
|
||||
@ -37,7 +37,7 @@ public class GeneratorCommand extends MultiverseCommand {
|
||||
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
this.plugin.log(Level.INFO, "PLEASE IGNORE the 'Plugin X does not contain any generators' message below!");
|
||||
Logging.info("PLEASE IGNORE the 'Plugin X does not contain any generators' message below!");
|
||||
Plugin[] plugins = this.plugin.getServer().getPluginManager().getPlugins();
|
||||
List<String> generators = new ArrayList<String>();
|
||||
for (Plugin p : plugins) {
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import com.dumptruckman.minecraft.util.Logging;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.event.MVVersionEvent;
|
||||
import com.onarandombox.MultiverseCore.utils.webpaste.BitlyURLShortener;
|
||||
@ -21,7 +22,6 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
/**
|
||||
* Dumps version info to the console.
|
||||
@ -81,7 +81,7 @@ public class VersionCommand extends MultiverseCommand {
|
||||
final String data = versionEvent.getVersionInfo();
|
||||
String[] lines = data.split("\n");
|
||||
for (String line : lines) {
|
||||
this.plugin.log(Level.INFO, line);
|
||||
Logging.info(line);
|
||||
}
|
||||
|
||||
this.plugin.getServer().getScheduler().scheduleAsyncDelayedTask(this.plugin, new Runnable() {
|
||||
@ -98,7 +98,7 @@ public class VersionCommand extends MultiverseCommand {
|
||||
}
|
||||
|
||||
sender.sendMessage("Version info dumped here: " + ChatColor.GREEN + pasteUrl);
|
||||
plugin.log(Level.INFO, "Version info dumped here: " + pasteUrl);
|
||||
Logging.info("Version info dumped here: %s", pasteUrl);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -50,7 +50,7 @@ public class AnchorManager {
|
||||
//world:x,y,z:pitch:yaw
|
||||
Location anchorLocation = plugin.getLocationManipulation().stringToLocation(anchorsSection.getString(key, ""));
|
||||
if (anchorLocation != null) {
|
||||
Logging.info("Loading anchor: '%s'...", key);
|
||||
Logging.config("Loading anchor: '%s'...", key);
|
||||
this.anchors.put(key, anchorLocation);
|
||||
} else {
|
||||
Logging.warning("The location for anchor '%s' is INVALID.", key);
|
||||
|
@ -7,6 +7,8 @@
|
||||
|
||||
package com.onarandombox.MultiverseCore.utils;
|
||||
|
||||
import com.dumptruckman.minecraft.util.Logging;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
@ -87,7 +89,7 @@ public class UpdateChecker {
|
||||
int compare = v1.compareTo(v2);
|
||||
|
||||
if (compare > 0) {
|
||||
log.info("[" + this.name + "]" + " - Update Available (" + version + ")");
|
||||
Logging.info("[%s] - Update Available (%s)", this.name, version);
|
||||
}
|
||||
|
||||
rd.close();
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
package com.onarandombox.MultiverseCore.utils;
|
||||
|
||||
import com.dumptruckman.minecraft.util.Logging;
|
||||
import com.onarandombox.MultiverseCore.MVWorld;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.api.MVWorldManager;
|
||||
@ -114,9 +115,7 @@ public class WorldManager implements MVWorldManager {
|
||||
|
||||
removePlayersFromWorld(oldName);
|
||||
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("Copying data for world '").append(oldName).append("'...");
|
||||
this.plugin.log(Level.INFO, builder.toString());
|
||||
Logging.config("Copying data for world '%s'", oldName);
|
||||
try {
|
||||
Thread t = new Thread(new Runnable() {
|
||||
@Override
|
||||
@ -136,23 +135,23 @@ public class WorldManager implements MVWorldManager {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
this.plugin.log(Level.INFO, "Kind of copied stuff");
|
||||
Logging.fine("Kind of copied stuff");
|
||||
|
||||
WorldCreator worldCreator = new WorldCreator(newName);
|
||||
this.plugin.log(Level.INFO, "Started to copy settings");
|
||||
Logging.fine("Started to copy settings");
|
||||
worldCreator.copy(this.getMVWorld(oldName).getCBWorld());
|
||||
this.plugin.log(Level.INFO, "Copied lots of settings");
|
||||
Logging.fine("Copied lots of settings");
|
||||
|
||||
boolean useSpawnAdjust = this.getMVWorld(oldName).getAdjustSpawn();
|
||||
this.plugin.log(Level.INFO, "Copied more settings");
|
||||
Logging.fine("Copied more settings");
|
||||
|
||||
Environment environment = worldCreator.environment();
|
||||
this.plugin.log(Level.INFO, "Copied most settings");
|
||||
Logging.fine("Copied most settings");
|
||||
if (newWorldFile.exists()) {
|
||||
this.plugin.log(Level.INFO, "Succeeded at copying stuff");
|
||||
Logging.fine("Succeeded at copying stuff");
|
||||
if (this.addWorld(newName, environment, null, null, null, generator, useSpawnAdjust)) {
|
||||
// getMVWorld() doesn't actually return an MVWorld
|
||||
this.plugin.log(Level.INFO, "Succeeded at importing stuff");
|
||||
Logging.fine("Succeeded at importing stuff");
|
||||
MVWorld newWorld = (MVWorld) this.getMVWorld(newName);
|
||||
MVWorld oldWorld = (MVWorld) this.getMVWorld(oldName);
|
||||
newWorld.copyValues(oldWorld);
|
||||
@ -221,7 +220,7 @@ public class WorldManager implements MVWorldManager {
|
||||
if (generator != null) {
|
||||
builder.append(" & generator: ").append(generator);
|
||||
}
|
||||
this.plugin.log(Level.INFO, builder.toString());
|
||||
Logging.info(builder.toString());
|
||||
|
||||
if (!doLoad(c, true)) {
|
||||
this.plugin.log(Level.SEVERE, "Failed to Create/Load the world '" + name + "'");
|
||||
@ -262,12 +261,12 @@ public class WorldManager implements MVWorldManager {
|
||||
}
|
||||
if (this.worldsFromTheConfig.containsKey(name)) {
|
||||
this.worldsFromTheConfig.remove(name);
|
||||
this.plugin.log(Level.INFO, "World '" + name + "' was removed from config.yml");
|
||||
Logging.info("World '%s' was removed from config.yml", name);
|
||||
|
||||
this.saveWorldsConfig();
|
||||
return true;
|
||||
} else {
|
||||
this.plugin.log(Level.INFO, "World '" + name + "' was already removed from config.yml");
|
||||
Logging.info("World '%s' was already removed from config.yml", name);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -311,22 +310,22 @@ public class WorldManager implements MVWorldManager {
|
||||
if (this.worlds.containsKey(name)) {
|
||||
if (this.unloadWorldFromBukkit(name, true)) {
|
||||
this.worlds.remove(name);
|
||||
this.plugin.log(Level.INFO, "World '" + name + "' was unloaded from memory.");
|
||||
Logging.info("World '%s' was unloaded from memory.", name);
|
||||
|
||||
this.worldsFromTheConfig.get(name).tearDown();
|
||||
|
||||
return true;
|
||||
} else {
|
||||
this.plugin.log(Level.WARNING, "World '" + name + "' could not be unloaded. Is it a default world?");
|
||||
Logging.warning("World '%s' could not be unloaded. Is it a default world?", name);
|
||||
}
|
||||
} else if (this.plugin.getServer().getWorld(name) != null) {
|
||||
this.plugin.log(Level.WARNING, "Hmm Multiverse does not know about this world but it's loaded in memory.");
|
||||
this.plugin.log(Level.WARNING, "To let Multiverse know about it, use:");
|
||||
this.plugin.log(Level.WARNING, String.format("/mv import %s %s", name, this.plugin.getServer().getWorld(name).getEnvironment().toString()));
|
||||
Logging.warning("Hmm Multiverse does not know about this world but it's loaded in memory.");
|
||||
Logging.warning("To let Multiverse know about it, use:");
|
||||
Logging.warning("/mv import %s %s", name, this.plugin.getServer().getWorld(name).getEnvironment().toString());
|
||||
} else if (this.worldsFromTheConfig.containsKey(name)) {
|
||||
return true; // it's already unloaded
|
||||
} else {
|
||||
this.plugin.log(Level.INFO, "Multiverse does not know about " + name + " and it's not loaded by Bukkit.");
|
||||
Logging.info("Multiverse does not know about '%s' and it's not loaded by Bukkit.", name);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -434,20 +433,20 @@ public class WorldManager implements MVWorldManager {
|
||||
File worldFile = world.getWorldFolder();
|
||||
plugin.log(Level.FINER, "deleteWorld(): worldFile: " + worldFile.getAbsolutePath());
|
||||
if (deleteWorldFolder ? FileUtils.deleteFolder(worldFile) : FileUtils.deleteFolderContents(worldFile)) {
|
||||
this.plugin.log(Level.INFO, "World " + name + " was DELETED.");
|
||||
Logging.info("World '%s' was DELETED.", name);
|
||||
return true;
|
||||
} else {
|
||||
this.plugin.log(Level.SEVERE, "World " + name + " was NOT deleted.");
|
||||
this.plugin.log(Level.SEVERE, "Are you sure the folder " + name + " exists?");
|
||||
this.plugin.log(Level.SEVERE, "Please check your file permissions on " + name);
|
||||
Logging.info("World '%s' was NOT deleted.", name);
|
||||
Logging.severe("Are you sure the folder %s exists?", name);
|
||||
Logging.severe("Please check your file permissions on '%s'", name);
|
||||
return false;
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
this.plugin.log(Level.SEVERE, "Hrm, something didn't go as planned. Here's an exception for ya.");
|
||||
this.plugin.log(Level.SEVERE, "You can go politely explain your situation in #multiverse on esper.net");
|
||||
this.plugin.log(Level.SEVERE, "But from here, it looks like your folder is oddly named.");
|
||||
this.plugin.log(Level.SEVERE, "This world has been removed from Multiverse-Core so your best bet is to go delete the folder by hand. Sorry.");
|
||||
this.plugin.log(Level.SEVERE, e.getMessage());
|
||||
Logging.severe("Hrm, something didn't go as planned. Here's an exception for ya.");
|
||||
Logging.severe("You can go politely explain your situation in #multiverse on esper.net");
|
||||
Logging.severe("But from here, it looks like your folder is oddly named.");
|
||||
Logging.severe("This world has been removed from Multiverse-Core so your best bet is to go delete the folder by hand. Sorry.");
|
||||
Logging.severe(e.getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -649,7 +648,7 @@ public class WorldManager implements MVWorldManager {
|
||||
}
|
||||
|
||||
// Simple Output to the Console to show how many Worlds were loaded.
|
||||
this.plugin.log(Level.INFO, count + " - World(s) loaded.");
|
||||
Logging.config("%s - World(s) loaded.", count);
|
||||
this.saveWorldsConfig();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user