diff --git a/MinecraftClient/McTcpClient.cs b/MinecraftClient/McTcpClient.cs
index 8fa06680..4e59d1b3 100644
--- a/MinecraftClient/McTcpClient.cs
+++ b/MinecraftClient/McTcpClient.cs
@@ -53,7 +53,7 @@ namespace MinecraftClient
/// The server port to use
/// Minecraft protocol version to use
- public McTcpClient(string username, string uuid, string sessionID, int protocolversion, string server_ip, int port)
+ public McTcpClient(string username, string uuid, string sessionID, int protocolversion, string server_ip, ushort port)
{
StartClient(username, uuid, sessionID, server_ip, port, protocolversion, false, "");
}
@@ -69,7 +69,7 @@ namespace MinecraftClient
/// Minecraft protocol version to use
/// The text or command to send.
- public McTcpClient(string username, string uuid, string sessionID, string server_ip, int port, int protocolversion, string command)
+ public McTcpClient(string username, string uuid, string sessionID, string server_ip, ushort port, int protocolversion, string command)
{
StartClient(username, uuid, sessionID, server_ip, port, protocolversion, true, command);
}
@@ -86,7 +86,7 @@ namespace MinecraftClient
/// If set to true, the client will send a single command and then disconnect from the server
/// The text or command to send. Will only be sent if singlecommand is set to true.
- private void StartClient(string user, string uuid, string sessionID, string server_ip, int port, int protocolversion, bool singlecommand, string command)
+ private void StartClient(string user, string uuid, string sessionID, string server_ip, ushort port, int protocolversion, bool singlecommand, string command)
{
this.sessionid = sessionID;
this.uuid = uuid;
diff --git a/MinecraftClient/Protocol/ProtocolHandler.cs b/MinecraftClient/Protocol/ProtocolHandler.cs
index 56beca83..bc8aaf8b 100644
--- a/MinecraftClient/Protocol/ProtocolHandler.cs
+++ b/MinecraftClient/Protocol/ProtocolHandler.cs
@@ -23,7 +23,7 @@ namespace MinecraftClient.Protocol
/// Will contain protocol version, if ping successful
/// TRUE if ping was successful
- public static bool GetServerInfo(string serverIP, int serverPort, ref int protocolversion)
+ public static bool GetServerInfo(string serverIP, ushort serverPort, ref int protocolversion)
{
try
{
diff --git a/MinecraftClient/Settings.cs b/MinecraftClient/Settings.cs
index facdaf68..5b22bc90 100644
--- a/MinecraftClient/Settings.cs
+++ b/MinecraftClient/Settings.cs
@@ -20,7 +20,7 @@ namespace MinecraftClient
public static string Username = "";
public static string Password = "";
public static string ServerIP = "";
- public static int ServerPort = 25565;
+ public static ushort ServerPort = 25565;
public static string ServerVersion = "";
public static string SingleCommand = "";
public static string ConsoleTitle = "";
@@ -90,7 +90,7 @@ namespace MinecraftClient
//Custom app variables and Minecraft accounts
private static Dictionary AppVars = new Dictionary();
private static Dictionary> Accounts = new Dictionary>();
- private static Dictionary> Servers = new Dictionary>();
+ private static Dictionary> Servers = new Dictionary>();
private enum ParseMode { Default, Main, AppVars, Proxy, AntiAFK, Hangman, Alerts, ChatLog, AutoRelog, ScriptScheduler, RemoteControl };
@@ -186,7 +186,7 @@ namespace MinecraftClient
{
//Backup current server info
string server_host_temp = ServerIP;
- int server_port_temp = ServerPort;
+ ushort server_port_temp = ServerPort;
foreach (string server_line in File.ReadAllLines(argValue))
{
@@ -198,7 +198,7 @@ namespace MinecraftClient
&& !server_data[0].Contains('.')
&& setServerIP(server_data[1]))
Servers[server_data[0]]
- = new KeyValuePair(ServerIP, ServerPort);
+ = new KeyValuePair(ServerIP, ServerPort);
}
//Restore current server info
@@ -432,13 +432,13 @@ namespace MinecraftClient
server = server.ToLower();
string[] sip = server.Split(':');
string host = sip[0];
- short port = 25565;
+ ushort port = 25565;
if (sip.Length > 1)
{
try
{
- port = Convert.ToInt16(sip[1]);
+ port = Convert.ToUInt16(sip[1]);
}
catch (FormatException) { return false; }
}