Created
June 27, 2019 23:20
-
-
Save PJZ9n/4ad7566aa27175017f4bdb9b476460d2 to your computer and use it in GitHub Desktop.
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 | |
/** | |
* @name PacketShow | |
* @main PJZ9n\PacketShow\Main | |
* @version 1.0.0 | |
* @api 3.0.0 | |
* @author PJZ9n | |
*/ | |
namespace PJZ9n\PacketShow { | |
use metowa1227\MoneySystemLand\MoneySystemLand; | |
use pocketmine\event\Listener; | |
use pocketmine\event\server\DataPacketReceiveEvent; | |
use pocketmine\network\mcpe\protocol\ItemFrameDropItemPacket; | |
use pocketmine\plugin\PluginBase; | |
class Main extends PluginBase implements Listener | |
{ | |
/** @var MoneySystemLand */ | |
private $land = null; | |
public function onEnable(): void | |
{ | |
$this->land = $this->getServer()->getPluginManager()->getPlugin("MoneySystemLand"); | |
$this->getServer()->getPluginManager()->registerEvents($this, $this); | |
} | |
public function onReceive(DataPacketReceiveEvent $event): void | |
{ | |
$player = $event->getPlayer(); | |
$packet = $event->getPacket(); | |
if (!$packet instanceof ItemFrameDropItemPacket) { | |
return; | |
} | |
$protected = $this->land->db->isProtected($packet->x, $packet->z, $player->getLevel(), $player); | |
if (!$protected) { | |
//保護されていない | |
return; | |
} | |
if ($protected) { | |
//保護されているが、編集権限はある | |
return; | |
} | |
//編集権限無し | |
$event->setCancelled(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment