Add a warning message for lost packets.

This commit is contained in:
Kristian S. Stangeland 2012-10-10 22:12:29 +02:00
parent 5bda655f39
commit dc75f34e11
2 changed files with 8 additions and 1 deletions

View File

@ -3,6 +3,6 @@
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="lib" path="D:/Games/Minecraft/Server Mods/API/bukkit-1.3.1-R2.0.jar"/> <classpathentry kind="lib" path="D:/Games/Minecraft/Server Mods/API/bukkit-1.3.1-R2.0.jar"/>
<classpathentry kind="lib" path="/ProtocolLib/bin/ProtocolLib.jar"/> <classpathentry combineaccessrules="false" kind="src" path="/ProtocolLib"/>
<classpathentry kind="output" path="class"/> <classpathentry kind="output" path="class"/>
</classpath> </classpath>

View File

@ -9,6 +9,7 @@ import java.util.concurrent.PriorityBlockingQueue;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.comphenix.protocol.events.PacketEvent; import com.comphenix.protocol.events.PacketEvent;
import com.comphenix.protocol.injector.PlayerLoggedOutException;
import com.comphenix.protocol.reflect.FieldAccessException; import com.comphenix.protocol.reflect.FieldAccessException;
/** /**
@ -184,6 +185,12 @@ class PacketSendingQueue {
if (marker != null && !marker.isTransmitted()) { if (marker != null && !marker.isTransmitted()) {
marker.sendPacket(event); marker.sendPacket(event);
} }
} catch (PlayerLoggedOutException e) {
System.out.println(String.format(
"Warning: Dropped packet index %s of ID %s",
marker.getOriginalSendingIndex(), event.getPacketID()
));
} catch (IOException e) { } catch (IOException e) {
// Just print the error // Just print the error