more work

This commit is contained in:
Noah van der Aa 2023-09-21 21:00:11 +02:00
parent 6a5bb6ffb8
commit d700351d49
6 changed files with 208 additions and 238 deletions

View file

@ -1666,28 +1666,31 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private static void resolveSignedMessage(Consumer<PlayerChatMessage> callback, CommandSourceStack source, PlayerChatMessage message) { private static void resolveSignedMessage(Consumer<PlayerChatMessage> callback, CommandSourceStack source, PlayerChatMessage message) {
MinecraftServer minecraftServer = source.getServer(); MinecraftServer minecraftServer = source.getServer();
CompletableFuture<FilteredText> completableFuture = filterPlainText(source, message); CompletableFuture<FilteredText> completableFuture = filterPlainText(source, message);
- CompletableFuture<Component> completableFuture2 = minecraftServer.getChatDecorator().decorate(source.getPlayer(), message.decoratedContent()); - Component component = minecraftServer.getChatDecorator().decorate(source.getPlayer(), message.decoratedContent());
+ CompletableFuture<net.minecraft.network.chat.ChatDecorator.Result> completableFuture2 = minecraftServer.getChatDecorator().decorate(source.getPlayer(), source, message.decoratedContent()); // Paper + CompletableFuture<ChatDecorator.Result> componentFuture = minecraftServer.getChatDecorator().decorate(source.getPlayer(), source, message.decoratedContent()); // Paper
source.getChatMessageChainer().append((executor) -> { source.getChatMessageChainer().append((executor) -> {
return CompletableFuture.allOf(completableFuture, completableFuture2).thenAcceptAsync((void_) -> { - return completableFuture.thenAcceptAsync((filtered) -> {
- PlayerChatMessage playerChatMessage2 = message.withUnsignedContent(completableFuture2.join()).filter(completableFuture.join().mask()); - PlayerChatMessage playerChatMessage2 = message.withUnsignedContent(component).filter(filtered.mask());
+ PlayerChatMessage playerChatMessage2 = message.withUnsignedContent(completableFuture2.join().component()).filter(completableFuture.join().mask()); // Paper + return CompletableFuture.allOf(completableFuture, componentFuture).thenAcceptAsync((filtered) -> {
+ PlayerChatMessage playerChatMessage2 = message.withUnsignedContent(componentFuture.join().component()).filter(completableFuture.join().mask()); // Paper
callback.accept(playerChatMessage2); callback.accept(playerChatMessage2);
}, executor); }, executor);
}); });
@@ -0,0 +0,0 @@ public class MessageArgument implements SignedArgument<MessageArgument.Message> @@ -0,0 +0,0 @@ public class MessageArgument implements SignedArgument<MessageArgument.Message>
private static void resolveDisguisedMessage(Consumer<PlayerChatMessage> callback, CommandSourceStack source, PlayerChatMessage message) { private static void resolveDisguisedMessage(Consumer<PlayerChatMessage> callback, CommandSourceStack source, PlayerChatMessage message) {
MinecraftServer minecraftServer = source.getServer(); ChatDecorator chatDecorator = source.getServer().getChatDecorator();
- CompletableFuture<Component> completableFuture = minecraftServer.getChatDecorator().decorate(source.getPlayer(), message.decoratedContent()); - Component component = chatDecorator.decorate(source.getPlayer(), message.decoratedContent());
+ CompletableFuture<net.minecraft.network.chat.ChatDecorator.Result> completableFuture = minecraftServer.getChatDecorator().decorate(source.getPlayer(), source, message.decoratedContent()); // Paper - callback.accept(message.withUnsignedContent(component));
source.getChatMessageChainer().append((executor) -> { + // Paper start
return completableFuture.thenAcceptAsync((content) -> { + CompletableFuture<ChatDecorator.Result> componentFuture = chatDecorator.decorate(source.getPlayer(), source, message.decoratedContent());
- callback.accept(message.withUnsignedContent(content)); + componentFuture.thenAcceptAsync((result) -> {
+ callback.accept(message.withUnsignedContent(content.component())); // Paper + callback.accept(message.withUnsignedContent(result.component()));
}, executor); + }, source.getServer().chatExecutor);
}); + // Paper end
} }
private static CompletableFuture<FilteredText> filterPlainText(CommandSourceStack source, PlayerChatMessage message) {
diff --git a/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java b/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java diff --git a/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java b/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java --- a/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java
@ -1705,16 +1708,8 @@ diff --git a/src/main/java/net/minecraft/network/FriendlyByteBuf.java b/src/main
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/network/FriendlyByteBuf.java --- a/src/main/java/net/minecraft/network/FriendlyByteBuf.java
+++ b/src/main/java/net/minecraft/network/FriendlyByteBuf.java +++ b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
@@ -0,0 +0,0 @@ import io.netty.handler.codec.EncoderException;
import io.netty.util.ByteProcessor;
import it.unimi.dsi.fastutil.ints.IntArrayList;
import it.unimi.dsi.fastutil.ints.IntList;
+import io.papermc.paper.adventure.PaperAdventure; // Paper
import java.io.DataOutput;
import java.io.IOException;
import java.io.InputStream;
@@ -0,0 +0,0 @@ public class FriendlyByteBuf extends ByteBuf { @@ -0,0 +0,0 @@ public class FriendlyByteBuf extends ByteBuf {
private static final int MAX_VARLONG_SIZE = 10;
public static final int DEFAULT_NBT_QUOTA = 2097152; public static final int DEFAULT_NBT_QUOTA = 2097152;
private final ByteBuf source; private final ByteBuf source;
+ public java.util.Locale adventure$locale; // Paper + public java.util.Locale adventure$locale; // Paper
@ -1727,14 +1722,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start + // Paper start
+ public FriendlyByteBuf writeComponent(final net.kyori.adventure.text.Component component) { + public FriendlyByteBuf writeComponent(final net.kyori.adventure.text.Component component) {
+ return this.writeUtf(PaperAdventure.asJsonString(component, this.adventure$locale), 262144); + return this.writeUtf(io.papermc.paper.adventure.PaperAdventure.asJsonString(component, this.adventure$locale), 262144);
+ } + }
+ // Paper end + // Paper end
+ +
public FriendlyByteBuf writeComponent(Component text) { public FriendlyByteBuf writeComponent(Component text) {
- return this.writeUtf(Component.Serializer.toJson(text), 262144); - return this.writeUtf(Component.Serializer.toJson(text), 262144);
+ //return this.a(IChatBaseComponent.ChatSerializer.a(ichatbasecomponent), 262144); // Paper - comment + //return this.a(IChatBaseComponent.ChatSerializer.a(ichatbasecomponent), 262144); // Paper - comment
+ return this.writeUtf(PaperAdventure.asJsonString(text, this.adventure$locale), 262144); // Paper + return this.writeUtf(io.papermc.paper.adventure.PaperAdventure.asJsonString(text, this.adventure$locale), 262144); // Paper
} }
public <T extends Enum<T>> T readEnum(Class<T> enumClass) { public <T extends Enum<T>> T readEnum(Class<T> enumClass) {
@ -1742,19 +1737,11 @@ diff --git a/src/main/java/net/minecraft/network/PacketEncoder.java b/src/main/j
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/network/PacketEncoder.java --- a/src/main/java/net/minecraft/network/PacketEncoder.java
+++ b/src/main/java/net/minecraft/network/PacketEncoder.java +++ b/src/main/java/net/minecraft/network/PacketEncoder.java
@@ -0,0 +0,0 @@ import com.mojang.logging.LogUtils;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;
+import io.papermc.paper.adventure.PaperAdventure; // Paper
import java.io.IOException;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.PacketFlow;
@@ -0,0 +0,0 @@ public class PacketEncoder extends MessageToByteEncoder<Packet<?>> { @@ -0,0 +0,0 @@ public class PacketEncoder extends MessageToByteEncoder<Packet<?>> {
} else { } else {
FriendlyByteBuf friendlyByteBuf = new FriendlyByteBuf(byteBuf); FriendlyByteBuf friendlyByteBuf = new FriendlyByteBuf(byteBuf);
friendlyByteBuf.writeVarInt(i); friendlyByteBuf.writeVarInt(i);
+ friendlyByteBuf.adventure$locale = channelHandlerContext.channel().attr(PaperAdventure.LOCALE_ATTRIBUTE).get(); // Paper + friendlyByteBuf.adventure$locale = channelHandlerContext.channel().attr(io.papermc.paper.adventure.PaperAdventure.LOCALE_ATTRIBUTE).get(); // Paper
try { try {
int j = friendlyByteBuf.writerIndex(); int j = friendlyByteBuf.writerIndex();
@ -1762,12 +1749,22 @@ diff --git a/src/main/java/net/minecraft/network/chat/ChatDecorator.java b/src/m
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/network/chat/ChatDecorator.java --- a/src/main/java/net/minecraft/network/chat/ChatDecorator.java
+++ b/src/main/java/net/minecraft/network/chat/ChatDecorator.java +++ b/src/main/java/net/minecraft/network/chat/ChatDecorator.java
@@ -0,0 +0,0 @@ public interface ChatDecorator { @@ -0,0 +0,0 @@ package net.minecraft.network.chat;
return CompletableFuture.completedFuture(message);
import javax.annotation.Nullable;
import net.minecraft.server.level.ServerPlayer;
+import java.util.concurrent.CompletableFuture; // Paper
@FunctionalInterface
public interface ChatDecorator {
ChatDecorator PLAIN = (sender, message) -> {
- return message;
+ return CompletableFuture.completedFuture(message); // Paper
}; };
- Component decorate(@Nullable ServerPlayer sender, Component message);
+ @io.papermc.paper.annotation.DoNotUse @Deprecated // Paper + @io.papermc.paper.annotation.DoNotUse @Deprecated // Paper
CompletableFuture<Component> decorate(@Nullable ServerPlayer sender, Component message); + CompletableFuture<Component> decorate(@Nullable ServerPlayer sender, Component message); // Paper - make a completable future again
+ +
+ // Paper start + // Paper start
+ default CompletableFuture<Result> decorate(@Nullable ServerPlayer sender, @Nullable net.minecraft.commands.CommandSourceStack commandSourceStack, Component message) { + default CompletableFuture<Result> decorate(@Nullable ServerPlayer sender, @Nullable net.minecraft.commands.CommandSourceStack commandSourceStack, Component message) {
@ -2159,7 +2156,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.SpigotTimings; // Spigot @@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.SpigotTimings; // Spigot
public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTask> implements CommandSource, AutoCloseable { public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTask> implements ServerInfo, CommandSource, AutoCloseable {
public static final Logger LOGGER = LogUtils.getLogger(); public static final Logger LOGGER = LogUtils.getLogger();
+ public static final net.kyori.adventure.text.logger.slf4j.ComponentLogger COMPONENT_LOGGER = net.kyori.adventure.text.logger.slf4j.ComponentLogger.logger(LOGGER.getName()); // Paper + public static final net.kyori.adventure.text.logger.slf4j.ComponentLogger COMPONENT_LOGGER = net.kyori.adventure.text.logger.slf4j.ComponentLogger.logger(LOGGER.getName()); // Paper
@ -2194,8 +2191,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
SpigotTimings.commandFunctionsTimer.startTiming(); // Spigot SpigotTimings.commandFunctionsTimer.startTiming(); // Spigot
this.getFunctions().tick(); this.getFunctions().tick();
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public abstract boolean isCommandBlockEnabled();
@Override
public String getMotd() { public String getMotd() {
- return this.motd; - return this.motd;
+ return net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(this.motd); // Paper - Adventure + return net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(this.motd); // Paper - Adventure
@ -2234,39 +2231,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
// CraftBukkit start - // CraftBukkit start
public final java.util.concurrent.ExecutorService chatExecutor = java.util.concurrent.Executors.newCachedThreadPool( public final java.util.concurrent.ExecutorService chatExecutor = java.util.concurrent.Executors.newCachedThreadPool(
- new com.google.common.util.concurrent.ThreadFactoryBuilder().setDaemon(true).setNameFormat("Async Chat Thread - #%d").build()); - new com.google.common.util.concurrent.ThreadFactoryBuilder().setDaemon(true).setNameFormat("Async Chat Thread - #%d").build());
- // CraftBukkit end
+ new com.google.common.util.concurrent.ThreadFactoryBuilder().setDaemon(true).setNameFormat("Async Chat Thread - #%d").setUncaughtExceptionHandler(new net.minecraft.DefaultUncaughtExceptionHandlerWithName(net.minecraft.server.MinecraftServer.LOGGER)).build()); // Paper + new com.google.common.util.concurrent.ThreadFactoryBuilder().setDaemon(true).setNameFormat("Async Chat Thread - #%d").setUncaughtExceptionHandler(new net.minecraft.DefaultUncaughtExceptionHandlerWithName(net.minecraft.server.MinecraftServer.LOGGER)).build()); // Paper
public ChatDecorator getChatDecorator() { public ChatDecorator getChatDecorator() {
- return (entityplayer, ichatbasecomponent) -> { - return ChatDecorator.PLAIN;
- // SPIGOT-7127: Console /say and similar - }
- if (entityplayer == null) {
- return CompletableFuture.completedFuture(ichatbasecomponent);
- }
- -
- return CompletableFuture.supplyAsync(() -> { - public boolean logIPs() {
- AsyncPlayerChatPreviewEvent event = new AsyncPlayerChatPreviewEvent(true, entityplayer.getBukkitEntity(), CraftChatMessage.fromComponent(ichatbasecomponent), new LazyPlayerSet(this)); - return true;
- String originalFormat = event.getFormat(), originalMessage = event.getMessage();
- this.server.getPluginManager().callEvent(event);
-
- if (originalFormat.equals(event.getFormat()) && originalMessage.equals(event.getMessage()) && event.getPlayer().getName().equalsIgnoreCase(event.getPlayer().getDisplayName())) {
- return ichatbasecomponent;
- }
-
- return CraftChatMessage.fromStringOrNull(String.format(event.getFormat(), event.getPlayer().getDisplayName(), event.getMessage()));
- }, chatExecutor);
- };
+ // Paper start - moved to ChatPreviewProcessor + // Paper start - moved to ChatPreviewProcessor
+ return ChatDecorator.create((sender, commandSourceStack, message) -> { + return ChatDecorator.create((sender, commandSourceStack, message) -> {
+ final io.papermc.paper.adventure.ChatDecorationProcessor processor = new io.papermc.paper.adventure.ChatDecorationProcessor(this, sender, commandSourceStack, message); + final io.papermc.paper.adventure.ChatDecorationProcessor processor = new io.papermc.paper.adventure.ChatDecorationProcessor(this, sender, commandSourceStack, message);
+ return processor.process(); + return processor.process();
+ }); + });
+ // Paper end + // Paper end
// CraftBukkit end
} }
public static record ReloadableResources(CloseableResourceManager resourceManager, ReloadableServerResources managers) implements AutoCloseable {
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
@ -2280,6 +2265,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.WeatherType; import org.bukkit.WeatherType;
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { @@ -0,0 +0,0 @@ public class ServerPlayer extends Player {
private boolean disconnected;
private int requestedViewDistance;
public String language = "en_us"; // CraftBukkit - default
+ public java.util.Locale adventure$locale = java.util.Locale.US; // Paper
@Nullable
private Vec3 startingToFallPosition;
@Nullable
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player {
// CraftBukkit start // CraftBukkit start
public String displayName; public String displayName;
@ -2354,28 +2347,93 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { @@ -0,0 +0,0 @@ public class ServerPlayer extends Player {
}
public String locale = "en_us"; // CraftBukkit - add, lowercase
+ public java.util.Locale adventure$locale = java.util.Locale.US; // Paper
public void updateOptions(ServerboundClientInformationPacket packet) {
// CraftBukkit start
if (getMainArm() != packet.mainHand()) {
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player {
this.server.server.getPluginManager().callEvent(event);
} }
this.locale = packet.language; // CraftBukkit end
this.language = clientOptions.language();
+ // Paper start + // Paper start
+ this.adventure$locale = net.kyori.adventure.translation.Translator.parseLocale(this.locale); + this.adventure$locale = net.kyori.adventure.translation.Translator.parseLocale(this.language);
+ this.connection.connection.channel.attr(PaperAdventure.LOCALE_ATTRIBUTE).set(this.adventure$locale); + this.connection.connection.channel.attr(PaperAdventure.LOCALE_ATTRIBUTE).set(this.adventure$locale);
+ // Paper end + // Paper end
this.clientViewDistance = packet.viewDistance; this.requestedViewDistance = clientOptions.viewDistance();
this.chatVisibility = clientOptions.chatVisibility();
this.canChatColor = clientOptions.chatColors();
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -0,0 +0,0 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
public static final int LATENCY_CHECK_INTERVAL = 15000;
private static final Component TIMEOUT_DISCONNECTION_MESSAGE = Component.translatable("disconnect.timeout");
protected final MinecraftServer server;
- protected final Connection connection;
+ public final Connection connection; // Paper
private long keepAliveTime;
private boolean keepAlivePending;
private long keepAliveChallenge;
@@ -0,0 +0,0 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
// CraftBukkit start
@Deprecated
- public void disconnect(Component reason) {
- this.disconnect(CraftChatMessage.fromComponent(reason));
+ public void disconnect(String s) { // Paper
+ this.disconnect(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(s)); // Paper
}
// CraftBukkit end
- public void disconnect(String s) {
+ // Paper start
+ public void disconnect(final Component reason) {
+ this.disconnect(io.papermc.paper.adventure.PaperAdventure.asAdventure(reason));
+ }
+
+ public void disconnect(net.kyori.adventure.text.Component reason) {
+ // Paper end
// CraftBukkit start - fire PlayerKickEvent
if (this.processedDisconnect) {
return;
@@ -0,0 +0,0 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
Waitable waitable = new Waitable() {
@Override
protected Object evaluate() {
- ServerCommonPacketListenerImpl.this.disconnect(s);
+ ServerCommonPacketListenerImpl.this.disconnect(reason); // Paper - adventure
return null;
}
};
@@ -0,0 +0,0 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
return;
}
- String leaveMessage = ChatFormatting.YELLOW + this.player.getScoreboardName() + " left the game.";
+ net.kyori.adventure.text.Component leaveMessage = net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? this.player.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(this.player.getScoreboardName())); // Paper - Adventure
- PlayerKickEvent event = new PlayerKickEvent(this.player.getBukkitEntity(), s, leaveMessage);
+ PlayerKickEvent event = new PlayerKickEvent(this.player.getBukkitEntity(), reason, leaveMessage); // Paper - adventure
if (this.cserver.getServer().isRunning()) {
this.cserver.getPluginManager().callEvent(event);
@@ -0,0 +0,0 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
}
this.player.kickLeaveMessage = event.getLeaveMessage(); // CraftBukkit - SPIGOT-3034: Forward leave message to PlayerQuitEvent
// Send the possibly modified leave message
- final Component ichatbasecomponent = CraftChatMessage.fromString(event.getReason(), true)[0];
+ final Component ichatbasecomponent = io.papermc.paper.adventure.PaperAdventure.asVanilla(event.reason()); // Paper - Adventure
// CraftBukkit end // CraftBukkit end
this.chatVisibility = packet.chatVisibility();
this.connection.send(new ClientboundDisconnectPacket(ichatbasecomponent), PacketSendListener.thenRun(() -> {
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -0,0 +0,0 @@ import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.StringTag;
import net.minecraft.network.Connection;
import net.minecraft.network.TickablePacketListener;
+import net.minecraft.network.chat.ChatDecorator;
import net.minecraft.network.chat.ChatType;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.LastSeenMessages;
@@ -0,0 +0,0 @@ import net.minecraft.world.phys.shapes.VoxelShape; @@ -0,0 +0,0 @@ import net.minecraft.world.phys.shapes.VoxelShape;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -2385,70 +2443,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
import com.mojang.datafixers.util.Pair; import com.mojang.datafixers.util.Pair;
import java.util.Arrays; import java.util.Arrays;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
private static final int NO_BLOCK_UPDATES_TO_ACK = -1;
private static final int TRACKED_MESSAGE_DISCONNECT_THRESHOLD = 4096;
private static final Component CHAT_VALIDATION_FAILED = Component.translatable("multiplayer.disconnect.chat_validation_failed");
- private final Connection connection;
+ public final Connection connection; // Paper
private final MinecraftServer server;
public ServerPlayer player;
private int tickCount;
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
return this.server.isSingleplayerOwner(this.player.getGameProfile());
}
- // CraftBukkit start
- @Deprecated
- public void disconnect(Component reason) {
- this.disconnect(CraftChatMessage.fromComponent(reason));
+ public void disconnect(String s) {
+ // Paper start
+ this.disconnect(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(s));
}
- // CraftBukkit end
- public void disconnect(String s) {
+ public void disconnect(final Component reason) {
+ this.disconnect(PaperAdventure.asAdventure(reason));
+ }
+
+ public void disconnect(net.kyori.adventure.text.Component reason) {
+ // Paper end
// CraftBukkit start - fire PlayerKickEvent
if (this.processedDisconnect) {
return;
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
Waitable waitable = new Waitable() {
@Override
protected Object evaluate() {
- ServerGamePacketListenerImpl.this.disconnect(s);
+ ServerGamePacketListenerImpl.this.disconnect(reason); // Paper - adventure
return null;
}
};
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
return;
}
- String leaveMessage = ChatFormatting.YELLOW + this.player.getScoreboardName() + " left the game.";
+ net.kyori.adventure.text.Component leaveMessage = net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? this.player.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(this.player.getScoreboardName())); // Paper - Adventure
- PlayerKickEvent event = new PlayerKickEvent(this.player.getBukkitEntity(), s, leaveMessage);
+ PlayerKickEvent event = new PlayerKickEvent(this.player.getBukkitEntity(), reason, leaveMessage); // Paper - Adventure
if (this.cserver.getServer().isRunning()) {
this.cserver.getPluginManager().callEvent(event);
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
}
this.player.kickLeaveMessage = event.getLeaveMessage(); // CraftBukkit - SPIGOT-3034: Forward leave message to PlayerQuitEvent
// Send the possibly modified leave message
- final Component ichatbasecomponent = CraftChatMessage.fromString(event.getReason(), true)[0];
+ final Component ichatbasecomponent = PaperAdventure.asVanilla(event.reason()); // Paper - Adventure
// CraftBukkit end
this.connection.send(new ClientboundDisconnectPacket(ichatbasecomponent), PacketSendListener.thenRun(() -> {
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
*/ */
this.player.disconnect(); this.player.disconnect();
@ -2463,21 +2458,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
// CraftBukkit end // CraftBukkit end
this.player.getTextFilter().leave(); this.player.getTextFilter().leave();
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
}
CompletableFuture<FilteredText> completablefuture = this.filterTextPacket(playerchatmessage.signedContent()); CompletableFuture<FilteredText> completablefuture = this.filterTextPacket(playerchatmessage.signedContent());
- CompletableFuture<Component> completablefuture1 = this.server.getChatDecorator().decorate(this.player, playerchatmessage.decoratedContent()); Component ichatbasecomponent = this.server.getChatDecorator().decorate(this.player, playerchatmessage.decoratedContent());
+ CompletableFuture<net.minecraft.network.chat.ChatDecorator.Result> completablefuture1 = this.server.getChatDecorator().decorate(this.player, null, playerchatmessage.decoratedContent()); // Paper
+ CompletableFuture<ChatDecorator.Result> componentFuture = this.server.getChatDecorator().decorate(this.player, null, playerchatmessage.decoratedContent()); // Paper
this.chatMessageChain.append((executor) -> { this.chatMessageChain.append((executor) -> {
return CompletableFuture.allOf(completablefuture, completablefuture1).thenAcceptAsync((ovoid) -> { - return completablefuture.thenAcceptAsync((filteredtext) -> {
- PlayerChatMessage playerchatmessage1 = playerchatmessage.withUnsignedContent((Component) completablefuture1.join()).filter(((FilteredText) completablefuture.join()).mask()); - PlayerChatMessage playerchatmessage1 = playerchatmessage.withUnsignedContent(ichatbasecomponent).filter(filteredtext.mask());
+ PlayerChatMessage playerchatmessage1 = playerchatmessage.filter(((FilteredText) completablefuture.join()).mask()).withResult(completablefuture1.join()); // Paper -
+ return CompletableFuture.allOf(completablefuture, componentFuture).thenAcceptAsync((filtered) -> { // Paper
+ PlayerChatMessage playerchatmessage1 = playerchatmessage.withUnsignedContent(componentFuture.join().component()).filter(completablefuture.join().mask()); // Paper
this.broadcastChatMessage(playerchatmessage1); this.broadcastChatMessage(playerchatmessage1);
}, this.server.chatExecutor); // CraftBukkit - async chat }, this.server.chatExecutor); // CraftBukkit - async chat
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic });
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
Optional<LastSeenMessages> optional = this.unpackAndApplyLastSeen(acknowledgment); Optional<LastSeenMessages> optional = this.unpackAndApplyLastSeen(acknowledgment);
if (this.player.isRemoved() || this.player.getChatVisibility() == ChatVisiblity.HIDDEN) { // CraftBukkit - dead men tell no tales if (this.player.isRemoved() || this.player.getChatVisibility() == ChatVisiblity.HIDDEN) { // CraftBukkit - dead men tell no tales
@ -2486,7 +2481,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return Optional.empty(); return Optional.empty();
} else { } else {
this.player.resetLastActionTime(); this.player.resetLastActionTime();
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.handleCommand(s); this.handleCommand(s);
} else if (this.player.getChatVisibility() == ChatVisiblity.SYSTEM) { } else if (this.player.getChatVisibility() == ChatVisiblity.SYSTEM) {
// Do nothing, this is coming from a plugin // Do nothing, this is coming from a plugin
@ -2498,9 +2493,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper end + // Paper end
+ } else if (false) { // Paper + } else if (false) { // Paper
Player player = this.getCraftPlayer(); Player player = this.getCraftPlayer();
AsyncPlayerChatEvent event = new AsyncPlayerChatEvent(async, player, s, new LazyPlayerSet(this.server)); AsyncPlayerChatEvent event = new AsyncPlayerChatEvent(async, player, s, new LazyPlayerSet(server));
String originalFormat = event.getFormat(), originalMessage = event.getMessage(); String originalFormat = event.getFormat(), originalMessage = event.getMessage();
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
} }
}); });
} else if (this.player.getChatVisibility() == ChatVisiblity.SYSTEM) { // Re-add "Command Only" flag check } else if (this.player.getChatVisibility() == ChatVisiblity.SYSTEM) { // Re-add "Command Only" flag check
@ -2554,14 +2549,6 @@ diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/ma
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -0,0 +0,0 @@ import com.mojang.logging.LogUtils;
import com.mojang.serialization.DataResult;
import com.mojang.serialization.Dynamic;
import io.netty.buffer.Unpooled;
+import io.papermc.paper.adventure.PaperAdventure;
import java.io.File;
import java.net.SocketAddress;
import java.nio.file.Path;
@@ -0,0 +0,0 @@ public abstract class PlayerList { @@ -0,0 +0,0 @@ public abstract class PlayerList {
} }
// CraftBukkit start // CraftBukkit start
@ -2576,7 +2563,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
player.containerMenu.transferTo(player.containerMenu, bukkitPlayer); player.containerMenu.transferTo(player.containerMenu, bukkitPlayer);
- PlayerJoinEvent playerJoinEvent = new PlayerJoinEvent(bukkitPlayer, joinMessage); - PlayerJoinEvent playerJoinEvent = new PlayerJoinEvent(bukkitPlayer, joinMessage);
+ PlayerJoinEvent playerJoinEvent = new PlayerJoinEvent(bukkitPlayer, PaperAdventure.asAdventure(ichatmutablecomponent)); // Paper - Adventure + PlayerJoinEvent playerJoinEvent = new PlayerJoinEvent(bukkitPlayer, io.papermc.paper.adventure.PaperAdventure.asAdventure(ichatmutablecomponent)); // Paper - Adventure
this.cserver.getPluginManager().callEvent(playerJoinEvent); this.cserver.getPluginManager().callEvent(playerJoinEvent);
if (!player.connection.isAcceptingMessages()) { if (!player.connection.isAcceptingMessages()) {
@ -2591,7 +2578,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- this.server.getPlayerList().broadcastSystemMessage(line, false); - this.server.getPlayerList().broadcastSystemMessage(line, false);
- } - }
+ if (jm != null && !jm.equals(net.kyori.adventure.text.Component.empty())) { // Paper - Adventure + if (jm != null && !jm.equals(net.kyori.adventure.text.Component.empty())) { // Paper - Adventure
+ joinMessage = PaperAdventure.asVanilla(jm); // Paper - Adventure + joinMessage = io.papermc.paper.adventure.PaperAdventure.asVanilla(jm); // Paper - Adventure
+ this.server.getPlayerList().broadcastSystemMessage(joinMessage, false); // Paper - Adventure + this.server.getPlayerList().broadcastSystemMessage(joinMessage, false); // Paper - Adventure
} }
// CraftBukkit end // CraftBukkit end
@ -2610,7 +2597,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
- PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(entityplayer.getBukkitEntity(), entityplayer.kickLeaveMessage != null ? entityplayer.kickLeaveMessage : "\u00A7e" + entityplayer.getScoreboardName() + " left the game"); - PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(entityplayer.getBukkitEntity(), entityplayer.kickLeaveMessage != null ? entityplayer.kickLeaveMessage : "\u00A7e" + entityplayer.getScoreboardName() + " left the game");
+ PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(entityplayer.getBukkitEntity(), net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? entityplayer.getBukkitEntity().displayName() : PaperAdventure.asAdventure(entityplayer.getDisplayName()))); // Paper - Adventure + PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(entityplayer.getBukkitEntity(), net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? entityplayer.getBukkitEntity().displayName() : io.papermc.paper.adventure.PaperAdventure.asAdventure(entityplayer.getDisplayName()))); // Paper - Adventure
this.cserver.getPluginManager().callEvent(playerQuitEvent); this.cserver.getPluginManager().callEvent(playerQuitEvent);
entityplayer.getBukkitEntity().disconnect(playerQuitEvent.getQuitMessage()); entityplayer.getBukkitEntity().disconnect(playerQuitEvent.getQuitMessage());
@ -2628,7 +2615,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// return chatmessage; // return chatmessage;
- event.disallow(PlayerLoginEvent.Result.KICK_BANNED, CraftChatMessage.fromComponent(ichatmutablecomponent)); - event.disallow(PlayerLoginEvent.Result.KICK_BANNED, CraftChatMessage.fromComponent(ichatmutablecomponent));
+ event.disallow(PlayerLoginEvent.Result.KICK_BANNED, PaperAdventure.asAdventure(ichatmutablecomponent)); // Paper - Adventure + event.disallow(PlayerLoginEvent.Result.KICK_BANNED, io.papermc.paper.adventure.PaperAdventure.asAdventure(ichatmutablecomponent)); // Paper - Adventure
} else if (!this.isWhiteListed(gameprofile)) { } else if (!this.isWhiteListed(gameprofile)) {
ichatmutablecomponent = Component.translatable("multiplayer.disconnect.not_whitelisted"); ichatmutablecomponent = Component.translatable("multiplayer.disconnect.not_whitelisted");
- event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, org.spigotmc.SpigotConfig.whitelistMessage); // Spigot - event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, org.spigotmc.SpigotConfig.whitelistMessage); // Spigot
@ -2641,7 +2628,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// return chatmessage; // return chatmessage;
- event.disallow(PlayerLoginEvent.Result.KICK_BANNED, CraftChatMessage.fromComponent(ichatmutablecomponent)); - event.disallow(PlayerLoginEvent.Result.KICK_BANNED, CraftChatMessage.fromComponent(ichatmutablecomponent));
+ event.disallow(PlayerLoginEvent.Result.KICK_BANNED, PaperAdventure.asAdventure(ichatmutablecomponent)); // Paper - Adventure + event.disallow(PlayerLoginEvent.Result.KICK_BANNED, io.papermc.paper.adventure.PaperAdventure.asAdventure(ichatmutablecomponent)); // Paper - Adventure
} else { } else {
// return this.players.size() >= this.maxPlayers && !this.canBypassPlayerLimit(gameprofile) ? IChatBaseComponent.translatable("multiplayer.disconnect.server_full") : null; // return this.players.size() >= this.maxPlayers && !this.canBypassPlayerLimit(gameprofile) ? IChatBaseComponent.translatable("multiplayer.disconnect.server_full") : null;
if (this.players.size() >= this.maxPlayers && !this.canBypassPlayerLimit(gameprofile)) { if (this.players.size() >= this.maxPlayers && !this.canBypassPlayerLimit(gameprofile)) {
@ -2653,7 +2640,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.cserver.getPluginManager().callEvent(event); this.cserver.getPluginManager().callEvent(event);
if (event.getResult() != PlayerLoginEvent.Result.ALLOWED) { if (event.getResult() != PlayerLoginEvent.Result.ALLOWED) {
- loginlistener.disconnect(event.getKickMessage()); - loginlistener.disconnect(event.getKickMessage());
+ loginlistener.disconnect(PaperAdventure.asVanilla(event.kickMessage())); // Paper - Adventure + loginlistener.disconnect(io.papermc.paper.adventure.PaperAdventure.asVanilla(event.kickMessage())); // Paper - Adventure
return null; return null;
} }
return entity; return entity;
@ -3141,7 +3128,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBeacon.java --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBeacon.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBeacon.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBeacon.java
@@ -0,0 +0,0 @@ public class CraftBeacon extends CraftBlockEntityState<BeaconBlockEntity> implem @@ -0,0 +0,0 @@ public class CraftBeacon extends CraftBlockEntityState<BeaconBlockEntity> implem
this.getSnapshot().secondaryPower = (effect != null) ? MobEffect.byId(effect.getId()) : null; this.getSnapshot().secondaryPower = (effect != null) ? CraftPotionEffectType.bukkitToMinecraft(effect) : null;
} }
+ // Paper start + // Paper start
@ -3847,7 +3834,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
Preconditions.checkState(this.channels.size() < 128, "Cannot register channel '%s'. Too many channels registered!", channel); Preconditions.checkState(this.channels.size() < 128, "Cannot register channel '%s'. Too many channels registered!", channel);
channel = StandardMessenger.validateAndCorrectChannel(channel); channel = StandardMessenger.validateAndCorrectChannel(channel);
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return (this.getHandle().clientViewDistance == null) ? Bukkit.getViewDistance() : this.getHandle().clientViewDistance; return (this.getHandle().requestedViewDistance() == 0) ? Bukkit.getViewDistance() : this.getHandle().requestedViewDistance();
} }
+ // Paper start + // Paper start
@ -3858,7 +3845,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper end + // Paper end
@Override @Override
public int getPing() { public int getPing() {
return this.getHandle().latency; return this.getHandle().connection.latency();
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return this.getHandle().allowsListing(); return this.getHandle().allowsListing();
} }
@ -4153,10 +4140,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class CraftEventFactory { @@ -0,0 +0,0 @@ public class CraftEventFactory {
* Server methods * Server methods
*/ */
public static ServerListPingEvent callServerListPingEvent(Server craftServer, InetAddress address, String motd, int numPlayers, int maxPlayers) { public static ServerListPingEvent callServerListPingEvent(SocketAddress address, String motd, int numPlayers, int maxPlayers) {
- ServerListPingEvent event = new ServerListPingEvent("", address, motd, numPlayers, maxPlayers); - ServerListPingEvent event = new ServerListPingEvent("", ((InetSocketAddress) address).getAddress(), motd, numPlayers, maxPlayers);
+ ServerListPingEvent event = new ServerListPingEvent("", address, craftServer.motd(), numPlayers, maxPlayers); // Paper - Adventure + ServerListPingEvent event = new ServerListPingEvent("", ((InetSocketAddress) address).getAddress(), Bukkit.getServer().motd(), numPlayers, maxPlayers);
craftServer.getPluginManager().callEvent(event); Bukkit.getServer().getPluginManager().callEvent(event);
return event; return event;
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java
@ -4739,8 +4726,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
MapDecoration decoration = worldMap.decorations.get(key); MapDecoration decoration = worldMap.decorations.get(key);
- cursors.addCursor(decoration.getX(), decoration.getY(), (byte) (decoration.getRot() & 15), decoration.getType().getIcon(), true, CraftChatMessage.fromComponent(decoration.getName())); - cursors.addCursor(decoration.x(), decoration.y(), (byte) (decoration.rot() & 15), decoration.type().getIcon(), true, CraftChatMessage.fromComponent(decoration.name()));
+ cursors.addCursor(decoration.getX(), decoration.getY(), (byte) (decoration.getRot() & 15), decoration.getType().getIcon(), true, decoration.getName() == null ? null : io.papermc.paper.adventure.PaperAdventure.asAdventure(decoration.getName())); // Paper + cursors.addCursor(decoration.x(), decoration.y(), (byte) (decoration.rot() & 15), decoration.type().getIcon(), true, decoration.getName() == null ? null : io.papermc.paper.adventure.PaperAdventure.asAdventure(decoration.getName())); // Paper
} }
} }

View file

@ -5529,14 +5529,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/network/PacketEncoder.java --- a/src/main/java/net/minecraft/network/PacketEncoder.java
+++ b/src/main/java/net/minecraft/network/PacketEncoder.java +++ b/src/main/java/net/minecraft/network/PacketEncoder.java
@@ -0,0 +0,0 @@ public class PacketEncoder extends MessageToByteEncoder<Packet<?>> { @@ -0,0 +0,0 @@ public class PacketEncoder extends MessageToByteEncoder<Packet<?>> {
JvmProfiler.INSTANCE.onPacketSent(l, i, channelHandlerContext.channel().remoteAddress(), k);
} JvmProfiler.INSTANCE.onPacketSent(codecData.protocol(), i, channelHandlerContext.channel().remoteAddress(), k);
} catch (Throwable var10) { } catch (Throwable var13) {
- LOGGER.error("Error receiving packet {}", i, var10); - LOGGER.error("Error receiving packet {}", i, var13);
+ LOGGER.error("Packet encoding of packet ID {} threw (skippable? {})", i, packet.isSkippable(), var10); // Paper - Give proper error message + LOGGER.error("Packet encoding of packet ID {} threw (skippable? {})", i, packet.isSkippable(), var13); // Paper - Give proper error message
if (packet.isSkippable()) { if (packet.isSkippable()) {
throw new SkipPacketException(var10); throw new SkipPacketException(var13);
} else { }
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
@ -5606,8 +5606,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Nullable @Nullable
private final DebugBuffer<ChunkHolder.ChunkSaveDebug> chunkToSaveHistory; private final DebugBuffer<ChunkHolder.ChunkSaveDebug> chunkToSaveHistory;
@@ -0,0 +0,0 @@ public class ChunkHolder { @@ -0,0 +0,0 @@ public class ChunkHolder {
private boolean wasAccessibleSinceLastSave;
private CompletableFuture<Void> pendingFullStateConfirmation; private CompletableFuture<Void> pendingFullStateConfirmation;
private CompletableFuture<?> sendSync;
+ private final ChunkMap chunkMap; // Paper + private final ChunkMap chunkMap; // Paper
+ +
@ -5835,14 +5835,6 @@ diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/j
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -0,0 +0,0 @@ import net.minecraft.network.protocol.game.ClientboundSetChunkCacheCenterPacket;
import net.minecraft.network.protocol.game.ClientboundSetEntityLinkPacket;
import net.minecraft.network.protocol.game.ClientboundSetPassengersPacket;
import net.minecraft.network.protocol.game.DebugPackets;
+import io.papermc.paper.util.MCUtil;
import net.minecraft.server.level.progress.ChunkProgressListener;
import net.minecraft.server.network.ServerPlayerConnection;
import net.minecraft.util.CsvOutput;
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}; };
// CraftBukkit end // CraftBukkit end
@ -5851,8 +5843,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ private final com.destroystokyo.paper.util.misc.PooledLinkedHashSets<ServerPlayer> pooledLinkedPlayerHashSets = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets<>(); + private final com.destroystokyo.paper.util.misc.PooledLinkedHashSets<ServerPlayer> pooledLinkedPlayerHashSets = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets<>();
+ +
+ void addPlayerToDistanceMaps(ServerPlayer player) { + void addPlayerToDistanceMaps(ServerPlayer player) {
+ int chunkX = MCUtil.getChunkCoordinate(player.getX()); + int chunkX = io.papermc.paper.util.MCUtil.getChunkCoordinate(player.getX());
+ int chunkZ = MCUtil.getChunkCoordinate(player.getZ()); + int chunkZ = io.papermc.paper.util.MCUtil.getChunkCoordinate(player.getZ());
+ // Note: players need to be explicitly added to distance maps before they can be updated + // Note: players need to be explicitly added to distance maps before they can be updated
+ } + }
+ +
@ -5861,8 +5853,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ +
+ void updateMaps(ServerPlayer player) { + void updateMaps(ServerPlayer player) {
+ int chunkX = MCUtil.getChunkCoordinate(player.getX()); + int chunkX = io.papermc.paper.util.MCUtil.getChunkCoordinate(player.getX());
+ int chunkZ = MCUtil.getChunkCoordinate(player.getZ()); + int chunkZ = io.papermc.paper.util.MCUtil.getChunkCoordinate(player.getZ());
+ // Note: players need to be explicitly added to distance maps before they can be updated + // Note: players need to be explicitly added to distance maps before they can be updated
+ } + }
+ // Paper end + // Paper end
@ -5903,7 +5895,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.overworldDataStorage = persistentStateManagerFactory; this.overworldDataStorage = persistentStateManagerFactory;
this.poiManager = new PoiManager(path.resolve("poi"), dataFixer, dsync, iregistrycustom, world); this.poiManager = new PoiManager(path.resolve("poi"), dataFixer, dsync, iregistrycustom, world);
this.setViewDistance(viewDistance); this.setServerViewDistance(viewDistance);
+ // Paper start + // Paper start
+ this.dataRegionManager = new io.papermc.paper.chunk.SingleThreadChunkRegionManager(this.level, 2, (1.0 / 3.0), 1, 6, "Data", DataRegionData::new, DataRegionSectionData::new); + this.dataRegionManager = new io.papermc.paper.chunk.SingleThreadChunkRegionManager(this.level, 2, (1.0 / 3.0), 1, 6, "Data", DataRegionData::new, DataRegionSectionData::new);
+ this.regionManagers.add(this.dataRegionManager); + this.regionManagers.add(this.dataRegionManager);
@ -5958,8 +5950,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
protected void saveAllChunks(boolean flush) { protected void saveAllChunks(boolean flush) {
if (flush) { if (flush) {
- List<ChunkHolder> list = (List) this.visibleChunkMap.values().stream().filter(ChunkHolder::wasAccessibleSinceLastSave).peek(ChunkHolder::refreshAccessibility).collect(Collectors.toList()); - List<ChunkHolder> list = this.visibleChunkMap.values().stream().filter(ChunkHolder::wasAccessibleSinceLastSave).peek(ChunkHolder::refreshAccessibility).toList();
+ List<ChunkHolder> list = (List) io.papermc.paper.chunk.system.ChunkSystem.getVisibleChunkHolders(this.level).stream().filter(ChunkHolder::wasAccessibleSinceLastSave).peek(ChunkHolder::refreshAccessibility).collect(Collectors.toList()); // Paper + List<ChunkHolder> list = io.papermc.paper.chunk.system.ChunkSystem.getVisibleChunkHolders(this.level).stream().filter(ChunkHolder::wasAccessibleSinceLastSave).peek(ChunkHolder::refreshAccessibility).toList(); // Paper
MutableBoolean mutableboolean = new MutableBoolean(); MutableBoolean mutableboolean = new MutableBoolean();
do { do {
@ -6023,15 +6015,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
}; };
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.viewDistance = j;
this.distanceManager.updatePlayerTickets(this.viewDistance);
- ObjectIterator objectiterator = this.updatingChunkMap.values().iterator();
+ Iterator objectiterator = io.papermc.paper.chunk.system.ChunkSystem.getUpdatingChunkHolders(this.level).iterator(); // Paper
while (objectiterator.hasNext()) {
ChunkHolder playerchunk = (ChunkHolder) objectiterator.next();
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
} }
public int size() { public int size() {
@ -6066,30 +6049,31 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
Optional<LevelChunk> optional1 = optional.flatMap((ichunkaccess) -> { Optional<LevelChunk> optional1 = optional.flatMap((ichunkaccess) -> {
return ichunkaccess instanceof LevelChunk ? Optional.of((LevelChunk) ichunkaccess) : Optional.empty(); return ichunkaccess instanceof LevelChunk ? Optional.of((LevelChunk) ichunkaccess) : Optional.empty();
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
if (!flag1) {
this.distanceManager.addPlayer(SectionPos.of((EntityAccess) player), player); player.setChunkTrackingView(ChunkTrackingView.EMPTY);
} this.updateChunkTracking(player);
+ this.addPlayerToDistanceMaps(player); // Paper - distance maps + this.addPlayerToDistanceMaps(player); // Paper - distance maps
} else { } else {
SectionPos sectionposition = player.getLastSectionPos(); SectionPos sectionposition = player.getLastSectionPos();
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
if (!flag2) {
this.distanceManager.removePlayer(sectionposition, player); this.distanceManager.removePlayer(sectionposition, player);
} }
+ this.removePlayerFromDistanceMaps(player); // Paper - distance maps + this.removePlayerFromDistanceMaps(player); // Paper - distance maps
+ }
+
this.applyChunkTrackingView(player, ChunkTrackingView.EMPTY);
} }
for (int k = i - this.viewDistance - 1; k <= i + this.viewDistance + 1; ++k) {
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
} this.updateChunkTracking(player);
} }
+ this.updateMaps(player); // Paper - distance maps + this.updateMaps(player); // Paper - distance maps
+
} }
@Override private void updateChunkTracking(ServerPlayer player) {
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
private class ChunkDistanceManager extends DistanceManager { private class ChunkDistanceManager extends DistanceManager {
@ -6567,17 +6551,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { @@ -0,0 +0,0 @@ public class ServerPlayer extends Player {
public Integer clientViewDistance; public boolean sentListPacket = false;
public String kickLeaveMessage = null; // SPIGOT-3034: Forward leave message to PlayerQuitEvent public String kickLeaveMessage = null; // SPIGOT-3034: Forward leave message to PlayerQuitEvent
// CraftBukkit end // CraftBukkit end
+ public boolean isRealPlayer; // Paper + public boolean isRealPlayer; // Paper
+ public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper + public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper
public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile) { public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile, ClientInformation clientOptions) {
super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile); super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile);
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { @@ -0,0 +0,0 @@ public class ServerPlayer extends Player {
this.setMaxUpStep(1.0F);
this.fudgeSpawnLocation(world); this.fudgeSpawnLocation(world);
this.updateOptions(clientOptions);
+ this.cachedSingleHashSet = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<>(this); // Paper + this.cachedSingleHashSet = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<>(this); // Paper
+ +
@ -6634,7 +6618,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public abstract class PlayerList { @@ -0,0 +0,0 @@ public abstract class PlayerList {
} }
public void placeNewPlayer(Connection connection, ServerPlayer player) { public void placeNewPlayer(Connection connection, ServerPlayer player, CommonListenerCookie clientData) {
+ player.isRealPlayer = true; // Paper + player.isRealPlayer = true; // Paper
GameProfile gameprofile = player.getGameProfile(); GameProfile gameprofile = player.getGameProfile();
GameProfileCache usercache = this.server.getProfileCache(); GameProfileCache usercache = this.server.getProfileCache();

View file

@ -723,26 +723,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/network/protocol/PacketUtils.java +++ b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
@@ -0,0 +0,0 @@ public class PacketUtils { @@ -0,0 +0,0 @@ public class PacketUtils {
engine.executeIfPossible(() -> { engine.executeIfPossible(() -> {
if (MinecraftServer.getServer().hasStopped() || (listener instanceof ServerGamePacketListenerImpl && ((ServerGamePacketListenerImpl) listener).processedDisconnect)) return; // CraftBukkit, MC-142590 if (MinecraftServer.getServer().hasStopped() || (listener instanceof ServerCommonPacketListenerImpl && ((ServerCommonPacketListenerImpl) listener).processedDisconnect)) return; // CraftBukkit, MC-142590
if (listener.isAcceptingMessages()) { if (listener.shouldHandleMessage(packet)) {
- try { - try {
+ co.aikar.timings.Timing timing = co.aikar.timings.MinecraftTimings.getPacketTiming(packet); // Paper - timings + co.aikar.timings.Timing timing = co.aikar.timings.MinecraftTimings.getPacketTiming(packet); // Paper - timings
+ try (co.aikar.timings.Timing ignored = timing.startTiming()) { // Paper - timings + try (co.aikar.timings.Timing ignored = timing.startTiming()) { // Paper - timings
packet.handle(listener); packet.handle(listener);
} catch (Exception exception) { } catch (Exception exception) {
if (listener.shouldPropagateHandlingExceptions()) { if (exception instanceof ReportedException) {
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -0,0 +0,0 @@ import org.bukkit.event.player.AsyncPlayerChatPreviewEvent; @@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.Main;
import org.bukkit.event.server.ServerLoadEvent; import org.bukkit.event.server.ServerLoadEvent;
// CraftBukkit end // CraftBukkit end
-import org.bukkit.craftbukkit.SpigotTimings; // Spigot -import org.bukkit.craftbukkit.SpigotTimings; // Spigot
+import co.aikar.timings.MinecraftTimings; // Paper +import co.aikar.timings.MinecraftTimings; // Paper
public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTask> implements CommandSource, AutoCloseable { public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTask> implements ServerInfo, CommandSource, AutoCloseable {
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} }
@ -775,7 +775,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.runAllTasks(); this.runAllTasks();
java.util.concurrent.locks.LockSupport.parkNanos("executing tasks", 1000L); java.util.concurrent.locks.LockSupport.parkNanos("executing tasks", 1000L);
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// CraftBukkit end }
protected void waitUntilNextTick() { protected void waitUntilNextTick() {
- this.runAllTasks(); - this.runAllTasks();
@ -827,7 +827,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
long j = this.tickTimes[this.tickCount % 100] = Util.getNanos() - i; long j = this.tickTimes[this.tickCount % 100] = Util.getNanos() - i;
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.frameTimer.logFrameDuration(k - i); this.logTickTime(k - i);
this.profiler.pop(); this.profiler.pop();
org.spigotmc.WatchdogThread.tick(); // Spigot org.spigotmc.WatchdogThread.tick(); // Spigot
- SpigotTimings.serverTickTimer.stopTiming(); // Spigot - SpigotTimings.serverTickTimer.stopTiming(); // Spigot
@ -835,11 +835,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ co.aikar.timings.TimingsManager.FULL_SERVER_TICK.stopTiming(); // Paper + co.aikar.timings.TimingsManager.FULL_SERVER_TICK.stopTiming(); // Paper
} }
private ServerStatus buildServerStatus() { protected void logTickTime(long nanos) {}
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} this.getPlayerList().getPlayers().forEach((entityplayer) -> {
entityplayer.connection.suspendFlushing();
public void tickChildren(BooleanSupplier shouldKeepTicking) { });
- SpigotTimings.schedulerTimer.startTiming(); // Spigot - SpigotTimings.schedulerTimer.startTiming(); // Spigot
+ MinecraftTimings.bukkitSchedulerTimer.startTiming(); // Spigot // Paper + MinecraftTimings.bukkitSchedulerTimer.startTiming(); // Spigot // Paper
this.server.getScheduler().mainThreadHeartbeat(this.tickCount); // CraftBukkit this.server.getScheduler().mainThreadHeartbeat(this.tickCount); // CraftBukkit
@ -908,8 +908,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- SpigotTimings.tickablesTimer.stopTiming(); // Spigot - SpigotTimings.tickablesTimer.stopTiming(); // Spigot
+ MinecraftTimings.tickablesTimer.stopTiming(); // Spigot // Paper + MinecraftTimings.tickablesTimer.stopTiming(); // Spigot // Paper
this.profiler.pop(); this.profiler.popPush("send chunks");
} iterator = this.playerList.getPlayers().iterator();
diff --git a/src/main/java/net/minecraft/server/ServerFunctionManager.java b/src/main/java/net/minecraft/server/ServerFunctionManager.java diff --git a/src/main/java/net/minecraft/server/ServerFunctionManager.java b/src/main/java/net/minecraft/server/ServerFunctionManager.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/ServerFunctionManager.java --- a/src/main/java/net/minecraft/server/ServerFunctionManager.java
@ -921,7 +921,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- try { - try {
+ try (co.aikar.timings.Timing timing = function.getTiming().startTiming()) { // Paper + try (co.aikar.timings.Timing timing = function.getTiming().startTiming()) { // Paper
this.context = new ServerFunctionManager.ExecutionContext(tracer); this.context = new ServerFunctionManager.ExecutionContext(tracer);
i = this.context.runTopCommand(function, source); i = this.context.runTopCommand(customfunction1, source);
} finally { } finally {
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
@ -1278,7 +1278,7 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListener
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@Override @Override
public void tick() { public void tick() {
@ -1286,7 +1286,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (this.ackBlockChangesUpTo > -1) { if (this.ackBlockChangesUpTo > -1) {
this.send(new ClientboundBlockChangedAckPacket(this.ackBlockChangesUpTo)); this.send(new ClientboundBlockChangedAckPacket(this.ackBlockChangesUpTo));
this.ackBlockChangesUpTo = -1; this.ackBlockChangesUpTo = -1;
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.player.resetLastActionTime(); // CraftBukkit - SPIGOT-854 this.player.resetLastActionTime(); // CraftBukkit - SPIGOT-854
this.disconnect(Component.translatable("multiplayer.disconnect.idling")); this.disconnect(Component.translatable("multiplayer.disconnect.idling"));
} }
@ -1294,7 +1294,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
} }
private void handleCommand(String s) { private void handleCommand(String s) {
@ -1303,7 +1303,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if ( org.spigotmc.SpigotConfig.logCommands ) // Spigot if ( org.spigotmc.SpigotConfig.logCommands ) // Spigot
this.LOGGER.info(this.player.getScoreboardName() + " issued server command: " + s); this.LOGGER.info(this.player.getScoreboardName() + " issued server command: " + s);
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.cserver.getPluginManager().callEvent(event); this.cserver.getPluginManager().callEvent(event);
if (event.isCancelled()) { if (event.isCancelled()) {
@ -1312,7 +1312,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return; return;
} }
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
java.util.logging.Logger.getLogger(ServerGamePacketListenerImpl.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); java.util.logging.Logger.getLogger(ServerGamePacketListenerImpl.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
return; return;
} finally { } finally {
@ -1455,17 +1455,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
double d0 = this.getX() - this.xo; double d0 = this.getX() - this.xo;
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
if (this.isSleeping()) {
this.setXRot(0.0F);
} }
-
this.refreshDirtyAttributes();
- SpigotTimings.timerEntityTickRest.stopTiming(); // Spigot - SpigotTimings.timerEntityTickRest.stopTiming(); // Spigot
} }
public void detectEquipmentUpdates() { public void detectEquipmentUpdates() {
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.setDeltaMovement(d4, d5, d6); this.setDeltaMovement(d0, d1, d2);
this.level().getProfiler().push("ai"); this.level().getProfiler().push("ai");
- SpigotTimings.timerEntityAI.startTiming(); // Spigot - SpigotTimings.timerEntityAI.startTiming(); // Spigot
if (this.isImmobile()) { if (this.isImmobile()) {