Compare commits

..

2 Commits

6 changed files with 63 additions and 18 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-->

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

@ -20,8 +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) {
boolean exist = false; boolean exist = configFile.exists();
if (!configFile.exists()) { if (!exist) {
configFile.getParentFile().mkdirs(); configFile.getParentFile().mkdirs();
try { try {
configFile.createNewFile(); configFile.createNewFile();
@ -35,7 +35,7 @@ public class T2CconfigWriter {
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()){ 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());
} }

View File

@ -44,6 +44,14 @@ public class T2CLibConfig {
space_command("command", null, true,""), 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]",
true,"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>'."),
; ;

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

@ -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;