Untitled

 avatar
unknown
plain_text
a year ago
1.6 kB
1
Indexable
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

public class KitPvPPlugin extends JavaPlugin implements CommandExecutor {

    @Override
    public void onEnable() {
        this.getCommand("kitpvp").setExecutor(this);
    }

    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        if (cmd.getName().equalsIgnoreCase("kitpvp")) {
            if (sender instanceof Player) {
                Player player = (Player) sender;
                if (args.length == 0) {
                    player.sendMessage(ChatColor.RED + "Please specify a kit!");
                    return true;
                }

                String kit = args[0];
                // TODO: Give the player the items for the specified kit

                // Teleport the player to the PvP area
                Location pvpArea = new Location(Bukkit.getWorld("world"), 0, 64, 0); // Change this to your PvP area's coordinates
                player.teleport(pvpArea);

                player.sendMessage(ChatColor.GREEN + "You have been teleported to the PvP area with the " + kit + " kit!");
            } else {
                sender.sendMessage(ChatColor.RED + "Only players can use this command!");
            }
            return true;
        }
        return false;
    }
}
Editor is loading...
Leave a Comment