mirror of
https://github.com/PaperMC/Folia.git
synced 2024-11-25 12:35:23 +01:00
fd838ffbee
Fix two regionizer issues: In ThreadedRegionizer#addChunk, fix the incorrect handling of merging two regions where one of the regions had pending merges. If the first region had pending merges, and the second was marked as "ready" then the merge would cause a "ready" region to have pending merges. The fix is to simply downgrade the "ready" region to "transient," as was previously done if the merge was delayed in the case where the first region was "ticking." Additionally, prevent the creation of empty regions by checking if any new sections were created. This would happen when a section existed, but had no marked chunks in it AND all of the sections neighbours existed. In these cases, no region needs to be created as no sections were created.
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 f83d112a6f55a75aae114bb1c0cb5db4e5e009a3..beb4946b582e2d3608dc3adff22089b4c19177ee 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;
|