Skip to content

Server ​

class · pocketmine\Server · source

The class that manages everything

Constants ​

BROADCAST_CHANNEL_ADMINISTRATIVE ​

php
public const BROADCAST_CHANNEL_ADMINISTRATIVE = "pocketmine.broadcast.admin"

BROADCAST_CHANNEL_USERS ​

php
public const BROADCAST_CHANNEL_USERS = "pocketmine.broadcast.user"

DEFAULT_MAX_PLAYERS ​

php
public const DEFAULT_MAX_PLAYERS = 20

DEFAULT_MAX_VIEW_DISTANCE ​

php
public const DEFAULT_MAX_VIEW_DISTANCE = 16

DEFAULT_PORT_IPV4 ​

php
public const DEFAULT_PORT_IPV4 = 19132

DEFAULT_PORT_IPV6 ​

php
public const DEFAULT_PORT_IPV6 = 19133

DEFAULT_SERVER_NAME ​

php
public const DEFAULT_SERVER_NAME = \pocketmine\VersionInfo::NAME . " Server"

TARGET_NANOSECONDS_PER_TICK ​

php
public const TARGET_NANOSECONDS_PER_TICK = 1000000000 / self::TARGET_TICKS_PER_SECOND

TARGET_SECONDS_PER_TICK ​

php
public const TARGET_SECONDS_PER_TICK = 1 / self::TARGET_TICKS_PER_SECOND

The average time between ticks, in seconds.

TARGET_TICKS_PER_SECOND ​

php
public const TARGET_TICKS_PER_SECOND = 20

Worlds, network, commands and most other things are polled this many times per second on average. Between ticks, the server will sleep to ensure that the average tick rate is maintained. It may wake up between ticks if a Snooze notification source is triggered (e.g. to process network packets).

Methods ​

__construct() ​

php
public function __construct(\pocketmine\thread\ThreadSafeClassLoader $autoloader, \pocketmine\thread\log\AttachableThreadSafeLogger $logger, string $dataPath, string $pluginPath)

__debugInfo() ​

php
public function __debugInfo() : array

addOnlinePlayer() ​

php
public function addOnlinePlayer(\pocketmine\player\Player $player) : bool

addOp() ​

php
public function addOp(string $name) : void

addWhitelist() ​

php
public function addWhitelist(string $name) : void

broadcastMessage() ​

php
public function broadcastMessage(\pocketmine\lang\Translatable|string $message, ?array $recipients = null) : int

broadcastPopup() ​

php
public function broadcastPopup(string $popup, ?array $recipients = null) : int

broadcastTip() ​

php
public function broadcastTip(string $tip, ?array $recipients = null) : int

broadcastTitle() ​

php
public function broadcastTitle(string $title, string $subtitle = "", int $fadeIn = -1, int $stay = -1, int $fadeOut = -1, ?array $recipients = null) : int

crashDump() ​

php
public function crashDump() : void

createPlayer() ​

php
public function createPlayer(\pocketmine\network\mcpe\NetworkSession $session, \pocketmine\player\PlayerInfo $playerInfo, bool $authenticated, ?\pocketmine\nbt\tag\CompoundTag $offlinePlayerData) : \pocketmine\promise\Promise

dispatchCommand() ​

php
public function dispatchCommand(\pocketmine\command\CommandSender $sender, string $commandLine, bool $internal = false) : bool

Executes a command from a CommandSender

enablePlugins() ​

php
public function enablePlugins(\pocketmine\plugin\PluginEnableOrder $type) : bool

exceptionHandler() ​

php
public function exceptionHandler(\Throwable $e, ?array $trace = null) : void

forceShutdown() ​

php
public function forceShutdown() : void

getAllowedViewDistance() ​

php
public function getAllowedViewDistance(int $distance) : int

Returns a view distance up to the currently-allowed limit.

getApiVersion() ​

php
public function getApiVersion() : string

getAsyncPool() ​

php
public function getAsyncPool() : \pocketmine\scheduler\AsyncPool

getBroadcastChannelSubscribers() ​

php
public function getBroadcastChannelSubscribers(string $channelId) : array

