WorldGuard's blocked-cmds and aliases

Discussion in 'Plugin Development' started by To175, Dec 31, 2014.

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

    To175

    Hi,
    I made custom command with BetterAlias plugin, but in a region I want to block /portails !
    Region block the /spawn and /portails but player CAN DO /portails ...

    I want to block it in the region !

    My code doesn't work !
    Code:
        @EventHandler(priority = EventPriority.MONITOR)
        public void Blockage(PlayerCommandPreprocessEvent event){
            String[] array2 = event.getMessage().split(" ");//Single whitespace
    if(array2[0].equalsIgnoreCase("/portails")&&event.getPlayer().getWorld().getName().equals("Mecraft")){
                    event.setMessage("/spawn");
                    event.getPlayer().sendMessage(prefixMecraft + ChatColor.RED + "Maintenant fais /portails !");
                    return;
            }
        }
    It logs that :
    [13:15:48] [Server thread/INFO]: fantakill issued server command: /portails
    [13:15:48] [Server thread/INFO]: [BetterAlias] [BetterAlias] §bRunning console command for fantakill: /warp portails fantakill
    [13:15:48] [Server thread/INFO]: CONSOLE issued server command: /warp portails fantakill

    I want player do /portails in the region be changed into /spawn and as they can't do that, it is not allowed ! Else it tp the player to spawn.
    If this is not the solution, how to do please ?

    /!\ I don't want to block /portails in the whole world ! Just in the region where /spawn is not allowed too /!\
    + someone sais "
    dispatchCommand" is not correct... I don't know why but he told me to use "PlayerCommandPreprocessEvent"


    Help please :(
     
Thread Status:
Not open for further replies.

Share This Page