作者:jjplayin
项目:HotBloc
public function onPlayerMove(PlayerMoveEvent $event)
{
$player = $event->getPlayer();
$world = $player->getLevel();
$block = $world->getBlock($player->floor()->subtract(0, 1));
if ($world->getName() == $this->getHotBlock()->getConfig()->get("world")) {
switch ($block->getId()) {
case Block::PLANKS:
$player->sendTip("§aYou're safe!");
break;
case Block::END_STONE:
$player->sendTip("§eGo!");
break;
case Block::NETHERRACK:
$player->sendTip("§cYou'll poisoned!");
$effect = Effect::getEffect(Effect::POISON);
$effect->setVisible(true);
$effect->setDuration(50);
$player->addEffect($effect);
break;
case Block::QUARTZ_BLOCK:
if (count($world->getPlayers()) < $this->getHotBlock()->getConfig()->get("players")) {
$player->sendTip("§cThere must be " . $this->getHotBlock()->getConfig()->get("players") . "players online");
} else {
$player->sendTip("§eYou're standing on the §l§cHot§6Block§r§e! §bMove!");
$this->getHotBlock()->getEconomy()->addMoney($player, 1, false, "HotBlock");
$player->sendPopup("§eYou have §a" . $this->getHotBlock()->getEconomy()->myMoney($player) . " §bCoins");
}
break;
}
}
}
作者:iJoshuaH
项目:PlayHarde
public function onPlayerMoveEvent(PlayerMoveEvent $event)
{
$player = $event->getPlayer();
if ($player->isSpectator()) {
return;
}
$attribute = AttributeProvider::getInstance()->getAttribute($player);
if ($attribute->getCTick() <= 20) {
$attribute->setCTick($attribute->getCTick() + 1);
}
if ($attribute->getCTick() > 20) {
$attribute->setCTick(0);
}
foreach ($player->getLevel()->getNearbyEntities($player->getBoundingBox()->grow(1, 0.5, 1), $player) as $entity) {
if (!$entity->isAlive()) {
continue;
}
if (!$entity instanceof ExperienceOrb) {
continue;
}
$pk = new TakeItemEntityPacket();
$pk->eid = $player->getId();
$pk->target = $entity->getId();
Server::broadcastPacket($entity->getViewers(), $pk);
$pk = new TakeItemEntityPacket();
$pk->eid = 0;
$pk->target = $player->getId();
$player->dataPacket($pk);
$entity->kill();
$attribute->addExp($entity->getExp());
}
if ($player->isSprinting()) {
if ($attribute->getCTick() == 20) {
HungerSystem::exhaustion($player, HungerSystem::SPRINTING);
}
} else {
if ($player->isSneaking()) {
if ($attribute->getCTick() == 20) {
HungerSystem::exhaustion($player, HungerSystem::WALKING_AND_SNEAKING);
}
}
}
if ($player->isInsideOfWater()) {
if ($attribute->getCTick() == 20) {
HungerSystem::exhaustion($player, HungerSystem::SWIMMING);
}
}
}
作者:tankisu0
项目:AdminFu
public function onMove(PlayerMoveEvent $event)
{
if ($this->getPlugin()->isFrozen($event->getPlayer())) {
$event->setCancelled(true);
$event->getPlayer()->sendTip("§cI'm sorry that you cannot move,\n§cbut you are frozen!");
}
}
作者:ZINGDIN
项目:GiveCooki
public function onPlayerMove(PlayerMoveEvent $event)
{
$player = $event->getPlayer();
if ($player == null) {
return;
}
if ($player->getLevel() == null) {
return;
}
// under
$x = (int) round($player->x - 0.5);
$y = (int) round($player->y - 1);
$z = (int) round($player->z - 0.5);
$id = $player->getLevel()->getBlockIdAt($x, $y, $z);
$data = $player->getLevel()->getBlockDataAt($x, $y, $z);
switch ($id) {
case 35:
if ($data == 1) {
$player->getInventory()->addItem(new Item(ITEM::COOKIE, 0, 1));
$player->sendPopup(TextFormat::GRAY . "GiveCookie:\n" . TextFormat::YELLOW . "> " . TextFormat::GREEN . "You've received a cookie!");
}
break;
default:
break;
}
}
作者:robozer
项目:S
public function onPlayerMove(PlayerMoveEvent $event)
{
$player = $event->getPlayer();
if ($player instanceof Player) {
if ($player->getLevel()->getName() === $this->plugin->vipLevelName) {
if (isset($this->plugin->statueManager->npcsSpawns[$player->getName()])) {
return;
}
foreach ($this->plugin->statueManager->npcs as $xnpc) {
if ($xnpc instanceof StatueModel) {
if ($player->getLevel()->getName() === $xnpc->levelName) {
$statuePos = $xnpc->position;
$pp = new Vector2(round($player->x), round($player->z));
$npc = new Vector2($statuePos->x, $statuePos->z);
$dff = abs(round($pp->distance($npc)));
if ($dff < 12 || $dff == 0) {
$builder = new StatueBuilder($this->plugin);
$builder->displayStatues($player, $this->plugin->statueManager->npcs);
$this->plugin->statueManager->npcsSpawns[$player->getName()] = $player->getName();
}
}
}
}
}
}
}
作者:mwven
项目:WattzMCPE-MyPlo
public function onPlayerMove(PlayerMoveEvent $event)
{
$player = $event->getPlayer();
$pname = strtolower($player->getName());
$levelName = $player->getLevel()->getName();
$players_in_tracker = isset($this->playerLocationTracker[$pname]);
if (!$this->plugin->isLevelLoaded($levelName)) {
if ($players_in_tracker) {
unset($this->playerLocationTracker[$pname]);
}
return;
}
$plot = $this->plugin->getPlotByPosition($player->getPosition());
// if users not in a plot make sure unset
if (is_null($plot) && $players_in_tracker) {
unset($this->playerLocationTracker[$pname]);
return;
}
if (is_null($plot)) {
return;
}
// if user was not previously tracked then save pos and return
if (!$players_in_tracker && !is_null($plot)) {
$this->playerLocationTracker[$pname] = $plot;
$this->plugin->getServer()->dispatchCommand($player, "p info summary");
return;
}
// if user has moved
if ($plot->X != $this->playerLocationTracker[$pname]->X || $plot->Z != $this->playerLocationTracker[$pname]->Z) {
$this->playerLocationTracker[$pname] = $plot;
$this->plugin->getServer()->dispatchCommand($player, "p info summary");
return;
}
}
作者:Evarettedavi
项目:PocketMine-Plugin
/**
* @param PlayerMoveEvent $event
*/
public function onPlayerMove(PlayerMoveEvent $event)
{
if (!$event->isCancelled()) {
if ($this->getPlugin()->isRocketPad($event->getPlayer()->getLevel()->getBlock($event->getPlayer()->subtract(0, 1, 0)))) {
$this->getPlugin()->launchPlayer($event->getPlayer());
}
}
}
作者:Vavaball
项目:BallzAut
/**
* When the player move while
* he is not logged in, cancel
* the event
* @param PlayerMoveEvent $event
*/
public function onPlayerMove(PlayerMoveEvent $event)
{
$player = $event->getPlayer();
if (!User::exist($player->getName()) || User::exist($player->getName()) && !User::get($player->getName())->isLogged()) {
$event->setCancelled(true);
$player->sendMessage($this->needLogin);
}
}
作者:0-Eclipse-
项目:PurePerm
public function onPlayerMove(PlayerMoveEvent $event)
{
if (!$this->plugin->getNoeulAPI()->isAuthed($event->getPlayer())) {
$this->plugin->getNoeulAPI()->sendAuthMsg($event->getPlayer());
$event->setCancelled(true);
$event->getPlayer()->onGround = true;
}
}
作者:Jackboy32
项目:xAut
public function onMove(PlayerMoveEvent $event)
{
if ($this->plugin->status === "enabled" && $this->plugin->loginmanager[$event->getPlayer()->getId()] === 0 && $this->plugin->allowMoving !== true) {
$event->setCancelled(true);
} elseif ($this->plugin->safemode === true and $this->plugin->status !== "enabled") {
$event->setCancelled(true);
}
}
作者:wodnr080
项目:NP
public function onMoveEvent(PlayerMoveEvent $event)
{
$player = $event->getPlayer();
foreach ($this->npc as $npc) {
if ($npc->getLevel()->getFolderName() === $event->getPlayer()->getLevel()->getFolderName()) {
$npc->seePlayer($player);
}
}
}
作者:somenabzofturtle
项目:Small-PM-Plugin
public function onMove(PlayerMoveEvent $event)
{
$player = $event->getPlayer();
$from = $event->getFrom();
$to = $event->getTo();
if ($from->getLevel()->getBlockIdAt($from->x, $from->y - 1, $from->z) === Block::REDSTONE_BLOCK) {
$player->setMotion((new Vector3($to->x - $from->x, $to->y - $from->y, $to->z - $from->z))->multiply(5));
}
}
作者:jigibbs12
项目:pocketmine-plugin
/**
* @param PlayerMoveEvent $event
*
* @priority LOWEST
*/
public function onPlayerMove(PlayerMoveEvent $event)
{
if (!$this->auth->isPlayerAuthenticated($event->getPlayer())) {
if (!$event->getPlayer()->hasPermission("simpleauth.move")) {
$event->setCancelled(true);
$event->getPlayer()->onGround = true;
}
}
}
作者:EmreTr
项目:rt
public function onMove(PlayerMoveEvent $event)
{
$player = $event->getPlayer();
if ($this->past_q[$player->getName()] != $player->yaw . ":" . $player->pitch) {
$this->past_q[$player->getName()] = $player->yaw . ":" . $player->pitch;
return;
}
$this->checkMove($player, round(microtime(true) * 1000));
$this->past_q[$player->getName()] = $player->yaw . ":" . $player->pitch;
}
作者:Skull3
项目:FootBloc
public function onPlayerMove(PlayerMoveEvent $event)
{
$player = $event->getPlayer();
$level = $player->getLevel();
$block = Block::get($player->getInventory()->getItemInHand()->getId(), 0);
$pos = new Vector3($player->getFloorX(), $player->getFloorY() - 1, $player->getFloorZ());
if ($this->isPlayer($player)) {
$level->setBlock($pos, $block);
}
}
作者:DWW
项目:pocketmine-plugin
public function onMove(PlayerMoveEvent $ev)
{
if ($ev->isCancelled()) {
return;
}
if ($this->checkMove($ev->getTo())) {
$ev->setCancelled();
}
return;
}
作者:TuffDe
项目:HungerGame
/**
* Checks if the player is in an arena, and if the game hasn't started yet, stops that player from moving
* @param PlayerMoveEvent $event
*/
public function onPlayerMove(PlayerMoveEvent $event)
{
$arena = $this->arenaManager->getPlayerArena($event->getPlayer());
if ($arena != null) {
// if the player is in an arena
if (!$arena->inUse) {
//arena is not in use (match hasn't started)
$event->setCancelled(true);
}
}
}
作者:DWW
项目:pocketmine-plugin
/**
* @priority HIGHEST
*/
public function onMove(PlayerMoveEvent $e)
{
if ($e->isCancelled()) {
return;
}
$pl = $e->getPlayer();
if (!$this->owner->getState("Torch", $pl, null)) {
return;
}
$this->spawnTorch($pl);
}
作者:EmreTr
项目:TNTRu
public function onMove(PlayerMoveEvent $event)
{
foreach ($this->tntRun->arenas as $arena) {
if ($arena->getPlayerManager()->isPlaying($event->getPlayer()) && $arena->getStatusManager()->isRunning()) {
$p = $event->getPlayer();
$p->getServer()->getScheduler()->scheduleDelayedTask(new UnsetBlockTask($this->tntRun, $p->getLevel()->getBlock(new Vector3($p->getFloorX(), $p->getFloorY() - 1, $p->getFloorZ()))), 40);
if ($p->y < $arena->getStructureManager()->getLowestFloorY()) {
$arena->getPlayerHandler()->leavePlayer($p);
}
return;
}
}
}
作者:Rspud
项目:AreaEffect
public function onMove(PlayerMoveEvent $event)
{
if (isset($this->areas)) {
$player = $event->getPlayer();
if (empty($this->areas)) {
return;
}
foreach ($this->areas as $area) {
if ($this->isInArea($player, $area)) {
$this->giveEffect($player, $area);
}
}
}
}