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

Anti-Fly, but real..

Comments in 'Plugin Development' started by SuperChipsLP, May 1, 2014.

  1. SuperChipsLP
    Offline

    SuperChipsLP Active Member Plugin Developer

    Joined:
    Sep 15, 2013
    Posts:
    204
    Plugins:
    5
    Minecraft User:
    Redmol
    So, everyone knows the stupid bug in Pocketmine:
    You get kicked for flying, if you are standing on a Chest or any other tile, like slabs, for too long.
    I have written a script, that kicks players only if they are in the air. It works fine. (Only to use with allow-flight=off)!

    Script:

    PHP:
    case 'player.flying':
                    
    $player $data;
                    
    $underblock $player->entity->level->getBlock(new Vector3($player->entity->x$player->entity->1$player->entity->z));
                    
    $ID $underblock->getID();
                    if(
    $ID == 0){
                        
    $data->close("Flying (in air)");
                    } else {
                        
    console($data->username." was prevented from kicking. ->".$ID);
                        return 
    false;
                    }
                break;
    Theroratically, this works totally fine. It detects the flying and kicks it. Here a console log:

    2014-05-01 12:16:50 [INFO] RedmonTV[/192.168.178.35:52700] logged out due to Flying (in air)

    The (in air) indicates, that the player was kicked trough my plugin. This was tested with a real fly mod.
    Now, when a player stands on a chest, this happens:

    2014-05-01 12:19:33 RedmonTV was prevented from kicking.
    2014-05-01 12:19:33 [INFO] RedmonTV left the game
    2014-05-01 12:19:33 [INFO] RedmonTV[/192.168.178.35:58735] logged out due to flying

    The "flying" says, that the player was kicked by PocketMines anti-fly. But, it is turned off.
    Is there a way to cancel the "player.flying" event? Thanks...
    Anton Magsino and iJoshuaHD like this.
  2. iJoshuaHD
    Offline

    iJoshuaHD Notable Member Plugin Developer

    Joined:
    Nov 7, 2013
    Posts:
    1,167
    Plugins:
    4
    Minecraft User:
    iJoshuaHD
    just turn on the allow-flight?
  3. SuperChipsLP
    Offline

    SuperChipsLP Active Member Plugin Developer

    Joined:
    Sep 15, 2013
    Posts:
    204
    Plugins:
    5
    Minecraft User:
    Redmol
    That is what I had, but, as I said, you get kicked for "flying" when you're standing on Chests, Fences, Iron Bars, Slabs, Walls etc. for longer than 5 seconds...
  4. Beast Mode
    Offline

    Beast Mode Banned

    Joined:
    Apr 4, 2014
    Posts:
    16
    I know right I always get kicked for standing on stuff
  5. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,706
    Plugins:
    22
    Minecraft User:
    Falkirknh
    There comes a point where making a workaround is more work than just fixing the bug and creating a pull request :)
    Andrey Nazarchuk likes this.
  6. SuperChipsLP
    Offline

    SuperChipsLP Active Member Plugin Developer

    Joined:
    Sep 15, 2013
    Posts:
    204
    Plugins:
    5
    Minecraft User:
    Redmol
    Yeah, you're right. :)
    Where can I find the file to change it?
  7. sekjun9878
    Offline

    sekjun9878 Staff Member PocketMine Team

    Joined:
    Aug 22, 2013
    Posts:
    108
    Plugins:
    1
    Minecraft User:
    sekjun9878
    It should be in Player.php. Search for player.flying.
  8. iJoshuaHD
    Offline

    iJoshuaHD Notable Member Plugin Developer

    Joined:
    Nov 7, 2013
    Posts:
    1,167
    Plugins:
    4
    Minecraft User:
    iJoshuaHD
    how about set stuff like this:

    Code:
    case 'player.flying':
     $player = $data;
     $underblock = $player->entity->level->getBlock(new Vector3($player->entity->x, $player->entity->y - 1, $player->entity->z));
     $ID = $underblock->getID();
     if($ID == 0){
     $data->close("Flying (in air)");
     } else {
    ///////my added idea/////////
    //whitelist the all item ids except the air block//
        if($ID != 0){
     console($data->username." was prevented from kicking. ->".$ID);
     return false;
    }
    ///////END\\\\\\\\\
     }
     break;
    
    IM not sure if this works or not but hope u can add up another idea
  9. BlinkSun
    Offline

    BlinkSun Active Member Plugin Developer

    Joined:
    Mar 26, 2014
    Posts:
    128
    Plugins:
    4
    Minecraft User:
    BlinkSun
    I ll try to look at it too !

Share This Page

Advertisement