Config Tutorial

Config Tutorial

Overview


Tutorial

Creating your first enchantment


When first loading up the config, which is found in /plugins/Enchantment Control/config.yml/ , you should see this:

custom-enchantments: 0
enchantable: false

To create an enchantment, you first need to set the custom-enchantments variable to 1, like this:

custom-enchantments: 1

Then you should save your config and reload it with the command /creload. After opening your config again you should see something like this:

custom-enchantments: 1
enchantable: false
custom0:
  name: Custom
  tier: I
  potions: 0
  sounds: 0
  effects: 0
  extra-damage:
    use: false
    damage: 1
    applies-to: victim
  fire:
    use: false
    time: 100
    applies-to: victim
  lightning:
    strike: false
    effect: false
    applies-to: victim
  requirements:
    min-level: 0
    max-level: 15
  chance: 0.01

..and voilá! You have created your first enchantment and are ready to continue to the next steps.



Name and tier


Now you might be confused with all those variables in the config, so let's start easy. We'll change the name and tier of the enchantment.
So what is name and tier? For example, in the enchantment Sharpness II, Sharpness is the name and II is the tier. Now you should have a basic understanding of it. If not, you will after this tutorial.
Changing name and tier is easy. Take a look at this section:

name: Custom
tier: I

Just change those variables to your liking. Name and tier can be ANYTHING you want, but they need to be alphanumeric. Try it out:

name: Elite
tier: MCCCXXXVII

Reload the plugin and see if you got any errors. If not, you are ready continue to the next section!


Damage


Take a look at this in the config:

extra-damage:
    use: false
    damage: 1
    applies-to: victim

This is the damage variable. The damage variable controls how much more an entity should be damaged on hit (when the player strikes a mob with an item that has this enchantment).
The damage variable is in fact a list with variables (variableception). We'll take a look at those variables now:

use: false

The use variable controls whether or not extra damage should be applied. Can only have the values true or false.

damage: 1

The damage variable controls how much the entity should be damaged. Must be a number between 0 and 20.

applies-to: victim

The applies-to variable controls who should be damaged. Set to victim to damage the mob that was attacked, or set to player to damage the attacker.

Now change those variables to your liking and reload the plugin. If you didn't get any errors you are ready to continue to the next section!


Fire


Now when we have configured the extra-damage variable the next will be fairly straightforward. This time we will burn an entity:

fire:
    use: false
    time: 100
    applies-to: victim

Like the extra-damage variable, this is a list of variables. I have already covered the use and applies-to variables, so let's not repeat those.
But take a look at:

time: 100

The time variable changes how long the entity should be burning (if you haven't figured it out yet, 'entity' stands for the player or victim). This is defined in ticks. 1 tick = 1/20 seconds. So how many ticks is one second? Yeah, you guessed it. 20 ticks.
So basically, the time variable can be any integer number greater than 0.

Now change those variables to your liking and reload the config. No errors = continue.


Lightning


We can't go around being human all day. Let's be thor and strike some lightning.

lightning:
    strike: false
    effect: false
    applies-to: victim

We already know the applies-to variable, but here it controls where the lightning will strike, at the player or at the victim. The other two are totally new, so let's check them out:

strike: false

The strike variable controls whether or not lightning should strike at all. Can only have the values true or false.

effect: false

The effect variable controls whether or not lightning is an effect or not. If it's set to true it won't damage nor burn. Can only have the values true or false.

That was easy. Now change those variables to your liking and reload the config. If there are no errors we can continue.


Enchanting


Currently we haven't tested these features. What if I'm lying?
So to prove that I'm not, let's try them out by changing some more variables:

requirements:
    min-level: 0
    max-level: 15

The requirements variable is self-explaining. It controls which levels are min and max to get the enchantment from an enchantment table. min-level sets the minimum level to get an enchantment and max-level sets the maximum level.

The next variable is:

chance: 0.01

The chance variable is the chance in percent (not really, 1.0 = 100%) to get the enchantment from an enchantment table. This increases at higher level, so you can try different values. Must be a decimal number between 0 and 1.

And finally before you can enchant from an enchantment table you need to change this last variable:

enchantable: false

If you don't find it, look at the top of the config. Yes, there.
The enchantable variable is a global variable that changes whether or not you can enchant custom enchantments from enchantment tables.

Change that to true and reload the plugin. No errors = continue. Now log in to the server and try to enchant some swords or axes and see if you can get your custom enchantment. If not make sure you are op or have the econtrol.enchant permission. If you change the chance variable that I mentioned previously to 1.0 theres a 100% chance to get your enchantment. Reload the plugin again and try to enchant again. It should now work.

Also, you can enchant an item with /cenchant custom0. That's the other way instead of doing all these steps. Just make sure you have the econtrol.op.enchant permisson before attempting that.

If everything worked fine you are ready to continue to the more advanced stuffz.


Effects


Coming soon...


Comments

Posts Quoted:
Reply
Clear All Quotes