mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-25 21:04:06 +00:00
Player: drop isAdmin from kick(), closes #3275
This commit is contained in:
parent
67247b2e81
commit
5a33dbd4c6
@ -81,7 +81,7 @@ class BanIpCommand extends VanillaCommand{
|
||||
|
||||
foreach($sender->getServer()->getOnlinePlayers() as $player){
|
||||
if($player->getNetworkSession()->getIp() === $ip){
|
||||
$player->kick($reason !== "" ? $reason : "IP banned.");
|
||||
$player->kick("Banned by admin. Reason: " . ($reason !== "" ? $reason : "IP banned."));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ class KickCommand extends VanillaCommand{
|
||||
$reason = trim(implode(" ", $args));
|
||||
|
||||
if(($player = $sender->getServer()->getPlayer($name)) instanceof Player){
|
||||
$player->kick($reason);
|
||||
$player->kick("Kicked by admin." . ($reason !== "" ? "Reason: " . $reason : ""));
|
||||
if($reason !== ""){
|
||||
Command::broadcastCommandMessage($sender, new TranslationContainer("commands.kick.success.reason", [$player->getName(), $reason]));
|
||||
}else{
|
||||
|
@ -1909,22 +1909,15 @@ class Player extends Human implements CommandSender, ChunkLoader, ChunkListener,
|
||||
*
|
||||
* @param TranslationContainer|string $quitMessage
|
||||
*/
|
||||
public function kick(string $reason = "", bool $isAdmin = true, $quitMessage = null) : bool{
|
||||
public function kick(string $reason = "", $quitMessage = null) : bool{
|
||||
$ev = new PlayerKickEvent($this, $reason, $quitMessage ?? $this->getLeaveMessage());
|
||||
$ev->call();
|
||||
if(!$ev->isCancelled()){
|
||||
$reason = $ev->getReason();
|
||||
$message = $reason;
|
||||
if($isAdmin){
|
||||
if(!$this->isBanned()){
|
||||
$message = "Kicked by admin." . ($reason !== "" ? " Reason: " . $reason : "");
|
||||
}
|
||||
}else{
|
||||
if($reason === ""){
|
||||
$message = "disconnectionScreen.noReason";
|
||||
}
|
||||
if($reason === ""){
|
||||
$reason = "disconnectionScreen.noReason";
|
||||
}
|
||||
$this->disconnect($message, $ev->getQuitMessage());
|
||||
$this->disconnect($reason, $ev->getQuitMessage());
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -1936,8 +1929,8 @@ class Player extends Human implements CommandSender, ChunkLoader, ChunkListener,
|
||||
* Removes the player from the server. This cannot be cancelled.
|
||||
* This is used for remote disconnects and for uninterruptible disconnects (for example, when the server shuts down).
|
||||
*
|
||||
* Note for plugin developers: Prefer kick() with the isAdmin flag set to kick without the "Kicked by admin" part
|
||||
* instead of this method. This way other plugins can have a say in whether the player is removed or not.
|
||||
* Note for plugin developers: Prefer kick() instead of this method.
|
||||
* That way other plugins can have a say in whether the player is removed or not.
|
||||
*
|
||||
* @param string $reason Shown to the player, usually this will appear on their disconnect screen.
|
||||
* @param TranslationContainer|string $quitMessage Message to broadcast to online players (null will use default)
|
||||
|
Loading…
x
Reference in New Issue
Block a user