本文整理汇总了PHP中pocketmine\Player::kick方法的典型用法代码示例。如果您正苦于以下问题:PHP Player::kick方法的具体用法?PHP Player::kick怎么用?PHP Player::kick使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocketmine\Player
的用法示例。
在下文中一共展示了Player::kick方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onRun
/**
* @param int $currentTick
*/
public function onRun($currentTick)
{
$this->getPlugin()->getServer()->getLogger()->debug(TextFormat::YELLOW . "Running EssentialsPE's AFKKickTask");
if ($this->getPlugin()->isAFK($this->player) && !$this->player->hasPermission("essentials.afk.kickexempt") && time() - $this->getPlugin()->getLastPlayerMovement($this->player) >= $this->getPlugin()->getConfig()->getNested("afk.auto-set")) {
$this->player->kick("You have been kicked for idling more than " . (($time = floor($this->getPlugin()->getConfig()->getNested("afk.auto-kick"))) / 60 >= 1 ? $time / 60 . " minutes" : $time . " seconds"), false);
}
}
示例2: checkMessage
/**
* checks message for any flooding
*
* @param Player $player
*/
public function checkMessage(Player $player)
{
if ($this->isSpamming() && !$player->isOp()) {
if (!isset($this->spams[$player->getName()]) && !$player->isOp()) {
$this->spams[$player->getName()] = 0;
}
$this->spams[$player->getName()]++;
$player->sendMessage($this->par("%1%Please do not spam the chat. Warnings: " . $this->spams[$player->getName()] . ".%nl%%2%* If your warnings are 3 you will be kicked.", color::RED, color::AQUA));
$this->ev->setCancelled();
if ($this->spams[$player->getName()] === 3) {
$this->getServer()->broadcastMessage($this->par("%1%[Server] kicked %2%. Reason: spamming the chat.", color::RED, $player->getName()));
$player->kick($this->par("%1%%nl%Spamming the chat.", color::RED));
unset($this->spams[$player->getName()]);
}
} else {
$this->time = time();
}
}
示例3: alreadyLogined
public function alreadyLogined(Player $player)
{
$player->kick($this->plugin->get("already-connected"));
}
示例4: Kick
public function Kick(Player $player)
{
$player->kick("You're not allowed to use this username.");
}
示例5: KickExecute
public function KickExecute(Player $target)
{
if (!$target->closed) {
$target->kick();
}
}
示例6: redirect_run
public function redirect_run(Player $player, $warpname)
{
$warpname = strtolower($warpname);
// chucked in to enable me to deal with an emergencey
if ($this->cfg["autokickall"]) {
$player->kick($this->cfg["autokickall_msg"]);
return;
}
// get server details from config
$targetwarp = $this->getWarpRealName($warpname);
if ($targetwarp === false) {
$player->sendMessage(TextFormat::RED . "[Error] Warp doesn't exist");
return false;
}
if ($this->cfg["warps"]["this_server_name"] == $targetwarp) {
$player->sendMessage(TextFormat::RED . "[Error] You are already in this world");
return false;
}
// Get connection details
$hostname = $this->cfg["warps"][$targetwarp]["hostname"];
$port = $this->cfg["warps"][$targetwarp]["port"];
// Update db
$this->db->db_setUserLocation($player, $targetwarp);
// skip past the actual transfer if disabled - just go to the part where
// player is disconnected
if ($this->cfg["warps"]["prevent-actual-transfer"]) {
$player->kick("To go to this world please connect to {$hostname} {$port}");
return;
}
// TODO ping/query target to check online
$ft_plugin = $this->getServer()->getPluginManager()->getPlugin("FastTransfer");
if ($ft_plugin === null) {
Server::getInstance()->getLogger()->critical(Main::PREFIX . "Could not find FastTransfer plugin");
}
$ft_plugin->transferPlayer($player, $hostname, $port, "Connecting you to " . $warpname);
$this->forcePlayerDisconnect($player);
}
示例7: Kick
public function Kick(Player $player)
{
$player->kick("게임모드 변경");
}
示例8: onRun
public function onRun($currentTick)
{
if (!$this->listener->isLogin($this->player)) {
$this->player->kick($this->db->get("timeout"));
}
}