Begin remigrate to Shiroha
uhm
This commit is contained in:
+22
-22
@@ -12,7 +12,7 @@ index 40f54536422fa38bd84017fc634808016b4de58b..d0dff5850717bd083b7a29104a61754c
|
||||
}
|
||||
}
|
||||
// Paper end - Optimize network
|
||||
+ // Camellia start - async protocol switcher
|
||||
+ // Shiroha start - async protocol switcher
|
||||
+ public <T extends PacketListener> void setupInboundProtocolAsync(
|
||||
+ ProtocolInfo<T> protocol,
|
||||
+ T packetListener,
|
||||
@@ -133,7 +133,7 @@ index 40f54536422fa38bd84017fc634808016b4de58b..d0dff5850717bd083b7a29104a61754c
|
||||
+ writeTask.run();
|
||||
+ }
|
||||
+ }
|
||||
+ // Camellia end
|
||||
+ // Shiroha end
|
||||
+
|
||||
}
|
||||
diff --git a/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java b/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java
|
||||
@@ -145,9 +145,9 @@ index efcf294b523ca6b039eb2544546bf863ba717749..343c98fb35eb4cb736d26f67a11c00ef
|
||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.server.packetProcessor());
|
||||
this.finishCurrentTask(JoinWorldTask.TYPE);
|
||||
- this.connection.setupOutboundProtocol(GameProtocols.CLIENTBOUND_TEMPLATE.bind(RegistryFriendlyByteBuf.decorator(this.server.registryAccess())));
|
||||
+ // this.connection.setupOutboundProtocol(GameProtocols.CLIENTBOUND_TEMPLATE.bind(RegistryFriendlyByteBuf.decorator(this.server.registryAccess()))); // Camellia - Async protocol switch - move down
|
||||
+ // this.connection.setupOutboundProtocol(GameProtocols.CLIENTBOUND_TEMPLATE.bind(RegistryFriendlyByteBuf.decorator(this.server.registryAccess()))); // Shiroha - Async protocol switch - move down
|
||||
|
||||
+ Runnable afterSwitch = () -> { // Camellia - Async protocol switch
|
||||
+ Runnable afterSwitch = () -> { // Shiroha - Async protocol switch
|
||||
try {
|
||||
PlayerList playerList = this.server.getPlayerList();
|
||||
if (playerList.getPlayer(this.gameProfile.id()) != null) {
|
||||
@@ -155,7 +155,7 @@ index efcf294b523ca6b039eb2544546bf863ba717749..343c98fb35eb4cb736d26f67a11c00ef
|
||||
LOGGER.error("Couldn't place player in world", e);
|
||||
this.disconnect(DISCONNECT_REASON_INVALID_DATA);
|
||||
}
|
||||
+ // Camellia start - Async protocol switch
|
||||
+ // Shiroha start - Async protocol switch
|
||||
+ };
|
||||
+ if (!moe.monnairealms.camellia.config.modules.optimizations.AsyncProtocolChangeConfig.enabled) {
|
||||
+ this.connection.setupOutboundProtocol(GameProtocols.CLIENTBOUND_TEMPLATE.bind(RegistryFriendlyByteBuf.decorator(this.server.registryAccess())));
|
||||
@@ -166,7 +166,7 @@ index efcf294b523ca6b039eb2544546bf863ba717749..343c98fb35eb4cb736d26f67a11c00ef
|
||||
+ io.papermc.paper.threadedregions.RegionizedServer.getInstance().addTask(afterSwitch);
|
||||
+ }, false); // we will start auto read once we set up inbound handler at placeNewPlayer in PlayerList
|
||||
+ }
|
||||
+ // Camellia end
|
||||
+ // Shiroha end
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -178,13 +178,13 @@ index eda7e765c7c2ffee305edc81e0c7a6b1e5bfa18d..4c9ea818be83ed3c4dacc762f4d0e8c0
|
||||
} // Folia end - rewrite login process - move connection ownership to global region
|
||||
this.waitingForSwitchToConfig = true; // Folia - rewrite login process - fix bad ordering of this field write - moved down
|
||||
this.send(ClientboundStartConfigurationPacket.INSTANCE);
|
||||
+ if (!moe.monnairealms.camellia.config.modules.optimizations.AsyncProtocolChangeConfig.enabled) { // Camellia - Async protocol switch
|
||||
+ if (!moe.monnairealms.camellia.config.modules.optimizations.AsyncProtocolChangeConfig.enabled) { // Shiroha - Async protocol switch
|
||||
this.connection.setupOutboundProtocol(ConfigurationProtocols.CLIENTBOUND);
|
||||
+ // Camellia start - Async protcol switch
|
||||
+ // Shiroha start - Async protcol switch
|
||||
+ } else {
|
||||
+ this.connection.setupOutboundProtocolAsync(ConfigurationProtocols.CLIENTBOUND, null, true);
|
||||
+ }
|
||||
+ // Camellia end
|
||||
+ // Shiroha end
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -192,15 +192,15 @@ index eda7e765c7c2ffee305edc81e0c7a6b1e5bfa18d..4c9ea818be83ed3c4dacc762f4d0e8c0
|
||||
}
|
||||
|
||||
final ServerConfigurationPacketListenerImpl listener = new ServerConfigurationPacketListenerImpl(this.server, this.connection, this.createCookie(this.player.clientInformation())); // Paper
|
||||
+ if (!moe.monnairealms.camellia.config.modules.optimizations.AsyncProtocolChangeConfig.enabled) { // Camellia - Async protocol switch
|
||||
+ if (!moe.monnairealms.camellia.config.modules.optimizations.AsyncProtocolChangeConfig.enabled) { // Shiroha - Async protocol switch
|
||||
this.connection
|
||||
.setupInboundProtocol(
|
||||
ConfigurationProtocols.SERVERBOUND,
|
||||
listener // Paper
|
||||
);
|
||||
new io.papermc.paper.event.connection.configuration.PlayerConnectionReconfigureEvent(listener.paperConnection).callEvent(); // Paper
|
||||
+ } // Camellia - Async protocol switch - add "{"
|
||||
+ // Camellia start - Async protocol switch - move up
|
||||
+ } // Shiroha - Async protocol switch - add "{"
|
||||
+ // Shiroha start - Async protocol switch - move up
|
||||
+ else
|
||||
+ this.connection.setupInboundProtocolAsync(
|
||||
+ ConfigurationProtocols.SERVERBOUND,
|
||||
@@ -210,8 +210,8 @@ index eda7e765c7c2ffee305edc81e0c7a6b1e5bfa18d..4c9ea818be83ed3c4dacc762f4d0e8c0
|
||||
+ },
|
||||
+ true
|
||||
+ );
|
||||
+ // Camellia end
|
||||
+ // new io.papermc.paper.event.connection.configuration.PlayerConnectionReconfigureEvent(listener.paperConnection).callEvent(); // Paper // Camellia - Async protocol switch - move up
|
||||
+ // Shiroha end
|
||||
+ // new io.papermc.paper.event.connection.configuration.PlayerConnectionReconfigureEvent(listener.paperConnection).callEvent(); // Paper // Shiroha - Async protocol switch - move up
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -224,15 +224,15 @@ index f2329d1a9d9d4bf4c9d771e25e54f2f9ef65a76c..7de3bbecea2f11e4e1cb65408729f346
|
||||
net.minecraft.network.protocol.PacketUtils.ensureRunningOnSameThread(packet, this, this.server.packetProcessor()); // CraftBukkit
|
||||
Validate.validState(this.state == ServerLoginPacketListenerImpl.State.PROTOCOL_SWITCHING, "Unexpected login acknowledgement packet");
|
||||
- this.connection.setupOutboundProtocol(ConfigurationProtocols.CLIENTBOUND);
|
||||
+ /*this.connection.setupOutboundProtocol(ConfigurationProtocols.CLIENTBOUND); // Camellia - Async protocol switch - Rewrite
|
||||
+ /*this.connection.setupOutboundProtocol(ConfigurationProtocols.CLIENTBOUND); // Shiroha - Async protocol switch - Rewrite
|
||||
CommonListenerCookie cookie = CommonListenerCookie.createInitial(Objects.requireNonNull(this.authenticatedProfile), this.transferred);
|
||||
ServerConfigurationPacketListenerImpl configPacketListener = new ServerConfigurationPacketListenerImpl(this.server, this.connection, cookie);
|
||||
this.connection.setupInboundProtocol(ConfigurationProtocols.SERVERBOUND, configPacketListener);
|
||||
configPacketListener.startConfiguration();
|
||||
- this.state = ServerLoginPacketListenerImpl.State.ACCEPTED;
|
||||
+ this.state = ServerLoginPacketListenerImpl.State.ACCEPTED;*/ // Camellia - Async protocol switch - Rewrite
|
||||
+ this.state = ServerLoginPacketListenerImpl.State.ACCEPTED;*/ // Shiroha - Async protocol switch - Rewrite
|
||||
+
|
||||
+ // Camellia start - Async protocol switch
|
||||
+ // Shiroha start - Async protocol switch
|
||||
+ CommonListenerCookie cookie = CommonListenerCookie.createInitial(Objects.requireNonNull(this.authenticatedProfile), this.transferred);
|
||||
+ ServerConfigurationPacketListenerImpl configPacketListener = new ServerConfigurationPacketListenerImpl(this.server, this.connection, cookie);
|
||||
+
|
||||
@@ -248,7 +248,7 @@ index f2329d1a9d9d4bf4c9d771e25e54f2f9ef65a76c..7de3bbecea2f11e4e1cb65408729f346
|
||||
+ this.connection.setupInboundProtocolAsync(ConfigurationProtocols.SERVERBOUND, configPacketListener, () -> {
|
||||
+ this.connection.setupOutboundProtocolAsync(ConfigurationProtocols.CLIENTBOUND, afterSwitch, true); // start auto read when everything is ready
|
||||
+ }, false); // we will resume auto reading once the outbound protocol is also setup
|
||||
+ // Camellia end
|
||||
+ // Shiroha end
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -260,11 +260,11 @@ index e7579a9873362317dd82b63306cf650af9472574..9e90197b96fcac958c5073ca8f560e77
|
||||
// only after setting the connection listener to game type, add the connection to this regions list
|
||||
level.getCurrentWorldData().connections.add(connection);
|
||||
// Folia end - rewrite login process
|
||||
+ if (!moe.monnairealms.camellia.config.modules.optimizations.AsyncProtocolChangeConfig.enabled) { // Camellia - Async protocol switch // we will run async switch once these main thread logics became done
|
||||
+ if (!moe.monnairealms.camellia.config.modules.optimizations.AsyncProtocolChangeConfig.enabled) { // Shiroha - Async protocol switch // we will run async switch once these main thread logics became done
|
||||
connection.setupInboundProtocol(
|
||||
GameProtocols.SERVERBOUND_TEMPLATE.bind(RegistryFriendlyByteBuf.decorator(this.server.registryAccess()), playerConnection), playerConnection
|
||||
);
|
||||
+ } // Camellia - Async protocol switch
|
||||
+ } // Shiroha - Async protocol switch
|
||||
playerConnection.suspendFlushing();
|
||||
GameRules gameRules = level.getGameRules();
|
||||
boolean immediateRespawn = gameRules.get(GameRules.IMMEDIATE_RESPAWN);
|
||||
@@ -272,7 +272,7 @@ index e7579a9873362317dd82b63306cf650af9472574..9e90197b96fcac958c5073ca8f560e77
|
||||
);
|
||||
}
|
||||
// Paper end - Send empty chunk
|
||||
+ // Camellia start - Async protocol switch
|
||||
+ // Shiroha start - Async protocol switch
|
||||
+ if (moe.monnairealms.camellia.config.modules.optimizations.AsyncProtocolChangeConfig.enabled) {
|
||||
+ // auto read will be enabled once the async switch is done
|
||||
+ connection.setupInboundProtocolAsync(
|
||||
@@ -282,7 +282,7 @@ index e7579a9873362317dd82b63306cf650af9472574..9e90197b96fcac958c5073ca8f560e77
|
||||
+ true // start auto read which we have disabled in configuration handler
|
||||
+ );
|
||||
+ }
|
||||
+ // Camellia end
|
||||
+ // Shiroha end
|
||||
}
|
||||
|
||||
public void updateEntireScoreboard(final ServerScoreboard scoreboard, final ServerPlayer player) {
|
||||
|
||||
Reference in New Issue
Block a user