PHP Class pocketmine\Server

显示文件 Open project: robske110/ClearSky Class Usage Examples

Public Properties

Property Type Description
$netherName Name of nether world
$networkCompressionLevel
$propertyCache

Public Methods

Method Description
__construct ( ClassLoader $autoloader, ThreadedLogger $logger, string $filePath, string $dataPath, string $pluginPath )
__debugInfo ( )
addOnlinePlayer ( Player $player )
addOp ( string $name )
addPlayer ( $identifier, Player $player )
addRecipe ( pocketmine\inventory\Recipe $recipe )
addWhitelist ( string $name )
batchPackets ( array $players, array $packets, boolean $forceSync = false ) Broadcasts a list of packets in a batch to a list of players
broadcast ( string $message, string $permissions ) : integer
broadcastMessage ( string $message, Player[] | null $recipients = null ) : integer
broadcastPacket ( array $players, DataPacket $packet ) Broadcasts a Minecraft packet to a list of players
broadcastPacketsCallback ( $data, array $identifiers )
broadcastPopup ( string $popup, Player[] | null $recipients = null ) : integer
broadcastTip ( string $tip, Player[] | null $recipients = null ) : integer
checkConsole ( )
crashDump ( )
disablePlugins ( )
dispatchCommand ( pocketmine\command\CommandSender $sender, string $commandLine ) : boolean Executes a command from a CommandSender
doAutoSave ( )
enablePlugin ( pocketmine\plugin\Plugin $plugin )
enablePlugins ( integer $type )
exceptionHandler ( Throwable $e, $trace = null )
forceShutdown ( )
generateLevel ( string $name, integer $seed = null, string $generator = null, array $options = [] ) : boolean Generates a new level if it does not exists
getAllowFlight ( ) : boolean
getAllowInvCheats ( ) : boolean
getApiVersion ( ) : string
getAutoSave ( ) : boolean
getCodename ( ) : string
getCommandAliases ( ) : string[]
getCommandMap ( ) : SimpleCommandMap
getConfigBoolean ( string $variable, boolean $defaultValue = false ) : boolean
getConfigInt ( string $variable, integer $defaultValue ) : integer
getConfigString ( string $variable, string $defaultValue = "" ) : string
getCraftingManager ( ) : CraftingManager
getCrashDumpPath ( ) : string
getDataPath ( ) : string
getDefaultGamemode ( ) : integer
getDefaultLevel ( ) : Level
getDifficulty ( ) : integer
getDifficultyFromString ( string $str ) : integer
getEntityMetadata ( ) : EntityMetadataStore
getFilePath ( ) : string
getForceGamemode ( ) : boolean
getGamemode ( ) : integer
getGamemodeFromString ( string $str ) : integer Parses a string and returns a gamemode integer, -1 if not found
getGamemodeString ( integer $mode ) : string Returns the gamemode text name
getGenerateStructures ( ) : boolean
getIPBans ( ) : BanList
getInstance ( ) : Server
getIp ( ) : string
getLanguage ( ) : BaseLang
getLevel ( integer $levelId ) : Level
getLevelByName ( $name ) : Level
getLevelMetadata ( ) : LevelMetadataStore
getLevelType ( ) : string
getLevels ( ) : Level[]
getLoader ( ) : ClassLoader
getLogger ( ) : AttachableThreadedLogger
getMaxPlayers ( ) : integer
getMemoryManager ( ) : MemoryManager
getMotd ( ) : string
getName ( ) : string
getNameBans ( ) : BanList
getNetwork ( ) : Network
getOfflinePlayer ( string $name ) : OfflinePlayer | Player
getOfflinePlayerData ( string $name ) : CompoundTag
getOnlinePlayers ( ) : Player[]
getOps ( ) : Config
getPlayer ( string $name ) : Player
getPlayerExact ( string $name ) : Player
getPlayerMetadata ( ) : PlayerMetadataStore
getPluginCommand ( string $name ) : pocketmine\command\PluginIdentifiableCommand
getPluginManager ( ) : PluginManager
getPluginPath ( ) : string
getPocketMineBuild ( ) : string
getPocketMineVersion ( ) : string
getPort ( ) : integer
getProperty ( string $variable, mixed $defaultValue = null ) : mixed
getQueryInformation ( )
getScheduler ( ) : ServerScheduler
getServerUniqueId ( )
getSpawnRadius ( ) : integer
getTick ( ) : integer
getTickUsage ( ) : float Returns the TPS usage/load in %
getTickUsageAverage ( ) : float Returns the TPS usage/load average in %
getTicksPerSecond ( ) : float Returns the last server TPS measure
getTicksPerSecondAverage ( ) : float Returns the last server TPS average measure
getUpdater ( ) : AutoUpdater
getVersion ( ) : string
getViewDistance ( ) : integer
getWhitelisted ( ) : Config
handlePacket ( string $address, integer $port, string $payload )
handleSignal ( $signo )
hasWhitelist ( ) : boolean
isHardcore ( ) : boolean
isLanguageForced ( ) : boolean
isLevelGenerated ( string $name ) : boolean
isLevelLoaded ( string $name ) : boolean
isOp ( string $name ) : boolean
isRunning ( ) : boolean
isWhitelisted ( string $name ) : boolean
loadLevel ( string $name ) : boolean Loads a level from the data directory
loadPlugin ( pocketmine\plugin\Plugin $plugin )
matchPlayer ( string $partialName ) : Player[]
microSleep ( integer $microseconds )
onPlayerLogin ( Player $player )
reload ( )
reloadWhitelist ( )
removeOnlinePlayer ( Player $player )
removeOp ( string $name )
removePlayer ( Player $player )
removePlayerListData ( UUID $uuid, array $players = null )
removeWhitelist ( string $name )
saveOfflinePlayerData ( string $name, CompoundTag $nbtTag, boolean $async = false )
sendFullPlayerListData ( Player $p )
sendRecipeList ( Player $p )
sendUsage ( $type = SendUsageTask::TYPE_STATUS )
setAutoSave ( boolean $value )
setConfigBool ( string $variable, boolean $value )
setConfigInt ( string $variable, integer $value )
setConfigString ( string $variable, string $value )
setDefaultLevel ( Level $level ) Sets the default level to a different level This won't change the level-name property, it only affects the server on runtime
setshutdownreason ( $reason )
shouldSavePlayerData ( ) : boolean
shutdown ( ) Shutdowns the server correctly
start ( ) Starts the PocketMine-MP server and starts processing ticks and packets
unloadLevel ( Level $level, boolean $forceUnload = false ) : boolean
updatePlayerListData ( UUID $uuid, $entityId, $name, $skinId, $skinData, array $players = null )

