Added static variable for logger-access

master
Ruakij 4 years ago
parent 92718de5a9
commit bcd147052c

@ -8,6 +8,7 @@ import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import java.io.File; import java.io.File;
import java.util.logging.Logger;
public class Main extends JavaPlugin { public class Main extends JavaPlugin {
@ -16,7 +17,10 @@ public class Main extends JavaPlugin {
public static FileConfiguration config; public static FileConfiguration config;
public static FileConfiguration data; public static FileConfiguration data;
public static Logger log;
public void onEnable() { public void onEnable() {
log = getLogger();
plugin = this; plugin = this;
@ -25,12 +29,12 @@ public class Main extends JavaPlugin {
loadConfigs(); loadConfigs();
getLogger().info("Plugin activated"); log.info("Plugin activated");
} }
public void onDisable() { public void onDisable() {
getLogger().info("Plugin deactivated"); log.info("Plugin deactivated");
} }
public void loadConfigs() { public void loadConfigs() {
@ -46,7 +50,7 @@ public class Main extends JavaPlugin {
dataFile dataFile
); );
}catch (Exception ex){ }catch (Exception ex){
getLogger().severe("Could not load/create data.yml!"); log.severe("Could not load/create data.yml!");
ex.printStackTrace(); ex.printStackTrace();
Bukkit.getPluginManager().disablePlugin(this); Bukkit.getPluginManager().disablePlugin(this);
} }

Loading…
Cancel
Save