geforkt von Mirrors/Paper
fixup display slots patch (#9746)
Dieser Commit ist enthalten in:
Ursprung
915bb9220e
Commit
47aeab84ad
@ -5,7 +5,7 @@ Subject: [PATCH] Add missing team sidebar display slots
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/scoreboard/DisplaySlot.java b/src/main/java/org/bukkit/scoreboard/DisplaySlot.java
|
diff --git a/src/main/java/org/bukkit/scoreboard/DisplaySlot.java b/src/main/java/org/bukkit/scoreboard/DisplaySlot.java
|
||||||
index 4959bec21d152a17fe4ca9d3f448aef482a05b5e..fe7d0a19f970ac5b4e0c4bef4ff7c4ceae60bb86 100644
|
index 4959bec21d152a17fe4ca9d3f448aef482a05b5e..21cd2ba659504c3a1eb95226539a5701d0c324db 100644
|
||||||
--- a/src/main/java/org/bukkit/scoreboard/DisplaySlot.java
|
--- a/src/main/java/org/bukkit/scoreboard/DisplaySlot.java
|
||||||
+++ b/src/main/java/org/bukkit/scoreboard/DisplaySlot.java
|
+++ b/src/main/java/org/bukkit/scoreboard/DisplaySlot.java
|
||||||
@@ -1,26 +1,55 @@
|
@@ -1,26 +1,55 @@
|
||||||
@ -36,7 +36,7 @@ index 4959bec21d152a17fe4ca9d3f448aef482a05b5e..fe7d0a19f970ac5b4e0c4bef4ff7c4ce
|
|||||||
- SIDEBAR_YELLOW,
|
- SIDEBAR_YELLOW,
|
||||||
- SIDEBAR_WHITE;
|
- SIDEBAR_WHITE;
|
||||||
+ // Paper start
|
+ // Paper start
|
||||||
+ BELOW_NAME("belowName"),
|
+ BELOW_NAME("below_name"),
|
||||||
+ PLAYER_LIST("list"),
|
+ PLAYER_LIST("list"),
|
||||||
+ SIDEBAR("sidebar"),
|
+ SIDEBAR("sidebar"),
|
||||||
+ SIDEBAR_TEAM_BLACK(NamedTextColor.BLACK),
|
+ SIDEBAR_TEAM_BLACK(NamedTextColor.BLACK),
|
||||||
|
@ -5,19 +5,17 @@ Subject: [PATCH] Add missing team sidebar display slots
|
|||||||
|
|
||||||
== AT ==
|
== AT ==
|
||||||
public org.bukkit.craftbukkit.scoreboard.CraftScoreboardTranslations
|
public org.bukkit.craftbukkit.scoreboard.CraftScoreboardTranslations
|
||||||
public org.bukkit.craftbukkit.scoreboard.CraftScoreboardTranslations toBukkitSlot(I)Lorg/bukkit/scoreboard/DisplaySlot;
|
public org.bukkit.craftbukkit.scoreboard.CraftScoreboardTranslations toBukkitSlot(Lnet/minecraft/world/scores/DisplaySlot;)Lorg/bukkit/scoreboard/DisplaySlot;
|
||||||
public org.bukkit.craftbukkit.scoreboard.CraftScoreboardTranslations fromBukkitSlot(Lorg/bukkit/scoreboard/DisplaySlot;)I
|
public org.bukkit.craftbukkit.scoreboard.CraftScoreboardTranslations fromBukkitSlot(Lorg/bukkit/scoreboard/DisplaySlot;)Lnet/minecraft/world/scores/DisplaySlot;
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardTranslations.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardTranslations.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardTranslations.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardTranslations.java
|
||||||
index 808118a033ace90246318dcf6a3110cab353d09c..183496dfd40d6c89fb77758e5f8f66e8015fe182 100644
|
index 73c5ffff70605b32188a9bb5fb6c0ee04cb66efe..711d227f5ee6d63356a94a0567968da48e9f284c 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardTranslations.java
|
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardTranslations.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardTranslations.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardTranslations.java
|
||||||
@@ -6,37 +6,23 @@ import org.bukkit.scoreboard.DisplaySlot;
|
@@ -7,35 +7,22 @@ import org.bukkit.scoreboard.RenderType;
|
||||||
import org.bukkit.scoreboard.RenderType;
|
|
||||||
|
|
||||||
public final class CraftScoreboardTranslations {
|
public final class CraftScoreboardTranslations {
|
||||||
- static final int MAX_DISPLAY_SLOT = 19;
|
static final int MAX_DISPLAY_SLOT = 19;
|
||||||
+ static final int MAX_DISPLAY_SLOT = net.minecraft.world.scores.DisplaySlot.values().length; // Paper // TODO - revisit this.
|
|
||||||
+ @Deprecated // Paper
|
+ @Deprecated // Paper
|
||||||
static final ImmutableBiMap<DisplaySlot, String> SLOTS = ImmutableBiMap.<DisplaySlot, String>builder()
|
static final ImmutableBiMap<DisplaySlot, String> SLOTS = ImmutableBiMap.<DisplaySlot, String>builder()
|
||||||
.put(DisplaySlot.BELOW_NAME, "below_name")
|
.put(DisplaySlot.BELOW_NAME, "below_name")
|
||||||
@ -43,18 +41,16 @@ index 808118a033ace90246318dcf6a3110cab353d09c..183496dfd40d6c89fb77758e5f8f66e8
|
|||||||
|
|
||||||
private CraftScoreboardTranslations() {}
|
private CraftScoreboardTranslations() {}
|
||||||
|
|
||||||
static DisplaySlot toBukkitSlot(net.minecraft.world.scores.DisplaySlot minecraft) {
|
public static DisplaySlot toBukkitSlot(net.minecraft.world.scores.DisplaySlot minecraft) {
|
||||||
+ if (true) return org.bukkit.scoreboard.DisplaySlot.NAMES.value(minecraft.getSerializedName()); // Paper
|
+ if (true) return DisplaySlot.NAMES.value(minecraft.getSerializedName()); // Paper
|
||||||
return CraftScoreboardTranslations.SLOTS.inverse().get(minecraft.getSerializedName());
|
return CraftScoreboardTranslations.SLOTS.inverse().get(minecraft.getSerializedName());
|
||||||
}
|
}
|
||||||
|
|
||||||
- static net.minecraft.world.scores.DisplaySlot fromBukkitSlot(DisplaySlot slot) {
|
public static net.minecraft.world.scores.DisplaySlot fromBukkitSlot(DisplaySlot slot) {
|
||||||
- return net.minecraft.world.scores.DisplaySlot.CODEC.byName(CraftScoreboardTranslations.SLOTS.get(slot));
|
+ if (true) return net.minecraft.world.scores.DisplaySlot.CODEC.byName(slot.getId()); // Paper
|
||||||
+ public static net.minecraft.world.scores.DisplaySlot fromBukkitSlot(DisplaySlot slot) { // Paper - public for testing
|
return net.minecraft.world.scores.DisplaySlot.CODEC.byName(CraftScoreboardTranslations.SLOTS.get(slot));
|
||||||
+ return net.minecraft.world.scores.DisplaySlot.CODEC.byName(slot.getId()); // Paper
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static RenderType toBukkitRender(ObjectiveCriteria.RenderType display) {
|
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
||||||
index fe5d3b60ad740b7f1cce040f9c8d96ac51245ef6..43ffc4180b1ef2d2000991ad58b0706141470d08 100644
|
index fe5d3b60ad740b7f1cce040f9c8d96ac51245ef6..43ffc4180b1ef2d2000991ad58b0706141470d08 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
--- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
||||||
@ -76,34 +72,31 @@ index fe5d3b60ad740b7f1cce040f9c8d96ac51245ef6..43ffc4180b1ef2d2000991ad58b07061
|
|||||||
{
|
{
|
||||||
diff --git a/src/test/java/io/papermc/paper/scoreboard/DisplaySlotTest.java b/src/test/java/io/papermc/paper/scoreboard/DisplaySlotTest.java
|
diff --git a/src/test/java/io/papermc/paper/scoreboard/DisplaySlotTest.java b/src/test/java/io/papermc/paper/scoreboard/DisplaySlotTest.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..2d1d86eb58d7ec7246eb72029c09a53d0f775eb4
|
index 0000000000000000000000000000000000000000..9765f08707df27d1a46a1daa1cc2e2fc9cda3ffe
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/test/java/io/papermc/paper/scoreboard/DisplaySlotTest.java
|
+++ b/src/test/java/io/papermc/paper/scoreboard/DisplaySlotTest.java
|
||||||
@@ -0,0 +1,27 @@
|
@@ -0,0 +1,24 @@
|
||||||
+package io.papermc.paper.scoreboard;
|
+package io.papermc.paper.scoreboard;
|
||||||
+
|
+
|
||||||
+import net.minecraft.world.scores.Scoreboard;
|
|
||||||
+import org.bukkit.craftbukkit.scoreboard.CraftScoreboardTranslations;
|
+import org.bukkit.craftbukkit.scoreboard.CraftScoreboardTranslations;
|
||||||
+import org.bukkit.scoreboard.DisplaySlot;
|
+import org.bukkit.scoreboard.DisplaySlot;
|
||||||
+import org.junit.Test;
|
+import org.junit.Test;
|
||||||
+
|
+
|
||||||
+import static org.junit.Assert.assertNotEquals;
|
|
||||||
+import static org.junit.Assert.assertNotNull;
|
+import static org.junit.Assert.assertNotNull;
|
||||||
+
|
+
|
||||||
+public class DisplaySlotTest {
|
+public class DisplaySlotTest {
|
||||||
+
|
+
|
||||||
+ @Test
|
+ @Test
|
||||||
+ public void testBukkitToMinecraftDisplaySlots() {
|
+ public void testBukkitToMinecraftDisplaySlots() {
|
||||||
+ for (DisplaySlot value : DisplaySlot.values()) {
|
+ for (DisplaySlot bukkitSlot : DisplaySlot.values()) {
|
||||||
+ assertNotEquals(-1, CraftScoreboardTranslations.fromBukkitSlot(value));
|
+ assertNotNull(CraftScoreboardTranslations.fromBukkitSlot(bukkitSlot));
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ @Test
|
+ @Test
|
||||||
+ public void testMinecraftToBukkitDisplaySlots() {
|
+ public void testMinecraftToBukkitDisplaySlots() {
|
||||||
+ // TODO https://github.com/PaperMC/Paper/issues/9742
|
+ for (net.minecraft.world.scores.DisplaySlot nmsSlot : net.minecraft.world.scores.DisplaySlot.values()) {
|
||||||
+ /*for (String name : Scoreboard.getDisplaySlotNames()) {
|
+ assertNotNull(CraftScoreboardTranslations.toBukkitSlot(nmsSlot));
|
||||||
+ assertNotNull(CraftScoreboardTranslations.toBukkitSlot(Scoreboard.getDisplaySlotByName(name)));
|
+ }
|
||||||
+ }*/
|
|
||||||
+ }
|
+ }
|
||||||
+}
|
+}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren