Compare commits

..

No commits in common. "deb42dbe25db497b9ede2d25eb5d94a8daa87307" and "a33204b7b87b8fe25885685e0a362fe0008b500b" have entirely different histories.

2 changed files with 2 additions and 22 deletions

View File

@ -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

View File

@ -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);
}
}