development status

add EnumManager
This commit is contained in:
JaTiTV 2024-07-01 03:18:32 +02:00
parent 2ac9c890f6
commit a05223333c
15 changed files with 488 additions and 100 deletions

View File

@ -14,5 +14,5 @@
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="corretto-17" project-jdk-type="JavaSDK" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_16" default="true" project-jdk-name="16" project-jdk-type="JavaSDK" />
</project>

View File

@ -27,8 +27,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
<plugin>

View File

@ -48,13 +48,12 @@ public class T2CBupdateAPI {
private static String pluginVersion;
public static void onUpdateCheckTimer(Plugin plugin, String prefix, String discord, Integer spigotID, String url) {
Integer finalInterval;
if (T2CBlibConfig.getUpdateTimer() < 1){
finalInterval = 1;
} else finalInterval = T2CBlibConfig.getUpdateTimer();
if ((int) T2CBlibConfig.VALUES.updateTimer.getValue() < 1) {
T2CBlibConfig.VALUES.updateTimer.setValue(1);
}
ProxyServer.getInstance().getScheduler().schedule(plugin, new Runnable() {
public void run() {
if (T2CBlibConfig.getUpdateCheckFullDisable()) return;
if ((boolean) T2CBlibConfig.VALUES.updateCheckFullDisable.getValue()) return;
(new T2CBupdateCheckerGit(plugin, spigotID)).getVersion((webData) -> {
pluginVersion = plugin.getDescription().getVersion();
T2CupdateObject update = new T2CupdateObject(
@ -77,6 +76,6 @@ public class T2CBupdateAPI {
}
}, pluginVersion, spigotID, url);
}
}, 0, finalInterval * 60 * 20L, TimeUnit.SECONDS);
}, 0, (int) T2CBlibConfig.VALUES.updateTimer.getValue() * 60 * 20L, TimeUnit.SECONDS);
}
}

View File

