Advertisement
Guest User

Untitled

a guest
Jan 26th, 2014
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.09 KB | None | 0 0
  1. <?php
  2.  
  3. /*
  4. __PocketMine Plugin__
  5. name=Claymores
  6. description=When a player steps on a claymore, it explodes.
  7. version=1.0
  8. author=Darunia18
  9. class=Claymores
  10. apiversion=10,11
  11. */
  12.  
  13. class Claymores implements Plugin {
  14.     private $api;
  15.     private $claymore;
  16.     private $explosionSize;
  17.  
  18.     public function __construct(ServerAPI $api, $server = false) {
  19.         $this->api = $api;
  20.     }
  21.  
  22.     public function init() {
  23.         $this->config = new Config($this->api->plugin->configPath($this)."config.yml", CONFIG_YAML, array('ClaymoreBlock' => 44, 'ExplosionSize' => 5));
  24.         $this->api->event("entity.move", array($this, "entitymove"));
  25.         $this->claymore = $this->config->get('ClaymoreBlock');
  26.         $this->explosionSize = $this->config->get('ExplosionSize');
  27.     }
  28.  
  29.     public function entitymove($data){
  30.         $claymore = $data->level->getBlock(new Vector3($data->x, ($data->y -1), $data->z));
  31.         if($claymore->getID() == $this->claymore){
  32.             $explosion = new Explosion(new Position($data->x, ($data->y -1), $data->z, $data->level), $this->explosionSize);
  33.             $explosion->explode();
  34.         }
  35.     }
  36.  
  37.     public function __destruct(){
  38.     }
  39. }
  40. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement