Compare commits

...

37 Commits

Author SHA1 Message Date
034bf241e5 15.2
Changes:
Commands:
- The command '/t2code serverid' has been added to display the server ID assigned by the T2CodeLib.
- The command '/t2code bcmd <command>' was added to execute a bungee command from a spigot plugin

DebugLog:
- The number of offline players is now displayed in T2CoderLog.txt
- The offline players as well as the plugins in the T2CoderLog.txt are now listed in alphabetical order

- Smaller code changes
2023-06-19 21:17:49 +02:00
b2ebce50ed 15.1 | Stable 1.20 support
Stable 1.20 support
2023-06-19 14:30:37 +02:00
1b8bedc4e6 Merge branch 'development' of https://git.t2code.net/JaTiTV/T2CodeLib into development 2023-06-08 06:57:15 +02:00
4b7d8539ea 15.0
- Update auf Minecraft Version 1.20
- Kyori MiniMessage API Update auf 4.14.0
2023-06-08 06:55:44 +02:00
JaTiTV
bb230fb3ea Merge pull request 'Update pom.xml' (#20) from 14.7 into development
Reviewed-on: #20
2023-05-17 18:53:58 +00:00
b01bf2d84f Update pom.xml 2023-05-17 20:48:09 +02:00
JaTiTV
32fe2ab579 Merge pull request '14.5' (#19) from 14.5 into development
Reviewed-on: #19
2023-05-17 18:44:01 +00:00
c4282817b0 14.6
Bugfix
T2CnameHistory API fix
2023-05-16 19:36:36 +02:00
JaTiTV
e9ee3e690c Merge pull request 'Update T2CnameHistory.java' (#18) from 14.5_FIX into 14.5
Reviewed-on: #18
2023-05-16 17:31:34 +00:00
Jkobs
c9ee80dd38 Update T2CnameHistory.java 2023-05-16 19:08:48 +02:00
JaTiTV
b00b201bce Merge pull request '14.5' (#17) from 14.5 into development
Reviewed-on: #17
2023-05-10 20:38:33 +00:00
709bd16317 [Bungee] Fixed a small performance bug: If the update check interval was set to 0, it could crash the server and cause spam in the console both to the update check server of T2Code. 2023-05-10 21:09:27 +02:00
66dc27483b new UpdateCheck option
Added an option to completely disable the UpdateCheck of all plugins that check via the T2CodeLib
2023-05-10 21:07:36 +02:00
623d6f8c12 14.5
Fixed a small performance bug: If the update check interval was set to 0, it could crash the server and cause spam in the console both to the update check server of T2Code.
2023-05-04 16:26:04 +02:00
b3adbe61e8 Improved Update Information 2023-04-23 14:33:42 +02:00
167b81f0df Improved update information 2023-04-23 13:50:53 +02:00
8bbdd7a818 Update T2Cdebug.java 2023-04-23 13:15:06 +02:00
3aee76ddb8 T2Csend.debug() -> T2Cdebug.debug() / add T2Cdebug.debugCode() 2023-04-23 12:30:56 +02:00
65ff4ee24a 14.4 / kiori update 2023-04-23 12:29:38 +02:00
ede7908721 Update pom.xml 2023-02-28 00:38:44 +01:00
dd4a5de2ab clean code 2023-02-27 23:36:53 +01:00
7243e403e1 change Bungee API
net.md_5.bungee.BungeeCord -> net.md_5.bungee.api.ProxyServer
2023-02-27 23:36:41 +01:00
63d80b9e5e Create T2CitemBuilder.java 2023-02-27 23:35:52 +01:00
74e05ff7c5 Update pom.xml 2023-02-27 23:35:46 +01:00
1708c4bf70 14.3 2023-01-25 13:52:19 +01:00
415e8dc24b Small improvement of the method addItem of the class T2Ceco 2023-01-25 11:58:57 +01:00
c4b5996256 14.3_DEV-1
Fix if Vault was disabled before T2CodeLib was loaded
2023-01-15 20:58:18 +01:00
37db515726 14.2
Changes:
- T2CLibConfig was added to the API to access the T2CodeLib config.yml
- Create ReportLog was slightly rewritten to make it easier to copy the T2CodePlugins into the zip and to improve performance
- added a feedback to the command /t2c reloadconfig
- change plugin info design
2023-01-05 19:27:11 +01:00
JaTiTV
6c412f5360 „.gitea/ISSUE_TEMPLATE/feature_request.md“ ändern 2022-12-31 20:28:25 +00:00
0fcf436dbf change plugin info design 2022-12-31 21:25:07 +01:00
1762afce07 add ISSUE TEMPLATE 2022-12-31 21:24:45 +01:00
9916040c63 bugfix by reloadconfig
'/t2c reloadconfig' did not give any feedback
2022-12-31 02:28:58 +01:00
1b589759fb Merge branch 'main' of https://git.t2code.net/JaTiTV/T2CodeLib 2022-12-29 22:03:32 +01:00
6ee14b4782 14.2 Dev 2022-12-29 22:02:05 +01:00
JaTiTV
2d916c7e0c Merge pull request '14.1' (#15) from 14.1 into main
Reviewed-on: #15
2022-12-29 20:58:13 +00:00
8567e6b3b2 Update pom.xml 2022-12-28 13:43:51 +01:00
b64c1e7c59 14.1 | API changes
- Methods with objects have been added to T2Csend
- Methods with objects have been added to T2Creplace
- Methods with objects have been added to T2Cconfig
2022-12-28 13:42:55 +01:00
36 changed files with 543 additions and 171 deletions

View 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 ##
#######################################
```

View 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):**

View 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
View File

@@ -6,7 +6,10 @@
<groupId>net.t2code</groupId>
<artifactId>T2CodeLib</artifactId>
<version>14.0</version>
<version>15.2</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>

View File

@@ -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());
});
}

View File

@@ -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);
}
}

View File

@@ -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;

View File

@@ -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");

View File

@@ -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();
}

View File

@@ -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;
}
}

View File

@@ -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);
}
}

View File

@@ -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());
});
}

View File

@@ -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());
});
}

View File

@@ -51,7 +51,6 @@ public class T2CbungeePlayers implements PluginMessageListener {
} catch (IOException e) {
e.printStackTrace();
}
}
public static void callAllBungeePlayers() {

View File

@@ -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);
}
}

View File

@@ -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);

View File

@@ -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;
}
}

View File

@@ -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]", "ö")

View File

@@ -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) {

View File

@@ -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) {

View File

@@ -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;
}
}

View File

@@ -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;
}

View File

@@ -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);
}
}

View File

@@ -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;

View File

@@ -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();
}
}

View File

@@ -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);

View File

@@ -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
}
}
}

View File

@@ -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,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");

View File

@@ -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) {

View File

@@ -1,10 +1,14 @@
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.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;
@@ -37,17 +41,31 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
Commands.info(sender);
return false;
case "updateinfo":
Commands.updateInfo(sender,args);
Commands.updateInfo(sender, args);
return false;
case "reloadconfig":
SelectLibConfig.onSelect();
T2Csend.sender(sender, Util.getPrefix() + " §2Config successfully reloaded");
return false;
case "debug":
Commands.debug(sender,args);
Commands.debug(sender, args);
return false;
case "test":
T2Csend.sender(sender, T2CbungeePlayers.getBungeePlayers().toString());
return false;
case "serverid":
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":
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:
T2Csend.sender(sender, "§4Use: §7/t2code debug createReportLog");
@@ -59,6 +77,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 +99,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 +123,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);
}
}
}

View File

@@ -3,6 +3,7 @@ package net.t2code.t2codelib.SPIGOT.system.cmd;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
import net.t2code.t2codelib.SPIGOT.system.T2CbungeeCommandSenderReciver;
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
import net.t2code.t2codelib.Util;
import org.bukkit.Bukkit;

View File

@@ -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,30 @@ 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()) {
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 +147,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 +223,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);

View File

@@ -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);

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -54,7 +54,8 @@ public class Util {
"LoreEditor",
"Booster",
"AntiMapCopy",
"AntiCopy"
"AntiCopy",
"T2C-LoginPermissionAuth"
);
}
}