@ -26,9 +26,9 @@ public class T2CBupdateCheckerGit {
}
public void getVersion(Consumer<T2CupdateWebData> consumer, String pluginVersion, Integer spigotID, String gitKey) {
if (T2CBlibConfig.getUpdateCheckFullDisable()) return;
if ((boolean)T2CBlibConfig.VALUES.updateCheckFullDisable.getValue() ) return;
String RepoURL = "https://git.t2code.net/api/v1/repos/" + gitKey + "/releases?limit=1";
if (!T2CBlibConfig.getSeePreReleaseUpdates()) {
if (!(boolean)T2CBlibConfig.VALUES.seePreReleaseUpdates.getValue() ) {
RepoURL = RepoURL + "&pre-release=false";
}
String finalRepoURL = RepoURL;

View File

@ -0,0 +1,100 @@
// This class was created by JaTiTV.
package net.t2code.t2codelib.BUNGEE.api.yaml;
import net.md_5.bungee.config.ConfigurationProvider;
import net.md_5.bungee.config.YamlConfiguration;
import net.t2code.t2codelib.T2CconfigItem;
import net.md_5.bungee.config.Configuration;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
public class T2CBconfigWriter {
private static Configuration config;
public static void createConfig(File configFile, T2CconfigItem[] values, String... header) {
if (!configFile.exists()) {
configFile.getParentFile().mkdirs();
try {
configFile.createNewFile();
} catch (IOException e) {
e.printStackTrace();
return;
}
}
try {
config = ConfigurationProvider.getProvider(YamlConfiguration.class).load(configFile);
} catch (IOException e) {
throw new RuntimeException(e);
}
Map<String, List<String>> comments = new LinkedHashMap<>();
for(T2CconfigItem item : values){
if(!config.contains(item.getKey())){
config.set(item.getKey(), item.getValue());
}
comments.put(item.getKey(), item.getComments());
}
saveConfigWithComments(configFile, comments, header);
readConfig(config,values);
}
private static void readConfig(Configuration config, T2CconfigItem[] values) {
for(T2CconfigItem item : values){
item.setValue(config.get(item.getKey()));
}
}
private static void saveConfigWithComments(File file, Map<String, List<String>> comments, String... headers) {
try {
StringBuilder configContent = new StringBuilder();
for(String h : headers){
configContent.append("# ").append(h).append("\n");
}
configContent.append("\n");
addSection(config, comments, configContent, "", 0);
// Write the content to the file
Files.write(file.toPath(), configContent.toString().getBytes());
} catch (IOException e) {
e.printStackTrace();
}
}
private static void addSection(Configuration section, Map<String, List<String>> comments, StringBuilder builder, String prefix, int indentLevel) {
String indent = " ".repeat(indentLevel);
for (String key : section.getKeys()) {
String fullKey = prefix.isEmpty() ? key : prefix + "." + key;
Object value = section.get(key);
// Add comment if it exists for this key
List<String> commentList = comments.get(fullKey);
if (commentList != null) {
for(String c : commentList){
builder.append(indent).append("# ").append(c).append("\n");
}
}
// Check if the value is a section (nested map)
if (value instanceof Configuration) {
// Correctly add the section
builder.append(indent).append(key).append(":\n");
addSection((Configuration) value, comments, builder, fullKey, indentLevel + 1);
} else {
// Add value with proper indentation
builder.append(indent).append(key).append(": ").append(value).append("\n");
}
}
}
}

View File

@ -3,9 +3,10 @@ package net.t2code.t2codelib.BUNGEE.system;
import net.md_5.bungee.api.plugin.Plugin;
import net.t2code.t2codelib.BUNGEE.api.messages.T2CBsend;
import net.t2code.t2codelib.BUNGEE.api.update.T2CBupdateAPI;
import net.t2code.t2codelib.BUNGEE.api.yaml.T2CBconfigWriter;
import net.t2code.t2codelib.BUNGEE.system.bstats.T2CBmetrics;
import net.t2code.t2codelib.BUNGEE.system.config.T2CBlibConfig;
import net.t2code.t2codelib.BUNGEE.api.bungeePlayers.T2CBbungeePlayers;
import net.t2code.t2codelib.BUNGEE.system.config.T2CBlibConfig;
import net.t2code.t2codelib.BUNGEE.system.pluginMessaging.T2CplmsgBcmd;
import net.t2code.t2codelib.BUNGEE.system.pluginMessaging.autoResponse.T2CapiAutoResponse;
import net.t2code.t2codelib.BUNGEE.system.pluginMessaging.commandgui.T2CapiCGUI;
@ -23,16 +24,7 @@ public class T2CBload {
T2CBsend.console(prefix + " §2Discord: §6" + discord);
T2CBmetrics.Bstats(plugin, bstatsID);
try {
T2CBlibConfig.create();
} catch (IOException e) {
throw new RuntimeException(e);
}
try {
T2CBlibConfig.select();
} catch (IOException e) {
throw new RuntimeException(e);
}
T2CBlibConfig.set();
T2CBupdateAPI.onUpdateCheckTimer(plugin, prefix, discord, spigotID, url);
@ -44,16 +36,16 @@ public class T2CBload {
plugin.getProxy().getPluginManager().registerListener(plugin, new T2CBbungeePlayers());
T2CBbungeePlayers.sendToSpigotDeleteAll();
if (T2CBlibConfig.getApiCommandGUIEnable()) {
if ((boolean) T2CBlibConfig.VALUES.apiCommandGUIEnable.getValue()) {
plugin.getProxy().registerChannel("t2c:cguiopl");
plugin.getProxy().getPluginManager().registerListener(plugin, new T2CapiCGUI());
T2CapiCGUI.sendToSpigotDeleteAll();
}
if (T2CBlibConfig.getApiAutoResponse()) {
if ( (boolean)T2CBlibConfig.VALUES.apiAutoResponse.getValue() ) {
plugin.getProxy().registerChannel("t2c:aresp");
plugin.getProxy().getPluginManager().registerListener(plugin, new T2CapiAutoResponse());
}
if (T2CBlibConfig.getApiOpSecurity()) {
if ((boolean)T2CBlibConfig.VALUES.apiOpSecurity.getValue()) {
plugin.getProxy().registerChannel("t2c:t2c:opsec");
plugin.getProxy().getPluginManager().registerListener(plugin, new T2CapiOpSecurity());
}

View File

@ -1,63 +1,63 @@
package net.t2code.t2codelib.BUNGEE.system.config;
import lombok.Getter;
import net.md_5.bungee.config.Configuration;
import net.md_5.bungee.config.ConfigurationProvider;
import net.md_5.bungee.config.YamlConfiguration;
import net.t2code.t2codelib.BUNGEE.api.messages.T2CBsend;
import net.t2code.t2codelib.BUNGEE.api.yaml.T2CBconfig;
import net.t2code.t2codelib.BUNGEE.api.yaml.T2CBconfigWriter;
import net.t2code.t2codelib.BUNGEE.system.T2CodeBMain;
import net.t2code.t2codelib.T2CconfigItem;
import net.t2code.t2codelib.Util;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class T2CBlibConfig {
public static void create() throws IOException {
long long_ = System.currentTimeMillis();
File config = new File(T2CodeBMain.getPlugin().getDataFolder(), "config.yml");
if (!T2CodeBMain.getPlugin().getDataFolder().exists()) T2CodeBMain.getPlugin().getDataFolder().mkdir();
if (!config.exists()) {
config.createNewFile();
}
Configuration configuration = ConfigurationProvider.getProvider(YamlConfiguration.class).load(config);
T2CBconfig.set("UpdateCheck.TimerInMin", 60, configuration);
T2CBconfig.set("UpdateCheck.SeePreReleaseUpdates", true, configuration);
T2CBconfig.set("Plugin.UpdateCheck.AllPlugins.FullDisable", false, configuration);
public enum VALUES implements T2CconfigItem{
updateTimer("UpdateCheck.TimerInMin", 60),
seePreReleaseUpdates("UpdateCheck.SeePreReleaseUpdates", true),
updateCheckFullDisable("Plugin.UpdateCheck.AllPlugins.FullDisable", false),
T2CBconfig.set("API.CommandGUI.Enable", false, configuration);
T2CBconfig.set("API.AutoResponse.Enable", false, configuration);
T2CBconfig.set("API.OPSecurity.Enable", false, configuration);
apiCommandGUIEnable("API.CommandGUI.Enable", false, "Aktiviere die API für CommandGUI"),
apiAutoResponse("API.AutoResponse.Enable", false),
apiOpSecurity("API.OPSecurity.Enable", false),
ConfigurationProvider.getProvider(YamlConfiguration.class).save(configuration, config);
T2CBsend.console(Util.getPrefix() + " §2config.yml were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
;
private final String key;
private Object value;
private final List<String> comments;
VALUES(String key, Object value, String... comments) {
this.key = key;
this.value = value;
this.comments = new ArrayList<>(Arrays.asList(comments));
}
public static void select() throws IOException {
File config = new File(T2CodeBMain.getPlugin().getDataFolder(), "config.yml");
Configuration configuration = ConfigurationProvider.getProvider(YamlConfiguration.class).load(config);
updateTimer = configuration.getInt("UpdateCheck.TimerInMin");
seePreReleaseUpdates = configuration.getBoolean("UpdateCheck.SeePreReleaseUpdates");
updateCheckFullDisable = configuration.getBoolean("Plugin.UpdateCheck.AllPlugins.FullDisable");
apiCommandGUIEnable = configuration.getBoolean("API.CommandGUI.Enable");
apiAutoResponse = configuration.getBoolean("API.AutoResponse.Enable");
apiOpSecurity = configuration.getBoolean("API.OPSecurity.Enable");
@Override
public String getKey() {
return key;
}
@Getter
private static Integer updateTimer;
@Getter
private static Boolean seePreReleaseUpdates;
@Getter
private static Boolean updateCheckFullDisable;
@Getter
private static Boolean apiCommandGUIEnable;
@Getter
private static Boolean apiAutoResponse;
@Getter
private static Boolean apiOpSecurity;
@Override
public Object getValue() {
return value;
}
@Override
public List<String> getComments() {
return comments;
}
@Override
public void setValue(Object newValue) {
value = newValue;
}
}
public static void set(){
T2CBconfigWriter.createConfig(new File(T2CodeBMain.getPlugin().getDataFolder(), "config.yml"), VALUES.values(), Util.getLogo());
}
}

View File

@ -0,0 +1,81 @@
// This class was created by JaTiTV.
package net.t2code.t2codelib.SPIGOT.api.yaml;
import net.t2code.t2codelib.T2CconfigItem;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class T2CconfigEnumManager {
private final List<AdditionalEnum> additionalEnums = new ArrayList<>();
public static class AdditionalEnum implements T2CconfigItem {
private final String key;
private String path;
private Object value;
private List<String> comments;
public AdditionalEnum(String key, String path, Object value, String... comments) {
this.key = key;
this.path = path;
this.value = value;
this.comments = new ArrayList<>(Arrays.asList(comments));
}
@Override
public String getKey() {
return key;
}
@Override
public Object getValue() {
return value;
}
@Override
public List<String> getComments() {
return comments;
}
@Override
public void setValue(Object newValue) {
value = newValue;
}
}
// Method to add or change an "enum" value
public void addOrChangeEnum(Object key, String path, Object value, String... comments) {
// Check if the key already exists
for (AdditionalEnum enumValue : additionalEnums) {
if (enumValue.key.equals(key)) {
// Update existing enum
enumValue.path = path;
enumValue.value = value;
enumValue.comments = Arrays.asList(comments);
return;
}
}
// Add new enum
AdditionalEnum newEnum = new AdditionalEnum(key.toString(), path, value, comments);
additionalEnums.add(newEnum);
}
// Method to retrieve all enums (original and additional)
public List<AdditionalEnum> getAllEnums() {
return new ArrayList<>(additionalEnums);
}
// Method to retrieve specific enum details
public AdditionalEnum getEnumDetails(Object key) {
for (AdditionalEnum e : additionalEnums) {
if (e.key.equals(key.toString())) {
return e;
}
}
return null;
}
}

View File

@ -0,0 +1,96 @@
// This class was created by JaTiTV.
package net.t2code.t2codelib.SPIGOT.api.yaml;
import net.t2code.t2codelib.T2CconfigItem;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
public class T2CconfigWriter {
private static FileConfiguration config;
public static void createConfig(File configFile, T2CconfigEnumManager manager, String... header) {
if (!configFile.exists()) {
configFile.getParentFile().mkdirs();
try {
configFile.createNewFile();
} catch (IOException e) {
e.printStackTrace();
return;
}
}
config = YamlConfiguration.loadConfiguration(configFile);
Map<String, List<String>> comments = new LinkedHashMap<>();
for(T2CconfigEnumManager.AdditionalEnum item : manager.getAllEnums()){
config.addDefault(item.getKey(), item.getValue());
comments.put(item.getKey(), item.getComments());
}
// Copy default values if they are missing
config.options().copyDefaults(true);
saveConfigWithComments(configFile, comments, header);
readConfig(config,values);
}
private static void readConfig(FileConfiguration config, T2CconfigItem[] values) {
for(T2CconfigItem item : values){
item.setValue(config.get(item.getKey()));
}
}
private static void saveConfigWithComments(File file, Map<String, List<String>> comments, String... headers) {
try {
StringBuilder configContent = new StringBuilder();
for(String h : headers){
configContent.append("# ").append(h).append("\n");
}
configContent.append("\n");
addSection(config, comments, configContent, "", 0);
// Write the content to the file
Files.write(file.toPath(), configContent.toString().getBytes());
} catch (IOException e) {
e.printStackTrace();
}
}
private static void addSection(ConfigurationSection section, Map<String, List<String>> comments, StringBuilder builder, String prefix, int indentLevel) {
String indent = " ".repeat(indentLevel);
for (String key : section.getKeys(false)) {
String fullKey = prefix.isEmpty() ? key : prefix + "." + key;
Object value = section.get(key);
// Add comment if it exists for this key
List<String> commentList = comments.get(fullKey);
if (commentList != null) {
for(String c : commentList){
builder.append(indent).append("# ").append(c).append("\n");
}
}
// Check if the value is a section (nested map)
if (value instanceof ConfigurationSection) {
// Correctly add the section
builder.append(indent).append(key).append(":\n");
addSection((ConfigurationSection) value, comments, builder, fullKey, indentLevel + 1);
} else {
// Add value with proper indentation
builder.append(indent).append(key).append(": ").append(value).append("\n");
}
}
}
}

View File

@ -131,7 +131,7 @@ public final class T2CodeLibMain extends JavaPlugin {
plugin.getCommand("t2code").setExecutor(new CmdExecuter());
ConfigCreate.configCreate();
ConfigCreate.set();
T2CitemVersion.scan();
LanguagesCreate.langCreate();
SelectLibConfig.onSelect();

View File

@ -1,46 +1,87 @@
package net.t2code.t2codelib.SPIGOT.system.config.config;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import net.t2code.t2codelib.SPIGOT.api.yaml.T2Cconfig;
import net.t2code.t2codelib.SPIGOT.api.yaml.T2CconfigEnumManager;
import net.t2code.t2codelib.SPIGOT.api.yaml.T2CconfigWriter;
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
import net.t2code.t2codelib.T2CconfigItem;
import net.t2code.t2codelib.Util;
import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class ConfigCreate {
public static void configCreate() {
long long_ = System.currentTimeMillis();
if (new File(T2CodeLibMain.getPath(), "config.yml").exists()){
if (T2CodeLibMain.getPlugin().getConfig().getBoolean("Plugin.Debug")) T2Csend.console(Util.getPrefix() + " §5DEBUG: §6" + " §4config.yml are created / updated...");
} else T2Csend.console(Util.getPrefix() + " §4config.yml are created...");
/**
public enum VALUES implements T2CconfigItem {
updateCheckOnJoin("plugin.updateCheck.onJoin", true),
updateCheckTimeInterval("plugin.updateCheck.timeInterval", 60),
seePreReleaseUpdates("plugin.updateCheck.seePreReleaseUpdates", true),
updateCheckFullDisable("plugin.updateCheck.allPlugins.FullDisable", false),
debug("plugin.debug.debugModus", false),
developerTool("plugin.debug.developerTool", true),
language("plugin.language", "english"),
bungee("proxy.enable", T2CodeLibMain.getIsBungee()),
inventoriesCloseByServerStop("player.inventories.closeByServerStop", true),
commandPermToggleCommand("command.permToggle.permissionSetCommand", "lp user [player] permission set [perm] [value]"),
;
File config = new File(T2CodeLibMain.getPath(), "config.yml");
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
private final String key;
private Object value;
private final List<String> comments;
T2Cconfig.set("Plugin.UpdateCheck.OnJoin", true, yamlConfiguration);
T2Cconfig.set("Plugin.UpdateCheck.TimeInterval", 60, yamlConfiguration);
T2Cconfig.set("Plugin.UpdateCheck.SeePreReleaseUpdates", true, yamlConfiguration);
T2Cconfig.set("Plugin.UpdateCheck.AllPlugins.FullDisable", false, yamlConfiguration);
T2Cconfig.set("Plugin.language", "english", yamlConfiguration);
T2Cconfig.set("Plugin.Not recommended to disable.developerTool", true, yamlConfiguration);
T2Cconfig.set("BungeeCord.Enable", T2CodeLibMain.getIsBungee(), yamlConfiguration);
T2Cconfig.set("Player.Inventories.CloseByServerStop", true, yamlConfiguration);
T2Cconfig.set("Command.PermToggle.PermissionSetCommand","lp user [player] permission set [perm] [value]",yamlConfiguration);
try {
yamlConfiguration.save(config);
} catch (IOException e) {
e.printStackTrace();
VALUES(String key, Object value, String... comments) {
this.key = key;
this.value = value;
this.comments = new ArrayList<>(Arrays.asList(comments));
}
@Override
public String getKey() {
return key;
}
@Override
public Object getValue() {
return value;
}
@Override
public List<String> getComments() {
return comments;
}
@Override
public void setValue(Object newValue) {
value = newValue;
}
}
*/
public static final T2CconfigEnumManager manager = new T2CconfigEnumManager();
public static void set() {
long long_ = System.currentTimeMillis();
manager.addOrChangeEnum(ConfigKey.updateCheckOnJoin, "plugin.updateCheck.onJoin", true);
manager.addOrChangeEnum(ConfigKey.updateCheckTimeInterval, "plugin.updateCheck.timeInterval", 60);
manager.addOrChangeEnum(ConfigKey.seePreReleaseUpdates, "plugin.updateCheck.seePreReleaseUpdates", true);
manager.addOrChangeEnum(ConfigKey.updateCheckFullDisable, "plugin.updateCheck.allPlugins.FullDisable", false);
manager.addOrChangeEnum(ConfigKey.debug, "plugin.debug.debugModus", false);
manager.addOrChangeEnum(ConfigKey.developerTool, "plugin.debug.developerTool", true);
manager.addOrChangeEnum(ConfigKey.language, "plugin.language", "english");
manager.addOrChangeEnum(ConfigKey.bungee, "proxy.enable", T2CodeLibMain.getIsBungee());
manager.addOrChangeEnum(ConfigKey.inventoriesCloseByServerStop, "player.inventories.closeByServerStop", true);
manager.addOrChangeEnum(ConfigKey.commandPermToggleCommand, "command.permToggle.permissionSetCommand", "lp user [player] permission set [perm] [value]");
T2CconfigWriter.createConfig(new File(T2CodeLibMain.getPath(), "config.yml"), manager.getAllEnums(), "PL von", "Jattitv");
T2CconfigWriter.createConfig(new File(T2CodeLibMain.getPath(), "config.yml"), VALUES.values(), "PL von", "Jattitv");
T2Csend.console(Util.getPrefix() + " §2config.yml were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
}
}

View File

@ -0,0 +1,14 @@
package net.t2code.t2codelib.SPIGOT.system.config.config;
public enum ConfigKey {
updateCheckOnJoin,
updateCheckTimeInterval,
seePreReleaseUpdates,
updateCheckFullDisable,
debug,
developerTool,
language,
bungee,
inventoriesCloseByServerStop,
commandPermToggleCommand
}

View File

@ -1,10 +1,14 @@
package net.t2code.t2codelib.SPIGOT.system.config.config;
import lombok.Getter;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import net.t2code.t2codelib.SPIGOT.api.yaml.T2Cconfig;
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
import net.t2code.t2codelib.Util;
import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File;
import java.io.IOException;
public class SelectLibConfig {
@ -50,4 +54,36 @@ public class SelectLibConfig {
inventoriesCloseByServerStop = yamlConfiguration.getBoolean("Player.Inventories.CloseByServerStop");
commandPermToggleCommand = yamlConfiguration.getString("Command.PermToggle.PermissionSetCommand");
}
public static void configCreate() {
long long_ = System.currentTimeMillis();
if (new File(T2CodeLibMain.getPath(), "config.yml").exists()){
if (T2CodeLibMain.getPlugin().getConfig().getBoolean("Plugin.Debug")) T2Csend.console(Util.getPrefix() + " §5DEBUG: §6" + " §4config.yml are created / updated...");
} else T2Csend.console(Util.getPrefix() + " §4config.yml are created...");
File config = new File(T2CodeLibMain.getPath(), "config.yml");
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
T2Cconfig.set("Plugin.UpdateCheck.OnJoin", true, yamlConfiguration);
T2Cconfig.set("Plugin.UpdateCheck.TimeInterval", 60, yamlConfiguration);
T2Cconfig.set("Plugin.UpdateCheck.SeePreReleaseUpdates", true, yamlConfiguration);
T2Cconfig.set("Plugin.UpdateCheck.AllPlugins.FullDisable", false, yamlConfiguration);
T2Cconfig.set("Plugin.language", "english", yamlConfiguration);
T2Cconfig.set("Plugin.Not recommended to disable.developerTool", true, yamlConfiguration);
T2Cconfig.set("BungeeCord.Enable", T2CodeLibMain.getIsBungee(), yamlConfiguration);
T2Cconfig.set("Player.Inventories.CloseByServerStop", true, yamlConfiguration);
T2Cconfig.set("Command.PermToggle.PermissionSetCommand","lp user [player] permission set [perm] [value]",yamlConfiguration);
try {
yamlConfiguration.save(config);
} catch (IOException e) {
e.printStackTrace();
}
T2Csend.console(Util.getPrefix() + " §2config.yml were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
}
}

View File

@ -0,0 +1,11 @@
package net.t2code.t2codelib;
import java.util.List;
public interface T2CconfigItem {
String getKey();
Object getValue();
List<String> getComments();
void setValue(Object newValue);
}

View File

@ -59,4 +59,22 @@ public class Util {
"T2C-LoginPermissionAuth"
);
}
@Getter
private static final String[] logo = new String[]{
"####################################################################################################################",
"## ##",
"## /$$$$$$$$ /$$$$$$ /$$$$$$ /$$ /$$ ##",
"## |__ $$__//$$__ $$ /$$__ $$ | $$ | $$ ##",
"## | $$ |__/ \\ $$| $$ \\__/ /$$$$$$ /$$$$$$$ /$$$$$$ /$$$$$$$ /$$$$$$ /$$$$$$ ##",
"## | $$ /$$$$$$/| $$ /$$__ $$ /$$__ $$ /$$__ $$ | $$__ $$ /$$__ $$|_ $$_/ ##",
"## | $$ /$$____/ | $$ | $$ \\ $$| $$ | $$| $$$$$$$$ | $$ \\ $$| $$$$$$$$ | $$ ##",
"## | $$ | $$ | $$ $$| $$ | $$| $$ | $$| $$_____/ | $$ | $$| $$_____/ | $$ /$$ ##",
"## | $$ | $$$$$$$$| $$$$$$/| $$$$$$/| $$$$$$$| $$$$$$$ /$$| $$ | $$| $$$$$$$ | $$$$/ ##",
"## |__/ |________/ \\______/ \\______/ \\_______/ \\_______/|__/|__/ |__/ \\_______/ \\___/ ##",
"## ##",
"## T2CodeLib from JaTiTV / T2Code.net. In case of problems please contact the Discord: https://dc.t2code.net ##",
"## ##",
"####################################################################################################################"
};
}