public static boolean isDebugEnabled() { try { return plugin.getConfig().getBoolean("global.debug", false); } catch (Throwable ex) { // Enable in testing environments return true; } }
protected Database(Plugin plugin) { this.plugin = plugin; this.prefix = plugin.getConfig().getString("mysql.prefix", ""); }
public boolean isBlackListPluginExists() { return Main.getInst().getConfig().getStringList("PLUGIN-INJECTOR.DISABLE-ON-PLUGIN-EXISTS").stream().anyMatch(PluginUtils::isPluginExists); }
public String getTeamHash() { return Main.getInst().getConfig().getBoolean("TABLIST-SORT") ? String.valueOf(Objects.hash(prefix)) : nameOrigin; }
@Override public void run() { long time = System.currentTimeMillis(); // 保存 for (String name : PLAYER_DATA.keySet()) { savePlayerData(name, false); } // 提示 if (!Main.getInst().getConfig().getBoolean("HIDE-NOTIFY")) { TLocale.Logger.info("PLAYER-DATAMANAGER.SUCCESS-SAVE-DATA", String.valueOf(PLAYER_DATA.size()), String.valueOf(System.currentTimeMillis() - time)); } } };
public static void saveAllCaches(boolean remove) { long time = System.currentTimeMillis(); for (String plugin : CACHE_DATA_PLUGIN.keySet()) { saveAllCaches(getFixedPlugin(plugin), remove); } if (!Main.getInst().getConfig().getBoolean("HIDE-NOTIFY")) { TLocale.Logger.info("DATA-UTILS.SUCCESS-SAVE-DATA", String.valueOf(DataUtils.CACHE_DATA_PLUGIN.size()), String.valueOf(System.currentTimeMillis() - time)); } }
/** * Reload configuration file. */ public void reloadConfig() { // Reset configChanged = false; valuesChanged = false; modCount++; this.config = plugin.getConfig(); this.lastUpdateTime = loadLastUpdate(); loadSections(!loadingSections); }
/** * 获取用户储存方式 * * @return */ public static UsernameType getUsernameType() { return Main.getInst().getConfig().getBoolean("ENABLE-UUID") ? UsernameType.UUID : UsernameType.USERNAME; }
public static void reloadItemDir() { File file = new File(Main.getInst().getConfig().getString("DATAURL.ITEMDIR")); if (file.exists()) { itemDir = YamlConfiguration.loadConfiguration(file); } }
public TARDISInformationSystemListener(TARDIS plugin) { this.plugin = plugin; pluginYml = this.plugin.getPM().getPlugin("TARDIS").getConfig(); }
public BukkitConfigHandler(Plugin plugin) { this.config = plugin.getConfig(); if (!(new File("plugins/CouponCodes/config.yml").exists())) plugin.saveDefaultConfig(); if (!config.options().copyDefaults(true).configuration().equals(config)) plugin.saveConfig(); }
public ChatColor getSubColor() { final String color = this.plugin.getName().equalsIgnoreCase("ProjectKorra") ? ConfigManager.languageConfig.get().getString("Chat.Colors." + this.name + "Sub") : this.plugin.getConfig().getString("Chat.Colors." + this.name + "Sub"); return color != null ? ChatColor.valueOf(color) : ChatColor.WHITE; }
public ChatColor getColor() { final String color = this.plugin.getName().equalsIgnoreCase("ProjectKorra") ? ConfigManager.languageConfig.get().getString("Chat.Colors." + this.name) : this.plugin.getConfig().getString("Chat.Colors." + this.name); return color != null ? ChatColor.valueOf(color) : ChatColor.WHITE; }
@Override public void run() { if (PacketUtils.isProtocolLibEnabled() && Main.getInst().getConfig().getBoolean("TABLIST-PACKET", true)) { TagPacket.inst(); } } }.runTask(TabooLib.instance());
@Override public void run() { for (Player player : Bukkit.getOnlinePlayers()) { savePlayerData(Main.getInst().getConfig().getBoolean("ENABLE-UUID") ? player.getUniqueId().toString() : player.getName(), remove); } } };
@Override public void run() { // 保存数据 savePlayerData(Main.getInst().getConfig().getBoolean("ENABLE-UUID") ? e.getPlayer().getUniqueId().toString() : e.getPlayer().getName(), true); } }.runTaskAsynchronously(Main.getInst());
@Override public ChatColor getColor() { final String color = this.getPlugin().getName().equalsIgnoreCase("ProjectKorra") ? ConfigManager.languageConfig.get().getString("Chat.Colors." + this.parentElement.name + "Sub") : this.getPlugin().getConfig().getString("Chat.Colors." + this.parentElement.name + "Sub"); return color != null ? ChatColor.valueOf(color) : ChatColor.WHITE; }
static void setupDatabase() { DataUtils.addPluginData("TabooLibrary", null); Main.setStorageType(Main.getInst().getConfig().getBoolean("MYSQL.ENABLE") ? Main.StorageType.SQL : Main.StorageType.LOCAL); TabooLibDatabase.init(); }
@Override public void run() { // 载入数据 loadPlayerData(Main.getInst().getConfig().getBoolean("ENABLE-UUID") ? e.getPlayer().getUniqueId().toString() : e.getPlayer().getName()); // 载入完成 Bukkit.getPluginManager().callEvent(new PlayerLoadedEvent(e.getPlayer())); } }.runTaskAsynchronously(Main.getInst());
static void testInternet() { try { InetAddress inetAddress = InetAddress.getByName(Main.getInst().getConfig().getString("TEST-URL", "aliyun.com")); Main.setIsInternetOnline(inetAddress.isReachable(10000)); } catch (Exception ignored) { } if (!Main.isInternetOnline() && !Main.isOfflineVersion() && !Main.isLibrariesExists()) { TLocale.Logger.error("TLIB.LOAD-FAIL-OFFLINE", Main.getInst().getDescription().getVersion()); for (; ; ) { // 停止主线程 } } }