java.lang.Object
org.bukkit.plugin.PluginBase
org.bukkit.plugin.java.JavaPlugin
io.github.thebusybiscuit.slimefun4.implementation.Slimefun
All Implemented Interfaces:
SlimefunAddon, CommandExecutor, TabCompleter, TabExecutor, Plugin

public class Slimefun extends JavaPlugin implements SlimefunAddon
This is the main class of Slimefun. This is where all the magic starts, take a look around.
Author:
TheBusyBiscuit
  • Constructor Details

    • Slimefun

      public Slimefun()
      This constructor is invoked by Bukkit and within unit tests. Therefore we need to figure out if we're within unit tests or not.
  • Method Details

    • onEnable

      public void onEnable()
      This is called when the Plugin has been loaded and enabled on a Server.
      Specified by:
      onEnable in interface Plugin
      Overrides:
      onEnable in class JavaPlugin
    • getJavaPlugin

      public JavaPlugin getJavaPlugin()
      Description copied from interface: SlimefunAddon
      This method returns the instance of JavaPlugin that this SlimefunAddon refers to.
      Specified by:
      getJavaPlugin in interface SlimefunAddon
      Returns:
      The instance of your JavaPlugin
    • getBugTrackerURL

      public String getBugTrackerURL()
      Description copied from interface: SlimefunAddon
      This method returns a link to the Bug Tracker of this SlimefunAddon
      Specified by:
      getBugTrackerURL in interface SlimefunAddon
      Returns:
      The URL for this Plugin's Bug Tracker, or null
    • onDisable

      public void onDisable()
      This method gets called when the Plugin gets disabled. Most often it is called when the Server is shutting down or reloading.
      Specified by:
      onDisable in interface Plugin
      Overrides:
      onDisable in class JavaPlugin
    • isUnitTest

      public boolean isUnitTest()
      This method checks if this is currently running in a unit test environment.
      Returns:
      Whether we are inside a unit test
    • instance

      @Nullable public static Slimefun instance()
      This returns the global instance of Slimefun. This may return null if the Plugin was disabled.
      Returns:
      The Slimefun instance
    • logger

      @Nonnull public static Logger logger()
      This returns the Logger instance that Slimefun uses.

      Any SlimefunAddon should use their own Logger instance!

      Returns:
      Our Logger instance
    • getVersion

      @Nonnull public static String getVersion()
      This returns the version of Slimefun that is currently installed.
      Returns:
      The currently installed version of Slimefun
    • getCfg

      @Nonnull public static io.github.bakedlibs.dough.config.Config getCfg()
    • getResearchCfg

      @Nonnull public static io.github.bakedlibs.dough.config.Config getResearchCfg()
    • getItemCfg

      @Nonnull public static io.github.bakedlibs.dough.config.Config getItemCfg()
    • getGPSNetwork

      @Nonnull public static GPSNetwork getGPSNetwork()
      This returns our GPSNetwork instance. The GPSNetwork is responsible for handling any GPS-related operations and for managing any GEOResource.
      Returns:
      Our GPSNetwork instance
    • getTickerTask

      @Nonnull public static TickerTask getTickerTask()
    • getLocalization

      @Nonnull public static LocalizationService getLocalization()
      This returns the LocalizationService of Slimefun.
      Returns:
      The LocalizationService of Slimefun
    • getMinecraftRecipeService

      @Nonnull public static MinecraftRecipeService getMinecraftRecipeService()
      This method returns out MinecraftRecipeService for Slimefun. This service is responsible for finding/identifying Recipes from vanilla Minecraft.
      Returns:
      Slimefun's MinecraftRecipeService instance
    • getItemDataService

      @Nonnull public static CustomItemDataService getItemDataService()
    • getItemTextureService

      @Nonnull public static CustomTextureService getItemTextureService()
    • getPermissionsService

      @Nonnull public static PermissionsService getPermissionsService()
    • getBlockDataService

      @Nonnull public static BlockDataService getBlockDataService()
    • getWorldSettingsService

      @Nonnull public static PerWorldSettingsService getWorldSettingsService()
      This method returns out world settings service. That service is responsible for managing item settings per World, such as disabling a SlimefunItem in a specific World.
      Returns:
      Our instance of PerWorldSettingsService
    • getHologramsService

      @Nonnull public static HologramsService getHologramsService()
      This returns our HologramsService which handles the creation and cleanup of any holograms.
      Returns:
      Our instance of HologramsService
    • getSoundService

      @Nonnull public static SoundService getSoundService()
      This returns our SoundService which handles the configuration of all sounds used in Slimefun
      Returns:
      Our instance of SoundService
    • getIntegrations

      @Nonnull public static IntegrationsManager getIntegrations()
      This returns our instance of IntegrationsManager. This is responsible for managing any integrations with third party plugins.
      Returns:
      Our instance of IntegrationsManager
    • getProtectionManager

      @Nonnull public static io.github.bakedlibs.dough.protection.ProtectionManager getProtectionManager()
      This returns out instance of the ProtectionManager. This bridge is used to hook into any third-party protection Plugin.
      Returns:
      Our instanceof of the ProtectionManager
    • getUpdater

      @Nonnull public static UpdaterService getUpdater()
      This method returns the UpdaterService of Slimefun. It is used to handle automatic updates.
      Returns:
      The UpdaterService for Slimefun
    • getMetricsService

      @Nonnull public static MetricsService getMetricsService()
      This method returns the MetricsService of Slimefun. It is used to handle sending metric information to bStats.
      Returns:
      The MetricsService for Slimefun
    • getAnalyticsService

      @Nonnull public static AnalyticsService getAnalyticsService()
      This method returns the AnalyticsService of Slimefun. It is used to handle sending analytic information.
      Returns:
      The AnalyticsService for Slimefun
    • getGitHubService

      @Nonnull public static GitHubService getGitHubService()
      This method returns the GitHubService of Slimefun. It is used to retrieve data from GitHub repositories.
      Returns:
      The GitHubService for Slimefun
    • getNetworkManager

      @Nonnull public static NetworkManager getNetworkManager()
      This returns our NetworkManager which is responsible for handling the Cargo and Energy networks.
      Returns:
      Our NetworkManager instance
    • getRegistry

      @Nonnull public static SlimefunRegistry getRegistry()
    • getGrapplingHookListener

      @Nonnull public static GrapplingHookListener getGrapplingHookListener()
    • getBackpackListener

      @Nonnull public static BackpackListener getBackpackListener()
    • getBowListener

      @Nonnull public static SlimefunBowListener getBowListener()
    • getCommand

      @Nonnull public static SlimefunCommand getCommand()
      The Command that was added by Slimefun.
      Returns:
      Slimefun's command
    • getProfiler

      @Nonnull public static SlimefunProfiler getProfiler()
      This returns our instance of the SlimefunProfiler, a tool that is used to analyse performance and lag.
      Returns:
      The SlimefunProfiler
    • getMinecraftVersion

      @Nonnull public static MinecraftVersion getMinecraftVersion()
      This returns the currently installed version of Minecraft.
      Returns:
      The current version of Minecraft
    • isNewlyInstalled

      public static boolean isNewlyInstalled()
      This method returns whether this version of Slimefun was newly installed. It will return true if this Server uses Slimefun for the very first time.
      Returns:
      Whether this is a new installation of Slimefun
    • getInstalledAddons

      @Nonnull public static Set<Plugin> getInstalledAddons()
      This method returns a Set of every Plugin that lists Slimefun as a required or optional dependency.

      We will just assume this to be a list of our addons.

      Returns:
      A Set of every Plugin that is dependent on Slimefun
    • runSync

      @Nullable public static BukkitTask runSync(@Nonnull Runnable runnable, long delay)
      This method schedules a delayed synchronous task for Slimefun. For Slimefun only, not for addons. This method should only be invoked by Slimefun itself. Addons must schedule their own tasks using their own Plugin instance.
      Parameters:
      runnable - The Runnable to run
      delay - The delay for this task
      Returns:
      The resulting BukkitTask or null if Slimefun was disabled
    • runSync

      @Nullable public static BukkitTask runSync(@Nonnull Runnable runnable)
      This method schedules a synchronous task for Slimefun. For Slimefun only, not for addons. This method should only be invoked by Slimefun itself. Addons must schedule their own tasks using their own Plugin instance.
      Parameters:
      runnable - The Runnable to run
      Returns:
      The resulting BukkitTask or null if Slimefun was disabled
    • getPlayerStorage

      @Nonnull public static Storage getPlayerStorage()
    • getThreadService

      @Nonnull public static ThreadService getThreadService()
      This method returns the ThreadService of Slimefun. Do not use this if you're an addon. Please make your own ThreadService.
      Returns:
      The ThreadService for Slimefun