Skip to content
This repository has been archived by the owner on Jul 11, 2018. It is now read-only.

Commit

Permalink
Closes #47
Browse files Browse the repository at this point in the history
  • Loading branch information
alejandroliu committed Apr 22, 2016
1 parent 34f55f1 commit 6d04348
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions WorldProtect/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ Returns an integer or null.

* 2.3.0: Updated to API 2.0.0
- Added banitem exempted permissions (@BobbyTowers)
- Closes #47 (@SleepSpace9)
* 2.2.0: minor Update
- Implemented banned commands (@Tolo)
- Documentation update
Expand Down
12 changes: 12 additions & 0 deletions WorldProtect/src/aliuly/worldprotect/BanItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

use pocketmine\event\player\PlayerInteractEvent;
use pocketmine\event\player\PlayerItemConsumeEvent;
use pocketmine\event\block\BlockPlaceEvent;
use pocketmine\item\Item;
use pocketmine\Player;
use aliuly\worldprotect\common\mc;
Expand Down Expand Up @@ -116,4 +117,15 @@ public function onConsume(PlayerItemConsumeEvent $ev) {
$pl->sendMessage(mc::_("You can not use that item here!"));
$ev->setCancelled();
}
public function onBlockPlace(BlockPlaceEvent $ev) {
if ($ev->isCancelled()) return;
$pl = $ev->getPlayer();
if ($pl->hasPermission("wp.banitem.exempt")) return;
$world = $pl->getLevel()->getName();
if (!isset($this->wcfg[$world])) return;
$item = $ev->getItem();
if (!isset($this->wcfg[$world][$item->getId()])) return;
$pl->sendMessage(mc::_("You can not use that item here!"));
$ev->setCancelled();
}
}

0 comments on commit 6d04348

Please sign in to comment.