Prevent /bukkit: and /minecraft: commands for non-OP players

This commit is contained in:
ArcticZeroo 2018-02-20 16:39:38 -05:00 committed by Alexander Meech
parent 53fc397536
commit 48e1f93b64

View File

@ -26,6 +26,20 @@ public class CommandModule extends Module
super("Commands", plugin);
}
@EventHandler
public void preventMe(PlayerCommandPreprocessEvent event)
{
if (event.getMessage().toLowerCase().startsWith("/bukkit")
|| event.getMessage().toLowerCase().startsWith("/minecraft"))
{
if (!event.getPlayer().isOp())
{
event.getPlayer().sendMessage(F.main("Parser", "Nope, not allowed!"));
event.setCancelled(true);
}
}
}
@EventHandler
public void onCommand(PlayerCommandPreprocessEvent event)
{