Package dev.magicmq.pyspigot
Class PyCore
java.lang.Object
dev.magicmq.pyspigot.PyCore
Core class of PySpigot for all platform-specific implementations. Platform-specific code is implemented via the PlatformAdapter.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Compare the current loaded plugin version with the cached latest SpigotMC plugin version, and log a message to console if the current version is detected as outdated.void
Fetch the latest available plugin version from SpigotMC.static PyCore
get()
Get the plugin configuration for PySpigot.Get the data folder for PySpigot.Get the path of the data folder for PySpigot.Get the logger for PySpigot.Get theClassLoader
for PySpigot.Get the identifier of the plugin.Get the script options configuration for PySpigot.Get the latest available plugin version on Spigot.Get the version of the plugin.void
init()
Initialize the plugin.boolean
isPaper()
Get if the server is running paper.static void
newInstance
(PlatformAdapter adapter) Initialize the PyCore instance.void
Reload the plugin config and the script options config.void
saveResource
(String resourcePath, boolean replace) Save a resource from the plugin JAR file to the plugin data folder.void
shutdown()
Shutdown the plugin.
-
Method Details
-
newInstance
Initialize the PyCore instance.Called from the
onEnable
method of the platform-specific plugin class (PySpigot for Bukkit, for example).- Parameters:
adapter
- The platform-specific adapter.
-
init
public void init()Initialize the plugin. -
shutdown
public void shutdown()Shutdown the plugin. -
reloadConfigs
public void reloadConfigs()Reload the plugin config and the script options config. -
getLogger
Get the logger for PySpigot.- Returns:
- The logger
-
getDataFolder
Get the data folder for PySpigot.- Returns:
- The data folder
-
getDataFolderPath
Get the path of the data folder for PySpigot.- Returns:
- A path representing the data folder
-
getPluginClassLoader
Get theClassLoader
for PySpigot.- Returns:
- The ClassLoader
-
getVersion
Get the version of the plugin.- Returns:
- The version
-
getPluginIdentifier
Get the identifier of the plugin.- Returns:
- The plugin identifier
-
isPaper
public boolean isPaper()Get if the server is running paper.- Returns:
- True if the server is running paper, false if otherwise
-
getConfig
Get the plugin configuration for PySpigot.- Returns:
- The PySpigot plugin config
-
getScriptOptionsConfig
Get the script options configuration for PySpigot.- Returns:
- The script options config
-
getSpigotVersion
Get the latest available plugin version on Spigot.- Returns:
- The latest available version on Spigot
-
fetchSpigotVersion
public void fetchSpigotVersion()Fetch the latest available plugin version from SpigotMC. -
compareVersions
public void compareVersions()Compare the current loaded plugin version with the cached latest SpigotMC plugin version, and log a message to console if the current version is detected as outdated. -
saveResource
Save a resource from the plugin JAR file to the plugin data folder.- Parameters:
resourcePath
- The path of the resource to savereplace
- True if the file should be replaced (if it already exists in the data folder), false if it should not
-
get
-