diff --git a/sig/App.java b/sig/App.java index eae5067..1dfb6dc 100644 --- a/sig/App.java +++ b/sig/App.java @@ -394,67 +394,69 @@ class Server @Override public void run() { while (true){ - for (String command:commandQueue){ - switch (command){ - case "FOLLOW":{ - PressKeyWithModifier(KeyEvent.VK_CONTROL,KeyEvent.VK_7); - }break; - case "FORWARD":{ - r.keyPress(KeyEvent.VK_W); - r.delay(1000); - r.keyRelease(KeyEvent.VK_W); - }break; - case "BACKWARD":{ - r.keyPress(KeyEvent.VK_S); - r.delay(1000); - r.keyRelease(KeyEvent.VK_S); - }break; - case "LEFT":{ - r.keyPress(KeyEvent.VK_Q); - r.delay(1000); - r.keyRelease(KeyEvent.VK_Q); - }break; - case "RIGHT":{ - r.keyPress(KeyEvent.VK_E); - r.delay(1000); - r.keyRelease(KeyEvent.VK_E); - }break; - case "FIGHT":{ - fighting=true; - fightingaoe=false; - System.out.println("Fight mode: "+fighting); - }break; - case "FIGHTAOE":{ - fighting=fightingaoe=true; - System.out.println("Fight mode: "+fighting); - }break; - case "CHILL":{ - fighting=false; - System.out.println("Fight mode: "+fighting); - }break; - case "PASS":{ - System.out.println("Mythra's Health: "+GetMythraHealth()+"%"); - System.out.println("Aya's Health: "+GetAyaHealth()+"%"); - System.out.println("Target's Health: "+GetTargetHealth()+"%"); - }break; - case "SPRINT":{ - if (nextActionTimer==0){ - PressKey(KeyEvent.VK_N); - r.delay(100); - PressKey(KeyEvent.VK_N); - } else { - queueUpSprint=true; + synchronized (commandQueue){ + commandQueue.forEach((command)->{ + switch (command){ + case "FOLLOW":{ + PressKeyWithModifier(KeyEvent.VK_CONTROL,KeyEvent.VK_7); + }break; + case "FORWARD":{ + r.keyPress(KeyEvent.VK_W); + r.delay(1000); + r.keyRelease(KeyEvent.VK_W); + }break; + case "BACKWARD":{ + r.keyPress(KeyEvent.VK_S); + r.delay(1000); + r.keyRelease(KeyEvent.VK_S); + }break; + case "LEFT":{ + r.keyPress(KeyEvent.VK_Q); + r.delay(1000); + r.keyRelease(KeyEvent.VK_Q); + }break; + case "RIGHT":{ + r.keyPress(KeyEvent.VK_E); + r.delay(1000); + r.keyRelease(KeyEvent.VK_E); + }break; + case "FIGHT":{ + fighting=true; + fightingaoe=false; + System.out.println("Fight mode: "+fighting); + }break; + case "FIGHTAOE":{ + fighting=fightingaoe=true; + System.out.println("Fight mode: "+fighting); + }break; + case "CHILL":{ + fighting=false; + System.out.println("Fight mode: "+fighting); + }break; + case "PASS":{ + System.out.println("Mythra's Health: "+GetMythraHealth()+"%"); + System.out.println("Aya's Health: "+GetAyaHealth()+"%"); + System.out.println("Target's Health: "+GetTargetHealth()+"%"); + }break; + case "SPRINT":{ + if (nextActionTimer==0){ + PressKey(KeyEvent.VK_N); + r.delay(100); + PressKey(KeyEvent.VK_N); + } else { + queueUpSprint=true; + } + }break; + case "UPDATE":{ + + }break; + default:{ + System.out.println("Unknown command: "+command); } - }break; - case "UPDATE":{ - - }break; - default:{ - System.out.println("Unknown command: "+command); } - } + }); + commandQueue.clear(); } - commandQueue.clear(); if (queueUpSprint&&nextActionTimer==0){ PressKey(KeyEvent.VK_N);