本文整理汇总了PHP中pocketmine\event\player\PlayerMoveEvent::setCancelled方法的典型用法代码示例。如果您正苦于以下问题:PHP PlayerMoveEvent::setCancelled方法的具体用法?PHP PlayerMoveEvent::setCancelled怎么用?PHP PlayerMoveEvent::setCancelled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocketmine\event\player\PlayerMoveEvent
的用法示例。
在下文中一共展示了PlayerMoveEvent::setCancelled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onMove
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);
}
}
示例2: onMove
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!");
}
}
示例3: onPlayerMove
/**
* 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);
}
}
示例4: onPlayerMove
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;
}
}
示例5: onPlayerMove
/**
* @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;
}
}
}
示例6: onMove
public function onMove(PlayerMoveEvent $event)
{
if (isset($this->move[$event->getPlayer()->getName()])) {
unset($this->move[$event->getPlayer()->getName()]);
return;
}
if ($event->getFrom()->distance($event->getTo()) > 7) {
$event->setCancelled();
}
}
示例7: onMove
public function onMove(PlayerMoveEvent $ev)
{
if ($ev->isCancelled()) {
return;
}
if ($this->checkMove($ev->getTo())) {
$ev->setCancelled();
}
return;
}
示例8: onPlayerMove
/**
* 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);
}
}
}
示例9: onPlayerMove
public function onPlayerMove(PlayerMoveEvent $event)
{
if (isset($this->activeZones[$event->getPlayer()->getLevel()->getId()])) {
foreach ($this->activeZones[$event->getPlayer()->getLevel()->getId()] as $zone) {
if ($this->isInsideZone($event->getTo(), $zone[0], $zone[1])) {
$event->setCancelled();
$event->getPlayer()->sendMessage("You can't go in there, a mine is resetting.");
return;
}
}
}
}
示例10: onMove
/**
* Handle player move events.
* @param PlayerMoveEvent $ev - Move event
*/
public function onMove(PlayerMoveEvent $ev)
{
//echo __METHOD__.",".__LINE__."\n";//##DEBUG
if ($ev->isCancelled()) {
return;
}
$p = $ev->getPlayer();
if (!$this->getState("fz", $p, false)) {
return;
}
if ($this->hard) {
$ev->setCancelled();
} else {
// Lock position but still allow to turn around
$to = clone $ev->getFrom();
$to->yaw = $ev->getTo()->yaw;
$to->pitch = $ev->getTo()->pitch;
$ev->setTo($to);
}
}
示例11: onMove
public function onMove(PlayerMoveEvent $event)
{
if (isset($this->standbyAuth[strtolower($event->getPlayer()->getName())])) {
$event->setCancelled();
$event->getPlayer()->onGround = true;
$event->getPlayer()->teleport($event->getPlayer()->getLevel()->getSafeSpawn($event->getPlayer()->getPosition()));
$this->standbyAuthenticatePlayer($event->getPlayer());
}
if (isset($this->needAuth[strtolower($event->getPlayer()->getName())])) {
$event->setCancelled();
$event->getPlayer()->onGround = true;
$event->getPlayer()->teleport($event->getPlayer()->getLevel()->getSafeSpawn($event->getPlayer()->getPosition()));
$this->deauthenticatePlayer($event->getPlayer());
}
}
示例12: onPlayerMove
public function onPlayerMove(PlayerMoveEvent $event)
{
if (!$this->plugin->getConfig()->getAll()["allow-move"]) {
if (!ServerAuth::getAPI()->isPlayerRegistered($event->getPlayer()->getName()) || !ServerAuth::getAPI()->isPlayerAuthenticated($event->getPlayer())) {
$event->setCancelled(true);
}
}
}
示例13: onMove
public function onMove(PlayerMoveEvent $event)
{
$player = $event->getPlayer()->getName();
if (in_array($player, $this->freezed)) {
$event->setCancelled();
$event->getPlayer()->sendMessage("[PunishPE] You are freezed and you cannot move.");
}
}
示例14: onMove
public function onMove(PlayerMoveEvent $e)
{
$p = $e->getPlayer();
if ($this->inArena($p) && $this->game === 0 && (floor($e->getFrom()->x) !== floor($e->getTo()->x) || floor($e->getFrom()->z) !== floor($e->getTo()->z))) {
$e->setCancelled();
return;
}
if ($this->game > 1) {
$e->getHandlers()->unregister($this);
}
}
示例15: onPlayerMove
public function onPlayerMove(PlayerMoveEvent $event)
{
$player = $event->getPlayer();
if (!$this->isLogin($player)) {
$this->db->alert($player, $this->db->get("to-login"));
$event->setCancelled();
if (!$this->isRegister($player)) {
$this->db->alert($player, $this->db->get("command-register-help"));
return true;
} else {
$this->db->alert($player, $this->db->get("command-login-help"));
return true;
}
return true;
}
}