Private Methods

Method Description
checkTickUpdates ( $currentTick, $tickTime )
registerEntities ( )
registerTiles ( )
tick ( ) Tries to execute a server tick
tickProcessor ( )
titleTick ( )
translateConfig ( $config, $language = "eng" ) ClearSky internal use

Method Details

__construct() public method

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

__debugInfo() public method

public __debugInfo ( )

addOnlinePlayer() public method

public addOnlinePlayer ( Player $player )
$player Player

addOp() public method

public addOp ( string $name )
$name string

addPlayer() public method

public addPlayer ( $identifier, Player $player )
$player Player

addRecipe() public method

public addRecipe ( pocketmine\inventory\Recipe $recipe )
$recipe pocketmine\inventory\Recipe

addWhitelist() public method

public addWhitelist ( string $name )
$name string

batchPackets() public method

Broadcasts a list of packets in a batch to a list of players
public batchPackets ( array $players, array $packets, boolean $forceSync = false )
$players array
$packets array
$forceSync boolean

broadcast() public method

public broadcast ( string $message, string $permissions ) : integer
$message string
$permissions string
return integer

broadcastMessage() public method

public broadcastMessage ( string $message, Player[] | null $recipients = null ) : integer
$message string
$recipients Player[] | null
return integer

broadcastPacket() public static method

Broadcasts a Minecraft packet to a list of players
public static broadcastPacket ( array $players, DataPacket $packet )
$players array
$packet pocketmine\network\protocol\DataPacket

