Package net.gcnt.additionsplus.api
Interface AdditionsAPI
public interface AdditionsAPI
The official AdditionsPlus API class.
This class holds all data that you can use in your plugin to control or use different aspects of this plugin.
-
Method Summary
Modifier and TypeMethodDescriptioncreateCustomAction
(org.bukkit.plugin.Plugin plugin, String identifier, ActionType type, Consumer<QueuedAction> consumer) Create a new custom action.createCustomAction
(org.bukkit.plugin.Plugin plugin, String identifier, ActionType type, Consumer<QueuedAction> consumer, boolean playersOnly, String... aliases) Create a new custom action.createCustomEvent
(AdditionsPlugin plugin, String pluginName, String eventName, String author, String description) Create a new custom event.getActionSender
(org.bukkit.command.CommandSender sender) Get anActionSender
wrapper class object for the given sender.Get theAnimationManager
that allows you to register animations.getBookByName
(String name) Get a customAdditionsBook
by its identifier.getBooks()
Get aList
ofAdditionsBook
that were registered.getCommandByAlias
(String alias) Get a customAdditionsCommand
that matches the given alias.getCommandByName
(String name) Get a customAdditionsCommand
that matches the given name.Get theCommandManager
used to check and set cooldowns and perform the custom commands.Get aList
ofAdditionsCommand
that were registered.Get the current config.yml file.Get aList
ofAdditionsAction
that were registered.Get aList
ofAdditionsItem
that were registered.getEventById
(String name) Get a registeredAdditionsEvent
by its identifier.Get aList
ofAdditionsEvent
that were registered.Get theAdditionsFileAPI
that contains every data file and its data.Get anAdditionsInterval
by its identifier.Get aList
ofAdditionsInterval
that were registered.getItemByName
(String name) Get a customAdditionsItem
by its identifier.getItemFromFile
(YAMLSection configSection, String itemIdentifier) Get anAdditionsItem
from aYAMLSection
.getItems()
Get aList
ofAdditionsItem
that were registered.getMenuByName
(String name) Get a customAdditionsMenu
by its identifier.getMenus()
Get aList
ofAdditionsMenu
that were registered.getNameTagByGroup
(String group) Get anAdditionsNameTag
by its group name.Get aList
ofAdditionsNameTag
that were registered.getNMS()
Get theNMS
manager used for version-specific code.Get theAdditionsPlugin
main class.getSignByLocation
(org.bukkit.Location location) Get a customAdditionsSign
by its location.getSignByName
(String name) Get a customAdditionsSign
by its identifier.getSigns()
Get aList
ofAdditionsSign
that were registered.getSimilarCommands
(String name) Get aList
of similarAdditionsCommand
that match the given command name.org.bukkit.scoreboard.Scoreboard
Deprecated.getUtils()
Get the generalAdditionsUtils
.boolean
isCustomActionRegistered
(String identifier) Check if there is an action registered with the given identifier.void
Load all AdditionsPlus data files.void
performActions
(ActionSender sender, List<String> actions) Perform a list of actions for a specific sender.boolean
registerCustomAction
(AdditionsAction action) Register a custom action.boolean
Register a custom event.void
setConfig
(AdditionsConfig config) Set current config.yml instance.
-
Method Details
-
getPlugin
AdditionsPlugin getPlugin()Get theAdditionsPlugin
main class.- Returns:
AdditionsPlugin
main class.
-
performActions
Perform a list of actions for a specific sender.- Parameters:
sender
-ActionSender
who is the executor of the actions.actions
-List
of action strings to be executed.
-
loadFiles
void loadFiles()Load all AdditionsPlus data files. -
createCustomAction
AdditionsAction createCustomAction(org.bukkit.plugin.Plugin plugin, String identifier, ActionType type, Consumer<QueuedAction> consumer) Create a new custom action. Please note that this purely creates the action object and does NOT register it.- Parameters:
plugin
-JavaPlugin
pluginidentifier
- Identifier of the action (must be unique).type
-ActionType
of the action.consumer
-Consumer
that is executed when the action is called.- Returns:
AdditionsAction
with the entered data.
-
createCustomAction
AdditionsAction createCustomAction(org.bukkit.plugin.Plugin plugin, String identifier, ActionType type, Consumer<QueuedAction> consumer, boolean playersOnly, String... aliases) Create a new custom action. Please note that this purely creates the action object and does NOT register it.- Parameters:
plugin
-JavaPlugin
pluginidentifier
- Identifier of the action (must be unique).type
-ActionType
of the action.consumer
-Consumer
that is executed when the action is called.playersOnly
- Whether only players can perform this action.aliases
- Optional list of aliases for this action.- Returns:
AdditionsAction
with the entered data.
-
createCustomEvent
AdditionsEvent createCustomEvent(AdditionsPlugin plugin, String pluginName, String eventName, String author, String description) Create a new custom event. Please note that this purely creates the event object and does NOT register it. The event identifier would be:: (all lowercase). - Parameters:
plugin
- Main AdditionsPlus class.pluginName
- Name of your plugin.eventName
- Name of your event.author
- Author of the event.description
- Description of the event.- Returns:
AdditionsEvent
with the entered data.
-
registerCustomEvent
Register a custom event.- Parameters:
event
-AdditionsEvent
instance to register.- Returns:
- true when succeeded, false otherwise.
-
registerCustomAction
Register a custom action.- Parameters:
action
-AdditionsAction
instance to register.- Returns:
- true when succeeded, false otherwise.
-
getCustomActions
List<AdditionsAction> getCustomActions()Get aList
ofAdditionsAction
that were registered.- Returns:
- A
List
ofAdditionsAction
.
-
isCustomActionRegistered
Check if there is an action registered with the given identifier.- Parameters:
identifier
- Identifier to look up.- Returns:
- True when found, false otherwise.
-
getUtils
AdditionsUtils getUtils()Get the generalAdditionsUtils
.- Returns:
- The general
AdditionsUtils
.
-
getCommands
List<AdditionsCommand> getCommands()Get aList
ofAdditionsCommand
that were registered.- Returns:
- A
List
ofAdditionsCommand
.
-
getCommandByName
Get a customAdditionsCommand
that matches the given name.- Parameters:
name
- Name of the command.- Returns:
AdditionsCommand
when found, null otherwise.
-
getCommandByAlias
Get a customAdditionsCommand
that matches the given alias.- Parameters:
alias
- Command alias to look up.- Returns:
AdditionsCommand
when found, null otherwise.
-
getActionSender
Get anActionSender
wrapper class object for the given sender.- Parameters:
sender
- Console sender / player.- Returns:
ActionSender
with the given sender data.
-
getSimilarCommands
Get aList
of similarAdditionsCommand
that match the given command name. Checks for custom command with the same command name (first word).- Parameters:
name
- Name of the command.- Returns:
- A
List
of similarAdditionsCommand
.
-
getCustomItems
List<AdditionsItem> getCustomItems()Get aList
ofAdditionsItem
that were registered.- Returns:
- A
List
ofAdditionsItem
.
-
getItemFromFile
Get anAdditionsItem
from aYAMLSection
.- Parameters:
configSection
- Section to get the item from.itemIdentifier
- Identifier of the item.- Returns:
AdditionsItem
when available, null otherwise.
-
getConfig
AdditionsConfig getConfig()Get the current config.yml file.- Returns:
- Current config.yml file.
-
setConfig
Set current config.yml instance.- Parameters:
config
- NewAdditionsConfig
to use.
-
getEvents
List<AdditionsEvent> getEvents()Get aList
ofAdditionsEvent
that were registered.- Returns:
- A
List
ofAdditionsEvent
.
-
getEventById
Get a registeredAdditionsEvent
by its identifier.- Parameters:
name
- Identifier of the event.- Returns:
AdditionsEvent
when found, null otherwise.
-
getIntervalActions
List<AdditionsInterval> getIntervalActions()Get aList
ofAdditionsInterval
that were registered.- Returns:
- A
List
ofAdditionsInterval
.
-
getIntervalActionByName
Get anAdditionsInterval
by its identifier.- Parameters:
name
- Identifier of the interval.- Returns:
AdditionsInterval
when found, null otherwise.
-
getBooks
List<AdditionsBook> getBooks()Get aList
ofAdditionsBook
that were registered.- Returns:
- A
List
ofAdditionsBook
.
-
getBookByName
Get a customAdditionsBook
by its identifier.- Parameters:
name
- Identifier of the book.- Returns:
AdditionsBook
when found, null otherwise.
-
getSigns
List<AdditionsSign> getSigns()Get aList
ofAdditionsSign
that were registered.- Returns:
- A
List
ofAdditionsSign
.
-
getSignByName
Get a customAdditionsSign
by its identifier.- Parameters:
name
- Identifier of the sign.- Returns:
AdditionsSign
when found, null otherwise.
-
getSignByLocation
Get a customAdditionsSign
by its location.- Parameters:
location
-Location
of the sign.- Returns:
AdditionsSign
when found, null otherwise.
-
getNMS
NMS getNMS()Get theNMS
manager used for version-specific code.- Returns:
NMS
manager.
-
getItems
List<AdditionsItem> getItems()Get aList
ofAdditionsItem
that were registered.- Returns:
- a
List
ofAdditionsItem
.
-
getItemByName
Get a customAdditionsItem
by its identifier.- Parameters:
name
- Identifier of the item.- Returns:
AdditionsItem
when found, null otherwise.
-
getMenus
List<AdditionsMenu> getMenus()Get aList
ofAdditionsMenu
that were registered.- Returns:
- a
List
ofAdditionsMenu
.
-
getMenuByName
Get a customAdditionsMenu
by its identifier.- Parameters:
name
- Identifier of the menu.- Returns:
- An
AdditionsMenu
when found, null otherwise.
-
getNameTags
List<AdditionsNameTag> getNameTags()Get aList
ofAdditionsNameTag
that were registered.- Returns:
- A
List
ofAdditionsNameTag
.
-
getNameTagByGroup
Get anAdditionsNameTag
by its group name.- Parameters:
group
- Group name to look up.- Returns:
AdditionsNameTag
when found, null otherwise.
-
getCommandManager
CommandManager getCommandManager()Get theCommandManager
used to check and set cooldowns and perform the custom commands.- Returns:
- The
CommandManager
.
-
getFilesAPI
AdditionsFileAPI getFilesAPI()Get theAdditionsFileAPI
that contains every data file and its data.- Returns:
- The
AdditionsFileAPI
.
-
getSortedTablist
Deprecated.Get the sorted scoreboard used for tablists.- Returns:
- Sorted tablist
Scoreboard
.
-
getAnimationManager
AnimationManager getAnimationManager()Get theAnimationManager
that allows you to register animations.- Returns:
- The
AnimationManager
. - Since:
- 1.0.3
-