Support for multiple players using the mouse

This commit is contained in:
Norbi Peti 2016-04-07 09:55:40 +02:00
parent e667097552
commit ece6a6aac0

View file

@ -162,12 +162,17 @@ 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;
}
}