Compare commits
14 Commits
13.4_SNAPS
...
test-updat
Author | SHA1 | Date | |
---|---|---|---|
1b12c2728b | |||
eb7fd03650 | |||
deeedcd408 | |||
e4c4aee0f7 | |||
1b7918f011 | |||
9986f477b2 | |||
d27ef185e6 | |||
8114035cd9 | |||
f0b5b2e65b | |||
|
f5460be3a1 | ||
|
f65d277817 | ||
|
c1b9de8b5a | ||
|
03af0646a6 | ||
1a914a9410 |
35
README.md
Normal file
35
README.md
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<p align="center">
|
||||||
|
<img src="https://i.imgur.com/0pSf6jl.png" width="300">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
---
|
||||||
|
# Links
|
||||||
|
* [Spigot](https://www.spigotmc.org/resources/t2codelib.96388/)
|
||||||
|
* [Discord](http://dc.T2Code.net)
|
||||||
|
---
|
||||||
|
|
||||||
|
T2CodeLib is a library for the plugins of T2Code.
|
||||||
|
|
||||||
|
Main library file to centralize the main functions for multiple plugins, allowing better maintenance capabilities and reducing the overall size of the plugins.
|
||||||
|
|
||||||
|
Maven:
|
||||||
|
```
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>T2Code</id>
|
||||||
|
<url>https://repo.t2code.net/repository/T2Code/</url>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.t2code</groupId>
|
||||||
|
<artifactId>T2CodeLib</artifactId>
|
||||||
|
<version>VERSION</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
<img src="https://i.imgur.com/HoZSt7c.png" width="600">
|
||||||
|
<img src="https://bstats.org/signatures/bukkit/T2CodeLib.svg" width="600">
|
18
pom.xml
18
pom.xml
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>net.t2code</groupId>
|
<groupId>net.t2code</groupId>
|
||||||
<artifactId>T2CodeLib</artifactId>
|
<artifactId>T2CodeLib</artifactId>
|
||||||
<version>13.4_SNAPSHOT-1</version>
|
<version>14.0</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>T2CodeLib</name>
|
<name>T2CodeLib</name>
|
||||||
@@ -94,7 +94,6 @@
|
|||||||
<url>https://nexus.bencodez.com/repository/maven-public/</url>
|
<url>https://nexus.bencodez.com/repository/maven-public/</url>
|
||||||
</repository>
|
</repository>
|
||||||
<!--Kyori MiniMessage
|
<!--Kyori MiniMessage
|
||||||
|
|
||||||
<repository>
|
<repository>
|
||||||
<id>sonatype-oss-snapshots1</id>
|
<id>sonatype-oss-snapshots1</id>
|
||||||
<url>https://s01.oss.sonatype.org/content/repositories/snapshots/</url>
|
<url>https://s01.oss.sonatype.org/content/repositories/snapshots/</url>
|
||||||
@@ -107,10 +106,9 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
<artifactId>spigot-api</artifactId>
|
<artifactId>spigot-api</artifactId>
|
||||||
<version>1.19.2-R0.1-SNAPSHOT</version>
|
<version>1.19.3-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- repo.t2code / T2Code -->
|
<!-- repo.t2code / T2Code -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.t2code</groupId>
|
<groupId>net.t2code</groupId>
|
||||||
@@ -135,33 +133,33 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>me.clip</groupId>
|
<groupId>me.clip</groupId>
|
||||||
<artifactId>placeholderapi</artifactId>
|
<artifactId>placeholderapi</artifactId>
|
||||||
<version>2.11.1</version>
|
<version>2.11.2</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- votingplugin -->
|
<!-- votingplugin -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.bencodez</groupId>
|
<groupId>com.bencodez</groupId>
|
||||||
<artifactId>votingplugin</artifactId>
|
<artifactId>votingplugin</artifactId>
|
||||||
<version>LATEST</version>
|
<version>6.10.0</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!--Kyori MiniMessage-->
|
<!--Kyori MiniMessage-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.kyori</groupId>
|
<groupId>net.kyori</groupId>
|
||||||
<artifactId>adventure-text-minimessage</artifactId>
|
<artifactId>adventure-text-minimessage</artifactId>
|
||||||
<version>4.11.0</version>
|
<version>4.12.0</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.kyori</groupId>
|
<groupId>net.kyori</groupId>
|
||||||
<artifactId>adventure-platform-bukkit</artifactId>
|
<artifactId>adventure-platform-bukkit</artifactId>
|
||||||
<version>4.1.2</version>
|
<version>4.2.0</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.kyori</groupId>
|
<groupId>net.kyori</groupId>
|
||||||
<artifactId>adventure-platform-bungeecord</artifactId>
|
<artifactId>adventure-platform-bungeecord</artifactId>
|
||||||
<version>4.1.2</version>
|
<version>4.2.0</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
|
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
|
||||||
@@ -182,7 +180,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.httpcomponents</groupId>
|
<groupId>org.apache.httpcomponents</groupId>
|
||||||
<artifactId>httpmime</artifactId>
|
<artifactId>httpmime</artifactId>
|
||||||
<version>4.5.13</version>
|
<version>4.5.14</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
@@ -0,0 +1,99 @@
|
|||||||
|
package net.t2code.t2codelib.BUNGEE.api.bungeePlayers;
|
||||||
|
|
||||||
|
import net.md_5.bungee.BungeeCord;
|
||||||
|
import net.md_5.bungee.api.ProxyServer;
|
||||||
|
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||||
|
import net.md_5.bungee.api.event.PlayerDisconnectEvent;
|
||||||
|
import net.md_5.bungee.api.event.PluginMessageEvent;
|
||||||
|
import net.md_5.bungee.api.event.PostLoginEvent;
|
||||||
|
import net.md_5.bungee.api.plugin.Listener;
|
||||||
|
import net.md_5.bungee.event.EventHandler;
|
||||||
|
import net.t2code.t2codelib.BUNGEE.api.messages.T2CBsend;
|
||||||
|
import net.t2code.t2codelib.BUNGEE.system.T2CodeBMain;
|
||||||
|
import net.t2code.t2codelib.SPIGOT.api.bungeePlayers.T2CbungeePlayersEnum;
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
public class T2CBbungeePlayers implements Listener {
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onJoin(PostLoginEvent e) {
|
||||||
|
sendToSpigotPlayer(e.getPlayer().getName(), T2CbungeePlayersEnum.JOIN, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onDisconnect(PlayerDisconnectEvent e) {
|
||||||
|
sendToSpigotPlayer(e.getPlayer().getName(), T2CbungeePlayersEnum.QUIT, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void sendToSpigotPlayer(String name, T2CbungeePlayersEnum value, String uuid) {
|
||||||
|
switch (value) {
|
||||||
|
case JOIN:
|
||||||
|
case QUIT:
|
||||||
|
sendToSpigotPlayerExecute(name, value, uuid);
|
||||||
|
break;
|
||||||
|
case GIVEALL:
|
||||||
|
StringBuilder input = new StringBuilder();
|
||||||
|
for (ProxiedPlayer player : ProxyServer.getInstance().getPlayers()) {
|
||||||
|
input.append(player.getName()).append(";");
|
||||||
|
}
|
||||||
|
sendToSpigotPlayerExecute(input.toString(), T2CbungeePlayersEnum.GIVEALL, uuid);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void sendToSpigotPlayerExecute(String name, T2CbungeePlayersEnum value, String uuid) {
|
||||||
|
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||||
|
DataOutputStream output = new DataOutputStream(stream);
|
||||||
|
try {
|
||||||
|
output.writeUTF(value.name());
|
||||||
|
output.writeUTF(name);
|
||||||
|
output.writeUTF(uuid);
|
||||||
|
} catch (IOException e) {
|
||||||
|
Logger.getLogger(e.getMessage());
|
||||||
|
}
|
||||||
|
T2CBsend.debug(T2CodeBMain.getPlugin(), "PluginMessage received channel: t2c:bonlp");
|
||||||
|
T2CBsend.debug(T2CodeBMain.getPlugin(), "PluginMessage received subChannel: " + value.name());
|
||||||
|
T2CBsend.debug(T2CodeBMain.getPlugin(), "PluginMessage received input: " + name);
|
||||||
|
T2CBsend.debug(T2CodeBMain.getPlugin(), "PluginMessage received input2/uuid: " + uuid);
|
||||||
|
BungeeCord.getInstance().getServers().values().stream().forEach((server) -> {
|
||||||
|
server.sendData("t2c:bonlp", stream.toByteArray());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void sendToSpigotDeleteAll() {
|
||||||
|
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||||
|
DataOutputStream output = new DataOutputStream(stream);
|
||||||
|
try {
|
||||||
|
output.writeUTF(T2CbungeePlayersEnum.CLEAR.name());
|
||||||
|
output.writeUTF("");
|
||||||
|
output.writeUTF("");
|
||||||
|
} catch (IOException e) {
|
||||||
|
Logger.getLogger(e.getMessage());
|
||||||
|
}
|
||||||
|
BungeeCord.getInstance().getServers().values().stream().forEach((server) -> {
|
||||||
|
server.sendData("t2c:bonlp", stream.toByteArray());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPluginMessage(PluginMessageEvent event) {
|
||||||
|
if (event.getTag().equalsIgnoreCase("t2c:bonlp")) {
|
||||||
|
DataInputStream stream = new DataInputStream(new ByteArrayInputStream(event.getData()));
|
||||||
|
event.setCancelled(true);
|
||||||
|
try {
|
||||||
|
T2CbungeePlayersEnum subChannel = T2CbungeePlayersEnum.valueOf(stream.readUTF());
|
||||||
|
String input = stream.readUTF();
|
||||||
|
|
||||||
|
T2CBsend.debug(T2CodeBMain.getPlugin(), "PluginMessage received channel: " + event.getTag());
|
||||||
|
T2CBsend.debug(T2CodeBMain.getPlugin(), "PluginMessage received subChannel: " + subChannel.name());
|
||||||
|
T2CBsend.debug(T2CodeBMain.getPlugin(), "PluginMessage received input/uuid: " + input);
|
||||||
|
|
||||||
|
sendToSpigotPlayer("", subChannel, input);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -11,13 +11,13 @@ import java.util.logging.Level;
|
|||||||
|
|
||||||
public class T2CBsend {
|
public class T2CBsend {
|
||||||
public static void console(String msg) {
|
public static void console(String msg) {
|
||||||
if (T2CodeBMain.getMmIsLoad()) {
|
if (T2CodeBMain.getMmIsLoad() && T2CodeBMain.getMmIsLoad()) {
|
||||||
T2CBminiMessage.sendConsoleMiniMessage(msg);
|
T2CBminiMessage.sendConsoleMiniMessage(msg);
|
||||||
} else ProxyServer.getInstance().getConsole().sendMessage(msg);
|
} else ProxyServer.getInstance().getConsole().sendMessage(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void player(ProxiedPlayer player, String msg) {
|
public static void player(ProxiedPlayer player, String msg) {
|
||||||
if (T2CodeBMain.getMmIsLoad()) {
|
if (T2CodeBMain.getMmIsLoad()&& T2CodeBMain.getMmIsLoad()) {
|
||||||
T2CBminiMessage.sendPlayerMiniMessage(msg, player);
|
T2CBminiMessage.sendPlayerMiniMessage(msg, player);
|
||||||
} else player.sendMessage(msg);
|
} else player.sendMessage(msg);
|
||||||
}
|
}
|
||||||
@@ -27,7 +27,7 @@ public class T2CBsend {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void sender(CommandSender sender, String msg) {
|
public static void sender(CommandSender sender, String msg) {
|
||||||
if (T2CodeBMain.getMmIsLoad()) {
|
if (T2CodeBMain.getMmIsLoad()&& T2CodeBMain.getMmIsLoad()) {
|
||||||
T2CBminiMessage.sendSenderMiniMessage(msg, sender);
|
T2CBminiMessage.sendSenderMiniMessage(msg, sender);
|
||||||
} else sender.sendMessage(msg);
|
} else sender.sendMessage(msg);
|
||||||
}
|
}
|
||||||
|
@@ -61,14 +61,15 @@ public class T2CBupdateAPI {
|
|||||||
public static void onUpdateCheckTimer(Plugin plugin, String prefix, String discord, Integer spigotID, String url) {
|
public static void onUpdateCheckTimer(Plugin plugin, String prefix, String discord, Integer spigotID, String url) {
|
||||||
ProxyServer.getInstance().getScheduler().schedule(plugin, new Runnable() {
|
ProxyServer.getInstance().getScheduler().schedule(plugin, new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
(new T2CBupdateAPI(plugin, spigotID)).getVersion((webData) -> {
|
(new T2CBupdateCheckerGit(plugin, spigotID)).getVersion((webData) -> {
|
||||||
pluginVersion = plugin.getDescription().getVersion();
|
pluginVersion = plugin.getDescription().getVersion();
|
||||||
T2CupdateObject update = new T2CupdateObject(
|
T2CupdateObject update = new T2CupdateObject(
|
||||||
plugin.getDescription().getName(),
|
plugin.getDescription().getName(),
|
||||||
plugin.getDescription().getVersion(),
|
plugin.getDescription().getVersion(),
|
||||||
webData,
|
webData,
|
||||||
false,
|
false,
|
||||||
!plugin.getDescription().getVersion().equals(webData.getVersion())
|
!plugin.getDescription().getVersion().equals(webData.getVersion()),
|
||||||
|
true
|
||||||
);
|
);
|
||||||
bungeePluginVersins.put(plugin.getDescription().getName(), update);
|
bungeePluginVersins.put(plugin.getDescription().getName(), update);
|
||||||
if (!pluginVersion.replace("_Bungee", "").equalsIgnoreCase(webData.getVersion())) {
|
if (!pluginVersion.replace("_Bungee", "").equalsIgnoreCase(webData.getVersion())) {
|
||||||
@@ -84,76 +85,4 @@ public class T2CBupdateAPI {
|
|||||||
}
|
}
|
||||||
}, 0, T2CBlibConfig.getUpdateTimer() * 60 * 20L, TimeUnit.SECONDS);
|
}, 0, T2CBlibConfig.getUpdateTimer() * 60 * 20L, TimeUnit.SECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Plugin plugin;
|
|
||||||
private int resourceId;
|
|
||||||
|
|
||||||
public T2CBupdateAPI(Plugin plugin, int resourceId) {
|
|
||||||
this.plugin = plugin;
|
|
||||||
this.resourceId = resourceId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void getVersion(Consumer<T2CupdateWebData> consumer, String pluginVersion, Integer spigotID, String URL) {
|
|
||||||
BungeeCord.getInstance().getScheduler().runAsync(this.plugin, () -> {
|
|
||||||
try {
|
|
||||||
URL url = new URL(URL);
|
|
||||||
URLConnection yc = url.openConnection();
|
|
||||||
BufferedReader in = new BufferedReader(
|
|
||||||
new InputStreamReader(
|
|
||||||
yc.getInputStream()));
|
|
||||||
String inputLine;
|
|
||||||
String data = "";
|
|
||||||
while ((inputLine = in.readLine()) != null)
|
|
||||||
data = inputLine;
|
|
||||||
in.close();
|
|
||||||
data = data.substring(1, data.length() - 1);
|
|
||||||
if (data.isEmpty()) {
|
|
||||||
consumer.accept(null);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
JSONObject obj = new JSONObject(data);
|
|
||||||
String UpdateName = obj.getString("name");
|
|
||||||
String tag_name = obj.getString("tag_name");
|
|
||||||
String body = obj.getString("body").replace("\n", "<br>").replace("\r", "").replace("'", "''");
|
|
||||||
String updateurl = obj.getString("html_url");
|
|
||||||
boolean prerelease = obj.getBoolean("prerelease");
|
|
||||||
|
|
||||||
String date = obj.getString("published_at");
|
|
||||||
SimpleDateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
|
|
||||||
SimpleDateFormat outputFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss a");
|
|
||||||
Date parsedDate = inputFormat.parse(date);
|
|
||||||
String formattedDate = outputFormat.format(parsedDate);
|
|
||||||
|
|
||||||
JSONArray downloadArray = obj.getJSONArray("assets");
|
|
||||||
String downloadURL;
|
|
||||||
if (downloadArray.isEmpty()) {
|
|
||||||
downloadURL = "https://www.spigotmc.org/resources/" + spigotID;
|
|
||||||
} else {
|
|
||||||
downloadURL = downloadArray.getJSONObject(0).getString("browser_download_url");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!prerelease) {
|
|
||||||
downloadURL = "https://www.spigotmc.org/resources/" + spigotID;
|
|
||||||
updateurl = "https://www.spigotmc.org/resources/" + spigotID;
|
|
||||||
}
|
|
||||||
|
|
||||||
T2CupdateWebData webData = new T2CupdateWebData(UpdateName, tag_name, body, updateurl, formattedDate, downloadURL, prerelease);
|
|
||||||
consumer.accept(webData);
|
|
||||||
} catch (Exception var10) {
|
|
||||||
Boolean load = false;
|
|
||||||
if (bungeePluginVersins.containsKey(plugin.getDescription().getName())) {
|
|
||||||
load = bungeePluginVersins.get(plugin.getDescription().getName()).load;
|
|
||||||
}
|
|
||||||
T2CupdateObject update = new T2CupdateObject(
|
|
||||||
plugin.getDescription().getName(),
|
|
||||||
pluginVersion,
|
|
||||||
null,
|
|
||||||
load,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
bungeePluginVersins.put(plugin.getDescription().getName(), update);
|
|
||||||
this.plugin.getLogger().severe("§4 Cannot look for updates: " + var10.getMessage());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,98 @@
|
|||||||
|
package net.t2code.t2codelib.BUNGEE.api.update;
|
||||||
|
|
||||||
|
import net.md_5.bungee.BungeeCord;
|
||||||
|
import net.md_5.bungee.api.plugin.Plugin;
|
||||||
|
import net.t2code.t2codelib.BUNGEE.system.config.T2CBlibConfig;
|
||||||
|
import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
|
||||||
|
import net.t2code.t2codelib.T2CupdateObject;
|
||||||
|
import net.t2code.t2codelib.T2CupdateWebData;
|
||||||
|
import org.json.JSONArray;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.net.URLConnection;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
public class T2CBupdateCheckerGit {
|
||||||
|
private Plugin plugin;
|
||||||
|
private int resourceId;
|
||||||
|
|
||||||
|
public T2CBupdateCheckerGit(Plugin plugin, int resourceId) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
this.resourceId = resourceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getVersion(Consumer<T2CupdateWebData> consumer, String pluginVersion, Integer spigotID, String gitKey) {
|
||||||
|
String RepoURL = "https://git.t2code.net/api/v1/repos/" + gitKey + "/releases?limit=1";
|
||||||
|
if (!T2CBlibConfig.getSeePreReleaseUpdates()){
|
||||||
|
RepoURL = RepoURL + "&pre-release=false";
|
||||||
|
}
|
||||||
|
String finalRepoURL = RepoURL;
|
||||||
|
BungeeCord.getInstance().getScheduler().runAsync(this.plugin, () -> {
|
||||||
|
try {
|
||||||
|
URL url = new URL(finalRepoURL);
|
||||||
|
URLConnection yc = url.openConnection();
|
||||||
|
BufferedReader in = new BufferedReader(
|
||||||
|
new InputStreamReader(
|
||||||
|
yc.getInputStream()));
|
||||||
|
String inputLine;
|
||||||
|
String data = "";
|
||||||
|
while ((inputLine = in.readLine()) != null)
|
||||||
|
data = inputLine;
|
||||||
|
in.close();
|
||||||
|
data = data.substring(1, data.length() - 1);
|
||||||
|
if (data.isEmpty()) {
|
||||||
|
consumer.accept(null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
JSONObject obj = new JSONObject(data);
|
||||||
|
String UpdateName = obj.getString("name");
|
||||||
|
String tag_name = obj.getString("tag_name");
|
||||||
|
String body = obj.getString("body").replace("\n", "<br>").replace("\r", "").replace("'", "''");
|
||||||
|
String updateurl = obj.getString("html_url");
|
||||||
|
boolean prerelease = obj.getBoolean("prerelease");
|
||||||
|
|
||||||
|
String date = obj.getString("published_at");
|
||||||
|
SimpleDateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
|
||||||
|
SimpleDateFormat outputFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss a");
|
||||||
|
Date parsedDate = inputFormat.parse(date);
|
||||||
|
String formattedDate = outputFormat.format(parsedDate);
|
||||||
|
|
||||||
|
JSONArray downloadArray = obj.getJSONArray("assets");
|
||||||
|
String downloadURL;
|
||||||
|
if (downloadArray.isEmpty()) {
|
||||||
|
downloadURL = "https://www.spigotmc.org/resources/" + spigotID;
|
||||||
|
} else {
|
||||||
|
downloadURL = downloadArray.getJSONObject(0).getString("browser_download_url");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!prerelease) {
|
||||||
|
downloadURL = "https://www.spigotmc.org/resources/" + spigotID;
|
||||||
|
updateurl = "https://www.spigotmc.org/resources/" + spigotID;
|
||||||
|
}
|
||||||
|
|
||||||
|
T2CupdateWebData webData = new T2CupdateWebData(UpdateName, tag_name, body, updateurl, formattedDate, downloadURL, prerelease);
|
||||||
|
consumer.accept(webData);
|
||||||
|
} catch (Exception var10) {
|
||||||
|
Boolean load = false;
|
||||||
|
if (T2CBupdateAPI.bungeePluginVersins.containsKey(plugin.getDescription().getName())) {
|
||||||
|
load = T2CBupdateAPI.bungeePluginVersins.get(plugin.getDescription().getName()).load;
|
||||||
|
}
|
||||||
|
T2CupdateObject update = new T2CupdateObject(
|
||||||
|
plugin.getDescription().getName(),
|
||||||
|
pluginVersion,
|
||||||
|
null,
|
||||||
|
load,
|
||||||
|
false,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
T2CBupdateAPI.bungeePluginVersins.put(plugin.getDescription().getName(), update);
|
||||||
|
this.plugin.getLogger().severe("§4 Cannot look for updates: " + var10.getMessage());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@@ -5,6 +5,7 @@ import net.t2code.t2codelib.BUNGEE.api.messages.T2CBsend;
|
|||||||
import net.t2code.t2codelib.BUNGEE.api.update.T2CBupdateAPI;
|
import net.t2code.t2codelib.BUNGEE.api.update.T2CBupdateAPI;
|
||||||
import net.t2code.t2codelib.BUNGEE.system.bstats.T2CBmetrics;
|
import net.t2code.t2codelib.BUNGEE.system.bstats.T2CBmetrics;
|
||||||
import net.t2code.t2codelib.BUNGEE.system.config.T2CBlibConfig;
|
import net.t2code.t2codelib.BUNGEE.system.config.T2CBlibConfig;
|
||||||
|
import net.t2code.t2codelib.BUNGEE.api.bungeePlayers.T2CBbungeePlayers;
|
||||||
import net.t2code.t2codelib.BUNGEE.system.pluginMessaging.T2CplmsgBcmd;
|
import net.t2code.t2codelib.BUNGEE.system.pluginMessaging.T2CplmsgBcmd;
|
||||||
import net.t2code.t2codelib.BUNGEE.system.pluginMessaging.autoResponse.T2CapiAutoResponse;
|
import net.t2code.t2codelib.BUNGEE.system.pluginMessaging.autoResponse.T2CapiAutoResponse;
|
||||||
import net.t2code.t2codelib.BUNGEE.system.pluginMessaging.commandgui.T2CapiCGUI;
|
import net.t2code.t2codelib.BUNGEE.system.pluginMessaging.commandgui.T2CapiCGUI;
|
||||||
@@ -39,8 +40,12 @@ public class T2CBload {
|
|||||||
plugin.getProxy().registerChannel("t2c:bcmd");
|
plugin.getProxy().registerChannel("t2c:bcmd");
|
||||||
plugin.getProxy().getPluginManager().registerListener(plugin, new T2CplmsgBcmd());
|
plugin.getProxy().getPluginManager().registerListener(plugin, new T2CplmsgBcmd());
|
||||||
|
|
||||||
|
plugin.getProxy().registerChannel("t2c:bonlp");
|
||||||
|
plugin.getProxy().getPluginManager().registerListener(plugin, new T2CBbungeePlayers());
|
||||||
|
T2CBbungeePlayers.sendToSpigotDeleteAll();
|
||||||
|
|
||||||
if (T2CBlibConfig.getApiCommandGUIEnable()) {
|
if (T2CBlibConfig.getApiCommandGUIEnable()) {
|
||||||
plugin.getProxy().registerChannel("t2c:cgui");
|
plugin.getProxy().registerChannel("t2c:cguiopl");
|
||||||
plugin.getProxy().getPluginManager().registerListener(plugin, new T2CapiCGUI());
|
plugin.getProxy().getPluginManager().registerListener(plugin, new T2CapiCGUI());
|
||||||
T2CapiCGUI.sendToSpigotDeleteAll();
|
T2CapiCGUI.sendToSpigotDeleteAll();
|
||||||
}
|
}
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
package net.t2code.t2codelib.BUNGEE.system;
|
package net.t2code.t2codelib.BUNGEE.system;
|
||||||
|
|
||||||
import lombok.NonNull;
|
|
||||||
import net.kyori.adventure.platform.bungeecord.BungeeAudiences;
|
import net.kyori.adventure.platform.bungeecord.BungeeAudiences;
|
||||||
import net.md_5.bungee.api.plugin.Plugin;
|
import net.md_5.bungee.api.plugin.Plugin;
|
||||||
import net.t2code.t2codelib.BUNGEE.api.messages.T2CBsend;
|
import net.t2code.t2codelib.BUNGEE.api.messages.T2CBsend;
|
||||||
|
import net.t2code.t2codelib.BUNGEE.api.bungeePlayers.T2CBbungeePlayers;
|
||||||
import net.t2code.t2codelib.Util;
|
import net.t2code.t2codelib.Util;
|
||||||
|
|
||||||
public class T2CodeBMain extends Plugin {
|
public class T2CodeBMain extends Plugin {
|
||||||
@@ -37,7 +37,9 @@ public class T2CodeBMain extends Plugin {
|
|||||||
autor = plugin.getDescription().getAuthor();
|
autor = plugin.getDescription().getAuthor();
|
||||||
try {
|
try {
|
||||||
adventure = BungeeAudiences.create(this);
|
adventure = BungeeAudiences.create(this);
|
||||||
|
T2CBsend.info(this,"Adventure load!");
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
|
T2CBsend.error(this,"Adventure can not be load!");
|
||||||
mmIsLoad = false;
|
mmIsLoad = false;
|
||||||
}
|
}
|
||||||
T2CBload.onLoad(plugin, Util.getPrefix(), autor, orgVersion, Util.getSpigot(), Util.getDiscord(), Util.getSpigotID(), Util.getBstatsID(),Util.getGit());
|
T2CBload.onLoad(plugin, Util.getPrefix(), autor, orgVersion, Util.getSpigot(), Util.getDiscord(), Util.getSpigotID(), Util.getBstatsID(),Util.getGit());
|
||||||
@@ -49,6 +51,7 @@ public class T2CodeBMain extends Plugin {
|
|||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
// Plugin shutdown logic
|
// Plugin shutdown logic
|
||||||
|
T2CBbungeePlayers.sendToSpigotDeleteAll();
|
||||||
if (mmIsLoad){
|
if (mmIsLoad){
|
||||||
if(adventure != null) {
|
if(adventure != null) {
|
||||||
adventure.close();
|
adventure.close();
|
||||||
|
@@ -36,6 +36,7 @@ public class T2CBlibConfig {
|
|||||||
Configuration configuration = ConfigurationProvider.getProvider(YamlConfiguration.class).load(config);
|
Configuration configuration = ConfigurationProvider.getProvider(YamlConfiguration.class).load(config);
|
||||||
|
|
||||||
updateTimer = configuration.getInt("UpdateCheck.TimerInMin");
|
updateTimer = configuration.getInt("UpdateCheck.TimerInMin");
|
||||||
|
seePreReleaseUpdates = configuration.getBoolean("UpdateCheck.SeePreReleaseUpdates");
|
||||||
|
|
||||||
apiCommandGUIEnable = configuration.getBoolean("API.CommandGUI.Enable");
|
apiCommandGUIEnable = configuration.getBoolean("API.CommandGUI.Enable");
|
||||||
apiAutoResponse = configuration.getBoolean("API.AutoResponse.Enable");
|
apiAutoResponse = configuration.getBoolean("API.AutoResponse.Enable");
|
||||||
@@ -43,6 +44,7 @@ public class T2CBlibConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static Integer updateTimer;
|
private static Integer updateTimer;
|
||||||
|
private static Boolean seePreReleaseUpdates;
|
||||||
private static Boolean apiCommandGUIEnable;
|
private static Boolean apiCommandGUIEnable;
|
||||||
private static Boolean apiAutoResponse;
|
private static Boolean apiAutoResponse;
|
||||||
private static Boolean apiOpSecurity;
|
private static Boolean apiOpSecurity;
|
||||||
@@ -51,6 +53,10 @@ public class T2CBlibConfig {
|
|||||||
return updateTimer;
|
return updateTimer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Boolean getSeePreReleaseUpdates() {
|
||||||
|
return seePreReleaseUpdates;
|
||||||
|
}
|
||||||
|
|
||||||
public static Boolean getApiCommandGUIEnable() {
|
public static Boolean getApiCommandGUIEnable() {
|
||||||
return apiCommandGUIEnable;
|
return apiCommandGUIEnable;
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,84 @@
|
|||||||
|
package net.t2code.t2codelib.SPIGOT.api.bungeePlayers;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
|
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
||||||
|
import net.t2code.t2codelib.Util;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.plugin.messaging.PluginMessageListener;
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class T2CbungeePlayers implements PluginMessageListener {
|
||||||
|
@Getter
|
||||||
|
private static List<String> bungeePlayers = new ArrayList<>();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPluginMessageReceived(String channel, Player player, byte[] message) {
|
||||||
|
DataInputStream stream = new DataInputStream(new ByteArrayInputStream(message));
|
||||||
|
T2Csend.debug(T2CodeLibMain.getPlugin(), "stream: " + stream.toString());
|
||||||
|
try {
|
||||||
|
T2CbungeePlayersEnum subChannel = T2CbungeePlayersEnum.valueOf(stream.readUTF());
|
||||||
|
String input = stream.readUTF();
|
||||||
|
String uuid = stream.readUTF();
|
||||||
|
T2Csend.debug(T2CodeLibMain.getPlugin(), "PluginMessage received channel: " + channel);
|
||||||
|
T2Csend.debug(T2CodeLibMain.getPlugin(), "PluginMessage received subChannel: " + subChannel.name());
|
||||||
|
T2Csend.debug(T2CodeLibMain.getPlugin(), "PluginMessage received input: " + input);
|
||||||
|
T2Csend.debug(T2CodeLibMain.getPlugin(), "PluginMessage received input2/uuid: " + uuid);
|
||||||
|
switch (subChannel) {
|
||||||
|
case JOIN:
|
||||||
|
bungeePlayers.add(input);
|
||||||
|
break;
|
||||||
|
case QUIT:
|
||||||
|
bungeePlayers.remove(input);
|
||||||
|
break;
|
||||||
|
case GIVEALL:
|
||||||
|
if (!Util.getServerUUID().toString().equals(uuid)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
bungeePlayers.clear();
|
||||||
|
String[] in = input.split(";");
|
||||||
|
bungeePlayers.addAll(Arrays.asList(in));
|
||||||
|
break;
|
||||||
|
case CLEAR:
|
||||||
|
bungeePlayers.clear();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void callAllBungeePlayers() {
|
||||||
|
if (Bukkit.getOnlinePlayers().isEmpty()) {
|
||||||
|
Bukkit.getScheduler().runTaskLaterAsynchronously(T2CodeLibMain.getPlugin(), new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
callAllBungeePlayers();
|
||||||
|
}
|
||||||
|
}, 20L);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||||
|
DataOutputStream output = new DataOutputStream(stream);
|
||||||
|
try {
|
||||||
|
output.writeUTF(T2CbungeePlayersEnum.GIVEALL.name());
|
||||||
|
output.writeUTF(Util.getServerUUID().toString());
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
|
player.sendPluginMessage(T2CodeLibMain.getPlugin(), "t2c:bonlp", stream.toByteArray());
|
||||||
|
T2Csend.debug(T2CodeLibMain.getPlugin(), "PluginMessage received channel: t2c:bonlp");
|
||||||
|
T2Csend.debug(T2CodeLibMain.getPlugin(), "PluginMessage send subChannel: " + T2CbungeePlayersEnum.GIVEALL.name());
|
||||||
|
T2Csend.debug(T2CodeLibMain.getPlugin(), "PluginMessage send output/uuid: " + Util.getServerUUID().toString());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,8 @@
|
|||||||
|
package net.t2code.t2codelib.SPIGOT.api.bungeePlayers;
|
||||||
|
|
||||||
|
public enum T2CbungeePlayersEnum {
|
||||||
|
JOIN,
|
||||||
|
QUIT,
|
||||||
|
GIVEALL,
|
||||||
|
CLEAR
|
||||||
|
}
|
@@ -1,24 +1,24 @@
|
|||||||
package net.t2code.t2codelib.SPIGOT.api.commands;
|
package net.t2code.t2codelib.SPIGOT.api.commands;
|
||||||
|
|
||||||
import net.t2code.t2codelib.SPIGOT.system.BCommandSenderReciver;
|
import net.t2code.t2codelib.SPIGOT.system.T2CbungeeCommandSenderReciver;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class T2Ccmd {
|
public class T2Ccmd {
|
||||||
public static void console(String cmd) {
|
public static void console(String cmd) {
|
||||||
if (cmd.contains("!onBungee")){
|
if (cmd.contains("!onBungee")){
|
||||||
BCommandSenderReciver.sendToBungee(null, cmd.replace("!onBungee", ""), true);
|
T2CbungeeCommandSenderReciver.sendToBungee(null, cmd.replace("!onBungee", ""), true);
|
||||||
}else Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), cmd);
|
}else Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void player(Player player, String cmd) {
|
public static void player(Player player, String cmd) {
|
||||||
if (cmd.contains("!asConsole")) {
|
if (cmd.contains("!asConsole")) {
|
||||||
if (cmd.contains("!onBungee")) {
|
if (cmd.contains("!onBungee")) {
|
||||||
BCommandSenderReciver.sendToBungee(player, cmd.replace("!asConsole", "").replace("!onBungee", ""), true);
|
T2CbungeeCommandSenderReciver.sendToBungee(player, cmd.replace("!asConsole", "").replace("!onBungee", ""), true);
|
||||||
} else console(cmd.replace("!asConsole", ""));
|
} else console(cmd.replace("!asConsole", ""));
|
||||||
} else {
|
} else {
|
||||||
if (cmd.contains("!onBungee")) {
|
if (cmd.contains("!onBungee")) {
|
||||||
BCommandSenderReciver.sendToBungee(player, cmd.replace("!onBungee", ""), false);
|
T2CbungeeCommandSenderReciver.sendToBungee(player, cmd.replace("!onBungee", ""), false);
|
||||||
} else player.chat("/" + cmd);
|
} else player.chat("/" + cmd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -44,16 +44,20 @@ public class T2Csend {
|
|||||||
public static void debug(Plugin plugin, String msg, Integer stage) {
|
public static void debug(Plugin plugin, String msg, Integer stage) {
|
||||||
// if (!new File(Main.getPath(), "config.yml").exists()) return;
|
// if (!new File(Main.getPath(), "config.yml").exists()) return;
|
||||||
if (stage == null) {
|
if (stage == null) {
|
||||||
if (plugin.getConfig().getBoolean("Plugin.Debug"))
|
if (plugin.getConfig().getBoolean("Plugin.Debug") || plugin.getConfig().getBoolean("plugin.debug") || plugin.getConfig().getBoolean("Debug") || plugin.getConfig().getBoolean("debug")){
|
||||||
|
info(plugin, "");
|
||||||
Bukkit.getConsoleSender().sendMessage(plugin.getDescription().getPrefix() + " §5DEBUG: §6" + msg);
|
Bukkit.getConsoleSender().sendMessage(plugin.getDescription().getPrefix() + " §5DEBUG: §6" + msg);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (plugin.getConfig().getInt("Plugin.Debug") >= stage)
|
if (plugin.getConfig().getInt("Plugin.Debug") >= stage || plugin.getConfig().getInt("plugin.debug") >= stage || plugin.getConfig().getInt("Debug") >= stage || plugin.getConfig().getInt("debug") >= stage) {
|
||||||
|
info(plugin, "");
|
||||||
Bukkit.getConsoleSender().sendMessage(plugin.getDescription().getPrefix() + " §5DEBUG: §6" + msg);
|
Bukkit.getConsoleSender().sendMessage(plugin.getDescription().getPrefix() + " §5DEBUG: §6" + msg);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void debugmsg(Plugin plugin, String msg) {
|
public static void debugmsg(Plugin plugin, String msg) {
|
||||||
warning(plugin,"");
|
warning(plugin, "");
|
||||||
Bukkit.getConsoleSender().sendMessage("§e[" + plugin.getDescription().getPrefix() + "] §5DEBUG-MSG: §6" + msg);
|
Bukkit.getConsoleSender().sendMessage("§e[" + plugin.getDescription().getPrefix() + "] §5DEBUG-MSG: §6" + msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -3,9 +3,9 @@ package net.t2code.t2codelib.SPIGOT.api.update;
|
|||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
||||||
import net.t2code.t2codelib.UpdateType;
|
import net.t2code.t2codelib.UpdateType;
|
||||||
import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
|
|
||||||
import net.t2code.t2codelib.T2CupdateObject;
|
import net.t2code.t2codelib.T2CupdateObject;
|
||||||
import net.t2code.t2codelib.T2CupdateWebData;
|
import net.t2code.t2codelib.T2CupdateWebData;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
@@ -17,7 +17,17 @@ public class T2CupdateAPI {
|
|||||||
public static HashMap<String, T2CupdateObject> pluginVersions = new HashMap<>();
|
public static HashMap<String, T2CupdateObject> 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 (!SelectLibConfig.getUpdateCheckOnJoin()) {
|
if (pluginVersions.get(plugin.getName()) == null){
|
||||||
|
Bukkit.getScheduler().runTaskLaterAsynchronously(T2CodeLibMain.getPlugin(), new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
join(plugin,prefix,perm,player,spigotID,discord);
|
||||||
|
}
|
||||||
|
},2*20L);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!pluginVersions.get(plugin.getName()).updateCheckOnJoin) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!player.hasPermission(perm) && !player.isOp()) {
|
if (!player.hasPermission(perm) && !player.isOp()) {
|
||||||
@@ -33,7 +43,6 @@ public class T2CupdateAPI {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
T2CupdateWebData webData = pluginVersions.get(plugin.getName()).webData;
|
T2CupdateWebData webData = pluginVersions.get(plugin.getName()).webData;
|
||||||
String pluginVersion = plugin.getDescription().getVersion();
|
|
||||||
if (!pluginVersions.get(plugin.getName()).updateAvailable) return;
|
if (!pluginVersions.get(plugin.getName()).updateAvailable) return;
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
@@ -50,17 +59,18 @@ public class T2CupdateAPI {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String st = "[prefix]<br>" +
|
String st = "[prefix]<br>" +
|
||||||
"<click:open_url:'[link]'><hover:show_text:'<gold>You can download it here: <yellow>[link]</yellow></gold>'>[prefix] <gold>A new</gold> [value] <gold>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!</gold></hover></click><br>" +
|
" found!</color></hover></click><br>" +
|
||||||
"<click:open_url:'[link]'><hover:show_text:'<gold>You can download it here: <yellow>[link]</yellow></gold>'>[prefix] <red>[plv]</red> <gray>-></gray> " +
|
"<click:open_url:'[link]'><hover:show_text:'<color:#6e90ff>You can download it here: <yellow>[link]</yellow></color>'>[prefix] <red>[plv]</red> <gray>-></gray> " +
|
||||||
"<green>[puv]</green></hover></click><br>" +
|
"<green>[puv]</green></hover></click><br>" +
|
||||||
"<click:open_url:'[dc]'><hover:show_text:'<yellow>[dc]</yellow>'>[prefix] <gold>You can find more information on Discord.</gold></hover></click><br>" +
|
"<click:open_url:'[dc]'><hover:show_text:'<yellow>[dc]</yellow>'>[prefix] <color:#6e90ff>You can find more information on Discord.</color></hover></click><br>" +
|
||||||
"[prefix] <blue><hover:show_text:'<red>Click for more information</red>'><click:run_command:'/t2c updateinfo " + plugin.getName() + "'>Update information</click></hover></blue><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 value;
|
String value;
|
||||||
|
|
||||||
if (webData.isPreRelease()) {
|
if (webData.isPreRelease()) {
|
||||||
|
//todo if (!SelectLibConfig.getSeePreReleaseUpdates()) return;
|
||||||
value = UpdateType.PRERELEASE.text;
|
value = UpdateType.PRERELEASE.text;
|
||||||
if (publicVersion.toLowerCase().contains("dev")) {
|
if (publicVersion.toLowerCase().contains("dev")) {
|
||||||
value = UpdateType.DEVELOPMENT.text;
|
value = UpdateType.DEVELOPMENT.text;
|
||||||
@@ -94,10 +104,10 @@ public class T2CupdateAPI {
|
|||||||
}
|
}
|
||||||
} else value = UpdateType.STABLE.text;
|
} else value = 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> <color:#6e90ff>A new [value] version was found!</color>".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> <color:#6e90ff>Your version: <red>" + pluginVersion + "</red> <gray>-</gray> Current version:</color> <green>" + webData.getVersion() + "</green>";
|
||||||
String s3 = "<br><dark_red>║</dark_red> <gold>You can download it here:</gold> <yellow>" + webData.getUpdateUrl() + "</yellow>";
|
String s3 = "<br><dark_red>║</dark_red> <color:#6e90ff>You can download it here:</color> <yellow>" + webData.getUpdateUrl() + "</yellow>";
|
||||||
String s4 = "<br><dark_red>║</dark_red> <gold>You can find more information on Discord:</gold> <yellow>" + discord + "</yellow>";
|
String s4 = "<br><dark_red>║</dark_red> <color:#6e90ff>You can find more information on Discord:</color> <yellow>" + discord + "</yellow>";
|
||||||
String f = "<br><dark_red>╚══════════════</dark_red>" + prefix + "<dark_red>══════════════</dark_red>";
|
String f = "<br><dark_red>╚══════════════</dark_red>" + prefix + "<dark_red>══════════════</dark_red>";
|
||||||
String text = h + s1 + s2 + s3 + s4 + f;
|
String text = h + s1 + s2 + s3 + s4 + f;
|
||||||
T2Csend.console(text);
|
T2Csend.console(text);
|
||||||
@@ -135,17 +145,18 @@ public class T2CupdateAPI {
|
|||||||
String updateUpdate = webData.getUpdateUrl();
|
String updateUpdate = webData.getUpdateUrl();
|
||||||
String updateDescription = webData.getUpdateDescription();
|
String updateDescription = webData.getUpdateDescription();
|
||||||
|
|
||||||
String pluginNameString = "<br><dark_red>║</dark_red> <yellow>Plugin:</yellow> <color:#5eff89>" + pluginName + "</color>";
|
String pluginNameString = "<br><dark_red>║</dark_red> <color:#6e90ff>Plugin:</color> <color:#5eff89>" + pluginName + "</color>";
|
||||||
String pluginVersionString = "<br><dark_red>║</dark_red> <yellow>Your version:</yellow> <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:#308aff>[value]:</color>";
|
String updateInfoString = "<br><dark_red>║</dark_red> <color:#09ff00>[value]:</color>";
|
||||||
String updateTitleString = "<br><dark_red>║</dark_red> <yellow>Title:</yellow> <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> <yellow>Version:</yellow> <color:#5eff89>" + updateVersion + "</color>";
|
String updateVersionString = "<br><dark_red>║</dark_red> <color:#6e90ff>Version:</color> <color:#5eff89>" + updateVersion + "</color>";
|
||||||
String updateAtString = "<br><dark_red>║</dark_red> <yellow>Published on:</yellow> <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> <yellow>Version type:</yellow> <color:#5eff89>" + updateType + "</color>";
|
String updateTypeString = "<br><dark_red>║</dark_red> <color:#6e90ff>Version type:</color> <color:#5eff89>" + updateType + "</color>";
|
||||||
|
|
||||||
String updateButton;
|
String updateButton;
|
||||||
if (player) {
|
if (player) {
|
||||||
updateButton = "<br><dark_red>║</dark_red> <color:#5eff89><hover:show_text:'<gold>" + updateUpdate + "</gold>'><click:open_url:'" + updateUpdate + "'>Download</click></hover></color> <dark_gray>|</dark_gray> <blue><hover:show_text:'" + updateDescription + "'>Update Description</hover></blue>";
|
updateButton = "<br><dark_red>║</dark_red> <color:#5eff89><hover:show_text:'<gold>" + updateUpdate + "</gold>'><click:open_url:'" + updateUpdate
|
||||||
|
+ "'>Download</click></hover></color> <dark_gray>|</dark_gray> <color:#ff9499><hover:show_text:'" + updateDescription + "'>Update Description</hover></color>";
|
||||||
} else updateButton = "<br><dark_red>║</dark_red> <color:#5eff89>Download:</color> <gold>" + updateUpdate + "</gold>";
|
} else updateButton = "<br><dark_red>║</dark_red> <color:#5eff89>Download:</color> <gold>" + updateUpdate + "</gold>";
|
||||||
|
|
||||||
String text;
|
String text;
|
||||||
@@ -158,7 +169,6 @@ public class T2CupdateAPI {
|
|||||||
if (object.updateAvailable) text = text + updateVersionString;
|
if (object.updateAvailable) text = text + updateVersionString;
|
||||||
if (!updateTitle.equals("OLD")) text = text + updateAtString;
|
if (!updateTitle.equals("OLD")) text = text + updateAtString;
|
||||||
if (!updateTitle.equals("OLD")) text = text + updateTypeString;
|
if (!updateTitle.equals("OLD")) text = text + updateTypeString;
|
||||||
if (object.updateAvailable)
|
|
||||||
text = text + updateButton;
|
text = text + updateButton;
|
||||||
|
|
||||||
if (updateTitle.equals("OLD")) text = text + "<br><dark_gray>This plugin does not have the new update checker yet, so there is no exact update / " +
|
if (updateTitle.equals("OLD")) text = text + "<br><dark_gray>This plugin does not have the new update checker yet, so there is no exact update / " +
|
||||||
@@ -169,75 +179,7 @@ public class T2CupdateAPI {
|
|||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void onUpdateCheck(Plugin plugin, String prefix, int spigotID, String discord) {
|
public static void onUpdateCheck(Plugin plugin, String prefix, String gitKey, Integer spigotID, String discord, Boolean updateCheckOnJoin, Boolean seePreReleaseUpdates, Integer timeInterval) {
|
||||||
new BukkitRunnable() {
|
new T2CupdateCheckerGit((JavaPlugin) plugin, prefix, gitKey, spigotID, discord, updateCheckOnJoin, seePreReleaseUpdates, timeInterval);
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
(new T2CupdateChecker((JavaPlugin) plugin, spigotID)).getVersion((update_version) -> {
|
|
||||||
T2CupdateObject update = new T2CupdateObject(
|
|
||||||
plugin.getName(),
|
|
||||||
plugin.getDescription().getVersion(),
|
|
||||||
new T2CupdateWebData("OLD", update_version, "", "https://www.spigotmc.org/resources/" + spigotID, "",
|
|
||||||
"https://www.spigotmc.org/resources/" + spigotID, false),
|
|
||||||
false, !plugin.getDescription().getVersion().equals(update_version)
|
|
||||||
);
|
|
||||||
pluginVersions.put(plugin.getName(), update);
|
|
||||||
if (pluginVersions.get(plugin.getName()).updateAvailable) {
|
|
||||||
if (!update.load) {
|
|
||||||
new BukkitRunnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
update.load = true;
|
|
||||||
sendUpdateMsg(prefix, discord, update.webData, plugin);
|
|
||||||
}
|
|
||||||
}.runTaskLaterAsynchronously(plugin, 600L);
|
|
||||||
} else sendUpdateMsg(prefix, discord, update.webData, plugin);
|
|
||||||
} else {
|
|
||||||
if (!update.load) {
|
|
||||||
T2Csend.console(prefix + " §2No update found.");
|
|
||||||
update.load = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, prefix, plugin.getDescription().getVersion());
|
|
||||||
}
|
|
||||||
}.runTaskTimerAsynchronously(plugin, 0L, SelectLibConfig.getUpdateCheckTimeInterval() * 60 * 20L);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void onUpdateCheck(Plugin plugin, String prefix, String RepoURL, Integer spigotID, String discord) {
|
|
||||||
if (!RepoURL.contains("?limit=1")) {
|
|
||||||
RepoURL = RepoURL + "?limit=1";
|
|
||||||
}
|
|
||||||
String finalRepoURL = RepoURL;
|
|
||||||
new BukkitRunnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
(new T2CupdateCheckerGit((JavaPlugin) plugin)).getVersion((webData) -> {
|
|
||||||
T2CupdateObject update = new T2CupdateObject(
|
|
||||||
plugin.getName(),
|
|
||||||
plugin.getDescription().getVersion(),
|
|
||||||
webData,
|
|
||||||
false,
|
|
||||||
!plugin.getDescription().getVersion().equals(webData.getVersion())
|
|
||||||
);
|
|
||||||
pluginVersions.put(plugin.getName(), update);
|
|
||||||
if (pluginVersions.get(plugin.getName()).updateAvailable) {
|
|
||||||
if (!update.load) {
|
|
||||||
new BukkitRunnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
update.load = true;
|
|
||||||
sendUpdateMsg(prefix, discord, webData, plugin);
|
|
||||||
}
|
|
||||||
}.runTaskLaterAsynchronously(plugin, 600L);
|
|
||||||
} else sendUpdateMsg(prefix, discord, webData, plugin);
|
|
||||||
} else {
|
|
||||||
if (!update.load) {
|
|
||||||
T2Csend.console(prefix + " §2No update found.");
|
|
||||||
update.load = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, plugin.getDescription().getVersion(), spigotID, finalRepoURL);
|
|
||||||
}
|
|
||||||
}.runTaskTimerAsynchronously(plugin, 0L, SelectLibConfig.getUpdateCheckTimeInterval() * 60 * 20L);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,74 +0,0 @@
|
|||||||
package net.t2code.t2codelib.SPIGOT.api.update;
|
|
||||||
|
|
||||||
import net.t2code.t2codelib.T2CupdateObject;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.util.Scanner;
|
|
||||||
import java.util.function.Consumer;
|
|
||||||
|
|
||||||
public class T2CupdateChecker {
|
|
||||||
private JavaPlugin plugin;
|
|
||||||
private int resourceId;
|
|
||||||
|
|
||||||
public T2CupdateChecker(JavaPlugin plugin, int resourceId) {
|
|
||||||
this.plugin = plugin;
|
|
||||||
this.resourceId = resourceId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void getVersion(Consumer<String> consumer, String Prefix, String pluginVersion) {
|
|
||||||
if (!plugin.isEnabled()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(this.plugin, () -> {
|
|
||||||
try {
|
|
||||||
InputStream inputStream = (new URL("https://api.spigotmc.org/legacy/update.php?resource=" + this.resourceId)).openStream();
|
|
||||||
try {
|
|
||||||
Scanner scanner = new Scanner(inputStream);
|
|
||||||
|
|
||||||
try {
|
|
||||||
if (scanner.hasNext()) {
|
|
||||||
consumer.accept(scanner.next());
|
|
||||||
}
|
|
||||||
} catch (Throwable var8) {
|
|
||||||
try {
|
|
||||||
scanner.close();
|
|
||||||
} catch (Throwable var7) {
|
|
||||||
var8.addSuppressed(var7);
|
|
||||||
}
|
|
||||||
throw var8;
|
|
||||||
}
|
|
||||||
scanner.close();
|
|
||||||
} catch (Throwable var9) {
|
|
||||||
if (inputStream != null) {
|
|
||||||
try {
|
|
||||||
inputStream.close();
|
|
||||||
} catch (Throwable var6) {
|
|
||||||
var9.addSuppressed(var6);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
throw var9;
|
|
||||||
}
|
|
||||||
inputStream.close();
|
|
||||||
} catch (IOException var10) {
|
|
||||||
Boolean load = false;
|
|
||||||
if (T2CupdateAPI.pluginVersions.containsKey(plugin.getName())){
|
|
||||||
load = T2CupdateAPI.pluginVersions.get(plugin.getName()).load;
|
|
||||||
}
|
|
||||||
|
|
||||||
T2CupdateObject update = new T2CupdateObject(
|
|
||||||
plugin.getName(),
|
|
||||||
pluginVersion,
|
|
||||||
null,
|
|
||||||
load,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
T2CupdateAPI.pluginVersions.put(plugin.getName(), update);
|
|
||||||
this.plugin.getLogger().severe("§4 Cannot look for updates: " + var10.getMessage());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,9 +1,11 @@
|
|||||||
package net.t2code.t2codelib.SPIGOT.api.update;
|
package net.t2code.t2codelib.SPIGOT.api.update;
|
||||||
|
|
||||||
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
import net.t2code.t2codelib.T2CupdateObject;
|
import net.t2code.t2codelib.T2CupdateObject;
|
||||||
import net.t2code.t2codelib.T2CupdateWebData;
|
import net.t2code.t2codelib.T2CupdateWebData;
|
||||||
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.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
@@ -15,13 +17,58 @@ import java.util.Date;
|
|||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
public class T2CupdateCheckerGit {
|
public class T2CupdateCheckerGit {
|
||||||
private JavaPlugin plugin;
|
private final JavaPlugin plugin;
|
||||||
|
private T2CupdateObject t2CupdateObject;
|
||||||
|
|
||||||
public T2CupdateCheckerGit(JavaPlugin plugin) {
|
|
||||||
|
public T2CupdateCheckerGit(JavaPlugin plugin, String prefix, String gitKey, Integer spigotID, String discord, Boolean updateCheckOnJoin, Boolean seePreReleaseUpdates, Integer timeInterval) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
|
|
||||||
|
String RepoURL = "https://git.t2code.net/api/v1/repos/" + gitKey + "/releases?limit=1";
|
||||||
|
if (!seePreReleaseUpdates) {
|
||||||
|
RepoURL = RepoURL + "&pre-release=false";
|
||||||
|
}
|
||||||
|
String finalRepoURL = RepoURL;
|
||||||
|
|
||||||
|
Bukkit.getScheduler().runTaskTimerAsynchronously(plugin, new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
getVersion((webData) -> {
|
||||||
|
T2CupdateObject update = new T2CupdateObject(
|
||||||
|
plugin.getName(),
|
||||||
|
plugin.getDescription().getVersion(),
|
||||||
|
webData,
|
||||||
|
t2CupdateObject != null && t2CupdateObject.load,
|
||||||
|
!plugin.getDescription().getVersion().equals(webData.getVersion()),
|
||||||
|
updateCheckOnJoin
|
||||||
|
);
|
||||||
|
|
||||||
|
T2CupdateAPI.pluginVersions.put(plugin.getName(), update);
|
||||||
|
if (T2CupdateAPI.pluginVersions.get(plugin.getName()).updateAvailable) {
|
||||||
|
if (!update.load) {
|
||||||
|
new BukkitRunnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
update.load = true;
|
||||||
|
T2CupdateAPI.sendUpdateMsg(prefix, discord, webData, plugin);
|
||||||
|
}
|
||||||
|
}.runTaskLaterAsynchronously(plugin, 600L);
|
||||||
|
} else T2CupdateAPI.sendUpdateMsg(prefix, discord, webData, plugin);
|
||||||
|
} else {
|
||||||
|
if (!update.load) {
|
||||||
|
T2Csend.console(prefix + " §2No update found.");
|
||||||
|
update.load = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getVersion(Consumer<T2CupdateWebData> consumer, String pluginVersion, Integer spigotID, String URL) {
|
t2CupdateObject = update;
|
||||||
|
|
||||||
|
}, plugin.getDescription().getVersion(), spigotID, finalRepoURL, updateCheckOnJoin, seePreReleaseUpdates, timeInterval);
|
||||||
|
}
|
||||||
|
}, 0L, timeInterval * 60 * 20L);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getVersion(Consumer<T2CupdateWebData> consumer, String pluginVersion, Integer spigotID, String URL, Boolean updateCheckOnJoin, Boolean seePreReleaseUpdates, Integer timeInterval) {
|
||||||
if (!plugin.isEnabled()) {
|
if (!plugin.isEnabled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -45,7 +92,7 @@ public class T2CupdateCheckerGit {
|
|||||||
JSONObject obj = new JSONObject(data);
|
JSONObject obj = new JSONObject(data);
|
||||||
String UpdateName = obj.getString("name");
|
String UpdateName = obj.getString("name");
|
||||||
String tag_name = obj.getString("tag_name");
|
String tag_name = obj.getString("tag_name");
|
||||||
String body = obj.getString("body").replace("\n","<br>").replace("\r","").replace("'","''");
|
String body = obj.getString("body").replace("\n", "<br>").replace("\r", "").replace("'", "''").replace("**", "");
|
||||||
String updateurl = obj.getString("html_url");
|
String updateurl = obj.getString("html_url");
|
||||||
boolean prerelease = obj.getBoolean("prerelease");
|
boolean prerelease = obj.getBoolean("prerelease");
|
||||||
|
|
||||||
@@ -80,7 +127,8 @@ public class T2CupdateCheckerGit {
|
|||||||
pluginVersion,
|
pluginVersion,
|
||||||
null,
|
null,
|
||||||
load,
|
load,
|
||||||
false
|
false,
|
||||||
|
updateCheckOnJoin
|
||||||
);
|
);
|
||||||
T2CupdateAPI.pluginVersions.put(plugin.getName(), update);
|
T2CupdateAPI.pluginVersions.put(plugin.getName(), update);
|
||||||
this.plugin.getLogger().severe("§4 Cannot look for updates: " + var10.getMessage());
|
this.plugin.getLogger().severe("§4 Cannot look for updates: " + var10.getMessage());
|
||||||
|
@@ -8,7 +8,7 @@ import java.io.ByteArrayOutputStream;
|
|||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class BCommandSenderReciver {
|
public class T2CbungeeCommandSenderReciver {
|
||||||
|
|
||||||
public static void sendToBungee(CommandSender sender, String information, Boolean console) {
|
public static void sendToBungee(CommandSender sender, String information, Boolean console) {
|
||||||
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
@@ -1,8 +1,10 @@
|
|||||||
package net.t2code.t2codelib.SPIGOT.system;
|
package net.t2code.t2codelib.SPIGOT.system;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
||||||
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.bungeePlayers.T2CbungeePlayers;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.items.T2CitemVersion;
|
import net.t2code.t2codelib.SPIGOT.api.items.T2CitemVersion;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
|
||||||
@@ -33,6 +35,7 @@ public final class T2CodeLibMain extends JavaPlugin {
|
|||||||
private static List<String> autor;
|
private static List<String> autor;
|
||||||
private static String version;
|
private static String version;
|
||||||
|
|
||||||
|
@Getter
|
||||||
private static Boolean mmIsLoad = true;
|
private static Boolean mmIsLoad = true;
|
||||||
private static Boolean load = false;
|
private static Boolean load = false;
|
||||||
|
|
||||||
@@ -48,6 +51,7 @@ public final class T2CodeLibMain extends JavaPlugin {
|
|||||||
mmIsLoad = false;
|
mmIsLoad = false;
|
||||||
}
|
}
|
||||||
long long_ = T2Ctemplate.onLoadHeader(Util.getPrefix(), autor, version, Util.getSpigot(), Util.getDiscord());
|
long long_ = T2Ctemplate.onLoadHeader(Util.getPrefix(), autor, version, Util.getSpigot(), Util.getDiscord());
|
||||||
|
checkIsBungee();
|
||||||
String prefix = Util.getPrefix();
|
String prefix = Util.getPrefix();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -99,15 +103,22 @@ public final class T2CodeLibMain extends JavaPlugin {
|
|||||||
SelectLibConfig.onSelect();
|
SelectLibConfig.onSelect();
|
||||||
SelectLibMsg.onSelect();
|
SelectLibMsg.onSelect();
|
||||||
|
|
||||||
T2CupdateAPI.onUpdateCheck(plugin, prefix, Util.getGit(), Util.getSpigotID(), Util.getDiscord());
|
T2CupdateAPI.onUpdateCheck(plugin, prefix, Util.getGit(), Util.getSpigotID(), Util.getDiscord(), SelectLibConfig.getUpdateCheckOnJoin(), SelectLibConfig.getSeePreReleaseUpdates(),
|
||||||
|
SelectLibConfig.getUpdateCheckTimeInterval());
|
||||||
Metrics.Bstats(plugin, Util.getBstatsID());
|
Metrics.Bstats(plugin, Util.getBstatsID());
|
||||||
if (SelectLibConfig.getBungee()) {
|
if (SelectLibConfig.getBungee()) {
|
||||||
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "t2c:bcmd");
|
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "t2c:bcmd");
|
||||||
|
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "t2c:bonlp");
|
||||||
|
if (!Bukkit.getMessenger().isIncomingChannelRegistered(plugin, "t2c:bonlp")) {
|
||||||
|
T2Csend.debug(plugin, "registerIncomingPluginChannel §et2c:bonlp");
|
||||||
|
Bukkit.getMessenger().registerIncomingPluginChannel(plugin, "t2c:bonlp", new T2CbungeePlayers());
|
||||||
|
T2CbungeePlayers.callAllBungeePlayers();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ReportLogStorage.load();
|
ReportLogStorage.load();
|
||||||
Bukkit.getServer().getPluginManager().registerEvents(new JoinEvent(), plugin);
|
Bukkit.getServer().getPluginManager().registerEvents(new JoinEvent(), plugin);
|
||||||
checkIsBungee();
|
|
||||||
T2Ctemplate.onLoadFooter(prefix, long_);
|
T2Ctemplate.onLoadFooter(prefix, long_);
|
||||||
load = true;
|
load = true;
|
||||||
}
|
}
|
||||||
@@ -171,7 +182,6 @@ public final class T2CodeLibMain extends JavaPlugin {
|
|||||||
if (adventure == null) {
|
if (adventure == null) {
|
||||||
throw new IllegalStateException("Tried to access Adventure when the plugin was disabled!");
|
throw new IllegalStateException("Tried to access Adventure when the plugin was disabled!");
|
||||||
}
|
}
|
||||||
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " Adventure load");
|
|
||||||
return adventure;
|
return adventure;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2,6 +2,7 @@ package net.t2code.t2codelib.SPIGOT.system.cmd;
|
|||||||
|
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
|
import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
|
||||||
|
import net.t2code.t2codelib.SPIGOT.api.bungeePlayers.T2CbungeePlayers;
|
||||||
import net.t2code.t2codelib.T2CupdateObject;
|
import net.t2code.t2codelib.T2CupdateObject;
|
||||||
import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
|
import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
@@ -44,6 +45,9 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
|
|||||||
case "debug":
|
case "debug":
|
||||||
Commands.debug(sender,args);
|
Commands.debug(sender,args);
|
||||||
return false;
|
return false;
|
||||||
|
case "test":
|
||||||
|
T2Csend.sender(sender, T2CbungeePlayers.getBungeePlayers().toString());
|
||||||
|
return false;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
T2Csend.sender(sender, "§4Use: §7/t2code debug createReportLog");
|
T2Csend.sender(sender, "§4Use: §7/t2code debug createReportLog");
|
||||||
|
@@ -23,17 +23,40 @@ public class Commands {
|
|||||||
}
|
}
|
||||||
switch (args[1].toLowerCase()) {
|
switch (args[1].toLowerCase()) {
|
||||||
case "createreportlog":
|
case "createreportlog":
|
||||||
|
switch (args.length){
|
||||||
|
case 2:
|
||||||
|
if (sender instanceof Player) {
|
||||||
|
T2Csend.sender(sender, "<dark_red>The debug zip file is <red>automatically uploaded</red> to T2Code's servers<br>and <red>automatically deleted</red> " +
|
||||||
|
"after <red>14</red> days!<br>The file can also be deleted manually by you via command!</dark_red><br><dark_green><hover:show_text:'<yellow>Confirm the" +
|
||||||
|
" upload</yellow>'><click:run_command:'/t2c debug createReportLog confirmupload'>upload</click></hover></dark_green> <dark_gray>|</dark_gray> " +
|
||||||
|
"<gold><hover:show_text:'<red>Do not upload</red>'><click:run_command:'/t2c debug createReportLog noupload'>keep the file on your server</click></hover></gold>");
|
||||||
|
} else T2Csend.sender(sender, "<dark_red>The debug zip file is <red>automatically uploaded</red> to T2Code's servers</dark_red>" +
|
||||||
|
"<br><dark_red>and <red>automatically deleted</red> after <red>14</red> days!</dark_red>" +
|
||||||
|
"<br><dark_red>The file can also be deleted manually by you via command!</dark_red>" +
|
||||||
|
"<br><green>Confirm the upload with the command:</green>" +
|
||||||
|
"<br><yellow>/t2c debug createReportLog confirmupload</yellow>" +
|
||||||
|
"<br><red>Keep the file on your server and do not upload it with the command:</red>" +
|
||||||
|
"<br><yellow>/t2c debug createReportLog noupload</yellow>");
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
Boolean upload = args[2].equalsIgnoreCase("confirmupload");
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(T2CodeLibMain.getPlugin(), new Runnable() {
|
Bukkit.getScheduler().runTaskAsynchronously(T2CodeLibMain.getPlugin(), new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
CreateReportLog.create(sender);
|
CreateReportLog.create(sender, upload);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
T2Csend.sender(sender, 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
T2Csend.sender(sender, "§4Use: §7/t2code debug createReportLog");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case "deletereportlog":
|
case "deletereportlog":
|
||||||
if (args.length != 3) {
|
if (args.length != 3) {
|
||||||
T2Csend.sender(sender, "§4Use: §7/t2code debug deleteReportLog [id]");
|
T2Csend.sender(sender, "§4Use: §7/t2code debug deleteReportLog [id]");
|
||||||
|
@@ -27,22 +27,27 @@ import java.io.*;
|
|||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Paths;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
import java.util.zip.ZipOutputStream;
|
import java.util.zip.ZipOutputStream;
|
||||||
|
|
||||||
public class CreateReportLog {
|
public class CreateReportLog {
|
||||||
protected static void create(CommandSender sender) throws IOException {
|
protected static void create(CommandSender sender, Boolean confirmUpload) throws IOException {
|
||||||
T2Csend.sender(sender, Util.getPrefix() + " §6A DebugLog is created...");
|
T2Csend.sender(sender, 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(T2CodeLibMain.getPath() + "/DebugLogs");
|
||||||
|
File directoryTemp = new File("T2CDebugLogsTemp");
|
||||||
if (!directory.exists()) {
|
if (!directory.exists()) {
|
||||||
directory.mkdir();
|
directory.mkdir();
|
||||||
}
|
}
|
||||||
|
if (!directoryTemp.exists()) {
|
||||||
|
directoryTemp.mkdir();
|
||||||
|
}
|
||||||
|
|
||||||
File file = new File(T2CodeLibMain.getPath(), "/DebugLogs/T2CodeLog.txt");
|
File file = new File("T2CDebugLogsTemp/T2CodeLog.txt");
|
||||||
PrintWriter pWriter = null;
|
PrintWriter pWriter = null;
|
||||||
try {
|
try {
|
||||||
pWriter = new PrintWriter(new FileWriter(file.getPath()));
|
pWriter = new PrintWriter(new FileWriter(file.getPath()));
|
||||||
@@ -117,9 +122,9 @@ public class CreateReportLog {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String filePath = T2CodeLibMain.getPath() + "/DebugLogs/T2CodeLog.txt";
|
String filePath = "T2CDebugLogsTemp/T2CodeLog.txt";
|
||||||
String log = "logs/latest.log";
|
String log = "logs/latest.log";
|
||||||
String zipPath = "plugins/T2CodeLib/DebugLogs/T2CLog-" + timeStampFile + ".zip";
|
String zipPath = "T2CDebugLogsTemp/T2CLog-" + timeStampFile + ".zip";
|
||||||
try (ZipOutputStream zip = new ZipOutputStream(new FileOutputStream(zipPath))) {
|
try (ZipOutputStream zip = new ZipOutputStream(new FileOutputStream(zipPath))) {
|
||||||
File fileToZip = new File(filePath);
|
File fileToZip = new File(filePath);
|
||||||
zip.putNextEntry(new ZipEntry(fileToZip.getName()));
|
zip.putNextEntry(new ZipEntry(fileToZip.getName()));
|
||||||
@@ -136,9 +141,22 @@ public class CreateReportLog {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
file.delete();
|
file.delete();
|
||||||
|
File zipFile = new File(zipPath);
|
||||||
|
|
||||||
|
if (!confirmUpload) {
|
||||||
|
Files.move(Paths.get(zipPath), Paths.get(directory + "/" + zipFile.getName()));
|
||||||
|
zipFile.delete();
|
||||||
|
directoryTemp.delete();
|
||||||
|
if (sender instanceof Player) {
|
||||||
|
T2Csend.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());
|
||||||
|
}
|
||||||
|
T2Csend.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());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
HttpClient httpclient = new DefaultHttpClient();
|
HttpClient httpclient = new DefaultHttpClient();
|
||||||
HttpPost httppost = new HttpPost("https://debug.t2code.net/uploadFile");
|
HttpPost httppost = new HttpPost("https://debug.t2code.net/uploadFile");
|
||||||
File zipFile = new File(zipPath);
|
|
||||||
FileBody bin = new FileBody(zipFile);
|
FileBody bin = new FileBody(zipFile);
|
||||||
MultipartEntity reqEntity = new MultipartEntity();
|
MultipartEntity reqEntity = new MultipartEntity();
|
||||||
reqEntity.addPart("file", bin);
|
reqEntity.addPart("file", bin);
|
||||||
@@ -152,15 +170,21 @@ public class CreateReportLog {
|
|||||||
String fileType = obj.getString("fileType");
|
String fileType = obj.getString("fileType");
|
||||||
Integer fileSize = obj.getInt("size");
|
Integer fileSize = obj.getInt("size");
|
||||||
zipFile.delete();
|
zipFile.delete();
|
||||||
|
directoryTemp.delete();
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
T2Csend.sender(sender, Util.getPrefix() + ("<green>A DebugLog zip has been created. You can download it <click:open_url:'[url]'>" +
|
T2Csend.sender(sender, ("[prefix] <green>A DebugLog zip has been created." +
|
||||||
"<gold><hover:show_text:'<yellow>Download the debug file</yellow>'>here</hover></gold></click>. Please enter the following key " +
|
"<br>[prefix] <green>You can download it <click:open_url:'[url]'><gold><hover:show_text:'<yellow>Download the debug file</yellow>'>here</hover></gold></click>." +
|
||||||
"in the ticket: <gold><click:copy_to_clipboard:[key]><hover:show_text:'<yellow>Copy to clipboard</yellow>'>[key]</hover></click></gold></green>" +
|
"<br>[prefix] <green>Please enter the following key in the ticket: <gold><click:copy_to_clipboard:[key]><hover:show_text:'<yellow>Copy to clipboard</yellow>'>[key]</hover></click></gold></green>" +
|
||||||
"<br><dark_red>Do not share the download URL with anyone!</dark_red><br><click:run_command:'/t2code debug deleteReportLog [key]'>" +
|
"<br>[prefix] <dark_red>Do not share the download URL with anyone!</dark_red>" +
|
||||||
"<green>You can <b>delte </b>yor Debug-File by clicking me.</green></click>").replace("[key]", fileID).replace("[url]", downloadURL));
|
"<br><hover:show_text:'<yellow>Click to delete</yellow>'><click:run_command:'/t2code debug deleteReportLog [key]'>[prefix] <green>You can <b>delte</b> yor Debug-File by clicking me.</green>" +
|
||||||
|
"<br>[prefix] <color:#910d06>(If you do not delete the debug file, it will be deleted automatically after <red>14</red> days!)</color></click></hover>")
|
||||||
|
.replace("[key]", fileID).replace("[url]", downloadURL).replace("[prefix]", Util.getPrefix()));
|
||||||
}
|
}
|
||||||
T2Csend.console(Util.getPrefix() + (" §6A DebugLog zip has been created. You can download it here: [url].\n§6Please enter the following key in the ticket:" +
|
T2Csend.console(Util.getPrefix() + (" <gold>A DebugLog zip has been created. You can download it here:</gold> <yellow>[url]</yellow>" +
|
||||||
" §e[key].\n§4Do not share the download URL with anyone!\nYou can delte yor Debug-File with the following command: /t2code debug deleteReportLog [key].")
|
"<br><gold>Please enter the following key in the ticket:</gold> <yellow>[key]</yellow>." +
|
||||||
|
"<br><dark_red>Do not share the download URL with anyone!</dark_red>" +
|
||||||
|
"<br><color:#910d06>(If you do not delete the debug file, it will be deleted automatically after <red>14</red> days!)</color>" +
|
||||||
|
"<br><dark_red>You can delte yor Debug-File with the following command:</dark_red> <red>/t2code debug deleteReportLog [key]</red>.")
|
||||||
.replace("[key]", fileID).replace("[url]", downloadURL));
|
.replace("[key]", fileID).replace("[url]", downloadURL));
|
||||||
ReportLogStorage.add(fileID);
|
ReportLogStorage.add(fileID);
|
||||||
}
|
}
|
||||||
|
@@ -24,9 +24,10 @@ public class ConfigCreate {
|
|||||||
|
|
||||||
T2Cconfig.set("Plugin.UpdateCheck.OnJoin", true, yamlConfiguration);
|
T2Cconfig.set("Plugin.UpdateCheck.OnJoin", true, yamlConfiguration);
|
||||||
T2Cconfig.set("Plugin.UpdateCheck.TimeInterval", 60, yamlConfiguration);
|
T2Cconfig.set("Plugin.UpdateCheck.TimeInterval", 60, yamlConfiguration);
|
||||||
|
T2Cconfig.set("Plugin.UpdateCheck.SeePreReleaseUpdates", true, yamlConfiguration);
|
||||||
T2Cconfig.set("Plugin.language", "english", yamlConfiguration);
|
T2Cconfig.set("Plugin.language", "english", yamlConfiguration);
|
||||||
|
|
||||||
T2Cconfig.set("BungeeCord.Enable", false, yamlConfiguration);
|
T2Cconfig.set("BungeeCord.Enable", T2CodeLibMain.getIsBungee(), yamlConfiguration);
|
||||||
T2Cconfig.set("Player.Inventories.CloseByServerStop", true, yamlConfiguration);
|
T2Cconfig.set("Player.Inventories.CloseByServerStop", true, yamlConfiguration);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@@ -7,29 +7,34 @@ import java.io.File;
|
|||||||
|
|
||||||
public class SelectLibConfig {
|
public class SelectLibConfig {
|
||||||
|
|
||||||
private static Boolean UpdateCheckOnJoin;
|
private static Boolean updateCheckOnJoin;
|
||||||
private static Boolean t2cTestDevelopment = false;
|
private static Boolean t2cTestDevelopment = false;
|
||||||
private static Integer UpdateCheckTimeInterval;
|
private static Integer updateCheckTimeInterval;
|
||||||
private static Boolean Debug;
|
private static Boolean seePreReleaseUpdates;
|
||||||
|
private static Boolean debug;
|
||||||
private static String language;
|
private static String language;
|
||||||
private static Boolean bungee;
|
private static Boolean bungee;
|
||||||
private static Boolean InventoriesCloseByServerStop;
|
private static Boolean inventoriesCloseByServerStop;
|
||||||
|
|
||||||
public static void onSelect() {
|
public static void onSelect() {
|
||||||
File config = new File(T2CodeLibMain.getPath(), "config.yml");
|
File config = new File(T2CodeLibMain.getPath(), "config.yml");
|
||||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||||
|
|
||||||
UpdateCheckOnJoin = yamlConfiguration.getBoolean("Plugin.UpdateCheck.OnJoin");
|
if (yamlConfiguration.contains("t2cTestDevelopment")) {
|
||||||
t2cTestDevelopment = yamlConfiguration.getBoolean("t2cTestDevelopment");
|
t2cTestDevelopment = yamlConfiguration.getBoolean("t2cTestDevelopment");
|
||||||
UpdateCheckTimeInterval = yamlConfiguration.getInt("Plugin.UpdateCheck.TimeInterval");
|
}
|
||||||
Debug = yamlConfiguration.getBoolean("Plugin.Debug");
|
|
||||||
|
updateCheckOnJoin = yamlConfiguration.getBoolean("Plugin.UpdateCheck.OnJoin");
|
||||||
|
updateCheckTimeInterval = yamlConfiguration.getInt("Plugin.UpdateCheck.TimeInterval");
|
||||||
|
seePreReleaseUpdates = yamlConfiguration.getBoolean("Plugin.UpdateCheck.SeePreReleaseUpdates");
|
||||||
|
debug = yamlConfiguration.getBoolean("Plugin.Debug");
|
||||||
language = yamlConfiguration.getString("Plugin.language");
|
language = yamlConfiguration.getString("Plugin.language");
|
||||||
bungee = yamlConfiguration.getBoolean("BungeeCord.Enable");
|
bungee = yamlConfiguration.getBoolean("BungeeCord.Enable");
|
||||||
InventoriesCloseByServerStop = yamlConfiguration.getBoolean("Player.Inventories.CloseByServerStop");
|
inventoriesCloseByServerStop = yamlConfiguration.getBoolean("Player.Inventories.CloseByServerStop");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Boolean getUpdateCheckOnJoin() {
|
public static Boolean getUpdateCheckOnJoin() {
|
||||||
return UpdateCheckOnJoin;
|
return updateCheckOnJoin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Boolean getT2cTestDevelopment() {
|
public static Boolean getT2cTestDevelopment() {
|
||||||
@@ -37,11 +42,15 @@ public class SelectLibConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Integer getUpdateCheckTimeInterval() {
|
public static Integer getUpdateCheckTimeInterval() {
|
||||||
return UpdateCheckTimeInterval;
|
return updateCheckTimeInterval;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Boolean getSeePreReleaseUpdates() {
|
||||||
|
return seePreReleaseUpdates;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Boolean getDebug() {
|
public static Boolean getDebug() {
|
||||||
return Debug;
|
return debug;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getLanguage() {
|
public static String getLanguage() {
|
||||||
@@ -53,7 +62,7 @@ public class SelectLibConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Boolean getInventoriesCloseByServerStop() {
|
public static Boolean getInventoriesCloseByServerStop() {
|
||||||
return InventoriesCloseByServerStop;
|
return inventoriesCloseByServerStop;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -8,16 +8,19 @@ public class T2CupdateObject {
|
|||||||
public T2CupdateWebData webData;
|
public T2CupdateWebData webData;
|
||||||
public Boolean load;
|
public Boolean load;
|
||||||
public Boolean updateAvailable;
|
public Boolean updateAvailable;
|
||||||
|
public Boolean updateCheckOnJoin;
|
||||||
|
|
||||||
public T2CupdateObject(String pluginName,
|
public T2CupdateObject(String pluginName,
|
||||||
String pluginVersion,
|
String pluginVersion,
|
||||||
T2CupdateWebData webData,
|
T2CupdateWebData webData,
|
||||||
Boolean load,
|
Boolean load,
|
||||||
Boolean updateAvailable) {
|
Boolean updateAvailable,
|
||||||
|
Boolean updateCheckOnJoin) {
|
||||||
this.pluginName = pluginName;
|
this.pluginName = pluginName;
|
||||||
this.pluginVersion = pluginVersion;
|
this.pluginVersion = pluginVersion;
|
||||||
this.webData = webData;
|
this.webData = webData;
|
||||||
this.load = load;
|
this.load = load;
|
||||||
this.updateAvailable = updateAvailable;
|
this.updateAvailable = updateAvailable;
|
||||||
|
this.updateCheckOnJoin = updateCheckOnJoin;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,16 +1,23 @@
|
|||||||
package net.t2code.t2codelib;
|
package net.t2code.t2codelib;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public class Util {
|
public class Util {
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private static final UUID serverUUID = UUID.randomUUID();
|
||||||
|
|
||||||
|
|
||||||
public static String getInfoText() {
|
public static String getInfoText() {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getPrefix() {
|
public static String getPrefix() {
|
||||||
return "§8[§4T2Code§5Lib§8]";
|
return "<dark_gray>[<dark_red>T2Code</dark_red><dark_purple>Lib</dark_purple>]</dark_gray>";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Integer getSpigotID() {
|
public static Integer getSpigotID() {
|
||||||
@@ -18,7 +25,7 @@ public class Util {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String getGit() {
|
public static String getGit() {
|
||||||
return "https://git.t2code.net/api/v1/repos/JaTiTV/T2CodeLib/releases?limit=1";
|
return "JaTiTV/T2CodeLib";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Integer getBstatsID() {
|
public static Integer getBstatsID() {
|
||||||
|
Reference in New Issue
Block a user