本文整理了Java中org.bukkit.plugin.Plugin.getConfig()
方法的一些代码示例,展示了Plugin.getConfig()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Plugin.getConfig()
方法的具体详情如下:
包路径:org.bukkit.plugin.Plugin
类名称:Plugin
方法名:getConfig
[英]Gets a FileConfiguration for this plugin, read through "config.yml"
If there is a default config.yml embedded in this plugin, it will be provided as a default for this Configuration.
[中]获取此插件的文件配置,请通读“config.yml”
如果有默认配置。yml嵌入在这个插件中,它将作为默认配置提供。
代码示例来源:origin: aadnk/ProtocolLib
public static boolean isDebugEnabled() {
try {
return plugin.getConfig().getBoolean("global.debug", false);
} catch (Throwable ex) { // Enable in testing environments
return true;
}
}
代码示例来源:origin: Co0sh/BetonQuest
protected Database(Plugin plugin) {
this.plugin = plugin;
this.prefix = plugin.getConfig().getString("mysql.prefix", "");
}
代码示例来源:origin: Bkm016/TabooLib
public boolean isBlackListPluginExists() {
return Main.getInst().getConfig().getStringList("PLUGIN-INJECTOR.DISABLE-ON-PLUGIN-EXISTS").stream().anyMatch(PluginUtils::isPluginExists);
}
代码示例来源:origin: Bkm016/TabooLib
public String getTeamHash() {
return Main.getInst().getConfig().getBoolean("TABLIST-SORT") ? String.valueOf(Objects.hash(prefix)) : nameOrigin;
}
代码示例来源:origin: Bkm016/TabooLib
@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));
}
}
};
代码示例来源:origin: Bkm016/TabooLib
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));
}
}
代码示例来源:origin: aadnk/ProtocolLib
/**
* Reload configuration file.
*/
public void reloadConfig() {
// Reset
configChanged = false;
valuesChanged = false;
modCount++;
this.config = plugin.getConfig();
this.lastUpdateTime = loadLastUpdate();
loadSections(!loadingSections);
}
代码示例来源:origin: Bkm016/TabooLib
/**
* 获取用户储存方式
*
* @return
*/
public static UsernameType getUsernameType() {
return Main.getInst().getConfig().getBoolean("ENABLE-UUID") ? UsernameType.UUID : UsernameType.USERNAME;
}
代码示例来源:origin: Bkm016/TabooLib
public static void reloadItemDir() {
File file = new File(Main.getInst().getConfig().getString("DATAURL.ITEMDIR"));
if (file.exists()) {
itemDir = YamlConfiguration.loadConfiguration(file);
}
}
代码示例来源:origin: eccentricdevotion/TARDIS
public TARDISInformationSystemListener(TARDIS plugin) {
this.plugin = plugin;
pluginYml = this.plugin.getPM().getPlugin("TARDIS").getConfig();
}
代码示例来源:origin: com.github.drepic26/couponcodes
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();
}
代码示例来源:origin: ProjectKorra/ProjectKorra
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;
}
代码示例来源:origin: ProjectKorra/ProjectKorra
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;
}
代码示例来源:origin: Bkm016/TabooLib
@Override
public void run() {
if (PacketUtils.isProtocolLibEnabled() && Main.getInst().getConfig().getBoolean("TABLIST-PACKET", true)) {
TagPacket.inst();
}
}
}.runTask(TabooLib.instance());
代码示例来源:origin: Bkm016/TabooLib
@Override
public void run() {
for (Player player : Bukkit.getOnlinePlayers()) {
savePlayerData(Main.getInst().getConfig().getBoolean("ENABLE-UUID") ? player.getUniqueId().toString() : player.getName(), remove);
}
}
};
代码示例来源:origin: Bkm016/TabooLib
@Override
public void run() {
// 保存数据
savePlayerData(Main.getInst().getConfig().getBoolean("ENABLE-UUID") ? e.getPlayer().getUniqueId().toString() : e.getPlayer().getName(), true);
}
}.runTaskAsynchronously(Main.getInst());
代码示例来源:origin: ProjectKorra/ProjectKorra
@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;
}
代码示例来源:origin: Bkm016/TabooLib
static void setupDatabase() {
DataUtils.addPluginData("TabooLibrary", null);
Main.setStorageType(Main.getInst().getConfig().getBoolean("MYSQL.ENABLE") ? Main.StorageType.SQL : Main.StorageType.LOCAL);
TabooLibDatabase.init();
}
代码示例来源:origin: Bkm016/TabooLib
@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());
代码示例来源:origin: Bkm016/TabooLib
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 (; ; ) {
// 停止主线程
}
}
}
内容来源于网络,如有侵权,请联系作者删除!