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

Join game and leave game blocker

Comments in 'Plugin Development' started by codmadnesspro, Oct 8, 2013.

  1. wies
    Offline

    wies Notable Member

    Joined:
    Aug 23, 2013
    Posts:
    390
    easy way: editing the src
    harder: check all the server messages in a plugin, and filter the ones that you don't need
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    I found something in fact before asking "how".
    In Onebone's Economys plugin Airport:
    PHP:
    if ($this->api->ban->isOp($data["player"]->username) === false){
    1         $output .= "You don't have permission to destroy airport";
    2         $player->sendChat($output);
    3         $this->api->ban->kick("kick", array($player->username"tried to destroy airport"), "EconomyAirport"false);
    4         return false;
                                }
    So when a non-op tries to destroy the airport and confirmed non-ip:
    Line 1&2: Tell the player he/she doesn't have permission.
    Line 3: Kick the player.
    Line 4: return false.
    What is done with the returned boolean?
    Because it is "return" in the handleEvents() function, there is no chance of doing something else. So, maybe this tells the server not to run default action? Or the airport will be destroyed anyway?
  3. wies
    Offline

    wies Notable Member

    Joined:
    Aug 23, 2013
    Posts:
    390
    Don't ask your questions on this post. Make another separated post for it in the dev or help selection.
    Anyways, you can check in the src what the returned value does.
    For example the event "player.block.break":
    PHP:
    if($this->server->api->dhandle("player.block.break", array("player" => $player"target" => $target"item" => $item)) !== false){
        
    $drops $target->getDrops($item$player);
        if(
    $target->onBreak($item$player) === false){
           return 
    $this->cancelAction($target$playerfalse);
        }
        if(
    $item->useOn($target) and ($player->gamemode 0x01) === and $item->getMetadata() >= $item->getMaxDurability()){
          
    $player->setSlot($player->slot, new Item(AIR00), false);
        }
    }else{
       return 
    $this->cancelAction($target$playerfalse);
    }
    if you return false it will cancel the action, any other value will allow the action

Share This Page

Advertisement