16.7_dev-2 repo release

This commit is contained in:
JaTiTV 2024-07-02 19:37:27 +02:00
parent 90f899cb16
commit 3c85c440c9
9 changed files with 205 additions and 48 deletions

View File

@ -6,7 +6,7 @@
<groupId>net.t2code</groupId> <groupId>net.t2code</groupId>
<artifactId>T2CodeLib</artifactId> <artifactId>T2CodeLib</artifactId>
<version>16.7_dev-1</version> <version>16.7_dev-2</version>
<!--version>VERSION_snapshot-0</version--> <!--version>VERSION_snapshot-0</version-->
<!--version>VERSION_beta-0</version--> <!--version>VERSION_beta-0</version-->
<!--version>VERSION_dev-0</version--> <!--version>VERSION_dev-0</version-->
@ -27,8 +27,8 @@
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version> <version>3.8.1</version>
<configuration> <configuration>
<source>9</source> <source>11</source>
<target>9</target> <target>11</target>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>

View File

@ -14,21 +14,23 @@ import java.util.List;
public class T2CBlibConfig { public class T2CBlibConfig {
public enum VALUES implements T2CconfigItem{ public enum VALUES implements T2CconfigItem{
updateTimer("updateCheck.timerInMin", 60,"In this option you can set the time interval in minutes in which updates should be checked."), updateTimer("updateCheck.timerInMin", 60,true,"In this option you can set the time interval in minutes in which updates should be checked."),
seePreReleaseUpdates("updateCheck.seePreReleaseUpdates", true,"In this option you can set whether you want to receive and display beta and snapshot versions in the update check."), seePreReleaseUpdates("updateCheck.seePreReleaseUpdates", true,true,"In this option you can set whether you want to receive and display beta and snapshot versions in the update check."),
apiCommandGUIEnable("api.commandGUI.enable", false, "With this option you activate the api interface for the T2C-CommandGUI plugin."), apiCommandGUIEnable("api.commandGUI.enable", false, true,"With this option you activate the api interface for the T2C-CommandGUI plugin."),
apiAutoResponse("api.autoResponse.enable", false,"With this option you activate the api interface for the T2C-AutoResponse plugin."), apiAutoResponse("api.autoResponse.enable", false,true,"With this option you activate the api interface for the T2C-AutoResponse plugin."),
apiOpSecurity("api.opSecurity.enable", false,"With this option you activate the api interface for the T2C-OPSecurity plugin."), apiOpSecurity("api.opSecurity.enable", false,true,"With this option you activate the api interface for the T2C-OPSecurity plugin."),
; ;
private final String path; private final String path;
private Object value; private Object value;
private final boolean forceSet;
private final List<String> comments; private final List<String> comments;
VALUES(String path, Object value, String... comments) { VALUES(String path, Object value,boolean forceSet, String... comments) {
this.path = path; this.path = path;
this.value = value; this.value = value;
this.forceSet=forceSet;
this.comments = new ArrayList<>(Arrays.asList(comments)); this.comments = new ArrayList<>(Arrays.asList(comments));
} }
@ -42,6 +44,11 @@ public class T2CBlibConfig {
return value; return value;
} }
@Override
public boolean getForceSet() {
return forceSet;
}
@Override @Override
public List<String> getComments() { public List<String> getComments() {
return comments; return comments;

View File

@ -3,7 +3,7 @@ package net.t2code.t2codelib.SPIGOT.api.yaml;
public class T2CLibConfig { public class T2CLibConfig {
/** /**
* @deprecated since version 16.7, use the manager directly instead as with the return. * @deprecated since version 16.7, use the method from the return!
*/ */
@Deprecated(since = "16.7", forRemoval = true) @Deprecated(since = "16.7", forRemoval = true)
public static Boolean getUpdateCheckOnJoin() { public static Boolean getUpdateCheckOnJoin() {
@ -11,7 +11,7 @@ public class T2CLibConfig {
} }
/** /**
* @deprecated since version 16.7, use the manager directly instead as with the return. * @deprecated since version 16.7, use the method from the return!
*/ */
@Deprecated(since = "16.7", forRemoval = true) @Deprecated(since = "16.7", forRemoval = true)
public static Integer getUpdateCheckTimeInterval() { public static Integer getUpdateCheckTimeInterval() {
@ -19,7 +19,7 @@ public class T2CLibConfig {
} }
/** /**
* @deprecated since version 16.7, use the manager directly instead as with the return. * @deprecated since version 16.7, use the method from the return!
*/ */
@Deprecated(since = "16.7", forRemoval = true) @Deprecated(since = "16.7", forRemoval = true)
public static Boolean getSeePreReleaseUpdates() { public static Boolean getSeePreReleaseUpdates() {
@ -27,7 +27,7 @@ public class T2CLibConfig {
} }
/** /**
* @deprecated since version 16.7, use the manager directly instead as with the return. * @deprecated since version 16.7, use the method from the return!
*/ */
@Deprecated(since = "16.7", forRemoval = true) @Deprecated(since = "16.7", forRemoval = true)
public static Boolean getDebug() { public static Boolean getDebug() {
@ -35,7 +35,7 @@ public class T2CLibConfig {
} }
/** /**
* @deprecated since version 16.7, use the manager directly instead as with the return. * @deprecated since version 16.7, use the method from the return!
*/ */
@Deprecated(since = "16.7", forRemoval = true) @Deprecated(since = "16.7", forRemoval = true)
public static String getLanguage() { public static String getLanguage() {
@ -43,7 +43,7 @@ public class T2CLibConfig {
} }
/** /**
* @deprecated since version 16.7, use the manager directly instead as with the return. * @deprecated since version 16.7, use the method from the return!
*/ */
@Deprecated(since = "16.7", forRemoval = true) @Deprecated(since = "16.7", forRemoval = true)
public static Boolean getBungee() { public static Boolean getBungee() {
@ -51,7 +51,7 @@ public class T2CLibConfig {
} }
/** /**
* @deprecated since version 16.7, use the manager directly instead as with the return. * @deprecated since version 16.7, use the method from the return!
*/ */
@Deprecated(since = "16.7", forRemoval = true) @Deprecated(since = "16.7", forRemoval = true)
public static Boolean getInventoriesCloseByServerStop() { public static Boolean getInventoriesCloseByServerStop() {

View File

@ -12,51 +12,80 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
public class T2Cconfig { public class T2Cconfig {
/**
* @deprecated since version 16.7, please use the new T2CconfigWriter.
*/
public static void set(String path, String value, YamlConfiguration YamlConfiguration) { public static void set(String path, String value, YamlConfiguration YamlConfiguration) {
if (!YamlConfiguration.contains(path)) { if (!YamlConfiguration.contains(path)) {
YamlConfiguration.set(path, value); YamlConfiguration.set(path, value);
} }
} }
/**
* @deprecated since version 16.7, please use the new T2CconfigWriter.
*/
public static void set(String path, Object value, YamlConfiguration YamlConfiguration) { public static void set(String path, Object value, YamlConfiguration YamlConfiguration) {
if (!YamlConfiguration.contains(path)) { if (!YamlConfiguration.contains(path)) {
YamlConfiguration.set(path, value); YamlConfiguration.set(path, value);
} }
} }
/**
* @deprecated since version 16.7, please use the new T2CconfigWriter.
*/
public static void set(String path, YamlConfiguration YamlConfiguration) { public static void set(String path, YamlConfiguration YamlConfiguration) {
YamlConfiguration.set(path, null); YamlConfiguration.set(path, null);
} }
/**
* @deprecated since version 16.7, please use the new T2CconfigWriter.
*/
public static void set(String path, Integer value, YamlConfiguration YamlConfiguration) { public static void set(String path, Integer value, YamlConfiguration YamlConfiguration) {
if (!YamlConfiguration.contains(path)) { if (!YamlConfiguration.contains(path)) {
YamlConfiguration.set(path, value); YamlConfiguration.set(path, value);
} }
} }
/**
* @deprecated since version 16.7, please use the new T2CconfigWriter.
*/
public static void set(String path, Double value, YamlConfiguration YamlConfiguration) { public static void set(String path, Double value, YamlConfiguration YamlConfiguration) {
if (!YamlConfiguration.contains(path)) { if (!YamlConfiguration.contains(path)) {
YamlConfiguration.set(path, value); YamlConfiguration.set(path, value);
} }
} }
/**
* @deprecated since version 16.7, please use the new T2CconfigWriter.
*/
public static void set(String path, Boolean value, YamlConfiguration YamlConfiguration) { public static void set(String path, Boolean value, YamlConfiguration YamlConfiguration) {
if (!YamlConfiguration.contains(path)) { if (!YamlConfiguration.contains(path)) {
YamlConfiguration.set(path, value); YamlConfiguration.set(path, value);
} }
} }
/**
* @deprecated since version 16.7, please use the new T2CconfigWriter.
*/
public static void set(String path, List<String> value, YamlConfiguration YamlConfiguration) { public static void set(String path, List<String> value, YamlConfiguration YamlConfiguration) {
if (!YamlConfiguration.contains(path)) { if (!YamlConfiguration.contains(path)) {
YamlConfiguration.set(path, value); YamlConfiguration.set(path, value);
} }
} }
/**
* @deprecated since version 16.7, please use the new T2CconfigWriter.
*/
public static void set(String path, ItemStack value, YamlConfiguration YamlConfiguration) { public static void set(String path, ItemStack value, YamlConfiguration YamlConfiguration) {
if (!YamlConfiguration.contains(path)) { if (!YamlConfiguration.contains(path)) {
YamlConfiguration.set(path, value); YamlConfiguration.set(path, value);
} }
} }
/**
* @deprecated since version 16.7, please use the new T2CconfigWriter.
*/
public static void setSound(String soundName, String sound1_8, String sound1_9, String sound1_13, YamlConfiguration yamlConfiguration) { public static void setSound(String soundName, String sound1_8, String sound1_9, String sound1_13, YamlConfiguration yamlConfiguration) {
set("Sound." + soundName + ".Enable", true, yamlConfiguration); set("Sound." + soundName + ".Enable", true, yamlConfiguration);
String sound; String sound;
@ -68,6 +97,9 @@ public class T2Cconfig {
set("Sound." + soundName + ".Sound", sound, yamlConfiguration); set("Sound." + soundName + ".Sound", sound, yamlConfiguration);
} }
/**
* @deprecated since version 16.7, please use the new T2CconfigWriter.
*/
public static void setSound(String soundName, String sound1_8, String sound1_13, YamlConfiguration yamlConfiguration) { public static void setSound(String soundName, String sound1_8, String sound1_13, YamlConfiguration yamlConfiguration) {
set("Sound." + soundName + ".Enable", true, yamlConfiguration); set("Sound." + soundName + ".Enable", true, yamlConfiguration);
String sound; String sound;
@ -77,19 +109,31 @@ public class T2Cconfig {
set("Sound." + soundName + ".Sound", sound, yamlConfiguration); set("Sound." + soundName + ".Sound", sound, yamlConfiguration);
} }
/**
* @deprecated since version 16.7, please use the new T2CconfigWriter.
*/
public static void setSound(String soundName, String sound, YamlConfiguration yamlConfiguration) { public static void setSound(String soundName, String sound, YamlConfiguration yamlConfiguration) {
set("Sound." + soundName + ".Enable", true, yamlConfiguration); set("Sound." + soundName + ".Enable", true, yamlConfiguration);
set("Sound." + soundName + ".Sound", sound.toString(), yamlConfiguration); set("Sound." + soundName + ".Sound", sound.toString(), yamlConfiguration);
} }
/**
* @deprecated since version 16.7, please use the new T2CconfigWriter.
*/
public static boolean selectSoundEnable(String soundName, YamlConfiguration yamlConfiguration) { public static boolean selectSoundEnable(String soundName, YamlConfiguration yamlConfiguration) {
return selectBoolean("Sound." + soundName + ".Enable", yamlConfiguration); return selectBoolean("Sound." + soundName + ".Enable", yamlConfiguration);
} }
/**
* @deprecated since version 16.7, please use the new T2CconfigWriter.
*/
public static String selectSound(String prefix, String soundName, YamlConfiguration yamlConfiguration) { public static String selectSound(String prefix, String soundName, YamlConfiguration yamlConfiguration) {
return select(prefix, "Sound." + soundName + ".Sound", yamlConfiguration); return select(prefix, "Sound." + soundName + ".Sound", yamlConfiguration);
} }
/**
* @deprecated since version 16.7, please use the new T2CconfigWriter.
*/
public static Sound checkSound(String sound1_8, String sound1_9, String sound1_13, String selectSoundFromConfig, String prefix) { public static Sound checkSound(String sound1_8, String sound1_9, String sound1_13, String selectSoundFromConfig, String prefix) {
String SOUND; String SOUND;
if (T2CmcVersion.isMc1_8()) { if (T2CmcVersion.isMc1_8()) {
@ -101,6 +145,9 @@ public class T2Cconfig {
return checkSound(SOUND, selectSoundFromConfig, prefix); return checkSound(SOUND, selectSoundFromConfig, prefix);
} }
/**
* @deprecated since version 16.7, please use the new T2CconfigWriter.
*/
public static Sound checkSound(String sound1_8, String sound1_13, String selectSoundFromConfig, String prefix) { public static Sound checkSound(String sound1_8, String sound1_13, String selectSoundFromConfig, String prefix) {
String SOUND; String SOUND;
if (T2CmcVersion.isMc1_8()) { if (T2CmcVersion.isMc1_8()) {
@ -110,6 +157,9 @@ public class T2Cconfig {
return checkSound(SOUND, selectSoundFromConfig, prefix); return checkSound(SOUND, selectSoundFromConfig, prefix);
} }
/**
* @deprecated since version 16.7, please use the new T2CconfigWriter.
*/
public static Sound checkSound(String sound, String selectSoundFromConfig, String prefix) { public static Sound checkSound(String sound, String selectSoundFromConfig, String prefix) {
try { try {
return Sound.valueOf(selectSoundFromConfig); return Sound.valueOf(selectSoundFromConfig);
@ -120,34 +170,58 @@ public class T2Cconfig {
} }
} }
/**
* @deprecated since version 16.7, please use the new T2CconfigWriter.
*/
public static String select(String prefix, String path, YamlConfiguration yamlConfiguration) { public static String select(String prefix, String path, YamlConfiguration yamlConfiguration) {
return T2Creplace.replace(prefix, yamlConfiguration.getString(path)); return T2Creplace.replace(prefix, yamlConfiguration.getString(path));
} }
/**
* @deprecated since version 16.7, please use the new T2CconfigWriter.
*/
public static Object selectObject(String prefix, String path, YamlConfiguration yamlConfiguration) { public static Object selectObject(String prefix, String path, YamlConfiguration yamlConfiguration) {
return T2Creplace.replaceObject(prefix, yamlConfiguration.get(path)); return T2Creplace.replaceObject(prefix, yamlConfiguration.get(path));
} }
/**
* @deprecated since version 16.7, please use the new T2CconfigWriter.
*/
public static Integer selectInt(String path, YamlConfiguration yamlConfiguration) { public static Integer selectInt(String path, YamlConfiguration yamlConfiguration) {
return (yamlConfiguration.getInt(path)); return (yamlConfiguration.getInt(path));
} }
/**
* @deprecated since version 16.7, please use the new T2CconfigWriter.
*/
public static Boolean selectBoolean(String path, YamlConfiguration yamlConfiguration) { public static Boolean selectBoolean(String path, YamlConfiguration yamlConfiguration) {
return (yamlConfiguration.getBoolean(path)); return (yamlConfiguration.getBoolean(path));
} }
/**
* @deprecated since version 16.7, please use the new T2CconfigWriter.
*/
public static Double selectDouble(String path, YamlConfiguration yamlConfiguration) { public static Double selectDouble(String path, YamlConfiguration yamlConfiguration) {
return (yamlConfiguration.getDouble(path)); return (yamlConfiguration.getDouble(path));
} }
/**
* @deprecated since version 16.7, please use the new T2CconfigWriter.
*/
public static List<String> selectList(String path, YamlConfiguration yamlConfiguration) { public static List<String> selectList(String path, YamlConfiguration yamlConfiguration) {
return (yamlConfiguration.getStringList(path)); return (yamlConfiguration.getStringList(path));
} }
/**
* @deprecated since version 16.7, please use the new T2CconfigWriter.
*/
public static ItemStack selectItemStack(String path, YamlConfiguration yamlConfiguration) { public static ItemStack selectItemStack(String path, YamlConfiguration yamlConfiguration) {
return (yamlConfiguration.getItemStack(path)); return (yamlConfiguration.getItemStack(path));
} }
/**
* @deprecated since version 16.7, please use the new T2CconfigWriter.
*/
public static List<String> selectList(String prefix, String path, YamlConfiguration yamlConfiguration) { public static List<String> selectList(String prefix, String path, YamlConfiguration yamlConfiguration) {
List<String> output = new ArrayList<>(); List<String> output = new ArrayList<>();
List<String> input = yamlConfiguration.getStringList(path); List<String> input = yamlConfiguration.getStringList(path);
@ -157,6 +231,9 @@ public class T2Cconfig {
return output; return output;
} }
/**
* @deprecated since version 16.7, please use the new T2CconfigWriter.
*/
public static void select(String prefix, List<String> value, String path, YamlConfiguration yamlConfiguration) { public static void select(String prefix, List<String> value, String path, YamlConfiguration yamlConfiguration) {
List<String> output = new ArrayList<>(); List<String> output = new ArrayList<>();
List<String> input = yamlConfiguration.getStringList(path); List<String> input = yamlConfiguration.getStringList(path);

View File

@ -20,7 +20,8 @@ public class T2CconfigWriter {
public static void createConfig(File configFile, T2CconfigItem[] values, String... header) { public static void createConfig(File configFile, T2CconfigItem[] values, String... header) {
if (!configFile.exists()) { boolean exist = configFile.exists();
if (!exist) {
configFile.getParentFile().mkdirs(); configFile.getParentFile().mkdirs();
try { try {
configFile.createNewFile(); configFile.createNewFile();
@ -33,19 +34,22 @@ public class T2CconfigWriter {
config = YamlConfiguration.loadConfiguration(configFile); config = YamlConfiguration.loadConfiguration(configFile);
Map<String, List<String>> comments = new LinkedHashMap<>(); Map<String, List<String>> comments = new LinkedHashMap<>();
for(T2CconfigItem value : values){ for (T2CconfigItem value : values) {
if ((value.getForceSet() && exist) || (!exist && !value.getForceSet())) {
config.addDefault(value.getPath(), value.getValue()); config.addDefault(value.getPath(), value.getValue());
comments.put(value.getPath(), value.getComments()); comments.put(value.getPath(), value.getComments());
} }
}
// Copy default values if they are missing // Copy default values if they are missing
config.options().copyDefaults(true); config.options().copyDefaults(true);
saveConfigWithComments(configFile, comments, header); saveConfigWithComments(configFile, comments, header);
readConfig(config,values); readConfig(config, values);
} }
private static void readConfig(FileConfiguration config, T2CconfigItem[] values) { private static void readConfig(FileConfiguration config, T2CconfigItem[] values) {
for(T2CconfigItem value : values){ for (T2CconfigItem value : values) {
value.setValue(config.get(value.getPath())); value.setValue(config.get(value.getPath()));
} }
} }
@ -53,7 +57,7 @@ public class T2CconfigWriter {
private static void saveConfigWithComments(File file, Map<String, List<String>> comments, String... headers) { private static void saveConfigWithComments(File file, Map<String, List<String>> comments, String... headers) {
try { try {
StringBuilder configContent = new StringBuilder(); StringBuilder configContent = new StringBuilder();
for(String h : headers){ for (String h : headers) {
configContent.append(h).append("\n"); configContent.append(h).append("\n");
} }
configContent.append("\n"); configContent.append("\n");
@ -77,7 +81,7 @@ public class T2CconfigWriter {
// Add comment if it exists for this key // Add comment if it exists for this key
List<String> commentList = comments.get(fullKey); List<String> commentList = comments.get(fullKey);
if (commentList != null) { if (commentList != null) {
for(String c : commentList){ for (String c : commentList) {
builder.append(indent).append("# ").append(c).append("\n"); builder.append(indent).append("# ").append(c).append("\n");
} }
} }

View File

@ -16,45 +16,55 @@ public class T2CLibConfig {
public enum VALUES implements T2CconfigItem { public enum VALUES implements T2CconfigItem {
updateCheckOnJoin("plugin.updateCheck.onJoin", true, "In this option you can set if players with the permission 't2code.lib.updatemsg' will get an update message on join when an update for the plugin is available."), updateCheckOnJoin("plugin.updateCheck.onJoin", true, true,"In this option you can set if players with the permission 't2code.lib.updatemsg' will get an update message on join when an update for the plugin is available."),
updateCheckTimeInterval("plugin.updateCheck.timeInterval", 60, "In this option you can set the time interval in minutes in which updates should be checked."), updateCheckTimeInterval("plugin.updateCheck.timeInterval", 60, true,"In this option you can set the time interval in minutes in which updates should be checked."),
seePreReleaseUpdates("plugin.updateCheck.seePreReleaseUpdates", true, "In this option you can set whether you want to receive and display beta and snapshot versions in the update check."), seePreReleaseUpdates("plugin.updateCheck.seePreReleaseUpdates", true, true,"In this option you can set whether you want to receive and display beta and snapshot versions in the update check."),
updateCheckFullDisable("plugin.updateCheck.allPlugins.fullDisable", false, "This option deactivates all update checks for plugins that use the T2CodeLib."), updateCheckFullDisable("plugin.updateCheck.allPlugins.fullDisable", false, true,"This option deactivates all update checks for plugins that use the T2CodeLib."),
debug("plugin.debug.debugModus", false, "The debug mode sends more detailed debug information to the console.", "In this version of the plugin no debug messages are built in!"), debug("plugin.debug.debugModus", false,true, "The debug mode sends more detailed debug information to the console.", "In this version of the plugin no debug messages are built in!"),
developerTool("plugin.debug.developerTool", false, "This option activates advanced tools for the developers of plugins that use the T2CodeLib.", "If you don't know exactly what this is for, you should leave it deactivated!"), developerTool("plugin.debug.developerTool", false, true,"This option activates advanced tools for the developers of plugins that use the T2CodeLib.", "If you don't know exactly what this is for, you should leave it deactivated!"),
language("plugin.language", "english", "In this option you can set the language of the plugin."), language("plugin.language", "english", true,"In this option you can set the language of the plugin."),
space_proxy("proxy", null, ""), space_proxy("proxy", null, true,""),
proxy("proxy.enable", T2CodeLibMain.getIsBungee(), "This option must be activated if you use the T2CodeLib on a BungeeCord, Waterfall or Velocity Proxy as a bridge." proxy("proxy.enable", T2CodeLibMain.getIsBungee(), true,"This option must be activated if you use the T2CodeLib on a BungeeCord, Waterfall or Velocity Proxy as a bridge."
, "Please note that the individual APIs of the plugins that use a bridge on a proxy must be activated in the config.yml of the T2CodeLib on the proxy!"), , "Please note that the individual APIs of the plugins that use a bridge on a proxy must be activated in the config.yml of the T2CodeLib on the proxy!"),
serverUUID("proxy.serverUUID", UUID.randomUUID(), "This UUID is used for the communication of the plugins in a network with several servers.", "This UUID may only occur once in a network!"), serverUUID("proxy.serverUUID", UUID.randomUUID(),true, "This UUID is used for the communication of the plugins in a network with several servers.", "This UUID may only occur once in a network!"),
space_player("player", null, ""), space_player("player", null, true,""),
inventoriesCloseByServerStop("player.inventories.closeByServerStop", true, "If this option is enabled, all players on the server (spigot, paper, etc.) will have their inventory / GUIs closed when the server is shut down or restarted.", inventoriesCloseByServerStop("player.inventories.closeByServerStop", true, true,"If this option is enabled, all players on the server (spigot, paper, etc.) will have their inventory / GUIs closed when the server is shut down or restarted.",
"This does not mean the entire network if a proxy is used),", "the inventory / GUIs are closed if players have them open when the server is shut down or restarted."), "This does not mean the entire network if a proxy is used),", "the inventory / GUIs are closed if players have them open when the server is shut down or restarted."),
space_command("command", null, ""), space_command("command", null, true,""),
test("opWhitelist.whitelist", null, true,"Test"),
testp1n("opWhitelist.whitelist.player1.name", "PlayerName", false,"Test"),
testp1u("opWhitelist.whitelist.player1.uuid", "00000000000000000000000000000000", false,"Test"),
commandPermToggleCommand("command.permToggle.permissionSetCommand", "lp user [player] permission set [perm] [value]", commandPermToggleCommand("command.permToggle.permissionSetCommand", "lp user [player] permission set [perm] [value]",
"This option specifies which command is to be used for the T2CodeLib command '/t2code permtoggle <player> <permission>'."), true,"This option specifies which command is to be used for the T2CodeLib command '/t2code permtoggle <player> <permission>'."),
; ;
private final String path; private final String path;
private Object value; private Object value;
private final boolean forceSet;
private final List<String> comments; private final List<String> comments;
VALUES(String path, Object value, String... comments) { VALUES(String path, Object value,boolean forceSet, String... comments) {
this.path = path; this.path = path;
this.value = value; this.value = value;
this.forceSet = forceSet;
this.comments = new ArrayList<>(Arrays.asList(comments)); this.comments = new ArrayList<>(Arrays.asList(comments));
} }
@ -68,6 +78,11 @@ public class T2CLibConfig {
return value; return value;
} }
@Override
public boolean getForceSet() {
return forceSet;
}
@Override @Override
public List<String> getComments() { public List<String> getComments() {
return comments; return comments;

View File

@ -0,0 +1,24 @@
// This class was created by JaTiTV.
package net.t2code.t2codelib.SPIGOT.system.config.config;
import net.t2code.t2codelib.T2CconfigItem;
import org.bukkit.configuration.ConfigurationSection;
import java.util.List;
public class test {
/**
public void test(){
ConfigurationSection test = (ConfigurationSection) T2CLibConfig.VALUES.test.getValue();
for (String key : test.getConfigurationSection("").getKeys(false)) {
String name = test.getString(key + ".Playername");//value.pathPlayerName.replace("KEY", key));
PlayerObject playerObject = new PlayerObject(
name,
test.getString(key + ".UUID")//value.pathPlayerUuid.replace("KEY", key)).replace("-", ""));
PlayerCache.getOpHashMap().put(name, playerObject);
}
}
*/
}

View File

@ -4,8 +4,32 @@ package net.t2code.t2codelib;
import java.util.List; import java.util.List;
public interface T2CconfigItem { public interface T2CconfigItem {
/**
* Returns the path of the option for the config
* @return Config path of the option
*/
String getPath(); String getPath();
/**
* Returns the default value of the option and, after reading the config, the value from the config
* @return Value of the option
*/
Object getValue(); Object getValue();
/**
* Here you determine whether the value should always be set (true) or only when the config is first created (false)
*/
boolean getForceSet();
/**
* Set the description of the option here, the '# ' is automatically set in front of it
*/
List<String> getComments(); List<String> getComments();
void setValue(Object newValue);
/**
* This @void is used to reset the value of @getValue()
*/
default void setValue(Object newValue){
}
} }

View File

@ -17,24 +17,25 @@ import java.util.List;
public class T2CVlibConfig { public class T2CVlibConfig {
public enum VALUES implements T2CconfigItem { public enum VALUES implements T2CconfigItem {
updateTimer("updateCheck.timerInMin", 60, "In this option you can set the time interval in minutes in which updates should be checked."), updateTimer("updateCheck.timerInMin", 60, true, "In this option you can set the time interval in minutes in which updates should be checked."),
seePreReleaseUpdates("updateCheck.seePreReleaseUpdates", true, "In this option you can set whether you want to receive and display beta and snapshot versions in the update check."), seePreReleaseUpdates("updateCheck.seePreReleaseUpdates", true, true, "In this option you can set whether you want to receive and display beta and snapshot versions in the update check."),
debug("plugin.debug.debugModus", false, "The debug mode sends more detailed debug information to the console."), debug("plugin.debug.debugModus", false, true, "The debug mode sends more detailed debug information to the console."),
apiCommandGUIEnable("api.commandGUI.enable", false, "With this option you activate the api interface for the T2C-CommandGUI plugin."), apiCommandGUIEnable("api.commandGUI.enable", false, true, "With this option you activate the api interface for the T2C-CommandGUI plugin."),
apiAutoResponse("api.autoResponse.enable", false, "With this option you activate the api interface for the T2C-AutoResponse plugin."), apiAutoResponse("api.autoResponse.enable", false, true, "With this option you activate the api interface for the T2C-AutoResponse plugin."),
apiOpSecurity("api.opSecurity.enable", false, "With this option you activate the api interface for the T2C-OPSecurity plugin."), apiOpSecurity("api.opSecurity.enable", false, true, "With this option you activate the api interface for the T2C-OPSecurity plugin."),
; ;
private final String path; private final String path;
private Object value; private Object value;
private final boolean forceSet;
private final List<String> comments; private final List<String> comments;
VALUES(String path, Object value, String... comments) { VALUES(String path, Object value, boolean forceSet, String... comments) {
this.path = path; this.path = path;
this.value = value; this.value = value;
this.forceSet = forceSet;
this.comments = new ArrayList<>(Arrays.asList(comments)); this.comments = new ArrayList<>(Arrays.asList(comments));
} }
@ -48,6 +49,11 @@ public class T2CVlibConfig {
return value; return value;
} }
@Override
public boolean getForceSet() {
return forceSet;
}
@Override @Override
public List<String> getComments() { public List<String> getComments() {
return comments; return comments;