Class PyCore

java.lang.Object
dev.magicmq.pyspigot.PyCore

public class PyCore extends Object
Core class of PySpigot for all platform-specific implementations. Platform-specific code is implemented via the PlatformAdapter.
See Also:
  • Method Details

    • newInstance

      public static void newInstance(PlatformAdapter adapter)
      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

      public Logger getLogger()
      Get the logger for PySpigot.
      Returns:
      The logger
    • getDataFolder

      public File getDataFolder()
      Get the data folder for PySpigot.
      Returns:
      The data folder
    • getDataFolderPath

      public Path getDataFolderPath()
      Get the path of the data folder for PySpigot.
      Returns:
      A path representing the data folder
    • getPluginClassLoader

      public ClassLoader getPluginClassLoader()
      Get the ClassLoader for PySpigot.
      Returns:
      The ClassLoader
    • getVersion

      public String getVersion()
      Get the version of the plugin.
      Returns:
      The version
    • getPluginIdentifier

      public String 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

      public PluginConfig getConfig()
      Get the plugin configuration for PySpigot.
      Returns:
      The PySpigot plugin config
    • getScriptOptionsConfig

      public ScriptOptionsConfig getScriptOptionsConfig()
      Get the script options configuration for PySpigot.
      Returns:
      The script options config
    • getSpigotVersion

      public String 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

      public void saveResource(String resourcePath, boolean replace)
      Save a resource from the plugin JAR file to the plugin data folder.
      Parameters:
      resourcePath - The path of the resource to save
      replace - True if the file should be replaced (if it already exists in the data folder), false if it should not
    • get

      public static PyCore get()