use of com.ebicep.warlords.game.option.PreGameItemOption in project Warlords by ebicep.
the class PreLobbyState method begin.
@Override
public void begin() {
this.maxTimer = game.getMap().getLobbyCountdown();
this.resetTimer();
game.setAcceptsPlayers(true);
game.setAcceptsSpectators(false);
for (Option option : game.getOptions()) {
if (option instanceof PreGameItemOption) {
PreGameItemOption preGameItemOption = (PreGameItemOption) option;
items[preGameItemOption.getSlot()] = preGameItemOption;
}
}
}
use of com.ebicep.warlords.game.option.PreGameItemOption in project Warlords by ebicep.
the class PreLobbyState method onPlayerReJoinGame.
@Override
public void onPlayerReJoinGame(Player player) {
State.super.onPlayerReJoinGame(player);
Team team = game.getPlayerTeam(player.getUniqueId());
player.getActivePotionEffects().clear();
if (team == null) {
player.getInventory().clear();
player.setAllowFlight(true);
player.setGameMode(GameMode.SPECTATOR);
} else {
player.getInventory().clear();
player.setAllowFlight(false);
player.setGameMode(GameMode.ADVENTURE);
for (PreGameItemOption item : items) {
if (item != null) {
player.getInventory().setItem(item.getSlot(), item.getItem(game, player));
}
}
ArmorManager.resetArmor(player, Warlords.getPlayerSettings(player.getUniqueId()).getSelectedClass(), team);
}
LobbyLocationMarker location = LobbyLocationMarker.getRandomLobbyLocation(game, team);
if (location != null) {
player.teleport(location.getLocation());
Warlords.setRejoinPoint(player.getUniqueId(), location.getLocation());
} else {
System.out.println("Unable to warp player to lobby!, no lobby marker found");
}
}
Aggregations