Compare commits
36 Commits
test-updat
...
15.1
Author | SHA1 | Date | |
---|---|---|---|
b2ebce50ed | |||
1b8bedc4e6 | |||
4b7d8539ea | |||
|
bb230fb3ea | ||
b01bf2d84f | |||
|
32fe2ab579 | ||
c4282817b0 | |||
|
e9ee3e690c | ||
|
c9ee80dd38 | ||
|
b00b201bce | ||
709bd16317 | |||
66dc27483b | |||
623d6f8c12 | |||
b3adbe61e8 | |||
167b81f0df | |||
8bbdd7a818 | |||
3aee76ddb8 | |||
65ff4ee24a | |||
ede7908721 | |||
dd4a5de2ab | |||
7243e403e1 | |||
63d80b9e5e | |||
74e05ff7c5 | |||
1708c4bf70 | |||
415e8dc24b | |||
c4b5996256 | |||
37db515726 | |||
|
6c412f5360 | ||
0fcf436dbf | |||
1762afce07 | |||
9916040c63 | |||
1b589759fb | |||
6ee14b4782 | |||
|
2d916c7e0c | ||
8567e6b3b2 | |||
b64c1e7c59 |
37
.gitea/ISSUE_TEMPLATE/bug_report.md
Normal file
37
.gitea/ISSUE_TEMPLATE/bug_report.md
Normal file
@@ -0,0 +1,37 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels:
|
||||
- "bug report"
|
||||
|
||||
---
|
||||
|
||||
**Description of issue:**
|
||||
|
||||
|
||||
---
|
||||
|
||||
**Plugin Version (using`/t2c info`):**
|
||||
|
||||
**Server Type (Spigot/Paperspigot/etc):**
|
||||
|
||||
**Server Version (using `/ver`):**
|
||||
|
||||
**Relevant plugins (Delete if this isn't needed):**
|
||||
|
||||
---
|
||||
|
||||
**ERROR (DELETE IF YOU HAVE NO ERROR):**
|
||||
```
|
||||
######################
|
||||
## REPLACE WITH ERROR ##
|
||||
######################
|
||||
```
|
||||
|
||||
**CONFIG SECTION (DELETE IF NOT RELEVANT):**
|
||||
```
|
||||
#######################################
|
||||
## REPLACE WITH RELEVANT CONFIG SECTION ##
|
||||
#######################################
|
||||
```
|
21
.gitea/ISSUE_TEMPLATE/feature_request.md
Normal file
21
.gitea/ISSUE_TEMPLATE/feature_request.md
Normal file
@@ -0,0 +1,21 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea/improvement
|
||||
title: ''
|
||||
labels:
|
||||
- "feature request"
|
||||
|
||||
---
|
||||
|
||||
**Description of feature request:**
|
||||
|
||||
|
||||
---
|
||||
|
||||
**Plugin Version (using`/t2c info`):**
|
||||
|
||||
**Server Type (Spigot/Paperspigot/etc):**
|
||||
|
||||
**Server Version (using `/ver`):**
|
||||
|
||||
**Relevant plugins (Delete if this isn't needed):**
|
22
.gitea/ISSUE_TEMPLATE/question.md
Normal file
22
.gitea/ISSUE_TEMPLATE/question.md
Normal file
@@ -0,0 +1,22 @@
|
||||
---
|
||||
name: Question
|
||||
about: Ask a question or get advice
|
||||
title: ''
|
||||
labels:
|
||||
- question
|
||||
|
||||
---
|
||||
|
||||
**Share your question here:**
|
||||
|
||||
---
|
||||
|
||||
**Plugin Version (using`/t2c info`):**
|
||||
|
||||
**Server Type (Spigot/Paperspigot/etc):**
|
||||
|
||||
**Server Version (using `/ver`):**
|
||||
|
||||
**Relevant plugins (Delete if this isn't needed):**
|
||||
|
||||
---
|
78
pom.xml
78
pom.xml
@@ -6,7 +6,10 @@
|
||||
|
||||
<groupId>net.t2code</groupId>
|
||||
<artifactId>T2CodeLib</artifactId>
|
||||
<version>14.0</version>
|
||||
<version>15.1</version>
|
||||
<!--version>VERSION_snapshot-0</version-->
|
||||
<!--version>VERSION_beta-0</version-->
|
||||
<!--version>VERSION_dev-0</version-->
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>T2CodeLib</name>
|
||||
@@ -60,39 +63,48 @@
|
||||
</build>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>sonatype-oss-snapshots1</id>
|
||||
<url>https://s01.oss.sonatype.org/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
<!-- Mojang / Spigot -->
|
||||
<!-- Spigot -->
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
<!-- repo.t2code / T2Code -->
|
||||
|
||||
<!-- Mojang authlib -->
|
||||
<repository>
|
||||
<id>Builders-Paradise</id>
|
||||
<url>https://repo.t2code.net/repository/Builders-Paradise/</url>
|
||||
<id>minecraft-repo</id>
|
||||
<url>https://libraries.minecraft.net/</url>
|
||||
</repository>
|
||||
|
||||
<!-- Bungee -->
|
||||
<repository>
|
||||
<id>bungeecord-repo</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||
</repository>
|
||||
|
||||
<!-- repo.t2code / T2Code -->
|
||||
<repository>
|
||||
<id>T2Code</id>
|
||||
<url>https://repo.t2code.net/repository/T2Code/</url>
|
||||
</repository>
|
||||
|
||||
<!-- Vault-->
|
||||
<repository>
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io</url>
|
||||
</repository>
|
||||
|
||||
<!-- placeholderapi -->
|
||||
<repository>
|
||||
<id>placeholderapi</id>
|
||||
<url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
|
||||
</repository>
|
||||
|
||||
<!-- votingplugin -->
|
||||
<repository>
|
||||
<id>BenCodez Repo</id>
|
||||
<url>https://nexus.bencodez.com/repository/maven-public/</url>
|
||||
</repository>
|
||||
|
||||
<!--Kyori MiniMessage
|
||||
<repository>
|
||||
<id>sonatype-oss-snapshots1</id>
|
||||
@@ -102,26 +114,46 @@
|
||||
|
||||
|
||||
<dependencies>
|
||||
<!-- Mojang / Spigot-->
|
||||
<!-- Spigot-->
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.19.3-R0.1-SNAPSHOT</version>
|
||||
<version>1.20-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- repo.t2code / T2Code -->
|
||||
|
||||
<!-- Mojang authlib -->
|
||||
<dependency>
|
||||
<groupId>net.t2code</groupId>
|
||||
<artifactId>bungee</artifactId>
|
||||
<version>1642</version>
|
||||
<groupId>com.mojang</groupId>
|
||||
<artifactId>authlib</artifactId>
|
||||
<version>1.5.21</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Bungee -->
|
||||
<dependency>
|
||||
<groupId>net.md-5</groupId>
|
||||
<artifactId>bungeecord-api</artifactId>
|
||||
<version>1.20-R0.1-SNAPSHOT</version>
|
||||
<type>jar</type>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.md-5</groupId>
|
||||
<artifactId>bungeecord-api</artifactId>
|
||||
<version>1.19-R0.1-SNAPSHOT</version>
|
||||
<type>javadoc</type>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- repo.t2code / T2Code -->
|
||||
<dependency>
|
||||
<groupId>net.t2code</groupId>
|
||||
<artifactId>LuckyBox-API</artifactId>
|
||||
<version>4.2.7</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Vault-->
|
||||
<dependency>
|
||||
<groupId>com.github.MilkBowl</groupId>
|
||||
@@ -129,39 +161,43 @@
|
||||
<version>1.7</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- placeholderapi -->
|
||||
<dependency>
|
||||
<groupId>me.clip</groupId>
|
||||
<artifactId>placeholderapi</artifactId>
|
||||
<version>2.11.2</version>
|
||||
<version>2.11.3</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- votingplugin -->
|
||||
<dependency>
|
||||
<groupId>com.bencodez</groupId>
|
||||
<artifactId>votingplugin</artifactId>
|
||||
<version>6.10.0</version>
|
||||
<version>6.12.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!--Kyori MiniMessage-->
|
||||
<dependency>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-text-minimessage</artifactId>
|
||||
<version>4.12.0</version>
|
||||
<version>4.14.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-platform-bukkit</artifactId>
|
||||
<version>4.2.0</version>
|
||||
<version>4.3.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-platform-bungeecord</artifactId>
|
||||
<version>4.2.0</version>
|
||||
<version>4.3.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
@@ -169,6 +205,7 @@
|
||||
<version>1.18.24</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.json/json -->
|
||||
<dependency>
|
||||
<groupId>org.json</groupId>
|
||||
@@ -176,6 +213,7 @@
|
||||
<version>20220924</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpmime -->
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
|
@@ -1,6 +1,6 @@
|
||||
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;
|
||||
@@ -57,7 +57,7 @@ public class T2CBbungeePlayers implements Listener {
|
||||
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) -> {
|
||||
ProxyServer.getInstance().getServers().values().stream().forEach((server) -> {
|
||||
server.sendData("t2c:bonlp", stream.toByteArray());
|
||||
});
|
||||
}
|
||||
@@ -72,7 +72,7 @@ public class T2CBbungeePlayers implements Listener {
|
||||
} catch (IOException e) {
|
||||
Logger.getLogger(e.getMessage());
|
||||
}
|
||||
BungeeCord.getInstance().getServers().values().stream().forEach((server) -> {
|
||||
ProxyServer.getInstance().getServers().values().stream().forEach((server) -> {
|
||||
server.sendData("t2c:bonlp", stream.toByteArray());
|
||||
});
|
||||
}
|
||||
|
@@ -1,27 +1,17 @@
|
||||
package net.t2code.t2codelib.BUNGEE.api.update;
|
||||
|
||||
import net.md_5.bungee.BungeeCord;
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.plugin.Plugin;
|
||||
import net.t2code.t2codelib.BUNGEE.api.messages.T2CBsend;
|
||||
import net.t2code.t2codelib.BUNGEE.system.config.T2CBlibConfig;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
|
||||
import net.t2code.t2codelib.T2CupdateObject;
|
||||
import net.t2code.t2codelib.T2CupdateWebData;
|
||||
import net.t2code.t2codelib.UpdateType;
|
||||
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.HashMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class T2CBupdateAPI {
|
||||
public static HashMap<String, T2CupdateObject> bungeePluginVersins = new HashMap<>();
|
||||
@@ -59,8 +49,13 @@ public class T2CBupdateAPI {
|
||||
private static String pluginVersion;
|
||||
|
||||
public static void onUpdateCheckTimer(Plugin plugin, String prefix, String discord, Integer spigotID, String url) {
|
||||
Integer finalInterval;
|
||||
if (T2CBlibConfig.getUpdateTimer() < 1){
|
||||
finalInterval = 1;
|
||||
} else finalInterval = T2CBlibConfig.getUpdateTimer();
|
||||
ProxyServer.getInstance().getScheduler().schedule(plugin, new Runnable() {
|
||||
public void run() {
|
||||
if (T2CBlibConfig.getUpdateCheckFullDisable()) return;
|
||||
(new T2CBupdateCheckerGit(plugin, spigotID)).getVersion((webData) -> {
|
||||
pluginVersion = plugin.getDescription().getVersion();
|
||||
T2CupdateObject update = new T2CupdateObject(
|
||||
@@ -83,6 +78,6 @@ public class T2CBupdateAPI {
|
||||
}
|
||||
}, pluginVersion, spigotID, url);
|
||||
}
|
||||
}, 0, T2CBlibConfig.getUpdateTimer() * 60 * 20L, TimeUnit.SECONDS);
|
||||
}, 0, finalInterval * 60 * 20L, TimeUnit.SECONDS);
|
||||
}
|
||||
}
|
||||
|
@@ -1,9 +1,8 @@
|
||||
package net.t2code.t2codelib.BUNGEE.api.update;
|
||||
|
||||
import net.md_5.bungee.BungeeCord;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
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;
|
||||
@@ -27,12 +26,13 @@ public class T2CBupdateCheckerGit {
|
||||
}
|
||||
|
||||
public void getVersion(Consumer<T2CupdateWebData> consumer, String pluginVersion, Integer spigotID, String gitKey) {
|
||||
if (T2CBlibConfig.getUpdateCheckFullDisable()) return;
|
||||
String RepoURL = "https://git.t2code.net/api/v1/repos/" + gitKey + "/releases?limit=1";
|
||||
if (!T2CBlibConfig.getSeePreReleaseUpdates()){
|
||||
if (!T2CBlibConfig.getSeePreReleaseUpdates()) {
|
||||
RepoURL = RepoURL + "&pre-release=false";
|
||||
}
|
||||
String finalRepoURL = RepoURL;
|
||||
BungeeCord.getInstance().getScheduler().runAsync(this.plugin, () -> {
|
||||
ProxyServer.getInstance().getScheduler().runAsync(this.plugin, () -> {
|
||||
try {
|
||||
URL url = new URL(finalRepoURL);
|
||||
URLConnection yc = url.openConnection();
|
||||
@@ -63,6 +63,7 @@ public class T2CBupdateCheckerGit {
|
||||
String formattedDate = outputFormat.format(parsedDate);
|
||||
|
||||
JSONArray downloadArray = obj.getJSONArray("assets");
|
||||
String gitURL = updateurl;
|
||||
String downloadURL;
|
||||
if (downloadArray.isEmpty()) {
|
||||
downloadURL = "https://www.spigotmc.org/resources/" + spigotID;
|
||||
@@ -75,7 +76,7 @@ public class T2CBupdateCheckerGit {
|
||||
updateurl = "https://www.spigotmc.org/resources/" + spigotID;
|
||||
}
|
||||
|
||||
T2CupdateWebData webData = new T2CupdateWebData(UpdateName, tag_name, body, updateurl, formattedDate, downloadURL, prerelease);
|
||||
T2CupdateWebData webData = new T2CupdateWebData(UpdateName, tag_name, body, updateurl, formattedDate, downloadURL, gitURL, prerelease);
|
||||
consumer.accept(webData);
|
||||
} catch (Exception var10) {
|
||||
Boolean load = false;
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package net.t2code.t2codelib.BUNGEE.system.config;
|
||||
|
||||
import lombok.Getter;
|
||||
import net.md_5.bungee.config.Configuration;
|
||||
import net.md_5.bungee.config.ConfigurationProvider;
|
||||
import net.md_5.bungee.config.YamlConfiguration;
|
||||
@@ -22,6 +23,8 @@ public class T2CBlibConfig {
|
||||
}
|
||||
Configuration configuration = ConfigurationProvider.getProvider(YamlConfiguration.class).load(config);
|
||||
T2CBconfig.set("UpdateCheck.TimerInMin", 60, configuration);
|
||||
T2CBconfig.set("UpdateCheck.SeePreReleaseUpdates", true, configuration);
|
||||
T2CBconfig.set("Plugin.UpdateCheck.AllPlugins.FullDisable", false, configuration);
|
||||
|
||||
T2CBconfig.set("API.CommandGUI.Enable", false, configuration);
|
||||
T2CBconfig.set("API.AutoResponse.Enable", false, configuration);
|
||||
@@ -37,35 +40,24 @@ public class T2CBlibConfig {
|
||||
|
||||
updateTimer = configuration.getInt("UpdateCheck.TimerInMin");
|
||||
seePreReleaseUpdates = configuration.getBoolean("UpdateCheck.SeePreReleaseUpdates");
|
||||
updateCheckFullDisable = configuration.getBoolean("Plugin.UpdateCheck.AllPlugins.FullDisable");
|
||||
|
||||
apiCommandGUIEnable = configuration.getBoolean("API.CommandGUI.Enable");
|
||||
apiAutoResponse = configuration.getBoolean("API.AutoResponse.Enable");
|
||||
apiOpSecurity = configuration.getBoolean("API.OPSecurity.Enable");
|
||||
}
|
||||
|
||||
@Getter
|
||||
private static Integer updateTimer;
|
||||
@Getter
|
||||
private static Boolean seePreReleaseUpdates;
|
||||
@Getter
|
||||
private static Boolean updateCheckFullDisable;
|
||||
@Getter
|
||||
private static Boolean apiCommandGUIEnable;
|
||||
@Getter
|
||||
private static Boolean apiAutoResponse;
|
||||
@Getter
|
||||
private static Boolean apiOpSecurity;
|
||||
|
||||
public static Integer getUpdateTimer() {
|
||||
return updateTimer;
|
||||
}
|
||||
|
||||
public static Boolean getSeePreReleaseUpdates() {
|
||||
return seePreReleaseUpdates;
|
||||
}
|
||||
|
||||
public static Boolean getApiCommandGUIEnable() {
|
||||
return apiCommandGUIEnable;
|
||||
}
|
||||
|
||||
public static Boolean getApiAutoResponse() {
|
||||
return apiAutoResponse;
|
||||
}
|
||||
|
||||
public static Boolean getApiOpSecurity() {
|
||||
return apiOpSecurity;
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package net.t2code.t2codelib.BUNGEE.system.pluginMessaging.commandgui;
|
||||
|
||||
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.PostLoginEvent;
|
||||
@@ -37,8 +37,7 @@ public class T2CapiCGUI implements Listener {
|
||||
} catch (IOException e) {
|
||||
Logger.getLogger(e.getMessage());
|
||||
}
|
||||
BungeeCord.getInstance().getServers().values().stream().forEach((server) -> {
|
||||
|
||||
ProxyServer.getInstance().getServers().values().stream().forEach((server) -> {
|
||||
server.sendData("t2c:cguiopl", stream.toByteArray());
|
||||
});
|
||||
}
|
||||
@@ -52,7 +51,7 @@ public class T2CapiCGUI implements Listener {
|
||||
} catch (IOException e) {
|
||||
Logger.getLogger(e.getMessage());
|
||||
}
|
||||
BungeeCord.getInstance().getServers().values().stream().forEach((server) -> {
|
||||
ProxyServer.getInstance().getServers().values().stream().forEach((server) -> {
|
||||
server.sendData("t2c:cguiopl", stream.toByteArray());
|
||||
});
|
||||
}
|
||||
|
@@ -1,12 +1,9 @@
|
||||
package net.t2code.t2codelib.BUNGEE.system.pluginMessaging.opSecurity;
|
||||
|
||||
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.PluginMessageEvent;
|
||||
import net.md_5.bungee.api.plugin.Listener;
|
||||
import net.md_5.bungee.event.EventHandler;
|
||||
import net.t2code.t2codelib.BUNGEE.api.messages.T2CBsend;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.logging.Logger;
|
||||
@@ -41,7 +38,7 @@ public class T2CapiOpSecurity implements Listener {
|
||||
} catch (IOException e) {
|
||||
Logger.getLogger(e.getMessage());
|
||||
}
|
||||
BungeeCord.getInstance().getServers().values().stream().forEach((server) -> {
|
||||
ProxyServer.getInstance().getServers().values().stream().forEach((server) -> {
|
||||
server.sendData("t2c:opsec", stream.toByteArray());
|
||||
});
|
||||
}
|
||||
|
@@ -51,7 +51,6 @@ public class T2CbungeePlayers implements PluginMessageListener {
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void callAllBungeePlayers() {
|
||||
|
@@ -0,0 +1,37 @@
|
||||
package net.t2code.t2codelib.SPIGOT.api.debug;
|
||||
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class T2Cdebug {
|
||||
public static void debug(Plugin plugin, String msg) {
|
||||
debug(plugin, msg, null);
|
||||
}
|
||||
|
||||
public static void debug(Plugin plugin, String msg, Integer stage) {
|
||||
// if (!new File(Main.getPath(), "config.yml").exists()) return;
|
||||
if (stage == null) {
|
||||
if (plugin.getConfig().getBoolean("Plugin.Debug") || plugin.getConfig().getBoolean("plugin.debug") || plugin.getConfig().getBoolean("Debug") || plugin.getConfig().getBoolean("debug")){
|
||||
T2Csend.info(plugin, "");
|
||||
Bukkit.getConsoleSender().sendMessage(plugin.getDescription().getPrefix() + " §5DEBUG: §6" + msg);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (plugin.getConfig().getInt("Plugin.Debug") >= stage || plugin.getConfig().getInt("plugin.debug") >= stage || plugin.getConfig().getInt("Debug") >= stage || plugin.getConfig().getInt("debug") >= stage) {
|
||||
T2Csend.info(plugin, "");
|
||||
Bukkit.getConsoleSender().sendMessage(plugin.getDescription().getPrefix() + " §5DEBUG: §6" + msg);
|
||||
}
|
||||
}
|
||||
|
||||
public static void debugmsg(Plugin plugin, String msg) {
|
||||
T2Csend.warning(plugin, "");
|
||||
Bukkit.getConsoleSender().sendMessage("§e[" + plugin.getDescription().getPrefix() + "] §5DEBUG-MSG: §6" + msg);
|
||||
}
|
||||
|
||||
public static String debugCode(){
|
||||
return UUID.randomUUID().toString().substring(0, 7);
|
||||
}
|
||||
}
|
@@ -55,15 +55,8 @@ public class T2Ceco {
|
||||
}
|
||||
|
||||
public static boolean itemAdd(Player player, ItemStack itemStack, int amount) {
|
||||
boolean empty = false;
|
||||
for (int i = 0; i < player.getInventory().getSize() - 5; i++) {
|
||||
if (player.getInventory().getItem(i) == null) {
|
||||
empty = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < amount; i++) {
|
||||
if (empty) {
|
||||
if (player.getInventory().firstEmpty() != -1) {
|
||||
player.getInventory().addItem(itemStack);
|
||||
} else {
|
||||
player.getLocation().getWorld().dropItem(player.getLocation(), itemStack);
|
||||
|
@@ -0,0 +1,77 @@
|
||||
package net.t2code.t2codelib.SPIGOT.api.items;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.inventory.meta.SkullMeta;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class T2CitemBuilder {
|
||||
public static final boolean getLegacy = T2CmcVersion.isMc1_8() || T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12();
|
||||
|
||||
public static void fillItem(boolean enable, String item, Integer lines, Inventory inventory) {
|
||||
if (!enable) return;
|
||||
fillItem(item, lines, inventory);
|
||||
}
|
||||
|
||||
public static void fillItem(String item, Integer lines, Inventory inventory) {
|
||||
try {
|
||||
ItemStack glass;
|
||||
if (getLegacy) {
|
||||
glass = new ItemStack(Material.valueOf("STAINED_GLASS_PANE"), 1, Short.parseShort(item));
|
||||
} else glass = new ItemStack(Material.valueOf(item.toUpperCase().replace(".", "_")));
|
||||
ItemMeta itemMetaglass = glass.getItemMeta();
|
||||
assert itemMetaglass != null;
|
||||
itemMetaglass.setDisplayName(" ");
|
||||
glass.setItemMeta(itemMetaglass);
|
||||
glass.setAmount(1);
|
||||
for (int i = 0; i < 9 * lines; i++) {
|
||||
inventory.setItem(i, glass);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static ItemStack itemStack(Material material, Integer amount, String displayName, List<String> lore) {
|
||||
ItemStack itemStack = new ItemStack(material);
|
||||
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||
|
||||
itemMeta.setDisplayName(displayName);
|
||||
itemMeta.setLore(lore);
|
||||
itemStack.setItemMeta(itemMeta);
|
||||
|
||||
itemStack.setAmount(amount);
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
public static ItemStack base64(String base64Value, Integer amount, String displayName, List<String> lore) {
|
||||
ItemStack itemStack = new ItemStack(T2CitemVersion.getHead());
|
||||
SkullMeta itemMeta = (SkullMeta) itemStack.getItemMeta();
|
||||
|
||||
GameProfile profile = new GameProfile(UUID.randomUUID(), "");
|
||||
profile.getProperties().put("textures", new Property("textures", base64Value));
|
||||
Field profileField;
|
||||
try {
|
||||
profileField = itemMeta.getClass().getDeclaredField("profile");
|
||||
profileField.setAccessible(true);
|
||||
profileField.set(itemMeta, profile);
|
||||
} catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
itemMeta.setDisplayName(displayName);
|
||||
itemMeta.setLore(lore);
|
||||
itemStack.setItemMeta(itemMeta);
|
||||
|
||||
itemStack.setAmount(amount);
|
||||
return itemStack;
|
||||
}
|
||||
}
|
@@ -23,6 +23,47 @@ public class T2Creplace {
|
||||
.replace("[nl]", "\n")));
|
||||
}
|
||||
|
||||
public static Object replaceObject(String prefix, Object object) {
|
||||
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) {
|
||||
if (object instanceof String) {
|
||||
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"));
|
||||
}
|
||||
if (object instanceof List) {
|
||||
List<String> in = (List<String>) object;
|
||||
List<String> output = new ArrayList<>();
|
||||
for (String input : in) {
|
||||
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")));
|
||||
}
|
||||
object = output;
|
||||
}
|
||||
return object;
|
||||
}
|
||||
|
||||
public static List<String> replace(String prefix, List<String> Text) {
|
||||
List<String> output = new ArrayList<>();
|
||||
for (String input : Text) {
|
||||
@@ -35,7 +76,7 @@ public class T2Creplace {
|
||||
}
|
||||
|
||||
public static List<String> replace(String prefix, Player player, List<String> Text) {
|
||||
List<String> output = new ArrayList();
|
||||
List<String> output = new ArrayList<>();
|
||||
if (player == null) {
|
||||
return Collections.singletonList("player is null");
|
||||
}
|
||||
@@ -52,7 +93,7 @@ public class T2Creplace {
|
||||
}
|
||||
|
||||
public static List<String> replacePrice(String prefix, List<String> Text, String price) {
|
||||
List<String> rp = new ArrayList();
|
||||
List<String> rp = new ArrayList<>();
|
||||
for (String s : Text) {
|
||||
rp.add(replaceLegacyColor(s).replace("[prefix]", prefix)
|
||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||
@@ -82,7 +123,7 @@ public class T2Creplace {
|
||||
}
|
||||
|
||||
public static List<String> replacePrice(String prefix, Player player, List<String> Text, String price) {
|
||||
List<String> rp = new ArrayList();
|
||||
List<String> rp = new ArrayList<>();
|
||||
for (String s : Text) {
|
||||
rp.add(replaceLegacyColor(PlaceholderAPI.setPlaceholders(player, s.replace("[prefix]", prefix)
|
||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package net.t2code.t2codelib.SPIGOT.api.messages;
|
||||
|
||||
import net.t2code.t2codelib.SPIGOT.api.debug.T2Cdebug;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -24,6 +25,29 @@ public class T2Csend {
|
||||
T2ChoverModule.modulePlayer(msg, player);
|
||||
}
|
||||
|
||||
public static void sender(CommandSender sender, String msg) {
|
||||
if (msg == null || msg.contains("[empty]")) return;
|
||||
T2ChoverModule.moduleSender(msg, sender);
|
||||
}
|
||||
|
||||
public static void console(Object object) {
|
||||
String msg = String.valueOf(object);
|
||||
if (msg == null || msg.contains("[empty]")) return;
|
||||
T2ChoverModule.moduleConsole(msg);
|
||||
}
|
||||
|
||||
public static void player(Player player, Object object) {
|
||||
String msg = String.valueOf(object);
|
||||
if (msg == null || msg.contains("[empty]")) return;
|
||||
T2ChoverModule.modulePlayer(msg, player);
|
||||
}
|
||||
|
||||
public static void sender(CommandSender sender, Object object) {
|
||||
String msg = String.valueOf(object);
|
||||
if (msg == null || msg.contains("[empty]")) return;
|
||||
T2ChoverModule.moduleSender(msg, sender);
|
||||
}
|
||||
|
||||
public static void title(Player player, @Nullable String title, @Nullable String subtitle) {
|
||||
player.sendTitle(title, subtitle);
|
||||
}
|
||||
@@ -32,33 +56,17 @@ public class T2Csend {
|
||||
player.sendTitle(title, subtitle, fadeIn, stay, fadeOut);
|
||||
}
|
||||
|
||||
public static void sender(CommandSender sender, String msg) {
|
||||
if (msg == null || msg.contains("[empty]")) return;
|
||||
T2ChoverModule.moduleSender(msg, sender);
|
||||
}
|
||||
|
||||
public static void debug(Plugin plugin, String msg) {
|
||||
debug(plugin, msg, null);
|
||||
}
|
||||
|
||||
public static void debug(Plugin plugin, String msg, Integer stage) {
|
||||
// if (!new File(Main.getPath(), "config.yml").exists()) return;
|
||||
if (stage == null) {
|
||||
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);
|
||||
}
|
||||
return;
|
||||
}
|
||||
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);
|
||||
}
|
||||
T2Cdebug.debug(plugin, msg, stage);
|
||||
}
|
||||
|
||||
public static void debugmsg(Plugin plugin, String msg) {
|
||||
warning(plugin, "");
|
||||
Bukkit.getConsoleSender().sendMessage("§e[" + plugin.getDescription().getPrefix() + "] §5DEBUG-MSG: §6" + msg);
|
||||
T2Cdebug.debugmsg(plugin, msg);
|
||||
}
|
||||
|
||||
public static void info(Plugin plugin, String msg) {
|
||||
|
@@ -104,7 +104,7 @@ public class T2Ctemplate {
|
||||
String pr = premiumVerified != null ? "<br><dark_red>║</dark_red> <yellow>Premium verified:</yellow> [pr]".replace("[pr]", premiumVerified ? "<dark_green>YES</dark_green>" : "<red>NO</red>") : "";
|
||||
|
||||
String stMSG = text == null || text.equals("") ? "" : "<br><dark_red>║</dark_red> " + text + "<br>";
|
||||
T2Csend.sender(sender, "<dark_red>╔══════════════════════════════════════</dark_red>"
|
||||
T2Csend.sender(sender, "<dark_red>╔════════════════════════════════</dark_red>"
|
||||
+ "<br>" + stPlugin
|
||||
+ stMSG
|
||||
+ stVersion
|
||||
@@ -113,7 +113,7 @@ public class T2Ctemplate {
|
||||
+ "<br>" + stStable
|
||||
+ "<br>" + stLink
|
||||
+ pr
|
||||
+ "<br><dark_red>╚══════════════════════════════════════</dark_red>");
|
||||
+ "<br><dark_red>╚════════════════════════════════</dark_red>");
|
||||
}
|
||||
|
||||
public static void sendInfo(CommandSender sender, Plugin plugin, int spigotID, String discord, String text) {
|
||||
|
@@ -43,6 +43,7 @@ public class T2CmcVersion {
|
||||
nms1_19_R1 = nms.contains("1_19_R1");
|
||||
nms1_19_R2 = nms.contains("1_19_R2");
|
||||
nms1_20_R1 = nms.contains("1_20_R1");
|
||||
nms1_20_R2 = nms.contains("1_20_R2");
|
||||
}
|
||||
|
||||
private static String mcVersion;
|
||||
@@ -83,6 +84,7 @@ public class T2CmcVersion {
|
||||
private static boolean nms1_19_R1;
|
||||
private static boolean nms1_19_R2;
|
||||
private static boolean nms1_20_R1;
|
||||
private static boolean nms1_20_R2;
|
||||
|
||||
public static String getMcVersion() {
|
||||
return mcVersion;
|
||||
@@ -231,4 +233,7 @@ public class T2CmcVersion {
|
||||
public static boolean isNms1_20_R1() {
|
||||
return nms1_20_R1;
|
||||
}
|
||||
public static boolean isNms1_20_R2() {
|
||||
return nms1_20_R2;
|
||||
}
|
||||
}
|
||||
|
@@ -5,7 +5,6 @@ import com.google.gson.JsonObject;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
@@ -13,6 +12,7 @@ import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class T2CnameHistory {
|
||||
public static class NameLookup {
|
||||
@@ -93,7 +93,7 @@ public class T2CnameHistory {
|
||||
con.setReadTimeout(2000);
|
||||
con.connect();
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
|
||||
String response = in.readLine();
|
||||
String response = in.lines().collect(Collectors.joining());
|
||||
in.close();
|
||||
return response;
|
||||
}
|
||||
|
@@ -2,6 +2,7 @@ package net.t2code.t2codelib.SPIGOT.api.update;
|
||||
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
|
||||
import net.t2code.t2codelib.UpdateType;
|
||||
import net.t2code.t2codelib.T2CupdateObject;
|
||||
import net.t2code.t2codelib.T2CupdateWebData;
|
||||
@@ -17,13 +18,13 @@ public class T2CupdateAPI {
|
||||
public static HashMap<String, T2CupdateObject> pluginVersions = new HashMap<>();
|
||||
|
||||
public static void join(Plugin plugin, String prefix, String perm, Player player, Integer spigotID, String discord) {
|
||||
if (pluginVersions.get(plugin.getName()) == null){
|
||||
if (pluginVersions.get(plugin.getName()) == null) {
|
||||
Bukkit.getScheduler().runTaskLaterAsynchronously(T2CodeLibMain.getPlugin(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
join(plugin,prefix,perm,player,spigotID,discord);
|
||||
join(plugin, prefix, perm, player, spigotID, discord);
|
||||
}
|
||||
},2*20L);
|
||||
}, 2 * 20L);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -156,7 +157,7 @@ public class T2CupdateAPI {
|
||||
String updateButton;
|
||||
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> <color:#ff9499><hover:show_text:'" + updateDescription + "'>Update Description</hover></color>";
|
||||
+ "'>Download</click></hover></color> <dark_gray>|</dark_gray> <color:#ff9499><hover:show_text:'" + updateDescription + "'><click:open_url:'" + webData.getGitURL() + "'>Update Description</click></hover></color>";
|
||||
} else updateButton = "<br><dark_red>║</dark_red> <color:#5eff89>Download:</color> <gold>" + updateUpdate + "</gold>";
|
||||
|
||||
String text;
|
||||
@@ -180,6 +181,7 @@ public class T2CupdateAPI {
|
||||
}
|
||||
|
||||
public static void onUpdateCheck(Plugin plugin, String prefix, String gitKey, Integer spigotID, String discord, Boolean updateCheckOnJoin, Boolean seePreReleaseUpdates, Integer timeInterval) {
|
||||
if (SelectLibConfig.getUpdateCheckFullDisable()) return;
|
||||
new T2CupdateCheckerGit((JavaPlugin) plugin, prefix, gitKey, spigotID, discord, updateCheckOnJoin, seePreReleaseUpdates, timeInterval);
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,8 @@
|
||||
package net.t2code.t2codelib.SPIGOT.api.update;
|
||||
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
|
||||
import net.t2code.t2codelib.T2CupdateObject;
|
||||
import net.t2code.t2codelib.T2CupdateWebData;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -30,9 +32,15 @@ public class T2CupdateCheckerGit {
|
||||
}
|
||||
String finalRepoURL = RepoURL;
|
||||
|
||||
Integer finalInterval;
|
||||
if (timeInterval < 1){
|
||||
finalInterval = 1;
|
||||
} else finalInterval = timeInterval;
|
||||
|
||||
Bukkit.getScheduler().runTaskTimerAsynchronously(plugin, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (SelectLibConfig.getUpdateCheckFullDisable()) return;
|
||||
getVersion((webData) -> {
|
||||
T2CupdateObject update = new T2CupdateObject(
|
||||
plugin.getName(),
|
||||
@@ -65,7 +73,7 @@ public class T2CupdateCheckerGit {
|
||||
|
||||
}, plugin.getDescription().getVersion(), spigotID, finalRepoURL, updateCheckOnJoin, seePreReleaseUpdates, timeInterval);
|
||||
}
|
||||
}, 0L, timeInterval * 60 * 20L);
|
||||
}, 0L, finalInterval * 60 * 20L);
|
||||
}
|
||||
|
||||
public void getVersion(Consumer<T2CupdateWebData> consumer, String pluginVersion, Integer spigotID, String URL, Boolean updateCheckOnJoin, Boolean seePreReleaseUpdates, Integer timeInterval) {
|
||||
@@ -102,6 +110,7 @@ public class T2CupdateCheckerGit {
|
||||
Date parsedDate = inputFormat.parse(date);
|
||||
String formattedDate = outputFormat.format(parsedDate);
|
||||
|
||||
String gitURL = updateurl;
|
||||
JSONArray downloadArray = obj.getJSONArray("assets");
|
||||
String downloadURL;
|
||||
if (downloadArray.isEmpty()) {
|
||||
@@ -115,7 +124,7 @@ public class T2CupdateCheckerGit {
|
||||
updateurl = "https://www.spigotmc.org/resources/" + spigotID;
|
||||
}
|
||||
|
||||
T2CupdateWebData webData = new T2CupdateWebData(UpdateName, tag_name, body, updateurl, formattedDate, downloadURL, prerelease);
|
||||
T2CupdateWebData webData = new T2CupdateWebData(UpdateName, tag_name, body, updateurl, formattedDate, downloadURL, gitURL, prerelease);
|
||||
consumer.accept(webData);
|
||||
} catch (Exception var10) {
|
||||
Boolean load = false;
|
||||
|
@@ -0,0 +1,37 @@
|
||||
package net.t2code.t2codelib.SPIGOT.api.yaml;
|
||||
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
|
||||
|
||||
public class T2CLibConfig {
|
||||
public static Boolean getUpdateCheckOnJoin() {
|
||||
return SelectLibConfig.getUpdateCheckOnJoin();
|
||||
}
|
||||
|
||||
public static Boolean getT2cTestDevelopment() {
|
||||
return SelectLibConfig.getT2cTestDevelopment();
|
||||
}
|
||||
|
||||
public static Integer getUpdateCheckTimeInterval() {
|
||||
return SelectLibConfig.getUpdateCheckTimeInterval();
|
||||
}
|
||||
|
||||
public static Boolean getSeePreReleaseUpdates() {
|
||||
return SelectLibConfig.getSeePreReleaseUpdates();
|
||||
}
|
||||
|
||||
public static Boolean getDebug() {
|
||||
return SelectLibConfig.getDebug();
|
||||
}
|
||||
|
||||
public static String getLanguage() {
|
||||
return SelectLibConfig.getLanguage();
|
||||
}
|
||||
|
||||
public static Boolean getBungee() {
|
||||
return SelectLibConfig.getBungee();
|
||||
}
|
||||
|
||||
public static Boolean getInventoriesCloseByServerStop() {
|
||||
return SelectLibConfig.getInventoriesCloseByServerStop();
|
||||
}
|
||||
}
|
@@ -17,6 +17,11 @@ public class T2Cconfig {
|
||||
YamlConfiguration.set(path, value);
|
||||
}
|
||||
}
|
||||
public static void set(String path, Object value, YamlConfiguration YamlConfiguration) {
|
||||
if (!YamlConfiguration.contains(path)) {
|
||||
YamlConfiguration.set(path, value);
|
||||
}
|
||||
}
|
||||
|
||||
public static void set(String path, YamlConfiguration YamlConfiguration) {
|
||||
YamlConfiguration.set(path, null);
|
||||
@@ -119,6 +124,9 @@ public class T2Cconfig {
|
||||
return T2Creplace.replace(prefix, yamlConfiguration.getString(path));
|
||||
}
|
||||
|
||||
public static Object selectObject(String prefix, String path, YamlConfiguration yamlConfiguration) {
|
||||
return T2Creplace.replaceObject(prefix, yamlConfiguration.get(path));
|
||||
}
|
||||
|
||||
public static Integer selectInt(String path, YamlConfiguration yamlConfiguration) {
|
||||
return (yamlConfiguration.getInt(path));
|
||||
@@ -140,7 +148,6 @@ public class T2Cconfig {
|
||||
return (yamlConfiguration.getItemStack(path));
|
||||
}
|
||||
|
||||
|
||||
public static List<String> selectList(String prefix, String path, YamlConfiguration yamlConfiguration) {
|
||||
List<String> output = new ArrayList<>();
|
||||
List<String> input = yamlConfiguration.getStringList(path);
|
||||
|
@@ -61,10 +61,10 @@ public final class T2CodeLibMain extends JavaPlugin {
|
||||
}
|
||||
T2CmcVersion.onCheck();
|
||||
|
||||
if (T2CmcVersion.isMc1_20()) {
|
||||
if (T2CmcVersion.isNms1_20_R2()) {
|
||||
T2Csend.console(prefix + " §4!!!!!!!!!!!!!!!!!!!!");
|
||||
T2Csend.console(prefix);
|
||||
T2Csend.warning(plugin, "The 1.20.* is a very fresh / new version. If there are any bugs in our plugins, please report them to us via our Discord: http://dc.t2code.net");
|
||||
T2Csend.warning(plugin, "The 1.20.* (R2) is a very fresh / new version. If there are any bugs in our plugins, please report them to us via our Discord: http://dc.t2code.net");
|
||||
T2Csend.console(prefix);
|
||||
T2Csend.console(prefix + " §4!!!!!!!!!!!!!!!!!!!!");
|
||||
if (!SelectLibConfig.getT2cTestDevelopment()) {
|
||||
@@ -96,6 +96,9 @@ public final class T2CodeLibMain extends JavaPlugin {
|
||||
T2Csend.console(prefix + " §3PlaceholderAPI: §6connected" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
}
|
||||
|
||||
T2Csend.console(prefix + " §3Kyori MiniMessage Support: "+ (getMmIsLoad() ? "§2load" : "§4not load") + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
|
||||
|
||||
plugin.getCommand("t2code").setExecutor(new CmdExecuter());
|
||||
ConfigCreate.configCreate();
|
||||
T2CitemVersion.scan();
|
||||
@@ -108,6 +111,7 @@ public final class T2CodeLibMain extends JavaPlugin {
|
||||
Metrics.Bstats(plugin, Util.getBstatsID());
|
||||
if (SelectLibConfig.getBungee()) {
|
||||
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");
|
||||
|
@@ -6,6 +6,8 @@ import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import net.t2code.t2codelib.Util;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class Vault {
|
||||
|
||||
public static Boolean vaultEnable;
|
||||
@@ -13,7 +15,7 @@ public class Vault {
|
||||
|
||||
public static void loadVault() throws InterruptedException {
|
||||
long long_ = System.currentTimeMillis();
|
||||
if (T2CodeLibMain.getPlugin().getServer().getPluginManager().getPlugin("Vault") != null) {
|
||||
if (T2CodeLibMain.getPlugin().getServer().getPluginManager().getPlugin("Vault") != null && Objects.requireNonNull(T2CodeLibMain.getPlugin().getServer().getPluginManager().getPlugin("Vault")).isEnabled()) {
|
||||
vaultEnable = true;
|
||||
RegisteredServiceProvider<Economy> eco = T2CodeLibMain.getPlugin().getServer().getServicesManager().getRegistration(Economy.class);
|
||||
if (eco != null) {
|
||||
|
@@ -5,6 +5,7 @@ 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.SPIGOT.system.config.config.SelectLibConfig;
|
||||
import net.t2code.t2codelib.Util;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@@ -41,6 +42,7 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
|
||||
return false;
|
||||
case "reloadconfig":
|
||||
SelectLibConfig.onSelect();
|
||||
T2Csend.sender(sender, Util.getPrefix() + " §2Config successfully reloaded");
|
||||
return false;
|
||||
case "debug":
|
||||
Commands.debug(sender,args);
|
||||
|
@@ -132,9 +132,11 @@ public class CreateReportLog {
|
||||
|
||||
addFileToZip("", "logs/latest.log", zip, false);
|
||||
|
||||
for (String pl : Util.getT2cPlugins()) {
|
||||
pluginToDebug(pl, zip);
|
||||
}
|
||||
// for (String pl : Util.getT2cPlugins()) {
|
||||
// pluginToDebug(pl, zip);
|
||||
// }
|
||||
pluginToDebug(zip); //todo überprüfen
|
||||
|
||||
zip.closeEntry();
|
||||
zip.close();
|
||||
} catch (IOException e) {
|
||||
@@ -206,6 +208,19 @@ public class CreateReportLog {
|
||||
}
|
||||
}
|
||||
}
|
||||
private static void pluginToDebug(ZipOutputStream zip) throws IOException {
|
||||
for (Plugin plugin : Bukkit.getPluginManager().getPlugins()){
|
||||
String plName = plugin.getDescription().getName();
|
||||
if (plName.contains("T2C-") || Util.getT2cPlugins().contains(plName)){
|
||||
File plConfigs = new File(plugin.getDataFolder().getPath());
|
||||
if (plConfigs.exists()) {
|
||||
addFolderToZip("T2Code-Plugins", plugin.getDataFolder().getPath(), zip);
|
||||
}
|
||||
File f = new File(plugin.getClass().getProtectionDomain().getCodeSource().getLocation().getPath());
|
||||
addFileToZip("T2Code-Plugins", f.getPath(), zip, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void addFolderToZip(String path, String srcFolder, ZipOutputStream zip) throws IOException {
|
||||
File folder = new File(srcFolder);
|
||||
|
@@ -22,9 +22,11 @@ public class ConfigCreate {
|
||||
File config = new File(T2CodeLibMain.getPath(), "config.yml");
|
||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||
|
||||
|
||||
T2Cconfig.set("Plugin.UpdateCheck.OnJoin", true, yamlConfiguration);
|
||||
T2Cconfig.set("Plugin.UpdateCheck.TimeInterval", 60, yamlConfiguration);
|
||||
T2Cconfig.set("Plugin.UpdateCheck.SeePreReleaseUpdates", true, yamlConfiguration);
|
||||
T2Cconfig.set("Plugin.UpdateCheck.AllPlugins.FullDisable", false, yamlConfiguration);
|
||||
T2Cconfig.set("Plugin.language", "english", yamlConfiguration);
|
||||
|
||||
T2Cconfig.set("BungeeCord.Enable", T2CodeLibMain.getIsBungee(), yamlConfiguration);
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package net.t2code.t2codelib.SPIGOT.system.config.config;
|
||||
|
||||
import lombok.Getter;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
@@ -7,13 +8,23 @@ import java.io.File;
|
||||
|
||||
public class SelectLibConfig {
|
||||
|
||||
@Getter
|
||||
private static Boolean updateCheckOnJoin;
|
||||
@Getter
|
||||
private static Boolean t2cTestDevelopment = false;
|
||||
@Getter
|
||||
private static Integer updateCheckTimeInterval;
|
||||
@Getter
|
||||
private static Boolean seePreReleaseUpdates;
|
||||
@Getter
|
||||
private static Boolean updateCheckFullDisable;
|
||||
@Getter
|
||||
private static Boolean debug;
|
||||
@Getter
|
||||
private static String language;
|
||||
@Getter
|
||||
private static Boolean bungee;
|
||||
@Getter
|
||||
private static Boolean inventoriesCloseByServerStop;
|
||||
|
||||
public static void onSelect() {
|
||||
@@ -27,42 +38,10 @@ public class SelectLibConfig {
|
||||
updateCheckOnJoin = yamlConfiguration.getBoolean("Plugin.UpdateCheck.OnJoin");
|
||||
updateCheckTimeInterval = yamlConfiguration.getInt("Plugin.UpdateCheck.TimeInterval");
|
||||
seePreReleaseUpdates = yamlConfiguration.getBoolean("Plugin.UpdateCheck.SeePreReleaseUpdates");
|
||||
updateCheckFullDisable = yamlConfiguration.getBoolean("Plugin.UpdateCheck.AllPlugins.FullDisable");
|
||||
debug = yamlConfiguration.getBoolean("Plugin.Debug");
|
||||
language = yamlConfiguration.getString("Plugin.language");
|
||||
bungee = yamlConfiguration.getBoolean("BungeeCord.Enable");
|
||||
inventoriesCloseByServerStop = yamlConfiguration.getBoolean("Player.Inventories.CloseByServerStop");
|
||||
}
|
||||
|
||||
public static Boolean getUpdateCheckOnJoin() {
|
||||
return updateCheckOnJoin;
|
||||
}
|
||||
|
||||
public static Boolean getT2cTestDevelopment() {
|
||||
return t2cTestDevelopment;
|
||||
}
|
||||
|
||||
public static Integer getUpdateCheckTimeInterval() {
|
||||
return updateCheckTimeInterval;
|
||||
}
|
||||
|
||||
public static Boolean getSeePreReleaseUpdates() {
|
||||
return seePreReleaseUpdates;
|
||||
}
|
||||
|
||||
public static Boolean getDebug() {
|
||||
return debug;
|
||||
}
|
||||
|
||||
public static String getLanguage() {
|
||||
return language;
|
||||
}
|
||||
|
||||
public static Boolean getBungee() {
|
||||
return bungee;
|
||||
}
|
||||
|
||||
public static Boolean getInventoriesCloseByServerStop() {
|
||||
return inventoriesCloseByServerStop;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -16,15 +16,18 @@ public class T2CupdateWebData {
|
||||
@Getter
|
||||
private String downloadURL;
|
||||
@Getter
|
||||
private String gitURL;
|
||||
@Getter
|
||||
private boolean preRelease;
|
||||
|
||||
public T2CupdateWebData(String updateTitle, String version, String updateDescription, String updateUrl, String publishedAt, String downloadURL, boolean preRelease) {
|
||||
public T2CupdateWebData(String updateTitle, String version, String updateDescription, String updateUrl, String publishedAt, String downloadURL, String gitURL, boolean preRelease) {
|
||||
this.updateTitle = updateTitle;
|
||||
this.version = version;
|
||||
this.updateDescription = updateDescription;
|
||||
this.updateUrl = updateUrl;
|
||||
this.publishedAt = publishedAt;
|
||||
this.downloadURL = downloadURL;
|
||||
this.gitURL = gitURL;
|
||||
this.preRelease = preRelease;
|
||||
}
|
||||
}
|
||||
|
@@ -54,7 +54,8 @@ public class Util {
|
||||
"LoreEditor",
|
||||
"Booster",
|
||||
"AntiMapCopy",
|
||||
"AntiCopy"
|
||||
"AntiCopy",
|
||||
"T2C-LoginPermissionAuth"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user