Class PluginInstallCommands

java.lang.Object
com.ultikits.ultitools.abstracts.command.BaseCommandExecutor
com.ultikits.ultitools.commands.PluginInstallCommands

@CmdExecutor(description="UltiTools Plugin Management Commands", alias="upm", requireOp=true) public class PluginInstallCommands extends BaseCommandExecutor
  • Field Details

  • Constructor Details

    • PluginInstallCommands

      public PluginInstallCommands()
  • Method Details

    • listPlugins

      public void listPlugins(org.bukkit.command.CommandSender sender, String page)
    • sendPluginList

      private static void sendPluginList(org.bukkit.command.CommandSender sender, int page, List<UltiToolsPlugin> installed, List<PluginEntity> plugins)
    • sendPlayerEntry

      private static void sendPlayerEntry(org.bukkit.command.CommandSender sender, PluginEntity plugin, String runtimeName)
    • sendListButton

      private static void sendListButton(org.bukkit.command.CommandSender sender, MessageKey label, MessageKey hover, String command)
    • replyOnServerThread

      private static void replyOnServerThread(Runnable reply)
    • listPlugins

      public void listPlugins(org.bukkit.command.CommandSender sender)
    • installPlugin

      public void installPlugin(org.bukkit.command.CommandSender sender, String plugin, String version)
    • installPlugin

      public void installPlugin(org.bukkit.command.CommandSender sender, String plugin)
    • listVersions

      public void listVersions(org.bukkit.command.CommandSender sender, String plugin)
    • sendVersionList

      private static void sendVersionList(org.bukkit.command.CommandSender sender, String plugin, List<String> versions)
    • uninstallPlugin

      public void uninstallPlugin(org.bukkit.command.CommandSender sender, String plugin)
    • pending

      public void pending(org.bukkit.command.CommandSender sender)
    • revoke

      public void revoke(org.bukkit.command.CommandSender sender, String module)
    • sendNotRevocable

      private static void sendNotRevocable(org.bukkit.command.CommandSender sender, PendingChanges.PendingChange item)
    • revocableModules

      public List<String> revocableModules()
    • sendResult

      private static boolean sendResult(org.bukkit.command.CommandSender sender, PluginInstallUtils.PendingResult result)
    • sendWarnings

      private static void sendWarnings(org.bukkit.command.CommandSender sender, String name, ModuleContent content)
    • sendPendingEntry

      private static void sendPendingEntry(org.bukkit.command.CommandSender sender, PendingChanges.PendingChange item, int index)
    • requesterText

      private static Text requesterText(PendingChanges.Requester requester)
    • sendStartOutcome

      private static void sendStartOutcome(org.bukkit.command.CommandSender sender, ModuleFileTransactions.StartOutcome outcome)
    • sendRevoked

      private static void sendRevoked(org.bukkit.command.CommandSender sender, PendingChanges.PendingChange before)
    • recordFile

      private static Arg recordFile(PendingChanges.PendingChange item)
    • arg

      private static Arg arg(String tag, String value)
    • send

      private static void send(org.bukkit.command.CommandSender sender, MessageKey key, Arg... args)
    • checkUpdates

      public void checkUpdates(org.bukkit.command.CommandSender sender)
    • sendPendingIfAny

      private static boolean sendPendingIfAny(org.bukkit.command.CommandSender sender, UpdateManager updateManager)
      Commands, like the join listener, read results only after the startup check publishes its completion flag. Before then, even a non-empty result is only a partial scan (#663).
      Returns:
      whether the pending reply was sent instead of consuming unfinished results
    • unconfirmed

      private static List<String> unconfirmed(UpdateManager updateManager)
      What the start-up check could not confirm (D19-032), or an empty list when there is no update manager yet.
    • sendIncompleteIfAny

      private static boolean sendIncompleteIfAny(org.bukkit.command.CommandSender sender, List<String> names)
      Phase 19 D19-032: when a lookup of the start-up check failed, "No updates available." is not known to be true for what it could not confirm; this says so instead, naming it, with the same line the console shows at start-up.
      Returns:
      whether a line was sent
    • unconfirmedModules

      private static List<String> unconfirmedModules(UpdateManager updateManager)
      unconfirmed(UpdateManager) without the framework: /upm update all updates modules only.
    • updatePlugin

      public void updatePlugin(org.bukkit.command.CommandSender sender, String pluginName)
    • updateAllPlugins

      private void updateAllPlugins(org.bukkit.command.CommandSender sender)
    • isSameModule

      static boolean isSameModule(UltiToolsPlugin installedPlugin, PluginEntity catalogueEntry)
      Decides whether installedPlugin (a currently loaded module) and catalogueEntry (a directory entry from the UltiCloud catalogue) refer to the SAME module (#439). The prior check compared installedPlugin.getPluginName() (the module's Bukkit plugin.yml name:) against catalogueEntry.getName() (the catalogue's own display name) with plain string equality -- correct only when the two strings genuinely agree, which they do not for every module.

      Preferred key: identifyString. This is the field PluginInstallUtils and UpdateManager already treat as this framework's stable module identity for install/update/version lookups, and the one field PluginEntity and UltiToolsPlugin both carry under the same name. Compared only when BOTH sides carry a non-blank value -- two identify-string-less entries are never treated as a match on that basis alone, or every such module would appear installed against every such catalogue entry, which is worse than the bug being fixed. This branch is load-bearing (corrected for 6.4.0, UltiTools-Reborn#658): all fifteen active modules now declare identify-string: in their plugin.yml, and the catalogue carries the same identifier, so for every first-party module the installed-state match (/upm list) is decided here. (When #439 was fixed, as of 6.3.0, none of them declared one and this branch was dormant; the earlier wording of this javadoc said so.)

      The fallback when either identifier is blank: exact name equality, plus one fixed, deterministic prefix strip. It still decides third-party modules without an identify-string: and catalogue entries without one. Measured (WR-01): only 4 of the 15 active modules declare a Bukkit name: carrying the literal "UltiTools-" prefix -- UltiTools-Chat (Modules/UltiChat/src/main/resources/plugin.yml:1), UltiTools-Economy (Modules/UltiEconomy/.../plugin.yml:1), UltiTools-Kits (Modules/UltiKits/.../plugin.yml:1), and UltiTools-Menu (Modules/UltiMenu/.../plugin.yml:1) -- the last two ARE #439's own two named modules. The other 11 modules declare their bare folder name with no prefix at all (e.g. UltiLogin, UltiWorlds). This is NOT a declared or tool-enforced convention: Tooling/ultikits-cli/src/lib/templates.ts:152 templates name: directly from the author-supplied module name with no prefix logic, and Tooling/UltiTools-Maven-Archetype ships no plugin.yml template at all -- it is simply each of these 4 authors' own historical choice. Stripping that one fixed prefix before comparing is a single deterministic transform, not a similarity/fuzzy heuristic: it accepts precisely the pairs that differ by nothing, or by exactly that one literal prefix, and rejects every other pair -- including one that merely shares a prefix or substring (a catalogue name that only resembles a loaded module's, such as one ending in "Pro", is rejected, not matched).

      Two present identifiers are authoritative, even on a mismatch (gate-2 Codex round 1). When BOTH sides carry a non-blank identifyString, that comparison alone decides the outcome -- a match returns true immediately, and a MISMATCH returns false immediately, without ever falling through to the name/prefix heuristic below. Two present, different stable identifiers prove the modules are different; the name heuristic must not override that proof (a loaded UltiTools-Foo with id author-a.foo must not be reported as the catalogue's unrelated Foo with id author-b.foo, even though the name/prefix rule alone would match them). The comparison is normalised (trimmed, lower-cased) via the same convention PluginInstallUtils's own (private) normalizeIdentifyString already applies before every install/update/lookup comparison elsewhere in this package, so a module and a catalogue entry that agree except for case are still recognised as the same.

      Residual collision risk (WR-01), disclosed rather than papered over: the risk above is closed whenever BOTH sides carry an identifier. It remains open only when at least one side's identifyString is blank -- no longer the case for any first-party module, but possible for a third-party one -- in which case a THIRD-PARTY module that names itself UltiTools-Foo in its own plugin.yml would still be reported installed against a different, unrelated author's unaffiliated catalogue entry literally named Foo, since neither UltiToolsPlugin nor PluginEntity exposes anything else (a developer/author ID) this method could cross-check in that case. Still strictly better than the defect being fixed: before #439, EVERY module whose name doesn't already match its catalogue display name byte-for-byte is unconditionally reported not installed, a guaranteed false negative for real, correctly-loaded modules. Closing the remaining gap needs a stable identifier populated on both sides (#474), not a looser name heuristic.

      Parameters:
      installedPlugin - a currently loaded module
      catalogueEntry - a directory entry from the catalogue
      Returns:
      true iff the two are judged to refer to the same module
    • resolveInstalledRuntimeName

      static String resolveInstalledRuntimeName(List<UltiToolsPlugin> installedPlugins, PluginEntity catalogueEntry)
      Resolves the runtime name to use for the /upm uninstall click command in listPlugins(CommandSender, String)'s player branch: the LOADED module's own getPluginName(), not the catalogue entry's display name (gate-2 Codex round 1). PluginInstallUtils.requestUninstall(String, CommandSender) matches only against the runtime name -- for exactly the display-name-mismatch case isSameModule(UltiToolsPlugin, PluginEntity) exists to recognise as installed, using the catalogue's display name here would build an uninstall command that silently fails without recording a change.
      Parameters:
      installedPlugins - every currently-loaded module
      catalogueEntry - the catalogue entry being rendered
      Returns:
      the matched module's own runtime name, or null if none matches
    • normalizeIdentifyString

      private static String normalizeIdentifyString(String value)
      Trims and lower-cases an identify string, the same normalisation PluginInstallUtils's own (private) normalizeIdentifyString applies before every install/update/lookup comparison elsewhere in this package (gate-2 Codex round 1) -- kept as a small local copy rather than widening that method's visibility, since the transform itself is a one-line, well-established convention, not shared mutable state.
      Parameters:
      value - the raw identify string, possibly null or blank
      Returns:
      the normalised value, or null if the input was null or blank
    • stripVendorPrefix

      private static String stripVendorPrefix(String runtimeName)
    • handleHelp

      protected void handleHelp(org.bukkit.command.CommandSender sender)
      Description copied from class: BaseCommandExecutor
      Handles the help command. Override to provide custom help.
      Specified by:
      handleHelp in class BaseCommandExecutor
      Parameters:
      sender - the command sender