类 Bukkit
Server
单例的调用.-
方法概要
修饰符和类型方法说明static boolean
向合成管理器添加一个合成配方.static Iterator<Advancement>
获取一个用以遍历所有进度的迭代器对象。static void
封禁指定的IP地址.static int
Broadcasts the specified message to every user with the given permission name.static int
broadcastMessage
(String message) 广播一条消息到所有在线玩家.static void
清理所有已添加的合成配方.static BossBar
createBossBar
(String title, BarColor color, BarStyle style, BarFlag... flags) 创建一个Boos血量条实例。static ChunkGenerator.ChunkData
createChunkData
(World world) 创建一个 ChunkData 实例,以用于区块生成。static Inventory
createInventory
(InventoryHolder owner, int size) Creates an empty inventory of typeInventoryType.CHEST
with the specified size.static Inventory
createInventory
(InventoryHolder owner, int size, String title) Creates an empty inventory of typeInventoryType.CHEST
with the specified size and title.static Inventory
createInventory
(InventoryHolder owner, InventoryType type) Creates an empty inventory of the specified type.static Inventory
createInventory
(InventoryHolder owner, InventoryType type, String title) Creates an empty inventory with the specified type and title.static MapView
创建一个新地图并自动分配一个ID.static Merchant
createMerchant
(String title) Creates an empty merchant.static World
createWorld
(WorldCreator creator) 用给定的世界生成器来创建或者加载一个世界.static boolean
dispatchCommand
(CommandSender sender, String commandLine) Dispatches a command on this server, and executes it if found.static Advancement
通过Key获得特定的进度对象.static boolean
获取此服务器是否开启了末路之地.static boolean
获取服务器是否允许飞行.static boolean
获取此服务器是否开启了下界.static int
Gets user-specified limit for number of ambient mobs that can spawn in a chunk.static int
获取用户指定的可以在一个区块内生成的动物的数量的限制.static BanList
getBanList
(BanList.Type type) 获取指定类型的封禁列表.static Set<OfflinePlayer>
获取已被封禁的玩家.static String
获取正在运行的服务器的Bukkit版本.获取服务器配置定义的命令别名列表.static long
获取服务器的最小连接间隔设定.static ConsoleCommandSender
Gets aConsoleCommandSender
that may be used as an input source for this server.static GameMode
获取服务器的的默认游戏模式
.static Entity
用UUID获取实体.static boolean
获取此服务器是否自然生成结构.static HelpMap
Gets theHelpMap
providing help topics for this server.static int
获取服务器空闲超时阈值(IDLE_KICK).static String
getIp()
获取服务器绑定的IP, 如果没有就返回空字符串.获取已被封禁的IP地址.static ItemFactory
Gets the instance of the item factory (forItemMeta
).static Logger
返回与此服务器实例绑定的主Logger
.static MapView
getMap
(short id) 已过时。不安全的参数static int
获取服务器允许进入的最大玩家数.static Messenger
Gets theMessenger
responsible for this server.static int
Gets user-specified limit for number of monsters that can spawn in a chunk.static String
getMotd()
获取在客户端服务器列表里显示的消息(服务器的欢迎消息,又称message of the day).static String
getName()
获取这个Server
实例的名字.static OfflinePlayer
getOfflinePlayer
(String name) 已过时。Persistent storage of users should be by UUID as names are no longer unique past a single session.static OfflinePlayer
getOfflinePlayer
(UUID id) 以指定的UUID获取玩家,无论他们使用正版模式还是离线模式.static OfflinePlayer[]
获取曾在此服务器游戏的玩家.static boolean
获取服务器的正版准入设定.static Collection<? extends Player>
获取所有在线玩家的集合的视图.static Set<OfflinePlayer>
获取服务器的所有OP(管理员).static Player
已过时。被getPlayer(UUID)
取代, 因为玩家名不再一定是唯一的.static Player
使用给定UUID
获取玩家.static Player
getPlayerExact
(String name) 已过时。被getPlayer(UUID)
取代, 因为玩家名不再一定是唯一的.static PluginCommand
getPluginCommand
(String name) 用给定命令名或别名获取PluginCommand
.static PluginManager
获取插件管理器以与其他插件进行交互.static int
getPort()
获取运行的服务器所在的端口号.getRecipesFor
(ItemStack result) Get a list of all recipes for a given item.static BukkitScheduler
获取用于管理调度任务的调度器.static ScoreboardManager
Gets the instance of the scoreboard manager.static Server
获取当前持有的Server
实例.static CachedServerIcon
Gets an instance of the server's default server-icon.static String
获取服务器的ID.static String
获取服务器的名称.static ServicesManager
获取服务管理器.static String
获取服务器关闭时显示的提示消息.static int
获取出生地保护的范围(以方块为单位).static int
获取每隔多少tick应该生成一次动物.static int
获取每隔多少tick应该生成一次怪物.static UnsafeValues
已过时。static String
获取更新文件夹的名字.static File
获取更新文件夹的File
实例.static String
获取这个Server
实例的版本.static int
获取服务器的视距.static Warning.WarningState
Gets the current warning state for the server.static int
Gets user-specified limit for number of water animals that can spawn in a chunk.static Set<OfflinePlayer>
获取所有已被添加到白名单的玩家.static World
使用给定名称查找世界.static World
使用给定唯一ID查找世界.static File
Gets the folder that contains all of the variousWorld
s.获取当前服务器加载的所有世界的列表.static String
获取默认世界的世界类型 (level-type 设置).static boolean
获取此服务器是否开启了白名单.static boolean
获取服务器是否处于极限模式.static boolean
Checks the current thread against the expected primary thread for the server.static CachedServerIcon
loadServerIcon
(BufferedImage image) Creates a cached server-icon for the specific image.static CachedServerIcon
loadServerIcon
(File file) Loads an image from a file, and returns a cached image for the specific server-icon.matchPlayer
(String name) 已过时。被getPlayer(UUID)
取代, 因为玩家名不再一定是唯一的.通过自定义合成配方列表获取迭代器.static void
reload()
重载服务器, 刷新设置与插件信息.static void
只重载Minecraft游戏数据.static void
从硬盘重载白名单列表.static void
重置自定义合成配方列表值至默认.static void
保存已加载的玩家信息.static void
setDefaultGameMode
(GameMode mode) 设置服务器的默认游戏模式.static void
setIdleTimeout
(int threshold) 设置一个空闲超时阈值(IDLE_KICK).static void
请求设置所持有的Server
实例.static void
setSpawnRadius
(int value) 设置出生地保护的范围.static void
setWhitelist
(boolean value) 设置此服务器是否开启白名单.static void
shutdown()
关闭服务器,停止一切在运行的东西.static void
解禁指定的IP地址.static boolean
unloadWorld
(String name, boolean save) 卸载给定名称对应的世界.static boolean
unloadWorld
(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.
- 返回:
- 服务器的最大玩家数
-
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.
- 返回:
- 服务器的视距
-
getIp
获取服务器绑定的IP, 如果没有就返回空字符串.原文: Get the IP that this server is bound to, or empty string if not specified.
- 返回:
- 服务器绑定的IP,如果没有就返回空 字符串
-
getServerName
获取服务器的名称.原文: Get the name of this server.
- 返回:
- 服务器名
-
getServerId
获取服务器的ID. 这是一个简单的字母标识, 可以用来唯一地识别此服务器.原文: Get an ID of this server. The ID is a simple generally alphanumeric ID that can be used for uniquely identifying this server.
- 返回:
- 服务器的唯一标识
-
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.
- 返回:
- 是否生成结构
-
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.
- 返回:
- 是否可以进入下界
-
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为关
-
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
获取更新文件夹的名字.系统将会在插件加载时选择适当的时机利用此文件夹来安全地更新插件.
更新文件夹的位置相对于插件文件夹.
原文: 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
public static int 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.
- 返回:
- 每个动物生成的默认刻
-
getTicksPerMonsterSpawns
public static int 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.
- 返回:
- 每个动物生成的默认刻
-
getPlayer
已过时。被getPlayer(UUID)
取代, 因为玩家名不再一定是唯一的.使用给定玩家名模糊搜索玩家. 这个方法不可能返回离线玩家的对象.译注: 注意此方法用于模糊搜索——当服务器内有玩家 aaa, aab, abc 时, 使用
getPlayer("ab")
会返回玩家 abc 的实例, 而如果 ab 在线则会返回 ab 的实例 因此可能存在严重的安全问题, 需要精确搜索(例如给予OP时)请用getPlayerExact(java.lang.String)
或getPlayer(java.util.UUID)
代替.原文: Gets a player object by the given username. This method may not return objects for offline players.
- 参数:
name
- 用来查找的玩家名- 返回:
- 如果找到了则返回玩家对象, 否则返回null
-
getPlayerExact
已过时。被getPlayer(UUID)
取代, 因为玩家名不再一定是唯一的.使用给定玩家名精确查找玩家, 不区分大小写.原文: Gets the player with the exact given name, case insensitive.
- 参数:
name
- 用于检索的精确玩家名称, 不区分大小写- 返回:
- 如果找到了则返回玩家对象, 否则返回null
-
matchPlayer
已过时。被getPlayer(UUID)
取代, 因为玩家名不再一定是唯一的.尝试获取所有匹配给定名称的玩家, 并返回包含了一切可能匹配的列表.这个列表没有经过任何特殊排序. 如果能在在线玩家内精确匹配到给定名称, 则返回一个只包含单个结果的列表.
译注: 设有在线玩家 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
-
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
-
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(CommandSender sender, String commandLine) throws CommandException Dispatches a command on this server, and executes it if found.- 参数:
sender
- the apparent sender of the commandcommandLine
- the command + arguments. Example:test abc 123
- 返回:
- returns false if no target is found
- 抛出:
CommandException
- thrown when the executor for the given command fails with an unhandled exception
-
addRecipe
向合成管理器添加一个合成配方.原文:Adds a recipe to the crafting manager.
- 参数:
recipe
- 要添加的合成配方- 返回:
- 是否成功的地添加了合成配方
-
getRecipesFor
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
- the item to match against recipe results- 返回:
- a list of recipes with the given result
-
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.
-
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设为没有保护
-
getOnlineMode
public static boolean getOnlineMode()获取服务器的正版准入设定.原文:Gets whether the Server is in online mode or not.
- 返回:
- 服务器是否处于正版模式
-
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
- message to broadcastpermission
- the required permissionpermissibles
must have to receive the broadcast- 返回:
- number of message recipients
-
getOfflinePlayer
已过时。Persistent storage of users should be by UUID as names are no longer unique past a single session.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
- the name the player to retrieve- 返回:
- an offline player
- 另请参阅:
-
getOfflinePlayer
以指定的UUID获取玩家,无论他们使用正版模式还是离线模式.本方法都将返回一个对象,甚至此玩家并不存在.对于此方法来说,任何玩家都存在.
原文: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对象
-
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地址
-
getBannedPlayers
获取已被封禁的玩家.原文:Gets a set containing all banned players.
- 返回:
- 已被封禁的玩家
-
getBanList
获取指定类型的封禁列表.以玩家名封禁已不再支持,尝试请求获取将返回null(Is it true? 经测试并没有返回null).替代方法是封禁UUID.
原文:Gets a ban list for the supplied type.
Bans by name are no longer supported and this method will return null when trying to request them. The replacement is bans by UUID.
- 参数:
type
- 要获取的封禁列表的类型,不能为null- 返回:
- 指定类型的封禁列表
-
getOperators
获取服务器的所有OP(管理员).原文:Gets a set containing all player operators.
- 返回:
- 服务器OP
-
getDefaultGameMode
- 返回:
- 默认游戏模式
-
setDefaultGameMode
设置服务器的默认游戏模式.原文:Sets the default
GameMode
for new players.- 参数:
mode
- 新的默认游戏模式
-
getConsoleSender
Gets aConsoleCommandSender
that may be used as an input source for this server.- 返回:
- a console command sender
-
getWorldContainer
Gets the folder that contains all of the variousWorld
s.- 返回:
- folder that contains all worlds
-
getOfflinePlayers
获取曾在此服务器游戏的玩家.原文:Gets every player that has ever played on this server.
- 返回:
- 曾在此服务器游戏的玩家
-
getMessenger
Gets theMessenger
responsible for this server.- 返回:
- messenger responsible for this server
-
getHelpMap
Gets theHelpMap
providing help topics for this server.- 返回:
- a help map for this server
-
createInventory
Creates an empty inventory of the specified type. If the type isInventoryType.CHEST
, the new inventory has a size of 27; otherwise the new inventory has the normal size for its type.- 参数:
owner
- the holder of the inventory, or null to indicate no holdertype
- the type of inventory to create- 返回:
- a new inventory
-
createInventory
Creates an empty inventory with the specified type and title. If the type isInventoryType.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.- 参数:
owner
- The holder of the inventory; can be null if there's no holder.type
- The type of inventory to create.title
- The title of the inventory, to be displayed when it is viewed.- 返回:
- The new inventory.
-
createInventory
public static Inventory createInventory(InventoryHolder owner, int size) throws IllegalArgumentException Creates an empty inventory of typeInventoryType.CHEST
with the specified size.- 参数:
owner
- the holder of the inventory, or null to indicate no holdersize
- a multiple of 9 as the size of inventory to create- 返回:
- a new inventory
- 抛出:
IllegalArgumentException
- if the size is not a multiple of 9
-
createInventory
public static Inventory createInventory(InventoryHolder owner, int size, String title) throws IllegalArgumentException Creates an empty inventory of typeInventoryType.CHEST
with the specified size and title.- 参数:
owner
- the holder of the inventory, or null to indicate no holdersize
- a multiple of 9 as the size of inventory to createtitle
- the title of the inventory, displayed when inventory is viewed- 返回:
- a new inventory
- 抛出:
IllegalArgumentException
- if the size is not a multiple of 9
-
createMerchant
Creates an empty merchant.- 参数:
title
- the title of the corresponding merchant inventory, displayed when the merchant inventory is viewed- 返回:
- a new merchant
-
getMonsterSpawnLimit
public static int getMonsterSpawnLimit()Gets user-specified limit for number of monsters that can spawn in a chunk.- 返回:
- the monster spawn limit
-
getAnimalSpawnLimit
public static int getAnimalSpawnLimit()获取用户指定的可以在一个区块内生成的动物的数量的限制.原文: Gets user-specified limit for number of animals that can spawn in a chunk.
- 返回:
- 同一区块内的动物数量限制
-
getWaterAnimalSpawnLimit
public static int getWaterAnimalSpawnLimit()Gets user-specified limit for number of water animals that can spawn in a chunk.- 返回:
- the water animal spawn limit
-
getAmbientSpawnLimit
public static int getAmbientSpawnLimit()Gets user-specified limit for number of ambient mobs that can spawn in a chunk.- 返回:
- the ambient 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 if the current thread matches the expected primary thread, false otherwise
-
getMotd
获取在客户端服务器列表里显示的消息(服务器的欢迎消息,又称message of the day).原文:Gets the message that is displayed on the server list.
- 返回:
- 服务器motd
-
getShutdownMessage
获取服务器关闭时显示的提示消息.原文:Gets the default message that is displayed when the server is stopped.
- 返回:
- 服务器关闭提示消息内容
-
getWarningState
Gets the current warning state for the server.- 返回:
- the configured warning state
-
getItemFactory
Gets the instance of the item factory (forItemMeta
).- 返回:
- the item factory
- 另请参阅:
-
getScoreboardManager
Gets the instance of the scoreboard manager.This will only exist after the first world has loaded.
- 返回:
- the scoreboard manager or null if no worlds are loaded.
-
getServerIcon
Gets an instance of the server's default server-icon.- 返回:
- the default server-icon; null values may be used by the implementation to indicate no defined icon, but this behavior is not guaranteed
-
loadServerIcon
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
- the file to load the from- 返回:
- a cached server-icon that can be used for a
ServerListPingEvent.setServerIcon(CachedServerIcon)
- 抛出:
IllegalArgumentException
- if image is nullException
- if the image does not meet current server server-icon specifications
-
loadServerIcon
public static CachedServerIcon loadServerIcon(BufferedImage image) throws IllegalArgumentException, 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
- the image to use- 返回:
- a cached server-icon that can be used for a
ServerListPingEvent.setServerIcon(CachedServerIcon)
- 抛出:
IllegalArgumentException
- if image is nullException
- if the image does not meet current server server-icon specifications
-
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()获取服务器空闲超时阈值(IDLE_KICK).原文: Gets the idle kick timeout.
- 返回:
- 以分钟为单位的空闲超时阈值
-
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
创建一个Boos血量条实例。血量条的进度默认为1.0。原文: Creates a boss bar instance to display to players. The progress defaults to 1.0
- 参数:
title
- 血量条的标题color
- 血量条的颜色style
- 血量条的样式flags
- 血量条的附加属性列表(可选)- 返回:
- 创建的Boss血量条实例
-
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,
- 返回:
- 一个进度迭代器对象
-
getUnsafe
已过时。- 返回:
- UnsafeValues实例
- 另请参阅:
-