mirror of
https://github.com/PaperMC/Waterfall.git
synced 2024-11-18 16:25:14 +01:00
98 lines
4.4 KiB
Diff
98 lines
4.4 KiB
Diff
From f37bca815bffe22461c5b2760596ef18d56a1070 Mon Sep 17 00:00:00 2001
|
|
From: LinsaFTW <25271111+linsaftw@users.noreply.github.com>
|
|
Date: Wed, 11 Jan 2023 10:14:12 -0300
|
|
Subject: [PATCH] Bungee Plugins Command
|
|
|
|
|
|
diff --git a/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/MessagesConfiguration.java b/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/MessagesConfiguration.java
|
|
index 6175d8e2d..2ea33a94b 100644
|
|
--- a/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/MessagesConfiguration.java
|
|
+++ b/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/MessagesConfiguration.java
|
|
@@ -96,6 +96,11 @@ public class MessagesConfiguration extends FlameConfig {
|
|
setIfUnexistant("flamecord_firewall_remove", "&cThe ip {0} was removed from the firewall!", configuration);
|
|
// FlameCord end - Antibot System
|
|
|
|
+ // FlameCord - Bungee Plugins Command
|
|
+ setIfUnexistant("flamecord_bplugins_nopermission", "&cYou don't have permission to do this!", configuration);
|
|
+ setIfUnexistant("flamecord_bplugins_separator", ", ", configuration);
|
|
+ setIfUnexistant("flamecord_bplugins_header", "&aPlugins ({0}): ", configuration);
|
|
+
|
|
for (final String key : configuration.getKeys()) {
|
|
final Object value = configuration.get(key);
|
|
|
|
diff --git a/proxy/src/main/java/dev/_2lstudios/flamecord/commands/BungeePluginsCommand.java b/proxy/src/main/java/dev/_2lstudios/flamecord/commands/BungeePluginsCommand.java
|
|
new file mode 100644
|
|
index 000000000..2e20e9dca
|
|
--- /dev/null
|
|
+++ b/proxy/src/main/java/dev/_2lstudios/flamecord/commands/BungeePluginsCommand.java
|
|
@@ -0,0 +1,45 @@
|
|
+package dev._2lstudios.flamecord.commands;
|
|
+
|
|
+import java.util.Collection;
|
|
+
|
|
+import dev._2lstudios.flamecord.FlameCord;
|
|
+import dev._2lstudios.flamecord.configuration.MessagesConfiguration;
|
|
+import net.md_5.bungee.BungeeCord;
|
|
+import net.md_5.bungee.api.CommandSender;
|
|
+import net.md_5.bungee.api.chat.TextComponent;
|
|
+import net.md_5.bungee.api.plugin.Command;
|
|
+import net.md_5.bungee.api.plugin.Plugin;
|
|
+
|
|
+public class BungeePluginsCommand extends Command {
|
|
+ public BungeePluginsCommand() {
|
|
+ super("bplugins");
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void execute(final CommandSender sender, final String[] args) {
|
|
+ final FlameCord flameCord = FlameCord.getInstance();
|
|
+ final MessagesConfiguration messagesConfiguration = flameCord.getMessagesConfiguration();
|
|
+
|
|
+ if (sender.hasPermission("flamecord.usage")) {
|
|
+ Collection<Plugin> plugins = BungeeCord.getInstance().getPluginManager().getPlugins();
|
|
+ int amount = plugins.size();
|
|
+ String header = FlameCord.getInstance().getMessagesConfiguration().getTranslation("flamecord_bplugins_header", amount);
|
|
+ String separator = FlameCord.getInstance().getMessagesConfiguration().getTranslation("flamecord_bplugins_separator");
|
|
+ StringBuilder stringBuilder = new StringBuilder(header);
|
|
+ boolean first = true;
|
|
+
|
|
+ for (Plugin plugin : plugins) {
|
|
+ stringBuilder.append((first ? "" : separator) + plugin.getDescription().getName());
|
|
+
|
|
+ if (first) {
|
|
+ first = false;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ sender.sendMessage(TextComponent.fromLegacyText(stringBuilder.toString()));
|
|
+ } else {
|
|
+ sender.sendMessage(TextComponent
|
|
+ .fromLegacyText(messagesConfiguration.getTranslation("flamecord_bplugins_nopermission")));
|
|
+ }
|
|
+ }
|
|
+}
|
|
diff --git a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java
|
|
index 62712330e..ec5fd4af2 100644
|
|
--- a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java
|
|
+++ b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java
|
|
@@ -11,6 +11,7 @@ import com.google.gson.Gson;
|
|
import com.google.gson.GsonBuilder;
|
|
|
|
import dev._2lstudios.flamecord.FlameCord;
|
|
+import dev._2lstudios.flamecord.commands.BungeePluginsCommand;
|
|
import dev._2lstudios.flamecord.commands.FlameCordCommand;
|
|
import dev._2lstudios.flamecord.configuration.ModulesConfiguration;
|
|
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
|
@@ -912,5 +913,8 @@ public class BungeeCord extends ProxyServer
|
|
|
|
// Flamecord Command
|
|
pluginManager.registerCommand(null, new FlameCordCommand(this));
|
|
+
|
|
+ // FlameCord - Bungee Plugins Command
|
|
+ pluginManager.registerCommand(null, new BungeePluginsCommand());
|
|
}
|
|
}
|
|
--
|
|
2.37.3.windows.1
|
|
|