mirror of
https://github.com/YouHaveTrouble/CommandWhitelist.git
synced 2026-05-12 06:26:57 +00:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1bb2c7ea6a | |||
| a935503239 | |||
| 2a6be9829c | |||
| 097b541a1f | |||
| 5f447e07b6 | |||
| b5e12655f9 | |||
| 14f15aa754 | |||
| 017011fad0 |
@@ -1,36 +0,0 @@
|
|||||||
name: Build CommandWhitelist Jar
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout Git repo
|
|
||||||
uses: actions/checkout@v1
|
|
||||||
- name: Restore Maven cache
|
|
||||||
uses: actions/cache@v1
|
|
||||||
with:
|
|
||||||
path: ~/.m2/repository
|
|
||||||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-maven-
|
|
||||||
- name: Set up JDK 1.8
|
|
||||||
uses: actions/setup-java@v1
|
|
||||||
with:
|
|
||||||
java-version: 1.8
|
|
||||||
- name: Build with Maven
|
|
||||||
run: mvn package --file pom.xml
|
|
||||||
- name: Copy artifacts
|
|
||||||
uses: actions/upload-artifact@master
|
|
||||||
with:
|
|
||||||
name: CommandWhitelist
|
|
||||||
path: target/CommandWhitelist*.jar
|
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>eu.endermite.commandwhitelist</groupId>
|
<groupId>eu.endermite.commandwhitelist</groupId>
|
||||||
<artifactId>CommandWhitelist</artifactId>
|
<artifactId>CommandWhitelist</artifactId>
|
||||||
<version>2.0-ALPHA-2</version>
|
<version>2.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>Bukkit</artifactId>
|
<artifactId>Bukkit</artifactId>
|
||||||
|
|||||||
+8
-4
@@ -1,10 +1,7 @@
|
|||||||
package eu.endermite.commandwhitelist.bukkit;
|
package eu.endermite.commandwhitelist.bukkit;
|
||||||
|
|
||||||
import eu.endermite.commandwhitelist.bukkit.command.MainCommandExecutor;
|
import eu.endermite.commandwhitelist.bukkit.command.MainCommandExecutor;
|
||||||
import eu.endermite.commandwhitelist.bukkit.listeners.PacketCommandPreProcessListener;
|
import eu.endermite.commandwhitelist.bukkit.listeners.*;
|
||||||
import eu.endermite.commandwhitelist.bukkit.listeners.PlayerCommandPreProcessListener;
|
|
||||||
import eu.endermite.commandwhitelist.bukkit.listeners.PlayerCommandSendListener;
|
|
||||||
import eu.endermite.commandwhitelist.bukkit.listeners.TabCompleteBlockerListener;
|
|
||||||
import eu.endermite.commandwhitelist.common.CWGroup;
|
import eu.endermite.commandwhitelist.common.CWGroup;
|
||||||
import eu.endermite.commandwhitelist.common.ConfigCache;
|
import eu.endermite.commandwhitelist.common.ConfigCache;
|
||||||
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
||||||
@@ -21,6 +18,7 @@ import org.bukkit.plugin.java.JavaPlugin;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class CommandWhitelistBukkit extends JavaPlugin {
|
public class CommandWhitelistBukkit extends JavaPlugin {
|
||||||
@@ -46,7 +44,13 @@ public class CommandWhitelistBukkit extends JavaPlugin {
|
|||||||
PacketCommandPreProcessListener.protocol(this);
|
PacketCommandPreProcessListener.protocol(this);
|
||||||
getLogger().info(ChatColor.AQUA + "Using ProtocolLib for command filter!");
|
getLogger().info(ChatColor.AQUA + "Using ProtocolLib for command filter!");
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
// Use paper's async tab completions if possible
|
||||||
|
Class.forName("com.destroystokyo.paper.event.server.AsyncTabCompleteEvent");
|
||||||
|
getServer().getPluginManager().registerEvents(new AsyncTabCompleteBlockerListener(), this);
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
getServer().getPluginManager().registerEvents(new TabCompleteBlockerListener(), this);
|
getServer().getPluginManager().registerEvents(new TabCompleteBlockerListener(), this);
|
||||||
|
}
|
||||||
|
|
||||||
PluginCommand command = getCommand("commandwhitelist");
|
PluginCommand command = getCommand("commandwhitelist");
|
||||||
if (command != null) {
|
if (command != null) {
|
||||||
|
|||||||
-1
@@ -26,7 +26,6 @@ public class MainCommandExecutor implements TabExecutor {
|
|||||||
audiences.sender(sender).sendMessage(CWCommand.helpComponent(label, sender.hasPermission(CWPermission.RELOAD.permission()), sender.hasPermission(CWPermission.ADMIN.permission())));
|
audiences.sender(sender).sendMessage(CWCommand.helpComponent(label, sender.hasPermission(CWPermission.RELOAD.permission()), sender.hasPermission(CWPermission.ADMIN.permission())));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
CWCommand.CommandType commandType = CWCommand.CommandType.valueOf(args[0].toUpperCase());
|
CWCommand.CommandType commandType = CWCommand.CommandType.valueOf(args[0].toUpperCase());
|
||||||
switch (commandType) {
|
switch (commandType) {
|
||||||
|
|||||||
+29
@@ -0,0 +1,29 @@
|
|||||||
|
package eu.endermite.commandwhitelist.bukkit.listeners;
|
||||||
|
|
||||||
|
import com.destroystokyo.paper.event.server.AsyncTabCompleteEvent;
|
||||||
|
import eu.endermite.commandwhitelist.bukkit.CommandWhitelistBukkit;
|
||||||
|
import eu.endermite.commandwhitelist.common.CWPermission;
|
||||||
|
import eu.endermite.commandwhitelist.common.CommandUtil;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
|
||||||
|
public class AsyncTabCompleteBlockerListener implements Listener {
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
|
public void onCommandTabComplete(AsyncTabCompleteEvent event) {
|
||||||
|
if (!(event.getSender() instanceof Player)) return;
|
||||||
|
Player player = (Player) event.getSender();
|
||||||
|
if (player.hasPermission(CWPermission.BYPASS.permission())) return;
|
||||||
|
event.setCompletions(
|
||||||
|
CommandUtil.filterSuggestions(
|
||||||
|
event.getBuffer(),
|
||||||
|
event.getCompletions(),
|
||||||
|
CommandWhitelistBukkit.getSuggestions(player)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
event.setHandled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>eu.endermite.commandwhitelist</groupId>
|
<groupId>eu.endermite.commandwhitelist</groupId>
|
||||||
<artifactId>CommandWhitelist</artifactId>
|
<artifactId>CommandWhitelist</artifactId>
|
||||||
<version>2.0-ALPHA-2</version>
|
<version>2.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>Common</artifactId>
|
<artifactId>Common</artifactId>
|
||||||
@@ -59,8 +59,8 @@
|
|||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
<id>jitpack.io</id>
|
<id>pluginwiki-repo</id>
|
||||||
<url>https://jitpack.io</url>
|
<url>https://ci.pluginwiki.us/plugin/repository/everything/</url>
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
<repository>
|
||||||
<id>velocitypowered-repo</id>
|
<id>velocitypowered-repo</id>
|
||||||
@@ -70,9 +70,9 @@
|
|||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.Thatsmusic99</groupId>
|
<groupId>com.github.thatsmusic99</groupId>
|
||||||
<artifactId>ConfigurationMaster</artifactId>
|
<artifactId>ConfigurationMaster-API</artifactId>
|
||||||
<version>v2.0.0-ALPHA-3</version>
|
<version>v2.0.0-BETA-1</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -90,7 +90,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.github.waterfallmc</groupId>
|
<groupId>io.github.waterfallmc</groupId>
|
||||||
<artifactId>waterfall-api</artifactId>
|
<artifactId>waterfall-api</artifactId>
|
||||||
<version>1.16-R0.5-SNAPSHOT</version>
|
<version>1.17-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|||||||
+16
-18
@@ -3,9 +3,7 @@ package eu.endermite.commandwhitelist.common.commands;
|
|||||||
import eu.endermite.commandwhitelist.common.CWGroup;
|
import eu.endermite.commandwhitelist.common.CWGroup;
|
||||||
import eu.endermite.commandwhitelist.common.ConfigCache;
|
import eu.endermite.commandwhitelist.common.ConfigCache;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.event.HoverEvent;
|
|
||||||
import net.kyori.adventure.text.format.NamedTextColor;
|
import net.kyori.adventure.text.format.NamedTextColor;
|
||||||
import net.kyori.adventure.text.format.TextDecoration;
|
|
||||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -16,8 +14,7 @@ public class CWCommand {
|
|||||||
|
|
||||||
public static boolean addToWhitelist(ConfigCache configCache, String command, String group) {
|
public static boolean addToWhitelist(ConfigCache configCache, String command, String group) {
|
||||||
CWGroup cwGroup = configCache.getGroupList().get(group);
|
CWGroup cwGroup = configCache.getGroupList().get(group);
|
||||||
if (cwGroup == null)
|
if (cwGroup == null) return false;
|
||||||
return false;
|
|
||||||
cwGroup.addCommand(command);
|
cwGroup.addCommand(command);
|
||||||
configCache.saveCWGroup(group, cwGroup);
|
configCache.saveCWGroup(group, cwGroup);
|
||||||
return true;
|
return true;
|
||||||
@@ -35,17 +32,16 @@ public class CWCommand {
|
|||||||
public static Component helpComponent(String baseCommand, boolean showReloadCommand, boolean showAdminCommands) {
|
public static Component helpComponent(String baseCommand, boolean showReloadCommand, boolean showAdminCommands) {
|
||||||
Component component = MiniMessage.markdown().parse("<rainbow><bold>CommandWhitelist by YouHaveTrouble")
|
Component component = MiniMessage.markdown().parse("<rainbow><bold>CommandWhitelist by YouHaveTrouble")
|
||||||
.append(Component.newline());
|
.append(Component.newline());
|
||||||
component = component.append(Component.text("Hover over the command to see what it does!").color(NamedTextColor.AQUA)).decoration(TextDecoration.BOLD, false).append(Component.newline());
|
component = component.append(Component.text("/" + baseCommand + " help").color(NamedTextColor.AQUA).append(Component.text(" - Displays this message").color(NamedTextColor.BLUE)));
|
||||||
component = component.append(Component.text("/"+baseCommand+" help").color(NamedTextColor.AQUA).hoverEvent(HoverEvent.showText(Component.text("Displays this message"))));
|
|
||||||
if (showReloadCommand) {
|
if (showReloadCommand) {
|
||||||
component = component.append(Component.newline());
|
component = component.append(Component.newline());
|
||||||
component = component.append(Component.text("/"+baseCommand+" reload").color(NamedTextColor.AQUA).hoverEvent(HoverEvent.showText(Component.text("Reloads plugin configuration"))));
|
component = component.append(Component.text("/" + baseCommand + " reload").color(NamedTextColor.AQUA).append(Component.text(" - Reloads plugin configuration").color(NamedTextColor.BLUE)));
|
||||||
}
|
}
|
||||||
if (showAdminCommands) {
|
if (showAdminCommands) {
|
||||||
component = component.append(Component.newline());
|
component = component.append(Component.newline());
|
||||||
component = component.append(Component.text("/"+baseCommand+" add <group> <command>").color(NamedTextColor.AQUA).hoverEvent(HoverEvent.showText(Component.text("Add a command to selected permission group"))));
|
component = component.append(Component.text("/" + baseCommand + " add <group> <command>").color(NamedTextColor.AQUA).append(Component.text(" - Add a command to selected permission group").color(NamedTextColor.BLUE)));
|
||||||
component = component.append(Component.newline());
|
component = component.append(Component.newline());
|
||||||
component = component.append(Component.text("/"+baseCommand+" remove <group> <command>").color(NamedTextColor.AQUA).hoverEvent(HoverEvent.showText(Component.text("Removes a command from selected permission group"))));
|
component = component.append(Component.text("/" + baseCommand + " remove <group> <command>").color(NamedTextColor.AQUA).append(Component.text(" - Removes a command from selected permission group").color(NamedTextColor.BLUE)));
|
||||||
}
|
}
|
||||||
return component;
|
return component;
|
||||||
}
|
}
|
||||||
@@ -57,6 +53,8 @@ public class CWCommand {
|
|||||||
public static List<String> commandSuggestions(ConfigCache config, Collection<String> serverCommands, String[] args, boolean reloadPerm, boolean adminPerm) {
|
public static List<String> commandSuggestions(ConfigCache config, Collection<String> serverCommands, String[] args, boolean reloadPerm, boolean adminPerm) {
|
||||||
List<String> list = new ArrayList<>();
|
List<String> list = new ArrayList<>();
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
|
default:
|
||||||
|
case 0:
|
||||||
case 1:
|
case 1:
|
||||||
if ("reload".startsWith(args[0]) && reloadPerm)
|
if ("reload".startsWith(args[0]) && reloadPerm)
|
||||||
list.add("reload");
|
list.add("reload");
|
||||||
@@ -77,27 +75,27 @@ public class CWCommand {
|
|||||||
case 3:
|
case 3:
|
||||||
if (args[0].equalsIgnoreCase("remove")) {
|
if (args[0].equalsIgnoreCase("remove")) {
|
||||||
if (!adminPerm) return list;
|
if (!adminPerm) return list;
|
||||||
try {
|
CWGroup group = config.getGroupList().get(args[1]);
|
||||||
for (String s : config.getGroupList().get(args[1]).getCommands()) {
|
if (group == null) return list;
|
||||||
|
for (String s : group.getCommands()) {
|
||||||
if (s.startsWith(args[2]))
|
if (s.startsWith(args[2]))
|
||||||
list.add(s);
|
list.add(s);
|
||||||
}
|
}
|
||||||
} catch (NullPointerException ignored) {
|
|
||||||
}
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
if (args[0].equalsIgnoreCase("add")) {
|
if (args[0].equalsIgnoreCase("add")) {
|
||||||
if (!adminPerm) return list;
|
if (!adminPerm) return list;
|
||||||
|
CWGroup group = config.getGroupList().get(args[1]);
|
||||||
|
if (group == null) return list;
|
||||||
for (String cmd : serverCommands) {
|
for (String cmd : serverCommands) {
|
||||||
if (!cmd.startsWith("/")) continue;
|
if (cmd.startsWith("/"))
|
||||||
|
cmd = cmd.substring(1);
|
||||||
if (cmd.contains(":")) {
|
if (cmd.contains(":")) {
|
||||||
String[] cmdSplit = cmd.split(":");
|
String[] cmdSplit = cmd.split(":");
|
||||||
if (cmdSplit.length < 2) continue;
|
if (cmdSplit.length < 2) continue;
|
||||||
cmd = cmd.split(":")[1];
|
cmd = cmdSplit[1];
|
||||||
}
|
}
|
||||||
cmd = cmd.replace("/", "");
|
if (group.getCommands().contains(cmd)) continue;
|
||||||
if (config.getGroupList().get(args[1]) == null) continue;
|
|
||||||
if (config.getGroupList().get(args[1]).getCommands().contains(cmd)) continue;
|
|
||||||
if (cmd.startsWith(args[2]))
|
if (cmd.startsWith(args[2]))
|
||||||
list.add(cmd);
|
list.add(cmd);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>eu.endermite.commandwhitelist</groupId>
|
<groupId>eu.endermite.commandwhitelist</groupId>
|
||||||
<artifactId>CommandWhitelist</artifactId>
|
<artifactId>CommandWhitelist</artifactId>
|
||||||
<version>2.0-ALPHA-2</version>
|
<version>2.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>Velocity</artifactId>
|
<artifactId>Velocity</artifactId>
|
||||||
@@ -82,7 +82,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.velocitypowered</groupId>
|
<groupId>com.velocitypowered</groupId>
|
||||||
<artifactId>velocity-api</artifactId>
|
<artifactId>velocity-api</artifactId>
|
||||||
<version>1.1.0</version>
|
<version>3.0.0</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
+4
-3
@@ -105,10 +105,11 @@ public class CommandWhitelistVelocity {
|
|||||||
HashMap<String, CWGroup> groups = configCache.getGroupList();
|
HashMap<String, CWGroup> groups = configCache.getGroupList();
|
||||||
HashSet<String> commandList = new HashSet<>();
|
HashSet<String> commandList = new HashSet<>();
|
||||||
for (Map.Entry<String, CWGroup> s : groups.entrySet()) {
|
for (Map.Entry<String, CWGroup> s : groups.entrySet()) {
|
||||||
|
CWGroup group = s.getValue();
|
||||||
if (s.getKey().equalsIgnoreCase("default"))
|
if (s.getKey().equalsIgnoreCase("default"))
|
||||||
commandList.addAll(s.getValue().getCommands());
|
commandList.addAll(group.getCommands());
|
||||||
else if (player.hasPermission(s.getValue().getPermission()))
|
else if (player.hasPermission(group.getPermission()))
|
||||||
commandList.addAll(s.getValue().getCommands());
|
commandList.addAll(group.getCommands());
|
||||||
}
|
}
|
||||||
return commandList;
|
return commandList;
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-12
@@ -42,11 +42,11 @@ public class VelocityMainCommand implements SimpleCommand {
|
|||||||
}
|
}
|
||||||
if (args.length == 3) {
|
if (args.length == 3) {
|
||||||
if (CWCommand.addToWhitelist(CommandWhitelistVelocity.getConfigCache(), args[2], args[1]))
|
if (CWCommand.addToWhitelist(CommandWhitelistVelocity.getConfigCache(), args[2], args[1]))
|
||||||
sender.sendMessage(MiniMessage.markdown().parse(CommandWhitelistVelocity.getConfigCache().prefix + CommandWhitelistVelocity.getConfigCache().added_to_whitelist));
|
sender.sendMessage(MiniMessage.markdown().parse(String.format(CommandWhitelistVelocity.getConfigCache().prefix + CommandWhitelistVelocity.getConfigCache().added_to_whitelist, args[2], args[1])));
|
||||||
else
|
else
|
||||||
sender.sendMessage(MiniMessage.markdown().parse(CommandWhitelistVelocity.getConfigCache().prefix + CommandWhitelistVelocity.getConfigCache().group_doesnt_exist));
|
sender.sendMessage(MiniMessage.markdown().parse(String.format(CommandWhitelistVelocity.getConfigCache().prefix + CommandWhitelistVelocity.getConfigCache().group_doesnt_exist, args[1])));
|
||||||
} else
|
} else
|
||||||
sender.sendMessage(Component.text("/"+label+" add <group> <command>"));
|
sender.sendMessage(Component.text("/" + label + " add <group> <command>"));
|
||||||
return;
|
return;
|
||||||
case REMOVE:
|
case REMOVE:
|
||||||
if (!sender.hasPermission(CWPermission.ADMIN.permission())) {
|
if (!sender.hasPermission(CWPermission.ADMIN.permission())) {
|
||||||
@@ -55,11 +55,11 @@ public class VelocityMainCommand implements SimpleCommand {
|
|||||||
}
|
}
|
||||||
if (args.length == 3) {
|
if (args.length == 3) {
|
||||||
if (CWCommand.removeFromWhitelist(CommandWhitelistVelocity.getConfigCache(), args[2], args[1]))
|
if (CWCommand.removeFromWhitelist(CommandWhitelistVelocity.getConfigCache(), args[2], args[1]))
|
||||||
sender.sendMessage(MiniMessage.markdown().parse(CommandWhitelistVelocity.getConfigCache().prefix + CommandWhitelistVelocity.getConfigCache().removed_from_whitelist));
|
sender.sendMessage(MiniMessage.markdown().parse(String.format(CommandWhitelistVelocity.getConfigCache().prefix + CommandWhitelistVelocity.getConfigCache().removed_from_whitelist, args[2], args[1])));
|
||||||
else
|
else
|
||||||
sender.sendMessage(MiniMessage.markdown().parse(CommandWhitelistVelocity.getConfigCache().prefix + CommandWhitelistVelocity.getConfigCache().group_doesnt_exist));
|
sender.sendMessage(MiniMessage.markdown().parse(String.format(CommandWhitelistVelocity.getConfigCache().prefix + CommandWhitelistVelocity.getConfigCache().group_doesnt_exist, args[1])));
|
||||||
} else
|
} else
|
||||||
sender.sendMessage(Component.text("/"+label+" remove <group> <command>"));
|
sender.sendMessage(Component.text("/" + label + " remove <group> <command>"));
|
||||||
return;
|
return;
|
||||||
case HELP:
|
case HELP:
|
||||||
default:
|
default:
|
||||||
@@ -77,12 +77,8 @@ public class VelocityMainCommand implements SimpleCommand {
|
|||||||
CommandSource source = invocation.source();
|
CommandSource source = invocation.source();
|
||||||
String[] args = invocation.arguments();
|
String[] args = invocation.arguments();
|
||||||
return CompletableFuture.supplyAsync(() -> {
|
return CompletableFuture.supplyAsync(() -> {
|
||||||
List<String> suggestions = new ArrayList<>();
|
List<String> serverCommands = new ArrayList<>();
|
||||||
if (args.length == 1) {
|
return CWCommand.commandSuggestions(CommandWhitelistVelocity.getConfigCache(), serverCommands, args, source.hasPermission(CWPermission.RELOAD.permission()), source.hasPermission(CWPermission.ADMIN.permission()));
|
||||||
if (source.hasPermission(CWPermission.RELOAD.permission()) && "reload".startsWith(args[0]))
|
|
||||||
suggestions.add("reload");
|
|
||||||
}
|
|
||||||
return suggestions;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>eu.endermite.commandwhitelist</groupId>
|
<groupId>eu.endermite.commandwhitelist</groupId>
|
||||||
<artifactId>CommandWhitelist</artifactId>
|
<artifactId>CommandWhitelist</artifactId>
|
||||||
<version>2.0-ALPHA-2</version>
|
<version>2.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>Waterfall</artifactId>
|
<artifactId>Waterfall</artifactId>
|
||||||
@@ -68,10 +68,6 @@
|
|||||||
<id>sonatype</id>
|
<id>sonatype</id>
|
||||||
<url>https://oss.sonatype.org/content/groups/public/</url>
|
<url>https://oss.sonatype.org/content/groups/public/</url>
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
|
||||||
<id>destroystokyo-repo</id>
|
|
||||||
<url>https://repo.destroystokyo.com/repository/maven-public/</url>
|
|
||||||
</repository>
|
|
||||||
<repository>
|
<repository>
|
||||||
<id>papermc</id>
|
<id>papermc</id>
|
||||||
<url>https://papermc.io/repo/repository/maven-public/</url>
|
<url>https://papermc.io/repo/repository/maven-public/</url>
|
||||||
@@ -82,7 +78,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.github.waterfallmc</groupId>
|
<groupId>io.github.waterfallmc</groupId>
|
||||||
<artifactId>waterfall-api</artifactId>
|
<artifactId>waterfall-api</artifactId>
|
||||||
<version>1.16-R0.5-SNAPSHOT</version>
|
<version>1.17-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
+9
-1
@@ -11,6 +11,10 @@ import net.md_5.bungee.api.CommandSender;
|
|||||||
import net.md_5.bungee.api.plugin.Command;
|
import net.md_5.bungee.api.plugin.Command;
|
||||||
import net.md_5.bungee.api.plugin.TabExecutor;
|
import net.md_5.bungee.api.plugin.TabExecutor;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class BungeeMainCommand extends Command implements TabExecutor {
|
public class BungeeMainCommand extends Command implements TabExecutor {
|
||||||
|
|
||||||
public BungeeMainCommand(String name) {
|
public BungeeMainCommand(String name) {
|
||||||
@@ -77,6 +81,10 @@ public class BungeeMainCommand extends Command implements TabExecutor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterable<String> onTabComplete(CommandSender sender, String[] args) {
|
public Iterable<String> onTabComplete(CommandSender sender, String[] args) {
|
||||||
return null;
|
List<String> serverCommands = new ArrayList<>();
|
||||||
|
for (Map.Entry<String, Command> command : CommandWhitelistWaterfall.getPlugin().getProxy().getPluginManager().getCommands()) {
|
||||||
|
serverCommands.add(command.getValue().getName());
|
||||||
|
}
|
||||||
|
return CWCommand.commandSuggestions(CommandWhitelistWaterfall.getConfigCache(), serverCommands, args, sender.hasPermission(CWPermission.RELOAD.permission()),sender.hasPermission(CWPermission.ADMIN.permission()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>eu.endermite.commandwhitelist</groupId>
|
<groupId>eu.endermite.commandwhitelist</groupId>
|
||||||
<artifactId>CommandWhitelist</artifactId>
|
<artifactId>CommandWhitelist</artifactId>
|
||||||
<version>2.0-ALPHA-2</version>
|
<version>2.0</version>
|
||||||
<modules>
|
<modules>
|
||||||
<module>CommandWhitelistCommon</module>
|
<module>CommandWhitelistCommon</module>
|
||||||
<module>CommandWhitelistBukkit</module>
|
<module>CommandWhitelistBukkit</module>
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.kyori</groupId>
|
<groupId>net.kyori</groupId>
|
||||||
<artifactId>adventure-api</artifactId>
|
<artifactId>adventure-api</artifactId>
|
||||||
<version>4.8.0</version>
|
<version>4.8.1</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -10,16 +10,22 @@ precisely what commands players can see and use.
|
|||||||

|

|
||||||
|
|
||||||
<h3>Plugin Features</h3>
|
<h3>Plugin Features</h3>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li>You can lock certain commands behind permission
|
<li>Lock selected commands behind permission
|
||||||
<li>Overwrites default "no such command" message with your branding
|
<li>Overwrite default "no such command" message with your branding
|
||||||
<li>Blocks tab completion on spigot and bungeecord*</li>
|
<li>Block tab completion</li>
|
||||||
<li>Blocks command execution on spigot and bungeecord</li>
|
<li>Block command execution</li>
|
||||||
<li>Blocks completion and execution of specific subcommands (spigot only)</li>
|
<li>Block completion and execution of specified subcommands</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
\*This only works on Waterfall and its forks
|
<b>Compatible versions</b>: 1.13+
|
||||||
|
|
||||||
|
<b>Compatible software</b>:
|
||||||
|
- Bukkit-based servers (Spigot, Paper, Airplane, Purpur, etc)
|
||||||
|
- Waterfall (NOT Bungeecord!)
|
||||||
|
- Velocity
|
||||||
|
|
||||||
|
[Download latest release](https://github.com/YouHaveTrouble/CommandWhitelist/releases/latest)
|
||||||
|
|
||||||
Having some issues? Make sure to check out <a href="https://github.com/YouHaveTrouble/CommandWhitelist/wiki">Plugin Wiki</a>.
|
Having some issues? Make sure to check out <a href="https://github.com/YouHaveTrouble/CommandWhitelist/wiki">Plugin Wiki</a>.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user