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 // 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 @NotNull
public static Server.Spigot spigot() { public static Server.Spigot spigot() {
return server.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 // Spigot start
public class Spigot { 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 @NotNull
public org.bukkit.configuration.file.YamlConfiguration getConfig() { public org.bukkit.configuration.file.YamlConfiguration getConfig() {
throw new UnsupportedOperationException("Not supported yet."); 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 // Paper start
@Deprecated(since = "1.21.4", forRemoval = true)
@NotNull @NotNull
public org.bukkit.configuration.file.YamlConfiguration getBukkitConfig() public org.bukkit.configuration.file.YamlConfiguration getBukkitConfig()
{ {
throw new UnsupportedOperationException( "Not supported yet." ); 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 @NotNull
public org.bukkit.configuration.file.YamlConfiguration getSpigotConfig() public org.bukkit.configuration.file.YamlConfiguration getSpigotConfig()
{ {
throw new UnsupportedOperationException("Not supported yet."); 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 @NotNull
public org.bukkit.configuration.file.YamlConfiguration getPaperConfig() 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. * 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() { public void restart() {
throw new UnsupportedOperationException("Not supported yet."); 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 @NotNull
Spigot spigot(); Spigot spigot();
// Spigot end // Spigot end
/**
* Restarts the server. If the server administrator has not configured restarting, the server will stop.
*/
void restart();
void reloadPermissions(); // Paper void reloadPermissions(); // Paper
boolean reloadCommandAliases(); // Paper boolean reloadCommandAliases(); // Paper

View File

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