How to build your own Class

 

 

Classes

  1. What is classes?
  2. Classes config
  3. Making your own class
    1. Layout
    2. Name and tag
    3. Health and Mana
    4. Armor
    5. Traits
  4. Advanced
    1. Permissions
    2. Per-Class Permissions

What is classes?

Classes is a group that players will be able to join. This group has many features, defined by the admin. Some of these features include:

  • Custom health (note! some plugins don't like health over or under 20)
  • Mana
  • Custom traits/spells/abilities
  • Restrict armor
  • Permissions per class

Classes config

The default race config looks like this:

warrior:
  config:
    tag: '[Warrior]'
    healthbonus: '+5'
    manabonus: '+1'
    guislot: 0
  traits:
    SwordDamageIncreaseTrait:
      operation: +
      value: 1
    AxeDamageIncreaseTrait:
      operation: +
      value: 1
archer:
  config:
    tag: '[Archer]'
    healthbonus: '+1'
    manabonus: '+3'
    guislot: 3
  traits:
    PoisonArrowTrait:
      duration: 10
      totalDamage: 10
    FireArrowTrait:
      duration: 10
      totalDamage: 10
    TeleportArrowTrait: {}

 

Making your own class


First we need to create an empty yml file in the classes folder. Call it whatever you want. Best practice is the name of the class followed by .yml.
Now we want to take a look at how the different lines in the yml file affect the class:

  • Name
  • Features of that class
    • Traits (optional, but seriously recommended)
    • Armor (optional)
    • Health (kind of optional)
    • Mana (optional)
    • Permissions (optional)
      That's it! Very simple

Layout

First we want to take a look at how the different lines affect the class

(name):
  config:
    tag: '[(the class tag)]'
    armor: (Armor the class can wear)
    healthbonus: '+100' (class gets +100 Health)
    manabonus: '+100' (class has 100 mana, not affected by the class)
    guislot: -1 (the slot to show in the GUI (0-27). -1 is next free slot)
  traits: (What special abilities does this class have?)
    trait: (can be any trait)
       Operation: (Information at the trait page)
       value: (Information at the trait page)
  permissions: (permissions for the individual class)
    - mcmmo.moreskill.sword (not the actual permission, but it would give this class more skill in swords)

It is very important that your classlayout looks like this (the optional lines don't need to be there, like permissions and mana)

Name and Tag

A class name is defined by the FIRST line of the class (or '<>.config.name: ...'). Which means this one:

Warrior: <-- That one
  config:
    name: 'Warrior' <-- Or this one (higher priority)

The tag is a different thing. A tag is a prefix for the player in the "tab" menu or in the chat, depends on your configuration of your plugin. Here is an example of a tag:

Warrior:
  config:
    tag: '[Warrior]' <-- Here is the tag

 

Health and Mana

Health is what defines the maximum health the class can have. Health is defined here:

    healthbonus: '+2'

This means that the class has 2 extra health. You could also replace the "+" with a "-" to give less health (useful for rouge/mage classes)
manabonus is what defines the mana the class can have. Mana is defined here:

    manabonus: '+100'

 

Gui Slot


The Gui slot to show to. This is only used if the GUI is activated.
The Item for the Class is set to that slot number (slot 0-8 = first row, 9-17 = second row, 18-26 = third row).

Armor

Armor is really just what is says. What armor can the class wear?

    armor: diamond

This class can only wear diamond, well... seems like they have to farm a lot before going into combat

Traits

Traits, also known as: abilities or spells. They can ALL be added to EVERY class you want to.
It is recommended, that you keep a restricted amount of traits on each class to keep the game balanced. Traits can look like this:

    LightningTrait:
      cost: 60

All you have to do is add that and it's there! For more information about how the traits work and how to configure them, go here trait page

Advanced

This is for the advanced server owner, who wants 100% customization on their classes.

Permissions

Permissions can be granted to the individual class, but beware! once the permission is added, it will NOT be removed from the permission group. Only by doing it manually Permissions are added like this:

  permissions:
    - permission.perm

These permissions all depends on your permission plugin. Let's say you use groupmanager, then to deny the class a permission, you would use the double "-" Like this:

  permissions:
    - -bukkit.op

Note that RaC will add global groups and add players to this group as sub, NOT as main group, so it will not change the current group of the player, but only give them the permissions

Per-Class Permissions

Classes can have per-class permissions, which is very useful for people wanting only one group to pick an exact class.
This could for example be a permission to the archer class:

- RaC.classes.archer

To enable this, you would have to enable it in the config.yml file








Building Classes

There are 2 Classes by default in the classes folder. warrior and archer. Classes can be added similar to Races (see build Race).

Requirement is to know what and how to modify (correct!) an .yml file.

At the bottom is an example which is fully configured.

This is the default config:
Warrior:

warrior:
  config:
    tag: '[Warrior]'
    healthbonus: '+5'
  traits:
    SwordDamageIncreaseTrait:
      operation: +
      value: 1
    AxeDamageIncreaseTrait:
      operation: +
      value: 1


Archer:

archer:
  config:
    tag: '[Archer]'
    healthbonus: '+1'
  traits:
    PoisonArrowTrait:
      duration: 10
      totalDamage: 10
    FireArrowTrait:
      duration: 10
      totalDamage: 10
    TeleportArrowTrait: {}

To add another Class, you have to add the new yml file in the classes Folder. Name it like the class name.yml. The root node of the yml file is the name of the classe: '<yourClassName>'.

Each Class needs a configuration which includes:

  • a classTag at: '<yourClassName>.config.tag' (a string).
  • a Health modification of the already owned Health at: '<yourClassName>.config.healthbonus' (a symbol + an Integer, eg. '+8' or '-2' or '*1.25')
  • a mana amount (akkumulated over Class + Race) at: '<yourRaceName>.config.manabonus' (same as Health modifier)

The next section needed is the Trait section. It consists of all traits the Class can use. A list of all Traits can be found on the Trait Page. Also Traits that are loaded externally can be specified there.

If a race already has the trait specified, the better trait is chosen. (For example: SwordDamageTrait: '+2' > SwordDamageTrait: '+0.5')

An example for the LastStandTrait would be:

<yourClassName>:
  traits:
    LastStandTrait:
      value: 50
      cooldown: 60

This means that the trait is configured to restore 50% health when the next attack would kill you.

The complete code for the example would be as following. I will call the new Class: Healer.

warrior:
  config:
    tag: '[Warrior]'
    health: '+5'
  traits:
    SwordDamageIncreaseTrait:
      operation: +
      value: 1
    AxeDamageIncreaseTrait:
      operation: +
      value: 1
archer:
  config:
    tag: '[Archer]'
    health: '+1'
  traits:
    PoisonArrowTrait:
      duration: 10
      totalDamage: 10
    FireArrowTrait:
      duration: 10
      totalDamage: 10
    TeleportArrowTrait: {}
Healer:
  config:
    tag: '[Healer]'
    health: '+2'
    manabonus: 10
  traits:
    HealOthersTrait:
      value: 10
    TrollbloodTrait:
      duration: 3
    LastStandTrait:
      value: 50
    SprintTrait:
      duration: 10
      value: 3

What does the new Class have?

It is called Healer.
It has 2 life more than the default.
It has 10 Maximum Mana more.
It can heal others (with string in hand) for 10 health.
It can remove Poison from himself by left clicking with an apple.
It can sprint (with speed of 3) for 10 seconds. (sprinting with apple in hand.)
It does not die when hit to death, instead is healed by 50% (with uplink). (LastStandTrait).