-no more server duplicates on webfront when the server crashes ( was intentional )

-warn reasons no longer show player's name
This commit is contained in:
RaidMax 2016-01-21 11:41:00 -06:00
parent e39c97a182
commit 85a658b987
7 changed files with 35 additions and 12 deletions

View File

@ -34,7 +34,7 @@ namespace IW4MAdmin
E.Origin.Tell("You cannot warn " + E.Target.Name);
else
{
E.Target.Warn(E.Data, E.Origin);
E.Target.Warn(E.Target.lastOffense, E.Origin);
}
}
}

View File

@ -74,7 +74,7 @@ namespace IW4MAdmin
if (!S.isRunning)
Utilities.shutdownInterface(S.pID());
mainLog.Write("Server with PID #" + S.pID() + " can no longer be monitored.", Log.Level.Debug);
mainLog.Write("Server with PID #" + S.pID() + " can no longer be monitored.", Log.Level.Production);
activePIDs.Remove(S.pID());
defunctServers.Add(S);
}

View File

@ -419,6 +419,11 @@ namespace IW4MAdmin
}
}
public override void Stop()
{
this.isRunning = false;
}
//Starts the monitoring process
override public void Monitor()
{
@ -568,6 +573,7 @@ namespace IW4MAdmin
}
events.Enqueue(new Event(Event.GType.Stop, "Server monitoring stopped", null, null, this));
SharedLibrary.Utilities.Wait(3);
isRunning = false;
eventQueueThread.Join();
}
@ -840,15 +846,18 @@ namespace IW4MAdmin
public override void Warn(String Reason, Player Target, Player Origin)
{
Penalty newPenalty = new Penalty(Penalty.Type.Warning, SharedLibrary.Utilities.stripColors(Reason), Target.npID, Origin.npID, DateTime.Now, Target.IP);
clientDB.addBan(newPenalty);
foreach (SharedLibrary.Server S in Program.getServers()) // make sure bans show up on the webfront
S.Bans = S.clientDB.getBans();
Target.Warnings++;
String Message = String.Format("^1WARNING ^7[^3{0}^7]: ^3{1}^7, {2}", Target.Warnings, Target.Name, Target.lastOffense);
Broadcast(Message);
if (Target.Warnings >= 4)
Target.Kick("You were kicked for too many warnings!", Origin);
Target.Kick("Too many warnings!", Origin);
else
{
Penalty newPenalty = new Penalty(Penalty.Type.Warning, SharedLibrary.Utilities.stripColors(Reason), Target.npID, Origin.npID, DateTime.Now, Target.IP);
clientDB.addBan(newPenalty);
foreach (SharedLibrary.Server S in Program.getServers()) // make sure bans show up on the webfront
S.Bans = S.clientDB.getBans();
Target.Warnings++;
String Message = String.Format("^1WARNING ^7[^3{0}^7]: ^3{1}^7, {2}", Target.Warnings, Target.Name, Target.lastOffense);
Broadcast(Message);
}
}
public override void Kick(String Reason, Player Target, Player Origin)

View File

@ -6,7 +6,9 @@ CHANGELOG:
-readded pubbans page http://127.0.0.1:1624/pubbans
-updated RepZ profile link
-added trusted group ( will need a new database or manual update )
-reports capture screenshot
-reports capture screenshot (maybe)
-no more server duplicates on webfront when the server crashes ( was intentional )
-warn reasons no longer show player's name
VERSION 1.0
CHANGELOG:

View File

@ -122,6 +122,8 @@ namespace SharedLibrary
return clientDB.getPlayers(databaseIDs);
}
abstract public void Stop();
/// <summary>
/// Add a player to the server's player list

View File

@ -24,8 +24,16 @@ namespace Webfront_Plugin
public void removeServer(Server S)
{
if (activeServers.Contains(S))
if (S != null && activeServers.Contains(S))
{
S.Stop();
activeServers.Remove(S);
}
}
public List<Server> getServers()
{
return activeServers;
}
private String processTemplate(String Input, String Param)

View File

@ -1,6 +1,7 @@
using System;
using SharedLibrary;
using System.Threading;
using System.Collections.Generic;
namespace Webfront_Plugin
{
@ -12,6 +13,7 @@ namespace Webfront_Plugin
{
if (E.Type == Event.GType.Start)
{
Manager.webFront.removeServer(Manager.webFront.getServers().Find(x => x.getPort() == E.Owner.getPort()));
Manager.webFront.addServer(E.Owner);
E.Owner.Log.Write("Webfront now listening", Log.Level.Production);
}