mirror of
https://github.com/YouHaveTrouble/CommandWhitelist.git
synced 2026-05-12 14:36:56 +00:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 727d6c3227 | |||
| 7e6b793ede | |||
| fd893b931d | |||
| 5bcf5bb130 | |||
| 7c33718190 | |||
| ad599092de | |||
| 1bb2c7ea6a | |||
| a935503239 | |||
| 2a6be9829c |
@@ -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>
|
||||
<groupId>eu.endermite.commandwhitelist</groupId>
|
||||
<artifactId>CommandWhitelist</artifactId>
|
||||
<version>2.0-ALPHA-3</version>
|
||||
<version>2.1.1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>Bukkit</artifactId>
|
||||
|
||||
+2
-2
@@ -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) {
|
||||
|
||||
+6
-9
@@ -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)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+9
-4
@@ -7,18 +7,23 @@ 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(),
|
||||
event.getCompletions(),
|
||||
CommandWhitelistBukkit.getSuggestions(player)
|
||||
buffer,
|
||||
event.getCompletions(),
|
||||
CommandWhitelistBukkit.getSuggestions(player)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>eu.endermite.commandwhitelist</groupId>
|
||||
<artifactId>CommandWhitelist</artifactId>
|
||||
<version>2.0-ALPHA-3</version>
|
||||
<version>2.1.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>
|
||||
|
||||
+1
-1
@@ -133,7 +133,7 @@ public class ConfigCache {
|
||||
}
|
||||
|
||||
public void saveCWGroup(String id, CWGroup group) {
|
||||
config.set("groups." + id + ".", group.serialize());
|
||||
config.set("groups." + id, group.serialize());
|
||||
saveConfig();
|
||||
}
|
||||
|
||||
|
||||
+6
-8
@@ -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;
|
||||
}
|
||||
@@ -103,8 +100,9 @@ public class CWCommand {
|
||||
}
|
||||
return list;
|
||||
}
|
||||
default:
|
||||
return list;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>eu.endermite.commandwhitelist</groupId>
|
||||
<artifactId>CommandWhitelist</artifactId>
|
||||
<version>2.0-ALPHA-3</version>
|
||||
<version>2.1.1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>Velocity</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>eu.endermite.commandwhitelist</groupId>
|
||||
<artifactId>CommandWhitelist</artifactId>
|
||||
<version>2.0-ALPHA-3</version>
|
||||
<version>2.1.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>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>eu.endermite.commandwhitelist</groupId>
|
||||
<artifactId>CommandWhitelist</artifactId>
|
||||
<version>2.0-ALPHA-3</version>
|
||||
<version>2.1.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>
|
||||
|
||||
@@ -10,16 +10,22 @@ precisely what commands players can see and use.
|
||||

|
||||
|
||||
<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>.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user