PocketMine
Server Class Reference

Public Member Functions

 getName ()
 
 isRunning ()
 
 getPocketMineVersion ()
 
 getCodename ()
 
 getVersion ()
 
 getApiVersion ()
 
 getFilePath ()
 
 getDataPath ()
 
 getPluginPath ()
 
 getMaxPlayers ()
 
 getPort ()
 
 getViewDistance ()
 
 getIp ()
 
 getServerName ()
 
 getServerUniqueId ()
 
 getAutoSave ()
 
 setAutoSave ($value)
 
 getLevelType ()
 
 getGenerateStructures ()
 
 getGamemode ()
 
 getForceGamemode ()
 
 getDifficulty ()
 
 hasWhitelist ()
 
 getSpawnRadius ()
 
 getAllowFlight ()
 
 isHardcore ()
 
 getDefaultGamemode ()
 
 getMotd ()
 
 getLoader ()
 
 getLogger ()
 
 getEntityMetadata ()
 
 getPlayerMetadata ()
 
 getLevelMetadata ()
 
 getUpdater ()
 
 getPluginManager ()
 
 getCraftingManager ()
 
 getScheduler ()
 
 getTick ()
 
 getTicksPerSecond ()
 
 getTicksPerSecondAverage ()
 
 getTickUsage ()
 
 getTickUsageAverage ()
 
 blockAddress ($address, $timeout=300)
 
 sendPacket ($address, $port, $payload)
 
 getInterfaces ()
 
 addInterface (SourceInterface $interface)
 
 removeInterface (SourceInterface $interface)
 
 getCommandMap ()
 
 getOnlinePlayers ()
 
 addRecipe (Recipe $recipe)
 
 getOfflinePlayer ($name)
 
 getOfflinePlayerData ($name)
 
 saveOfflinePlayerData ($name, Compound $nbtTag, $async=false)
 
 getPlayer ($name)
 
 getPlayerExact ($name)
 
 matchPlayer ($partialName)
 
 removePlayer (Player $player)
 
 getLevels ()
 
 getDefaultLevel ()
 
 setDefaultLevel ($level)
 
 isLevelLoaded ($name)
 
 getLevel ($levelId)
 
 getLevelByName ($name)
 
 unloadLevel (Level $level, $forceUnload=false)
 
 loadLevel ($name)
 
 isLevelGenerated ($name)
 
 getConfigString ($variable, $defaultValue="")
 
 getProperty ($variable, $defaultValue=null)
 
 setConfigString ($variable, $value)
 
 getConfigInt ($variable, $defaultValue=0)
 
 setConfigInt ($variable, $value)
 
 getConfigBoolean ($variable, $defaultValue=false)
 
 setConfigBool ($variable, $value)
 
 getPluginCommand ($name)
 
 getNameBans ()
 
 getIPBans ()
 
 addOp ($name)
 
 removeOp ($name)
 
 addWhitelist ($name)
 
 removeWhitelist ($name)
 
 isWhitelisted ($name)
 
 isOp ($name)
 
 getWhitelisted ()
 
 getOps ()
 
 reloadWhitelist ()
 
 getCommandAliases ()
 
 __construct (\ClassLoader $autoloader,\ThreadedLogger $logger, $filePath, $dataPath, $pluginPath)
 
 batchPackets (array $players, array $packets, $forceSync=false, $channel=0)
 
 broadcastPacketsCallback ($data, array $identifiers)
 
 enablePlugins ($type)
 
 enablePlugin (Plugin $plugin)
 
 loadPlugin (Plugin $plugin)
 
 disablePlugins ()
 
 checkConsole ()
 
 dispatchCommand (CommandSender $sender, $commandLine)
 
 reload ()
 
 shutdown ()
 
 forceShutdown ()
 
 getQueryInformation ()
 
 start ()
 
 handleSignal ($signo)
 
 exceptionHandler (\Exception $e, $trace=null)
 
 crashDump ()
 
 __debugInfo ()
 
 onPlayerLogin (Player $player)
 
 addPlayer ($identifier, Player $player)
 
 addOnlinePlayer (Player $player)
 
 removeOnlinePlayer (Player $player)
 
 updatePlayerListData (UUID $uuid, $entityId, $name, $skinName, $skinData, array $players=null)
 
 removePlayerListData (UUID $uuid, array $players=null)
 
 sendFullPlayerListData (Player $p)
 
 sendRecipeList (Player $p)
 
 doAutoSave ()
 
 sendUsage ($type=SendUsageTask::TYPE_STATUS)
 
 getLanguage ()
 
 isLanguageForced ()
 
 getNetwork ()
 
 getMemoryManager ()
 
 handlePacket ($address, $port, $payload)
 

