Only remove from TelnetLogAppender if the socket is truely closed. Resolves #3

Small changes.
This commit is contained in:
Jerom van der Sar 2014-06-15 16:40:09 +02:00
parent 4407c6ab95
commit 76f21c3487
6 changed files with 7 additions and 14 deletions

View file

@ -38,6 +38,6 @@ public class BukkitTelnet extends JavaPlugin
{
TelnetServer.getInstance().stopServer();
TelnetLogger.info("Plugin disabled.");
TelnetLogger.info(plugin.getName() + " disabled.");
}
}

View file

@ -5,11 +5,8 @@ import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
public class SocketListener extends Thread
{
@ -53,11 +50,10 @@ public class SocketListener extends Thread
while (it.hasNext())
{
final ClientSession session = it.next();
TelnetLogAppender.getInstance().removeSession(session);
if (!session.syncIsConnected())
{
TelnetLogAppender.getInstance().removeSession(session);
it.remove();
}
}

View file

@ -8,9 +8,7 @@ import java.util.HashSet;
import java.util.Set;
import me.StevenLawson.BukkitTelnet.session.ClientSession;
import me.StevenLawson.BukkitTelnet.session.FilterMode;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.core.LogEvent;
import org.apache.logging.log4j.core.Logger;
import org.apache.logging.log4j.core.appender.AbstractAppender;
public class TelnetLogAppender extends AbstractAppender

View file

@ -15,14 +15,11 @@ import me.StevenLawson.BukkitTelnet.BukkitTelnet;
import me.StevenLawson.BukkitTelnet.TelnetConfig;
import me.StevenLawson.BukkitTelnet.TelnetLogAppender;
import me.StevenLawson.BukkitTelnet.TelnetLogger;
import me.StevenLawson.BukkitTelnet.TelnetServer;
import me.StevenLawson.BukkitTelnet.Util;
import org.apache.logging.log4j.LogManager;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Server;
import org.bukkit.scheduler.BukkitRunnable;
import org.apache.logging.log4j.core.Logger;
public final class ClientSession extends Thread
{

View file

@ -2,5 +2,7 @@ package me.StevenLawson.BukkitTelnet.session;
public enum FilterMode
{
FULL, NONCHAT_ONLY, CHAT_ONLY
FULL,
NONCHAT_ONLY,
CHAT_ONLY;
}

View file

@ -13,7 +13,7 @@ public class SessionCommandSender implements CommandSender
{
private final ClientSession session;
protected SessionCommandSender(ClientSession session)
public SessionCommandSender(ClientSession session)
{
this.session = session;
}