+ TConfiguration 增加部分方法

This commit is contained in:
坏黑 2018-10-28 23:35:14 +08:00
parent a1c4ddc499
commit cfba114331
3 changed files with 27 additions and 10 deletions

View File

@ -3,6 +3,7 @@ package me.skymc.taboolib.common.configuration;
import com.google.common.collect.Maps;
import com.ilummc.tlib.TLib;
import com.ilummc.tlib.logger.TLogger;
import com.ilummc.tlib.resources.TLocale;
import com.ilummc.tlib.util.Ref;
import me.skymc.taboolib.Main;
import me.skymc.taboolib.TabooLib;
@ -35,6 +36,10 @@ public class TConfiguration extends YamlConfiguration {
TabooLib.debug("Loaded TConfiguration \"" + file.getName() + "\" from Plugin \"" + plugin.getName() + "\"");
}
public static Map<String, List<File>> getFiles() {
return files;
}
/**
* 创建配置文件
*
@ -71,8 +76,16 @@ public class TConfiguration extends YamlConfiguration {
return create(file, plugin);
}
public static Map<String, List<File>> getFiles() {
return files;
public String getStringColored(String path) {
return TLocale.Translate.setColored(getString(path));
}
public String getStringColored(String path, String def) {
return TLocale.Translate.setColored(getString(path, def));
}
public List<String> getStringListColored(String path) {
return TLocale.Translate.setColored(getStringList(path));
}
public void release() {
@ -94,14 +107,6 @@ public class TConfiguration extends YamlConfiguration {
//
// *********************************
public void runListener() {
try {
Optional.ofNullable(runnable).ifPresent(Runnable::run);
} catch (Exception e) {
e.printStackTrace();
}
}
public File getFile() {
return file;
}
@ -110,4 +115,12 @@ public class TConfiguration extends YamlConfiguration {
this.runnable = runnable;
return this;
}
public void runListener() {
try {
Optional.ofNullable(runnable).ifPresent(Runnable::run);
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@ -9,6 +9,8 @@ import java.util.Spliterator;
import java.util.function.Consumer;
/**
* JsonObject 有更加人性化的操作目前版本只能获取数据
*
* @Author 坏黑
* @Since 2018-10-27 23:46
*/

View File

@ -6,6 +6,8 @@ import java.util.*;
import java.util.stream.Collectors;
/**
* JsonObject 有更加人性化的操作目前版本只能获取数据
*
* @Author 坏黑
* @Since 2018-10-27 23:06
*/