public class BukkitTriggerReactorCore extends TriggerReactorCore implements org.bukkit.plugin.Plugin
Try not to import Bukkit related classes in here for sake of code cohesiveness if it's not necessary. (Put them in the AbstractJavaPlugin or its child instead. Plugin class is exception since the BukkitTriggerReactorCore wants to act as delegate class of JavaPlugin)
Modifier and Type | Field and Description |
---|---|
protected static AbstractBukkitWrapper |
WRAPPER |
CACHED_THREAD_POOL, PERMISSION, sharedVars
Constructor and Description |
---|
BukkitTriggerReactorCore() |
Modifier and Type | Method and Description |
---|---|
protected void |
addItemLore(IItemStack iS,
String lore) |
void |
callEvent(IEvent event)
Call event so that it can be heard by listeners
|
<T> Future<T> |
callSyncMethod(Callable<T> call)
Run Callable on the server thread.
|
Object |
createEmptyPlayerEvent(ICommandSender sender) |
Interpreter.ProcessInterrupter |
createInterrupter(Object e,
Interpreter interpreter,
Map<UUID,Long> cooldowns)
Create ProcessInterrupter that will be used for the most of the Triggers.
|
Interpreter.ProcessInterrupter |
createInterrupterForInv(Object e,
Interpreter interpreter,
Map<UUID,Long> cooldowns,
Map<IInventory,InventoryTrigger> inventoryMap)
Create ProcessInterrupter that will be used for the most of the Triggers.
|
Object |
createPlayerCommandEvent(ICommandSender sender,
String label,
String[] args) |
void |
disablePlugin()
Disable this plugin.
|
IPlayer |
extractPlayerFromContext(Object e)
try to extract player from context 'e'.
|
AbstractAreaTriggerManager |
getAreaManager() |
String |
getAuthor()
get Author of plugin
|
AbstractJavaPlugin.BungeeCordHelper |
getBungeeHelper() |
AbstractLocationBasedTriggerManager<AbstractLocationBasedTriggerManager.ClickTrigger> |
getClickManager() |
AbstractCommandTriggerManager |
getCmdManager() |
org.bukkit.configuration.file.FileConfiguration |
getConfig() |
Object |
getConfig(String key)
Get the saved value associated with 'key' in config.yml.
|
<T> T |
getConfig(String key,
T def)
Get the saved value associated with 'key' in config.yml.
|
ICommandSender |
getConsoleSender()
get sender instance of the console
|
AbstractCustomTriggerManager |
getCustomManager() |
Map<String,Object> |
getCustomVarsForTrigger(Object e)
extract useful custom variables manually from 'context'
|
File |
getDataFolder()
Get folder where the plugin files will be saved.
|
org.bukkit.generator.ChunkGenerator |
getDefaultWorldGenerator(String worldName,
String id) |
org.bukkit.plugin.PluginDescriptionFile |
getDescription() |
AbstractExecutorManager |
getExecutorManager() |
AbstractInventoryEditManager |
getInvEditManager() |
AbstractInventoryTriggerManager |
getInvManager() |
AbstractPlayerLocationManager |
getLocationManager() |
Logger |
getLogger()
get Logger.
|
<T> T |
getMain()
Get the main class instance.
|
AbstractJavaPlugin.MysqlSupport |
getMysqlHelper() |
String |
getName() |
AbstractNamedTriggerManager |
getNamedTriggerManager() |
AbstractPermissionManager |
getPermissionManager() |
AbstractPlaceholderManager |
getPlaceholderManager() |
IPlayer |
getPlayer(String string) |
String |
getPluginDescription()
get Plugin's description.
|
org.bukkit.plugin.PluginLoader |
getPluginLoader() |
AbstractRepeatingTriggerManager |
getRepeatManager() |
InputStream |
getResource(String filename) |
AbstractScriptEditManager |
getScriptEditManager() |
AbstractAreaSelectionManager |
getSelectionManager() |
SelfReference |
getSelfReference() |
org.bukkit.Server |
getServer() |
Lag |
getTpsHelper() |
String |
getVersion()
get Plugin's version as String
|
AbstractLocationBasedTriggerManager<AbstractLocationBasedTriggerManager.WalkTrigger> |
getWalkManager() |
static AbstractBukkitWrapper |
getWrapper() |
boolean |
isConfigSet(String key)
Check if the 'key' is set in the config.yml.
|
boolean |
isEnabled()
Check if this plugin is enabled.
|
boolean |
isNaggable() |
boolean |
isServerThread()
Check if the current Thread is the Server
|
boolean |
onCommand(org.bukkit.command.CommandSender sender,
org.bukkit.command.Command command,
String label,
String[] args) |
void |
onCoreDisable(AbstractJavaPlugin plugin) |
void |
onCoreEnable(AbstractJavaPlugin plugin) |
void |
onDisable() |
void |
onEnable() |
void |
onLoad() |
List<String> |
onTabComplete(org.bukkit.command.CommandSender sender,
org.bukkit.command.Command command,
String alias,
String[] args) |
void |
registerEvents(Manager manager)
Register events for Managers.
|
void |
reloadConfig()
Save all configs from config.yml.
|
protected boolean |
removeLore(IItemStack iS,
int index) |
void |
runTask(Runnable runnable)
Run task on the server thread.
|
void |
saveAsynchronously(Manager manager)
Call saveAll() on separated thread.
|
void |
saveConfig()
Save all configs to config.yml.
|
void |
saveDefaultConfig() |
void |
saveResource(String resourcePath,
boolean replace) |
protected void |
sendCommandDesc(ICommandSender sender,
String command,
String desc)
Send command description.
|
protected void |
sendDetails(ICommandSender sender,
String detail)
Send detail under the command.
|
void |
setConfig(String key,
Object value)
Save the 'value' to the associated 'key' in config.yml.
|
protected void |
setItemTitle(IItemStack iS,
String title) |
protected boolean |
setLore(IItemStack iS,
int index,
String lore) |
void |
setNaggable(boolean canNag) |
void |
showGlowStones(ICommandSender sender,
Set<Map.Entry<SimpleLocation,Trigger>> set)
Show glowstones to indicate the walk/click triggers in the chunk.
|
getInstance, getPluginConfigManager, getSharedVars, getVariableManager, handleException, handleException, isDebugging, onCommand, onCoreDisable, onCoreEnable, onTabComplete, submitAsync, submitSync
protected static AbstractBukkitWrapper WRAPPER
public static AbstractBukkitWrapper getWrapper()
public SelfReference getSelfReference()
getSelfReference
in class TriggerReactorCore
public AbstractExecutorManager getExecutorManager()
getExecutorManager
in class TriggerReactorCore
public AbstractPlaceholderManager getPlaceholderManager()
getPlaceholderManager
in class TriggerReactorCore
public AbstractScriptEditManager getScriptEditManager()
getScriptEditManager
in class TriggerReactorCore
public AbstractPlayerLocationManager getLocationManager()
getLocationManager
in class TriggerReactorCore
public AbstractPermissionManager getPermissionManager()
getPermissionManager
in class TriggerReactorCore
public AbstractAreaSelectionManager getSelectionManager()
getSelectionManager
in class TriggerReactorCore
public AbstractInventoryEditManager getInvEditManager()
getInvEditManager
in class TriggerReactorCore
public AbstractLocationBasedTriggerManager<AbstractLocationBasedTriggerManager.ClickTrigger> getClickManager()
getClickManager
in class TriggerReactorCore
public AbstractLocationBasedTriggerManager<AbstractLocationBasedTriggerManager.WalkTrigger> getWalkManager()
getWalkManager
in class TriggerReactorCore
public AbstractCommandTriggerManager getCmdManager()
getCmdManager
in class TriggerReactorCore
public AbstractInventoryTriggerManager getInvManager()
getInvManager
in class TriggerReactorCore
public AbstractAreaTriggerManager getAreaManager()
getAreaManager
in class TriggerReactorCore
public AbstractCustomTriggerManager getCustomManager()
getCustomManager
in class TriggerReactorCore
public AbstractRepeatingTriggerManager getRepeatManager()
getRepeatManager
in class TriggerReactorCore
public AbstractNamedTriggerManager getNamedTriggerManager()
getNamedTriggerManager
in class TriggerReactorCore
public AbstractJavaPlugin.BungeeCordHelper getBungeeHelper()
public Lag getTpsHelper()
public AbstractJavaPlugin.MysqlSupport getMysqlHelper()
public void onCoreEnable(AbstractJavaPlugin plugin)
public void onCoreDisable(AbstractJavaPlugin plugin)
protected void sendCommandDesc(ICommandSender sender, String command, String desc)
TriggerReactorCore
sendCommandDesc
in class TriggerReactorCore
sender
- sender to show descriptioncommand
- the command to explaindesc
- descriptionprotected void sendDetails(ICommandSender sender, String detail)
TriggerReactorCore
TriggerReactorCore.sendCommandDesc(ICommandSender, String, String)
to add more information or example about the command.sendDetails
in class TriggerReactorCore
sender
- sender to show descriptiondetail
- detail to showpublic String getPluginDescription()
TriggerReactorCore
getPluginDescription
in class TriggerReactorCore
public String getVersion()
TriggerReactorCore
getVersion
in class TriggerReactorCore
public String getAuthor()
TriggerReactorCore
getAuthor
in class TriggerReactorCore
public void showGlowStones(ICommandSender sender, Set<Map.Entry<SimpleLocation,Trigger>> set)
TriggerReactorCore
showGlowStones
in class TriggerReactorCore
sender
- sender to show the glow stonesset
- the set contains location of block and its associated trigger.public void registerEvents(Manager manager)
TriggerReactorCore
registerEvents
in class TriggerReactorCore
manager
- the object instance of Managerpublic File getDataFolder()
TriggerReactorCore
getDataFolder
in interface org.bukkit.plugin.Plugin
getDataFolder
in class TriggerReactorCore
public Logger getLogger()
TriggerReactorCore
getLogger
in interface org.bukkit.plugin.Plugin
getLogger
in class TriggerReactorCore
public boolean isEnabled()
TriggerReactorCore
isEnabled
in interface org.bukkit.plugin.Plugin
isEnabled
in class TriggerReactorCore
public <T> T getMain()
TriggerReactorCore
getMain
in class TriggerReactorCore
public boolean isConfigSet(String key)
TriggerReactorCore
isConfigSet
in class TriggerReactorCore
key
- the keypublic void setConfig(String key, Object value)
TriggerReactorCore
TriggerReactorCore.saveConfig()
setConfig
in class TriggerReactorCore
key
- the keyvalue
- the value to set.public Object getConfig(String key)
TriggerReactorCore
getConfig
in class TriggerReactorCore
key
- the keypublic <T> T getConfig(String key, T def)
TriggerReactorCore
getConfig
in class TriggerReactorCore
key
- the keydef
- the default value to return if the 'key' is not setpublic void saveConfig()
TriggerReactorCore
saveConfig
in interface org.bukkit.plugin.Plugin
saveConfig
in class TriggerReactorCore
public void reloadConfig()
TriggerReactorCore
reloadConfig
in interface org.bukkit.plugin.Plugin
reloadConfig
in class TriggerReactorCore
public void runTask(Runnable runnable)
TriggerReactorCore
runTask
in class TriggerReactorCore
runnable
- the Runnable to runpublic void saveAsynchronously(Manager manager)
TriggerReactorCore
saveAsynchronously
in class TriggerReactorCore
public Interpreter.ProcessInterrupter createInterrupter(Object e, Interpreter interpreter, Map<UUID,Long> cooldowns)
TriggerReactorCore
createInterrupter
in class TriggerReactorCore
e
- the contextinterpreter
- the interpretercooldowns
- list of current cooldowns.public Interpreter.ProcessInterrupter createInterrupterForInv(Object e, Interpreter interpreter, Map<UUID,Long> cooldowns, Map<IInventory,InventoryTrigger> inventoryMap)
TriggerReactorCore
createInterrupterForInv
in class TriggerReactorCore
e
- the contextinterpreter
- the interpretercooldowns
- list of current cooldowns.inventoryMap
- the inventory map that contains all the information about open inventories. As child class that implements
IIventory should override hashCode() and equals() methods, you can assume that each IInventory instance represents one trigger
that is running with the InventoryTrigger mapped. So it is ideal to get inventory object from the 'e' context and see if the Inventory
object exists in the 'inventoryMap.' For the properly working InventoryTriggerManager, closing the inventory should delete the IInventory
from the 'inventoryMap,' so you can safely assume that closed inventory will not exists in the 'inventoryMap.'public IPlayer extractPlayerFromContext(Object e)
TriggerReactorCore
extractPlayerFromContext
in class TriggerReactorCore
e
- Event for Bukkit APIpublic <T> Future<T> callSyncMethod(Callable<T> call)
TriggerReactorCore
callSyncMethod
in class TriggerReactorCore
call
- the callablepublic void disablePlugin()
TriggerReactorCore
disablePlugin
in class TriggerReactorCore
public void callEvent(IEvent event)
TriggerReactorCore
callEvent
in class TriggerReactorCore
public IPlayer getPlayer(String string)
getPlayer
in class TriggerReactorCore
public Object createEmptyPlayerEvent(ICommandSender sender)
createEmptyPlayerEvent
in class TriggerReactorCore
public Object createPlayerCommandEvent(ICommandSender sender, String label, String[] args)
createPlayerCommandEvent
in class TriggerReactorCore
protected void setItemTitle(IItemStack iS, String title)
setItemTitle
in class TriggerReactorCore
protected void addItemLore(IItemStack iS, String lore)
addItemLore
in class TriggerReactorCore
protected boolean setLore(IItemStack iS, int index, String lore)
setLore
in class TriggerReactorCore
protected boolean removeLore(IItemStack iS, int index)
removeLore
in class TriggerReactorCore
public boolean isServerThread()
TriggerReactorCore
isServerThread
in class TriggerReactorCore
public Map<String,Object> getCustomVarsForTrigger(Object e)
TriggerReactorCore
getCustomVarsForTrigger
in class TriggerReactorCore
public ICommandSender getConsoleSender()
TriggerReactorCore
getConsoleSender
in class TriggerReactorCore
public List<String> onTabComplete(org.bukkit.command.CommandSender sender, org.bukkit.command.Command command, String alias, String[] args)
onTabComplete
in interface org.bukkit.command.TabCompleter
public boolean onCommand(org.bukkit.command.CommandSender sender, org.bukkit.command.Command command, String label, String[] args)
onCommand
in interface org.bukkit.command.CommandExecutor
public org.bukkit.plugin.PluginDescriptionFile getDescription()
getDescription
in interface org.bukkit.plugin.Plugin
public org.bukkit.configuration.file.FileConfiguration getConfig()
getConfig
in interface org.bukkit.plugin.Plugin
public InputStream getResource(String filename)
getResource
in interface org.bukkit.plugin.Plugin
public void saveDefaultConfig()
saveDefaultConfig
in interface org.bukkit.plugin.Plugin
public void saveResource(String resourcePath, boolean replace)
saveResource
in interface org.bukkit.plugin.Plugin
public org.bukkit.plugin.PluginLoader getPluginLoader()
getPluginLoader
in interface org.bukkit.plugin.Plugin
public org.bukkit.Server getServer()
getServer
in interface org.bukkit.plugin.Plugin
public void onDisable()
onDisable
in interface org.bukkit.plugin.Plugin
public void onLoad()
onLoad
in interface org.bukkit.plugin.Plugin
public void onEnable()
onEnable
in interface org.bukkit.plugin.Plugin
public boolean isNaggable()
isNaggable
in interface org.bukkit.plugin.Plugin
public void setNaggable(boolean canNag)
setNaggable
in interface org.bukkit.plugin.Plugin
public org.bukkit.generator.ChunkGenerator getDefaultWorldGenerator(String worldName, String id)
getDefaultWorldGenerator
in interface org.bukkit.plugin.Plugin
public String getName()
getName
in interface org.bukkit.plugin.Plugin