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

KillBlock issues

Comments in 'Plugin Development' started by Deathcrow, Sep 2, 2015.

  1. Deathcrow
    Offline

    Deathcrow Active Member

    Joined:
    Aug 20, 2015
    Posts:
    61
    Minecraft User:
    Deathcrow
    Building a plugin called "KillBlock"
    Purpose:perform an action when user steps on block

    Edit:

    So i decided killing someone is a lil harsh so i changed the coding (luca28pet assisted in fixing thx :) ) so now the user should get thrown back a block or 2 now this isnt working also i would like t add the possibility for the block that has the effect to be change in config is thre some documentation i can read up on this i have searched thtough pocketmine and found nothing tht is up to date. if anyone can spread some wisdom i will be forever grateful :)

    <?php

    namespace KillBlock;


    use pocketmine\plugin\PluginBase;
    use pocketmine\event\Listener;
    use pocketmine\math\Vector3;
    use pocketmine\event\player\PlayerMoveEvent;

    class KillBlock extends PluginBase implements Listener{
    public function onLoad(){
    $this->getLogger()->info("KillBlock is loaded!");
    }
    public function onEnable(){
    $this->getLogger()->info("KillBlock is on!");
    $this->getServer()->getPluginManager()->registerEvents($this, $this);
    }

    public function onMove(PlayerMoveEvent $event){
    $player = $event->getPlayer();

    if($player->getLevel()->getBlock(new Vector3($player->getFloorX(), $player->getFloorY() - 1, $player->getFloorZ()))->getId() === 133){

    $issuer->teleport(new Vector3($player->x-10, $player->y + 2,$player->z));
    $issuer->sendMessage("You may not cross over these blocks");

    return true;

    }
    }
    }










    ?>
    Last edited: Sep 2, 2015
  2. MCPEPIG
    Offline

    MCPEPIG Notable Member

    Joined:
    Jun 22, 2014
    Posts:
    349
    Minecraft User:
    MCPEPIG
    ... Are you sure you know the PocketMine API?...
  3. Deathcrow
    Offline

    Deathcrow Active Member

    Joined:
    Aug 20, 2015
    Posts:
    61
    Minecraft User:
    Deathcrow
    Ive been reading all the tutorials i could find including the official documentation posted in the resources and i just kinda started putting things together from what i have read this should work?
  4. MCPEPIG
    Offline

    MCPEPIG Notable Member

    Joined:
    Jun 22, 2014
    Posts:
    349
    Minecraft User:
    MCPEPIG
    No it wouldn't, you didn't register events, forgot to implement Listener, and you combined onEnable and PlayerMoveEvent.
  5. Deathcrow
    Offline

    Deathcrow Active Member

    Joined:
    Aug 20, 2015
    Posts:
    61
    Minecraft User:
    Deathcrow
    Sorry ive been coding php for years but doing it with minecraft is an enirely new battle and thanks for helping out :)
  6. Deathcrow
    Offline

    Deathcrow Active Member

    Joined:
    Aug 20, 2015
    Posts:
    61
    Minecraft User:
    Deathcrow
    I updated this thread with more issues :p hope im not too much of a nuance
  7. MCPEPIG
    Offline

    MCPEPIG Notable Member

    Joined:
    Jun 22, 2014
    Posts:
    349
    Minecraft User:
    MCPEPIG
    Use $player->knockBack() instead :p
  8. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
    Depends on what @Deathcrow wants to do. It wasn't called KillBlock for nothing. :p
  9. MCPEPIG
    Offline

    MCPEPIG Notable Member

    Joined:
    Jun 22, 2014
    Posts:
    349
    Minecraft User:
    MCPEPIG
    He changed the killing to knocking back lel
  10. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
    He changed it? Where? o_O
  11. Deathcrow
    Offline

    Deathcrow Active Member

    Joined:
    Aug 20, 2015
    Posts:
    61
    Minecraft User:
    Deathcrow
    Thanks haha perhaps there should be documentation widely available for all predefined methods :p
  12. MCPEPIG
    Offline

    MCPEPIG Notable Member

    Joined:
    Jun 22, 2014
    Posts:
    349
    Minecraft User:
    MCPEPIG
    He edited the first post of this thread -_-
  13. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
    :eek:
  14. Deathcrow
    Offline

    Deathcrow Active Member

    Joined:
    Aug 20, 2015
    Posts:
    61
    Minecraft User:
    Deathcrow
    Sorry im a newbie not sure on the forum rules and honestly not sure what im making lol basically specialBlock but actually working no offence to the dev but its very poorly done its way too buggy and crashes a lot
  15. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
    Why not do the dev a favor and learn PHP and help them out with the code?
  16. Deathcrow
    Offline

    Deathcrow Active Member

    Joined:
    Aug 20, 2015
    Posts:
    61
    Minecraft User:
    Deathcrow
    Ive finished my webmasters certificate so ive had 3 classes of PHP so thats not really an issue using it for minecraft however has gotten me baffled the documentation helped a lil with the basics but leaves out a lot of key concepts like registering events and i dont see a lot of other documentation out there
  17. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
    Then learn the PocketMine API, I guess. ;)
    Deathcrow likes this.
  18. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    Coded on f**ing android -_-
  19. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
    Language...
  20. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    Can bother :p I dont see any rude word.

Share This Page

Advertisement