Search in sources :

Example 1 with DebugLocationMarker

use of com.ebicep.warlords.game.option.marker.DebugLocationMarker in project Warlords by ebicep.

the class DebugMenuPlayerOptions method openTeleportLocations.

public static void openTeleportLocations(Player player, WarlordsPlayer target) {
    Menu menu = new Menu("Teleport To: " + target.getName(), 9 * 5);
    Game game = target.getGame();
    int x = 0;
    int y = 0;
    for (DebugLocationMarker marker : game.getMarkers(DebugLocationMarker.class)) {
        menu.setItem(x, y, marker.getAsItem(), (m, e) -> {
            target.teleport(marker.getLocation());
            player.sendMessage(ChatColor.RED + "DEV: " + target.getColoredName() + "§a was teleported to " + marker.getName());
        });
        x++;
        if (x > 8) {
            x = 0;
            y++;
        }
    }
    menu.setItem(3, 4, MENU_BACK, (m, e) -> openPlayerMenu(player, target));
    menu.setItem(4, 4, MENU_CLOSE, ACTION_CLOSE_MENU);
    menu.openForPlayer(player);
}
Also used : Game(com.ebicep.warlords.game.Game) DebugLocationMarker(com.ebicep.warlords.game.option.marker.DebugLocationMarker) Menu(com.ebicep.warlords.menu.Menu)

Aggregations

Game (com.ebicep.warlords.game.Game)1 DebugLocationMarker (com.ebicep.warlords.game.option.marker.DebugLocationMarker)1 Menu (com.ebicep.warlords.menu.Menu)1