broadcastPacketsCallback() public method

public broadcastPacketsCallback ( $data, array $identifiers )
$identifiers array

broadcastPopup() public method

public broadcastPopup ( string $popup, Player[] | null $recipients = null ) : integer
$popup string
$recipients Player[] | null
return integer

broadcastTip() public method

public broadcastTip ( string $tip, Player[] | null $recipients = null ) : integer
$tip string
$recipients Player[] | null
return integer

checkConsole() public method

public checkConsole ( )

crashDump() public method

public crashDump ( )

disablePlugins() public method

public disablePlugins ( )

dispatchCommand() public method

Executes a command from a CommandSender
public dispatchCommand ( pocketmine\command\CommandSender $sender, string $commandLine ) : boolean
$sender pocketmine\command\CommandSender
$commandLine string
return boolean

doAutoSave() public method

public doAutoSave ( )

enablePlugin() public method

public enablePlugin ( pocketmine\plugin\Plugin $plugin )
$plugin pocketmine\plugin\Plugin

enablePlugins() public method

public enablePlugins ( integer $type )
$type integer

exceptionHandler() public method

public exceptionHandler ( Throwable $e, $trace = null )
$e Throwable

forceShutdown() public method

public forceShutdown ( )

generateLevel() public method

Generates a new level if it does not exists
public generateLevel ( string $name, integer $seed = null, string $generator = null, array $options = [] ) : boolean
$name string
$seed integer
$generator string Class name that extends pocketmine\level\generator\Noise
$options array
return boolean

getAllowFlight() public method

public getAllowFlight ( ) : boolean
return boolean

getAllowInvCheats() public method

public getAllowInvCheats ( ) : boolean
return boolean

getApiVersion() public method

public getApiVersion ( ) : string
return string

getAutoSave() public method

public getAutoSave ( ) : boolean
return boolean

getCodename() public method

public getCodename ( ) : string
return string

getCommandAliases() public method

public getCommandAliases ( ) : string[]
return string[]

getCommandMap() public method

public getCommandMap ( ) : SimpleCommandMap
return pocketmine\command\SimpleCommandMap

getConfigBoolean() public method

public getConfigBoolean ( string $variable, boolean $defaultValue = false ) : boolean
$variable string
$defaultValue boolean
return boolean

getConfigInt() public method

public getConfigInt ( string $variable, integer $defaultValue ) : integer
$variable string
$defaultValue integer
return integer

getConfigString() public method

public getConfigString ( string $variable, string $defaultValue = "" ) : string
$variable string
$defaultValue string
return string

getCraftingManager() public method

public getCraftingManager ( ) : CraftingManager
return pocketmine\inventory\CraftingManager

getCrashDumpPath() public method

public getCrashDumpPath ( ) : string
return string

getDataPath() public method

public getDataPath ( ) : string
return string

getDefaultGamemode() public method

public getDefaultGamemode ( ) : integer
return integer

getDefaultLevel() public method

public getDefaultLevel ( ) : Level
return pocketmine\level\Level

getDifficulty() public method

public getDifficulty ( ) : integer
return integer

getDifficultyFromString() public static method

public static getDifficultyFromString ( string $str ) : integer
$str string
return integer

getEntityMetadata() public method

public getEntityMetadata ( ) : EntityMetadataStore
return pocketmine\metadata\EntityMetadataStore

getFilePath() public method

public getFilePath ( ) : string
return string

getForceGamemode() public method

public getForceGamemode ( ) : boolean
return boolean

getGamemode() public method

public getGamemode ( ) : integer
return integer

getGamemodeFromString() public static method

Parses a string and returns a gamemode integer, -1 if not found
public static getGamemodeFromString ( string $str ) : integer
$str string
return integer

getGamemodeString() public static method

Returns the gamemode text name
public static getGamemodeString ( integer $mode ) : string
$mode integer
return string

getGenerateStructures() public method

public getGenerateStructures ( ) : boolean
return boolean

getIPBans() public method

public getIPBans ( ) : BanList
return pocketmine\permission\BanList

