public final class Bukkit
extends java.lang.Object
Server
单例的调用.限定符和类型 | 方法和说明 |
---|---|
static boolean |
addRecipe(Recipe recipe)
向合成管理器添加一个合成配方.
|
static java.util.Iterator<Advancement> |
advancementIterator()
获取一个用以遍历所有进度的迭代器对象。
|
static void |
banIP(java.lang.String address)
封禁指定的IP地址.
|
static int |
broadcast(java.lang.String message,
java.lang.String permission)
Broadcasts the specified message to every user with the given
permission name.
|
static int |
broadcastMessage(java.lang.String message)
广播一条消息到所有在线玩家.
|
static void |
clearRecipes()
清理所有已添加的合成配方.
|
static BossBar |
createBossBar(java.lang.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 type
InventoryType.CHEST with the
specified size. |
static Inventory |
createInventory(InventoryHolder owner,
int size,
java.lang.String title)
Creates an empty inventory of type
InventoryType.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,
java.lang.String title)
Creates an empty inventory with the specified type and title.
|
static MapView |
createMap(World world)
创建一个新地图并自动分配一个ID.
|
static Merchant |
createMerchant(java.lang.String title)
Creates an empty merchant.
|
static World |
createWorld(WorldCreator creator)
用给定的世界生成器来创建或者加载一个世界.
|
static boolean |
dispatchCommand(CommandSender sender,
java.lang.String commandLine)
Dispatches a command on this server, and executes it if found.
|
static Advancement |
getAdvancement(NamespacedKey key)
通过Key获得特定的进度对象.
|
static boolean |
getAllowEnd()
获取此服务器是否开启了末路之地.
|
static boolean |
getAllowFlight()
获取服务器是否允许飞行.
|
static boolean |
getAllowNether()
获取此服务器是否开启了下界.
|
static int |
getAmbientSpawnLimit()
Gets user-specified limit for number of ambient mobs that can spawn in
a chunk.
|
static int |
getAnimalSpawnLimit()
获取用户指定的可以在一个区块内生成的动物的数量的限制.
|
static BanList |
getBanList(BanList.Type type)
获取指定类型的封禁列表.
|
static java.util.Set<OfflinePlayer> |
getBannedPlayers()
获取已被封禁的玩家.
|
static java.lang.String |
getBukkitVersion()
获取正在运行的服务器的Bukkit版本.
|
static java.util.Map<java.lang.String,java.lang.String[]> |
getCommandAliases()
获取服务器配置定义的命令别名列表.
|
static long |
getConnectionThrottle()
获取服务器的最小连接间隔设定.
|
static ConsoleCommandSender |
getConsoleSender()
Gets a
ConsoleCommandSender that may be used as an input source
for this server. |
static GameMode |
getDefaultGameMode()
获取服务器的的默认
游戏模式 . |
static Entity |
getEntity(java.util.UUID uuid)
用UUID获取实体.
|
static boolean |
getGenerateStructures()
获取此服务器是否自然生成结构.
|
static HelpMap |
getHelpMap()
Gets the
HelpMap providing help topics for this server. |
static int |
getIdleTimeout()
获取服务器空闲超时阈值(IDLE_KICK).
|
static java.lang.String |
getIp()
获取服务器绑定的IP, 如果没有就返回空字符串.
|
static java.util.Set<java.lang.String> |
getIPBans()
获取已被封禁的IP地址.
|
static ItemFactory |
getItemFactory()
Gets the instance of the item factory (for
ItemMeta ). |
static java.util.logging.Logger |
getLogger()
返回与此服务器实例绑定的主
Logger . |
static MapView |
getMap(short id)
已过时。
不安全的参数
|
static int |
getMaxPlayers()
获取服务器允许进入的最大玩家数.
|
static Messenger |
getMessenger()
Gets the
Messenger responsible for this server. |
static int |
getMonsterSpawnLimit()
Gets user-specified limit for number of monsters that can spawn in a
chunk.
|
static java.lang.String |
getMotd()
获取在客户端服务器列表里显示的消息(服务器的欢迎消息,又称message of the day).
|
static java.lang.String |
getName()
获取这个
Server 实例的名字. |
static OfflinePlayer |
getOfflinePlayer(java.lang.String name)
已过时。
Persistent storage of users should be by UUID as names are no longer
unique past a single session.
|
static OfflinePlayer |
getOfflinePlayer(java.util.UUID id)
以指定的UUID获取玩家,无论他们使用正版模式还是离线模式.
|
static OfflinePlayer[] |
getOfflinePlayers()
获取曾在此服务器游戏的玩家.
|
static boolean |
getOnlineMode()
获取服务器的正版准入设定.
|
static java.util.Collection<? extends Player> |
getOnlinePlayers()
获取所有在线玩家的集合的视图.
|
static java.util.Set<OfflinePlayer> |
getOperators()
获取服务器的所有OP(管理员).
|
static Player |
getPlayer(java.lang.String name)
已过时。
被
getPlayer(UUID) 取代, 因为玩家名不再一定是唯一的. |
static Player |
getPlayer(java.util.UUID id)
使用给定
UUID 获取玩家. |
static Player |
getPlayerExact(java.lang.String name)
已过时。
被
getPlayer(UUID) 取代, 因为玩家名不再一定是唯一的. |
static PluginCommand |
getPluginCommand(java.lang.String name)
用给定命令名或别名获取
PluginCommand . |
static PluginManager |
getPluginManager()
获取插件管理器以与其他插件进行交互.
|
static int |
getPort()
获取运行的服务器所在的端口号.
|
static java.util.List<Recipe> |
getRecipesFor(ItemStack result)
Get a list of all recipes for a given item.
|
static BukkitScheduler |
getScheduler()
获取用于管理调度任务的调度器.
|
static ScoreboardManager |
getScoreboardManager()
Gets the instance of the scoreboard manager.
|
static Server |
getServer()
获取当前持有的
Server 实例. |
static CachedServerIcon |
getServerIcon()
Gets an instance of the server's default server-icon.
|
static java.lang.String |
getServerId()
获取服务器的ID.
|
static java.lang.String |
getServerName()
获取服务器的名称.
|
static ServicesManager |
getServicesManager()
获取服务管理器.
|
static java.lang.String |
getShutdownMessage()
获取服务器关闭时显示的提示消息.
|
static int |
getSpawnRadius()
获取出生地保护的范围(以方块为单位).
|
static int |
getTicksPerAnimalSpawns()
获取每隔多少tick应该生成一次动物.
|
static int |
getTicksPerMonsterSpawns()
获取每隔多少tick应该生成一次怪物.
|
static UnsafeValues |
getUnsafe()
已过时。
|
static java.lang.String |
getUpdateFolder()
获取更新文件夹的名字.
|
static java.io.File |
getUpdateFolderFile()
获取更新文件夹的
File 实例. |
static java.lang.String |
getVersion()
获取这个
Server 实例的版本. |
static int |
getViewDistance()
获取服务器的视距.
|
static Warning.WarningState |
getWarningState()
Gets the current warning state for the server.
|
static int |
getWaterAnimalSpawnLimit()
Gets user-specified limit for number of water animals that can spawn in
a chunk.
|
static java.util.Set<OfflinePlayer> |
getWhitelistedPlayers()
获取所有已被添加到白名单的玩家.
|
static World |
getWorld(java.lang.String name)
使用给定名称查找世界.
|
static World |
getWorld(java.util.UUID uid)
使用给定唯一ID查找世界.
|
static java.io.File |
getWorldContainer()
Gets the folder that contains all of the various
World s. |
static java.util.List<World> |
getWorlds()
获取当前服务器加载的所有世界的列表.
|
static java.lang.String |
getWorldType()
获取默认世界的世界类型 (level-type 设置).
|
static boolean |
hasWhitelist()
获取此服务器是否开启了白名单.
|
static boolean |
isHardcore()
获取服务器是否处于极限模式.
|
static boolean |
isPrimaryThread()
Checks the current thread against the expected primary thread for the
server.
|
static CachedServerIcon |
loadServerIcon(java.awt.image.BufferedImage image)
Creates a cached server-icon for the specific image.
|
static CachedServerIcon |
loadServerIcon(java.io.File file)
Loads an image from a file, and returns a cached image for the specific
server-icon.
|
static java.util.List<Player> |
matchPlayer(java.lang.String name)
已过时。
被
getPlayer(UUID) 取代, 因为玩家名不再一定是唯一的. |
static java.util.Iterator<Recipe> |
recipeIterator()
通过自定义合成配方列表获取迭代器.
|
static void |
reload()
重载服务器, 刷新设置与插件信息.
|
static void |
reloadData()
只重载Minecraft游戏数据.
|
static void |
reloadWhitelist()
从硬盘重载白名单列表.
|
static void |
resetRecipes()
重置自定义合成配方列表值至默认.
|
static void |
savePlayers()
保存已加载的玩家信息.
|
static void |
setDefaultGameMode(GameMode mode)
设置服务器的默认游戏模式.
|
static void |
setIdleTimeout(int threshold)
设置一个空闲超时阈值(IDLE_KICK).
|
static void |
setServer(Server server)
请求设置所持有的
Server 实例. |
static void |
setSpawnRadius(int value)
设置出生地保护的范围.
|
static void |
setWhitelist(boolean value)
设置此服务器是否开启白名单.
|
static void |
shutdown()
关闭服务器,停止一切在运行的东西.
|
static void |
unbanIP(java.lang.String address)
解禁指定的IP地址.
|
static boolean |
unloadWorld(java.lang.String name,
boolean save)
卸载给定名称对应的世界.
|
static boolean |
unloadWorld(World world,
boolean save)
卸载指定的世界.
|
public static Server getServer()
public static void setServer(Server server)
Server
实例.
如果 Server 已经被设定过了, 这个操作无法完成.
原文:
Attempts to set the Server
singleton.
This cannot be done if the Server is already set.
server
- 服务器实例public static java.lang.String getName()
Server
实例的名字.
原文: Gets the name of this server implementation.
public static java.lang.String getVersion()
Server
实例的版本.
原文: Gets the version string of this server implementation.
public static java.lang.String getBukkitVersion()
原文: Gets the Bukkit version that this server is running.
public static java.util.Collection<? extends Player> getOnlinePlayers()
此 视图 is a reused
object, making some operations like Collection.size()
zero-allocation.
(以下翻译仅供参考)
此集合是由内部表示支持的视图, 因此, 一切修改服务器内部状态的操作将会
立即反映到此集合上. 并不严格保证未来或所有实现都会遵守
返回一个可再利用集合 (一致性)的约定. 不赞成对这个集合执行强制转换或
依赖于接口实现 (例如 Serializable
or List
).
迭代操作 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
or List
), 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
, and kicking
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.
public static int getMaxPlayers()
原文: Get the maximum amount of players which can login to this server.
public static int getPort()
原文:Get the game port that the server runs on.
public static int getViewDistance()
原文: Get the view distance from this server.
public static java.lang.String getIp()
原文: Get the IP that this server is bound to, or empty string if not specified.
public static java.lang.String getServerName()
原文: Get the name of this server.
public static java.lang.String getServerId()
原文: Get an ID of this server. The ID is a simple generally alphanumeric ID that can be used for uniquely identifying this server.
public static java.lang.String getWorldType()
原文: Get world type (level-type setting) for default world.
public static boolean getGenerateStructures()
原文: Get generate-structures setting.
public static boolean getAllowEnd()
原文: Gets whether this server allows the End or not.
public static boolean getAllowNether()
原文: Gets whether this server allows the Nether or not.
public static boolean hasWhitelist()
原文: Gets whether this server has a whitelist or not.
public static void setWhitelist(boolean value)
原文: Sets if the server is whitelisted.
value
- true为开, false为关public static java.util.Set<OfflinePlayer> getWhitelistedPlayers()
原文: Gets a list of whitelisted players.
public static void reloadWhitelist()
原文:Reloads the whitelist from disk.
public static int broadcastMessage(java.lang.String message)
这与调用 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)
to Server.BROADCAST_CHANNEL_USERS
message
- 要广播的消息public static java.lang.String 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.
public static java.io.File getUpdateFolderFile()
File
实例.
系统将会在插件加载时选择适当的时机利用此文件夹来安全地更新插件.
原文: Gets the update folder. The update folder is used to safely update plugins at the right moment on a plugin load.
public static long getConnectionThrottle()
译注: 单位为毫秒.
原文: Gets the value of the connection throttle setting.
public static int getTicksPerAnimalSpawns()
Minecraft使用的默认值: 400.
原文:
Example Usage:
Note: If set to 0, animal spawning will be disabled. We recommend using spawn-animals to control this instead.
Minecraft default: 400.
public static int getTicksPerMonsterSpawns()
Minecraft使用的默认值: 1.
原文: Gets default ticks per monster spawns value.
Example Usage:
Note: If set to 0, monster spawning will be disabled. We recommend using spawn-monsters to control this instead.
Minecraft default: 1.
@Deprecated public static Player getPlayer(java.lang.String name)
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
- 用来查找的玩家名@Deprecated public static Player getPlayerExact(java.lang.String name)
getPlayer(UUID)
取代, 因为玩家名不再一定是唯一的.原文: Gets the player with the exact given name, case insensitive.
name
- 用于检索的精确玩家名称, 不区分大小写@Deprecated public static java.util.List<Player> matchPlayer(java.lang.String name)
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
- 需要匹配的(部分)名称public static Player getPlayer(java.util.UUID id)
UUID
获取玩家.
原文: Gets the player with the given UUID.
id
- 要获取的玩家的UUID
public static PluginManager getPluginManager()
原文: Gets the plugin manager for interfacing with plugins.
public static BukkitScheduler getScheduler()
原文: Gets the scheduler for managing scheduled events.
public static ServicesManager getServicesManager()
原文: Gets a services manager.
public static java.util.List<World> getWorlds()
原文: Gets a list of all worlds on this server.
public static World createWorld(WorldCreator creator)
如果这个世界已经被加载了, 那么就会返回等同于调用
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
- 加载或者创建这个世界的时候要用的世界生成器public static boolean unloadWorld(java.lang.String name, boolean save)
原文: Unloads a world with the given name.
name
- 要卸载的世界的名字save
- 卸载时是否要保存数据public static boolean unloadWorld(World world, boolean save)
原文: Unloads a world with the given name.
world
- 要卸载的世界save
- 卸载时是否要保存数据public static World getWorld(java.lang.String name)
原文: Gets the world with the given name.
name
- 世界名称public static World getWorld(java.util.UUID uid)
原文: Gets the world from the given Unique ID.
uid
- 要查找的世界的唯一ID@Deprecated public static MapView getMap(short id)
原文: Gets the map from the given item ID.
id
- 要获取的地图的IDMapView
, 否则返回nullpublic static MapView createMap(World world)
原文: Create a new map with an automatically assigned ID.
world
- 地图所属的世界MapView
public static void reload()
原文: Reloads the server, refreshing settings and plugin information.
public static void reloadData()
原文:Reload only the Minecraft data for the server. This includes custom advancements and loot tables.
public static java.util.logging.Logger getLogger()
Logger
.
原文: Returns the primary logger associated with this server instance.
Logger
public static PluginCommand getPluginCommand(java.lang.String name)
PluginCommand
.
原文: Gets a PluginCommand
with the given name or alias.
name
- 命令名或命令别名public static void savePlayers()
原文:Writes loaded players to disk.
public static boolean dispatchCommand(CommandSender sender, java.lang.String commandLine) throws CommandException
sender
- the apparent sender of the commandcommandLine
- the command + arguments. Example: test abc
123
CommandException
- thrown when the executor for the given command
fails with an unhandled exceptionpublic static boolean addRecipe(Recipe recipe)
原文:Adds a recipe to the crafting manager.
recipe
- 要添加的合成配方public static java.util.List<Recipe> getRecipesFor(ItemStack result)
result
- the item to match against recipe resultspublic static java.util.Iterator<Recipe> recipeIterator()
原文:Get an iterator through the list of crafting recipes.
public static void clearRecipes()
原文:Clears the list of crafting recipes.
public static void resetRecipes()
原文:Resets the list of crafting recipes to the default.
public static java.util.Map<java.lang.String,java.lang.String[]> getCommandAliases()
原文:Gets a list of command aliases defined in the server properties.
public static int getSpawnRadius()
原文:Gets the radius, in blocks, around each worlds spawn point to protect.
public static void setSpawnRadius(int value)
原文:Sets the radius, in blocks, around each worlds spawn point to protect.
value
- 新的出生地保护的范围,0设为没有保护public static boolean getOnlineMode()
原文:Gets whether the Server is in online mode or not.
public static boolean getAllowFlight()
原文:Gets whether this server allows flying or not.
public static boolean isHardcore()
原文:Gets whether the server is in hardcore mode or not.
public static void shutdown()
原文:Shutdowns the server, stopping everything.
public static int broadcast(java.lang.String message, java.lang.String permission)
message
- message to broadcastpermission
- the required permission permissibles
must have to receive the broadcast@Deprecated public static OfflinePlayer getOfflinePlayer(java.lang.String name)
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 retrievegetOfflinePlayer(java.util.UUID)
public static OfflinePlayer getOfflinePlayer(java.util.UUID id)
本方法都将返回一个对象,甚至此玩家并不存在.对于此方法来说,任何玩家都存在.
原文: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
- 要检索的玩家UUIDpublic static java.util.Set<java.lang.String> getIPBans()
原文:Gets a set containing all current IPs that are banned.
public static void banIP(java.lang.String address)
原文:Bans the specified address from the server.
address
- 要封禁的IP地址public static void unbanIP(java.lang.String address)
原文:Unbans the specified address from the server.
address
- 要解禁的IP地址public static java.util.Set<OfflinePlayer> getBannedPlayers()
原文:Gets a set containing all banned players.
public static BanList getBanList(BanList.Type type)
以玩家名封禁已不再支持,尝试请求获取将返回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
- 要获取的封禁列表的类型,不能为nullpublic static java.util.Set<OfflinePlayer> getOperators()
原文:Gets a set containing all player operators.
public static GameMode getDefaultGameMode()
public static void setDefaultGameMode(GameMode mode)
原文:Sets the default GameMode
for new players.
mode
- 新的默认游戏模式public static ConsoleCommandSender getConsoleSender()
ConsoleCommandSender
that may be used as an input source
for this server.public static java.io.File getWorldContainer()
World
s.public static OfflinePlayer[] getOfflinePlayers()
原文:Gets every player that has ever played on this server.
public static Messenger getMessenger()
Messenger
responsible for this server.public static HelpMap getHelpMap()
HelpMap
providing help topics for this server.public static Inventory createInventory(InventoryHolder owner, InventoryType type)
InventoryType.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 createpublic static Inventory createInventory(InventoryHolder owner, InventoryType type, java.lang.String title)
InventoryType.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; 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.public static Inventory createInventory(InventoryHolder owner, int size) throws java.lang.IllegalArgumentException
InventoryType.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 createjava.lang.IllegalArgumentException
- if the size is not a multiple of 9public static Inventory createInventory(InventoryHolder owner, int size, java.lang.String title) throws java.lang.IllegalArgumentException
InventoryType.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
viewedjava.lang.IllegalArgumentException
- if the size is not a multiple of 9public static Merchant createMerchant(java.lang.String title)
title
- the title of the corresponding merchant inventory, displayed
when the merchant inventory is viewedpublic static int getMonsterSpawnLimit()
public static int getAnimalSpawnLimit()
原文: Gets user-specified limit for number of animals that can spawn in a chunk.
public static int getWaterAnimalSpawnLimit()
public static int getAmbientSpawnLimit()
public static boolean isPrimaryThread()
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.
public static java.lang.String getMotd()
原文:Gets the message that is displayed on the server list.
public static java.lang.String getShutdownMessage()
原文:Gets the default message that is displayed when the server is stopped.
public static Warning.WarningState getWarningState()
public static ItemFactory getItemFactory()
ItemMeta
).ItemFactory
public static ScoreboardManager getScoreboardManager()
This will only exist after the first world has loaded.
public static CachedServerIcon getServerIcon()
public static CachedServerIcon loadServerIcon(java.io.File file) throws java.lang.IllegalArgumentException, java.lang.Exception
Size and type are implementation defined. An incompatible file is
guaranteed to throw an implementation-defined Exception
.
file
- the file to load the fromServerListPingEvent.setServerIcon(CachedServerIcon)
java.lang.IllegalArgumentException
- if image is nulljava.lang.Exception
- if the image does not meet current server server-icon
specificationspublic static CachedServerIcon loadServerIcon(java.awt.image.BufferedImage image) throws java.lang.IllegalArgumentException, java.lang.Exception
Size and type are implementation defined. An incompatible file is
guaranteed to throw an implementation-defined Exception
.
image
- the image to useServerListPingEvent.setServerIcon(CachedServerIcon)
java.lang.IllegalArgumentException
- if image is nulljava.lang.Exception
- if the image does not meet current server
server-icon specificationspublic static void setIdleTimeout(int threshold)
原文: 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
- 玩家空闲时间阈值,以分钟为单位public static int getIdleTimeout()
原文: Gets the idle kick timeout.
public static ChunkGenerator.ChunkData createChunkData(World world)
原文:
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对应的世界public static BossBar createBossBar(java.lang.String title, BarColor color, BarStyle style, BarFlag... flags)
原文: Creates a boss bar instance to display to players. The progress defaults to 1.0
title
- 血量条的标题color
- 血量条的颜色style
- 血量条的样式flags
- 血量条的附加属性列表(可选)public static Entity getEntity(java.util.UUID uuid)
原文:Gets an entity on the server by its UUID
uuid
- 实体的UUIDpublic static Advancement getAdvancement(NamespacedKey key)
原文: Get the advancement specified by this key.
寻找进度对象所需的key
- public static java.util.Iterator<Advancement> advancementIterator()
原文: Get an iterator through all advancements. Advancements cannot be removed from this iterator,
@Deprecated public static UnsafeValues getUnsafe()
UnsafeValues