-
Notifications
You must be signed in to change notification settings - Fork 0
Using the EventAPI
EventAPI - additional events.
Current list of additional events:
- PVPEvent - when two players join PvP
- ExplodeEvent - when something explodes
- VillagerHealEvent - when the player heals a resident
- WorldInteractEvent - when the player interacts with the world
- WorldSelfDestructEvent - when the world tries to self-destruct (under someone's influence)
- BlockClickEvent - when a player clicks on a block
And less important:
- AncapHeartbeatEvent - called every second
- FastTimerTenSecondsEvent
- FastTimerTenMinutesEvent
Events from CommandAPI:
- IncorrectArgsEvent
- NotEnoughArgsEvent
- NotEnoughPermsEvent
- UnknownCommandEvent
Additional events from AncapFramework can be used for different purposes, but here are the main applications:
Many events are generalizations for a large number of specific events from Bukkit. For example, WorldInteractEvent summarizes about 20 events of player interaction with the world. Using AncapFramework events allows you to process only 1 event instead of 20.
The use of generalized events allows plugins to communicate only with Ancapframework, without contacting each other and without knowing anything about each other at all.
Let's assume this situation: you have a plugin for privates, and a plugin for ships. The plugin for privates allows players to defend their territory, and the plugin for ships allows them to build ships. The plugin for privates knows nothing about the plugin for ships, and the plugin for ships knows nothing about the plugin for privates.
If both of these plugins worked with the Bukkit API, then the following problem could arise - inside the territories protected by the first plugin, you can create ships from the second plugin, because the first plugin does not know about the creation of ships and cannot limit it. The solution to this problem would be to add an additional listener to the first plugin specifically for creating ships from the second plugin. However, this solution is obviously not the best - after all, you can't foresee everything. A special hell begins in real conditions - when there may be hundreds of plugins on the server alone, and there are millions of them in total.
However, if both plug-ins worked with the Event API (the plug-in threw the World Inter act Event on ships independently, and the plug-in listened to it in private), such a problem would not have arisen. This is the advantage of low connectivity achieved through a bridge in the form of events.
-
Создание плагина
- Создание main-класса
- Настройка ancapplugin.yml
- Использование AncapPluginAPI
- Использование LanguageAPI
- Использование CommunicatorAPI
- Использование ConfigurationAPI
- Использование CommandAPI
- Использование DatabaseAPI
- Использование EventAPI
- Использование MaterialAPI
- Использование WorldIteratorAPI
- Использование BukkitUtil
- Использование ResourceAPI
-
- Creating main class
- Setting up the ancapplugin.yml
- Using the AncapPluginAPI
- Using the LanguageAPI
- Using the CommunicatorAPI
- Using the ConfigurationAPI
- Using the CommandAPI
- Using the DatabaseAPI
- Using the EventAPI
- Using the MaterialAPI
- Using the WorldIteratorAPI
- Using the BukkitUtil
- Using the ResouceAPI