+ TConfiguration 增加部分方法
This commit is contained in:
parent
a1c4ddc499
commit
cfba114331
@ -3,6 +3,7 @@ package me.skymc.taboolib.common.configuration;
|
|||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.ilummc.tlib.TLib;
|
import com.ilummc.tlib.TLib;
|
||||||
import com.ilummc.tlib.logger.TLogger;
|
import com.ilummc.tlib.logger.TLogger;
|
||||||
|
import com.ilummc.tlib.resources.TLocale;
|
||||||
import com.ilummc.tlib.util.Ref;
|
import com.ilummc.tlib.util.Ref;
|
||||||
import me.skymc.taboolib.Main;
|
import me.skymc.taboolib.Main;
|
||||||
import me.skymc.taboolib.TabooLib;
|
import me.skymc.taboolib.TabooLib;
|
||||||
@ -35,6 +36,10 @@ public class TConfiguration extends YamlConfiguration {
|
|||||||
TabooLib.debug("Loaded TConfiguration \"" + file.getName() + "\" from Plugin \"" + plugin.getName() + "\"");
|
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);
|
return create(file, plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Map<String, List<File>> getFiles() {
|
public String getStringColored(String path) {
|
||||||
return files;
|
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() {
|
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() {
|
public File getFile() {
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
@ -110,4 +115,12 @@ public class TConfiguration extends YamlConfiguration {
|
|||||||
this.runnable = runnable;
|
this.runnable = runnable;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void runListener() {
|
||||||
|
try {
|
||||||
|
Optional.ofNullable(runnable).ifPresent(Runnable::run);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,8 @@ import java.util.Spliterator;
|
|||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 让 JsonObject 有更加人性化的操作,目前版本只能获取数据。
|
||||||
|
*
|
||||||
* @Author 坏黑
|
* @Author 坏黑
|
||||||
* @Since 2018-10-27 23:46
|
* @Since 2018-10-27 23:46
|
||||||
*/
|
*/
|
||||||
|
@ -6,6 +6,8 @@ import java.util.*;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 让 JsonObject 有更加人性化的操作,目前版本只能获取数据。
|
||||||
|
*
|
||||||
* @Author 坏黑
|
* @Author 坏黑
|
||||||
* @Since 2018-10-27 23:06
|
* @Since 2018-10-27 23:06
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user