From ece6a6aac0f490fb35f3eff83bc27c1b28971e39 Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Thu, 7 Apr 2016 09:55:40 +0200 Subject: [PATCH] Support for multiple players using the mouse --- VirtualComputer/src/sznp/virtualcomputer/Commands.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/VirtualComputer/src/sznp/virtualcomputer/Commands.java b/VirtualComputer/src/sznp/virtualcomputer/Commands.java index 1638e65..1d947ed 100644 --- a/VirtualComputer/src/sznp/virtualcomputer/Commands.java +++ b/VirtualComputer/src/sznp/virtualcomputer/Commands.java @@ -162,11 +162,16 @@ public class Commands implements CommandExecutor + " [\"\",{\"text\":\" [Ctrl]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key ControlLeft\"}},{\"text\":\" [Alt]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key AltLeft\"}},{\"text\":\" [Space]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key Space\"}},{\"text\":\" [AltGr]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key AltRight\"}},{\"text\":\" [Ctrl]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key ControlRight\"}}]"); } else if (args[1].equalsIgnoreCase("mouse")) { - MouseLockerPlayerListener.MouseLocked = !MouseLockerPlayerListener.MouseLocked; - if (MouseLockerPlayerListener.MouseLocked) + if (!MouseLockerPlayerListener.LockedPlayers.contains(e.getPlayer())) + { + MouseLockerPlayerListener.LockedPlayers.add(e.getPlayer()); sender.sendMessage("§aMouse locked."); + } else + { + MouseLockedPlayerListener.LockedPlayers.remove(e.getPlayer()); sender.sendMessage("§bMouse unlocked."); + } } break; }