final 13.0 & 13.1
13.1: add by Commands "!asConsole" & "!onBungee"
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -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();
|
||||
|
@@ -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() {
|
||||
|
@@ -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 {
|
||||
|
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user