mirror of
https://github.com/PaperMC/Folia.git
synced 2024-11-22 12:05:12 +01:00
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 d68e0ae2e6332a6a99630e2635b22d2cd509377f..dc7ff994269e2a41a3256936c6b46f80dd8c2e18 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
@@ -1264,6 +1264,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.
|
|
Validate.notNull(creator, "Creator may not be null");
|
|
@@ -1404,6 +1405,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 fe57437155ff9471738d3b85e787350601b79584..4ccdcdc78c86a698d555b6dc53bbd8668ca41d39 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java
|
|
@@ -44,6 +44,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();
|
|
}
|
|
@@ -212,6 +213,7 @@ public final class CraftScoreboard implements org.bukkit.scoreboard.Scoreboard {
|
|
|
|
@Override
|
|
public Team registerNewTeam(String name) throws IllegalArgumentException {
|
|
+ if (true) throw new UnsupportedOperationException(); // Folia - not supported yet
|
|
Validate.notNull(name, "Team name cannot be null");
|
|
Validate.isTrue(name.length() <= Short.MAX_VALUE, "Team name '" + name + "' is longer than the limit of 32767 characters");
|
|
Validate.isTrue(this.board.getPlayerTeam(name) == null, "Team name '" + name + "' is already in use");
|
|
@@ -239,6 +241,7 @@ public final class CraftScoreboard implements org.bukkit.scoreboard.Scoreboard {
|
|
|
|
@Override
|
|
public void clearSlot(DisplaySlot slot) throws IllegalArgumentException {
|
|
+ if (true) throw new UnsupportedOperationException(); // Folia - not supported yet
|
|
Validate.notNull(slot, "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 138407c2d4b0bc55ddb9aac5d2aa3edadda090fb..071289fe33f444b903b61d6ec34c9ca4873c9ac5 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) throws IllegalArgumentException {
|
|
+ if (true) throw new UnsupportedOperationException(); // Folia - not supported yet
|
|
Validate.isTrue(bukkitScoreboard instanceof CraftScoreboard, "Cannot set player scoreboard to an unregistered Scoreboard");
|
|
|
|
CraftScoreboard scoreboard = (CraftScoreboard) bukkitScoreboard;
|