Compare commits

..

9 Commits

12 changed files with 50 additions and 84 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> <parent>
<groupId>eu.endermite.commandwhitelist</groupId> <groupId>eu.endermite.commandwhitelist</groupId>
<artifactId>CommandWhitelist</artifactId> <artifactId>CommandWhitelist</artifactId>
<version>2.0-ALPHA-3</version> <version>2.1.1</version>
</parent> </parent>
<artifactId>Bukkit</artifactId> <artifactId>Bukkit</artifactId>
@@ -48,9 +48,9 @@ public class CommandWhitelistBukkit extends JavaPlugin {
// Use paper's async tab completions if possible // Use paper's async tab completions if possible
Class.forName("com.destroystokyo.paper.event.server.AsyncTabCompleteEvent"); Class.forName("com.destroystokyo.paper.event.server.AsyncTabCompleteEvent");
getServer().getPluginManager().registerEvents(new AsyncTabCompleteBlockerListener(), this); getServer().getPluginManager().registerEvents(new AsyncTabCompleteBlockerListener(), this);
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException ignored) {
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) {
@@ -9,21 +9,18 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
public class AsyncTabCompleteBlockerListener implements Listener { public class AsyncTabCompleteBlockerListener implements Listener {
@EventHandler(priority = EventPriority.NORMAL) @EventHandler(priority = EventPriority.HIGHEST)
public void onCommandTabComplete(AsyncTabCompleteEvent event) { public void onCommandTabComplete(AsyncTabCompleteEvent event) {
if (!(event.getSender() instanceof Player)) return; if (!(event.getSender() instanceof Player)) return;
Player player = (Player) event.getSender(); Player player = (Player) event.getSender();
if (player.hasPermission(CWPermission.BYPASS.permission())) return; if (player.hasPermission(CWPermission.BYPASS.permission())) return;
event.setCompletions( String buffer = event.getBuffer();
CommandUtil.filterSuggestions( if (!buffer.endsWith(" ") && buffer.split(" ").length == 1) event.setCancelled(true);
event.getBuffer(), if (event.getCompletions().isEmpty()) return;
event.getCompletions(), event.setCompletions(CommandUtil.filterSuggestions(buffer, event.getCompletions(), CommandWhitelistBukkit.getSuggestions(player)));
CommandWhitelistBukkit.getSuggestions(player)
)
);
event.setHandled(true);
} }
} }
@@ -7,16 +7,21 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.server.TabCompleteEvent;
public class TabCompleteBlockerListener implements Listener { public class TabCompleteBlockerListener implements Listener {
@EventHandler(priority = EventPriority.NORMAL) @EventHandler(priority = EventPriority.NORMAL)
public void onCommandTabComplete(org.bukkit.event.server.TabCompleteEvent event) { public void onCommandTabComplete(TabCompleteEvent event) {
if (!(event.getSender() instanceof Player)) return; if (!(event.getSender() instanceof Player)) return;
Player player = (Player) event.getSender(); Player player = (Player) event.getSender();
if (player.hasPermission(CWPermission.BYPASS.permission())) return; 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( event.setCompletions(
CommandUtil.filterSuggestions( CommandUtil.filterSuggestions(
event.getBuffer(), buffer,
event.getCompletions(), event.getCompletions(),
CommandWhitelistBukkit.getSuggestions(player) CommandWhitelistBukkit.getSuggestions(player)
) )
+7 -7
View File
@@ -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-3</version> <version>2.1.1</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>
@@ -133,7 +133,7 @@ public class ConfigCache {
} }
public void saveCWGroup(String id, CWGroup group) { public void saveCWGroup(String id, CWGroup group) {
config.set("groups." + id + ".", group.serialize()); config.set("groups." + id, group.serialize());
saveConfig(); saveConfig();
} }
@@ -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;
@@ -34,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;
} }
@@ -103,8 +100,9 @@ public class CWCommand {
} }
return list; return list;
} }
} default:
return list; return list;
} }
}
} }
+1 -1
View File
@@ -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-3</version> <version>2.1.1</version>
</parent> </parent>
<artifactId>Velocity</artifactId> <artifactId>Velocity</artifactId>
+2 -6
View File
@@ -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-3</version> <version>2.1.1</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>
+2 -2
View File
@@ -6,7 +6,7 @@
<groupId>eu.endermite.commandwhitelist</groupId> <groupId>eu.endermite.commandwhitelist</groupId>
<artifactId>CommandWhitelist</artifactId> <artifactId>CommandWhitelist</artifactId>
<version>2.0-ALPHA-3</version> <version>2.1.1</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>
+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) ![bStats Servers](https://img.shields.io/bstats/servers/8704?label=Proxy%20servers%20using%20CW&style=flat-square)
<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>.