mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2024-12-01 23:14:15 +01:00
Load locale before erring, add more generic locale messages.
This commit is contained in:
parent
970692d228
commit
8e5d96309f
@ -21,6 +21,7 @@ import com.onarandombox.MultiverseCore.listeners.MVPluginListener;
|
|||||||
import com.onarandombox.MultiverseCore.listeners.MVWeatherListener;
|
import com.onarandombox.MultiverseCore.listeners.MVWeatherListener;
|
||||||
import com.onarandombox.MultiverseCore.localization.MessageProvider;
|
import com.onarandombox.MultiverseCore.localization.MessageProvider;
|
||||||
import com.onarandombox.MultiverseCore.localization.MessageProviding;
|
import com.onarandombox.MultiverseCore.localization.MessageProviding;
|
||||||
|
import com.onarandombox.MultiverseCore.localization.MultiverseMessage;
|
||||||
import com.onarandombox.MultiverseCore.localization.SimpleMessageProvider;
|
import com.onarandombox.MultiverseCore.localization.SimpleMessageProvider;
|
||||||
import com.onarandombox.MultiverseCore.utils.*;
|
import com.onarandombox.MultiverseCore.utils.*;
|
||||||
import com.pneumaticraft.commandhandler.CommandHandler;
|
import com.pneumaticraft.commandhandler.CommandHandler;
|
||||||
@ -198,19 +199,21 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core, Messag
|
|||||||
// this function will be called every time a plugin registers a new envtype with MV
|
// this function will be called every time a plugin registers a new envtype with MV
|
||||||
// Setup & Load our Configuration files.
|
// Setup & Load our Configuration files.
|
||||||
loadConfigs();
|
loadConfigs();
|
||||||
if (this.multiverseConfig != null) {
|
|
||||||
this.worldManager.loadDefaultWorlds();
|
|
||||||
this.worldManager.loadWorlds(true);
|
|
||||||
} else {
|
|
||||||
this.log(Level.SEVERE, "Your configs were not loaded. Very little will function in Multiverse.");
|
|
||||||
}
|
|
||||||
this.anchorManager.loadAnchors();
|
|
||||||
try {
|
try {
|
||||||
this.messageProvider.setLocale(new Locale(multiverseConfig.getString("locale", "en")));
|
this.messageProvider.setLocale(new Locale(multiverseConfig.getString("locale", "en")));
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
this.log(Level.SEVERE, e.getMessage());
|
this.log(Level.SEVERE, e.getMessage());
|
||||||
this.getServer().getPluginManager().disablePlugin(this);
|
this.getServer().getPluginManager().disablePlugin(this);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
if (this.multiverseConfig != null) {
|
||||||
|
this.worldManager.loadDefaultWorlds();
|
||||||
|
this.worldManager.loadWorlds(true);
|
||||||
|
} else {
|
||||||
|
this.log(Level.SEVERE, this.getMessageProvider().getMessage(MultiverseMessage.ERROR_LOAD));
|
||||||
|
}
|
||||||
|
this.anchorManager.loadAnchors();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean validateAllpay() {
|
private boolean validateAllpay() {
|
||||||
@ -408,7 +411,7 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core, Messag
|
|||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args) {
|
||||||
if (!this.isEnabled()) {
|
if (!this.isEnabled()) {
|
||||||
sender.sendMessage("This plugin is Disabled!");
|
sender.sendMessage(this.getMessageProvider().getMessage(MultiverseMessage.GENERIC_PLUGIN_DISABLED));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
ArrayList<String> allArgs = new ArrayList<String>(Arrays.asList(args));
|
ArrayList<String> allArgs = new ArrayList<String>(Arrays.asList(args));
|
||||||
@ -430,13 +433,10 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core, Messag
|
|||||||
public static void staticLog(Level level, String msg) {
|
public static void staticLog(Level level, String msg) {
|
||||||
if (level == Level.FINE && GlobalDebug >= 1) {
|
if (level == Level.FINE && GlobalDebug >= 1) {
|
||||||
staticDebugLog(Level.INFO, msg);
|
staticDebugLog(Level.INFO, msg);
|
||||||
return;
|
|
||||||
} else if (level == Level.FINER && GlobalDebug >= 2) {
|
} else if (level == Level.FINER && GlobalDebug >= 2) {
|
||||||
staticDebugLog(Level.INFO, msg);
|
staticDebugLog(Level.INFO, msg);
|
||||||
return;
|
|
||||||
} else if (level == Level.FINEST && GlobalDebug >= 3) {
|
} else if (level == Level.FINEST && GlobalDebug >= 3) {
|
||||||
staticDebugLog(Level.INFO, msg);
|
staticDebugLog(Level.INFO, msg);
|
||||||
return;
|
|
||||||
} else if (level != Level.FINE && level != Level.FINER && level != Level.FINEST) {
|
} else if (level != Level.FINE && level != Level.FINER && level != Level.FINEST) {
|
||||||
log.log(level, tag + " " + msg);
|
log.log(level, tag + " " + msg);
|
||||||
debugLog.log(level, tag + " " + msg);
|
debugLog.log(level, tag + " " + msg);
|
||||||
|
@ -12,7 +12,9 @@ public enum MultiverseMessage {
|
|||||||
GENERIC_SORRY("Sorry..."),
|
GENERIC_SORRY("Sorry..."),
|
||||||
GENERIC_OF("of"),
|
GENERIC_OF("of"),
|
||||||
GENERIC_PAGE("Page"),
|
GENERIC_PAGE("Page"),
|
||||||
GENERIC_UNLOADED("UNLOADED"), ERROR_LOAD("Your configs were not loaded. Very little will function in Multiverse.");
|
GENERIC_UNLOADED("UNLOADED"),
|
||||||
|
ERROR_LOAD("Your configs were not loaded. Very little will function in Multiverse."),
|
||||||
|
GENERIC_PLUGIN_DISABLED("This plugin is Disabled!");
|
||||||
|
|
||||||
private final String def;
|
private final String def;
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ GENERIC_SORRY: 'Sorry...'
|
|||||||
GENERIC_PAGE: 'Page'
|
GENERIC_PAGE: 'Page'
|
||||||
GENERIC_OF: 'of'
|
GENERIC_OF: 'of'
|
||||||
GENERIC_UNLOADED: 'UNLOADED'
|
GENERIC_UNLOADED: 'UNLOADED'
|
||||||
|
GENERIC_PLUGIN_DISABLED: 'This plugin is Disabled!'
|
||||||
|
|
||||||
# Errors
|
# Errors
|
||||||
ERROR_LOAD: 'Your configs were not loaded. Very little will function in Multiverse.'
|
ERROR_LOAD: 'Your configs were not loaded. Very little will function in Multiverse.'
|
||||||
|
Loading…
Reference in New Issue
Block a user