From 6ee14b4782b21455138370fc72caa83c72258feb Mon Sep 17 00:00:00 2001 From: JaTiTV Date: Thu, 29 Dec 2022 22:02:05 +0100 Subject: [PATCH] 14.2 Dev --- pom.xml | 2 +- .../SPIGOT/api/yaml/T2CLibConfig.java | 37 ++++++++++++++++ .../SPIGOT/system/T2CodeLibMain.java | 1 + .../SPIGOT/system/cmd/CreateReportLog.java | 21 ++++++++-- .../system/config/config/SelectLibConfig.java | 42 ++++--------------- src/main/java/net/t2code/t2codelib/Util.java | 3 +- 6 files changed, 68 insertions(+), 38 deletions(-) create mode 100644 src/main/java/net/t2code/t2codelib/SPIGOT/api/yaml/T2CLibConfig.java diff --git a/pom.xml b/pom.xml index 4ff1bfc..6ac70e7 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ net.t2code T2CodeLib - 14.0 + 14.2_DEV-1 jar T2CodeLib diff --git a/src/main/java/net/t2code/t2codelib/SPIGOT/api/yaml/T2CLibConfig.java b/src/main/java/net/t2code/t2codelib/SPIGOT/api/yaml/T2CLibConfig.java new file mode 100644 index 0000000..b442556 --- /dev/null +++ b/src/main/java/net/t2code/t2codelib/SPIGOT/api/yaml/T2CLibConfig.java @@ -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(); + } +} diff --git a/src/main/java/net/t2code/t2codelib/SPIGOT/system/T2CodeLibMain.java b/src/main/java/net/t2code/t2codelib/SPIGOT/system/T2CodeLibMain.java index 50b494f..a3c2b09 100644 --- a/src/main/java/net/t2code/t2codelib/SPIGOT/system/T2CodeLibMain.java +++ b/src/main/java/net/t2code/t2codelib/SPIGOT/system/T2CodeLibMain.java @@ -108,6 +108,7 @@ 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"); diff --git a/src/main/java/net/t2code/t2codelib/SPIGOT/system/cmd/CreateReportLog.java b/src/main/java/net/t2code/t2codelib/SPIGOT/system/cmd/CreateReportLog.java index acc1203..58a65d9 100644 --- a/src/main/java/net/t2code/t2codelib/SPIGOT/system/cmd/CreateReportLog.java +++ b/src/main/java/net/t2code/t2codelib/SPIGOT/system/cmd/CreateReportLog.java @@ -132,9 +132,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 +208,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); diff --git a/src/main/java/net/t2code/t2codelib/SPIGOT/system/config/config/SelectLibConfig.java b/src/main/java/net/t2code/t2codelib/SPIGOT/system/config/config/SelectLibConfig.java index a78fa7d..9da1842 100644 --- a/src/main/java/net/t2code/t2codelib/SPIGOT/system/config/config/SelectLibConfig.java +++ b/src/main/java/net/t2code/t2codelib/SPIGOT/system/config/config/SelectLibConfig.java @@ -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,21 @@ 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 debug; + @Getter private static String language; + @Getter private static Boolean bungee; + @Getter private static Boolean inventoriesCloseByServerStop; public static void onSelect() { @@ -32,37 +41,4 @@ public class SelectLibConfig { 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; - } - } diff --git a/src/main/java/net/t2code/t2codelib/Util.java b/src/main/java/net/t2code/t2codelib/Util.java index 1b992cf..cb584f2 100644 --- a/src/main/java/net/t2code/t2codelib/Util.java +++ b/src/main/java/net/t2code/t2codelib/Util.java @@ -54,7 +54,8 @@ public class Util { "LoreEditor", "Booster", "AntiMapCopy", - "AntiCopy" + "AntiCopy", + "T2C-LoginPermissionAuth" ); } }