mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2025-06-29 19:46:42 +00:00
Logviewer registration overhaul.
This commit is contained in:
@ -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()
|
||||
{
|
||||
|
@ -10,7 +10,6 @@ import java.util.concurrent.TimeUnit;
|
||||
import lombok.Getter;
|
||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||
import me.totalfreedom.totalfreedommod.command.Command_logs;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
@ -272,6 +271,14 @@ public class AdminList extends FreedomService
|
||||
|
||||
public boolean removeAdmin(Admin admin)
|
||||
{
|
||||
if (admin.getRank().isAtLeast(Rank.TELNET_ADMIN))
|
||||
{
|
||||
if (plugin.btb != null)
|
||||
{
|
||||
plugin.btb.killTelnetSessions(admin.getName());
|
||||
}
|
||||
}
|
||||
|
||||
// Remove admin, update views
|
||||
if (allAdmins.remove(admin.getConfigKey()) == null)
|
||||
{
|
||||
@ -345,7 +352,6 @@ public class AdminList extends FreedomService
|
||||
}
|
||||
|
||||
admin.setActive(false);
|
||||
plugin.lv.deactivateSuperadmin(admin);
|
||||
}
|
||||
|
||||
save();
|
||||
|
Reference in New Issue
Block a user