mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 15:49:00 +01:00
Replace usages of LegacyComponentSerializer.legacySection() in Paper-Server with PaperAdventure.LEGACY_SECTION_UXRC (#5233)
This commit is contained in:
parent
36e0569896
commit
9cf511130f
6 changed files with 43 additions and 54 deletions
|
@ -536,7 +536,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+import net.kyori.adventure.text.Component;
|
||||
+import net.kyori.adventure.text.ComponentLike;
|
||||
+import net.kyori.adventure.text.TextComponent;
|
||||
+import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
+import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
+
|
||||
+public class VanillaChatMessageLogic {
|
||||
|
@ -555,7 +554,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ return displayName;
|
||||
+ } else if (this.index == 1) {
|
||||
+ this.index++;
|
||||
+ return LegacyComponentSerializer.legacySection().deserialize(message).mergeStyle(builder.asComponent());
|
||||
+ return PaperAdventure.LEGACY_SECTION_UXRC.deserialize(message).mergeStyle(builder.asComponent());
|
||||
+ } else {
|
||||
+ return builder;
|
||||
+ }
|
||||
|
@ -565,7 +564,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ if (format.contains("%2$s") && !format.contains("%1$s")) {
|
||||
+ replacement.index = 1;
|
||||
+ }
|
||||
+ return LegacyComponentSerializer.legacySection().deserialize(format)
|
||||
+ return PaperAdventure.LEGACY_SECTION_UXRC.deserialize(format)
|
||||
+ .replaceText(config -> {
|
||||
+ config.times(2);
|
||||
+ config.match("%(\\d+\\$)?s");
|
||||
|
@ -1338,7 +1337,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
} else if (!this.isWhitelisted(gameprofile)) {
|
||||
chatmessage = new ChatMessage("multiplayer.disconnect.not_whitelisted");
|
||||
- event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, org.spigotmc.SpigotConfig.whitelistMessage); // Spigot
|
||||
+ event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(org.spigotmc.SpigotConfig.whitelistMessage)); // Spigot // Paper - Adventure
|
||||
+ event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, PaperAdventure.LEGACY_SECTION_UXRC.deserialize(org.spigotmc.SpigotConfig.whitelistMessage)); // Spigot // Paper - Adventure
|
||||
} else if (getIPBans().isBanned(socketaddress) && !getIPBans().get(socketaddress).hasExpired()) {
|
||||
IpBanEntry ipbanentry = this.l.get(socketaddress);
|
||||
|
||||
|
@ -1352,7 +1351,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
// return this.players.size() >= this.maxPlayers && !this.f(gameprofile) ? new ChatMessage("multiplayer.disconnect.server_full") : null;
|
||||
if (this.players.size() >= this.maxPlayers && !this.f(gameprofile)) {
|
||||
- event.disallow(PlayerLoginEvent.Result.KICK_FULL, org.spigotmc.SpigotConfig.serverFullMessage); // Spigot
|
||||
+ event.disallow(PlayerLoginEvent.Result.KICK_FULL, net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(org.spigotmc.SpigotConfig.serverFullMessage)); // Spigot // Paper - Adventure
|
||||
+ event.disallow(PlayerLoginEvent.Result.KICK_FULL, PaperAdventure.LEGACY_SECTION_UXRC.deserialize(org.spigotmc.SpigotConfig.serverFullMessage)); // Spigot // Paper - Adventure
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1404,7 +1403,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ @Deprecated // Paper start
|
||||
public int broadcastMessage(String message) {
|
||||
- return broadcast(message, BROADCAST_CHANNEL_USERS);
|
||||
+ this.sendMessage(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(message));
|
||||
+ this.sendMessage(io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(message));
|
||||
+ return this.getOnlinePlayers().size() + 1;
|
||||
+ // Paper end
|
||||
}
|
||||
|
@ -1418,7 +1417,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
@Override
|
||||
+ public net.kyori.adventure.text.Component shutdownMessage() {
|
||||
+ String msg = getShutdownMessage();
|
||||
+ return msg != null ? net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(msg) : null;
|
||||
+ return msg != null ? io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(msg) : null;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+ @Override
|
||||
|
@ -1433,7 +1432,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ @Deprecated // Paper
|
||||
public int broadcast(String message, String permission) {
|
||||
+ // Paper start - Adventure
|
||||
+ return this.broadcast(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(message), permission);
|
||||
+ return this.broadcast(io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(message), permission);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
|
@ -1675,21 +1674,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ @Override
|
||||
+ public String[] getLines() {
|
||||
+ this.loadLines();
|
||||
+ return this.lines.stream().map(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection()::serialize).toArray(String[]::new); // Paper
|
||||
+ return this.lines.stream().map(io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC::serialize).toArray(String[]::new); // Paper
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLine(int index) throws IndexOutOfBoundsException {
|
||||
- return getLines()[index];
|
||||
+ this.loadLines();
|
||||
+ return net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(this.lines.get(index)); // Paper
|
||||
+ return io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.serialize(this.lines.get(index)); // Paper
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLine(int index, String line) throws IndexOutOfBoundsException {
|
||||
- getLines()[index] = line;
|
||||
+ this.loadLines();
|
||||
+ this.lines.set(index, net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(line)); // Paper
|
||||
+ this.lines.set(index, io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(line)); // Paper
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1806,7 +1805,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
- String title = container.getBukkitView().getTitle();
|
||||
+ //String title = container.getBukkitView().getTitle(); // Paper - comment
|
||||
+ net.kyori.adventure.text.Component adventure$title = container.getBukkitView().title(); // Paper
|
||||
+ if (adventure$title == null) adventure$title = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(container.getBukkitView().getTitle()); // Paper
|
||||
+ if (adventure$title == null) adventure$title = io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(container.getBukkitView().getTitle()); // Paper
|
||||
|
||||
- player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(container.windowId, windowType, CraftChatMessage.fromString(title)[0]));
|
||||
+ //player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(container.windowId, windowType, CraftChatMessage.fromString(title)[0])); // Paper // Paper - comment
|
||||
|
@ -1823,7 +1822,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+
|
||||
+ //String title = inventory.getTitle(); // Paper - comment
|
||||
+ net.kyori.adventure.text.Component adventure$title = inventory.title(); // Paper
|
||||
+ if (adventure$title == null) adventure$title = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(inventory.getTitle()); // Paper
|
||||
+ if (adventure$title == null) adventure$title = io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(inventory.getTitle()); // Paper
|
||||
+ //player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(container.windowId, windowType, CraftChatMessage.fromString(title)[0])); // Paper - comment
|
||||
+ player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(container.windowId, windowType, io.papermc.paper.adventure.PaperAdventure.asVanilla(adventure$title))); // Paper
|
||||
player.activeContainer = container;
|
||||
|
@ -1837,13 +1836,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
+ if(true) return net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(this.getHandle().adventure$displayName); // Paper
|
||||
+ if(true) return io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.serialize(this.getHandle().adventure$displayName); // Paper
|
||||
return getHandle().displayName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDisplayName(final String name) {
|
||||
+ this.getHandle().adventure$displayName = name != null ? net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(name) : null; if (true) return; // Paper
|
||||
+ this.getHandle().adventure$displayName = name != null ? io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(name) : null; if (true) return; // Paper
|
||||
getHandle().displayName = name == null ? getName() : name;
|
||||
}
|
||||
|
||||
|
@ -1885,26 +1884,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
@Override
|
||||
public String getPlayerListHeader() {
|
||||
- return (playerListHeader == null) ? null : CraftChatMessage.fromComponent(playerListHeader);
|
||||
+ return (playerListHeader == null) ? null : net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(playerListHeader); // Paper - Adventure
|
||||
+ return (playerListHeader == null) ? null : io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.serialize(playerListHeader); // Paper - Adventure
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlayerListFooter() {
|
||||
- return (playerListFooter == null) ? null : CraftChatMessage.fromComponent(playerListFooter);
|
||||
+ return (playerListFooter == null) ? null : net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(playerListFooter); // Paper - Adventure
|
||||
+ return (playerListFooter == null) ? null : io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.serialize(playerListFooter); // Paper - Adventure
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerListHeader(String header) {
|
||||
- this.playerListHeader = CraftChatMessage.fromStringOrNull(header, true);
|
||||
+ this.playerListHeader = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(header); // Paper - Adventure
|
||||
+ this.playerListHeader = io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(header); // Paper - Adventure
|
||||
updatePlayerListHeaderFooter();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlayerListFooter(String footer) {
|
||||
- this.playerListFooter = CraftChatMessage.fromStringOrNull(footer, true);
|
||||
+ this.playerListFooter = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(footer); // Paper - Adventure
|
||||
+ this.playerListFooter = io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(footer); // Paper - Adventure
|
||||
updatePlayerListHeaderFooter();
|
||||
}
|
||||
|
||||
|
@ -1912,8 +1911,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
public void setPlayerListHeaderFooter(String header, String footer) {
|
||||
- this.playerListHeader = CraftChatMessage.fromStringOrNull(header, true);
|
||||
- this.playerListFooter = CraftChatMessage.fromStringOrNull(footer, true);
|
||||
+ this.playerListHeader = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(header); // Paper - Adventure
|
||||
+ this.playerListFooter = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(footer); // Paper - Adventure
|
||||
+ this.playerListHeader = io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(header); // Paper - Adventure
|
||||
+ this.playerListFooter = io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(footer); // Paper - Adventure
|
||||
updatePlayerListHeaderFooter();
|
||||
}
|
||||
|
||||
|
@ -2196,7 +2195,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
cachedType = view.getType();
|
||||
- cachedTitle = view.getTitle();
|
||||
+ this.adventure$title = view.title(); // Paper
|
||||
+ if (this.adventure$title == null) this.adventure$title = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(view.getTitle()); // Paper
|
||||
+ if (this.adventure$title == null) this.adventure$title = io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(view.getTitle()); // Paper
|
||||
+ //cachedTitle = view.getTitle(); // Paper - comment
|
||||
cachedSize = getSize();
|
||||
setupSlots(top, bottom, player);
|
||||
|
@ -2231,7 +2230,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
cachedType = view.getType();
|
||||
- cachedTitle = view.getTitle();
|
||||
+ this.adventure$title = view.title(); // Paper
|
||||
+ if (this.adventure$title == null) this.adventure$title = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(view.getTitle()); // Paper
|
||||
+ if (this.adventure$title == null) this.adventure$title = io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(view.getTitle()); // Paper
|
||||
+ //cachedTitle = view.getTitle(); // Paper - comment
|
||||
if (view.getPlayer() instanceof CraftPlayer) {
|
||||
CraftPlayer player = (CraftPlayer) view.getPlayer();
|
||||
|
@ -2298,7 +2297,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
Validate.notNull(title, "Title cannot be null");
|
||||
this.items = NonNullList.a(size, ItemStack.b);
|
||||
this.title = title;
|
||||
+ this.adventure$title = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(title);
|
||||
+ this.adventure$title = io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(title);
|
||||
this.viewers = new ArrayList<HumanEntity>();
|
||||
this.owner = owner;
|
||||
this.type = InventoryType.CHEST;
|
||||
|
@ -2308,7 +2307,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ public MinecraftInventory(final InventoryHolder owner, final int size, final net.kyori.adventure.text.Component title) {
|
||||
+ Validate.notNull(title, "Title cannot be null");
|
||||
+ this.items = NonNullList.a(size, ItemStack.b);
|
||||
+ this.title = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(title);
|
||||
+ this.title = io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.serialize(title);
|
||||
+ this.adventure$title = title;
|
||||
+ this.viewers = new ArrayList<HumanEntity>();
|
||||
+ this.owner = owner;
|
||||
|
@ -2422,13 +2421,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
+import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||
+import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
import net.minecraft.server.IChatBaseComponent;
|
||||
import net.minecraft.server.NBTTagCompound;
|
||||
import net.minecraft.server.NBTTagList;
|
||||
@@ -0,0 +0,0 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta {
|
||||
this.generation = (generation == null) ? null : generation.ordinal();
|
||||
}
|
||||
|
@ -2436,30 +2428,30 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ // Paper start
|
||||
+ @Override
|
||||
+ public net.kyori.adventure.text.Component title() {
|
||||
+ return this.title == null ? null : net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(this.title);
|
||||
+ return this.title == null ? null : io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(this.title);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public org.bukkit.inventory.meta.BookMeta title(net.kyori.adventure.text.Component title) {
|
||||
+ this.setTitle(title == null ? null : net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(title));
|
||||
+ this.setTitle(title == null ? null : io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.serialize(title));
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public net.kyori.adventure.text.Component author() {
|
||||
+ return this.author == null ? null : net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(this.author);
|
||||
+ return this.author == null ? null : io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(this.author);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public org.bukkit.inventory.meta.BookMeta author(net.kyori.adventure.text.Component author) {
|
||||
+ this.setAuthor(author == null ? null : net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(author));
|
||||
+ this.setAuthor(author == null ? null : io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.serialize(author));
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public net.kyori.adventure.text.Component page(final int page) {
|
||||
+ Validate.isTrue(isValidPage(page), "Invalid page number");
|
||||
+ return this instanceof CraftMetaBookSigned ? GsonComponentSerializer.gson().deserialize(pages.get(page - 1)) : LegacyComponentSerializer.legacySection().deserialize(pages.get(page - 1));
|
||||
+ return this instanceof CraftMetaBookSigned ? net.kyori.adventure.text.serializer.gson.GsonComponentSerializer.gson().deserialize(pages.get(page - 1)) : io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(pages.get(page - 1));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
|
@ -2470,16 +2462,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ if (data == null) {
|
||||
+ data = net.kyori.adventure.text.Component.empty();
|
||||
+ }
|
||||
+ pages.set(page - 1, this instanceof CraftMetaBookSigned ? GsonComponentSerializer.gson().serialize(data) : LegacyComponentSerializer.legacySection().serialize(data));
|
||||
+ pages.set(page - 1, this instanceof CraftMetaBookSigned ? net.kyori.adventure.text.serializer.gson.GsonComponentSerializer.gson().serialize(data) : io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.serialize(data));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public List<net.kyori.adventure.text.Component> pages() {
|
||||
+ if (this.pages == null) return ImmutableList.of();
|
||||
+ if (this instanceof CraftMetaBookSigned)
|
||||
+ return pages.stream().map(GsonComponentSerializer.gson()::deserialize).collect(ImmutableList.toImmutableList());
|
||||
+ return pages.stream().map(net.kyori.adventure.text.serializer.gson.GsonComponentSerializer.gson()::deserialize).collect(ImmutableList.toImmutableList());
|
||||
+ else
|
||||
+ return pages.stream().map(LegacyComponentSerializer.legacySection()::deserialize).collect(ImmutableList.toImmutableList());
|
||||
+ return pages.stream().map(io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC::deserialize).collect(ImmutableList.toImmutableList());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
|
@ -2510,15 +2502,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ page = net.kyori.adventure.text.Component.empty();
|
||||
+ }
|
||||
+
|
||||
+ this.pages.add(this instanceof CraftMetaBookSigned ? GsonComponentSerializer.gson().serialize(page) : LegacyComponentSerializer.legacySection().serialize(page));
|
||||
+ this.pages.add(this instanceof CraftMetaBookSigned ? net.kyori.adventure.text.serializer.gson.GsonComponentSerializer.gson().serialize(page) : io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.serialize(page));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private CraftMetaBook(net.kyori.adventure.text.Component title, net.kyori.adventure.text.Component author, List<net.kyori.adventure.text.Component> pages) {
|
||||
+ super((org.bukkit.craftbukkit.inventory.CraftMetaItem) org.bukkit.Bukkit.getItemFactory().getItemMeta(org.bukkit.Material.WRITABLE_BOOK));
|
||||
+ this.title = title == null ? null : net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(title);
|
||||
+ this.author = author == null ? null : net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(author);
|
||||
+ this.pages = pages.subList(0, Math.min(MAX_PAGES, pages.size())).stream().map(LegacyComponentSerializer.legacySection()::serialize).collect(java.util.stream.Collectors.toList());
|
||||
+ this.title = title == null ? null : io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.serialize(title);
|
||||
+ this.author = author == null ? null : io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.serialize(author);
|
||||
+ this.pages = pages.subList(0, Math.min(MAX_PAGES, pages.size())).stream().map(io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC::serialize).collect(java.util.stream.Collectors.toList());
|
||||
+ }
|
||||
+
|
||||
+ static final class CraftMetaBookBuilder implements BookMetaBuilder {
|
||||
|
@ -2845,7 +2837,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
ScoreboardObjective objective = board.registerObjective(name, craftCriteria.criteria, CraftChatMessage.fromStringOrNull(displayName), CraftScoreboardTranslations.fromBukkitRender(renderType));
|
||||
- return new CraftObjective(this, objective);
|
||||
+ return new CraftObjective(this, objective);*/ // Paper
|
||||
+ return registerNewObjective(name, criteria, net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(displayName)); // Paper
|
||||
+ return registerNewObjective(name, criteria, io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(displayName)); // Paper
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -51,7 +51,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ // Paper end
|
||||
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)); // Paper
|
||||
return registerNewObjective(name, criteria, io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(displayName)); // Paper
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java
|
||||
|
|
|
@ -33,9 +33,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.ComponentLike;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
+import net.kyori.adventure.text.format.NamedTextColor;
|
||||
+import net.kyori.adventure.text.format.Style;
|
||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
+import net.minecraft.server.IChatBaseComponent;
|
||||
+import net.minecraft.server.ScoreboardTeam;
|
||||
+import org.bukkit.craftbukkit.CraftWorld;
|
||||
|
|
|
@ -145,4 +145,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
if(true) return net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(this.getHandle().adventure$displayName); // Paper
|
||||
if(true) return io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.serialize(this.getHandle().adventure$displayName); // Paper
|
||||
|
|
|
@ -40,7 +40,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
|
||||
@@ -0,0 +0,0 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
||||
if (adventure$title == null) adventure$title = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(container.getBukkitView().getTitle()); // Paper
|
||||
if (adventure$title == null) adventure$title = io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(container.getBukkitView().getTitle()); // Paper
|
||||
|
||||
//player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(container.windowId, windowType, CraftChatMessage.fromString(title)[0])); // Paper // Paper - comment
|
||||
- player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(container.windowId, windowType, io.papermc.paper.adventure.PaperAdventure.asVanilla(adventure$title))); // Paper
|
||||
|
@ -50,7 +50,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
}
|
||||
@@ -0,0 +0,0 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
||||
net.kyori.adventure.text.Component adventure$title = inventory.title(); // Paper
|
||||
if (adventure$title == null) adventure$title = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(inventory.getTitle()); // Paper
|
||||
if (adventure$title == null) adventure$title = io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(inventory.getTitle()); // Paper
|
||||
//player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(container.windowId, windowType, CraftChatMessage.fromString(title)[0])); // Paper - comment
|
||||
- player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(container.windowId, windowType, io.papermc.paper.adventure.PaperAdventure.asVanilla(adventure$title))); // Paper
|
||||
+ if (!player.isFrozen()) player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(container.windowId, windowType, io.papermc.paper.adventure.PaperAdventure.asVanilla(adventure$title))); // Paper
|
||||
|
|
|
@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
if (!gameprofilebanentry.hasExpired()) event.disallow(PlayerLoginEvent.Result.KICK_BANNED, PaperAdventure.asAdventure(chatmessage)); // Spigot // Paper - Adventure
|
||||
- } else if (!this.isWhitelisted(gameprofile)) {
|
||||
- chatmessage = new ChatMessage("multiplayer.disconnect.not_whitelisted");
|
||||
- event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(org.spigotmc.SpigotConfig.whitelistMessage)); // Spigot // Paper - Adventure
|
||||
- event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, PaperAdventure.LEGACY_SECTION_UXRC.deserialize(org.spigotmc.SpigotConfig.whitelistMessage)); // Spigot // Paper - Adventure
|
||||
+ } else if (!this.isWhitelisted(gameprofile, event)) { // Paper
|
||||
+ //chatmessage = new ChatMessage("multiplayer.disconnect.not_whitelisted"); // Paper
|
||||
+ //event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, org.spigotmc.SpigotConfig.whitelistMessage); // Spigot // Paper - moved to isWhitelisted
|
||||
|
@ -38,7 +38,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ event.callEvent();
|
||||
+ if (!event.isWhitelisted()) {
|
||||
+ if (loginEvent != null) {
|
||||
+ loginEvent.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(event.getKickMessage() == null ? org.spigotmc.SpigotConfig.whitelistMessage : event.getKickMessage()));
|
||||
+ loginEvent.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, PaperAdventure.LEGACY_SECTION_UXRC.deserialize(event.getKickMessage() == null ? org.spigotmc.SpigotConfig.whitelistMessage : event.getKickMessage()));
|
||||
+ }
|
||||
+ return false;
|
||||
+ }
|
||||
|
|
Loading…
Reference in a new issue