Returns a list of all the CommandSenders subscribed to the given broadcast channel.

getCommandAliases() ​

php
public function getCommandAliases() : array

getCommandMap() ​

php
public function getCommandMap() : \pocketmine\command\SimpleCommandMap

getConfigGroup() ​

php
public function getConfigGroup() : \pocketmine\ServerConfigGroup

getCraftingManager() ​

php
public function getCraftingManager() : \pocketmine\crafting\CraftingManager

getDataPath() ​

php
public function getDataPath() : string

getDifficulty() ​

php
public function getDifficulty() : int

Returns Server global difficulty. Note that this may be overridden in individual worlds.

getFilePath() ​

php
public function getFilePath() : string

getForceGamemode() ​

php
public function getForceGamemode() : bool

getGamemode() ​

php
public function getGamemode() : \pocketmine\player\GameMode

getIPBans() ​

php
public function getIPBans() : \pocketmine\permission\BanList

getInstance() ​

php
public static function getInstance() : \pocketmine\Server

getIp() ​

php
public function getIp() : string

getIpV6() ​

php
public function getIpV6() : string

getLanguage() ​

php
public function getLanguage() : \pocketmine\lang\Language

getLanguageForLocale() 5.46.0 ​

php
public function getLanguageForLocale(string $locale) : \pocketmine\lang\Language

Returns the language to use for a client with the given locale (e.g. "es_MX"). Falls back to the server language if per-player languages are disabled or no translation exists for the locale.

getLoader() ​

php
public function getLoader() : \pocketmine\thread\ThreadSafeClassLoader

getLogger() ​

php
public function getLogger() : \pocketmine\thread\log\AttachableThreadSafeLogger

getMaxPlayers() ​

php
public function getMaxPlayers() : int

getMemoryManager() ​

php
public function getMemoryManager() : \pocketmine\MemoryManager

getMotd() ​

php
public function getMotd() : string

getName() ​

php
public function getName() : string

getNameBans() ​

php
public function getNameBans() : \pocketmine\permission\BanList

getNetwork() ​

php
public function getNetwork() : \pocketmine\network\Network

getOfflinePlayer() ​

php
public function getOfflinePlayer(string $name) : \pocketmine\player\Player|\pocketmine\player\OfflinePlayer|null

getOfflinePlayerData() ​

php
public function getOfflinePlayerData(string $name) : ?\pocketmine\nbt\tag\CompoundTag

getOnlineMode() ​

php
public function getOnlineMode() : bool

Returns whether the server requires that players be authenticated to Xbox Live. If true, connecting players who are not logged into Xbox Live will be disconnected.

getOnlinePlayers() ​

php
public function getOnlinePlayers() : array

getOps() ​

php
public function getOps() : \pocketmine\utils\Config

getPlayerByPrefix() ​

php
public function getPlayerByPrefix(string $name) : ?\pocketmine\player\Player

Deprecated

This method's results are unpredictable. The string "Steve" will return the player named "SteveJobs",

Returns an online player whose name begins with or equals the given string (case insensitive). The closest match will be returned, or null if there are no online matches.

getPlayerByRawUUID() ​

php
public function getPlayerByRawUUID(string $rawUUID) : ?\pocketmine\player\Player

Returns the player online with the specified raw UUID, or null if not found

getPlayerByUUID() ​

php
public function getPlayerByUUID(\Ramsey\Uuid\UuidInterface $uuid) : ?\pocketmine\player\Player

Returns the player online with a UUID equivalent to the specified UuidInterface object, or null if not found

getPlayerExact() ​

php
public function getPlayerExact(string $name) : ?\pocketmine\player\Player

Returns an online player with the given name (case insensitive), or null if not found.

getPluginCommand() ​

php
public function getPluginCommand(string $name)

getPluginManager() ​

php
public function getPluginManager() : \pocketmine\plugin\PluginManager

getPluginPath() ​

php
public function getPluginPath() : string

getPocketMineVersion() ​

php
public function getPocketMineVersion() : string

getPort() ​

php
public function getPort() : int

getPortV6() ​

php
public function getPortV6() : int

getProxyNetwork() 5.46.0 ​

