Compare commits
44 Commits
test-updat
...
15.4
Author | SHA1 | Date | |
---|---|---|---|
59133a36f9 | |||
c2adf6957d | |||
2e1ef9c46d | |||
a7c7877ac6 | |||
71c746b752 | |||
6f054a8993 | |||
a3ec7117dd | |||
034bf241e5 | |||
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.4</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());
|
||||
});
|
||||
}
|
||||
|
@@ -10,31 +10,55 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public class T2CBtab {
|
||||
public static Iterable<String> tab(CommandSender sender, String[] args, String perm,Boolean onlinePlayer){
|
||||
List<String> matches = new ArrayList<>();
|
||||
Iterator var6 = ProxyServer.getInstance().getPlayers().iterator();
|
||||
while (var6.hasNext()) {
|
||||
ProxiedPlayer player1 = (ProxiedPlayer) var6.next();
|
||||
if (passend(player1.getName(), args[0]) && hasPermission(sender, perm)){
|
||||
matches.add(player1.getName());
|
||||
}
|
||||
|
||||
|
||||
public static void tab(List<String> matches, CommandSender sender, int arg, String[] args, String perm, Boolean onlinePlayer) {
|
||||
if (args.length != arg + 1) return;
|
||||
for (ProxiedPlayer player1 : ProxyServer.getInstance().getPlayers()) {
|
||||
if (passend(player1.getName(), args[arg]) && hasPermission(sender, perm)) {
|
||||
matches.add(player1.getName());
|
||||
}
|
||||
return matches;
|
||||
}
|
||||
}
|
||||
|
||||
public static Iterable<String> tab(CommandSender sender, String[] args, HashMap<String, String> permMap) {
|
||||
List<String> matches = new ArrayList<>();
|
||||
public static void tab(List<String> matches, CommandSender sender, int argEquals, String equalsValue, int arg, String[] args, String perm, Boolean onlinePlayer) {
|
||||
if (args.length != arg + 1) return;
|
||||
if (!args[argEquals].toLowerCase().equals(equalsValue)) return;
|
||||
for (ProxiedPlayer player1 : ProxyServer.getInstance().getPlayers()) {
|
||||
if (passend(player1.getName(), args[arg]) && hasPermission(sender, perm)) {
|
||||
matches.add(player1.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void tab(List<String> matches, CommandSender sender, int arg, String[] args, HashMap<String, String> permMap, Boolean onlinePlayer, String permForPlayer) {
|
||||
if (args.length != arg + 1) return;
|
||||
for (String command : permMap.keySet()) {
|
||||
if (hasPermission(sender, permMap.get(command)) && passend(command, args[0])) {
|
||||
if (hasPermission(sender, permMap.get(command)) && passend(command, args[arg])) {
|
||||
matches.add(command);
|
||||
} else if (onlinePlayer != null && permForPlayer != null) {
|
||||
tab(matches, sender, arg, args, permForPlayer, onlinePlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void tab(List<String> matches, CommandSender sender, int arg, String[] args, HashMap<String, String> permMap) {
|
||||
tab(matches, sender, arg, args, permMap, null, null);
|
||||
}
|
||||
|
||||
public static void tab(List<String> matches, CommandSender sender, int argEquals, String equalsValue, int arg, String[] args, HashMap<String, String> permMap) {
|
||||
if (args.length != arg + 1) return;
|
||||
if (!args[argEquals].toLowerCase().equals(equalsValue)) return;
|
||||
for (String command : permMap.keySet()) {
|
||||
if (hasPermission(sender, permMap.get(command)) && passend(command, args[arg])) {
|
||||
matches.add(command);
|
||||
}
|
||||
}
|
||||
return matches;
|
||||
}
|
||||
|
||||
public static Iterable<String> tab(CommandSender sender, String[] args, String perm, String command) {
|
||||
public static List<String> tab(CommandSender sender, int arg, String[] args, String perm, String command) {
|
||||
List<String> matches = new ArrayList<>();
|
||||
if (hasPermission(sender, perm) && passend(command, args[0])) {
|
||||
if (hasPermission(sender, perm) && passend(command, args[arg])) {
|
||||
matches.add(command);
|
||||
}
|
||||
return matches;
|
||||
|
@@ -1,27 +1,16 @@
|
||||
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.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 +48,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 +77,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;
|
||||
|
@@ -34,7 +34,7 @@ public class T2CBload {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
T2CBupdateAPI.onUpdateCheckTimer(plugin, prefix, discord, spigotID,url);
|
||||
T2CBupdateAPI.onUpdateCheckTimer(plugin, prefix, discord, spigotID, url);
|
||||
|
||||
//API
|
||||
plugin.getProxy().registerChannel("t2c:bcmd");
|
||||
|
@@ -43,8 +43,6 @@ public class T2CodeBMain extends Plugin {
|
||||
mmIsLoad = false;
|
||||
}
|
||||
T2CBload.onLoad(plugin, Util.getPrefix(), autor, orgVersion, Util.getSpigot(), Util.getDiscord(), Util.getSpigotID(), Util.getBstatsID(),Util.getGit());
|
||||
String[] fv = orgVersion.split("_");
|
||||
plugin.getDescription().setVersion(fv[0]);
|
||||
version = plugin.getDescription().getVersion();
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
|
@@ -5,6 +5,7 @@ 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.Util;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.DataInputStream;
|
||||
@@ -19,13 +20,14 @@ public class T2CplmsgBcmd implements Listener {
|
||||
try {
|
||||
String channel = stream.readUTF();
|
||||
String input = stream.readUTF();
|
||||
String serverID = stream.readUTF();
|
||||
if (channel.equals("T2Code-Console")) {
|
||||
ProxyServer.getInstance().getConsole().sendMessage("Command Console: "+ input);
|
||||
ProxyServer.getInstance().getConsole().sendMessage(Util.getPrefix()+" [§6"+serverID+"§r] §cT2C BCMD Command Console: §r"+ input);
|
||||
ProxyServer.getInstance().getPluginManager().dispatchCommand(ProxyServer.getInstance().getConsole(), input);
|
||||
} else {
|
||||
ProxiedPlayer player = ProxyServer.getInstance().getPlayer(channel);
|
||||
if (player != null) {
|
||||
ProxyServer.getInstance().getConsole().sendMessage("Command " + player +": "+ input);
|
||||
ProxyServer.getInstance().getConsole().sendMessage(Util.getPrefix()+" [§6"+serverID+"§r] §cT2C BCMD Command §r" + player +": "+ input);
|
||||
ProxyServer.getInstance().getPluginManager().dispatchCommand(player, input);
|
||||
}
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
package net.t2code.t2codelib.SPIGOT.api.dev;
|
||||
|
||||
public class T2CdevelopmentTool {
|
||||
public static String removeLastChar(String s, int amount) {
|
||||
return (s == null || s.length() == 0)
|
||||
? null
|
||||
: (s.substring(0, s.length() - amount));
|
||||
}
|
||||
}
|
@@ -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;
|
||||
}
|
||||
}
|
@@ -8,11 +8,25 @@ import org.bukkit.entity.Player;
|
||||
|
||||
public class T2ChoverModule {
|
||||
|
||||
/**
|
||||
* @deprecated reason this method is deprecated <br/>
|
||||
* The T2Code Hover Module will be removed soon,<br/>
|
||||
* please use 'T2CminiMessage.sendPlayerMiniMessage(msg, player);'<br/>
|
||||
* and the Kyori MiniMessage format!
|
||||
*/
|
||||
@Deprecated
|
||||
public static void modulePlayer(String text, String hover, String action, String actionValue, Player player) {
|
||||
modulePlayer((text != null ? text : "null") + "/*/" + (hover != null ? hover : "null") + "/*/" + (action != null ? action : "null")
|
||||
+ "/*/" + (actionValue != null ? actionValue : "null"), player);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated reason this method is deprecated <br/>
|
||||
* The T2Code Hover Module will be removed soon,<br/>
|
||||
* please use 'T2CminiMessage.sendPlayerMiniMessage(msg, player);'<br/>
|
||||
* and the Kyori MiniMessage format!
|
||||
*/
|
||||
@Deprecated
|
||||
public static void modulePlayer(String msg, Player player) {
|
||||
if (msg.contains("/*/")) {
|
||||
t2cmodule(msg, player);
|
||||
@@ -21,10 +35,24 @@ public class T2ChoverModule {
|
||||
T2CminiMessage.sendPlayerMiniMessage(msg, player);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated reason this method is deprecated <br/>
|
||||
* The T2Code Hover Module will be removed soon,<br/>
|
||||
* please use 'T2CminiMessage.sendSenderMiniMessage(msg, sender);'<br/>
|
||||
* and the Kyori MiniMessage format!
|
||||
*/
|
||||
@Deprecated
|
||||
public static void moduleSender(String msg, CommandSender sender) {
|
||||
T2CminiMessage.sendSenderMiniMessage(msg, sender);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated reason this method is deprecated <br/>
|
||||
* The T2Code Hover Module will be removed soon,<br/>
|
||||
* please use 'T2CminiMessage.sendPlayerMiniMessage(msg, player);'<br/>
|
||||
* and the Kyori MiniMessage format!
|
||||
*/
|
||||
@Deprecated
|
||||
public static void moduleConsole(String msg) {
|
||||
if (T2CodeLibMain.getMmIsLoad()) {
|
||||
T2CminiMessage.sendConsoleMiniMessage(msg);
|
||||
@@ -33,6 +61,13 @@ public class T2ChoverModule {
|
||||
Bukkit.getConsoleSender().sendMessage(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated reason this method is deprecated <br/>
|
||||
* The T2Code Hover Module will be removed soon,<br/>
|
||||
* please use 'T2CminiMessage.sendPlayerMiniMessage(msg, player);'<br/>
|
||||
* and the Kyori MiniMessage format!
|
||||
*/
|
||||
@Deprecated
|
||||
private static void t2cmodule(String msg, Player player) {
|
||||
String[] split = msg.split("/\\*/");
|
||||
int i = split.length;
|
||||
|
@@ -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]", "ö")
|
||||
@@ -69,20 +110,10 @@ public class T2Creplace {
|
||||
.replace("&c", "").replace("&d", "").replace("&e", "").replace("&f", "")
|
||||
.replace("&k", "").replace("&l", "").replace("&m", "").replace("&n", "")
|
||||
.replace("&o", "").replace("&r", "");
|
||||
// String text = value.replace("&", "§");
|
||||
// while (text.contains("§")) {
|
||||
// int stelle = text.indexOf("§");
|
||||
// if (text.length() >= stelle + 2) {
|
||||
// text = text.substring(0, stelle) + text.substring(stelle + 2);
|
||||
// } else {
|
||||
// text = text.substring(0, stelle) + text.substring(stelle + 1);
|
||||
// }
|
||||
// }
|
||||
// return (text);
|
||||
}
|
||||
|
||||
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;
|
||||
@@ -11,19 +12,68 @@ import java.util.logging.Level;
|
||||
public class T2Csend {
|
||||
|
||||
/**
|
||||
* Spigot
|
||||
* @deprecated reason this method is deprecated <br/>
|
||||
* Please note that these methods will be rebuilt to MiniMessage in the future and from then on the T2Code Hover Module will be removed!
|
||||
*/
|
||||
|
||||
@Deprecated
|
||||
public static void console(String msg) {
|
||||
if (msg == null || msg.contains("[empty]")) return;
|
||||
T2ChoverModule.moduleConsole(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated reason this method is deprecated <br/>
|
||||
* Please note that these methods will be rebuilt to MiniMessage in the future and from then on the T2Code Hover Module will be removed!
|
||||
*/
|
||||
@Deprecated
|
||||
public static void player(Player player, String msg) {
|
||||
if (msg == null || msg.contains("[empty]")) return;
|
||||
T2ChoverModule.modulePlayer(msg, player);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated reason this method is deprecated <br/>
|
||||
* Please note that these methods will be rebuilt to MiniMessage in the future and from then on the T2Code Hover Module will be removed!
|
||||
*/
|
||||
@Deprecated
|
||||
public static void sender(CommandSender sender, String msg) {
|
||||
if (msg == null || msg.contains("[empty]")) return;
|
||||
T2ChoverModule.moduleSender(msg, sender);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated reason this method is deprecated <br/>
|
||||
* Please note that these methods will be rebuilt to MiniMessage in the future and from then on the T2Code Hover Module will be removed!
|
||||
*/
|
||||
@Deprecated
|
||||
public static void console(Object object) {
|
||||
String msg = String.valueOf(object);
|
||||
if (msg == null || msg.contains("[empty]")) return;
|
||||
T2ChoverModule.moduleConsole(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated reason this method is deprecated <br/>
|
||||
* Please note that these methods will be rebuilt to MiniMessage in the future and from then on the T2Code Hover Module will be removed!
|
||||
*/
|
||||
@Deprecated
|
||||
public static void player(Player player, Object object) {
|
||||
String msg = String.valueOf(object);
|
||||
if (msg == null || msg.contains("[empty]")) return;
|
||||
T2ChoverModule.modulePlayer(msg, player);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated reason this method is deprecated <br/>
|
||||
* Please note that these methods will be rebuilt to MiniMessage in the future and from then on the T2Code Hover Module will be removed!
|
||||
*/
|
||||
@Deprecated
|
||||
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 +82,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) {
|
||||
|
@@ -68,21 +68,41 @@ public class T2Ctemplate {
|
||||
T2Csend.console(prefix + " §8-------------------------------");
|
||||
}
|
||||
|
||||
public static void onLoadFooter(String prefix, Long long_, String version) {
|
||||
onLoadSeparateStroke(prefix);
|
||||
T2Csend.console(prefix + " §2Plugin loaded successfully." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
}
|
||||
|
||||
public static void onLoadFooter(String prefix, Long long_) {
|
||||
onLoadSeparateStroke(prefix);
|
||||
T2Csend.console(prefix + " §2Plugin loaded successfully." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param prefix
|
||||
* @param autor
|
||||
* @param spigot
|
||||
* @param discord
|
||||
*
|
||||
* @deprecated reason this method is deprecated <br/>
|
||||
* {will be removed in next version} <br/>
|
||||
* use {@link #onDisable(Plugin)} instead like this:
|
||||
*
|
||||
*
|
||||
* <blockquote><pre>
|
||||
* onDisable(getPlugin())
|
||||
* </pre></blockquote>
|
||||
*
|
||||
*/
|
||||
@Deprecated
|
||||
public static void onDisable(String prefix, List<String> autor, String version, String spigot, String discord) {
|
||||
T2Csend.console(prefix + " §2Version: §6" + version);
|
||||
T2Csend.console(prefix + " §4Plugin successfully disabled.");
|
||||
}
|
||||
|
||||
public static void onDisable(String prefix, Plugin plugin) {
|
||||
T2Csend.console(prefix + " §4 §e╔══════════════════════════");
|
||||
T2Csend.console(prefix + " §4 §e║ §2Version: §6" + plugin.getDescription().getVersion());
|
||||
T2Csend.console(prefix + " §4 §e║ §2Autors: §6" + plugin.getDescription().getAuthors());
|
||||
T2Csend.console(prefix + " §4 §e║ §4Plugin successfully disabled.");
|
||||
T2Csend.console(prefix + " §4 §e╚══════════════════════════");
|
||||
}
|
||||
|
||||
public static void sendInfo(CommandSender sender, Plugin plugin, int spigotID, String discord, Boolean premiumVerified, String text) {
|
||||
String pluginVersion = plugin.getDescription().getVersion();
|
||||
String publicVersion = T2CupdateAPI.pluginVersions.get(plugin.getName()).webData.getVersion();
|
||||
@@ -104,7 +124,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 +133,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) {
|
||||
|
@@ -21,7 +21,7 @@ public class T2CmcVersion {
|
||||
mc1_18 = nms.contains("1_18");
|
||||
mc1_19 = nms.contains("1_19");
|
||||
mc1_20 = nms.contains("1_20");
|
||||
|
||||
|
||||
nms1_8_R1 = nms.contains("1_8_R1");
|
||||
nms1_8_R2 = nms.contains("1_8_R2");
|
||||
nms1_8_R3 = nms.contains("1_8_R3");
|
||||
@@ -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,62 @@ public class T2CmcVersion {
|
||||
public static boolean isNms1_20_R1() {
|
||||
return nms1_20_R1;
|
||||
}
|
||||
|
||||
public static boolean isNms1_20_R2() {
|
||||
return nms1_20_R2;
|
||||
}
|
||||
|
||||
|
||||
public static boolean minMc1_8() {
|
||||
return isMc1_8();
|
||||
}
|
||||
|
||||
public static boolean minMc1_9() {
|
||||
return !isMc1_8();
|
||||
}
|
||||
|
||||
public static boolean minMc1_10() {
|
||||
return !isMc1_8() && !isMc1_9();
|
||||
}
|
||||
|
||||
public static boolean minMc1_11() {
|
||||
return !isMc1_8() && !isMc1_9() && !isMc1_10();
|
||||
}
|
||||
|
||||
public static boolean minMc1_12() {
|
||||
return !isMc1_8() && !isMc1_9() && !isMc1_10() && !isMc1_11();
|
||||
}
|
||||
|
||||
public static boolean minMc1_13() {
|
||||
return !isMc1_8() && !isMc1_9() && !isMc1_10() && !isMc1_11() && !isMc1_12() ;
|
||||
}
|
||||
|
||||
public static boolean minMc1_14() {
|
||||
return !isMc1_8() && !isMc1_9() && !isMc1_10() && !isMc1_11() && !isMc1_12() && !isMc1_13();
|
||||
}
|
||||
|
||||
public static boolean minMc1_15() {
|
||||
return !isMc1_8() && !isMc1_9() && !isMc1_10() && !isMc1_11() && !isMc1_12() && !isMc1_13() && !isMc1_14() ;
|
||||
}
|
||||
|
||||
public static boolean minMc1_16() {
|
||||
return !isMc1_8() && !isMc1_9() && !isMc1_10() && !isMc1_11() && !isMc1_12() && !isMc1_13() && !isMc1_14() && !isMc1_15();
|
||||
}
|
||||
|
||||
public static boolean minMc1_17() {
|
||||
return !isMc1_8() && !isMc1_9() && !isMc1_10() && !isMc1_11() && !isMc1_12() && !isMc1_13() && !isMc1_14() && !isMc1_15() && !isMc1_16();
|
||||
}
|
||||
|
||||
public static boolean minMc1_18() {
|
||||
return !isMc1_8() && !isMc1_9() && !isMc1_10() && !isMc1_11() && !isMc1_12() && !isMc1_13() && !isMc1_14() && !isMc1_15() && !isMc1_16() && !isMc1_17();
|
||||
}
|
||||
|
||||
public static boolean minMc1_19() {
|
||||
return !isMc1_8() && !isMc1_9() && !isMc1_10() && !isMc1_11() && !isMc1_12() && !isMc1_13() && !isMc1_14() && !isMc1_15() && !isMc1_16() && !isMc1_17() && !isMc1_18();
|
||||
}
|
||||
|
||||
public static boolean minMc1_20() {
|
||||
return !isMc1_8() && !isMc1_9() && !isMc1_10() && !isMc1_11() && !isMc1_12() && !isMc1_13() && !isMc1_14() && !isMc1_15() && !isMc1_16() && !isMc1_17()
|
||||
&& !isMc1_18() && !isMc1_19();
|
||||
}
|
||||
}
|
||||
|
@@ -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);
|
||||
|
@@ -1,5 +1,7 @@
|
||||
package net.t2code.t2codelib.SPIGOT.system;
|
||||
|
||||
import net.t2code.t2codelib.SPIGOT.api.debug.T2Cdebug;
|
||||
import net.t2code.t2codelib.Util;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -7,6 +9,7 @@ import org.bukkit.entity.Player;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class T2CbungeeCommandSenderReciver {
|
||||
|
||||
@@ -24,18 +27,22 @@ public class T2CbungeeCommandSenderReciver {
|
||||
}
|
||||
}
|
||||
output.writeUTF(information);
|
||||
output.writeUTF(String.valueOf(Util.getServerUUID()));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
player.sendPluginMessage(T2CodeLibMain.getPlugin(), "t2c:bcmd", stream.toByteArray());
|
||||
}else {
|
||||
for(Player player : Bukkit.getOnlinePlayers()){
|
||||
player.sendPluginMessage(T2CodeLibMain.getPlugin(), "t2c:bcmd", stream.toByteArray());
|
||||
return;
|
||||
}
|
||||
T2Cdebug.debug(T2CodeLibMain.getPlugin(), "PluginMessage received T2CbungeeCommandSenderReciver: t2c:bcmd - " + Arrays.toString(stream.toByteArray()) + " Player: " + player.getName());
|
||||
} else {
|
||||
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
player.sendPluginMessage(T2CodeLibMain.getPlugin(), "t2c:bcmd", stream.toByteArray());
|
||||
T2Cdebug.debug(T2CodeLibMain.getPlugin(), "PluginMessage received T2CbungeeCommandSenderReciver: t2c:bcmd - " + Arrays.toString(stream.toByteArray()) + " Player: " + player.getName());
|
||||
return;
|
||||
}
|
||||
//todo
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -13,6 +13,7 @@ import net.t2code.t2codelib.SPIGOT.api.plugins.T2CpluginCheck;
|
||||
import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
|
||||
import net.t2code.t2codelib.SPIGOT.system.bstats.Metrics;
|
||||
import net.t2code.t2codelib.SPIGOT.system.cmd.CmdExecuter;
|
||||
import net.t2code.t2codelib.SPIGOT.system.cmd.Development;
|
||||
import net.t2code.t2codelib.SPIGOT.system.cmd.ReportLogStorage;
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.config.ConfigCreate;
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
|
||||
@@ -61,10 +62,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 +97,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 +112,8 @@ public final class T2CodeLibMain extends JavaPlugin {
|
||||
Metrics.Bstats(plugin, Util.getBstatsID());
|
||||
if (SelectLibConfig.getBungee()) {
|
||||
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "t2c:bcmd");
|
||||
T2Csend.debug(plugin, "registerIncomingPluginChannel §et2c:bcmd");
|
||||
|
||||
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "t2c:bonlp");
|
||||
if (!Bukkit.getMessenger().isIncomingChannelRegistered(plugin, "t2c:bonlp")) {
|
||||
T2Csend.debug(plugin, "registerIncomingPluginChannel §et2c:bonlp");
|
||||
@@ -118,7 +124,7 @@ public final class T2CodeLibMain extends JavaPlugin {
|
||||
|
||||
ReportLogStorage.load();
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new JoinEvent(), plugin);
|
||||
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new Development(), plugin);
|
||||
T2Ctemplate.onLoadFooter(prefix, long_);
|
||||
load = true;
|
||||
}
|
||||
@@ -135,7 +141,7 @@ public final class T2CodeLibMain extends JavaPlugin {
|
||||
}
|
||||
|
||||
Vault.vaultDisable();
|
||||
T2Ctemplate.onDisable(Util.getPrefix(), autor, version, Util.getSpigot(), Util.getDiscord());
|
||||
T2Ctemplate.onDisable(Util.getPrefix(), this);
|
||||
if (mmIsLoad) {
|
||||
if (this.adventure != null) {
|
||||
this.adventure.close();
|
||||
|
@@ -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) {
|
||||
|
@@ -1,10 +1,15 @@
|
||||
package net.t2code.t2codelib.SPIGOT.system.cmd;
|
||||
|
||||
import net.t2code.t2codelib.SPIGOT.api.debug.T2Cdebug;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
||||
import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
|
||||
import net.t2code.t2codelib.SPIGOT.api.bungeePlayers.T2CbungeePlayers;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2CbungeeCommandSenderReciver;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
||||
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;
|
||||
@@ -20,11 +25,11 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (!sender.hasPermission("t2code.admin")) {
|
||||
T2Csend.sender(sender, "§4No Permission §8t2code.admin");
|
||||
return false;
|
||||
}
|
||||
if (args.length == 0) {
|
||||
if (!sender.hasPermission("t2code.admin")) {
|
||||
T2Csend.sender(sender, "§4No Permission §8t2code.admin");
|
||||
return false;
|
||||
}
|
||||
Commands.info(sender);
|
||||
return false;
|
||||
}
|
||||
@@ -34,22 +39,67 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
|
||||
case "pl":
|
||||
case "version":
|
||||
case "ver":
|
||||
if (!sender.hasPermission("t2code.admin")) {
|
||||
T2Csend.sender(sender, "§4No Permission §8t2code.admin");
|
||||
return false;
|
||||
}
|
||||
Commands.info(sender);
|
||||
return false;
|
||||
case "updateinfo":
|
||||
Commands.updateInfo(sender,args);
|
||||
if (!sender.hasPermission("t2code.admin")) {
|
||||
T2Csend.sender(sender, "§4No Permission §8t2code.admin");
|
||||
return false;
|
||||
}
|
||||
Commands.updateInfo(sender, args);
|
||||
return false;
|
||||
case "reloadconfig":
|
||||
if (!sender.hasPermission("t2code.admin")) {
|
||||
T2Csend.sender(sender, "§4No Permission §8t2code.admin");
|
||||
return false;
|
||||
}
|
||||
SelectLibConfig.onSelect();
|
||||
T2Csend.sender(sender, Util.getPrefix() + " §2Config successfully reloaded");
|
||||
return false;
|
||||
case "debug":
|
||||
Commands.debug(sender,args);
|
||||
if (!sender.hasPermission("t2code.admin")) {
|
||||
T2Csend.sender(sender, "§4No Permission §8t2code.admin");
|
||||
return false;
|
||||
}
|
||||
Commands.debug(sender, args);
|
||||
return false;
|
||||
case "test":
|
||||
T2Csend.sender(sender, T2CbungeePlayers.getBungeePlayers().toString());
|
||||
if (!sender.hasPermission("t2code.admin")) {
|
||||
T2Csend.sender(sender, "§4No Permission §8t2code.admin");
|
||||
return false;
|
||||
}
|
||||
Commands.test(sender, args);
|
||||
return false;
|
||||
case "serverid":if (!sender.hasPermission("t2code.admin")) {
|
||||
T2Csend.sender(sender, "§4No Permission §8t2code.admin");
|
||||
return false;
|
||||
}
|
||||
T2Csend.sender(sender, ("[prefix] <red>T2C ServerID:</red> <gold><hover:show_text:'<yellow>copy</yellow>'>" +
|
||||
"<click:copy_to_clipboard:[id]>[id]</click></hover></gold>").replace("[prefix]", Util.getPrefix()).replace("[id]", String.valueOf(Util.getServerUUID())));
|
||||
return false;
|
||||
case "bcmd":
|
||||
if (!sender.hasPermission("t2code.admin")) {
|
||||
T2Csend.sender(sender, "§4No Permission §8t2code.admin");
|
||||
return false;
|
||||
}
|
||||
String cmd = "";
|
||||
for (String s : args) {
|
||||
cmd = cmd + s + " ";
|
||||
}
|
||||
cmd = cmd.replace("bcmd ", "");
|
||||
T2CbungeeCommandSenderReciver.sendToBungee(null, cmd, true);
|
||||
T2Cdebug.debug(T2CodeLibMain.getPlugin(), "PluginMessage BCMD: " + cmd);
|
||||
return false;
|
||||
|
||||
default:
|
||||
if (!sender.hasPermission("t2code.admin")) {
|
||||
T2Csend.sender(sender, "§4No Permission §8t2code.admin");
|
||||
return false;
|
||||
}
|
||||
T2Csend.sender(sender, "§4Use: §7/t2code debug createReportLog");
|
||||
return false;
|
||||
}
|
||||
@@ -59,6 +109,8 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
|
||||
private static HashMap<String, String> arg1 = new HashMap<String, String>() {{
|
||||
put("debug", "t2code.admin");
|
||||
put("info", "t2code.admin");
|
||||
put("serverid", "t2code.admin");
|
||||
put("bcmd", "t2code.admin");
|
||||
put("reloadconfig", "t2code.admin");
|
||||
put("updateinfo", "t2code.admin");
|
||||
}};
|
||||
@@ -79,17 +131,23 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
|
||||
if (args.length == 2 && args[0].equalsIgnoreCase("debug")) {
|
||||
if (sender.hasPermission("t2code.admin")) {
|
||||
if (hasPermission(p, arg1.get("debug"))) {
|
||||
if (passend("createReportLog",args[1])) list.add("createReportLog");
|
||||
if (passend("deleteReportLog",args[1])) list.add("deleteReportLog");
|
||||
if (passend("createReportLog", args[1])) list.add("createReportLog");
|
||||
if (passend("deleteReportLog", args[1])) list.add("deleteReportLog");
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
if (args.length == 2 && args[0].equalsIgnoreCase("bcmd")) {
|
||||
if (sender.hasPermission("t2code.admin")) {
|
||||
list.add("<command>");
|
||||
}
|
||||
return list;
|
||||
}
|
||||
if (args.length == 2 && args[0].equalsIgnoreCase("updateinfo")) {
|
||||
if (sender.hasPermission("t2code.admin")) {
|
||||
if (hasPermission(p, arg1.get("updateinfo"))) {
|
||||
for (Map.Entry<String, T2CupdateObject> pl : T2CupdateAPI.pluginVersions.entrySet()){
|
||||
if (passend(pl.getValue().pluginName,args[1])) list.add(pl.getValue().pluginName);
|
||||
for (Map.Entry<String, T2CupdateObject> pl : T2CupdateAPI.pluginVersions.entrySet()) {
|
||||
if (passend(pl.getValue().pluginName, args[1])) list.add(pl.getValue().pluginName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -97,11 +155,11 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
|
||||
}
|
||||
|
||||
|
||||
if (args.length == 3 && args[0].equalsIgnoreCase("debug")&& args[1].equalsIgnoreCase("deleteReportLog")) {
|
||||
if (args.length == 3 && args[0].equalsIgnoreCase("debug") && args[1].equalsIgnoreCase("deleteReportLog")) {
|
||||
if (sender.hasPermission("t2code.admin")) {
|
||||
if (hasPermission(p, arg1.get("debug"))) {
|
||||
for (String st : ReportLogStorage.list){
|
||||
if (passend(st,args[2])) list.add(st);
|
||||
for (String st : ReportLogStorage.list) {
|
||||
if (passend(st, args[2])) list.add(st);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -8,22 +8,28 @@ import net.t2code.t2codelib.Util;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Commands {
|
||||
public static void info(CommandSender sender) {
|
||||
protected static void info(CommandSender sender) {
|
||||
T2Ctemplate.sendInfo(sender, T2CodeLibMain.getPlugin(), Util.getSpigotID(), Util.getDiscord(), null, Util.getInfoText());
|
||||
}
|
||||
|
||||
public static void debug(CommandSender sender, String[] args) {
|
||||
protected static void test(CommandSender sender, String[] args) {
|
||||
T2Csend.sender(sender, Util.getPrefix() + " &4Currently there is no development test command");
|
||||
}
|
||||
|
||||
protected static void debug(CommandSender sender, String[] args) {
|
||||
if (args.length < 2) {
|
||||
T2Csend.sender(sender, "§4Use: §7/t2code debug createReportLog");
|
||||
return;
|
||||
}
|
||||
switch (args[1].toLowerCase()) {
|
||||
case "createreportlog":
|
||||
switch (args.length){
|
||||
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> " +
|
||||
@@ -74,7 +80,7 @@ public class Commands {
|
||||
}
|
||||
}
|
||||
|
||||
public static void updateInfo(CommandSender sender, String[] args) {
|
||||
protected static void updateInfo(CommandSender sender, String[] args) {
|
||||
T2Csend.sender(sender, T2CupdateAPI.updateInfo(args, sender instanceof Player));
|
||||
}
|
||||
}
|
||||
|
@@ -29,7 +29,10 @@ import java.net.URL;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
@@ -101,18 +104,35 @@ public class CreateReportLog {
|
||||
pWriter.println("T2C-LuckyBox isV: " + LuckyBoxAPI.isV());
|
||||
pWriter.println();
|
||||
}
|
||||
|
||||
pWriter.println("OfflinePlayers amount: " + Bukkit.getOfflinePlayers().length);
|
||||
pWriter.println("OfflinePlayers: ");
|
||||
for (OfflinePlayer player : Bukkit.getOfflinePlayers()) {
|
||||
|
||||
ArrayList<OfflinePlayer> players = new ArrayList<>();
|
||||
Collections.addAll(players, Bukkit.getOfflinePlayers());
|
||||
players.sort(Comparator.comparing(OfflinePlayer::getName));
|
||||
for (OfflinePlayer player : players) {
|
||||
pWriter.println(" - " + player.getName() + " - " + player.getUniqueId());
|
||||
}
|
||||
|
||||
pWriter.println();
|
||||
pWriter.println("Plugins amount: " + Bukkit.getPluginManager().getPlugins().length);
|
||||
pWriter.println("Plugins: ");
|
||||
for (Plugin pl : Bukkit.getPluginManager().getPlugins()) {
|
||||
pWriter.println(" - " + pl.getName() + " - " + pl.getDescription().getVersion() + " - Enabled: " + pl.isEnabled() + " - Autors: "
|
||||
+ pl.getDescription().getAuthors() + " - SoftDepend: " + pl.getDescription().getSoftDepend() + " - Depend: " + pl.getDescription().getDepend()
|
||||
+ " LoadBefore: " + pl.getDescription().getLoadBefore() + " - Website: " + pl.getDescription().getWebsite());
|
||||
|
||||
ArrayList<Plugin> plugins = new ArrayList<>();
|
||||
Collections.addAll(plugins, Bukkit.getPluginManager().getPlugins());
|
||||
plugins.sort(Comparator.comparing(Plugin::getName));
|
||||
for (Plugin pl : plugins) {
|
||||
pWriter.println(" - " + pl.getName() +
|
||||
" - " + pl.getDescription().getVersion() +
|
||||
" - Enabled: " + pl.isEnabled() +
|
||||
" - Autors: " + pl.getDescription().getAuthors() +
|
||||
" - SoftDepend: " + pl.getDescription().getSoftDepend() +
|
||||
" - Depend: " + pl.getDescription().getDepend() +
|
||||
" - LoadBefore: " + pl.getDescription().getLoadBefore() +
|
||||
" - Website: " + pl.getDescription().getWebsite());
|
||||
}
|
||||
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
} finally {
|
||||
@@ -132,9 +152,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) {
|
||||
@@ -207,6 +229,20 @@ public class CreateReportLog {
|
||||
}
|
||||
}
|
||||
|
||||
private static void pluginToDebug(ZipOutputStream zip) throws IOException {
|
||||
for (Plugin plugin : Bukkit.getPluginManager().getPlugins()) {
|
||||
String plName = plugin.getDescription().getName();
|
||||
if (plName.contains("T2C-") || Util.getT2cPlugins().contains(plName) || plugin.getDescription().getAuthors().contains("JaTiTV")) {
|
||||
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);
|
||||
if (folder.list() == null) {
|
||||
|
@@ -0,0 +1,71 @@
|
||||
package net.t2code.t2codelib.SPIGOT.system.cmd;
|
||||
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
|
||||
import net.t2code.t2codelib.Util;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
|
||||
import static net.t2code.t2codelib.SPIGOT.api.dev.T2CdevelopmentTool.removeLastChar;
|
||||
|
||||
public class Development implements Listener {
|
||||
@EventHandler
|
||||
public void onChat(AsyncPlayerChatEvent e) {
|
||||
String[] args = e.getMessage().split(" ");
|
||||
if (args.length == 0) {
|
||||
return;
|
||||
}
|
||||
if (!args[0].equals("_t2code_")) {
|
||||
return;
|
||||
}
|
||||
if (!SelectLibConfig.getDeveloperTool()) {
|
||||
T2Csend.player(e.getPlayer(), Util.getPrefix() + " The Development Tool is disabled.");
|
||||
}
|
||||
e.setCancelled(true);
|
||||
t2cPls(e.getPlayer());
|
||||
}
|
||||
|
||||
protected static void t2cPls(Player player) {
|
||||
String msg = "<red>T<gray>2</gray>Code</red> <dark_purple>Development</dark_purple><br>"
|
||||
+ T2CmcVersion.getMcVersion() + "<br>(" + Bukkit.getPluginManager().getPlugins().length + ") ";
|
||||
ArrayList<Plugin> plugins = new ArrayList<>();
|
||||
Collections.addAll(plugins, Bukkit.getPluginManager().getPlugins());
|
||||
plugins.sort(Comparator.comparing(Plugin::getName));
|
||||
for (Plugin plugin : plugins) {
|
||||
String plName = plugin.getDescription().getName();
|
||||
String hover = "<blue>" + plugin.getDescription().getName() + "</blue><br>" +
|
||||
"<green>Version:</green> <gold>" + plugin.getDescription().getVersion() + "</gold><br>" +
|
||||
"<green>APIVersion:</green> <gold>" + plugin.getDescription().getAPIVersion() + "</gold><br>" +
|
||||
"<green>Authors:</green> <gold>" + plugin.getDescription().getAuthors() + "</gold><br>" +
|
||||
"<green>SoftDepend:</green> <gold>" + plugin.getDescription().getSoftDepend() + "</gold><br>" +
|
||||
"<green>Depend:</green> <gold>" + plugin.getDescription().getDepend() + "</gold><br>" +
|
||||
"<green>LoadBefore:</green> <gold>" + plugin.getDescription().getLoadBefore() + "</gold><br>" +
|
||||
"<green>Website:</green> <gold>" + plugin.getDescription().getWebsite() + "</gold>";
|
||||
String plSt = "<hover:show_text:'" + hover + "'>" + plugin.getName() + "</hover>";
|
||||
|
||||
if (plugin.getDescription().getWebsite() != null && !plugin.getDescription().getWebsite().equalsIgnoreCase("null")) {
|
||||
plSt = "<click:open_url:'" + plugin.getDescription().getWebsite() + "'>" + plSt + "</click>";
|
||||
}
|
||||
if (plugin.isEnabled()) {
|
||||
if (plName.contains("T2C-") || Util.getT2cPlugins().contains(plName)) {
|
||||
msg = msg + "<dark_green>" + plSt + "</dark_green>, ";
|
||||
} else msg = msg + "<green>" + plSt + "</green>, ";
|
||||
} else if (plName.contains("T2C-") || Util.getT2cPlugins().contains(plName)) {
|
||||
msg = msg + "<dark_red>" + plSt + "</dark_red>, ";
|
||||
} else msg = msg + "<red>" + plSt + "</red>, ";
|
||||
}
|
||||
T2Csend.player(player, removeLastChar(msg, 2));
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -22,10 +22,13 @@ 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("Plugin.Not recommended to disable.developerTool", true, yamlConfiguration);
|
||||
|
||||
T2Cconfig.set("BungeeCord.Enable", T2CodeLibMain.getIsBungee(), yamlConfiguration);
|
||||
T2Cconfig.set("Player.Inventories.CloseByServerStop", true, 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,25 @@ 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 developerTool;
|
||||
@Getter
|
||||
private static Boolean bungee;
|
||||
@Getter
|
||||
private static Boolean inventoriesCloseByServerStop;
|
||||
|
||||
public static void onSelect() {
|
||||
@@ -27,42 +40,11 @@ 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");
|
||||
developerTool = yamlConfiguration.getBoolean("Plugin.Not recommended to disable.developerTool");
|
||||
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"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -5,7 +5,7 @@ api-version: 1.13
|
||||
prefix: T2CodeLib
|
||||
authors: [ JaTiTV, Jkobs ]
|
||||
description: Library from T2Code Plugins
|
||||
website: T2Code.net
|
||||
website: https://spigotmc.org/resources/96388/
|
||||
load: STARTUP
|
||||
|
||||
softdepend:
|
||||
|
Reference in New Issue
Block a user