Class PluginInstallCommands
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final net.kyori.adventure.text.format.TextColorprivate static final Stringprivate static final StringThe literal Bukkitname:prefixisSameModule(UltiToolsPlugin, PluginEntity)strips before comparing a loaded module's runtime name against the catalogue's display name (#439). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static ArgvoidcheckUpdates(org.bukkit.command.CommandSender sender) protected voidhandleHelp(org.bukkit.command.CommandSender sender) Handles the help command.voidinstallPlugin(org.bukkit.command.CommandSender sender, String plugin) voidinstallPlugin(org.bukkit.command.CommandSender sender, String plugin, String version) (package private) static booleanisSameModule(UltiToolsPlugin installedPlugin, PluginEntity catalogueEntry) Decides whetherinstalledPlugin(a currently loaded module) andcatalogueEntry(a directory entry from the UltiCloud catalogue) refer to the SAME module (#439).voidlistPlugins(org.bukkit.command.CommandSender sender) voidlistPlugins(org.bukkit.command.CommandSender sender, String page) voidlistVersions(org.bukkit.command.CommandSender sender, String plugin) private static StringnormalizeIdentifyString(String value) Trims and lower-cases an identify string, the same normalisationPluginInstallUtils's own (private)normalizeIdentifyStringapplies 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.voidpending(org.bukkit.command.CommandSender sender) private static Argprivate static voidreplyOnServerThread(Runnable reply) private static TextrequesterText(PendingChanges.Requester requester) (package private) static StringresolveInstalledRuntimeName(List<UltiToolsPlugin> installedPlugins, PluginEntity catalogueEntry) Resolves the runtime name to use for the/upm uninstallclick command inlistPlugins(CommandSender, String)'s player branch: the LOADED module's owngetPluginName(), not the catalogue entry's display name (gate-2 Codex round 1).voidprivate static voidsend(org.bukkit.command.CommandSender sender, MessageKey key, Arg... args) private static booleansendIncompleteIfAny(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.private static voidsendListButton(org.bukkit.command.CommandSender sender, MessageKey label, MessageKey hover, String command) private static voidsendNotRevocable(org.bukkit.command.CommandSender sender, PendingChanges.PendingChange item) private static voidsendPendingEntry(org.bukkit.command.CommandSender sender, PendingChanges.PendingChange item, int index) private static booleansendPendingIfAny(org.bukkit.command.CommandSender sender, UpdateManager updateManager) Commands, like the join listener, read results only after the startup check publishes its completion flag.private static voidsendPlayerEntry(org.bukkit.command.CommandSender sender, PluginEntity plugin, String runtimeName) private static voidsendPluginList(org.bukkit.command.CommandSender sender, int page, List<UltiToolsPlugin> installed, List<PluginEntity> plugins) private static booleansendResult(org.bukkit.command.CommandSender sender, PluginInstallUtils.PendingResult result) private static voidsendRevoked(org.bukkit.command.CommandSender sender, PendingChanges.PendingChange before) private static voidsendStartOutcome(org.bukkit.command.CommandSender sender, ModuleFileTransactions.StartOutcome outcome) private static voidsendVersionList(org.bukkit.command.CommandSender sender, String plugin, List<String> versions) private static voidsendWarnings(org.bukkit.command.CommandSender sender, String name, ModuleContent content) private static StringstripVendorPrefix(String runtimeName) unconfirmed(UpdateManager updateManager) What the start-up check could not confirm (D19-032), or an empty list when there is no update manager yet.unconfirmedModules(UpdateManager updateManager) unconfirmed(UpdateManager)without the framework:/upm update allupdates modules only.voiduninstallPlugin(org.bukkit.command.CommandSender sender, String plugin) private voidupdateAllPlugins(org.bukkit.command.CommandSender sender) voidupdatePlugin(org.bukkit.command.CommandSender sender, String pluginName) Methods inherited from class BaseCommandExecutor
addValidator, awaitAsyncCommands, buildMethodParams, createDefaultValidatorChain, executeCommand, getHelpCommand, getMappings, handleGatedHelp, helpCommand, invokeTyped, removeValidator, suggest, suggestions
-
Field Details
-
VENDOR_PREFIX
The literal Bukkitname:prefixisSameModule(UltiToolsPlugin, PluginEntity)strips before comparing a loaded module's runtime name against the catalogue's display name (#439).- See Also:
-
LIST_SEPARATOR
- See Also:
-
LIST_CYAN
private static final net.kyori.adventure.text.format.TextColor LIST_CYAN
-
-
Constructor Details
-
PluginInstallCommands
public PluginInstallCommands()
-
-
Method Details
-
listPlugins
-
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
-
listPlugins
public void listPlugins(org.bukkit.command.CommandSender sender) -
installPlugin
-
installPlugin
-
listVersions
-
sendVersionList
-
uninstallPlugin
-
pending
public void pending(org.bukkit.command.CommandSender sender) -
revoke
-
sendNotRevocable
private static void sendNotRevocable(org.bukkit.command.CommandSender sender, PendingChanges.PendingChange item) -
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
-
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
-
arg
-
send
-
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
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
unconfirmed(UpdateManager)without the framework:/upm update allupdates modules only. -
updatePlugin
-
updateAllPlugins
private void updateAllPlugins(org.bukkit.command.CommandSender sender) -
isSameModule
Decides whetherinstalledPlugin(a currently loaded module) andcatalogueEntry(a directory entry from the UltiCloud catalogue) refer to the SAME module (#439). The prior check comparedinstalledPlugin.getPluginName()(the module's Bukkitplugin.ymlname:) againstcatalogueEntry.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 fieldPluginInstallUtilsandUpdateManageralready treat as this framework's stable module identity for install/update/version lookups, and the one fieldPluginEntityandUltiToolsPluginboth 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 declareidentify-string:in theirplugin.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 Bukkitname: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), andUltiTools-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:152templatesname:directly from the author-supplied module name with no prefix logic, andTooling/UltiTools-Maven-Archetypeships noplugin.ymltemplate 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 returnstrueimmediately, and a MISMATCH returnsfalseimmediately, 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 loadedUltiTools-Foowith idauthor-a.foomust not be reported as the catalogue's unrelatedFoowith idauthor-b.foo, even though the name/prefix rule alone would match them). The comparison is normalised (trimmed, lower-cased) via the same conventionPluginInstallUtils's own (private)normalizeIdentifyStringalready 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
identifyStringis 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 itselfUltiTools-Fooin its ownplugin.ymlwould still be reported installed against a different, unrelated author's unaffiliated catalogue entry literally namedFoo, since neitherUltiToolsPluginnorPluginEntityexposes 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 modulecatalogueEntry- a directory entry from the catalogue- Returns:
trueiff 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 uninstallclick command inlistPlugins(CommandSender, String)'s player branch: the LOADED module's owngetPluginName(), 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 caseisSameModule(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 modulecatalogueEntry- the catalogue entry being rendered- Returns:
- the matched module's own runtime name, or
nullif none matches
-
normalizeIdentifyString
Trims and lower-cases an identify string, the same normalisationPluginInstallUtils's own (private)normalizeIdentifyStringapplies 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, possiblynullor blank- Returns:
- the normalised value, or
nullif the input wasnullor blank
-
stripVendorPrefix
-
handleHelp
protected void handleHelp(org.bukkit.command.CommandSender sender) Description copied from class:BaseCommandExecutorHandles the help command. Override to provide custom help.- Specified by:
handleHelpin classBaseCommandExecutor- Parameters:
sender- the command sender
-