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

Solved Commands on Block Walking

Comments in 'Plugin Development' started by HotFireyDeath, May 18, 2015.

  1. CD123XD
    Offline

    CD123XD New Member

    Joined:
    Jul 12, 2014
    Posts:
    13
    Minecraft User:
    RinsibleRocket4
    Is there a code for speed boost on a diamond block?
  2. TigerHix
    Offline

    TigerHix Active Member

    Joined:
    May 11, 2015
    Posts:
    61
    Minecraft User:
    TigerHix
    I already provide code for having an action on player when they are walking on an emerald block. Simply change the code to fit you need and you will be good to go. After all I consider you have the basic abilities of coding upon visiting this forum.
  3. CD123XD
    Offline

    CD123XD New Member

    Joined:
    Jul 12, 2014
    Posts:
    13
    Minecraft User:
    RinsibleRocket4
    Ok ill do that
  4. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    Crash?:
    Code:
    Error: syntax error, unexpected '->' (T_OBJECT_OPERATOR)
    File: /PlayerBooster/src/legoboy/booster/MovementDetectionTask
    Line: 9
    Type: E_PARSE
    
    THIS CRASH WAS CAUSED BY A PLUGIN
    BAD PLUGIN: PlayerBooster v1.0.0
    
    Code:
    [1] <?php
    [2]
    [3] namespace legoboy\booster;
    [4]
    [5] use pocketmine\plugin\PluginTask;
    [6]
    [7] class MovementDetectionTask extends PluginTask{
    [8]    public function onRun($currentTick) {
    [9]     if (somePlayer->getLevel()->getBlock(somePlayer->getLocation())->getSide(Vector3::SIDE_DOWN)->getId() === Block::EMERALD_BLOCK) {
    [10]         // Do something...
    [11]     }
    [12] }
    [13]
    [14]
    [15]
    [16]
    [17]
    [18]
    [19]
    
    Backtrace:
    #0 /src/pocketmine/Server(0): pocketmine\Server->crashDump()
    #1 /src/pocketmine/plugin/PluginBase(7): BaseClassLoader->loadClass()
    #2 /src/pocketmine/plugin/PluginBase(7): spl_autoload_call()
    #3 /src/pocketmine/plugin/PluginBase(86): legoboy\booster\Main->onEnable()
    #4 /DevTools_v1.10.0.phar/src/FolderPluginLoader/FolderPluginLoader(125): pocketmine\plugin\PluginBase->setEnabled()
    #5 /src/pocketmine/plugin/PluginManager(559): FolderPluginLoader\FolderPluginLoader->enablePlugin()
    #6 /src/pocketmine/Server(1847): pocketmine\plugin\PluginManager->enablePlugin()
    #7 /src/pocketmine/Server(1833): pocketmine\Server->enablePlugin()
    #8 /src/pocketmine/Server(1759): pocketmine\Server->enablePlugins()
    #9 /src/pocketmine/PocketMine(437): pocketmine\Server->__construct()
    #10 (1): ()
    #11 (0): {main}()
    
    Main.php:
    PHP:
    <?php
    namespace legoboy\booster;
    use 
    pocketmine\block\Block;
    use 
    pocketmine\plugin\PluginBase;
    class 
    Main extends PluginBase{
      public function 
    onEnable(){
        
    $this->getServer()->getScheduler()->scheduleDelayedRepeatingTask(new MovementDetectionTask($this), 2020); //This task will have a 20-tick delay and a 20-tick repeat interval.  }
    }
    }
    MovementDetectionTask.php:
    PHP:
    <?php

    namespace legoboy\booster;

    use 
    pocketmine\plugin\PluginTask;

    class 
    MovementDetectionTask extends PluginTask{
       public function 
    onRun($currentTick) {
        if (
    somePlayer->getLevel()->getBlock(somePlayer->getLocation())->getSide(Vector3::SIDE_DOWN)->getId() === Block::EMERALD_BLOCK) {
            
    // Do not care what is here yet...
        
    }
    }
  5. TigerHix
    Offline

    TigerHix Active Member

    Joined:
    May 11, 2015
    Posts:
    61
    Minecraft User:
    TigerHix
    *facepalm* Replace somePlayer with your own player instance! You may want to create a new argument in the constructor of MovementDetectionTask.
  6. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    Thanks...
    Why does everyone like "*facepalm*"?
  7. CD123XD
    Offline

    CD123XD New Member

    Joined:
    Jul 12, 2014
    Posts:
    13
    Minecraft User:
    RinsibleRocket4
    im kind of stuck on this...
  8. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Because this is the plugin development forum not the plugin request forum! We are teaching you how to code not to give code for you! Understand the code and write them yourself! If you don't understand, don't use! Or do you think that programming is merely putting lines together and you recite those lines?
    TigerHix likes this.
  9. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    Nope... Ok, I will try to not get any "facepalms" any more.

Share This Page

Advertisement