Static Public Member Functions

static getGamemodeString ($mode)
 
static getGamemodeFromString ($str)
 
static getDifficultyFromString ($str)
 
static getInstance ()
 
static broadcastPacket (array $players, DataPacket $packet)
 

Data Fields

const BROADCAST_CHANNEL_ADMINISTRATIVE = "pocketmine.broadcast.admin"
 
const BROADCAST_CHANNEL_USERS = "pocketmine.broadcast.user"
 
 $networkCompressionLevel = 7
 

Detailed Description

The class that manages everything

Constructor & Destructor Documentation

__construct ( \ClassLoader  $autoloader,
\ThreadedLogger  $logger,
  $filePath,
  $dataPath,
  $pluginPath 
)
Parameters
\ClassLoader$autoloader
\ThreadedLogger$logger
string$filePath
string$dataPath
string$pluginPath

TODO:

Deprecated:

Member Function Documentation

addInterface ( SourceInterface  $interface)
Deprecated:
Parameters
SourceInterface$interface
addOp (   $name)
Parameters
string$name
addWhitelist (   $name)
Parameters
string$name
batchPackets ( array  $players,
array  $packets,
  $forceSync = false,
  $channel = 0 
)

Broadcasts a list of packets in a batch to a list of players

Parameters
Player[]$players
DataPacket[]|string$packets
bool$forceSync
int$channel
blockAddress (   $address,
  $timeout = 300 
)
Deprecated:
Parameters
$address
int$timeout
static broadcastPacket ( array  $players,
DataPacket  $packet 
)
static

Broadcasts a Minecraft packet to a list of players

Parameters
Player[]$players
DataPacket$packet
dispatchCommand ( CommandSender  $sender,
  $commandLine 
)

Executes a command from a CommandSender

Parameters
CommandSender$sender
string$commandLine
Returns
bool
Exceptions
enablePlugin ( Plugin  $plugin)
Parameters
Plugin$plugin
enablePlugins (   $type)
Parameters
int$type
getAllowFlight ( )
Returns
bool
getApiVersion ( )
Returns
string
getAutoSave ( )
Returns
bool
getCodename ( )
Returns
string
getCommandAliases ( )
Returns
string[]
getCommandMap ( )
Returns
SimpleCommandMap
getConfigBoolean (   $variable,
  $defaultValue = false 
)
Parameters
string$variable
boolean$defaultValue
Returns
boolean
getConfigInt (   $variable,
  $defaultValue = 0 
)
Parameters
string$variable
int$defaultValue
Returns
int
getConfigString (   $variable,
  $defaultValue = "" 
)
Parameters
string$variable
string$defaultValue
Returns
string
getCraftingManager ( )
Returns
CraftingManager
getDataPath ( )
Returns
string
getDefaultGamemode ( )
Returns
int
getDefaultLevel ( )
Returns
Level
getDifficulty ( )
Returns
int
static getDifficultyFromString (   $str)
static
Parameters
string$str
Returns
int
getEntityMetadata ( )
Returns
EntityMetadataStore
getFilePath ( )
Returns
string
getForceGamemode ( )
Returns
bool
getGamemode ( )
Returns
int
static getGamemodeFromString (   $str)
static

Parses a string and returns a gamemode integer, -1 if not found

Parameters
string$str
Returns
int
static getGamemodeString (   $mode)
static

Returns the gamemode text name

