nathan

minecraft version: 26.1.2 paper server make it so that every time the day restarts or if like a day passes in game (make it determine if it has been a day whenever someone completes sleeping) everyone in the server teleports to this arena (the operator in the server can set where everyone gets teleported to by /arena tpset) and then when they get teleported to the arena they are invincible for 10 seconds and during that 10 seconds is a 10 second timer that counts down 10 9 8 7 6 5 4 3 2 1 fight! then invinvibility comes off and when they die they get teleported back to where they were last before being teleported and then 3rd place gets 10k 2nd place gets 50k 3rd place gets 100k and thats if 3 people joins the arena and each person that joins past 3 players is a 1.5x boost with the rewards and also the money rewards have to be able to be linked to economyshopgui money

Kodari AI
KodariSep 27 at 11:58 am 8
ArenaDayBattle
A Minecraft Paper plugin that triggers an automatic PvP arena battle every in-game day. When a player completes sleeping, all online players are teleported to a configurable arena location set via /arena tpset. Upon arrival, participants receive 10 seconds of invincibility with a visible countdown timer (10 to 1, then "Fight!"). After invincibility ends, players battle; upon death, they are teleported back to their pre-arena location. Rewards are distributed based on placement: 3rd place receives 10k, 2nd receives 50k, and 1st receives 100k. Each additional player beyond 3 multiplies all rewards by 1.5x. Money rewards integrate with EconomyShopGUI's economy system.
  1. Set up the Paper plugin and /arena tpset command.

  2. Start a round when the overworld reaches a new day, with a 10-second countdown and damage protection.

  3. Return eliminated players to their saved locations and pay the top three through the Vault currency used by EconomyShopGUI.

Created the DailyArena Paper plugin. An operator can set the destination with /arena tpset. When the overworld reaches a new day—including after a sleep skip—online players enter the arena, get 10 seconds of damage protection and a countdown, then fight. Eliminated players return to their saved locations.

With at least three entrants, prizes are 100k for 1st, 50k for 2nd, and 10k for 3rd, multiplied by 1.5 for each entrant beyond three. EconomyShopGUI must be configured to use its VAULT economy so the prizes reach the same money balance; the server also needs Vault and an active economy provider.

nathan

jar file

Kodari AI
KodariSep 27 at 11:58 am 1

There isn’t a compiled JAR in the project, and I can’t attach one from this environment. To build it on your computer with Gradle installed, run gradle jar in the project folder. The file will be build/libs/daily-arena-1.0.0.jar.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
5 354
src/main/java/com/kodari/dailyarena/DailyArenaPlugin.java
package com.kodari.dailyarena;

import net.milkbowl.vault.economy.Economy;
import net.milkbowl.vault.economy.EconomyResponse;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitTask;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;

public final class DailyArenaPlugin extends JavaPlugin implements Listener, CommandExecutor {
    private final Map<UUID, Location> returnLocations = new HashMap<>();
    private final Set<UUID> alive = new LinkedHashSet<>();
    private final Map<Integer, UUID> places = new HashMap<>();
    private BukkitTask countdown;
    private boolean protectedPhase;
    private boolean roundActive;
    private int entrantCount;
    private long lastDay;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        ConfigurationSection stored = getConfig().getConfigurationSection("returns");
        if (stored != null) {
            for (String key : stored.getKeys(false)) {
                try {
                    Location location = stored.getLocation(key);
                    if (location != null) {
                        returnLocations.put(UUID.fromString(key), location);
                    }
                } catch (IllegalArgumentException exception) {
                    getLogger().warning("Ignoring invalid saved return location for " + key);
                }
            }
        }

        World world = Bukkit.getWorlds().get(0);
        lastDay = world.getFullTime() / 24000L;
        getConfig().set("last-day", lastDay);
        saveConfig();

