|
|
|
|
@@ -1,4 +1,4 @@
|
|
|
|
|
From 2586ac1cc5a0b940aa0b46721383c28e615e0dab Mon Sep 17 00:00:00 2001
|
|
|
|
|
From c3da24e911229cfcf8530507d75c719ce463b3eb Mon Sep 17 00:00:00 2001
|
|
|
|
|
From: =?UTF-8?q?=E3=84=97=E3=84=A0=CB=8B=20=E3=84=91=E3=84=A7=CB=8A?=
|
|
|
|
|
<tsao-chi@the-lingo.org>
|
|
|
|
|
Date: Sun, 5 Apr 2020 14:59:10 +0800
|
|
|
|
|
@@ -106,7 +106,7 @@ index f1222fcb2b..522cfed4cb 100644
|
|
|
|
|
|
|
|
|
|
protected GameProfile a(GameProfile gameprofile) {
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java
|
|
|
|
|
index 96a785af27..f2a31f5923 100644
|
|
|
|
|
index 96a785af27..fd1d5fe3bf 100644
|
|
|
|
|
--- a/src/main/java/net/minecraft/server/NetworkManager.java
|
|
|
|
|
+++ b/src/main/java/net/minecraft/server/NetworkManager.java
|
|
|
|
|
@@ -43,6 +43,7 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
|
|
|
|
|
@@ -145,7 +145,7 @@ index 96a785af27..f2a31f5923 100644
|
|
|
|
|
if (enumprotocol != enumprotocol1) {
|
|
|
|
|
this.setProtocol(enumprotocol);
|
|
|
|
|
}
|
|
|
|
|
@@ -223,30 +225,71 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
|
|
|
|
|
@@ -223,30 +225,92 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -179,14 +179,35 @@ index 96a785af27..f2a31f5923 100644
|
|
|
|
|
+ NetworkManager.LOGGER.debug("Disabled auto read");
|
|
|
|
|
+ this.channel.config().setAutoRead(false);
|
|
|
|
|
+ this.setProtocol(enumprotocol);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- return true; // Return true if all packets were dispatched
|
|
|
|
|
+ ChannelFuture channelfuture = this.channel.writeAndFlush(packet);
|
|
|
|
|
+
|
|
|
|
|
+ channelfuture.addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE);
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public void sendPackets(Packet<?> packet, Packet<?> other) {
|
|
|
|
|
+ EnumProtocol enumprotocol = packet.protocol();
|
|
|
|
|
+
|
|
|
|
|
+ ++this.q;
|
|
|
|
|
+ if (protocol != enumprotocol) {
|
|
|
|
|
+ NetworkManager.LOGGER.debug("Disabled auto read");
|
|
|
|
|
+ this.channel.config().setAutoRead(false);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ this.channel.eventLoop().execute(() -> {
|
|
|
|
|
+ if (enumprotocol != protocol) {
|
|
|
|
|
+ this.setProtocol(enumprotocol);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ this.channel.write(packet).addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE);
|
|
|
|
|
+ this.channel.write(other).addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE);
|
|
|
|
|
+ this.channel.flush();
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public void sendPackets(Packet<?> packet, Packet<?> ...packets) {
|
|
|
|
|
+ EnumProtocol enumprotocol = packet.protocol();
|
|
|
|
|
+
|
|
|
|
|
@@ -194,9 +215,8 @@ index 96a785af27..f2a31f5923 100644
|
|
|
|
|
+ if (protocol != enumprotocol) {
|
|
|
|
|
+ NetworkManager.LOGGER.debug("Disabled auto read");
|
|
|
|
|
+ this.channel.config().setAutoRead(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- return true; // Return true if all packets were dispatched
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ this.channel.eventLoop().execute(() -> {
|
|
|
|
|
+ if (enumprotocol != protocol) {
|
|
|
|
|
+ this.setProtocol(enumprotocol);
|
|
|
|
|
@@ -206,6 +226,7 @@ index 96a785af27..f2a31f5923 100644
|
|
|
|
|
+ for (Packet<?> pkt : packets) {
|
|
|
|
|
+ this.channel.write(pkt).addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ this.channel.flush();
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
@@ -238,7 +259,7 @@ index 96a785af27..f2a31f5923 100644
|
|
|
|
|
}
|
|
|
|
|
// Paper end
|
|
|
|
|
|
|
|
|
|
@@ -260,9 +303,9 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
|
|
|
|
|
@@ -260,9 +324,9 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
|
|
|
|
|
((PlayerConnection) this.packetListener).tick();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -408,29 +429,33 @@ index 6dfbbc67dd..b23612817b 100644
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
|
|
|
|
|
index 6d6fbf2f50..4b549ccc41 100644
|
|
|
|
|
index 6d6fbf2f50..fa23e838ee 100644
|
|
|
|
|
--- a/src/main/java/net/minecraft/server/PlayerList.java
|
|
|
|
|
+++ b/src/main/java/net/minecraft/server/PlayerList.java
|
|
|
|
|
@@ -159,13 +159,15 @@ public abstract class PlayerList {
|
|
|
|
|
@@ -159,6 +159,8 @@ public abstract class PlayerList {
|
|
|
|
|
// Spigot - view distance
|
|
|
|
|
playerconnection.sendPacket(new PacketPlayOutLogin(entityplayer.getId(), entityplayer.playerInteractManager.getGameMode(), WorldData.c(worlddata.getSeed()), worlddata.isHardcore(), worldserver.worldProvider.getDimensionManager().getType(), this.getMaxPlayers(), worlddata.getType(), worldserver.spigotConfig.viewDistance, flag1, !flag));
|
|
|
|
|
entityplayer.getBukkitEntity().sendSupportedChannels(); // CraftBukkit
|
|
|
|
|
- playerconnection.sendPacket(new PacketPlayOutCustomPayload(PacketPlayOutCustomPayload.a, (new PacketDataSerializer(Unpooled.buffer())).a(this.getServer().getServerModName())));
|
|
|
|
|
- playerconnection.sendPacket(new PacketPlayOutServerDifficulty(worlddata.getDifficulty(), worlddata.isDifficultyLocked()));
|
|
|
|
|
- playerconnection.sendPacket(new PacketPlayOutAbilities(entityplayer.abilities));
|
|
|
|
|
- playerconnection.sendPacket(new PacketPlayOutHeldItemSlot(entityplayer.inventory.itemInHandIndex));
|
|
|
|
|
- playerconnection.sendPacket(new PacketPlayOutRecipeUpdate(this.server.getCraftingManager().b()));
|
|
|
|
|
- playerconnection.sendPacket(new PacketPlayOutTags(this.server.getTagRegistry()));
|
|
|
|
|
- playerconnection.sendPacket(new PacketPlayOutEntityStatus(entityplayer, (byte) (worldserver.getGameRules().getBoolean(GameRules.REDUCED_DEBUG_INFO) ? 22 : 23))); // Paper - fix this rule not being initialized on the client
|
|
|
|
|
+ // Akarin Start
|
|
|
|
|
+ playerconnection.networkManager.sendPackets(new PacketPlayOutCustomPayload(PacketPlayOutCustomPayload.a, (new PacketDataSerializer(Unpooled.buffer())).a(this.getServer().getServerModName())),
|
|
|
|
|
+ // Akarin start - send multiple packets at once
|
|
|
|
|
+ /*
|
|
|
|
|
playerconnection.sendPacket(new PacketPlayOutCustomPayload(PacketPlayOutCustomPayload.a, (new PacketDataSerializer(Unpooled.buffer())).a(this.getServer().getServerModName())));
|
|
|
|
|
playerconnection.sendPacket(new PacketPlayOutServerDifficulty(worlddata.getDifficulty(), worlddata.isDifficultyLocked()));
|
|
|
|
|
playerconnection.sendPacket(new PacketPlayOutAbilities(entityplayer.abilities));
|
|
|
|
|
@@ -166,6 +168,17 @@ public abstract class PlayerList {
|
|
|
|
|
playerconnection.sendPacket(new PacketPlayOutRecipeUpdate(this.server.getCraftingManager().b()));
|
|
|
|
|
playerconnection.sendPacket(new PacketPlayOutTags(this.server.getTagRegistry()));
|
|
|
|
|
playerconnection.sendPacket(new PacketPlayOutEntityStatus(entityplayer, (byte) (worldserver.getGameRules().getBoolean(GameRules.REDUCED_DEBUG_INFO) ? 22 : 23))); // Paper - fix this rule not being initialized on the client
|
|
|
|
|
+ */
|
|
|
|
|
+ playerconnection.networkManager.sendPackets(
|
|
|
|
|
+ new PacketPlayOutCustomPayload(PacketPlayOutCustomPayload.a, (new PacketDataSerializer(Unpooled.buffer())).a(this.getServer().getServerModName())),
|
|
|
|
|
+ new PacketPlayOutServerDifficulty(worlddata.getDifficulty(), worlddata.isDifficultyLocked()),
|
|
|
|
|
+ new PacketPlayOutAbilities(entityplayer.abilities),
|
|
|
|
|
+ new PacketPlayOutHeldItemSlot(entityplayer.inventory.itemInHandIndex),
|
|
|
|
|
+ new PacketPlayOutRecipeUpdate(this.server.getCraftingManager().b()),
|
|
|
|
|
+ new PacketPlayOutTags(this.server.getTagRegistry()),
|
|
|
|
|
+ new PacketPlayOutEntityStatus(entityplayer, (byte) (worldserver.getGameRules().getBoolean(GameRules.REDUCED_DEBUG_INFO) ? 22 : 23))); // Paper - fix this rule not being initialized on the client
|
|
|
|
|
+ // Akarin End
|
|
|
|
|
+ new PacketPlayOutEntityStatus(entityplayer, (byte) (worldserver.getGameRules().getBoolean(GameRules.REDUCED_DEBUG_INFO) ? 22 : 23))
|
|
|
|
|
+ );
|
|
|
|
|
+ // Akarin end
|
|
|
|
|
this.d(entityplayer);
|
|
|
|
|
entityplayer.getStatisticManager().c();
|
|
|
|
|
entityplayer.B().a(entityplayer);
|
|
|
|
|
|