From f4871574d334c12cdc7f8e01137b2e85be87f1fe Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Thu, 15 Jul 2021 22:37:08 +0200 Subject: [PATCH] Add check for when the session state doesn't actually change --- .../src/main/java/sznp/virtualcomputer/Computer.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/VirtualComputer-Core/src/main/java/sznp/virtualcomputer/Computer.java b/VirtualComputer-Core/src/main/java/sznp/virtualcomputer/Computer.java index d2d4b4a..9305754 100644 --- a/VirtualComputer-Core/src/main/java/sznp/virtualcomputer/Computer.java +++ b/VirtualComputer-Core/src/main/java/sznp/virtualcomputer/Computer.java @@ -105,6 +105,10 @@ public final class Computer { */ public void onLock(CommandSender sender) { System.out.println("A"); + if (session.getState() != SessionState.Locked) { + sendMessage(sender, "§cFailed to start computer! Failed to lock session"); + return; + } machine = session.getMachine(); // This is the Machine object we can work with final IConsole console = session.getConsole(); if (embedded) { //Otherwise it's set while starting the VM