Created
May 17, 2013 02:28
-
-
Save zhuowei/5596536 to your computer and use it in GitHub Desktop.
Tap obsidian to teleport to Nether world on PocketMine
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
__PocketMine Plugin__ | |
name=NetherQuick | |
description=Tap on obsidian to go to the second world loaded or to the default world if already in second world | |
version=1.0 | |
author=zhuowei | |
class=NetherQuick | |
apiversion=7 | |
*/ | |
/* | |
Small Changelog | |
=============== | |
1.0: Initial release | |
*/ | |
class NetherQuick implements Plugin{ | |
private $api; | |
public function __construct(ServerAPI $api, $server = false){ | |
$this->api = $api; | |
} | |
public function init(){ | |
$this->api->addHandler("player.block.touch", array($this, "touchHandler"), 15); | |
} | |
public function touchHandler($data, $event) { | |
$dataTarget = $data["target"]; | |
if ($dataTarget->getID() === OBSIDIAN) { | |
if ($data["player"]->level !== $this->api->level->getDefault()) { | |
$data["player"]->teleport($this->api->level->getDefault()->getSpawn()); | |
} else { | |
$data["player"]->teleport($this->api->level->get("nether")->getSpawn()); | |
} | |
return false; | |
} | |
return true; | |
} | |
public function __destruct(){ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment