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,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\"}}]"); + " [\"\",{\"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")) } else if (args[1].equalsIgnoreCase("mouse"))
{ {
MouseLockerPlayerListener.MouseLocked = !MouseLockerPlayerListener.MouseLocked; if (!MouseLockerPlayerListener.LockedPlayers.contains(e.getPlayer()))
if (MouseLockerPlayerListener.MouseLocked) {
MouseLockerPlayerListener.LockedPlayers.add(e.getPlayer());
sender.sendMessage("§aMouse locked."); sender.sendMessage("§aMouse locked.");
}
else else
{
MouseLockedPlayerListener.LockedPlayers.remove(e.getPlayer());
sender.sendMessage("§bMouse unlocked."); sender.sendMessage("§bMouse unlocked.");
}
} }
break; break;
} }