Inventory.yml 教程

在此文件中你可以完全地修改插件的各类菜单,它们是:main, options, whitelistammunition

菜单属性(Inventories properties)

每一个菜单都有如下所示的三种属性

Inventories:
  main:
    slots: 27
    title: "&9炮塔菜单"
    0:
      item: BLACK_STAINED_GLASS_PANE
      name: " "

Slots

这是菜单要拥有的格数,你只能设置为9,18,27,16,45,54中的一个

Title

此菜单的名称

Item Slot

一个物品在菜单中的位置,有一些更简单的方法来放置物品,就是使用格式:

格式1

此示例会在第0格(所谓的第"1"格)放一个物品(黑色玻璃板)

0:
  item: BLACK_STAINED_GLASS_PANE
  name: " "

格式2

此示例则是在第0、8、16格放置

0;8;16:
  item: BLACK_STAINED_GLASS_PANE
  name: " "

格式3

此示例是在第0-8格放置

0-8:
  item: BLACK_STAINED_GLASS_PANE
  name: " "

混合格式

此示例是在0-7,第9,和17-26格放置

0-7;9;17-26:
  item: BLACK_STAINED_GLASS_PANE
  name: " "

物品属性(Item Properties)

你可以创建你自己的物品或是使用config.yml里的,在那个文件里提前创建好的物品会被用在特定的情况下。比如,在config.yml里,attack_animals_item 会根据炮塔的Attack Animals选项来改变

物品 ID

物品名或材料

最新版的物品ID:https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Material.html

1.8的:

如果你想使用有自定义材质的玩家头颅,你只需设置base64的材质数据值(如下)

0:
  id: "CHEST"
1:
  id: eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNmNlZjlhYTE0ZTg4NDc3M2VhYzEzNGE0ZWU4OTcyMDYzZjQ2NmRlNjc4MzYzY2Y3YjFhMjFhODViNyJ9fX0=

Name 和 lore

物品的显示名和描述

8:
  id: "CHEST"
  name: "&a炮塔选项"
  lore:
  - "&7点击来编辑你的炮塔"

Type(种类)

当添加了一个种类以后,物品就会被config.yml里定义的物品所替代,你无需添加任何属性

# 这将会把第26格的物品设置为config.yml里定义的 delete_turret_item 物品,当点击时便会删除该炮塔
26:
   type: delete_turret_item

# 这将会把第22格的物品设置为config.yml里定义的 whitelisted_players_item 物品,点击时可打开白名单菜单
22:
   type: whitelisted_players_item

Open Inventory(打开菜单)

当点击时打开一个菜单

8:
   id: "CHEST"
   name: "&a炮塔选项"
   open_inventory: options

Custom Model Data(自定义模型数据)

为物品添加一个特定的自定义模型数据

8:
   id: "DIAMOND"
   custom_model_data: 1

Item Commands(物品命令)

当点击物品时执行一串由控制台发送的命令,你可以使用%player%来指代点击的玩家

'9':
      id: DIAMOND
      name: '&a命令'
      lore:
      - "&7点击执行命令."
      click_commands:
      - "msg %player% &4你执行了一个命令!"
      - "eco give %player% 5000"

弹药(Ammunition)和白名单(Whitelist)菜单的细节

你必须特别谨慎对待这两个菜单

白名单菜单

第一,白名单菜单需要把玩家的头放在白名单列表中,默认情况下它看起来是这样的:

0-35:
    type: whitelist_player_item

这意味着,白名单玩家会被放置在0-35格中。如果因为某些原因你想要让它更有装饰性,比如把头颅放在菜单中间,只需要使用不同的格式即可(见上方)

弹药菜单

弹药菜单限制更多. 你可以更改菜单最后一行的物品. 前面的物品栏则会被弹药填充. 我建议你将此菜单保持默认状态,除非你需要改变物品材质或是进行翻译。

ammunition:
    title: "&9炮塔弹药"
    1-7:
      id: BLACK_STAINED_GLASS_PANE
      name: " "
    0:
      id: "ARROW"
      name: "&7返回"
      open_inventory: options
    6:
      type: ammo_previous_page
    7:
      type: ammo_next_page
    8:
      type: infinite_ammo_item

默认文件

Inventories:
  main:
    slots: 27
    title: "&9Turret Inventory"
    0-7;9;17-26:
      id: BLACK_STAINED_GLASS_PANE
      name: " "
    10;16:
      id: BLUE_STAINED_GLASS_PANE
      name: " "
    11;12;14;15:
      id: WHITE_STAINED_GLASS_PANE
      name: " "
    8:
      id: "CHEST"
      name: "&aTurret Options"
      open_inventory: options
    13:
      type: turret_upgrade
    26:
      type: delete_turret_item
  options:
    slots: 45
    title: "&9Turret Options"
    0-9;17;18;26;27;35-44:
      id: BLACK_STAINED_GLASS_PANE
      name: " "
    10;16;28;34:
      id: WHITE_STAINED_GLASS_PANE
      name: " "
    8:
      type: turret_status_item
    20:
      type: attack_players_item
    21:
      type: attack_monsters_item
    22:
      type: whitelisted_players_item
    23:
      type: attack_animals_item
    24:
      type: attack_others_item
    36:
      id: "ARROW"
      name: "&7Back"
      open_inventory: main
    40:
      type: priority_item  
    44:
      type: turret_ammo_item
  whitelist:
    slots: 45
    title: "&9Turret Player Whitelist"
    37-43:
      id: BLACK_STAINED_GLASS_PANE
      name: " "
    0-35:
      type: whitelist_player_item
    36:
      id: "ARROW"
      name: "&7Back"
      open_inventory: options
    40:
      type: whitelist_add_player_item
    44:
      type: whitelist_apply_item
  ammunition:
    title: "&9Turret Ammunition"
    1-7:
      id: BLACK_STAINED_GLASS_PANE
      name: " "
    0:
      id: "ARROW"
      name: "&7Back"
      open_inventory: options
    6:
      type: ammo_previous_page
    7:
      type: ammo_next_page
    8:
      type: infinite_ammo_item

Last updated