mirror of
https://github.com/songoda/SongodaCore.git
synced 2024-11-27 12:35:12 +01:00
fix possible settings NPE
This commit is contained in:
parent
04de7c9060
commit
d04de3159c
@ -86,12 +86,14 @@ public abstract class SongodaPlugin extends JavaPlugin {
|
||||
locale = Locale.loadDefaultLocale(this, "en_US");
|
||||
// plugin setup
|
||||
onPluginEnable();
|
||||
if(emergencyStop) {
|
||||
console.sendMessage(ChatColor.RED + "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
|
||||
return;
|
||||
}
|
||||
// Start Metrics
|
||||
Metrics.start(this);
|
||||
} catch (Throwable t) {
|
||||
getLogger().log(Level.SEVERE, "Unexpected error while loading " + getDescription().getName() + ": Disabling plugin!", t);
|
||||
emergencyStop = true;
|
||||
setEnabled(false);
|
||||
console.sendMessage(ChatColor.RED + "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
|
||||
return;
|
||||
}
|
||||
@ -99,6 +101,11 @@ public abstract class SongodaPlugin extends JavaPlugin {
|
||||
console.sendMessage(ChatColor.GREEN + "=============================");
|
||||
}
|
||||
|
||||
protected void emergencyStop() {
|
||||
emergencyStop = true;
|
||||
Bukkit.getPluginManager().disablePlugin(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void onDisable() {
|
||||
if (emergencyStop) {
|
||||
|
@ -60,7 +60,7 @@ public class PluginConfigGui extends SimplePagedGui {
|
||||
try {
|
||||
// can we also grab extra config from this mysterious plugin?
|
||||
Object more = plugin.getClass().getDeclaredMethod("getExtraConfig").invoke(plugin);
|
||||
if (more instanceof List && !((List) more).isEmpty()) {
|
||||
if (more != null && more instanceof List && !((List) more).isEmpty()) {
|
||||
try {
|
||||
// if we have the getExtraConfig function, we should also be able to get the file
|
||||
Method method_Config_getFile = ((List) more).get(0).getClass().getDeclaredMethod("getFile");
|
||||
|
Loading…
Reference in New Issue
Block a user