Melvin Fransson

Make an plugin where staff (ops) or with luckperms perms can set a spawn point, by /setspawn and players can use /spawn, 3 seconds cooldown, if you mov, canceled, if leave canceled. And then if you typ /protectarea, you get an axe, and you select an area where you want to set the protecting area, only avaible for ops, or with perms, and you can set /permission, and like change who / all have perms to do in that area.

Kodari AI
KodariNov 14 at 4:09 pm 1
AreaProtectionSpawn
A Minecraft plugin enabling staff with ops or LuckPerms permissions to set a server spawn via /setspawn, while players use /spawn with a 3-second cooldown that cancels on movement or logout. Staff can also use /protectarea to receive an axe, select a region, and define it as protected. Within protected areas, admins can use /permission to configure which players or groups (via permissions) can perform actions, granting or restricting access dynamically.

Created the Java plugin with:

  • /setspawn and /spawn: starts a 3-second teleport warmup; moving or leaving cancels it.

  • /protectarea: gives staff a selection axe. Left-click the first corner, right-click the second, then run /protectarea create <name>.

  • /permission <area> <all|player> <allow|deny>: manage who can build in each area.

  • Ops bypass area protection; LuckPerms can grant areaguard.setspawn, areaguard.protect, areaguard.permission, and areaguard.bypass. Spawn and area data are saved in config.yml.

Kodari can make mistakes. Review important code before using.
Files
src
Code
8 713
src/main/java/com/kodari/areaguard/AreaGuardPlugin.java
package com.kodari.areaguard;

import org.bukkit.NamespacedKey;
import org.bukkit.plugin.java.JavaPlugin;

public class AreaGuardPlugin extends JavaPlugin {
    private RegionManager regionManager;
    private SpawnManager spawnManager;
    private NamespacedKey selectionKey;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        selectionKey = new NamespacedKey(this, "selection_tool");
        regionManager = new RegionManager(this);
        spawnManager = new SpawnManager(this);

        AreaGuardCommand command = new AreaGuardCommand(this);
        for (String name : new String[]{"spawn", "setspawn", "protectarea", "permission"}) {
            getCommand(name).setExecutor(command);
            getCommand(name).setTabCompleter(command);
        }
        getServer().getPluginManager().registerEvents(new ProtectionListener(this), this);
    }

    @Override
    public void onDisable() {
        if (spawnManager != null) {
            spawnManager.cancelAll();
        }
    }

    public RegionManager getRegionManager() {
        return regionManager;
    }

    public SpawnManager getSpawnManager() {
        return spawnManager;
    }

    public NamespacedKey getSelectionKey() {
        return selectionKey;
    }
}