(98ad00fa2) v0.9.1.0
This commit is contained in:
@@ -35,7 +35,7 @@ namespace Barotrauma.Networking
|
||||
|
||||
public bool CompareTo(string ipCompare)
|
||||
{
|
||||
if (string.IsNullOrEmpty(IP)) { return false; }
|
||||
if (string.IsNullOrEmpty(IP) || string.IsNullOrEmpty(IP)) { return false; }
|
||||
if (!IsRangeBan)
|
||||
{
|
||||
return ipCompare == IP;
|
||||
@@ -50,7 +50,7 @@ namespace Barotrauma.Networking
|
||||
|
||||
public bool CompareTo(IPAddress ipCompare)
|
||||
{
|
||||
if (string.IsNullOrEmpty(IP)) { return false; }
|
||||
if (string.IsNullOrEmpty(IP) || ipCompare == null) { return false; }
|
||||
if (ipCompare.IsIPv4MappedToIPv6 && CompareTo(ipCompare.MapToIPv4().ToString()))
|
||||
{
|
||||
return true;
|
||||
|
||||
@@ -97,6 +97,10 @@ namespace Barotrauma.Networking
|
||||
{
|
||||
name = name.Replace(":", "");
|
||||
name = name.Replace(";", "");
|
||||
if (name.Length > NetConfig.ServerNameMaxLength)
|
||||
{
|
||||
name = name.Substring(0, NetConfig.ServerNameMaxLength);
|
||||
}
|
||||
|
||||
this.name = name;
|
||||
|
||||
@@ -185,11 +189,7 @@ namespace Barotrauma.Networking
|
||||
|
||||
if (SteamManager.USE_STEAM)
|
||||
{
|
||||
SteamManager.CreateServer(this, isPublic);
|
||||
if (isPublic)
|
||||
{
|
||||
registeredToMaster = true;
|
||||
}
|
||||
registeredToMaster = SteamManager.CreateServer(this, isPublic);
|
||||
}
|
||||
if (isPublic && !GameMain.Config.UseSteamMatchmaking)
|
||||
{
|
||||
@@ -1084,6 +1084,10 @@ namespace Barotrauma.Networking
|
||||
Log("Client \"" + sender.Name + "\" kicked \"" + kickedClient.Name + "\".", ServerLog.MessageType.ServerMessage);
|
||||
KickClient(kickedClient, string.IsNullOrEmpty(kickReason) ? $"ServerMessage.KickedBy~[initiator]={sender.Name}" : kickReason);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendDirectChatMessage(TextManager.GetServerMessage($"ServerMessage.PlayerNotFound~[player]={kickedName}"), sender, ChatMessageType.Console);
|
||||
}
|
||||
break;
|
||||
case ClientPermissions.Ban:
|
||||
string bannedName = inc.ReadString().ToLowerInvariant();
|
||||
@@ -1104,11 +1108,15 @@ namespace Barotrauma.Networking
|
||||
BanClient(bannedClient, string.IsNullOrEmpty(banReason) ? $"ServerMessage.BannedBy~[initiator]={sender.Name}" : banReason, range);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SendDirectChatMessage(TextManager.GetServerMessage($"ServerMessage.PlayerNotFound~[player]={bannedName}"), sender, ChatMessageType.Console);
|
||||
}
|
||||
break;
|
||||
case ClientPermissions.Unban:
|
||||
string unbannedName = inc.ReadString().ToLowerInvariant();
|
||||
string unbannedName = inc.ReadString();
|
||||
string unbannedIP = inc.ReadString();
|
||||
UnbanPlayer(unbannedIP, unbannedIP);
|
||||
UnbanPlayer(unbannedName, unbannedIP);
|
||||
break;
|
||||
case ClientPermissions.ManageRound:
|
||||
bool end = inc.ReadBoolean();
|
||||
@@ -1784,6 +1792,8 @@ namespace Barotrauma.Networking
|
||||
|
||||
if (serverSettings.AllowRespawn && missionAllowRespawn) respawnManager = new RespawnManager(this, usingShuttle ? selectedShuttle : null);
|
||||
|
||||
entityEventManager.RefreshEntityIDs();
|
||||
|
||||
//assign jobs and spawnpoints separately for each team
|
||||
for (int n = 0; n < teamCount; n++)
|
||||
{
|
||||
@@ -1969,6 +1979,7 @@ namespace Barotrauma.Networking
|
||||
msg.Write(Submarine.MainSubs[1] != null); //loadSecondSub
|
||||
|
||||
msg.Write(serverSettings.AllowDisguises);
|
||||
msg.Write(serverSettings.AllowRewiring);
|
||||
|
||||
Traitor traitor = null;
|
||||
if (TraitorManager != null && TraitorManager.TraitorList.Count > 0)
|
||||
|
||||
@@ -339,13 +339,14 @@ namespace Barotrauma.Networking
|
||||
return;
|
||||
}
|
||||
|
||||
if (clVersion != GameMain.Version.ToString())
|
||||
bool? isCompatibleVersion = IsCompatible(clVersion, GameMain.Version.ToString());
|
||||
if (isCompatibleVersion.HasValue && !isCompatibleVersion.Value)
|
||||
{
|
||||
DisconnectUnauthClient(inc, unauthClient, DisconnectReason.InvalidVersion,
|
||||
$"DisconnectMessage.InvalidVersion~[version]={GameMain.Version.ToString()}~[clientversion]={clVersion}");
|
||||
|
||||
Log(clName + " (" + inc.SenderConnection.RemoteEndPoint.Address.ToString() + ") couldn't join the server (wrong game version)", ServerLog.MessageType.Error);
|
||||
DebugConsole.NewMessage(clName + " (" + inc.SenderConnection.RemoteEndPoint.Address.ToString() + ") couldn't join the server (wrong game version)", Color.Red);
|
||||
Log(clName + " (" + inc.SenderConnection.RemoteEndPoint.Address.ToString() + ") couldn't join the server (incompatible game version)", ServerLog.MessageType.Error);
|
||||
DebugConsole.NewMessage(clName + " (" + inc.SenderConnection.RemoteEndPoint.Address.ToString() + ") couldn't join the server (incompatible game version)", Color.Red);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+9
-5
@@ -10,7 +10,7 @@ namespace Barotrauma.Networking
|
||||
class ServerEntityEvent : NetEntityEvent
|
||||
{
|
||||
private IServerSerializable serializable;
|
||||
|
||||
|
||||
#if DEBUG
|
||||
public string StackTrace;
|
||||
#endif
|
||||
@@ -21,11 +21,10 @@ namespace Barotrauma.Networking
|
||||
get { return createTime; }
|
||||
}
|
||||
|
||||
public ServerEntityEvent(IServerSerializable entity, UInt16 id)
|
||||
: base(entity, id)
|
||||
public ServerEntityEvent(IServerSerializable serializableEntity, UInt16 id)
|
||||
: base(serializableEntity, id)
|
||||
{
|
||||
serializable = entity;
|
||||
|
||||
serializable = serializableEntity;
|
||||
createTime = Timing.TotalTime;
|
||||
|
||||
#if DEBUG
|
||||
@@ -292,6 +291,11 @@ namespace Barotrauma.Networking
|
||||
bufferedEvents.Add(bufferedEvent);
|
||||
}
|
||||
|
||||
public void RefreshEntityIDs()
|
||||
{
|
||||
events.ForEach(e => e.RefreshEntityID());
|
||||
uniqueEvents.ForEach(e => e.RefreshEntityID());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Writes all the events that the client hasn't received yet into the outgoing message
|
||||
|
||||
@@ -12,7 +12,6 @@ namespace Barotrauma.Networking
|
||||
{
|
||||
partial class ServerSettings
|
||||
{
|
||||
public const string SettingsFile = "serversettings.xml";
|
||||
public static readonly string ClientPermissionsFile = "Data" + Path.DirectorySeparatorChar + "clientpermissions.xml";
|
||||
|
||||
partial void InitProjSpecific()
|
||||
|
||||
Reference in New Issue
Block a user