        getServer().getPluginManager().registerEvents(this, this);
        getCommand("arena").setExecutor(this);
        Bukkit.getScheduler().runTaskTimer(this, this::checkDay, 20L, 20L);
        for (Player player : Bukkit.getOnlinePlayers()) {
            Bukkit.getScheduler().runTask(this, () -> returnIfPending(player));
        }
    }

    @Override
    public void onDisable() {
        if (countdown != null) {
            countdown.cancel();
        }
        for (UUID id : new HashSet<>(alive)) {
            Player player = Bukkit.getPlayer(id);
            if (player != null && !player.isDead()) {
                returnPlayer(player);
            }
        }
        alive.clear();
        roundActive = false;
        saveConfig();
    }

    private Economy economy() {
        RegisteredServiceProvider<Economy> registration = getServer().getServicesManager().getRegistration(Economy.class);
        return registration == null ? null : registration.getProvider();
    }

    private void checkDay() {
        World world = Bukkit.getWorlds().get(0);
        long day = world.getFullTime() / 24000L;
        if (day <= lastDay) {
            return;
        }
        lastDay = day;
        getConfig().set("last-day", day);
        saveConfig();
        if (!roundActive) {
            startRound();
        }
    }

    private void startRound() {
        Location spawn = getConfig().getLocation("arena.spawn");
        if (spawn == null || spawn.getWorld() == null) {
            return;
        }
        Economy provider = economy();
        if (provider == null || !provider.isEnabled()) {
            getLogger().warning("No active Vault economy provider; skipping today's arena to avoid unpaid prizes.");
            return;
        }

        List<Player> entrants = new ArrayList<>();
        for (Player player : Bukkit.getOnlinePlayers()) {
            if (!player.isDead() && !returnLocations.containsKey(player.getUniqueId())) {
                entrants.add(player);
            }
        }
        if (entrants.size() < 2) {
            return;
        }

        roundActive = true;
        protectedPhase = true;
        entrantCount = entrants.size();
        places.clear();
        for (Player player : entrants) {
            UUID id = player.getUniqueId();
            returnLocations.put(id, player.getLocation().clone());
            getConfig().set("returns." + id, returnLocations.get(id));
            alive.add(id);
        }
        saveConfig();
        for (Player player : entrants) {
            player.teleport(spawn);
        }
        Bukkit.broadcastMessage(ChatColor.GOLD + "Daily arena: " + entrantCount + " players entered! Fight begins in 10 seconds.");
        countdown = Bukkit.getScheduler().runTaskTimer(this, new Runnable() {
            private int seconds = 10;

            @Override
            public void run() {
                if (!roundActive) {
                    countdown.cancel();
                    countdown = null;
                    return;
                }
                if (seconds == 0) {
                    protectedPhase = false;
                    for (UUID id : alive) {
                        Player player = Bukkit.getPlayer(id);
                        if (player != null) {
                            player.sendTitle(ChatColor.RED + "FIGHT!", "", 0, 25, 5);
                            player.sendMessage(ChatColor.RED + "FIGHT!");
                        }
                    }
                    countdown.cancel();
                    countdown = null;
                    return;
                }
                for (UUID id : alive) {
                    Player player = Bukkit.getPlayer(id);
                    if (player != null) {
                        player.sendTitle(ChatColor.YELLOW + String.valueOf(seconds), ChatColor.GREEN + "Invincible until the fight begins", 0, 25, 0);
                    }
                }
                seconds--;
            }
        }, 0L, 20L);
    }

    @EventHandler(ignoreCancelled = true)
    public void onDamage(EntityDamageEvent event) {
        if (protectedPhase && event.getEntity() instanceof Player player && alive.contains(player.getUniqueId())) {
            event.setCancelled(true);
        }
    }

    @EventHandler
    public void onDeath(PlayerDeathEvent event) {
        if (alive.contains(event.getEntity().getUniqueId())) {
            eliminate(event.getEntity().getUniqueId());
        }
    }

    @EventHandler
    public void onQuit(PlayerQuitEvent event) {
        if (alive.contains(event.getPlayer().getUniqueId())) {
            eliminate(event.getPlayer().getUniqueId());
        }
    }

    @EventHandler