类 Bukkit
Server
单例的调用.-
方法概要
修饰符和类型方法说明static boolean
向合成管理器添加一个合成配方.static @NotNull Iterator<Advancement>
获取一个用以遍历所有进度的迭代器对象。static void
已过时。static void
banIP
(@NotNull InetAddress address) 封禁指定的IP地址.static int
向有给定权限的用户广播一条消息.static int
broadcastMessage
(@NotNull String message) 广播一条消息到所有在线玩家.static void
清理所有已添加的合成配方.Get the crafted item using the list ofItemStack
provided.Get the crafted item using the list ofItemStack
provided.static @NotNull ItemCraftResult
craftItemResult
(@NotNull ItemStack[] craftingMatrix, @NotNull World world) Get the crafted item using the list ofItemStack
provided.static @NotNull ItemCraftResult
Get the crafted item using the list ofItemStack
provided.createBlockData
(@NotNull String data) Creates a newBlockData
instance with material and properties parsed from provided data.createBlockData
(@NotNull Material material) Creates a newBlockData
instance for the specified Material, with all properties initialized to unspecified defaults.Creates a newBlockData
instance for the specified Material, with all properties initialized to unspecified defaults.createBlockData
(@Nullable Material material, @Nullable String data) Creates a newBlockData
instance for the specified Material, with all properties initialized to unspecified defaults, except for those provided in data.static @NotNull KeyedBossBar
createBossBar
(@NotNull NamespacedKey key, @Nullable String title, @NotNull BarColor color, @NotNull BarStyle style, @NotNull BarFlag... flags) 创建一个Boss血量条实例.createBossBar
(@Nullable String title, @NotNull BarColor color, @NotNull BarStyle style, @NotNull BarFlag... flags) 创建一个Boss血量条实例.static ChunkGenerator.ChunkData
createChunkData
(@NotNull World world) 创建一个 ChunkData 实例,以用于区块生成。createExplorerMap
(@NotNull World world, @NotNull Location location, @NotNull StructureType structureType) Create a new explorer map targeting the closest nearby structure of a givenStructureType
.createExplorerMap
(@NotNull World world, @NotNull Location location, @NotNull StructureType structureType, int radius, boolean findUnexplored) Create a new explorer map targeting the closest nearby structure of a givenStructureType
.createInventory
(@Nullable InventoryHolder owner, int size) 创建一个类型为InventoryType.CHEST
, 有指定大小的空物品栏.createInventory
(@Nullable InventoryHolder owner, int size, @NotNull String title) 创建一个类型为InventoryType.CHEST
, 有指定大小和标题的空物品栏.createInventory
(@Nullable InventoryHolder owner, @NotNull InventoryType type) 以指定类型创建一个空物品栏.createInventory
(@Nullable InventoryHolder owner, @NotNull InventoryType type, @NotNull String title) 以指定类型和标题创建一个空物品栏.创建一个新地图并自动分配一个ID.createMerchant
(@Nullable String title) 创建一个空的商人.static @NotNull PlayerProfile
创建一份新的玩家资料
.static @NotNull PlayerProfile
createPlayerProfile
(@NotNull UUID uniqueId) 创建一份新的玩家资料
.static @NotNull PlayerProfile
createPlayerProfile
(@Nullable UUID uniqueId, @Nullable String name) 创建一份新的玩家资料
.createWorld
(@NotNull WorldCreator creator) 用给定的世界生成器来创建或者加载一个世界.static @NotNull WorldBorder
创建一个虚拟世界边界
.static boolean
dispatchCommand
(@NotNull CommandSender sender, @NotNull String commandLine) 在服务器执行一个命令 (如果命令存在).static @Nullable Advancement
通过Key获得特定的进度对象.static boolean
获取此服务器是否开启了末路之地.static boolean
获取服务器是否允许飞行.static boolean
获取此服务器是否开启了下界.static int
已过时。static int
已过时。static <T extends BanList<?>>
TgetBanList
(BanList.Type type) 获取指定类型的封禁列表.static @NotNull Set<OfflinePlayer>
获取所有已被封禁的玩家.static @Nullable KeyedBossBar
Gets theKeyedBossBar
specified by this key.static @NotNull Iterator<KeyedBossBar>
获取一个不可编辑的用于迭代所有持久存储的boss血量条的迭代器.获得服务器运行的Bukkit版本.获取服务器配置定义的命令别名列表.static long
获取服务器的最小连接间隔设定.static @NotNull ConsoleCommandSender
获取服务器的ConsoleCommandSender
, 将被作为服务器的标准输入.getCraftingRecipe
(@NotNull ItemStack[] craftingMatrix, @NotNull World world) Get theRecipe
for the list of ItemStacks provided.static @NotNull DataPackManager
Get the DataPack Manager.获取新玩家的默认游戏模式
.用UUID获取实体.static @NotNull EntityFactory
Gets the instance of the entity factory (forEntitySnapshot
).static boolean
获取此服务器是否自然生成结构.获取服务器上提供所有帮助主题的HelpMap
实例.static boolean
Gets whether the Server hide online players in server status.static int
获取自动踢出闲置玩家的时间.getIp()
获取服务器绑定的IP, 如果未指定就返回空字符串.获取所有已被封禁的IP地址.static @NotNull ItemFactory
获取ItemFactory实例 (用于ItemMeta
).返回与此服务器实例绑定的主Logger
.获取指定的战利品表
.getMap
(int id) 已过时。不安全的参数static int
Gets the amount of consecutive neighbor updates before skipping additional ones.static int
获取服务器允许进入的最大玩家数.static int
获取最大世界大小.获取服务器上管理plugin channel(插件通道)通信的Messenger
实例.static int
已过时。getMotd()
获取在客户端服务器列表里显示的消息(服务器的欢迎消息,又称message of the day, 展示在mc客户端的服务器列表).getName()
获取这个Server
实例的名字.static @NotNull OfflinePlayer
getOfflinePlayer
(@NotNull String name) 已过时。由于玩家名在某个会话后(某次游戏后)不再唯一, 应使用uuid作为唯一标识来持久化存储用户.static @NotNull OfflinePlayer
以给定名字获取玩家对象, 无论玩家是否在线.static @NotNull OfflinePlayer[]
获取所有登陆过服务器的玩家.static boolean
获取服务器是否开启了正版模式.static @NotNull Collection<? extends Player>
获取所有在线玩家的集合的视图.static @NotNull Set<OfflinePlayer>
获取服务器的所有OP(管理员).使用给定玩家名模糊搜索玩家(名字最近似的玩家).使用给定UUID
获取玩家.getPlayerExact
(@NotNull String name) 使用给定玩家名精确查找玩家, 不区分大小写.static @Nullable PluginCommand
getPluginCommand
(@NotNull String name) 用给定命令名或别名获取PluginCommand
.static @NotNull PluginManager
获取插件管理器以与其他插件进行交互.static int
getPort()
获取服务器监听的端口号.getRecipe
(@NotNull NamespacedKey recipeKey) 根据指定的 key 获取配方
.getRecipesFor
(@NotNull ItemStack result) 获取对指定物品适用的所有合成配方的列表.getRegistry
(@NotNull Class<T> tClass) Returns the registry for the given class.Gets the server resource pack uri, or empty string if not specified.Gets the SHA-1 digest of the server resource pack, or empty string if not specified.Gets the custom prompt message to be shown when the server resource pack is required, or empty string if not specified.static @NotNull BukkitScheduler
获取用于管理调度任务的调度器.Get (or create) a newCriteria
by its name.static @Nullable ScoreboardManager
获取计分板管理器实例.获取当前持有的Server
实例.static @Nullable CachedServerIcon
获取服务器默认图标.static @NotNull ServerLinks
Gets the server links which will be sent to clientsstatic @Nullable ResourcePack
Gets the resource pack configured to be sent to clients by the server.static @NotNull ServerTickManager
Get the ServerTick Manager.static @NotNull ServicesManager
获取服务管理器.获取服务器关闭时广播给玩家的默认提示消息.static int
Get the simulation distance from this server.static int
getSpawnLimit
(@NotNull SpawnCategory spawnCategory) Gets user-specified limit for number ofSpawnCategory
mobs that can spawn in a chunk.static int
获取出生地保护的范围(以方块为单位).static @NotNull StructureManager
Gets the structure manager for loading and saving structures.Gets a tag which has already been defined within the server.获取服务器定义的所有标签.static int
已过时。static int
已过时。static int
已过时。static int
getTicksPerSpawns
(@NotNull SpawnCategory spawnCategory) Gets the default ticks perSpawnCategory
spawns value.static int
已过时。static int
已过时。static int
已过时。static @NotNull UnsafeValues
已过时。获取更新文件夹的名字.获取更新文件夹的 File 实例.获取这个Server
实例的版本.static int
获取服务器的视距.static @NotNull Warning.WarningState
获取服务器的警告状态.static int
已过时。static int
已过时。static int
已过时。Deprecated in favor ofgetSpawnLimit(SpawnCategory)
static @NotNull Set<OfflinePlayer>
获取所有已被添加到白名单的玩家.使用给定的名称查找世界.使用给定唯一ID查找世界.获取包含所有世界
数据的文件夹.获取当前服务器加载的所有世界的列表.获取默认世界的世界类型 (level-type 设置).static boolean
获取此服务器是否开启了白名单.static boolean
Gets whether this server is allowing connections transferred from other servers.static boolean
Gets whether the server only allow players with Mojang-signed public key to joinstatic boolean
获取服务器是否处于极限生存模式.static boolean
Gets whether the server is logging the IP addresses of players.static boolean
检查当前方法是否在主线程执行。static boolean
Gets whether the server resource pack is enforced.static boolean
Gets whether the server whitelist is enforced.static @NotNull CachedServerIcon
loadServerIcon
(@NotNull BufferedImage image) 为指定图片创建一个缓存的服务器图标.static @NotNull CachedServerIcon
loadServerIcon
(@NotNull File file) 为指定文件创建一个缓存的服务器图标.matchPlayer
(@NotNull String name) 尝试获取所有匹配给定名称的玩家, 并返回包含了一切可能匹配的列表.获取合成配方列表迭代器.static void
reload()
重新加载服务器并刷新设置和插件信息.static void
只重载Minecraft游戏数据.static void
从硬盘重载白名单列表.static boolean
Removes aKeyedBossBar
specified by this key.static boolean
从服务器移除指定的合成配方.static void
重置自定义合成配方列表至默认状态.static void
保存已加载的玩家信息.selectEntities
(@NotNull CommandSender sender, @NotNull String selector) 以给定的原版选择器选择筛选实体.static void
设置新玩家的默认GameMode
.static void
setIdleTimeout
(int threshold) 设置一个空闲超时阈值(IDLE_KICK).static void
setMaxPlayers
(int maxPlayers) 设置服务器允许进入的最大玩家数.static void
设置在客户端服务器列表里显示的消息.static void
请求设置所持有的Server
实例.static void
setSpawnRadius
(int value) 设置出生地保护的范围.static void
setWhitelist
(boolean value) 设置此服务器是否开启白名单.static void
setWhitelistEnforced
(boolean value) Sets if the server whitelist is enforced.static boolean
已过时。chat previews have been removedstatic void
shutdown()
关闭服务器, 停止一切在运行的东西.static Server.Spigot
spigot()
static void
已过时。static void
unbanIP
(@NotNull InetAddress address) 解禁指定的IP地址.static boolean
unloadWorld
(@NotNull String name, boolean save) 卸载给定名称对应的世界.static boolean
unloadWorld
(@NotNull World world, boolean save) 卸载指定的世界.
-
方法详细资料
-
getServer
- 返回:
- 正在运行的服务器的实例
-
setServer
请求设置所持有的Server
实例. 如果 Server 已经被设定过了, 这个操作无法完成.原文: Attempts to set the
Server
singleton. This cannot be done if the Server is already set.- 参数:
server
- 服务器实例
-
getName
获取这个Server
实例的名字.原文:Gets the name of this server implementation.
- 返回:
- 这个服务器实例的名字
-
getVersion
获取这个Server
实例的版本.原文:Gets the version string of this server implementation.
- 返回:
- 这个服务器实例的版本
-
getBukkitVersion
获得服务器运行的Bukkit版本.原文:Gets the Bukkit version that this server is running.
- 返回:
- Bukkit版本
-
getOnlinePlayers
获取所有在线玩家的集合的视图.此 视图 is a reused object, making some operations like
Collection.size()
zero-allocation. (以下翻译仅供参考)此集合是由内部表示支持的视图, 因此, 一切修改服务器内部状态的操作将会 立即反映到此集合上. 并不严格保证未来或所有实现都会遵守 返回一个可再利用集合 (一致性)的约定. 不赞成对这个集合执行强制转换或 依赖于接口实现 (例如
Serializable
orList
).迭代操作 is undefined outside of self-contained main-thread uses. 正常且立即的迭代器会影响集合是否被完全支持.
传送
,死亡
,踢出
等操作的结果是未知的 (没有罗列完全). 任何对这个集合的异步操作都是不安全的.For safe consequential iteration or mimicking the old array behavior, using
Collection.toArray(Object[])
is recommended. For making snapshots,ImmutableList.copyOf(Collection)
is recommended.原文: This view is a reused object, making some operations like
Collection.size()
zero-allocation.The collection is a view backed by the internal representation, such that, changes to the internal state of the server will be reflected immediately. However, the reuse of the returned collection (identity) is not strictly guaranteed for future or all implementations. Casting the collection, or relying on interface implementations (like
Serializable
orList
), is deprecated.Iteration behavior is undefined outside of self-contained main-thread uses. Normal and immediate iterator use without consequences that affect the collection are fully supported. The effects following (non-exhaustive)
teleportation
,death
, andkicking
are undefined. Any use of this collection from asynchronous threads is unsafe.For safe consequential iteration or mimicking the old array behavior, using
Collection.toArray(Object[])
is recommended. For making snapshots,ImmutableList.copyOf(Collection)
is recommended.- 返回:
- 所有在线玩家的视图
-
getMaxPlayers
public static int getMaxPlayers()获取服务器允许进入的最大玩家数.原文:Get the maximum amount of players which can login to this server.
- 返回:
- 服务器的最大玩家数
-
setMaxPlayers
public static void setMaxPlayers(int maxPlayers) 设置服务器允许进入的最大玩家数.原文:Set the maximum amount of players allowed to be logged in at once.
- 参数:
maxPlayers
- 服务器的最大玩家数
-
getPort
public static int getPort()获取服务器监听的端口号.原文:Get the game port that the server runs on.
- 返回:
- 服务器端口
-
getViewDistance
public static int getViewDistance()获取服务器的视距.原文:Get the view distance from this server.
- 返回:
- 服务器当前设置的视距
-
getSimulationDistance
public static int getSimulationDistance()Get the simulation distance from this server.- 返回:
- the simulation distance from this server.
-
getIp
获取服务器绑定的IP, 如果未指定就返回空字符串.原文:Get the IP that this server is bound to, or empty string if not specified.
- 返回:
- 服务器绑定的IP, 如果未指定就返回空字符串
-
getWorldType
获取默认世界的世界类型 (level-type 设置).原文:Get world type (level-type setting) for default world.
- 返回:
- 默认世界的世界类型 (例: DEFAULT, FLAT, DEFAULT_1_1)
-
getGenerateStructures
public static boolean getGenerateStructures()获取此服务器是否自然生成结构.原文:Get generate-structures setting.
- 返回:
- true表示服务器可自然生成结构, false反之
-
getMaxWorldSize
public static int getMaxWorldSize()获取最大世界大小.原文:Get max world size.
- 返回:
- 为服务器指定的最大世界大小
-
getAllowEnd
public static boolean getAllowEnd()获取此服务器是否开启了末路之地.原文:Gets whether this server allows the End or not.
- 返回:
- 是否可以进入末路之地
-
getAllowNether
public static boolean getAllowNether()获取此服务器是否开启了下界.原文:Gets whether this server allows the Nether or not.
- 返回:
- 是否可以进入下界
-
isLoggingIPs
public static boolean isLoggingIPs()Gets whether the server is logging the IP addresses of players.- 返回:
- whether the server is logging the IP addresses of players
-
getInitialEnabledPacks
-
getInitialDisabledPacks
-
getDataPackManager
Get the DataPack Manager.- 返回:
- the manager
-
getServerResourcePack
Gets the resource pack configured to be sent to clients by the server.- 返回:
- the resource pack
-
getServerTickManager
Get the ServerTick Manager.- 返回:
- the manager
-
getResourcePack
Gets the server resource pack uri, or empty string if not specified.- 返回:
- the server resource pack uri, otherwise empty string
-
getResourcePackHash
Gets the SHA-1 digest of the server resource pack, or empty string if not specified.- 返回:
- the SHA-1 digest of the server resource pack, otherwise empty string
-
getResourcePackPrompt
Gets the custom prompt message to be shown when the server resource pack is required, or empty string if not specified.- 返回:
- the custom prompt message to be shown when the server resource, otherwise empty string
-
isResourcePackRequired
public static boolean isResourcePackRequired()Gets whether the server resource pack is enforced.- 返回:
- whether the server resource pack is enforced
-
hasWhitelist
public static boolean hasWhitelist()获取此服务器是否开启了白名单.原文:Gets whether this server has a whitelist or not.
- 返回:
- 是否开启了白名单
-
setWhitelist
public static void setWhitelist(boolean value) 设置此服务器是否开启白名单.原文:Sets if the server is whitelisted.
- 参数:
value
- true为开, false为关
-
isWhitelistEnforced
public static boolean isWhitelistEnforced()Gets whether the server whitelist is enforced. If the whitelist is enforced, non-whitelisted players will be disconnected when the server whitelist is reloaded.- 返回:
- whether the server whitelist is enforced
-
setWhitelistEnforced
public static void setWhitelistEnforced(boolean value) Sets if the server whitelist is enforced. If the whitelist is enforced, non-whitelisted players will be disconnected when the server whitelist is reloaded.- 参数:
value
- true for enforced, false for not
-
getWhitelistedPlayers
获取所有已被添加到白名单的玩家.原文:Gets a list of whitelisted players.
- 返回:
- 用Set存储的所有被添加到白名单的玩家
-
reloadWhitelist
public static void reloadWhitelist()从硬盘重载白名单列表.原文:Reloads the whitelist from disk.
-
broadcastMessage
广播一条消息到所有在线玩家.这与调用
broadcast(java.lang.String, java.lang.String)
并将第二个参数设为Server.BROADCAST_CHANNEL_USERS
等效.原文:Broadcast a message to all players.
This is the same as calling
broadcast(java.lang.String, java.lang.String)
toServer.BROADCAST_CHANNEL_USERS
- 参数:
message
- 要广播的消息- 返回:
- 成功接收此消息的玩家数
-
getUpdateFolder
获取更新文件夹的名字. 系统将会在插件加载时选择适当的时机利用此文件夹来安全地更新插件.更新文件夹的位置相对于插件文件夹(译注:一般指服务端plugins文件夹下的update文件夹).
Tips:如何使用更新文件夹来实现更新您的插件呢? (服主和开发者都可以了解下):
- 创建更新文件夹,已有则跳过此步.
- 下载您要更新的插件到此目录(plugins/update) (注意:jar文件名必须和在插件目录下的jar文件名一样,否则不起作用).
- 重载/重启服务器.
- OK,看效果吧.
原文: Gets the name of the update folder. The update folder is used to safely update plugins at the right moment on a plugin load.
The update folder name is relative to the plugins folder.
- 返回:
- 更新文件夹的名字
-
getUpdateFolderFile
获取更新文件夹的 File 实例.系统将会在插件加载时选择适当的时机利用此文件夹来安全地更新插件.
原文:Gets the update folder. The update folder is used to safely update plugins at the right moment on a plugin load.
- 返回:
- 表示更新文件夹的 File 实例
-
getConnectionThrottle
public static long getConnectionThrottle()获取服务器的最小连接间隔设定.译注:单位为毫秒.
原文:Gets the value of the connection throttle setting.
- 返回:
- 服务器的最小连接间隔数设定
-
getTicksPerAnimalSpawns
已过时。获取每隔多少tick应该生成一次动物. 例如:- 此值为 1 表示服务器会在每个tick尝试生成动物.
- 此值为 400 表示服务器会每隔400tick尝试生成动物.
- 此值小于 0 表示会使用Minecraft的默认设置.
Minecraft使用的默认值: 400.
原文:
Gets default ticks per animal spawns value.Example Usage:
- A value of 1 will mean the server will attempt to spawn monsters every tick.
- A value of 400 will mean the server will attempt to spawn monsters every 400th tick.
- A value below 0 will be reset back to Minecraft's default.
Note: If set to 0, animal spawning will be disabled. We recommend using spawn-animals to control this instead.
Minecraft default: 400.
- 返回:
- 每隔多少tick应该生成一次动物
-
getTicksPerMonsterSpawns
已过时。获取每隔多少tick应该生成一次怪物. 例如:- 此值为 1 表示服务器会在每个tick尝试生成怪物.
- 此值为 400 表示服务器会每隔400tick尝试生成怪物.
- 此值小于 0 表示会使用Minecraft的默认设置.
Minecraft使用的默认值: 1.
原文: Gets default ticks per monster spawns value.
Example Usage:
- A value of 1 will mean the server will attempt to spawn monsters every tick.
- A value of 400 will mean the server will attempt to spawn monsters every 400th tick.
- A value below 0 will be reset back to Minecraft's default.
Note: If set to 0, monster spawning will be disabled. We recommend using spawn-monsters to control this instead.
Minecraft default: 1.
- 返回:
- 每隔多少tick应该生成一次怪物
-
getTicksPerWaterSpawns
已过时。获取每隔多少tick应该生成一次水生动物.例如:
- 此值为 1 表示服务器会在每个tick尝试生成水生动物.
- 此值为 400 表示服务器会每隔400tick尝试生成水生动物.
- 此值小于 0 表示会使用Minecraft的默认设置.
注意: 如果设为 0, 水生动物生成会被禁用.
Minecraft使用的默认值: 1.
原文:Gets the default ticks per water mob spawns value.
Example Usage:
- A value of 1 will mean the server will attempt to spawn water mobs every tick.
- A value of 400 will mean the server will attempt to spawn water mobs every 400th tick.
- A value below 0 will be reset back to Minecraft's default.
Note: If set to 0, water mobs spawning will be disabled.
Minecraft default: 1.
- 返回:
- 每隔多少tick应该生成一次怪物
-
getTicksPerAmbientSpawns
已过时。获取每隔多少tick应该生成一次环境生物(即蝙蝠).例如:
- 此值为 1 表示服务器会在每个tick尝试生成环境生物.
- 此值为 400 表示服务器会每隔400tick尝试生成环境生物.
- 此值小于 0 表示会使用Minecraft的默认设置.
注意: 如果设为 0, 环境生物生成会被禁用.
Minecraft使用的默认值: 1.
原文:Gets the default ticks per ambient mob spawns value.
Example Usage:
- A value of 1 will mean the server will attempt to spawn ambient mobs every tick.
- A value of 400 will mean the server will attempt to spawn ambient mobs every 400th tick.
- A value below 0 will be reset back to Minecraft's default.
Note: If set to 0, ambient mobs spawning will be disabled.
Minecraft default: 1.
- 返回:
- 每隔多少tick应该生成一次环境生物
-
getTicksPerWaterAmbientSpawns
已过时。获取每隔多少tick应该生成一次水生环境生物(通常指鱼类).例如:
- 此值为 1 表示服务器会在每个tick尝试生成水生环境生物.
- 此值为 400 表示服务器会每隔400tick尝试生成水生环境生物.
- 此值小于 0 表示会使用Minecraft的默认设置.
注意: 如果设为 0, 水生环境生物生成会被禁用.
Minecraft使用的默认值: 1.
原文:Gets the default ticks per water ambient mob spawns value.
Example Usage:
- A value of 1 will mean the server will attempt to spawn water ambient mobs every tick.
- A value of 400 will mean the server will attempt to spawn water ambient mobs every 400th tick.
- A value below 0 will be reset back to Minecraft's default.
Note: If set to 0, ambient mobs spawning will be disabled.
Minecraft default: 1.
- 返回:
- 每隔多少tick应该生成一次水生环境生物
-
getTicksPerWaterUndergroundCreatureSpawns
已过时。Gets the default ticks per water underground creature spawns value.Example Usage:
- A value of 1 will mean the server will attempt to spawn water underground creature every tick.
- A value of 400 will mean the server will attempt to spawn water underground creature every 400th tick.
- A value below 0 will be reset back to Minecraft's default.
Note: If set to 0, water underground creature spawning will be disabled.
Minecraft default: 1.
- 返回:
- the default ticks per water underground creature spawn value
-
getTicksPerSpawns
Gets the default ticks perSpawnCategory
spawns value.Example Usage:
- A value of 1 will mean the server will attempt to spawn
SpawnCategory
mobs every tick. - A value of 400 will mean the server will attempt to spawn
SpawnCategory
mobs every 400th tick. - A value below 0 will be reset back to Minecraft's default.
Note: If set to 0,
SpawnCategory
mobs spawning will be disabled.Minecraft default: 1.
Note: theSpawnCategory.MISC
are not consider.- 参数:
spawnCategory
- the category of spawn- 返回:
- the default ticks per
SpawnCategory
mobs spawn value
- A value of 1 will mean the server will attempt to spawn
-
getPlayer
使用给定玩家名模糊搜索玩家(名字最近似的玩家).使用
getPlayerExact(String)
以精准匹配某个玩家, 若要搜索所有匹配的玩家,请使用matchPlayer(String)
.译注: 注意此方法用于模糊搜索——当服务器内有玩家 aaa, aab, abc 时, 使用
getPlayer("ab")
会返回玩家 abc 的实例, 而如果 ab 在线则会返回 ab 的实例 因此可能存在严重的安全问题, 需要精确搜索(例如给予OP时)请用getPlayerExact(java.lang.String)
或getPlayer(java.util.UUID)
代替.原文: Gets a player whose name matches the given name closest.
Use
getPlayerExact(String)
to get the player matching the input exactly andmatchPlayer(String)
if you want a list of all players matching the input.- 参数:
name
- 用来查找的玩家名- 返回:
- 如果找到了则返回玩家对象, 否则返回null
-
getPlayerExact
使用给定玩家名精确查找玩家, 不区分大小写.原文:Gets the player with the exact given name, case insensitive.
- 参数:
name
- 用于检索的精确玩家名称, 不区分大小写- 返回:
- 如果找到了则返回玩家对象, 否则返回null
-
matchPlayer
尝试获取所有匹配给定名称的玩家, 并返回包含了一切可能匹配的列表.这个列表没有经过任何特殊排序. 如果能在在线玩家内精确匹配到给定名称, 则返回一个只包含单个结果的列表.
译注: 设有在线玩家 abcd, efg, dbca 那么
matchPlayer("bc")
会 返回一个包含 [abcd, dbca] 的列表. 但如果此时玩家 bc 上线了, 再执行相同的查找 就只会返回包含一个结果的列表 [bc].原文: Attempts to match any players with the given name, and returns a list of all possibly matches.
This list is not sorted in any particular order. If an exact match is found, the returned list will only contain a single result.
- 参数:
name
- 需要匹配的(部分)名称- 返回:
- 包含所有可能的匹配结果的列表
-
getPlayer
使用给定UUID
获取玩家.原文:Gets the player with the given UUID.
- 参数:
id
- 要获取的玩家的UUID
- 返回:
- 如果找到了则返回玩家对象, 否则返回null
-
getPluginManager
获取插件管理器以与其他插件进行交互.原文:Gets the plugin manager for interfacing with plugins.
- 返回:
- 此服务器的插件管理器
-
getScheduler
获取用于管理调度任务的调度器.原文: Gets the scheduler for managing scheduled events.
- 返回:
- 此服务器的调度器服务
-
getServicesManager
获取服务管理器.原文:Gets a services manager.
- 返回:
- 服务管理器
-
getWorlds
获取当前服务器加载的所有世界的列表.原文:Gets a list of all worlds on this server.
- 返回:
- 所有已经被服务器加载的世界列表
-
createWorld
用给定的世界生成器来创建或者加载一个世界.如果这个世界已经被加载了, 那么就会返回等同于调用
getWorld(creator.name())
的结果.原文: Creates or loads a world with the given name using the specified options.
If the world is already loaded, it will just return the equivalent of getWorld(creator.name()).
- 参数:
creator
- 加载或者创建这个世界的时候要用的世界生成器- 返回:
- 生成的或者加载的世界对象
-
unloadWorld
卸载给定名称对应的世界.原文: Unloads a world with the given name.
- 参数:
name
- 要卸载的世界的名字save
- 是否在卸载世界前保存区块数据- 返回:
- 如果成功返回true, 否则返回false
-
unloadWorld
卸载指定的世界.原文: Unloads a world with the given name.
- 参数:
world
- 要卸载的世界save
- 是否在卸载世界前保存区块数据- 返回:
- 如果成功返回true, 否则返回false
-
getWorld
使用给定的名称查找世界.原文: Gets the world with the given name.
- 参数:
name
- 世界名称- 返回:
- 给定名称对应世界的实例, 没找到则返回null
-
getWorld
使用给定唯一ID查找世界.原文:Gets the world from the given Unique ID.
- 参数:
uid
- 要查找的世界的唯一ID- 返回:
- 没找到则返回null
-
createWorldBorder
创建一个虚拟世界边界
.原文: Create a new virtual
WorldBorder
.- 返回:
- 新创建的虚拟世界边界实例
- 另请参阅:
-
getMap
已过时。不安全的参数使用给定物品ID获取地图.原文: Gets the map from the given item ID.
- 参数:
id
- 要获取的地图的ID- 返回:
- 如果找到则返回对应的
MapView
, 否则返回null
-
createMap
创建一个新地图并自动分配一个ID.原文:Create a new map with an automatically assigned ID.
- 参数:
world
- 地图所属的世界- 返回:
- 新创建的
MapView
-
createExplorerMap
@NotNull public static @NotNull ItemStack createExplorerMap(@NotNull @NotNull World world, @NotNull @NotNull Location location, @NotNull @NotNull StructureType structureType) Create a new explorer map targeting the closest nearby structure of a givenStructureType
.
This method uses implementation default values for radius and findUnexplored (usually 100, true).- 参数:
world
- the world the map will belong tolocation
- the origin location to find the nearest structurestructureType
- the type of structure to find- 返回:
- a newly created item stack
- 另请参阅:
-
createExplorerMap
@NotNull public static @NotNull ItemStack createExplorerMap(@NotNull @NotNull World world, @NotNull @NotNull Location location, @NotNull @NotNull StructureType structureType, int radius, boolean findUnexplored) Create a new explorer map targeting the closest nearby structure of a givenStructureType
.
This method uses implementation default values for radius and findUnexplored (usually 100, true).- 参数:
world
- the world the map will belong tolocation
- the origin location to find the nearest structurestructureType
- the type of structure to findradius
- radius to search, see World#locateNearestStructure for more informationfindUnexplored
- whether to find unexplored structures- 返回:
- the newly created item stack
- 另请参阅:
-
reload
public static void reload()重新加载服务器并刷新设置和插件信息.原文:Reloads the server, refreshing settings and plugin information.
-
reloadData
public static void reloadData()只重载Minecraft游戏数据. 这包括自定义的进度和掉落表.原文:Reload only the Minecraft data for the server. This includes custom advancements and loot tables.
-
getLogger
返回与此服务器实例绑定的主Logger
.原文:Returns the primary logger associated with this server instance.
- 返回:
- 与此服务器绑定的
Logger
-
getPluginCommand
用给定命令名或别名获取PluginCommand
.原文:Gets a
PluginCommand
with the given name or alias.- 参数:
name
- 命令名或命令别名- 返回:
- 若找到则返回对应的命令实例, 找不到则返回null
-
savePlayers
public static void savePlayers()保存已加载的玩家信息.原文:Writes loaded players to disk.
-
dispatchCommand
public static boolean dispatchCommand(@NotNull @NotNull CommandSender sender, @NotNull @NotNull String commandLine) throws CommandException 在服务器执行一个命令 (如果命令存在).原文:Dispatches a command on this server, and executes it if found.
- 参数:
sender
- 执行该命令的发送者commandLine
- 命令 + 参数. 例如:test abc 123
- 返回:
- 若命令未找到返回false
- 抛出:
CommandException
- 当执行命令期间出现未捕获的异常时抛出
-
addRecipe
向合成管理器添加一个合成配方.原文:Adds a recipe to the crafting manager.
- 参数:
recipe
- 要添加的合成配方- 返回:
- 是否成功的地添加了合成配方
-
getRecipesFor
获取对指定物品适用的所有合成配方的列表. 在比对过程中物品堆叠数量会被忽略. 如果给定物品堆的耐久度为 -1, 将匹配任意的数据值.原文:Get a list of all recipes for a given item. The stack size is ignored in comparisons. If the durability is -1, it will match any data value.
- 参数:
result
- 要匹配的物品- 返回:
- 对指定物品适用的所有合成配方的列表
-
getRecipe
- 参数:
recipeKey
- 配方的 key- 返回:
- 给定 key 对应的配方, 若未找到返回 null
-
getCraftingRecipe
@Nullable public static @Nullable Recipe getCraftingRecipe(@NotNull @NotNull ItemStack[] craftingMatrix, @NotNull @NotNull World world) Get theRecipe
for the list of ItemStacks provided.The list is formatted as a crafting matrix where the index follow the pattern below:
[ 0 1 2 ] [ 3 4 5 ] [ 6 7 8 ]
NOTE: This method will not modify the provided ItemStack array, for that, use
craftItem(ItemStack[], World, Player)
.- 参数:
craftingMatrix
- list of items to be crafted from. Must not contain more than 9 items.world
- The world the crafting takes place in.- 返回:
- the
Recipe
resulting from the given crafting matrix.
-
craftItemResult
@NotNull public static @NotNull ItemCraftResult craftItemResult(@NotNull @NotNull ItemStack[] craftingMatrix, @NotNull @NotNull World world, @NotNull @NotNull Player player) Get the crafted item using the list ofItemStack
provided.The list is formatted as a crafting matrix where the index follow the pattern below:
[ 0 1 2 ] [ 3 4 5 ] [ 6 7 8 ]
The
World
andPlayer
arguments are required to fulfill the Bukkit Crafting events.Calls
PrepareItemCraftEvent
to imitate thePlayer
initiating the crafting event.- 参数:
craftingMatrix
- list of items to be crafted from. Must not contain more than 9 items.world
- The world the crafting takes place in.player
- The player to imitate the crafting event on.- 返回:
- resulting
ItemCraftResult
containing the resulting item, matrix and any overflow items.
-
craftItemResult
@NotNull public static @NotNull ItemCraftResult craftItemResult(@NotNull @NotNull ItemStack[] craftingMatrix, @NotNull @NotNull World world) Get the crafted item using the list ofItemStack
provided.The list is formatted as a crafting matrix where the index follow the pattern below:
[ 0 1 2 ] [ 3 4 5 ] [ 6 7 8 ]
- 参数:
craftingMatrix
- list of items to be crafted from. Must not contain more than 9 items.world
- The world the crafting takes place in.- 返回:
- resulting
ItemCraftResult
containing the resulting item, matrix and any overflow items.
-
craftItem
@NotNull public static @NotNull ItemStack craftItem(@NotNull @NotNull ItemStack[] craftingMatrix, @NotNull @NotNull World world, @NotNull @NotNull Player player) Get the crafted item using the list ofItemStack
provided.The list is formatted as a crafting matrix where the index follow the pattern below:
[ 0 1 2 ] [ 3 4 5 ] [ 6 7 8 ]
The
World
andPlayer
arguments are required to fulfill the Bukkit Crafting events.Calls
PrepareItemCraftEvent
to imitate thePlayer
initiating the crafting event.- 参数:
craftingMatrix
- list of items to be crafted from. Must not contain more than 9 items.world
- The world the crafting takes place in.player
- The player to imitate the crafting event on.- 返回:
- the
ItemStack
resulting from the given crafting matrix, if no recipe is found an ItemStack ofMaterial.AIR
is returned.
-
craftItem
@NotNull public static @NotNull ItemStack craftItem(@NotNull @NotNull ItemStack[] craftingMatrix, @NotNull @NotNull World world) Get the crafted item using the list ofItemStack
provided.The list is formatted as a crafting matrix where the index follow the pattern below:
[ 0 1 2 ] [ 3 4 5 ] [ 6 7 8 ]
- 参数:
craftingMatrix
- list of items to be crafted from. Must not contain more than 9 items.world
- The world the crafting takes place in.- 返回:
- the
ItemStack
resulting from the given crafting matrix, if no recipe is found an ItemStack ofMaterial.AIR
is returned.
-
recipeIterator
获取合成配方列表迭代器.原文:Get an iterator through the list of crafting recipes.
- 返回:
- 迭代器
-
clearRecipes
public static void clearRecipes()清理所有已添加的合成配方.原文:Clears the list of crafting recipes.
-
resetRecipes
public static void resetRecipes()重置自定义合成配方列表至默认状态.原文:Resets the list of crafting recipes to the default.
-
removeRecipe
从服务器移除指定的合成配方. 注意:移除一个合成配方可能导致与此配方有关的数据的永久丢失 (例如配方是否已被玩家发现).原文:Remove a recipe from the server. Note that removing a recipe may cause permanent loss of data associated with that recipe (eg whether it has been discovered by players).
- 参数:
key
- 要移除的配方的NamespacedKey- 返回:
- 若配方成功移除返回true
-
getCommandAliases
获取服务器配置定义的命令别名列表.原文:Gets a list of command aliases defined in the server properties.
- 返回:
- 命令别名map
-
getSpawnRadius
public static int getSpawnRadius()获取出生地保护的范围(以方块为单位).原文:Gets the radius, in blocks, around each worlds spawn point to protect.
- 返回:
- 出生地保护范围,0为没有保护
-
setSpawnRadius
public static void setSpawnRadius(int value) 设置出生地保护的范围.原文:Sets the radius, in blocks, around each worlds spawn point to protect.
- 参数:
value
- 新的出生地保护的范围,0设为没有保护
-
shouldSendChatPreviews
已过时。chat previews have been removedGets whether the server should send a preview of the player's chat message to the client when the player sends a message- 返回:
- true if the server should send a preview, false otherwise
-
isEnforcingSecureProfiles
public static boolean isEnforcingSecureProfiles()Gets whether the server only allow players with Mojang-signed public key to join- 返回:
- true if only Mojang-signed players can join, false otherwise
-
isAcceptingTransfers
public static boolean isAcceptingTransfers()Gets whether this server is allowing connections transferred from other servers.- 返回:
- true if the server accepts transfers, false otherwise
-
getHideOnlinePlayers
public static boolean getHideOnlinePlayers()Gets whether the Server hide online players in server status.- 返回:
- true if the server hide online players, false otherwise
-
getOnlineMode
public static boolean getOnlineMode()获取服务器是否开启了正版模式.原文:Gets whether the Server is in online mode or not.
- 返回:
- true则开启/false反之
-
getAllowFlight
public static boolean getAllowFlight()获取服务器是否允许飞行.原文:Gets whether this server allows flying or not.
- 返回:
- 服务器是否允许飞行
-
isHardcore
public static boolean isHardcore()获取服务器是否处于极限生存模式.原文:Gets whether the server is in hardcore mode or not.
- 返回:
- 服务器是否处于极限生存模式
-
shutdown
public static void shutdown()关闭服务器, 停止一切在运行的东西.原文:Shutdowns the server, stopping everything.
-
broadcast
向有给定权限的用户广播一条消息.原文:Broadcasts the specified message to every user with the given permission name.
- 参数:
message
- 要广播的消息permission
- 接受这条公告需要拥有的权限许可
- 返回:
- 成功接收此消息的玩家数
-
getOfflinePlayer
@Deprecated @NotNull public static @NotNull OfflinePlayer getOfflinePlayer(@NotNull @NotNull String name) 已过时。由于玩家名在某个会话后(某次游戏后)不再唯一, 应使用uuid作为唯一标识来持久化存储用户. (译注:正版玩家更改它们的玩家名后,其uuid不会改变,其他正版玩家可以使用这些玩家的曾用名, 可能会出现同一玩家名对应两个或多个不同玩家的情况)以给定名字获取玩家对象, 无论玩家是否在线.这个方法可能因通过web请求获取玩家名对应UUID而阻塞.
即使此玩家不存在也会返回一个对象. 对于此方法, 任何玩家都是存在的.
原文:Gets the player by the given name, regardless if they are offline or online.
This method may involve a blocking web request to get the UUID for the given name.
This will return an object even if the player does not exist. To this method, all players will exist.
- 参数:
name
- 此玩家的玩家名- 返回:
- 表示此玩家的OfflinePlayer对象
- 另请参阅:
-
getOfflinePlayer
以给定名字获取玩家对象, 无论玩家是否在线.即使此玩家不存在也会返回一个对象. 对于此方法, 任何玩家都是存在的.
原文:Gets the player by the given UUID, regardless if they are offline or online.
This will return an object even if the player does not exist. To this method, all players will exist.
- 参数:
id
- 要检索的玩家UUID- 返回:
- 表示此玩家的OfflinePlayer对象
-
createPlayerProfile
@NotNull public static @NotNull PlayerProfile createPlayerProfile(@Nullable @Nullable UUID uniqueId, @Nullable @Nullable String name) 创建一份新的玩家资料
.原文:Creates a new
PlayerProfile
.- 参数:
uniqueId
- 唯一 idname
- 玩家名- 返回:
- 新 PlayerProfile
- 抛出:
IllegalArgumentException
- 如果唯一 id 和玩家名均为null
或玩家名为空白字符串
-
createPlayerProfile
创建一份新的玩家资料
.原文:Creates a new
PlayerProfile
.- 参数:
uniqueId
- 唯一 id- 返回:
- 新 PlayerProfile
- 抛出:
IllegalArgumentException
- 如果唯一 id 为null
-
createPlayerProfile
创建一份新的玩家资料
.原文:Creates a new
PlayerProfile
.- 参数:
name
- 玩家名- 返回:
- 新 PlayerProfile
- 抛出:
IllegalArgumentException
- 如果玩家名为null
或空白字符串
-
getIPBans
获取所有已被封禁的IP地址.原文:Gets a set containing all current IPs that are banned.
- 返回:
- 被封禁IP集合
-
banIP
已过时。封禁指定的IP地址.原文:Bans the specified address from the server.
- 参数:
address
- 要封禁的IP地址
-
unbanIP
已过时。解禁指定的IP地址.原文:Unbans the specified address from the server.
- 参数:
address
- 要解禁的IP地址
-
banIP
封禁指定的IP地址.原文:Bans the specified address from the server.
- 参数:
address
- 要封禁的IP地址
-
unbanIP
解禁指定的IP地址.原文:Unbans the specified address from the server.
- 参数:
address
- 要解禁的IP地址
-
getBannedPlayers
获取所有已被封禁的玩家.原文:Gets a set containing all banned players.
- 返回:
- 已被封禁的玩家
-
getBanList
获取指定类型的封禁列表.原文:Gets a ban list for the supplied type.
- 类型参数:
T
- 封禁目标- 参数:
type
- 要获取的封禁列表的类型, 不能为null- 返回:
- 指定类型的封禁列表
-
getOperators
获取服务器的所有OP(管理员).原文:Gets a set containing all player operators.
- 返回:
- 服务器OP
-
getDefaultGameMode
- 返回:
- 默认游戏模式
-
setDefaultGameMode
- 参数:
mode
- 新的游戏模式
-
getConsoleSender
获取服务器的ConsoleCommandSender
, 将被作为服务器的标准输入.译注:该方法用于获取控制台.
原文:Gets a
ConsoleCommandSender
that may be used as an input source for this server.- 返回:
- 控制台命令发送者对象
-
getWorldContainer
- 返回:
- 包含所有世界数据的文件夹
-
getOfflinePlayers
获取所有登陆过服务器的玩家.原文:Gets every player that has ever played on this server.
- 返回:
- 包含所有登录过的玩家的数组
-
getMessenger
- 返回:
- Messenger实例
-
getHelpMap
- 返回:
- HelpMap实例
-
createInventory
@NotNull public static @NotNull Inventory createInventory(@Nullable @Nullable InventoryHolder owner, @NotNull @NotNull InventoryType type) 以指定类型创建一个空物品栏. 如果type是InventoryType.CHEST
(箱子类型), 新的物品栏的大小则是27, 否则是与物品栏类型对应的正常大小.
如果type是InventoryType.WORKBENCH
, 则这个物品栏不会处理合成配方. 请使用HumanEntity.openWorkbench(Location, boolean)
.
同理, 以InventoryType.ENCHANTING
创建的附魔台物品栏也不起作用. 请使用HumanEntity.openEnchanting(Location, boolean)
.原文:Creates an empty inventory with the specified type. If the type is
InventoryType.CHEST
, the new inventory has a size of 27; otherwise the new inventory has the normal size for its type.
InventoryType.WORKBENCH
will not process crafting recipes if created with this method. UseHumanEntity.openWorkbench(Location, boolean)
instead.
InventoryType.ENCHANTING
will not processItemStack
s for possible enchanting results. UseHumanEntity.openEnchanting(Location, boolean)
instead.- 参数:
owner
- 物品栏的持有者, 不指定持有者为nulltype
- 要创建的物品栏的种类- 返回:
- 新的物品栏
- 抛出:
IllegalArgumentException
- 如果这种InventoryType
物品栏不能显示给玩家- 另请参阅:
-
createInventory
@NotNull public static @NotNull Inventory createInventory(@Nullable @Nullable InventoryHolder owner, @NotNull @NotNull InventoryType type, @NotNull @NotNull String title) 以指定类型和标题创建一个空物品栏. 如果type是InventoryType.CHEST
(箱子类型), 新的物品栏的大小则是27, 否则是与物品栏类型对应的正常大小.
如果type是InventoryType.WORKBENCH
, 则这个物品栏不会处理合成配方. 请使用HumanEntity.openWorkbench(Location, boolean)
.
同理, 以InventoryType.ENCHANTING
创建的附魔台物品栏也不起作用. 请使用HumanEntity.openEnchanting(Location, boolean)
.原文:Creates an empty inventory with the specified type and title. If the type is
InventoryType.CHEST
, the new inventory has a size of 27; otherwise the new inventory has the normal size for its type.
It should be noted that some inventory types do not support titles and may not render with said titles on the Minecraft client.
InventoryType.WORKBENCH
will not process crafting recipes if created with this method. UseHumanEntity.openWorkbench(Location, boolean)
instead.
InventoryType.ENCHANTING
will not processItemStack
s for possible enchanting results. UseHumanEntity.openEnchanting(Location, boolean)
instead.- 参数:
owner
- 物品栏的持有者, 如果没有持有者可为nulltype
- 要创建的物品栏的种类title
- 物品栏的标题, 会显示给玩家- 返回:
- 新的物品栏
- 抛出:
IllegalArgumentException
- 如果这种InventoryType
物品栏不能显示给玩家- 另请参阅:
-
createInventory
@NotNull public static @NotNull Inventory createInventory(@Nullable @Nullable InventoryHolder owner, int size) throws IllegalArgumentException 创建一个类型为InventoryType.CHEST
, 有指定大小的空物品栏.原文:Creates an empty inventory of type
InventoryType.CHEST
with the specified size.- 参数:
owner
- 物品栏的持有者, 不指定持有者为nullsize
- 物品栏的大小, 必须为9的倍数- 返回:
- 新的物品栏
- 抛出:
IllegalArgumentException
- 如果大小不是9的倍数
-
createInventory
@NotNull public static @NotNull Inventory createInventory(@Nullable @Nullable InventoryHolder owner, int size, @NotNull @NotNull String title) throws IllegalArgumentException 创建一个类型为InventoryType.CHEST
, 有指定大小和标题的空物品栏.原文:Creates an empty inventory of type
InventoryType.CHEST
with the specified size and title.- 参数:
owner
- 物品栏的持有者, 不指定持有者为nullsize
- 物品栏的大小, 必须为9的倍数title
- 物品栏的标题, 会显示给玩家- 返回:
- 新的物品栏
- 抛出:
IllegalArgumentException
- 如果大小不是9的倍数
-
createMerchant
创建一个空的商人.原文:Creates an empty merchant.
- 参数:
title
- 查看商人物品栏时显示的标题- 返回:
- 新的商人
-
getMaxChainedNeighborUpdates
public static int getMaxChainedNeighborUpdates()Gets the amount of consecutive neighbor updates before skipping additional ones.- 返回:
- the amount of consecutive neighbor updates, if the value is negative then the limit it's not used
-
getMonsterSpawnLimit
已过时。获取一个区块最大可生成的怪物数量.原文:Gets user-specified limit for number of monsters that can spawn in a chunk.
- 返回:
- 生成限制数
-
getAnimalSpawnLimit
已过时。获取一个区块最大可生成的动物数量.原文: Gets user-specified limit for number of animals that can spawn in a chunk.
- 返回:
- 生成限制数
-
getWaterAnimalSpawnLimit
已过时。获取一个区块最大可生成的水生动物数量.原文:Gets user-specified limit for number of water animals that can spawn in a chunk.
- 返回:
- 生成限制数
-
getWaterAmbientSpawnLimit
已过时。获取一个区块最大可生成的水生环境数量.原文:Gets user-specified limit for number of water ambient mobs that can spawn in a chunk.
- 返回:
- 生成限制数
-
getWaterUndergroundCreatureSpawnLimit
已过时。Deprecated in favor ofgetSpawnLimit(SpawnCategory)
Get user-specified limit for number of water creature underground that can spawn in a chunk.- 返回:
- the water underground creature limit
-
getAmbientSpawnLimit
已过时。获取一个区块最大可生成的环境生物(一般指蝙蝠)数量.原文:Gets user-specified limit for number of ambient mobs that can spawn in a chunk.
- 返回:
- 生成限制数
-
getSpawnLimit
Gets user-specified limit for number ofSpawnCategory
mobs that can spawn in a chunk. Note: theSpawnCategory.MISC
are not consider.- 参数:
spawnCategory
- the category spawn- 返回:
- the
SpawnCategory
spawn limit
-
isPrimaryThread
public static 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.
- 返回:
- 为主线程返回true否则返回false
-
getMotd
获取在客户端服务器列表里显示的消息(服务器的欢迎消息,又称message of the day, 展示在mc客户端的服务器列表).原文:Gets the message that is displayed on the server list.
- 返回:
- 服务器motd
-
setMotd
设置在客户端服务器列表里显示的消息.原文:Set the message that is displayed on the server list.
- 参数:
motd
- 服务器motd
-
getServerLinks
Gets the server links which will be sent to clients- 返回:
- the server's links
-
getShutdownMessage
获取服务器关闭时广播给玩家的默认提示消息.原文:Gets the default message that is displayed when the server is stopped.
- 返回:
- 关服消息
-
getWarningState
获取服务器的警告状态.原文:Gets the current warning state for the server.
- 返回:
- 预先配置的警告状态
-
getItemFactory
- 返回:
- ItemFactory实例
- 另请参阅:
-
getEntityFactory
Gets the instance of the entity factory (forEntitySnapshot
).- 返回:
- the entity factory
- 另请参阅:
-
getScoreboardManager
获取计分板管理器实例.只在第一个世界加载后存在.
原文:Gets the instance of the scoreboard manager.
This will only exist after the first world has loaded.
- 返回:
- 计分板管理器实例, 如果未加载任何世界则为null
-
getScoreboardCriteria
Get (or create) a newCriteria
by its name.- 参数:
name
- the criteria name- 返回:
- the criteria
- 另请参阅:
-
getServerIcon
获取服务器默认图标.原文:Gets an instance of the server's default server-icon.
- 返回:
- 服务器默认图标,当未定义服务器图标时将返回null(该行为无法担保)
-
loadServerIcon
@NotNull public static @NotNull CachedServerIcon loadServerIcon(@NotNull @NotNull File file) throws IllegalArgumentException, Exception 为指定文件创建一个缓存的服务器图标.大小和类型必须在允许范围内(由底层实现定义),否则将会抛出
Exception
.原文:Loads an image from a file, and returns a cached image for the specific server-icon.
Size and type are implementation defined. An incompatible file is guaranteed to throw an implementation-defined
Exception
.- 参数:
file
- 需要被加载的文件- 返回:
- 一个CachedServerIcon实例,可用于
ServerListPingEvent.setServerIcon(CachedServerIcon)
- 抛出:
IllegalArgumentException
- 如果图片为nullException
- 如果图片规格不适合作为服务器图标
-
loadServerIcon
@NotNull public static @NotNull CachedServerIcon loadServerIcon(@NotNull @NotNull BufferedImage image) throws IllegalArgumentException, Exception 为指定图片创建一个缓存的服务器图标.大小和类型必须在允许范围内(由底层实现定义),否则将会抛出
Exception
.原文:Creates a cached server-icon for the specific image.
Size and type are implementation defined. An incompatible file is guaranteed to throw an implementation-defined
Exception
.- 参数:
image
- 用于缓存的图片- 返回:
- 一个CachedServerIcon实例,可用于
ServerListPingEvent.setServerIcon(CachedServerIcon)
- 抛出:
IllegalArgumentException
- 若image为nullException
- 如果图片规格不适合作为服务器图标
-
setIdleTimeout
public static void setIdleTimeout(int threshold) 设置一个空闲超时阈值(IDLE_KICK). 玩家空闲达到这个特定的时间后会被自动踢出服务器. 如果设置为0,该功能将被关闭.原文: Set the idle kick timeout. Any players idle for the specified amount of time will be automatically kicked.
A value of 0 will disable the idle kick timeout.
- 参数:
threshold
- 玩家空闲时间阈值,以分钟为单位
-
getIdleTimeout
public static int getIdleTimeout()获取自动踢出闲置玩家的时间.原文:Gets the idle kick timeout.
- 返回:
- the 闲置超时的分钟数
-
createChunkData
创建一个 ChunkData 实例,以用于区块生成。原文: Create a ChunkData for use in a generator. See
ChunkGenerator.generateChunkData(org.bukkit.World, java.util.Random, int, int, org.bukkit.generator.ChunkGenerator.BiomeGrid)
- 参数:
world
- ChunkData对应的世界- 返回:
- 这个世界的新ChunkData实例
-
createBossBar
@NotNull public static @NotNull BossBar createBossBar(@Nullable @Nullable String title, @NotNull @NotNull BarColor color, @NotNull @NotNull BarStyle style, @NotNull @NotNull BarFlag... flags) 创建一个Boss血量条实例. 血量条的进度默认为1.0.原文: Creates a boss bar instance to display to players. The progress defaults to 1.0
- 参数:
title
- 血量条的标题color
- 血量条的颜色style
- 血量条的样式flags
- 血量条的附加属性列表(可选)- 返回:
- 创建的Boss血量条实例
-
createBossBar
@NotNull public static @NotNull KeyedBossBar createBossBar(@NotNull @NotNull NamespacedKey key, @Nullable @Nullable String title, @NotNull @NotNull BarColor color, @NotNull @NotNull BarStyle style, @NotNull @NotNull BarFlag... flags) 创建一个Boss血量条实例. 血量条的进度默认为1.0.
该方法创建的实例会被添加到服务器的持久化存储空间中, 命令将可以编辑它们, 服务器重启后会被恢复.原文:Creates a boss bar instance to display to players. The progress defaults to 1.0.
This instance is added to the persistent storage of the server and will be editable by commands and restored after restart.- 参数:
key
- boss血量条的key, 将用于获取血量条title
- 血量条的标题color
- 血量条的颜色style
- 血量条的样式flags
- 血量条的附加属性列表(可选)- 返回:
- 创建的Boss血量条实例
-
getBossBars
获取一个不可编辑的用于迭代所有持久存储的boss血量条的迭代器.- 这个血量条不绑定到某一具体的
Boss
- 这个血量条不是由
createBossBar(String, BarColor, BarStyle, BarFlag...)
创建的
原文:Gets an unmodifiable iterator through all persistent bossbars.
- not bound to a
Boss
-
not created using
createBossBar(String, BarColor, BarStyle, BarFlag...)
- 返回:
- bossbar迭代器
- 这个血量条不绑定到某一具体的
-
getBossBar
Gets theKeyedBossBar
specified by this key.- not bound to a
Boss
-
not created using
createBossBar(String, BarColor, BarStyle, BarFlag...)
- 参数:
key
- unique bossbar key- 返回:
- bossbar or null if not exists
- not bound to a
-
removeBossBar
Removes aKeyedBossBar
specified by this key.- not bound to a
Boss
-
not created using
createBossBar(String, BarColor, BarStyle, BarFlag...)
- 参数:
key
- unique bossbar key- 返回:
- true if removal succeeded or false
- not bound to a
-
getEntity
用UUID获取实体.原文:Gets an entity on the server by its UUID
- 参数:
uuid
- 实体的UUID- 返回:
- 该UUID代表的实体,如果不存在为null
-
getAdvancement
通过Key获得特定的进度对象.原文: Get the advancement specified by this key.
- 参数:
key
- 寻找进度对象所需的key- 返回:
- 一个进度对象. 如果它不存在,将返回null.
-
advancementIterator
获取一个用以遍历所有进度的迭代器对象。 进度不能够从该迭代器上删除。原文: Get an iterator through all advancements. Advancements cannot be removed from this iterator,
- 返回:
- 一个进度迭代器对象
-
createBlockData
Creates a newBlockData
instance for the specified Material, with all properties initialized to unspecified defaults.- 参数:
material
- the material- 返回:
- new data instance
-
createBlockData
@NotNull public static @NotNull BlockData createBlockData(@NotNull @NotNull Material material, @Nullable @Nullable Consumer<? super BlockData> consumer) Creates a newBlockData
instance for the specified Material, with all properties initialized to unspecified defaults.- 参数:
material
- the materialconsumer
- consumer to run on new instance before returning- 返回:
- new data instance
-
createBlockData
@NotNull public static @NotNull BlockData createBlockData(@NotNull @NotNull String data) throws IllegalArgumentException Creates a newBlockData
instance with material and properties parsed from provided data.- 参数:
data
- data string- 返回:
- new data instance
- 抛出:
IllegalArgumentException
- if the specified data is not valid
-
createBlockData
@NotNull @Contract("null, null -> fail") public static @NotNull BlockData createBlockData(@Nullable @Nullable Material material, @Nullable @Nullable String data) throws IllegalArgumentException Creates a newBlockData
instance for the specified Material, with all properties initialized to unspecified defaults, except for those provided in data.- 参数:
material
- the materialdata
- data string- 返回:
- new data instance
- 抛出:
IllegalArgumentException
- if the specified data is not valid
-
getTag
@Nullable public static <T extends Keyed> @Nullable Tag<T> getTag(@NotNull @NotNull String registry, @NotNull @NotNull NamespacedKey tag, @NotNull @NotNull Class<T> clazz) Gets a tag which has already been defined within the server. Plugins are suggested to use the concrete tags inTag
rather than this method which makes no guarantees about which tags are available, and may also be less performant due to lack of caching.
Tags will be searched for in an implementation specific manner, but a path consisting of namespace/tags/registry/key is expected.
Server implementations are allowed to handle only the registries indicated inTag
.- 类型参数:
T
- type of the tag- 参数:
registry
- the tag registry to look attag
- the name of the tagclazz
- the class of the tag entries- 返回:
- the tag or null
-
getTags
@NotNull public static <T extends Keyed> @NotNull Iterable<Tag<T>> getTags(@NotNull @NotNull String registry, @NotNull @NotNull Class<T> clazz) 获取服务器定义的所有标签.
Server implementations are allowed to handle only the registries indicated inTag
.
对返回的迭代器的可变性不作保证. 原文:Gets a all tags which have been defined within the server.
Server implementations are allowed to handle only the registries indicated inTag
.
No guarantees are made about the mutability of the returned iterator.- 类型参数:
T
- tag的类型- 参数:
registry
- the tag registry to look atclazz
- the class of the tag entries- 返回:
- all defined tags
-
getLootTable
- 参数:
key
- LootTable的名称- 返回:
- LootTable实例, 若找不到返回null
-
selectEntities
@NotNull public static @NotNull List<Entity> selectEntities(@NotNull @NotNull CommandSender sender, @NotNull @NotNull String selector) throws IllegalArgumentException 以给定的原版选择器选择筛选实体.
既不保证选择器的格式, 也不保证. 原文:Selects entities using the given Vanilla selector.
No guarantees are made about the selector format, other than they match the Vanilla format for the active Minecraft version.
Usually a selector will start with '@', unless selecting a Player in which case it may simply be the Player's name or UUID.
Note that in Vanilla, elevated permissions are usually required to use '@' selectors, but this method should not check such permissions from the sender.- 参数:
sender
- the sender to execute as, must be providedselector
- the selection string- 返回:
- a list of the selected entities. The list will not be null, but no further guarantees are made.
- 抛出:
IllegalArgumentException
- if the selector is malformed in any way or a parameter is null
-
getStructureManager
Gets the structure manager for loading and saving structures.- 返回:
- the structure manager
-
getRegistry
@Nullable public static <T extends Keyed> @Nullable Registry<T> getRegistry(@NotNull @NotNull Class<T> tClass) Returns the registry for the given class.
If no registry is present for the given class null will be returned.
Depending on the implementation not every registry present inRegistry
will be returned by this method.- 类型参数:
T
- type of the registry- 参数:
tClass
- of the registry to get- 返回:
- the corresponding registry or null if not present
-
getUnsafe
已过时。- 返回:
- UnsafeValues实例
- 另请参阅:
-
spigot
-
banIP(InetAddress)