Package cn.nukkit

Class Server

java.lang.Object
cn.nukkit.Server

public class Server extends Object
代表着服务器对象,全局单例.

Nukkit中被实例化,后通过getInstance()获取实例对象. Server的构造方法进行了一系列操作,包括但不限于初始化配置文件,创建线程、线程池,开启插件,注册配方、方块、实体、物品等.

Represents a server object, global singleton.

is instantiated in Nukkit and later the instance object is obtained via getInstance(). The constructor method of Server performs a number of operations, including but not limited to initializing configuration files, creating threads, thread pools, start plugins, registering recipes, blocks, entities, items, etc.

Author:
MagicDroidX, Box
  • Field Details

    • BROADCAST_CHANNEL_ADMINISTRATIVE

      public static final String BROADCAST_CHANNEL_ADMINISTRATIVE
      See Also:
    • BROADCAST_CHANNEL_USERS

      public static final String BROADCAST_CHANNEL_USERS
      See Also:
    • computeThreadPool

      public final ForkJoinPool computeThreadPool
      负责地形生成,数据压缩等计算任务的FJP线程池

      FJP thread pool responsible for terrain generation, data compression and other computing tasks

    • checkLoginTime

      public boolean checkLoginTime
      配置项是否检查登录时间.

      Does the configuration item check the login time.

    • networkCompressionLevel

      public int networkCompressionLevel
      网络压缩级别

      Network compression level

  • Method Details

    • broadcastMessage

      public int broadcastMessage(String message)
      广播一条消息给所有玩家

      Broadcast a message to all players

      Parameters:
      message - 消息
      Returns:
      int 玩家数量
      Number of players
    • broadcastMessage

      public int broadcastMessage(TextContainer message)
      See Also:
    • broadcastMessage

      public int broadcastMessage(String message, CommandSender[] recipients)
      广播一条消息给指定的recipients

      Broadcast a message to the specified recipients

      Parameters:
      message - 消息
      Returns:
      int recipients数量
      Number of recipients
    • broadcastMessage

      public int broadcastMessage(String message, Collection<? extends CommandSender> recipients)
      See Also:
    • broadcastMessage

      public int broadcastMessage(TextContainer message, Collection<? extends CommandSender> recipients)
      See Also:
    • broadcast

      public int broadcast(String message, String permissions)
      从指定的许可名获取发送者们,广播一条消息给他们.可以指定多个许可名,以 ; 分割.
      一个permission在PluginManager.permSubs对应一个发送者Set.

      Get the sender to broadcast a message from the specified permission name, multiple permissions can be specified, split by ;
      The permission corresponds to a Sender set in PluginManager.permSubs.

      Parameters:
      message - 消息内容
      Message content
      permissions - 许可名,需要先通过subscribeToPermission注册
      Permissions name, need to register first through subscribeToPermission
      Returns:
      int 接受到消息的发送者数量
      Number of senders who received the message
    • broadcast

      public int broadcast(TextContainer message, String permissions)
      See Also:
    • broadcastPacket

      public static void broadcastPacket(Collection<Player> players, DataPacket packet)
      See Also:
    • broadcastPacket

      public static void broadcastPacket(Player[] players, DataPacket packet)
      广播一个数据包给指定的玩家们.

      Broadcast a packet to the specified players.

      Parameters:
      players - 接受数据包的所有玩家
      All players receiving the data package
      packet - 数据包
    • batchPackets

      @DeprecationDetails(since="1.4.0.0-PN", by="Cloudburst Nukkit", reason="Packet management was refactored, batching is done automatically near the RakNet layer") @Deprecated public void batchPackets(Player[] players, DataPacket[] packets)
      Deprecated.
    • batchPackets

      @DeprecationDetails(since="1.4.0.0-PN", by="Cloudburst Nukkit", reason="Packet management was refactored, batching is done automatically near the RakNet layer") @Deprecated public void batchPackets(Player[] players, DataPacket[] packets, boolean forceSync)
      Deprecated.
    • broadcastPacketsCallback

      public void broadcastPacketsCallback(byte[] data, List<InetSocketAddress> targets)
    • enablePlugins

      public void enablePlugins(PluginLoadOrder type)
      以指定插件加载顺序启用插件

      Enable plugins in the specified plugin loading order

      Parameters:
      type - 插件加载顺序
      Plugin loading order
    • enablePlugin

      public void enablePlugin(Plugin plugin)
      启用一个指定插件

      Enable a specified plugin

      Parameters:
      plugin - 插件实例
      Plugin instance
    • disablePlugins

      public void disablePlugins()
      禁用全部插件

      Disable all plugins

    • dispatchCommand

      @Deprecated @DeprecationDetails(since="1.19.60-r1", reason="use Server#executeCommand") public boolean dispatchCommand(CommandSender sender, String commandLine) throws ServerException
      Deprecated.
      Throws:
      ServerException
    • executeCommand

      public int executeCommand(CommandSender sender, String commandLine) throws ServerException
      以sender身份执行一行命令

      Execute one line of command as sender

      Parameters:
      sender - 命令执行者
      commandLine - 一行命令
      Returns:
      返回0代表执行失败, 返回大于等于1代表执行成功
      Returns 0 for failed execution, greater than or equal to 1 for successful execution
      Throws:
      ServerException - 服务器异常
    • silentExecuteCommand

      public void silentExecuteCommand(String... commands)
      以该控制台身份静音执行这些命令,无视权限

      Execute these commands silently as the console, ignoring permissions.

      Parameters:
      commands - the commands
      Throws:
      ServerException - 服务器异常
    • silentExecuteCommand

      public void silentExecuteCommand(@Nullable Player sender, String... commands)
      以该玩家身份静音执行这些命令无视权限

      Execute these commands silently as this player, ignoring permissions.

      Parameters:
      sender - 命令执行者
      command sender
      commands - the commands
      Throws:
      ServerException - 服务器异常
    • getConsoleSender

      public ConsoleCommandSender getConsoleSender()
      得到控制台发送者

      Get the console sender

      Returns:
      ConsoleCommandSender
    • reload

      public void reload()
      重载服务器

      Reload Server

    • shutdown

      public void shutdown()
      关闭服务器

      Shut down the server

    • forceShutdown

      public void forceShutdown()
      强制关闭服务器

      Force Shut down the server

    • start

      public void start()
    • handlePacket

      public void handlePacket(InetSocketAddress address, io.netty.buffer.ByteBuf payload)
    • tickProcessor

      public void tickProcessor()
    • onPlayerCompleteLoginSequence

      public void onPlayerCompleteLoginSequence(Player player)
    • onPlayerLogin

      public void onPlayerLogin(Player player)
    • addPlayer

      public void addPlayer(InetSocketAddress socketAddress, Player player)
    • addOnlinePlayer

      public void addOnlinePlayer(Player player)
    • removeOnlinePlayer

      public void removeOnlinePlayer(Player player)
    • updatePlayerListData

      public void updatePlayerListData(UUID uuid, long entityId, String name, Skin skin)
      See Also:
    • updatePlayerListData

      public void updatePlayerListData(UUID uuid, long entityId, String name, Skin skin, String xboxUserId)
      See Also:
    • updatePlayerListData

      public void updatePlayerListData(UUID uuid, long entityId, String name, Skin skin, Player[] players)
      See Also:
    • updatePlayerListData

      public void updatePlayerListData(UUID uuid, long entityId, String name, Skin skin, String xboxUserId, Player[] players)
      更新指定玩家们(players)的PlayerListPacket数据包(即玩家列表数据)

      Update PlayerListPacket data packets (i.e. player list data) for specified players

      Parameters:
      uuid - uuid
      entityId - 实体id
      name - 名字
      skin - 皮肤
      xboxUserId - xbox用户id
      players - 指定接受数据包的玩家
    • updatePlayerListData

      public void updatePlayerListData(UUID uuid, long entityId, String name, Skin skin, String xboxUserId, Collection<Player> players)
      See Also:
    • removePlayerListData

      public void removePlayerListData(UUID uuid)
    • removePlayerListData

      public void removePlayerListData(UUID uuid, Player[] players)
      移除玩家数组中所有玩家的玩家列表数据.

      Remove player list data for all players in the array.

      Parameters:
      players - 玩家数组
    • removePlayerListData

      @Since("1.4.0.0-PN") public void removePlayerListData(UUID uuid, Player player)
      移除这个玩家的玩家列表数据.

      Remove this player's player list data.

      Parameters:
      player - 玩家
    • removePlayerListData

      public void removePlayerListData(UUID uuid, Collection<Player> players)
    • sendFullPlayerListData

      public void sendFullPlayerListData(Player player)
      发送玩家列表数据包给一个玩家.

      Send a player list packet to a player.

      Parameters:
      player - 玩家
    • sendRecipeList

      public void sendRecipeList(Player player)
      发送配方列表数据包给一个玩家.

      Send a recipe list packet to a player.

      Parameters:
      player - 玩家
    • doAutoSave

      public void doAutoSave()
    • getNextTick

      public long getNextTick()
    • titleTick

      public void titleTick()
    • getQueryInformation

      public QueryRegenerateEvent getQueryInformation()
    • getName

      public String getName()
      Returns:
      服务器名称
      The name of server
    • isRunning

      public boolean isRunning()
    • getNukkitVersion

      public String getNukkitVersion()
    • getBStatsNukkitVersion

      public String getBStatsNukkitVersion()
    • getGitCommit

      @PowerNukkitOnly public String getGitCommit()
    • getCodename

      public String getCodename()
    • getVersion

      public String getVersion()
    • getApiVersion

      public String getApiVersion()
    • getFilePath

      public String getFilePath()
    • getDataPath

      public String getDataPath()
    • getPluginPath

      public String getPluginPath()
    • getMaxPlayers

      public int getMaxPlayers()
    • setMaxPlayers

      public void setMaxPlayers(int maxPlayers)
    • addBusying

      public int addBusying(long busyTime)
      将服务器设置为繁忙状态,这可以阻止相关代码认为服务器处于无响应状态。 请牢记,必须在设置之后清除。
      Parameters:
      busyTime - 单位为毫秒
      Returns:
      id
    • removeBusying

      public void removeBusying(int index)
    • getBusyingTime

      public long getBusyingTime()
    • getPort

      public int getPort()
      Returns:
      服务器端口
      server port
    • getViewDistance

      public int getViewDistance()
      Returns:
      可视距离
      server view distance
    • getIp

      public String getIp()
      Returns:
      服务器网络地址
      server ip
    • getServerUniqueId

      public UUID getServerUniqueId()
      Returns:
      服务器UUID
      server UUID
    • getAutoSave

      public boolean getAutoSave()
      Returns:
      服务器是否会自动保存
      Does the server automatically save
    • setAutoSave

      public void setAutoSave(boolean autoSave)
      设置服务器自动保存

      Set server autosave

      Parameters:
      autoSave - 是否自动保存
      Whether to save automatically
    • getLevelType

      public String getLevelType()
    • getGenerateStructures

      public boolean getGenerateStructures()
      Returns:
      服务器是否生成结构
      Whether the server generate the structure.
    • getGamemode

      public int getGamemode()
      得到服务器的gamemode

      Get the gamemode of the server

      Returns:
      gamemode id
    • getForceGamemode

      public boolean getForceGamemode()
    • getGamemodeString

      public static String getGamemodeString(int mode)
      默认direct=false
      See Also:
    • getGamemodeString

      public static String getGamemodeString(int mode, boolean direct)
      从gamemode id获取游戏模式字符串.

      Get game mode string from gamemode id.

      Parameters:
      mode - gamemode id
      direct - 如果为true就直接返回字符串,为false返回代表游戏模式的硬编码字符串.
      If true, the string is returned directly, and if false, the hard-coded string representing the game mode is returned.
      Returns:
      游戏模式字符串
      Game Mode String
    • getGamemodeFromString

      public static int getGamemodeFromString(String str)
      从字符串获取gamemode

      Get gamemode from string

      Parameters:
      str - 代表游戏模式的字符串,例如0,survival...
      A string representing the game mode, e.g. 0,survival...
      Returns:
      游戏模式id
      gamemode id
    • getDifficultyFromString

      public static int getDifficultyFromString(String str)
      从字符串获取游戏难度

      Get game difficulty from string

      Parameters:
      str - 代表游戏难度的字符串,例如0,peaceful...
      A string representing the game difficulty, e.g. 0,peaceful...
      Returns:
      游戏难度id
      game difficulty id
    • getDifficulty

      public int getDifficulty()
      获得服务器游戏难度

      Get server game difficulty

      Returns:
      游戏难度id
      game difficulty id
    • setDifficulty

      public void setDifficulty(int difficulty)
      设置服务器游戏难度

      set server game difficulty

      Parameters:
      difficulty - 游戏难度id
      game difficulty id
    • hasWhitelist

      public boolean hasWhitelist()
      Returns:
      是否开启白名单
      Whether to start server whitelist
    • getSpawnRadius

      public int getSpawnRadius()
      Returns:
      得到服务器出生点保护半径
      Get server birth point protection radius
    • getAllowFlight

      public boolean getAllowFlight()
      Returns:
      服务器是否允许飞行
      Whether the server allows flying
    • isHardcore

      public boolean isHardcore()
      Returns:
      服务器是否为硬核模式
      Whether the server is in hardcore mode
    • getDefaultGamemode

      public int getDefaultGamemode()
      Returns:
      获取默认gamemode
      Get default gamemode
    • getMotd

      public String getMotd()
      Returns:
      得到服务器标题
      Get server motd
    • getSubMotd

      public String getSubMotd()
      Returns:
      得到服务器子标题
      Get the server subheading
    • getForceResources

      public boolean getForceResources()
      Returns:
      是否强制使用服务器资源包
      Whether to force the use of server resourcepack
    • getForceResourcesAllowOwnPacks

      public boolean getForceResourcesAllowOwnPacks()
      Returns:
      是否强制使用服务器资源包的同时允许加载客户端资源包
      Whether to force the use of server resourcepack while allowing the loading of client resourcepack
    • getLogger

      @Deprecated @DeprecationDetails(since="1.4.0.0-PN", by="PowerNukkit", reason="Use your own logger, sharing loggers makes bug analyses harder.", replaceWith="@Log4j2 annotation in the class and use the `log` static field that is generated by lombok, also make sure to log the exception as the last argument, don\'t concatenate it or use it as parameter replacement. Just put it as last argument and SLF4J will understand that the log message was caused by that exception/throwable.") public MainLogger getLogger()
      Deprecated.
    • getEntityMetadata

      public EntityMetadataStore getEntityMetadata()
    • getPlayerMetadata

      public PlayerMetadataStore getPlayerMetadata()
    • getLevelMetadata

      public LevelMetadataStore getLevelMetadata()
    • getPluginManager

      public PluginManager getPluginManager()
    • getCraftingManager

      public CraftingManager getCraftingManager()
    • getResourcePackManager

      public ResourcePackManager getResourcePackManager()
    • getScoreboardManager

      public IScoreboardManager getScoreboardManager()
    • getFunctionManager

      public FunctionManager getFunctionManager()
    • getTickingAreaManager

      public TickingAreaManager getTickingAreaManager()
    • getFreezableArrayManager

      public FreezableArrayManager getFreezableArrayManager()
    • getScheduler

      public ServerScheduler getScheduler()
    • getTick

      public int getTick()
      Returns:
      返回服务器经历过的tick数
      Returns the number of ticks recorded by the server
    • getTicksPerSecond

      public float getTicksPerSecond()
    • getTicksPerSecondAverage

      public float getTicksPerSecondAverage()
    • getTickUsage

      public float getTickUsage()
    • getTickUsageAverage

      public float getTickUsageAverage()
    • getCommandMap

      public SimpleCommandMap getCommandMap()
    • getOnlinePlayers

      public Map<UUID,Player> getOnlinePlayers()
      获得所有在线的玩家Map.

      Get all online players Map.

      Returns:
      所有的在线玩家Map
    • addRecipe

      public void addRecipe(Recipe recipe)
      注册配方到配方管理器

      Register Recipe to Recipe Manager

      Parameters:
      recipe - 配方
    • getPlayer

      public Optional<Player> getPlayer(UUID uuid)
      从指定的UUID得到玩家实例.

      Get the player instance from the specified UUID.

      Parameters:
      uuid - uuid
      Returns:
      玩家实例,可为空
      Player example, can be empty
    • lookupName

      public Optional<UUID> lookupName(String name)
      从数据库中查找指定玩家名对应的UUID.

      Find the UUID corresponding to the specified player name from the database.

      Parameters:
      name - 玩家名
      player name
      Returns:
      玩家的UUID,可为空.
      The player's UUID, which can be empty.
    • getOfflinePlayer

      public IPlayer getOfflinePlayer(String name)
    • getOfflinePlayer

      public IPlayer getOfflinePlayer(UUID uuid)
      从指定的UUID得到一个玩家实例,可以是在线玩家也可以是离线玩家.

      Get a player instance from the specified UUID, either online or offline.

      Parameters:
      uuid - uuid
      Returns:
      玩家
      player
    • getOfflinePlayerData

      public CompoundTag getOfflinePlayerData(UUID uuid)
      create为false

      create is false

      See Also:
    • getOfflinePlayerData

      public CompoundTag getOfflinePlayerData(UUID uuid, boolean create)
      获得UUID指定的玩家的NBT数据
      Parameters:
      uuid - 要获取数据的玩家UUID
      UUID of the player to get data from
      create - 如果玩家数据不存在是否创建
      If player data does not exist whether to create.
      Returns:
      CompoundTag
    • getOfflinePlayerData

      @Deprecated public CompoundTag getOfflinePlayerData(String name)
      Deprecated.
    • getOfflinePlayerData

      @Deprecated public CompoundTag getOfflinePlayerData(String name, boolean create)
      Deprecated.
    • saveOfflinePlayerData

      public void saveOfflinePlayerData(UUID uuid, CompoundTag tag)
      See Also:
    • saveOfflinePlayerData

      public void saveOfflinePlayerData(String name, CompoundTag tag)
      See Also:
    • saveOfflinePlayerData

      public void saveOfflinePlayerData(UUID uuid, CompoundTag tag, boolean async)
      See Also:
    • saveOfflinePlayerData

      public void saveOfflinePlayerData(String name, CompoundTag tag, boolean async)
      保存玩家数据,玩家在线离线都行.

      Save player data, players can be offline.

      Parameters:
      name - 玩家名
      player name
      tag - NBT数据
      nbt data
      async - 是否异步保存
      Whether to save asynchronously
    • getPlayer

      public Player getPlayer(String name)
      从玩家名获得一个在线玩家,这个方法是模糊匹配,只要玩家名带有name前缀就会被返回.

      Get an online player from the player name, this method is a fuzzy match and will be returned as long as the player name has the name prefix.

      Parameters:
      name - 玩家名
      player name
      Returns:
      玩家实例对象,获取失败为null
      Player instance object,failed to get null
    • getPlayerExact

      public Player getPlayerExact(String name)
      从玩家名获得一个在线玩家,这个方法是精确匹配,当玩家名字符串完全相同时返回.

      Get an online player from a player name, this method is an exact match and returns when the player name string is identical.

      Parameters:
      name - 玩家名
      player name
      Returns:
      玩家实例对象,获取失败为null
      Player instance object,failed to get null
    • matchPlayer

      public Player[] matchPlayer(String partialName)
      指定一个部分玩家名,返回所有包含或者等于该名称的玩家.

      Specify a partial player name and return all players with or equal to that name.

      Parameters:
      partialName - 部分玩家名
      partial name
      Returns:
      匹配到的所有玩家, 若匹配不到则为一个空数组
      All players matched, if not matched then an empty array
    • removePlayer

      public void removePlayer(Player player)
      删除一个玩家,可以让一个玩家离线.

      Delete a player to take a player offline.

      Parameters:
      player - 需要删除的玩家
      Players who need to be deleted
    • getLevels

      public Map<Integer,Level> getLevels()
      Returns:
      获得所有游戏世界
      Get all the game world
    • getDefaultLevel

      public Level getDefaultLevel()
      Returns:
      获得默认游戏世界
      Get the default world
    • setDefaultLevel

      public void setDefaultLevel(Level defaultLevel)
      设置默认游戏世界

      Set default game world

      Parameters:
      defaultLevel - 默认游戏世界
      default game world
    • isLevelLoaded

      public boolean isLevelLoaded(String name)
      Parameters:
      name - 世界名字
      Returns:
      世界是否已经加载
      Is the world already loaded
    • getLevel

      public Level getLevel(int levelId)
      从世界id得到世界,0主世界 1 地狱 2 末地

      Get world from world id,0 OVERWORLD 1 NETHER 2 THE_END

      Parameters:
      levelId - 世界id
      world id
      Returns:
      level实例
      level instance
    • getLevelByName

      public Level getLevelByName(String name)
      从世界名得到世界,overworld 主世界 nether 地狱 the_end 末地

      Get world from world name,overworld nether the_end

      Parameters:
      name - 世界名
      world name
      Returns:
      level实例
      level instance
    • unloadLevel

      public boolean unloadLevel(Level level)
    • unloadLevel

      public boolean unloadLevel(Level level, boolean forceUnload)
      卸载世界

      unload level

      Parameters:
      level - 世界
      forceUnload - 是否强制卸载
      whether to force uninstallation.
      Returns:
      卸载是否成功
    • loadLevel

      public boolean loadLevel(String name)
    • generateLevel

      public boolean generateLevel(String name)
    • generateLevel

      public boolean generateLevel(String name, long seed)
    • generateLevel

      public boolean generateLevel(String name, long seed, Class<? extends Generator> generator)
    • generateLevel

      public boolean generateLevel(String name, long seed, Class<? extends Generator> generator, Map<String,Object> options)
    • generateLevel

      @PowerNukkitXOnly @Since("1.19.20-r3") public boolean generateLevel(String name, long seed, Class<? extends Generator> generator, Map<String,Object> options, DimensionData givenDimensionData)
    • generateLevel

      public boolean generateLevel(String name, long seed, Class<? extends Generator> generator, Map<String,Object> options, DimensionData givenDimensionData, Class<? extends LevelProvider> provider)
    • isLevelGenerated

      public boolean isLevelGenerated(String name)
    • getLanguage

      public BaseLang getLanguage()
    • getLanguageCode

      public LangCode getLanguageCode()
    • isLanguageForced

      public boolean isLanguageForced()
    • isRedstoneEnabled

      @PowerNukkitOnly public boolean isRedstoneEnabled()
    • setRedstoneEnabled

      @PowerNukkitOnly public void setRedstoneEnabled(boolean redstoneEnabled)
    • getNetwork

      public Network getNetwork()
    • getConfig

      public Config getConfig()
    • getConfig

      public <T> T getConfig(String variable)
    • getConfig

      public <T> T getConfig(String variable, T defaultValue)
    • getProperties

      public Config getProperties()
    • getProperty

      public Object getProperty(String variable)
    • getProperty

      public Object getProperty(String variable, Object defaultValue)
    • setPropertyString

      public void setPropertyString(String variable, String value)
    • getPropertyString

      public String getPropertyString(String variable)
    • getPropertyString

      public String getPropertyString(String variable, String defaultValue)
    • getPropertyInt

      public int getPropertyInt(String variable)
    • getPropertyInt

      public int getPropertyInt(String variable, Integer defaultValue)
    • setPropertyInt

      public void setPropertyInt(String variable, int value)
    • getPropertyBoolean

      public boolean getPropertyBoolean(String variable)
    • getPropertyBoolean

      public boolean getPropertyBoolean(String variable, Object defaultValue)
    • setPropertyBoolean

      public void setPropertyBoolean(String variable, boolean value)
    • getPluginCommand

      public PluginIdentifiableCommand getPluginCommand(String name)
    • getNameBans

      public BanList getNameBans()
    • getIPBans

      public BanList getIPBans()
    • addOp

      public void addOp(String name)
    • removeOp

      public void removeOp(String name)
    • addWhitelist

      public void addWhitelist(String name)
    • removeWhitelist

      public void removeWhitelist(String name)
    • isWhitelisted

      public boolean isWhitelisted(String name)
    • isOp

      public boolean isOp(String name)
    • getWhitelist

      public Config getWhitelist()
    • getOps

      public Config getOps()
    • reloadWhitelist

      public void reloadWhitelist()
    • getServiceManager

      public ServiceManager getServiceManager()
    • getCommandAliases

      public Map<String,List<String>> getCommandAliases()
    • shouldSavePlayerData

      public boolean shouldSavePlayerData()
    • getPlayerSkinChangeCooldown

      public int getPlayerSkinChangeCooldown()
    • isNetherAllowed

      public boolean isNetherAllowed()
    • getPlayerDataSerializer

      public PlayerDataSerializer getPlayerDataSerializer()
    • setPlayerDataSerializer

      public void setPlayerDataSerializer(PlayerDataSerializer playerDataSerializer)
    • isIgnoredPacket

      @Since("1.3.0.0-PN") public boolean isIgnoredPacket(Class<? extends DataPacket> clazz)
    • isSafeSpawn

      @PowerNukkitOnly @Since("1.4.0.0-PN") public boolean isSafeSpawn()
    • getInstance

      public static Server getInstance()
    • getPositionTrackingService

      @PowerNukkitOnly @Since("1.4.0.0-PN") @NotNull public PositionTrackingService getPositionTrackingService()
    • isForceSkinTrusted

      @PowerNukkitOnly @Since("1.4.0.0-PN") public boolean isForceSkinTrusted()
    • isCheckMovement

      @PowerNukkitOnly @Since("1.4.0.0-PN") public boolean isCheckMovement()
    • getLaunchTime

      @PowerNukkitOnly @Since("1.4.0.0-PN") public long getLaunchTime()
    • isTheEndAllowed

      @PowerNukkitOnly @Since("1.4.0.0-PN") public boolean isTheEndAllowed()
    • isEnableExperimentMode

      @PowerNukkitXOnly @Since("1.6.0.0-PNX") public boolean isEnableExperimentMode()
    • isWaterdogCapable

      @PowerNukkitXOnly @Since("1.19.21-r4") public boolean isWaterdogCapable()
    • getMaximumStaleDatagrams

      @PowerNukkitXOnly @Since("1.19.30-r2") public int getMaximumStaleDatagrams()
    • getMaximumSizePerChunk

      @PowerNukkitXOnly @Since("1.19.30-r2") public int getMaximumSizePerChunk()
    • getServerAuthoritativeMovement

      @PowerNukkitXOnly @Since("1.19.40-r3") public int getServerAuthoritativeMovement()
    • isPrimaryThread

      public final boolean isPrimaryThread()
      Checks the current thread against the expected primary thread for the server.

      Note: this method should not be used to indicate the current synchronized state of the runtime. A current thread matching the main thread indicates that it is synchronized, but a mismatch does not preclude the same assumption.

      Returns:
      true if the current thread matches the expected primary thread, false otherwise
    • getPrimaryThread

      public Thread getPrimaryThread()