Do not send packets for fake players

This commit is contained in:
Sotr
2019-03-23 16:49:30 +08:00
parent 02c2da2d21
commit 427e24ae2c
4 changed files with 13 additions and 10 deletions

View File

@@ -26,6 +26,7 @@ import org.bukkit.block.BlockFace;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Hanging;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Vehicle;
import co.aikar.timings.MinecraftTimings; // Paper
import co.aikar.timings.Timing; // Paper
@@ -1270,13 +1271,13 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
for (i = 0; (float) i < 1.0F + this.width * 20.0F; ++i) {
f3 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width;
f4 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width;
this.world.addParticle(Particles.e, this.locX + (double) f3, (double) (f2 + 1.0F), this.locZ + (double) f4, this.motX, this.motY - (double) (this.random.nextFloat() * 0.2F), this.motZ);
//this.world.addParticle(Particles.e, this.locX + (double) f3, (double) (f2 + 1.0F), this.locZ + (double) f4, this.motX, this.motY - (double) (this.random.nextFloat() * 0.2F), this.motZ);
}
for (i = 0; (float) i < 1.0F + this.width * 20.0F; ++i) {
f3 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width;
f4 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width;
this.world.addParticle(Particles.R, this.locX + (double) f3, (double) (f2 + 1.0F), this.locZ + (double) f4, this.motX, this.motY, this.motZ);
//this.world.addParticle(Particles.R, this.locX + (double) f3, (double) (f2 + 1.0F), this.locZ + (double) f4, this.motX, this.motY, this.motZ);
}
}

View File

@@ -178,7 +178,7 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
// Akarin start
public final void sendPackets(Packet<?> packet0, Packet<?> packet1) {
if (this.isConnected()) { // why send packet to whom not connected?
if (this.isConnected() && this.channel.isRegistered()) { // why send packet to whom not connected?
//this.j.readLock().lock();
//try {
// Queue new packets
@@ -191,7 +191,7 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
}
public final void sendPackets(Packet<?> packet0, Packet<?> packet1, Packet<?> packet2) {
if (this.isConnected()) { // why send packet to whom not connected?
if (this.isConnected() && this.channel.isRegistered()) { // why send packet to whom not connected?
//this.j.readLock().lock();
//try {
// Queue new packets
@@ -205,7 +205,7 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
}
public final void sendPackets(Packet<?> packet0, Packet<?> packet1, Packet<?> packet2, Packet<?> packet3, Packet<?> packet4, Packet<?> packet5, Packet<?> packet6) {
if (this.isConnected()) { // why send packet to whom not connected?
if (this.isConnected() && this.channel.isRegistered()) { // why send packet to whom not connected?
//this.j.readLock().lock();
//try {
// Queue new packets
@@ -223,7 +223,7 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
}
// Akarin end
public void sendPacket(Packet<?> packet, @Nullable GenericFutureListener<? extends Future<? super Void>> genericfuturelistener) {
if (this.isConnected() /*&& this.sendPacketQueue() && !(packet instanceof PacketPlayOutMapChunk && !((PacketPlayOutMapChunk) packet).isReady())*/) { // Paper - Async-Anti-Xray - Add chunk packets which are not ready or all packets if the packet queue contains chunk packets which are not ready to the packet queue and send the packets later in the right order // Akarin
if (this.isConnected() && this.channel.isRegistered() /*&& this.sendPacketQueue() && !(packet instanceof PacketPlayOutMapChunk && !((PacketPlayOutMapChunk) packet).isReady())*/) { // Paper - Async-Anti-Xray - Add chunk packets which are not ready or all packets if the packet queue contains chunk packets which are not ready to the packet queue and send the packets later in the right order // Akarin
//this.o(); // Paper - Async-Anti-Xray - Move to if statement (this.sendPacketQueue())
// Akarin start
//this.j.readLock().lock();

View File

@@ -98,9 +98,11 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
private double s;
private double t;
private double u;
private double v;
private double w;
private double x;
// Akarin start - package
double v;
double w;
double x;
// Akarin end
private Vec3D teleportPos;
private int teleportAwait;
private int A;