Class UltiTools

java.lang.Object
org.bukkit.plugin.PluginBase
org.bukkit.plugin.java.JavaPlugin
com.ultikits.ultitools.UltiTools
All Implemented Interfaces:
Localized, io.papermc.paper.plugin.lifecycle.event.LifecycleEventOwner, net.kyori.adventure.key.Namespaced, org.bukkit.command.CommandExecutor, org.bukkit.command.TabCompleter, org.bukkit.command.TabExecutor, org.bukkit.plugin.Plugin

public final class UltiTools extends org.bukkit.plugin.java.JavaPlugin implements Localized
UltiTools plugin main class.

UltiTools插件主类。

Version:
6.0.7
Author:
wisdommen, qianmo
  • Field Details

  • Constructor Details

    • UltiTools

      public UltiTools()
  • Method Details

    • getVersionWrapper

      @Deprecated(since="6.2.0", forRemoval=true) public VersionWrapper getVersionWrapper()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use XVersionUtils instead.
      手写而不是用 Lombok 的 @Getter。Lombok 会把 @Deprecated 复制到生成的 accessor 上,但丢掉 sinceforRemoval 两个元素,编译产物里只剩一个 裸 @Deprecated。而 javac 的 -Xlint:removal 自 JDK 9 起默认开启、 -Xlint:deprecation 默认关闭,所以下游用默认参数编译时收不到点名的移除警告, 只会看到一句不含 API 名的笼统提示。字段上标了 forRemoval 不解决问题 —— 对外的入口是这个 getter,标注必须落在它身上。改回 @Getter 会让 COMPATIBILITY.md 的移除清单对这一项失真。

      Hand-written rather than Lombok's @Getter: Lombok copies @Deprecated onto the generated accessor but drops the since and forRemoval elements, so downstream compiling with default flags never sees the named [removal] warning for this API.

      Returns:
      the version wrapper
      版本适配器
    • getInstance

      public static UltiTools getInstance()
      Returns the instance of the UltiTools.

      获取UltiTools的实例。

      Returns:
      the instance of the UltiTools
      UltiTools的实例
    • getPluginVersion

      public static int getPluginVersion()
      Gets the version of UltiTools.

      获取UltiTools的版本。

      Returns:
      the version of the UltiTools
      UltiTools的版本
    • parsePluginVersion

      static int parsePluginVersion(String versionString)
    • getEnv

      public static org.bukkit.configuration.file.YamlConfiguration getEnv()
      Retrieves the YAML configuration object containing environment variables.

      获取包含环境变量的YAML配置对象。

      Returns:
      the YAML configuration object
      YAML配置对象
    • onLoad

      public void onLoad()
      Specified by:
      onLoad in interface org.bukkit.plugin.Plugin
      Overrides:
      onLoad in class org.bukkit.plugin.java.JavaPlugin
    • onEnable

      public void onEnable()
      Specified by:
      onEnable in interface org.bukkit.plugin.Plugin
      Overrides:
      onEnable in class org.bukkit.plugin.java.JavaPlugin
    • initDependencies

      private boolean initDependencies()
    • initLanguage

      private void initLanguage()
    • initDataStore

      private void initDataStore()
    • initPluginModules

      private void initPluginModules()
    • initWebSocketManagers

      private void initWebSocketManagers()
    • attemptCloudLogin

      private boolean attemptCloudLogin()
    • initWebSocket

      private void initWebSocket()
    • registerCommands

      private void registerCommands()
    • scheduleStartupMessages

      private void scheduleStartupMessages(boolean loginSuccess)
    • onDisable

      public void onDisable()
      Specified by:
      onDisable in interface org.bukkit.plugin.Plugin
      Overrides:
      onDisable in class org.bukkit.plugin.java.JavaPlugin
    • reloadPlugins

      public void reloadPlugins() throws IOException
      Reloads the UltiTools plugins by calling the reload method in the PluginManager.

      通过调用PluginManager中的reload方法重新加载UltiTools插件。

      Throws:
      IOException - if an I/O error occurs during the reloading process
    • supported

      public List<String> supported()
      Returns the supported language codes.

      返回支持的语言代码。

      Specified by:
      supported in interface Localized
      Returns:
      a list of supported language codes
      支持的语言代码列表
      See Also:
    • i18n

      public String i18n(String str)
      Internationalization method that translates the given string based on the current language. If the string is not found in the dictionary, the original string is returned.

      根据当前语言翻译给定的字符串的国际化方法。 如果在字典中找不到字符串,则返回原始字符串。

      Parameters:
      str - the string to be translated
      要翻译的字符串
      Returns:
      the translated string or the original string if not found in the dictionary
      翻译后的字符串,如果在字典中找不到,则为原始字符串
    • getFileResource

      private InputStream getFileResource(String filename)
      Retrieves the input stream for the specified file resource.

      获取指定文件资源的输入流。

      Parameters:
      filename - the name of the file resource
      Returns:
      the input stream for the file resource, or null if an I/O error occurs
    • getEconomy

      public net.milkbowl.vault.economy.Economy getEconomy()
      Get the economy provider

      获取经济服务提供者

      Returns:
      the instance of the Economy provider
      经济服务提供者实例
    • getServerJar

      public URL getServerJar()
      Get server jar file URL.
      获取服务器Jar文件URL。
      Returns:
      Server jar file URL
      服务器Jar文件URL
    • getModuleUrls

      private URL[] getModuleUrls()
      Get URLs for module plugin JARs in the UltiTools/plugins directory.
      获取 UltiTools/plugins 目录中模块插件JAR的URL。
      Returns:
      Array of URLs for module plugin JARs
    • getJavaPluginClassLoader

      public static ClassLoader getJavaPluginClassLoader()
      Get the JavaPlugin class loader. This ensures all class loading operations use the correct parent class loader.
      获取JavaPlugin类加载器。 这确保所有类加载操作都使用正确的父类加载器。
      Returns:
      JavaPlugin class loader
      JavaPlugin类加载器