Added /op, /deop, /kick, OfflinePlayer, moved player list to Server instead of static Player

This commit is contained in:
Shoghi Cervantes
2014-04-01 19:46:48 +02:00
parent e60ea2eb15
commit b4cc3bbd43
16 changed files with 699 additions and 204 deletions

View File

@@ -55,7 +55,7 @@ class BanIpCommand extends VanillaCommand{
if(preg_match("/^([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])$/", $value)){
$this->processIPBan($value, $sender, $reason);
}else{
if(($player = Player::get($value, true)) instanceof Player){
if(($player = Server::getInstance()->getPlayer($value)) instanceof Player){
$this->processIPBan($player->getAddress(), $sender, $reason);
}else{
$sender->sendMessage(TextFormat::RED . "Usage: " . $this->usageMessage);
@@ -70,7 +70,7 @@ class BanIpCommand extends VanillaCommand{
private function processIPBan($ip, CommandSender $sender, $reason){
Server::getInstance()->getIPBans()->addBan($ip, $reason, null, $sender->getName());
foreach(Player::getAll() as $player){
foreach(Server::getInstance()->getOnlinePlayers() as $player){
if($player->getAddress() === $ip){
$player->kick("You have been IP banned.");
}