mirror of
https://github.com/PaperMC/Folia.git
synced 2024-09-30 04:47:31 +02:00
de6a87e338
- Compile needs to be checked. - Behaviors around the new tick manager need to be designed and implemented. Chk update.txt for anything specific.
75 lines
5.0 KiB
Diff
75 lines
5.0 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
|
Date: Wed, 22 Mar 2023 14:40:24 -0700
|
|
Subject: [PATCH] Throw UnsupportedOperationException() for broken APIs
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
index d2c8ad04c59035449dc798a637acc6e809d35fc4..7cbf625384f02e3c8c40a57cd5582ecaca4bd15c 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
@@ -1263,6 +1263,7 @@ public final class CraftServer implements Server {
|
|
|
|
@Override
|
|
public World createWorld(WorldCreator creator) {
|
|
+ if (true) throw new UnsupportedOperationException(); // Folia - not implemented properly yet
|
|
Preconditions.checkState(this.console.getAllLevels().iterator().hasNext(), "Cannot create additional worlds on STARTUP");
|
|
//Preconditions.checkState(!this.console.isIteratingOverLevels, "Cannot create a world while worlds are being ticked"); // Paper - Cat - Temp disable. We'll see how this goes.
|
|
Preconditions.checkArgument(creator != null, "WorldCreator cannot be null");
|
|
@@ -1442,6 +1443,7 @@ public final class CraftServer implements Server {
|
|
|
|
@Override
|
|
public boolean unloadWorld(World world, boolean save) {
|
|
+ if (true) throw new UnsupportedOperationException(); // Folia - not implemented properly yet
|
|
//Preconditions.checkState(!this.console.isIteratingOverLevels, "Cannot unload a world while worlds are being ticked"); // Paper - Cat - Temp disable. We'll see how this goes.
|
|
if (world == null) {
|
|
return false;
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java
|
|
index 81889e30a634ac84d996f688d0a2466e9efa19ca..f2ad3247b512ed5115dea475035736eddc038c7e 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java
|
|
@@ -45,6 +45,7 @@ public final class CraftScoreboard implements org.bukkit.scoreboard.Scoreboard {
|
|
}
|
|
@Override
|
|
public CraftObjective registerNewObjective(String name, Criteria criteria, net.kyori.adventure.text.Component displayName, RenderType renderType) throws IllegalArgumentException {
|
|
+ if (true) throw new UnsupportedOperationException(); // Folia - not supported yet
|
|
if (displayName == null) {
|
|
displayName = net.kyori.adventure.text.Component.empty();
|
|
}
|
|
@@ -204,6 +205,7 @@ public final class CraftScoreboard implements org.bukkit.scoreboard.Scoreboard {
|
|
|
|
@Override
|
|
public Team registerNewTeam(String name) {
|
|
+ if (true) throw new UnsupportedOperationException(); // Folia - not supported yet
|
|
Preconditions.checkArgument(name != null, "Team name cannot be null");
|
|
Preconditions.checkArgument(name.length() <= Short.MAX_VALUE, "Team name '%s' is longer than the limit of 32767 characters (%s)", name, name.length());
|
|
Preconditions.checkArgument(this.board.getPlayerTeam(name) == null, "Team name '%s' is already in use", name);
|
|
@@ -231,6 +233,7 @@ public final class CraftScoreboard implements org.bukkit.scoreboard.Scoreboard {
|
|
|
|
@Override
|
|
public void clearSlot(DisplaySlot slot) {
|
|
+ if (true) throw new UnsupportedOperationException(); // Folia - not supported yet
|
|
Preconditions.checkArgument(slot != null, "Slot cannot be null");
|
|
this.board.setDisplayObjective(CraftScoreboardTranslations.fromBukkitSlot(slot), null);
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java
|
|
index b3e1adeb932da9b3bed16acd94e2f16da48a7c72..46a8262f21ef95714c122240ee86f01858010047 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java
|
|
@@ -42,6 +42,7 @@ public final class CraftScoreboardManager implements ScoreboardManager {
|
|
|
|
@Override
|
|
public CraftScoreboard getNewScoreboard() {
|
|
+ if (true) throw new UnsupportedOperationException(); // Folia - not supported yet
|
|
org.spigotmc.AsyncCatcher.catchOp("scoreboard creation"); // Spigot
|
|
CraftScoreboard scoreboard = new CraftScoreboard(new ServerScoreboard(this.server));
|
|
// Paper start
|
|
@@ -68,6 +69,7 @@ public final class CraftScoreboardManager implements ScoreboardManager {
|
|
|
|
// CraftBukkit method
|
|
public void setPlayerBoard(CraftPlayer player, org.bukkit.scoreboard.Scoreboard bukkitScoreboard) {
|
|
+ if (true) throw new UnsupportedOperationException(); // Folia - not supported yet
|
|
Preconditions.checkArgument(bukkitScoreboard instanceof CraftScoreboard, "Cannot set player scoreboard to an unregistered Scoreboard");
|
|
|
|
CraftScoreboard scoreboard = (CraftScoreboard) bukkitScoreboard;
|