16.7_dev-24
This commit is contained in:
parent
a350f9fb00
commit
c7e392a0f0
@ -2,6 +2,7 @@
|
|||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="CompilerConfiguration">
|
<component name="CompilerConfiguration">
|
||||||
<annotationProcessing>
|
<annotationProcessing>
|
||||||
|
<profile default="true" name="Default" enabled="true" />
|
||||||
<profile name="Maven default annotation processors profile" enabled="true">
|
<profile name="Maven default annotation processors profile" enabled="true">
|
||||||
<sourceOutputDir name="target/generated-sources/annotations" />
|
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||||
|
@ -31,5 +31,19 @@
|
|||||||
</list>
|
</list>
|
||||||
</option>
|
</option>
|
||||||
</inspection_tool>
|
</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>
|
</profile>
|
||||||
</component>
|
</component>
|
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>net.t2code</groupId>
|
<groupId>net.t2code</groupId>
|
||||||
<artifactId>T2CodeLib</artifactId>
|
<artifactId>T2CodeLib</artifactId>
|
||||||
<version>16.7_dev-22</version>
|
<version>16.7_dev-24</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-->
|
||||||
|
@ -64,7 +64,7 @@ public class T2C_ConfigWriter {
|
|||||||
// Copy default values if they are missing
|
// Copy default values if they are missing
|
||||||
config.options().copyDefaults(true);
|
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);
|
readConfig(prefix, configFile, config, values, isReload);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ public class T2C_LanguageWriter {
|
|||||||
comments.put(item.getPath(), commandList);
|
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);
|
readConfig(prefix, path, values, loadConfig, isReload);
|
||||||
|
@ -12,14 +12,14 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class T2C_YmlWriter {
|
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 {
|
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");
|
||||||
addSection(config, comments, configContent, "", 0);
|
addSection(config, comments, configContent, "", 0,oneListToString);
|
||||||
|
|
||||||
// Write the content to the file
|
// Write the content to the file
|
||||||
Files.write(file.toPath(), configContent.toString().getBytes());
|
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);
|
String indent = " ".repeat(indentLevel);
|
||||||
|
|
||||||
for (String key : section.getKeys(false)) {
|
for (String key : section.getKeys(false)) {
|
||||||
@ -49,12 +49,19 @@ public class T2C_YmlWriter {
|
|||||||
if (value instanceof ConfigurationSection) {
|
if (value instanceof ConfigurationSection) {
|
||||||
// Correctly add the section
|
// Correctly add the section
|
||||||
builder.append(indent).append(key).append(":\n");
|
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 {
|
} else {
|
||||||
// Add value with proper indentation
|
// Add value with proper indentation
|
||||||
// builder.append(indent).append(key).append(": ").append(value).append("\n");
|
// builder.append(indent).append(key).append(": ").append(value).append("\n");
|
||||||
if (value instanceof List) {
|
if (value instanceof List) {
|
||||||
List<?> list = (List<?>) value;
|
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()) {
|
if (list.isEmpty()) {
|
||||||
builder.append(indent).append(key).append(": []").append("\n");
|
builder.append(indent).append(key).append(": []").append("\n");
|
||||||
continue;
|
continue;
|
||||||
|
@ -13,9 +13,11 @@ public class ConvertT2ClibConfig {
|
|||||||
|
|
||||||
public static void convert() {
|
public static void convert() {
|
||||||
File config = new File(T2C_Main.getPath(), "config.yml");
|
File config = new File(T2C_Main.getPath(), "config.yml");
|
||||||
yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
|
||||||
|
|
||||||
if (!config.exists()) return;
|
if (!config.exists()) return;
|
||||||
|
yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||||
|
|
||||||
|
|
||||||
if (yamlConfiguration.contains("plugin.updateCheck.onJoin")) return;
|
if (yamlConfiguration.contains("plugin.updateCheck.onJoin")) return;
|
||||||
|
|
||||||
set("Plugin.UpdateCheck.OnJoin", T2C_LibConfig.VALUES.updateCheckOnJoin);
|
set("Plugin.UpdateCheck.OnJoin", T2C_LibConfig.VALUES.updateCheckOnJoin);
|
||||||
|
@ -59,9 +59,9 @@ public class T2C_LibConfig {
|
|||||||
space_proxy("proxy", null, true,
|
space_proxy("proxy", null, true,
|
||||||
new HashMap<>() {{
|
new HashMap<>() {{
|
||||||
put(T2C_LanguageEnum.german, List.of());
|
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<>() {{
|
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."
|
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!"));
|
, "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) {
|
public static void set(boolean isReload) {
|
||||||
long long_ = System.currentTimeMillis();
|
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());
|
T2C_ConfigWriter.createConfig(T2C_Util.getPrefix(), new File(T2C_Main.getPath(), "config.yml"), VALUES.values(), isReload, T2C_Util.getConfigLogo());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ public class T2CV_Send {
|
|||||||
public static void console(Logger logger, String msg) {
|
public static void console(Logger logger, String msg) {
|
||||||
if (msg == null || msg.contains("[empty]")) return;
|
if (msg == null || msg.contains("[empty]")) return;
|
||||||
logger.info(msg);
|
logger.info(msg);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void player(Player player, String msg) {
|
public static void player(Player player, String msg) {
|
||||||
|
@ -11,7 +11,6 @@ import com.velocitypowered.api.proxy.ProxyServer;
|
|||||||
import com.velocitypowered.api.proxy.messages.MinecraftChannelIdentifier;
|
import com.velocitypowered.api.proxy.messages.MinecraftChannelIdentifier;
|
||||||
import lombok.Getter;
|
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_GenerateFrame;
|
||||||
import net.t2code.t2codelib.util.T2C_PlatformDetector;
|
import net.t2code.t2codelib.util.T2C_PlatformDetector;
|
||||||
import net.t2code.t2codelib.util.T2C_Util;
|
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("", "Spigot: " + T2C_Util.getSpigot()));
|
||||||
logger.info(T2C_GenerateFrame.setCenterAligned("", "Discord: " + T2C_Util.getDiscord()));
|
logger.info(T2C_GenerateFrame.setCenterAligned("", "Discord: " + T2C_Util.getDiscord()));
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
T2CV_LibConfig.set(dataDirectory, logger);
|
T2CV_LibConfig.set(dataDirectory, logger);
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
|
Loading…
Reference in New Issue
Block a user