Parameters
int$mode
Returns
string
getGenerateStructures ( )
Returns
bool
static getInstance ( )
static
Returns
Server
getInterfaces ( )
Deprecated:
Returns
SourceInterface[]
getIp ( )
Returns
string
getIPBans ( )
Returns
BanList
getLanguage ( )
Returns
BaseLang
getLevel (   $levelId)
Parameters
int$levelId
Returns
Level
getLevelByName (   $name)
Parameters
$name
Returns
Level
getLevelMetadata ( )
Returns
LevelMetadataStore
getLevels ( )
Returns
Level[]
getLevelType ( )
Returns
string
getLoader ( )
Returns
getLogger ( )
Returns
getMaxPlayers ( )
Returns
int
getMemoryManager ( )
Returns
MemoryManager
getMotd ( )
Returns
string
getName ( )
Returns
string
getNameBans ( )
Returns
BanList
getNetwork ( )
Returns
Network
getOfflinePlayer (   $name)
Parameters
string$name
Returns
OfflinePlayer|Player
getOfflinePlayerData (   $name)
Parameters
string$name
Returns
Compound
getOnlinePlayers ( )
Returns
Player[]
getOps ( )
Returns
Config
getPlayer (   $name)
Parameters
string$name
Returns
Player
getPlayerExact (   $name)
Parameters
string$name
Returns
Player
getPlayerMetadata ( )
Returns
PlayerMetadataStore
getPluginCommand (   $name)
Parameters
string$name
Returns
PluginIdentifiableCommand
getPluginManager ( )
Returns
PluginManager
getPluginPath ( )
Returns
string
getPocketMineVersion ( )
Returns
string
getPort ( )
Returns
int
getProperty (   $variable,
  $defaultValue = null 
)
Parameters
string$variable
mixed$defaultValue
Returns
mixed
getScheduler ( )
Returns
ServerScheduler
getServerName ( )
getSpawnRadius ( )
Returns
int
getTick ( )
Returns
int
getTicksPerSecond ( )

Returns the last server TPS measure

Returns
float
getTicksPerSecondAverage ( )

Returns the last server TPS average measure

Returns
float
getTickUsage ( )

Returns the TPS usage/load in %

Returns
float
getTickUsageAverage ( )

Returns the TPS usage/load average in %

Returns
float
getUpdater ( )
Returns
AutoUpdater
getVersion ( )
Returns
string
getViewDistance ( )
Returns
int
getWhitelisted ( )
Returns
Config
handlePacket (   $address,
  $port,
  $payload 
)
Parameters
string$address
int$port
string$payloadTODO: move this to Network
hasWhitelist ( )
Returns
bool
isHardcore ( )
Returns
bool
isLanguageForced ( )
Returns
bool
isLevelGenerated (   $name)
Parameters
string$name
Returns
bool
isLevelLoaded (   $name)
Parameters
string$name
Returns
bool
isOp (   $name)
Parameters
string$name
Returns
bool
isRunning ( )
Returns
bool
isWhitelisted (   $name)
Parameters
string$name
Returns
bool
loadLevel (   $name)

Loads a level from the data directory

Parameters
string$name
Returns
bool
Exceptions
LevelException
loadPlugin ( Plugin  $plugin)
Parameters
Plugin$plugin
Deprecated:
matchPlayer (   $partialName)
Parameters
string$partialName
Returns
Player[]
removeInterface ( SourceInterface  $interface)
Deprecated:
Parameters
SourceInterface$interface
removeOp (   $name)
Parameters
string$name
removePlayer ( Player  $player)
Parameters
Player$player
removeWhitelist (   $name)
Parameters
string$name
saveOfflinePlayerData (   $name,
Compound  $nbtTag,
  $async = false 
)
Parameters
string$name
Compound$nbtTag
bool$async
sendPacket (   $address,
  $port,
  $payload 
)
Deprecated:
Parameters
$address
$port
$payload
setAutoSave (   $value)
Parameters
bool$value
setConfigBool (   $variable,
  $value 
)
Parameters
string$variable
bool$value
setConfigInt (   $variable,
  $value 
)
Parameters
string$variable
int$value
setConfigString (   $variable,
  $value 
)
Parameters
string$variable
string$value
setDefaultLevel (   $level)

Sets the default level to a different level This won't change the level-name property, it only affects the server on runtime

Parameters
Level$level
shutdown ( )

Shutdowns the server correctly

start ( )

Starts the PocketMine-MP server and starts processing ticks and packets

unloadLevel ( Level  $level,
  $forceUnload = false 
)
Parameters
Level$level
bool$forceUnload
Returns
bool

The documentation for this class was generated from the following file: