Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions MinecraftClient/McTcpClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public class McTcpClient : IMinecraftComHandler
/// <param name="port">The server port to use</param>
/// <param name="protocolversion">Minecraft protocol version to use</param>

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, "");
}
Expand All @@ -69,7 +69,7 @@ public McTcpClient(string username, string uuid, string sessionID, int protocolv
/// <param name="protocolversion">Minecraft protocol version to use</param>
/// <param name="command">The text or command to send.</param>

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);
}
Expand All @@ -86,7 +86,7 @@ public McTcpClient(string username, string uuid, string sessionID, string server
/// <param name="singlecommand">If set to true, the client will send a single command and then disconnect from the server</param>
/// <param name="command">The text or command to send. Will only be sent if singlecommand is set to true.</param>

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;
Expand Down
2 changes: 1 addition & 1 deletion MinecraftClient/Protocol/ProtocolHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static class ProtocolHandler
/// <param name="protocolversion">Will contain protocol version, if ping successful</param>
/// <returns>TRUE if ping was successful</returns>

public static bool GetServerInfo(string serverIP, int serverPort, ref int protocolversion)
public static bool GetServerInfo(string serverIP, ushort serverPort, ref int protocolversion)
{
try
{
Expand Down
12 changes: 6 additions & 6 deletions MinecraftClient/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static class Settings
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 = "";
Expand Down Expand Up @@ -90,7 +90,7 @@ public static class Settings
//Custom app variables and Minecraft accounts
private static Dictionary<string, string> AppVars = new Dictionary<string, string>();
private static Dictionary<string, KeyValuePair<string, string>> Accounts = new Dictionary<string, KeyValuePair<string, string>>();
private static Dictionary<string, KeyValuePair<string, int>> Servers = new Dictionary<string, KeyValuePair<string, int>>();
private static Dictionary<string, KeyValuePair<string, ushort>> Servers = new Dictionary<string, KeyValuePair<string, ushort>>();

private enum ParseMode { Default, Main, AppVars, Proxy, AntiAFK, Hangman, Alerts, ChatLog, AutoRelog, ScriptScheduler, RemoteControl };

Expand Down Expand Up @@ -186,7 +186,7 @@ public static void LoadSettings(string settingsfile)
{
//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))
{
Expand All @@ -198,7 +198,7 @@ public static void LoadSettings(string settingsfile)
&& !server_data[0].Contains('.')
&& setServerIP(server_data[1]))
Servers[server_data[0]]
= new KeyValuePair<string, int>(ServerIP, ServerPort);
= new KeyValuePair<string, ushort>(ServerIP, ServerPort);
}

//Restore current server info
Expand Down Expand Up @@ -432,13 +432,13 @@ public static bool setServerIP(string server)
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; }
}
Expand Down