Blocking /minecraft:me in plugin

Discussion in 'Plugin Development' started by flash110, Jul 10, 2016.

Thread Status:
Not open for further replies.
  1. Offline


    Hello, so today I noticed that blocking commands like /me is easy by creating and overwriting them in your own plugin, but how would I go about overwriting commands with : in them? I do not want to use permissions and negate it.
  2. Offline


    if string contains(":"), event.setCancelled(true);
  3. Offline


    Player» My coords: 143,852
    The event would be cancelled and the message wouldn't be sent. So, you could use #contains("/minecraft:me") etc.

    Gesendet via Tapatalk auf meinem Honor 7. ❤
  4. Offline


    Use #startsWith("/minecraft:me ")..

    If a player said a message containing it, it would also cancel it.

    Also put a space after (like the example above) to make sure it is the full command.
    adagi likes this.
  5. Offline


    Assuming you use the chat event...
  6. Offline


        public void onMinecraftMe(PlayerCommandPreprocessEvent event) {
            Player p = event.getPlayer();
            if (event.getMessage().startsWith("/minecraft:")) {
  7. Good starting point but not perfect. Players can still exploit it by writing "/minEcraft:me" for example

    Check if event.getMessage().toLowerCase() starts with "/minecraft:me" and then cancel
    cococow123 and ChipDev like this.
  8. Offline


    cococow123 likes this.
Thread Status:
Not open for further replies.

Share This Page