Search in sources :

Example 6 with Map

use of com.voxelgameslib.voxelgameslib.map.Map in project VoxelGamesLibv2 by VoxelGamesLib.

the class WorldCommands method tp.

@Subcommand("tp")
@CommandPermission("%admin")
@Syntax("<world> - the name of the world to tp to")
@Description("Teleports you to a world")
public void tp(@Nonnull User sender, @Nonnull String world) {
    Optional<Map> o = handler.getMap(world);
    if (o.isPresent()) {
        Map map = o.get();
        sender.getPlayer().teleport(map.getCenter().toLocation(map.getLoadedName(sender.getUuid())));
    } else {
        World w = Bukkit.getWorld(world);
        if (w != null) {
            sender.getPlayer().teleport(Bukkit.getWorld(world).getSpawnLocation());
        }
        Lang.msg(sender, LangKey.WORLD_UNKNOWN_MAP, world);
    }
}
Also used : World(org.bukkit.World) Map(com.voxelgameslib.voxelgameslib.map.Map) Description(co.aikar.commands.annotation.Description) Subcommand(co.aikar.commands.annotation.Subcommand) Syntax(co.aikar.commands.annotation.Syntax) CommandPermission(co.aikar.commands.annotation.CommandPermission)

Aggregations

Map (com.voxelgameslib.voxelgameslib.map.Map)6 CommandPermission (co.aikar.commands.annotation.CommandPermission)4 Subcommand (co.aikar.commands.annotation.Subcommand)4 Syntax (co.aikar.commands.annotation.Syntax)3 Description (co.aikar.commands.annotation.Description)2 WorldException (com.voxelgameslib.voxelgameslib.exception.WorldException)2 MapFeature (com.voxelgameslib.voxelgameslib.feature.features.MapFeature)2 SpawnFeature (com.voxelgameslib.voxelgameslib.feature.features.SpawnFeature)2 File (java.io.File)2 ZipFile (net.lingala.zip4j.core.ZipFile)2 ZipException (net.lingala.zip4j.exception.ZipException)2 JsonReader (com.google.gson.stream.JsonReader)1 Scoreboard (com.voxelgameslib.voxelgameslib.components.scoreboard.Scoreboard)1 MapException (com.voxelgameslib.voxelgameslib.exception.MapException)1 MapInfo (com.voxelgameslib.voxelgameslib.map.MapInfo)1 Vector3D (com.voxelgameslib.voxelgameslib.map.Vector3D)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 InputStreamReader (java.io.InputStreamReader)1 ArrayList (java.util.ArrayList)1