php
public function getProxyNetwork() : ?\pocketmine\network\proxy\ProxyNetwork

The pm-proxy network this server belongs to (network.proxy in pocketmine.yml), or null when it is not behind pm-proxy.

getQueryInformation() ​

php
public function getQueryInformation() : \pocketmine\network\query\QueryInfo

getResourcePackManager() ​

php
public function getResourcePackManager() : \pocketmine\resourcepacks\ResourcePackManager

getResourcePath() ​

php
public function getResourcePath() : string

getServerUniqueId() ​

php
public function getServerUniqueId() : \Ramsey\Uuid\UuidInterface

getStartTime() ​

php
public function getStartTime() : float

getTick() ​

php
public function getTick() : int

getTickSleeper() ​

php
public function getTickSleeper() : \pocketmine\snooze\SleeperHandler

getTickStartTime() 5.46.0 ​

php
public function getTickStartTime() : float

Returns the time (microtime(true)) at which the current server tick started. Code which runs every tick for every player can use it instead of reading the clock, which is slow on some virtual machines.

getTickUsage() ​

php
public function getTickUsage() : float

Returns the TPS usage/load in %

getTickUsageAverage() ​

php
public function getTickUsageAverage() : float

Returns the TPS usage/load average in %

getTicksPerSecond() ​

php
public function getTicksPerSecond() : float

Returns the last server TPS measure

getTicksPerSecondAverage() ​

php
public function getTicksPerSecondAverage() : float

Returns the last server TPS average measure

getUpdater() ​

php
public function getUpdater() : \pocketmine\updater\UpdateChecker

getVersion() ​

php
public function getVersion() : string

getViewDistance() ​

php
public function getViewDistance() : int

getWhitelisted() ​

php
public function getWhitelisted() : \pocketmine\utils\Config

getWorldManager() ​

php
public function getWorldManager() : \pocketmine\world\WorldManager

hasOfflinePlayerData() ​

php
public function hasOfflinePlayerData(string $name) : bool

Returns whether the server has stored any saved data for this player.

hasWhitelist() ​

php
public function hasWhitelist() : bool

isHardcore() ​

php
public function isHardcore() : bool

isLanguageForced() ​

php
public function isLanguageForced() : bool

isOp() ​

php
public function isOp(string $name) : bool

isPerPlayerLanguageEnabled() 5.46.0 ​

php
public function isPerPlayerLanguageEnabled() : bool

Returns whether server-side messages are translated to each player's own language.

isRunning() ​

php
public function isRunning() : bool

isWhitelisted() ​

php
public function isWhitelisted(string $name) : bool

removeOnlinePlayer() ​

php
public function removeOnlinePlayer(\pocketmine\player\Player $player) : void

removeOp() ​

php
public function removeOp(string $name) : void

removeWhitelist() ​

php
public function removeWhitelist(string $name) : void

requiresAuthentication() ​

php
public function requiresAuthentication() : bool

Alias of #getOnlineMode().

saveOfflinePlayerData() ​

php
public function saveOfflinePlayerData(string $name, \pocketmine\nbt\tag\CompoundTag $nbtTag) : void

sendUsage() ​

php
public function sendUsage(int $type = \pocketmine\stats\SendUsageTask::TYPE_STATUS) : void

shouldSavePlayerData() ​

php
public function shouldSavePlayerData() : bool

shutdown() ​

php
public function shutdown() : void

Shuts the server down correctly

subscribeToBroadcastChannel() ​

php
public function subscribeToBroadcastChannel(string $channelId, \pocketmine\command\CommandSender $subscriber) : void

Subscribes to a particular message broadcast channel. The channel ID can be any arbitrary string.

unsubscribeFromAllBroadcastChannels() ​

php
public function unsubscribeFromAllBroadcastChannels(\pocketmine\command\CommandSender $subscriber) : void

Unsubscribes from all broadcast channels.

unsubscribeFromBroadcastChannel() ​

php
public function unsubscribeFromBroadcastChannel(string $channelId, \pocketmine\command\CommandSender $subscriber) : void

Unsubscribes from a particular message broadcast channel.

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.