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

help with plugin

Comments in 'Plugin Development' started by minecraft090, Apr 21, 2015.

  1. minecraft090
    Offline

    minecraft090 New Member

    Joined:
    Oct 31, 2014
    Posts:
    9
    Minecraft User:
    minecraft090
    If player stay on block (46) its block rebuild to id 0
    Sorry for bad english
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Somewhere in main class onEnable(): $this->getServer()->getScheduler()->scheduleRepeatingTask(new CheckBlockTask($this), 5);
    PHP:
    namespace your\own\name\space;
    use 
    pocketmine\block\Block;
    use 
    pocketmine\scheduler\PluginTask;
    class 
    CheckBlockTask extends PluginTask{
      public function 
    onRun($t){
        foreach(
    $this->getOwner()->getServer()->getOnlinePlayers() as $p){
          if(
    $p->getLevel()->getBlock($v3 $p->floor()->subtract(01))->getId() === 46){
            
    $p->getLevel()->setBlock($v3Block::get(0));
          }
        }
      }
    }
  3. minecraft090
    Offline

    minecraft090 New Member

    Joined:
    Oct 31, 2014
    Posts:
    9
    Minecraft User:
    minecraft090
    Crush in public function onRun($t){
  4. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    OK. Check $player->isOnline() first inside the foreach loop.

Share This Page

Advertisement