mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-10 13:35:29 +00:00
Formatting
This commit is contained in:
parent
befe1c606f
commit
22b5255421
@ -359,6 +359,7 @@ class Player extends RealHuman implements CommandSender{
|
||||
$this->server->getScheduler()->scheduleDelayedTask(new CallbackTask(array($this, "getNextChunk"), array(false, true)), MAX_CHUNK_RATE);
|
||||
++$this->chunkScheduled;
|
||||
}
|
||||
|
||||
return;
|
||||
}else{
|
||||
unset($this->chunkCount[$count]);
|
||||
@ -2334,7 +2335,7 @@ class Player extends RealHuman implements CommandSender{
|
||||
/**
|
||||
* Broadcasts a Minecraft packet to a list of players
|
||||
*
|
||||
* @param Player[] $players
|
||||
* @param Player[] $players
|
||||
* @param DataPacket $packet
|
||||
*/
|
||||
public static function broadcastPacket(array $players, DataPacket $packet){
|
||||
|
@ -40,10 +40,10 @@ use PocketMine\Item\Item;
|
||||
use PocketMine\Level\Generator\Generator;
|
||||
use PocketMine\Level\Level;
|
||||
use PocketMine\Network\Packet;
|
||||
use PocketMine\Network\RakNet\Info as RakNetInfo;
|
||||
use PocketMine\Network\RakNet\Packet as RakNetPacket;
|
||||
use PocketMine\Network\Query\QueryHandler;
|
||||
use PocketMine\Network\Query\QueryPacket;
|
||||
use PocketMine\Network\RakNet\Info as RakNetInfo;
|
||||
use PocketMine\Network\RakNet\Packet as RakNetPacket;
|
||||
use PocketMine\Network\ThreadedHandler;
|
||||
use PocketMine\Network\UPnP\UPnP;
|
||||
use PocketMine\Permission\BanList;
|
||||
|
@ -34,7 +34,6 @@ use PocketMine\Command\Defaults\StopCommand;
|
||||
use PocketMine\Command\Defaults\TellCommand;
|
||||
use PocketMine\Command\Defaults\VanillaCommand;
|
||||
use PocketMine\Command\Defaults\VersionCommand;
|
||||
use PocketMine\Permission\BanList;
|
||||
use PocketMine\Server;
|
||||
|
||||
class SimpleCommandMap implements CommandMap{
|
||||
|
@ -45,6 +45,7 @@ class BanCommand extends VanillaCommand{
|
||||
|
||||
if(count($args) === 0){
|
||||
$sender->sendMessage(TextFormat::RED . "Usage: " . $this->usageMessage);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -57,7 +58,8 @@ class BanCommand extends VanillaCommand{
|
||||
$player->kick("Banned by admin.");
|
||||
}
|
||||
|
||||
Command::broadcastCommandMessage($sender, "Banned player ". $name);
|
||||
Command::broadcastCommandMessage($sender, "Banned player " . $name);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -45,6 +45,7 @@ class BanIpCommand extends VanillaCommand{
|
||||
|
||||
if(count($args) === 0){
|
||||
$sender->sendMessage(TextFormat::RED . "Usage: " . $this->usageMessage);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -58,11 +59,13 @@ class BanIpCommand extends VanillaCommand{
|
||||
$this->processIPBan($player->getIP(), $sender, $reason);
|
||||
}else{
|
||||
$sender->sendMessage(TextFormat::RED . "Usage: " . $this->usageMessage);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Command::broadcastCommandMessage($sender, "Banned player ". $name);
|
||||
Command::broadcastCommandMessage($sender, "Banned player " . $name);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -75,6 +78,6 @@ class BanIpCommand extends VanillaCommand{
|
||||
}
|
||||
}
|
||||
|
||||
Command::broadcastCommandMessage($sender, "Banned IP Address ". $ip);
|
||||
Command::broadcastCommandMessage($sender, "Banned IP Address " . $ip);
|
||||
}
|
||||
}
|
@ -21,11 +21,8 @@
|
||||
|
||||
namespace PocketMine\Command\Defaults;
|
||||
|
||||
use PocketMine\Command\Command;
|
||||
use PocketMine\Command\CommandSender;
|
||||
use PocketMine\Player;
|
||||
use PocketMine\Server;
|
||||
use PocketMine\Utils\TextFormat;
|
||||
|
||||
class BanListCommand extends VanillaCommand{
|
||||
|
||||
@ -58,8 +55,9 @@ class BanListCommand extends VanillaCommand{
|
||||
$message .= $entry->getName() . ", ";
|
||||
}
|
||||
|
||||
$sender->sendMessage("There are ". count($list)." total banned players:");
|
||||
$sender->sendMessage("There are " . count($list) . " total banned players:");
|
||||
$sender->sendMessage(substr($message, 0, -2));
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -22,7 +22,6 @@
|
||||
namespace PocketMine\Command\Defaults;
|
||||
|
||||
use PocketMine\Command\CommandSender;
|
||||
use PocketMine\Player;
|
||||
use PocketMine\Server;
|
||||
use PocketMine\Utils\TextFormat;
|
||||
|
||||
@ -44,6 +43,7 @@ class DefaultGamemodeCommand extends VanillaCommand{
|
||||
|
||||
if(count($args) === 0){
|
||||
$sender->sendMessage(TextFormat::RED . "Usage: " . $this->usageMessage);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -51,10 +51,11 @@ class DefaultGamemodeCommand extends VanillaCommand{
|
||||
|
||||
if($gameMode !== -1){
|
||||
Server::getInstance()->setConfigInt("gamemode", $gameMode);
|
||||
$sender->sendMessage("Default game mode set to ". strtolower(Server::getGamemodeString($gameMode)));
|
||||
$sender->sendMessage("Default game mode set to " . strtolower(Server::getGamemodeString($gameMode)));
|
||||
}else{
|
||||
$sender->sendMessage("Unknown game mode");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -23,7 +23,6 @@ namespace PocketMine\Command\Defaults;
|
||||
|
||||
use PocketMine\Command\Command;
|
||||
use PocketMine\Command\CommandSender;
|
||||
use PocketMine\Player;
|
||||
use PocketMine\Server;
|
||||
use PocketMine\Utils\TextFormat;
|
||||
|
||||
@ -45,12 +44,14 @@ class PardonCommand extends VanillaCommand{
|
||||
|
||||
if(count($args) !== 1){
|
||||
$sender->sendMessage(TextFormat::RED . "Usage: " . $this->usageMessage);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Server::getInstance()->getNameBans()->remove($args[0]);
|
||||
|
||||
Command::broadcastCommandMessage($sender, "Pardoned ". $name);
|
||||
Command::broadcastCommandMessage($sender, "Pardoned " . $name);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -23,7 +23,6 @@ namespace PocketMine\Command\Defaults;
|
||||
|
||||
use PocketMine\Command\Command;
|
||||
use PocketMine\Command\CommandSender;
|
||||
use PocketMine\Player;
|
||||
use PocketMine\Server;
|
||||
use PocketMine\Utils\TextFormat;
|
||||
|
||||
@ -45,12 +44,13 @@ class PardonIpCommand extends VanillaCommand{
|
||||
|
||||
if(count($args) !== 1){
|
||||
$sender->sendMessage(TextFormat::RED . "Usage: " . $this->usageMessage);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
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])$/", $args[0])){
|
||||
Server::getInstance()->getIPBans()->remove($args[0]);
|
||||
Command::broadcastCommandMessage($sender, "Pardoned IP ". $name);
|
||||
Command::broadcastCommandMessage($sender, "Pardoned IP " . $name);
|
||||
}else{
|
||||
$sender->sendMessage("Invalid IP");
|
||||
}
|
||||
|
@ -23,7 +23,6 @@ namespace PocketMine\Event\Player;
|
||||
|
||||
use PocketMine\Event\Cancellable;
|
||||
use PocketMine\Player;
|
||||
use PocketMine\Server;
|
||||
|
||||
/**
|
||||
* Called when a player runs a command or chats, early in the process
|
||||
@ -41,8 +40,8 @@ class PlayerCommandPreprocessEvent extends PlayerEvent implements Cancellable{
|
||||
|
||||
|
||||
/**
|
||||
* @param Player $player
|
||||
* @param string $message
|
||||
* @param Player $player
|
||||
* @param string $message
|
||||
*/
|
||||
public function __construct(Player $player, $message){
|
||||
$this->player = $player;
|
||||
|
@ -21,9 +21,6 @@
|
||||
|
||||
namespace PocketMine\Event\Player;
|
||||
|
||||
use PocketMine\Block\Block;
|
||||
use PocketMine\Event\Cancellable;
|
||||
use PocketMine\Item\Item;
|
||||
use PocketMine\Level\Position;
|
||||
use PocketMine\Player;
|
||||
|
||||
|
@ -23,8 +23,6 @@ namespace PocketMine\Event\Server;
|
||||
|
||||
use PocketMine\Command\CommandSender;
|
||||
use PocketMine\Event\Cancellable;
|
||||
use PocketMine\Player;
|
||||
use PocketMine\Server;
|
||||
|
||||
/**
|
||||
* Called when the console runs a command, early in the process
|
||||
|
@ -27,7 +27,6 @@ namespace PocketMine\Network;
|
||||
use PocketMine\Network\Query\QueryPacket;
|
||||
use PocketMine\Network\RakNet\Info;
|
||||
use PocketMine\Network\RakNet\Packet as RakNetPacket;
|
||||
use PocketMine\Server;
|
||||
|
||||
class ThreadedHandler extends \Thread{
|
||||
protected $bandwidthUp;
|
||||
@ -62,7 +61,7 @@ class ThreadedHandler extends \Thread{
|
||||
}
|
||||
|
||||
public function close(){
|
||||
$this->synchronized(function(){
|
||||
$this->synchronized(function (){
|
||||
$this->stop = true;
|
||||
socket_close($this->socket);
|
||||
});
|
||||
@ -101,6 +100,7 @@ class ThreadedHandler extends \Thread{
|
||||
*/
|
||||
public function writePacket(Packet $packet){
|
||||
$this->queue[] = $packet;
|
||||
|
||||
return strlen($packet->buffer);
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ class BanEntry{
|
||||
public static $format = "Y-m-d H:i:s O";
|
||||
|
||||
private $name;
|
||||
/** @var \DateTime*/
|
||||
/** @var \DateTime */
|
||||
private $creationDate = null;
|
||||
private $source = "(Unknown)";
|
||||
/** @var \DateTime */
|
||||
@ -70,6 +70,7 @@ class BanEntry{
|
||||
|
||||
public function hasExpired(){
|
||||
$now = new \DateTime();
|
||||
|
||||
return $this->expirationDate === null ? false : $this->expirationDate < $now;
|
||||
}
|
||||
|
||||
@ -92,6 +93,7 @@ class BanEntry{
|
||||
$str .= $this->getExpires() === null ? "Forever" : $this->getExpires()->format(self::$format);
|
||||
$str .= "|";
|
||||
$str .= $this->getReason();
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
@ -117,6 +119,7 @@ class BanEntry{
|
||||
}
|
||||
if(count($str) > 0){
|
||||
$entry->setReason(trim(array_shift($str)));
|
||||
|
||||
return $entry;
|
||||
}else{
|
||||
return $entry;
|
||||
|
@ -60,6 +60,7 @@ class BanList{
|
||||
*/
|
||||
public function getEntries(){
|
||||
$this->removeExpired();
|
||||
|
||||
return $this->list;
|
||||
}
|
||||
|
||||
@ -74,6 +75,7 @@ class BanList{
|
||||
return false;
|
||||
}else{
|
||||
$this->removeExpired();
|
||||
|
||||
return isset($this->list[$name]);
|
||||
}
|
||||
}
|
||||
@ -102,6 +104,7 @@ class BanList{
|
||||
|
||||
$this->list[$entry->getName()] = $entry;
|
||||
$this->save();
|
||||
|
||||
return $entry;
|
||||
}
|
||||
|
||||
@ -147,7 +150,7 @@ class BanList{
|
||||
$fp = @fopen($this->file, "w");
|
||||
if(is_resource($fp)){
|
||||
if($flag === true){
|
||||
fwrite($fp, "# Updated ".strftime("%x %H:%M", time())." by ".Server::getInstance()->getName() . " ".Server::getInstance()->getPocketMineVersion()."\n");
|
||||
fwrite($fp, "# Updated " . strftime("%x %H:%M", time()) . " by " . Server::getInstance()->getName() . " " . Server::getInstance()->getPocketMineVersion() . "\n");
|
||||
fwrite($fp, "# victim name | ban date | banned by | banned until | reason\n\n");
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user