getInstance() public static method

public static getInstance ( ) : Server
return Server

getIp() public method

public getIp ( ) : string
return string

getLanguage() public method

public getLanguage ( ) : BaseLang
return pocketmine\lang\BaseLang

getLevel() public method

public getLevel ( integer $levelId ) : Level
$levelId integer
return pocketmine\level\Level

getLevelByName() public method

public getLevelByName ( $name ) : Level
$name
return pocketmine\level\Level

getLevelMetadata() public method

public getLevelMetadata ( ) : LevelMetadataStore
return pocketmine\metadata\LevelMetadataStore

getLevelType() public method

public getLevelType ( ) : string
return string

getLevels() public method

public getLevels ( ) : Level[]
return pocketmine\level\Level[]

getLoader() public method

public getLoader ( ) : ClassLoader
return ClassLoader

getLogger() public method

public getLogger ( ) : AttachableThreadedLogger
return AttachableThreadedLogger

getMaxPlayers() public method

public getMaxPlayers ( ) : integer
return integer

getMemoryManager() public method

public getMemoryManager ( ) : MemoryManager
return MemoryManager

getMotd() public method

public getMotd ( ) : string
return string

getName() public method

public getName ( ) : string
return string

getNameBans() public method

public getNameBans ( ) : BanList
return pocketmine\permission\BanList

getNetwork() public method

public getNetwork ( ) : Network
return pocketmine\network\Network

getOfflinePlayer() public method

public getOfflinePlayer ( string $name ) : OfflinePlayer | Player
$name string
return OfflinePlayer | Player

getOfflinePlayerData() public method

public getOfflinePlayerData ( string $name ) : CompoundTag
$name string
return pocketmine\nbt\tag\CompoundTag

getOnlinePlayers() public method

public getOnlinePlayers ( ) : Player[]
return Player[]

getOps() public method

public getOps ( ) : Config
return pocketmine\utils\Config

getPlayer() public method

public getPlayer ( string $name ) : Player
$name string
return Player

getPlayerExact() public method

public getPlayerExact ( string $name ) : Player
$name string
return Player

getPlayerMetadata() public method

public getPlayerMetadata ( ) : PlayerMetadataStore
return pocketmine\metadata\PlayerMetadataStore

getPluginCommand() public method

public getPluginCommand ( string $name ) : pocketmine\command\PluginIdentifiableCommand
$name string
return pocketmine\command\PluginIdentifiableCommand

getPluginManager() public method

public getPluginManager ( ) : PluginManager
return pocketmine\plugin\PluginManager

getPluginPath() public method

public getPluginPath ( ) : string
return string

getPocketMineBuild() public method

public getPocketMineBuild ( ) : string
return string

getPocketMineVersion() public method

public getPocketMineVersion ( ) : string
return string

getPort() public method

public getPort ( ) : integer
return integer

getProperty() public method

public getProperty ( string $variable, mixed $defaultValue = null ) : mixed
$variable string
$defaultValue mixed
return mixed

getQueryInformation() public method

public getQueryInformation ( )

getScheduler() public method

public getScheduler ( ) : ServerScheduler
return pocketmine\scheduler\ServerScheduler

getServerUniqueId() public method

public getServerUniqueId ( )

getSpawnRadius() public method

public getSpawnRadius ( ) : integer
return integer

getTick() public method

public getTick ( ) : integer
return integer

getTickUsage() public method

Returns the TPS usage/load in %
public getTickUsage ( ) : float
return float

getTickUsageAverage() public method

Returns the TPS usage/load average in %
public getTickUsageAverage ( ) : float
return float

getTicksPerSecond() public method

Returns the last server TPS measure
public getTicksPerSecond ( ) : float
return float

getTicksPerSecondAverage() public method

Returns the last server TPS average measure
public getTicksPerSecondAverage ( ) : float
return float

getUpdater() public method

public getUpdater ( ) : AutoUpdater
return pocketmine\updater\AutoUpdater

getVersion() public method

public getVersion ( ) : string
return string

getViewDistance() public method

public getViewDistance ( ) : integer
return integer

