From 71492bfd51d0a5b227a32024bafa3e851f1a22df Mon Sep 17 00:00:00 2001 From: Falkirks Date: Sat, 16 Aug 2014 10:54:24 -0700 Subject: [PATCH] 1.2 * Blocked block breaking. --- plugin.yml | 2 +- src/icontrolu/iControlU.php | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/plugin.yml b/plugin.yml index f70fd48..75e8e96 100644 --- a/plugin.yml +++ b/plugin.yml @@ -1,6 +1,6 @@ name: iControlU main: icontrolu\iControlU -version: 1.1 +version: 1.2 author: Falk api: [1.0.0] load: POSTWORLD diff --git a/src/icontrolu/iControlU.php b/src/icontrolu/iControlU.php index d48b87b..d4e6bc3 100644 --- a/src/icontrolu/iControlU.php +++ b/src/icontrolu/iControlU.php @@ -4,6 +4,8 @@ use pocketmine\command\Command; use pocketmine\command\CommandExecutor; use pocketmine\command\CommandSender; +use pocketmine\event\block\BlockBreakEvent; +use pocketmine\event\block\BlockPlaceEvent; use pocketmine\event\entity\EntityMoveEvent; use pocketmine\event\inventory\InventoryPickupItemEvent; use pocketmine\event\Listener; @@ -115,6 +117,16 @@ public function onItemPickup(InventoryPickupItemEvent $event){ } } } + public function onBreak(BlockBreakEvent $event){ + if($this->isBarred($event->getPlayer())){ + $event->setCancelled(); + } + } + public function onPlace(BlockPlaceEvent $event){ + if($this->isBarred($event->getPlayer())){ + $event->setCancelled(); + } + } public function onQuit(PlayerQuitEvent $event){ if($this->isControl($event->getPlayer())){ unset($this->b[$this->s[$event->getPlayer()->getName()]->getTarget()->getName()]); @@ -127,6 +139,8 @@ public function onQuit(PlayerQuitEvent $event){ foreach($this->getServer()->getOnlinePlayers() as $online){ $online->showPlayer($i->getControl()); } + //$i->getControl()->showPlayer($i->getTarget()); + unset($this->b[$event->getPlayer()->getName()]); unset($this->s[$i->getControl()->getName()]); break;