mirror of
https://github.com/PaperMC/Folia.git
synced 2024-11-29 13:15:11 +01:00
76b06a1260
The code to stop all brain tasks is required to pass the current game time to the tasks it stops. But, when a villager is being portalled, the copied entity does not have any running tasks. So, we can simply return early before invoking getGameTime if there are no running tasks. Fixes https://github.com/PaperMC/Folia/issues/23
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 788ac73125620ceaaec390a6498451b65d16d325..32c9b38036052649b7b5fb25d7c4a49fdd1ca972 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
@@ -1245,6 +1245,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");
|
|
@@ -1385,6 +1386,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;
|