File tree Expand file tree Collapse file tree 3 files changed +16
-2
lines changed
main/java/org/mini2Dx/miniscript/core/util
test/java/org/mini2Dx/miniscript/core/util Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Original file line number Diff line number Diff line change 1+ [1.7.1]
2+ - Fix interactive script running flag always being set to true. Update unit test.
3+
14[1.7.0]
25- Prevent game future execution by checking for script skipping in constructor
36- Allow scripts to be marked as player interactive to restrict one interactive script running at a time
Original file line number Diff line number Diff line change @@ -47,7 +47,9 @@ private ScriptInvocation pollInteractiveScript() {
4747 interactiveScriptLock .lockWrite ();
4848 if (!interactiveScriptRunning .get ()) {
4949 result = interactiveScriptQueue .poll ();
50- interactiveScriptRunning .set (true );
50+ if (result != null ) {
51+ interactiveScriptRunning .set (true );
52+ }
5153 }
5254 interactiveScriptLock .unlockWrite ();
5355 return result ;
@@ -82,4 +84,8 @@ public void clearInteractiveScriptStatus() {
8284 interactiveScriptRunning .set (false );
8385 interactiveScriptLock .unlockWrite ();
8486 }
87+
88+ public boolean isInteractiveScriptRunnung () {
89+ return interactiveScriptRunning .get ();
90+ }
8591}
Original file line number Diff line number Diff line change @@ -25,7 +25,6 @@ public void testOnlyOneInteractiveScriptPolled() {
2525 invocationQueue .offer (createInvocation (i % 10 == 0 ? INTERACTIVE_SCRIPT_ID : i , i % 10 == 0 ));
2626 }
2727
28-
2928 final CountDownLatch countDownLatch = new CountDownLatch (threads .length );
3029
3130 for (int i = 0 ; i < threads .length ; i ++) {
@@ -57,6 +56,12 @@ public void testOnlyOneInteractiveScriptPolled() {
5756 while (!invocationQueue .isEmpty ()) {
5857 Assert .assertTrue (interactiveScriptsRunning .get () <= 1 );
5958 }
59+ for (int i = 0 ; i < threads .length ; i ++) {
60+ try {
61+ threads [i ].join ();
62+ } catch (InterruptedException e ) {}
63+ }
64+ Assert .assertFalse (invocationQueue .isInteractiveScriptRunnung ());
6065 }
6166
6267 private ScriptInvocation createInvocation (int scriptId , boolean interactive ) {
You can’t perform that action at this time.
0 commit comments