xotiic_596

Make me a plugin that has /1v1 and it tps you to a random place in the over world with one other person with 10 blocks infront of you and make it so you cant spawn in any blocks

Kodari AI
KodariMar 22 at 12:41 pm 7,234 (v2)

I’ll create a 1v1 plugin that pairs players in a queue and teleports them to safe random locations in the overworld, 10 blocks apart.

OneVOne
A competitive 1v1 matchmaking plugin that pairs players together and teleports them to random safe locations in the overworld. Players use /1v1 to join the queue and are automatically matched with another player. Both players spawn 10 blocks apart facing each other on solid ground, ensuring fair PvP encounters. Features configurable world boundaries, safe spawn detection, and customizable messages.

Plugin created! Players can use /1v1 to join the queue. When two players are queued, they’ll be teleported to a random safe location 10 blocks apart facing each other. The plugin ensures spawns are on solid ground with no blocks obstructing the players.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
7 374
src/main/java/com/example/onevone/OneVOnePlugin.java
package com.example.onevone;

import com.example.onevone.command.OneVOneCommand;
import com.example.onevone.manager.QueueManager;
import com.example.onevone.util.SafeLocationFinder;
import lombok.Getter;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public class OneVOnePlugin extends JavaPlugin {

    private QueueManager queueManager;
    private SafeLocationFinder locationFinder;

    @Override
    public void onEnable() {
        saveDefaultConfig();

        this.locationFinder = new SafeLocationFinder(this);
        this.queueManager = new QueueManager(this);

        getCommand("1v1").setExecutor(new OneVOneCommand(this));

        getLogger().info("OneVOne plugin enabled!");
    }

    @Override
    public void onDisable() {
        if (queueManager != null) {
            queueManager.clearQueue();
        }
        getLogger().info("OneVOne plugin disabled!");
    }

    public String getMessage(String path) {
        return getConfig().getString("messages." + path, "&cMessage not found: " + path)
                .replace("&", "§");
    }
}