Updated Upstream (Bukkit/CraftBukkit) (#8270)

Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
d43a1e72 SPIGOT-2450: Improve scoreboard criteria API, add missing DisplaySlots
9d6e4847 SPIGOT-7122: New Allay Methods from 1.19.1

CraftBukkit Changes:
c379a6b4e SPIGOT-2450: Improve scoreboard criteria API, add missing DisplaySlots
051fcced1 SPIGOT-7122: New Allay Methods from 1.19.1
This commit is contained in:
Nassim Jahnke 2022-08-09 09:18:08 +02:00 committed by GitHub
parent c7e118b394
commit e6f8284125
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
91 changed files with 469 additions and 379 deletions

View file

@ -2546,10 +2546,10 @@ index 595b56b2ab9a813ba71399d306117294fa90dc65..3527d40102d512d0e276edc969ea3c18
}
collection = icons;
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index a850bb8a4268c0210ee7af98f51131759ff95f30..837fb51698e6650c6df720f798b7196322b6e7bb 100644
index 5550dbea555a99ee1612609093292db79a625c94..e4f8ccb45a16c35b5256e209435840609d527695 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -590,8 +590,10 @@ public final class CraftServer implements Server {
@@ -592,8 +592,10 @@ public final class CraftServer implements Server {
}
@Override
@ -2560,7 +2560,7 @@ index a850bb8a4268c0210ee7af98f51131759ff95f30..837fb51698e6650c6df720f798b71963
}
@Override
@@ -1411,7 +1413,15 @@ public final class CraftServer implements Server {
@@ -1413,7 +1415,15 @@ public final class CraftServer implements Server {
return this.configuration.getInt("settings.spawn-radius", -1);
}
@ -2576,7 +2576,7 @@ index a850bb8a4268c0210ee7af98f51131759ff95f30..837fb51698e6650c6df720f798b71963
public String getShutdownMessage() {
return this.configuration.getString("settings.shutdown-message");
}
@@ -1579,7 +1589,20 @@ public final class CraftServer implements Server {
@@ -1581,7 +1591,20 @@ public final class CraftServer implements Server {
}
@Override
@ -2597,7 +2597,7 @@ index a850bb8a4268c0210ee7af98f51131759ff95f30..837fb51698e6650c6df720f798b71963
Set<CommandSender> recipients = new HashSet<>();
for (Permissible permissible : this.getPluginManager().getPermissionSubscriptions(permission)) {
if (permissible instanceof CommandSender && permissible.hasPermission(permission)) {
@@ -1587,14 +1610,14 @@ public final class CraftServer implements Server {
@@ -1589,14 +1612,14 @@ public final class CraftServer implements Server {
}
}
@ -2614,7 +2614,7 @@ index a850bb8a4268c0210ee7af98f51131759ff95f30..837fb51698e6650c6df720f798b71963
for (CommandSender recipient : recipients) {
recipient.sendMessage(message);
@@ -1845,6 +1868,14 @@ public final class CraftServer implements Server {
@@ -1847,6 +1870,14 @@ public final class CraftServer implements Server {
return CraftInventoryCreator.INSTANCE.createInventory(owner, type);
}
@ -2629,7 +2629,7 @@ index a850bb8a4268c0210ee7af98f51131759ff95f30..837fb51698e6650c6df720f798b71963
@Override
public Inventory createInventory(InventoryHolder owner, InventoryType type, String title) {
Validate.isTrue(type.isCreatable(), "Cannot open an inventory of type ", type);
@@ -1857,13 +1888,28 @@ public final class CraftServer implements Server {
@@ -1859,13 +1890,28 @@ public final class CraftServer implements Server {
return CraftInventoryCreator.INSTANCE.createInventory(owner, size);
}
@ -2658,7 +2658,7 @@ index a850bb8a4268c0210ee7af98f51131759ff95f30..837fb51698e6650c6df720f798b71963
public Merchant createMerchant(String title) {
return new CraftMerchantCustom(title == null ? InventoryType.MERCHANT.getDefaultTitle() : title);
}
@@ -1928,6 +1974,12 @@ public final class CraftServer implements Server {
@@ -1930,6 +1976,12 @@ public final class CraftServer implements Server {
return Thread.currentThread().equals(console.serverThread) || this.console.hasStopped() || !org.spigotmc.AsyncCatcher.enabled; // All bets are off if we have shut down (e.g. due to watchdog)
}
@ -2671,7 +2671,7 @@ index a850bb8a4268c0210ee7af98f51131759ff95f30..837fb51698e6650c6df720f798b71963
@Override
public String getMotd() {
return this.console.getMotd();
@@ -2350,4 +2402,15 @@ public final class CraftServer implements Server {
@@ -2357,4 +2409,15 @@ public final class CraftServer implements Server {
return this.spigot;
}
// Spigot end
@ -4228,10 +4228,10 @@ index 1980240d3dc0331ddf2ff56e163e2bfbd3b231ab..7a7f3f53aef601f124d474d9890e23d8
public Inventory createInventory(InventoryHolder holder, InventoryType type, String title) {
// BrewingStand does not extend TileEntityLootable
diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftObjective.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftObjective.java
index e9bb0728ae5c16aad4acc106d332db5095db4033..6752cd9b3bc246fc2a7764df0d2b40d3e638fa62 100644
index 0d25c7c03f7ac21a4b21bb95b5bd921c43430cf9..b7f0277b50a0f45c32b818bf9fe1218874aa8533 100644
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftObjective.java
+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftObjective.java
@@ -30,6 +30,21 @@ final class CraftObjective extends CraftScoreboardComponent implements Objective
@@ -31,6 +31,21 @@ final class CraftObjective extends CraftScoreboardComponent implements Objective
return this.objective.getName();
}
@ -4254,20 +4254,28 @@ index e9bb0728ae5c16aad4acc106d332db5095db4033..6752cd9b3bc246fc2a7764df0d2b40d3
public String getDisplayName() throws IllegalStateException {
CraftScoreboard scoreboard = this.checkState();
diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java
index afc059755ae3e7b1c0a4cf3c6b8f32ce13cc458d..9130c478b80fc50ef1fc4e27b1afa51e3f97d618 100644
index c624867e28dd5187d58a6bcb9067b0c10ff7e733..f367261b119ab48c1d17b2b6552cce481c6effbb 100644
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java
+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java
@@ -27,6 +27,27 @@ public final class CraftScoreboard implements org.bukkit.scoreboard.Scoreboard {
@@ -28,6 +28,34 @@ public final class CraftScoreboard implements org.bukkit.scoreboard.Scoreboard {
public CraftObjective registerNewObjective(String name, String criteria) throws IllegalArgumentException {
return this.registerNewObjective(name, criteria, name);
}
+ // Paper start
+ @Override
+ public CraftObjective registerNewObjective(String name, String criteria, net.kyori.adventure.text.Component displayName) {
+ return registerNewObjective(name, criteria, displayName, org.bukkit.scoreboard.RenderType.INTEGER);
+ return registerNewObjective(name, CraftCriteria.getFromBukkit(criteria), displayName, RenderType.INTEGER);
+ }
+ @Override
+ public CraftObjective registerNewObjective(String name, String criteria, net.kyori.adventure.text.Component displayName, RenderType renderType) {
+ return registerNewObjective(name, CraftCriteria.getFromBukkit(criteria), displayName, renderType);
+ }
+ @Override
+ public CraftObjective registerNewObjective(String name, Criteria criteria, net.kyori.adventure.text.Component displayName) throws IllegalArgumentException {
+ return registerNewObjective(name, criteria, displayName, RenderType.INTEGER);
+ }
+ @Override
+ public CraftObjective registerNewObjective(String name, Criteria criteria, net.kyori.adventure.text.Component displayName, RenderType renderType) throws IllegalArgumentException {
+ if (displayName == null) {
+ displayName = net.kyori.adventure.text.Component.empty();
+ }
@ -4277,32 +4285,27 @@ index afc059755ae3e7b1c0a4cf3c6b8f32ce13cc458d..9130c478b80fc50ef1fc4e27b1afa51e
+ Validate.notNull(renderType, "RenderType cannot be null");
+ Validate.isTrue(name.length() <= Short.MAX_VALUE, "The name '" + name + "' is longer than the limit of 32767 characters");
+ Validate.isTrue(board.getObjective(name) == null, "An objective of name '" + name + "' already exists");
+ CraftCriteria craftCriteria = CraftCriteria.getFromBukkit(criteria);
+ net.minecraft.world.scores.Objective objective = board.addObjective(name, craftCriteria.criteria, io.papermc.paper.adventure.PaperAdventure.asVanilla(displayName), CraftScoreboardTranslations.fromBukkitRender(renderType));
+ net.minecraft.world.scores.Objective objective = board.addObjective(name, ((CraftCriteria) criteria).criteria, io.papermc.paper.adventure.PaperAdventure.asVanilla(displayName), CraftScoreboardTranslations.fromBukkitRender(renderType));
+ return new CraftObjective(this, objective);
+ }
+ // Paper end
@Override
public CraftObjective registerNewObjective(String name, String criteria, String displayName) throws IllegalArgumentException {
@@ -35,7 +56,7 @@ public final class CraftScoreboard implements org.bukkit.scoreboard.Scoreboard {
@@ -46,16 +74,7 @@ public final class CraftScoreboard implements org.bukkit.scoreboard.Scoreboard {
@Override
public CraftObjective registerNewObjective(String name, String criteria, String displayName, RenderType renderType) throws IllegalArgumentException {
public CraftObjective registerNewObjective(String name, Criteria criteria, String displayName, RenderType renderType) throws IllegalArgumentException {
- Validate.notNull(name, "Objective name cannot be null");
+ /*Validate.notNull(name, "Objective name cannot be null"); // Paper
Validate.notNull(criteria, "Criteria cannot be null");
Validate.notNull(displayName, "Display name cannot be null");
Validate.notNull(renderType, "RenderType cannot be null");
@@ -45,7 +66,11 @@ public final class CraftScoreboard implements org.bukkit.scoreboard.Scoreboard {
CraftCriteria craftCriteria = CraftCriteria.getFromBukkit(criteria);
net.minecraft.world.scores.Objective objective = this.board.addObjective(name, craftCriteria.criteria, CraftChatMessage.fromStringOrNull(displayName), CraftScoreboardTranslations.fromBukkitRender(renderType));
- Validate.notNull(criteria, "Criteria cannot be null");
- Validate.notNull(displayName, "Display name cannot be null");
- Validate.notNull(renderType, "RenderType cannot be null");
- Validate.isTrue(name.length() <= Short.MAX_VALUE, "The name '" + name + "' is longer than the limit of 32767 characters");
- Validate.isTrue(displayName.length() <= 128, "The display name '" + displayName + "' is longer than the limit of 128 characters");
- Validate.isTrue(this.board.getObjective(name) == null, "An objective of name '" + name + "' already exists");
-
- net.minecraft.world.scores.Objective objective = this.board.addObjective(name, ((CraftCriteria) criteria).criteria, CraftChatMessage.fromStringOrNull(displayName), CraftScoreboardTranslations.fromBukkitRender(renderType));
- return new CraftObjective(this, objective);
+
+ CraftCriteria craftCriteria = CraftCriteria.getFromBukkit(criteria);
+ ScoreboardObjective objective = board.registerObjective(name, craftCriteria.criteria, CraftChatMessage.fromStringOrNull(displayName), CraftScoreboardTranslations.fromBukkitRender(renderType));
+ return new CraftObjective(this, objective);*/ // Paper
+ return registerNewObjective(name, criteria, net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(displayName), renderType); // Paper
}