Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved Disable a notification message

Comments in 'Plugin Development' started by amiremad, Oct 25, 2015.

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

    amiremad Active Member

    Joined:
    Sep 8, 2015
    Posts:
    192
    Minecraft User:
    amir107
    hello i made a plugin that disables ops from banning other ops

    i disabled the event but i need help to disable the message for example [Op:Banned:Op]

    i want this message to be disabled when an op try to ban an op only
  2. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    if you cancel commandPreProcessEvent so message is cancelled too
    amiremad likes this.
  3. amiremad
    Offline

    amiremad Active Member

    Joined:
    Sep 8, 2015
    Posts:
    192
    Minecraft User:
    amir107
    PLEASE SEND ME A CODE ON HOW TO CANCEL THIS
  4. amiremad
    Offline

    amiremad Active Member

    Joined:
    Sep 8, 2015
    Posts:
    192
    Minecraft User:
    amir107
    I WILL ATTACH THE PLUGIN WAIT
  5. amiremad
    Offline

    amiremad Active Member

    Joined:
    Sep 8, 2015
    Posts:
    192
    Minecraft User:
    amir107
    Here it is attached

    Attached Files:

  6. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    PHP:
    public function onCommandPreProcess(PlayerCommandPreProcessEvent $e){
        
    $p $e->getPlayer();
        
        
    $args explode(" "$e->getMessage();
        if(
    count($args) !== 2){
            return 
    false;
        }

        if(
    strtolower($args[0]) == "ban"){
            
    $player $this->getServer()->getPlayer($args[1]);
            if(!
    $player instanceof Player){
                
    $player $this->getServer()->getOfflinePlayer($args[1]);
            }
            if(
    $player->isOp()){
                
    $e->setCancelled();
            }
        }
    }
  7. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    Wrong.
    PHP:
    public function onCommandPreProcess(PlayerCommandPreProcessEvent $e){
        
    $p $e->getPlayer();
       
        
    $args explode(" "$e->getMessage();
        if(
    count($args) !== 2){
            return 
    false;
        }

        if(
    strtolower($args[0]) == "/ban"){
            
    $player $this->getServer()->getPlayer($args[1]);
            if(!
    $player instanceof Player){
                
    $player $this->getServer()->getOfflinePlayer($args[1]);
            }
            if(
    $player->isOp()){
                
    $e->setCancelled();
            }
        }
    is right.
    SeifValkierks and amiremad like this.
  8. amiremad
    Offline

    amiremad Active Member

    Joined:
    Sep 8, 2015
    Posts:
    192
    Minecraft User:
    amir107
    Thx Taha
Thread Status:
Not open for further replies.

Share This Page

Advertisement