Compare commits

..

6 Commits

11 changed files with 48 additions and 82 deletions
-36
View File
@@ -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
+1 -1
View File
@@ -6,7 +6,7 @@
<parent>
<groupId>eu.endermite.commandwhitelist</groupId>
<artifactId>CommandWhitelist</artifactId>
<version>2.0-ALPHA-3</version>
<version>2.1</version>
</parent>
<artifactId>Bukkit</artifactId>
@@ -48,9 +48,9 @@ public class CommandWhitelistBukkit extends JavaPlugin {
// 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);
} catch (ClassNotFoundException ignored) {
}
getServer().getPluginManager().registerEvents(new TabCompleteBlockerListener(), this);
PluginCommand command = getCommand("commandwhitelist");
if (command != null) {
@@ -9,21 +9,18 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
public class AsyncTabCompleteBlockerListener implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
@EventHandler(priority = EventPriority.HIGHEST)
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);
String buffer = event.getBuffer();
if (!buffer.endsWith(" ") && buffer.split(" ").length == 1) event.setCancelled(true);
if (event.getCompletions().isEmpty()) return;
event.setCompletions(CommandUtil.filterSuggestions(buffer, event.getCompletions(), CommandWhitelistBukkit.getSuggestions(player)));
}
}
@@ -7,16 +7,21 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.server.TabCompleteEvent;
public class TabCompleteBlockerListener implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void onCommandTabComplete(org.bukkit.event.server.TabCompleteEvent event) {
public void onCommandTabComplete(TabCompleteEvent event) {
if (!(event.getSender() instanceof Player)) return;
Player player = (Player) event.getSender();
if (player.hasPermission(CWPermission.BYPASS.permission())) return;
String buffer = event.getBuffer();
if (!buffer.endsWith(" ") && buffer.split(" ").length == 1) event.setCancelled(true);
if (event.getCompletions().isEmpty()) return;
event.setCompletions(
CommandUtil.filterSuggestions(
event.getBuffer(),
buffer,
event.getCompletions(),
CommandWhitelistBukkit.getSuggestions(player)
)
+7 -7
View File
@@ -6,7 +6,7 @@
<parent>
<groupId>eu.endermite.commandwhitelist</groupId>
<artifactId>CommandWhitelist</artifactId>
<version>2.0-ALPHA-3</version>
<version>2.1</version>
</parent>
<artifactId>Common</artifactId>
@@ -59,8 +59,8 @@
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
<id>pluginwiki-repo</id>
<url>https://ci.pluginwiki.us/plugin/repository/everything/</url>
</repository>
<repository>
<id>velocitypowered-repo</id>
@@ -70,9 +70,9 @@
<dependencies>
<dependency>
<groupId>com.github.Thatsmusic99</groupId>
<artifactId>ConfigurationMaster</artifactId>
<version>v2.0.0-ALPHA-3</version>
<groupId>com.github.thatsmusic99</groupId>
<artifactId>ConfigurationMaster-API</artifactId>
<version>v2.0.0-BETA-1</version>
<scope>compile</scope>
</dependency>
<dependency>
@@ -90,7 +90,7 @@
<dependency>
<groupId>io.github.waterfallmc</groupId>
<artifactId>waterfall-api</artifactId>
<version>1.16-R0.5-SNAPSHOT</version>
<version>1.17-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
@@ -3,9 +3,7 @@ package eu.endermite.commandwhitelist.common.commands;
import eu.endermite.commandwhitelist.common.CWGroup;
import eu.endermite.commandwhitelist.common.ConfigCache;
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.TextDecoration;
import net.kyori.adventure.text.minimessage.MiniMessage;
import java.util.ArrayList;
@@ -34,17 +32,16 @@ public class CWCommand {
public static Component helpComponent(String baseCommand, boolean showReloadCommand, boolean showAdminCommands) {
Component component = MiniMessage.markdown().parse("<rainbow><bold>CommandWhitelist by YouHaveTrouble")
.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).hoverEvent(HoverEvent.showText(Component.text("Displays this message"))));
component = component.append(Component.text("/" + baseCommand + " help").color(NamedTextColor.AQUA).append(Component.text(" - Displays this message").color(NamedTextColor.BLUE)));
if (showReloadCommand) {
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) {
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.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;
}
@@ -56,6 +53,7 @@ public class CWCommand {
public static List<String> commandSuggestions(ConfigCache config, Collection<String> serverCommands, String[] args, boolean reloadPerm, boolean adminPerm) {
List<String> list = new ArrayList<>();
switch (args.length) {
default:
case 0:
case 1:
if ("reload".startsWith(args[0]) && reloadPerm)
+1 -1
View File
@@ -6,7 +6,7 @@
<parent>
<groupId>eu.endermite.commandwhitelist</groupId>
<artifactId>CommandWhitelist</artifactId>
<version>2.0-ALPHA-3</version>
<version>2.1</version>
</parent>
<artifactId>Velocity</artifactId>
+2 -6
View File
@@ -6,7 +6,7 @@
<parent>
<groupId>eu.endermite.commandwhitelist</groupId>
<artifactId>CommandWhitelist</artifactId>
<version>2.0-ALPHA-3</version>
<version>2.1</version>
</parent>
<artifactId>Waterfall</artifactId>
@@ -68,10 +68,6 @@
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
<repository>
<id>destroystokyo-repo</id>
<url>https://repo.destroystokyo.com/repository/maven-public/</url>
</repository>
<repository>
<id>papermc</id>
<url>https://papermc.io/repo/repository/maven-public/</url>
@@ -82,7 +78,7 @@
<dependency>
<groupId>io.github.waterfallmc</groupId>
<artifactId>waterfall-api</artifactId>
<version>1.16-R0.5-SNAPSHOT</version>
<version>1.17-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
+2 -2
View File
@@ -6,7 +6,7 @@
<groupId>eu.endermite.commandwhitelist</groupId>
<artifactId>CommandWhitelist</artifactId>
<version>2.0-ALPHA-3</version>
<version>2.1</version>
<modules>
<module>CommandWhitelistCommon</module>
<module>CommandWhitelistBukkit</module>
@@ -34,7 +34,7 @@
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-api</artifactId>
<version>4.8.0</version>
<version>4.8.1</version>
<scope>compile</scope>
</dependency>
<dependency>
+13 -7
View File
@@ -10,16 +10,22 @@ precisely what commands players can see and use.
![bStats Servers](https://img.shields.io/bstats/servers/8704?label=Proxy%20servers%20using%20CW&style=flat-square)
<h3>Plugin Features</h3>
<ul>
<li>You can lock certain commands behind permission
<li>Overwrites default "no such command" message with your branding
<li>Blocks tab completion on spigot and bungeecord*</li>
<li>Blocks command execution on spigot and bungeecord</li>
<li>Blocks completion and execution of specific subcommands (spigot only)</li>
<li>Lock selected commands behind permission
<li>Overwrite default "no such command" message with your branding
<li>Block tab completion</li>
<li>Block command execution</li>
<li>Block completion and execution of specified subcommands</li>
</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>.