mirror of
https://github.com/TotalFreedomMC/BukkitTelnet.git
synced 2024-12-28 11:04:22 +00:00
Only remove from TelnetLogAppender if the socket is truely closed. Resolves #3
Small changes.
This commit is contained in:
parent
4407c6ab95
commit
76f21c3487
6 changed files with 7 additions and 14 deletions
|
@ -38,6 +38,6 @@ public class BukkitTelnet extends JavaPlugin
|
|||
{
|
||||
TelnetServer.getInstance().stopServer();
|
||||
|
||||
TelnetLogger.info("Plugin disabled.");
|
||||
TelnetLogger.info(plugin.getName() + " disabled.");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -2,5 +2,7 @@ package me.StevenLawson.BukkitTelnet.session;
|
|||
|
||||
public enum FilterMode
|
||||
{
|
||||
FULL, NONCHAT_ONLY, CHAT_ONLY
|
||||
FULL,
|
||||
NONCHAT_ONLY,
|
||||
CHAT_ONLY;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ public class SessionCommandSender implements CommandSender
|
|||
{
|
||||
private final ClientSession session;
|
||||
|
||||
protected SessionCommandSender(ClientSession session)
|
||||
public SessionCommandSender(ClientSession session)
|
||||
{
|
||||
this.session = session;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue