Minor changes

New Plugin Start design
Minor changes
Descriptions adapted
This commit is contained in:
JaTiTV 2024-07-04 07:16:24 +02:00
parent 44c35bd185
commit a533d2211b
25 changed files with 497 additions and 434 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DiscordProjectSettings">
<option name="show" value="ASK" />
<option name="show" value="PROJECT_FILES" />
<option name="description" value="" />
</component>
</project>

View File

@ -1,6 +1,9 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="JavadocDeclaration" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ADDITIONAL_TAGS" value="Deprecated" />
</inspection_tool>
<inspection_tool class="VulnerableLibrariesLocal" enabled="true" level="WARNING" enabled_by_default="true">
<option name="isIgnoringEnabled" value="true" />
<option name="ignoredModules">

View File

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

View File

@ -41,23 +41,23 @@ public class T2CBconfigWriter {
T2CLanguageEnum lang = T2CLanguageEnum.english;
for(T2CconfigItem item : values){
for (T2CconfigItem item : values) {
if (item.getForceSet() || !exist) {
if(!config.contains(item.getPath())){
if (!config.contains(item.getPath())) {
config.set(item.getPath(), item.getValue());
}
List<String> commandList = item.getComments().get(lang);
if (commandList != null){
comments.put(item.getPath(),commandList );
List<String> commandList = item.getComments().get(lang);
if (commandList != null) {
comments.put(item.getPath(), commandList);
}
}
}
saveConfigWithComments(configFile, comments, header);
readConfig(config,values);
readConfig(config, values);
}
private static void readConfig(Configuration config, T2CconfigItem[] values) {
for(T2CconfigItem item : values){
for (T2CconfigItem item : values) {
item.setValue(config.get(item.getPath()));
}
}
@ -65,7 +65,7 @@ public class T2CBconfigWriter {
private static void saveConfigWithComments(File file, Map<String, List<String>> comments, String... headers) {
try {
StringBuilder configContent = new StringBuilder();
for(String h : headers){
for (String h : headers) {
configContent.append("# ").append(h).append("\n");
}
configContent.append("\n");
@ -79,8 +79,7 @@ public class T2CBconfigWriter {
}
private static void addSection(Configuration section, Map<String, List<String>> comments, StringBuilder builder, String prefix, int indentLevel) {
String indent = " ".repeat(indentLevel);
String indent = " ".repeat(indentLevel);
for (String key : section.getKeys()) {
String fullKey = prefix.isEmpty() ? key : prefix + "." + key;
@ -89,8 +88,10 @@ public class T2CBconfigWriter {
// 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");
for (String c : commentList) {
if (c.isEmpty()) {
builder.append(indent).append(c).append("\n");
} else builder.append(indent).append("# ").append(c).append("\n");
}
}
@ -102,7 +103,7 @@ public class T2CBconfigWriter {
addSection((Configuration) value, comments, builder, fullKey, indentLevel + 1);
} else {
// 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) {
builder.append(indent).append(key).append(": ").append("\n");
List<Object> zw = (List<Object>) value;

View File

@ -1,6 +1,7 @@
package net.t2code.t2codelib.SPIGOT.api.bungeePlayers;
import lombok.Getter;
import net.t2code.t2codelib.SPIGOT.api.debug.T2Cdebug;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
import net.t2code.t2codelib.SPIGOT.system.config.config.T2CLibConfig;
@ -21,15 +22,15 @@ public class T2CbungeePlayers implements PluginMessageListener {
@Override
public void onPluginMessageReceived(String channel, Player player, byte[] message) {
DataInputStream stream = new DataInputStream(new ByteArrayInputStream(message));
T2Csend.debug(T2CodeLibMain.getPlugin(), "stream: " + stream.toString());
T2Cdebug.debug(T2CodeLibMain.getPlugin(), "stream: " + stream.toString());
try {
T2CbungeePlayersEnum subChannel = T2CbungeePlayersEnum.valueOf(stream.readUTF());
String input = stream.readUTF();
String uuid = stream.readUTF();
T2Csend.debug(T2CodeLibMain.getPlugin(), "PluginMessage received channel: " + channel);
T2Csend.debug(T2CodeLibMain.getPlugin(), "PluginMessage received subChannel: " + subChannel.name());
T2Csend.debug(T2CodeLibMain.getPlugin(), "PluginMessage received input: " + input);
T2Csend.debug(T2CodeLibMain.getPlugin(), "PluginMessage received input2/uuid: " + uuid);
T2Cdebug.debug(T2CodeLibMain.getPlugin(), "PluginMessage received channel: " + channel);
T2Cdebug.debug(T2CodeLibMain.getPlugin(), "PluginMessage received subChannel: " + subChannel.name());
T2Cdebug.debug(T2CodeLibMain.getPlugin(), "PluginMessage received input: " + input);
T2Cdebug.debug(T2CodeLibMain.getPlugin(), "PluginMessage received input2/uuid: " + uuid);
switch (subChannel) {
case JOIN:
bungeePlayers.add(input);
@ -75,9 +76,9 @@ public class T2CbungeePlayers implements PluginMessageListener {
for (Player player : Bukkit.getOnlinePlayers()) {
player.sendPluginMessage(T2CodeLibMain.getPlugin(), "t2c:bonlp", stream.toByteArray());
T2Csend.debug(T2CodeLibMain.getPlugin(), "PluginMessage received channel: t2c:bonlp");
T2Csend.debug(T2CodeLibMain.getPlugin(), "PluginMessage send subChannel: " + T2CbungeePlayersEnum.GIVEALL.name());
T2Csend.debug(T2CodeLibMain.getPlugin(), "PluginMessage send output/uuid: " + T2CLibConfig.VALUES.serverUUID.getValue().toString());
T2Cdebug.debug(T2CodeLibMain.getPlugin(), "PluginMessage received channel: t2c:bonlp");
T2Cdebug.debug(T2CodeLibMain.getPlugin(), "PluginMessage send subChannel: " + T2CbungeePlayersEnum.GIVEALL.name());
T2Cdebug.debug(T2CodeLibMain.getPlugin(), "PluginMessage send output/uuid: " + T2CLibConfig.VALUES.serverUUID.getValue().toString());
return;
}
}

View File

@ -4,7 +4,8 @@ import com.bencodez.votingplugin.VotingPluginMain;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import net.t2code.t2codelib.SPIGOT.api.plugins.T2CpluginCheck;
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
import net.t2code.t2codelib.SPIGOT.system.config.languages.old.SelectLibMsg;
import net.t2code.t2codelib.SPIGOT.system.config.languages.T2CLibLanguages;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
@ -28,10 +29,10 @@ public class T2Ceco {
private static boolean vault(String prefix, Player player) {
if (T2CodeLibMain.getEco() == null) {
if (Bukkit.getPluginManager().getPlugin("Vault") == null) {
T2Csend.console(prefix + " §4\n" + prefix + " §4Vault could not be found! §9Please download it here: " +
"§6https://www.spigotmc.org/resources/vault.34315/§4\n" + prefix);
T2Csend.console(prefix + " §e║ "+ "§4\n" + prefix + " §e║ " + "§4Vault could not be found! §9Please download it here: " +
"§6https://www.spigotmc.org/resources/vault.34315/§4\n" + prefix + " §e║ ");
}
player.sendMessage(prefix + "\n" + SelectLibMsg.vaultNotSetUp + "\n" + prefix);
player.sendMessage(prefix + "\n" + T2CLibLanguages.VALUES.vaultNotSetUp.getValue().toString() + "\n" + prefix);
return false;
} else return true;
}
@ -85,9 +86,9 @@ public class T2Ceco {
private static boolean votePlugin(String prefix, Player player) {
if (T2CpluginCheck.votingPlugin()) return true;
T2Csend.console(prefix + " §4\n" + prefix + " §4VotingPlugin could not be found! §9Please download it here: " +
"§6https://www.spigotmc.org/resources/votingplugin.15358/§4\n" + prefix);
player.sendMessage(prefix + "\n" + SelectLibMsg.votingPluginNotSetUp + "\n" + prefix);
T2Csend.console(prefix + " §e║ " + "§4\n" + prefix + " §e║ " + "§4VotingPlugin could not be found! §9Please download it here: " +
"§6https://www.spigotmc.org/resources/votingplugin.15358/§4\n" + prefix + " §e║ ");
player.sendMessage(prefix + "\n" + T2CLibLanguages.VALUES.votingPluginNotSetUp.getValue().toString() + "\n" + prefix);
return false;
}
}

View File

@ -59,8 +59,7 @@ public class T2Csend {
}
/**
*
* Use: T2Cdebug.debug(Plugin plugin, String msg) or T2Cdebug.debug(Plugin plugin, String msg, Integer stage)
* @Deprecated Use: T2Cdebug.debug(Plugin plugin, String msg) or T2Cdebug.debug(Plugin plugin, String msg, Integer stage)
*/
@Deprecated
public static void debug(Plugin plugin, String msg) {
@ -68,8 +67,7 @@ public class T2Csend {
}
/**
*
* Use: T2Cdebug.debug(Plugin plugin, String msg) or T2Cdebug.debug(Plugin plugin, String msg, Integer stage)
* @Deprecated Use: T2Cdebug.debug(Plugin plugin, String msg) or T2Cdebug.debug(Plugin plugin, String msg, Integer stage)
*/
@Deprecated
public static void debug(Plugin plugin, String msg, Integer stage) {

View File

@ -1,5 +1,6 @@
package net.t2code.t2codelib.SPIGOT.api.messages;
import net.t2code.t2codelib.SPIGOT.api.debug.T2Cdebug;
import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
import net.t2code.t2codelib.T2CupdateWebData;
@ -11,15 +12,13 @@ import org.bukkit.plugin.Plugin;
import java.util.List;
public class T2Ctemplate {
public static Long onLoadHeader(String prefix, List<String> autor, String version, String spigot, String discord) {
return onLoadHeader(prefix, autor, version, spigot, discord, null, null);
public static Long onLoadHeader( String prefix, List<String> autor, String version, String spigot, String discord) {
return onLoadHeader( prefix, autor, version, spigot, discord, null, null);
}
public static Long onLoadHeader(String prefix, List<String> autor, String version, String spigot, String discord, Boolean isPremium) {
return onLoadHeader(prefix, autor, version, spigot, discord, isPremium, null);
}
public static Long onLoadHeader( String prefix, List<String> autor, String version, String spigot, String discord, Boolean isPremium, Boolean isVerify) {
public static Long onLoadHeader(String prefix, List<String> autor, String version, String spigot, String discord, Boolean isPremium, Boolean isVerify) {
Long long_ = System.currentTimeMillis();
/**
@ -32,36 +31,34 @@ public class T2Ctemplate {
*/
for (String s : Util.getLoadLogo()) {
T2Csend.console(prefix + " §e" + s);
}
onStartMsg(prefix,"");
onStartMsg(prefix,"§2Author §6" + String.valueOf(autor).replace("[", "").replace("]", ""));
onStartMsg(prefix,"§2Version: §6" + version);
onStartMsg(prefix,"§2Spigot: §6" + spigot);
onStartMsg(prefix,"§2Discord: §6" + discord);
setCenterAligned(prefix, "§2Author §6" + String.valueOf(autor).replace("[", "").replace("]", ""), true);
setCenterAligned(prefix, "§2Version: §6" + version, true);
setCenterAligned(prefix, "§2Spigot: §6" + spigot, true);
setCenterAligned(prefix, "§2Discord: §6" + discord, true);
if (isPremium != null) {
if (isPremium) {
onStartMsg(prefix,"§6Premium: §2true");
} else onStartMsg(prefix,"§6Premium: §4false");
setCenterAligned(prefix, "§6Premium: §2true", true);
} else setCenterAligned(prefix, "§6Premium: §4false", true);
if (isVerify != null) {
if (isVerify) {
onStartMsg(prefix,"§6Verify: §2true");
} else onStartMsg(prefix,"§6Verify: §4false");
} else onStartMsg(prefix,"§6Verify: §4false");
setCenterAligned(prefix, "§6Verify: §2true", true);
} else setCenterAligned(prefix, "§6Verify: §4false", true);
} else setCenterAligned(prefix, "§6Verify: §4false", true);
}
onLoadSeparateStroke(prefix);
if (version.toLowerCase().contains("dev") || version.toLowerCase().contains("snapshot") || version.toLowerCase().contains("beta")) {
T2Csend.warning(T2CodeLibMain.getPlugin(), "");
T2Csend.warning(T2CodeLibMain.getPlugin(), "");
onStartMsg(prefix, "§eYou are running §4" + version + " §eof " + prefix + "§e!");
onStartMsg(prefix, "§eSome features may not be working as expected.");
onStartMsg(prefix, "§ePlease report all bugs here: http://dc.t2code.net");
onStartMsg(prefix, "§4UpdateChecker & bStats may be disabled!");
T2Csend.warning(T2CodeLibMain.getPlugin(), "");
T2Csend.warning(T2CodeLibMain.getPlugin(), "");
setCenterAligned(prefix, "", true);
setCenterAligned(prefix, "", true);
setCenterAligned(prefix, "§eYou are running §4" + version + " §eof §4" + prefix + "§e!", true);
setCenterAligned(prefix, "§eSome features may not be working as expected.", true);
setCenterAligned(prefix, "§ePlease report all bugs here: http://dc.t2code.net", true);
setCenterAligned(prefix, "§4UpdateChecker & bStats may be disabled!", true);
setCenterAligned(prefix, "", true);
setCenterAligned(prefix, "", true);
onLoadSeparateStroke(prefix);
try {
@ -82,49 +79,24 @@ public class T2Ctemplate {
}
public static void onLoadSeparateStroke(String prefix) {
onStartMsg(prefix,"§8-------------------------------");
T2Csend.console(prefix + " §e╠═══════════════════════════════════════════════════════════════════════════╣");
}
public static void onStartMsg(String prefix, String msg) {
T2Csend.console(prefix + " §e║ " + msg);
}
public static void onLoadFooter(String prefix, Long long_, String v) {
onLoadFooter(prefix, long_);
}
public static void onLoadFooter(String prefix, Long long_) {
onLoadSeparateStroke(prefix);
onStartMsg(prefix, "§2Plugin loaded successfully." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
T2Csend.console(prefix + " §e╚════════════════════════════════════");
}
/**
* @param prefix
* @param autor
* @param spigot
* @param discord
* @deprecated reason this method is deprecated <br/>
* {will be removed in next version} <br/>
* use {@link #onDisable(String, Plugin)} instead like this:
*
*
* <blockquote><pre>
* onDisable(getPlugin())
* </pre></blockquote>
*/
@Deprecated
public static void onDisable(String prefix, List<String> autor, String version, String spigot, String discord) {
T2Csend.console(prefix + " §2Version: §6" + version);
T2Csend.console(prefix + " §4Plugin successfully disabled.");
setCenterAligned(prefix, "§2Plugin loaded successfully." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms", true);
T2Csend.console(prefix + " §e" + BOTTOM_BORDER);
}
public static void onDisable(String prefix, Plugin plugin) {
T2Csend.console(prefix + " §4 §e╔══════════════════════════");
T2Csend.console(prefix + " §4 §e║ §2Version: §6" + plugin.getDescription().getVersion());
T2Csend.console(prefix + " §4 §e║ §2Autors: §6" + plugin.getDescription().getAuthors());
T2Csend.console(prefix + " §4 §e║ §4Plugin successfully disabled.");
T2Csend.console(prefix + " §4 §e╚══════════════════════════");
sendFrameCenter(prefix, " §2Version: §6" + plugin.getDescription().getVersion(), "§2Autors: §6" + String.valueOf(plugin.getDescription().getAuthors()).replace("[", "").replace("]", ""), " §4Plugin successfully disabled. ");
}
public static void sendInfo(CommandSender sender, Plugin plugin, int spigotID, String discord, Boolean premiumVerified, String text) {
@ -181,4 +153,171 @@ public class T2Ctemplate {
public static void sendInfo(CommandSender sender, Plugin plugin, int spigotID, String discord, String text) {
sendInfo(sender, plugin, spigotID, discord, null, text);
}
}
// Frame in Console
protected static final String BOTTOM_BORDER = "╚═══════════════════════════════════════════════════════════════════════════╝";
protected static final int FIXED_WIDTH = BOTTOM_BORDER.length() - 2; // Länge ohne die Randzeichen
public static void setCenterAligned(String prefix, String text, boolean setStartFrame) {
if (!setStartFrame) {
T2Csend.console(prefix + " " + text);
return;
}
// Entfernen von Farbcodes aus der Berechnungslänge
String textWithoutColor = removeColorCodes(text);
int textLengthWithoutColor = textWithoutColor.length();
int totalPaddingSize = FIXED_WIDTH - textLengthWithoutColor;
// Sicherstellen, dass das Padding nicht negativ wird
if (totalPaddingSize < 0) totalPaddingSize = 0;
// Berechnung des Abstands vor und nach dem Text
int paddingLeft = totalPaddingSize / 2;
int paddingRight = totalPaddingSize - paddingLeft;
// Formatierung der Zeile: Text zentrieren
String formattedValue = "§e║" + " ".repeat(paddingLeft) + text + " ".repeat(paddingRight) + "§e║";
T2Csend.console(prefix + " " + formattedValue);
}
public static void setLeftAligned(String prefix, String text, boolean setStartFrame) {
T2Csend.error(T2CodeLibMain.getPlugin(), text);
if (!setStartFrame) {
T2Csend.console(prefix + " " + text);
return;
}
// Entfernen von Farbcodes aus der Berechnungslänge
String textWithoutColor = removeColorCodes(text);
int textLengthWithoutColor = textWithoutColor.length();
int totalPaddingSize = FIXED_WIDTH - textLengthWithoutColor;
// Sicherstellen, dass das Padding nicht negativ wird
if (totalPaddingSize < 0) totalPaddingSize = 0;
// Berechnung des Abstands nach dem Text und vor dem Rand
int paddingLeft = 0; // Kein zusätzlicher Abstand vor dem Text
int paddingRight = totalPaddingSize; // Alles Padding geht nach rechts
// Formatierung der Zeile: Text am Anfang und dynamischer Abstand zum Ende
String formattedValue = "§e║" + text + " ".repeat(paddingRight) + "";
T2Csend.console(prefix + " " + formattedValue);
}
// Methode für mehrere Zeilen Text mit dynamischem Rahmen
public static void sendFrameLeft(String prefix, String... lines) {
String COLOR_CODE = "§e";
String BORDER_CHAR = "";
String TOP_LEFT = "";
String TOP_RIGHT = "";
String BOTTOM_LEFT = "";
String BOTTOM_RIGHT = "";
String SIDE_BORDER = "";
// Entfernen von Farbcodes und Berechnung der maximalen Länge
int maxLength = 0;
for (String line : lines) {
String lineWithoutColor = removeColorCodes(line);
maxLength = Math.max(maxLength, lineWithoutColor.length());
}
// Berechnung der Rahmenbreite
int frameWidth = maxLength + 2; // +2 für die Ränder '║'
String topBorder = COLOR_CODE + TOP_LEFT + BORDER_CHAR.repeat(frameWidth) + COLOR_CODE + TOP_RIGHT;
String bottomBorder = COLOR_CODE + BOTTOM_LEFT + BORDER_CHAR.repeat(frameWidth) + COLOR_CODE + BOTTOM_RIGHT;
// Gehe durch jede Zeile und formatiere sie
StringBuilder builder = new StringBuilder();
// Ausgabe der oberen Linie
builder.append("<br>").append(prefix).append(" ").append(topBorder).append("<br>");
for (String line : lines) {
// Entfernen von Farbcodes aus der Berechnungslänge
String lineWithoutColor = removeColorCodes(line);
int lineLengthWithoutColor = lineWithoutColor.length();
int totalPaddingSize = frameWidth - lineLengthWithoutColor; // -2 für die Ränder '║'
// Sicherstellen, dass das Padding nicht negativ wird
if (totalPaddingSize < 0) totalPaddingSize = 0;
// Berechnung des Abstands nach dem Text und vor dem Rand
int paddingLeft = 0; // Kein zusätzlicher Abstand vor dem Text
int paddingRight = totalPaddingSize; // Alles Padding geht nach rechts
// Formatierung der Zeile: Text am Anfang und dynamischer Abstand zum Ende
String formattedValue = COLOR_CODE + SIDE_BORDER + line + " ".repeat(paddingRight) + COLOR_CODE + SIDE_BORDER;
builder.append(prefix).append(" ").append(formattedValue).append("<br>");
}
// Ausgabe der unteren Linie
builder.append(prefix).append(" ").append(bottomBorder);
T2Csend.console(builder.toString());
}
public static void sendFrameCenter(String prefix, String... lines) {
String COLOR_CODE = "§e";
String BORDER_CHAR = "";
String TOP_LEFT = "";
String TOP_RIGHT = "";
String BOTTOM_LEFT = "";
String BOTTOM_RIGHT = "";
String SIDE_BORDER = "";
// Entfernen von Farbcodes und Berechnung der maximalen Länge
int maxLength = 0;
for (String line : lines) {
String lineWithoutColor = removeColorCodes(line);
maxLength = Math.max(maxLength, lineWithoutColor.length());
}
// Berechnung der Rahmenbreite
int frameWidth = maxLength + 2; // +2 für die Ränder '║'
String topBorder = COLOR_CODE + TOP_LEFT + BORDER_CHAR.repeat(frameWidth) + COLOR_CODE + TOP_RIGHT;
String bottomBorder = COLOR_CODE + BOTTOM_LEFT + BORDER_CHAR.repeat(frameWidth) + COLOR_CODE + BOTTOM_RIGHT;
T2Cdebug.debugmsg(T2CodeLibMain.getPlugin(), "frameWidth "+frameWidth);
// Gehe durch jede Zeile und formatiere sie
StringBuilder builder = new StringBuilder();
// Ausgabe der oberen Linie
builder.append("<br>").append(prefix).append(" ").append(topBorder).append("<br>");
for (String line : lines) {
// Entfernen von Farbcodes aus der Berechnungslänge
String lineWithoutColor = removeColorCodes(line);
int lineLengthWithoutColor = lineWithoutColor.length();
int totalPaddingSize = frameWidth - lineLengthWithoutColor; // -2 für die Ränder '║'
// Sicherstellen, dass das Padding nicht negativ wird
if (totalPaddingSize < 0) totalPaddingSize = 0;
// Berechnung des Abstands vor und nach dem Text
int paddingLeft = totalPaddingSize / 2;
int paddingRight = totalPaddingSize - paddingLeft;
// Formatierung der Zeile: Text zentrieren
String formattedValue = COLOR_CODE + SIDE_BORDER + " ".repeat(paddingLeft) + line + " ".repeat(paddingRight) + COLOR_CODE + SIDE_BORDER;
builder.append(prefix).append(" ").append(formattedValue).append("<br>");
}
// Ausgabe der unteren Linie
builder.append(prefix).append(" ").append(bottomBorder);
T2Csend.console(builder.toString());
}
// Methode zum Entfernen von Farbcodes und MiniMessage-Farbcodes aus dem Text, außer <br>
private static String removeColorCodes(String text) {
// Regex für alle Farbcodes und MiniMessage-Codes außer <br>
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, "");
}
}

View File

@ -0,0 +1,53 @@
// This class was created by JaTiTV.
package net.t2code.t2codelib.SPIGOT.api.sound;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
import net.t2code.t2codelib.SPIGOT.system.config.languages.T2CLibLanguages;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
public class T2Csound {
public static void playSound(Player player, String sound, int v, int v1) {
playSound(player, Sound.valueOf(sound), v, v1);
}
public static void playSound(Player player, Sound sound, int v, int v1) {
player.playSound(player.getLocation(), sound, v, v1);
}
public static Sound checkSound(String sound1_8, String sound1_9, String sound1_13, String selectSoundFromConfig, String prefix) {
String SOUND;
if (T2CmcVersion.isMc1_8()) {
SOUND = sound1_8;
} else if (T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
SOUND = sound1_9;
} else SOUND = sound1_13;
return checkSound(SOUND, selectSoundFromConfig, prefix);
}
public static Sound checkSound(String sound1_8, String sound1_13, String selectSoundFromConfig, String prefix) {
String SOUND;
if (T2CmcVersion.isMc1_8()) {
SOUND = sound1_8;
} else SOUND = sound1_13;
return checkSound(SOUND, selectSoundFromConfig, prefix);
}
public static Sound checkSound(String sound, String selectSoundFromConfig, String prefix) {
try {
return Sound.valueOf(selectSoundFromConfig);
} catch (Exception e) {
T2Csend.console("§4\n§4\n§4\n" + T2CLibLanguages.VALUES.soundNotFound.getValue().toString().replace("[prefix]", prefix)
.replace("[sound]", "§8Buy: §6" + selectSoundFromConfig) + "§4\n§4\n§4\n");
return Sound.valueOf(sound);
}
}
}

View File

@ -1,6 +1,7 @@
package net.t2code.t2codelib.SPIGOT.api.update;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
import net.t2code.t2codelib.SPIGOT.system.config.config.T2CLibConfig;
import net.t2code.t2codelib.UpdateType;
@ -105,14 +106,12 @@ public class T2CupdateAPI {
updateStatusVersion = UpdateType.SNAPSHOT.text;
}
} else updateStatusVersion = UpdateType.STABLE.text;
String h = "<br><dark_red>╔══════════════</dark_red>" + prefix + "<dark_red>══════════════</dark_red>";
String s1 = "<br><dark_red>║</dark_red> <color:#6e90ff>A new [value] version was found!</color>".replace("[value]", updateStatusVersion);
String s2 = "<br><dark_red>║</dark_red> <color:#6e90ff>Your version: <red>" + pluginVersion + "</red> <gray>-</gray> Current version:</color> <green>" + webData.getVersion() + "</green>";
String s3 = "<br><dark_red>║</dark_red> <color:#6e90ff>You can download it here:</color> <yellow>" + webData.getUpdateUrl() + "</yellow>";
String s4 = "<br><dark_red>║</dark_red> <color:#6e90ff>You can find more information on Discord:</color> <yellow>" + discord + "</yellow>";
String f = "<br><dark_red>╚══════════════</dark_red>" + prefix + "<dark_red>══════════════</dark_red>";
String text = h + s1 + s2 + s3 + s4 + f;
T2Csend.console(text);
String s1 = " <color:#6e90ff>A new [value] version was found!</color>".replace("[value]", updateStatusVersion);
String s2 = " <color:#6e90ff>Your version: <red>" + pluginVersion + "</red> <gray>-</gray> Current version:</color> <green>" + webData.getVersion() + "</green>";
String s3 = " <color:#6e90ff>You can download it here:</color> <yellow>" + webData.getUpdateUrl() + "</yellow>";
String s4 = " <color:#6e90ff>You can find more information on Discord:</color> <yellow>" + discord + "</yellow>";
T2Ctemplate.sendFrameCenter(prefix,s1,s2,s3,s4);
}
public static String updateInfo(String[] args, Boolean player) {

View File

@ -68,7 +68,7 @@ public class T2CupdateCheckerGit {
} else T2CupdateAPI.sendUpdateMsg(prefix, discord, webData, plugin);
} else {
if (!update.load) {
T2Csend.console(prefix + " §2No update found.");
T2Csend.console(prefix + " §e║ " + "§2No update found.");
update.load = true;
}
}

View File

@ -1,9 +1,8 @@
package net.t2code.t2codelib.SPIGOT.api.yaml;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
import net.t2code.t2codelib.SPIGOT.system.config.languages.old.SelectLibMsg;
import net.t2code.t2codelib.SPIGOT.api.sound.T2Csound;
import org.bukkit.Sound;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.inventory.ItemStack;
@ -135,39 +134,22 @@ public class T2Cconfig {
* @deprecated since version 16.7, please use the new T2CconfigWriter.
*/
public static Sound checkSound(String sound1_8, String sound1_9, String sound1_13, String selectSoundFromConfig, String prefix) {
String SOUND;
if (T2CmcVersion.isMc1_8()) {
SOUND = sound1_8;
} else if (T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
SOUND = sound1_9;
} else SOUND = sound1_13;
return checkSound(SOUND, selectSoundFromConfig, prefix);
return T2Csound.checkSound(sound1_8, sound1_9, sound1_13, selectSoundFromConfig, prefix);
}
/**
* @deprecated since version 16.7, please use the new T2CconfigWriter.
*/
public static Sound checkSound(String sound1_8, String sound1_13, String selectSoundFromConfig, String prefix) {
String SOUND;
if (T2CmcVersion.isMc1_8()) {
SOUND = sound1_8;
} else SOUND = sound1_13;
return checkSound(SOUND, selectSoundFromConfig, prefix);
return T2Csound.checkSound(sound1_8, sound1_13, selectSoundFromConfig, prefix);
}
/**
* @deprecated since version 16.7, please use the new T2CconfigWriter.
*/
public static Sound checkSound(String sound, String selectSoundFromConfig, String prefix) {
try {
return Sound.valueOf(selectSoundFromConfig);
} catch (Exception e) {
T2Csend.console("§4\n§4\n§4\n" + SelectLibMsg.soundNotFound.replace("[prefix]", prefix)
.replace("[sound]", "§8Buy: §6" + selectSoundFromConfig) + "§4\n§4\n§4\n");
return Sound.valueOf(sound);
}
return T2Csound.checkSound(sound, selectSoundFromConfig, prefix);
}
/**

View File

@ -3,11 +3,8 @@
package net.t2code.t2codelib.SPIGOT.api.yaml;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
import net.t2code.t2codelib.T2CLanguageEnum;
import net.t2code.t2codelib.T2CconfigItemLanguages;
import net.t2code.t2codelib.Util;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
@ -19,7 +16,7 @@ public class T2CconfigWriterLanguage {
private static FileConfiguration config;
public static void createConfig(File path, T2CconfigItemLanguages[] values, String loadConfig, String... header) {
public static void createConfig(String prefix,File path, T2CconfigItemLanguages[] values, String loadConfig,boolean pluginStart, String... header) {
File f = new File(path + "/languages/");
f.mkdirs();
@ -66,27 +63,27 @@ public class T2CconfigWriterLanguage {
T2CymlWriter.saveConfigWithComments(langFile, config, comments, header);
}
}
readConfig(values, loadConfig);
readConfig(prefix,path,values, loadConfig, pluginStart);
}
private static void readConfig(T2CconfigItemLanguages[] values, String loadConfig) {
private static void readConfig(String prefix, File path, T2CconfigItemLanguages[] values, String loadConfig, boolean pluginStart) {
String selectMSG;
File msg;
msg = new File(T2CodeLibMain.getPath(), "languages/" + loadConfig + ".yml");
msg = new File(path, "languages/" + loadConfig + ".yml");
if (!msg.isFile()) {
T2Ctemplate.onStartMsg(Util.getPrefix(), "");
T2Ctemplate.onStartMsg(Util.getPrefix(), "§4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
T2Ctemplate.onStartMsg(Util.getPrefix(), "§4The selected §c" + loadConfig + " §4language file was not found.");
T2Ctemplate.onStartMsg(Util.getPrefix(), "§6The default language §e" + T2CLanguageEnum.english.name() + " §6is used!");
T2Ctemplate.onStartMsg(Util.getPrefix(), "§4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
T2Ctemplate.onStartMsg(Util.getPrefix(), "");
msg = new File(T2CodeLibMain.getPath(), "languages/" + T2CLanguageEnum.english.name() + ".yml");
T2Ctemplate.setCenterAligned(prefix, "", pluginStart);
T2Ctemplate.setCenterAligned(prefix, "§4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", pluginStart);
T2Ctemplate.setCenterAligned(prefix, "§4The selected §c" + loadConfig + " §4language file was not found.", pluginStart);
T2Ctemplate.setCenterAligned(prefix, "§6The default language §e" + T2CLanguageEnum.english.name() + " §6is used!", pluginStart);
T2Ctemplate.setCenterAligned(prefix, "§4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", pluginStart);
T2Ctemplate.setCenterAligned(prefix, "", pluginStart);
msg = new File(path, "languages/" + T2CLanguageEnum.english.name() + ".yml");
selectMSG = T2CLanguageEnum.english.name();
} else selectMSG = loadConfig;
YamlConfiguration yml = YamlConfiguration.loadConfiguration(msg);
for (T2CconfigItemLanguages value : values) {
value.setValue(yml.get(value.getPath()));
}
T2Ctemplate.onStartMsg(Util.getPrefix(), "§2Language successfully selected to: §6" + selectMSG);
T2Ctemplate.setCenterAligned(prefix, "§2Language successfully selected to: §6" + selectMSG, pluginStart);
}
}

View File

@ -39,7 +39,9 @@ public class T2CymlWriter {
List<String> commentList = comments.get(fullKey);
if (commentList != null) {
for (String c : commentList) {
builder.append(indent).append("# ").append(c).append("\n");
if (c.isEmpty()) {
builder.append(indent).append(c).append("\n");
} else builder.append(indent).append("# ").append(c).append("\n");
}
}

View File

@ -19,7 +19,7 @@ import net.t2code.t2codelib.SPIGOT.system.cmd.CmdExecuter;
import net.t2code.t2codelib.SPIGOT.system.cmd.Development;
import net.t2code.t2codelib.SPIGOT.system.cmd.ReportLogStorage;
import net.t2code.t2codelib.SPIGOT.system.config.config.T2CLibConfig;
import net.t2code.t2codelib.SPIGOT.system.config.languages.Languages;
import net.t2code.t2codelib.SPIGOT.system.config.languages.T2CLibLanguages;
import net.t2code.t2codelib.T2CplatformDetector;
import net.t2code.t2codelib.Util;
import org.bukkit.Bukkit;
@ -64,7 +64,7 @@ public final class T2CodeLibMain extends JavaPlugin {
mmIsLoad = false;
}
plattform = T2CplatformDetector.detectPlatform();
long long_ = T2Ctemplate.onLoadHeader(Util.getPrefix(), autor, version, Util.getSpigot(), Util.getDiscord(), null, null);
long long_ = T2Ctemplate.onLoadHeader(Util.getPrefix(), autor, version, Util.getSpigot(), Util.getDiscord());
checkIsBungee();
String prefix = Util.getPrefix();
@ -77,20 +77,18 @@ public final class T2CodeLibMain extends JavaPlugin {
T2CmcVersion.onCheck();
if (T2CnmsVersions.getT2CnmsEnum() == T2CnmsEnum.not_support) {
T2Csend.warning(plugin, "");
T2Csend.warning(plugin, "");
T2Csend.warning(plugin, "");
T2Ctemplate.onStartMsg(prefix, "§4!!!!!!!!!!!!!!!!!!!!");
T2Ctemplate.onStartMsg(prefix, "");
T2Ctemplate.onStartMsg(prefix, "The " + T2CmcVersion.getMcVersion() + " is a very fresh / new version.");
T2Ctemplate.onStartMsg(prefix, "The plugin may not yet be supported on this server!");
T2Ctemplate.onStartMsg(prefix, "If there are any bugs in our plugins,");
T2Ctemplate.onStartMsg(prefix, "please report them to us via our Discord: http://dc.t2code.net");
T2Ctemplate.onStartMsg(prefix, "");
T2Ctemplate.onStartMsg(prefix, "§4!!!!!!!!!!!!!!!!!!!!");
T2Csend.warning(plugin, "");
T2Csend.warning(plugin, "");
T2Csend.warning(plugin, "");
T2Ctemplate.setCenterAligned(prefix, "", true);
T2Ctemplate.setCenterAligned(prefix, "", true);
T2Ctemplate.setCenterAligned(prefix, "§4!!!!!!!!!!!!!!!!!!!!", true);
T2Ctemplate.setCenterAligned(prefix, "", true);
T2Ctemplate.setCenterAligned(prefix, "The " + T2CmcVersion.getMcVersion() + " is a very fresh / new version.", true);
T2Ctemplate.setCenterAligned(prefix, "The plugin may not yet be supported on this server!", true);
T2Ctemplate.setCenterAligned(prefix, "If there are any bugs in our plugins,", true);
T2Ctemplate.setCenterAligned(prefix, "please report them to us via our Discord: http://dc.t2code.net", true);
T2Ctemplate.setCenterAligned(prefix, "", true);
T2Ctemplate.setCenterAligned(prefix, "§4!!!!!!!!!!!!!!!!!!!!", true);
T2Ctemplate.setCenterAligned(prefix, "", true);
T2Ctemplate.setCenterAligned(prefix, "", true);
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
@ -98,19 +96,17 @@ public final class T2CodeLibMain extends JavaPlugin {
}
}
if (T2CmcVersion.isMc1_22()) {
T2Csend.warning(plugin, "");
T2Csend.warning(plugin, "");
T2Csend.warning(plugin, "");
T2Ctemplate.onStartMsg(prefix, "§4!!!!!!!!!!!!!!!!!!!!");
T2Ctemplate.onStartMsg(prefix, "");
T2Ctemplate.onStartMsg(prefix, "The 1.22 is a very fresh / new version.");
T2Ctemplate.onStartMsg(prefix, "If there are any bugs in our plugins,");
T2Ctemplate.onStartMsg(prefix, "please report them to us via our Discord: http://dc.t2code.net");
T2Ctemplate.onStartMsg(prefix, "");
T2Ctemplate.onStartMsg(prefix, "§4!!!!!!!!!!!!!!!!!!!!");
T2Csend.warning(plugin, "");
T2Csend.warning(plugin, "");
T2Csend.warning(plugin, "");
T2Ctemplate.setCenterAligned(prefix, "", true);
T2Ctemplate.setCenterAligned(prefix, "", true);
T2Ctemplate.setCenterAligned(prefix, "§4!!!!!!!!!!!!!!!!!!!!", true);
T2Ctemplate.setCenterAligned(prefix, "", true);
T2Ctemplate.setCenterAligned(prefix, "The 1.22 is a very fresh / new version.", true);
T2Ctemplate.setCenterAligned(prefix, "If there are any bugs in our plugins,", true);
T2Ctemplate.setCenterAligned(prefix, "please report them to us via our Discord: http://dc.t2code.net", true);
T2Ctemplate.setCenterAligned(prefix, "", true);
T2Ctemplate.setCenterAligned(prefix, "§4!!!!!!!!!!!!!!!!!!!!", true);
T2Ctemplate.setCenterAligned(prefix, "", true);
T2Ctemplate.setCenterAligned(prefix, "", true);
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
@ -118,52 +114,51 @@ public final class T2CodeLibMain extends JavaPlugin {
}
}
T2Ctemplate.onLoadSeparateStroke(prefix);
T2Ctemplate.onStartMsg(prefix, "§2Server run on:");
T2Ctemplate.onStartMsg(prefix, "§3Platform: §6" + plattform.name());
T2Ctemplate.onStartMsg(prefix, "§3Server Version: §6" + T2CmcVersion.getMcVersion());
T2Ctemplate.onStartMsg(prefix, "§3Bukkit Version: §6" + T2CmcVersion.getBukkitVersion());
T2Ctemplate.onStartMsg(prefix, "§3NMS: §6" + T2CmcVersion.getNms());
T2Ctemplate.setCenterAligned(prefix, "§2Server run on:", true);
T2Ctemplate.setCenterAligned(prefix, "§3NMS: §6" + T2CmcVersion.getNms(), true);
T2Ctemplate.setCenterAligned(prefix, "§3Platform: §6" + plattform.name(), true);
T2Ctemplate.setCenterAligned(prefix, "§3Bukkit Version: §6" + T2CmcVersion.getBukkitVersion(), true);
T2Ctemplate.setCenterAligned(prefix, "§3Server Version: §6" + T2CmcVersion.getMcVersion(), true);
T2Ctemplate.onLoadSeparateStroke(prefix);
if (eco != null) {
String st = eco.getName();
if (eco.getName().equals("CMIEconomy")) st = "CMI";
if (Bukkit.getPluginManager().getPlugin(st) != null) {
T2Ctemplate.onStartMsg(prefix, "§3Economy: §6" + eco.getName() + " - " + Bukkit.getPluginManager().getPlugin(st).getDescription().getVersion() + " §7- §e" +
(System.currentTimeMillis() - long_) + "ms");
T2Ctemplate.setCenterAligned(prefix, "§3Economy: §6" + eco.getName() + " - " + Bukkit.getPluginManager().getPlugin(st).getDescription().getVersion() + " §7- §e" +
(System.currentTimeMillis() - long_) + "ms", true);
} else
T2Ctemplate.onStartMsg(prefix, "§3Economy: §6" + eco.getName() + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
T2Ctemplate.setCenterAligned(prefix, "§3Economy: §6" + eco.getName() + " §7- §e" + (System.currentTimeMillis() - long_) + "ms", true);
} else
T2Ctemplate.onStartMsg(prefix, "§3Economy: §4not connected via vault!" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
T2Ctemplate.setCenterAligned(prefix, "§3Economy: §4not connected via vault!" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms", true);
if (perm != null) {
if (Bukkit.getPluginManager().getPlugin(perm.getName()) != null) {
T2Ctemplate.onStartMsg(prefix, "§3Permission plugin: §6" + perm.getName() + " - " + Bukkit.getPluginManager().getPlugin(perm.getName()).getDescription().getVersion()
+ " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
T2Ctemplate.setCenterAligned(prefix, "§3Permission plugin: §6" + perm.getName() + " - " + Bukkit.getPluginManager().getPlugin(perm.getName()).getDescription().getVersion()
+ " §7- §e" + (System.currentTimeMillis() - long_) + "ms", true);
} else
T2Ctemplate.onStartMsg(prefix, "§3Permission plugin: §6" + perm.getName() + " - §7- §e" + (System.currentTimeMillis() - long_) + "ms");
T2Ctemplate.setCenterAligned(prefix, "§3Permission plugin: §6" + perm.getName() + " - §7- §e" + (System.currentTimeMillis() - long_) + "ms", true);
} else
T2Ctemplate.onStartMsg(prefix, "§3Permission plugin: §4not connected via vault!" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
T2Ctemplate.setCenterAligned(prefix, "§3Permission plugin: §4not connected via vault!" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms", true);
if (T2CpluginCheck.papi()) {
T2Ctemplate.onStartMsg(prefix, "§3PlaceholderAPI: §6connected" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
T2Ctemplate.setCenterAligned(prefix, "§3PlaceholderAPI: §6connected" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms", true);
}
T2Ctemplate.onStartMsg(prefix, "§3Kyori MiniMessage Support: " + (getMmIsLoad() ? "§2load" : "§4not load") + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
T2Ctemplate.setCenterAligned(prefix, "§3Kyori MiniMessage Support: " + (getMmIsLoad() ? "§2load" : "§4not load") + " §7- §e" + (System.currentTimeMillis() - long_) + "ms", true);
plugin.getCommand("t2code").setExecutor(new CmdExecuter());
T2Ctemplate.onLoadSeparateStroke(prefix);
T2CLibConfig.set();
T2CLibConfig.set(true);
T2CitemVersion.scan();
// LanguagesCreate.langCreate(); todo
// SelectLibMsg.onSelect();
Languages.set();
T2CLibLanguages.set(true);
T2Ctemplate.onLoadSeparateStroke(prefix);
T2Ctemplate.onStartMsg(prefix, "§3Use Proxy: §6" + (boolean) T2CLibConfig.VALUES.proxy.getValue());
T2Ctemplate.onStartMsg(prefix, "§3serverUUID: §6" + T2CLibConfig.VALUES.serverUUID.getValue());
T2Ctemplate.setCenterAligned(prefix, "§3Use Proxy: §6" + (boolean) T2CLibConfig.VALUES.proxy.getValue(), true);
T2Ctemplate.setCenterAligned(prefix, "§3serverUUID: §6" + T2CLibConfig.VALUES.serverUUID.getValue(), true);
T2CupdateAPI.onUpdateCheck(plugin, prefix, Util.getGit(), Util.getSpigotID(), Util.getDiscord(),
(boolean) T2CLibConfig.VALUES.updateCheckOnJoin.getValue(),

View File

@ -2,7 +2,6 @@ package net.t2code.t2codelib.SPIGOT.system;
import net.milkbowl.vault.economy.Economy;
import net.milkbowl.vault.permission.Permission;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
import net.t2code.t2codelib.Util;
import org.bukkit.plugin.RegisteredServiceProvider;
@ -24,14 +23,14 @@ public class Vault {
if (T2CodeLibMain.getEco() != null) {
connected = true;
T2Ctemplate.onStartMsg(Util.getPrefix(), " §2Vault / Economy successfully connected!" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
T2Ctemplate.setCenterAligned(Util.getPrefix(), " §2Vault / Economy successfully connected!" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms", true);
} else {
connected = false;
T2Ctemplate.onStartMsg(Util.getPrefix(), " §4Economy could not be connected / found! [1]" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
T2Ctemplate.setCenterAligned(Util.getPrefix(), " §4Economy could not be connected / found! [1]" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms", true);
}
} else {
connected = false;
T2Ctemplate.onStartMsg(Util.getPrefix(), " §4Economy could not be connected / found! [2]" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
T2Ctemplate.setCenterAligned(Util.getPrefix(), " §4Economy could not be connected / found! [2]" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms", true);
}
RegisteredServiceProvider<Permission> perm = T2CodeLibMain.getPlugin().getServer().getServicesManager().getRegistration(Permission.class);
if (perm != null) {
@ -40,13 +39,13 @@ public class Vault {
} else {
vaultEnable = false;
connected = false;
T2Ctemplate.onStartMsg(Util.getPrefix()," §4Vault could not be connected! [3]" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
T2Ctemplate.setCenterAligned(Util.getPrefix()," §4Vault could not be connected! [3]" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms", true);
}
}
public static void vaultDisable() {
if (!connected) return;
connected = false;
T2Ctemplate.onStartMsg(Util.getPrefix(), " §4Vault / Economy successfully deactivated.");
T2Ctemplate.setCenterAligned(Util.getPrefix(), " §4Vault / Economy successfully deactivated.", true);
}
}

View File

@ -6,7 +6,7 @@ import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
import net.t2code.t2codelib.SPIGOT.system.T2CbungeeCommandSenderReciver;
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
import net.t2code.t2codelib.SPIGOT.system.config.config.T2CLibConfig;
import net.t2code.t2codelib.SPIGOT.system.config.languages.Languages;
import net.t2code.t2codelib.SPIGOT.system.config.languages.T2CLibLanguages;
import net.t2code.t2codelib.T2CupdateObject;
import net.t2code.t2codelib.Util;
import org.bukkit.command.Command;
@ -70,8 +70,8 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
T2Csend.sender(sender, "§4No Permission §8t2code.admin");
return false;
}
T2CLibConfig.set();
Languages.set();
T2CLibConfig.set(false);
T2CLibLanguages.set(false);
T2Csend.sender(sender, Util.getPrefix() + " §2Config successfully reloaded");
return false;
case "debug":

View File

@ -93,10 +93,10 @@ public class Commands {
String permission = args[2];
if (player.hasPermission(permission)) {
T2Ccmd.console(String.valueOf(T2CLibConfig.VALUES.commandPermToggleCommand.getValue()).replace("[player]",player.getName()).replace("[perm]",permission).replace("[value]", "false"));
T2Ccmd.console(String.valueOf(T2CLibConfig.VALUES.commandPermToggleCommand.getValue()).replace("[player]",player.getName()).replace("%player_name%",player.getName()).replace("[perm]",permission).replace("[value]", "false"));
T2Csend.sender(sender, "§2Permission §8'§6" + permission + "§8' §2was set to §6false §2for the player §6" + player.getName() + "§2.");
} else {
T2Ccmd.console(String.valueOf(T2CLibConfig.VALUES.commandPermToggleCommand.getValue()).replace("[player]",player.getName()).replace("[perm]",permission).replace("[value]", "true"));
T2Ccmd.console(String.valueOf(T2CLibConfig.VALUES.commandPermToggleCommand.getValue()).replace("[player]",player.getName()).replace("%player_name%",player.getName()).replace("[perm]",permission).replace("[value]", "true"));
T2Csend.sender(sender, "§2Permission §8'§6" + permission + "§8' §2was set to §6true §2for the player §6" + player.getName() + "§2.");
}

View File

@ -16,89 +16,90 @@ public class T2CLibConfig {
updateCheckOnJoin("plugin.updateCheck.onJoin", true, true,
new HashMap<>() {{
put(T2CLanguageEnum.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(T2CLanguageEnum.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."));
put(T2CLanguageEnum.german, List.of("Mit dieser Option können Sie festlegen, ob Spieler mit der Berechtigung 't2code.lib.updatemsg' beim Beitritt eine Update-Nachricht erhalten, wenn ein Update für das Plugin verfügbar ist."));
}}),
updateCheckTimeInterval("plugin.updateCheck.timeInterval", 60, true,
new HashMap<>() {{
put(T2CLanguageEnum.german, List.of("Mit dieser Option kannst du das Zeitintervall in Minuten festlegen, in dem Aktualisierungen überprüft werden sollen."));
put(T2CLanguageEnum.english, List.of("In this option you can set the time interval in minutes in which updates should be checked."));
put(T2CLanguageEnum.german, List.of("Mit dieser Option können Sie das Zeitintervall in Minuten festlegen, in dem Aktualisierungen überprüft werden sollen."));
}}),
seePreReleaseUpdates("plugin.updateCheck.seePreReleaseUpdates", true, true,
new HashMap<>() {{
put(T2CLanguageEnum.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(T2CLanguageEnum.english, List.of("In this option you can set whether you want to receive and display beta and snapshot versions in the update check."));
put(T2CLanguageEnum.german, List.of("In dieser Option können Sie einstellen, ob Sie Beta- und Snapshot-Versionen in der Update-Prüfung erhalten und anzeigen möchten."));
}}),
updateCheckFullDisable("plugin.updateCheck.allPlugins.fullDisable", false, true,
new HashMap<>() {{
put(T2CLanguageEnum.english, List.of("This option deactivates all update checks for plugins that use the T2CodeLib."));
put(T2CLanguageEnum.german, List.of("Diese Option deaktiviert alle Aktualisierungsprüfungen für Plugins, die die T2CodeLib verwenden."));
put(T2CLanguageEnum.english, List.of("This option deactivates all update checks for plugins that use the T2CodeLib."));
}}),
debug("plugin.debug.debugModus", false, true,
new HashMap<>() {{
put(T2CLanguageEnum.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!"));
put(T2CLanguageEnum.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(T2CLanguageEnum.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<>() {{
put(T2CLanguageEnum.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(T2CLanguageEnum.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!"));
put(T2CLanguageEnum.german, List.of("Diese Option aktiviert erweiterte Werkzeuge für die Entwickler von Plugins, die die T2CodeLib verwenden.", "Wenn Sie nicht genau wissen, wozu das gut ist, sollten Sie es deaktiviert lassen!"));
}}),
language("plugin.language", "english", true,
new HashMap<>() {{
put(T2CLanguageEnum.german, List.of("In dieser Option kannst du die Sprache des Plugins einstellen."));
put(T2CLanguageEnum.english, List.of("In this option you can set the language of the plugin."));
put(T2CLanguageEnum.german, List.of("In dieser Option können Sie die Sprache des Plugins einstellen."));
}}),
space_proxy("proxy", null, true,
new HashMap<>() {{
put(T2CLanguageEnum.english, List.of());
put(T2CLanguageEnum.german, List.of());
put(T2CLanguageEnum.english, List.of());
}}),
proxy("proxy.enable", T2CodeLibMain.getIsBungee(), true,
new HashMap<>() {{
put(T2CLanguageEnum.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(T2CLanguageEnum.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!"));
put(T2CLanguageEnum.german, List.of("Diese Option muss aktiviert werden, wenn Sie die T2CodeLib auf einem BungeeCord, Waterfall oder Velocity Proxy als Bridge verwenden."
, "Bitte beachten Sie, 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!"));
}}),
serverUUID("proxy.serverUUID", UUID.randomUUID(), true,
new HashMap<>() {{
put(T2CLanguageEnum.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!"));
put(T2CLanguageEnum.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(T2CLanguageEnum.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<>() {{
put(T2CLanguageEnum.english, List.of());
put(T2CLanguageEnum.german, List.of());
put(T2CLanguageEnum.english, List.of());
}}),
inventoriesCloseByServerStop("player.inventories.closeByServerStop", true, true,
new HashMap<>() {{
put(T2CLanguageEnum.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(T2CLanguageEnum.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.",
"This does not mean the entire network if a proxy is used),", "the inventory / GUIs are closed if players have them open when the server is shut down or restarted."));
put(T2CLanguageEnum.german, List.of("Wenn diese Option aktiviert ist, werden alle Spieler auf dem Server (Spigot, Papier, etc.) ihr Inventar / GUIs geschlossen, wenn der Server heruntergefahren oder neu gestartet wird.",
"Damit ist nicht das gesamte Netz gemeint, wenn ein Proxy verwendet wird),", "das Inventar / die GUIs werden geschlossen, wenn Spieler sie geöffnet haben, wenn der Server heruntergefahren oder neu gestartet wird."));
"(This does not mean the entire network if a proxy is used)"));
}}),
space_command("command", null, true,
new HashMap<>() {{
put(T2CLanguageEnum.english, List.of());
put(T2CLanguageEnum.german, List.of());
put(T2CLanguageEnum.english, List.of());
}}),
commandPermToggleCommand("command.permToggle.permissionSetCommand", "lp user [player] permission set [perm] [value]", true,
new HashMap<>() {{
put(T2CLanguageEnum.english, List.of("This option specifies which command is to be used for the T2CodeLib command '/t2code permtoggle <player> <permission>'."));
put(T2CLanguageEnum.german, List.of("Diese Option gibt an, welcher Befehl für den T2CodeLib-Befehl '/t2code permtoggle <player> <permission>' verwendet werden soll."));
put(T2CLanguageEnum.english, List.of("This option specifies which command is to be used for the T2CodeLib command '/t2code permtoggle <player> <permission>'."));
}}),
;
@ -145,12 +146,12 @@ public class T2CLibConfig {
}
}
public static void set() {
public static void set(boolean pluginStart) {
long long_ = System.currentTimeMillis();
ConvertT2ClibConfig.convert();
T2CconfigWriter.createConfig(new File(T2CodeLibMain.getPath(), "config.yml"), VALUES.values(), Util.getConfigLogo());
T2Ctemplate.onStartMsg(Util.getPrefix(), "§2config.yml were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
T2Ctemplate.setCenterAligned(Util.getPrefix(), "§2config.yml were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms", pluginStart);
}
}

View File

@ -3,6 +3,7 @@
package net.t2code.t2codelib.SPIGOT.system.config.languages;
import lombok.NonNull;
import net.t2code.t2codelib.T2CLanguageEnum;
import net.t2code.t2codelib.T2CconfigItemLanguages;
import net.t2code.t2codelib.SPIGOT.api.yaml.T2CconfigWriterLanguage;
@ -12,41 +13,49 @@ import net.t2code.t2codelib.Util;
import java.util.*;
public class Languages {
public class T2CLibLanguages {
public enum VALUES implements T2CconfigItemLanguages {
otherLang("plugin", null,
new HashMap<>() {{
put(T2CLanguageEnum.german, null);
put(T2CLanguageEnum.english, null);
}},
new HashMap<>() {{
put(T2CLanguageEnum.german, List.of("Wenn du eine Eigene Sprache hinzufügen magst, dann kopiere einfach eine Sprachdatei und benenne sie in deine Sprache, dies kannst du dann in der config.yml einstellen.", ""));
put(T2CLanguageEnum.english, List.of("If you want to add your own language, simply copy a language file and rename it to your language, you can then set this in config.yml.", ""));
}}),
vaultNotSetUp("plugin.vaultNotSetUp",
null,
new HashMap<>() {{
put(T2CLanguageEnum.english, "[prefix] &4Vault / Economy not set up!");
put(T2CLanguageEnum.german, "[prefix] &4Vault / Economy nicht eingerichtet!");
put(T2CLanguageEnum.english, "[prefix] &4Vault / Economy not set up!");
}},
new HashMap<>() {{
put(T2CLanguageEnum.english, List.of());
put(T2CLanguageEnum.german, List.of());
put(T2CLanguageEnum.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."));
put(T2CLanguageEnum.english, List.of("This message is displayed if a plugin accesses the Vault interface of T2CodeLib and Vault or no Economy System is available."));
}}),
votingPluginNotSetUp("plugin.votingPluginNotSetUp",
null,
new HashMap<>() {{
put(T2CLanguageEnum.english, "[prefix] &4VotingPlugin is not present on the server!");
put(T2CLanguageEnum.german, "[prefix] &4VotingPlugin ist auf dem Server nicht vorhanden!");
put(T2CLanguageEnum.english, "[prefix] &4VotingPlugin is not present on the server!");
}},
new HashMap<>() {{
put(T2CLanguageEnum.english, List.of());
put(T2CLanguageEnum.german, List.of());
put(T2CLanguageEnum.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/"));
put(T2CLanguageEnum.english, List.of("This message is displayed if a plugin accesses the VotingPlugin interface of T2CodeLib and VotingPlugin is not available.", "VotingPlugin: https://spigotmc.org/resources/votingplugin.15358/"));
}}),
soundNotFound("plugin.soundNotFound",
null,
new HashMap<>() {{
put(T2CLanguageEnum.german, "[prefix] &4Der Sound &6[sound] &4wurde nicht gefunden! Bitte überprüfe die Einstellungen.");
put(T2CLanguageEnum.english, "[prefix] &4The sound &6[sound] &4was not found! Please check the settings.");
put(T2CLanguageEnum.german, "[prefix] &4Der Sound &6[sound] &4wurde nicht gefunden! Bitte [ue]berpr[ue]fe die Einstellungen.");
}},
new HashMap<>() {{
put(T2CLanguageEnum.german, List.of("Diese Meldung wird angezeigt, wenn ein Sound über die T2CodeLib abgespielt werden soll, den es nicht gibt"));
put(T2CLanguageEnum.english, List.of());
put(T2CLanguageEnum.german, List.of());
}}),
;
@ -56,7 +65,7 @@ public class Languages {
private final HashMap<T2CLanguageEnum, String> lang;
private final HashMap<T2CLanguageEnum, List<String>> comments;
VALUES(String path, Object value, HashMap<T2CLanguageEnum, String> lang, HashMap<T2CLanguageEnum, List<String>> comments) {
VALUES(String path, Object value, @NonNull HashMap<T2CLanguageEnum, String> lang, HashMap<T2CLanguageEnum, List<String>> comments) {
this.path = path;
this.value = value;
this.lang = lang;
@ -92,8 +101,8 @@ public class Languages {
}
}
public static void set() {
T2CconfigWriterLanguage.createConfig(T2CodeLibMain.getPath(), VALUES.values(), T2CLibConfig.VALUES.language.getValue().toString(), Util.getConfigLogo());
public static void set(boolean pluginStart) {
T2CconfigWriterLanguage.createConfig(Util.getPrefix(), T2CodeLibMain.getPath(), VALUES.values(), T2CLibConfig.VALUES.language.getValue().toString(), pluginStart, Util.getConfigLogo());
}
}

View File

@ -1,46 +0,0 @@
package net.t2code.t2codelib.SPIGOT.system.config.languages.old;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
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 org.bukkit.plugin.Plugin;
import java.io.File;
import java.io.IOException;
public class LanguagesCreate {
static Plugin plugin = T2CodeLibMain.getPlugin();
public static void langCreate() {
T2Csend.debug(plugin, "§4Language files are created / updated...");
long long_ = System.currentTimeMillis();
setFile("english", MSG.EN_VaultNotSetUp, MSG.EN_VotingPluginNotSetUp, MSG.EN_SoundNotFound);
setFile("german", MSG.DE_VaultNotSetUp, MSG.DE_VotingPluginNotSetUp, MSG.DE_SoundNotFound);
setFile("norwegian", MSG.NO_VaultNotSetUp, MSG.NO_VotingPluginNotSetUp, MSG.NO_SoundNotFound);
T2Ctemplate.onStartMsg(Util.getPrefix(), "§2Language files were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
}
private static void setFile(String language, String vaultNotSetUp, String votingPluginNotSetUp, String soundNotFound) {
File messages = new File(T2CodeLibMain.getPath(), "languages/" + language + ".yml");
YamlConfiguration yamlConfigurationNO = YamlConfiguration.loadConfiguration(messages);
T2Cconfig.set("Plugin.VaultNotSetUp", vaultNotSetUp, yamlConfigurationNO);
T2Cconfig.set("Plugin.VotingPluginNotSetUp", votingPluginNotSetUp, yamlConfigurationNO);
T2Cconfig.set("Plugin.SoundNotFound", soundNotFound, yamlConfigurationNO);
try {
yamlConfigurationNO.save(messages);
} catch (IOException e) {
T2Csend.warning(plugin, e.getMessage());
e.printStackTrace();
}
}
}

View File

@ -1,25 +0,0 @@
// This claas was created by JaTiTV
package net.t2code.t2codelib.SPIGOT.system.config.languages.old;
public class MSG {
// EN
public static String EN_VaultNotSetUp = "[prefix] &4Vault / Economy not set up!";
public static String EN_VotingPluginNotSetUp = "[prefix] &4VotingPlugin is not present on the server!";
public static String EN_SoundNotFound = "[prefix] &4The sound &6[sound] &4was not found! Please check the settings.";
// DE
public static String DE_VaultNotSetUp = "[prefix] &4Vault / Economy nicht eingerichtet!";
public static String DE_VotingPluginNotSetUp = "[prefix] &4VotingPlugin ist auf dem Server nicht vorhanden!";
public static String DE_SoundNotFound = "[prefix] &4Der Sound &6[sound] &4wurde nicht gefunden! Bitte [ue]berpr[ue]fe die Einstellungen.";
// NO
public static String NO_VaultNotSetUp = "[prefix] &4Vault / Økonomi har ikke blitt satt opp!";
public static String NO_VotingPluginNotSetUp = "[prefix] &4VotingPlugin er ikke til stede på serveren!";
public static String NO_SoundNotFound = "[prefix] &4Lyden &6[sound] &4ble ikke bli funnet! Vennligst sjekk innstillingene.";
}

View File

@ -1,49 +0,0 @@
package net.t2code.t2codelib.SPIGOT.system.config.languages.old;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
import net.t2code.t2codelib.SPIGOT.system.config.config.T2CLibConfig;
import net.t2code.t2codelib.Util;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.Plugin;
import java.io.File;
public class SelectLibMsg {
private static Plugin plugin = T2CodeLibMain.getPlugin();
public static String selectMSG;
public static String vaultNotSetUp;
public static String votingPluginNotSetUp;
public static String soundNotFound;
public static void onSelect() {
String prefix = Util.getPrefix();
T2Csend.debug(plugin, "§4Select language...");
long long_ = System.currentTimeMillis();
File msg;
msg = new File(T2CodeLibMain.getPath(), "languages/" + T2CLibConfig.VALUES.language.getValue() + ".yml");
if (!msg.isFile()) {
T2Ctemplate.onStartMsg(Util.getPrefix(),"");
T2Ctemplate.onStartMsg(Util.getPrefix(), "§4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
T2Ctemplate.onStartMsg(Util.getPrefix(), "§4The selected §c" + T2CLibConfig.VALUES.language.getValue() + " §4language file was not found.");
T2Ctemplate.onStartMsg(Util.getPrefix(), "§6The default language §eEnglish §6is used!");
T2Ctemplate.onStartMsg(Util.getPrefix(), "§4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
T2Ctemplate.onStartMsg(Util.getPrefix(),"");
msg = new File(T2CodeLibMain.getPath(), "languages/" + "english.yml");
selectMSG = "english";
} else selectMSG = (String) T2CLibConfig.VALUES.language.getValue();
YamlConfiguration yamlConfiguration_msg = YamlConfiguration.loadConfiguration(msg);
vaultNotSetUp = T2Creplace.replace(prefix, yamlConfiguration_msg.getString("Plugin.VaultNotSetUp"));
votingPluginNotSetUp = T2Creplace.replace(prefix, yamlConfiguration_msg.getString("Plugin.VotingPluginNotSetUp"));
soundNotFound = T2Creplace.replace(prefix, yamlConfiguration_msg.getString("Plugin.SoundNotFound"));
T2Ctemplate.onStartMsg(Util.getPrefix(), "§2Language successfully selected to: §6" + selectMSG + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
}
}

View File

@ -3,68 +3,70 @@ package net.t2code.t2codelib;
import lombok.Getter;
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
public class Util {
//@Getter
// private static final UUID serverUUID = UUID.randomUUID();
@Getter
private static String infoText = "<yellow>Description:</yellow> <gold>" + T2CodeLibMain.getPlugin().getDescription().getDescription() + "</gold>";
public static String getInfoText() {
return "<yellow>Description:</yellow> <gold>" + T2CodeLibMain.getPlugin().getDescription().getDescription() + "</gold>";
}
public static String getPrefix() {
return "<dark_gray>[<dark_red>T2Code</dark_red><dark_purple>Lib</dark_purple>]</dark_gray>";
}
@Getter
private static String prefix = "<dark_gray>[<dark_red>T2Code</dark_red><dark_purple>Lib</dark_purple>]</dark_gray>";
@Getter
private static String vPrefix = "[T2CodeLib]";
public static Integer getSpigotID() {
return 96388;
}
public static String getGit() {
return "JaTiTV/T2CodeLib";
}
public static Integer getBstatsID() {
return 12518;
}
public static String getSpigot() {
return "https://www.spigotmc.org/resources/" + getSpigotID();
}
public static String getDiscord() {
return "http://dc.t2code.net";
}
public static List<String> getT2cPlugins() {
return Arrays.asList(
"T2CodeLib",
"T2C-LuckyBox",
"WonderBagShop",
"CommandGUI",
// "T2C-OPSecurity",
"OPSecurity",
"PaPiTest",
"T2C-Alias",
"T2C-AutoResponse",
"LoreEditor",
"Booster",
"AntiMapCopy",
"AntiCopy",
"T2C-LoginPermissionAuth"
);
}
@Getter
private static Integer spigotID = 96388;
@Getter
private static final String[] configLogo = new String[]{
private static String git = "JaTiTV/T2CodeLib";
@Getter
private static Integer bstatsID = 12518;
@Getter
private static String spigot = "https://www.spigotmc.org/resources/" + getSpigotID();
@Getter
private static String discord = "http://dc.t2code.net";
@Getter
private static List<String> T2cPlugins = Arrays.asList(
"T2CodeLib",
"T2C-LuckyBox",
"WonderBagShop",
"CommandGUI",
// "T2C-OPSecurity",
"OPSecurity",
"PaPiTest",
"T2C-Alias",
"T2C-AutoResponse",
"LoreEditor",
"Booster",
"AntiMapCopy",
"AntiCopy",
"T2C-LoginPermissionAuth"
);
@Getter
private static final List<String> configT2CodeLogo = Arrays.asList(
"# ╔═════════════════════════════════════════════════════════════════════════════╗",
"# ║ _______ ___ _____ _ _ ║",
"# ║ |__ __| |__ \\ / ____| | | | | ║",
"# ║ | | ) | | | ___ __| | ___ _ __ ___ | |_ ║",
"# ║ | | / / | | / _ \\ / _` | / _ \\ | '_ \\ / _ \\ | __| ║",
"# ║ | | / /_ | |____ | (_) | | (_| | | __/ _ | | | | | __/ | |_ ║",
"# ║ |_| |____| \\_____| \\___/ \\__,_| \\___| (_) |_| |_| \\___| \\__| ║",
"# ║ ║",
"# ║ This plugin is from T2Code.net ║",
"# ║ Development Team: JaTiTV & Jkobs ║",
"# ║ Feel free to come to our Discord for support: https://dc.t2code.net ║",
"# ╚═════════════════════════════════════════════════════════════════════════════╝",
"",
"####################################################################################################################",
"## ##",
"## /$$$$$$$$ /$$$$$$ /$$$$$$ /$$ /$$ ##",
@ -78,39 +80,38 @@ public class Util {
"## ##",
"## T2CodeLib from JaTiTV / T2Code.net. In case of problems please contact the Discord: https://dc.t2code.net ##",
"## ##",
"####################################################################################################################"
};
"####################################################################################################################");
public static String[] getConfigLogo() {
ArrayList<String> arrayList = new ArrayList<>(configT2CodeLogo);
arrayList.addAll(Arrays.asList("", "# Spigot: " + getSpigot()));
return arrayList.toArray(new String[0]);
}
@Getter
private static String[] loadLogo2 = new String[]{
"################################################################################",
"## ##",
"## _______ ___ _____ _ _ ##",
"## |__ __| |__ \\ / ____| | | | | ##",
"## | | ) | | | ___ __| | ___ _ __ ___ | |_ ##",
"## | | / / | | / _ \\ / _` | / _ \\ | '_ \\ / _ \\ | __| ##",
"## | | / /_ | |____ | (_) | | (_| | | __/ _ | | | | | __/ | |_ ##",
"## |_| |____| \\_____| \\___/ \\__,_| \\___| (_) |_| |_| \\___| \\__| ##",
"## ##",
"## T2CodeLib from JaTiTV / T2Code.net. ##",
"## In case of problems please contact the Discord: https://dc.t2code.net ##",
"## ##",
"################################################################################"
};
@Getter
private static String[] loadLogo = new String[]{
"╔═════════════════════════════════════════════════════════════════════════════╗",
"║ _______ ___ _____ _ _ ║",
"║ |__ __| |__ \\ / ____| | | | | ║",
"║ | | ) | | | ___ __| | ___ _ __ ___ | |_ ║",
"║ | | / / | | / _ \\ / _` | / _ \\ | '_ \\ / _ \\ | __| ║",
"║ | | / /_ | |____ | (_) | | (_| | | __/ _ | | | | | __/ | |_ ║",
"║ |_| |____| \\_____| \\___/ \\__,_| \\___| (_) |_| |_| \\___| \\__| ║",
"║ ║",
"║ This plugin is from T2Code.net ║",
"║ Development Team: JaTiTV & Jkobs ║",
"║ Feel free to come to our Discord for support: https://dc.t2code.net ║",
"╠═════════════════════════════════════════════════════════════════════════════╝"
"╔═══════════════════════════════════════════════════════════════════════════╗",
"║ _______ ___ _____ _ _ ║",
"║ |__ __| |__ \\ / ____| | | | | ║",
"║ | | ) | | | ___ __| | ___ _ __ ___ | |_ ║",
"║ | | / / | | / _ \\ / _` | / _ \\ | '_ \\ / _ \\ | __| ║",
"║ | | / /_ | |____ | (_) | | (_| | | __/ _ | | | | | __/ | |_ ║",
"║ |_| |____| \\_____| \\___/ \\__,_| \\___| (_) |_| |_| \\___| \\__| ║",
"║ ║",
"║ This plugin is from T2Code.net ║",
"║ Development Team: JaTiTV & Jkobs ║",
"║ Feel free to come to our Discord for support: https://dc.t2code.net ║",
"╠═══════════════════════════════════════════════════════════════════════════╣"
};
private static String[] loadLogos = new String[]{
"╔════════════════════════════════════╗",
// "║ Version: "+version+"",
"╚════════════════════════════════════╝"
};
}

View File

@ -133,7 +133,9 @@ public class T2CVconfigWriter {
List<String> commentList = comments.get(fullKey);
if (commentList != null) {
for (String c : commentList) {
builder.append(indent).append("# ").append(c).append("\n");
if (c.isEmpty()) {
builder.append(indent).append(c).append("\n");
} else builder.append(indent).append("# ").append(c).append("\n");
}
}
// Check if the value is a section (nested map)