getWhitelisted() public method

public getWhitelisted ( ) : Config
return pocketmine\utils\Config

handlePacket() public method

public handlePacket ( string $address, integer $port, string $payload )
$address string
$port integer
$payload string TODO: move this to Network

handleSignal() public method

public handleSignal ( $signo )

hasWhitelist() public method

public hasWhitelist ( ) : boolean
return boolean

isHardcore() public method

public isHardcore ( ) : boolean
return boolean

isLanguageForced() public method

public isLanguageForced ( ) : boolean
return boolean

isLevelGenerated() public method

public isLevelGenerated ( string $name ) : boolean
$name string
return boolean

isLevelLoaded() public method

public isLevelLoaded ( string $name ) : boolean
$name string
return boolean

isOp() public method

public isOp ( string $name ) : boolean
$name string
return boolean

isRunning() public method

public isRunning ( ) : boolean
return boolean

isWhitelisted() public method

public isWhitelisted ( string $name ) : boolean
$name string
return boolean

loadLevel() public method

Loads a level from the data directory
public loadLevel ( string $name ) : boolean
$name string
return boolean

loadPlugin() public method

Deprecation:
public loadPlugin ( pocketmine\plugin\Plugin $plugin )
$plugin pocketmine\plugin\Plugin

matchPlayer() public method

public matchPlayer ( string $partialName ) : Player[]
$partialName string
return Player[]

microSleep() public static method

public static microSleep ( integer $microseconds )
$microseconds integer

onPlayerLogin() public method

public onPlayerLogin ( Player $player )
$player Player

reload() public method

public reload ( )

reloadWhitelist() public method

public reloadWhitelist ( )

removeOnlinePlayer() public method

public removeOnlinePlayer ( Player $player )
$player Player

removeOp() public method

public removeOp ( string $name )
$name string

removePlayer() public method

public removePlayer ( Player $player )
$player Player

removePlayerListData() public method

public removePlayerListData ( UUID $uuid, array $players = null )
$uuid pocketmine\utils\UUID
$players array

removeWhitelist() public method

public removeWhitelist ( string $name )
$name string

saveOfflinePlayerData() public method

public saveOfflinePlayerData ( string $name, CompoundTag $nbtTag, boolean $async = false )
$name string
$nbtTag pocketmine\nbt\tag\CompoundTag
$async boolean

sendFullPlayerListData() public method

public sendFullPlayerListData ( Player $p )
$p Player

sendRecipeList() public method

public sendRecipeList ( Player $p )
$p Player

sendUsage() public method

public sendUsage ( $type = SendUsageTask::TYPE_STATUS )

setAutoSave() public method

public setAutoSave ( boolean $value )
$value boolean

setConfigBool() public method

public setConfigBool ( string $variable, boolean $value )
$variable string
$value boolean

setConfigInt() public method

public setConfigInt ( string $variable, integer $value )
$variable string
$value integer

setConfigString() public method

public setConfigString ( string $variable, string $value )
$variable string
$value string

setDefaultLevel() public method

Sets the default level to a different level This won't change the level-name property, it only affects the server on runtime
public setDefaultLevel ( Level $level )
$level pocketmine\level\Level

setshutdownreason() public method

public setshutdownreason ( $reason )

shouldSavePlayerData() public method

public shouldSavePlayerData ( ) : boolean
return boolean

shutdown() public method

Shutdowns the server correctly
public shutdown ( )

start() public method

Starts the PocketMine-MP server and starts processing ticks and packets
public start ( )

unloadLevel() public method

public unloadLevel ( Level $level, boolean $forceUnload = false ) : boolean
$level pocketmine\level\Level
$forceUnload boolean
return boolean

updatePlayerListData() public method

public updatePlayerListData ( UUID $uuid, $entityId, $name, $skinId, $skinData, array $players = null )
$uuid pocketmine\utils\UUID
$players array

Property Details

$netherName public_oe property

Name of nether world
public $netherName

$networkCompressionLevel public_oe property

public $networkCompressionLevel

$propertyCache public_oe property

public $propertyCache