Last active
December 22, 2015 09:08
-
-
Save 99leonchang/6449449 to your computer and use it in GitHub Desktop.
Very simple plugin that kicks player when they touch doors.
Doors still open though.
This was done on request.
This file contains hidden or 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=DoorKick | |
description=Get's kicked if touches door | |
version=1.0 | |
author=99leonchang | |
class=DoorKick | |
apiversion=9,10,11 | |
*/ | |
class DoorKick implements Plugin{ | |
private $api; | |
public function __construct(ServerAPI $api, $server = false){ | |
$this->api = $api; | |
} | |
public function init(){ | |
$this->api->addHandler("player.interact", array($this, "touchHandler"), 100); | |
$this->api->addHandler("player.block.touch", array($this, "eventHandler"), 100); | |
} | |
public function touchHandler($data, $event) { | |
$dataTarget = $data["target"]; | |
if ($dataTarget->getID() === WOOD_DOOR_BLOCK) { | |
// $data->close("NO TOUCHING THE DOORS", false); | |
$player->close("Don't touch the door!"); | |
return false; | |
} | |
case "player.block.touch": | |
if($dataTarget->getID() === WOOD_DOOR_BLOCK) | |
{ | |
$player->close("Don't touch the door!"); | |
return false; | |
} | |
} | |
public function __destruct(){ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment