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

help with tnt run

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

  1. minecraft090
    Offline

    minecraft090 New Member

    Joined:
    Oct 31, 2014
    Posts:
    9
    Minecraft User:
    minecraft090
    Pls help import to 1.5
    Its code for 1.3

    class Main extends PluginBase implements Listener {

    public function tntcheck($data){
    $check = $this->config->get('TNTRun');
    $block = $data->level->getBlock(new Vector3($data->x, ($data->y -1), $data->z));
    if ($check == true){

    if($block->getID() == 46){

    $data->level->setBlock(new Vector3($data->x, $data->y-1, $data->z,$data->level), new AirBlock());
    }}
    else{}
    }

    public function __destruct(){
    }
    }
  2. Praxthisnovcht
    Offline

    Praxthisnovcht Notable Member Plugin Developer

    Joined:
    Mar 10, 2014
    Posts:
    701
    Plugins:
    4
    Minecraft User:
    PraxHellTag
    ?
    TonyDroidd likes this.
  3. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    I formatted the code in the quote to let others read more easily.
    So, in the formatted code:
    1. It is a better practice to use === rather than == on lines 06 and 08.
    2. `$a == true` can be replaced by `$a`.
    3. If this is all of your code, it does nothing because it isn't connected with the PocketMine API at all and PocketMine will not do anything for you.
    4. Line 13 is redundant and can be deleted.
    5. Line 16-17, an empty __destruct() is not necessary.
    Legoboy0215 likes this.
  4. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    I think even a person without knowledge of php, and knows english will find out what is a wrong
  5. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Why?

Share This Page

Advertisement