mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-16 18:59:00 +00:00
Fixed teleport command with a single target not teleporting correctly
This commit is contained in:
parent
2302a37311
commit
03b1385f26
@ -1970,7 +1970,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
||||
public function kick($reason = ""){
|
||||
$this->server->getPluginManager()->callEvent($ev = new PlayerKickEvent($this, $reason, "Kicked player " . $this->username . "." . ($reason !== "" ? " With reason: $reason" : "")));
|
||||
if(!$ev->isCancelled()){
|
||||
$message = TextFormat::BOLD . "You have been kicked." . ($reason !== "" ? TextFormat::RESET."\nReason: $reason" : "");
|
||||
$message = $reason !== "" ? $reason : "Kicked from server";
|
||||
$this->sendMessage($message);
|
||||
$this->close($ev->getQuitMessage(), $message);
|
||||
|
||||
@ -2044,7 +2044,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
||||
}
|
||||
$this->server->getPluginManager()->unsubscribeFromPermission(Server::BROADCAST_CHANNEL_USERS, $this);
|
||||
$this->spawned = false;
|
||||
$this->server->getLogger()->info(TextFormat::AQUA . $this->username . TextFormat::WHITE . "[/" . $this->ip . ":" . $this->port . "] logged out due to " . $reason);
|
||||
$this->server->getLogger()->info(TextFormat::AQUA . $this->username . TextFormat::WHITE . "[/" . $this->ip . ":" . $this->port . "] logged out due to " . str_replace(["\n", "\r"], [" ", ""], $reason));
|
||||
$this->windows = new \SplObjectStorage();
|
||||
$this->windowIndex = [];
|
||||
$this->usedChunks = [];
|
||||
|
@ -58,14 +58,19 @@ class TeleportCommand extends VanillaCommand{
|
||||
$target = $sender;
|
||||
}else{
|
||||
$sender->sendMessage(TextFormat::RED . "Please provide a player!");
|
||||
|
||||
return true;
|
||||
}
|
||||
if(count($args) === 1){
|
||||
$target = $sender->getServer()->getPlayer($args[0]);
|
||||
if($target === null){
|
||||
$sender->sendMessage(TextFormat::RED . "Can't find player " . $args[0]);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$target = $sender->getServer()->getPlayer($args[0]);
|
||||
if($target === null){
|
||||
$sender->sendMessage(TextFormat::RED . "Can't find player " . $args[0]);
|
||||
|
||||
return true;
|
||||
}
|
||||
if(count($args) === 2){
|
||||
@ -73,7 +78,6 @@ class TeleportCommand extends VanillaCommand{
|
||||
$target = $sender->getServer()->getPlayer($args[1]);
|
||||
if($target === null){
|
||||
$sender->sendMessage(TextFormat::RED . "Can't find player " . $args[1]);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user