// Path: src/main/java/com/github/mmonkey/destinations/events/PlayerTeleportGrabEvent.java
// public class PlayerTeleportGrabEvent extends AbstractPlayerTeleportEvent implements PlayerTeleportEvent.Grab {
// 
//     /**
//      * PlayerTeleportGrabEvent constructor
//      *
//      * @param player   Player
//      * @param location Location
//      * @param rotation Vector3d
//      */
//     public PlayerTeleportGrabEvent(Player player, Location<World> location, Vector3d rotation) {
//         super(player, location, rotation);
//     }
// }
// 
// Path: src/main/java/com/github/mmonkey/destinations/events/PlayerTeleportPreEvent.java
// public class PlayerTeleportPreEvent extends AbstractPlayerTeleportEvent implements PlayerTeleportEvent.Pre {
// 
//     /**
//      * PlayerTeleportPreEvent constructor
//      *
//      * @param player   Player
//      * @param location Location
//      * @param rotation Vector3d
//      */
//     public PlayerTeleportPreEvent(Player player, Location<World> location, Vector3d rotation) {
//         super(player, location, rotation);
//     }
// 
// }
// 
// Path: src/main/java/com/github/mmonkey/destinations/utilities/MessagesUtil.java
// public class MessagesUtil {
// 
//     /**
//      * Get the message associated with this key, for this player's locale
//      *
//      * @param player Player
//      * @param key    String
//      * @param args   String.format args
//      * @return Text formatting of message
//      */
//     public static Text get(Player player, String key, Object... args) {
//         ResourceBundle messages = PlayerCache.instance.getResourceCache(player);
//         return messages.containsKey(key) ? Text.of(String.format(messages.getString(key), args)) : Text.EMPTY;
//     }
// 
//     /**
//      * Get the message associated with this key, for this player's locale.
//      * Message colored as a success (green).
//      *
//      * @param player Player
//      * @param key    String
//      * @param args   String.format args
//      * @return Text formatting of message
//      */
//     public static Text success(Player player, String key, Object... args) {
//         return Text.of(TextColors.GREEN, get(player, key, args));
//     }
// 
//     /**
//      * Get the message associated with this key, for this player's locale.
//      * Message colored as a warning (gold).
//      *
//      * @param player Player
//      * @param key    String
//      * @param args   String.format args
//      * @return Text formatting of message
//      */
//     public static Text warning(Player player, String key, Object... args) {
//         return Text.of(TextColors.GOLD, get(player, key, args));
//     }
// 
//     /**
//      * Get the message associated with this key, for this player's locale.
//      * Message colored as an error (red).
//      *
//      * @param player Player
//      * @param key    String
//      * @param args   String.format args
//      * @return Text formatting of message
//      */
//     public static Text error(Player player, String key, Object... args) {
//         return Text.of(TextColors.RED, get(player, key, args));
//     }
// 
// }


import com.github.mmonkey.destinations.events.PlayerTeleportGrabEvent;
import com.github.mmonkey.destinations.events.PlayerTeleportPreEvent;
import com.github.mmonkey.destinations.utilities.MessagesUtil;
import org.spongepowered.api.Sponge;
import org.spongepowered.api.command.CommandException;
import org.spongepowered.api.command.CommandResult;
import org.spongepowered.api.command.CommandSource;
import org.spongepowered.api.command.args.CommandContext;
import org.spongepowered.api.command.args.GenericArguments;
import org.spongepowered.api.command.spec.CommandExecutor;
import org.spongepowered.api.command.spec.CommandSpec;
import org.spongepowered.api.entity.living.player.Player;
import org.spongepowered.api.text.Text;
package com.github.mmonkey.destinations.commands;


public class GrabCommand implements CommandExecutor {

    public static final String[] ALIASES = {"grab", "tphere"};

    /**
     * Get the Command Specifications for this command
     *
     * @return CommandSpec
     */
    public static CommandSpec getCommandSpec() {
        return CommandSpec.builder()
                .permission("destinations.tphere")
                .description(Text.of("/grab <player> or /tphere <player>"))
                .extendedDescription(Text.of("Teleports a player to your current location."))
                .executor(new GrabCommand())
                .arguments(GenericArguments.player(Text.of("player")))
                .build();
    }

