Skip to content

Creating an ability

Cervinakuy edited this page Nov 27, 2020 · 3 revisions

Understanding abilities

  • With every kit created using /kp create, there is an Ability section at the bottom of each kit file
  • An unlimited number of abilities can be created per kit
  • Abilities support sending a custom message, playing a sound, giving potion effects, or running commands

Ability activator

In order for the plugin to distinguish which items are ability items, you must specify the exact item details to detect for, which are the item name and an item type:

Activator:
  Name: '&aAbility Item'
  Item: EMERALD

You must also include an item in the kit which has the matching name and item type, like so:

Inventory:
(...)
  8:
    Name: '&aAbility Item'
    Item: EMERALD
    Amount: 5

To give more uses for an ability item, all you have to do is specify an amount in the kit item. In the above example, the ability item amount given is 5, which allows the player to use it 5 times. After each use, the item automatically decreases its amount in the inventory. Alternatively, a cooldown can be set which would allow for an unlimited number of uses. See more about ability cooldowns below.

Other ability options

  • Message is a message that is sent to the player upon use
  • Cooldown allows for unlimited uses of an item, following the format of kit cooldowns
  • Sound is a sound that is played to the player upon use, list of sounds can be found on the Wiki home page
  • Effects are the potion effects given to the player upon use, which supports using vanilla potion effect names
  • Commands are the commands run upon use, following the same commands format as used in the rest of the plugin with customizable console & players commands with support for PlaceholderAPI placeholders
Example ability section
Abilities:
  HealthPack:
    Activator:
      Name: '&aHealth Pack &7(Right Click)'
      Material: ENDER_CHEST
    Cooldown:
      Cooldown: '30S' # 30 second cooldown
    Message:
      Message: '%prefix% &7You have used a &bHealth Pack&7.'
    Sound:
      Sound: ANVIL_USE
      Pitch: 1
      Volume: 1
    Effects:
      SPEED:
        Amplifier: 2
        Duration: 10

Creating "special" abilities

Since custom abilities have been added, numerous users have been asking how to create abilities such as flying, climbing walls, or copying ones from popular servers. Such abilities are not possible without hard-coding them, or making them individually. However, using the Commands section of an ability, you can execute a command that triggers an external plugin that either you or a hired developer can code. This is perfectly possible, and unfortunately the only way to implement "special" abilities into the plugin.