This repository has been archived by the owner on May 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Use actions in your plugin
GCNT edited this page Feb 23, 2022
·
2 revisions
On this page, we will be explaining how you can integrate the AdditionsPlus action in your plugin. You will eventually be able to execute a list of action strings from the config. Please make sure that you have set up the dependency correctly. You can read how here.
In AdditionsPlus, we work with ActionSenders. This is basically a wrapper class/bridge for console senders and players. All queued actions have a primary executor. This is often the 'owner' of the action, to whom the actions are targeted.
Let's say you are making a game plugin, and you want to perform a list of win actions for the player that won the game. Below is a method that allows you to do this:
public void performWinActions(Player player) {
AdditionsPlugin additions = (AdditionsPlugin) Bukkit.getPluginManager().getPlugin("Additions");
ActionSender sender = additions.getAPI().getActionSender(player);
List<String> actions = main.getConfig().getStringList("win-actions"); // gets the 'win-actions' from the config.yml file. Replace main with your main class.
additions.getAPI().performActions(sender, actions); // queues the actions.
}
© 2016 - 2022 GCNT Development
Thanks for using AdditionsPlus.