Adventure
== AT == public net.minecraft.network.chat.HoverEvent$ItemStackInfo item public net.minecraft.network.chat.HoverEvent$ItemStackInfo count public net.minecraft.network.chat.HoverEvent$ItemStackInfo components public net.minecraft.network.chat.contents.TranslatableContents filterAllowedArguments(Ljava/lang/Object;)Lcom/mojang/serialization/DataResult; Co-authored-by: zml <zml@stellardrift.ca> Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
This commit is contained in:
@@ -90,7 +90,7 @@ public final class CraftChatMessage {
|
||||
this.hex.append(c);
|
||||
|
||||
if (this.hex.length() == 7) {
|
||||
this.modifier = StringMessage.RESET.withColor(TextColor.parseColor(this.hex.toString()).result().get());
|
||||
this.modifier = StringMessage.RESET.withColor(TextColor.parseColor(this.hex.toString()).result().orElse(null)); // Paper
|
||||
this.hex = null;
|
||||
}
|
||||
} else if (format.isFormat() && format != ChatFormatting.RESET) {
|
||||
@@ -264,6 +264,7 @@ public final class CraftChatMessage {
|
||||
|
||||
public static String fromComponent(Component component) {
|
||||
if (component == null) return "";
|
||||
if (component instanceof io.papermc.paper.adventure.AdventureComponent) component = ((io.papermc.paper.adventure.AdventureComponent) component).deepConverted();
|
||||
StringBuilder out = new StringBuilder();
|
||||
|
||||
boolean hadFormat = false;
|
||||
|
||||
@@ -80,6 +80,43 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
|
||||
private CraftMagicNumbers() {}
|
||||
|
||||
// Paper start
|
||||
@Override
|
||||
public net.kyori.adventure.text.flattener.ComponentFlattener componentFlattener() {
|
||||
return io.papermc.paper.adventure.PaperAdventure.FLATTENER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public net.kyori.adventure.text.serializer.gson.GsonComponentSerializer colorDownsamplingGsonComponentSerializer() {
|
||||
return net.kyori.adventure.text.serializer.gson.GsonComponentSerializer.colorDownsamplingGson();
|
||||
}
|
||||
|
||||
@Override
|
||||
public net.kyori.adventure.text.serializer.gson.GsonComponentSerializer gsonComponentSerializer() {
|
||||
return net.kyori.adventure.text.serializer.gson.GsonComponentSerializer.gson();
|
||||
}
|
||||
|
||||
@Override
|
||||
public net.kyori.adventure.text.serializer.plain.PlainComponentSerializer plainComponentSerializer() {
|
||||
return io.papermc.paper.adventure.PaperAdventure.PLAIN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer plainTextSerializer() {
|
||||
return net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer.plainText();
|
||||
}
|
||||
|
||||
@Override
|
||||
public net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer legacyComponentSerializer() {
|
||||
return net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection();
|
||||
}
|
||||
|
||||
@Override
|
||||
public net.kyori.adventure.text.Component resolveWithContext(final net.kyori.adventure.text.Component component, final org.bukkit.command.CommandSender context, final org.bukkit.entity.Entity scoreboardSubject, final boolean bypassPermissions) throws IOException {
|
||||
return io.papermc.paper.adventure.PaperAdventure.resolveWithContext(component, context, scoreboardSubject, bypassPermissions);
|
||||
}
|
||||
// Paper end
|
||||
|
||||
public static BlockState getBlock(MaterialData material) {
|
||||
return CraftMagicNumbers.getBlock(material.getItemType(), material.getData());
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ public abstract class LazyHashSet<E> implements Set<E> {
|
||||
return this.reference = this.makeReference();
|
||||
}
|
||||
|
||||
abstract Set<E> makeReference();
|
||||
protected abstract Set<E> makeReference(); // Paper - protected
|
||||
|
||||
public boolean isLazy() {
|
||||
return this.reference == null;
|
||||
|
||||
@@ -16,9 +16,14 @@ public class LazyPlayerSet extends LazyHashSet<Player> {
|
||||
}
|
||||
|
||||
@Override
|
||||
HashSet<Player> makeReference() {
|
||||
protected HashSet<Player> makeReference() { // Paper - protected
|
||||
Preconditions.checkState(this.reference == null, "Reference already created!");
|
||||
List<ServerPlayer> players = this.server.getPlayerList().players;
|
||||
// Paper start
|
||||
return makePlayerSet(this.server);
|
||||
}
|
||||
public static HashSet<Player> makePlayerSet(final MinecraftServer server) {
|
||||
List<ServerPlayer> players = server.getPlayerList().players;
|
||||
// Paper end
|
||||
HashSet<Player> reference = new HashSet<Player>(players.size());
|
||||
for (ServerPlayer player : players) {
|
||||
reference.add(player.getBukkitEntity());
|
||||
|
||||
Reference in New Issue
Block a user