Supression of duplicated error msgs.

This commit is contained in:
ProfMobius committed 2014-10-23 20:25:38 +02:00
1 parent 292726b37e
commit 98d6df8312
1 file changed
+11
@@ -1,5 +1,7 @@
package mcp.mobius.opis.network.rcon;
import java.lang.ref.WeakReference;
import javax.net.ssl.SSLException;
import io.nettyopis.buffer.ByteBuf;
@@ -29,6 +31,9 @@ public class RConHandler {
public static BiMap<FakePlayer, ChannelHandlerContext> fakePlayersRcon = HashBiMap.create();
public static BiMap<FakePlayer, ChannelHandlerContext> fakePlayersNexus = HashBiMap.create();
public static String lastError = null;
public static WeakReference<ChannelHandlerContext> lastContext = null;
static {
packetTypes.put((byte)0, PacketReqChunks.class);
packetTypes.put((byte)1, PacketReqData.class);
@@ -90,6 +95,12 @@ public class RConHandler {
}
public static void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
if (cause.getMessage().equals(RConHandler.lastError) && ctx.equals(RConHandler.lastContext.get()))
return;
RConHandler.lastError = cause.getMessage();
RConHandler.lastContext = new WeakReference<ChannelHandlerContext>(ctx);
cause.printStackTrace();
FakePlayer fakePlayer = null;