Deprecate server config getters (#12189)

This commit is contained in:
Warrior
2025-02-25 22:03:38 +01:00
committed by GitHub
parent ca2610904b
commit a501c45918
3 changed files with 57 additions and 1 deletions

View File

@@ -2980,8 +2980,19 @@ public final class Bukkit {
}
// Paper end - Folia region threading API
/**
* @deprecated All methods on this class have been deprecated, see the individual methods for replacements.
*/
@Deprecated(since = "1.21.4", forRemoval = true)
@NotNull
public static Server.Spigot spigot() {
return server.spigot();
}
/**
* Restarts the server. If the server administrator has not configured restarting, the server will stop.
*/
public static void restart() {
server.restart();
}
}

View File

@@ -2309,24 +2309,52 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
// Spigot start
public class Spigot {
/**
* @deprecated Server config options may be renamed or removed without notice. Prefer using existing API
* wherever possible, rather than directly reading from a server config.
*
* @return The server's spigot config.
*/
@Deprecated(since = "1.21.4", forRemoval = true)
@NotNull
public org.bukkit.configuration.file.YamlConfiguration getConfig() {
throw new UnsupportedOperationException("Not supported yet.");
}
/**
* @deprecated Server config options may be renamed or removed without notice. Prefer using existing API
* wherever possible, rather than directly reading from a server config.
*
* @return The server's bukkit config.
*/
// Paper start
@Deprecated(since = "1.21.4", forRemoval = true)
@NotNull
public org.bukkit.configuration.file.YamlConfiguration getBukkitConfig()
{
throw new UnsupportedOperationException( "Not supported yet." );
}
/**
* @deprecated Server config options may be renamed or removed without notice. Prefer using existing API
* wherever possible, rather than directly reading from a server config.
*
* @return The server's spigot config.
*/
@Deprecated(since = "1.21.4", forRemoval = true)
@NotNull
public org.bukkit.configuration.file.YamlConfiguration getSpigotConfig()
{
throw new UnsupportedOperationException("Not supported yet.");
}
/**
* @deprecated Server config options may be renamed or removed without notice. Prefer using existing API
* wherever possible, rather than directly reading from a server config.
*
* @return The server's paper config.
*/
@Deprecated(since = "1.21.4", forRemoval = true)
@NotNull
public org.bukkit.configuration.file.YamlConfiguration getPaperConfig()
{
@@ -2358,16 +2386,28 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
/**
* Restart the server. If the server administrator has not configured restarting, the server will stop.
*
* @deprecated Use {@link Server#restart()} instead.
*/
@Deprecated(since = "1.21.4", forRemoval = true)
public void restart() {
throw new UnsupportedOperationException("Not supported yet.");
}
}
/**
* @deprecated All methods on this class have been deprecated, see the individual methods for replacements.
*/
@Deprecated(since = "1.21.4", forRemoval = true)
@NotNull
Spigot spigot();
// Spigot end
/**
* Restarts the server. If the server administrator has not configured restarting, the server will stop.
*/
void restart();
void reloadPermissions(); // Paper
boolean reloadCommandAliases(); // Paper

View File

@@ -3053,7 +3053,7 @@ public final class CraftServer implements Server {
@Override
public void restart() {
org.spigotmc.RestartCommand.restart();
CraftServer.this.restart();
}
@Override
@@ -3077,6 +3077,11 @@ public final class CraftServer implements Server {
}
// Spigot end
@Override
public void restart() {
org.spigotmc.RestartCommand.restart();
}
@Override
public double[] getTPS() {
return new double[] {