use of au.com.mineauz.minigames.minigame.modules.LobbySettingsModule in project Minigames by AddstarMC.
the class MinigamesTest method onJoinMinigame.
@Test
public void onJoinMinigame() {
assertNotSame(player.getLocation(), game.getLobbyPosition());
plugin.getPlayerManager().addMinigamePlayer(player);
MinigamePlayer mplayer = plugin.getPlayerManager().getMinigamePlayer(player.getUniqueId());
plugin.getPlayerManager().joinMinigame(mplayer, game, false, 0D);
LobbySettingsModule module = (LobbySettingsModule) game.getModule("LobbySettings");
player.assertLocation(lobby, 0);
assertTrue(module.isTeleportOnStart());
assertNotSame(player.getLocation(), game.getStartLocations().indexOf(0));
server.getScheduler().performTicks(200L);
player.assertLocation(start, 0);
server.getScheduler().performTicks(200L);
player.assertLocation(quit, 0);
}
use of au.com.mineauz.minigames.minigame.modules.LobbySettingsModule in project Minigames by AddstarMC.
the class SetLobbyCommand method onCommand.
@Override
public boolean onCommand(CommandSender sender, Minigame minigame, String label, String[] args) {
if (args == null) {
minigame.setLobbyPosition(((Player) sender).getLocation());
sender.sendMessage(ChatColor.GRAY + "Lobby position has been set for " + minigame);
return true;
} else {
LobbySettingsModule lobby = LobbySettingsModule.getMinigameModule(minigame);
if (args.length == 3) {
if (args[0].equalsIgnoreCase("canmove")) {
boolean v = true;
v = Boolean.getBoolean(args[2]);
if (args[1].equalsIgnoreCase("playerwait")) {
lobby.setCanMovePlayerWait(v);
if (v)
sender.sendMessage(ChatColor.GRAY + "Allowed players to move in lobby on player wait.");
else
sender.sendMessage(ChatColor.GRAY + "Disallowed players to move in lobby on player wait.");
} else if (args[1].equalsIgnoreCase("startwait")) {
lobby.setCanMoveStartWait(v);
if (v)
sender.sendMessage(ChatColor.GRAY + "Allowed players to move in lobby on start wait.");
else
sender.sendMessage(ChatColor.GRAY + "Disallowed players to move in lobby on start wait.");
} else {
sender.sendMessage(ChatColor.RED + "Invalid syntax!");
return false;
}
} else if (args[0].equalsIgnoreCase("caninteract")) {
boolean v = true;
v = Boolean.getBoolean(args[2]);
if (args[1].equalsIgnoreCase("playerwait")) {
lobby.setCanInteractPlayerWait(v);
if (v)
sender.sendMessage(ChatColor.GRAY + "Allowed players to interact in lobby on player wait.");
else
sender.sendMessage(ChatColor.GRAY + "Disallowed players to interact in lobby on player wait.");
} else if (args[1].equalsIgnoreCase("startwait")) {
lobby.setCanInteractStartWait(v);
if (v)
sender.sendMessage(ChatColor.GRAY + "Allowed players to interact in lobby on start wait.");
else
sender.sendMessage(ChatColor.GRAY + "Disallowed players to interact in lobby on start wait.");
} else {
sender.sendMessage(ChatColor.RED + "Invalid syntax!");
return false;
}
} else if (args[0].equalsIgnoreCase("teleport")) {
boolean v = Boolean.parseBoolean(args[2]);
if (args[1].equalsIgnoreCase("playerwait")) {
lobby.setTeleportOnPlayerWait(v);
if (v)
sender.sendMessage(ChatColor.GRAY + "Allowed players to teleport out of lobby on player wait.");
else
sender.sendMessage(ChatColor.GRAY + "Disallowed players to teleport out of lobby on player wait.");
} else if (args[1].equalsIgnoreCase("startwait")) {
lobby.setTeleportOnStart(v);
if (v)
sender.sendMessage(ChatColor.GRAY + "Allowed players to teleport out of lobby on start.");
else
sender.sendMessage(ChatColor.GRAY + "Disallowed players to teleport out of lobby on start.");
} else {
sender.sendMessage(ChatColor.RED + "Invalid syntax!");
return false;
}
} else {
sender.sendMessage(ChatColor.RED + "Invalid syntax!");
return false;
}
} else if (args.length == 2) {
if (args[0].equalsIgnoreCase("playerWait")) {
try {
int value = Integer.parseInt(args[1]);
if (value < 0) {
value = 0;
}
lobby.setPlayerWaitTime(value);
if (value == 0) {
sender.sendMessage(ChatColor.GRAY + "Using the default player wait time.");
} else {
sender.sendMessage(ChatColor.GRAY + "Using player wait time of " + value + " seconds.");
}
} catch (NumberFormatException e) {
sender.sendMessage(ChatColor.RED + "Invalid syntax!");
return false;
}
}
}
return true;
}
}
Aggregations