16.7_dev-19
This commit is contained in:
@@ -3,9 +3,9 @@ package net.t2code.t2codelib.SPIGOT.api.bungeePlayers;
|
||||
import lombok.Getter;
|
||||
import net.t2code.t2codelib.SPIGOT.api.debug.T2C_Debug;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2C_Main;
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.config.T2C_LibConfig;
|
||||
import net.t2code.t2codelib.Util;
|
||||
import net.t2code.t2codelib.util.T2C_Util;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.messaging.PluginMessageListener;
|
||||
@@ -23,15 +23,15 @@ public class T2C_BungeePlayers implements PluginMessageListener {
|
||||
@Override
|
||||
public void onPluginMessageReceived(@NotNull String channel, @NotNull Player player, byte[] message) {
|
||||
DataInputStream stream = new DataInputStream(new ByteArrayInputStream(message));
|
||||
T2C_Debug.debug(T2CodeLibMain.getPlugin(), "stream: " + stream.toString());
|
||||
T2C_Debug.debug(T2C_Main.getPlugin(), "stream: " + stream.toString());
|
||||
try {
|
||||
T2C_BngeePlayersEnum subChannel = T2C_BngeePlayersEnum.valueOf(stream.readUTF());
|
||||
String input = stream.readUTF();
|
||||
String uuid = stream.readUTF();
|
||||
T2C_Debug.debug(T2CodeLibMain.getPlugin(), "PluginMessage received channel: " + channel);
|
||||
T2C_Debug.debug(T2CodeLibMain.getPlugin(), "PluginMessage received subChannel: " + subChannel.name());
|
||||
T2C_Debug.debug(T2CodeLibMain.getPlugin(), "PluginMessage received input: " + input);
|
||||
T2C_Debug.debug(T2CodeLibMain.getPlugin(), "PluginMessage received input2/uuid: " + uuid);
|
||||
T2C_Debug.debug(T2C_Main.getPlugin(), "PluginMessage received channel: " + channel);
|
||||
T2C_Debug.debug(T2C_Main.getPlugin(), "PluginMessage received subChannel: " + subChannel.name());
|
||||
T2C_Debug.debug(T2C_Main.getPlugin(), "PluginMessage received input: " + input);
|
||||
T2C_Debug.debug(T2C_Main.getPlugin(), "PluginMessage received input2/uuid: " + uuid);
|
||||
switch (subChannel) {
|
||||
case JOIN:
|
||||
bungeePlayers.add(input);
|
||||
@@ -52,13 +52,13 @@ public class T2C_BungeePlayers implements PluginMessageListener {
|
||||
break;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
T2C_Send.sendException(e, T2CodeLibMain.getPlugin().getLogger());
|
||||
T2C_Send.sendException(e, T2C_Main.getPlugin().getLogger());
|
||||
}
|
||||
}
|
||||
|
||||
public static void callAllBungeePlayers() {
|
||||
if (Bukkit.getOnlinePlayers().isEmpty()) {
|
||||
Bukkit.getScheduler().runTaskLaterAsynchronously(T2CodeLibMain.getPlugin(), new Runnable() {
|
||||
Bukkit.getScheduler().runTaskLaterAsynchronously(T2C_Main.getPlugin(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
callAllBungeePlayers();
|
||||
@@ -72,14 +72,14 @@ public class T2C_BungeePlayers implements PluginMessageListener {
|
||||
output.writeUTF(T2C_BngeePlayersEnum.GIVEALL.name());
|
||||
output.writeUTF(T2C_LibConfig.VALUES.serverUUID.getValue().toString());
|
||||
} catch (IOException e) {
|
||||
T2C_Send.sendException(e, T2CodeLibMain.getPlugin().getLogger());
|
||||
T2C_Send.sendException(e, T2C_Main.getPlugin().getLogger());
|
||||
}
|
||||
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
player.sendPluginMessage(T2CodeLibMain.getPlugin(), Util.getPluginChannel_ProxyOnlinePlayers(), stream.toByteArray());
|
||||
T2C_Debug.debug(T2CodeLibMain.getPlugin(), "PluginMessage received channel: " + Util.getPluginChannel_ProxyOnlinePlayers());
|
||||
T2C_Debug.debug(T2CodeLibMain.getPlugin(), "PluginMessage send subChannel: " + T2C_BngeePlayersEnum.GIVEALL.name());
|
||||
T2C_Debug.debug(T2CodeLibMain.getPlugin(), "PluginMessage send output/uuid: " + T2C_LibConfig.VALUES.serverUUID.getValue().toString());
|
||||
player.sendPluginMessage(T2C_Main.getPlugin(), T2C_Util.getPluginChannel_ProxyOnlinePlayers(), stream.toByteArray());
|
||||
T2C_Debug.debug(T2C_Main.getPlugin(), "PluginMessage received channel: " + T2C_Util.getPluginChannel_ProxyOnlinePlayers());
|
||||
T2C_Debug.debug(T2C_Main.getPlugin(), "PluginMessage send subChannel: " + T2C_BngeePlayersEnum.GIVEALL.name());
|
||||
T2C_Debug.debug(T2C_Main.getPlugin(), "PluginMessage send output/uuid: " + T2C_LibConfig.VALUES.serverUUID.getValue().toString());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package net.t2code.t2codelib.SPIGOT.api.commands;
|
||||
|
||||
import net.t2code.t2codelib.SPIGOT.system.BungeeCommandSenderReceiver;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2C_Main;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -13,7 +13,7 @@ public class T2C_Cmd {
|
||||
Map.Entry<String,Integer> map = delay(cmdInput);
|
||||
int delay = map.getValue();
|
||||
String cmd = map.getKey();
|
||||
Bukkit.getScheduler().runTaskLater(T2CodeLibMain.getPlugin(), new Runnable() {
|
||||
Bukkit.getScheduler().runTaskLater(T2C_Main.getPlugin(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (cmd.contains("!onBungee")) {
|
||||
@@ -27,7 +27,7 @@ public class T2C_Cmd {
|
||||
Map.Entry<String,Integer> map = delay(cmdInput);
|
||||
int delay = map.getValue();
|
||||
String cmd = map.getKey();
|
||||
Bukkit.getScheduler().runTaskLater(T2CodeLibMain.getPlugin(), new Runnable() {
|
||||
Bukkit.getScheduler().runTaskLater(T2C_Main.getPlugin(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (cmd.contains("!asConsole")) {
|
||||
|
@@ -3,7 +3,7 @@ package net.t2code.t2codelib.SPIGOT.api.eco;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
||||
import net.t2code.t2codelib.SPIGOT.api.plugins.T2C_PluginCheck;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2C_Main;
|
||||
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.languages.T2CLibLanguages;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -14,20 +14,20 @@ import org.bukkit.inventory.ItemStack;
|
||||
public class T2C_Eco {
|
||||
public static boolean moneyRemove(String prefix, Player player, Double price) {
|
||||
if (vault(prefix, player)) {
|
||||
return T2CodeLibMain.getEco().withdrawPlayer(player, price).transactionSuccess();
|
||||
return T2C_Main.getEco().withdrawPlayer(player, price).transactionSuccess();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean moneyAdd(String prefix, Player player, Double price) {
|
||||
if (vault(prefix, player)) {
|
||||
return T2CodeLibMain.getEco().depositPlayer(player, price).transactionSuccess();
|
||||
return T2C_Main.getEco().depositPlayer(player, price).transactionSuccess();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean vault(String prefix, Player player) {
|
||||
if (T2CodeLibMain.getEco() == null) {
|
||||
if (T2C_Main.getEco() == null) {
|
||||
if (Bukkit.getPluginManager().getPlugin("Vault") == null) {
|
||||
T2C_Send.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║ ");
|
||||
@@ -74,7 +74,7 @@ public class T2C_Eco {
|
||||
|
||||
public static boolean votePointsAdd(String prefix, Player player, Integer amount) {
|
||||
if (votePlugin(prefix, player)) {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(T2CodeLibMain.getPlugin(), new Runnable() {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(T2C_Main.getPlugin(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
VotingPluginMain.getPlugin().getVotingPluginUserManager().getVotingPluginUser(player).addPoints(amount);
|
||||
|
@@ -4,7 +4,7 @@ import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
||||
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2C_McVersion;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2C_Main;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
@@ -47,7 +47,7 @@ public class T2C_ItemBuilder {
|
||||
inventory.setItem(i, glass);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
T2C_Send.sendException(e, T2CodeLibMain.getPlugin().getLogger());
|
||||
T2C_Send.sendException(e, T2C_Main.getPlugin().getLogger());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ public class T2C_ItemBuilder {
|
||||
profileField.setAccessible(true);
|
||||
profileField.set(itemMeta, profile);
|
||||
} catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e) {
|
||||
T2C_Send.sendException(e, T2CodeLibMain.getPlugin().getLogger());
|
||||
T2C_Send.sendException(e, T2C_Main.getPlugin().getLogger());
|
||||
}
|
||||
|
||||
itemStack.setItemMeta(itemMeta);
|
||||
|
@@ -1,145 +0,0 @@
|
||||
// This class was created by JaTiTV.
|
||||
|
||||
package net.t2code.t2codelib.SPIGOT.api.messages;
|
||||
|
||||
public class T2C_GernerateFrame {
|
||||
|
||||
protected static final String BOTTOM_BORDER = "╚═══════════════════════════════════════════════════════════════════════════╝";
|
||||
private static final int FIXED_WIDTH = BOTTOM_BORDER.length() - 2; // Länge ohne die Randzeichen
|
||||
|
||||
private static final String COLOR_CODE = "§e";
|
||||
private static final String BORDER_CHAR = "═";
|
||||
private static final String TOP_LEFT = "╔";
|
||||
private static final String TOP_RIGHT = "╗";
|
||||
private static final String BOTTOM_LEFT = "╚";
|
||||
private static final String BOTTOM_RIGHT = "╝";
|
||||
private static final String SIDE_BORDER = "║";
|
||||
|
||||
public static String setCenterAligned(String prefix, String text) {
|
||||
// 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);
|
||||
return prefix + " " + formattedValue;
|
||||
}
|
||||
|
||||
|
||||
public static String setLeftAligned(String prefix, String text) {
|
||||
// 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 paddingRight = totalPaddingSize; // Alles Padding geht nach rechts
|
||||
|
||||
// Formatierung der Zeile: Text am Anfang und dynamischer Abstand zum Ende
|
||||
String formattedValue = "§e║ " + text + " ".repeat((paddingRight - 1)) + "║";
|
||||
System.out.println(formattedValue);
|
||||
T2C_Send.console(prefix + " " + formattedValue);
|
||||
return prefix + " " + formattedValue;
|
||||
}
|
||||
|
||||
|
||||
// Methode für mehrere Zeilen Text mit dynamischem Rahmen
|
||||
public static String sendFrameLeft(String prefix, String... lines) {
|
||||
// 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());
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
public static String sendFrameCenter(String prefix, String... lines) {
|
||||
// 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 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());
|
||||
return 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, "");
|
||||
}
|
||||
}
|
@@ -1,7 +1,7 @@
|
||||
package net.t2code.t2codelib.SPIGOT.api.messages;
|
||||
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2C_Main;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -26,7 +26,7 @@ public class T2C_HoverModule {
|
||||
}
|
||||
|
||||
public static void moduleConsole(String msg) {
|
||||
if (T2CodeLibMain.getMmIsLoad()) {
|
||||
if (T2C_Main.getMmIsLoad()) {
|
||||
T2C_MiniMessage.sendConsoleMiniMessage(msg);
|
||||
return;
|
||||
}
|
||||
|
@@ -3,12 +3,12 @@ package net.t2code.t2codelib.SPIGOT.api.messages;
|
||||
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2C_Main;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class T2C_MiniMessage {
|
||||
private static final BukkitAudiences bukkitAudiences = T2CodeLibMain.getPlugin().getAdventure();
|
||||
private static final BukkitAudiences bukkitAudiences = T2C_Main.getPlugin().getAdventure();
|
||||
|
||||
public static void sendSenderMiniMessage(String msg, CommandSender sender) {
|
||||
String string = "";
|
||||
@@ -30,4 +30,9 @@ public class T2C_MiniMessage {
|
||||
protected static Component replace(String text) {
|
||||
return MiniMessage.miniMessage().deserialize(T2C_Replace.convertColorCode(text));
|
||||
}
|
||||
|
||||
|
||||
public static String removeMiniMessageCodes(String text){
|
||||
return MiniMessage.miniMessage().stripTags(text);
|
||||
}
|
||||
}
|
||||
|
@@ -5,112 +5,226 @@ import net.t2code.t2codelib.SPIGOT.api.plugins.T2C_PluginCheck;
|
||||
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 {
|
||||
|
||||
public static String replace(String prefix, String Text) {
|
||||
|
||||
private static final Map<String, String> REPLACEMENTS = Map.of(
|
||||
"[ue]", "ü", "[UE]", "Ü",
|
||||
"[oe]", "ö", "[OE]", "Ö",
|
||||
"[ae]", "ä", "[AE]", "Ä",
|
||||
"[nl]", "\n"
|
||||
);
|
||||
|
||||
public static String replace(String prefix, String text) {
|
||||
return replacePlaceholders(replaceLegacyColor(text), prefix, null, null);
|
||||
return replaceLegacyColor(Text).replace("[prefix]", prefix).replace("[ue]", "ü")
|
||||
.replace("[UE]", "Ü").replace("[oe]", "ö").replace("[OE]", "Ö")
|
||||
.replace("[ae]", "ä").replace("[AE]", "Ä").replace("[nl]", "\n");
|
||||
}
|
||||
|
||||
public static String replace(String prefix, Player player, String text) {
|
||||
return replacePlaceholders(replaceLegacyColor(text), prefix, player, null);
|
||||
public static String replace(String prefix, Player player, String Text) {
|
||||
String input = Text.replace("[prefix]", prefix)
|
||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä")
|
||||
.replace("[nl]", "\n");
|
||||
if (T2C_PluginCheck.papi()) {
|
||||
return replaceLegacyColor(PlaceholderAPI.setPlaceholders(player, input));
|
||||
} else {
|
||||
return replaceLegacyColor(input);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static Object replaceObject(String prefix, Object object) {
|
||||
return replaceObjectPlaceholders(object, prefix, null, null);
|
||||
}
|
||||
|
||||
public static Object replaceObject(String prefix, Player player, Object object) {
|
||||
return replaceObjectPlaceholders(object, prefix, player, null);
|
||||
}
|
||||
|
||||
public static List<String> replace(String prefix, List<String> texts) {
|
||||
return replacePlaceholdersInList(texts, prefix, null, null);
|
||||
}
|
||||
|
||||
public static List<String> replace(String prefix, Player player, List<String> texts) {
|
||||
return replacePlaceholdersInList(texts, prefix, player, null);
|
||||
}
|
||||
|
||||
public static List<String> replacePrice(String prefix, List<String> texts, String price) {
|
||||
return replacePlaceholdersInList(texts, prefix, null, price);
|
||||
}
|
||||
|
||||
public static List<String> replacePrice(String prefix, Player player, List<String> texts, String price) {
|
||||
return replacePlaceholdersInList(texts, prefix, player, price);
|
||||
}
|
||||
|
||||
public static String replacePrice(String prefix, String text, String price) {
|
||||
return replacePlaceholders(replaceLegacyColor(text), prefix, null, price);
|
||||
}
|
||||
|
||||
public static String replacePrice(String prefix, Player player, String text, String price) {
|
||||
return replacePlaceholders(replaceLegacyColor(text), prefix, player, price);
|
||||
}
|
||||
|
||||
public static String removeColorCode(String value) {
|
||||
return value.replaceAll("&[0-9a-fk-or]", "");
|
||||
}
|
||||
|
||||
public static String replaceLegacyColor(String text) {
|
||||
return text.replaceAll("&([0-9a-fk-or])", "§$1");
|
||||
}
|
||||
|
||||
public static String convertColorCode(String text) {
|
||||
return text.replaceAll("&([0-9a-fk-or])", "<$1>").replaceAll("§([0-9a-fk-or])", "<$1>");
|
||||
}
|
||||
|
||||
public static Object replace(Object object, String placeholder, String replacement) {
|
||||
if (object instanceof String) {
|
||||
return ((String) object).replace(placeholder, replacement);
|
||||
} else if (object instanceof List) {
|
||||
List<String> list = (List<String>) object;
|
||||
object = replaceLegacyColor((String) object).replace("[prefix]", prefix).replace("[ue]", "ü")
|
||||
.replace("[UE]", "Ü").replace("[oe]", "ö").replace("[OE]", "Ö")
|
||||
.replace("[ae]", "ä").replace("[AE]", "Ä").replace("[nl]", "\n");
|
||||
}
|
||||
|
||||
if ((object instanceof List) || (object instanceof ArrayList)) {
|
||||
List<String> in = (List<String>) object;
|
||||
List<String> output = new ArrayList<>();
|
||||
for (String item : list) {
|
||||
output.add(item.replace(placeholder, replacement));
|
||||
for (String input : in) {
|
||||
output.add(replaceLegacyColor(input).replace("[prefix]", prefix)
|
||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä")
|
||||
.replace("[nl]", "\n"));
|
||||
}
|
||||
return output;
|
||||
object = output;
|
||||
}
|
||||
return object;
|
||||
}
|
||||
|
||||
private static String replacePlaceholders(String text, String prefix, Player player, String price) {
|
||||
text = text.replace("[prefix]", prefix);
|
||||
for (Map.Entry<String, String> entry : REPLACEMENTS.entrySet()) {
|
||||
text = text.replace(entry.getKey(), entry.getValue());
|
||||
public static Object replaceObject(String prefix, Player player, Object object) {
|
||||
if (object instanceof String) {
|
||||
|
||||
if (T2C_PluginCheck.papi()) {
|
||||
object = PlaceholderAPI.setPlaceholders(player, replaceLegacyColor((String) object).replace("[prefix]", prefix).replace("[ue]", "ü")
|
||||
.replace("[UE]", "Ü").replace("[oe]", "ö").replace("[OE]", "Ö")
|
||||
.replace("[ae]", "ä").replace("[AE]", "Ä").replace("[nl]", "\n"));
|
||||
} else {
|
||||
object = replaceLegacyColor((String) object).replace("[prefix]", prefix).replace("[ue]", "ü")
|
||||
.replace("[UE]", "Ü").replace("[oe]", "ö").replace("[OE]", "Ö")
|
||||
.replace("[ae]", "ä").replace("[AE]", "Ä").replace("[nl]", "\n");
|
||||
}
|
||||
|
||||
}
|
||||
if (price != null) {
|
||||
text = text.replace("[price]", price);
|
||||
if (object instanceof List) {
|
||||
List<String> in = (List<String>) object;
|
||||
List<String> output = new ArrayList<>();
|
||||
for (String input : in) {
|
||||
if (T2C_PluginCheck.papi()) {
|
||||
output.add(PlaceholderAPI.setPlaceholders(player, replaceLegacyColor(input).replace("[prefix]", prefix)
|
||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä")
|
||||
.replace("[nl]", "\n")));
|
||||
} else {
|
||||
output.add(replaceLegacyColor(input).replace("[prefix]", prefix)
|
||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä")
|
||||
.replace("[nl]", "\n"));
|
||||
}
|
||||
}
|
||||
object = output;
|
||||
}
|
||||
if (player != null && T2C_PluginCheck.papi()) {
|
||||
text = PlaceholderAPI.setPlaceholders(player, text);
|
||||
}
|
||||
return text;
|
||||
return object;
|
||||
}
|
||||
|
||||
private static List<String> replacePlaceholdersInList(List<String> texts, String prefix, Player player, String price) {
|
||||
public static List<String> replace(String prefix, List<String> Text) {
|
||||
List<String> output = new ArrayList<>();
|
||||
for (String text : texts) {
|
||||
output.add(replacePlaceholders(replaceLegacyColor(text), prefix, player, price));
|
||||
for (String input : Text) {
|
||||
output.add(replaceLegacyColor(input).replace("[prefix]", prefix)
|
||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä")
|
||||
.replace("[nl]", "\n"));
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
private static Object replaceObjectPlaceholders(Object object, String prefix, Player player, String price) {
|
||||
public static List<String> replace(String prefix, Player player, List<String> Text) {
|
||||
List<String> output = new ArrayList<>();
|
||||
if (player == null) {
|
||||
return Collections.singletonList("player is null");
|
||||
}
|
||||
if (Text == null) {
|
||||
return Collections.singletonList("Text is null");
|
||||
}
|
||||
for (String input : Text) {
|
||||
if (T2C_PluginCheck.papi()) {
|
||||
output.add(PlaceholderAPI.setPlaceholders(player, replaceLegacyColor(input).replace("[prefix]", prefix)
|
||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä")
|
||||
.replace("[nl]", "\n")));
|
||||
} else {
|
||||
output.add(replaceLegacyColor(input).replace("[prefix]", prefix)
|
||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä")
|
||||
.replace("[nl]", "\n"));
|
||||
}
|
||||
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
public static List<String> replacePrice(String prefix, List<String> Text, String price) {
|
||||
List<String> rp = new ArrayList<>();
|
||||
for (String s : Text) {
|
||||
rp.add(replaceLegacyColor(s).replace("[prefix]", prefix)
|
||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä")
|
||||
.replace("[nl]", "\n").replace("[price]", String.valueOf(price)));
|
||||
}
|
||||
return rp;
|
||||
}
|
||||
|
||||
public static String removeColorCode(String value) {
|
||||
return value.replace("&0", "").replace("&1", "").replace("&2", "").replace("&3", "")
|
||||
.replace("&4", "").replace("&5", "").replace("&6", "").replace("&7", "")
|
||||
.replace("&8", "").replace("&9", "").replace("&a", "").replace("&b", "")
|
||||
.replace("&c", "").replace("&d", "").replace("&e", "").replace("&f", "")
|
||||
.replace("&k", "").replace("&l", "").replace("&m", "").replace("&n", "")
|
||||
.replace("&o", "").replace("&r", "");
|
||||
}
|
||||
|
||||
public static List<String> replacePrice(String prefix, Player player, List<String> Text, String price) {
|
||||
List<String> rp = new ArrayList<>();
|
||||
for (String s : Text) {
|
||||
String input = s.replace("[prefix]", prefix)
|
||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä").replace("[nl]", "\n")
|
||||
.replace("[price]", String.valueOf(price));
|
||||
if (T2C_PluginCheck.papi()) {
|
||||
rp.add(replaceLegacyColor(PlaceholderAPI.setPlaceholders(player, input)));
|
||||
} else {
|
||||
rp.add(replaceLegacyColor(input));
|
||||
}
|
||||
}
|
||||
return rp;
|
||||
}
|
||||
|
||||
public static String replacePrice(String prefix, String Text, String price) {
|
||||
return replaceLegacyColor(Text).replace("[prefix]", prefix)
|
||||
.replace("&o", "§o").replace("&r", "§r").replace("[ue]", "ü")
|
||||
.replace("[UE]", "Ü").replace("[oe]", "ö").replace("[OE]", "Ö")
|
||||
.replace("[ae]", "ä").replace("[AE]", "Ä").replace("[price]", String.valueOf(price))
|
||||
.replace("[nl]", "\n");
|
||||
}
|
||||
|
||||
public static String replacePrice(String prefix, Player player, String Text, String price) {
|
||||
String input = Text.replace("[prefix]", prefix)
|
||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä")
|
||||
.replace("[price]", String.valueOf(price)).replace("[nl]", "\n");
|
||||
if (T2C_PluginCheck.papi()) {
|
||||
return replaceLegacyColor(PlaceholderAPI.setPlaceholders(player, input));
|
||||
} else {
|
||||
return replaceLegacyColor(input);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static String replaceLegacyColor(String text) {
|
||||
return text.replace("&0", "§0").replace("&1", "§1").replace("&2", "§2").replace("&3", "§3")
|
||||
.replace("&4", "§4").replace("&5", "§5").replace("&6", "§6").replace("&7", "§7")
|
||||
.replace("&8", "§8").replace("&9", "§9").replace("&a", "§a").replace("&b", "§b")
|
||||
.replace("&c", "§c").replace("&d", "§d").replace("&e", "§e").replace("&f", "§f")
|
||||
.replace("&k", "§k").replace("&l", "§l").replace("&m", "§m").replace("&n", "§n")
|
||||
.replace("&o", "§o").replace("&r", "§r");
|
||||
}
|
||||
|
||||
public static String convertColorCode(String text) {
|
||||
return text.replace("&0", "<black>").replace("§0", "<black>")
|
||||
.replace("&1", "<dark_blue>").replace("§1", "<dark_blue>")
|
||||
.replace("&2", "<dark_green>").replace("§2", "<dark_green>")
|
||||
.replace("&3", "<dark_aqua>").replace("§3", "<dark_aqua>")
|
||||
.replace("&4", "<dark_red>").replace("§4", "<dark_red>")
|
||||
.replace("&5", "<dark_purple>").replace("§5", "<dark_purple>")
|
||||
.replace("&6", "<gold>").replace("§6", "<gold>")
|
||||
.replace("&7", "<gray>").replace("§7", "<gray>")
|
||||
.replace("&8", "<dark_gray>").replace("§8", "<dark_gray>")
|
||||
.replace("&9", "<blue>").replace("§9", "<blue>")
|
||||
.replace("&a", "<green>").replace("§a", "<green>")
|
||||
.replace("&b", "<aqua>").replace("§b", "<aqua>")
|
||||
.replace("&c", "<red>").replace("§c", "<red>")
|
||||
.replace("&d", "<light_purple>").replace("§d", "<light_purple>")
|
||||
.replace("&e", "<yellow>").replace("§e", "<yellow>")
|
||||
.replace("&f", "<white>").replace("§f", "<white>")
|
||||
.replace("&k", "<obfuscated>").replace("§k", "<obfuscated>")
|
||||
.replace("&l", "<bold>").replace("§l", "<bold>")
|
||||
.replace("&m", "<strikethrough>").replace("§m", "<strikethrough>")
|
||||
.replace("&n", "<underlined>").replace("§n", "<underlined>")
|
||||
.replace("&o", "<italic>").replace("§o", "<italic>")
|
||||
.replace("&r", "<reset>").replace("§r", "<reset>");
|
||||
}
|
||||
|
||||
public static Object replace(Object object, String placeholder, String replacement) {
|
||||
if (object instanceof String) {
|
||||
return replacePlaceholders(replaceLegacyColor((String) object), prefix, player, price);
|
||||
} else if (object instanceof List) {
|
||||
return replacePlaceholdersInList((List<String>) object, prefix, player, price);
|
||||
object = ((String) object).replace(placeholder, replacement);
|
||||
}
|
||||
if ((object instanceof List) || (object instanceof ArrayList)) {
|
||||
List<String> in = (List<String>) object;
|
||||
List<String> output = new ArrayList<>();
|
||||
for (String input : in) {
|
||||
output.add(input.replace(placeholder, replacement));
|
||||
}
|
||||
object = output;
|
||||
}
|
||||
return object;
|
||||
}
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package net.t2code.t2codelib.SPIGOT.api.messages;
|
||||
|
||||
import net.t2code.t2codelib.SPIGOT.api.debug.T2C_Debug;
|
||||
import net.t2code.t2codelib.util.T2C_GenerateFrame;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
@@ -13,31 +14,32 @@ import java.util.logging.Logger;
|
||||
|
||||
public class T2C_Send {
|
||||
|
||||
public static String sendStartTextCenter(String prefix, String text, boolean isReload) {
|
||||
public static void sendStartTextCenter(String prefix, String text, boolean isReload) {
|
||||
if (isReload) {
|
||||
return prefix + " " + text;
|
||||
console(prefix + " " + text);
|
||||
return;
|
||||
}
|
||||
return T2C_GernerateFrame.setCenterAligned(prefix,text);
|
||||
console(T2C_GenerateFrame.setCenterAligned(prefix, text));
|
||||
}
|
||||
|
||||
public static String sendStartTextLeft(String prefix, String text, boolean isReload) {
|
||||
public static void sendStartTextLeft(String prefix, String text, boolean isReload) {
|
||||
if (isReload) {
|
||||
return prefix + " " + text;
|
||||
|
||||
console(prefix + " " + text);
|
||||
return;
|
||||
}
|
||||
return T2C_GernerateFrame.setLeftAligned(prefix, text);
|
||||
console(T2C_GenerateFrame.setLeftAligned(prefix, text));
|
||||
}
|
||||
|
||||
public static String sendFrameCenter(String prefix, String... lines){
|
||||
return T2C_GernerateFrame.sendFrameCenter(prefix, lines);
|
||||
public static String getFrameCenter(String prefix, boolean console, String... lines) {
|
||||
return T2C_GenerateFrame.getFrameCenter(prefix, console, lines);
|
||||
}
|
||||
|
||||
public static String sendFrameLeft(String prefix, String... lines){
|
||||
return T2C_GernerateFrame.sendFrameLeft(prefix, lines);
|
||||
public static String getFrameLeft(String prefix, boolean console, String... lines) {
|
||||
return T2C_GenerateFrame.getFrameLeft(prefix, console, lines);
|
||||
}
|
||||
|
||||
public static void sendException(Exception e, Logger logger){
|
||||
logger.log(Level.SEVERE,"Interrupted exception occurred", e);
|
||||
public static void sendException(Exception e, Logger logger) {
|
||||
logger.log(Level.SEVERE, "Interrupted exception occurred", e);
|
||||
}
|
||||
|
||||
public static void console(String msg) {
|
||||
@@ -56,14 +58,14 @@ public class T2C_Send {
|
||||
}
|
||||
|
||||
public static void console(Object object) {
|
||||
for (String msg : list(object)){
|
||||
for (String msg : list(object)) {
|
||||
if (msg == null || msg.contains("[empty]")) continue;
|
||||
T2C_HoverModule.moduleConsole(msg);
|
||||
}
|
||||
}
|
||||
|
||||
public static void player(Player player, Object object) {
|
||||
for (String msg : list(object)){
|
||||
for (String msg : list(object)) {
|
||||
if (msg == null || msg.contains("[empty]")) continue;
|
||||
T2C_HoverModule.modulePlayer(msg, player);
|
||||
}
|
||||
@@ -71,7 +73,7 @@ public class T2C_Send {
|
||||
|
||||
|
||||
public static void sender(CommandSender sender, Object object) {
|
||||
for (String msg : list(object)){
|
||||
for (String msg : list(object)) {
|
||||
if (msg == null || msg.contains("[empty]")) return;
|
||||
T2C_HoverModule.moduleSender(msg, sender);
|
||||
}
|
||||
@@ -87,7 +89,7 @@ public class T2C_Send {
|
||||
|
||||
/**
|
||||
* @deprecated This method will be removed soon, as the debug messages have been moved to a separate class.
|
||||
* Please use the new method {@link T2C_Debug#debug(Plugin, String)} or {@link T2C_Debug#debug(Plugin, String, Integer)}
|
||||
* Please use the new method {@link T2C_Debug#debug(Plugin, String)} or {@link T2C_Debug#debug(Plugin, String, Integer)}
|
||||
*/
|
||||
@Deprecated(since = "16.7", forRemoval = true)
|
||||
public static void debug(Plugin plugin, String msg) {
|
||||
@@ -96,7 +98,7 @@ public class T2C_Send {
|
||||
|
||||
/**
|
||||
* @deprecated This method will be removed soon, as the debug messages have been moved to a separate class.
|
||||
* Please use the new method {@link T2C_Debug#debug(Plugin, String)} or {@link T2C_Debug#debug(Plugin, String, Integer)}
|
||||
* Please use the new method {@link T2C_Debug#debug(Plugin, String)} or {@link T2C_Debug#debug(Plugin, String, Integer)}
|
||||
*/
|
||||
@Deprecated(since = "16.7", forRemoval = true)
|
||||
public static void debug(Plugin plugin, String msg, Integer stage) {
|
||||
@@ -106,7 +108,7 @@ public class T2C_Send {
|
||||
|
||||
/**
|
||||
* @deprecated This method will be removed soon, as the debug messages have been moved to a separate class.
|
||||
* Please use the new method {@link T2C_Debug#debugmsg(Plugin, String)}
|
||||
* Please use the new method {@link T2C_Debug#debugmsg(Plugin, String)}
|
||||
*/
|
||||
@Deprecated(since = "16.7", forRemoval = true)
|
||||
public static void debugmsg(Plugin plugin, String msg) {
|
||||
@@ -125,13 +127,13 @@ public class T2C_Send {
|
||||
plugin.getLogger().log(Level.SEVERE, msg);
|
||||
}
|
||||
|
||||
private static ArrayList<String> list(Object object){
|
||||
private static ArrayList<String> list(Object object) {
|
||||
ArrayList<String> list = new ArrayList<>();
|
||||
|
||||
if (object instanceof List){
|
||||
list= (ArrayList<String>) object;
|
||||
if (object instanceof List) {
|
||||
list = (ArrayList<String>) object;
|
||||
}
|
||||
if (object instanceof String){
|
||||
if (object instanceof String) {
|
||||
list.add((String) object);
|
||||
}
|
||||
return list;
|
||||
|
@@ -1,8 +1,9 @@
|
||||
package net.t2code.t2codelib.SPIGOT.api.messages;
|
||||
|
||||
import net.t2code.t2codelib.SPIGOT.api.update.T2C_UpdateAPI;
|
||||
import net.t2code.t2codelib.T2CupdateWebData;
|
||||
import net.t2code.t2codelib.Util;
|
||||
import net.t2code.t2codelib.util.T2C_GenerateFrame;
|
||||
import net.t2code.t2codelib.util.T2C_UpdateWebData;
|
||||
import net.t2code.t2codelib.util.T2C_Util;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
@@ -20,8 +21,8 @@ public class T2C_Template {
|
||||
public static Long onLoadHeader(String prefix, List<String> autor, String version, String spigot, String discord, Boolean isPremium, Boolean isVerify) {
|
||||
Long long_ = System.currentTimeMillis();
|
||||
|
||||
for (String s : Util.getLoadLogo()) {
|
||||
T2C_Send.console(prefix + " §e" + s);
|
||||
for (String s : T2C_Util.getLoadLogo()) {
|
||||
T2C_Send.console(prefix + " "+ T2C_GenerateFrame.getCOLOR_CODE() + s);
|
||||
}
|
||||
T2C_Send.sendStartTextCenter(prefix, "§2Author §6" + String.valueOf(autor).replace("[", "").replace("]", ""), false);
|
||||
T2C_Send.sendStartTextCenter(prefix, "§2Version: §6" + version, false);
|
||||
@@ -61,17 +62,18 @@ public class T2C_Template {
|
||||
}
|
||||
|
||||
public static void onLoadSeparateStroke(String prefix) {
|
||||
T2C_Send.console(prefix + " §e╠═══════════════════════════════════════════════════════════════════════════╣");
|
||||
T2C_Send.console(prefix + " " + T2C_GenerateFrame.getCOLOR_CODE() + T2C_GenerateFrame.getSTROKE());
|
||||
}
|
||||
|
||||
public static void onLoadFooter(String prefix, Long long_) {
|
||||
onLoadSeparateStroke(prefix);
|
||||
T2C_Send.sendStartTextCenter(prefix, "§2Plugin loaded successfully." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms", false);
|
||||
T2C_Send.console(prefix + " §e" + T2C_GernerateFrame.BOTTOM_BORDER);
|
||||
T2C_Send.console(prefix + " " + T2C_GenerateFrame.getCOLOR_CODE() + T2C_GenerateFrame.getBOTTOM_BORDER());
|
||||
}
|
||||
|
||||
public static void onDisable(String prefix, Plugin plugin) {
|
||||
T2C_Send.sendFrameCenter(prefix, " §2Version: §6" + plugin.getDescription().getVersion(), "§2Autors: §6" + String.valueOf(plugin.getDescription().getAuthors()).replace("[", "").replace("]", ""), " §4Plugin successfully disabled. ");
|
||||
T2C_Send.console(T2C_Send.getFrameCenter(prefix, true, " §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) {
|
||||
@@ -79,7 +81,7 @@ public class T2C_Template {
|
||||
String publicVersion = "";
|
||||
boolean update;
|
||||
String stNVersion;
|
||||
T2CupdateWebData webData;
|
||||
T2C_UpdateWebData webData;
|
||||
try {
|
||||
webData = T2C_UpdateAPI.pluginVersions.get(plugin.getName()).webData;
|
||||
} catch (Exception ex) {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package net.t2code.t2codelib.SPIGOT.api.plugins;
|
||||
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2C_Main;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
@@ -82,7 +82,7 @@ public class T2C_PluginCheck {
|
||||
plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
|
||||
Bukkit.getConsoleSender().sendMessage(prefix + " §e" + pl + " §4could not be found. Please download it here: " +
|
||||
"§6https://spigotmc.org/resources/" + pl + "." + spigotID + " §4to be able to use this plugin.");
|
||||
T2CodeLibMain.getPlugin().getPluginLoader().disablePlugin(T2CodeLibMain.getPlugin());
|
||||
T2C_Main.getPlugin().getPluginLoader().disablePlugin(T2C_Main.getPlugin());
|
||||
return true;
|
||||
} else return false;
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package net.t2code.t2codelib.SPIGOT.api.plugins;
|
||||
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2C_Main;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
@@ -10,33 +10,33 @@ public class T2C_PluginManager {
|
||||
|
||||
public static void restart(String plugin) {
|
||||
if (Bukkit.getPluginManager().getPlugin(plugin) == null) return;
|
||||
T2CodeLibMain.getPlugin().getPluginLoader().disablePlugin(Objects.requireNonNull(Bukkit.getPluginManager().getPlugin(plugin)));
|
||||
T2CodeLibMain.getPlugin().getPluginLoader().enablePlugin(Objects.requireNonNull(Bukkit.getPluginManager().getPlugin(plugin)));
|
||||
T2C_Main.getPlugin().getPluginLoader().disablePlugin(Objects.requireNonNull(Bukkit.getPluginManager().getPlugin(plugin)));
|
||||
T2C_Main.getPlugin().getPluginLoader().enablePlugin(Objects.requireNonNull(Bukkit.getPluginManager().getPlugin(plugin)));
|
||||
}
|
||||
|
||||
public static void enable(String plugin) {
|
||||
if (Bukkit.getPluginManager().getPlugin(plugin) == null) return;
|
||||
T2CodeLibMain.getPlugin().getPluginLoader().enablePlugin(Objects.requireNonNull(Bukkit.getPluginManager().getPlugin(plugin)));
|
||||
T2C_Main.getPlugin().getPluginLoader().enablePlugin(Objects.requireNonNull(Bukkit.getPluginManager().getPlugin(plugin)));
|
||||
}
|
||||
|
||||
public static void disable(String plugin) {
|
||||
if (Bukkit.getPluginManager().getPlugin(plugin) == null) return;
|
||||
T2CodeLibMain.getPlugin().getPluginLoader().disablePlugin(Objects.requireNonNull(Bukkit.getPluginManager().getPlugin(plugin)));
|
||||
T2C_Main.getPlugin().getPluginLoader().disablePlugin(Objects.requireNonNull(Bukkit.getPluginManager().getPlugin(plugin)));
|
||||
}
|
||||
|
||||
public static void restart(Plugin plugin) {
|
||||
if (plugin == null) return;
|
||||
T2CodeLibMain.getPlugin().getPluginLoader().disablePlugin(plugin);
|
||||
T2CodeLibMain.getPlugin().getPluginLoader().enablePlugin(plugin);
|
||||
T2C_Main.getPlugin().getPluginLoader().disablePlugin(plugin);
|
||||
T2C_Main.getPlugin().getPluginLoader().enablePlugin(plugin);
|
||||
}
|
||||
|
||||
public static void enable(Plugin plugin) {
|
||||
if (plugin == null) return;
|
||||
T2CodeLibMain.getPlugin().getPluginLoader().enablePlugin(plugin);
|
||||
T2C_Main.getPlugin().getPluginLoader().enablePlugin(plugin);
|
||||
}
|
||||
|
||||
public static void disable(Plugin plugin) {
|
||||
if (plugin == null) return;
|
||||
T2CodeLibMain.getPlugin().getPluginLoader().disablePlugin(plugin);
|
||||
T2C_Main.getPlugin().getPluginLoader().disablePlugin(plugin);
|
||||
}
|
||||
}
|
||||
|
@@ -1,12 +1,12 @@
|
||||
package net.t2code.t2codelib.SPIGOT.api.update;
|
||||
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2C_Main;
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.config.T2C_LibConfig;
|
||||
import net.t2code.t2codelib.UpdateType;
|
||||
import net.t2code.t2codelib.T2CupdateObject;
|
||||
import net.t2code.t2codelib.T2CupdateWebData;
|
||||
import net.t2code.t2codelib.Util;
|
||||
import net.t2code.t2codelib.util.T2C_UpdateType;
|
||||
import net.t2code.t2codelib.util.T2C_UpdateObject;
|
||||
import net.t2code.t2codelib.util.T2C_UpdateWebData;
|
||||
import net.t2code.t2codelib.util.T2C_Util;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
@@ -16,16 +16,11 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class T2C_UpdateAPI {
|
||||
public static HashMap<String, T2CupdateObject> pluginVersions = new HashMap<>();
|
||||
public static HashMap<String, T2C_UpdateObject> pluginVersions = new HashMap<>();
|
||||
|
||||
public static void join(Plugin plugin, String prefix, String perm, Player player, Integer spigotID, String discord) {
|
||||
if (pluginVersions.get(plugin.getName()) == null) {
|
||||
Bukkit.getScheduler().runTaskLaterAsynchronously(T2CodeLibMain.getPlugin(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
join(plugin, prefix, perm, player, spigotID, discord);
|
||||
}
|
||||
}, 2 * 20L);
|
||||
Bukkit.getScheduler().runTaskLaterAsynchronously(T2C_Main.getPlugin(), () -> join(plugin, prefix, perm, player, spigotID, discord), 2 * 20L);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -44,22 +39,23 @@ public class T2C_UpdateAPI {
|
||||
}.runTaskLaterAsynchronously(plugin, 20L);
|
||||
return;
|
||||
}
|
||||
T2CupdateWebData webData = pluginVersions.get(plugin.getName()).webData;
|
||||
T2C_UpdateWebData webData = pluginVersions.get(plugin.getName()).webData;
|
||||
if (!pluginVersions.get(plugin.getName()).updateAvailable) return;
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
sendUpdateMsg(prefix, webData, discord, plugin, player);
|
||||
}
|
||||
}.runTaskLaterAsynchronously(T2CodeLibMain.getPlugin(), 200L);
|
||||
}.runTaskLaterAsynchronously(T2C_Main.getPlugin(), 200L);
|
||||
}
|
||||
|
||||
public static void sendUpdateMsg(String prefix, T2CupdateWebData webData, String discord, Plugin plugin, Player player) {
|
||||
public static void sendUpdateMsg(String prefix, T2C_UpdateWebData webData, String discord, Plugin plugin, Player player) {
|
||||
String publicVersion = webData.getVersion();
|
||||
String pluginVersion = plugin.getDescription().getVersion();
|
||||
if (!pluginVersions.get(plugin.getName()).updateAvailable) {
|
||||
return;
|
||||
}
|
||||
String updateStatusVersion = getUpdateType(webData);
|
||||
String st = "[prefix]<br>" +
|
||||
"<click:open_url:'[link]'><hover:show_text:'<color:#6e90ff>You can download it here: <yellow>[link]</yellow></color>'>[prefix] <color:#6e90ff>A new</color> [value] <color:#6e90ff>version was" +
|
||||
" found!</color></hover></click><br>" +
|
||||
@@ -69,81 +65,40 @@ public class T2C_UpdateAPI {
|
||||
"[prefix] <color:#ff9499><hover:show_text:'<red>Click for more information</red>'><click:run_command:'/t2c updateinfo " + plugin.getName() + "'>Update information</click></hover></color><br>" +
|
||||
"[prefix]";
|
||||
|
||||
String updateStatusVersion;
|
||||
|
||||
if (webData.isPreRelease()) {
|
||||
//todo if (!SelectLibConfig.getSeePreReleaseUpdates()) return;
|
||||
updateStatusVersion = UpdateType.PRERELEASE.text;
|
||||
if (publicVersion.toLowerCase().contains("dev")) {
|
||||
updateStatusVersion = UpdateType.DEVELOPMENT.text;
|
||||
}
|
||||
if (publicVersion.toLowerCase().contains("beta")) {
|
||||
updateStatusVersion = UpdateType.BETA.text;
|
||||
}
|
||||
if (publicVersion.toLowerCase().contains("snapshot")) {
|
||||
updateStatusVersion = UpdateType.SNAPSHOT.text;
|
||||
}
|
||||
} else updateStatusVersion = UpdateType.STABLE.text;
|
||||
|
||||
T2C_Send.player(player, st.replace("[prefix]", prefix).replace("[value]", updateStatusVersion).replace("[link]", webData.getUpdateUrl())
|
||||
.replace("[plv]", pluginVersion).replace("[puv]", publicVersion).replace("[dc]", discord));
|
||||
}
|
||||
|
||||
public static void sendUpdateMsg(String prefix, String discord, T2CupdateWebData webData, Plugin plugin) {
|
||||
public static void sendUpdateMsg(String prefix, String discord, T2C_UpdateWebData webData, Plugin plugin) {
|
||||
String publicVersion = webData.getVersion();
|
||||
String pluginVersion = plugin.getDescription().getVersion();
|
||||
String updateStatusVersion;
|
||||
if (webData.isPreRelease()) {
|
||||
updateStatusVersion = UpdateType.PRERELEASE.text;
|
||||
if (publicVersion.toLowerCase().contains("dev")) {
|
||||
updateStatusVersion = UpdateType.DEVELOPMENT.text;
|
||||
}
|
||||
if (publicVersion.toLowerCase().contains("beta")) {
|
||||
updateStatusVersion = UpdateType.BETA.text;
|
||||
}
|
||||
if (publicVersion.toLowerCase().contains("snapshot")) {
|
||||
updateStatusVersion = UpdateType.SNAPSHOT.text;
|
||||
}
|
||||
} else updateStatusVersion = UpdateType.STABLE.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>";
|
||||
String updateStatusVersion = getUpdateType(webData);
|
||||
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>";
|
||||
|
||||
T2C_Send.sendFrameCenter(prefix,s1,s2,s3,s4);
|
||||
T2C_Send.console(T2C_Send.getFrameCenter(prefix, true, s1, s2, s3, s4));
|
||||
}
|
||||
|
||||
public static String updateInfo(String[] args, Boolean player) {
|
||||
T2CupdateObject object;
|
||||
T2C_UpdateObject object;
|
||||
try {
|
||||
object = T2C_UpdateAPI.pluginVersions.get(args[1]);
|
||||
} catch (Exception e) {
|
||||
return Util.getPrefix() + " <red>The plugin <yellow>" + args[1] + "</yellow> is not registered in the update checker of T2Code!</red>";
|
||||
return T2C_Util.getPrefix() + " <red>The plugin <yellow>" + args[1] + "</yellow> is not registered in the update checker of T2Code!</red>";
|
||||
}
|
||||
if (object == null) return Util.getPrefix() + " <red>The plugin <yellow>" + args[1] + "</yellow> is not registered in the update checker of T2Code!</red>";
|
||||
T2CupdateWebData webData = object.webData;
|
||||
if (object == null) return T2C_Util.getPrefix() + " <red>The plugin <yellow>" + args[1] + "</yellow> is not registered in the update checker of T2Code!</red>";
|
||||
T2C_UpdateWebData webData = object.webData;
|
||||
if (webData == null) {
|
||||
return Util.getPrefix() + " <b><dark_red>It could not be checked for updates with the plugin <yellow>" + args[1] + "</yellow>!</dark_red></b>";
|
||||
return T2C_Util.getPrefix() + " <b><dark_red>It could not be checked for updates with the plugin <yellow>" + args[1] + "</yellow>!</dark_red></b>";
|
||||
}
|
||||
String pluginName = T2C_UpdateAPI.pluginVersions.get(args[1]).pluginName;
|
||||
String pluginVersion = T2C_UpdateAPI.pluginVersions.get(args[1]).pluginVersion;
|
||||
|
||||
String updateTitle = webData.getUpdateTitle();
|
||||
String updateVersion = webData.getVersion();
|
||||
String updateType;
|
||||
|
||||
if (webData.isPreRelease()) {
|
||||
updateType = UpdateType.PRERELEASE.text;
|
||||
if (updateVersion.toLowerCase().contains("dev")) {
|
||||
updateType = UpdateType.DEVELOPMENT.text;
|
||||
}
|
||||
if (updateVersion.toLowerCase().contains("beta")) {
|
||||
updateType = UpdateType.BETA.text;
|
||||
}
|
||||
if (updateVersion.toLowerCase().contains("snapshot")) {
|
||||
updateType = UpdateType.SNAPSHOT.text;
|
||||
}
|
||||
} else updateType = UpdateType.STABLE.text;
|
||||
String publicVersion = webData.getVersion();
|
||||
String updateType = getUpdateType(webData);
|
||||
|
||||
String updateAt = webData.getPublishedAt();
|
||||
String updateUpdate = webData.getUpdateUrl();
|
||||
@@ -153,7 +108,7 @@ public class T2C_UpdateAPI {
|
||||
String pluginVersionString = "<br><dark_red>║</dark_red> <color:#6e90ff>Your version:</color> <color:#5eff89>" + pluginVersion + "</color>";
|
||||
String updateInfoString = "<br><dark_red>║</dark_red> <color:#09ff00>[value]:</color>";
|
||||
String updateTitleString = "<br><dark_red>║</dark_red> <color:#6e90ff>Title:</color> <color:#5eff89>" + updateTitle + "</color>";
|
||||
String updateVersionString = "<br><dark_red>║</dark_red> <color:#6e90ff>Version:</color> <color:#5eff89>" + updateVersion + "</color>";
|
||||
String updateVersionString = "<br><dark_red>║</dark_red> <color:#6e90ff>Version:</color> <color:#5eff89>" + publicVersion + "</color>";
|
||||
String updateAtString = "<br><dark_red>║</dark_red> <color:#6e90ff>Published on:</color> <color:#5eff89>" + updateAt + "</color>";
|
||||
String updateTypeString = "<br><dark_red>║</dark_red> <color:#6e90ff>Version type:</color> <color:#5eff89>" + updateType + "</color>";
|
||||
|
||||
@@ -187,4 +142,22 @@ public class T2C_UpdateAPI {
|
||||
if ((boolean) T2C_LibConfig.VALUES.updateCheckFullDisable.getValue()) return;
|
||||
new T2C_UpdateCheckerGit((JavaPlugin) plugin, prefix, gitKey, spigotID, discord, updateCheckOnJoin, seePreReleaseUpdates, timeInterval);
|
||||
}
|
||||
|
||||
private static String getUpdateType(T2C_UpdateWebData webData) {
|
||||
String updateType;
|
||||
String publicVersion = webData.getVersion();
|
||||
if (webData.isPreRelease()) {
|
||||
updateType = T2C_UpdateType.PRERELEASE.text;
|
||||
if (publicVersion.toLowerCase().contains("dev")) {
|
||||
updateType = T2C_UpdateType.DEVELOPMENT.text;
|
||||
}
|
||||
if (publicVersion.toLowerCase().contains("beta")) {
|
||||
updateType = T2C_UpdateType.BETA.text;
|
||||
}
|
||||
if (publicVersion.toLowerCase().contains("snapshot")) {
|
||||
updateType = T2C_UpdateType.SNAPSHOT.text;
|
||||
}
|
||||
} else updateType = T2C_UpdateType.STABLE.text;
|
||||
return updateType;
|
||||
}
|
||||
}
|
||||
|
@@ -1,10 +1,11 @@
|
||||
package net.t2code.t2codelib.SPIGOT.api.update;
|
||||
|
||||
import net.t2code.t2codelib.SPIGOT.api.debug.T2C_Debug;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2C_Main;
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.config.T2C_LibConfig;
|
||||
import net.t2code.t2codelib.T2CupdateObject;
|
||||
import net.t2code.t2codelib.T2CupdateWebData;
|
||||
import net.t2code.t2codelib.util.T2C_UpdateObject;
|
||||
import net.t2code.t2codelib.util.T2C_UpdateWebData;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
@@ -20,7 +21,7 @@ import java.util.function.Consumer;
|
||||
|
||||
public class T2C_UpdateCheckerGit {
|
||||
private final JavaPlugin plugin;
|
||||
private T2CupdateObject t2CupdateObject;
|
||||
private T2C_UpdateObject t2CupdateObject;
|
||||
|
||||
|
||||
public T2C_UpdateCheckerGit(JavaPlugin plugin, String prefix, String gitKey, Integer spigotID, String discord, Boolean updateCheckOnJoin, Boolean seePreReleaseUpdates, Integer timeInterval) {
|
||||
@@ -42,7 +43,7 @@ public class T2C_UpdateCheckerGit {
|
||||
public void run() {
|
||||
if ((boolean) T2C_LibConfig.VALUES.updateCheckFullDisable.getValue()) return;
|
||||
getVersion((webData) -> {
|
||||
T2CupdateObject update = new T2CupdateObject(
|
||||
T2C_UpdateObject update = new T2C_UpdateObject(
|
||||
plugin.getName(),
|
||||
plugin.getDescription().getVersion(),
|
||||
webData,
|
||||
@@ -53,7 +54,7 @@ public class T2C_UpdateCheckerGit {
|
||||
|
||||
T2C_UpdateAPI.pluginVersions.put(plugin.getName(), update);
|
||||
if (T2C_UpdateAPI.pluginVersions.get(plugin.getName()) == null) {
|
||||
T2C_Send.debugmsg(T2CodeLibMain.getPlugin(), "'" + plugin.getName() + "' UpdateAPI T2CupdateAPI.pluginVersions.get(plugin.getName()) == null");
|
||||
T2C_Debug.debugmsg(T2C_Main.getPlugin(), "'" + plugin.getName() + "' UpdateAPI T2CupdateAPI.pluginVersions.get(plugin.getName()) == null");
|
||||
return;
|
||||
}
|
||||
if (T2C_UpdateAPI.pluginVersions.get(plugin.getName()).updateAvailable) {
|
||||
@@ -80,7 +81,7 @@ public class T2C_UpdateCheckerGit {
|
||||
}, 10L, finalInterval * 60 * 20L);
|
||||
}
|
||||
|
||||
public void getVersion(Consumer<T2CupdateWebData> consumer, String pluginVersion, Integer spigotID, String URL, Boolean updateCheckOnJoin, Boolean seePreReleaseUpdates, Integer timeInterval) {
|
||||
public void getVersion(Consumer<T2C_UpdateWebData> consumer, String pluginVersion, Integer spigotID, String URL, Boolean updateCheckOnJoin, Boolean seePreReleaseUpdates, Integer timeInterval) {
|
||||
if (!plugin.isEnabled()) {
|
||||
return;
|
||||
}
|
||||
@@ -128,14 +129,14 @@ public class T2C_UpdateCheckerGit {
|
||||
updateUrl = "https://www.spigotmc.org/resources/" + spigotID;
|
||||
}
|
||||
|
||||
T2CupdateWebData webData = new T2CupdateWebData(updateTitle, version, updateDescription, updateUrl, publishedAt, downloadURL, gitURL, preRelease);
|
||||
T2C_UpdateWebData webData = new T2C_UpdateWebData(updateTitle, version, updateDescription, updateUrl, publishedAt, downloadURL, gitURL, preRelease);
|
||||
consumer.accept(webData);
|
||||
} catch (Exception exception) {
|
||||
Boolean load = false;
|
||||
if (T2C_UpdateAPI.pluginVersions.containsKey(plugin.getName())) {
|
||||
load = T2C_UpdateAPI.pluginVersions.get(plugin.getName()).load;
|
||||
}
|
||||
T2CupdateObject update = new T2CupdateObject(
|
||||
T2C_UpdateObject update = new T2C_UpdateObject(
|
||||
plugin.getName(),
|
||||
pluginVersion,
|
||||
null,
|
||||
|
@@ -3,7 +3,7 @@ package net.t2code.t2codelib.SPIGOT.api.yaml;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Replace;
|
||||
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2C_McVersion;
|
||||
import net.t2code.t2codelib.SPIGOT.api.sound.T2C_Sound;
|
||||
import net.t2code.t2codelib.T2CconfigItem;
|
||||
import net.t2code.t2codelib.util.T2C_ConfigItem;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@@ -17,7 +17,7 @@ public class T2C_Config {
|
||||
/**
|
||||
* @deprecated since version 16.7
|
||||
* This method will be removed soon!
|
||||
* Please use the new {@link T2C_ConfigWriter#createConfig(File, T2CconfigItem[], String...)}.
|
||||
* Please use the new {@link T2C_ConfigWriter#createConfig(File, T2C_ConfigItem[], String...)}.
|
||||
*/
|
||||
@Deprecated(since = "16.7", forRemoval = true)
|
||||
public static void set(String path, String value, YamlConfiguration YamlConfiguration) {
|
||||
@@ -29,7 +29,7 @@ public class T2C_Config {
|
||||
/**
|
||||
* @deprecated since version 16.7
|
||||
* This method will be removed soon!
|
||||
* Please use the new {@link T2C_ConfigWriter#createConfig(File, T2CconfigItem[], String...)}.
|
||||
* Please use the new {@link T2C_ConfigWriter#createConfig(File, T2C_ConfigItem[], String...)}.
|
||||
*/
|
||||
@Deprecated(since = "16.7", forRemoval = true)
|
||||
public static void set(String path, Object value, YamlConfiguration YamlConfiguration) {
|
||||
@@ -41,7 +41,7 @@ public class T2C_Config {
|
||||
/**
|
||||
* @deprecated since version 16.7
|
||||
* This method will be removed soon!
|
||||
* Please use the new {@link T2C_ConfigWriter#createConfig(File, T2CconfigItem[], String...)}.
|
||||
* Please use the new {@link T2C_ConfigWriter#createConfig(File, T2C_ConfigItem[], String...)}.
|
||||
*/
|
||||
@Deprecated(since = "16.7", forRemoval = true)
|
||||
public static void set(String path, YamlConfiguration YamlConfiguration) {
|
||||
@@ -51,7 +51,7 @@ public class T2C_Config {
|
||||
/**
|
||||
* @deprecated since version 16.7
|
||||
* This method will be removed soon!
|
||||
* Please use the new {@link T2C_ConfigWriter#createConfig(File, T2CconfigItem[], String...)}.
|
||||
* Please use the new {@link T2C_ConfigWriter#createConfig(File, T2C_ConfigItem[], String...)}.
|
||||
*/
|
||||
@Deprecated(since = "16.7", forRemoval = true)
|
||||
public static void set(String path, Integer value, YamlConfiguration YamlConfiguration) {
|
||||
@@ -63,7 +63,7 @@ public class T2C_Config {
|
||||
/**
|
||||
* @deprecated since version 16.7
|
||||
* This method will be removed soon!
|
||||
* Please use the new {@link T2C_ConfigWriter#createConfig(File, T2CconfigItem[], String...)}.
|
||||
* Please use the new {@link T2C_ConfigWriter#createConfig(File, T2C_ConfigItem[], String...)}.
|
||||
*/
|
||||
@Deprecated(since = "16.7", forRemoval = true)
|
||||
public static void set(String path, Double value, YamlConfiguration YamlConfiguration) {
|
||||
@@ -75,7 +75,7 @@ public class T2C_Config {
|
||||
/**
|
||||
* @deprecated since version 16.7
|
||||
* This method will be removed soon!
|
||||
* Please use the new {@link T2C_ConfigWriter#createConfig(File, T2CconfigItem[], String...)}.
|
||||
* Please use the new {@link T2C_ConfigWriter#createConfig(File, T2C_ConfigItem[], String...)}.
|
||||
*/
|
||||
@Deprecated(since = "16.7", forRemoval = true)
|
||||
public static void set(String path, Boolean value, YamlConfiguration YamlConfiguration) {
|
||||
@@ -87,7 +87,7 @@ public class T2C_Config {
|
||||
/**
|
||||
* @deprecated since version 16.7
|
||||
* This method will be removed soon!
|
||||
* Please use the new {@link T2C_ConfigWriter#createConfig(File, T2CconfigItem[], String...)}.
|
||||
* Please use the new {@link T2C_ConfigWriter#createConfig(File, T2C_ConfigItem[], String...)}.
|
||||
*/
|
||||
@Deprecated(since = "16.7", forRemoval = true)
|
||||
public static void set(String path, List<String> value, YamlConfiguration YamlConfiguration) {
|
||||
@@ -99,7 +99,7 @@ public class T2C_Config {
|
||||
/**
|
||||
* @deprecated since version 16.7
|
||||
* This method will be removed soon!
|
||||
* Please use the new {@link T2C_ConfigWriter#createConfig(File, T2CconfigItem[], String...)}.
|
||||
* Please use the new {@link T2C_ConfigWriter#createConfig(File, T2C_ConfigItem[], String...)}.
|
||||
*/
|
||||
@Deprecated(since = "16.7", forRemoval = true)
|
||||
public static void set(String path, ItemStack value, YamlConfiguration YamlConfiguration) {
|
||||
@@ -111,7 +111,7 @@ public class T2C_Config {
|
||||
/**
|
||||
* @deprecated since version 16.7
|
||||
* This method will be removed soon!
|
||||
* Please use the new {@link T2C_ConfigWriter#createConfig(File, T2CconfigItem[], String...)}.
|
||||
* Please use the new {@link T2C_ConfigWriter#createConfig(File, T2C_ConfigItem[], String...)}.
|
||||
*/
|
||||
@Deprecated(since = "16.7", forRemoval = true)
|
||||
public static void setSound(String soundName, String sound1_8, String sound1_9, String sound1_13, YamlConfiguration yamlConfiguration) {
|
||||
@@ -128,7 +128,7 @@ public class T2C_Config {
|
||||
/**
|
||||
* @deprecated since version 16.7
|
||||
* This method will be removed soon!
|
||||
* Please use the new {@link T2C_ConfigWriter#createConfig(File, T2CconfigItem[], String...)}.
|
||||
* Please use the new {@link T2C_ConfigWriter#createConfig(File, T2C_ConfigItem[], String...)}.
|
||||
*/
|
||||
@Deprecated(since = "16.7", forRemoval = true)
|
||||
public static void setSound(String soundName, String sound1_8, String sound1_13, YamlConfiguration yamlConfiguration) {
|
||||
@@ -143,7 +143,7 @@ public class T2C_Config {
|
||||
/**
|
||||
* @deprecated since version 16.7
|
||||
* This method will be removed soon!
|
||||
* Please use the new {@link T2C_ConfigWriter#createConfig(File, T2CconfigItem[], String...)}.
|
||||
* Please use the new {@link T2C_ConfigWriter#createConfig(File, T2C_ConfigItem[], String...)}.
|
||||
*/
|
||||
@Deprecated(since = "16.7", forRemoval = true)
|
||||
public static void setSound(String soundName, String sound, YamlConfiguration yamlConfiguration) {
|
||||
@@ -154,7 +154,7 @@ public class T2C_Config {
|
||||
/**
|
||||
* @deprecated since version 16.7
|
||||
* This method will be removed soon!
|
||||
* Please use the new {@link T2C_ConfigWriter#createConfig(File, T2CconfigItem[], String...)}.
|
||||
* Please use the new {@link T2C_ConfigWriter#createConfig(File, T2C_ConfigItem[], String...)}.
|
||||
*/
|
||||
@Deprecated(since = "16.7", forRemoval = true)
|
||||
public static boolean selectSoundEnable(String soundName, YamlConfiguration yamlConfiguration) {
|
||||
@@ -164,7 +164,7 @@ public class T2C_Config {
|
||||
/**
|
||||
* @deprecated since version 16.7
|
||||
* This method will be removed soon!
|
||||
* Please use the new {@link T2C_ConfigWriter#createConfig(File, T2CconfigItem[], String...)}.
|
||||
* Please use the new {@link T2C_ConfigWriter#createConfig(File, T2C_ConfigItem[], String...)}.
|
||||
*/
|
||||
@Deprecated(since = "16.7", forRemoval = true)
|
||||
public static String selectSound(String prefix, String soundName, YamlConfiguration yamlConfiguration) {
|
||||
@@ -174,7 +174,7 @@ public class T2C_Config {
|
||||
/**
|
||||
* @deprecated since version 16.7
|
||||
* This method will be removed soon!
|
||||
* Please use the new {@link T2C_ConfigWriter#createConfig(File, T2CconfigItem[], String...)}.
|
||||
* Please use the new {@link T2C_ConfigWriter#createConfig(File, T2C_ConfigItem[], String...)}.
|
||||
*/
|
||||
@Deprecated(since = "16.7", forRemoval = true)
|
||||
public static Sound checkSound(String sound1_8, String sound1_9, String sound1_13, String selectSoundFromConfig, String prefix) {
|
||||
@@ -184,7 +184,7 @@ public class T2C_Config {
|
||||
/**
|
||||
* @deprecated since version 16.7
|
||||
* This method will be removed soon!
|
||||
* Please use the new {@link T2C_ConfigWriter#createConfig(File, T2CconfigItem[], String...)}.
|
||||
* Please use the new {@link T2C_ConfigWriter#createConfig(File, T2C_ConfigItem[], String...)}.
|
||||
*/
|
||||
@Deprecated(since = "16.7", forRemoval = true)
|
||||
public static Sound checkSound(String sound1_8, String sound1_13, String selectSoundFromConfig, String prefix) {
|
||||
@@ -194,7 +194,7 @@ public class T2C_Config {
|
||||
/**
|
||||
* @deprecated since version 16.7
|
||||
* This method will be removed soon!
|
||||
* Please use the new {@link T2C_ConfigWriter#createConfig(File, T2CconfigItem[], String...)}.
|
||||
* Please use the new {@link T2C_ConfigWriter#createConfig(File, T2C_ConfigItem[], String...)}.
|
||||
*/
|
||||
@Deprecated(since = "16.7", forRemoval = true)
|
||||
public static Sound checkSound(String sound, String selectSoundFromConfig, String prefix) {
|
||||
@@ -205,7 +205,7 @@ public class T2C_Config {
|
||||
/**
|
||||
* @deprecated since version 16.7
|
||||
* This method will be removed soon!
|
||||
* Please use the new {@link T2C_ConfigWriter#createConfig(File, T2CconfigItem[], String...)}.
|
||||
* Please use the new {@link T2C_ConfigWriter#createConfig(File, T2C_ConfigItem[], String...)}.
|
||||
*/
|
||||
@Deprecated(since = "16.7", forRemoval = true)
|
||||
public static String select(String prefix, String path, YamlConfiguration yamlConfiguration) {
|
||||
@@ -215,7 +215,7 @@ public class T2C_Config {
|
||||
/**
|
||||
* @deprecated since version 16.7
|
||||
* This method will be removed soon!
|
||||
* Please use the new {@link T2C_ConfigWriter#createConfig(File, T2CconfigItem[], String...)}.
|
||||
* Please use the new {@link T2C_ConfigWriter#createConfig(File, T2C_ConfigItem[], String...)}.
|
||||
*/
|
||||
@Deprecated(since = "16.7", forRemoval = true)
|
||||
public static Object selectObject(String prefix, String path, YamlConfiguration yamlConfiguration) {
|
||||
@@ -225,7 +225,7 @@ public class T2C_Config {
|
||||
/**
|
||||
* @deprecated since version 16.7
|
||||
* This method will be removed soon!
|
||||
* Please use the new {@link T2C_ConfigWriter#createConfig(File, T2CconfigItem[], String...)}.
|
||||
* Please use the new {@link T2C_ConfigWriter#createConfig(File, T2C_ConfigItem[], String...)}.
|
||||
*/
|
||||
@Deprecated(since = "16.7", forRemoval = true)
|
||||
public static Integer selectInt(String path, YamlConfiguration yamlConfiguration) {
|
||||
@@ -235,7 +235,7 @@ public class T2C_Config {
|
||||
/**
|
||||
* @deprecated since version 16.7
|
||||
* This method will be removed soon!
|
||||
* Please use the new {@link T2C_ConfigWriter#createConfig(File, T2CconfigItem[], String...)}.
|
||||
* Please use the new {@link T2C_ConfigWriter#createConfig(File, T2C_ConfigItem[], String...)}.
|
||||
*/
|
||||
@Deprecated(since = "16.7", forRemoval = true)
|
||||
public static Boolean selectBoolean(String path, YamlConfiguration yamlConfiguration) {
|
||||
@@ -245,7 +245,7 @@ public class T2C_Config {
|
||||
/**
|
||||
* @deprecated since version 16.7
|
||||
* This method will be removed soon!
|
||||
* Please use the new {@link T2C_ConfigWriter#createConfig(File, T2CconfigItem[], String...)}.
|
||||
* Please use the new {@link T2C_ConfigWriter#createConfig(File, T2C_ConfigItem[], String...)}.
|
||||
*/
|
||||
@Deprecated(since = "16.7", forRemoval = true)
|
||||
public static Double selectDouble(String path, YamlConfiguration yamlConfiguration) {
|
||||
@@ -255,7 +255,7 @@ public class T2C_Config {
|
||||
/**
|
||||
* @deprecated since version 16.7
|
||||
* This method will be removed soon!
|
||||
* Please use the new {@link T2C_ConfigWriter#createConfig(File, T2CconfigItem[], String...)}.
|
||||
* Please use the new {@link T2C_ConfigWriter#createConfig(File, T2C_ConfigItem[], String...)}.
|
||||
*/
|
||||
@Deprecated(since = "16.7", forRemoval = true)
|
||||
public static List<String> selectList(String path, YamlConfiguration yamlConfiguration) {
|
||||
@@ -265,7 +265,7 @@ public class T2C_Config {
|
||||
/**
|
||||
* @deprecated since version 16.7
|
||||
* This method will be removed soon!
|
||||
* Please use the new {@link T2C_ConfigWriter#createConfig(File, T2CconfigItem[], String...)}.
|
||||
* Please use the new {@link T2C_ConfigWriter#createConfig(File, T2C_ConfigItem[], String...)}.
|
||||
*/
|
||||
@Deprecated(since = "16.7", forRemoval = true)
|
||||
public static ItemStack selectItemStack(String path, YamlConfiguration yamlConfiguration) {
|
||||
@@ -275,7 +275,7 @@ public class T2C_Config {
|
||||
/**
|
||||
* @deprecated since version 16.7
|
||||
* This method will be removed soon!
|
||||
* Please use the new {@link T2C_ConfigWriter#createConfig(File, T2CconfigItem[], String...)}.
|
||||
* Please use the new {@link T2C_ConfigWriter#createConfig(File, T2C_ConfigItem[], String...)}.
|
||||
*/
|
||||
@Deprecated(since = "16.7", forRemoval = true)
|
||||
public static List<String> selectList(String prefix, String path, YamlConfiguration yamlConfiguration) {
|
||||
@@ -290,7 +290,7 @@ public class T2C_Config {
|
||||
/**
|
||||
* @deprecated since version 16.7
|
||||
* This method will be removed soon!
|
||||
* Please use the new {@link T2C_ConfigWriter#createConfig(File, T2CconfigItem[], String...)}.
|
||||
* Please use the new {@link T2C_ConfigWriter#createConfig(File, T2C_ConfigItem[], String...)}.
|
||||
*/
|
||||
@Deprecated(since = "16.7", forRemoval = true)
|
||||
public static void select(String prefix, List<String> value, String path, YamlConfiguration yamlConfiguration) {
|
||||
|
@@ -3,9 +3,9 @@
|
||||
package net.t2code.t2codelib.SPIGOT.api.yaml;
|
||||
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
||||
import net.t2code.t2codelib.T2CLanguageEnum;
|
||||
import net.t2code.t2codelib.T2CconfigItem;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2C_Main;
|
||||
import net.t2code.t2codelib.util.T2C_LanguageEnum;
|
||||
import net.t2code.t2codelib.util.T2C_ConfigItem;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
@@ -19,14 +19,14 @@ public class T2C_ConfigWriter {
|
||||
|
||||
private static FileConfiguration config;
|
||||
|
||||
public static void createConfig(File configFile, T2CconfigItem[] values, String... header) {
|
||||
public static void createConfig(File configFile, T2C_ConfigItem[] values, String... header) {
|
||||
boolean exist = configFile.exists();
|
||||
if (!exist) {
|
||||
configFile.getParentFile().mkdirs();
|
||||
try {
|
||||
configFile.createNewFile();
|
||||
} catch (IOException e) {
|
||||
T2C_Send.sendException(e, T2CodeLibMain.getPlugin().getLogger());
|
||||
T2C_Send.sendException(e, T2C_Main.getPlugin().getLogger());
|
||||
return;
|
||||
}
|
||||
} else exist = true;
|
||||
@@ -34,13 +34,13 @@ public class T2C_ConfigWriter {
|
||||
config = YamlConfiguration.loadConfiguration(configFile);
|
||||
Map<String, List<String>> comments = new LinkedHashMap<>();
|
||||
|
||||
T2CLanguageEnum lang = T2CLanguageEnum.english;
|
||||
T2C_LanguageEnum lang = T2C_LanguageEnum.english;
|
||||
try {
|
||||
lang = T2CLanguageEnum.valueOf(config.getString(values[0].getLanguagePath().replace(".yml", "")));
|
||||
lang = T2C_LanguageEnum.valueOf(config.getString(values[0].getLanguagePath().replace(".yml", "")));
|
||||
} catch (Exception ignore) {
|
||||
}
|
||||
|
||||
for (T2CconfigItem item : values) {
|
||||
for (T2C_ConfigItem item : values) {
|
||||
if (item.getForceSet() || !exist) {
|
||||
config.addDefault(item.getPath(), item.getValue());
|
||||
|
||||
@@ -58,8 +58,8 @@ public class T2C_ConfigWriter {
|
||||
readConfig(config, values);
|
||||
}
|
||||
|
||||
private static void readConfig(FileConfiguration config, T2CconfigItem[] values) {
|
||||
for (T2CconfigItem value : values) {
|
||||
private static void readConfig(FileConfiguration config, T2C_ConfigItem[] values) {
|
||||
for (T2C_ConfigItem value : values) {
|
||||
value.setValue(config.get(value.getPath()));
|
||||
}
|
||||
}
|
||||
|
@@ -3,9 +3,9 @@
|
||||
package net.t2code.t2codelib.SPIGOT.api.yaml;
|
||||
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
||||
import net.t2code.t2codelib.T2CLanguageEnum;
|
||||
import net.t2code.t2codelib.T2CconfigItemLanguages;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2C_Main;
|
||||
import net.t2code.t2codelib.util.T2C_LanguageEnum;
|
||||
import net.t2code.t2codelib.util.T2C_ConfigItemLanguages;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
@@ -17,14 +17,14 @@ public class T2C_LanguageWriter {
|
||||
|
||||
private static FileConfiguration config;
|
||||
|
||||
public static void createConfig(String prefix, File path, T2CconfigItemLanguages[] values, String loadConfig, boolean isReload, String... header) {
|
||||
public static void createConfig(String prefix, File path, T2C_ConfigItemLanguages[] values, String loadConfig, boolean isReload, String... header) {
|
||||
|
||||
File f = new File(path + "/languages/");
|
||||
f.mkdirs();
|
||||
File[] fileArray = f.listFiles();
|
||||
if (fileArray.length == 0) {
|
||||
List<File> zw = new ArrayList<>();
|
||||
for (T2CLanguageEnum lan : T2CLanguageEnum.values()) {
|
||||
for (T2C_LanguageEnum lan : T2C_LanguageEnum.values()) {
|
||||
if (values[0].getLanguage().containsKey(lan)) {
|
||||
zw.add(new File(path + "/languages/" + lan.name() + ".yml"));
|
||||
}
|
||||
@@ -33,9 +33,9 @@ public class T2C_LanguageWriter {
|
||||
}
|
||||
for (File langFile : fileArray) {
|
||||
if (langFile.getName().endsWith(".yml")) {
|
||||
T2CLanguageEnum lang = T2CLanguageEnum.english;
|
||||
T2C_LanguageEnum lang = T2C_LanguageEnum.english;
|
||||
try {
|
||||
lang = T2CLanguageEnum.valueOf(langFile.getName().replace(".yml", ""));
|
||||
lang = T2C_LanguageEnum.valueOf(langFile.getName().replace(".yml", ""));
|
||||
} catch (Exception ignore) {
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public class T2C_LanguageWriter {
|
||||
try {
|
||||
langFile.createNewFile();
|
||||
} catch (IOException e) {
|
||||
T2C_Send.sendException(e, T2CodeLibMain.getPlugin().getLogger());
|
||||
T2C_Send.sendException(e, T2C_Main.getPlugin().getLogger());
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -52,7 +52,7 @@ public class T2C_LanguageWriter {
|
||||
// Copy default values if they are missing
|
||||
config = YamlConfiguration.loadConfiguration(langFile);
|
||||
config.options().copyDefaults(true);
|
||||
for (T2CconfigItemLanguages item : values) {
|
||||
for (T2C_ConfigItemLanguages item : values) {
|
||||
config.addDefault(item.getPath(), item.getLanguage().get(lang));
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ public class T2C_LanguageWriter {
|
||||
readConfig(prefix, path, values, loadConfig, isReload);
|
||||
}
|
||||
|
||||
private static void readConfig(String prefix, File path, T2CconfigItemLanguages[] values, String loadConfig, boolean isReload) {
|
||||
private static void readConfig(String prefix, File path, T2C_ConfigItemLanguages[] values, String loadConfig, boolean isReload) {
|
||||
String selectMSG;
|
||||
File msg;
|
||||
msg = new File(path, "languages/" + loadConfig + ".yml");
|
||||
@@ -75,14 +75,14 @@ public class T2C_LanguageWriter {
|
||||
T2C_Send.sendStartTextCenter(prefix, "", isReload);
|
||||
T2C_Send.sendStartTextCenter(prefix, "§4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", isReload);
|
||||
T2C_Send.sendStartTextCenter(prefix, "§4The selected §c" + loadConfig + " §4language file was not found.", isReload);
|
||||
T2C_Send.sendStartTextCenter(prefix, "§6The default language §e" + T2CLanguageEnum.english.name() + " §6is used!", isReload);
|
||||
T2C_Send.sendStartTextCenter(prefix, "§6The default language §e" + T2C_LanguageEnum.english.name() + " §6is used!", isReload);
|
||||
T2C_Send.sendStartTextCenter(prefix, "§4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", isReload);
|
||||
T2C_Send.sendStartTextCenter(prefix, "", isReload);
|
||||
msg = new File(path, "languages/" + T2CLanguageEnum.english.name() + ".yml");
|
||||
selectMSG = T2CLanguageEnum.english.name();
|
||||
msg = new File(path, "languages/" + T2C_LanguageEnum.english.name() + ".yml");
|
||||
selectMSG = T2C_LanguageEnum.english.name();
|
||||
} else selectMSG = loadConfig;
|
||||
YamlConfiguration yml = YamlConfiguration.loadConfiguration(msg);
|
||||
for (T2CconfigItemLanguages value : values) {
|
||||
for (T2C_ConfigItemLanguages value : values) {
|
||||
value.setValue(yml.get(value.getPath()));
|
||||
}
|
||||
T2C_Send.sendStartTextCenter(prefix, "§2Language successfully selected to: §6" + selectMSG, isReload);
|
||||
|
@@ -3,7 +3,7 @@ package net.t2code.t2codelib.SPIGOT.system;
|
||||
import net.t2code.t2codelib.SPIGOT.api.debug.T2C_Debug;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.config.T2C_LibConfig;
|
||||
import net.t2code.t2codelib.Util;
|
||||
import net.t2code.t2codelib.util.T2C_Util;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -31,16 +31,16 @@ public class BungeeCommandSenderReceiver {
|
||||
output.writeUTF(information);
|
||||
output.writeUTF(String.valueOf(T2C_LibConfig.VALUES.serverUUID.getValue()));
|
||||
} catch (IOException e) {
|
||||
T2C_Send.sendException(e, T2CodeLibMain.getPlugin().getLogger());
|
||||
T2C_Send.sendException(e, T2C_Main.getPlugin().getLogger());
|
||||
}
|
||||
if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
player.sendPluginMessage(T2CodeLibMain.getPlugin(), Util.getPluginChannel_ProxyCommand(), stream.toByteArray());
|
||||
T2C_Debug.debug(T2CodeLibMain.getPlugin(), "PluginMessage received T2CbungeeCommandSenderReciver: "+Util.getPluginChannel_ProxyCommand()+" - " + Arrays.toString(stream.toByteArray()) + " Player: " + player.getName());
|
||||
player.sendPluginMessage(T2C_Main.getPlugin(), T2C_Util.getPluginChannel_ProxyCommand(), stream.toByteArray());
|
||||
T2C_Debug.debug(T2C_Main.getPlugin(), "PluginMessage received T2CbungeeCommandSenderReciver: "+ T2C_Util.getPluginChannel_ProxyCommand()+" - " + Arrays.toString(stream.toByteArray()) + " Player: " + player.getName());
|
||||
} else {
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
player.sendPluginMessage(T2CodeLibMain.getPlugin(), Util.getPluginChannel_ProxyCommand(), stream.toByteArray());
|
||||
T2C_Debug.debug(T2CodeLibMain.getPlugin(), "PluginMessage received T2CbungeeCommandSenderReciver: "+Util.getPluginChannel_ProxyCommand()+" - " + Arrays.toString(stream.toByteArray()) + " Player: " + player.getName());
|
||||
player.sendPluginMessage(T2C_Main.getPlugin(), T2C_Util.getPluginChannel_ProxyCommand(), stream.toByteArray());
|
||||
T2C_Debug.debug(T2C_Main.getPlugin(), "PluginMessage received T2CbungeeCommandSenderReciver: "+ T2C_Util.getPluginChannel_ProxyCommand()+" - " + Arrays.toString(stream.toByteArray()) + " Player: " + player.getName());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@@ -3,7 +3,7 @@
|
||||
package net.t2code.t2codelib.SPIGOT.system;
|
||||
|
||||
import net.t2code.t2codelib.SPIGOT.api.update.T2C_UpdateAPI;
|
||||
import net.t2code.t2codelib.Util;
|
||||
import net.t2code.t2codelib.util.T2C_Util;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerLoginEvent;
|
||||
@@ -12,6 +12,6 @@ public class JoinEvent implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onJoinEvent(PlayerLoginEvent event) {
|
||||
T2C_UpdateAPI.join(T2CodeLibMain.getPlugin(), Util.getPrefix(),"t2code.lib.updatemsg",event.getPlayer(),Util.getSpigotID(),Util.getDiscord());
|
||||
T2C_UpdateAPI.join(T2C_Main.getPlugin(), T2C_Util.getPrefix(),"t2code.lib.updatemsg",event.getPlayer(), T2C_Util.getSpigotID(), T2C_Util.getDiscord());
|
||||
}
|
||||
}
|
@@ -20,21 +20,19 @@ import net.t2code.t2codelib.SPIGOT.system.cmd.Development;
|
||||
import net.t2code.t2codelib.SPIGOT.system.cmd.ReportLogStorage;
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.config.T2C_LibConfig;
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.languages.T2CLibLanguages;
|
||||
import net.t2code.t2codelib.T2CplatformDetector;
|
||||
import net.t2code.t2codelib.Util;
|
||||
import net.t2code.t2codelib.util.T2C_PlatformDetector;
|
||||
import net.t2code.t2codelib.util.T2C_Util;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public final class T2CodeLibMain extends JavaPlugin {
|
||||
public final class T2C_Main extends JavaPlugin {
|
||||
@Getter
|
||||
private static T2CodeLibMain plugin;
|
||||
private static T2C_Main plugin;
|
||||
@Getter
|
||||
private static Economy eco = null;
|
||||
@Getter
|
||||
@@ -49,12 +47,11 @@ public final class T2CodeLibMain extends JavaPlugin {
|
||||
private static Boolean mmIsLoad = true;
|
||||
@Getter
|
||||
private static Boolean load = false;
|
||||
@Getter
|
||||
private static T2CplatformDetector.PlatformType plattform;
|
||||
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
T2C_PlatformDetector.scan();
|
||||
// Plugin startup logic
|
||||
plugin = this;
|
||||
autor = plugin.getDescription().getAuthors();
|
||||
@@ -66,15 +63,15 @@ public final class T2CodeLibMain extends JavaPlugin {
|
||||
} catch (Exception e) {
|
||||
mmIsLoad = false;
|
||||
}
|
||||
plattform = T2CplatformDetector.detectPlatform();
|
||||
|
||||
load();
|
||||
}
|
||||
|
||||
private void load() {
|
||||
long long_ = T2C_Template.onLoadHeader(Util.getPrefix(), autor, version, Util.getSpigot(), Util.getDiscord());
|
||||
long long_ = T2C_Template.onLoadHeader(T2C_Util.getPrefix(), autor, version, T2C_Util.getSpigot(), T2C_Util.getDiscord());
|
||||
|
||||
checkIsBungee();
|
||||
String prefix = Util.getPrefix();
|
||||
String prefix = T2C_Util.getPrefix();
|
||||
|
||||
try {
|
||||
Vault.loadVault();
|
||||
@@ -120,11 +117,11 @@ public final class T2CodeLibMain extends JavaPlugin {
|
||||
}
|
||||
}
|
||||
T2C_Template.onLoadSeparateStroke(prefix);
|
||||
T2C_Send.sendStartTextCenter(prefix, "§2Server run on:", true);
|
||||
T2C_Send.sendStartTextCenter(prefix, "§3NMS: §6" + T2C_McVersion.getNms(), true);
|
||||
T2C_Send.sendStartTextCenter(prefix, "§3Platform: §6" + plattform.name(), true);
|
||||
T2C_Send.sendStartTextCenter(prefix, "§3Bukkit Version: §6" + T2C_McVersion.getBukkitVersion(), true);
|
||||
T2C_Send.sendStartTextCenter(prefix, "§3Server Version: §6" + T2C_McVersion.getMcVersion(), true);
|
||||
T2C_Send.sendStartTextCenter(prefix, "§2Server run on:", false);
|
||||
T2C_Send.sendStartTextCenter(prefix, "§3NMS: §6" + T2C_McVersion.getNms(), false);
|
||||
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_Template.onLoadSeparateStroke(prefix);
|
||||
if (eco != null) {
|
||||
@@ -132,26 +129,26 @@ public final class T2CodeLibMain extends JavaPlugin {
|
||||
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" +
|
||||
(System.currentTimeMillis() - long_) + "ms", true);
|
||||
(System.currentTimeMillis() - long_) + "ms", false);
|
||||
} else
|
||||
T2C_Send.sendStartTextCenter(prefix, "§3Economy: §6" + eco.getName() + " §7- §e" + (System.currentTimeMillis() - long_) + "ms", true);
|
||||
T2C_Send.sendStartTextCenter(prefix, "§3Economy: §6" + eco.getName() + " §7- §e" + (System.currentTimeMillis() - long_) + "ms", false);
|
||||
} else
|
||||
T2C_Send.sendStartTextCenter(prefix, "§3Economy: §4not connected via vault!" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms", true);
|
||||
T2C_Send.sendStartTextCenter(prefix, "§3Economy: §4not connected via vault!" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms", false);
|
||||
|
||||
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()
|
||||
+ " §7- §e" + (System.currentTimeMillis() - long_) + "ms", true);
|
||||
+ " §7- §e" + (System.currentTimeMillis() - long_) + "ms", false);
|
||||
} else
|
||||
T2C_Send.sendStartTextCenter(prefix, "§3Permission plugin: §6" + perm.getName() + " - §7- §e" + (System.currentTimeMillis() - long_) + "ms", true);
|
||||
T2C_Send.sendStartTextCenter(prefix, "§3Permission plugin: §6" + perm.getName() + " - §7- §e" + (System.currentTimeMillis() - long_) + "ms", false);
|
||||
} else
|
||||
T2C_Send.sendStartTextCenter(prefix, "§3Permission plugin: §4not connected via vault!" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms", true);
|
||||
T2C_Send.sendStartTextCenter(prefix, "§3Permission plugin: §4not connected via vault!" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms", false);
|
||||
|
||||
if (T2C_PluginCheck.papi()) {
|
||||
T2C_Send.sendStartTextCenter(prefix, "§3PlaceholderAPI: §6connected" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms", true);
|
||||
T2C_Send.sendStartTextCenter(prefix, "§3PlaceholderAPI: §6connected" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms", false);
|
||||
}
|
||||
|
||||
T2C_Send.sendStartTextCenter(prefix, "§3Kyori MiniMessage Support: " + (getMmIsLoad() ? "§2load" : "§4not load") + " §7- §e" + (System.currentTimeMillis() - long_) + "ms", true);
|
||||
T2C_Send.sendStartTextCenter(prefix, "§3Kyori MiniMessage Support: " + (getMmIsLoad() ? "§2load" : "§4not load") + " §7- §e" + (System.currentTimeMillis() - long_) + "ms", false);
|
||||
|
||||
|
||||
plugin.getCommand("t2code").setExecutor(new CmdExecuter());
|
||||
@@ -163,22 +160,22 @@ public final class T2CodeLibMain extends JavaPlugin {
|
||||
T2CLibLanguages.set(false);
|
||||
|
||||
T2C_Template.onLoadSeparateStroke(prefix);
|
||||
T2C_Send.sendStartTextCenter(prefix, "§3Use Proxy: §6" + (boolean) T2C_LibConfig.VALUES.proxy.getValue(), true);
|
||||
T2C_Send.sendStartTextCenter(prefix, "§3serverUUID: §6" + T2C_LibConfig.VALUES.serverUUID.getValue(), true);
|
||||
T2C_Send.sendStartTextCenter(prefix, "§3Use Proxy: §6" + (boolean) T2C_LibConfig.VALUES.proxy.getValue(), false);
|
||||
T2C_Send.sendStartTextCenter(prefix, "§3serverUUID: §6" + T2C_LibConfig.VALUES.serverUUID.getValue(), false);
|
||||
|
||||
T2C_UpdateAPI.onUpdateCheck(plugin, prefix, Util.getGit(), Util.getSpigotID(), Util.getDiscord(),
|
||||
T2C_UpdateAPI.onUpdateCheck(plugin, prefix, T2C_Util.getGit(), T2C_Util.getSpigotID(), T2C_Util.getDiscord(),
|
||||
(boolean) T2C_LibConfig.VALUES.updateCheckOnJoin.getValue(),
|
||||
(boolean) T2C_LibConfig.VALUES.seePreReleaseUpdates.getValue(),
|
||||
(int) T2C_LibConfig.VALUES.updateCheckTimeInterval.getValue());
|
||||
Metrics.Bstats(plugin, Util.getBstatsID());
|
||||
Metrics.Bstats(plugin, T2C_Util.getBstatsID());
|
||||
if ((boolean) T2C_LibConfig.VALUES.proxy.getValue()) {
|
||||
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, Util.getPluginChannel_ProxyCommand());
|
||||
T2C_Debug.debug(plugin, "registerIncomingPluginChannel §e" + Util.getPluginChannel_ProxyCommand());
|
||||
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, T2C_Util.getPluginChannel_ProxyCommand());
|
||||
T2C_Debug.debug(plugin, "registerIncomingPluginChannel §e" + T2C_Util.getPluginChannel_ProxyCommand());
|
||||
|
||||
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, Util.getPluginChannel_ProxyOnlinePlayers());
|
||||
if (!Bukkit.getMessenger().isIncomingChannelRegistered(plugin, Util.getPluginChannel_ProxyOnlinePlayers())) {
|
||||
T2C_Debug.debug(plugin, "registerIncomingPluginChannel §e" + Util.getPluginChannel_ProxyOnlinePlayers());
|
||||
Bukkit.getMessenger().registerIncomingPluginChannel(plugin, Util.getPluginChannel_ProxyOnlinePlayers(), new T2C_BungeePlayers());
|
||||
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, T2C_Util.getPluginChannel_ProxyOnlinePlayers());
|
||||
if (!Bukkit.getMessenger().isIncomingChannelRegistered(plugin, T2C_Util.getPluginChannel_ProxyOnlinePlayers())) {
|
||||
T2C_Debug.debug(plugin, "registerIncomingPluginChannel §e" + T2C_Util.getPluginChannel_ProxyOnlinePlayers());
|
||||
Bukkit.getMessenger().registerIncomingPluginChannel(plugin, T2C_Util.getPluginChannel_ProxyOnlinePlayers(), new T2C_BungeePlayers());
|
||||
T2C_BungeePlayers.callAllBungeePlayers();
|
||||
}
|
||||
}
|
||||
@@ -202,7 +199,7 @@ public final class T2CodeLibMain extends JavaPlugin {
|
||||
}
|
||||
|
||||
Vault.vaultDisable();
|
||||
T2C_Template.onDisable(Util.getPrefix(), this);
|
||||
T2C_Template.onDisable(T2C_Util.getPrefix(), this);
|
||||
if (mmIsLoad) {
|
||||
if (this.adventure != null) {
|
||||
this.adventure.close();
|
||||
@@ -216,11 +213,11 @@ public final class T2CodeLibMain extends JavaPlugin {
|
||||
}
|
||||
|
||||
static void setEco(Economy eco) {
|
||||
T2CodeLibMain.eco = eco;
|
||||
T2C_Main.eco = eco;
|
||||
}
|
||||
|
||||
static void setPerm(Permission perm) {
|
||||
T2CodeLibMain.perm = perm;
|
||||
T2C_Main.perm = perm;
|
||||
}
|
||||
|
||||
private static BukkitAudiences adventure;
|
@@ -3,7 +3,7 @@ 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.T2C_Send;
|
||||
import net.t2code.t2codelib.Util;
|
||||
import net.t2code.t2codelib.util.T2C_Util;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
|
||||
import java.util.Objects;
|
||||
@@ -15,37 +15,37 @@ public class Vault {
|
||||
|
||||
public static void loadVault() throws InterruptedException {
|
||||
long long_ = System.currentTimeMillis();
|
||||
if (T2CodeLibMain.getPlugin().getServer().getPluginManager().getPlugin("Vault") != null && Objects.requireNonNull(T2CodeLibMain.getPlugin().getServer().getPluginManager().getPlugin("Vault")).isEnabled()) {
|
||||
if (T2C_Main.getPlugin().getServer().getPluginManager().getPlugin("Vault") != null && Objects.requireNonNull(T2C_Main.getPlugin().getServer().getPluginManager().getPlugin("Vault")).isEnabled()) {
|
||||
vaultEnable = true;
|
||||
RegisteredServiceProvider<Economy> eco = T2CodeLibMain.getPlugin().getServer().getServicesManager().getRegistration(Economy.class);
|
||||
RegisteredServiceProvider<Economy> eco = T2C_Main.getPlugin().getServer().getServicesManager().getRegistration(Economy.class);
|
||||
if (eco != null) {
|
||||
T2CodeLibMain.setEco(eco.getProvider());
|
||||
if (T2CodeLibMain.getEco() != null) {
|
||||
T2C_Main.setEco(eco.getProvider());
|
||||
if (T2C_Main.getEco() != null) {
|
||||
connected = true;
|
||||
|
||||
T2C_Send.sendStartTextCenter(Util.getPrefix(), " §2Vault / Economy successfully connected!" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms", true);
|
||||
T2C_Send.sendStartTextCenter(T2C_Util.getPrefix(), " §2Vault / Economy successfully connected!" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms", false);
|
||||
} else {
|
||||
connected = false;
|
||||
T2C_Send.sendStartTextCenter(Util.getPrefix(), " §4Economy could not be connected / found! [1]" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms", true);
|
||||
T2C_Send.sendStartTextCenter(T2C_Util.getPrefix(), " §4Economy could not be connected / found! [1]" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms", false);
|
||||
}
|
||||
} else {
|
||||
connected = false;
|
||||
T2C_Send.sendStartTextCenter(Util.getPrefix(), " §4Economy could not be connected / found! [2]" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms", true);
|
||||
T2C_Send.sendStartTextCenter(T2C_Util.getPrefix(), " §4Economy could not be connected / found! [2]" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms", false);
|
||||
}
|
||||
RegisteredServiceProvider<Permission> perm = T2CodeLibMain.getPlugin().getServer().getServicesManager().getRegistration(Permission.class);
|
||||
RegisteredServiceProvider<Permission> perm = T2C_Main.getPlugin().getServer().getServicesManager().getRegistration(Permission.class);
|
||||
if (perm != null) {
|
||||
T2CodeLibMain.setPerm(perm.getProvider());
|
||||
T2C_Main.setPerm(perm.getProvider());
|
||||
}
|
||||
} else {
|
||||
vaultEnable = false;
|
||||
connected = false;
|
||||
T2C_Send.sendStartTextCenter(Util.getPrefix()," §4Vault could not be connected! [3]" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms", true);
|
||||
T2C_Send.sendStartTextCenter(T2C_Util.getPrefix()," §4Vault could not be connected! [3]" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms", false);
|
||||
}
|
||||
}
|
||||
|
||||
public static void vaultDisable() {
|
||||
if (!connected) return;
|
||||
connected = false;
|
||||
T2C_Send.sendStartTextCenter(Util.getPrefix(), " §4Vault / Economy successfully deactivated.", true);
|
||||
T2C_Send.sendStartTextCenter(T2C_Util.getPrefix(), " §4Vault / Economy successfully deactivated.", false);
|
||||
}
|
||||
}
|
||||
|
@@ -4,11 +4,11 @@ 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.T2CodeLibMain;
|
||||
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;
|
||||
import net.t2code.t2codelib.T2CupdateObject;
|
||||
import net.t2code.t2codelib.Util;
|
||||
import net.t2code.t2codelib.util.T2C_UpdateObject;
|
||||
import net.t2code.t2codelib.util.T2C_Util;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@@ -72,7 +72,7 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
|
||||
}
|
||||
T2C_LibConfig.set(true);
|
||||
T2CLibLanguages.set(true);
|
||||
T2C_Send.sender(sender, Util.getPrefix() + " §2Config successfully reloaded");
|
||||
T2C_Send.sender(sender, T2C_Util.getPrefix() + " §2Config successfully reloaded");
|
||||
return false;
|
||||
case "debug":
|
||||
if (!sender.hasPermission("t2code.admin")) {
|
||||
@@ -94,7 +94,7 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
|
||||
return false;
|
||||
}
|
||||
T2C_Send.sender(sender, ("[prefix] <red>T2C ServerID:</red> <gold><hover:show_text:'<yellow>copy</yellow>'>" +
|
||||
"<click:copy_to_clipboard:[id]>[id]</click></hover></gold>").replace("[prefix]", Util.getPrefix()).replace("[id]", String.valueOf(T2C_LibConfig.VALUES.serverUUID.getValue())));
|
||||
"<click:copy_to_clipboard:[id]>[id]</click></hover></gold>").replace("[prefix]", T2C_Util.getPrefix()).replace("[id]", String.valueOf(T2C_LibConfig.VALUES.serverUUID.getValue())));
|
||||
return false;
|
||||
case "bcmd":
|
||||
if (!sender.hasPermission("t2code.admin")) {
|
||||
@@ -107,7 +107,7 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
|
||||
}
|
||||
cmd = cmd.replace("bcmd ", "");
|
||||
BungeeCommandSenderReceiver.sendToBungee(null, cmd, true);
|
||||
T2C_Debug.debug(T2CodeLibMain.getPlugin(), "PluginMessage BCMD: " + cmd);
|
||||
T2C_Debug.debug(T2C_Main.getPlugin(), "PluginMessage BCMD: " + cmd);
|
||||
return false;
|
||||
|
||||
default:
|
||||
@@ -161,7 +161,7 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
|
||||
if (args.length == 2 && args[0].equalsIgnoreCase("updateinfo")) {
|
||||
if (sender.hasPermission("t2code.admin")) {
|
||||
if (hasPermission(p, arg1.get("updateinfo"))) {
|
||||
for (Map.Entry<String, T2CupdateObject> pl : T2C_UpdateAPI.pluginVersions.entrySet()) {
|
||||
for (Map.Entry<String, T2C_UpdateObject> pl : T2C_UpdateAPI.pluginVersions.entrySet()) {
|
||||
if (passend(pl.getValue().pluginName, args[1])) list.add(pl.getValue().pluginName);
|
||||
}
|
||||
}
|
||||
|
@@ -4,9 +4,9 @@ import net.t2code.t2codelib.SPIGOT.api.commands.T2C_Cmd;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Template;
|
||||
import net.t2code.t2codelib.SPIGOT.api.update.T2C_UpdateAPI;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2C_Main;
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.config.T2C_LibConfig;
|
||||
import net.t2code.t2codelib.Util;
|
||||
import net.t2code.t2codelib.util.T2C_Util;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -15,11 +15,12 @@ import java.io.IOException;
|
||||
|
||||
public class Commands {
|
||||
protected static void info(CommandSender sender) {
|
||||
T2C_Template.sendInfo(sender, T2CodeLibMain.getPlugin(), Util.getSpigotID(), Util.getDiscord(), null, Util.getInfoText());
|
||||
assert T2C_Main.getPlugin().getDescription().getDescription() != null;
|
||||
T2C_Template.sendInfo(sender, T2C_Main.getPlugin(), T2C_Util.getSpigotID(), T2C_Util.getDiscord(), null, T2C_Util.getInfoText().replace("[getDescription()]",T2C_Main.getPlugin().getDescription().getDescription()));
|
||||
}
|
||||
|
||||
protected static void test(CommandSender sender, String[] args) {
|
||||
T2C_Send.sender(sender, Util.getPrefix() + " &4Currently there is no development test command");
|
||||
T2C_Send.sender(sender, T2C_Util.getPrefix() + " &4Currently there is no development test command");
|
||||
}
|
||||
|
||||
protected static void debug(CommandSender sender, String[] args) {
|
||||
@@ -46,13 +47,13 @@ public class Commands {
|
||||
break;
|
||||
case 3:
|
||||
Boolean upload = args[2].equalsIgnoreCase("confirmupload");
|
||||
Bukkit.getScheduler().runTaskAsynchronously(T2CodeLibMain.getPlugin(), new Runnable() {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(T2C_Main.getPlugin(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
CreateReportLog.create(sender, upload);
|
||||
} catch (IOException e) {
|
||||
T2C_Send.sender(sender, Util.getPrefix() + " <red>An error occurred while creating a report log! Please look in the console!</red>");
|
||||
T2C_Send.sender(sender, T2C_Util.getPrefix() + " <red>An error occurred while creating a report log! Please look in the console!</red>");
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
@@ -4,9 +4,9 @@ import net.t2code.luckyBox.api.LuckyBoxAPI;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
||||
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2C_McVersion;
|
||||
import net.t2code.t2codelib.SPIGOT.api.plugins.T2C_PluginCheck;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2C_Main;
|
||||
import net.t2code.t2codelib.SPIGOT.system.Vault;
|
||||
import net.t2code.t2codelib.Util;
|
||||
import net.t2code.t2codelib.util.T2C_Util;
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.HttpClient;
|
||||
@@ -37,10 +37,10 @@ import java.util.zip.ZipOutputStream;
|
||||
|
||||
public class CreateReportLog {
|
||||
protected static void create(CommandSender sender, Boolean confirmUpload) throws IOException {
|
||||
T2C_Send.sender(sender, Util.getPrefix() + " §6A DebugLog is created...");
|
||||
T2C_Send.sender(sender, T2C_Util.getPrefix() + " §6A DebugLog is created...");
|
||||
String timeStampFile = new SimpleDateFormat("HH_mm_ss-dd_MM_yyyy").format(Calendar.getInstance().getTime());
|
||||
|
||||
File directory = new File(T2CodeLibMain.getPath() + "/DebugLogs");
|
||||
File directory = new File(T2C_Main.getPath() + "/DebugLogs");
|
||||
File directoryTemp = new File("T2CDebugLogsTemp");
|
||||
if (!directory.exists()) {
|
||||
directory.mkdir();
|
||||
@@ -60,7 +60,7 @@ 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: " + T2CodeLibMain.getIsBungee());
|
||||
pWriter.println("Bungee Mode: " + T2C_Main.getIsBungee());
|
||||
pWriter.println("Server Port: " + Bukkit.getServer().getPort());
|
||||
pWriter.println();
|
||||
pWriter.println("Worlds: " + Bukkit.getWorlds());
|
||||
@@ -73,18 +73,18 @@ public class CreateReportLog {
|
||||
pWriter.println("Vault: " + Bukkit.getPluginManager().getPlugin("Vault").getName() + " - " + Bukkit.getPluginManager().getPlugin("Vault")
|
||||
.getDescription().getVersion());
|
||||
} else pWriter.println("Vault: not connected");
|
||||
if (T2CodeLibMain.getEco() != null) {
|
||||
String st = T2CodeLibMain.getEco().getName();
|
||||
if (T2CodeLibMain.getEco().getName().equals("CMIEconomy")) st = "CMI";
|
||||
if (T2C_Main.getEco() != null) {
|
||||
String st = T2C_Main.getEco().getName();
|
||||
if (T2C_Main.getEco().getName().equals("CMIEconomy")) st = "CMI";
|
||||
if (Bukkit.getPluginManager().getPlugin(st) != null) {
|
||||
pWriter.println("Economy: " + T2CodeLibMain.getEco().isEnabled() + " - " + st + " - " + Bukkit.getPluginManager().getPlugin(st).getDescription().getVersion());
|
||||
} else pWriter.println("Economy: " + T2CodeLibMain.getEco().isEnabled() + " - " + st);
|
||||
pWriter.println("Economy: " + T2C_Main.getEco().isEnabled() + " - " + st + " - " + Bukkit.getPluginManager().getPlugin(st).getDescription().getVersion());
|
||||
} else pWriter.println("Economy: " + T2C_Main.getEco().isEnabled() + " - " + st);
|
||||
} else pWriter.println("Economy: not connected via vault");
|
||||
if (T2CodeLibMain.getPerm() != null) {
|
||||
if (Bukkit.getPluginManager().getPlugin(T2CodeLibMain.getPerm().getName()) != null) {
|
||||
pWriter.println("Permission: " + T2CodeLibMain.getPerm().isEnabled() + " - " + T2CodeLibMain.getPerm().getName() + " - " + Bukkit.getPluginManager()
|
||||
.getPlugin(T2CodeLibMain.getPerm().getName()).getDescription().getVersion());
|
||||
} else pWriter.println("Permission: " + T2CodeLibMain.getPerm().isEnabled() + " - " + T2CodeLibMain.getPerm().getName());
|
||||
if (T2C_Main.getPerm() != null) {
|
||||
if (Bukkit.getPluginManager().getPlugin(T2C_Main.getPerm().getName()) != null) {
|
||||
pWriter.println("Permission: " + T2C_Main.getPerm().isEnabled() + " - " + T2C_Main.getPerm().getName() + " - " + Bukkit.getPluginManager()
|
||||
.getPlugin(T2C_Main.getPerm().getName()).getDescription().getVersion());
|
||||
} else pWriter.println("Permission: " + T2C_Main.getPerm().isEnabled() + " - " + T2C_Main.getPerm().getName());
|
||||
} else pWriter.println("Permission: not connected via vault");
|
||||
pWriter.println();
|
||||
pWriter.println("Java: " + System.getProperty("java.version"));
|
||||
@@ -92,7 +92,7 @@ public class CreateReportLog {
|
||||
pWriter.println("System: " + System.getProperty("os.version"));
|
||||
pWriter.println("User Home: " + System.getProperty("user.home"));
|
||||
pWriter.println();
|
||||
pWriter.println("T2CodeLib: " + T2CodeLibMain.getPlugin().getDescription().getVersion());
|
||||
pWriter.println("T2CodeLib: " + T2C_Main.getPlugin().getDescription().getVersion());
|
||||
pWriter.println();
|
||||
if (T2C_PluginCheck.luckyBox()) {
|
||||
pWriter.println("T2C-PremiumPlugins: ");
|
||||
@@ -133,7 +133,7 @@ public class CreateReportLog {
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
T2C_Send.sendException(e, T2CodeLibMain.getPlugin().getLogger());
|
||||
T2C_Send.sendException(e, T2C_Main.getPlugin().getLogger());
|
||||
} finally {
|
||||
if (pWriter != null) {
|
||||
pWriter.flush();
|
||||
@@ -159,7 +159,7 @@ public class CreateReportLog {
|
||||
zip.closeEntry();
|
||||
zip.close();
|
||||
} catch (IOException e) {
|
||||
T2C_Send.sendException(e, T2CodeLibMain.getPlugin().getLogger());
|
||||
T2C_Send.sendException(e, T2C_Main.getPlugin().getLogger());
|
||||
}
|
||||
file.delete();
|
||||
File zipFile = new File(zipPath);
|
||||
@@ -169,9 +169,9 @@ public class CreateReportLog {
|
||||
zipFile.delete();
|
||||
directoryTemp.delete();
|
||||
if (sender instanceof Player) {
|
||||
T2C_Send.sender(sender, Util.getPrefix() + " §6A DebugLog zip has been created. you can find it on in the files on your server under the path: §e" + directory + "/" + zipFile.getName());
|
||||
T2C_Send.sender(sender, T2C_Util.getPrefix() + " §6A DebugLog zip has been created. you can find it on in the files on your server under the path: §e" + directory + "/" + zipFile.getName());
|
||||
}
|
||||
T2C_Send.console(Util.getPrefix() + " §6A DebugLog zip has been created. you can find it on in the files on your server under the path: §e" + directory + "/" + zipFile.getName());
|
||||
T2C_Send.console(T2C_Util.getPrefix() + " §6A DebugLog zip has been created. you can find it on in the files on your server under the path: §e" + directory + "/" + zipFile.getName());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -199,9 +199,9 @@ public class CreateReportLog {
|
||||
"<br>[prefix] <dark_red>Do not share the download URL with anyone!</dark_red>" +
|
||||
"<br>[prefix] <click:run_command:'/t2code debug deleteReportLog [key]'><hover:show_text:'<yellow>Click to delete</yellow>'><green>You can <b>delete</b> your Debug-File by clicking me.</green>" +
|
||||
"<br>[prefix] <color:#910d06>(If you do not delete the debug file, it will be deleted automatically after <red>14</red> days!)</color></click></hover>")
|
||||
.replace("[key]", fileID).replace("[url]", downloadURL).replace("[prefix]", Util.getPrefix()));
|
||||
.replace("[key]", fileID).replace("[url]", downloadURL).replace("[prefix]", T2C_Util.getPrefix()));
|
||||
}
|
||||
T2C_Send.console(Util.getPrefix() + (" <gold>A DebugLog zip has been created. You can download it here:</gold> <yellow>[url]</yellow>" +
|
||||
T2C_Send.console(T2C_Util.getPrefix() + (" <gold>A DebugLog zip has been created. You can download it here:</gold> <yellow>[url]</yellow>" +
|
||||
"<br><gold>Please enter the following key in the ticket:</gold> <yellow>[key]</yellow>." +
|
||||
"<br><dark_red>Do not share the download URL with anyone!</dark_red>" +
|
||||
"<br><color:#910d06>(If you do not delete the debug file, it will be deleted automatically after <red>14</red> days!)</color>" +
|
||||
@@ -231,7 +231,7 @@ public class CreateReportLog {
|
||||
private static void pluginToDebug(ZipOutputStream zip) throws IOException {
|
||||
for (Plugin plugin : Bukkit.getPluginManager().getPlugins()) {
|
||||
String plName = plugin.getDescription().getName();
|
||||
if (plName.contains("T2C-") || Util.getT2cPlugins().contains(plName) || plugin.getDescription().getAuthors().contains("JaTiTV")) {
|
||||
if (plName.contains("T2C-") || T2C_Util.getT2cPlugins().contains(plName) || plugin.getDescription().getAuthors().contains("JaTiTV")) {
|
||||
File plConfigs = new File(plugin.getDataFolder().getPath());
|
||||
if (plConfigs.exists()) {
|
||||
addFolderToZip("T2Code-Plugins", plugin.getDataFolder().getPath(), zip);
|
||||
|
@@ -3,7 +3,7 @@ package net.t2code.t2codelib.SPIGOT.system.cmd;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
||||
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2C_McVersion;
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.config.T2C_LibConfig;
|
||||
import net.t2code.t2codelib.Util;
|
||||
import net.t2code.t2codelib.util.T2C_Util;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@@ -28,7 +28,7 @@ public class Development implements Listener {
|
||||
return;
|
||||
}
|
||||
if (!(boolean) T2C_LibConfig.VALUES.developerTool.getValue()) {
|
||||
T2C_Send.player(e.getPlayer(), Util.getPrefix() + " The Development Tool is disabled.");
|
||||
T2C_Send.player(e.getPlayer(), T2C_Util.getPrefix() + " The Development Tool is disabled.");
|
||||
}
|
||||
e.setCancelled(true);
|
||||
t2cPls(e.getPlayer());
|
||||
@@ -56,10 +56,10 @@ public class Development implements Listener {
|
||||
plSt = "<click:open_url:'" + plugin.getDescription().getWebsite() + "'>" + plSt + "</click>";
|
||||
}
|
||||
if (plugin.isEnabled()) {
|
||||
if (plName.contains("T2C-") || Util.getT2cPlugins().contains(plName)) {
|
||||
if (plName.contains("T2C-") || T2C_Util.getT2cPlugins().contains(plName)) {
|
||||
msg = msg + "<dark_green>" + plSt + "</dark_green>, ";
|
||||
} else msg = msg + "<green>" + plSt + "</green>, ";
|
||||
} else if (plName.contains("T2C-") || Util.getT2cPlugins().contains(plName)) {
|
||||
} else if (plName.contains("T2C-") || T2C_Util.getT2cPlugins().contains(plName)) {
|
||||
msg = msg + "<dark_red>" + plSt + "</dark_red>, ";
|
||||
} else msg = msg + "<red>" + plSt + "</red>, ";
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package net.t2code.t2codelib.SPIGOT.system.cmd;
|
||||
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2C_Main;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
@@ -12,7 +12,7 @@ import java.util.List;
|
||||
public class ReportLogStorage {
|
||||
public static List<String> list = new ArrayList<>();
|
||||
|
||||
protected static File config = new File(T2CodeLibMain.getPath(), "/DebugLogs/T2CodeReportKeys.yml");
|
||||
protected static File config = new File(T2C_Main.getPath(), "/DebugLogs/T2CodeReportKeys.yml");
|
||||
protected static YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||
|
||||
public static void add(String key) {
|
||||
@@ -32,7 +32,7 @@ public class ReportLogStorage {
|
||||
try {
|
||||
yamlConfiguration.save(config);
|
||||
} catch (IOException e) {
|
||||
T2C_Send.sendException(e, T2CodeLibMain.getPlugin().getLogger());
|
||||
T2C_Send.sendException(e, T2C_Main.getPlugin().getLogger());
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package net.t2code.t2codelib.SPIGOT.system.config.config;
|
||||
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
||||
import net.t2code.t2codelib.T2CconfigItem;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2C_Main;
|
||||
import net.t2code.t2codelib.util.T2C_ConfigItem;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
@@ -12,7 +12,7 @@ public class ConvertT2ClibConfig {
|
||||
|
||||
|
||||
public static void convert() {
|
||||
File config = new File(T2CodeLibMain.getPath(), "config.yml");
|
||||
File config = new File(T2C_Main.getPath(), "config.yml");
|
||||
yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||
|
||||
if (!config.exists()) return;
|
||||
@@ -32,7 +32,7 @@ public class ConvertT2ClibConfig {
|
||||
config.delete();
|
||||
}
|
||||
|
||||
private static void set(String path, T2CconfigItem item){
|
||||
private static void set(String path, T2C_ConfigItem item){
|
||||
if (yamlConfiguration.contains(path)){
|
||||
item.setValue(yamlConfiguration.get(path));
|
||||
}
|
||||
|
@@ -2,113 +2,113 @@ 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.T2CLanguageEnum;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
||||
import net.t2code.t2codelib.T2CconfigItem;
|
||||
import net.t2code.t2codelib.Util;
|
||||
import net.t2code.t2codelib.util.T2C_LanguageEnum;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2C_Main;
|
||||
import net.t2code.t2codelib.util.T2C_ConfigItem;
|
||||
import net.t2code.t2codelib.util.T2C_Util;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
||||
public class T2C_LibConfig {
|
||||
|
||||
public enum VALUES implements T2CconfigItem {
|
||||
public enum VALUES implements T2C_ConfigItem {
|
||||
|
||||
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(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<>() {{
|
||||
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(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<>() {{
|
||||
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(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<>() {{
|
||||
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."));
|
||||
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<>() {{
|
||||
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!"));
|
||||
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<>() {{
|
||||
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(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<>() {{
|
||||
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(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<>() {{
|
||||
put(T2CLanguageEnum.german, List.of());
|
||||
put(T2CLanguageEnum.english, List.of());
|
||||
put(T2C_LanguageEnum.german, List.of());
|
||||
put(T2C_LanguageEnum.english, List.of());
|
||||
}}),
|
||||
proxy("proxy.enable", T2CodeLibMain.getIsBungee(), true,
|
||||
proxy("proxy.enable", T2C_Main.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."
|
||||
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(T2CLanguageEnum.english, List.of("This option must be activated if you use the T2CodeLib on a BungeeCord, Waterfall or Velocity Proxy as a bridge."
|
||||
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<>() {{
|
||||
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!"));
|
||||
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<>() {{
|
||||
put(T2CLanguageEnum.german, List.of());
|
||||
put(T2CLanguageEnum.english, List.of());
|
||||
put(T2C_LanguageEnum.german, List.of());
|
||||
put(T2C_LanguageEnum.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.",
|
||||
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(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.",
|
||||
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.",
|
||||
"(This does not mean the entire network if a proxy is used)"));
|
||||
|
||||
}}),
|
||||
|
||||
space_command("command", null, true,
|
||||
new HashMap<>() {{
|
||||
put(T2CLanguageEnum.german, List.of());
|
||||
put(T2CLanguageEnum.english, List.of());
|
||||
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<>() {{
|
||||
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>'."));
|
||||
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>'."));
|
||||
}}),
|
||||
;
|
||||
|
||||
private final String path;
|
||||
private Object value;
|
||||
private final boolean forceSet;
|
||||
private final HashMap<T2CLanguageEnum, List<String>> comments;
|
||||
private final HashMap<T2C_LanguageEnum, List<String>> comments;
|
||||
|
||||
VALUES(String path, Object value, boolean forceSet, HashMap<T2CLanguageEnum, List<String>> comments) {
|
||||
VALUES(String path, Object value, boolean forceSet, HashMap<T2C_LanguageEnum, List<String>> comments) {
|
||||
this.path = path;
|
||||
this.value = value;
|
||||
this.forceSet = forceSet;
|
||||
@@ -131,7 +131,7 @@ public class T2C_LibConfig {
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<T2CLanguageEnum, List<String>> getComments() {
|
||||
public HashMap<T2C_LanguageEnum, List<String>> getComments() {
|
||||
return comments;
|
||||
}
|
||||
|
||||
@@ -149,9 +149,9 @@ public class T2C_LibConfig {
|
||||
public static void set(boolean isReload) {
|
||||
long long_ = System.currentTimeMillis();
|
||||
ConvertT2ClibConfig.convert();
|
||||
T2C_ConfigWriter.createConfig(new File(T2CodeLibMain.getPath(), "config.yml"), VALUES.values(), Util.getConfigLogo());
|
||||
T2C_ConfigWriter.createConfig(new File(T2C_Main.getPath(), "config.yml"), VALUES.values(), T2C_Util.getConfigLogo());
|
||||
|
||||
T2C_Send.sendStartTextCenter(Util.getPrefix(), "§2config.yml were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms", isReload);
|
||||
T2C_Send.sendStartTextCenter(T2C_Util.getPrefix(), "§2config.yml were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms", isReload);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -4,68 +4,68 @@ 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.util.T2C_LanguageEnum;
|
||||
import net.t2code.t2codelib.util.T2C_ConfigItemLanguages;
|
||||
import net.t2code.t2codelib.SPIGOT.api.yaml.T2C_LanguageWriter;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2C_Main;
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.config.T2C_LibConfig;
|
||||
import net.t2code.t2codelib.Util;
|
||||
import net.t2code.t2codelib.util.T2C_Util;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class T2CLibLanguages {
|
||||
|
||||
public enum VALUES implements T2CconfigItemLanguages {
|
||||
public enum VALUES implements T2C_ConfigItemLanguages {
|
||||
otherLang("plugin", null,
|
||||
new HashMap<>() {{
|
||||
put(T2CLanguageEnum.german, null);
|
||||
put(T2CLanguageEnum.english, null);
|
||||
put(T2C_LanguageEnum.german, null);
|
||||
put(T2C_LanguageEnum.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.", ""));
|
||||
put(T2C_LanguageEnum.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(T2C_LanguageEnum.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.german, "[prefix] &4Vault / Economy nicht eingerichtet!");
|
||||
put(T2CLanguageEnum.english, "[prefix] &4Vault / Economy not set up!");
|
||||
put(T2C_LanguageEnum.german, "[prefix] &4Vault / Economy nicht eingerichtet!");
|
||||
put(T2C_LanguageEnum.english, "[prefix] &4Vault / Economy not set up!");
|
||||
}},
|
||||
new HashMap<>() {{
|
||||
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."));
|
||||
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."));
|
||||
put(T2C_LanguageEnum.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.german, "[prefix] &4VotingPlugin ist auf dem Server nicht vorhanden!");
|
||||
put(T2CLanguageEnum.english, "[prefix] &4VotingPlugin is not present on the server!");
|
||||
put(T2C_LanguageEnum.german, "[prefix] &4VotingPlugin ist auf dem Server nicht vorhanden!");
|
||||
put(T2C_LanguageEnum.english, "[prefix] &4VotingPlugin is not present on the server!");
|
||||
}},
|
||||
new HashMap<>() {{
|
||||
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/"));
|
||||
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/"));
|
||||
put(T2C_LanguageEnum.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(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.");
|
||||
}},
|
||||
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(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());
|
||||
}}),
|
||||
|
||||
;
|
||||
|
||||
private final String path;
|
||||
private Object value;
|
||||
private final HashMap<T2CLanguageEnum, String> lang;
|
||||
private final HashMap<T2CLanguageEnum, List<String>> comments;
|
||||
private final HashMap<T2C_LanguageEnum, String> lang;
|
||||
private final HashMap<T2C_LanguageEnum, List<String>> comments;
|
||||
|
||||
VALUES(String path, Object value, @NonNull HashMap<T2CLanguageEnum, String> lang, HashMap<T2CLanguageEnum, List<String>> comments) {
|
||||
VALUES(String path, Object value, @NonNull HashMap<T2C_LanguageEnum, String> lang, HashMap<T2C_LanguageEnum, List<String>> comments) {
|
||||
this.path = path;
|
||||
this.value = value;
|
||||
this.lang = lang;
|
||||
@@ -80,18 +80,18 @@ public class T2CLibLanguages {
|
||||
@Override
|
||||
public Object getValue() {
|
||||
if (value == null) {
|
||||
return lang.get(T2CLanguageEnum.english);
|
||||
return lang.get(T2C_LanguageEnum.english);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<T2CLanguageEnum, String> getLanguage() {
|
||||
public HashMap<T2C_LanguageEnum, String> getLanguage() {
|
||||
return lang;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<T2CLanguageEnum, List<String>> getComments() {
|
||||
public HashMap<T2C_LanguageEnum, List<String>> getComments() {
|
||||
return comments;
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ public class T2CLibLanguages {
|
||||
}
|
||||
|
||||
public static void set(boolean isReload) {
|
||||
T2C_LanguageWriter.createConfig(Util.getPrefix(), T2CodeLibMain.getPath(), VALUES.values(), T2C_LibConfig.VALUES.language.getValue().toString(), isReload, Util.getConfigLogo());
|
||||
T2C_LanguageWriter.createConfig(T2C_Util.getPrefix(), T2C_Main.getPath(), VALUES.values(), T2C_LibConfig.VALUES.language.getValue().toString(), isReload, T2C_Util.getConfigLogo());
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user