16.7_dev-19
This commit is contained in:
parent
8678eee675
commit
83f4a3ef71
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>net.t2code</groupId>
|
<groupId>net.t2code</groupId>
|
||||||
<artifactId>T2CodeLib</artifactId>
|
<artifactId>T2CodeLib</artifactId>
|
||||||
<version>16.7_dev-13</version>
|
<version>16.7_dev-19</version>
|
||||||
<!--version>VERSION_snapshot-0</version-->
|
<!--version>VERSION_snapshot-0</version-->
|
||||||
<!--version>VERSION_beta-0</version-->
|
<!--version>VERSION_beta-0</version-->
|
||||||
<!--version>VERSION_dev-0</version-->
|
<!--version>VERSION_dev-0</version-->
|
||||||
|
@ -11,7 +11,7 @@ import net.md_5.bungee.event.EventHandler;
|
|||||||
import net.t2code.t2codelib.BUNGEE.api.messages.T2CB_Send;
|
import net.t2code.t2codelib.BUNGEE.api.messages.T2CB_Send;
|
||||||
import net.t2code.t2codelib.BUNGEE.system.T2CB_Main;
|
import net.t2code.t2codelib.BUNGEE.system.T2CB_Main;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.bungeePlayers.T2C_BngeePlayersEnum;
|
import net.t2code.t2codelib.SPIGOT.api.bungeePlayers.T2C_BngeePlayersEnum;
|
||||||
import net.t2code.t2codelib.Util;
|
import net.t2code.t2codelib.util.T2C_Util;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@ -54,12 +54,12 @@ public class T2CB_BungeePlayers implements Listener {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Logger.getLogger(e.getMessage());
|
Logger.getLogger(e.getMessage());
|
||||||
}
|
}
|
||||||
T2CB_Send.debug(T2CB_Main.getPlugin(), "PluginMessage received channel: "+ Util.getPluginChannel_ProxyOnlinePlayers());
|
T2CB_Send.debug(T2CB_Main.getPlugin(), "PluginMessage received channel: "+ T2C_Util.getPluginChannel_ProxyOnlinePlayers());
|
||||||
T2CB_Send.debug(T2CB_Main.getPlugin(), "PluginMessage received subChannel: " + value.name());
|
T2CB_Send.debug(T2CB_Main.getPlugin(), "PluginMessage received subChannel: " + value.name());
|
||||||
T2CB_Send.debug(T2CB_Main.getPlugin(), "PluginMessage received input: " + name);
|
T2CB_Send.debug(T2CB_Main.getPlugin(), "PluginMessage received input: " + name);
|
||||||
T2CB_Send.debug(T2CB_Main.getPlugin(), "PluginMessage received input2/uuid: " + uuid);
|
T2CB_Send.debug(T2CB_Main.getPlugin(), "PluginMessage received input2/uuid: " + uuid);
|
||||||
ProxyServer.getInstance().getServers().values().stream().forEach((server) -> {
|
ProxyServer.getInstance().getServers().values().stream().forEach((server) -> {
|
||||||
server.sendData(Util.getPluginChannel_ProxyOnlinePlayers(), stream.toByteArray());
|
server.sendData(T2C_Util.getPluginChannel_ProxyOnlinePlayers(), stream.toByteArray());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,13 +74,13 @@ public class T2CB_BungeePlayers implements Listener {
|
|||||||
Logger.getLogger(e.getMessage());
|
Logger.getLogger(e.getMessage());
|
||||||
}
|
}
|
||||||
ProxyServer.getInstance().getServers().values().stream().forEach((server) -> {
|
ProxyServer.getInstance().getServers().values().stream().forEach((server) -> {
|
||||||
server.sendData(Util.getPluginChannel_ProxyOnlinePlayers(), stream.toByteArray());
|
server.sendData(T2C_Util.getPluginChannel_ProxyOnlinePlayers(), stream.toByteArray());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPluginMessage(PluginMessageEvent event) {
|
public void onPluginMessage(PluginMessageEvent event) {
|
||||||
if (event.getTag().equalsIgnoreCase(Util.getPluginChannel_ProxyOnlinePlayers())) {
|
if (event.getTag().equalsIgnoreCase(T2C_Util.getPluginChannel_ProxyOnlinePlayers())) {
|
||||||
DataInputStream stream = new DataInputStream(new ByteArrayInputStream(event.getData()));
|
DataInputStream stream = new DataInputStream(new ByteArrayInputStream(event.getData()));
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
try {
|
try {
|
||||||
|
@ -27,4 +27,8 @@ public class T2CB_MiniMessage {
|
|||||||
protected static Component replace(String text) {
|
protected static Component replace(String text) {
|
||||||
return MiniMessage.miniMessage().deserialize(T2C_Replace.convertColorCode(text));
|
return MiniMessage.miniMessage().deserialize(T2C_Replace.convertColorCode(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String removeMiniMessageCodes(String text){
|
||||||
|
return MiniMessage.miniMessage().stripTags(text);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ package net.t2code.t2codelib.BUNGEE.api.messages;
|
|||||||
import net.md_5.bungee.api.CommandSender;
|
import net.md_5.bungee.api.CommandSender;
|
||||||
import net.md_5.bungee.api.plugin.Plugin;
|
import net.md_5.bungee.api.plugin.Plugin;
|
||||||
import net.t2code.t2codelib.BUNGEE.api.update.T2CB_UpdateAPI;
|
import net.t2code.t2codelib.BUNGEE.api.update.T2CB_UpdateAPI;
|
||||||
import net.t2code.t2codelib.T2CupdateWebData;
|
import net.t2code.t2codelib.util.T2C_UpdateWebData;
|
||||||
|
|
||||||
public class T2CB_Template {
|
public class T2CB_Template {
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ public class T2CB_Template {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void sendInfo(CommandSender sender, Plugin plugin, String prefix, String spigot, String discord, String autor) {
|
public static void sendInfo(CommandSender sender, Plugin plugin, String prefix, String spigot, String discord, String autor) {
|
||||||
T2CupdateWebData webData = T2CB_UpdateAPI.bungeePluginVersins.get(plugin.getDescription().getName()).webData;
|
T2C_UpdateWebData webData = T2CB_UpdateAPI.bungeePluginVersins.get(plugin.getDescription().getName()).webData;
|
||||||
String pluginVersion = plugin.getDescription().getVersion();
|
String pluginVersion = plugin.getDescription().getVersion();
|
||||||
T2CB_Send.sender(sender, prefix + "§4======= " + prefix + " §4=======");
|
T2CB_Send.sender(sender, prefix + "§4======= " + prefix + " §4=======");
|
||||||
T2CB_Send.sender(sender, prefix + " §2Autor: §6" + autor);
|
T2CB_Send.sender(sender, prefix + " §2Autor: §6" + autor);
|
||||||
|
@ -5,7 +5,7 @@ import net.md_5.bungee.api.connection.ProxiedPlayer;
|
|||||||
import net.md_5.bungee.api.event.PluginMessageEvent;
|
import net.md_5.bungee.api.event.PluginMessageEvent;
|
||||||
import net.md_5.bungee.api.plugin.Listener;
|
import net.md_5.bungee.api.plugin.Listener;
|
||||||
import net.md_5.bungee.event.EventHandler;
|
import net.md_5.bungee.event.EventHandler;
|
||||||
import net.t2code.t2codelib.Util;
|
import net.t2code.t2codelib.util.T2C_Util;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
@ -14,7 +14,7 @@ import java.io.IOException;
|
|||||||
public class T2CB_PluginMessageProxyCommand implements Listener {
|
public class T2CB_PluginMessageProxyCommand implements Listener {
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPluginmessage(PluginMessageEvent event) {
|
public void onPluginmessage(PluginMessageEvent event) {
|
||||||
if (event.getTag().equalsIgnoreCase(Util.getPluginChannel_ProxyCommand())) {
|
if (event.getTag().equalsIgnoreCase(T2C_Util.getPluginChannel_ProxyCommand())) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
DataInputStream stream = new DataInputStream(new ByteArrayInputStream(event.getData()));
|
DataInputStream stream = new DataInputStream(new ByteArrayInputStream(event.getData()));
|
||||||
try {
|
try {
|
||||||
@ -28,12 +28,12 @@ public class T2CB_PluginMessageProxyCommand implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (channel.equals("T2Code-Console")) {
|
if (channel.equals("T2Code-Console")) {
|
||||||
ProxyServer.getInstance().getConsole().sendMessage(Util.getPrefix()+" [§6"+serverID+"§r] §cT2C BCMD Command Console: §r"+ input);
|
ProxyServer.getInstance().getConsole().sendMessage(T2C_Util.getPrefix()+" [§6"+serverID+"§r] §cT2C BCMD Command Console: §r"+ input);
|
||||||
ProxyServer.getInstance().getPluginManager().dispatchCommand(ProxyServer.getInstance().getConsole(), input);
|
ProxyServer.getInstance().getPluginManager().dispatchCommand(ProxyServer.getInstance().getConsole(), input);
|
||||||
} else {
|
} else {
|
||||||
ProxiedPlayer player = ProxyServer.getInstance().getPlayer(channel);
|
ProxiedPlayer player = ProxyServer.getInstance().getPlayer(channel);
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
ProxyServer.getInstance().getConsole().sendMessage(Util.getPrefix()+" [§6"+serverID+"§r] §cT2C BCMD Command §r" + player +": "+ input);
|
ProxyServer.getInstance().getConsole().sendMessage(T2C_Util.getPrefix()+" [§6"+serverID+"§r] §cT2C BCMD Command §r" + player +": "+ input);
|
||||||
ProxyServer.getInstance().getPluginManager().dispatchCommand(player, input);
|
ProxyServer.getInstance().getPluginManager().dispatchCommand(player, input);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ import net.md_5.bungee.api.event.PluginMessageEvent;
|
|||||||
import net.md_5.bungee.api.plugin.Listener;
|
import net.md_5.bungee.api.plugin.Listener;
|
||||||
import net.md_5.bungee.event.EventHandler;
|
import net.md_5.bungee.event.EventHandler;
|
||||||
import net.t2code.t2codelib.BUNGEE.api.messages.T2CB_Send;
|
import net.t2code.t2codelib.BUNGEE.api.messages.T2CB_Send;
|
||||||
import net.t2code.t2codelib.Util;
|
import net.t2code.t2codelib.util.T2C_Util;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
@ -16,7 +16,7 @@ public class T2CB_API_AutoResponse implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPluginmessage(PluginMessageEvent event) {
|
public void onPluginmessage(PluginMessageEvent event) {
|
||||||
if (event.getTag().equalsIgnoreCase(Util.getPluginChannel_AutoResponse())) {
|
if (event.getTag().equalsIgnoreCase(T2C_Util.getPluginChannel_AutoResponse())) {
|
||||||
DataInputStream stream = new DataInputStream(new ByteArrayInputStream(event.getData()));
|
DataInputStream stream = new DataInputStream(new ByteArrayInputStream(event.getData()));
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
try {
|
try {
|
||||||
|
@ -6,7 +6,7 @@ import net.md_5.bungee.api.event.PlayerDisconnectEvent;
|
|||||||
import net.md_5.bungee.api.event.PostLoginEvent;
|
import net.md_5.bungee.api.event.PostLoginEvent;
|
||||||
import net.md_5.bungee.api.plugin.Listener;
|
import net.md_5.bungee.api.plugin.Listener;
|
||||||
import net.md_5.bungee.event.EventHandler;
|
import net.md_5.bungee.event.EventHandler;
|
||||||
import net.t2code.t2codelib.Util;
|
import net.t2code.t2codelib.util.T2C_Util;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@ -39,7 +39,7 @@ public class T2CB_API_CGUI implements Listener {
|
|||||||
Logger.getLogger(e.getMessage());
|
Logger.getLogger(e.getMessage());
|
||||||
}
|
}
|
||||||
ProxyServer.getInstance().getServers().values().stream().forEach((server) -> {
|
ProxyServer.getInstance().getServers().values().stream().forEach((server) -> {
|
||||||
server.sendData(Util.getPluginChannel_CGUIOnlinePlayers(), stream.toByteArray());
|
server.sendData(T2C_Util.getPluginChannel_CGUIOnlinePlayers(), stream.toByteArray());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ public class T2CB_API_CGUI implements Listener {
|
|||||||
Logger.getLogger(e.getMessage());
|
Logger.getLogger(e.getMessage());
|
||||||
}
|
}
|
||||||
ProxyServer.getInstance().getServers().values().stream().forEach((server) -> {
|
ProxyServer.getInstance().getServers().values().stream().forEach((server) -> {
|
||||||
server.sendData(Util.getPluginChannel_CGUIOnlinePlayers(), stream.toByteArray());
|
server.sendData(T2C_Util.getPluginChannel_CGUIOnlinePlayers(), stream.toByteArray());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ import net.md_5.bungee.api.ProxyServer;
|
|||||||
import net.md_5.bungee.api.event.PluginMessageEvent;
|
import net.md_5.bungee.api.event.PluginMessageEvent;
|
||||||
import net.md_5.bungee.api.plugin.Listener;
|
import net.md_5.bungee.api.plugin.Listener;
|
||||||
import net.md_5.bungee.event.EventHandler;
|
import net.md_5.bungee.event.EventHandler;
|
||||||
import net.t2code.t2codelib.Util;
|
import net.t2code.t2codelib.util.T2C_Util;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@ -13,7 +13,7 @@ public class T2CB_API_OpSecurity implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPluginmessage(PluginMessageEvent event) {
|
public void onPluginmessage(PluginMessageEvent event) {
|
||||||
if (event.getTag().equalsIgnoreCase(Util.getPluginChannel_OPSecurity())) {
|
if (event.getTag().equalsIgnoreCase(T2C_Util.getPluginChannel_OPSecurity())) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
DataInputStream stream = new DataInputStream(new ByteArrayInputStream(event.getData()));
|
DataInputStream stream = new DataInputStream(new ByteArrayInputStream(event.getData()));
|
||||||
try {
|
try {
|
||||||
@ -40,7 +40,7 @@ public class T2CB_API_OpSecurity implements Listener {
|
|||||||
Logger.getLogger(e.getMessage());
|
Logger.getLogger(e.getMessage());
|
||||||
}
|
}
|
||||||
ProxyServer.getInstance().getServers().values().stream().forEach((server) -> {
|
ProxyServer.getInstance().getServers().values().stream().forEach((server) -> {
|
||||||
server.sendData(Util.getPluginChannel_OPSecurity(), stream.toByteArray());
|
server.sendData(T2C_Util.getPluginChannel_OPSecurity(), stream.toByteArray());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,32 +5,32 @@ import net.md_5.bungee.api.ProxyServer;
|
|||||||
import net.md_5.bungee.api.plugin.Plugin;
|
import net.md_5.bungee.api.plugin.Plugin;
|
||||||
import net.t2code.t2codelib.BUNGEE.api.messages.T2CB_Send;
|
import net.t2code.t2codelib.BUNGEE.api.messages.T2CB_Send;
|
||||||
import net.t2code.t2codelib.BUNGEE.system.config.T2CB_LibConfig;
|
import net.t2code.t2codelib.BUNGEE.system.config.T2CB_LibConfig;
|
||||||
import net.t2code.t2codelib.T2CupdateObject;
|
import net.t2code.t2codelib.util.T2C_UpdateObject;
|
||||||
import net.t2code.t2codelib.T2CupdateWebData;
|
import net.t2code.t2codelib.util.T2C_UpdateWebData;
|
||||||
import net.t2code.t2codelib.UpdateType;
|
import net.t2code.t2codelib.util.T2C_UpdateType;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
public class T2CB_UpdateAPI {
|
public class T2CB_UpdateAPI {
|
||||||
public static HashMap<String, T2CupdateObject> bungeePluginVersins = new HashMap<>();
|
public static HashMap<String, T2C_UpdateObject> bungeePluginVersins = new HashMap<>();
|
||||||
|
|
||||||
public static void sendUpdateMsg(String prefix, String discord, T2CupdateWebData webData, Plugin plugin, CommandSender sender) {
|
public static void sendUpdateMsg(String prefix, String discord, T2C_UpdateWebData webData, Plugin plugin, CommandSender sender) {
|
||||||
String publicVersion = webData.getVersion();
|
String publicVersion = webData.getVersion();
|
||||||
String pluginVersion = plugin.getDescription().getVersion();
|
String pluginVersion = plugin.getDescription().getVersion();
|
||||||
String value;
|
String value;
|
||||||
if (webData.isPreRelease()) {
|
if (webData.isPreRelease()) {
|
||||||
value = UpdateType.PRERELEASE.text;
|
value = T2C_UpdateType.PRERELEASE.text;
|
||||||
if (publicVersion.toLowerCase().contains("dev")) {
|
if (publicVersion.toLowerCase().contains("dev")) {
|
||||||
value = UpdateType.DEVELOPMENT.text;
|
value = T2C_UpdateType.DEVELOPMENT.text;
|
||||||
}
|
}
|
||||||
if (publicVersion.toLowerCase().contains("beta")) {
|
if (publicVersion.toLowerCase().contains("beta")) {
|
||||||
value = UpdateType.BETA.text;
|
value = T2C_UpdateType.BETA.text;
|
||||||
}
|
}
|
||||||
if (publicVersion.toLowerCase().contains("snapshot")) {
|
if (publicVersion.toLowerCase().contains("snapshot")) {
|
||||||
value = UpdateType.SNAPSHOT.text;
|
value = T2C_UpdateType.SNAPSHOT.text;
|
||||||
}
|
}
|
||||||
} else value = UpdateType.STABLE.text;
|
} else value = T2C_UpdateType.STABLE.text;
|
||||||
String h = "<br><dark_red>╔══════════════</dark_red>" + prefix + "<dark_red>══════════════</dark_red>";
|
String h = "<br><dark_red>╔══════════════</dark_red>" + prefix + "<dark_red>══════════════</dark_red>";
|
||||||
String s1 = "<br><dark_red>║</dark_red> <gold>A new [value] version was found!</gold>".replace("[value]", value);
|
String s1 = "<br><dark_red>║</dark_red> <gold>A new [value] version was found!</gold>".replace("[value]", value);
|
||||||
String s2 = "<br><dark_red>║</dark_red> <gold>Your version: <red>" + pluginVersion + "</red> <gray>-</gray> Current version:</gold> <green>" + webData.getVersion() + "</green>";
|
String s2 = "<br><dark_red>║</dark_red> <gold>Your version: <red>" + pluginVersion + "</red> <gray>-</gray> Current version:</gold> <green>" + webData.getVersion() + "</green>";
|
||||||
@ -55,7 +55,7 @@ public class T2CB_UpdateAPI {
|
|||||||
public void run() {
|
public void run() {
|
||||||
(new T2CB_UpdateCheckerGit(plugin)).getVersion((webData) -> {
|
(new T2CB_UpdateCheckerGit(plugin)).getVersion((webData) -> {
|
||||||
pluginVersion = plugin.getDescription().getVersion();
|
pluginVersion = plugin.getDescription().getVersion();
|
||||||
T2CupdateObject update = new T2CupdateObject(
|
T2C_UpdateObject update = new T2C_UpdateObject(
|
||||||
plugin.getDescription().getName(),
|
plugin.getDescription().getName(),
|
||||||
plugin.getDescription().getVersion(),
|
plugin.getDescription().getVersion(),
|
||||||
webData,
|
webData,
|
||||||
|
@ -3,8 +3,8 @@ package net.t2code.t2codelib.BUNGEE.api.update;
|
|||||||
import net.md_5.bungee.api.ProxyServer;
|
import net.md_5.bungee.api.ProxyServer;
|
||||||
import net.md_5.bungee.api.plugin.Plugin;
|
import net.md_5.bungee.api.plugin.Plugin;
|
||||||
import net.t2code.t2codelib.BUNGEE.system.config.T2CB_LibConfig;
|
import net.t2code.t2codelib.BUNGEE.system.config.T2CB_LibConfig;
|
||||||
import net.t2code.t2codelib.T2CupdateObject;
|
import net.t2code.t2codelib.util.T2C_UpdateObject;
|
||||||
import net.t2code.t2codelib.T2CupdateWebData;
|
import net.t2code.t2codelib.util.T2C_UpdateWebData;
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ public class T2CB_UpdateCheckerGit {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getVersion(Consumer<T2CupdateWebData> consumer, String pluginVersion, Integer spigotID, String gitKey) {
|
public void getVersion(Consumer<T2C_UpdateWebData> consumer, String pluginVersion, Integer spigotID, String gitKey) {
|
||||||
String RepoURL = "https://git.t2code.net/api/v1/repos/" + gitKey + "/releases?limit=1";
|
String RepoURL = "https://git.t2code.net/api/v1/repos/" + gitKey + "/releases?limit=1";
|
||||||
if (!(boolean) T2CB_LibConfig.VALUES.seePreReleaseUpdates.getValue() ) {
|
if (!(boolean) T2CB_LibConfig.VALUES.seePreReleaseUpdates.getValue() ) {
|
||||||
RepoURL = RepoURL + "&pre-release=false";
|
RepoURL = RepoURL + "&pre-release=false";
|
||||||
@ -75,14 +75,14 @@ public class T2CB_UpdateCheckerGit {
|
|||||||
updateUrl = "https://www.spigotmc.org/resources/" + spigotID;
|
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);
|
consumer.accept(webData);
|
||||||
} catch (Exception var10) {
|
} catch (Exception var10) {
|
||||||
Boolean load = false;
|
Boolean load = false;
|
||||||
if (T2CB_UpdateAPI.bungeePluginVersins.containsKey(plugin.getDescription().getName())) {
|
if (T2CB_UpdateAPI.bungeePluginVersins.containsKey(plugin.getDescription().getName())) {
|
||||||
load = T2CB_UpdateAPI.bungeePluginVersins.get(plugin.getDescription().getName()).load;
|
load = T2CB_UpdateAPI.bungeePluginVersins.get(plugin.getDescription().getName()).load;
|
||||||
}
|
}
|
||||||
T2CupdateObject update = new T2CupdateObject(
|
T2C_UpdateObject update = new T2C_UpdateObject(
|
||||||
plugin.getDescription().getName(),
|
plugin.getDescription().getName(),
|
||||||
pluginVersion,
|
pluginVersion,
|
||||||
null,
|
null,
|
||||||
|
@ -4,9 +4,9 @@ package net.t2code.t2codelib.BUNGEE.api.yaml;
|
|||||||
|
|
||||||
import net.md_5.bungee.config.ConfigurationProvider;
|
import net.md_5.bungee.config.ConfigurationProvider;
|
||||||
import net.md_5.bungee.config.YamlConfiguration;
|
import net.md_5.bungee.config.YamlConfiguration;
|
||||||
import net.t2code.t2codelib.T2CconfigItem;
|
import net.t2code.t2codelib.util.T2C_ConfigItem;
|
||||||
import net.md_5.bungee.config.Configuration;
|
import net.md_5.bungee.config.Configuration;
|
||||||
import net.t2code.t2codelib.T2CLanguageEnum;
|
import net.t2code.t2codelib.util.T2C_LanguageEnum;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -20,7 +20,7 @@ public class T2CB_ConfigWriter {
|
|||||||
private static Configuration config;
|
private static Configuration 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();
|
boolean exist = configFile.exists();
|
||||||
if (!exist) {
|
if (!exist) {
|
||||||
configFile.getParentFile().mkdirs();
|
configFile.getParentFile().mkdirs();
|
||||||
@ -39,9 +39,9 @@ public class T2CB_ConfigWriter {
|
|||||||
}
|
}
|
||||||
Map<String, List<String>> comments = new LinkedHashMap<>();
|
Map<String, List<String>> comments = new LinkedHashMap<>();
|
||||||
|
|
||||||
T2CLanguageEnum lang = T2CLanguageEnum.english;
|
T2C_LanguageEnum lang = T2C_LanguageEnum.english;
|
||||||
|
|
||||||
for (T2CconfigItem item : values) {
|
for (T2C_ConfigItem item : values) {
|
||||||
if (item.getForceSet() || !exist) {
|
if (item.getForceSet() || !exist) {
|
||||||
if (!config.contains(item.getPath())) {
|
if (!config.contains(item.getPath())) {
|
||||||
config.set(item.getPath(), item.getValue());
|
config.set(item.getPath(), item.getValue());
|
||||||
@ -56,8 +56,8 @@ public class T2CB_ConfigWriter {
|
|||||||
readConfig(config, values);
|
readConfig(config, values);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void readConfig(Configuration config, T2CconfigItem[] values) {
|
private static void readConfig(Configuration config, T2C_ConfigItem[] values) {
|
||||||
for (T2CconfigItem item : values) {
|
for (T2C_ConfigItem item : values) {
|
||||||
item.setValue(config.get(item.getPath()));
|
item.setValue(config.get(item.getPath()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,8 @@ import net.t2code.t2codelib.BUNGEE.api.pluginMessaging.opSecurity.T2CB_API_OpSec
|
|||||||
import net.t2code.t2codelib.BUNGEE.api.update.T2CB_UpdateAPI;
|
import net.t2code.t2codelib.BUNGEE.api.update.T2CB_UpdateAPI;
|
||||||
import net.t2code.t2codelib.BUNGEE.system.bstats.T2CB_Metrics;
|
import net.t2code.t2codelib.BUNGEE.system.bstats.T2CB_Metrics;
|
||||||
import net.t2code.t2codelib.BUNGEE.system.config.T2CB_LibConfig;
|
import net.t2code.t2codelib.BUNGEE.system.config.T2CB_LibConfig;
|
||||||
import net.t2code.t2codelib.Util;
|
import net.t2code.t2codelib.util.T2C_PlatformDetector;
|
||||||
|
import net.t2code.t2codelib.util.T2C_Util;
|
||||||
|
|
||||||
public class T2CB_Main extends Plugin {
|
public class T2CB_Main extends Plugin {
|
||||||
|
|
||||||
@ -27,6 +28,7 @@ public class T2CB_Main extends Plugin {
|
|||||||
private static BungeeAudiences adventure;
|
private static BungeeAudiences adventure;
|
||||||
|
|
||||||
public static BungeeAudiences getAdventure() {
|
public static BungeeAudiences getAdventure() {
|
||||||
|
T2C_PlatformDetector.scan();
|
||||||
if (adventure == null) {
|
if (adventure == null) {
|
||||||
throw new IllegalStateException("Cannot retrieve audience provider while plugin is not enabled");
|
throw new IllegalStateException("Cannot retrieve audience provider while plugin is not enabled");
|
||||||
}
|
}
|
||||||
@ -47,7 +49,7 @@ public class T2CB_Main extends Plugin {
|
|||||||
T2CB_Send.error(this, "Adventure can not be load!");
|
T2CB_Send.error(this, "Adventure can not be load!");
|
||||||
mmIsLoad = false;
|
mmIsLoad = false;
|
||||||
}
|
}
|
||||||
onLoad(Util.getPrefix(), autor, orgVersion, Util.getSpigot(), Util.getDiscord(), Util.getSpigotID(), Util.getBstatsID(), Util.getGit());
|
onLoad(T2C_Util.getPrefix(), autor, orgVersion, T2C_Util.getSpigot(), T2C_Util.getDiscord(), T2C_Util.getSpigotID(), T2C_Util.getBstatsID(), T2C_Util.getGit());
|
||||||
version = plugin.getDescription().getVersion();
|
version = plugin.getDescription().getVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,13 +63,13 @@ public class T2CB_Main extends Plugin {
|
|||||||
adventure = null;
|
adventure = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
T2CB_Send.console(Util.getPrefix() + "§4============================= " + Util.getPrefix() + " §4=============================");
|
T2CB_Send.console(T2C_Util.getPrefix() + "§4============================= " + T2C_Util.getPrefix() + " §4=============================");
|
||||||
T2CB_Send.console(Util.getPrefix() + " §2Autor: §6" + String.valueOf(plugin.getDescription().getAuthor()).replace("[", "").replace("]", ""));
|
T2CB_Send.console(T2C_Util.getPrefix() + " §2Autor: §6" + String.valueOf(plugin.getDescription().getAuthor()).replace("[", "").replace("]", ""));
|
||||||
T2CB_Send.console(Util.getPrefix() + " §2Version: §6" + version);
|
T2CB_Send.console(T2C_Util.getPrefix() + " §2Version: §6" + version);
|
||||||
T2CB_Send.console(Util.getPrefix() + " §2Spigot: §6" + Util.getSpigot());
|
T2CB_Send.console(T2C_Util.getPrefix() + " §2Spigot: §6" + T2C_Util.getSpigot());
|
||||||
T2CB_Send.console(Util.getPrefix() + " §2Discord: §6" + Util.getDiscord());
|
T2CB_Send.console(T2C_Util.getPrefix() + " §2Discord: §6" + T2C_Util.getDiscord());
|
||||||
T2CB_Send.console(Util.getPrefix() + " §4Plugin successfully disabled.");
|
T2CB_Send.console(T2C_Util.getPrefix() + " §4Plugin successfully disabled.");
|
||||||
T2CB_Send.console(Util.getPrefix() + "§4============================= " + Util.getPrefix() + " §4=============================");
|
T2CB_Send.console(T2C_Util.getPrefix() + "§4============================= " + T2C_Util.getPrefix() + " §4=============================");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Boolean getMmIsLoad() {
|
public static Boolean getMmIsLoad() {
|
||||||
@ -88,24 +90,24 @@ public class T2CB_Main extends Plugin {
|
|||||||
T2CB_UpdateAPI.onUpdateCheckTimer(plugin, prefix, discord, spigotID, url);
|
T2CB_UpdateAPI.onUpdateCheckTimer(plugin, prefix, discord, spigotID, url);
|
||||||
|
|
||||||
//API
|
//API
|
||||||
plugin.getProxy().registerChannel(Util.getPluginChannel_ProxyCommand());
|
plugin.getProxy().registerChannel(T2C_Util.getPluginChannel_ProxyCommand());
|
||||||
plugin.getProxy().getPluginManager().registerListener(plugin, new T2CB_PluginMessageProxyCommand());
|
plugin.getProxy().getPluginManager().registerListener(plugin, new T2CB_PluginMessageProxyCommand());
|
||||||
|
|
||||||
plugin.getProxy().registerChannel(Util.getPluginChannel_ProxyOnlinePlayers());
|
plugin.getProxy().registerChannel(T2C_Util.getPluginChannel_ProxyOnlinePlayers());
|
||||||
plugin.getProxy().getPluginManager().registerListener(plugin, new T2CB_BungeePlayers());
|
plugin.getProxy().getPluginManager().registerListener(plugin, new T2CB_BungeePlayers());
|
||||||
T2CB_BungeePlayers.sendToSpigotDeleteAll();
|
T2CB_BungeePlayers.sendToSpigotDeleteAll();
|
||||||
|
|
||||||
if ((boolean) T2CB_LibConfig.VALUES.apiCommandGUIEnable.getValue()) {
|
if ((boolean) T2CB_LibConfig.VALUES.apiCommandGUIEnable.getValue()) {
|
||||||
plugin.getProxy().registerChannel(Util.getPluginChannel_CGUIOnlinePlayers());
|
plugin.getProxy().registerChannel(T2C_Util.getPluginChannel_CGUIOnlinePlayers());
|
||||||
plugin.getProxy().getPluginManager().registerListener(plugin, new T2CB_API_CGUI());
|
plugin.getProxy().getPluginManager().registerListener(plugin, new T2CB_API_CGUI());
|
||||||
T2CB_API_CGUI.sendToSpigotDeleteAll();
|
T2CB_API_CGUI.sendToSpigotDeleteAll();
|
||||||
}
|
}
|
||||||
if ((boolean) T2CB_LibConfig.VALUES.apiAutoResponse.getValue()) {
|
if ((boolean) T2CB_LibConfig.VALUES.apiAutoResponse.getValue()) {
|
||||||
plugin.getProxy().registerChannel(Util.getPluginChannel_AutoResponse());
|
plugin.getProxy().registerChannel(T2C_Util.getPluginChannel_AutoResponse());
|
||||||
plugin.getProxy().getPluginManager().registerListener(plugin, new T2CB_API_AutoResponse());
|
plugin.getProxy().getPluginManager().registerListener(plugin, new T2CB_API_AutoResponse());
|
||||||
}
|
}
|
||||||
if ((boolean) T2CB_LibConfig.VALUES.apiOpSecurity.getValue()) {
|
if ((boolean) T2CB_LibConfig.VALUES.apiOpSecurity.getValue()) {
|
||||||
plugin.getProxy().registerChannel(Util.getPluginChannel_OPSecurity());
|
plugin.getProxy().registerChannel(T2C_Util.getPluginChannel_OPSecurity());
|
||||||
plugin.getProxy().getPluginManager().registerListener(plugin, new T2CB_API_OpSecurity());
|
plugin.getProxy().getPluginManager().registerListener(plugin, new T2CB_API_OpSecurity());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ import net.md_5.bungee.config.ConfigurationProvider;
|
|||||||
import net.t2code.t2codelib.BUNGEE.system.T2CB_Main;
|
import net.t2code.t2codelib.BUNGEE.system.T2CB_Main;
|
||||||
import net.md_5.bungee.config.Configuration;
|
import net.md_5.bungee.config.Configuration;
|
||||||
import net.md_5.bungee.config.YamlConfiguration;
|
import net.md_5.bungee.config.YamlConfiguration;
|
||||||
import net.t2code.t2codelib.T2CconfigItem;
|
import net.t2code.t2codelib.util.T2C_ConfigItem;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -29,7 +29,7 @@ public class ConvertT2CBlibConfig {
|
|||||||
config.delete();
|
config.delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void set(String path, T2CconfigItem item){
|
private static void set(String path, T2C_ConfigItem item){
|
||||||
if (configuration.contains(path)){
|
if (configuration.contains(path)){
|
||||||
item.setValue(configuration.get(path));
|
item.setValue(configuration.get(path));
|
||||||
}
|
}
|
||||||
|
@ -2,9 +2,9 @@ package net.t2code.t2codelib.BUNGEE.system.config;
|
|||||||
|
|
||||||
import net.t2code.t2codelib.BUNGEE.api.yaml.T2CB_ConfigWriter;
|
import net.t2code.t2codelib.BUNGEE.api.yaml.T2CB_ConfigWriter;
|
||||||
import net.t2code.t2codelib.BUNGEE.system.T2CB_Main;
|
import net.t2code.t2codelib.BUNGEE.system.T2CB_Main;
|
||||||
import net.t2code.t2codelib.T2CconfigItem;
|
import net.t2code.t2codelib.util.T2C_ConfigItem;
|
||||||
import net.t2code.t2codelib.T2CLanguageEnum;
|
import net.t2code.t2codelib.util.T2C_LanguageEnum;
|
||||||
import net.t2code.t2codelib.Util;
|
import net.t2code.t2codelib.util.T2C_Util;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -13,36 +13,36 @@ import java.util.List;
|
|||||||
|
|
||||||
public class T2CB_LibConfig {
|
public class T2CB_LibConfig {
|
||||||
|
|
||||||
public enum VALUES implements T2CconfigItem {
|
public enum VALUES implements T2C_ConfigItem {
|
||||||
updateTimer("updateCheck.timerInMin", 60, true,
|
updateTimer("updateCheck.timerInMin", 60, true,
|
||||||
new HashMap<>() {{
|
new HashMap<>() {{
|
||||||
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.english, List.of("In this option you can set the time interval in minutes in which updates should be checked."));
|
||||||
}}),
|
}}),
|
||||||
seePreReleaseUpdates("updateCheck.seePreReleaseUpdates", true, true,
|
seePreReleaseUpdates("updateCheck.seePreReleaseUpdates", true, true,
|
||||||
new HashMap<>() {{
|
new HashMap<>() {{
|
||||||
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.english, List.of("In this option you can set whether you want to receive and display beta and snapshot versions in the update check."));
|
||||||
}}),
|
}}),
|
||||||
|
|
||||||
apiCommandGUIEnable("api.commandGUI.enable", false, true,
|
apiCommandGUIEnable("api.commandGUI.enable", false, true,
|
||||||
new HashMap<>() {{
|
new HashMap<>() {{
|
||||||
put(T2CLanguageEnum.english, List.of("With this option you activate the api interface for the T2C-CommandGUI plugin."));
|
put(T2C_LanguageEnum.english, List.of("With this option you activate the api interface for the T2C-CommandGUI plugin."));
|
||||||
}}),
|
}}),
|
||||||
apiAutoResponse("api.autoResponse.enable", false, true,
|
apiAutoResponse("api.autoResponse.enable", false, true,
|
||||||
new HashMap<>() {{
|
new HashMap<>() {{
|
||||||
put(T2CLanguageEnum.english, List.of("With this option you activate the api interface for the T2C-AutoResponse plugin."));
|
put(T2C_LanguageEnum.english, List.of("With this option you activate the api interface for the T2C-AutoResponse plugin."));
|
||||||
}}),
|
}}),
|
||||||
apiOpSecurity("api.opSecurity.enable", false, true,
|
apiOpSecurity("api.opSecurity.enable", false, true,
|
||||||
new HashMap<>() {{
|
new HashMap<>() {{
|
||||||
put(T2CLanguageEnum.english, List.of("With this option you activate the api interface for the T2C-OPSecurity plugin."));
|
put(T2C_LanguageEnum.english, List.of("With this option you activate the api interface for the T2C-OPSecurity plugin."));
|
||||||
}}),
|
}}),
|
||||||
;
|
;
|
||||||
|
|
||||||
private final String path;
|
private final String path;
|
||||||
private Object value;
|
private Object value;
|
||||||
private final boolean forceSet;
|
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.path = path;
|
||||||
this.value = value;
|
this.value = value;
|
||||||
this.forceSet = forceSet;
|
this.forceSet = forceSet;
|
||||||
@ -65,7 +65,7 @@ public class T2CB_LibConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HashMap<T2CLanguageEnum, List<String>> getComments() {
|
public HashMap<T2C_LanguageEnum, List<String>> getComments() {
|
||||||
return comments;
|
return comments;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ public class T2CB_LibConfig {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
T2CB_ConfigWriter.createConfig(new File(T2CB_Main.getPlugin().getDataFolder(), "config.yml"), VALUES.values(), Util.getConfigLogo());
|
T2CB_ConfigWriter.createConfig(new File(T2CB_Main.getPlugin().getDataFolder(), "config.yml"), VALUES.values(), T2C_Util.getConfigLogo());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,9 +3,9 @@ package net.t2code.t2codelib.SPIGOT.api.bungeePlayers;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.debug.T2C_Debug;
|
import net.t2code.t2codelib.SPIGOT.api.debug.T2C_Debug;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
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.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.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.messaging.PluginMessageListener;
|
import org.bukkit.plugin.messaging.PluginMessageListener;
|
||||||
@ -23,15 +23,15 @@ public class T2C_BungeePlayers implements PluginMessageListener {
|
|||||||
@Override
|
@Override
|
||||||
public void onPluginMessageReceived(@NotNull String channel, @NotNull Player player, byte[] message) {
|
public void onPluginMessageReceived(@NotNull String channel, @NotNull Player player, byte[] message) {
|
||||||
DataInputStream stream = new DataInputStream(new ByteArrayInputStream(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 {
|
try {
|
||||||
T2C_BngeePlayersEnum subChannel = T2C_BngeePlayersEnum.valueOf(stream.readUTF());
|
T2C_BngeePlayersEnum subChannel = T2C_BngeePlayersEnum.valueOf(stream.readUTF());
|
||||||
String input = stream.readUTF();
|
String input = stream.readUTF();
|
||||||
String uuid = stream.readUTF();
|
String uuid = stream.readUTF();
|
||||||
T2C_Debug.debug(T2CodeLibMain.getPlugin(), "PluginMessage received channel: " + channel);
|
T2C_Debug.debug(T2C_Main.getPlugin(), "PluginMessage received channel: " + channel);
|
||||||
T2C_Debug.debug(T2CodeLibMain.getPlugin(), "PluginMessage received subChannel: " + subChannel.name());
|
T2C_Debug.debug(T2C_Main.getPlugin(), "PluginMessage received subChannel: " + subChannel.name());
|
||||||
T2C_Debug.debug(T2CodeLibMain.getPlugin(), "PluginMessage received input: " + input);
|
T2C_Debug.debug(T2C_Main.getPlugin(), "PluginMessage received input: " + input);
|
||||||
T2C_Debug.debug(T2CodeLibMain.getPlugin(), "PluginMessage received input2/uuid: " + uuid);
|
T2C_Debug.debug(T2C_Main.getPlugin(), "PluginMessage received input2/uuid: " + uuid);
|
||||||
switch (subChannel) {
|
switch (subChannel) {
|
||||||
case JOIN:
|
case JOIN:
|
||||||
bungeePlayers.add(input);
|
bungeePlayers.add(input);
|
||||||
@ -52,13 +52,13 @@ public class T2C_BungeePlayers implements PluginMessageListener {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
T2C_Send.sendException(e, T2CodeLibMain.getPlugin().getLogger());
|
T2C_Send.sendException(e, T2C_Main.getPlugin().getLogger());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void callAllBungeePlayers() {
|
public static void callAllBungeePlayers() {
|
||||||
if (Bukkit.getOnlinePlayers().isEmpty()) {
|
if (Bukkit.getOnlinePlayers().isEmpty()) {
|
||||||
Bukkit.getScheduler().runTaskLaterAsynchronously(T2CodeLibMain.getPlugin(), new Runnable() {
|
Bukkit.getScheduler().runTaskLaterAsynchronously(T2C_Main.getPlugin(), new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
callAllBungeePlayers();
|
callAllBungeePlayers();
|
||||||
@ -72,14 +72,14 @@ public class T2C_BungeePlayers implements PluginMessageListener {
|
|||||||
output.writeUTF(T2C_BngeePlayersEnum.GIVEALL.name());
|
output.writeUTF(T2C_BngeePlayersEnum.GIVEALL.name());
|
||||||
output.writeUTF(T2C_LibConfig.VALUES.serverUUID.getValue().toString());
|
output.writeUTF(T2C_LibConfig.VALUES.serverUUID.getValue().toString());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
T2C_Send.sendException(e, T2CodeLibMain.getPlugin().getLogger());
|
T2C_Send.sendException(e, T2C_Main.getPlugin().getLogger());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
player.sendPluginMessage(T2CodeLibMain.getPlugin(), Util.getPluginChannel_ProxyOnlinePlayers(), stream.toByteArray());
|
player.sendPluginMessage(T2C_Main.getPlugin(), T2C_Util.getPluginChannel_ProxyOnlinePlayers(), stream.toByteArray());
|
||||||
T2C_Debug.debug(T2CodeLibMain.getPlugin(), "PluginMessage received channel: " + Util.getPluginChannel_ProxyOnlinePlayers());
|
T2C_Debug.debug(T2C_Main.getPlugin(), "PluginMessage received channel: " + T2C_Util.getPluginChannel_ProxyOnlinePlayers());
|
||||||
T2C_Debug.debug(T2CodeLibMain.getPlugin(), "PluginMessage send subChannel: " + T2C_BngeePlayersEnum.GIVEALL.name());
|
T2C_Debug.debug(T2C_Main.getPlugin(), "PluginMessage send subChannel: " + T2C_BngeePlayersEnum.GIVEALL.name());
|
||||||
T2C_Debug.debug(T2CodeLibMain.getPlugin(), "PluginMessage send output/uuid: " + T2C_LibConfig.VALUES.serverUUID.getValue().toString());
|
T2C_Debug.debug(T2C_Main.getPlugin(), "PluginMessage send output/uuid: " + T2C_LibConfig.VALUES.serverUUID.getValue().toString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package net.t2code.t2codelib.SPIGOT.api.commands;
|
package net.t2code.t2codelib.SPIGOT.api.commands;
|
||||||
|
|
||||||
import net.t2code.t2codelib.SPIGOT.system.BungeeCommandSenderReceiver;
|
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.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@ -13,7 +13,7 @@ public class T2C_Cmd {
|
|||||||
Map.Entry<String,Integer> map = delay(cmdInput);
|
Map.Entry<String,Integer> map = delay(cmdInput);
|
||||||
int delay = map.getValue();
|
int delay = map.getValue();
|
||||||
String cmd = map.getKey();
|
String cmd = map.getKey();
|
||||||
Bukkit.getScheduler().runTaskLater(T2CodeLibMain.getPlugin(), new Runnable() {
|
Bukkit.getScheduler().runTaskLater(T2C_Main.getPlugin(), new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (cmd.contains("!onBungee")) {
|
if (cmd.contains("!onBungee")) {
|
||||||
@ -27,7 +27,7 @@ public class T2C_Cmd {
|
|||||||
Map.Entry<String,Integer> map = delay(cmdInput);
|
Map.Entry<String,Integer> map = delay(cmdInput);
|
||||||
int delay = map.getValue();
|
int delay = map.getValue();
|
||||||
String cmd = map.getKey();
|
String cmd = map.getKey();
|
||||||
Bukkit.getScheduler().runTaskLater(T2CodeLibMain.getPlugin(), new Runnable() {
|
Bukkit.getScheduler().runTaskLater(T2C_Main.getPlugin(), new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (cmd.contains("!asConsole")) {
|
if (cmd.contains("!asConsole")) {
|
||||||
|
@ -3,7 +3,7 @@ package net.t2code.t2codelib.SPIGOT.api.eco;
|
|||||||
import com.bencodez.votingplugin.VotingPluginMain;
|
import com.bencodez.votingplugin.VotingPluginMain;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.plugins.T2C_PluginCheck;
|
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 net.t2code.t2codelib.SPIGOT.system.config.languages.T2CLibLanguages;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -14,20 +14,20 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
public class T2C_Eco {
|
public class T2C_Eco {
|
||||||
public static boolean moneyRemove(String prefix, Player player, Double price) {
|
public static boolean moneyRemove(String prefix, Player player, Double price) {
|
||||||
if (vault(prefix, player)) {
|
if (vault(prefix, player)) {
|
||||||
return T2CodeLibMain.getEco().withdrawPlayer(player, price).transactionSuccess();
|
return T2C_Main.getEco().withdrawPlayer(player, price).transactionSuccess();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean moneyAdd(String prefix, Player player, Double price) {
|
public static boolean moneyAdd(String prefix, Player player, Double price) {
|
||||||
if (vault(prefix, player)) {
|
if (vault(prefix, player)) {
|
||||||
return T2CodeLibMain.getEco().depositPlayer(player, price).transactionSuccess();
|
return T2C_Main.getEco().depositPlayer(player, price).transactionSuccess();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean vault(String prefix, Player player) {
|
private static boolean vault(String prefix, Player player) {
|
||||||
if (T2CodeLibMain.getEco() == null) {
|
if (T2C_Main.getEco() == null) {
|
||||||
if (Bukkit.getPluginManager().getPlugin("Vault") == 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: " +
|
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║ ");
|
"§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) {
|
public static boolean votePointsAdd(String prefix, Player player, Integer amount) {
|
||||||
if (votePlugin(prefix, player)) {
|
if (votePlugin(prefix, player)) {
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(T2CodeLibMain.getPlugin(), new Runnable() {
|
Bukkit.getScheduler().runTaskAsynchronously(T2C_Main.getPlugin(), new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
VotingPluginMain.getPlugin().getVotingPluginUserManager().getVotingPluginUser(player).addPoints(amount);
|
VotingPluginMain.getPlugin().getVotingPluginUserManager().getVotingPluginUser(player).addPoints(amount);
|
||||||
|
@ -4,7 +4,7 @@ import com.mojang.authlib.GameProfile;
|
|||||||
import com.mojang.authlib.properties.Property;
|
import com.mojang.authlib.properties.Property;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2C_McVersion;
|
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.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
@ -47,7 +47,7 @@ public class T2C_ItemBuilder {
|
|||||||
inventory.setItem(i, glass);
|
inventory.setItem(i, glass);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} 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.setAccessible(true);
|
||||||
profileField.set(itemMeta, profile);
|
profileField.set(itemMeta, profile);
|
||||||
} catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e) {
|
} catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e) {
|
||||||
T2C_Send.sendException(e, T2CodeLibMain.getPlugin().getLogger());
|
T2C_Send.sendException(e, T2C_Main.getPlugin().getLogger());
|
||||||
}
|
}
|
||||||
|
|
||||||
itemStack.setItemMeta(itemMeta);
|
itemStack.setItemMeta(itemMeta);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package net.t2code.t2codelib.SPIGOT.api.messages;
|
package net.t2code.t2codelib.SPIGOT.api.messages;
|
||||||
|
|
||||||
import net.md_5.bungee.api.chat.ClickEvent;
|
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.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -26,7 +26,7 @@ public class T2C_HoverModule {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void moduleConsole(String msg) {
|
public static void moduleConsole(String msg) {
|
||||||
if (T2CodeLibMain.getMmIsLoad()) {
|
if (T2C_Main.getMmIsLoad()) {
|
||||||
T2C_MiniMessage.sendConsoleMiniMessage(msg);
|
T2C_MiniMessage.sendConsoleMiniMessage(msg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -3,12 +3,12 @@ package net.t2code.t2codelib.SPIGOT.api.messages;
|
|||||||
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
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.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class T2C_MiniMessage {
|
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) {
|
public static void sendSenderMiniMessage(String msg, CommandSender sender) {
|
||||||
String string = "";
|
String string = "";
|
||||||
@ -30,4 +30,9 @@ public class T2C_MiniMessage {
|
|||||||
protected static Component replace(String text) {
|
protected static Component replace(String text) {
|
||||||
return MiniMessage.miniMessage().deserialize(T2C_Replace.convertColorCode(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 org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class T2C_Replace {
|
public class T2C_Replace {
|
||||||
|
|
||||||
|
public static String replace(String prefix, String Text) {
|
||||||
|
|
||||||
private static final Map<String, String> REPLACEMENTS = Map.of(
|
return replaceLegacyColor(Text).replace("[prefix]", prefix).replace("[ue]", "ü")
|
||||||
"[ue]", "ü", "[UE]", "Ü",
|
.replace("[UE]", "Ü").replace("[oe]", "ö").replace("[OE]", "Ö")
|
||||||
"[oe]", "ö", "[OE]", "Ö",
|
.replace("[ae]", "ä").replace("[AE]", "Ä").replace("[nl]", "\n");
|
||||||
"[ae]", "ä", "[AE]", "Ä",
|
}
|
||||||
"[nl]", "\n"
|
|
||||||
);
|
public static String replace(String prefix, Player player, String Text) {
|
||||||
|
String input = Text.replace("[prefix]", prefix)
|
||||||
public static String replace(String prefix, String text) {
|
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||||
return replacePlaceholders(replaceLegacyColor(text), prefix, null, null);
|
.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 String replace(String prefix, Player player, String text) {
|
|
||||||
return replacePlaceholders(replaceLegacyColor(text), prefix, player, null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Object replaceObject(String prefix, Object object) {
|
public static Object replaceObject(String prefix, Object object) {
|
||||||
return replaceObjectPlaceholders(object, prefix, null, null);
|
if (object instanceof String) {
|
||||||
|
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 input : in) {
|
||||||
|
output.add(replaceLegacyColor(input).replace("[prefix]", prefix)
|
||||||
|
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||||
|
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä")
|
||||||
|
.replace("[nl]", "\n"));
|
||||||
|
}
|
||||||
|
object = output;
|
||||||
|
}
|
||||||
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Object replaceObject(String prefix, Player player, Object object) {
|
public static Object replaceObject(String prefix, Player player, Object object) {
|
||||||
return replaceObjectPlaceholders(object, prefix, player, null);
|
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");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<String> replace(String prefix, List<String> texts) {
|
}
|
||||||
return replacePlaceholdersInList(texts, prefix, null, null);
|
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;
|
||||||
|
}
|
||||||
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<String> replace(String prefix, Player player, List<String> texts) {
|
public static List<String> replace(String prefix, List<String> Text) {
|
||||||
return replacePlaceholdersInList(texts, prefix, player, null);
|
List<String> output = new ArrayList<>();
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<String> replacePrice(String prefix, List<String> texts, String price) {
|
public static List<String> replace(String prefix, Player player, List<String> Text) {
|
||||||
return replacePlaceholdersInList(texts, prefix, null, price);
|
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"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<String> replacePrice(String prefix, Player player, List<String> texts, String price) {
|
}
|
||||||
return replacePlaceholdersInList(texts, prefix, player, price);
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String replacePrice(String prefix, String text, String price) {
|
public static List<String> replacePrice(String prefix, List<String> Text, String price) {
|
||||||
return replacePlaceholders(replaceLegacyColor(text), prefix, null, 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 replacePrice(String prefix, Player player, String text, String price) {
|
|
||||||
return replacePlaceholders(replaceLegacyColor(text), prefix, player, price);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String removeColorCode(String value) {
|
public static String removeColorCode(String value) {
|
||||||
return value.replaceAll("&[0-9a-fk-or]", "");
|
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) {
|
public static String replaceLegacyColor(String text) {
|
||||||
return text.replaceAll("&([0-9a-fk-or])", "§$1");
|
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) {
|
public static String convertColorCode(String text) {
|
||||||
return text.replaceAll("&([0-9a-fk-or])", "<$1>").replaceAll("§([0-9a-fk-or])", "<$1>");
|
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) {
|
public static Object replace(Object object, String placeholder, String replacement) {
|
||||||
if (object instanceof String) {
|
if (object instanceof String) {
|
||||||
return ((String) object).replace(placeholder, replacement);
|
object = ((String) object).replace(placeholder, replacement);
|
||||||
} else if (object instanceof List) {
|
}
|
||||||
List<String> list = (List<String>) object;
|
if ((object instanceof List) || (object instanceof ArrayList)) {
|
||||||
|
List<String> in = (List<String>) object;
|
||||||
List<String> output = new ArrayList<>();
|
List<String> output = new ArrayList<>();
|
||||||
for (String item : list) {
|
for (String input : in) {
|
||||||
output.add(item.replace(placeholder, replacement));
|
output.add(input.replace(placeholder, replacement));
|
||||||
}
|
}
|
||||||
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());
|
|
||||||
}
|
|
||||||
if (price != null) {
|
|
||||||
text = text.replace("[price]", price);
|
|
||||||
}
|
|
||||||
if (player != null && T2C_PluginCheck.papi()) {
|
|
||||||
text = PlaceholderAPI.setPlaceholders(player, text);
|
|
||||||
}
|
|
||||||
return text;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static List<String> replacePlaceholdersInList(List<String> texts, String prefix, Player player, String price) {
|
|
||||||
List<String> output = new ArrayList<>();
|
|
||||||
for (String text : texts) {
|
|
||||||
output.add(replacePlaceholders(replaceLegacyColor(text), prefix, player, price));
|
|
||||||
}
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Object replaceObjectPlaceholders(Object object, String prefix, Player player, String price) {
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package net.t2code.t2codelib.SPIGOT.api.messages;
|
package net.t2code.t2codelib.SPIGOT.api.messages;
|
||||||
|
|
||||||
import net.t2code.t2codelib.SPIGOT.api.debug.T2C_Debug;
|
import net.t2code.t2codelib.SPIGOT.api.debug.T2C_Debug;
|
||||||
|
import net.t2code.t2codelib.util.T2C_GenerateFrame;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
@ -13,27 +14,28 @@ import java.util.logging.Logger;
|
|||||||
|
|
||||||
public class T2C_Send {
|
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) {
|
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) {
|
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){
|
public static String getFrameCenter(String prefix, boolean console, String... lines) {
|
||||||
return T2C_GernerateFrame.sendFrameCenter(prefix, lines);
|
return T2C_GenerateFrame.getFrameCenter(prefix, console, lines);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String sendFrameLeft(String prefix, String... lines){
|
public static String getFrameLeft(String prefix, boolean console, String... lines) {
|
||||||
return T2C_GernerateFrame.sendFrameLeft(prefix, lines);
|
return T2C_GenerateFrame.getFrameLeft(prefix, console, lines);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendException(Exception e, Logger logger) {
|
public static void sendException(Exception e, Logger logger) {
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package net.t2code.t2codelib.SPIGOT.api.messages;
|
package net.t2code.t2codelib.SPIGOT.api.messages;
|
||||||
|
|
||||||
import net.t2code.t2codelib.SPIGOT.api.update.T2C_UpdateAPI;
|
import net.t2code.t2codelib.SPIGOT.api.update.T2C_UpdateAPI;
|
||||||
import net.t2code.t2codelib.T2CupdateWebData;
|
import net.t2code.t2codelib.util.T2C_GenerateFrame;
|
||||||
import net.t2code.t2codelib.Util;
|
import net.t2code.t2codelib.util.T2C_UpdateWebData;
|
||||||
|
import net.t2code.t2codelib.util.T2C_Util;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.Plugin;
|
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) {
|
public static Long onLoadHeader(String prefix, List<String> autor, String version, String spigot, String discord, Boolean isPremium, Boolean isVerify) {
|
||||||
Long long_ = System.currentTimeMillis();
|
Long long_ = System.currentTimeMillis();
|
||||||
|
|
||||||
for (String s : Util.getLoadLogo()) {
|
for (String s : T2C_Util.getLoadLogo()) {
|
||||||
T2C_Send.console(prefix + " §e" + s);
|
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, "§2Author §6" + String.valueOf(autor).replace("[", "").replace("]", ""), false);
|
||||||
T2C_Send.sendStartTextCenter(prefix, "§2Version: §6" + version, false);
|
T2C_Send.sendStartTextCenter(prefix, "§2Version: §6" + version, false);
|
||||||
@ -61,17 +62,18 @@ public class T2C_Template {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void onLoadSeparateStroke(String prefix) {
|
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_) {
|
public static void onLoadFooter(String prefix, Long long_) {
|
||||||
onLoadSeparateStroke(prefix);
|
onLoadSeparateStroke(prefix);
|
||||||
T2C_Send.sendStartTextCenter(prefix, "§2Plugin loaded successfully." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms", false);
|
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) {
|
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) {
|
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 = "";
|
String publicVersion = "";
|
||||||
boolean update;
|
boolean update;
|
||||||
String stNVersion;
|
String stNVersion;
|
||||||
T2CupdateWebData webData;
|
T2C_UpdateWebData webData;
|
||||||
try {
|
try {
|
||||||
webData = T2C_UpdateAPI.pluginVersions.get(plugin.getName()).webData;
|
webData = T2C_UpdateAPI.pluginVersions.get(plugin.getName()).webData;
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package net.t2code.t2codelib.SPIGOT.api.plugins;
|
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.Bukkit;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ public class T2C_PluginCheck {
|
|||||||
plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
|
plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
|
||||||
Bukkit.getConsoleSender().sendMessage(prefix + " §e" + pl + " §4could not be found. Please download it here: " +
|
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.");
|
"§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;
|
return true;
|
||||||
} else return false;
|
} else return false;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package net.t2code.t2codelib.SPIGOT.api.plugins;
|
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.Bukkit;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
@ -10,33 +10,33 @@ public class T2C_PluginManager {
|
|||||||
|
|
||||||
public static void restart(String plugin) {
|
public static void restart(String plugin) {
|
||||||
if (Bukkit.getPluginManager().getPlugin(plugin) == null) return;
|
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)));
|
||||||
T2CodeLibMain.getPlugin().getPluginLoader().enablePlugin(Objects.requireNonNull(Bukkit.getPluginManager().getPlugin(plugin)));
|
T2C_Main.getPlugin().getPluginLoader().enablePlugin(Objects.requireNonNull(Bukkit.getPluginManager().getPlugin(plugin)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void enable(String plugin) {
|
public static void enable(String plugin) {
|
||||||
if (Bukkit.getPluginManager().getPlugin(plugin) == null) return;
|
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) {
|
public static void disable(String plugin) {
|
||||||
if (Bukkit.getPluginManager().getPlugin(plugin) == null) return;
|
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) {
|
public static void restart(Plugin plugin) {
|
||||||
if (plugin == null) return;
|
if (plugin == null) return;
|
||||||
T2CodeLibMain.getPlugin().getPluginLoader().disablePlugin(plugin);
|
T2C_Main.getPlugin().getPluginLoader().disablePlugin(plugin);
|
||||||
T2CodeLibMain.getPlugin().getPluginLoader().enablePlugin(plugin);
|
T2C_Main.getPlugin().getPluginLoader().enablePlugin(plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void enable(Plugin plugin) {
|
public static void enable(Plugin plugin) {
|
||||||
if (plugin == null) return;
|
if (plugin == null) return;
|
||||||
T2CodeLibMain.getPlugin().getPluginLoader().enablePlugin(plugin);
|
T2C_Main.getPlugin().getPluginLoader().enablePlugin(plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void disable(Plugin plugin) {
|
public static void disable(Plugin plugin) {
|
||||||
if (plugin == null) return;
|
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;
|
package net.t2code.t2codelib.SPIGOT.api.update;
|
||||||
|
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
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.SPIGOT.system.config.config.T2C_LibConfig;
|
||||||
import net.t2code.t2codelib.UpdateType;
|
import net.t2code.t2codelib.util.T2C_UpdateType;
|
||||||
import net.t2code.t2codelib.T2CupdateObject;
|
import net.t2code.t2codelib.util.T2C_UpdateObject;
|
||||||
import net.t2code.t2codelib.T2CupdateWebData;
|
import net.t2code.t2codelib.util.T2C_UpdateWebData;
|
||||||
import net.t2code.t2codelib.Util;
|
import net.t2code.t2codelib.util.T2C_Util;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
@ -16,16 +16,11 @@ import org.bukkit.scheduler.BukkitRunnable;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
public class T2C_UpdateAPI {
|
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) {
|
public static void join(Plugin plugin, String prefix, String perm, Player player, Integer spigotID, String discord) {
|
||||||
if (pluginVersions.get(plugin.getName()) == null) {
|
if (pluginVersions.get(plugin.getName()) == null) {
|
||||||
Bukkit.getScheduler().runTaskLaterAsynchronously(T2CodeLibMain.getPlugin(), new Runnable() {
|
Bukkit.getScheduler().runTaskLaterAsynchronously(T2C_Main.getPlugin(), () -> join(plugin, prefix, perm, player, spigotID, discord), 2 * 20L);
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
join(plugin, prefix, perm, player, spigotID, discord);
|
|
||||||
}
|
|
||||||
}, 2 * 20L);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,22 +39,23 @@ public class T2C_UpdateAPI {
|
|||||||
}.runTaskLaterAsynchronously(plugin, 20L);
|
}.runTaskLaterAsynchronously(plugin, 20L);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
T2CupdateWebData webData = pluginVersions.get(plugin.getName()).webData;
|
T2C_UpdateWebData webData = pluginVersions.get(plugin.getName()).webData;
|
||||||
if (!pluginVersions.get(plugin.getName()).updateAvailable) return;
|
if (!pluginVersions.get(plugin.getName()).updateAvailable) return;
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
sendUpdateMsg(prefix, webData, discord, plugin, player);
|
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 publicVersion = webData.getVersion();
|
||||||
String pluginVersion = plugin.getDescription().getVersion();
|
String pluginVersion = plugin.getDescription().getVersion();
|
||||||
if (!pluginVersions.get(plugin.getName()).updateAvailable) {
|
if (!pluginVersions.get(plugin.getName()).updateAvailable) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
String updateStatusVersion = getUpdateType(webData);
|
||||||
String st = "[prefix]<br>" +
|
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" +
|
"<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>" +
|
" 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] <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]";
|
"[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())
|
T2C_Send.player(player, st.replace("[prefix]", prefix).replace("[value]", updateStatusVersion).replace("[link]", webData.getUpdateUrl())
|
||||||
.replace("[plv]", pluginVersion).replace("[puv]", publicVersion).replace("[dc]", discord));
|
.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 publicVersion = webData.getVersion();
|
||||||
String pluginVersion = plugin.getDescription().getVersion();
|
String pluginVersion = plugin.getDescription().getVersion();
|
||||||
String updateStatusVersion;
|
String updateStatusVersion = getUpdateType(webData);
|
||||||
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 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 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 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 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) {
|
public static String updateInfo(String[] args, Boolean player) {
|
||||||
T2CupdateObject object;
|
T2C_UpdateObject object;
|
||||||
try {
|
try {
|
||||||
object = T2C_UpdateAPI.pluginVersions.get(args[1]);
|
object = T2C_UpdateAPI.pluginVersions.get(args[1]);
|
||||||
} catch (Exception e) {
|
} 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>";
|
if (object == null) return T2C_Util.getPrefix() + " <red>The plugin <yellow>" + args[1] + "</yellow> is not registered in the update checker of T2Code!</red>";
|
||||||
T2CupdateWebData webData = object.webData;
|
T2C_UpdateWebData webData = object.webData;
|
||||||
if (webData == null) {
|
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 pluginName = T2C_UpdateAPI.pluginVersions.get(args[1]).pluginName;
|
||||||
String pluginVersion = T2C_UpdateAPI.pluginVersions.get(args[1]).pluginVersion;
|
String pluginVersion = T2C_UpdateAPI.pluginVersions.get(args[1]).pluginVersion;
|
||||||
|
|
||||||
String updateTitle = webData.getUpdateTitle();
|
String updateTitle = webData.getUpdateTitle();
|
||||||
String updateVersion = webData.getVersion();
|
String publicVersion = webData.getVersion();
|
||||||
String updateType;
|
String updateType = getUpdateType(webData);
|
||||||
|
|
||||||
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 updateAt = webData.getPublishedAt();
|
String updateAt = webData.getPublishedAt();
|
||||||
String updateUpdate = webData.getUpdateUrl();
|
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 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 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 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 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>";
|
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;
|
if ((boolean) T2C_LibConfig.VALUES.updateCheckFullDisable.getValue()) return;
|
||||||
new T2C_UpdateCheckerGit((JavaPlugin) plugin, prefix, gitKey, spigotID, discord, updateCheckOnJoin, seePreReleaseUpdates, timeInterval);
|
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;
|
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.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.SPIGOT.system.config.config.T2C_LibConfig;
|
||||||
import net.t2code.t2codelib.T2CupdateObject;
|
import net.t2code.t2codelib.util.T2C_UpdateObject;
|
||||||
import net.t2code.t2codelib.T2CupdateWebData;
|
import net.t2code.t2codelib.util.T2C_UpdateWebData;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
@ -20,7 +21,7 @@ import java.util.function.Consumer;
|
|||||||
|
|
||||||
public class T2C_UpdateCheckerGit {
|
public class T2C_UpdateCheckerGit {
|
||||||
private final JavaPlugin plugin;
|
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) {
|
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() {
|
public void run() {
|
||||||
if ((boolean) T2C_LibConfig.VALUES.updateCheckFullDisable.getValue()) return;
|
if ((boolean) T2C_LibConfig.VALUES.updateCheckFullDisable.getValue()) return;
|
||||||
getVersion((webData) -> {
|
getVersion((webData) -> {
|
||||||
T2CupdateObject update = new T2CupdateObject(
|
T2C_UpdateObject update = new T2C_UpdateObject(
|
||||||
plugin.getName(),
|
plugin.getName(),
|
||||||
plugin.getDescription().getVersion(),
|
plugin.getDescription().getVersion(),
|
||||||
webData,
|
webData,
|
||||||
@ -53,7 +54,7 @@ public class T2C_UpdateCheckerGit {
|
|||||||
|
|
||||||
T2C_UpdateAPI.pluginVersions.put(plugin.getName(), update);
|
T2C_UpdateAPI.pluginVersions.put(plugin.getName(), update);
|
||||||
if (T2C_UpdateAPI.pluginVersions.get(plugin.getName()) == null) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
if (T2C_UpdateAPI.pluginVersions.get(plugin.getName()).updateAvailable) {
|
if (T2C_UpdateAPI.pluginVersions.get(plugin.getName()).updateAvailable) {
|
||||||
@ -80,7 +81,7 @@ public class T2C_UpdateCheckerGit {
|
|||||||
}, 10L, finalInterval * 60 * 20L);
|
}, 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()) {
|
if (!plugin.isEnabled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -128,14 +129,14 @@ public class T2C_UpdateCheckerGit {
|
|||||||
updateUrl = "https://www.spigotmc.org/resources/" + spigotID;
|
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);
|
consumer.accept(webData);
|
||||||
} catch (Exception exception) {
|
} catch (Exception exception) {
|
||||||
Boolean load = false;
|
Boolean load = false;
|
||||||
if (T2C_UpdateAPI.pluginVersions.containsKey(plugin.getName())) {
|
if (T2C_UpdateAPI.pluginVersions.containsKey(plugin.getName())) {
|
||||||
load = T2C_UpdateAPI.pluginVersions.get(plugin.getName()).load;
|
load = T2C_UpdateAPI.pluginVersions.get(plugin.getName()).load;
|
||||||
}
|
}
|
||||||
T2CupdateObject update = new T2CupdateObject(
|
T2C_UpdateObject update = new T2C_UpdateObject(
|
||||||
plugin.getName(),
|
plugin.getName(),
|
||||||
pluginVersion,
|
pluginVersion,
|
||||||
null,
|
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.messages.T2C_Replace;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2C_McVersion;
|
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2C_McVersion;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.sound.T2C_Sound;
|
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.Sound;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@ -17,7 +17,7 @@ public class T2C_Config {
|
|||||||
/**
|
/**
|
||||||
* @deprecated since version 16.7
|
* @deprecated since version 16.7
|
||||||
* This method will be removed soon!
|
* 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)
|
@Deprecated(since = "16.7", forRemoval = true)
|
||||||
public static void set(String path, String value, YamlConfiguration YamlConfiguration) {
|
public static void set(String path, String value, YamlConfiguration YamlConfiguration) {
|
||||||
@ -29,7 +29,7 @@ public class T2C_Config {
|
|||||||
/**
|
/**
|
||||||
* @deprecated since version 16.7
|
* @deprecated since version 16.7
|
||||||
* This method will be removed soon!
|
* 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)
|
@Deprecated(since = "16.7", forRemoval = true)
|
||||||
public static void set(String path, Object value, YamlConfiguration YamlConfiguration) {
|
public static void set(String path, Object value, YamlConfiguration YamlConfiguration) {
|
||||||
@ -41,7 +41,7 @@ public class T2C_Config {
|
|||||||
/**
|
/**
|
||||||
* @deprecated since version 16.7
|
* @deprecated since version 16.7
|
||||||
* This method will be removed soon!
|
* 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)
|
@Deprecated(since = "16.7", forRemoval = true)
|
||||||
public static void set(String path, YamlConfiguration YamlConfiguration) {
|
public static void set(String path, YamlConfiguration YamlConfiguration) {
|
||||||
@ -51,7 +51,7 @@ public class T2C_Config {
|
|||||||
/**
|
/**
|
||||||
* @deprecated since version 16.7
|
* @deprecated since version 16.7
|
||||||
* This method will be removed soon!
|
* 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)
|
@Deprecated(since = "16.7", forRemoval = true)
|
||||||
public static void set(String path, Integer value, YamlConfiguration YamlConfiguration) {
|
public static void set(String path, Integer value, YamlConfiguration YamlConfiguration) {
|
||||||
@ -63,7 +63,7 @@ public class T2C_Config {
|
|||||||
/**
|
/**
|
||||||
* @deprecated since version 16.7
|
* @deprecated since version 16.7
|
||||||
* This method will be removed soon!
|
* 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)
|
@Deprecated(since = "16.7", forRemoval = true)
|
||||||
public static void set(String path, Double value, YamlConfiguration YamlConfiguration) {
|
public static void set(String path, Double value, YamlConfiguration YamlConfiguration) {
|
||||||
@ -75,7 +75,7 @@ public class T2C_Config {
|
|||||||
/**
|
/**
|
||||||
* @deprecated since version 16.7
|
* @deprecated since version 16.7
|
||||||
* This method will be removed soon!
|
* 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)
|
@Deprecated(since = "16.7", forRemoval = true)
|
||||||
public static void set(String path, Boolean value, YamlConfiguration YamlConfiguration) {
|
public static void set(String path, Boolean value, YamlConfiguration YamlConfiguration) {
|
||||||
@ -87,7 +87,7 @@ public class T2C_Config {
|
|||||||
/**
|
/**
|
||||||
* @deprecated since version 16.7
|
* @deprecated since version 16.7
|
||||||
* This method will be removed soon!
|
* 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)
|
@Deprecated(since = "16.7", forRemoval = true)
|
||||||
public static void set(String path, List<String> value, YamlConfiguration YamlConfiguration) {
|
public static void set(String path, List<String> value, YamlConfiguration YamlConfiguration) {
|
||||||
@ -99,7 +99,7 @@ public class T2C_Config {
|
|||||||
/**
|
/**
|
||||||
* @deprecated since version 16.7
|
* @deprecated since version 16.7
|
||||||
* This method will be removed soon!
|
* 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)
|
@Deprecated(since = "16.7", forRemoval = true)
|
||||||
public static void set(String path, ItemStack value, YamlConfiguration YamlConfiguration) {
|
public static void set(String path, ItemStack value, YamlConfiguration YamlConfiguration) {
|
||||||
@ -111,7 +111,7 @@ public class T2C_Config {
|
|||||||
/**
|
/**
|
||||||
* @deprecated since version 16.7
|
* @deprecated since version 16.7
|
||||||
* This method will be removed soon!
|
* 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)
|
@Deprecated(since = "16.7", forRemoval = true)
|
||||||
public static void setSound(String soundName, String sound1_8, String sound1_9, String sound1_13, YamlConfiguration yamlConfiguration) {
|
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
|
* @deprecated since version 16.7
|
||||||
* This method will be removed soon!
|
* 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)
|
@Deprecated(since = "16.7", forRemoval = true)
|
||||||
public static void setSound(String soundName, String sound1_8, String sound1_13, YamlConfiguration yamlConfiguration) {
|
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
|
* @deprecated since version 16.7
|
||||||
* This method will be removed soon!
|
* 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)
|
@Deprecated(since = "16.7", forRemoval = true)
|
||||||
public static void setSound(String soundName, String sound, YamlConfiguration yamlConfiguration) {
|
public static void setSound(String soundName, String sound, YamlConfiguration yamlConfiguration) {
|
||||||
@ -154,7 +154,7 @@ public class T2C_Config {
|
|||||||
/**
|
/**
|
||||||
* @deprecated since version 16.7
|
* @deprecated since version 16.7
|
||||||
* This method will be removed soon!
|
* 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)
|
@Deprecated(since = "16.7", forRemoval = true)
|
||||||
public static boolean selectSoundEnable(String soundName, YamlConfiguration yamlConfiguration) {
|
public static boolean selectSoundEnable(String soundName, YamlConfiguration yamlConfiguration) {
|
||||||
@ -164,7 +164,7 @@ public class T2C_Config {
|
|||||||
/**
|
/**
|
||||||
* @deprecated since version 16.7
|
* @deprecated since version 16.7
|
||||||
* This method will be removed soon!
|
* 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)
|
@Deprecated(since = "16.7", forRemoval = true)
|
||||||
public static String selectSound(String prefix, String soundName, YamlConfiguration yamlConfiguration) {
|
public static String selectSound(String prefix, String soundName, YamlConfiguration yamlConfiguration) {
|
||||||
@ -174,7 +174,7 @@ public class T2C_Config {
|
|||||||
/**
|
/**
|
||||||
* @deprecated since version 16.7
|
* @deprecated since version 16.7
|
||||||
* This method will be removed soon!
|
* 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)
|
@Deprecated(since = "16.7", forRemoval = true)
|
||||||
public static Sound checkSound(String sound1_8, String sound1_9, String sound1_13, String selectSoundFromConfig, String prefix) {
|
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
|
* @deprecated since version 16.7
|
||||||
* This method will be removed soon!
|
* 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)
|
@Deprecated(since = "16.7", forRemoval = true)
|
||||||
public static Sound checkSound(String sound1_8, String sound1_13, String selectSoundFromConfig, String prefix) {
|
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
|
* @deprecated since version 16.7
|
||||||
* This method will be removed soon!
|
* 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)
|
@Deprecated(since = "16.7", forRemoval = true)
|
||||||
public static Sound checkSound(String sound, String selectSoundFromConfig, String prefix) {
|
public static Sound checkSound(String sound, String selectSoundFromConfig, String prefix) {
|
||||||
@ -205,7 +205,7 @@ public class T2C_Config {
|
|||||||
/**
|
/**
|
||||||
* @deprecated since version 16.7
|
* @deprecated since version 16.7
|
||||||
* This method will be removed soon!
|
* 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)
|
@Deprecated(since = "16.7", forRemoval = true)
|
||||||
public static String select(String prefix, String path, YamlConfiguration yamlConfiguration) {
|
public static String select(String prefix, String path, YamlConfiguration yamlConfiguration) {
|
||||||
@ -215,7 +215,7 @@ public class T2C_Config {
|
|||||||
/**
|
/**
|
||||||
* @deprecated since version 16.7
|
* @deprecated since version 16.7
|
||||||
* This method will be removed soon!
|
* 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)
|
@Deprecated(since = "16.7", forRemoval = true)
|
||||||
public static Object selectObject(String prefix, String path, YamlConfiguration yamlConfiguration) {
|
public static Object selectObject(String prefix, String path, YamlConfiguration yamlConfiguration) {
|
||||||
@ -225,7 +225,7 @@ public class T2C_Config {
|
|||||||
/**
|
/**
|
||||||
* @deprecated since version 16.7
|
* @deprecated since version 16.7
|
||||||
* This method will be removed soon!
|
* 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)
|
@Deprecated(since = "16.7", forRemoval = true)
|
||||||
public static Integer selectInt(String path, YamlConfiguration yamlConfiguration) {
|
public static Integer selectInt(String path, YamlConfiguration yamlConfiguration) {
|
||||||
@ -235,7 +235,7 @@ public class T2C_Config {
|
|||||||
/**
|
/**
|
||||||
* @deprecated since version 16.7
|
* @deprecated since version 16.7
|
||||||
* This method will be removed soon!
|
* 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)
|
@Deprecated(since = "16.7", forRemoval = true)
|
||||||
public static Boolean selectBoolean(String path, YamlConfiguration yamlConfiguration) {
|
public static Boolean selectBoolean(String path, YamlConfiguration yamlConfiguration) {
|
||||||
@ -245,7 +245,7 @@ public class T2C_Config {
|
|||||||
/**
|
/**
|
||||||
* @deprecated since version 16.7
|
* @deprecated since version 16.7
|
||||||
* This method will be removed soon!
|
* 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)
|
@Deprecated(since = "16.7", forRemoval = true)
|
||||||
public static Double selectDouble(String path, YamlConfiguration yamlConfiguration) {
|
public static Double selectDouble(String path, YamlConfiguration yamlConfiguration) {
|
||||||
@ -255,7 +255,7 @@ public class T2C_Config {
|
|||||||
/**
|
/**
|
||||||
* @deprecated since version 16.7
|
* @deprecated since version 16.7
|
||||||
* This method will be removed soon!
|
* 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)
|
@Deprecated(since = "16.7", forRemoval = true)
|
||||||
public static List<String> selectList(String path, YamlConfiguration yamlConfiguration) {
|
public static List<String> selectList(String path, YamlConfiguration yamlConfiguration) {
|
||||||
@ -265,7 +265,7 @@ public class T2C_Config {
|
|||||||
/**
|
/**
|
||||||
* @deprecated since version 16.7
|
* @deprecated since version 16.7
|
||||||
* This method will be removed soon!
|
* 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)
|
@Deprecated(since = "16.7", forRemoval = true)
|
||||||
public static ItemStack selectItemStack(String path, YamlConfiguration yamlConfiguration) {
|
public static ItemStack selectItemStack(String path, YamlConfiguration yamlConfiguration) {
|
||||||
@ -275,7 +275,7 @@ public class T2C_Config {
|
|||||||
/**
|
/**
|
||||||
* @deprecated since version 16.7
|
* @deprecated since version 16.7
|
||||||
* This method will be removed soon!
|
* 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)
|
@Deprecated(since = "16.7", forRemoval = true)
|
||||||
public static List<String> selectList(String prefix, String path, YamlConfiguration yamlConfiguration) {
|
public static List<String> selectList(String prefix, String path, YamlConfiguration yamlConfiguration) {
|
||||||
@ -290,7 +290,7 @@ public class T2C_Config {
|
|||||||
/**
|
/**
|
||||||
* @deprecated since version 16.7
|
* @deprecated since version 16.7
|
||||||
* This method will be removed soon!
|
* 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)
|
@Deprecated(since = "16.7", forRemoval = true)
|
||||||
public static void select(String prefix, List<String> value, String path, YamlConfiguration yamlConfiguration) {
|
public static void select(String prefix, List<String> value, String path, YamlConfiguration yamlConfiguration) {
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
package net.t2code.t2codelib.SPIGOT.api.yaml;
|
package net.t2code.t2codelib.SPIGOT.api.yaml;
|
||||||
|
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
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.T2CLanguageEnum;
|
import net.t2code.t2codelib.util.T2C_LanguageEnum;
|
||||||
import net.t2code.t2codelib.T2CconfigItem;
|
import net.t2code.t2codelib.util.T2C_ConfigItem;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
@ -19,14 +19,14 @@ public class T2C_ConfigWriter {
|
|||||||
|
|
||||||
private static FileConfiguration config;
|
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();
|
boolean exist = configFile.exists();
|
||||||
if (!exist) {
|
if (!exist) {
|
||||||
configFile.getParentFile().mkdirs();
|
configFile.getParentFile().mkdirs();
|
||||||
try {
|
try {
|
||||||
configFile.createNewFile();
|
configFile.createNewFile();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
T2C_Send.sendException(e, T2CodeLibMain.getPlugin().getLogger());
|
T2C_Send.sendException(e, T2C_Main.getPlugin().getLogger());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else exist = true;
|
} else exist = true;
|
||||||
@ -34,13 +34,13 @@ public class T2C_ConfigWriter {
|
|||||||
config = YamlConfiguration.loadConfiguration(configFile);
|
config = YamlConfiguration.loadConfiguration(configFile);
|
||||||
Map<String, List<String>> comments = new LinkedHashMap<>();
|
Map<String, List<String>> comments = new LinkedHashMap<>();
|
||||||
|
|
||||||
T2CLanguageEnum lang = T2CLanguageEnum.english;
|
T2C_LanguageEnum lang = T2C_LanguageEnum.english;
|
||||||
try {
|
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) {
|
} catch (Exception ignore) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (T2CconfigItem item : values) {
|
for (T2C_ConfigItem item : values) {
|
||||||
if (item.getForceSet() || !exist) {
|
if (item.getForceSet() || !exist) {
|
||||||
config.addDefault(item.getPath(), item.getValue());
|
config.addDefault(item.getPath(), item.getValue());
|
||||||
|
|
||||||
@ -58,8 +58,8 @@ public class T2C_ConfigWriter {
|
|||||||
readConfig(config, values);
|
readConfig(config, values);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void readConfig(FileConfiguration config, T2CconfigItem[] values) {
|
private static void readConfig(FileConfiguration config, T2C_ConfigItem[] values) {
|
||||||
for (T2CconfigItem value : values) {
|
for (T2C_ConfigItem value : values) {
|
||||||
value.setValue(config.get(value.getPath()));
|
value.setValue(config.get(value.getPath()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
package net.t2code.t2codelib.SPIGOT.api.yaml;
|
package net.t2code.t2codelib.SPIGOT.api.yaml;
|
||||||
|
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
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.T2CLanguageEnum;
|
import net.t2code.t2codelib.util.T2C_LanguageEnum;
|
||||||
import net.t2code.t2codelib.T2CconfigItemLanguages;
|
import net.t2code.t2codelib.util.T2C_ConfigItemLanguages;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
@ -17,14 +17,14 @@ public class T2C_LanguageWriter {
|
|||||||
|
|
||||||
private static FileConfiguration config;
|
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/");
|
File f = new File(path + "/languages/");
|
||||||
f.mkdirs();
|
f.mkdirs();
|
||||||
File[] fileArray = f.listFiles();
|
File[] fileArray = f.listFiles();
|
||||||
if (fileArray.length == 0) {
|
if (fileArray.length == 0) {
|
||||||
List<File> zw = new ArrayList<>();
|
List<File> zw = new ArrayList<>();
|
||||||
for (T2CLanguageEnum lan : T2CLanguageEnum.values()) {
|
for (T2C_LanguageEnum lan : T2C_LanguageEnum.values()) {
|
||||||
if (values[0].getLanguage().containsKey(lan)) {
|
if (values[0].getLanguage().containsKey(lan)) {
|
||||||
zw.add(new File(path + "/languages/" + lan.name() + ".yml"));
|
zw.add(new File(path + "/languages/" + lan.name() + ".yml"));
|
||||||
}
|
}
|
||||||
@ -33,9 +33,9 @@ public class T2C_LanguageWriter {
|
|||||||
}
|
}
|
||||||
for (File langFile : fileArray) {
|
for (File langFile : fileArray) {
|
||||||
if (langFile.getName().endsWith(".yml")) {
|
if (langFile.getName().endsWith(".yml")) {
|
||||||
T2CLanguageEnum lang = T2CLanguageEnum.english;
|
T2C_LanguageEnum lang = T2C_LanguageEnum.english;
|
||||||
try {
|
try {
|
||||||
lang = T2CLanguageEnum.valueOf(langFile.getName().replace(".yml", ""));
|
lang = T2C_LanguageEnum.valueOf(langFile.getName().replace(".yml", ""));
|
||||||
} catch (Exception ignore) {
|
} catch (Exception ignore) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ public class T2C_LanguageWriter {
|
|||||||
try {
|
try {
|
||||||
langFile.createNewFile();
|
langFile.createNewFile();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
T2C_Send.sendException(e, T2CodeLibMain.getPlugin().getLogger());
|
T2C_Send.sendException(e, T2C_Main.getPlugin().getLogger());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -52,7 +52,7 @@ public class T2C_LanguageWriter {
|
|||||||
// Copy default values if they are missing
|
// Copy default values if they are missing
|
||||||
config = YamlConfiguration.loadConfiguration(langFile);
|
config = YamlConfiguration.loadConfiguration(langFile);
|
||||||
config.options().copyDefaults(true);
|
config.options().copyDefaults(true);
|
||||||
for (T2CconfigItemLanguages item : values) {
|
for (T2C_ConfigItemLanguages item : values) {
|
||||||
config.addDefault(item.getPath(), item.getLanguage().get(lang));
|
config.addDefault(item.getPath(), item.getLanguage().get(lang));
|
||||||
|
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ public class T2C_LanguageWriter {
|
|||||||
readConfig(prefix, path, values, loadConfig, isReload);
|
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;
|
String selectMSG;
|
||||||
File msg;
|
File msg;
|
||||||
msg = new File(path, "languages/" + loadConfig + ".yml");
|
msg = new File(path, "languages/" + loadConfig + ".yml");
|
||||||
@ -75,14 +75,14 @@ public class T2C_LanguageWriter {
|
|||||||
T2C_Send.sendStartTextCenter(prefix, "", isReload);
|
T2C_Send.sendStartTextCenter(prefix, "", isReload);
|
||||||
T2C_Send.sendStartTextCenter(prefix, "§4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", 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, "§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, "§4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", isReload);
|
||||||
T2C_Send.sendStartTextCenter(prefix, "", isReload);
|
T2C_Send.sendStartTextCenter(prefix, "", isReload);
|
||||||
msg = new File(path, "languages/" + T2CLanguageEnum.english.name() + ".yml");
|
msg = new File(path, "languages/" + T2C_LanguageEnum.english.name() + ".yml");
|
||||||
selectMSG = T2CLanguageEnum.english.name();
|
selectMSG = T2C_LanguageEnum.english.name();
|
||||||
} else selectMSG = loadConfig;
|
} else selectMSG = loadConfig;
|
||||||
YamlConfiguration yml = YamlConfiguration.loadConfiguration(msg);
|
YamlConfiguration yml = YamlConfiguration.loadConfiguration(msg);
|
||||||
for (T2CconfigItemLanguages value : values) {
|
for (T2C_ConfigItemLanguages value : values) {
|
||||||
value.setValue(yml.get(value.getPath()));
|
value.setValue(yml.get(value.getPath()));
|
||||||
}
|
}
|
||||||
T2C_Send.sendStartTextCenter(prefix, "§2Language successfully selected to: §6" + selectMSG, isReload);
|
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.debug.T2C_Debug;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
||||||
import net.t2code.t2codelib.SPIGOT.system.config.config.T2C_LibConfig;
|
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.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -31,16 +31,16 @@ public class BungeeCommandSenderReceiver {
|
|||||||
output.writeUTF(information);
|
output.writeUTF(information);
|
||||||
output.writeUTF(String.valueOf(T2C_LibConfig.VALUES.serverUUID.getValue()));
|
output.writeUTF(String.valueOf(T2C_LibConfig.VALUES.serverUUID.getValue()));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
T2C_Send.sendException(e, T2CodeLibMain.getPlugin().getLogger());
|
T2C_Send.sendException(e, T2C_Main.getPlugin().getLogger());
|
||||||
}
|
}
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
player.sendPluginMessage(T2CodeLibMain.getPlugin(), Util.getPluginChannel_ProxyCommand(), stream.toByteArray());
|
player.sendPluginMessage(T2C_Main.getPlugin(), T2C_Util.getPluginChannel_ProxyCommand(), stream.toByteArray());
|
||||||
T2C_Debug.debug(T2CodeLibMain.getPlugin(), "PluginMessage received T2CbungeeCommandSenderReciver: "+Util.getPluginChannel_ProxyCommand()+" - " + Arrays.toString(stream.toByteArray()) + " Player: " + player.getName());
|
T2C_Debug.debug(T2C_Main.getPlugin(), "PluginMessage received T2CbungeeCommandSenderReciver: "+ T2C_Util.getPluginChannel_ProxyCommand()+" - " + Arrays.toString(stream.toByteArray()) + " Player: " + player.getName());
|
||||||
} else {
|
} else {
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
player.sendPluginMessage(T2CodeLibMain.getPlugin(), Util.getPluginChannel_ProxyCommand(), stream.toByteArray());
|
player.sendPluginMessage(T2C_Main.getPlugin(), T2C_Util.getPluginChannel_ProxyCommand(), stream.toByteArray());
|
||||||
T2C_Debug.debug(T2CodeLibMain.getPlugin(), "PluginMessage received T2CbungeeCommandSenderReciver: "+Util.getPluginChannel_ProxyCommand()+" - " + Arrays.toString(stream.toByteArray()) + " Player: " + player.getName());
|
T2C_Debug.debug(T2C_Main.getPlugin(), "PluginMessage received T2CbungeeCommandSenderReciver: "+ T2C_Util.getPluginChannel_ProxyCommand()+" - " + Arrays.toString(stream.toByteArray()) + " Player: " + player.getName());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
package net.t2code.t2codelib.SPIGOT.system;
|
package net.t2code.t2codelib.SPIGOT.system;
|
||||||
|
|
||||||
import net.t2code.t2codelib.SPIGOT.api.update.T2C_UpdateAPI;
|
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.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.player.PlayerLoginEvent;
|
import org.bukkit.event.player.PlayerLoginEvent;
|
||||||
@ -12,6 +12,6 @@ public class JoinEvent implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onJoinEvent(PlayerLoginEvent event) {
|
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.cmd.ReportLogStorage;
|
||||||
import net.t2code.t2codelib.SPIGOT.system.config.config.T2C_LibConfig;
|
import net.t2code.t2codelib.SPIGOT.system.config.config.T2C_LibConfig;
|
||||||
import net.t2code.t2codelib.SPIGOT.system.config.languages.T2CLibLanguages;
|
import net.t2code.t2codelib.SPIGOT.system.config.languages.T2CLibLanguages;
|
||||||
import net.t2code.t2codelib.T2CplatformDetector;
|
import net.t2code.t2codelib.util.T2C_PlatformDetector;
|
||||||
import net.t2code.t2codelib.Util;
|
import net.t2code.t2codelib.util.T2C_Util;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
public final class T2CodeLibMain extends JavaPlugin {
|
public final class T2C_Main extends JavaPlugin {
|
||||||
@Getter
|
@Getter
|
||||||
private static T2CodeLibMain plugin;
|
private static T2C_Main plugin;
|
||||||
@Getter
|
@Getter
|
||||||
private static Economy eco = null;
|
private static Economy eco = null;
|
||||||
@Getter
|
@Getter
|
||||||
@ -49,12 +47,11 @@ public final class T2CodeLibMain extends JavaPlugin {
|
|||||||
private static Boolean mmIsLoad = true;
|
private static Boolean mmIsLoad = true;
|
||||||
@Getter
|
@Getter
|
||||||
private static Boolean load = false;
|
private static Boolean load = false;
|
||||||
@Getter
|
|
||||||
private static T2CplatformDetector.PlatformType plattform;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
|
T2C_PlatformDetector.scan();
|
||||||
// Plugin startup logic
|
// Plugin startup logic
|
||||||
plugin = this;
|
plugin = this;
|
||||||
autor = plugin.getDescription().getAuthors();
|
autor = plugin.getDescription().getAuthors();
|
||||||
@ -66,15 +63,15 @@ public final class T2CodeLibMain extends JavaPlugin {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
mmIsLoad = false;
|
mmIsLoad = false;
|
||||||
}
|
}
|
||||||
plattform = T2CplatformDetector.detectPlatform();
|
|
||||||
load();
|
load();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void 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();
|
checkIsBungee();
|
||||||
String prefix = Util.getPrefix();
|
String prefix = T2C_Util.getPrefix();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Vault.loadVault();
|
Vault.loadVault();
|
||||||
@ -120,11 +117,11 @@ public final class T2CodeLibMain extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
T2C_Template.onLoadSeparateStroke(prefix);
|
T2C_Template.onLoadSeparateStroke(prefix);
|
||||||
T2C_Send.sendStartTextCenter(prefix, "§2Server run on:", true);
|
T2C_Send.sendStartTextCenter(prefix, "§2Server run on:", false);
|
||||||
T2C_Send.sendStartTextCenter(prefix, "§3NMS: §6" + T2C_McVersion.getNms(), true);
|
T2C_Send.sendStartTextCenter(prefix, "§3NMS: §6" + T2C_McVersion.getNms(), false);
|
||||||
T2C_Send.sendStartTextCenter(prefix, "§3Platform: §6" + plattform.name(), true);
|
T2C_Send.sendStartTextCenter(prefix, "§3Platform: §6" + T2C_PlatformDetector.detectPlatform, false);
|
||||||
T2C_Send.sendStartTextCenter(prefix, "§3Bukkit Version: §6" + T2C_McVersion.getBukkitVersion(), true);
|
T2C_Send.sendStartTextCenter(prefix, "§3Bukkit Version: §6" + T2C_McVersion.getBukkitVersion(), false);
|
||||||
T2C_Send.sendStartTextCenter(prefix, "§3Server Version: §6" + T2C_McVersion.getMcVersion(), true);
|
T2C_Send.sendStartTextCenter(prefix, "§3Server Version: §6" + T2C_McVersion.getMcVersion(), false);
|
||||||
|
|
||||||
T2C_Template.onLoadSeparateStroke(prefix);
|
T2C_Template.onLoadSeparateStroke(prefix);
|
||||||
if (eco != null) {
|
if (eco != null) {
|
||||||
@ -132,26 +129,26 @@ public final class T2CodeLibMain extends JavaPlugin {
|
|||||||
if (eco.getName().equals("CMIEconomy")) st = "CMI";
|
if (eco.getName().equals("CMIEconomy")) st = "CMI";
|
||||||
if (Bukkit.getPluginManager().getPlugin(st) != null) {
|
if (Bukkit.getPluginManager().getPlugin(st) != null) {
|
||||||
T2C_Send.sendStartTextCenter(prefix, "§3Economy: §6" + eco.getName() + " - " + Bukkit.getPluginManager().getPlugin(st).getDescription().getVersion() + " §7- §e" +
|
T2C_Send.sendStartTextCenter(prefix, "§3Economy: §6" + eco.getName() + " - " + Bukkit.getPluginManager().getPlugin(st).getDescription().getVersion() + " §7- §e" +
|
||||||
(System.currentTimeMillis() - long_) + "ms", true);
|
(System.currentTimeMillis() - long_) + "ms", false);
|
||||||
} else
|
} 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
|
} 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 (perm != null) {
|
||||||
if (Bukkit.getPluginManager().getPlugin(perm.getName()) != null) {
|
if (Bukkit.getPluginManager().getPlugin(perm.getName()) != null) {
|
||||||
T2C_Send.sendStartTextCenter(prefix, "§3Permission plugin: §6" + perm.getName() + " - " + Bukkit.getPluginManager().getPlugin(perm.getName()).getDescription().getVersion()
|
T2C_Send.sendStartTextCenter(prefix, "§3Permission plugin: §6" + perm.getName() + " - " + Bukkit.getPluginManager().getPlugin(perm.getName()).getDescription().getVersion()
|
||||||
+ " §7- §e" + (System.currentTimeMillis() - long_) + "ms", true);
|
+ " §7- §e" + (System.currentTimeMillis() - long_) + "ms", false);
|
||||||
} else
|
} 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
|
} 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()) {
|
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());
|
plugin.getCommand("t2code").setExecutor(new CmdExecuter());
|
||||||
@ -163,22 +160,22 @@ public final class T2CodeLibMain extends JavaPlugin {
|
|||||||
T2CLibLanguages.set(false);
|
T2CLibLanguages.set(false);
|
||||||
|
|
||||||
T2C_Template.onLoadSeparateStroke(prefix);
|
T2C_Template.onLoadSeparateStroke(prefix);
|
||||||
T2C_Send.sendStartTextCenter(prefix, "§3Use Proxy: §6" + (boolean) T2C_LibConfig.VALUES.proxy.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(), true);
|
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.updateCheckOnJoin.getValue(),
|
||||||
(boolean) T2C_LibConfig.VALUES.seePreReleaseUpdates.getValue(),
|
(boolean) T2C_LibConfig.VALUES.seePreReleaseUpdates.getValue(),
|
||||||
(int) T2C_LibConfig.VALUES.updateCheckTimeInterval.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()) {
|
if ((boolean) T2C_LibConfig.VALUES.proxy.getValue()) {
|
||||||
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, Util.getPluginChannel_ProxyCommand());
|
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, T2C_Util.getPluginChannel_ProxyCommand());
|
||||||
T2C_Debug.debug(plugin, "registerIncomingPluginChannel §e" + Util.getPluginChannel_ProxyCommand());
|
T2C_Debug.debug(plugin, "registerIncomingPluginChannel §e" + T2C_Util.getPluginChannel_ProxyCommand());
|
||||||
|
|
||||||
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, Util.getPluginChannel_ProxyOnlinePlayers());
|
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, T2C_Util.getPluginChannel_ProxyOnlinePlayers());
|
||||||
if (!Bukkit.getMessenger().isIncomingChannelRegistered(plugin, Util.getPluginChannel_ProxyOnlinePlayers())) {
|
if (!Bukkit.getMessenger().isIncomingChannelRegistered(plugin, T2C_Util.getPluginChannel_ProxyOnlinePlayers())) {
|
||||||
T2C_Debug.debug(plugin, "registerIncomingPluginChannel §e" + Util.getPluginChannel_ProxyOnlinePlayers());
|
T2C_Debug.debug(plugin, "registerIncomingPluginChannel §e" + T2C_Util.getPluginChannel_ProxyOnlinePlayers());
|
||||||
Bukkit.getMessenger().registerIncomingPluginChannel(plugin, Util.getPluginChannel_ProxyOnlinePlayers(), new T2C_BungeePlayers());
|
Bukkit.getMessenger().registerIncomingPluginChannel(plugin, T2C_Util.getPluginChannel_ProxyOnlinePlayers(), new T2C_BungeePlayers());
|
||||||
T2C_BungeePlayers.callAllBungeePlayers();
|
T2C_BungeePlayers.callAllBungeePlayers();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -202,7 +199,7 @@ public final class T2CodeLibMain extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Vault.vaultDisable();
|
Vault.vaultDisable();
|
||||||
T2C_Template.onDisable(Util.getPrefix(), this);
|
T2C_Template.onDisable(T2C_Util.getPrefix(), this);
|
||||||
if (mmIsLoad) {
|
if (mmIsLoad) {
|
||||||
if (this.adventure != null) {
|
if (this.adventure != null) {
|
||||||
this.adventure.close();
|
this.adventure.close();
|
||||||
@ -216,11 +213,11 @@ public final class T2CodeLibMain extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void setEco(Economy eco) {
|
static void setEco(Economy eco) {
|
||||||
T2CodeLibMain.eco = eco;
|
T2C_Main.eco = eco;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setPerm(Permission perm) {
|
static void setPerm(Permission perm) {
|
||||||
T2CodeLibMain.perm = perm;
|
T2C_Main.perm = perm;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static BukkitAudiences adventure;
|
private static BukkitAudiences adventure;
|
@ -3,7 +3,7 @@ package net.t2code.t2codelib.SPIGOT.system;
|
|||||||
import net.milkbowl.vault.economy.Economy;
|
import net.milkbowl.vault.economy.Economy;
|
||||||
import net.milkbowl.vault.permission.Permission;
|
import net.milkbowl.vault.permission.Permission;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
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 org.bukkit.plugin.RegisteredServiceProvider;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@ -15,37 +15,37 @@ public class Vault {
|
|||||||
|
|
||||||
public static void loadVault() throws InterruptedException {
|
public static void loadVault() throws InterruptedException {
|
||||||
long long_ = System.currentTimeMillis();
|
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;
|
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) {
|
if (eco != null) {
|
||||||
T2CodeLibMain.setEco(eco.getProvider());
|
T2C_Main.setEco(eco.getProvider());
|
||||||
if (T2CodeLibMain.getEco() != null) {
|
if (T2C_Main.getEco() != null) {
|
||||||
connected = true;
|
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 {
|
} else {
|
||||||
connected = false;
|
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 {
|
} else {
|
||||||
connected = false;
|
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) {
|
if (perm != null) {
|
||||||
T2CodeLibMain.setPerm(perm.getProvider());
|
T2C_Main.setPerm(perm.getProvider());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
vaultEnable = false;
|
vaultEnable = false;
|
||||||
connected = 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() {
|
public static void vaultDisable() {
|
||||||
if (!connected) return;
|
if (!connected) return;
|
||||||
connected = false;
|
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.messages.T2C_Send;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.update.T2C_UpdateAPI;
|
import net.t2code.t2codelib.SPIGOT.api.update.T2C_UpdateAPI;
|
||||||
import net.t2code.t2codelib.SPIGOT.system.BungeeCommandSenderReceiver;
|
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.config.T2C_LibConfig;
|
||||||
import net.t2code.t2codelib.SPIGOT.system.config.languages.T2CLibLanguages;
|
import net.t2code.t2codelib.SPIGOT.system.config.languages.T2CLibLanguages;
|
||||||
import net.t2code.t2codelib.T2CupdateObject;
|
import net.t2code.t2codelib.util.T2C_UpdateObject;
|
||||||
import net.t2code.t2codelib.Util;
|
import net.t2code.t2codelib.util.T2C_Util;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -72,7 +72,7 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
|
|||||||
}
|
}
|
||||||
T2C_LibConfig.set(true);
|
T2C_LibConfig.set(true);
|
||||||
T2CLibLanguages.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;
|
return false;
|
||||||
case "debug":
|
case "debug":
|
||||||
if (!sender.hasPermission("t2code.admin")) {
|
if (!sender.hasPermission("t2code.admin")) {
|
||||||
@ -94,7 +94,7 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
T2C_Send.sender(sender, ("[prefix] <red>T2C ServerID:</red> <gold><hover:show_text:'<yellow>copy</yellow>'>" +
|
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;
|
return false;
|
||||||
case "bcmd":
|
case "bcmd":
|
||||||
if (!sender.hasPermission("t2code.admin")) {
|
if (!sender.hasPermission("t2code.admin")) {
|
||||||
@ -107,7 +107,7 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
|
|||||||
}
|
}
|
||||||
cmd = cmd.replace("bcmd ", "");
|
cmd = cmd.replace("bcmd ", "");
|
||||||
BungeeCommandSenderReceiver.sendToBungee(null, cmd, true);
|
BungeeCommandSenderReceiver.sendToBungee(null, cmd, true);
|
||||||
T2C_Debug.debug(T2CodeLibMain.getPlugin(), "PluginMessage BCMD: " + cmd);
|
T2C_Debug.debug(T2C_Main.getPlugin(), "PluginMessage BCMD: " + cmd);
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -161,7 +161,7 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
|
|||||||
if (args.length == 2 && args[0].equalsIgnoreCase("updateinfo")) {
|
if (args.length == 2 && args[0].equalsIgnoreCase("updateinfo")) {
|
||||||
if (sender.hasPermission("t2code.admin")) {
|
if (sender.hasPermission("t2code.admin")) {
|
||||||
if (hasPermission(p, arg1.get("updateinfo"))) {
|
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);
|
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_Send;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Template;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Template;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.update.T2C_UpdateAPI;
|
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.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.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -15,11 +15,12 @@ import java.io.IOException;
|
|||||||
|
|
||||||
public class Commands {
|
public class Commands {
|
||||||
protected static void info(CommandSender sender) {
|
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) {
|
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) {
|
protected static void debug(CommandSender sender, String[] args) {
|
||||||
@ -46,13 +47,13 @@ public class Commands {
|
|||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
Boolean upload = args[2].equalsIgnoreCase("confirmupload");
|
Boolean upload = args[2].equalsIgnoreCase("confirmupload");
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(T2CodeLibMain.getPlugin(), new Runnable() {
|
Bukkit.getScheduler().runTaskAsynchronously(T2C_Main.getPlugin(), new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
CreateReportLog.create(sender, upload);
|
CreateReportLog.create(sender, upload);
|
||||||
} catch (IOException e) {
|
} 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);
|
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.messages.T2C_Send;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2C_McVersion;
|
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2C_McVersion;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.plugins.T2C_PluginCheck;
|
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.SPIGOT.system.Vault;
|
||||||
import net.t2code.t2codelib.Util;
|
import net.t2code.t2codelib.util.T2C_Util;
|
||||||
import org.apache.http.HttpEntity;
|
import org.apache.http.HttpEntity;
|
||||||
import org.apache.http.HttpResponse;
|
import org.apache.http.HttpResponse;
|
||||||
import org.apache.http.client.HttpClient;
|
import org.apache.http.client.HttpClient;
|
||||||
@ -37,10 +37,10 @@ import java.util.zip.ZipOutputStream;
|
|||||||
|
|
||||||
public class CreateReportLog {
|
public class CreateReportLog {
|
||||||
protected static void create(CommandSender sender, Boolean confirmUpload) throws IOException {
|
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());
|
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");
|
File directoryTemp = new File("T2CDebugLogsTemp");
|
||||||
if (!directory.exists()) {
|
if (!directory.exists()) {
|
||||||
directory.mkdir();
|
directory.mkdir();
|
||||||
@ -60,7 +60,7 @@ public class CreateReportLog {
|
|||||||
pWriter.println("Server run on: " + T2C_McVersion.getMcVersion());
|
pWriter.println("Server run on: " + T2C_McVersion.getMcVersion());
|
||||||
pWriter.println("Server NMS: " + T2C_McVersion.getNms());
|
pWriter.println("Server NMS: " + T2C_McVersion.getNms());
|
||||||
pWriter.println("Online Mode: " + Bukkit.getOnlineMode());
|
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("Server Port: " + Bukkit.getServer().getPort());
|
||||||
pWriter.println();
|
pWriter.println();
|
||||||
pWriter.println("Worlds: " + Bukkit.getWorlds());
|
pWriter.println("Worlds: " + Bukkit.getWorlds());
|
||||||
@ -73,18 +73,18 @@ public class CreateReportLog {
|
|||||||
pWriter.println("Vault: " + Bukkit.getPluginManager().getPlugin("Vault").getName() + " - " + Bukkit.getPluginManager().getPlugin("Vault")
|
pWriter.println("Vault: " + Bukkit.getPluginManager().getPlugin("Vault").getName() + " - " + Bukkit.getPluginManager().getPlugin("Vault")
|
||||||
.getDescription().getVersion());
|
.getDescription().getVersion());
|
||||||
} else pWriter.println("Vault: not connected");
|
} else pWriter.println("Vault: not connected");
|
||||||
if (T2CodeLibMain.getEco() != null) {
|
if (T2C_Main.getEco() != null) {
|
||||||
String st = T2CodeLibMain.getEco().getName();
|
String st = T2C_Main.getEco().getName();
|
||||||
if (T2CodeLibMain.getEco().getName().equals("CMIEconomy")) st = "CMI";
|
if (T2C_Main.getEco().getName().equals("CMIEconomy")) st = "CMI";
|
||||||
if (Bukkit.getPluginManager().getPlugin(st) != null) {
|
if (Bukkit.getPluginManager().getPlugin(st) != null) {
|
||||||
pWriter.println("Economy: " + T2CodeLibMain.getEco().isEnabled() + " - " + st + " - " + Bukkit.getPluginManager().getPlugin(st).getDescription().getVersion());
|
pWriter.println("Economy: " + T2C_Main.getEco().isEnabled() + " - " + st + " - " + Bukkit.getPluginManager().getPlugin(st).getDescription().getVersion());
|
||||||
} else pWriter.println("Economy: " + T2CodeLibMain.getEco().isEnabled() + " - " + st);
|
} else pWriter.println("Economy: " + T2C_Main.getEco().isEnabled() + " - " + st);
|
||||||
} else pWriter.println("Economy: not connected via vault");
|
} else pWriter.println("Economy: not connected via vault");
|
||||||
if (T2CodeLibMain.getPerm() != null) {
|
if (T2C_Main.getPerm() != null) {
|
||||||
if (Bukkit.getPluginManager().getPlugin(T2CodeLibMain.getPerm().getName()) != null) {
|
if (Bukkit.getPluginManager().getPlugin(T2C_Main.getPerm().getName()) != null) {
|
||||||
pWriter.println("Permission: " + T2CodeLibMain.getPerm().isEnabled() + " - " + T2CodeLibMain.getPerm().getName() + " - " + Bukkit.getPluginManager()
|
pWriter.println("Permission: " + T2C_Main.getPerm().isEnabled() + " - " + T2C_Main.getPerm().getName() + " - " + Bukkit.getPluginManager()
|
||||||
.getPlugin(T2CodeLibMain.getPerm().getName()).getDescription().getVersion());
|
.getPlugin(T2C_Main.getPerm().getName()).getDescription().getVersion());
|
||||||
} else pWriter.println("Permission: " + T2CodeLibMain.getPerm().isEnabled() + " - " + T2CodeLibMain.getPerm().getName());
|
} else pWriter.println("Permission: " + T2C_Main.getPerm().isEnabled() + " - " + T2C_Main.getPerm().getName());
|
||||||
} else pWriter.println("Permission: not connected via vault");
|
} else pWriter.println("Permission: not connected via vault");
|
||||||
pWriter.println();
|
pWriter.println();
|
||||||
pWriter.println("Java: " + System.getProperty("java.version"));
|
pWriter.println("Java: " + System.getProperty("java.version"));
|
||||||
@ -92,7 +92,7 @@ public class CreateReportLog {
|
|||||||
pWriter.println("System: " + System.getProperty("os.version"));
|
pWriter.println("System: " + System.getProperty("os.version"));
|
||||||
pWriter.println("User Home: " + System.getProperty("user.home"));
|
pWriter.println("User Home: " + System.getProperty("user.home"));
|
||||||
pWriter.println();
|
pWriter.println();
|
||||||
pWriter.println("T2CodeLib: " + T2CodeLibMain.getPlugin().getDescription().getVersion());
|
pWriter.println("T2CodeLib: " + T2C_Main.getPlugin().getDescription().getVersion());
|
||||||
pWriter.println();
|
pWriter.println();
|
||||||
if (T2C_PluginCheck.luckyBox()) {
|
if (T2C_PluginCheck.luckyBox()) {
|
||||||
pWriter.println("T2C-PremiumPlugins: ");
|
pWriter.println("T2C-PremiumPlugins: ");
|
||||||
@ -133,7 +133,7 @@ public class CreateReportLog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
T2C_Send.sendException(e, T2CodeLibMain.getPlugin().getLogger());
|
T2C_Send.sendException(e, T2C_Main.getPlugin().getLogger());
|
||||||
} finally {
|
} finally {
|
||||||
if (pWriter != null) {
|
if (pWriter != null) {
|
||||||
pWriter.flush();
|
pWriter.flush();
|
||||||
@ -159,7 +159,7 @@ public class CreateReportLog {
|
|||||||
zip.closeEntry();
|
zip.closeEntry();
|
||||||
zip.close();
|
zip.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
T2C_Send.sendException(e, T2CodeLibMain.getPlugin().getLogger());
|
T2C_Send.sendException(e, T2C_Main.getPlugin().getLogger());
|
||||||
}
|
}
|
||||||
file.delete();
|
file.delete();
|
||||||
File zipFile = new File(zipPath);
|
File zipFile = new File(zipPath);
|
||||||
@ -169,9 +169,9 @@ public class CreateReportLog {
|
|||||||
zipFile.delete();
|
zipFile.delete();
|
||||||
directoryTemp.delete();
|
directoryTemp.delete();
|
||||||
if (sender instanceof Player) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,9 +199,9 @@ public class CreateReportLog {
|
|||||||
"<br>[prefix] <dark_red>Do not share the download URL with anyone!</dark_red>" +
|
"<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] <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>")
|
"<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><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><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>" +
|
"<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 {
|
private static void pluginToDebug(ZipOutputStream zip) throws IOException {
|
||||||
for (Plugin plugin : Bukkit.getPluginManager().getPlugins()) {
|
for (Plugin plugin : Bukkit.getPluginManager().getPlugins()) {
|
||||||
String plName = plugin.getDescription().getName();
|
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());
|
File plConfigs = new File(plugin.getDataFolder().getPath());
|
||||||
if (plConfigs.exists()) {
|
if (plConfigs.exists()) {
|
||||||
addFolderToZip("T2Code-Plugins", plugin.getDataFolder().getPath(), zip);
|
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.messages.T2C_Send;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2C_McVersion;
|
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2C_McVersion;
|
||||||
import net.t2code.t2codelib.SPIGOT.system.config.config.T2C_LibConfig;
|
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.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@ -28,7 +28,7 @@ public class Development implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!(boolean) T2C_LibConfig.VALUES.developerTool.getValue()) {
|
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);
|
e.setCancelled(true);
|
||||||
t2cPls(e.getPlayer());
|
t2cPls(e.getPlayer());
|
||||||
@ -56,10 +56,10 @@ public class Development implements Listener {
|
|||||||
plSt = "<click:open_url:'" + plugin.getDescription().getWebsite() + "'>" + plSt + "</click>";
|
plSt = "<click:open_url:'" + plugin.getDescription().getWebsite() + "'>" + plSt + "</click>";
|
||||||
}
|
}
|
||||||
if (plugin.isEnabled()) {
|
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>, ";
|
msg = msg + "<dark_green>" + plSt + "</dark_green>, ";
|
||||||
} else msg = msg + "<green>" + plSt + "</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>, ";
|
msg = msg + "<dark_red>" + plSt + "</dark_red>, ";
|
||||||
} else msg = msg + "<red>" + plSt + "</red>, ";
|
} else msg = msg + "<red>" + plSt + "</red>, ";
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package net.t2code.t2codelib.SPIGOT.system.cmd;
|
package net.t2code.t2codelib.SPIGOT.system.cmd;
|
||||||
|
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
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 org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -12,7 +12,7 @@ import java.util.List;
|
|||||||
public class ReportLogStorage {
|
public class ReportLogStorage {
|
||||||
public static List<String> list = new ArrayList<>();
|
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);
|
protected static YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||||
|
|
||||||
public static void add(String key) {
|
public static void add(String key) {
|
||||||
@ -32,7 +32,7 @@ public class ReportLogStorage {
|
|||||||
try {
|
try {
|
||||||
yamlConfiguration.save(config);
|
yamlConfiguration.save(config);
|
||||||
} catch (IOException e) {
|
} 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;
|
package net.t2code.t2codelib.SPIGOT.system.config.config;
|
||||||
|
|
||||||
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
import net.t2code.t2codelib.SPIGOT.system.T2C_Main;
|
||||||
import net.t2code.t2codelib.T2CconfigItem;
|
import net.t2code.t2codelib.util.T2C_ConfigItem;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -12,7 +12,7 @@ public class ConvertT2ClibConfig {
|
|||||||
|
|
||||||
|
|
||||||
public static void convert() {
|
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);
|
yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||||
|
|
||||||
if (!config.exists()) return;
|
if (!config.exists()) return;
|
||||||
@ -32,7 +32,7 @@ public class ConvertT2ClibConfig {
|
|||||||
config.delete();
|
config.delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void set(String path, T2CconfigItem item){
|
private static void set(String path, T2C_ConfigItem item){
|
||||||
if (yamlConfiguration.contains(path)){
|
if (yamlConfiguration.contains(path)){
|
||||||
item.setValue(yamlConfiguration.get(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.messages.T2C_Send;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.yaml.T2C_ConfigWriter;
|
import net.t2code.t2codelib.SPIGOT.api.yaml.T2C_ConfigWriter;
|
||||||
import net.t2code.t2codelib.T2CLanguageEnum;
|
import net.t2code.t2codelib.util.T2C_LanguageEnum;
|
||||||
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
import net.t2code.t2codelib.SPIGOT.system.T2C_Main;
|
||||||
import net.t2code.t2codelib.T2CconfigItem;
|
import net.t2code.t2codelib.util.T2C_ConfigItem;
|
||||||
import net.t2code.t2codelib.Util;
|
import net.t2code.t2codelib.util.T2C_Util;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class T2C_LibConfig {
|
public class T2C_LibConfig {
|
||||||
|
|
||||||
public enum VALUES implements T2CconfigItem {
|
public enum VALUES implements T2C_ConfigItem {
|
||||||
|
|
||||||
updateCheckOnJoin("plugin.updateCheck.onJoin", true, true,
|
updateCheckOnJoin("plugin.updateCheck.onJoin", true, true,
|
||||||
new HashMap<>() {{
|
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(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(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.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,
|
updateCheckTimeInterval("plugin.updateCheck.timeInterval", 60, true,
|
||||||
new HashMap<>() {{
|
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(T2C_LanguageEnum.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.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,
|
seePreReleaseUpdates("plugin.updateCheck.seePreReleaseUpdates", true, true,
|
||||||
new HashMap<>() {{
|
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(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(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.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,
|
updateCheckFullDisable("plugin.updateCheck.allPlugins.fullDisable", false, true,
|
||||||
new HashMap<>() {{
|
new HashMap<>() {{
|
||||||
put(T2CLanguageEnum.german, List.of("Diese Option deaktiviert alle Aktualisierungsprüfungen für Plugins, die die T2CodeLib verwenden."));
|
put(T2C_LanguageEnum.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.english, List.of("This option deactivates all update checks for plugins that use the T2CodeLib."));
|
||||||
}}),
|
}}),
|
||||||
|
|
||||||
debug("plugin.debug.debugModus", false, true,
|
debug("plugin.debug.debugModus", false, true,
|
||||||
new HashMap<>() {{
|
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(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(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.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,
|
developerTool("plugin.debug.developerTool", false, true,
|
||||||
new HashMap<>() {{
|
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(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(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.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,
|
language("plugin.language", "english", true,
|
||||||
new HashMap<>() {{
|
new HashMap<>() {{
|
||||||
put(T2CLanguageEnum.german, List.of("In dieser Option kannst du die Sprache des Plugins einstellen."));
|
put(T2C_LanguageEnum.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.english, List.of("In this option you can set the language of the plugin."));
|
||||||
}}),
|
}}),
|
||||||
|
|
||||||
space_proxy("proxy", null, true,
|
space_proxy("proxy", null, true,
|
||||||
new HashMap<>() {{
|
new HashMap<>() {{
|
||||||
put(T2CLanguageEnum.german, List.of());
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
put(T2CLanguageEnum.english, List.of());
|
put(T2C_LanguageEnum.english, List.of());
|
||||||
}}),
|
}}),
|
||||||
proxy("proxy.enable", T2CodeLibMain.getIsBungee(), true,
|
proxy("proxy.enable", T2C_Main.getIsBungee(), true,
|
||||||
new HashMap<>() {{
|
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!"));
|
, "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!"));
|
, "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,
|
serverUUID("proxy.serverUUID", UUID.randomUUID(), true,
|
||||||
new HashMap<>() {{
|
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(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(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.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,
|
space_player("player", null, true,
|
||||||
new HashMap<>() {{
|
new HashMap<>() {{
|
||||||
put(T2CLanguageEnum.german, List.of());
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
put(T2CLanguageEnum.english, List.of());
|
put(T2C_LanguageEnum.english, List.of());
|
||||||
}}),
|
}}),
|
||||||
|
|
||||||
inventoriesCloseByServerStop("player.inventories.closeByServerStop", true, true,
|
inventoriesCloseByServerStop("player.inventories.closeByServerStop", true, true,
|
||||||
new HashMap<>() {{
|
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)"));
|
"(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)"));
|
"(This does not mean the entire network if a proxy is used)"));
|
||||||
|
|
||||||
}}),
|
}}),
|
||||||
|
|
||||||
space_command("command", null, true,
|
space_command("command", null, true,
|
||||||
new HashMap<>() {{
|
new HashMap<>() {{
|
||||||
put(T2CLanguageEnum.german, List.of());
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
put(T2CLanguageEnum.english, List.of());
|
put(T2C_LanguageEnum.english, List.of());
|
||||||
}}),
|
}}),
|
||||||
|
|
||||||
commandPermToggleCommand("command.permToggle.permissionSetCommand", "lp user [player] permission set [perm] [value]", true,
|
commandPermToggleCommand("command.permToggle.permissionSetCommand", "lp user [player] permission set [perm] [value]", true,
|
||||||
new HashMap<>() {{
|
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(T2C_LanguageEnum.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.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 final String path;
|
||||||
private Object value;
|
private Object value;
|
||||||
private final boolean forceSet;
|
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.path = path;
|
||||||
this.value = value;
|
this.value = value;
|
||||||
this.forceSet = forceSet;
|
this.forceSet = forceSet;
|
||||||
@ -131,7 +131,7 @@ public class T2C_LibConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HashMap<T2CLanguageEnum, List<String>> getComments() {
|
public HashMap<T2C_LanguageEnum, List<String>> getComments() {
|
||||||
return comments;
|
return comments;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,9 +149,9 @@ public class T2C_LibConfig {
|
|||||||
public static void set(boolean isReload) {
|
public static void set(boolean isReload) {
|
||||||
long long_ = System.currentTimeMillis();
|
long long_ = System.currentTimeMillis();
|
||||||
ConvertT2ClibConfig.convert();
|
ConvertT2ClibConfig.convert();
|
||||||
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 lombok.NonNull;
|
||||||
import net.t2code.t2codelib.T2CLanguageEnum;
|
import net.t2code.t2codelib.util.T2C_LanguageEnum;
|
||||||
import net.t2code.t2codelib.T2CconfigItemLanguages;
|
import net.t2code.t2codelib.util.T2C_ConfigItemLanguages;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.yaml.T2C_LanguageWriter;
|
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.SPIGOT.system.config.config.T2C_LibConfig;
|
||||||
import net.t2code.t2codelib.Util;
|
import net.t2code.t2codelib.util.T2C_Util;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class T2CLibLanguages {
|
public class T2CLibLanguages {
|
||||||
|
|
||||||
public enum VALUES implements T2CconfigItemLanguages {
|
public enum VALUES implements T2C_ConfigItemLanguages {
|
||||||
otherLang("plugin", null,
|
otherLang("plugin", null,
|
||||||
new HashMap<>() {{
|
new HashMap<>() {{
|
||||||
put(T2CLanguageEnum.german, null);
|
put(T2C_LanguageEnum.german, null);
|
||||||
put(T2CLanguageEnum.english, null);
|
put(T2C_LanguageEnum.english, null);
|
||||||
}},
|
}},
|
||||||
new HashMap<>() {{
|
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(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(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.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",
|
vaultNotSetUp("plugin.vaultNotSetUp",
|
||||||
null,
|
null,
|
||||||
new HashMap<>() {{
|
new HashMap<>() {{
|
||||||
put(T2CLanguageEnum.german, "[prefix] &4Vault / Economy nicht eingerichtet!");
|
put(T2C_LanguageEnum.german, "[prefix] &4Vault / Economy nicht eingerichtet!");
|
||||||
put(T2CLanguageEnum.english, "[prefix] &4Vault / Economy not set up!");
|
put(T2C_LanguageEnum.english, "[prefix] &4Vault / Economy not set up!");
|
||||||
}},
|
}},
|
||||||
new HashMap<>() {{
|
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(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(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.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",
|
votingPluginNotSetUp("plugin.votingPluginNotSetUp",
|
||||||
null,
|
null,
|
||||||
new HashMap<>() {{
|
new HashMap<>() {{
|
||||||
put(T2CLanguageEnum.german, "[prefix] &4VotingPlugin ist auf dem Server nicht vorhanden!");
|
put(T2C_LanguageEnum.german, "[prefix] &4VotingPlugin ist auf dem Server nicht vorhanden!");
|
||||||
put(T2CLanguageEnum.english, "[prefix] &4VotingPlugin is not present on the server!");
|
put(T2C_LanguageEnum.english, "[prefix] &4VotingPlugin is not present on the server!");
|
||||||
}},
|
}},
|
||||||
new HashMap<>() {{
|
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(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(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.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",
|
soundNotFound("plugin.soundNotFound",
|
||||||
null,
|
null,
|
||||||
new HashMap<>() {{
|
new HashMap<>() {{
|
||||||
put(T2CLanguageEnum.german, "[prefix] &4Der Sound &6[sound] &4wurde nicht gefunden! Bitte überprüfe die Einstellungen.");
|
put(T2C_LanguageEnum.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.english, "[prefix] &4The sound &6[sound] &4was not found! Please check the settings.");
|
||||||
}},
|
}},
|
||||||
new HashMap<>() {{
|
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(T2C_LanguageEnum.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.english, List.of());
|
||||||
}}),
|
}}),
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
private final String path;
|
private final String path;
|
||||||
private Object value;
|
private Object value;
|
||||||
private final HashMap<T2CLanguageEnum, String> lang;
|
private final HashMap<T2C_LanguageEnum, String> lang;
|
||||||
private final HashMap<T2CLanguageEnum, List<String>> comments;
|
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.path = path;
|
||||||
this.value = value;
|
this.value = value;
|
||||||
this.lang = lang;
|
this.lang = lang;
|
||||||
@ -80,18 +80,18 @@ public class T2CLibLanguages {
|
|||||||
@Override
|
@Override
|
||||||
public Object getValue() {
|
public Object getValue() {
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
return lang.get(T2CLanguageEnum.english);
|
return lang.get(T2C_LanguageEnum.english);
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HashMap<T2CLanguageEnum, String> getLanguage() {
|
public HashMap<T2C_LanguageEnum, String> getLanguage() {
|
||||||
return lang;
|
return lang;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HashMap<T2CLanguageEnum, List<String>> getComments() {
|
public HashMap<T2C_LanguageEnum, List<String>> getComments() {
|
||||||
return comments;
|
return comments;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,7 +102,7 @@ public class T2CLibLanguages {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void set(boolean isReload) {
|
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());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,7 +0,0 @@
|
|||||||
package net.t2code.t2codelib;
|
|
||||||
|
|
||||||
public enum T2CLanguageEnum {
|
|
||||||
german,
|
|
||||||
english,
|
|
||||||
norwegian
|
|
||||||
}
|
|
@ -8,7 +8,7 @@ import com.velocitypowered.api.event.Subscribe;
|
|||||||
import com.velocitypowered.api.event.connection.PluginMessageEvent;
|
import com.velocitypowered.api.event.connection.PluginMessageEvent;
|
||||||
import com.velocitypowered.api.proxy.Player;
|
import com.velocitypowered.api.proxy.Player;
|
||||||
import com.velocitypowered.api.proxy.ProxyServer;
|
import com.velocitypowered.api.proxy.ProxyServer;
|
||||||
import net.t2code.t2codelib.Util;
|
import net.t2code.t2codelib.util.T2C_Util;
|
||||||
import net.t2code.t2codelib.VELOCITY.api.commands.T2CV_Cmd;
|
import net.t2code.t2codelib.VELOCITY.api.commands.T2CV_Cmd;
|
||||||
import net.t2code.t2codelib.VELOCITY.system.T2CV_Main;
|
import net.t2code.t2codelib.VELOCITY.system.T2CV_Main;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@ -41,12 +41,12 @@ public class T2CV_PluginMessageProxyCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (channel.equals("T2Code-Console")) {
|
if (channel.equals("T2Code-Console")) {
|
||||||
logger.info("{} [{}] T2C BCMD Command Console: {}", Util.getVPrefix(), serverID, input);
|
logger.info("{} [{}] T2C BCMD Command Console: {}", T2C_Util.getVPrefix(), serverID, input);
|
||||||
T2CV_Cmd.Console(input);
|
T2CV_Cmd.Console(input);
|
||||||
} else {
|
} else {
|
||||||
Player player = server.getPlayer(channel).orElse(null);
|
Player player = server.getPlayer(channel).orElse(null);
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
logger.info("{} [{}] T2C BCMD Command {}: {}", Util.getVPrefix(), serverID, player, input);
|
logger.info("{} [{}] T2C BCMD Command {}: {}", T2C_Util.getVPrefix(), serverID, player, input);
|
||||||
T2CV_Cmd.Player(player, input);
|
T2CV_Cmd.Player(player, input);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ import com.velocitypowered.api.proxy.Player;
|
|||||||
import com.velocitypowered.api.proxy.ProxyServer;
|
import com.velocitypowered.api.proxy.ProxyServer;
|
||||||
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.bungeePlayers.T2C_BngeePlayersEnum;
|
import net.t2code.t2codelib.SPIGOT.api.bungeePlayers.T2C_BngeePlayersEnum;
|
||||||
import net.t2code.t2codelib.Util;
|
import net.t2code.t2codelib.util.T2C_Util;
|
||||||
import net.t2code.t2codelib.VELOCITY.api.messages.T2CV_Send;
|
import net.t2code.t2codelib.VELOCITY.api.messages.T2CV_Send;
|
||||||
import net.t2code.t2codelib.VELOCITY.system.T2CV_Main;
|
import net.t2code.t2codelib.VELOCITY.system.T2CV_Main;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@ -61,7 +61,7 @@ public class T2CV_Players {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.error (e.getMessage());
|
logger.error (e.getMessage());
|
||||||
}
|
}
|
||||||
T2CV_Send.debug(logger, "PluginMessage received channel: "+ Util.getPluginChannel_ProxyOnlinePlayers());
|
T2CV_Send.debug(logger, "PluginMessage received channel: "+ T2C_Util.getPluginChannel_ProxyOnlinePlayers());
|
||||||
T2CV_Send.debug(logger, "PluginMessage received subChannel: " + value.name());
|
T2CV_Send.debug(logger, "PluginMessage received subChannel: " + value.name());
|
||||||
T2CV_Send.debug(logger, "PluginMessage received input: " + name);
|
T2CV_Send.debug(logger, "PluginMessage received input: " + name);
|
||||||
T2CV_Send.debug(logger, "PluginMessage received input2/uuid: " + uuid);
|
T2CV_Send.debug(logger, "PluginMessage received input2/uuid: " + uuid);
|
||||||
|
@ -3,9 +3,10 @@ package net.t2code.t2codelib.VELOCITY.api.update;
|
|||||||
|
|
||||||
import com.velocitypowered.api.plugin.PluginContainer;
|
import com.velocitypowered.api.plugin.PluginContainer;
|
||||||
import com.velocitypowered.api.proxy.ProxyServer;
|
import com.velocitypowered.api.proxy.ProxyServer;
|
||||||
import net.t2code.t2codelib.T2CupdateObject;
|
import net.t2code.t2codelib.util.T2C_GenerateFrame;
|
||||||
import net.t2code.t2codelib.T2CupdateWebData;
|
import net.t2code.t2codelib.util.T2C_UpdateObject;
|
||||||
import net.t2code.t2codelib.UpdateType;
|
import net.t2code.t2codelib.util.T2C_UpdateWebData;
|
||||||
|
import net.t2code.t2codelib.util.T2C_UpdateType;
|
||||||
import net.t2code.t2codelib.VELOCITY.api.messages.T2CV_Send;
|
import net.t2code.t2codelib.VELOCITY.api.messages.T2CV_Send;
|
||||||
import net.t2code.t2codelib.VELOCITY.system.config.T2CV_LibConfig;
|
import net.t2code.t2codelib.VELOCITY.system.config.T2CV_LibConfig;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@ -14,30 +15,30 @@ import java.time.Duration;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
public class T2CV_UpdateAPI {
|
public class T2CV_UpdateAPI {
|
||||||
public static HashMap<String, T2CupdateObject> bungeePluginVersins = new HashMap<>();
|
public static HashMap<String, T2C_UpdateObject> bungeePluginVersins = new HashMap<>();
|
||||||
|
|
||||||
public static void sendUpdateMsg(Logger logger, String prefix, String discord, T2CupdateWebData webData, PluginContainer plugin) {
|
public static void sendUpdateMsg(Logger logger, String prefix, String discord, T2C_UpdateWebData webData, PluginContainer plugin) {
|
||||||
String publicVersion = webData.getVersion();
|
String publicVersion = webData.getVersion();
|
||||||
String pluginVersion = plugin.getDescription().getVersion().orElse("unknown");
|
String pluginVersion = plugin.getDescription().getVersion().orElse("unknown");
|
||||||
String value;
|
String value;
|
||||||
if (webData.isPreRelease()) {
|
if (webData.isPreRelease()) {
|
||||||
value = UpdateType.PRERELEASE_.text;
|
value = T2C_UpdateType.PRERELEASE_.text;
|
||||||
if (publicVersion.toLowerCase().contains("dev")) {
|
if (publicVersion.toLowerCase().contains("dev")) {
|
||||||
value = UpdateType.DEVELOPMENT_.text;
|
value = T2C_UpdateType.DEVELOPMENT_.text;
|
||||||
}
|
}
|
||||||
if (publicVersion.toLowerCase().contains("beta")) {
|
if (publicVersion.toLowerCase().contains("beta")) {
|
||||||
value = UpdateType.BETA_.text;
|
value = T2C_UpdateType.BETA_.text;
|
||||||
}
|
}
|
||||||
if (publicVersion.toLowerCase().contains("snapshot")) {
|
if (publicVersion.toLowerCase().contains("snapshot")) {
|
||||||
value = UpdateType.SNAPSHOT_.text;
|
value = T2C_UpdateType.SNAPSHOT_.text;
|
||||||
}
|
}
|
||||||
} else value = UpdateType.STABLE_.text;
|
} else value = T2C_UpdateType.STABLE_.text;
|
||||||
T2CV_Send.console(logger, "╔══════════════" + prefix + "══════════════");
|
String s1 = "A new [value] version was found!".replace("[value]", value);
|
||||||
T2CV_Send.console(logger, "║ A new [value] version was found!".replace("[value]", value));
|
String s2 = "Your version: " + pluginVersion + " - Current version: " + webData.getVersion();
|
||||||
T2CV_Send.console(logger, "║ Your version: " + pluginVersion + " - Current version: " + webData.getVersion());
|
String s3 = "You can download it here: " + webData.getUpdateUrl();
|
||||||
T2CV_Send.console(logger, "║ You can download it here: " + webData.getUpdateUrl());
|
String s4 = "You can find more information on Discord: " + discord;
|
||||||
T2CV_Send.console(logger, "║ You can find more information on Discord: " + discord);
|
|
||||||
T2CV_Send.console(logger, "╚══════════════" + prefix + "══════════════");
|
T2CV_Send.console(logger, T2C_GenerateFrame.getFrameCenter("[t2codelib]", true, s1, s2, s3, s4));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Boolean noUpdate = true;
|
private static Boolean noUpdate = true;
|
||||||
@ -51,7 +52,7 @@ public class T2CV_UpdateAPI {
|
|||||||
server.getScheduler().buildTask(plugin, () -> {
|
server.getScheduler().buildTask(plugin, () -> {
|
||||||
(new T2CV_UpdateCheckerGit(plugin, logger)).getVersion((webData) -> {
|
(new T2CV_UpdateCheckerGit(plugin, logger)).getVersion((webData) -> {
|
||||||
pluginVersion = plugin.getDescription().getVersion().toString();
|
pluginVersion = plugin.getDescription().getVersion().toString();
|
||||||
T2CupdateObject update = new T2CupdateObject(
|
T2C_UpdateObject update = new T2C_UpdateObject(
|
||||||
plugin.getDescription().getName().toString(),
|
plugin.getDescription().getName().toString(),
|
||||||
plugin.getDescription().getVersion().toString(),
|
plugin.getDescription().getVersion().toString(),
|
||||||
webData,
|
webData,
|
||||||
|
@ -2,8 +2,8 @@ package net.t2code.t2codelib.VELOCITY.api.update;
|
|||||||
|
|
||||||
import com.velocitypowered.api.plugin.PluginContainer;
|
import com.velocitypowered.api.plugin.PluginContainer;
|
||||||
import net.t2code.t2codelib.BUNGEE.system.config.T2CB_LibConfig;
|
import net.t2code.t2codelib.BUNGEE.system.config.T2CB_LibConfig;
|
||||||
import net.t2code.t2codelib.T2CupdateObject;
|
import net.t2code.t2codelib.util.T2C_UpdateObject;
|
||||||
import net.t2code.t2codelib.T2CupdateWebData;
|
import net.t2code.t2codelib.util.T2C_UpdateWebData;
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@ -28,7 +28,7 @@ public class T2CV_UpdateCheckerGit {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getVersion(Consumer<T2CupdateWebData> consumer, String pluginVersion, Integer spigotID, String gitKey) {
|
public void getVersion(Consumer<T2C_UpdateWebData> consumer, String pluginVersion, Integer spigotID, String gitKey) {
|
||||||
String RepoURL = "https://git.t2code.net/api/v1/repos/" + gitKey + "/releases?limit=1";
|
String RepoURL = "https://git.t2code.net/api/v1/repos/" + gitKey + "/releases?limit=1";
|
||||||
if (!(boolean) T2CB_LibConfig.VALUES.seePreReleaseUpdates.getValue() ) {
|
if (!(boolean) T2CB_LibConfig.VALUES.seePreReleaseUpdates.getValue() ) {
|
||||||
RepoURL = RepoURL + "&pre-release=false";
|
RepoURL = RepoURL + "&pre-release=false";
|
||||||
@ -78,14 +78,14 @@ public class T2CV_UpdateCheckerGit {
|
|||||||
updateUrl = "https://www.spigotmc.org/resources/" + spigotID;
|
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);
|
consumer.accept(webData);
|
||||||
} catch (Exception var10) {
|
} catch (Exception var10) {
|
||||||
Boolean load = false;
|
Boolean load = false;
|
||||||
if (T2CV_UpdateAPI.bungeePluginVersins.containsKey(plugin.getDescription().getName().toString())) {
|
if (T2CV_UpdateAPI.bungeePluginVersins.containsKey(plugin.getDescription().getName().toString())) {
|
||||||
load = T2CV_UpdateAPI.bungeePluginVersins.get(plugin.getDescription().getName().toString()).load;
|
load = T2CV_UpdateAPI.bungeePluginVersins.get(plugin.getDescription().getName().toString()).load;
|
||||||
}
|
}
|
||||||
T2CupdateObject update = new T2CupdateObject(
|
T2C_UpdateObject update = new T2C_UpdateObject(
|
||||||
plugin.getDescription().getName().toString(),
|
plugin.getDescription().getName().toString(),
|
||||||
pluginVersion,
|
pluginVersion,
|
||||||
null,
|
null,
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package net.t2code.t2codelib.VELOCITY.api.yml;// This class was created by JaTiTV.
|
package net.t2code.t2codelib.VELOCITY.api.yml;// This class was created by JaTiTV.
|
||||||
|
|
||||||
|
|
||||||
import net.t2code.t2codelib.T2CLanguageEnum;
|
import net.t2code.t2codelib.util.T2C_LanguageEnum;
|
||||||
import net.t2code.t2codelib.T2CconfigItem;
|
import net.t2code.t2codelib.util.T2C_ConfigItem;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.yaml.snakeyaml.Yaml;
|
import org.yaml.snakeyaml.Yaml;
|
||||||
|
|
||||||
@ -15,7 +15,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
public class T2CV_ConfigWriter {
|
public class T2CV_ConfigWriter {
|
||||||
|
|
||||||
public static void createConfig(Logger logger, File configFile, T2CconfigItem[] manager, String... header) throws IOException {
|
public static void createConfig(Logger logger, File configFile, T2C_ConfigItem[] manager, String... header) throws IOException {
|
||||||
boolean exist = configFile.exists();
|
boolean exist = configFile.exists();
|
||||||
if (!exist) {
|
if (!exist) {
|
||||||
configFile.getParentFile().mkdirs();
|
configFile.getParentFile().mkdirs();
|
||||||
@ -34,9 +34,9 @@ public class T2CV_ConfigWriter {
|
|||||||
config = new LinkedHashMap<>();
|
config = new LinkedHashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
T2CLanguageEnum lang = T2CLanguageEnum.english;
|
T2C_LanguageEnum lang = T2C_LanguageEnum.english;
|
||||||
|
|
||||||
for (T2CconfigItem item : manager) {
|
for (T2C_ConfigItem item : manager) {
|
||||||
if (item.getForceSet() || !exist) {
|
if (item.getForceSet() || !exist) {
|
||||||
readValue(config, item.getPath(), item);
|
readValue(config, item.getPath(), item);
|
||||||
addValue(config, item.getPath(), item.getValue());
|
addValue(config, item.getPath(), item.getValue());
|
||||||
@ -50,7 +50,7 @@ public class T2CV_ConfigWriter {
|
|||||||
saveConfigWithComments(configFile, comments, config, header);
|
saveConfigWithComments(configFile, comments, config, header);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void readValue(Map<String, Object> config, String path, T2CconfigItem value) {
|
private static void readValue(Map<String, Object> config, String path, T2C_ConfigItem value) {
|
||||||
if (path.contains(".")) {
|
if (path.contains(".")) {
|
||||||
String[] pathsplit = path.split("\\.");
|
String[] pathsplit = path.split("\\.");
|
||||||
String key = pathsplit[0];
|
String key = pathsplit[0];
|
||||||
|
@ -11,7 +11,10 @@ import com.velocitypowered.api.proxy.ProxyServer;
|
|||||||
import com.velocitypowered.api.proxy.messages.MinecraftChannelIdentifier;
|
import com.velocitypowered.api.proxy.messages.MinecraftChannelIdentifier;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
import net.t2code.t2codelib.Util;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
||||||
|
import net.t2code.t2codelib.util.T2C_GenerateFrame;
|
||||||
|
import net.t2code.t2codelib.util.T2C_PlatformDetector;
|
||||||
|
import net.t2code.t2codelib.util.T2C_Util;
|
||||||
import net.t2code.t2codelib.VELOCITY.api.pluginMessaging.T2CV_PluginMessageProxyCommand;
|
import net.t2code.t2codelib.VELOCITY.api.pluginMessaging.T2CV_PluginMessageProxyCommand;
|
||||||
import net.t2code.t2codelib.VELOCITY.api.pluginMessaging.autoResponse.T2CV_API_AutoResponse;
|
import net.t2code.t2codelib.VELOCITY.api.pluginMessaging.autoResponse.T2CV_API_AutoResponse;
|
||||||
import net.t2code.t2codelib.VELOCITY.api.pluginMessaging.commandgui.T2CV_API_CGUI;
|
import net.t2code.t2codelib.VELOCITY.api.pluginMessaging.commandgui.T2CV_API_CGUI;
|
||||||
@ -40,39 +43,35 @@ public class T2CV_Main {
|
|||||||
|
|
||||||
private final T2CV_Metrics.Factory metricsFactory;
|
private final T2CV_Metrics.Factory metricsFactory;
|
||||||
|
|
||||||
|
public static final MinecraftChannelIdentifier bcmd = MinecraftChannelIdentifier.from(T2C_Util.getPluginChannel_ProxyCommand());
|
||||||
public static final MinecraftChannelIdentifier bcmd = MinecraftChannelIdentifier.from(Util.getPluginChannel_ProxyCommand());
|
public static final MinecraftChannelIdentifier bonlp = MinecraftChannelIdentifier.from(T2C_Util.getPluginChannel_ProxyOnlinePlayers());
|
||||||
public static final MinecraftChannelIdentifier bonlp = MinecraftChannelIdentifier.from(Util.getPluginChannel_ProxyOnlinePlayers());
|
public static final MinecraftChannelIdentifier cguiopl = MinecraftChannelIdentifier.from(T2C_Util.getPluginChannel_CGUIOnlinePlayers());
|
||||||
public static final MinecraftChannelIdentifier cguiopl = MinecraftChannelIdentifier.from(Util.getPluginChannel_CGUIOnlinePlayers());
|
public static final MinecraftChannelIdentifier aresp = MinecraftChannelIdentifier.from(T2C_Util.getPluginChannel_AutoResponse());
|
||||||
public static final MinecraftChannelIdentifier aresp = MinecraftChannelIdentifier.from(Util.getPluginChannel_AutoResponse());
|
public static final MinecraftChannelIdentifier opsec = MinecraftChannelIdentifier.from(T2C_Util.getPluginChannel_OPSecurity());
|
||||||
public static final MinecraftChannelIdentifier opsec = MinecraftChannelIdentifier.from(Util.getPluginChannel_OPSecurity());
|
|
||||||
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public T2CV_Main(ProxyServer server, Logger logger, @DataDirectory Path dataDirectory, T2CV_Metrics.Factory metricsFactory) {
|
public T2CV_Main(ProxyServer server, Logger logger, @DataDirectory Path dataDirectory, T2CV_Metrics.Factory metricsFactory) {
|
||||||
|
T2C_PlatformDetector.scan();
|
||||||
starttime = System.currentTimeMillis();
|
starttime = System.currentTimeMillis();
|
||||||
T2CV_Main.server = server;
|
T2CV_Main.server = server;
|
||||||
T2CV_Main.logger = logger;
|
T2CV_Main.logger = logger;
|
||||||
T2CV_Main.dataDirectory = dataDirectory;
|
T2CV_Main.dataDirectory = dataDirectory;
|
||||||
this.metricsFactory = metricsFactory;
|
this.metricsFactory = metricsFactory;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onLoad(ProxyInitializeEvent e) {
|
public void onLoad(ProxyInitializeEvent e) {
|
||||||
new pl(this, server);
|
new pl(this, server);
|
||||||
logger.info("╔════════════════════════════════════");
|
|
||||||
// logger.info("║");
|
// logger.info("║");
|
||||||
for (String s : Util.getLoadLogo()) {
|
for (String s : T2C_Util.getLoadLogo()) {
|
||||||
logger.info("║ {}", s);
|
logger.info(T2C_GenerateFrame.removeColorCodes(s));
|
||||||
}
|
}
|
||||||
logger.info("║");
|
|
||||||
// Thread.sleep(5000);
|
// Thread.sleep(5000);
|
||||||
logger.info("║ Author: {}", String.valueOf(plugin.getDescription().getAuthors()).replace("[", "").replace("]", ""));
|
logger.info(T2C_GenerateFrame.setCenterAligned("", "Author: " + String.valueOf(plugin.getDescription().getAuthors()).replace("[", "").replace("]", "")));
|
||||||
logger.info("║ Version: {}", plugin.getDescription().getVersion().orElse("unknown"));
|
logger.info(T2C_GenerateFrame.setCenterAligned("", "Version: " + plugin.getDescription().getVersion().orElse("unknown")));
|
||||||
logger.info("║ Spigot: {}", Util.getSpigot());
|
logger.info(T2C_GenerateFrame.setCenterAligned("", "Spigot: " + T2C_Util.getSpigot()));
|
||||||
logger.info("║ Discord: {}", Util.getDiscord());
|
logger.info(T2C_GenerateFrame.setCenterAligned("", "Discord: " + T2C_Util.getDiscord()));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
T2CV_LibConfig.set(dataDirectory, logger);
|
T2CV_LibConfig.set(dataDirectory, logger);
|
||||||
@ -105,13 +104,12 @@ public class T2CV_Main {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
T2CV_Metrics.bStats(this, Util.getBstatsID(), metricsFactory);
|
T2CV_Metrics.bStats(this, T2C_Util.getBstatsID(), metricsFactory);
|
||||||
T2CV_UpdateAPI.onUpdateCheckTimer(logger, plugin, server, Util.getVPrefix(), Util.getDiscord(), Util.getSpigotID(), Util.getGit());
|
T2CV_UpdateAPI.onUpdateCheckTimer(logger, plugin, server, T2C_Util.getVPrefix(), T2C_Util.getDiscord(), T2C_Util.getSpigotID(), T2C_Util.getGit());
|
||||||
logger.info("║");
|
logger.info(T2C_GenerateFrame.setCenterAligned("", ""));
|
||||||
logger.info("║ Plugin loaded successfully - {}ms", System.currentTimeMillis() - starttime);
|
logger.info(T2C_GenerateFrame.setCenterAligned("", "Plugin loaded successfully - " + (System.currentTimeMillis() - starttime) + "ms"));
|
||||||
logger.info("╚════════════════════════════════════");
|
|
||||||
|
|
||||||
|
|
||||||
|
logger.info(T2C_GenerateFrame.getBOTTOM_BORDER());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package net.t2code.t2codelib.VELOCITY.system.config;
|
package net.t2code.t2codelib.VELOCITY.system.config;
|
||||||
|
|
||||||
import net.t2code.t2codelib.T2CLanguageEnum;
|
import net.t2code.t2codelib.util.T2C_GenerateFrame;
|
||||||
import net.t2code.t2codelib.T2CconfigItem;
|
import net.t2code.t2codelib.util.T2C_LanguageEnum;
|
||||||
import net.t2code.t2codelib.Util;
|
import net.t2code.t2codelib.util.T2C_ConfigItem;
|
||||||
|
import net.t2code.t2codelib.util.T2C_Util;
|
||||||
import net.t2code.t2codelib.VELOCITY.api.messages.T2CV_Send;
|
import net.t2code.t2codelib.VELOCITY.api.messages.T2CV_Send;
|
||||||
import net.t2code.t2codelib.VELOCITY.api.yml.T2CV_ConfigWriter;
|
import net.t2code.t2codelib.VELOCITY.api.yml.T2CV_ConfigWriter;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@ -15,41 +16,41 @@ import java.util.List;
|
|||||||
|
|
||||||
public class T2CV_LibConfig {
|
public class T2CV_LibConfig {
|
||||||
|
|
||||||
public enum VALUES implements T2CconfigItem {
|
public enum VALUES implements T2C_ConfigItem {
|
||||||
updateTimer("updateCheck.timerInMin", 60, true,
|
updateTimer("updateCheck.timerInMin", 60, true,
|
||||||
new HashMap<>() {{
|
new HashMap<>() {{
|
||||||
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.english, List.of("In this option you can set the time interval in minutes in which updates should be checked."));
|
||||||
}}),
|
}}),
|
||||||
seePreReleaseUpdates("updateCheck.seePreReleaseUpdates", true, true,
|
seePreReleaseUpdates("updateCheck.seePreReleaseUpdates", true, true,
|
||||||
new HashMap<>() {{
|
new HashMap<>() {{
|
||||||
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.english, List.of("In this option you can set whether you want to receive and display beta and snapshot versions in the update check."));
|
||||||
}}),
|
}}),
|
||||||
|
|
||||||
debug("plugin.debug.debugModus", false, true,
|
debug("plugin.debug.debugModus", false, true,
|
||||||
new HashMap<>() {{
|
new HashMap<>() {{
|
||||||
put(T2CLanguageEnum.english, List.of("The debug mode sends more detailed debug information to the console."));
|
put(T2C_LanguageEnum.english, List.of("The debug mode sends more detailed debug information to the console."));
|
||||||
}}),
|
}}),
|
||||||
|
|
||||||
apiCommandGUIEnable("api.commandGUI.enable", false, true,
|
apiCommandGUIEnable("api.commandGUI.enable", false, true,
|
||||||
new HashMap<>() {{
|
new HashMap<>() {{
|
||||||
put(T2CLanguageEnum.english, List.of("With this option you activate the api interface for the T2C-CommandGUI plugin."));
|
put(T2C_LanguageEnum.english, List.of("With this option you activate the api interface for the T2C-CommandGUI plugin."));
|
||||||
}}),
|
}}),
|
||||||
apiAutoResponse("api.autoResponse.enable", false, true,
|
apiAutoResponse("api.autoResponse.enable", false, true,
|
||||||
new HashMap<>() {{
|
new HashMap<>() {{
|
||||||
put(T2CLanguageEnum.english, List.of("With this option you activate the api interface for the T2C-AutoResponse plugin."));
|
put(T2C_LanguageEnum.english, List.of("With this option you activate the api interface for the T2C-AutoResponse plugin."));
|
||||||
}}),
|
}}),
|
||||||
apiOpSecurity("api.opSecurity.enable", false, true,
|
apiOpSecurity("api.opSecurity.enable", false, true,
|
||||||
new HashMap<>() {{
|
new HashMap<>() {{
|
||||||
put(T2CLanguageEnum.english, List.of("With this option you activate the api interface for the T2C-OPSecurity plugin."));
|
put(T2C_LanguageEnum.english, List.of("With this option you activate the api interface for the T2C-OPSecurity plugin."));
|
||||||
}}),
|
}}),
|
||||||
;
|
;
|
||||||
|
|
||||||
private final String path;
|
private final String path;
|
||||||
private Object value;
|
private Object value;
|
||||||
private final boolean forceSet;
|
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.path = path;
|
||||||
this.value = value;
|
this.value = value;
|
||||||
this.forceSet = forceSet;
|
this.forceSet = forceSet;
|
||||||
@ -72,7 +73,7 @@ public class T2CV_LibConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HashMap<T2CLanguageEnum, List<String>> getComments() {
|
public HashMap<T2C_LanguageEnum, List<String>> getComments() {
|
||||||
return comments;
|
return comments;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,7 +90,7 @@ public class T2CV_LibConfig {
|
|||||||
|
|
||||||
public static void set(Path dataDirectory, Logger logger) throws IOException {
|
public static void set(Path dataDirectory, Logger logger) throws IOException {
|
||||||
long long_ = System.currentTimeMillis();
|
long long_ = System.currentTimeMillis();
|
||||||
T2CV_ConfigWriter.createConfig(logger, new File(dataDirectory.getParent() + "/T2CodeLib", "config.yml"), VALUES.values(), Util.getConfigLogo());
|
T2CV_ConfigWriter.createConfig(logger, new File(dataDirectory.getParent() + "/T2CodeLib", "config.yml"), VALUES.values(), T2C_Util.getConfigLogo());
|
||||||
T2CV_Send.info(logger, "║ The config.yml were successfully created / updated." + " - " + (System.currentTimeMillis() - long_) + "ms");
|
T2CV_Send.info(logger, T2C_GenerateFrame.setCenterAligned("", "The config.yml were successfully created / updated." + " - " + (System.currentTimeMillis() - long_) + "ms"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package net.t2code.t2codelib;
|
package net.t2code.t2codelib.util;
|
||||||
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface T2CconfigItem {
|
public interface T2C_ConfigItem {
|
||||||
/**
|
/**
|
||||||
* Returns the path of the option for the config
|
* Returns the path of the option for the config
|
||||||
* @return Config path of the option
|
* @return Config path of the option
|
||||||
@ -25,7 +25,7 @@ public interface T2CconfigItem {
|
|||||||
/**
|
/**
|
||||||
* Set the description of the option here, the '# ' is automatically set in front of it
|
* Set the description of the option here, the '# ' is automatically set in front of it
|
||||||
*/
|
*/
|
||||||
HashMap<T2CLanguageEnum,List<String>> getComments();
|
HashMap<T2C_LanguageEnum,List<String>> getComments();
|
||||||
|
|
||||||
|
|
||||||
String getLanguagePath();
|
String getLanguagePath();
|
@ -1,10 +1,10 @@
|
|||||||
package net.t2code.t2codelib;
|
package net.t2code.t2codelib.util;
|
||||||
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface T2CconfigItemLanguages {
|
public interface T2C_ConfigItemLanguages {
|
||||||
/**
|
/**
|
||||||
* Returns the path of the option for the config
|
* Returns the path of the option for the config
|
||||||
*
|
*
|
||||||
@ -19,13 +19,13 @@ public interface T2CconfigItemLanguages {
|
|||||||
*/
|
*/
|
||||||
Object getValue();
|
Object getValue();
|
||||||
|
|
||||||
HashMap<T2CLanguageEnum, String> getLanguage();
|
HashMap<T2C_LanguageEnum, String> getLanguage();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the description of the option here, the '# ' is automatically set in front of it
|
* Set the description of the option here, the '# ' is automatically set in front of it
|
||||||
*/
|
*/
|
||||||
HashMap<T2CLanguageEnum, List<String>> getComments();
|
HashMap<T2C_LanguageEnum, List<String>> getComments();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
@ -1,13 +1,21 @@
|
|||||||
// This class was created by JaTiTV.
|
// This class was created by JaTiTV.
|
||||||
|
|
||||||
package net.t2code.t2codelib.SPIGOT.api.messages;
|
package net.t2code.t2codelib.util;
|
||||||
|
|
||||||
public class T2C_GernerateFrame {
|
import lombok.Getter;
|
||||||
|
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||||
|
|
||||||
protected static final String BOTTOM_BORDER = "╚═══════════════════════════════════════════════════════════════════════════╝";
|
public class T2C_GenerateFrame {
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private static final String BOTTOM_BORDER = "╚═══════════════════════════════════════════════════════════════════════════╝";
|
||||||
|
@Getter
|
||||||
|
private static final String STROKE = "╠═══════════════════════════════════════════════════════════════════════════╣";
|
||||||
private static final int FIXED_WIDTH = BOTTOM_BORDER.length() - 2; // Länge ohne die Randzeichen
|
private static final int FIXED_WIDTH = BOTTOM_BORDER.length() - 2; // Länge ohne die Randzeichen
|
||||||
|
|
||||||
|
@Getter
|
||||||
private static final String COLOR_CODE = "§e";
|
private static final String COLOR_CODE = "§e";
|
||||||
|
|
||||||
private static final String BORDER_CHAR = "═";
|
private static final String BORDER_CHAR = "═";
|
||||||
private static final String TOP_LEFT = "╔";
|
private static final String TOP_LEFT = "╔";
|
||||||
private static final String TOP_RIGHT = "╗";
|
private static final String TOP_RIGHT = "╗";
|
||||||
@ -16,6 +24,11 @@ public class T2C_GernerateFrame {
|
|||||||
private static final String SIDE_BORDER = "║";
|
private static final String SIDE_BORDER = "║";
|
||||||
|
|
||||||
public static String setCenterAligned(String prefix, String text) {
|
public static String setCenterAligned(String prefix, String text) {
|
||||||
|
String colorCode = COLOR_CODE;
|
||||||
|
|
||||||
|
if (T2C_PlatformDetector.detectPlatform == T2C_PlatformDetector.PlatformType.VELOCITY) {
|
||||||
|
colorCode = "";
|
||||||
|
}
|
||||||
// Entfernen von Farbcodes aus der Berechnungslänge
|
// Entfernen von Farbcodes aus der Berechnungslänge
|
||||||
String textWithoutColor = removeColorCodes(text);
|
String textWithoutColor = removeColorCodes(text);
|
||||||
int textLengthWithoutColor = textWithoutColor.length();
|
int textLengthWithoutColor = textWithoutColor.length();
|
||||||
@ -28,13 +41,20 @@ public class T2C_GernerateFrame {
|
|||||||
int paddingLeft = totalPaddingSize / 2;
|
int paddingLeft = totalPaddingSize / 2;
|
||||||
int paddingRight = totalPaddingSize - paddingLeft;
|
int paddingRight = totalPaddingSize - paddingLeft;
|
||||||
// Formatierung der Zeile: Text zentrieren
|
// Formatierung der Zeile: Text zentrieren
|
||||||
String formattedValue = "§e║" + " ".repeat(paddingLeft) + text + " ".repeat(paddingRight) + "§e║";
|
String formattedValue = colorCode + "║" + " ".repeat(paddingLeft) + text + " ".repeat(paddingRight) + colorCode + "║";
|
||||||
//T2Csend.console(prefix + " " + formattedValue);
|
//T2Csend.console(prefix + " " + formattedValue);
|
||||||
return prefix + " " + formattedValue;
|
if (T2C_PlatformDetector.detectPlatform == T2C_PlatformDetector.PlatformType.VELOCITY) {
|
||||||
|
return removeColorCodes(formattedValue);
|
||||||
|
} else return prefix + " " + formattedValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static String setLeftAligned(String prefix, String text) {
|
public static String setLeftAligned(String prefix, String text) {
|
||||||
|
String colorCode = COLOR_CODE;
|
||||||
|
|
||||||
|
if (T2C_PlatformDetector.detectPlatform == T2C_PlatformDetector.PlatformType.VELOCITY) {
|
||||||
|
colorCode = "";
|
||||||
|
}
|
||||||
// Entfernen von Farbcodes aus der Berechnungslänge
|
// Entfernen von Farbcodes aus der Berechnungslänge
|
||||||
String textWithoutColor = removeColorCodes(text);
|
String textWithoutColor = removeColorCodes(text);
|
||||||
int textLengthWithoutColor = textWithoutColor.length();
|
int textLengthWithoutColor = textWithoutColor.length();
|
||||||
@ -47,16 +67,23 @@ public class T2C_GernerateFrame {
|
|||||||
int paddingRight = totalPaddingSize; // Alles Padding geht nach rechts
|
int paddingRight = totalPaddingSize; // Alles Padding geht nach rechts
|
||||||
|
|
||||||
// Formatierung der Zeile: Text am Anfang und dynamischer Abstand zum Ende
|
// Formatierung der Zeile: Text am Anfang und dynamischer Abstand zum Ende
|
||||||
String formattedValue = "§e║ " + text + " ".repeat((paddingRight - 1)) + "║";
|
String formattedValue = colorCode + "║ " + text + " ".repeat((paddingRight - 1)) + colorCode + "║";
|
||||||
System.out.println(formattedValue);
|
if (T2C_PlatformDetector.detectPlatform == T2C_PlatformDetector.PlatformType.VELOCITY) {
|
||||||
T2C_Send.console(prefix + " " + formattedValue);
|
return removeColorCodes(formattedValue);
|
||||||
return prefix + " " + formattedValue;
|
} else return prefix + " " + formattedValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Methode für mehrere Zeilen Text mit dynamischem Rahmen
|
// Methode für mehrere Zeilen Text mit dynamischem Rahmen
|
||||||
public static String sendFrameLeft(String prefix, String... lines) {
|
public static String getFrameLeft(String prefix, boolean console, String... lines) {
|
||||||
// Entfernen von Farbcodes und Berechnung der maximalen Länge
|
// Entfernen von Farbcodes und Berechnung der maximalen Länge
|
||||||
|
String colorCode = COLOR_CODE;
|
||||||
|
String nextLine = "<br>";
|
||||||
|
|
||||||
|
if (console && T2C_PlatformDetector.detectPlatform == T2C_PlatformDetector.PlatformType.VELOCITY) {
|
||||||
|
colorCode = "";
|
||||||
|
nextLine = "\n";
|
||||||
|
}
|
||||||
int maxLength = 0;
|
int maxLength = 0;
|
||||||
for (String line : lines) {
|
for (String line : lines) {
|
||||||
String lineWithoutColor = removeColorCodes(line);
|
String lineWithoutColor = removeColorCodes(line);
|
||||||
@ -65,13 +92,14 @@ public class T2C_GernerateFrame {
|
|||||||
|
|
||||||
// Berechnung der Rahmenbreite
|
// Berechnung der Rahmenbreite
|
||||||
int frameWidth = maxLength + 2; // +2 für die Ränder '║'
|
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 topBorder = colorCode + TOP_LEFT + BORDER_CHAR.repeat(frameWidth) + colorCode + TOP_RIGHT;
|
||||||
String bottomBorder = COLOR_CODE + BOTTOM_LEFT + BORDER_CHAR.repeat(frameWidth) + COLOR_CODE + BOTTOM_RIGHT;
|
String bottomBorder = colorCode + BOTTOM_LEFT + BORDER_CHAR.repeat(frameWidth) + colorCode + BOTTOM_RIGHT;
|
||||||
|
|
||||||
// Gehe durch jede Zeile und formatiere sie
|
// Gehe durch jede Zeile und formatiere sie
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
// Ausgabe der oberen Linie
|
// Ausgabe der oberen Linie
|
||||||
builder.append("<br>").append(prefix).append(" ").append(topBorder).append("<br>");
|
if (console) builder.append(nextLine);
|
||||||
|
builder.append(prefix).append(" ").append(topBorder).append(nextLine);
|
||||||
for (String line : lines) {
|
for (String line : lines) {
|
||||||
// Entfernen von Farbcodes aus der Berechnungslänge
|
// Entfernen von Farbcodes aus der Berechnungslänge
|
||||||
String lineWithoutColor = removeColorCodes(line);
|
String lineWithoutColor = removeColorCodes(line);
|
||||||
@ -86,16 +114,28 @@ public class T2C_GernerateFrame {
|
|||||||
int paddingRight = totalPaddingSize; // Alles Padding geht nach rechts
|
int paddingRight = totalPaddingSize; // Alles Padding geht nach rechts
|
||||||
|
|
||||||
// Formatierung der Zeile: Text am Anfang und dynamischer Abstand zum Ende
|
// Formatierung der Zeile: Text am Anfang und dynamischer Abstand zum Ende
|
||||||
String formattedValue = COLOR_CODE + SIDE_BORDER + line + " ".repeat(paddingRight) + COLOR_CODE + SIDE_BORDER;
|
String formattedValue = colorCode + SIDE_BORDER + line + " ".repeat(paddingRight) + colorCode + SIDE_BORDER;
|
||||||
builder.append(prefix).append(" ").append(formattedValue).append("<br>");
|
builder.append(prefix).append(" ").append(formattedValue).append(nextLine);
|
||||||
}
|
}
|
||||||
// Ausgabe der unteren Linie
|
// Ausgabe der unteren Linie
|
||||||
builder.append(prefix).append(" ").append(bottomBorder);
|
builder.append(prefix).append(" ").append(bottomBorder);
|
||||||
// T2Csend.console(builder.toString());
|
// T2Csend.console(builder.toString());
|
||||||
return builder.toString();
|
if (console && T2C_PlatformDetector.detectPlatform == T2C_PlatformDetector.PlatformType.VELOCITY) {
|
||||||
|
return removeColorCodes(builder.toString());
|
||||||
|
} else return builder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getFrameCenter(String prefix, boolean console, String... lines) {
|
||||||
|
String colorCode = COLOR_CODE;
|
||||||
|
String nextLine = "<br>";
|
||||||
|
|
||||||
|
|
||||||
|
if (console && T2C_PlatformDetector.detectPlatform == T2C_PlatformDetector.PlatformType.VELOCITY) {
|
||||||
|
System.out.println("conole & velo");
|
||||||
|
colorCode = "";
|
||||||
|
nextLine = "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String sendFrameCenter(String prefix, String... lines) {
|
|
||||||
// Entfernen von Farbcodes und Berechnung der maximalen Länge
|
// Entfernen von Farbcodes und Berechnung der maximalen Länge
|
||||||
int maxLength = 0;
|
int maxLength = 0;
|
||||||
for (String line : lines) {
|
for (String line : lines) {
|
||||||
@ -105,14 +145,15 @@ public class T2C_GernerateFrame {
|
|||||||
|
|
||||||
// Berechnung der Rahmenbreite
|
// Berechnung der Rahmenbreite
|
||||||
int frameWidth = maxLength + 2; // +2 für die Ränder '║'
|
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 topBorder = colorCode + TOP_LEFT + BORDER_CHAR.repeat(frameWidth) + colorCode + TOP_RIGHT;
|
||||||
String bottomBorder = COLOR_CODE + BOTTOM_LEFT + BORDER_CHAR.repeat(frameWidth) + COLOR_CODE + BOTTOM_RIGHT;
|
String bottomBorder = colorCode + BOTTOM_LEFT + BORDER_CHAR.repeat(frameWidth) + colorCode + BOTTOM_RIGHT;
|
||||||
|
|
||||||
// Gehe durch jede Zeile und formatiere sie
|
// Gehe durch jede Zeile und formatiere sie
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
|
|
||||||
// Ausgabe der oberen Linie
|
// Ausgabe der oberen Linie
|
||||||
builder.append("<br>").append(prefix).append(" ").append(topBorder).append("<br>");
|
if (console) builder.append(nextLine);
|
||||||
|
builder.append(prefix).append(" ").append(topBorder).append(nextLine);
|
||||||
for (String line : lines) {
|
for (String line : lines) {
|
||||||
// Entfernen von Farbcodes aus der Berechnungslänge
|
// Entfernen von Farbcodes aus der Berechnungslänge
|
||||||
String lineWithoutColor = removeColorCodes(line);
|
String lineWithoutColor = removeColorCodes(line);
|
||||||
@ -127,19 +168,24 @@ public class T2C_GernerateFrame {
|
|||||||
int paddingRight = totalPaddingSize - paddingLeft;
|
int paddingRight = totalPaddingSize - paddingLeft;
|
||||||
|
|
||||||
// Formatierung der Zeile: Text zentrieren
|
// Formatierung der Zeile: Text zentrieren
|
||||||
String formattedValue = COLOR_CODE + SIDE_BORDER + " ".repeat(paddingLeft) + line + " ".repeat(paddingRight) + COLOR_CODE + SIDE_BORDER;
|
String formattedValue = colorCode + SIDE_BORDER + " ".repeat(paddingLeft) + line + " ".repeat(paddingRight) + colorCode + SIDE_BORDER;
|
||||||
builder.append(prefix).append(" ").append(formattedValue).append("<br>");
|
builder.append(prefix).append(" ").append(formattedValue).append(nextLine);
|
||||||
}
|
}
|
||||||
// Ausgabe der unteren Linie
|
// Ausgabe der unteren Linie
|
||||||
builder.append(prefix).append(" ").append(bottomBorder);
|
builder.append(prefix).append(" ").append(bottomBorder);
|
||||||
// T2Csend.console(builder.toString());
|
// T2Csend.console(builder.toString());
|
||||||
return builder.toString();
|
if (console && T2C_PlatformDetector.detectPlatform == T2C_PlatformDetector.PlatformType.VELOCITY) {
|
||||||
|
return removeColorCodes(builder.toString());
|
||||||
|
} else return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Methode zum Entfernen von Farbcodes und MiniMessage-Farbcodes aus dem Text, außer <br>
|
// Methode zum Entfernen von Farbcodes und MiniMessage-Farbcodes aus dem Text, außer <br>
|
||||||
private static String removeColorCodes(String text) {
|
public static String removeColorCodes(String text) {
|
||||||
// Regex für alle Farbcodes und MiniMessage-Codes außer <br>
|
// 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_]+>";
|
// 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, "");
|
// return text.replaceAll("§[a-f0-9k-oK-O]", "").replaceAll(miniMessageRegex, "");
|
||||||
|
String s = MiniMessage.miniMessage().stripTags(text).replaceAll("§[a-f0-9k-oK-O]", "");
|
||||||
|
System.out.println(s);
|
||||||
|
return s;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
package net.t2code.t2codelib.util;
|
||||||
|
|
||||||
|
public enum T2C_LanguageEnum {
|
||||||
|
german,
|
||||||
|
english,
|
||||||
|
norwegian
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
package net.t2code.t2codelib;// This class was created by JaTiTV.
|
package net.t2code.t2codelib.util;// This class was created by JaTiTV.
|
||||||
|
|
||||||
public class T2CplatformDetector {
|
public class T2C_PlatformDetector {
|
||||||
|
|
||||||
public static PlatformType detectPlatform;
|
public static PlatformType detectPlatform;
|
||||||
|
|
||||||
@ -8,10 +8,15 @@ public class T2CplatformDetector {
|
|||||||
SPIGOT,
|
SPIGOT,
|
||||||
PAPER,
|
PAPER,
|
||||||
BUNGEECORD,
|
BUNGEECORD,
|
||||||
|
VELOCITY,
|
||||||
UNKNOWN
|
UNKNOWN
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PlatformType detectPlatform() {
|
public static void scan() {
|
||||||
|
detectPlatform = detectPlatform();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static PlatformType detectPlatform() {
|
||||||
// Check for Bukkit/Spigot/Paper
|
// Check for Bukkit/Spigot/Paper
|
||||||
try {
|
try {
|
||||||
Class.forName("org.bukkit.Bukkit");
|
Class.forName("org.bukkit.Bukkit");
|
||||||
@ -32,6 +37,14 @@ public class T2CplatformDetector {
|
|||||||
// Not a BungeeCord server
|
// Not a BungeeCord server
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check for Velocity
|
||||||
|
try {
|
||||||
|
Class.forName("com.velocitypowered.api.proxy.ProxyServer");
|
||||||
|
return PlatformType.VELOCITY;
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
// Not a Velocity server
|
||||||
|
}
|
||||||
|
|
||||||
return PlatformType.UNKNOWN;
|
return PlatformType.UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,4 +57,5 @@ public class T2CplatformDetector {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,18 +1,18 @@
|
|||||||
package net.t2code.t2codelib;
|
package net.t2code.t2codelib.util;
|
||||||
|
|
||||||
|
|
||||||
public class T2CupdateObject {
|
public class T2C_UpdateObject {
|
||||||
|
|
||||||
public String pluginName;
|
public String pluginName;
|
||||||
public String pluginVersion;
|
public String pluginVersion;
|
||||||
public T2CupdateWebData webData;
|
public T2C_UpdateWebData webData;
|
||||||
public Boolean load;
|
public Boolean load;
|
||||||
public Boolean updateAvailable;
|
public Boolean updateAvailable;
|
||||||
public Boolean updateCheckOnJoin;
|
public Boolean updateCheckOnJoin;
|
||||||
|
|
||||||
public T2CupdateObject(String pluginName,
|
public T2C_UpdateObject(String pluginName,
|
||||||
String pluginVersion,
|
String pluginVersion,
|
||||||
T2CupdateWebData webData,
|
T2C_UpdateWebData webData,
|
||||||
Boolean load,
|
Boolean load,
|
||||||
Boolean updateAvailable,
|
Boolean updateAvailable,
|
||||||
Boolean updateCheckOnJoin) {
|
Boolean updateCheckOnJoin) {
|
@ -1,6 +1,6 @@
|
|||||||
package net.t2code.t2codelib;
|
package net.t2code.t2codelib.util;
|
||||||
|
|
||||||
public enum UpdateType {
|
public enum T2C_UpdateType {
|
||||||
PRERELEASE("<light_purple>Pre-Release</light_purple>"),
|
PRERELEASE("<light_purple>Pre-Release</light_purple>"),
|
||||||
DEVELOPMENT("<dark_red>DEV</dark_red>"),
|
DEVELOPMENT("<dark_red>DEV</dark_red>"),
|
||||||
BETA("<gold>BETA</gold>"),
|
BETA("<gold>BETA</gold>"),
|
||||||
@ -15,7 +15,7 @@ public enum UpdateType {
|
|||||||
|
|
||||||
public String text;
|
public String text;
|
||||||
|
|
||||||
UpdateType(String text) {
|
T2C_UpdateType(String text) {
|
||||||
this.text = text;
|
this.text = text;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,8 +1,8 @@
|
|||||||
package net.t2code.t2codelib;
|
package net.t2code.t2codelib.util;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
public class T2CupdateWebData {
|
public class T2C_UpdateWebData {
|
||||||
@Getter
|
@Getter
|
||||||
private String updateTitle;
|
private String updateTitle;
|
||||||
@Getter
|
@Getter
|
||||||
@ -20,7 +20,7 @@ public class T2CupdateWebData {
|
|||||||
@Getter
|
@Getter
|
||||||
private boolean preRelease;
|
private boolean preRelease;
|
||||||
|
|
||||||
public T2CupdateWebData(String updateTitle, String version, String updateDescription, String updateUrl, String publishedAt, String downloadURL, String gitURL, boolean preRelease) {
|
public T2C_UpdateWebData(String updateTitle, String version, String updateDescription, String updateUrl, String publishedAt, String downloadURL, String gitURL, boolean preRelease) {
|
||||||
this.updateTitle = updateTitle;
|
this.updateTitle = updateTitle;
|
||||||
this.version = version;
|
this.version = version;
|
||||||
this.updateDescription = updateDescription;
|
this.updateDescription = updateDescription;
|
@ -1,16 +1,15 @@
|
|||||||
package net.t2code.t2codelib;
|
package net.t2code.t2codelib.util;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class Util {
|
public class T2C_Util {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private static String infoText = "<yellow>Description:</yellow> <gold>" + T2CodeLibMain.getPlugin().getDescription().getDescription() + "</gold>";
|
private static String infoText = "<yellow>Description:</yellow> <gold>[getDescription()]</gold>";
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private static String prefix = "<dark_gray>[<dark_red>T2Code</dark_red><dark_purple>Lib</dark_purple>]</dark_gray>";
|
private static String prefix = "<dark_gray>[<dark_red>T2Code</dark_red><dark_purple>Lib</dark_purple>]</dark_gray>";
|
||||||
@ -64,23 +63,22 @@ public class Util {
|
|||||||
"# ║ This plugin is from T2Code.net ║",
|
"# ║ This plugin is from T2Code.net ║",
|
||||||
"# ║ Development Team: JaTiTV & Jkobs ║",
|
"# ║ Development Team: JaTiTV & Jkobs ║",
|
||||||
"# ║ Feel free to come to our Discord for support: https://dc.t2code.net ║",
|
"# ║ Feel free to come to our Discord for support: https://dc.t2code.net ║",
|
||||||
"# ╚═════════════════════════════════════════════════════════════════════════════╝",
|
"# ╚═════════════════════════════════════════════════════════════════════════════╝");
|
||||||
"",
|
|
||||||
|
|
||||||
"####################################################################################################################",
|
// "####################################################################################################################",
|
||||||
"## ##",
|
// "## ##",
|
||||||
"## /$$$$$$$$ /$$$$$$ /$$$$$$ /$$ /$$ ##",
|
// "## /$$$$$$$$ /$$$$$$ /$$$$$$ /$$ /$$ ##",
|
||||||
"## |__ $$__//$$__ $$ /$$__ $$ | $$ | $$ ##",
|
// "## |__ $$__//$$__ $$ /$$__ $$ | $$ | $$ ##",
|
||||||
"## | $$ |__/ \\ $$| $$ \\__/ /$$$$$$ /$$$$$$$ /$$$$$$ /$$$$$$$ /$$$$$$ /$$$$$$ ##",
|
// "## | $$ |__/ \\ $$| $$ \\__/ /$$$$$$ /$$$$$$$ /$$$$$$ /$$$$$$$ /$$$$$$ /$$$$$$ ##",
|
||||||
"## | $$ /$$$$$$/| $$ /$$__ $$ /$$__ $$ /$$__ $$ | $$__ $$ /$$__ $$|_ $$_/ ##",
|
// "## | $$ /$$$$$$/| $$ /$$__ $$ /$$__ $$ /$$__ $$ | $$__ $$ /$$__ $$|_ $$_/ ##",
|
||||||
"## | $$ /$$____/ | $$ | $$ \\ $$| $$ | $$| $$$$$$$$ | $$ \\ $$| $$$$$$$$ | $$ ##",
|
// "## | $$ /$$____/ | $$ | $$ \\ $$| $$ | $$| $$$$$$$$ | $$ \\ $$| $$$$$$$$ | $$ ##",
|
||||||
"## | $$ | $$ | $$ $$| $$ | $$| $$ | $$| $$_____/ | $$ | $$| $$_____/ | $$ /$$ ##",
|
// "## | $$ | $$ | $$ $$| $$ | $$| $$ | $$| $$_____/ | $$ | $$| $$_____/ | $$ /$$ ##",
|
||||||
"## | $$ | $$$$$$$$| $$$$$$/| $$$$$$/| $$$$$$$| $$$$$$$ /$$| $$ | $$| $$$$$$$ | $$$$/ ##",
|
// "## | $$ | $$$$$$$$| $$$$$$/| $$$$$$/| $$$$$$$| $$$$$$$ /$$| $$ | $$| $$$$$$$ | $$$$/ ##",
|
||||||
"## |__/ |________/ \\______/ \\______/ \\_______/ \\_______/|__/|__/ |__/ \\_______/ \\___/ ##",
|
// "## |__/ |________/ \\______/ \\______/ \\_______/ \\_______/|__/|__/ |__/ \\_______/ \\___/ ##",
|
||||||
"## ##",
|
// "## ##",
|
||||||
"## T2CodeLib from JaTiTV / T2Code.net. In case of problems please contact the Discord: https://dc.t2code.net ##",
|
// "## T2CodeLib from JaTiTV / T2Code.net. In case of problems please contact the Discord: https://dc.t2code.net ##",
|
||||||
"## ##",
|
// "## ##",
|
||||||
"####################################################################################################################");
|
// "####################################################################################################################");
|
||||||
|
|
||||||
|
|
||||||
public static String[] getConfigLogo() {
|
public static String[] getConfigLogo() {
|
||||||
@ -92,20 +90,19 @@ public class Util {
|
|||||||
return arrayList.toArray(new String[0]);
|
return arrayList.toArray(new String[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private static String[] loadLogo = new String[]{
|
private static String[] loadLogo = new String[]{
|
||||||
"╔═══════════════════════════════════════════════════════════════════════════╗",
|
"╔═══════════════════════════════════════════════════════════════════════════╗",
|
||||||
"║ _______ ___ _____ _ _ ║",
|
"║<dark_red> _______ <gray> ___ </gray> _____ _ _ </dark_red>║",
|
||||||
"║ |__ __| |__ \\ / ____| | | | | ║",
|
"║<dark_red> |__ __| <gray>|__ \\ </gray> / ____| | | | | </dark_red>║",
|
||||||
"║ | | ) | | | ___ __| | ___ _ __ ___ | |_ ║",
|
"║<dark_red> | | <gray> ) |</gray> | | ___ __| | ___ _ __ ___ | |_ </dark_red>║",
|
||||||
"║ | | / / | | / _ \\ / _` | / _ \\ | '_ \\ / _ \\ | __| ║",
|
"║<dark_red> | | <gray> / / </gray> | | / _ \\ / _` | / _ \\ | '_ \\ / _ \\ | __| </dark_red>║",
|
||||||
"║ | | / /_ | |____ | (_) | | (_| | | __/ _ | | | | | __/ | |_ ║",
|
"║<dark_red> | | <gray> / /_ </gray> | |____ | (_) | | (_| | | __/ _ | | | | | __/ | |_ </dark_red>║",
|
||||||
"║ |_| |____| \\_____| \\___/ \\__,_| \\___| (_) |_| |_| \\___| \\__| ║",
|
"║<dark_red> |_| <gray>|____|</gray> \\_____| \\___/ \\__,_| \\___| (_) |_| |_| \\___| \\__| </dark_red>║",
|
||||||
"║ ║",
|
"║ ║",
|
||||||
"║ This plugin is from T2Code.net ║",
|
"║<color:#69b9ff> This plugin is from T2Code.net </color>║",
|
||||||
"║ Development Team: JaTiTV & Jkobs ║",
|
"║<color:#69b9ff> Development Team: JaTiTV & Jkobs </color>║",
|
||||||
"║ Feel free to come to our Discord for support: https://dc.t2code.net ║",
|
"║<color:#69b9ff> Feel free to come to our Discord for support: https://dc.t2code.net </color>║",
|
||||||
"╠═══════════════════════════════════════════════════════════════════════════╣"
|
"╠═══════════════════════════════════════════════════════════════════════════╣"
|
||||||
};
|
};
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
name: T2CodeLib
|
name: T2CodeLib
|
||||||
version: ${project.version}
|
version: ${project.version}
|
||||||
main: net.t2code.t2codelib.BUNGEE.system.T2CodeBMain
|
main: net.t2code.t2codelib.BUNGEE.system.T2CB_Main
|
||||||
author: JaTiTV, Jkobs
|
author: JaTiTV, Jkobs
|
||||||
description: Library from T2Code Plugins
|
description: Library from T2Code Plugins
|
@ -1,6 +1,6 @@
|
|||||||
name: T2CodeLib
|
name: T2CodeLib
|
||||||
version: '${project.version}'
|
version: '${project.version}'
|
||||||
main: net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain
|
main: net.t2code.t2codelib.SPIGOT.system.T2C_Main
|
||||||
api-version: 1.13
|
api-version: 1.13
|
||||||
prefix: T2CodeLib
|
prefix: T2CodeLib
|
||||||
authors: [ JaTiTV ]
|
authors: [ JaTiTV ]
|
||||||
|
@ -1 +1 @@
|
|||||||
{"id":"t2codelib","name":"T2CodeLib","version":"${project.version}","authors":["JaTiTV"],"dependencies":[],"main":"net.t2code.t2codelib.VELOCITY.system.T2CodeVMain"}
|
{"id":"t2codelib","name":"T2CodeLib","version":"${project.version}","authors":["JaTiTV"],"dependencies":[],"main":"net.t2code.t2codelib.VELOCITY.system.T2CV_Main"}
|
Loading…
Reference in New Issue
Block a user