Formatting

This commit is contained in:
Shoghi Cervantes 2014-04-01 19:48:28 +02:00
parent b4cc3bbd43
commit 7e9304a0c9
20 changed files with 23 additions and 27 deletions

View File

@ -20,6 +20,7 @@
*/ */
namespace pocketmine; namespace pocketmine;
use pocketmine\utils\TextFormat; use pocketmine\utils\TextFormat;
/** /**

View File

@ -22,7 +22,6 @@
namespace pocketmine; namespace pocketmine;
use pocketmine\nbt\NBT;
use pocketmine\nbt\tag\Compound; use pocketmine\nbt\tag\Compound;
class OfflinePlayer implements IPlayer{ class OfflinePlayer implements IPlayer{
@ -114,5 +113,4 @@ class OfflinePlayer implements IPlayer{
} }
} }

View File

@ -31,12 +31,6 @@ use pocketmine\math\Vector3 as Vector3;
use pocketmine\nbt\NBT; use pocketmine\nbt\NBT;
use pocketmine\nbt\tag\Byte; use pocketmine\nbt\tag\Byte;
use pocketmine\nbt\tag\Compound; use pocketmine\nbt\tag\Compound;
use pocketmine\nbt\tag\Double;
use pocketmine\nbt\tag\Enum;
use pocketmine\nbt\tag\Float;
use pocketmine\nbt\tag\Int;
use pocketmine\nbt\tag\Long;
use pocketmine\nbt\tag\Short;
use pocketmine\nbt\tag\String; use pocketmine\nbt\tag\String;
use pocketmine\network\protocol\AdventureSettingsPacket; use pocketmine\network\protocol\AdventureSettingsPacket;
use pocketmine\network\protocol\ChunkDataPacket; use pocketmine\network\protocol\ChunkDataPacket;
@ -69,7 +63,6 @@ use pocketmine\tile\Furnace;
use pocketmine\tile\Sign; use pocketmine\tile\Sign;
use pocketmine\tile\Spawnable; use pocketmine\tile\Spawnable;
use pocketmine\tile\Tile; use pocketmine\tile\Tile;
use pocketmine\utils\Config;
use pocketmine\utils\TextFormat; use pocketmine\utils\TextFormat;
use pocketmine\utils\Utils; use pocketmine\utils\Utils;

View File

@ -464,6 +464,7 @@ class Server{
if($result === null){ if($result === null){
$result = new OfflinePlayer($this, $name); $result = new OfflinePlayer($this, $name);
} }
return $result; return $result;
} }
@ -568,10 +569,12 @@ class Server{
console("[NOTICE] Player data not found for \"" . $name . "\", creating new profile"); console("[NOTICE] Player data not found for \"" . $name . "\", creating new profile");
} }
$this->saveOfflinePlayerData($name, $nbt); $this->saveOfflinePlayerData($name, $nbt);
return $nbt; return $nbt;
}else{ }else{
$nbt = new NBT(NBT::BIG_ENDIAN); $nbt = new NBT(NBT::BIG_ENDIAN);
$nbt->readCompressed(file_get_contents($path . "$name.dat")); $nbt->readCompressed(file_get_contents($path . "$name.dat"));
return $nbt->getData(); return $nbt->getData();
} }
} }
@ -607,6 +610,7 @@ class Server{
} }
} }
} }
return $found; return $found;
} }

View File

@ -56,7 +56,7 @@ class PluginCommand extends Command{
$success = $this->executor->onCommand($sender, $this, $commandLabel, $args); $success = $this->executor->onCommand($sender, $this, $commandLabel, $args);
if(!$success and $this->usageMessage !== ""){ if(!$success and $this->usageMessage !== ""){
$sender->sendMessage(TextFormat::RED . "Usage: ". $this->usageMessage); $sender->sendMessage(TextFormat::RED . "Usage: " . $this->usageMessage);
} }
return $success; return $success;

View File

@ -21,11 +21,9 @@
namespace pocketmine\command\defaults; namespace pocketmine\command\defaults;
use pocketmine\command\Command;
use pocketmine\command\CommandSender; use pocketmine\command\CommandSender;
use pocketmine\Player; use pocketmine\Player;
use pocketmine\Server; use pocketmine\Server;
use pocketmine\utils\TextFormat;
class ListCommand extends VanillaCommand{ class ListCommand extends VanillaCommand{
@ -51,7 +49,7 @@ class ListCommand extends VanillaCommand{
} }
} }
$sender->sendMessage("There are ".count(Server::getInstance()->getOnlinePlayers())."/".Server::getInstance()->getMaxPlayers()." players online:\n" . substr($online, 0, -2)); $sender->sendMessage("There are " . count(Server::getInstance()->getOnlinePlayers()) . "/" . Server::getInstance()->getMaxPlayers() . " players online:\n" . substr($online, 0, -2));
return true; return true;
} }

View File

@ -23,7 +23,6 @@ namespace pocketmine\command\defaults;
use pocketmine\command\Command; use pocketmine\command\Command;
use pocketmine\command\CommandSender; use pocketmine\command\CommandSender;
use pocketmine\Player;
use pocketmine\Server; use pocketmine\Server;
class StopCommand extends VanillaCommand{ class StopCommand extends VanillaCommand{

View File

@ -34,11 +34,11 @@ use pocketmine\level\Position;
use pocketmine\math\AxisAlignedBB; use pocketmine\math\AxisAlignedBB;
use pocketmine\math\Vector3 as Vector3; use pocketmine\math\Vector3 as Vector3;
use pocketmine\nbt\tag\Compound; use pocketmine\nbt\tag\Compound;
use pocketmine\Network;
use pocketmine\network\protocol\MoveEntityPacket_PosRot; use pocketmine\network\protocol\MoveEntityPacket_PosRot;
use pocketmine\network\protocol\MovePlayerPacket; use pocketmine\network\protocol\MovePlayerPacket;
use pocketmine\network\protocol\RemoveEntityPacket; use pocketmine\network\protocol\RemoveEntityPacket;
use pocketmine\network\protocol\SetEntityMotionPacket; use pocketmine\network\protocol\SetEntityMotionPacket;
use pocketmine\Network;
use pocketmine\network\protocol\SetTimePacket; use pocketmine\network\protocol\SetTimePacket;
use pocketmine\Player; use pocketmine\Player;
use pocketmine\pmf\LevelFormat; use pocketmine\pmf\LevelFormat;

View File

@ -29,13 +29,13 @@ use pocketmine\nbt\tag\Byte;
use pocketmine\nbt\tag\Compound; use pocketmine\nbt\tag\Compound;
use pocketmine\nbt\tag\Enum; use pocketmine\nbt\tag\Enum;
use pocketmine\nbt\tag\Short; use pocketmine\nbt\tag\Short;
use pocketmine\Network;
use pocketmine\network\protocol\AddPlayerPacket; use pocketmine\network\protocol\AddPlayerPacket;
use pocketmine\network\protocol\ContainerSetContentPacket; use pocketmine\network\protocol\ContainerSetContentPacket;
use pocketmine\network\protocol\PlayerArmorEquipmentPacket; use pocketmine\network\protocol\PlayerArmorEquipmentPacket;
use pocketmine\network\protocol\PlayerEquipmentPacket; use pocketmine\network\protocol\PlayerEquipmentPacket;
use pocketmine\network\protocol\RemovePlayerPacket; use pocketmine\network\protocol\RemovePlayerPacket;
use pocketmine\network\protocol\SetEntityMotionPacket; use pocketmine\network\protocol\SetEntityMotionPacket;
use pocketmine\Network;
use pocketmine\Player; use pocketmine\Player;
use pocketmine\Server; use pocketmine\Server;

View File

@ -21,8 +21,8 @@
namespace pocketmine\event\player; namespace pocketmine\event\player;
use pocketmine\event\Cancellable;
use pocketmine\Event; use pocketmine\Event;
use pocketmine\event\Cancellable;
use pocketmine\item\Item; use pocketmine\item\Item;
use pocketmine\Player; use pocketmine\Player;

View File

@ -21,8 +21,8 @@
namespace pocketmine\event\server; namespace pocketmine\event\server;
use pocketmine\event;
use pocketmine\event\Cancellable; use pocketmine\event\Cancellable;
use pocketmine\event;
use pocketmine\network\protocol\DataPacket; use pocketmine\network\protocol\DataPacket;
use pocketmine\Player; use pocketmine\Player;

View File

@ -21,8 +21,8 @@
namespace pocketmine\event\server; namespace pocketmine\event\server;
use pocketmine\event;
use pocketmine\event\Cancellable; use pocketmine\event\Cancellable;
use pocketmine\event;
use pocketmine\network\protocol\DataPacket; use pocketmine\network\protocol\DataPacket;
use pocketmine\Player; use pocketmine\Player;

View File

@ -21,8 +21,8 @@
namespace pocketmine\event\tile; namespace pocketmine\event\tile;
use pocketmine\Event;
use pocketmine\event\Cancellable; use pocketmine\event\Cancellable;
use pocketmine\Event;
use pocketmine\item\Item; use pocketmine\item\Item;
use pocketmine\tile\Tile; use pocketmine\tile\Tile;

View File

@ -305,7 +305,7 @@ class Level{
/** /**
* Generates a new level * Generates a new level
* *
* @param string $name * @param string $name
* @param bool $seed * @param bool $seed
* @param bool $generator * @param bool $generator
* @param bool|array $options * @param bool|array $options

View File

@ -26,7 +26,6 @@
namespace pocketmine\network\query; namespace pocketmine\network\query;
use pocketmine\level\Level; use pocketmine\level\Level;
use pocketmine\Player;
use pocketmine\Server; use pocketmine\Server;
use pocketmine\utils\Utils; use pocketmine\utils\Utils;

View File

@ -102,6 +102,7 @@ class PermissibleBase implements Permissible{
if(($perm = Server::getInstance()->getPluginManager()->getPermission($name)) !== null){ if(($perm = Server::getInstance()->getPluginManager()->getPermission($name)) !== null){
$perm = $perm->getDefault(); $perm = $perm->getDefault();
return $perm === Permission::DEFAULT_TRUE or ($this->isOp() and $perm === Permission::DEFAULT_OP) or (!$this->isOp() and $perm === Permission::DEFAULT_NOT_OP); return $perm === Permission::DEFAULT_TRUE or ($this->isOp() and $perm === Permission::DEFAULT_OP) or (!$this->isOp() and $perm === Permission::DEFAULT_NOT_OP);
}else{ }else{
return Permission::$DEFAULT_PERMISSION === Permission::DEFAULT_TRUE or ($this->isOp() and Permission::$DEFAULT_PERMISSION === Permission::DEFAULT_OP) or (!$this->isOp() and Permission::$DEFAULT_PERMISSION === Permission::DEFAULT_NOT_OP); return Permission::$DEFAULT_PERMISSION === Permission::DEFAULT_TRUE or ($this->isOp() and Permission::$DEFAULT_PERMISSION === Permission::DEFAULT_OP) or (!$this->isOp() and Permission::$DEFAULT_PERMISSION === Permission::DEFAULT_NOT_OP);

View File

@ -51,7 +51,7 @@ class FolderPluginLoader implements PluginLoader{
if(is_dir($file) and file_exists($file . "/plugin.yml") and file_exists($file . "/src/")){ if(is_dir($file) and file_exists($file . "/plugin.yml") and file_exists($file . "/src/")){
if(($description = $this->getPluginDescription($file)) instanceof PluginDescription){ if(($description = $this->getPluginDescription($file)) instanceof PluginDescription){
console("[INFO] Loading " . $description->getFullName()); console("[INFO] Loading " . $description->getFullName());
console("[WARNING] Non-packaged plugin ".$description->getName() ." detected, do not use on production."); console("[WARNING] Non-packaged plugin " . $description->getName() . " detected, do not use on production.");
$dataFolder = dirname($file) . DIRECTORY_SEPARATOR . $description->getName(); $dataFolder = dirname($file) . DIRECTORY_SEPARATOR . $description->getName();
if(file_exists($dataFolder) and !is_dir($dataFolder)){ if(file_exists($dataFolder) and !is_dir($dataFolder)){
trigger_error("Projected dataFolder '" . $dataFolder . "' for " . $description->getName() . " exists and is not a directory", E_USER_WARNING); trigger_error("Projected dataFolder '" . $dataFolder . "' for " . $description->getName() . " exists and is not a directory", E_USER_WARNING);

View File

@ -73,6 +73,7 @@ class PharPluginLoader implements PluginLoader{
return null; return null;
} }
} }
return null; return null;
} }

View File

@ -555,6 +555,7 @@ class PluginManager{
$pluginCmds[] = $newCmd; $pluginCmds[] = $newCmd;
} }
} }
return $pluginCmds; return $pluginCmds;
} }
@ -616,7 +617,8 @@ class PluginManager{
*/ */
public function registerEvents(Listener $listener, Plugin $plugin){ public function registerEvents(Listener $listener, Plugin $plugin){
if(!$plugin->isEnabled()){ if(!$plugin->isEnabled()){
trigger_error("Plugin attempted to register ".get_class($listener)." while not enabled", E_USER_WARNING); trigger_error("Plugin attempted to register " . get_class($listener) . " while not enabled", E_USER_WARNING);
return; return;
} }
@ -627,8 +629,8 @@ class PluginManager{
$ignoreCancelled = false; $ignoreCancelled = false;
if(preg_match("/^[\t ]*\\* @priority[\t ]{1,}([a-zA-Z]{1,})$/m", (string) $method->getDocComment(), $matches) > 0){ if(preg_match("/^[\t ]*\\* @priority[\t ]{1,}([a-zA-Z]{1,})$/m", (string) $method->getDocComment(), $matches) > 0){
$matches[1] = strtoupper($matches[1]); $matches[1] = strtoupper($matches[1]);
if(defined("pocketmine\\event\\EventPriority::".$matches[1])){ if(defined("pocketmine\\event\\EventPriority::" . $matches[1])){
$priority = constant("pocketmine\\event\\EventPriority::".$matches[1]); $priority = constant("pocketmine\\event\\EventPriority::" . $matches[1]);
} }
} }
if(preg_match("/^[\t ]*\\* @ignoreCancelled[\t ]{1,}([a-zA-Z]{1,})$/m", (string) $method->getDocComment(), $matches) > 0){ if(preg_match("/^[\t ]*\\* @ignoreCancelled[\t ]{1,}([a-zA-Z]{1,})$/m", (string) $method->getDocComment(), $matches) > 0){

View File

@ -26,10 +26,10 @@ use pocketmine\item\Item;
use pocketmine\nbt\tag\Byte; use pocketmine\nbt\tag\Byte;
use pocketmine\nbt\tag\Compound; use pocketmine\nbt\tag\Compound;
use pocketmine\nbt\tag\Short; use pocketmine\nbt\tag\Short;
use pocketmine\Network;
use pocketmine\network\protocol\ContainerOpenPacket; use pocketmine\network\protocol\ContainerOpenPacket;
use pocketmine\network\protocol\ContainerSetContentPacket; use pocketmine\network\protocol\ContainerSetContentPacket;
use pocketmine\network\protocol\TileEventPacket; use pocketmine\network\protocol\TileEventPacket;
use pocketmine\Network;
use pocketmine\Player; use pocketmine\Player;
use pocketmine\Server; use pocketmine\Server;