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

Solved Disable Op Kick Message

Comments in 'Plugin Development' started by amiremad, Nov 12, 2015.

  1. amiremad
    Offline

    amiremad Active Member

    Joined:
    Sep 8, 2015
    Posts:
    192
    Minecraft User:
    amir107
    I need help to disable the ban and kick message for ops please if you are going to help


    tell me what should i do in use/pocketmine .........

    because the time before i asked someone gave me a code but it crashes because i didnt do the correct use/pocketmine

    please help because i do nt know really how to disable the message and i am still learning more about pocketmine api

    thx
  2. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    Use PlayerKickEvent
    And $event->setKickMessage()
  3. Radguy23
    Offline

    Radguy23 Active Member

    Joined:
    Aug 14, 2015
    Posts:
    74
    Minecraft User:
    TheAwesomeCrew27
    Where can i put that code in the phar or somewhere else?
  4. amiremad
    Offline

    amiremad Active Member

    Joined:
    Sep 8, 2015
    Posts:
    192
    Minecraft User:
    amir107
    When I finish the plugin I will tell you
  5. Radguy23
    Offline

    Radguy23 Active Member

    Joined:
    Aug 14, 2015
    Posts:
    74
    Minecraft User:
    TheAwesomeCrew27
    Ok thanks
  6. amiremad
    Offline

    amiremad Active Member

    Joined:
    Sep 8, 2015
    Posts:
    192
    Minecraft User:
    amir107
    Start a conversation when done i will tell you
  7. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
  8. Driesboy1
    Offline

    Driesboy1 Active Member

    Joined:
    Oct 28, 2015
    Posts:
    102
    Minecraft User:
    Driesboy
    sorry
    I had not looked good
  9. amiremad
    Offline

    amiremad Active Member

    Joined:
    Sep 8, 2015
    Posts:
    192
    Minecraft User:
    amir107
    PHP:
    <?php  namespace main;
    use 
    pocketmine\utils\TextFormat as MT;
    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\Player;
    use 
    pocketmine\server;
    use 
    pocketmine\level;
    use 
    pocketmine\event\Listener;
    use 
    pocketmine\event\player\PlayerKickEvent;
    use 
    pocketmine\math\Vector3;
    class 
    AntiOpKick extends PluginBase implements Listener {
      public function 
    onEnable() { $this->getServer()->getPluginManager()->registerEvents($this,$this); $this->getLogger()->info(MT::BLUE."Plugin Anti Op Kick loaded!"); }
      public function 
    onKick(PlayerKickEvent $event) { $player $event->getPlayer(); if($player->isOp()){$event->setCancelled(\true);} }
      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(); }
      public function 
    onDisable() { $this->getLogger()->info(MT::RED."Anti_OP_Kick Is Unloaded!"); } }
  10. amiremad
    Offline

    amiremad Active Member

    Joined:
    Sep 8, 2015
    Posts:
    192
    Minecraft User:
    amir107
    i did it but still crashing

Share This Page

Advertisement