Skip to content

The basics

Soreth edited this page Jul 9, 2020 · 5 revisions

Before we start talking about the plugin in more detail, we need to see some basics that will be omnipresent in it and that we must therefore master.

Manager

The principle of a manager is, as its name suggests, to manage. On this plugin, most of the content goes through a manager. There are different types of managers that we will see later, for now, it should be known that each of them has certainly common properties.

A handler is used to automatically create an object from your configuration file, they have the ability to create different types of objects, some present in VanillaPlus, others in VanillaPlusPowered and others that could be added by other plugins, either mine or those of other developers.

These different types of objects often configure themselves and each other in different ways, so it is important to look at the documentation.

The managers index some of the objects created so that they can be reused in other places without the need to reconfigure the exact same object. The index of these objects is an alias, this alias can be used wherever an object of the same type is requested. To illustrate a minimum, if you have a predefined message that says the same thing all the time, instead of writing it every time, it will be written only once with an alias that will be used instead, so if you change the object, here a message, you only need to do it once.

There are three groups of handlers in my plugin :

General manager

They have their indexes shared with all plugins, which means that the alias can be created only once for this object regardless of the plugin, and it can be used in all plugins.

This is notably the case for what is collectable such as statistics, money, titles, ...

Global manager

Unlike generals, global managers create aliases that can be accessed globally. The difference here is that this is no longer a requirement, so you can have your WELCOME message twice, once in vanillaplus and once in another plugin, this will not be a problem.

These managers have a fallback system, you can configure a plugin to fetch your object if it is not found in the one you are configuring.

Finally, these managers can use this plugin::alias format to access the object with the 'alias' alias created in the 'plugin' plugin.

The others

Then we have other managers, those who either have no additional functionality or have their own operation.


Finally, there are different types of managers for creating objects:

The indexed handlers

These managers need to have the created objects directly in their file and access them only with their aliases.

On-site managers.

These managers work like the indexed ones but have the added ability to create the object directly where it will be used, so you don't need to list an object that will only be used once.

YAML

The second important point to understand is the YAML, although the majority of the configuration files on bukkit use the yml extension, some are not in YAML format where others don't actually use the YAML system.

The important point in YAML is the path system :

REQUIREMENT_LIST:
   ADMIN: "group.admin" 
   FONDA: "group.fonda"
   MODO: "group.modo"
   PREMIUM: "group.premium"
   DEV: "group.dev"

Here the value group.admin has the path REQUIREMENT_LIST.ADMIN.

Which means it would be the same thing to have this:

REQUIREMENT_LIST.ADMIN: "group.admin" 
REQUIREMENT_LIST.FONDA: "group.fonda"
REQUIREMENT_LIST.MODO: "group.modo"
REQUIREMENT_LIST. PREMIUM: "group.premium"
REQUIREMENT_LIST.DEV: "group.dev"

If it helps you to find your way around, don't hesitate, and it will also help you avoid making mistakes about the number of spaces to put before each line.

If it's useful to know it is for the translation system because it uses the path to the text to be used.

Moreover, if you configure one of your files wrongly, in the sense that your file does not respect the YAML format, it will probably generate a lot of errors, if you have a doubt about your file, do not hesitate to check it with tools such as https://yamlchecker.com/ .

To help you, the api has a logger system that can show you a lot of errors in case of bad configuration that should help you to correct them with the help of the documentation.

API

Then, VanillaPlus is an API, which means that the content of this plugin is designed to be reused by other plugins.

For this reason, all the files present will have the same functionality with other plugins, except for the config.yml which contains parameters exclusive to VanillaPlus.

We will therefore see the different functionalities as such and not per file, the majority of the options are grouped in the same file but some VanillaPlus exclusive parameters will be exported in the config.yml file.

Requirement

Finally, you have to know that my plugin doesn't use permission, instead it has a fully configurable system of requirement which allows you to allow certain actions only in specific cases.

Of course, you can always set permissions if you want, although I don't recommend it, the abundance of permissions tends to make minecraft servers heavier.

Clone this wiki locally