16.7_dev-24

This commit is contained in:
JaTiTV 2024-07-05 22:40:29 +02:00
parent a350f9fb00
commit c7e392a0f0
10 changed files with 37 additions and 12 deletions

View File

@ -2,6 +2,7 @@
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile default="true" name="Default" enabled="true" />
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />

View File

@ -31,5 +31,19 @@
</list>
</option>
</inspection_tool>
<inspection_tool class="unused" enabled="false" level="WARNING" enabled_by_default="false" checkParameterExcludingHierarchy="false">
<option name="LOCAL_VARIABLE" value="true" />
<option name="FIELD" value="true" />
<option name="METHOD" value="true" />
<option name="CLASS" value="true" />
<option name="PARAMETER" value="true" />
<option name="REPORT_PARAMETER_FOR_PUBLIC_METHODS" value="true" />
<option name="ADD_MAINS_TO_ENTRIES" value="true" />
<option name="ADD_APPLET_TO_ENTRIES" value="true" />
<option name="ADD_SERVLET_TO_ENTRIES" value="true" />
<option name="ADD_NONJAVA_TO_ENTRIES" value="true" />
<option name="selected" value="true" />
<option name="mixinEntryPoint" value="true" />
</inspection_tool>
</profile>
</component>

View File

@ -6,7 +6,7 @@
<groupId>net.t2code</groupId>
<artifactId>T2CodeLib</artifactId>
<version>16.7_dev-22</version>
<version>16.7_dev-24</version>
<!--version>VERSION_snapshot-0</version-->
<!--version>VERSION_beta-0</version-->
<!--version>VERSION_dev-0</version-->

View File

@ -64,7 +64,7 @@ public class T2C_ConfigWriter {
// Copy default values if they are missing
config.options().copyDefaults(true);
T2C_YmlWriter.saveConfigWithComments(configFile, config, comments, header);
T2C_YmlWriter.saveConfigWithComments(configFile, config, comments, false,header);
readConfig(prefix, configFile, config, values, isReload);
}

View File

@ -61,7 +61,7 @@ public class T2C_LanguageWriter {
comments.put(item.getPath(), commandList);
}
}
T2C_YmlWriter.saveConfigWithComments(langFile, config, comments, header);
T2C_YmlWriter.saveConfigWithComments(langFile, config, comments, true, header);
}
}
readConfig(prefix, path, values, loadConfig, isReload);

View File

@ -12,14 +12,14 @@ import java.util.List;
import java.util.Map;
public class T2C_YmlWriter {
protected static void saveConfigWithComments(File file, FileConfiguration config, Map<String, List<String>> comments, String... headers) {
protected static void saveConfigWithComments(File file, FileConfiguration config, Map<String, List<String>> comments, boolean oneListToString,String... headers) {
try {
StringBuilder configContent = new StringBuilder();
for (String h : headers) {
configContent.append(h).append("\n");
}
configContent.append("\n");
addSection(config, comments, configContent, "", 0);
addSection(config, comments, configContent, "", 0,oneListToString);
// Write the content to the file
Files.write(file.toPath(), configContent.toString().getBytes());
@ -28,7 +28,7 @@ public class T2C_YmlWriter {
}
}
protected static void addSection(ConfigurationSection section, Map<String, List<String>> comments, StringBuilder builder, String prefix, int indentLevel) {
protected static void addSection(ConfigurationSection section, Map<String, List<String>> comments, StringBuilder builder, String prefix, int indentLevel, boolean oneListToString) {
String indent = " ".repeat(indentLevel);
for (String key : section.getKeys(false)) {
@ -49,12 +49,19 @@ public class T2C_YmlWriter {
if (value instanceof ConfigurationSection) {
// Correctly add the section
builder.append(indent).append(key).append(":\n");
addSection((ConfigurationSection) value, comments, builder, fullKey, indentLevel + 1);
addSection((ConfigurationSection) value, comments, builder, fullKey, indentLevel + 1, oneListToString);
} else {
// Add value with proper indentation
// builder.append(indent).append(key).append(": ").append(value).append("\n");
if (value instanceof List) {
List<?> list = (List<?>) value;
if (oneListToString && list.size() == 1) {
for (Object s : list) {
builder.append(indent).append(key).append(": \"").append(s).append("\"\n");
}
continue;
}
if (list.isEmpty()) {
builder.append(indent).append(key).append(": []").append("\n");
continue;

View File

@ -13,9 +13,11 @@ public class ConvertT2ClibConfig {
public static void convert() {
File config = new File(T2C_Main.getPath(), "config.yml");
yamlConfiguration = YamlConfiguration.loadConfiguration(config);
if (!config.exists()) return;
yamlConfiguration = YamlConfiguration.loadConfiguration(config);
if (yamlConfiguration.contains("plugin.updateCheck.onJoin")) return;
set("Plugin.UpdateCheck.OnJoin", T2C_LibConfig.VALUES.updateCheckOnJoin);

View File

@ -59,9 +59,9 @@ public class T2C_LibConfig {
space_proxy("proxy", null, true,
new HashMap<>() {{
put(T2C_LanguageEnum.german, List.of());
put(T2C_LanguageEnum.english, List.of());
put(T2C_LanguageEnum.english, List.of("For this option, the option proxy.enable in the config.yml of the T2CodeLib must be set to true and the T2CodeLib must also be present on the proxy in order to function as a bridge."));
}}),
proxy("For this option, the option proxy.enable in the config.yml of the T2CodeLib must be set to true and the T2CodeLib must also be present on the proxy in order to function as a bridge.", T2C_Main.getIsBungee(), true,
proxy("proxy.enable", T2C_Main.getIsBungee(), true,
new HashMap<>() {{
put(T2C_LanguageEnum.german, List.of("Diese Option muss aktiviert werden, wenn du die T2CodeLib auf einem BungeeCord, Waterfall oder Velocity Proxy als Bridge verwenden möchtest."
, "Bitte beachte, dass die einzelnen APIs der Plugins, die eine Bridge auf einem Proxy verwenden, in der config.yml der T2CodeLib auf dem Proxy aktiviert werden müssen!"));
@ -148,7 +148,7 @@ public class T2C_LibConfig {
public static void set(boolean isReload) {
long long_ = System.currentTimeMillis();
ConvertT2ClibConfig.convert();
// ConvertT2ClibConfig.convert(); todo
T2C_ConfigWriter.createConfig(T2C_Util.getPrefix(), new File(T2C_Main.getPath(), "config.yml"), VALUES.values(), isReload, T2C_Util.getConfigLogo());
}

View File

@ -17,6 +17,7 @@ public class T2CV_Send {
public static void console(Logger logger, String msg) {
if (msg == null || msg.contains("[empty]")) return;
logger.info(msg);
}
public static void player(Player player, String msg) {

View File

@ -11,7 +11,6 @@ import com.velocitypowered.api.proxy.ProxyServer;
import com.velocitypowered.api.proxy.messages.MinecraftChannelIdentifier;
import lombok.Getter;
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
import net.t2code.t2codelib.util.T2C_GenerateFrame;
import net.t2code.t2codelib.util.T2C_PlatformDetector;
import net.t2code.t2codelib.util.T2C_Util;
@ -73,6 +72,7 @@ public class T2CV_Main {
logger.info(T2C_GenerateFrame.setCenterAligned("", "Spigot: " + T2C_Util.getSpigot()));
logger.info(T2C_GenerateFrame.setCenterAligned("", "Discord: " + T2C_Util.getDiscord()));
try {
T2CV_LibConfig.set(dataDirectory, logger);
} catch (IOException ex) {