How to Start
Information of the plugin to work correctly on your server.
Requirements
1) Spigot
You need Spigot or Paper for the plugin to work. Don't use Craftbukkit.
2) PlaceholderAPI
This dependency is optional but extremely recommended. If you need to verify for some specific conditions you will need to install PlaceholderAPI on your server to get a lot of variables. https://www.spigotmc.org/resources/placeholderapi.6245/
Remember to follow the instructions for downloading variables. If you need to use variables from the Player expansion you need to use the following commands to get them to work:
/papi ecloud download Player
/papi reload
Installation
To install the plugin on your server just place the ConditionalEvents file inside your plugins folder and start your server. Examples will be generated in the config.yml file, you can use them as a reference or delete them.
Config.yml file
This is the main file where you can add new events. To create a new event just add a new configuration section in the config in the "Events" path.
Events folder
You can also create more files inside the events folder, where you can add new events. This is a good practice to keep everything more organized. These events should also be created under the "Events" path.
Remember to use a different name for each of the events!
Your first Event
Let's create our first event. What we want to do is to prevent the player from breaking blocks on the world called "spawn".
First we must think of the event itself. What do we want to block? What is the player doing? Breaking a block. So, for this event, we can use a block_break event type, that detects everytime a player tries to break a block. Under the "Events" path we can create multiple events, for this one, I will give it the name event1
and the type will be block_break
as defined before. You can find all possible events to detect HERE.
Next, we must think if the event needs to check for conditions. In our case, we want to prevent breaking blocks on a world called "spawn", so our first condition must be to detect the current player's world. For that we can use the Player expansion from PlaceholderAPI plugin. That expansion provides the %player_world%
variable, which returns the current world of the player. It is vital that you use the following command to have access to the variable: /papi ecloud download Player
Since we have the variable, now we must create a condition following this format:
<value> <conditional> <value>
The idea is to check if %player_world%
is equals to spawn
. The first value will be %player_world%
, the conditional must be ==
, and the second value, world
. All conditionals can be found HERE.
Finally, we can add actions to execute when the player tries to break a block on a world called spawn
. ConditionalEvents provides a lot of actions. In this case it is necessary to stop the player from breaking the block. When we want to block or prevent an event, we use the cancel_event: true
action. Then, we can send a message telling the player that breaking blocks is not allowed on this world.
For the actions to work you need to add the actions
path, and then a default
path. The default
name is in fact an action group. Events can have multiple action groups that can be executed depending on different situations, but that's more advanced that is explained later on the wiki.
The event is ready! Now, players will be unable to break blocks on a world called spawn
.
Last updated