1
0
mirror of https://github.com/pmmp/PocketMine-MP.git synced 2025-07-11 20:35:15 +00:00

Player: remove dead functions

these functions belong in the network session, and they are currently just proxies for them. In the future we might have players who don't have IPs at all depending on how they connected (for example Specter) so this stuff shouldn't be in here.
This commit is contained in:
Dylan K. Taylor 2019-05-08 19:47:25 +01:00
parent 4634baeb02
commit ca7c23c137
2 changed files with 2 additions and 28 deletions
src/pocketmine

@ -849,32 +849,6 @@ class Player extends Human implements CommandSender, ChunkLoader, ChunkListener,
parent::sendSkin($targets ?? $this->server->getOnlinePlayers());
}
/**
* Gets the player IP address
*
* @return string
*/
public function getAddress() : string{
return $this->networkSession->getIp();
}
/**
* @return int
*/
public function getPort() : int{
return $this->networkSession->getPort();
}
/**
* Returns the last measured latency for this player, in milliseconds. This is measured automatically and reported
* back by the network interface.
*
* @return int
*/
public function getPing() : int{
return $this->networkSession->getPing();
}
/**
* Returns whether the player is currently using an item (right-click and hold).
* @return bool

@ -62,7 +62,7 @@ class BanIpCommand extends VanillaCommand{
Command::broadcastCommandMessage($sender, new TranslationContainer("commands.banip.success", [$value]));
}else{
if(($player = $sender->getServer()->getPlayer($value)) instanceof Player){
$ip = $player->getAddress();
$ip = $player->getNetworkSession()->getIp();
$this->processIPBan($ip, $sender, $reason);
Command::broadcastCommandMessage($sender, new TranslationContainer("commands.banip.success.players", [$ip, $player->getName()]));
@ -80,7 +80,7 @@ class BanIpCommand extends VanillaCommand{
$sender->getServer()->getIPBans()->addBan($ip, $reason, null, $sender->getName());
foreach($sender->getServer()->getOnlinePlayers() as $player){
if($player->getAddress() === $ip){
if($player->getNetworkSession()->getIp() === $ip){
$player->kick($reason !== "" ? $reason : "IP banned.");
}
}