final 13.0 & 13.1

13.1:
add by Commands "!asConsole" & "!onBungee"
This commit is contained in:
JaTiTV 2022-11-03 07:57:53 +01:00
parent 667ff81357
commit 176e9724e7
24 changed files with 318 additions and 94 deletions

11
pom.xml
View File

@ -6,7 +6,7 @@
<groupId>net.t2code</groupId>
<artifactId>T2CodeLib</artifactId>
<version>13.0-DEVELOPMENT</version>
<version>13.1</version>
<packaging>jar</packaging>
<name>T2CodeLib</name>
@ -86,8 +86,15 @@
<id>BenCodez Repo</id>
<url>https://nexus.bencodez.com/repository/maven-public/</url>
</repository>
<!--Kyori MiniMessage-->
<repository>
<id>sonatype-oss-snapshots1</id>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots/</url>
</repository>
</repositories>
<dependencies>
<!-- Mojang / Spigot-->
<dependency>
@ -138,7 +145,7 @@
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-platform-bukkit</artifactId>
<version>4.1.1</version>
<version>4.1.3-SNAPSHOT</version>
</dependency>
</dependencies>
</project>

View File

@ -1,6 +1,7 @@
package net.t2code.t2codelib.BUNGEE.api.messages;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.plugin.Plugin;
import net.t2code.t2codelib.BUNGEE.api.update.T2CBupdateAPI;
public class T2CBtemplate {
@ -37,7 +38,9 @@ public class T2CBtemplate {
T2CBsend.console(prefix + "§4============================= " + prefix + " §4=============================");
}
public static void sendInfo(CommandSender sender, String prefix, String spigot, String discord, String autor, String pluginVersion, String publicVersion) {
public static void sendInfo(CommandSender sender, Plugin plugin, String prefix, String spigot, String discord, String autor) {
String publicVersion = T2CBupdateAPI.bungeePluginVersins.get(plugin.getDescription().getName()).publicVersion;
String pluginVersion = plugin.getDescription().getVersion();
T2CBsend.sender(sender, prefix + "§4======= " + prefix + " §4=======");
T2CBsend.sender(sender, prefix + " §2Autor: §6" + autor);
if (publicVersion.equalsIgnoreCase(pluginVersion)) {

View File

@ -14,7 +14,7 @@ import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
public class T2CBupdateAPI {
public static HashMap<String, T2CBupdateObject> bungeePluginVersionen = new HashMap<String, T2CBupdateObject>();
public static HashMap<String, T2CBupdateObject> bungeePluginVersins = new HashMap<String, T2CBupdateObject>();
public static void sendUpdateMsg(String Prefix, String Spigot, String Discord, String foundVersion, String update_version) {
T2CBsend.console("§4=========== " + Prefix + " §4===========");
@ -44,7 +44,7 @@ public class T2CBupdateAPI {
pluginVersion,
update_version
);
bungeePluginVersionen.put(plugin.getDescription().getName(), update);
bungeePluginVersins.put(plugin.getDescription().getName(), update);
if (!pluginVersion.replace("_Bungee", "").equalsIgnoreCase(update_version)) {
sendUpdateMsg(Prefix, Spigot, Discord, pluginVersion, update_version);
noUpdate = true;
@ -105,7 +105,7 @@ public class T2CBupdateAPI {
pluginVersion,
"§4No public version found!"
);
bungeePluginVersionen.put(plugin.getDescription().getName(), update);
bungeePluginVersins.put(plugin.getDescription().getName(), update);
this.plugin.getLogger().severe(Prefix + "§4 Cannot look for updates: " + var10.getMessage());
}
});

View File

@ -5,10 +5,15 @@ import net.t2code.t2codelib.BUNGEE.api.messages.T2CBsend;
import net.t2code.t2codelib.BUNGEE.api.update.T2CBupdateAPI;
import net.t2code.t2codelib.BUNGEE.system.bstats.T2CBmetrics;
import net.t2code.t2codelib.BUNGEE.system.config.T2CBlibConfig;
import net.t2code.t2codelib.BUNGEE.system.pluginMessaging.commandgui.T2CapiCGUIEvent;
import net.t2code.t2codelib.BUNGEE.system.pluginMessaging.T2CplmsgBcmd;
import net.t2code.t2codelib.BUNGEE.system.pluginMessaging.autoResponse.T2CapiAutoResponse;
import net.t2code.t2codelib.BUNGEE.system.pluginMessaging.commandgui.T2CapiCGUI;
import net.t2code.t2codelib.BUNGEE.system.pluginMessaging.opSecurity.T2CapiOpSecurity;
import java.io.IOException;
public class T2CBload {
public static void onLoad(Plugin plugin, String prefix, String autor, String version, String spigot, String discord, Integer spigotID,Integer bstatsID){
public static void onLoad(Plugin plugin, String prefix, String autor, String version, String spigot, String discord, Integer spigotID, Integer bstatsID) {
long long_ = System.currentTimeMillis();
T2CBsend.console(prefix + "§4============================= " + prefix + " §4=============================");
T2CBsend.console(prefix + " §2Autor: §6" + String.valueOf(autor).replace("[", "").replace("]", ""));
@ -17,14 +22,35 @@ public class T2CBload {
T2CBsend.console(prefix + " §2Discord: §6" + discord);
T2CBmetrics.Bstats(plugin, bstatsID);
try {
T2CBlibConfig.create();
} catch (IOException e) {
throw new RuntimeException(e);
}
try {
T2CBlibConfig.select();
} catch (IOException e) {
throw new RuntimeException(e);
}
T2CBupdateAPI.onUpdateCheckTimer(plugin, prefix, spigot, discord, spigotID);
//API
if (T2CBlibConfig.getApiCommandGUIEnable()){
plugin.getProxy().getPluginManager().registerListener(plugin, new T2CapiCGUIEvent());
T2CapiCGUIEvent.sendToSpigotDeleteAll();
plugin.getProxy().registerChannel("t2c:bcmd");
plugin.getProxy().getPluginManager().registerListener(plugin, new T2CplmsgBcmd());
if (T2CBlibConfig.getApiCommandGUIEnable()) {
plugin.getProxy().registerChannel("t2c:cgui");
plugin.getProxy().getPluginManager().registerListener(plugin, new T2CapiCGUI());
T2CapiCGUI.sendToSpigotDeleteAll();
}
if (T2CBlibConfig.getApiAutoResponse()) {
plugin.getProxy().registerChannel("t2c:aresp");
plugin.getProxy().getPluginManager().registerListener(plugin, new T2CapiAutoResponse());
}
if (T2CBlibConfig.getApiAutoResponse()) {
plugin.getProxy().registerChannel("t2c:t2c:opsec");
plugin.getProxy().getPluginManager().registerListener(plugin, new T2CapiOpSecurity());
}

View File

@ -4,6 +4,7 @@ import net.md_5.bungee.config.Configuration;
import net.md_5.bungee.config.ConfigurationProvider;
import net.md_5.bungee.config.YamlConfiguration;
import net.t2code.t2codelib.BUNGEE.api.messages.T2CBsend;
import net.t2code.t2codelib.BUNGEE.api.yaml.T2CBconfig;
import net.t2code.t2codelib.BUNGEE.system.T2CodeBMain;
import net.t2code.t2codelib.Util;
@ -20,15 +21,12 @@ public class T2CBlibConfig {
config.createNewFile();
}
Configuration configuration = ConfigurationProvider.getProvider(YamlConfiguration.class).load(config);
configuration.set("API.CommandGUI.Enable", false);
T2CBconfig.set("API.CommandGUI.Enable", false, configuration);
T2CBconfig.set("API.AutoResponse.Enable", false, configuration);
T2CBconfig.set("API.OPSecurity.Enable", false, configuration);
ConfigurationProvider.getProvider(YamlConfiguration.class).save(configuration, config);
T2CBsend.console(Util.getPrefix() + " §2config.yml were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
}
public static void select() throws IOException {
@ -36,13 +34,23 @@ public class T2CBlibConfig {
Configuration configuration = ConfigurationProvider.getProvider(YamlConfiguration.class).load(config);
apiCommandGUIEnable = configuration.getBoolean("API.CommandGUI.Enable");
apiAutoResponse = configuration.getBoolean("API.AutoResponse.Enable");
apiOpSecurity = configuration.getBoolean("API.OPSecurity.Enable");
}
private static Boolean apiCommandGUIEnable;
private static Boolean apiAutoResponse;
private static Boolean apiOpSecurity;
public static Boolean getApiCommandGUIEnable() {
return apiCommandGUIEnable;
}
public static Boolean getApiAutoResponse() {
return apiAutoResponse;
}
public static Boolean getApiOpSecurity() {
return apiOpSecurity;
}
}

View File

@ -0,0 +1,37 @@
package net.t2code.t2codelib.BUNGEE.system.pluginMessaging;
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 java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.IOException;
public class T2CplmsgBcmd implements Listener {
@EventHandler
public void onPluginmessage(PluginMessageEvent event) {
if (event.getTag().equalsIgnoreCase("t2c:bcmd")) {
event.setCancelled(true);
DataInputStream stream = new DataInputStream(new ByteArrayInputStream(event.getData()));
try {
String channel = stream.readUTF();
String input = stream.readUTF();
if (channel.equals("T2Code-Console")) {
ProxyServer.getInstance().getConsole().sendMessage("Command Console: "+ 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().getPluginManager().dispatchCommand(player, input);
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
}

View File

@ -0,0 +1,48 @@
package net.t2code.t2codelib.BUNGEE.system.pluginMessaging.autoResponse;
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.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.IOException;
public class T2CapiAutoResponse implements Listener {
@EventHandler
public void onPluginmessage(PluginMessageEvent event) {
if (event.getTag().equalsIgnoreCase("t2c:aresp")) {
DataInputStream stream = new DataInputStream(new ByteArrayInputStream(event.getData()));
event.setCancelled(true);
try {
String channel = stream.readUTF();
String input = stream.readUTF();
switch (channel) {
case "ConC":
ProxyServer.getInstance().getConsole().sendMessage("Command Console: " + input);
ProxyServer.getInstance().getPluginManager().dispatchCommand(ProxyServer.getInstance().getConsole(), input);
break;
case "ALLPMSG":
for (ProxiedPlayer player : ProxyServer.getInstance().getPlayers()) {
T2CBsend.player(player, input);
}
break;
default:
ProxiedPlayer player = ProxyServer.getInstance().getPlayer(channel);
if (player != null) {
ProxyServer.getInstance().getConsole().sendMessage("Command " + player + ": " + input);
ProxyServer.getInstance().getPluginManager().dispatchCommand(player, input);
}
break;
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
}

View File

@ -1,7 +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;
@ -11,31 +10,7 @@ import net.md_5.bungee.event.EventHandler;
import java.io.*;
import java.util.logging.Logger;
public class T2CapiCGUIEvent implements Listener {
@EventHandler
public void onPluginmessage(net.md_5.bungee.api.event.PluginMessageEvent event) {
if (event.getTag().equalsIgnoreCase("t2c:cgui")) {
event.setCancelled(true);
DataInputStream stream = new DataInputStream(new ByteArrayInputStream(event.getData()));
try {
String channel = stream.readUTF();
String input = stream.readUTF();
if (channel.equals("cgui-Console")) {
ProxyServer.getInstance().getConsole().sendMessage("Command Console: " + 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().getPluginManager().dispatchCommand(player, input);
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
public class T2CapiCGUI implements Listener {
@EventHandler
public void onJoin(PostLoginEvent e) {

View File

@ -0,0 +1,48 @@
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;
public class T2CapiOpSecurity implements Listener {
@EventHandler
public void onPluginmessage(PluginMessageEvent event) {
if (event.getTag().equalsIgnoreCase("t2c:opsec")) {
event.setCancelled(true);
DataInputStream stream = new DataInputStream(new ByteArrayInputStream(event.getData()));
try {
String channel = stream.readUTF();
String mode = stream.readUTF();
String information = stream.readUTF();
if (channel.equals("T2Cconsole")) {
sendToSpigotPlayer(channel,mode,information);
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
private static void sendToSpigotPlayer(String channel,String mode,String information) {
ByteArrayOutputStream stream = new ByteArrayOutputStream();
DataOutputStream output = new DataOutputStream(stream);
try {
output.writeUTF(channel);
output.writeUTF(mode);
output.writeUTF(information);
} catch (IOException e) {
Logger.getLogger(e.getMessage());
}
BungeeCord.getInstance().getServers().values().stream().forEach((server) -> {
server.sendData("t2c:opsec", stream.toByteArray());
});
}
}

View File

@ -1,14 +1,25 @@
package net.t2code.t2codelib.SPIGOT.api.commands;
import net.t2code.t2codelib.SPIGOT.system.BCommandSenderReciver;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
public class T2Ccmd {
public static void console(String cmd) {
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), cmd);
if (cmd.contains("!onBungee")){
BCommandSenderReciver.sendToBungee(null, cmd.replace("!onBungee", ""), true);
}else Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), cmd);
}
public static void player(Player player, String cmd) {
player.chat("/" + cmd);
if (cmd.contains("!asConsole")) {
if (cmd.contains("!onBungee")) {
BCommandSenderReciver.sendToBungee(player, cmd.replace("!asConsole", "").replace("!onBungee", ""), true);
} else console(cmd.replace("!asConsole", ""));
} else {
if (cmd.contains("!onBungee")) {
BCommandSenderReciver.sendToBungee(player, cmd.replace("!onBungee", ""), false);
} else player.chat("/" + cmd);
}
}
}

View File

@ -75,7 +75,6 @@ public class T2Ceco {
public static boolean votePointsRemove(String prefix, Player player, Integer amount) {
if (votePlugin(prefix, player)) {
return VotingPluginMain.getPlugin().getVotingPluginUserManager().getVotingPluginUser(player).removePoints(amount);
} else return false;
}

View File

@ -15,7 +15,7 @@ public class T2CitemVersion {
private static ItemStack RED_WOOL;
private static ItemStack RED_STAINED_GLASS_PANE;
public void scan() {
public static void scan() {
if (T2CmcVersion.isMc1_8() || T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
Head = Material.valueOf("SKULL_ITEM");
YELLOW_WOOL = new ItemStack(Material.valueOf("WOOL"), 1, (short) 4);

View File

@ -3,6 +3,7 @@ package net.t2code.t2codelib.SPIGOT.api.messages;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage;
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

View File

@ -18,12 +18,12 @@ public class T2Ctemplate {
public static Long onLoadHeader(String prefix, List<String> autor, String version, String spigot, String discord, Boolean isPremium, Boolean isVerify) {
Long long_ = System.currentTimeMillis();
T2Csend.console("[prefix] <dark_red> _______ </dark_red><gray>___ </gray><dark_red>_____ </dark_red>");
T2Csend.console("[prefix] <dark_red> |__ __|</dark_red><gray>__ \\ </gray><dark_red>/ ____|</dark_red>");
T2Csend.console("[prefix] <dark_red> | | </dark_red><gray> ) </gray><dark_red>| | </dark_red>");
T2Csend.console("[prefix] <dark_red> | | </dark_red><gray> / /</gray><dark_red>| | </dark_red>");
T2Csend.console("[prefix] <dark_red> | | </dark_red><gray>/ /_</gray><dark_red>| |____ </dark_red>");
T2Csend.console("[prefix] <dark_red> |_| </dark_red><gray>|____|</gray><dark_red>\\_____|</dark_red>");
T2Csend.console(prefix + " <dark_red> _______ </dark_red><gray>___ </gray><dark_red>_____ </dark_red>");
T2Csend.console(prefix + " <dark_red> |__ __|</dark_red><gray>__ \\ </gray><dark_red>/ ____|</dark_red>");
T2Csend.console(prefix + " <dark_red> | | </dark_red><gray> ) </gray><dark_red>| | </dark_red>");
T2Csend.console(prefix + " <dark_red> | | </dark_red><gray> / /</gray><dark_red>| | </dark_red>");
T2Csend.console(prefix + " <dark_red> | | </dark_red><gray>/ /_</gray><dark_red>| |____ </dark_red>");
T2Csend.console(prefix + " <dark_red> |_| </dark_red><gray>|____|</gray><dark_red>\\_____|</dark_red>");
T2Csend.console(prefix + " §4 §e------------------");
T2Csend.console(prefix + " §4 §e| §2Autor: §6" + String.valueOf(autor).replace("[", "").replace("]", ""));
T2Csend.console(prefix + " §4 §e| §2Version: §6" + version);
@ -100,17 +100,17 @@ public class T2Ctemplate {
String stLink = player ? stLinkPlayer : stLinkConsole;
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 ? "<br><dark_red>|</dark_red> " + text + "<br>" : "";
T2Csend.sender(sender, "<dark_red>_____________________</dark_red>"
String stMSG = text == null || text.equals("") ? "" : "<br><dark_red>|</dark_red> " + text + "<br>";
T2Csend.sender(sender, "<dark_red>---------------------</dark_red>"
+ "<br>" + stPlugin
+ stMSG
+ "<br>" + stVersion
+ stVersion
+ "<br>" + stAutor
+ "<br>" + stNVersion
+ "<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

@ -55,6 +55,9 @@ public class T2CpluginCheck {
public static Boolean opSec(){
return Bukkit.getPluginManager().getPlugin("OPSecurity") != null;
}
public static Boolean T2COPSecurity(){
return Bukkit.getPluginManager().getPlugin("T2C-OPSecurity") != null;
}
public static Boolean papiTest(){
return Bukkit.getPluginManager().getPlugin("PaPiTest") != null;
}

View File

@ -70,28 +70,28 @@ public class T2CupdateAPI {
public static void sendUpdateMsg(String prefix, Integer spigot, String discord, Plugin plugin) {
String publicVersion = pluginVersions.get(plugin.getName()).publicVersion;
String pluginVersion = plugin.getDescription().getVersion();
T2Csend.console("§4=========== " + prefix + " §4===========");
String h = "§4=========== " + prefix + " §4===========";
String s1 = "";
String s2 = "§6Your version: §c" + pluginVersion + " §7- §6Current version: §a" + publicVersion;
String s3 = "§6You can download it here: §ehttps://www.spigotmc.org/resources/" + spigot;
String s4 = "§6You can find more information on Discord: §e" + discord;
if (publicVersion.toLowerCase().contains("dev") || publicVersion.toLowerCase().contains("beta") || publicVersion.toLowerCase().contains("snapshot")) {
if (publicVersion.toLowerCase().contains("dev")) {
T2Csend.console("§6A new §4DEV§6 version was found!");
s1 = "§6A new §4DEV§6 version was found!§r";
}
if (publicVersion.toLowerCase().contains("beta")) {
T2Csend.console("§6A new §2BETA§6 version was found!");
s1 = "§6A new §2BETA§6 version was found!§r";
}
if (publicVersion.toLowerCase().contains("snapshot")) {
T2Csend.console("§6A new §eSNAPSHOT§6 version was found!");
s1 = "§6A new §eSNAPSHOT§6 version was found!§r";
}
} else {
T2Csend.console("§6A new version was found!");
s1 = "§6A new version was found!§r";
}
T2Csend.console("§6Your version: §c" + pluginVersion + " §7- §6Current version: §a" + publicVersion);
T2Csend.console("§6You can download it here: §ehttps://www.spigotmc.org/resources/" + spigot);
T2Csend.console("§6You can find more information on Discord: §e" + discord);
T2Csend.console("§4=========== " + prefix + " §4===========");
String text = "<br>" + h + "<br>" + s1 + "<br>" + s2 + "<br>" + s3 + "<br>" + s4 + "<br>" + h;
T2Csend.console(text);
}
private static Boolean load = false;
public static void onUpdateCheck(Plugin plugin, String prefix, int spigotID, String discord) {
new BukkitRunnable() {
@Override
@ -100,21 +100,25 @@ public class T2CupdateAPI {
T2CupdateObject update = new T2CupdateObject(
plugin.getName(),
plugin.getDescription().getVersion(),
update_version
update_version,
false
);
pluginVersions.put(plugin.getName(), update);
if (!plugin.getDescription().getVersion().equalsIgnoreCase(update_version)) {
if (!load) {
if (!update.load) {
new BukkitRunnable() {
@Override
public void run() {
load = true;
update.load = true;
sendUpdateMsg(prefix, spigotID, discord, plugin);
}
}.runTaskLaterAsynchronously(plugin, 600L);
} else sendUpdateMsg(prefix, spigotID, discord, plugin);
} else {
T2Csend.console(prefix + " §2No update found.");
if (!update.load){
T2Csend.console(prefix + " §2No update found.");
update.load = true;
}
}
}, prefix, plugin.getDescription().getVersion());
}

View File

@ -53,10 +53,16 @@ public class T2CupdateChecker {
}
inputStream.close();
} catch (IOException var10) {
Boolean load = false;
if (T2CupdateAPI.pluginVersions.containsKey(plugin.getName())){
load = T2CupdateAPI.pluginVersions.get(plugin.getName()).load;
}
T2CupdateObject update = new T2CupdateObject(
plugin.getName(),
pluginVersion,
null
null,
load
);
T2CupdateAPI.pluginVersions.put(plugin.getName(), update);
this.plugin.getLogger().severe("§4 Cannot look for updates: " + var10.getMessage());

View File

@ -1,16 +1,20 @@
package net.t2code.t2codelib.SPIGOT.api.update;
public class T2CupdateObject {
public String pluginName;
public String pluginVersion;
public String publicVersion;
public Boolean load;
public T2CupdateObject(String pluginName,
String pluginVersion,
String publicVersion ) {
String publicVersion ,
Boolean load) {
this.pluginName = pluginName;
this.pluginVersion = pluginVersion;
this.publicVersion = publicVersion;
this.load=load;
}
}

View File

@ -0,0 +1,41 @@
package net.t2code.t2codelib.SPIGOT.system;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class BCommandSenderReciver {
public static void sendToBungee(CommandSender sender, String information, Boolean console) {
ByteArrayOutputStream stream = new ByteArrayOutputStream();
DataOutputStream output = new DataOutputStream(stream);
try {
if (console) {
output.writeUTF("T2Code-Console");
} else {
if (sender instanceof Player) {
output.writeUTF(sender.getName());
} else {
output.writeUTF("T2Code-Console");
}
}
output.writeUTF(information);
} 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;
}
}
}
}

View File

@ -104,7 +104,7 @@ public class CreateReportLog {
addFileToZip("", "logs/latest.log", zip, false);
for (String pl : Util.getT2cPlugins()){
for (String pl : Util.getT2cPlugins()) {
pluginToDebug(pl, zip);
}
zip.closeEntry();

View File

@ -3,6 +3,7 @@ package net.t2code.t2codelib.SPIGOT.system;
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
import net.milkbowl.vault.economy.Economy;
import net.milkbowl.vault.permission.Permission;
import net.t2code.t2codelib.SPIGOT.api.items.T2CitemVersion;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
@ -38,14 +39,7 @@ public final class T2CodeLibMain extends JavaPlugin {
plugin = this;
autor = plugin.getDescription().getAuthors();
version = plugin.getDescription().getVersion();
// try {
this.adventure = BukkitAudiences.create(this);
// nmIsLoad = true;
// } catch (Exception ex) {
// ex.printStackTrace();
// nmIsLoad = false;
// }
this.adventure = BukkitAudiences.create(this);
long long_ = T2Ctemplate.onLoadHeader(Util.getPrefix(), autor, version, Util.getSpigot(), Util.getDiscord());
String prefix = Util.getPrefix();
@ -56,10 +50,10 @@ public final class T2CodeLibMain extends JavaPlugin {
}
T2CmcVersion.onCheck();
if (T2CmcVersion.isMc1_19()) {
if (T2CmcVersion.isMc1_20()) {
T2Csend.console(prefix + " §4!!!!!!!!!!!!!!!!!!!!");
T2Csend.console(prefix);
T2Csend.warning(plugin, "The 1.19.* 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.* 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!!!!!!!!!!!!!!!!!!!!");
try {
@ -91,12 +85,16 @@ public final class T2CodeLibMain extends JavaPlugin {
plugin.getCommand("t2code").setExecutor(new CmdExecuter());
ConfigCreate.configCreate();
T2CitemVersion.scan();
LanguagesCreate.langCreate();
SelectLibConfig.onSelect();
SelectLibMsg.onSelect();
T2CupdateAPI.onUpdateCheck(plugin, prefix, Util.getSpigotID(), Util.getDiscord());
Metrics.Bstats(plugin, Util.getBstatsID());
if (SelectLibConfig.getBungee()){
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "t2c:bcmd");
}
Bukkit.getServer().getPluginManager().registerEvents(new JoinEvent(), plugin);
T2Ctemplate.onLoadFooter(prefix, long_);
@ -113,15 +111,14 @@ public final class T2CodeLibMain extends JavaPlugin {
}
}
Vault.vaultDisable();
T2Ctemplate.onDisable(Util.getPrefix(), autor, version, Util.getSpigot(), Util.getDiscord());
if (nmIsLoad) {
if (this.adventure != null) {
this.adventure.close();
this.adventure = null;
}
}
Vault.vaultDisable();
T2Ctemplate.onDisable(Util.getPrefix(), autor, version, Util.getSpigot(), Util.getDiscord());
}
public static File getPath() {

View File

@ -27,7 +27,6 @@ public class ConfigCreate {
T2Cconfig.set("Plugin.language", "english", yamlConfiguration);
T2Cconfig.set("BungeeCord.Enable", false, yamlConfiguration);
T2Cconfig.set("BungeeCord.ThisServer", "server", yamlConfiguration);
T2Cconfig.set("Player.Inventories.CloseByServerStop", true, yamlConfiguration);
try {

View File

@ -12,6 +12,7 @@ public class SelectLibConfig {
private static Integer UpdateCheckTimeInterval;
private static Boolean Debug;
private static String language;
private static Boolean bungee;
private static Boolean InventoriesCloseByServerStop;
public static void onSelect() {
@ -23,6 +24,7 @@ public class SelectLibConfig {
UpdateCheckTimeInterval = yamlConfiguration.getInt("Plugin.UpdateCheck.TimeInterval");
Debug = yamlConfiguration.getBoolean("Plugin.Debug");
language = yamlConfiguration.getString("Plugin.language");
bungee = yamlConfiguration.getBoolean("BungeeCord.Enable");
InventoriesCloseByServerStop = yamlConfiguration.getBoolean("Player.Inventories.CloseByServerStop");
}
@ -46,6 +48,10 @@ public class SelectLibConfig {
return language;
}
public static Boolean getBungee() {
return bungee;
}
public static Boolean getInventoriesCloseByServerStop() {
return InventoriesCloseByServerStop;
}

View File

@ -6,7 +6,7 @@ import java.util.List;
public class Util {
public static String getInfoText() {
return "<red>DEVELOPMENT VERSION!</red>";
return "";
}
public static String getPrefix() {
@ -31,12 +31,13 @@ public class Util {
public static List<String> getT2cPlugins() {
return Arrays.asList(
"T2CodeLib",
"T2C-LuckyBox",
"WonderBagShop",
"CommandGUI",
"T2C-OPSecurity",
"OPSecurity",
"PaPiTest",
"PlotSquaredGUI",
"T2C-Alias",
"T2C-AutoResponse",
"LoreEditor",