Logviewer registration overhaul.

This commit is contained in:
Steven Lawson
2017-08-01 15:59:24 -04:00
parent 3bc8adfb98
commit b55ca70056
5 changed files with 175 additions and 59 deletions

View File

@ -5,6 +5,8 @@ import java.util.Date;
import java.util.List;
import lombok.Getter;
import lombok.Setter;
import me.totalfreedom.totalfreedommod.LogViewer.LogsRegistrationMode;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import net.pravian.aero.base.ConfigLoadable;
@ -25,7 +27,6 @@ public class Admin implements ConfigLoadable, ConfigSavable, Validatable
@Setter
private String name;
@Getter
@Setter
private boolean active = true;
@Getter
@Setter
@ -138,6 +139,26 @@ public class Admin implements ConfigLoadable, ConfigSavable, Validatable
ips.clear();
}
public void setActive(boolean active)
{
this.active = active;
final TotalFreedomMod plugin = TotalFreedomMod.plugin();
if (!active)
{
if (getRank().isAtLeast(Rank.TELNET_ADMIN))
{
if (plugin.btb != null)
{
plugin.btb.killTelnetSessions(getName());
}
}
plugin.lv.updateLogsRegistration(null, getName(), LogsRegistrationMode.DELETE);
}
}
@Override
public boolean isValid()
{