diff --git a/src/vm/computer/Machine.java b/src/vm/computer/Machine.java index a8e99d0..d170f41 100644 --- a/src/vm/computer/Machine.java +++ b/src/vm/computer/Machine.java @@ -63,6 +63,7 @@ public class Machine { public HashMap tunnelComponents = new HashMap<>(); public HashMap internetComponents = new HashMap<>(); public HashMap dataComponents = new HashMap<>(); + public HashMap keyboardComponents= new HashMap<>(); public HashMap unknownComponents = new HashMap<>(); @@ -132,6 +133,9 @@ public static void fromJSONObject(JSONObject machineConfig) { case "data": machine.dataComponents.put(address,new Data(machine,address, component.optInt("tier",3))); break; + case "keyboard": + machine.keyboardComponents.put(address,new Keyboard(machine,address)); + break; default: machine.unknownComponents.put(address,new UnknownComponent(machine,address,component.getString("type"))); } diff --git a/src/vm/computer/components/Internet.java b/src/vm/computer/components/Internet.java index 1b010bd..ef5fc2a 100644 --- a/src/vm/computer/components/Internet.java +++ b/src/vm/computer/components/Internet.java @@ -17,6 +17,7 @@ public Internet(Machine machine, String address) { super(machine, address, "internet"); } + @SuppressWarnings("unchecked") @Override public void pushProxyFields() { super.pushProxyFields(); @@ -88,8 +89,8 @@ public void pushProxyFields() { catch (IOException ignored) {} finally { machine.lua.pushBoolean(true); - return 1; } + return 1; }); machine.lua.setField(-2, "close"); @@ -117,7 +118,7 @@ public void pushProxyFields() { // Подрубаем хедеры if (!requestArgs.isNoneOrNil(3) && requestArgs.isTable(3)) { - requestArgs.toJavaObject(3, Map.class).forEach((key, value) -> { + ((Map) requestArgs.toJavaObject(3, Map.class)).forEach((key, value) -> { // System.out.println("Setting header: "+ key.toString() + " : " + value.toString()); connection.setRequestProperty(key.toString(), value.toString()); }); @@ -180,8 +181,8 @@ public void pushProxyFields() { catch (IOException ignored) {} finally { machine.lua.pushBoolean(true); - return 1; } + return 1; }); machine.lua.setField(-2, "close");