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
This commit is contained in:
parent
b2ebce50ed
commit
034bf241e5
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>net.t2code</groupId>
|
<groupId>net.t2code</groupId>
|
||||||
<artifactId>T2CodeLib</artifactId>
|
<artifactId>T2CodeLib</artifactId>
|
||||||
<version>15.1</version>
|
<version>15.2</version>
|
||||||
<!--version>VERSION_snapshot-0</version-->
|
<!--version>VERSION_snapshot-0</version-->
|
||||||
<!--version>VERSION_beta-0</version-->
|
<!--version>VERSION_beta-0</version-->
|
||||||
<!--version>VERSION_dev-0</version-->
|
<!--version>VERSION_dev-0</version-->
|
||||||
|
@ -5,7 +5,6 @@ import net.md_5.bungee.api.ProxyServer;
|
|||||||
import net.md_5.bungee.api.plugin.Plugin;
|
import net.md_5.bungee.api.plugin.Plugin;
|
||||||
import net.t2code.t2codelib.BUNGEE.api.messages.T2CBsend;
|
import net.t2code.t2codelib.BUNGEE.api.messages.T2CBsend;
|
||||||
import net.t2code.t2codelib.BUNGEE.system.config.T2CBlibConfig;
|
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.T2CupdateObject;
|
||||||
import net.t2code.t2codelib.T2CupdateWebData;
|
import net.t2code.t2codelib.T2CupdateWebData;
|
||||||
import net.t2code.t2codelib.UpdateType;
|
import net.t2code.t2codelib.UpdateType;
|
||||||
|
@ -34,7 +34,7 @@ public class T2CBload {
|
|||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
T2CBupdateAPI.onUpdateCheckTimer(plugin, prefix, discord, spigotID,url);
|
T2CBupdateAPI.onUpdateCheckTimer(plugin, prefix, discord, spigotID, url);
|
||||||
|
|
||||||
//API
|
//API
|
||||||
plugin.getProxy().registerChannel("t2c:bcmd");
|
plugin.getProxy().registerChannel("t2c:bcmd");
|
||||||
|
@ -43,8 +43,6 @@ public class T2CodeBMain extends Plugin {
|
|||||||
mmIsLoad = false;
|
mmIsLoad = false;
|
||||||
}
|
}
|
||||||
T2CBload.onLoad(plugin, Util.getPrefix(), autor, orgVersion, Util.getSpigot(), Util.getDiscord(), Util.getSpigotID(), Util.getBstatsID(),Util.getGit());
|
T2CBload.onLoad(plugin, Util.getPrefix(), autor, orgVersion, Util.getSpigot(), Util.getDiscord(), Util.getSpigotID(), Util.getBstatsID(),Util.getGit());
|
||||||
String[] fv = orgVersion.split("_");
|
|
||||||
plugin.getDescription().setVersion(fv[0]);
|
|
||||||
version = plugin.getDescription().getVersion();
|
version = plugin.getDescription().getVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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.event.PluginMessageEvent;
|
||||||
import net.md_5.bungee.api.plugin.Listener;
|
import net.md_5.bungee.api.plugin.Listener;
|
||||||
import net.md_5.bungee.event.EventHandler;
|
import net.md_5.bungee.event.EventHandler;
|
||||||
|
import net.t2code.t2codelib.Util;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
@ -19,13 +20,14 @@ public class T2CplmsgBcmd implements Listener {
|
|||||||
try {
|
try {
|
||||||
String channel = stream.readUTF();
|
String channel = stream.readUTF();
|
||||||
String input = stream.readUTF();
|
String input = stream.readUTF();
|
||||||
|
String serverID = stream.readUTF();
|
||||||
if (channel.equals("T2Code-Console")) {
|
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);
|
ProxyServer.getInstance().getPluginManager().dispatchCommand(ProxyServer.getInstance().getConsole(), input);
|
||||||
} else {
|
} else {
|
||||||
ProxiedPlayer player = ProxyServer.getInstance().getPlayer(channel);
|
ProxiedPlayer player = ProxyServer.getInstance().getPlayer(channel);
|
||||||
if (player != null) {
|
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);
|
ProxyServer.getInstance().getPluginManager().dispatchCommand(player, input);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package net.t2code.t2codelib.SPIGOT.system;
|
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.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -7,6 +9,7 @@ import org.bukkit.entity.Player;
|
|||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
public class T2CbungeeCommandSenderReciver {
|
public class T2CbungeeCommandSenderReciver {
|
||||||
|
|
||||||
@ -24,18 +27,22 @@ public class T2CbungeeCommandSenderReciver {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
output.writeUTF(information);
|
output.writeUTF(information);
|
||||||
|
output.writeUTF(String.valueOf(Util.getServerUUID()));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
player.sendPluginMessage(T2CodeLibMain.getPlugin(), "t2c:bcmd", stream.toByteArray());
|
player.sendPluginMessage(T2CodeLibMain.getPlugin(), "t2c:bcmd", stream.toByteArray());
|
||||||
}else {
|
T2Cdebug.debug(T2CodeLibMain.getPlugin(), "PluginMessage received T2CbungeeCommandSenderReciver: t2c:bcmd - " + Arrays.toString(stream.toByteArray()) + " Player: " + player.getName());
|
||||||
for(Player player : Bukkit.getOnlinePlayers()){
|
} else {
|
||||||
player.sendPluginMessage(T2CodeLibMain.getPlugin(), "t2c:bcmd", stream.toByteArray());
|
|
||||||
return;
|
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -111,6 +111,7 @@ public final class T2CodeLibMain extends JavaPlugin {
|
|||||||
Metrics.Bstats(plugin, Util.getBstatsID());
|
Metrics.Bstats(plugin, Util.getBstatsID());
|
||||||
if (SelectLibConfig.getBungee()) {
|
if (SelectLibConfig.getBungee()) {
|
||||||
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "t2c:bcmd");
|
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "t2c:bcmd");
|
||||||
|
T2Csend.debug(plugin, "registerIncomingPluginChannel §et2c:bcmd");
|
||||||
|
|
||||||
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "t2c:bonlp");
|
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "t2c:bonlp");
|
||||||
if (!Bukkit.getMessenger().isIncomingChannelRegistered(plugin, "t2c:bonlp")) {
|
if (!Bukkit.getMessenger().isIncomingChannelRegistered(plugin, "t2c:bonlp")) {
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
package net.t2code.t2codelib.SPIGOT.system.cmd;
|
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.messages.T2Csend;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
|
import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.bungeePlayers.T2CbungeePlayers;
|
import net.t2code.t2codelib.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.T2CupdateObject;
|
||||||
import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
|
import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
|
||||||
import net.t2code.t2codelib.Util;
|
import net.t2code.t2codelib.Util;
|
||||||
@ -38,18 +41,31 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
|
|||||||
Commands.info(sender);
|
Commands.info(sender);
|
||||||
return false;
|
return false;
|
||||||
case "updateinfo":
|
case "updateinfo":
|
||||||
Commands.updateInfo(sender,args);
|
Commands.updateInfo(sender, args);
|
||||||
return false;
|
return false;
|
||||||
case "reloadconfig":
|
case "reloadconfig":
|
||||||
SelectLibConfig.onSelect();
|
SelectLibConfig.onSelect();
|
||||||
T2Csend.sender(sender, Util.getPrefix() + " §2Config successfully reloaded");
|
T2Csend.sender(sender, Util.getPrefix() + " §2Config successfully reloaded");
|
||||||
return false;
|
return false;
|
||||||
case "debug":
|
case "debug":
|
||||||
Commands.debug(sender,args);
|
Commands.debug(sender, args);
|
||||||
return false;
|
return false;
|
||||||
case "test":
|
case "test":
|
||||||
T2Csend.sender(sender, T2CbungeePlayers.getBungeePlayers().toString());
|
T2Csend.sender(sender, T2CbungeePlayers.getBungeePlayers().toString());
|
||||||
return false;
|
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:
|
default:
|
||||||
T2Csend.sender(sender, "§4Use: §7/t2code debug createReportLog");
|
T2Csend.sender(sender, "§4Use: §7/t2code debug createReportLog");
|
||||||
@ -61,6 +77,8 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
|
|||||||
private static HashMap<String, String> arg1 = new HashMap<String, String>() {{
|
private static HashMap<String, String> arg1 = new HashMap<String, String>() {{
|
||||||
put("debug", "t2code.admin");
|
put("debug", "t2code.admin");
|
||||||
put("info", "t2code.admin");
|
put("info", "t2code.admin");
|
||||||
|
put("serverid", "t2code.admin");
|
||||||
|
put("bcmd", "t2code.admin");
|
||||||
put("reloadconfig", "t2code.admin");
|
put("reloadconfig", "t2code.admin");
|
||||||
put("updateinfo", "t2code.admin");
|
put("updateinfo", "t2code.admin");
|
||||||
}};
|
}};
|
||||||
@ -81,17 +99,23 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
|
|||||||
if (args.length == 2 && args[0].equalsIgnoreCase("debug")) {
|
if (args.length == 2 && args[0].equalsIgnoreCase("debug")) {
|
||||||
if (sender.hasPermission("t2code.admin")) {
|
if (sender.hasPermission("t2code.admin")) {
|
||||||
if (hasPermission(p, arg1.get("debug"))) {
|
if (hasPermission(p, arg1.get("debug"))) {
|
||||||
if (passend("createReportLog",args[1])) list.add("createReportLog");
|
if (passend("createReportLog", args[1])) list.add("createReportLog");
|
||||||
if (passend("deleteReportLog",args[1])) list.add("deleteReportLog");
|
if (passend("deleteReportLog", args[1])) list.add("deleteReportLog");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return list;
|
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 (args.length == 2 && args[0].equalsIgnoreCase("updateinfo")) {
|
||||||
if (sender.hasPermission("t2code.admin")) {
|
if (sender.hasPermission("t2code.admin")) {
|
||||||
if (hasPermission(p, arg1.get("updateinfo"))) {
|
if (hasPermission(p, arg1.get("updateinfo"))) {
|
||||||
for (Map.Entry<String, T2CupdateObject> pl : T2CupdateAPI.pluginVersions.entrySet()){
|
for (Map.Entry<String, T2CupdateObject> pl : T2CupdateAPI.pluginVersions.entrySet()) {
|
||||||
if (passend(pl.getValue().pluginName,args[1])) list.add(pl.getValue().pluginName);
|
if (passend(pl.getValue().pluginName, args[1])) list.add(pl.getValue().pluginName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -99,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 (sender.hasPermission("t2code.admin")) {
|
||||||
if (hasPermission(p, arg1.get("debug"))) {
|
if (hasPermission(p, arg1.get("debug"))) {
|
||||||
for (String st : ReportLogStorage.list){
|
for (String st : ReportLogStorage.list) {
|
||||||
if (passend(st,args[2])) list.add(st);
|
if (passend(st, args[2])) list.add(st);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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.T2Csend;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
|
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.SPIGOT.system.T2CodeLibMain;
|
||||||
import net.t2code.t2codelib.Util;
|
import net.t2code.t2codelib.Util;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
@ -29,7 +29,10 @@ import java.net.URL;
|
|||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
import java.util.zip.ZipOutputStream;
|
import java.util.zip.ZipOutputStream;
|
||||||
|
|
||||||
@ -101,18 +104,30 @@ public class CreateReportLog {
|
|||||||
pWriter.println("T2C-LuckyBox isV: " + LuckyBoxAPI.isV());
|
pWriter.println("T2C-LuckyBox isV: " + LuckyBoxAPI.isV());
|
||||||
pWriter.println();
|
pWriter.println();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pWriter.println("OfflinePlayers amount: " + Bukkit.getOfflinePlayers().length);
|
||||||
pWriter.println("OfflinePlayers: ");
|
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(" - " + player.getName() + " - " + player.getUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
pWriter.println();
|
pWriter.println();
|
||||||
pWriter.println("Plugins amount: " + Bukkit.getPluginManager().getPlugins().length);
|
pWriter.println("Plugins amount: " + Bukkit.getPluginManager().getPlugins().length);
|
||||||
pWriter.println("Plugins: ");
|
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: "
|
pWriter.println(" - " + pl.getName() + " - " + pl.getDescription().getVersion() + " - Enabled: " + pl.isEnabled() + " - Autors: "
|
||||||
+ pl.getDescription().getAuthors() + " - SoftDepend: " + pl.getDescription().getSoftDepend() + " - Depend: " + pl.getDescription().getDepend()
|
+ pl.getDescription().getAuthors() + " - SoftDepend: " + pl.getDescription().getSoftDepend() + " - Depend: " + pl.getDescription().getDepend()
|
||||||
+ " LoadBefore: " + pl.getDescription().getLoadBefore() + " - Website: " + pl.getDescription().getWebsite());
|
+ " LoadBefore: " + pl.getDescription().getLoadBefore() + " - Website: " + pl.getDescription().getWebsite());
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
ioe.printStackTrace();
|
ioe.printStackTrace();
|
||||||
} finally {
|
} finally {
|
||||||
|
Loading…
Reference in New Issue
Block a user