fix: handle object creation correctly in JavaPlugin

This commit is contained in:
Simon Giesel 2020-05-27 11:22:46 +02:00
parent a2b1c42ad8
commit 5a63464cce

View file

@ -63,18 +63,6 @@ public class Varo extends JavaPlugin {
this.configurationFile = new File("plugins/CliffbreakVaro", "config.yml"); this.configurationFile = new File("plugins/CliffbreakVaro", "config.yml");
this.config = YamlConfiguration.loadConfiguration(this.configurationFile); this.config = YamlConfiguration.loadConfiguration(this.configurationFile);
this.npcManager = new NPCManager(this);
this.playerCache = new PlayerCache(this);
this.banUtils = new BanUtils(this);
this.varoUtils = new VaroUtils(this);
this.teamManager = new TeamManager();
this.messageUtils = new MessageUtils(this);
this.database = new Database();
this.gameTimeManager = new GameTimeManager(this);
this.playerUtils = new PlayerUtils(this);
this.borderManager = new BorderManager(this);
this.langUtils = new LangUtils();
this.config.addDefault("Varo.Start", 1590393600000f); this.config.addDefault("Varo.Start", 1590393600000f);
this.config.addDefault("Varo.Debug", false); this.config.addDefault("Varo.Debug", false);
this.config.addDefault("Varo.Discord.Token", "insert.token.here"); this.config.addDefault("Varo.Discord.Token", "insert.token.here");
@ -89,6 +77,18 @@ public class Varo extends JavaPlugin {
this.config.options().copyDefaults(true); this.config.options().copyDefaults(true);
this.saveConfig(); this.saveConfig();
this.database = new Database();
this.teamManager = new TeamManager();
this.playerCache = new PlayerCache(this);
this.npcManager = new NPCManager(this);
this.banUtils = new BanUtils(this);
this.varoUtils = new VaroUtils(this);
this.messageUtils = new MessageUtils(this);
this.gameTimeManager = new GameTimeManager(this);
this.playerUtils = new PlayerUtils(this);
this.borderManager = new BorderManager(this);
this.langUtils = new LangUtils();
this.getServer().getPluginManager().registerEvents(new PlayerLoginListener(this), this); this.getServer().getPluginManager().registerEvents(new PlayerLoginListener(this), this);
this.getServer().getPluginManager().registerEvents(new PlayerJoinQuitListener(this), this); this.getServer().getPluginManager().registerEvents(new PlayerJoinQuitListener(this), this);
this.getServer().getPluginManager().registerEvents(new PlayerClientOptionsChangeListener(this), this); this.getServer().getPluginManager().registerEvents(new PlayerClientOptionsChangeListener(this), this);