geforkt von Mirrors/Paper
some compile fixes
Dieser Commit ist enthalten in:
Ursprung
2f8a665549
Commit
037e6ff905
@ -43,14 +43,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
this.queue.clear(); // Free up packet queue.
|
this.queue.clear(); // Free up packet queue.
|
||||||
+ // Paper start - Add PlayerConnectionCloseEvent
|
+ // Paper start - Add PlayerConnectionCloseEvent
|
||||||
+ final PacketListener packetListener = this.getPacketListener();
|
+ final PacketListener packetListener = this.getPacketListener();
|
||||||
+ if (packetListener instanceof ServerGamePacketListenerImpl) {
|
+ if (packetListener instanceof net.minecraft.server.network.ServerGamePacketListenerImpl playerConnection) {
|
||||||
+ /* Player was logged in */
|
+ /* Player was logged in */
|
||||||
+ final ServerGamePacketListenerImpl playerConnection = (ServerGamePacketListenerImpl) packetListener;
|
|
||||||
+ new com.destroystokyo.paper.event.player.PlayerConnectionCloseEvent(playerConnection.player.getUUID(),
|
+ new com.destroystokyo.paper.event.player.PlayerConnectionCloseEvent(playerConnection.player.getUUID(),
|
||||||
+ playerConnection.player.getScoreboardName(), ((java.net.InetSocketAddress)address).getAddress(), false).callEvent();
|
+ playerConnection.player.getScoreboardName(), ((java.net.InetSocketAddress)address).getAddress(), false).callEvent();
|
||||||
+ } else if (packetListener instanceof ServerLoginPacketListenerImpl) {
|
+ } else if (packetListener instanceof net.minecraft.server.network.ServerLoginPacketListenerImpl loginListener) {
|
||||||
+ /* Player is login stage */
|
+ /* Player is login stage */
|
||||||
+ final ServerLoginPacketListenerImpl loginListener = (ServerLoginPacketListenerImpl) packetListener;
|
|
||||||
+ switch (loginListener.state) {
|
+ switch (loginListener.state) {
|
||||||
+ case READY_TO_ACCEPT:
|
+ case READY_TO_ACCEPT:
|
||||||
+ case DELAY_ACCEPT:
|
+ case DELAY_ACCEPT:
|
||||||
|
@ -40,9 +40,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+
|
+
|
||||||
+ private boolean stopReadingPackets;
|
+ private boolean stopReadingPackets;
|
||||||
+ private void killForPacketSpam() {
|
+ private void killForPacketSpam() {
|
||||||
+ this.sendPacket(new ClientboundDisconnectPacket(io.papermc.paper.adventure.PaperAdventure.asVanilla(io.papermc.paper.configuration.GlobalConfiguration.get().packetLimiter.kickMessage)), (future) -> {
|
+ this.sendPacket(new ClientboundDisconnectPacket(io.papermc.paper.adventure.PaperAdventure.asVanilla(io.papermc.paper.configuration.GlobalConfiguration.get().packetLimiter.kickMessage)), PacketSendListener.thenRun(() -> {
|
||||||
+ this.disconnect(io.papermc.paper.adventure.PaperAdventure.asVanilla(io.papermc.paper.configuration.GlobalConfiguration.get().packetLimiter.kickMessage));
|
+ this.disconnect(io.papermc.paper.adventure.PaperAdventure.asVanilla(io.papermc.paper.configuration.GlobalConfiguration.get().packetLimiter.kickMessage));
|
||||||
+ });
|
+ }));
|
||||||
+ this.setReadOnly();
|
+ this.setReadOnly();
|
||||||
+ this.stopReadingPackets = true;
|
+ this.stopReadingPackets = true;
|
||||||
+ }
|
+ }
|
||||||
|
@ -140,7 +140,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
} else {
|
} else {
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
- this.sendPacket(packet, queued.listener);
|
- this.sendPacket(packet, queued.listener);
|
||||||
+ this.writePacket(packet, queued.listener, (!iterator.hasNext() && (needsFlush || this.canFlush)) ? Boolean.TRUE : Boolean.FALSE); // Paper - make only one flush call per sendPacketQueue() call
|
+ this.sendPacket(packet, queued.listener, (!iterator.hasNext() && (needsFlush || this.canFlush)) ? Boolean.TRUE : Boolean.FALSE); // Paper - make only one flush call per sendPacketQueue() call
|
||||||
+ hasWrotePacket = true; // Paper - make only one flush call per sendPacketQueue() call
|
+ hasWrotePacket = true; // Paper - make only one flush call per sendPacketQueue() call
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,10 +26,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ joinAttemptsThisTick = 0;
|
+ joinAttemptsThisTick = 0;
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
+ if (this.packetListener instanceof ServerLoginPacketListenerImpl) {
|
+ if (this.packetListener instanceof net.minecraft.server.network.ServerLoginPacketListenerImpl serverLoginPacketListener) {
|
||||||
+ if ( ((ServerLoginPacketListenerImpl) this.packetListener).state != ServerLoginPacketListenerImpl.State.READY_TO_ACCEPT // Paper
|
+ if ( serverLoginPacketListener.state != net.minecraft.server.network.ServerLoginPacketListenerImpl.State.READY_TO_ACCEPT // Paper
|
||||||
+ || (joinAttemptsThisTick++ < MAX_PER_TICK)) { // Paper - limit the number of joins which can be processed each tick
|
+ || (joinAttemptsThisTick++ < MAX_PER_TICK)) { // Paper - limit the number of joins which can be processed each tick
|
||||||
+ ((ServerLoginPacketListenerImpl) this.packetListener).tick();
|
+ serverLoginPacketListener.tick();
|
||||||
+ } // Paper
|
+ } // Paper
|
||||||
+ }
|
+ }
|
||||||
PacketListener packetlistener = this.packetListener;
|
PacketListener packetlistener = this.packetListener;
|
||||||
|
@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
+ // Paper start
|
+ // Paper start
|
||||||
+ public ChatSender {
|
+ public ChatSender {
|
||||||
+ com.google.common.base.Preconditions.checkNotNull(uuid, "uuid cannot be null");
|
+ com.google.common.base.Preconditions.checkNotNull(profileId, "uuid cannot be null");
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
+
|
+
|
||||||
|
@ -55,9 +55,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
this.packetListener = listener;
|
this.packetListener = listener;
|
||||||
}
|
}
|
||||||
+ // Paper start
|
+ // Paper start
|
||||||
+ public net.minecraft.server.level.ServerPlayer getPlayer() {
|
+ public @Nullable net.minecraft.server.level.ServerPlayer getPlayer() {
|
||||||
+ if (packetListener instanceof ServerGamePacketListenerImpl) {
|
+ if (packetListener instanceof net.minecraft.server.network.ServerGamePacketListenerImpl serverGamePacketListener) {
|
||||||
+ return ((ServerGamePacketListenerImpl) packetListener).player;
|
+ return serverGamePacketListener.player;
|
||||||
+ } else {
|
+ } else {
|
||||||
+ return null;
|
+ return null;
|
||||||
+ }
|
+ }
|
||||||
@ -127,7 +127,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ java.util.List<Packet> extraPackets = InnerUtil.buildExtraPackets(packet);
|
+ java.util.List<Packet> extraPackets = InnerUtil.buildExtraPackets(packet);
|
||||||
+ boolean hasExtraPackets = extraPackets != null && !extraPackets.isEmpty();
|
+ boolean hasExtraPackets = extraPackets != null && !extraPackets.isEmpty();
|
||||||
+ if (!hasExtraPackets) {
|
+ if (!hasExtraPackets) {
|
||||||
+ this.queue.add(new Connection.PacketHolder(packet, callback));
|
+ this.queue.add(new Connection.PacketHolder(packet, packetsendlistener));
|
||||||
+ } else {
|
+ } else {
|
||||||
+ java.util.List<Connection.PacketHolder> packets = new java.util.ArrayList<>(1 + extraPackets.size());
|
+ java.util.List<Connection.PacketHolder> packets = new java.util.ArrayList<>(1 + extraPackets.size());
|
||||||
+ packets.add(new Connection.PacketHolder(packet, null)); // delay the future listener until the end of the extra packets
|
+ packets.add(new Connection.PacketHolder(packet, null)); // delay the future listener until the end of the extra packets
|
||||||
@ -135,7 +135,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ for (int i = 0, len = extraPackets.size(); i < len;) {
|
+ for (int i = 0, len = extraPackets.size(); i < len;) {
|
||||||
+ Packet extra = extraPackets.get(i);
|
+ Packet extra = extraPackets.get(i);
|
||||||
+ boolean end = ++i == len;
|
+ boolean end = ++i == len;
|
||||||
+ packets.add(new Connection.PacketHolder(extra, end ? callback : null)); // append listener to the end
|
+ packets.add(new Connection.PacketHolder(extra, end ? packetsendlistener : null)); // append listener to the end
|
||||||
+ }
|
+ }
|
||||||
+ this.queue.addAll(packets); // atomic
|
+ this.queue.addAll(packets); // atomic
|
||||||
+ }
|
+ }
|
||||||
@ -275,7 +275,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ clearPacketQueue(); // Paper
|
+ clearPacketQueue(); // Paper
|
||||||
// Paper start - Add PlayerConnectionCloseEvent
|
// Paper start - Add PlayerConnectionCloseEvent
|
||||||
final PacketListener packetListener = this.getPacketListener();
|
final PacketListener packetListener = this.getPacketListener();
|
||||||
if (packetListener instanceof ServerGamePacketListenerImpl) {
|
if (packetListener instanceof net.minecraft.server.network.ServerGamePacketListenerImpl playerConnection) {
|
||||||
diff --git a/src/main/java/net/minecraft/network/protocol/Packet.java b/src/main/java/net/minecraft/network/protocol/Packet.java
|
diff --git a/src/main/java/net/minecraft/network/protocol/Packet.java b/src/main/java/net/minecraft/network/protocol/Packet.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/network/protocol/Packet.java
|
--- a/src/main/java/net/minecraft/network/protocol/Packet.java
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren