Package me.remigio07.chatplugin.api
Class ChatPlugin
java.lang.Object
me.remigio07.chatplugin.api.ChatPlugin
ChatPlugin's main class's abstraction.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the plugin's data folder in the plugins (Bukkit/BungeeCord/Velocity) or mods (Sponge) folder.static ChatPlugin
Gets the main instance of the plugin.int
Gets the time elapsed during the plugin's last reload, in milliseconds.Gets the plugin's logger.Gets the managers' manager.int
Gets the time elapsed during the plugin's startup, in milliseconds.static ChatPluginState
getState()
Gets the plugin's state.abstract boolean
Checks if the plugin is running on online mode.abstract boolean
Checks if a premium copy of the plugin is running.abstract void
Prints the beautiful start message.abstract int
reload()
Reloads ChatPlugin.abstract void
runConsoleCommand
(String command, boolean forceSync) Runs a command from the console synchronously.abstract void
sendConsoleMessage
(String message, boolean log) Sends a message to the console.abstract int
unload()
Deprecated.Internal use only.
-
Field Details
-
VERSION
String containing the plugin's current version.This string follows Semantic Versioning.
Content: 🤷
-
-
Constructor Details
-
ChatPlugin
public ChatPlugin()
-
-
Method Details
-
getManagers
Gets the managers' manager. Yeah...- Returns:
- Managers' manager
-
getLogger
Gets the plugin's logger.There are two loggers supported:
java.util.logging.Logger
- Bukkit and BungeeCord environmentsorg.slf4j.Logger
- Sponge and Velocity environments
- Returns:
- Plugin's logger
- See Also:
-
getDataFolder
Gets the plugin's data folder in the plugins (Bukkit/BungeeCord/Velocity) or mods (Sponge) folder.- Returns:
- Plugin's data folder
-
getStartupTime
public int getStartupTime()Gets the time elapsed during the plugin's startup, in milliseconds.- Returns:
- Startup's time, in milliseconds
-
getLastReloadTime
public int getLastReloadTime()Gets the time elapsed during the plugin's last reload, in milliseconds.Will return -1 if no reloads have been performed yet.
- Returns:
- Last reload's time, in milliseconds
-
getInstance
Gets the main instance of the plugin.You may need instances of the bootstrappers instead: check the following methods, too.
- Returns:
- Main instance
- See Also:
-
getState
Gets the plugin's state.- Returns:
- Plugin's state
-
reload
public abstract int reload()Reloads ChatPlugin. Totally.If the reload fails the plugin will be safely disabled, enter recovery mode if possible and send an error message to the console.
- Returns:
- Time elapsed in milliseconds or 0 if not loaded or -1 if failed
- See Also:
-
unload
Deprecated.Internal use only. You should never need to manually unload ChatPlugin.Unloads ChatPlugin.If the unload fails the plugin will be safely disabled, enter recovery mode if possible and send an error message to the console.
- Returns:
- Time elapsed in milliseconds or 0 if not loaded or -1 if failed
- See Also:
-
runConsoleCommand
Runs a command from the console synchronously.It will run on the next server tick if
forceSync
. Otherwise, make sure the call comes from the server's main thread, unlessEnvironment.isProxy()
, where everything is asynchronous.- Parameters:
command
- Command to runforceSync
- Whether to force synchronization
-
sendConsoleMessage
Sends a message to the console.- Parameters:
message
- Message to sendlog
- Whether toLogManager.writeToFile(String)
the message
-
printStartMessage
public abstract void printStartMessage()Prints the beautiful start message. -
isOnlineMode
public abstract boolean isOnlineMode()Checks if the plugin is running on online mode.- Returns:
- Whether online mode is enabled
- Throws:
IllegalStateException
- If!
Environment.isProxy()
and ChatPlugin has not finished loading yet
-
isPremium
public abstract boolean isPremium()Checks if a premium copy of the plugin is running.- Returns:
- Whether the plugin is premium
-