Allow exceptions to commands

This commit is contained in:
Bea 2022-11-11 18:31:46 +01:00
parent a33204b7b8
commit 44ba3cd7ab
1 changed files with 13 additions and 2 deletions

View File

@ -4,13 +4,24 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import java.util.ArrayList;
import java.util.List;
public class CommandCanceller implements Listener
private final static String allowedCmdsRegex = "\\/(login|register|changepassword)\\b";
first "/" is the command prefix
(login|register|...) means either one or the other
\b means end of word (end of string, whitespace, ...) so NO other characters (like /loginabc)
public void onCommand(PlayerCommandPreprocessEvent event)
// block literally all commands (except from proxy ones)
// block all commands (except from proxy and allowed ones)