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

Player move

Comments in 'Plugin Development' started by Creeperface, Sep 25, 2015.

  1. Hotshot_9930
    Offline

    Hotshot_9930 Notable Member Plugin Developer

    Joined:
    May 26, 2014
    Posts:
    665
    Plugins:
    2
    Minecraft User:
    HotshotHD
    OOPS, i posted that in the wrong thread
  2. CrazedMiner
    Offline

    CrazedMiner Notable Member Plugin Developer

    Joined:
    Jan 31, 2015
    Posts:
    348
    Plugins:
    2
    Minecraft User:
    CrazedMinerYT
    You can do it, no one said it would be easy or simple. I honestly don't see the point, your better off getting good staff that will report hackers.
  3. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    i try to look at another antifly plugins (from craftbukkit)
  4. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    i made some protection :D what do you think?
    PHP:
    public function onMove(PlayerMoveEvent $e){
        
    $p $e->getPlayer();
        
    $to $e->getTo();
        
    $from $e->getFrom();
        if(!
    $p->isSurvival() || $p->getLevel()->getName() == "BedWars_hub" || ($from->=== $to->&& $from->=== $to->&& $from->=== $to->z)){
            return;
        }

        if(
    $to->>= $from->&& !$this->jump($to)){
            
    $e->setCancelled();
            return;
        }
    }

        public function 
    jump(Location $v){
            for(
    $x = ($v->1); $x < ($v->1); $x++){
                for(
    $z = ($v->1); $z < ($v->1); $z++){
                    if(
    $this->whatBlock(new Position($x$v->1$z$v->getLevel())) == "block" || $this->whatBlock(new Position($x$v->1.5$z$v->getLevel())) == "block" || ($ppos $this->whatBlock(new Position($x$v->y$z$v->getLevel()))) == "water" || $ppos == "block"){
                        return 
    true;
                    }
                }
            }
            return 
    false;
        }

        public function 
    whatBlock(Position $v) {
            
    $block $v->getLevel()->getBlock($v);
            
    $id $block->getID();
            
    $damage $block->getDamage();
            switch (
    $id) {
                case 
    0:
                case 
    6:
                case 
    27:
                case 
    30:
                case 
    31:
                case 
    37:
                case 
    38:
                case 
    39:
                case 
    40:
                case 
    50:
                case 
    51:
                case 
    63:
                case 
    66:
                case 
    68:
                case 
    78:
                case 
    111:
                case 
    141:
                case 
    142:
                case 
    171:
                case 
    175:
                case 
    244:
                case 
    323:
                    return 
    "air";
                    break;
                case 
    8:
                    return 
    "water";
                case 
    9:
                    return 
    "water";
                    break;
                case 
    10:
                    return 
    "water";
                case 
    11:
                    return 
    "water";
                    break;
                case 
    44:
                case 
    64:
                    if ((
    $damage 0x08) === 0x08) {
                        return 
    "air";
                    }else{
                        return 
    "block";
                    }
                    break;
                case 
    85:
                case 
    107:
                case 
    139:
                    return 
    "high";
                    break;
                case 
    65:
                case 
    106:
                    return 
    "climb";
                    break;
                default:
                    return 
    "block";
                    break;
            }
        }
    Last edited: Sep 30, 2015
  5. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
  6. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    It compares player position against the supposed speed.

    Players don't send their speeds. They just send the positions they want to be at.
  7. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    I know it only checks last and actual player position

Share This Page

Advertisement