mirror of
https://github.com/plexusorg/Plex.git
synced 2024-12-23 01:27:37 +00:00
fix issue where matcher would match partial commands
This commit is contained in:
parent
0fc2aa68b0
commit
8866f44aa2
@ -7,6 +7,7 @@ import dev.plex.command.blocker.MatchCommand;
|
|||||||
import dev.plex.command.blocker.RegexCommand;
|
import dev.plex.command.blocker.RegexCommand;
|
||||||
import dev.plex.listener.PlexListener;
|
import dev.plex.listener.PlexListener;
|
||||||
import dev.plex.player.PlexPlayer;
|
import dev.plex.player.PlexPlayer;
|
||||||
|
import dev.plex.util.PlexLog;
|
||||||
import dev.plex.util.PlexUtils;
|
import dev.plex.util.PlexUtils;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -55,7 +56,7 @@ public class CommandListener extends PlexListener
|
|||||||
}
|
}
|
||||||
else if (blockedCommand instanceof MatchCommand matchCommand)
|
else if (blockedCommand instanceof MatchCommand matchCommand)
|
||||||
{
|
{
|
||||||
if (message.toLowerCase().startsWith(matchCommand.getMatch().toLowerCase()))
|
if (message.equalsIgnoreCase(matchCommand.getMatch()) || message.toLowerCase().startsWith(matchCommand.getMatch().toLowerCase() + " "))
|
||||||
{
|
{
|
||||||
isBlocked = true;
|
isBlocked = true;
|
||||||
}
|
}
|
||||||
@ -63,7 +64,7 @@ public class CommandListener extends PlexListener
|
|||||||
if (isBlocked)
|
if (isBlocked)
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
//PlexLog.debug("Command blocked.");
|
PlexLog.debug("Command blocked: " + blockedCommand);
|
||||||
player.sendMessage(PlexUtils.mmDeserialize(blockedCommand.getMessage()));
|
player.sendMessage(PlexUtils.mmDeserialize(blockedCommand.getMessage()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user