diff --git a/pom.xml b/pom.xml
index f036002..6aa771c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -168,6 +168,14 @@
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+
+ 8
+
+
\ No newline at end of file
diff --git a/src/main/java/xyz/etztech/qol/QoL.java b/src/main/java/xyz/etztech/qol/QoL.java
index 705ec9e..ae931a6 100644
--- a/src/main/java/xyz/etztech/qol/QoL.java
+++ b/src/main/java/xyz/etztech/qol/QoL.java
@@ -85,19 +85,24 @@ public class QoL extends JavaPlugin {
WorldInfoCommand worldInfoCommand = new WorldInfoCommand(this);
this.getCommand("worldinfo").setExecutor(worldInfoCommand);
+ if (getConfig().getStringList("list").size() > 0) {
+ ListCommand listCommand = new ListCommand(this);
+ this.getCommand("list").setExecutor(listCommand);
+ }
+ if (getConfig().getStringList("plugins").size() > 0) {
+ PluginsCommand pluginsCommand = new PluginsCommand(this);
+ this.getCommand("plugins").setExecutor(pluginsCommand);
+ }
+
// Scheduler
int schedule = config.getInt("schedule.frequency");
if (schedule > 0) {
- Bukkit.getScheduler().scheduleSyncRepeatingTask(QoL.getInstance(), new Runnable() {
-
- @Override
- public void run() {
- List scheduled = config.getStringList("schedule.commands");
- for (String command : scheduled) {
- runTask(command);
- }
+ Bukkit.getScheduler().scheduleSyncRepeatingTask(QoL.getInstance(), () -> {
+ List scheduled = config.getStringList("schedule.commands");
+ for (String command : scheduled) {
+ runTask(command);
}
}, 0, EtzTechUtil.minutesToTicks(schedule));
}
diff --git a/src/main/java/xyz/etztech/qol/commands/ListCommand.java b/src/main/java/xyz/etztech/qol/commands/ListCommand.java
new file mode 100644
index 0000000..9f150c5
--- /dev/null
+++ b/src/main/java/xyz/etztech/qol/commands/ListCommand.java
@@ -0,0 +1,55 @@
+package xyz.etztech.qol.commands;
+
+import org.apache.commons.lang.StringUtils;
+import org.bukkit.Bukkit;
+import org.bukkit.ChatColor;
+import org.bukkit.command.Command;
+import org.bukkit.command.CommandExecutor;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+import xyz.etztech.qol.QoL;
+
+import java.util.*;
+
+public class ListCommand implements CommandExecutor {
+
+ QoL plugin;
+
+ public ListCommand(QoL plugin) {
+ this.plugin = plugin;
+ }
+
+ @Override
+ public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
+
+ Map> list = new HashMap<>();
+ List groups = plugin.getConfig().getStringList("list");
+
+ for (Player player : Bukkit.getServer().getOnlinePlayers()) {
+ for (String group : groups) {
+ if (player.hasPermission("qol.list." + group)) {
+ List names = list.containsKey(group) ? list.get(group) : new ArrayList();
+ names.add(player.getName());
+ list.put(group, names);
+ break;
+ }
+ }
+ }
+ StringBuilder message = new StringBuilder();
+ for (String key : list.keySet()) {
+ List parts = Arrays.asList(key.split("_"));
+ parts.forEach(StringUtils::capitalize);
+ message.append(ChatColor.GOLD)
+ .append(StringUtils.join(parts, " "))
+ .append(": ")
+ .append(ChatColor.YELLOW)
+ .append(StringUtils.join(list.get(key), ", "))
+ .append("\n");
+ }
+
+ commandSender.sendMessage(message.toString());
+
+ return true;
+ }
+}
+
diff --git a/src/main/java/xyz/etztech/qol/commands/PluginsCommand.java b/src/main/java/xyz/etztech/qol/commands/PluginsCommand.java
new file mode 100644
index 0000000..38a4faa
--- /dev/null
+++ b/src/main/java/xyz/etztech/qol/commands/PluginsCommand.java
@@ -0,0 +1,27 @@
+package xyz.etztech.qol.commands;
+
+import org.apache.commons.lang.StringUtils;
+import org.bukkit.ChatColor;
+import org.bukkit.command.Command;
+import org.bukkit.command.CommandExecutor;
+import org.bukkit.command.CommandSender;
+import xyz.etztech.qol.QoL;
+
+public class PluginsCommand implements CommandExecutor {
+
+ QoL plugin;
+
+ public PluginsCommand(QoL plugin) {
+ this.plugin = plugin;
+ }
+
+ @Override
+ public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
+
+ commandSender.sendMessage(ChatColor.GOLD + "Plugins: " + ChatColor.YELLOW +
+ StringUtils.join(plugin.getConfig().getStringList("plugins"), ", "));
+
+ return true;
+ }
+}
+
diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml
index 7f69269..3e19f32 100644
--- a/src/main/resources/config.yml
+++ b/src/main/resources/config.yml
@@ -8,6 +8,22 @@ makeme:
# Can either be PermissionsEX or LuckPerms
engine: 'LuckPerms'
+# Each item in the following list will be used to split players in /list
+# Give the group the permission qol.list.-
+# Group names will be generated by title-case and replacing underscores with spaces
+# e.g. senior_staff -> Senior Staff (qol.list.senior_staff)
+# Make sure the items are ordered from most to least important
+# Leave blank to disable
+list:
+# - admin
+# - mod
+# - member
+
+# A list of plugins to show, overriding the Vanilla /pl
+# Leave blank to disable
+plugins:
+# - QoL
+
# A list of commands to send to Discord if anyone uses them
audit:
enabled: true
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
index e438e4d..14289ac 100644
--- a/src/main/resources/plugin.yml
+++ b/src/main/resources/plugin.yml
@@ -10,6 +10,12 @@ commands:
colors:
description: See all color/formatting codes
aliases: [color, c]
+ list:
+ description: See a list of players
+ aliases: [players, playerlist]
+ plugins:
+ description: See a list of plugins
+ aliases: [pl]
history:
description: Name History utility command
aliases: [names, name]