mirror of
https://github.com/YouHaveTrouble/CommandWhitelist.git
synced 2026-05-12 06:26:57 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e80629d708 | |||
| f41bfa7cd1 | |||
| 5af0cdef84 | |||
| e232953f11 | |||
| e8b284db69 |
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>eu.endermite.commandwhitelist</groupId>
|
<groupId>eu.endermite.commandwhitelist</groupId>
|
||||||
<artifactId>CommandWhitelist</artifactId>
|
<artifactId>CommandWhitelist</artifactId>
|
||||||
<version>2.5.4</version>
|
<version>2.6.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>Bukkit</artifactId>
|
<artifactId>Bukkit</artifactId>
|
||||||
|
|||||||
+2
-1
@@ -21,6 +21,7 @@ import org.bukkit.plugin.java.JavaPlugin;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
public class CommandWhitelistBukkit extends JavaPlugin {
|
public class CommandWhitelistBukkit extends JavaPlugin {
|
||||||
|
|
||||||
@@ -78,7 +79,7 @@ public class CommandWhitelistBukkit extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void reloadPluginConfig(CommandSender sender) {
|
public void reloadPluginConfig(CommandSender sender) {
|
||||||
getServer().getScheduler().runTaskAsynchronously(this, () -> {
|
CompletableFuture.runAsync(() -> {
|
||||||
reloadPluginConfig();
|
reloadPluginConfig();
|
||||||
try {
|
try {
|
||||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||||
|
|||||||
+8
-3
@@ -9,7 +9,6 @@ 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.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
@@ -18,8 +17,14 @@ public class AsyncTabCompleteBlockerListener implements Listener {
|
|||||||
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();
|
String buffer = event.getBuffer();
|
||||||
if (!buffer.endsWith(" ") && buffer.split(" ").length == 1) event.setCancelled(true);
|
if ((buffer.split(" ").length == 1 && !buffer.endsWith(" ")) || !buffer.startsWith("/")) {
|
||||||
if (event.getCompletions().isEmpty()) return;
|
CommandWhitelistBukkit.getConfigCache().debug("Actively prevented "+event.getSender().getName()+"'s tab completion (sus packet)");
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (event.getCompletions().isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
event.setCompletions(CommandUtil.filterSuggestions(buffer, event.getCompletions(), CommandWhitelistBukkit.getSuggestions(player)));
|
event.setCompletions(CommandUtil.filterSuggestions(buffer, event.getCompletions(), CommandWhitelistBukkit.getSuggestions(player)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-3
@@ -17,13 +17,12 @@ public class TabCompleteBlockerListener implements Listener {
|
|||||||
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();
|
String buffer = event.getBuffer();
|
||||||
if (!buffer.endsWith(" ") && buffer.split(" ").length == 1) {
|
if ((buffer.split(" ").length == 1 && !buffer.endsWith(" ")) || !buffer.startsWith("/")) {
|
||||||
CommandWhitelistBukkit.getConfigCache().debug("Actively prevented "+event.getSender().getName()+"'s tab completion (/[tab] packet)");
|
CommandWhitelistBukkit.getConfigCache().debug("Actively prevented "+event.getSender().getName()+"'s tab completion (sus packet)");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (event.getCompletions().isEmpty()) {
|
if (event.getCompletions().isEmpty()) {
|
||||||
CommandWhitelistBukkit.getConfigCache().debug("Tab completion not provided");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
event.setCompletions(
|
event.setCompletions(
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ api-version: 1.13
|
|||||||
main: eu.endermite.commandwhitelist.bukkit.CommandWhitelistBukkit
|
main: eu.endermite.commandwhitelist.bukkit.CommandWhitelistBukkit
|
||||||
authors: [YouHaveTrouble]
|
authors: [YouHaveTrouble]
|
||||||
website: youhavetrouble.me
|
website: youhavetrouble.me
|
||||||
|
folia-supported: true
|
||||||
softdepend:
|
softdepend:
|
||||||
- ProtocolLib
|
- ProtocolLib
|
||||||
description: Control what commands players can use
|
description: Control what commands players can use
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>eu.endermite.commandwhitelist</groupId>
|
<groupId>eu.endermite.commandwhitelist</groupId>
|
||||||
<artifactId>CommandWhitelist</artifactId>
|
<artifactId>CommandWhitelist</artifactId>
|
||||||
<version>2.5.4</version>
|
<version>2.6.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>Common</artifactId>
|
<artifactId>Common</artifactId>
|
||||||
@@ -82,13 +82,13 @@
|
|||||||
<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.1.2-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.kyori</groupId>
|
<groupId>net.kyori</groupId>
|
||||||
<artifactId>adventure-text-minimessage</artifactId>
|
<artifactId>adventure-text-minimessage</artifactId>
|
||||||
<version>4.11.0</version>
|
<version>4.13.1</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>eu.endermite.commandwhitelist</groupId>
|
<groupId>eu.endermite.commandwhitelist</groupId>
|
||||||
<artifactId>CommandWhitelist</artifactId>
|
<artifactId>CommandWhitelist</artifactId>
|
||||||
<version>2.5.4</version>
|
<version>2.6.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>Velocity</artifactId>
|
<artifactId>Velocity</artifactId>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>eu.endermite.commandwhitelist</groupId>
|
<groupId>eu.endermite.commandwhitelist</groupId>
|
||||||
<artifactId>CommandWhitelist</artifactId>
|
<artifactId>CommandWhitelist</artifactId>
|
||||||
<version>2.5.4</version>
|
<version>2.6.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>Waterfall</artifactId>
|
<artifactId>Waterfall</artifactId>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>eu.endermite.commandwhitelist</groupId>
|
<groupId>eu.endermite.commandwhitelist</groupId>
|
||||||
<artifactId>CommandWhitelist</artifactId>
|
<artifactId>CommandWhitelist</artifactId>
|
||||||
<version>2.5.4</version>
|
<version>2.6.0</version>
|
||||||
<modules>
|
<modules>
|
||||||
<module>CommandWhitelistCommon</module>
|
<module>CommandWhitelistCommon</module>
|
||||||
<module>CommandWhitelistBukkit</module>
|
<module>CommandWhitelistBukkit</module>
|
||||||
|
|||||||
Reference in New Issue
Block a user