程序包 org.bukkit

接口 Server

所有超级接口:
PluginMessageRecipient

public interface Server extends PluginMessageRecipient
代表执行插件的服务器.
  • 字段详细资料

  • 方法详细资料

    • getName

      获取这个 Server 实例的名字.

      原文:Gets the name of this server implementation.

      返回:
      这个服务器实例的名字
    • getVersion

      @NotNull @NotNull String getVersion()
      获取这个 Server 实例的版本.

      原文:Gets the version string of this server implementation.

      返回:
      这个服务器实例的版本
    • getBukkitVersion

      @NotNull @NotNull String getBukkitVersion()
      获得服务器运行的Bukkit版本.

      原文:Gets the Bukkit version that this server is running.

      返回:
      Bukkit版本
    • getOnlinePlayers

      @NotNull @NotNull 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.

      返回:
      所有在线玩家的视图
    • getMaxPlayers

      int getMaxPlayers()
      获取服务器允许进入的最大玩家数.

      原文:Get the maximum amount of players which can login to this server.

      返回:
      服务器的最大玩家数
    • setMaxPlayers

      void setMaxPlayers(int maxPlayers)
      设置服务器允许进入的最大玩家数.

      原文:Set the maximum amount of players allowed to be logged in at once.

      参数:
      maxPlayers - 服务器的最大玩家数
    • getPort

      int getPort()
      获取服务器监听的端口号.

      原文:Get the game port that the server runs on.

      返回:
      服务器端口
    • getViewDistance

      int getViewDistance()
      获取服务器的视距.

      原文:Get the view distance from this server.

      返回:
      服务器当前设置的视距
    • getSimulationDistance

      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

      @NotNull @NotNull String getWorldType()
      获取默认世界的世界类型 (level-type 设置).

      原文:Get world type (level-type setting) for default world.

      返回:
      默认世界的世界类型 (例: DEFAULT, FLAT, DEFAULT_1_1)
    • getGenerateStructures

      boolean getGenerateStructures()
      获取此服务器是否自然生成结构.

      原文:Get generate-structures setting.

      返回:
      true表示服务器可自然生成结构, false反之
    • getMaxWorldSize

      int getMaxWorldSize()
      获取最大世界大小.

      原文:Get max world size.

      返回:
      为服务器指定的最大世界大小
    • getAllowEnd

      boolean getAllowEnd()
      获取此服务器是否开启了末路之地.

      原文:Gets whether this server allows the End or not.

      返回:
      是否可以进入末路之地
    • getAllowNether

      boolean getAllowNether()
      获取此服务器是否开启了下界.

      原文:Gets whether this server allows the Nether or not.

      返回:
      是否可以进入下界
    • isLoggingIPs

      boolean isLoggingIPs()
      Gets whether the server is logging the IP addresses of players.
      返回:
      whether the server is logging the IP addresses of players
    • getInitialEnabledPacks

      @NotNull @NotNull List<String> getInitialEnabledPacks()
      Gets a list of packs to be enabled.
      返回:
      a list of packs names
    • getInitialDisabledPacks

      @NotNull @NotNull List<String> getInitialDisabledPacks()
      Gets a list of packs that will not be enabled automatically.
      返回:
      a list of packs names
    • getDataPackManager

      @NotNull @NotNull DataPackManager getDataPackManager()
      Get the DataPack Manager.
      返回:
      the manager
    • getServerTickManager

      @NotNull @NotNull ServerTickManager getServerTickManager()
      Get the ServerTick Manager.
      返回:
      the manager
    • getServerResourcePack

      @Nullable @Nullable ResourcePack getServerResourcePack()
      Gets the resource pack configured to be sent to clients by the server.
      返回:
      the resource pack
    • getResourcePack

      @NotNull @NotNull String getResourcePack()
      Gets the server resource pack uri, or empty string if not specified.
      返回:
      the server resource pack uri, otherwise empty string
    • getResourcePackHash

      @NotNull @NotNull 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

      @NotNull @NotNull 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

      boolean isResourcePackRequired()
      Gets whether the server resource pack is enforced.
      返回:
      whether the server resource pack is enforced
    • hasWhitelist

      boolean hasWhitelist()
      获取此服务器是否开启了白名单.

      原文: Gets whether this server has a whitelist or not.

      返回:
      是否开启了白名单
    • setWhitelist

      void setWhitelist(boolean value)
      设置此服务器是否开启白名单.

      原文:Sets if the server is whitelisted.

      参数:
      value - true为开, false为关
    • isWhitelistEnforced

      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

      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

      @NotNull @NotNull Set<OfflinePlayer> getWhitelistedPlayers()
      获取所有已被添加到白名单的玩家.

      原文:Gets a list of whitelisted players.

      返回:
      用Set存储的所有被添加到白名单的玩家
    • reloadWhitelist

      void reloadWhitelist()
      从硬盘重载白名单列表.

      原文:Reloads the whitelist from disk.

    • broadcastMessage

      int broadcastMessage(@NotNull @NotNull String message)
      广播一条消息到所有在线玩家.

      这与调用 broadcast(java.lang.String, java.lang.String) 并将第二个参数设为 BROADCAST_CHANNEL_USERS 等效.

      原文:Broadcast a message to all players.

      This is the same as calling broadcast(java.lang.String, java.lang.String) to BROADCAST_CHANNEL_USERS

      参数:
      message - 要广播的消息
      返回:
      成功接收此消息的玩家数
    • getUpdateFolder

      @NotNull @NotNull String getUpdateFolder()
      获取更新文件夹的名字. 系统将会在插件加载时选择适当的时机利用此文件夹来安全地更新插件.

      更新文件夹的位置相对于插件文件夹(译注:一般指服务端plugins文件夹下的update文件夹).

      Tips:如何使用更新文件夹来实现更新您的插件呢? (服主和开发者都可以了解下):

      1. 创建更新文件夹,已有则跳过此步.
      2. 下载您要更新的插件到此目录(plugins/update) (注意:jar文件名必须和在插件目录下的jar文件名一样,否则不起作用).
      3. 重载/重启服务器.
      4. 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

      @NotNull @NotNull File 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

      long getConnectionThrottle()
      获取服务器的最小连接间隔设定.

      译注:单位为毫秒.

      原文:Gets the value of the connection throttle setting.

      返回:
      服务器的最小连接间隔数设定
    • getTicksPerAnimalSpawns

      @Deprecated int getTicksPerAnimalSpawns()
      已过时。
      获取每隔多少tick应该生成一次动物. 例如:
      • 此值为 1 表示服务器会在每个tick尝试生成动物.
      • 此值为 400 表示服务器会每隔400tick尝试生成动物.
      • 此值小于 0 表示会使用Minecraft的默认设置.
      注意: 如果设为 0, 动物生成会被禁用. 我们推荐使用 spawn-animals 选项来代替将其设为0.

      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

      @Deprecated int getTicksPerMonsterSpawns()
      已过时。
      获取每隔多少tick应该生成一次怪物. 例如:
      • 此值为 1 表示服务器会在每个tick尝试生成怪物.
      • 此值为 400 表示服务器会每隔400tick尝试生成怪物.
      • 此值小于 0 表示会使用Minecraft的默认设置.
      注意: 如果设为 0, 怪物生成会被禁用. 我们推荐使用 spawn-monsters 选项来代替将其设为0.

      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

      @Deprecated int 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应该生成一次怪物
    • getTicksPerWaterAmbientSpawns

      @Deprecated int 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

      @Deprecated int 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
    • getTicksPerAmbientSpawns

      @Deprecated int 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应该生成一次环境生物
    • getTicksPerSpawns

      int getTicksPerSpawns(@NotNull @NotNull SpawnCategory spawnCategory)
      Gets the default ticks per SpawnCategory 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: the SpawnCategory.MISC are not consider.

      参数:
      spawnCategory - the category of spawn
      返回:
      the default ticks per SpawnCategory mobs spawn value
    • 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 and matchPlayer(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

      @NotNull @NotNull PluginManager getPluginManager()
      获取插件管理器以与其他插件进行交互.

      原文:Gets the plugin manager for interfacing with plugins.

      返回:
      此服务器的插件管理器
    • getScheduler

      获取用于管理调度任务的调度器.

      原文: Gets the scheduler for managing scheduled events.

      返回:
      此服务器的调度器服务
    • getServicesManager

      @NotNull @NotNull ServicesManager getServicesManager()
      获取服务管理器.

      原文:Gets a services manager.

      返回:
      服务管理器
    • getWorlds

      @NotNull @NotNull List<World> 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

      boolean unloadWorld(@NotNull @NotNull String name, boolean save)
      卸载给定名称对应的世界.

      原文: Unloads a world with the given name.

      参数:
      name - 要卸载的世界的名字
      save - 是否在卸载世界前保存区块数据
      返回:
      如果成功返回true, 否则返回false
    • unloadWorld

      boolean unloadWorld(@NotNull @NotNull World world, boolean save)
      卸载指定的世界.

      原文: 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

      @NotNull @NotNull WorldBorder createWorldBorder()
      Create a new virtual WorldBorder.

      Note that world borders created by the server will not respect any world scaling effects (i.e. coordinates are not divided by 8 in the nether).

      返回:
      the created world border instance
      另请参阅:
    • 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

      Create a new explorer map targeting the closest nearby structure of a given StructureType.
      This method uses implementation default values for radius and findUnexplored (usually 100, true).
      参数:
      world - the world the map will belong to
      location - the origin location to find the nearest structure
      structureType - the type of structure to find
      返回:
      a newly created item stack
      另请参阅:
    • createExplorerMap

      @NotNull @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 given StructureType.
      This method uses implementation default values for radius and findUnexplored (usually 100, true).
      参数:
      world - the world the map will belong to
      location - the origin location to find the nearest structure
      structureType - the type of structure to find
      radius - radius to search, see World#locateNearestStructure for more information
      findUnexplored - whether to find unexplored structures
      返回:
      the newly created item stack
      另请参阅:
    • reload

      void reload()
      重新加载服务器并刷新设置和插件信息.

      原文:Reloads the server, refreshing settings and plugin information.

    • reloadData

      void reloadData()
      只重载Minecraft游戏数据. 这包括自定义的进度和掉落表.

      原文:Reload only the Minecraft data for the server. This includes custom advancements and loot tables.

    • getLogger

      @NotNull @NotNull Logger 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

      void savePlayers()
      保存已加载的玩家信息.

      原文:Writes loaded players to disk.

    • dispatchCommand

      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

      @Contract("null -> false") boolean addRecipe(@Nullable @Nullable Recipe recipe)
      向合成管理器添加一个合成配方.

      原文: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

      根据指定的 key 获取配方.

      原文:Get the Recipe for the given key.

      参数:
      recipeKey - 配方的 key
      返回:
      给定 key 对应的配方, 若未找到返回 null
    • getCraftingRecipe

      @Nullable @Nullable Recipe getCraftingRecipe(@NotNull @NotNull ItemStack[] craftingMatrix, @NotNull @NotNull World world)
      Get the Recipe 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.
    • craftItem

      Get the crafted item using the list of ItemStack 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 and Player arguments are required to fulfill the Bukkit Crafting events.

      Calls PrepareItemCraftEvent to imitate the Player 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 of Material.AIR is returned.
    • craftItem

      Get the crafted item using the list of ItemStack 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 of Material.AIR is returned.
    • craftItemResult

      Get the crafted item using the list of ItemStack 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 and Player arguments are required to fulfill the Bukkit Crafting events.

      Calls PrepareItemCraftEvent to imitate the Player 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 @NotNull ItemCraftResult craftItemResult(@NotNull @NotNull ItemStack[] craftingMatrix, @NotNull @NotNull World world)
      Get the crafted item using the list of ItemStack 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.
    • recipeIterator

      @NotNull @NotNull Iterator<Recipe> recipeIterator()
      获取合成配方列表迭代器.

      原文:Get an iterator through the list of crafting recipes.

      返回:
      迭代器
    • clearRecipes

      void clearRecipes()
      清理所有已添加的合成配方.

      原文:Clears the list of crafting recipes.

    • resetRecipes

      void resetRecipes()
      重置自定义合成配方列表至默认状态.

      原文:Resets the list of crafting recipes to the default.

    • removeRecipe

      boolean removeRecipe(@NotNull @NotNull NamespacedKey key)
      从服务器移除指定的合成配方. 注意:移除一个合成配方可能导致与此配方有关的数据的永久丢失 (例如配方是否已被玩家发现).

      原文: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

      @NotNull @NotNull Map<String,String[]> getCommandAliases()
      获取服务器配置定义的命令别名列表.

      原文:Gets a list of command aliases defined in the server properties.

      返回:
      命令别名map
    • getSpawnRadius

      int getSpawnRadius()
      获取出生地保护的半径范围(以方块为单位).

      原文:Gets the radius, in blocks, around each worlds spawn point to protect.

      返回:
      出生地保护范围,0为没有保护
    • setSpawnRadius

      void setSpawnRadius(int value)
      设置出生地保护的半径范围.

      原文:Sets the radius, in blocks, around each worlds spawn point to protect.

      参数:
      value - 新的出生地保护的范围,0设为没有保护
    • shouldSendChatPreviews

      @Deprecated boolean shouldSendChatPreviews()
      已过时。
      chat previews have been removed
      Gets whether the server should send a preview of the player's chat message to the client when the player types a message
      返回:
      true if the server should send a preview, false otherwise
    • isEnforcingSecureProfiles

      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

      boolean isAcceptingTransfers()
      Gets whether this server is allowing connections transferred from other servers.
      返回:
      true if the server accepts transfers, false otherwise
    • getHideOnlinePlayers

      boolean getHideOnlinePlayers()
      Gets whether the Server hide online players in server status.
      返回:
      true if the server hide online players, false otherwise
    • getOnlineMode

      boolean getOnlineMode()
      获取服务器是否开启了正版模式.

      原文:Gets whether the Server is in online mode or not.

      返回:
      true则开启/false反之
    • getAllowFlight

      boolean getAllowFlight()
      获取服务器是否允许飞行.

      原文:Gets whether this server allows flying or not.

      返回:
      服务器是否允许飞行
    • isHardcore

      boolean isHardcore()
      获取服务器是否处于极限生存模式.

      原文:Gets whether the server is in hardcore mode or not.

      返回:
      服务器是否处于极限生存模式
    • shutdown

      void shutdown()
      关闭服务器, 停止一切在运行的东西.

      原文:Shutdowns the server, stopping everything.

    • broadcast

      int broadcast(@NotNull @NotNull String message, @NotNull @NotNull String permission)
      向有给定权限的用户广播一条消息.

      原文:Broadcasts the specified message to every user with the given permission name.

      参数:
      message - 要广播的消息
      permission - 接受这条公告需要拥有的权限许可
      返回:
      成功接收此消息的玩家数
    • getOfflinePlayer

      已过时。
      由于玩家名在某个会话后(某次游戏后)不再唯一, 应使用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

      创建一份新的玩家资料.

      原文:Creates a new PlayerProfile.

      参数:
      uniqueId - 唯一 id
      name - 玩家名
      返回:
      新 PlayerProfile
      抛出:
      IllegalArgumentException - 如果唯一 id 和玩家名均为 null 或玩家名为空白字符串
    • createPlayerProfile

      @NotNull @NotNull PlayerProfile createPlayerProfile(@NotNull @NotNull UUID uniqueId)
      创建一份新的玩家资料.

      原文:Creates a new PlayerProfile.

      参数:
      uniqueId - 唯一 id
      返回:
      新 PlayerProfile
      抛出:
      IllegalArgumentException - 如果唯一 id 为 null
    • createPlayerProfile

      创建一份新的玩家资料.

      原文:Creates a new PlayerProfile.

      参数:
      name - 玩家名
      返回:
      新 PlayerProfile
      抛出:
      IllegalArgumentException - 如果玩家名为 null 或空白字符串
    • getIPBans

      @NotNull @NotNull Set<String> getIPBans()
      获取所有已被封禁的IP地址.

      原文:Gets a set containing all current IPs that are banned.

      返回:
      被封禁IP集合
    • banIP

      @Deprecated void banIP(@NotNull @NotNull String address)
      已过时。
      封禁指定的IP地址.

      原文:Bans the specified address from the server.

      参数:
      address - 要封禁的IP地址
    • unbanIP

      @Deprecated void unbanIP(@NotNull @NotNull String address)
      已过时。
      解禁指定的IP地址.

      原文:Unbans the specified address from the server.

      参数:
      address - 要解禁的IP地址
    • banIP

      void banIP(@NotNull @NotNull InetAddress address)
      封禁指定的IP地址.

      原文:Bans the specified address from the server.

      参数:
      address - 要封禁的IP地址
    • unbanIP

      void unbanIP(@NotNull @NotNull InetAddress address)
      解禁指定的IP地址.

      原文:Unbans the specified address from the server.

      参数:
      address - 要解禁的IP地址
    • getBannedPlayers

      @NotNull @NotNull Set<OfflinePlayer> getBannedPlayers()
      获取所有已被封禁的玩家.

      原文:Gets a set containing all banned players.

      返回:
      已被封禁的玩家
    • getBanList

      @NotNull <T extends BanList<?>> T getBanList(@NotNull BanList.Type type)
      获取指定类型的封禁列表.

      原文:Gets a ban list for the supplied type.

      类型参数:
      T - 封禁目标
      参数:
      type - 要获取的封禁列表的类型, 不能为null
      返回:
      指定类型的封禁列表
    • getOperators

      获取服务器的所有OP(管理员).

      原文:Gets a set containing all player operators.

      返回:
      服务器OP
    • getDefaultGameMode

      @NotNull @NotNull GameMode getDefaultGameMode()
      获取新玩家的默认游戏模式.

      原文:Gets the default GameMode for new players.

      返回:
      默认游戏模式
    • setDefaultGameMode

      void setDefaultGameMode(@NotNull @NotNull GameMode mode)
      设置新玩家的默认 GameMode.

      原文:Sets the default GameMode for new players.

      参数:
      mode - 新的游戏模式
    • getConsoleSender

      获取服务器的ConsoleCommandSender, 将被作为服务器的标准输入.

      译注:该方法用于获取控制台.

      原文:Gets a ConsoleCommandSender that may be used as an input source for this server.

      返回:
      控制台命令发送者对象
    • getWorldContainer

      @NotNull @NotNull File getWorldContainer()
      获取包含所有世界数据的文件夹.

      译注:通常此文件夹就是服务端根目录.

      原文:Gets the folder that contains all of the various Worlds.

      返回:
      包含所有世界数据的文件夹
    • getOfflinePlayers

      @NotNull @NotNull OfflinePlayer[] getOfflinePlayers()
      获取所有登陆过服务器的玩家.

      原文:Gets every player that has ever played on this server.

      返回:
      包含所有登录过的玩家的数组
    • getMessenger

      @NotNull @NotNull Messenger getMessenger()
      获取服务器上管理plugin channel(插件通道)通信的Messenger实例.

      原文:Gets the Messenger responsible for this server.

      返回:
      Messenger实例
    • getHelpMap

      @NotNull @NotNull HelpMap getHelpMap()
      获取服务器上提供所有帮助主题的HelpMap实例.

      原文:Gets the HelpMap providing help topics for this server.

      返回:
      HelpMap实例
    • createInventory

      以指定类型创建一个空物品栏. 如果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. Use HumanEntity.openWorkbench(Location, boolean) instead.
      InventoryType.ENCHANTING will not process ItemStacks for possible enchanting results. Use HumanEntity.openEnchanting(Location, boolean) instead.

      参数:
      owner - 物品栏的持有者, 不指定持有者为null
      type - 要创建的物品栏的种类
      返回:
      新的物品栏
      抛出:
      IllegalArgumentException - 如果这种 InventoryType 物品栏不能显示给玩家
      另请参阅:
    • createInventory

      以指定类型和标题创建一个空物品栏. 如果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. Use HumanEntity.openWorkbench(Location, boolean) instead.
      InventoryType.ENCHANTING will not process ItemStacks for possible enchanting results. Use HumanEntity.openEnchanting(Location, boolean) instead.

      参数:
      owner - 物品栏的持有者, 如果没有持有者可为null
      type - 要创建的物品栏的种类
      title - 物品栏的标题, 会显示给玩家
      返回:
      新的物品栏
      抛出:
      IllegalArgumentException - 如果这种 InventoryType 物品栏不能显示给玩家
      另请参阅:
    • createInventory

      创建一个类型为InventoryType.CHEST, 有指定大小的空物品栏.

      原文:Creates an empty inventory of type InventoryType.CHEST with the specified size.

      参数:
      owner - 物品栏的持有者, 不指定持有者为null
      size - 物品栏的大小, 必须为9的倍数
      返回:
      新的物品栏
      抛出:
      IllegalArgumentException - 如果大小不是9的倍数
    • createInventory

      创建一个类型为InventoryType.CHEST, 有指定大小和标题的空物品栏.

      原文:Creates an empty inventory of type InventoryType.CHEST with the specified size and title.

      参数:
      owner - 物品栏的持有者, 不指定持有者为null
      size - 物品栏的大小, 必须为9的倍数
      title - 物品栏的标题, 会显示给玩家
      返回:
      新的物品栏
      抛出:
      IllegalArgumentException - 如果大小不是9的倍数
    • createMerchant

      创建一个空的商人.

      原文:Creates an empty merchant.

      参数:
      title - 查看商人物品栏时显示的标题
      返回:
      新的商人
    • getMaxChainedNeighborUpdates

      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

      @Deprecated int getMonsterSpawnLimit()
      已过时。
      获取一个区块最大可生成怪物数量.

      原文:Gets user-specified limit for number of monsters that can spawn in a chunk.

      返回:
      生成限制数
    • getAnimalSpawnLimit

      @Deprecated int getAnimalSpawnLimit()
      已过时。
      获取一个区块最大可生成的动物数量.

      原文: Gets user-specified limit for number of animals that can spawn in a chunk.

      返回:
      生成限制数
    • getWaterAnimalSpawnLimit

      @Deprecated int getWaterAnimalSpawnLimit()
      已过时。
      获取一个区块最大可生成的水生动物数量.

      原文:Gets user-specified limit for number of water animals that can spawn in a chunk.

      返回:
      生成限制数
    • getWaterAmbientSpawnLimit

      @Deprecated int getWaterAmbientSpawnLimit()
      已过时。
      获取一个区块最大可生成的水生环境数量.

      原文:Gets user-specified limit for number of water ambient mobs that can spawn in a chunk.

      返回:
      生成限制数
    • getWaterUndergroundCreatureSpawnLimit

      @Deprecated int getWaterUndergroundCreatureSpawnLimit()
      已过时。
      Get user-specified limit for number of water creature underground that can spawn in a chunk.
      返回:
      the water underground creature limit
    • getAmbientSpawnLimit

      @Deprecated int getAmbientSpawnLimit()
      已过时。
      获取一个区块最大可生成的环境生物(一般指蝙蝠)数量.

      原文:Gets user-specified limit for number of ambient mobs that can spawn in a chunk.

      返回:
      生成限制数
    • getSpawnLimit

      int getSpawnLimit(@NotNull @NotNull SpawnCategory spawnCategory)
      Gets user-specified limit for number of SpawnCategory mobs that can spawn in a chunk. Note: the SpawnCategory.MISC are not consider.
      参数:
      spawnCategory - the category spawn
      返回:
      the SpawnCategory spawn limit
    • isPrimaryThread

      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

      void setMotd(@NotNull @NotNull String motd)
      设置在客户端服务器列表里显示的消息.

      原文: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

      @Nullable @Nullable String getShutdownMessage()
      获取服务器关闭时广播给玩家的默认提示消息.

      原文:Gets the default message that is displayed when the server is stopped.

      返回:
      关服消息
    • getWarningState

      获取服务器的警告状态.

      原文:Gets the current warning state for the server.

      返回:
      预先配置的警告状态
    • getItemFactory

      @NotNull @NotNull ItemFactory getItemFactory()
      获取ItemFactory实例 (用于ItemMeta).

      原文:Gets the instance of the item factory (for ItemMeta).

      返回:
      ItemFactory实例
      另请参阅:
    • getEntityFactory

      @NotNull @NotNull EntityFactory getEntityFactory()
      Gets the instance of the entity factory (for EntitySnapshot).
      返回:
      the entity factory
      另请参阅:
    • getScoreboardManager

      @Nullable @Nullable ScoreboardManager getScoreboardManager()
      获取计分板管理器实例.

      只在第一个世界加载后存在.

      原文:Gets the instance of the scoreboard manager.

      This will only exist after the first world has loaded.

      返回:
      计分板管理器实例, 如果未加载任何世界则为null
    • getScoreboardCriteria

      @NotNull @NotNull Criteria getScoreboardCriteria(@NotNull @NotNull String name)
      Get (or create) a new Criteria by its name.
      参数:
      name - the criteria name
      返回:
      the criteria
      另请参阅:
    • getServerIcon

      获取服务器默认图标.

      原文:Gets an instance of the server's default server-icon.

      返回:
      服务器默认图标,当未定义服务器图标时将返回null(该行为无法担保)
    • loadServerIcon

      为指定文件创建一个缓存的服务器图标.

      大小和类型必须在允许范围内(由底层实现定义),否则将会抛出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 - 如果图片为null
      Exception - 如果图片规格不适合作为服务器图标
    • loadServerIcon

      为指定图片创建一个缓存的服务器图标.

      大小和类型必须在允许范围内(由底层实现定义),否则将会抛出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为null
      Exception - 如果图片规格不适合作为服务器图标
    • setIdleTimeout

      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

      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

      创建一个Boss血量条实例. 血量条的进度默认为1.0.

      原文: Creates a boss bar instance to display to players. The progress defaults to 1.0

      参数:
      title - 血量条的标题
      color - 血量条的颜色
      style - 血量条的样式
      flags - 血量条的附加属性列表(可选)
      返回:
      创建的Boss血量条实例
    • createBossBar

      创建一个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血量条的迭代器. 例如:使用bossbar命令创建的boss血量条 (它是持久存储的, 可由此迭代器访问).

      原文:Gets an unmodifiable iterator through all persistent bossbars.

      e.g. bossbars created using the bossbar command
      返回:
      bossbar迭代器
    • getBossBar

      Gets the KeyedBossBar specified by this key. e.g. bossbars created using the bossbar command
      参数:
      key - unique bossbar key
      返回:
      bossbar or null if not exists
    • removeBossBar

      boolean removeBossBar(@NotNull @NotNull NamespacedKey key)
      Removes a KeyedBossBar specified by this key. e.g. bossbars created using the bossbar command
      参数:
      key - unique bossbar key
      返回:
      true if removal succeeded or false
    • 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

      @NotNull @NotNull Iterator<Advancement> advancementIterator()
      获取一个用以遍历所有进度的迭代器对象。 进度不能够从该迭代器上删除。

      原文: Get an iterator through all advancements. Advancements cannot be removed from this iterator,

      返回:
      一个进度迭代器对象
    • createBlockData

      @NotNull @NotNull BlockData createBlockData(@NotNull @NotNull Material material)
      Creates a new BlockData instance for the specified Material, with all properties initialized to unspecified defaults.
      参数:
      material - the material
      返回:
      new data instance
    • createBlockData

      @NotNull @NotNull BlockData createBlockData(@NotNull @NotNull Material material, @Nullable @Nullable Consumer<? super BlockData> consumer)
      Creates a new BlockData instance for the specified Material, with all properties initialized to unspecified defaults.
      参数:
      material - the material
      consumer - consumer to run on new instance before returning
      返回:
      new data instance
    • createBlockData

      Creates a new BlockData 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") @NotNull BlockData createBlockData(@Nullable @Nullable Material material, @Nullable @Nullable String data) throws IllegalArgumentException
      Creates a new BlockData instance for the specified Material, with all properties initialized to unspecified defaults, except for those provided in data.
      If material is specified, then the data string must not also contain the material.
      参数:
      material - the material
      data - data string
      返回:
      new data instance
      抛出:
      IllegalArgumentException - if the specified data is not valid
    • getTag

      Gets a tag which has already been defined within the server. Plugins are suggested to use the concrete tags in Tag 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 in Tag.
      类型参数:
      T - type of the tag
      参数:
      registry - the tag registry to look at
      tag - the name of the tag
      clazz - the class of the tag entries
      返回:
      the tag or null
    • getTags

      @NotNull <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 in Tag.
      对返回的迭代器的可变性不作保证. 原文:Gets a all tags which have been defined within the server.
      Server implementations are allowed to handle only the registries indicated in Tag.
      No guarantees are made about the mutability of the returned iterator.
      类型参数:
      T - tag的类型
      参数:
      registry - the tag registry to look at
      clazz - the class of the tag entries
      返回:
      all defined tags
    • getLootTable

      获取指定的 战利品表.

      原文:Gets the specified LootTable.

      参数:
      key - LootTable的名称
      返回:
      LootTable实例, 若找不到返回null
    • selectEntities

      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 provided
      selector - 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

      @NotNull @NotNull StructureManager getStructureManager()
      Gets the structure manager for loading and saving structures.
      返回:
      the structure manager
    • getRegistry

      @Nullable <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 in Registry 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