Replace old version command with brigadier equivalent (#12502)

---------

Co-authored-by: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
This commit is contained in:
David
2025-05-18 22:24:02 +02:00
committed by GitHub
parent 6f73e62ecd
commit ce0fa4c438
7 changed files with 216 additions and 17 deletions

View File

@@ -21,12 +21,24 @@ public interface VersionFetcher {
/**
* Gets the version message to cache and show to command senders.
*
* <p>NOTE: This is run in a new thread separate from that of the command processing thread</p>
* @return the message to show when requesting a version
* @apiNote This method may involve a web request which will block the executing thread
*/
Component getVersionMessage();
/**
* Gets the version message to cache and show to command senders.
*
* @param serverVersion the current version of the server (will match {@link Bukkit#getVersion()})
* @return the message to show when requesting a version
* @apiNote This method may involve a web request which will block the current thread
* @see #getVersionMessage()
* @deprecated {@code serverVersion} is not required
*/
Component getVersionMessage(String serverVersion);
@Deprecated
default Component getVersionMessage(String serverVersion) {
return getVersionMessage();
}
@ApiStatus.Internal
class DummyVersionFetcher implements VersionFetcher {
@@ -37,7 +49,7 @@ public interface VersionFetcher {
}
@Override
public Component getVersionMessage(final String serverVersion) {
public Component getVersionMessage() {
Bukkit.getLogger().warning("Version provider has not been set, cannot check for updates!");
Bukkit.getLogger().info("Override the default implementation of org.bukkit.UnsafeValues#getVersionFetcher()");
new Throwable().printStackTrace();