    @Override
    public CommandResult execute(CommandSource src, CommandContext args) throws CommandException {

        if (!(src instanceof Player)) {
            return CommandResult.empty();
        }

        Player requester = (Player) src;
        Player target = (Player) args.getOne("player").orElse(null);

        if (target == null) {
// Path: src/main/java/com/github/mmonkey/destinations/events/PlayerTeleportGrabEvent.java
// public class PlayerTeleportGrabEvent extends AbstractPlayerTeleportEvent implements PlayerTeleportEvent.Grab {
// 
//     /**
//      * PlayerTeleportGrabEvent constructor
//      *
//      * @param player   Player
//      * @param location Location
//      * @param rotation Vector3d
//      */
//     public PlayerTeleportGrabEvent(Player player, Location<World> location, Vector3d rotation) {
//         super(player, location, rotation);
//     }
// }
// 
// Path: src/main/java/com/github/mmonkey/destinations/events/PlayerTeleportPreEvent.java
// public class PlayerTeleportPreEvent extends AbstractPlayerTeleportEvent implements PlayerTeleportEvent.Pre {
// 
//     /**
//      * PlayerTeleportPreEvent constructor
//      *
//      * @param player   Player
//      * @param location Location
//      * @param rotation Vector3d
//      */
//     public PlayerTeleportPreEvent(Player player, Location<World> location, Vector3d rotation) {
//         super(player, location, rotation);
//     }
// 
// }
// 
// Path: src/main/java/com/github/mmonkey/destinations/utilities/MessagesUtil.java
// public class MessagesUtil {
// 
//     /**
//      * Get the message associated with this key, for this player's locale
//      *
//      * @param player Player
//      * @param key    String
//      * @param args   String.format args
//      * @return Text formatting of message
//      */
//     public static Text get(Player player, String key, Object... args) {
//         ResourceBundle messages = PlayerCache.instance.getResourceCache(player);
//         return messages.containsKey(key) ? Text.of(String.format(messages.getString(key), args)) : Text.EMPTY;
//     }
// 
//     /**
//      * Get the message associated with this key, for this player's locale.
//      * Message colored as a success (green).
//      *
//      * @param player Player
//      * @param key    String
//      * @param args   String.format args
//      * @return Text formatting of message
//      */
//     public static Text success(Player player, String key, Object... args) {
//         return Text.of(TextColors.GREEN, get(player, key, args));
//     }
// 
//     /**
//      * Get the message associated with this key, for this player's locale.
//      * Message colored as a warning (gold).
//      *
//      * @param player Player
//      * @param key    String
//      * @param args   String.format args
//      * @return Text formatting of message
//      */
//     public static Text warning(Player player, String key, Object... args) {
//         return Text.of(TextColors.GOLD, get(player, key, args));
//     }
// 
//     /**
//      * Get the message associated with this key, for this player's locale.
//      * Message colored as an error (red).
//      *
//      * @param player Player
//      * @param key    String
//      * @param args   String.format args
//      * @return Text formatting of message
//      */
//     public static Text error(Player player, String key, Object... args) {
//         return Text.of(TextColors.RED, get(player, key, args));
//     }
// 
// }


// Path: src/main/java/com/github/mmonkey/destinations/commands/GrabCommand.java
import com.github.mmonkey.destinations.events.PlayerTeleportGrabEvent;
import com.github.mmonkey.destinations.events.PlayerTeleportPreEvent;
import com.github.mmonkey.destinations.utilities.MessagesUtil;
import org.spongepowered.api.Sponge;
import org.spongepowered.api.command.CommandException;
import org.spongepowered.api.command.CommandResult;
import org.spongepowered.api.command.CommandSource;
import org.spongepowered.api.command.args.CommandContext;
import org.spongepowered.api.command.args.GenericArguments;
import org.spongepowered.api.command.spec.CommandExecutor;
import org.spongepowered.api.command.spec.CommandSpec;
import org.spongepowered.api.entity.living.player.Player;
import org.spongepowered.api.text.Text;

package com.github.mmonkey.destinations.commands;


public class GrabCommand implements CommandExecutor {

    public static final String[] ALIASES = {"grab", "tphere"};

    /**
     * Get the Command Specifications for this command
     *
     * @return CommandSpec
     */
    public static CommandSpec getCommandSpec() {
        return CommandSpec.builder()
                .permission("destinations.tphere")
                .description(Text.of("/grab <player> or /tphere <player>"))
                .extendedDescription(Text.of("Teleports a player to your current location."))
                .executor(new GrabCommand())
                .arguments(GenericArguments.player(Text.of("player")))
                .build();
    }

    @Override
    public CommandResult execute(CommandSource src, CommandContext args) throws CommandException {

        if (!(src instanceof Player)) {
            return CommandResult.empty();
        }

        Player requester = (Player) src;
        Player target = (Player) args.getOne("player").orElse(null);

        if (target == null) {
            requester.sendMessage(MessagesUtil.error(requester, "grab.invalid_player"));