public class AnnoyingPlugin
extends org.bukkit.plugin.java.JavaPlugin
| Modifier and Type | Field and Description |
|---|---|
static @NotNull xyz.srnyx.javautilities.objects.SemanticVersion |
ANNOYING_API_VERSION
The version of the Annoying API the plugin is using
|
@NotNull CooldownManager |
cooldownManager
The
CooldownManager for the plugin |
@NotNull java.util.Map<java.lang.Class<? extends org.bukkit.event.Event>,AnnoyingListener> |
customEvents
Custom events/listeners for the API
|
@Nullable DataManager |
dataManager
The
DataManager for the plugin |
@NotNull java.util.Map<java.lang.String,java.lang.String> |
globalPlaceholders
ChatColor aliases for the plugin from the messages file (MessagesOptions.MessageKeys#globalPlaceholders) |
@NotNull AnnoyingLibraryManager |
libraryManager
The
AnnoyingLibraryManager for the plugin to manage libraries |
static @NotNull java.util.logging.Logger |
LOGGER
|
@Nullable AnnoyingResource |
messages
The
AnnoyingResource that contains the plugin's messages |
static @NotNull xyz.srnyx.javautilities.objects.SemanticVersion |
MINECRAFT_VERSION
The Minecraft version the server is running
|
@NotNull AnnoyingOptions |
options
The API options for the plugin
|
boolean |
papiInstalled
Whether PlaceholderAPI is installed
|
@NotNull java.util.Set<Registrable> |
registeredClasses
Set of registered
Registrables by the plugin |
@Nullable AnnoyingStats |
stats
Wrapper for bStats
|
| Constructor and Description |
|---|
AnnoyingPlugin()
Constructs a new
AnnoyingPlugin instance |
| Modifier and Type | Method and Description |
|---|---|
@NotNull java.util.Optional<org.bukkit.scheduler.BukkitTask> |
attemptAsync(@NotNull java.lang.Runnable runnable)
Attempt to run a task asynchronously if the plugin is enabled, otherwise run it synchronously
|
void |
checkUpdate()
|
void |
disable()
Called when the plugin is disabled
|
void |
disablePlugin()
Runs
PluginManager.disablePlugin(Plugin) with this as the plugin
Do not override this method! Override disable() instead |
void |
enable()
Called after dependency checks, start-up messages, and command/listener registration
|
@NotNull java.lang.String |
getLibsPackage()
Gets the package path for relocated libraries
|
@NotNull java.lang.String |
getMessagesString(@NotNull java.lang.String key)
Gets a string from
messages with the specified key |
@NotNull net.byteflux.libby.relocation.Relocation |
getRelocation(@NotNull java.lang.String from)
Gets a
Relocation for the specified package |
@NotNull net.byteflux.libby.relocation.Relocation |
getRelocation(@NotNull java.lang.String from,
@NotNull java.lang.String name)
Gets a
Relocation for the specified package |
void |
load()
Called when the plugin is loaded
|
void |
loadDataManger(boolean saveCache)
Attempts to load the
dataManager, catching any exceptions and logging them
If storage-new.yml exists, it will attempt to migrate the data from storage.yml to storage-new.yml using DataManager.attemptDatabaseMigration() |
void |
loadMessages()
Loads the messages.yml file to
messages and globalPlaceholders |
static void |
log(@Nullable java.util.logging.Level level,
@Nullable java.lang.Object message)
|
static void |
log(@Nullable java.util.logging.Level level,
@Nullable java.lang.Object message,
@Nullable java.lang.Throwable throwable)
Logs a message with the specified level and throwable to the console
|
static void |
log(@Nullable java.lang.Object message)
|
void |
onDisable()
Called when the plugin is disabled
|
void |
onEnable()
Called when the plugin is enabled.
|
void |
onLoad()
Called after a plugin is loaded but before it has been enabled.
|
@NotNull java.lang.String |
parsePapiPlaceholders(@Nullable org.bukkit.OfflinePlayer player,
@Nullable java.lang.String message)
Parses all PlaceholderAPI placeholders in a message
|
void |
reload()
Called when the plugin is reloaded
|
void |
reloadPlugin()
Reloads the plugin (
messages, etc...). |
static @NotNull java.lang.String |
replaceBrackets(@NotNull java.lang.String string)
Replaces all instances of
{} in a string with .
Used for replacing brackets in package names |
void |
unregisterClasses()
Unregisters all
Registrables in registeredClasses |
getClassLoader, getCommand, getConfig, getDatabase, getDatabaseClasses, getDataFolder, getDefaultWorldGenerator, getDescription, getFile, getLogger, getPlugin, getPluginLoader, getProvidingPlugin, getResource, getServer, getTextResource, initialize, installDDL, isEnabled, isInitialized, isNaggable, onCommand, onTabComplete, reloadConfig, removeDDL, saveConfig, saveDefaultConfig, saveResource, setEnabled, setNaggable, toString@NotNull public static @NotNull java.util.logging.Logger LOGGER
@NotNull public static final @NotNull xyz.srnyx.javautilities.objects.SemanticVersion ANNOYING_API_VERSION
@NotNull public static final @NotNull xyz.srnyx.javautilities.objects.SemanticVersion MINECRAFT_VERSION
@NotNull public final @NotNull AnnoyingOptions options
@NotNull public final @NotNull AnnoyingLibraryManager libraryManager
AnnoyingLibraryManager for the plugin to manage libraries@Nullable public @Nullable AnnoyingStats stats
@Nullable public @Nullable AnnoyingResource messages
AnnoyingResource that contains the plugin's messages@NotNull public final @NotNull java.util.Map<java.lang.String,java.lang.String> globalPlaceholders
ChatColor aliases for the plugin from the messages file (MessagesOptions.MessageKeys#globalPlaceholders)MessagesOptions.MessageKeys#globalPlaceholders@Nullable public @Nullable DataManager dataManager
DataManager for the plugin@NotNull public final @NotNull java.util.Set<Registrable> registeredClasses
Registrables by the plugin@NotNull public final @NotNull java.util.Map<java.lang.Class<? extends org.bukkit.event.Event>,AnnoyingListener> customEvents
@NotNull public final @NotNull CooldownManager cooldownManager
CooldownManager for the pluginpublic boolean papiInstalled
public AnnoyingPlugin()
AnnoyingPlugin instancepublic final void onLoad()
Do not try to override this method! Override load() instead
onLoad in interface org.bukkit.plugin.PluginonLoad in class org.bukkit.plugin.java.JavaPluginload()public final void onEnable()
Do not try to override this method! Override enable() instead
onEnable in interface org.bukkit.plugin.PluginonEnable in class org.bukkit.plugin.java.JavaPluginenable()public final void onDisable()
Do not try to override this method! Override disable() instead
onDisable in interface org.bukkit.plugin.PluginonDisable in class org.bukkit.plugin.java.JavaPlugindisable()public void load()
onLoad()public void enable()
onEnable(),
enablePlugin()public void disable()
onDisable(),
disablePlugin()public void reload()
reloadPlugin()public void disablePlugin()
PluginManager.disablePlugin(Plugin) with this as the plugin
disable() insteaddisable()public void reloadPlugin()
messages, etc...). This will not trigger onLoad() or onEnable()
This is not run automatically (such as onEnable() and onDisable()), it is to be used manually by the plugin itself (ex: in a /reload command)
Do not override this method! Override reload() instead
reload()public void loadMessages()
messages and globalPlaceholders@NotNull
public @NotNull java.lang.String getMessagesString(@NotNull
@NotNull java.lang.String key)
messages with the specified keykey - the key of the stringkey if messages is null or the string is not found@NotNull
public @NotNull java.lang.String parsePapiPlaceholders(@Nullable
@Nullable org.bukkit.OfflinePlayer player,
@Nullable
@Nullable java.lang.String message)
player - the OfflinePlayer to parse the placeholders for (or null if none)message - the message to parsepublic void unregisterClasses()
Registrables in registeredClassespublic void checkUpdate()
AnnoyingUpdatepublic void loadDataManger(boolean saveCache)
dataManager, catching any exceptions and logging them
storage-new.yml exists, it will attempt to migrate the data from storage.yml to storage-new.yml using DataManager.attemptDatabaseMigration()saveCache - whether to save the cache before loading the data manager
false!@NotNull
public @NotNull java.util.Optional<org.bukkit.scheduler.BukkitTask> attemptAsync(@NotNull
@NotNull java.lang.Runnable runnable)
runnable - the task to runBukkitTask if the task was run asynchronously, otherwise Optional.empty()@NotNull
public @NotNull net.byteflux.libby.relocation.Relocation getRelocation(@NotNull
@NotNull java.lang.String from,
@NotNull
@NotNull java.lang.String name)
Relocation for the specified packagefrom - the package to relocatename - the name of the module being relocated (getLibsPackage() + name)@NotNull
public @NotNull net.byteflux.libby.relocation.Relocation getRelocation(@NotNull
@NotNull java.lang.String from)
Relocation for the specified packagefrom - the package to relocate@NotNull public @NotNull java.lang.String getLibsPackage()
public static void log(@Nullable
@Nullable java.util.logging.Level level,
@Nullable
@Nullable java.lang.Object message,
@Nullable
@Nullable java.lang.Throwable throwable)
level - the level of the message. If null, Level.INFO will be usedmessage - the message to logthrowable - the throwable to logpublic static void log(@Nullable
@Nullable java.util.logging.Level level,
@Nullable
@Nullable java.lang.Object message)
level - the level of the message. If null, Level.INFO will be usedmessage - the message to logpublic static void log(@Nullable
@Nullable java.lang.Object message)
message - the message to log@NotNull
public static @NotNull java.lang.String replaceBrackets(@NotNull
@NotNull java.lang.String string)
{} in a string with .
string - the string to replace brackets in