add BungeePlayers List / Event for Spigot Server
This commit is contained in:
2022-12-24 19:05:18 +01:00
parent eb7fd03650
commit 1b12c2728b
14 changed files with 233 additions and 13 deletions

View File

@@ -8,7 +8,7 @@ import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class BCommandSenderReciver {
public class T2CbungeeCommandSenderReciver {
public static void sendToBungee(CommandSender sender, String information, Boolean console) {
ByteArrayOutputStream stream = new ByteArrayOutputStream();

View File

@@ -4,6 +4,7 @@ import lombok.Getter;
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.bungeePlayers.T2CbungeePlayers;
import net.t2code.t2codelib.SPIGOT.api.items.T2CitemVersion;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
@@ -50,6 +51,7 @@ public final class T2CodeLibMain extends JavaPlugin {
mmIsLoad = false;
}
long long_ = T2Ctemplate.onLoadHeader(Util.getPrefix(), autor, version, Util.getSpigot(), Util.getDiscord());
checkIsBungee();
String prefix = Util.getPrefix();
try {
@@ -106,11 +108,17 @@ public final class T2CodeLibMain extends JavaPlugin {
Metrics.Bstats(plugin, Util.getBstatsID());
if (SelectLibConfig.getBungee()) {
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "t2c:bcmd");
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "t2c:bonlp");
if (!Bukkit.getMessenger().isIncomingChannelRegistered(plugin, "t2c:bonlp")) {
T2Csend.debug(plugin, "registerIncomingPluginChannel §et2c:bonlp");
Bukkit.getMessenger().registerIncomingPluginChannel(plugin, "t2c:bonlp", new T2CbungeePlayers());
T2CbungeePlayers.callAllBungeePlayers();
}
}
ReportLogStorage.load();
Bukkit.getServer().getPluginManager().registerEvents(new JoinEvent(), plugin);
checkIsBungee();
T2Ctemplate.onLoadFooter(prefix, long_);
load = true;
}

View File

@@ -2,6 +2,7 @@ package net.t2code.t2codelib.SPIGOT.system.cmd;
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.T2CupdateObject;
import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
import org.bukkit.command.Command;
@@ -44,6 +45,9 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
case "debug":
Commands.debug(sender,args);
return false;
case "test":
T2Csend.sender(sender, T2CbungeePlayers.getBungeePlayers().toString());
return false;
default:
T2Csend.sender(sender, "§4Use: §7/t2code debug createReportLog");

View File

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

View File

@@ -20,7 +20,7 @@ public class SelectLibConfig {
File config = new File(T2CodeLibMain.getPath(), "config.yml");
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
if (yamlConfiguration.contains("t2cTestDevelopment")){
if (yamlConfiguration.contains("t2cTestDevelopment")) {
t2cTestDevelopment = yamlConfiguration.getBoolean("t2cTestDevelopment");
}