Add plugins information

This commit is contained in:
rayzsyt committed 2025-09-05 02:44:04 +02:00
1 parent f43c4f7680
commit dabf1ca089
5 files changed
+61 -14

No files matched your search

@@ -333,6 +333,18 @@ public class BukkitLoader extends JavaPlugin implements PluginLoader {
return new ArrayList<>(allowedCommands);
}
@Override
public List<String> getPluginNames() {
List<String> pluginNames = new ArrayList<>();
for (Plugin plugin : Bukkit.getPluginManager().getPlugins()) {
PluginDescriptionFile description = plugin.getDescription();
pluginNames.add(description.getName() + " (" + description.getVersion() + ")");
}
return pluginNames;
}
private void loadCommandMap() {
try {
if (Bukkit.getPluginManager() instanceof SimplePluginManager) {
@@ -232,6 +232,18 @@ public class BungeeLoader extends Plugin implements PluginLoader {
return new ArrayList<>(ProxyServer.getInstance().getServers().keySet().stream().toList());
}
@Override
public List<String> getPluginNames() {
List<String> pluginNames = new ArrayList<>();
for (Plugin plugin : ProxyServer.getInstance().getPluginManager().getPlugins()) {
PluginDescription description = plugin.getDescription();
pluginNames.add(description.getName() + " (" + description.getVersion() + ")");
}
return pluginNames;
}
public void startUpdaterTask() {
if (!Storage.ConfigSections.Settings.UPDATE.ENABLED)
return;
@@ -38,4 +38,6 @@ public interface PluginLoader {
List<String> getPlayerNames();
List<String> getOnlinePlayerNames();
List<String> getOfflinePlayerNames();
List<String> getPluginNames();
}
@@ -274,6 +274,21 @@ public class VelocityLoader implements PluginLoader {
return new ArrayList<>(server.getAllServers().stream().map(registeredServer -> registeredServer.getServerInfo().getName()).toList());
}
@Override
public List<String> getPluginNames() {
List<String> pluginNames = new ArrayList<>();
for (PluginContainer plugin : server.getPluginManager().getPlugins()) {
PluginDescription description = plugin.getDescription();
String pluginName = description.getName().orElse("/");
String version = description.getVersion().orElse("/");
pluginNames.add(pluginName + " (" + version + ")");
}
return pluginNames;
}
public void startUpdaterTask() {
if (!Storage.ConfigSections.Settings.UPDATE.ENABLED) return;
@@ -87,26 +87,30 @@ public class Logger {
builder.append("Mode: ")
.append(Storage.ConfigSections.Settings.TURN_BLACKLIST_TO_WHITELIST.ENABLED ? "WHITELIST" : "BLACKLIST")
.append("\n\n");
builder.append("Plugins:")
.append("\n");
builder.append(" LuckPerms installed: ")
builder.append("Installed: \n ")
.append(String.join("\n ", Storage.getLoader().getPluginNames()))
.append("\n\n");
builder.append("Detected supported plugins:")
.append("\n");
builder.append(" LuckPerms: ")
.append(Storage.USE_LUCKPERMS)
.append("\n");
builder.append(" PlaceholderAPI installed: ")
builder.append(" PlaceholderAPI: ")
.append(Storage.USE_PLACEHOLDERAPI)
.append("\n");
builder.append(" ViaVersion installed: ")
builder.append(" ViaVersion: ")
.append(Storage.USE_VIAVERSION)
.append("\n");
.append("\n\n");
if (!Reflection.isProxyServer()) {
builder.append("server-name: ")
.append(Storage.SERVER_NAME)
.append(Storage.ConfigSections.Settings.HANDLE_THROUGH_PROXY.ENABLED ? Storage.SERVER_NAME : "Not connected to a proxy using PAT")
.append("\n");
builder.append("last-received-sync: ")
@@ -136,13 +140,15 @@ public class Logger {
builder.append("\n\n");
}
builder.append("server-commands:").append("\n");
if (Reflection.isProxyServer()) {
builder.append("server-commands:").append("\n");
for (Map.Entry<String, GeneralBlacklist> blacklist : Storage.Blacklist.getBlacklists()) {
builder.append(" ")
.append(blacklist.getKey()).append(": ")
.append(String.join(", ", blacklist.getValue().getCommands()))
.append("\n");
for (Map.Entry<String, GeneralBlacklist> blacklist : Storage.Blacklist.getBlacklists()) {
builder.append(" ")
.append(blacklist.getKey()).append(": ")
.append(String.join(", ", blacklist.getValue().getCommands()))
.append("\n");
}
}
builder.append("\ngroups:");