Skip to content

Commit 9ac1d0c

Browse files
committed
PlayerCommandPreprocessListener: fix lingering usage of - thanks JunTVDE
1 parent 7fd0078 commit 9ac1d0c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

blackwidowpluginbukkit/src/main/java/io/github/arcaneplugins/blackwidow/plugin/bukkit/listener/bukkit/PlayerCommandPreprocessListener.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public void handle(final PlayerCommandPreprocessEvent event) {
4949

5050
final Player player = event.getPlayer();
5151
final String msg = event.getMessage();
52+
final String msgWithSlash = msg.startsWith("/") ? msg : '/' + msg;
5253

5354
/*
5455
BlackWidow will add a starting slash to the command if missing since Bukkit doesn't follow its own
@@ -62,12 +63,12 @@ public void handle(final PlayerCommandPreprocessEvent event) {
6263
*/
6364
final Context context = new Context(plugin())
6465
.withPlayer(player)
65-
.withCommands(List.of(msg.startsWith("/") ? msg : '/' + msg));
66+
.withCommands(List.of(msgWithSlash));
6667

6768
if (plugin().cmdBlocker().filterCmdExecution()) {
6869
final Evaluation eval = plugin()
6970
.cmdBlocker()
70-
.evalAndProcess(context, event.getMessage(), true, EvalCause.CMD_EXECUTION);
71+
.evalAndProcess(context, msgWithSlash, true, EvalCause.CMD_EXECUTION);
7172

7273
switch (eval.policy()) {
7374
case ALLOW:

0 commit comments

Comments
 (0)