Compare commits
No commits in common. "deb42dbe25db497b9ede2d25eb5d94a8daa87307" and "a33204b7b87b8fe25885685e0a362fe0008b500b" have entirely different histories.
deb42dbe25
...
a33204b7b8
@ -1,9 +0,0 @@
|
||||
kind: pipeline
|
||||
name: default
|
||||
|
||||
steps:
|
||||
- name: build
|
||||
image: maven:3-eclipse-temurin-17
|
||||
commands:
|
||||
- mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V
|
||||
- mvn test -B
|
@ -4,24 +4,13 @@ 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)
|
||||
*/
|
||||
|
||||
@EventHandler
|
||||
public void onCommand(PlayerCommandPreprocessEvent event)
|
||||
{
|
||||
if(!event.getMessage().matches(allowedCmdsRegex))
|
||||
// block all commands (except from proxy and allowed ones)
|
||||
// block literally all commands (except from proxy ones)
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user