Ensure main event in PlayerConnection
This commit is contained in:
@@ -1,15 +1,13 @@
|
|||||||
package net.minecraft.server;
|
package net.minecraft.server;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.common.primitives.Doubles;
|
import com.google.common.primitives.Doubles;
|
||||||
import com.google.common.primitives.Floats;
|
import com.google.common.primitives.Floats;
|
||||||
import com.google.common.util.concurrent.Futures;
|
import io.akarin.api.Akari;
|
||||||
import io.netty.util.concurrent.Future;
|
import io.netty.util.concurrent.Future;
|
||||||
import io.netty.util.concurrent.GenericFutureListener;
|
import io.netty.util.concurrent.GenericFutureListener;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
@@ -147,8 +145,10 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
|||||||
this.processedMovePackets = this.receivedMovePackets;
|
this.processedMovePackets = this.receivedMovePackets;
|
||||||
if (this.B) {
|
if (this.B) {
|
||||||
if (++this.C > 80) {
|
if (++this.C > 80) {
|
||||||
|
Akari.callbackQueue.add(() -> {
|
||||||
PlayerConnection.LOGGER.warn("{} was kicked for floating too long!", this.player.getName());
|
PlayerConnection.LOGGER.warn("{} was kicked for floating too long!", this.player.getName());
|
||||||
this.disconnect(com.destroystokyo.paper.PaperConfig.flyingKickPlayerMessage); // Paper - use configurable kick message
|
this.disconnect(com.destroystokyo.paper.PaperConfig.flyingKickPlayerMessage); // Paper - use configurable kick message
|
||||||
|
}); // Akarin - post to main thread
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -166,8 +166,10 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
|||||||
this.x = this.r.locZ;
|
this.x = this.r.locZ;
|
||||||
if (this.D && this.player.getVehicle().bE() == this.player) {
|
if (this.D && this.player.getVehicle().bE() == this.player) {
|
||||||
if (++this.E > 80) {
|
if (++this.E > 80) {
|
||||||
|
Akari.callbackQueue.add(() -> {
|
||||||
PlayerConnection.LOGGER.warn("{} was kicked for floating a vehicle too long!", this.player.getName());
|
PlayerConnection.LOGGER.warn("{} was kicked for floating a vehicle too long!", this.player.getName());
|
||||||
this.disconnect(com.destroystokyo.paper.PaperConfig.flyingKickVehicleMessage); // Paper - use configurable kick message
|
this.disconnect(com.destroystokyo.paper.PaperConfig.flyingKickVehicleMessage); // Paper - use configurable kick message
|
||||||
|
}); // Akarin - post to main thread
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -188,8 +190,10 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
|||||||
if (this.isPendingPing()) {
|
if (this.isPendingPing()) {
|
||||||
// We're pending a ping from the client
|
// We're pending a ping from the client
|
||||||
if (!this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // check keepalive limit, don't fire if already disconnected
|
if (!this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // check keepalive limit, don't fire if already disconnected
|
||||||
|
Akari.callbackQueue.add(() -> {
|
||||||
PlayerConnection.LOGGER.warn("{} was kicked due to keepalive timeout!", this.player.getName()); // more info
|
PlayerConnection.LOGGER.warn("{} was kicked due to keepalive timeout!", this.player.getName()); // more info
|
||||||
this.disconnect(new ChatMessage("disconnect.timeout"));
|
this.disconnect(new ChatMessage("disconnect.timeout"));
|
||||||
|
}); // Akarin - post to main thread
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (elapsedTime >= 15000L) { // 15 seconds
|
if (elapsedTime >= 15000L) { // 15 seconds
|
||||||
@@ -216,8 +220,10 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.player.J() > 0L && this.minecraftServer.getIdleTimeout() > 0 && MinecraftServer.aw() - this.player.J() > this.minecraftServer.getIdleTimeout() * 1000 * 60) {
|
if (this.player.J() > 0L && this.minecraftServer.getIdleTimeout() > 0 && MinecraftServer.aw() - this.player.J() > this.minecraftServer.getIdleTimeout() * 1000 * 60) {
|
||||||
|
Akari.callbackQueue.add(() -> {
|
||||||
this.player.resetIdleTimer(); // CraftBukkit - SPIGOT-854
|
this.player.resetIdleTimer(); // CraftBukkit - SPIGOT-854
|
||||||
this.disconnect(new ChatMessage("multiplayer.disconnect.idling", new Object[0]));
|
this.disconnect(new ChatMessage("multiplayer.disconnect.idling", new Object[0]));
|
||||||
|
}); // Akarin - post to main thread
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -2289,7 +2295,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
|||||||
|
|
||||||
private long getCurrentMillis() { return d(); } // Paper - OBFHELPER
|
private long getCurrentMillis() { return d(); } // Paper - OBFHELPER
|
||||||
private long d() {
|
private long d() {
|
||||||
return System.nanoTime() / 1000000L;
|
return System.currentTimeMillis(); // Akarin
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user