mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-09 04:09:54 +01:00
750049fa2b
CraftChatMessage.fromComponent fails to take into account the style of TranslatableComponent args, causing any styling on args to be completely ignored. Fixing this is relatively simple, however would cause behavior to deviate from upstream. This commit will fix the coloring in messages logged through MinecraftServer.LOGGER by simply using Adventure's legacy text serializer, which properly serializes TranslatableComponents and their arguments. Note that this doesn't do anything about the underlying issue of CraftChatMessage.fromComponent improperly serializing TranslatableComponents.
43 lines
2.6 KiB
Diff
43 lines
2.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Fri, 2 Nov 2018 23:11:51 -0400
|
|
Subject: [PATCH] Optimize World Time Updates
|
|
|
|
Splits time updates into incremental updates as well as does
|
|
the updates per world, so that we can re-use the same packet
|
|
object for every player unless they have per-player time enabled.
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
index 67748b3c57766ef297082a7ea6a255b0f42de446..4d44604da7c65df6d8e87b6c6c56371ca307c11f 100644
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
@@ -1316,12 +1316,24 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
|
|
|
MinecraftTimings.timeUpdateTimer.startTiming(); // Spigot // Paper
|
|
// Send time updates to everyone, it will get the right time from the world the player is in.
|
|
- if (this.ticks % 20 == 0) {
|
|
- for (int i = 0; i < this.getPlayerList().players.size(); ++i) {
|
|
- EntityPlayer entityplayer = (EntityPlayer) this.getPlayerList().players.get(i);
|
|
- entityplayer.playerConnection.sendPacket(new PacketPlayOutUpdateTime(entityplayer.world.getTime(), entityplayer.getPlayerTime(), entityplayer.world.getGameRules().getBoolean(GameRules.DO_DAYLIGHT_CYCLE))); // Add support for per player time
|
|
+ // Paper start - optimize time updates
|
|
+ for (final WorldServer world : this.getWorlds()) {
|
|
+ final boolean doDaylight = world.getGameRules().getBoolean(GameRules.DO_DAYLIGHT_CYCLE);
|
|
+ final long dayTime = world.getDayTime();
|
|
+ long worldTime = world.getTime();
|
|
+ final PacketPlayOutUpdateTime worldPacket = new PacketPlayOutUpdateTime(worldTime, dayTime, doDaylight);
|
|
+ for (EntityHuman entityhuman : world.getPlayers()) {
|
|
+ if (!(entityhuman instanceof EntityPlayer) || (ticks + entityhuman.getId()) % 20 != 0) {
|
|
+ continue;
|
|
+ }
|
|
+ EntityPlayer entityplayer = (EntityPlayer) entityhuman;
|
|
+ long playerTime = entityplayer.getPlayerTime();
|
|
+ PacketPlayOutUpdateTime packet = (playerTime == dayTime) ? worldPacket :
|
|
+ new PacketPlayOutUpdateTime(worldTime, playerTime, doDaylight);
|
|
+ entityplayer.playerConnection.sendPacket(packet); // Add support for per player time
|
|
}
|
|
}
|
|
+ // Paper end
|
|
MinecraftTimings.timeUpdateTimer.stopTiming(); // Spigot // Paper
|
|
|
|
while (iterator.hasNext()) {
|