So, I have a class called MainControl that runs from another class (main), which, I am sure, works only once. Inside MainControl, I have several things that need to be loaded, one of which is a function that populates the HashMap with the key set for keybind (int), and values set for the class that contains information about the specific keybinds (KeyDetails) function.
So, in order to fill the hash map, it goes through 2 cycles, the first of which must iterate over the list of functions, and the second - check whether the key should be bound to this function. If the second loop finds that it should be connected, it will run Keybinds.put (KeyCode, new details (Function, KeyCode, KeyName, false); (just ignore false).
For some reason, it exits with MainControl (); run again as soon as it reaches Keybinds.put ... for no reason. There are no functions that MainControl should run, and it works when I delete the Keybinds.put line. By simply removing THIS one line, it works.
public MainControl()
{
System.out.println("Starting System");
LoadSession("Default");
System.out.println("Ended System - Never Reached");
}
public static void LoadSession(String s)
{
Keybinds = new HashMap();
for (int i = 0; i < FunctionStringList.length; i++)
{
String Key = "";
int KeyVal = 0;
try
{
for (int a = 0; a < KeyBindingList.length; a++)
{
if (KeyBindingList[a].KeyName.equalsIgnoreCase(FunctionStringList[i]))
{
Key = KeyBindingList[a].KeyName
KeyVal = KeyBindingList[a].KeyCode
}
}
Keybinds.put(KeyVal, new Details(FunctionStringList[i], KeyVal, Key, false));
System.out.println("Key: " + Key + " Val: " + KeyVal + " Hack: " + FunctionStringList[i]);
}
catch (Exception E) { E.printStackTrace(); }
}
}
public static String FunctionStringList[] =
{
"Forward", "Backwards", "StrafeLeft", "StrafeRight", "Jump", "Sneak"
};
Details Class:
public class Details extends MainControl
{
public Details(String Name, int KeyCode, String KeyName2, boolean Bool)
{
FunctionName = Name;
Code = KeyCode;
KeyName = KeyName2 != null ? KeyName2 : "None";
State = Bool;
}
public boolean Toggle()
{
State = !State;
return State;
}
public void SendChat(String s)
{
Console.AddChat(s);
}
public String FunctionName;
public String KeyName;
public int Code;
public boolean State;
}