Compare commits
11 Commits
83f4a3ef71
...
16.7
Author | SHA1 | Date | |
---|---|---|---|
5f2c2cacbe | |||
6ea2335bc2 | |||
7b574ffa02 | |||
2f7f8e3bee | |||
987af06fb4 | |||
311ae66d18 | |||
8ae50fcbbf | |||
90df1fa5fb | |||
56080e1eb8 | |||
c7e392a0f0 | |||
a350f9fb00 |
1
.idea/compiler.xml
generated
1
.idea/compiler.xml
generated
@@ -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" />
|
||||
|
14
.idea/inspectionProfiles/Project_Default.xml
generated
14
.idea/inspectionProfiles/Project_Default.xml
generated
@@ -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>
|
28
pom.xml
28
pom.xml
@@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>net.t2code</groupId>
|
||||
<artifactId>T2CodeLib</artifactId>
|
||||
<version>16.7_dev-19</version>
|
||||
<version>16.7_beta-1</version>
|
||||
<!--version>VERSION_snapshot-0</version-->
|
||||
<!--version>VERSION_beta-0</version-->
|
||||
<!--version>VERSION_dev-0</version-->
|
||||
@@ -47,31 +47,7 @@
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>net.kyori</pattern>
|
||||
<shadedPattern>net.t2code.libraries.kyori.adventure</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>com.google.gson</pattern>
|
||||
<shadedPattern>net.t2code.libraries.google</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>mozilla</pattern>
|
||||
<shadedPattern>net.t2code.libraries.mozilla</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>org.apache</pattern>
|
||||
<shadedPattern>net.t2code.libraries.apache</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>org.intellij</pattern>
|
||||
<shadedPattern>net.t2code.libraries.intellij</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>org.jetbrains</pattern>
|
||||
<shadedPattern>net.t2code.libraries.jetbrains</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>org.json</pattern>
|
||||
<shadedPattern>net.t2code.libraries.json</shadedPattern>
|
||||
<shadedPattern>net.t2code.t2codelib.shaded.adventure</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
</configuration>
|
||||
|
@@ -105,13 +105,21 @@ public class T2CB_ConfigWriter {
|
||||
// Add value with proper indentation
|
||||
// builder.append(indent).append(key).append(": ").append(value).append("\n");
|
||||
if (value instanceof List) {
|
||||
List<?> list = (List<?>) value;
|
||||
if (list.size() == 1){
|
||||
for (Object s : list) {
|
||||
if (s instanceof String) {
|
||||
builder.append(indent).append(key).append(": \"").append(value).append("\"\n");
|
||||
} else builder.append(indent).append(key).append(": ").append(value).append("\n");
|
||||
}
|
||||
} else {
|
||||
builder.append(indent).append(key).append(": ").append("\n");
|
||||
List<Object> zw = (List<Object>) value;
|
||||
for (Object s : zw) {
|
||||
for (Object s : list) {
|
||||
if (s instanceof String) {
|
||||
builder.append(indent).append("- \"").append(s).append("\"\n");
|
||||
} else builder.append(indent).append("- ").append(s).append("\n");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (value instanceof String) {
|
||||
builder.append(indent).append(key).append(": \"").append(value).append("\"\n");
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package net.t2code.t2codelib.SPIGOT.api.commands;
|
||||
|
||||
import net.t2code.t2codelib.SPIGOT.system.BungeeCommandSenderReceiver;
|
||||
import me.clip.placeholderapi.PlaceholderAPI;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2C_ProxyCommandSenderReceiver;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2C_Main;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -17,14 +18,14 @@ public class T2C_Cmd {
|
||||
@Override
|
||||
public void run() {
|
||||
if (cmd.contains("!onBungee")) {
|
||||
BungeeCommandSenderReceiver.sendToBungee(null, cmd.replace("!onBungee", ""), true);
|
||||
T2C_ProxyCommandSenderReceiver.sendToBungee(null, cmd.replace("!onBungee", ""), true);
|
||||
} else Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), cmd);
|
||||
}
|
||||
}, delay);
|
||||
}
|
||||
|
||||
public static void player(Player player, String cmdInput) {
|
||||
Map.Entry<String,Integer> map = delay(cmdInput);
|
||||
Map.Entry<String,Integer> map = delay(PlaceholderAPI.setPlaceholders(player, cmdInput));
|
||||
int delay = map.getValue();
|
||||
String cmd = map.getKey();
|
||||
Bukkit.getScheduler().runTaskLater(T2C_Main.getPlugin(), new Runnable() {
|
||||
@@ -32,11 +33,11 @@ public class T2C_Cmd {
|
||||
public void run() {
|
||||
if (cmd.contains("!asConsole")) {
|
||||
if (cmd.contains("!onBungee")) {
|
||||
BungeeCommandSenderReceiver.sendToBungee(player, cmd.replace("!asConsole", "").replace("!onBungee", ""), true);
|
||||
T2C_ProxyCommandSenderReceiver.sendToBungee(player, cmd.replace("!asConsole", "").replace("!onBungee", ""), true);
|
||||
} else console(cmd.replace("!asConsole", ""));
|
||||
} else {
|
||||
if (cmd.contains("!onBungee")) {
|
||||
BungeeCommandSenderReceiver.sendToBungee(player, cmd.replace("!onBungee", ""), false);
|
||||
T2C_ProxyCommandSenderReceiver.sendToBungee(player, cmd.replace("!onBungee", ""), false);
|
||||
} else player.chat("/" + cmd);
|
||||
}
|
||||
}
|
||||
|
@@ -1,58 +0,0 @@
|
||||
package net.t2code.t2codelib.SPIGOT.api.messages;
|
||||
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2C_Main;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class T2C_HoverModule {
|
||||
|
||||
public static void modulePlayer(String text, String hover, String action, String actionValue, Player player) {
|
||||
modulePlayer((text != null ? text : "null") + "/*/" + (hover != null ? hover : "null") + "/*/" + (action != null ? action : "null")
|
||||
+ "/*/" + (actionValue != null ? actionValue : "null"), player);
|
||||
}
|
||||
|
||||
public static void modulePlayer(String msg, Player player) {
|
||||
if (msg.contains("/*/")) {
|
||||
t2cmodule(msg, player);
|
||||
return;
|
||||
}
|
||||
T2C_MiniMessage.sendPlayerMiniMessage(msg, player);
|
||||
}
|
||||
|
||||
public static void moduleSender(String msg, CommandSender sender) {
|
||||
T2C_MiniMessage.sendSenderMiniMessage(msg, sender);
|
||||
}
|
||||
|
||||
public static void moduleConsole(String msg) {
|
||||
if (T2C_Main.getMmIsLoad()) {
|
||||
T2C_MiniMessage.sendConsoleMiniMessage(msg);
|
||||
return;
|
||||
}
|
||||
Bukkit.getConsoleSender().sendMessage(msg);
|
||||
}
|
||||
|
||||
private static void t2cmodule(String msg, Player player) {
|
||||
String[] split = msg.split("/\\*/");
|
||||
int i = split.length;
|
||||
String text = null;
|
||||
String hover = null;
|
||||
String action = null;
|
||||
String actionValue = null;
|
||||
if (i > 0) text = split[0];
|
||||
if (i > 1) hover = split[1];
|
||||
if (i > 2) action = split[2];
|
||||
if (i > 3) actionValue = split[3];
|
||||
|
||||
T2C_TextBuilder textBuilder = new T2C_TextBuilder(text);
|
||||
if (hover != null && !hover.equals("null")) {
|
||||
textBuilder.addHover(hover);
|
||||
}
|
||||
|
||||
if (action != null && actionValue != null && !action.equals("null") && !actionValue.equals("null")) {
|
||||
textBuilder.addClickEvent(ClickEvent.Action.valueOf(action.toUpperCase()), actionValue);
|
||||
}
|
||||
player.spigot().sendMessage(textBuilder.build());
|
||||
}
|
||||
}
|
@@ -7,7 +7,6 @@ import org.bukkit.entity.Player;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class T2C_Replace {
|
||||
|
||||
|
@@ -44,30 +44,30 @@ public class T2C_Send {
|
||||
|
||||
public static void console(String msg) {
|
||||
if (msg == null || msg.contains("[empty]")) return;
|
||||
T2C_HoverModule.moduleConsole(msg);
|
||||
T2C_MiniMessage.sendConsoleMiniMessage(msg);
|
||||
}
|
||||
|
||||
public static void player(Player player, String msg) {
|
||||
if (msg == null || msg.contains("[empty]")) return;
|
||||
T2C_HoverModule.modulePlayer(msg, player);
|
||||
T2C_MiniMessage.sendPlayerMiniMessage(msg, player);
|
||||
}
|
||||
|
||||
public static void sender(CommandSender sender, String msg) {
|
||||
if (msg == null || msg.contains("[empty]")) return;
|
||||
T2C_HoverModule.moduleSender(msg, sender);
|
||||
T2C_MiniMessage.sendSenderMiniMessage(msg, sender);
|
||||
}
|
||||
|
||||
public static void console(Object object) {
|
||||
for (String msg : list(object)) {
|
||||
if (msg == null || msg.contains("[empty]")) continue;
|
||||
T2C_HoverModule.moduleConsole(msg);
|
||||
T2C_MiniMessage.sendConsoleMiniMessage(msg);
|
||||
}
|
||||
}
|
||||
|
||||
public static void player(Player player, Object object) {
|
||||
for (String msg : list(object)) {
|
||||
if (msg == null || msg.contains("[empty]")) continue;
|
||||
T2C_HoverModule.modulePlayer(msg, player);
|
||||
T2C_MiniMessage.sendPlayerMiniMessage(msg, player);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ public class T2C_Send {
|
||||
public static void sender(CommandSender sender, Object object) {
|
||||
for (String msg : list(object)) {
|
||||
if (msg == null || msg.contains("[empty]")) return;
|
||||
T2C_HoverModule.moduleSender(msg, sender);
|
||||
T2C_MiniMessage.sendSenderMiniMessage(msg, sender);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -330,4 +330,8 @@ public class T2C_McVersion {
|
||||
return !isMc1_8() && !isMc1_9() && !isMc1_10() && !isMc1_11() && !isMc1_12() && !isMc1_13() && !isMc1_14() && !isMc1_15() && !isMc1_16() && !isMc1_17()
|
||||
&& !isMc1_18() && !isMc1_19();
|
||||
}
|
||||
public static boolean minMc1_21() {
|
||||
return !isMc1_8() && !isMc1_9() && !isMc1_10() && !isMc1_11() && !isMc1_12() && !isMc1_13() && !isMc1_14() && !isMc1_15() && !isMc1_16() && !isMc1_17()
|
||||
&& !isMc1_18() && !isMc1_19() && !isMc1_20();
|
||||
}
|
||||
}
|
||||
|
@@ -6,6 +6,7 @@ import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2C_Main;
|
||||
import net.t2code.t2codelib.util.T2C_LanguageEnum;
|
||||
import net.t2code.t2codelib.util.T2C_ConfigItem;
|
||||
import net.t2code.t2codelib.util.T2C_Util;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
@@ -19,10 +20,11 @@ public class T2C_ConfigWriter {
|
||||
|
||||
private static FileConfiguration config;
|
||||
|
||||
public static void createConfig(File configFile, T2C_ConfigItem[] values, String... header) {
|
||||
public static void createConfig(String prefix, File configFile, T2C_ConfigItem[] values, boolean isReload, String... header) {
|
||||
long long_ = System.currentTimeMillis();
|
||||
boolean exist = configFile.exists();
|
||||
if (!exist) {
|
||||
configFile.getParentFile().mkdirs();
|
||||
configFile.getParentFile().mkdir();
|
||||
try {
|
||||
configFile.createNewFile();
|
||||
} catch (IOException e) {
|
||||
@@ -34,11 +36,20 @@ public class T2C_ConfigWriter {
|
||||
config = YamlConfiguration.loadConfiguration(configFile);
|
||||
Map<String, List<String>> comments = new LinkedHashMap<>();
|
||||
|
||||
T2C_LanguageEnum lang = T2C_LanguageEnum.english;
|
||||
T2C_LanguageEnum lang = null;
|
||||
String lp = values[0].getLanguagePath();
|
||||
|
||||
try {
|
||||
lang = T2C_LanguageEnum.valueOf(config.getString(values[0].getLanguagePath().replace(".yml", "")));
|
||||
lang = T2C_LanguageEnum.valueOf(lp);
|
||||
} catch (Exception ignore) {
|
||||
}
|
||||
if (lang == null) {
|
||||
try {
|
||||
lang = T2C_LanguageEnum.valueOf(config.getString(lp.replace(".yml", "")));
|
||||
} catch (Exception e) {
|
||||
lang = T2C_LanguageEnum.english;
|
||||
}
|
||||
}
|
||||
|
||||
for (T2C_ConfigItem item : values) {
|
||||
if (item.getForceSet() || !exist) {
|
||||
@@ -51,16 +62,21 @@ public class T2C_ConfigWriter {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Copy default values if they are missing
|
||||
config.options().copyDefaults(true);
|
||||
|
||||
T2C_YmlWriter.saveConfigWithComments(configFile, config, comments, header);
|
||||
readConfig(config, values);
|
||||
T2C_YmlWriter.saveConfigWithComments(configFile, config, comments, false, header);
|
||||
readConfig(prefix, configFile, config, values, isReload, long_);
|
||||
}
|
||||
|
||||
private static void readConfig(FileConfiguration config, T2C_ConfigItem[] values) {
|
||||
private static void readConfig(String prefix, File configFile, FileConfiguration config, T2C_ConfigItem[] values, boolean isReload, long long_) {
|
||||
for (T2C_ConfigItem value : values) {
|
||||
value.setValue(config.get(value.getPath()));
|
||||
}
|
||||
T2C_Send.sendStartTextCenter(prefix, "§2Load successfully: §7" + configFile.getPath() + "/" + config.getName().replace("/","")+" §7- §e"+ (System.currentTimeMillis() - long_) + "ms", isReload);
|
||||
// T2C_Send.sendStartTextCenter(prefix, "§2Has been successfully created / updated §7- §e" + (System.currentTimeMillis() - long_) + "ms", isReload);
|
||||
//T2C_Send.sendStartTextCenter(prefix, "", isReload);
|
||||
//T2C_Send.sendStartTextCenter(Util.getPrefix(), "§2opWhitelist.yml were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms",isReload);
|
||||
}
|
||||
}
|
||||
|
@@ -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);
|
||||
|
@@ -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) {
|
||||
public 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,23 +49,35 @@ 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;
|
||||
}
|
||||
builder.append(indent).append(key).append(": ").append("\n");
|
||||
List<Object> zw = (List<Object>) value;
|
||||
for (Object s : zw) {
|
||||
for (Object s : list) {
|
||||
if (s instanceof String) {
|
||||
builder.append(indent).append("- \"").append(s).append("\"\n");
|
||||
} else builder.append(indent).append("- ").append(s).append("\n");
|
||||
}
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
if (value instanceof String) {
|
||||
builder.append(indent).append(key).append(": \"").append(value).append("\"\n");
|
||||
} else builder.append(indent).append(key).append(": ").append(value).append("\n");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -29,6 +29,7 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public final class T2C_Main extends JavaPlugin {
|
||||
@Getter
|
||||
@@ -52,6 +53,7 @@ public final class T2C_Main extends JavaPlugin {
|
||||
@Override
|
||||
public void onEnable() {
|
||||
T2C_PlatformDetector.scan();
|
||||
checkIsProxy();
|
||||
// Plugin startup logic
|
||||
plugin = this;
|
||||
autor = plugin.getDescription().getAuthors();
|
||||
@@ -70,7 +72,7 @@ public final class T2C_Main extends JavaPlugin {
|
||||
private void load() {
|
||||
long long_ = T2C_Template.onLoadHeader(T2C_Util.getPrefix(), autor, version, T2C_Util.getSpigot(), T2C_Util.getDiscord());
|
||||
|
||||
checkIsBungee();
|
||||
|
||||
String prefix = T2C_Util.getPrefix();
|
||||
|
||||
try {
|
||||
@@ -122,13 +124,18 @@ public final class T2C_Main extends JavaPlugin {
|
||||
T2C_Send.sendStartTextCenter(prefix, "§3Platform: §6" + T2C_PlatformDetector.detectPlatform, false);
|
||||
T2C_Send.sendStartTextCenter(prefix, "§3Bukkit Version: §6" + T2C_McVersion.getBukkitVersion(), false);
|
||||
T2C_Send.sendStartTextCenter(prefix, "§3Server Version: §6" + T2C_McVersion.getMcVersion(), false);
|
||||
T2C_Send.sendStartTextCenter(prefix, "§3OnlineMode: §6" + isOnlineMode, false);
|
||||
if (isProxy) {
|
||||
if (isBungee) T2C_Send.sendStartTextCenter(prefix, "§3Proxy: §6BungeeCord", false);
|
||||
if (isVelocity) T2C_Send.sendStartTextCenter(prefix, "§3Proxy: §6Velocity", false);
|
||||
}
|
||||
|
||||
T2C_Template.onLoadSeparateStroke(prefix);
|
||||
if (eco != null) {
|
||||
String st = eco.getName();
|
||||
if (eco.getName().equals("CMIEconomy")) st = "CMI";
|
||||
if (Bukkit.getPluginManager().getPlugin(st) != null) {
|
||||
T2C_Send.sendStartTextCenter(prefix, "§3Economy: §6" + eco.getName() + " - " + Bukkit.getPluginManager().getPlugin(st).getDescription().getVersion() + " §7- §e" +
|
||||
T2C_Send.sendStartTextCenter(prefix, "§3Economy: §6" + eco.getName() + " - " + Objects.requireNonNull(Bukkit.getPluginManager().getPlugin(st)).getDescription().getVersion() + " §7- §e" +
|
||||
(System.currentTimeMillis() - long_) + "ms", false);
|
||||
} else
|
||||
T2C_Send.sendStartTextCenter(prefix, "§3Economy: §6" + eco.getName() + " §7- §e" + (System.currentTimeMillis() - long_) + "ms", false);
|
||||
@@ -137,7 +144,7 @@ public final class T2C_Main extends JavaPlugin {
|
||||
|
||||
if (perm != null) {
|
||||
if (Bukkit.getPluginManager().getPlugin(perm.getName()) != null) {
|
||||
T2C_Send.sendStartTextCenter(prefix, "§3Permission plugin: §6" + perm.getName() + " - " + Bukkit.getPluginManager().getPlugin(perm.getName()).getDescription().getVersion()
|
||||
T2C_Send.sendStartTextCenter(prefix, "§3Permission plugin: §6" + perm.getName() + " - " + Objects.requireNonNull(Bukkit.getPluginManager().getPlugin(perm.getName())).getDescription().getVersion()
|
||||
+ " §7- §e" + (System.currentTimeMillis() - long_) + "ms", false);
|
||||
} else
|
||||
T2C_Send.sendStartTextCenter(prefix, "§3Permission plugin: §6" + perm.getName() + " - §7- §e" + (System.currentTimeMillis() - long_) + "ms", false);
|
||||
@@ -151,7 +158,7 @@ public final class T2C_Main extends JavaPlugin {
|
||||
T2C_Send.sendStartTextCenter(prefix, "§3Kyori MiniMessage Support: " + (getMmIsLoad() ? "§2load" : "§4not load") + " §7- §e" + (System.currentTimeMillis() - long_) + "ms", false);
|
||||
|
||||
|
||||
plugin.getCommand("t2code").setExecutor(new CmdExecuter());
|
||||
Objects.requireNonNull(plugin.getCommand("t2code")).setExecutor(new CmdExecuter());
|
||||
|
||||
T2C_Template.onLoadSeparateStroke(prefix);
|
||||
T2C_LibConfig.set(false);
|
||||
@@ -201,9 +208,9 @@ public final class T2C_Main extends JavaPlugin {
|
||||
Vault.vaultDisable();
|
||||
T2C_Template.onDisable(T2C_Util.getPrefix(), this);
|
||||
if (mmIsLoad) {
|
||||
if (this.adventure != null) {
|
||||
this.adventure.close();
|
||||
this.adventure = null;
|
||||
if (adventure != null) {
|
||||
adventure.close();
|
||||
adventure = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -229,14 +236,47 @@ public final class T2C_Main extends JavaPlugin {
|
||||
return adventure;
|
||||
}
|
||||
|
||||
private static void checkIsBungee() {
|
||||
private static void checkIsProxy() {
|
||||
isOnlineMode = Bukkit.getServer().getOnlineMode();
|
||||
|
||||
File config = new File("spigot.yml");
|
||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||
|
||||
isBungee = yamlConfiguration.getBoolean("settings.bungeecord");
|
||||
if (yamlConfiguration.getBoolean("settings.bungeecord")) {
|
||||
isProxy = true;
|
||||
isBungee = true;
|
||||
File paper = new File("config/paper-global.yml");
|
||||
YamlConfiguration yamlPaper = YamlConfiguration.loadConfiguration(paper);
|
||||
isOnlineMode = yamlPaper.isBoolean("proxies.bungee-cord.online-mode");
|
||||
return;
|
||||
}
|
||||
|
||||
if (T2C_PlatformDetector.detectPlatform == T2C_PlatformDetector.PlatformType.PAPER) {
|
||||
|
||||
File paperOld = new File("paper.yml");
|
||||
|
||||
if (paperOld.exists()) {
|
||||
YamlConfiguration yamlPaperOld = YamlConfiguration.loadConfiguration(paperOld);
|
||||
|
||||
isVelocity = yamlPaperOld.getBoolean("settings.velocity-support.enabled");
|
||||
isOnlineMode = yamlPaperOld.isBoolean("settings.velocity-support.online-mode");
|
||||
}
|
||||
File paper = new File("config/paper-global.yml");
|
||||
YamlConfiguration yamlPaper = YamlConfiguration.loadConfiguration(paper);
|
||||
isVelocity = yamlPaper.isBoolean("proxies.velocity.enabled");
|
||||
isOnlineMode = yamlPaper.isBoolean("proxies.velocity.online-mode");
|
||||
isProxy = isVelocity;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Getter
|
||||
private static Boolean isBungee;
|
||||
private static boolean isProxy = false;
|
||||
@Getter
|
||||
private static boolean isBungee = false;
|
||||
@Getter
|
||||
private static boolean isVelocity = false;
|
||||
@Getter
|
||||
private static boolean isOnlineMode;
|
||||
|
||||
}
|
||||
|
@@ -13,7 +13,7 @@ import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class BungeeCommandSenderReceiver {
|
||||
public class T2C_ProxyCommandSenderReceiver {
|
||||
|
||||
public static void sendToBungee(CommandSender sender, String information, Boolean console) {
|
||||
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
@@ -46,6 +46,6 @@ public class Vault {
|
||||
public static void vaultDisable() {
|
||||
if (!connected) return;
|
||||
connected = false;
|
||||
T2C_Send.sendStartTextCenter(T2C_Util.getPrefix(), " §4Vault / Economy successfully deactivated.", false);
|
||||
T2C_Send.console(T2C_Util.getPrefix()+ " §4Vault / Economy successfully deactivated.");
|
||||
}
|
||||
}
|
||||
|
@@ -3,7 +3,7 @@ package net.t2code.t2codelib.SPIGOT.system.cmd;
|
||||
import net.t2code.t2codelib.SPIGOT.api.debug.T2C_Debug;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
||||
import net.t2code.t2codelib.SPIGOT.api.update.T2C_UpdateAPI;
|
||||
import net.t2code.t2codelib.SPIGOT.system.BungeeCommandSenderReceiver;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2C_ProxyCommandSenderReceiver;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2C_Main;
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.config.T2C_LibConfig;
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.languages.T2CLibLanguages;
|
||||
@@ -106,7 +106,7 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
|
||||
cmd = cmd + s + " ";
|
||||
}
|
||||
cmd = cmd.replace("bcmd ", "");
|
||||
BungeeCommandSenderReceiver.sendToBungee(null, cmd, true);
|
||||
T2C_ProxyCommandSenderReceiver.sendToBungee(null, cmd, true);
|
||||
T2C_Debug.debug(T2C_Main.getPlugin(), "PluginMessage BCMD: " + cmd);
|
||||
return false;
|
||||
|
||||
|
@@ -28,10 +28,7 @@ import java.net.URL;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.*;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
@@ -60,7 +57,9 @@ public class CreateReportLog {
|
||||
pWriter.println("Server run on: " + T2C_McVersion.getMcVersion());
|
||||
pWriter.println("Server NMS: " + T2C_McVersion.getNms());
|
||||
pWriter.println("Online Mode: " + Bukkit.getOnlineMode());
|
||||
pWriter.println("Bungee Mode: " + T2C_Main.getIsBungee());
|
||||
pWriter.println("Proxy Mode: " + T2C_Main.isBungee());
|
||||
pWriter.println("BungeeCord: " + T2C_Main.isBungee());
|
||||
pWriter.println("Velocity: " + T2C_Main.isVelocity());
|
||||
pWriter.println("Server Port: " + Bukkit.getServer().getPort());
|
||||
pWriter.println();
|
||||
pWriter.println("Worlds: " + Bukkit.getWorlds());
|
||||
@@ -77,7 +76,7 @@ public class CreateReportLog {
|
||||
String st = T2C_Main.getEco().getName();
|
||||
if (T2C_Main.getEco().getName().equals("CMIEconomy")) st = "CMI";
|
||||
if (Bukkit.getPluginManager().getPlugin(st) != null) {
|
||||
pWriter.println("Economy: " + T2C_Main.getEco().isEnabled() + " - " + st + " - " + Bukkit.getPluginManager().getPlugin(st).getDescription().getVersion());
|
||||
pWriter.println("Economy: " + T2C_Main.getEco().isEnabled() + " - " + st + " - " + Objects.requireNonNull(Bukkit.getPluginManager().getPlugin(st)).getDescription().getVersion());
|
||||
} else pWriter.println("Economy: " + T2C_Main.getEco().isEnabled() + " - " + st);
|
||||
} else pWriter.println("Economy: not connected via vault");
|
||||
if (T2C_Main.getPerm() != null) {
|
||||
|
@@ -63,6 +63,7 @@ public class Development implements Listener {
|
||||
msg = msg + "<dark_red>" + plSt + "</dark_red>, ";
|
||||
} else msg = msg + "<red>" + plSt + "</red>, ";
|
||||
}
|
||||
|
||||
T2C_Send.player(player, removeLastChar(msg, 2));
|
||||
}
|
||||
|
||||
|
@@ -8,15 +8,17 @@ import java.io.File;
|
||||
|
||||
public class ConvertT2ClibConfig {
|
||||
|
||||
public static YamlConfiguration yamlConfiguration;
|
||||
private static YamlConfiguration yamlConfiguration;
|
||||
|
||||
|
||||
public static void convert() {
|
||||
File config = new File(T2C_Main.getPath(), "config.yml");
|
||||
yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||
|
||||
if (!config.exists()) return;
|
||||
if (yamlConfiguration.contains("plugin.updateCheck.onJoin")) return;
|
||||
yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||
|
||||
|
||||
if (yamlConfiguration.contains("proxy.serverUUID")) return;
|
||||
|
||||
set("Plugin.UpdateCheck.OnJoin", T2C_LibConfig.VALUES.updateCheckOnJoin);
|
||||
set("Plugin.UpdateCheck.TimeInterval", T2C_LibConfig.VALUES.updateCheckTimeInterval);
|
||||
@@ -27,8 +29,7 @@ public class ConvertT2ClibConfig {
|
||||
set("Plugin.Not recommended to disable.developerTool", T2C_LibConfig.VALUES.developerTool);
|
||||
set("BungeeCord.Enable", T2C_LibConfig.VALUES.proxy);
|
||||
set("Player.Inventories.CloseByServerStop", T2C_LibConfig.VALUES.inventoriesCloseByServerStop);
|
||||
set("Command.PermToggle.PermissionSetCommand", T2C_LibConfig.VALUES.updateCheckOnJoin);
|
||||
|
||||
set("Command.PermToggle.PermissionSetCommand", T2C_LibConfig.VALUES.commandPermToggleCommand);
|
||||
config.delete();
|
||||
}
|
||||
|
||||
|
@@ -1,6 +1,5 @@
|
||||
package net.t2code.t2codelib.SPIGOT.system.config.config;
|
||||
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
||||
import net.t2code.t2codelib.SPIGOT.api.yaml.T2C_ConfigWriter;
|
||||
import net.t2code.t2codelib.util.T2C_LanguageEnum;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2C_Main;
|
||||
@@ -14,75 +13,63 @@ public class T2C_LibConfig {
|
||||
|
||||
public enum VALUES implements T2C_ConfigItem {
|
||||
|
||||
updateCheckOnJoin("plugin.updateCheck.onJoin", true, true,
|
||||
new HashMap<>() {{
|
||||
updateCheckOnJoin("plugin.updateCheck.onJoin", true, true, new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Mit dieser Option kannst du festlegen, ob Spieler mit der Berechtigung 't2code.lib.updatemsg' beim Join eine Update-Nachricht erhalten, wenn ein Update für das Plugin verfügbar ist."));
|
||||
put(T2C_LanguageEnum.english, List.of("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, true,
|
||||
new HashMap<>() {{
|
||||
updateCheckTimeInterval("plugin.updateCheck.timeInterval", 60, true, new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Mit dieser Option kannst du das Zeitintervall in Minuten festlegen, in dem Aktualisierungen überprüft werden sollen."));
|
||||
put(T2C_LanguageEnum.english, List.of("In this option you can set the time interval in minutes in which updates should be checked."));
|
||||
}}),
|
||||
|
||||
seePreReleaseUpdates("plugin.updateCheck.seePreReleaseUpdates", true, true,
|
||||
new HashMap<>() {{
|
||||
seePreReleaseUpdates("plugin.updateCheck.seePreReleaseUpdates", true, true, new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("In dieser Option kannst du einstellen, ob du Beta- und Snapshot-Versionen in der Update-Prüfung erhalten und anzeigen möchten."));
|
||||
put(T2C_LanguageEnum.english, List.of("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, true,
|
||||
new HashMap<>() {{
|
||||
updateCheckFullDisable("plugin.updateCheck.allPlugins.fullDisable", false, true, new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Diese Option deaktiviert alle Aktualisierungsprüfungen für Plugins, die die T2CodeLib verwenden."));
|
||||
put(T2C_LanguageEnum.english, List.of("This option deactivates all update checks for plugins that use the T2CodeLib."));
|
||||
}}),
|
||||
|
||||
debug("plugin.debug.debugModus", false, true,
|
||||
new HashMap<>() {{
|
||||
debug("plugin.debug.debugModus", false, true, new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Der Debug-Modus sendet ausführlichere Debug-Informationen an die Konsole.", "In dieser Version des Plugins sind keine Debug-Meldungen eingebaut!"));
|
||||
put(T2C_LanguageEnum.english, List.of("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, true,
|
||||
new HashMap<>() {{
|
||||
developerTool("plugin.debug.developerTool", false, true, new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Diese Option aktiviert erweiterte Werkzeuge für die Entwickler von Plugins, die die T2CodeLib verwenden.", "Wenn du nicht genau weist, wozu das gut ist, solltest du es deaktiviert lassen!"));
|
||||
put(T2C_LanguageEnum.english, List.of("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", true,
|
||||
new HashMap<>() {{
|
||||
language("plugin.language", T2C_LanguageEnum.english, true, new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("In dieser Option kannst du die Sprache des Plugins einstellen."));
|
||||
put(T2C_LanguageEnum.english, List.of("In this option you can set the language of the plugin."));
|
||||
}}),
|
||||
|
||||
space_proxy("proxy", null, true,
|
||||
new HashMap<>() {{
|
||||
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("proxy.enable", T2C_Main.getIsBungee(), true,
|
||||
new HashMap<>() {{
|
||||
proxy("proxy.enable", T2C_Main.isProxy(), 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!"));
|
||||
put(T2C_LanguageEnum.english, List.of("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!"));
|
||||
}}),
|
||||
|
||||
serverUUID("proxy.serverUUID", UUID.randomUUID(), true,
|
||||
new HashMap<>() {{
|
||||
serverUUID("proxy.serverUUID", UUID.randomUUID(), true, new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Diese UUID wird für die Kommunikation der Plugins in einem Netzwerk mit mehreren Servern verwendet.", "Diese UUID darf nur einmal in einem Netz vorkommen!"));
|
||||
put(T2C_LanguageEnum.english, List.of("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, true,
|
||||
new HashMap<>() {{
|
||||
space_player("player", null, true, new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of());
|
||||
put(T2C_LanguageEnum.english, List.of());
|
||||
}}),
|
||||
|
||||
inventoriesCloseByServerStop("player.inventories.closeByServerStop", true, true,
|
||||
new HashMap<>() {{
|
||||
inventoriesCloseByServerStop("player.inventories.closeByServerStop", true, true, new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Wenn diese Option aktiviert ist, werden bei allen Spielern auf dem Server (Spigot, Papier, etc.) das Inventar / GUIs geschlossen, wenn der Server heruntergefahren oder neu gestartet wird.",
|
||||
"(Damit ist nicht das gesamte Netz gemeint, wenn ein Proxy verwendet wird)"));
|
||||
put(T2C_LanguageEnum.english, List.of("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.",
|
||||
@@ -90,14 +77,12 @@ public class T2C_LibConfig {
|
||||
|
||||
}}),
|
||||
|
||||
space_command("command", null, true,
|
||||
new HashMap<>() {{
|
||||
space_command("command", null, true, new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of());
|
||||
put(T2C_LanguageEnum.english, List.of());
|
||||
}}),
|
||||
|
||||
commandPermToggleCommand("command.permToggle.permissionSetCommand", "lp user [player] permission set [perm] [value]", true,
|
||||
new HashMap<>() {{
|
||||
commandPermToggleCommand("command.permToggle.permissionSetCommand", "lp user [player] permission set [perm] [value]", true, new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Diese Option gibt an, welcher Befehl für den T2CodeLib-Befehl '/t2code permtoggle <player> <permission>' verwendet werden soll."));
|
||||
put(T2C_LanguageEnum.english, List.of("This option specifies which command is to be used for the T2CodeLib command '/t2code permtoggle <player> <permission>'."));
|
||||
}}),
|
||||
@@ -149,9 +134,7 @@ public class T2C_LibConfig {
|
||||
public static void set(boolean isReload) {
|
||||
long long_ = System.currentTimeMillis();
|
||||
ConvertT2ClibConfig.convert();
|
||||
T2C_ConfigWriter.createConfig(new File(T2C_Main.getPath(), "config.yml"), VALUES.values(), T2C_Util.getConfigLogo());
|
||||
|
||||
T2C_Send.sendStartTextCenter(T2C_Util.getPrefix(), "§2config.yml were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms", isReload);
|
||||
T2C_ConfigWriter.createConfig(T2C_Util.getPrefix(), new File(T2C_Main.getPath(), "config.yml"), VALUES.values(), isReload, T2C_Util.getConfigLogo());
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -29,8 +29,8 @@ public class T2CLibLanguages {
|
||||
vaultNotSetUp("plugin.vaultNotSetUp",
|
||||
null,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, "[prefix] &4Vault / Economy nicht eingerichtet!");
|
||||
put(T2C_LanguageEnum.english, "[prefix] &4Vault / Economy not set up!");
|
||||
put(T2C_LanguageEnum.german, List.of("[prefix] &4Vault / Economy nicht eingerichtet!"));
|
||||
put(T2C_LanguageEnum.english,List.of( "[prefix] &4Vault / Economy not set up!"));
|
||||
}},
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Diese Meldung wird angezeigt, wenn ein Plugin auf die Vault Schnittstelle von T2CodeLib zugreift und Vault oder kein Economy System vorhanden ist."));
|
||||
@@ -40,8 +40,8 @@ public class T2CLibLanguages {
|
||||
votingPluginNotSetUp("plugin.votingPluginNotSetUp",
|
||||
null,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, "[prefix] &4VotingPlugin ist auf dem Server nicht vorhanden!");
|
||||
put(T2C_LanguageEnum.english, "[prefix] &4VotingPlugin is not present on the server!");
|
||||
put(T2C_LanguageEnum.german, List.of("[prefix] &4VotingPlugin ist auf dem Server nicht vorhanden!"));
|
||||
put(T2C_LanguageEnum.english, List.of("[prefix] &4VotingPlugin is not present on the server!"));
|
||||
}},
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Diese Meldung wird angezeigt, wenn ein Plugin auf die VotingPlugin Schnittstelle von T2CodeLib zugreift und VotingPlugin nicht vorhanden ist.", "VotingPlugin: https://spigotmc.org/resources/votingplugin.15358/"));
|
||||
@@ -50,22 +50,22 @@ public class T2CLibLanguages {
|
||||
soundNotFound("plugin.soundNotFound",
|
||||
null,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, "[prefix] &4Der Sound &6[sound] &4wurde nicht gefunden! Bitte überprüfe die Einstellungen.");
|
||||
put(T2C_LanguageEnum.english, "[prefix] &4The sound &6[sound] &4was not found! Please check the settings.");
|
||||
put(T2C_LanguageEnum.german, List.of("[prefix] &4Der Sound &6[sound] &4wurde nicht gefunden! Bitte überprüfe die Einstellungen."));
|
||||
put(T2C_LanguageEnum.english, List.of("[prefix] &4The sound &6[sound] &4was not found! Please check the settings."));
|
||||
}},
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Diese Meldung wird angezeigt, wenn ein Sound über die T2CodeLib abgespielt werden soll, den es nicht gibt"));
|
||||
put(T2C_LanguageEnum.english, List.of());
|
||||
put(T2C_LanguageEnum.german, List.of("Diese Meldung wird angezeigt, wenn ein Sound über die T2CodeLib abgespielt werden soll, den es nicht gibt."));
|
||||
put(T2C_LanguageEnum.english, List.of("This message is displayed if a sound is to be played via the T2CodeLib that does not exist."));
|
||||
}}),
|
||||
|
||||
;
|
||||
|
||||
private final String path;
|
||||
private Object value;
|
||||
private final HashMap<T2C_LanguageEnum, String> lang;
|
||||
private final HashMap<T2C_LanguageEnum, List<String>> lang;
|
||||
private final HashMap<T2C_LanguageEnum, List<String>> comments;
|
||||
|
||||
VALUES(String path, Object value, @NonNull HashMap<T2C_LanguageEnum, String> lang, HashMap<T2C_LanguageEnum, List<String>> comments) {
|
||||
VALUES(String path, Object value, @NonNull HashMap<T2C_LanguageEnum, List<String>> lang, HashMap<T2C_LanguageEnum, List<String>> comments) {
|
||||
this.path = path;
|
||||
this.value = value;
|
||||
this.lang = lang;
|
||||
@@ -86,7 +86,7 @@ public class T2CLibLanguages {
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<T2C_LanguageEnum, String> getLanguage() {
|
||||
public HashMap<T2C_LanguageEnum, List<String>> getLanguage() {
|
||||
return lang;
|
||||
}
|
||||
|
||||
@@ -103,6 +103,5 @@ public class T2CLibLanguages {
|
||||
|
||||
public static void set(boolean isReload) {
|
||||
T2C_LanguageWriter.createConfig(T2C_Util.getPrefix(), T2C_Main.getPath(), VALUES.values(), T2C_LibConfig.VALUES.language.getValue().toString(), isReload, T2C_Util.getConfigLogo());
|
||||
|
||||
}
|
||||
}
|
@@ -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) {
|
||||
|
@@ -147,13 +147,21 @@ public class T2CV_ConfigWriter {
|
||||
// Add value with proper indentation
|
||||
// builder.append(indent).append(key.getKey()).append(": ").append(value).append("\n");
|
||||
if (value instanceof List) {
|
||||
List<?> list = (List<?>) value;
|
||||
if (list.size() == 1){
|
||||
for (Object s : list) {
|
||||
if (s instanceof String) {
|
||||
builder.append(indent).append(key.getKey()).append(": \"").append(value).append("\"\n");
|
||||
} else builder.append(indent).append(key.getKey()).append(": ").append(value).append("\n");
|
||||
}
|
||||
}else {
|
||||
builder.append(indent).append(key.getKey()).append(": ").append("\n");
|
||||
List<Object> zw = (List<Object>) value;
|
||||
for (Object s : zw) {
|
||||
for (Object s : list) {
|
||||
if (s instanceof String) {
|
||||
builder.append(indent).append("- \"").append(s).append("\"\n");
|
||||
} else builder.append(indent).append("- ").append(s).append("\n");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (value instanceof String) {
|
||||
builder.append(indent).append(key.getKey()).append(": \"").append(value).append("\"\n");
|
||||
|
@@ -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) {
|
||||
|
@@ -19,7 +19,7 @@ public interface T2C_ConfigItemLanguages {
|
||||
*/
|
||||
Object getValue();
|
||||
|
||||
HashMap<T2C_LanguageEnum, String> getLanguage();
|
||||
HashMap<T2C_LanguageEnum, List<String>> getLanguage();
|
||||
|
||||
|
||||
/**
|
||||
|
@@ -131,7 +131,6 @@ public class T2C_GenerateFrame {
|
||||
|
||||
|
||||
if (console && T2C_PlatformDetector.detectPlatform == T2C_PlatformDetector.PlatformType.VELOCITY) {
|
||||
System.out.println("conole & velo");
|
||||
colorCode = "";
|
||||
nextLine = "\n";
|
||||
}
|
||||
@@ -185,7 +184,6 @@ public class T2C_GenerateFrame {
|
||||
// String miniMessageRegex = "<(?!br)(color:#([A-Fa-f0-9]{6})|[a-zA-Z_]+)(:[a-zA-Z0-9_]+)?>|</[a-zA-Z_]+>";
|
||||
// return text.replaceAll("§[a-f0-9k-oK-O]", "").replaceAll(miniMessageRegex, "");
|
||||
String s = MiniMessage.miniMessage().stripTags(text).replaceAll("§[a-f0-9k-oK-O]", "");
|
||||
System.out.println(s);
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
@@ -27,7 +27,7 @@ public class T2C_Util {
|
||||
private static Integer bstatsID = 12518;
|
||||
|
||||
@Getter
|
||||
private static String spigot = "https://www.spigotmc.org/resources/" + getSpigotID();
|
||||
private static String spigot = "https://spigotmc.org/resources/" + getSpigotID();
|
||||
|
||||
@Getter
|
||||
private static String discord = "http://dc.t2code.net";
|
||||
|
Reference in New Issue
Block a user