use of br.net.fabiozumbi12.RedProtect.Bukkit.config.LangGuiManager in project RedProtect by FabioZumbi12.
the class RedProtect method startLoad.
private void startLoad() throws Exception {
redProtectUtil = new RedProtectUtil(this);
config = new ConfigManager();
lang = new LangManager();
blockConfig = new BlockConfig();
if (config.configRoot().purge.regen.enable_whitelist_regen && Bukkit.getServer().hasWhitelist()) {
Bukkit.getServer().setWhitelist(false);
RedProtect.get().logger.success("Whitelist disabled!");
}
logger.info("Registering commands...");
cmdHandler = new CommandHandler(this);
logger.info("Registering listeners...");
getServer().getPluginManager().registerEvents(cmdHandler, this);
getServer().getPluginManager().registerEvents(new GlobalListener(), this);
getServer().getPluginManager().registerEvents(new BlockListener(), this);
getServer().getPluginManager().registerEvents(new PlayerListener(), this);
getServer().getPluginManager().registerEvents(new EntityListener(), this);
getServer().getPluginManager().registerEvents(new WorldListener(), this);
// Register hooks
hooks.registerHooksFirst();
rm = new RegionManager();
rm.loadAll();
redProtectUtil.ReadAllDB(rm.getAllRegions());
rm.saveAll(false);
if (!config.configRoot().file_type.equalsIgnoreCase("mysql")) {
startAutoSave();
}
logger.info("There are " + rm.getTotalRegionsNum() + " regions on (" + config.configRoot().file_type + ") database!");
// Register hooks
hooks.registerHooksLast();
// Load Gui lang file
guiLang = new LangGuiManager();
// Update Manager
if (updater != null) {
Bukkit.getScheduler().cancelTask(updater.getTaskId());
updater = null;
}
if (config.configRoot().update.enable) {
updater = new SpigetUpdater(this);
updater.setCurrentJarFile(this.getFile().getName());
updater.hourlyUpdateCheck(getServer().getConsoleSender(), config.configRoot().update.enable, false);
}
bukkitVersion = getBukkitVersion();
logger.debug(LogLevel.DEFAULT, "Version String: " + bukkitVersion);
if (bukkitVersion >= 180) {
getServer().getPluginManager().registerEvents(new Compat18(), this);
}
if (bukkitVersion >= 190) {
getServer().getPluginManager().registerEvents(new Compat19(), this);
}
if (bukkitVersion >= 1110) {
getServer().getPluginManager().registerEvents(new Compat111(), this);
}
if (bukkitVersion >= 1140) {
getServer().getPluginManager().registerEvents(new Compat114(), this);
}
if (bukkitVersion <= 189) {
rpvHelper = (VersionHelper) Class.forName("br.net.fabiozumbi12.RedProtect.Bukkit.helpers.VersionHelper18").newInstance();
}
if (bukkitVersion >= 190) {
rpvHelper = (VersionHelper) Class.forName("br.net.fabiozumbi12.RedProtect.Bukkit.helpers.VersionHelper112").newInstance();
}
if (bukkitVersion >= 1130) {
rpvHelper = (VersionHelper) Class.forName("br.net.fabiozumbi12.RedProtect.Bukkit.helpers.VersionHelper113").newInstance();
}
if (bukkitVersion >= 1140) {
rpvHelper = (VersionHelper) Class.forName("br.net.fabiozumbi12.RedProtect.Bukkit.helpers.VersionHelperLatest").newInstance();
}
// Register as listener
getServer().getPluginManager().registerEvents(rpvHelper, this);
// Print helper version
logger.info("Helper version: " + rpvHelper.getVersion());
// Load gui items for Minecraft version
config.setGuiRoot(rpvHelper.setGuiItems(config.guiRoot()));
// Load mob permissions
modListener = new ModListener(this);
// Metrics
try {
Metrics metrics = new Metrics(this);
metrics.addCustomChart(new Metrics.SingleLineChart("server_regions", () -> rm.getAllRegions().size()));
if (metrics.isEnabled())
logger.info("Metrics enabled! See our stats here: https://bstats.org/plugin/bukkit/RedProtect");
} catch (Exception ex) {
logger.info("Metrics not enabled due errors: " + ex.getLocalizedMessage());
}
}
use of br.net.fabiozumbi12.RedProtect.Bukkit.config.LangGuiManager in project RedProtect by FabioZumbi12.
the class RedProtect method startLoad.
private void startLoad() throws Exception {
redProtectUtil = new RedProtectUtil();
config = new ConfigManager(this.factory);
lang = new LangManager();
if (RedProtect.get().getConfigManager().configRoot().purge.regen.enable_whitelist_regen && Sponge.getServer().hasWhitelist()) {
Sponge.getServer().setHasWhitelist(false);
RedProtect.get().logger.success("Whitelist disabled!");
}
logger.info("Registering commands...");
commandHandler = new CommandHandler(this);
logger.info("Registering listeners...");
Sponge.getGame().getEventManager().registerListeners(container, commandHandler);
Sponge.getGame().getEventManager().registerListeners(container, new BlockListener());
Sponge.getGame().getEventManager().registerListeners(container, new GlobalListener());
Sponge.getGame().getEventManager().registerListeners(container, new PlayerListener());
Sponge.getGame().getEventManager().registerListeners(container, new EntityListener());
Sponge.getGame().getEventManager().registerListeners(container, new WorldListener());
// Register hooks
this.hooks.registerHooksFirst();
rm = new RegionManager();
rm.loadAll();
RedProtect.get().getUtil().ReadAllDB(rm.getAllRegions());
rm.saveAll(false);
if (!config.configRoot().file_type.equalsIgnoreCase("mysql")) {
AutoSaveHandler();
}
logger.info("There are " + rm.getTotalRegionsNum() + " regions on (" + config.configRoot().file_type + ") database!");
// Register hooks
this.hooks.registerHooksLast();
// Load Gui lang file
guiLang = new LangGuiManager();
}
use of br.net.fabiozumbi12.RedProtect.Bukkit.config.LangGuiManager in project RedProtect by FabioZumbi12.
the class RedProtect method reloadConfigs.
public void reloadConfigs() {
commandHandler.unregisterAll();
try {
config = new ConfigManager(factory);
} catch (ObjectMappingException e) {
CoreUtil.printJarVersion();
e.printStackTrace();
}
logger.info("Loading language files...");
lang = new LangManager();
guiLang = new LangGuiManager();
logger.info("Re-registering commands...");
commandHandler = new CommandHandler(this);
}
use of br.net.fabiozumbi12.RedProtect.Bukkit.config.LangGuiManager in project RedProtect by FabioZumbi12.
the class RedProtect method reloadConfigs.
public void reloadConfigs() {
cmdHandler.unregisterAll();
try {
config = new ConfigManager();
} catch (ObjectMappingException e) {
CoreUtil.printJarVersion();
e.printStackTrace();
}
logger.info("Loading language files...");
lang = new LangManager();
guiLang = new LangGuiManager();
blockConfig = new BlockConfig();
logger.info("Re-registering commands...");
cmdHandler = new CommandHandler(this);
}
Aggregations