Fixed rangeban
This commit is contained in:
@@ -157,6 +157,7 @@
|
|||||||
<Compile Include="Source\Networking\NetStats.cs" />
|
<Compile Include="Source\Networking\NetStats.cs" />
|
||||||
<Compile Include="Source\Networking\RespawnManager.cs" />
|
<Compile Include="Source\Networking\RespawnManager.cs" />
|
||||||
<Compile Include="Source\Networking\ServerLog.cs" />
|
<Compile Include="Source\Networking\ServerLog.cs" />
|
||||||
|
<Compile Include="Source\Networking\WhiteList.cs" />
|
||||||
<Compile Include="Source\Particles\ParticleEmitter.cs" />
|
<Compile Include="Source\Particles\ParticleEmitter.cs" />
|
||||||
<Compile Include="Source\Networking\GameServerSettings.cs" />
|
<Compile Include="Source\Networking\GameServerSettings.cs" />
|
||||||
<Compile Include="Source\Screens\BlurEffect.cs" />
|
<Compile Include="Source\Screens\BlurEffect.cs" />
|
||||||
|
|||||||
@@ -774,7 +774,7 @@ namespace Barotrauma.Networking
|
|||||||
yield return CoroutineStatus.Success;
|
yield return CoroutineStatus.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void KickPlayer(string playerName, bool ban)
|
public override void KickPlayer(string playerName, bool ban, bool range=false)
|
||||||
{
|
{
|
||||||
playerName = playerName.ToLowerInvariant();
|
playerName = playerName.ToLowerInvariant();
|
||||||
|
|
||||||
@@ -782,10 +782,10 @@ namespace Barotrauma.Networking
|
|||||||
c.name.ToLowerInvariant() == playerName ||
|
c.name.ToLowerInvariant() == playerName ||
|
||||||
(c.Character != null && c.Character.Name.ToLowerInvariant() == playerName));
|
(c.Character != null && c.Character.Name.ToLowerInvariant() == playerName));
|
||||||
|
|
||||||
KickClient(client, ban);
|
KickClient(client, ban, range);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void KickClient(NetConnection conn, bool ban = false)
|
public void KickClient(NetConnection conn, bool ban = false, bool range = false)
|
||||||
{
|
{
|
||||||
Client client = connectedClients.Find(c => c.Connection == conn);
|
Client client = connectedClients.Find(c => c.Connection == conn);
|
||||||
if (client == null)
|
if (client == null)
|
||||||
@@ -801,18 +801,20 @@ namespace Barotrauma.Networking
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
KickClient(client, ban);
|
KickClient(client, ban, range);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void KickClient(Client client, bool ban = false)
|
public void KickClient(Client client, bool ban = false, bool range = false)
|
||||||
{
|
{
|
||||||
if (client == null) return;
|
if (client == null) return;
|
||||||
|
|
||||||
if (ban)
|
if (ban)
|
||||||
{
|
{
|
||||||
DisconnectClient(client, client.name + " has been banned from the server", "You have been banned from the server");
|
DisconnectClient(client, client.name + " has been banned from the server", "You have been banned from the server");
|
||||||
banList.BanPlayer(client.name, client.Connection.RemoteEndPoint.Address.ToString());
|
string ip = client.Connection.RemoteEndPoint.Address.ToString();
|
||||||
|
if (range) { ip = banList.ToRange(ip); }
|
||||||
|
banList.BanPlayer(client.name, ip);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -156,14 +156,13 @@ namespace Barotrauma.Networking
|
|||||||
unauthenticatedClients.Remove(unauthClient);
|
unauthenticatedClients.Remove(unauthClient);
|
||||||
unauthClient = null;
|
unauthClient = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
if (!whitelist.IsWhiteListed(name, inc.SenderConnection.RemoteEndPoint.Address.ToString()))
|
||||||
if (!whitelist.IsWhiteListed(name, inc.SenderConnection.RemoteEndPoint.Address.ToString()))
|
{
|
||||||
{
|
|
||||||
inc.SenderConnection.Disconnect("You're not in this server's whitelist.");
|
inc.SenderConnection.Disconnect("You're not in this server's whitelist.");
|
||||||
DebugConsole.NewMessage(name + " (" + inc.SenderConnection.RemoteEndPoint.Address.ToString() + ") couldn't join the server (not in whitelist)", Color.Red);
|
DebugConsole.NewMessage(name + " (" + inc.SenderConnection.RemoteEndPoint.Address.ToString() + ") couldn't join the server (not in whitelist)", Color.Red);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!Client.IsValidName(name))
|
if (!Client.IsValidName(name))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -55,19 +55,19 @@ namespace Barotrauma
|
|||||||
const float NetworkUpdateInterval = 1.0f;
|
const float NetworkUpdateInterval = 1.0f;
|
||||||
private float networkUpdateTimer;
|
private float networkUpdateTimer;
|
||||||
private UInt32 lastUpdateID;
|
private UInt32 lastUpdateID;
|
||||||
public UInt32 LastUpdateID
|
public UInt32 LastUpdateID
|
||||||
{
|
{
|
||||||
get { if (GameMain.Server != null && lastUpdateID < 1) lastUpdateID++; return lastUpdateID; }
|
get { if (GameMain.Server != null && lastUpdateID < 1) lastUpdateID++; return lastUpdateID; }
|
||||||
set { if (GameMain.Server != null) return; lastUpdateID = value; }
|
set { if (GameMain.Server != null) return; lastUpdateID = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
private Sprite backgroundSprite;
|
private Sprite backgroundSprite;
|
||||||
|
|
||||||
private GUITextBox serverMessage;
|
private GUITextBox serverMessage;
|
||||||
public string ServerMessage
|
public string ServerMessage
|
||||||
{
|
{
|
||||||
get { return serverMessage.Text; }
|
get { return serverMessage.Text; }
|
||||||
set { if (GameMain.Server != null) return; serverMessage.Text = value; }
|
set { if (GameMain.Server != null) return; serverMessage.Text = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public GUIListBox SubList
|
public GUIListBox SubList
|
||||||
@@ -413,10 +413,10 @@ namespace Barotrauma
|
|||||||
|
|
||||||
GUIButton settingsButton = new GUIButton(new Rectangle(-100, 0, 80, 30), "Settings", Alignment.BottomRight, GUI.Style, infoFrame);
|
GUIButton settingsButton = new GUIButton(new Rectangle(-100, 0, 80, 30), "Settings", Alignment.BottomRight, GUI.Style, infoFrame);
|
||||||
settingsButton.OnClicked = GameMain.Server.ToggleSettingsFrame;
|
settingsButton.OnClicked = GameMain.Server.ToggleSettingsFrame;
|
||||||
settingsButton.UserData = "settingsButton";
|
settingsButton.UserData = "settingsButton";
|
||||||
|
|
||||||
GUIButton whitelistButton = new GUIButton(new Rectangle(-200, 0, 80, 30), "Whitelist", Alignment.BottomRight, GUI.Style, infoFrame);
|
GUIButton whitelistButton = new GUIButton(new Rectangle(-200, 0, 80, 30), "Whitelist", Alignment.BottomRight, GUI.Style, infoFrame);
|
||||||
whitelistButton.OnClicked = GameMain.Server.ToggleWhiteListFrame;
|
whitelistButton.OnClicked = GameMain.Server.ToggleWhiteListFrame;
|
||||||
whitelistButton.UserData = "whitelistButton";
|
whitelistButton.UserData = "whitelistButton";
|
||||||
|
|
||||||
if (subList.Selected == null) subList.Select(Math.Max(0, prevSelectedSub));
|
if (subList.Selected == null) subList.Select(Math.Max(0, prevSelectedSub));
|
||||||
@@ -573,10 +573,10 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (GameMain.Server == null) return false;
|
if (GameMain.Server == null) return false;
|
||||||
|
|
||||||
GameMain.Server.AutoRestart = tickBox.Selected;
|
GameMain.Server.AutoRestart = tickBox.Selected;
|
||||||
|
|
||||||
lastUpdateID++;
|
lastUpdateID++;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -615,8 +615,8 @@ namespace Barotrauma
|
|||||||
if (index < 0) index = 2;
|
if (index < 0) index = 2;
|
||||||
if (index > 2) index = 0;
|
if (index > 2) index = 0;
|
||||||
|
|
||||||
SetTraitorsEnabled((YesNoMaybe)index);
|
SetTraitorsEnabled((YesNoMaybe)index);
|
||||||
|
|
||||||
lastUpdateID++;
|
lastUpdateID++;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -912,8 +912,8 @@ namespace Barotrauma
|
|||||||
else if (GameMain.Client != null && GameMain.Client.HasPermission(ClientPermissions.Ban))
|
else if (GameMain.Client != null && GameMain.Client.HasPermission(ClientPermissions.Ban))
|
||||||
{
|
{
|
||||||
GameMain.Client.KickPlayer(userData.ToString(), true);
|
GameMain.Client.KickPlayer(userData.ToString(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -928,8 +928,8 @@ namespace Barotrauma
|
|||||||
else if (GameMain.Client != null && GameMain.Client.HasPermission(ClientPermissions.Ban))
|
else if (GameMain.Client != null && GameMain.Client.HasPermission(ClientPermissions.Ban))
|
||||||
{
|
{
|
||||||
GameMain.Client.KickPlayer(userData.ToString(), true, true);
|
GameMain.Client.KickPlayer(userData.ToString(), true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1084,11 +1084,11 @@ namespace Barotrauma
|
|||||||
if (!string.IsNullOrWhiteSpace(seed))
|
if (!string.IsNullOrWhiteSpace(seed))
|
||||||
{
|
{
|
||||||
LevelSeed = seed;
|
LevelSeed = seed;
|
||||||
}
|
}
|
||||||
|
|
||||||
//textBox.Text = LevelSeed;
|
//textBox.Text = LevelSeed;
|
||||||
//textBox.Selected = false;
|
//textBox.Selected = false;
|
||||||
|
|
||||||
lastUpdateID++;
|
lastUpdateID++;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user