Преглед на файлове

Allowing new protocol 152 to connect.

JIV преди 15 години
родител
ревизия
5e57547bf1

+ 14 - 7
L2_GameServer/java/com/l2jserver/Config.java

@@ -14,6 +14,7 @@
  */
 package com.l2jserver;
 
+import gnu.trove.TIntArrayList;
 import gnu.trove.TIntFloatHashMap;
 import gnu.trove.TIntIntHashMap;
 import gnu.trove.TIntObjectHashMap;
@@ -812,8 +813,7 @@ public final class Config
 	public static boolean ACCEPT_ALTERNATE_ID;
 	public static int REQUEST_ID;
 	public static boolean RESERVE_HOST_ON_LOGIN = false;
-	public static int MIN_PROTOCOL_REVISION;
-	public static int MAX_PROTOCOL_REVISION;
+	public static TIntArrayList PROTOCOL_LIST;
 	public static boolean LOG_LOGIN_CONTROLLER;
 
 	//--------------------------------------------------
@@ -999,13 +999,20 @@ public final class Config
 					MAX_CHARACTERS_NUMBER_PER_ACCOUNT = Integer.parseInt(serverSettings.getProperty("CharMaxNumber", "0"));
 					MAXIMUM_ONLINE_USERS = Integer.parseInt(serverSettings.getProperty("MaximumOnlineUsers", "100"));
 
-					MIN_PROTOCOL_REVISION = Integer.parseInt(serverSettings.getProperty("MinProtocolRevision", "660"));
-					MAX_PROTOCOL_REVISION = Integer.parseInt(serverSettings.getProperty("MaxProtocolRevision", "665"));
-
-					if (MIN_PROTOCOL_REVISION > MAX_PROTOCOL_REVISION)
+					String[] protocols = serverSettings.getProperty("AllowedProtocolRevisions", "146;152").split(";");
+					PROTOCOL_LIST = new TIntArrayList(protocols.length);
+					for (String protocol : protocols)
 					{
-						throw new Error("MinProtocolRevision is bigger than MaxProtocolRevision in server configuration file.");
+						try
+						{
+							PROTOCOL_LIST.add(Integer.parseInt(protocol.trim()));
+						}
+						catch(NumberFormatException e)
+						{
+							_log.info("Wrong config protocol version: "+protocol+". Skipped.");
+						}
 					}
+					
 				}
 				catch (Exception e)
 				{

+ 1 - 2
L2_GameServer/java/com/l2jserver/gameserver/network/clientpackets/ProtocolVersion.java

@@ -51,8 +51,7 @@ public final class ProtocolVersion extends L2GameClientPacket
 			// this is just a ping attempt from the new C2 client
 			getClient().closeNow();
 		}
-		else if (_version < Config.MIN_PROTOCOL_REVISION
-				|| _version > Config.MAX_PROTOCOL_REVISION)
+		else if (!Config.PROTOCOL_LIST.contains(_version))
 		{
 			LogRecord record = new LogRecord(Level.WARNING, "Wrong protocol");
 			record.setParameters(new Object[]{_version, getClient()});

+ 4 - 10
L2_GameServer/java/config/server.properties

@@ -88,17 +88,11 @@ AcceptAlternateID = True
 # Default: 100
 MaximumOnlineUsers = 100
 
-# Minimum and maximum protocol revision that server allow to connect.
-# Warning: You must make sure that the minimum revision is always less than or equal to the maximum revision.
+# Numbers of protocol revisions that server allows to connect.
+# Delimiter is ;
 # WARNING: <u><b><font color="red">Changing the protocol revision may result in incompatible communication and many errors in game!</font></b></u>
-# Default: 146
-MinProtocolRevision = 146
-
-# Minimum and maximum protocol revision that server allow to connect.
-# Warning: You must make sure that the minimum revision is always less than or equal to the maximum revision.
-# WARNING: <u><b><font color="red">Changing the protocol revision may result in incompatible communication and many errors in game!</font></b></u>
-# Default: 146
-MaxProtocolRevision = 146
+# Default: 146;152
+AllowedProtocolRevisions = 146;152
 
 
 # ---------------------------------------------------------------------------