Hotfix close GH-70 w/ cleanup

This commit is contained in:
Sotr
2019-03-18 20:20:58 +08:00
parent 4ec2ec70ca
commit 3b7adb3d4f
6 changed files with 31 additions and 31 deletions

View File

@@ -296,7 +296,7 @@ public class CheckedConcurrentLinkedQueue<E> extends AbstractQueue<E>
* @return {@code true} (as specified by {@link Collection#add})
* @throws NullPointerException if the specified element is null
*/
public boolean add(E e) {
public final boolean add(E e) {
return offer(e);
}
@@ -326,7 +326,7 @@ public class CheckedConcurrentLinkedQueue<E> extends AbstractQueue<E>
* @return {@code true} (as specified by {@link Queue#offer})
* @throws NullPointerException if the specified element is null
*/
public boolean offer(E e) {
public final boolean offer(E e) {
//checkNotNull(e);
final Node<E> newNode = new Node<E>(e);
@@ -381,7 +381,7 @@ public class CheckedConcurrentLinkedQueue<E> extends AbstractQueue<E>
}
}
public E poll(Predicate<E> predicate, E signal) {
public final E poll(Predicate<E> predicate, E signal) {
restartFromHead:
for (;;) {
for (Node<E> h = head, p = h, q;;) {

View File

@@ -323,7 +323,7 @@ public abstract class Container {
if (!crafting) ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutSetSlot(this.windowId, slot2.rawSlotIndex, slot2.getItem())); // Akarin
// Updating a crafting inventory makes the client reset the result slot, have to send it again
if (crafting) { // Akarin
((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutSetSlot(this.windowId, slot2.rawSlotIndex, slot2.getItem()), new PacketPlayOutSetSlot(this.windowId, 0, this.getSlot(0).getItem())); // Akarin
((EntityPlayer) entityhuman).playerConnection.sendPackets(new PacketPlayOutSetSlot(this.windowId, slot2.rawSlotIndex, slot2.getItem()), new PacketPlayOutSetSlot(this.windowId, 0, this.getSlot(0).getItem())); // Akarin
}
}
// CraftBukkit end

View File

@@ -1010,7 +1010,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
public void a(Container container, NonNullList<ItemStack> nonnulllist) {
this.playerConnection.sendPacket(new PacketPlayOutWindowItems(container.windowId, nonnulllist), new PacketPlayOutSetSlot(-1, -1, this.inventory.getCarried())); // Akarin
this.playerConnection.sendPackets(new PacketPlayOutWindowItems(container.windowId, nonnulllist), new PacketPlayOutSetSlot(-1, -1, this.inventory.getCarried())); // Akarin
// CraftBukkit start - Send a Set Slot to update the crafting result slot
if (java.util.EnumSet.of(InventoryType.CRAFTING,InventoryType.WORKBENCH).contains(container.getBukkitView().getType())) {
this.playerConnection.sendPacket(new PacketPlayOutSetSlot(container.windowId, 0, container.getSlot(0).getItem()));

View File

@@ -169,13 +169,13 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
}
// Akarin start
public final void sendPacket(Packet<?> packet0, Packet<?> packet1) {
public final void sendPackets(Packet<?> packet0, Packet<?> packet1) {
if (this.isConnected()) { // why send packet to whom not connected?
this.j.readLock().lock();
try {
// Send queued packets
this.sendPacketQueueUnsafe();
// Dispatch or queue new packets
// Queue new packets
this.packetQueue.offer(new QueuedPacket(packet0, null));
this.packetQueue.offer(new QueuedPacket(packet1, null));
} finally {
@@ -184,13 +184,13 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
}
}
public final void sendPacket(Packet<?> packet0, Packet<?> packet1, Packet<?> packet2) {
public final void sendPackets(Packet<?> packet0, Packet<?> packet1, Packet<?> packet2) {
if (this.isConnected()) { // why send packet to whom not connected?
this.j.readLock().lock();
try {
// Send queued packets
this.sendPacketQueueUnsafe();
// Dispatch or queue new packets
// Queue new packets
this.packetQueue.offer(new QueuedPacket(packet0, null));
this.packetQueue.offer(new QueuedPacket(packet1, null));
this.packetQueue.offer(new QueuedPacket(packet2, null));
@@ -200,13 +200,13 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
}
}
public final void sendPacket(Packet<?> packet0, Packet<?> packet1, Packet<?> packet2, Packet<?> packet3, Packet<?> packet4, Packet<?> packet5, Packet<?> packet6) {
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?
this.j.readLock().lock();
try {
// Send queued packets
this.sendPacketQueueUnsafe();
// Dispatch or queue new packets
// Queue new packets
this.packetQueue.offer(new QueuedPacket(packet0, null));
this.packetQueue.offer(new QueuedPacket(packet1, null));
this.packetQueue.offer(new QueuedPacket(packet2, null));
@@ -220,12 +220,12 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
}
}
private final void dispatchOrQueuePacketUnsafe(Packet<?> packet) {
private final void dispatchOrQueuePacketUnsafe(Packet<?> packet, @Nullable GenericFutureListener<? extends Future<? super Void>> genericfuturelistener) {
boolean dispatch = packet instanceof PacketStatusOutPong || packet instanceof PacketStatusOutServerInfo || (packet instanceof PacketPlayOutMapChunk && ((PacketPlayOutMapChunk) packet).isReady());
if (dispatch)
this.dispatchPacket(packet, null);
else {
this.packetQueue.offer(new QueuedPacket(packet, null));
if (dispatch) {
this.dispatchPacket(packet, genericfuturelistener);
} else {
this.packetQueue.offer(new QueuedPacket(packet, genericfuturelistener));
}
}
@@ -250,11 +250,11 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
// Send queued packets
this.sendPacketQueueUnsafe();
// Dispatch or queue new packets
this.dispatchOrQueuePacketUnsafe(packet);
this.dispatchOrQueuePacketUnsafe(packet, genericfuturelistener);
} finally {
this.j.readLock().unlock();
}
//this.b(packet, genericfuturelistener);
//this.dispatchPacket(packet, genericfuturelistener);
} else if (false) {
// Akarin end
this.j.writeLock().lock();
@@ -268,8 +268,8 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
}
private void dispatchPacket(Packet<?> packet, @Nullable GenericFutureListener<? extends Future<? super Void>> genericFutureListener) { this.b(packet, genericFutureListener); } // Paper - OBFHELPER
private void b(Packet<?> packet, @Nullable GenericFutureListener<? extends Future<? super Void>> genericfuturelistener) {
private final void dispatchPacket(Packet<?> packet, @Nullable GenericFutureListener<? extends Future<? super Void>> genericFutureListener) { this.b(packet, genericFutureListener); } // Paper - OBFHELPER // Akarin - add final
private final void b(Packet<?> packet, @Nullable GenericFutureListener<? extends Future<? super Void>> genericfuturelistener) { // Akarin - add final
EnumProtocol enumprotocol = EnumProtocol.a(packet);
EnumProtocol enumprotocol1 = (EnumProtocol) this.channel.attr(NetworkManager.c).get();

View File

@@ -1493,11 +1493,11 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
}
public void sendPacket(Packet<?> packet) {
public final void sendPacket(Packet<?> packet) { // Akarin - add final
this.a(packet, (GenericFutureListener) null);
}
// Akarin start
public final void sendPacket(Packet<?> packet0, Packet<?> packet1) {
public final void sendPackets(Packet<?> packet0, Packet<?> packet1) {
if (this.processedDisconnect)
return;
@@ -1510,7 +1510,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
}
try {
this.networkManager.sendPacket(packet0, packet1);
this.networkManager.sendPackets(packet0, packet1);
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Sending packet");
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Packet being sent");
@@ -1522,7 +1522,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
}
}
public final void sendPacket(Packet<?> packet0, Packet<?> packet1, Packet<?> packet2) {
public final void sendPackets(Packet<?> packet0, Packet<?> packet1, Packet<?> packet2) {
if (this.processedDisconnect)
return;
@@ -1538,7 +1538,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
}
try {
this.networkManager.sendPacket(packet0, packet1, packet2);
this.networkManager.sendPackets(packet0, packet1, packet2);
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Sending packet");
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Packet being sent");
@@ -1550,12 +1550,12 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
}
}
public final void sendPacket(Packet<?> packet0, Packet<?> packet1, Packet<?> packet2, Packet<?> packet3, Packet<?> packet4, Packet<?> packet5, Packet<?> packet6) {
public final void sendPackets(Packet<?> packet0, Packet<?> packet1, Packet<?> packet2, Packet<?> packet3, Packet<?> packet4, Packet<?> packet5, Packet<?> packet6) {
if (this.processedDisconnect)
return;
try {
this.networkManager.sendPacket(packet0, packet1, packet2, packet3, packet4, packet5, packet6);
this.networkManager.sendPackets(packet0, packet1, packet2, packet3, packet4, packet5, packet6);
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Sending packet");
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Packet being sent");

View File

@@ -157,7 +157,7 @@ public abstract class PlayerList {
playerconnection.sendPacket(new PacketPlayOutLogin(entityplayer.getId(), entityplayer.playerInteractManager.getGameMode(), worlddata.isHardcore(), worldserver.worldProvider.getDimensionManager(), worldserver.getDifficulty(), this.getMaxPlayers(), worlddata.getType(), worldserver.getGameRules().getBoolean("reducedDebugInfo")));
entityplayer.getBukkitEntity().sendSupportedChannels(); // CraftBukkit
// Akarin start
playerconnection.sendPacket(
playerconnection.sendPackets(
new PacketPlayOutCustomPayload(PacketPlayOutCustomPayload.b, (new PacketDataSerializer(Unpooled.buffer())).a(this.getServer().getServerModName())),
new PacketPlayOutServerDifficulty(worlddata.getDifficulty(), worlddata.isDifficultyLocked()),
new PacketPlayOutAbilities(entityplayer.abilities),
@@ -723,7 +723,7 @@ public abstract class PlayerList {
entityplayer1.setSneaking(false);
blockposition1 = worldserver.getSpawn();
// entityplayer1.playerConnection.a(entityplayer1.locX, entityplayer1.locY, entityplayer1.locZ, entityplayer1.yaw, entityplayer1.pitch);
entityplayer1.playerConnection.sendPacket(new PacketPlayOutSpawnPosition(blockposition1), new PacketPlayOutExperience(entityplayer1.exp, entityplayer1.expTotal, entityplayer1.expLevel)); // Akarin
entityplayer1.playerConnection.sendPackets(new PacketPlayOutSpawnPosition(blockposition1), new PacketPlayOutExperience(entityplayer1.exp, entityplayer1.expTotal, entityplayer1.expLevel)); // Akarin
this.b(entityplayer1, worldserver);
this.f(entityplayer1);
if (!entityplayer.playerConnection.isDisconnected()) {
@@ -1288,7 +1288,7 @@ public abstract class PlayerList {
// Akarin start
BlockPosition blockposition = worldserver.getSpawn();
entityplayer.playerConnection.sendPacket(
entityplayer.playerConnection.sendPackets(
new PacketPlayOutWorldBorder(worldborder, PacketPlayOutWorldBorder.EnumWorldBorderAction.INITIALIZE),
new PacketPlayOutUpdateTime(worldserver.getTime(), worldserver.getDayTime(), worldserver.getGameRules().getBoolean("doDaylightCycle")),
new PacketPlayOutSpawnPosition(blockposition));
@@ -1311,7 +1311,7 @@ public abstract class PlayerList {
entityplayer.getBukkitEntity().updateScaledHealth(); // CraftBukkit - Update scaled health on respawn and worldchange
// Akarin start
int i = entityplayer.world.getGameRules().get("reducedDebugInfo").b() ? 22 : 23;
entityplayer.playerConnection.sendPacket(
entityplayer.playerConnection.sendPackets(
new PacketPlayOutHeldItemSlot(entityplayer.inventory.itemInHandIndex),
new PacketPlayOutEntityStatus(entityplayer, (byte) i));
// Akarin end