30 lines
1 KiB
Java
30 lines
1 KiB
Java
package dev.zontreck.ase.commands;
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
import com.mojang.brigadier.Command;
|
|
import com.mojang.brigadier.context.CommandContext;
|
|
|
|
import dev.zontreck.ase.AriasServerEssentials;
|
|
import dev.zontreck.ase.SavedData;
|
|
import io.papermc.paper.command.brigadier.CommandSourceStack;
|
|
import net.md_5.bungee.api.ChatColor;
|
|
|
|
public class HomeCommand {
|
|
public static final String PERMISSION = "ase.commands.home";
|
|
|
|
public static int execute(CommandContext<CommandSourceStack> ctx, String homeName) {
|
|
// We can now teleport to the home
|
|
Player player = (Player) ctx.getSource().getSender();
|
|
SavedData data = AriasServerEssentials.getPlayerData(player.getUniqueId().toString());
|
|
|
|
if (data.homes.containsKey(homeName)) {
|
|
data.homes.get(homeName).apply(player);
|
|
player.sendMessage(ChatColor.DARK_GREEN + "Teleporting home...");
|
|
} else {
|
|
player.sendMessage(ChatColor.DARK_RED + "No such home could be found");
|
|
}
|
|
|
|
return Command.SINGLE_SUCCESS;
|
|
}
|
|
}
|