slxps_za

make a plugin where i can op somebody else but it prevents them from droping stuff in creative and / give stuff to other players but they can still give items to themself and make it so they cant hurt people in creative or throw harmful stuff or do anything that could hurt them and make a menu for it so i can do /mod and it will have a menu with all the players online and make it so i can click on a player and add a /mod command so it will give them certain perms and add all the things i said but make it so i can enable and disable that

Kodari AI
KodariOct 2 at 2:42 pm 1
ModeratorControlPanel
A Bukkit plugin that provides a /mod command opening a GUI menu listing all online players. Clicking a player grants them moderator status with restricted permissions. Moderators can op other players but cannot drop items in creative, give items to others (self-giving allowed), or harm players in creative mode. The plugin includes a toggle system to enable or disable these restrictions, ensuring safe moderation without griefing capabilities.
  1. Create a Paper plugin with /mod player-selection GUI and direct player commands.

  2. Grant/revoke operator status with a saved protection list and a global enable/disable switch.

  3. Enforce creative-mode drop, damage, projectile, and hazardous-item protections, plus restrict protected operators’ /give to themselves.

Created CreativeModGuard with:

  • /mod opens a paginated menu of online players. Click a player to grant or revoke OP and their protection.

  • /mod <player> [on|off] manages a player directly; /mod enable, /mod disable, and /mod toggle control protection globally.

  • Protected players can use /give on themselves but not other players. In Creative, they cannot drop items, damage players, launch projectiles, ignite blocks, or use several hazardous items. Common destructive commands are also blocked.

  • Protection settings are saved across restarts.

Note: Granting OP gives full Bukkit operator permissions; this plugin blocks the listed actions and commands, but it is not a granular permissions system.

slxps_za

and make ssure they have a blue mod tag above thier head and make it so thier is also a tag called owner in gold or yellow only for the player Mikey_ZA aka me

Kodari AI
KodariOct 2 at 2:42 pm 1

Plan:

  1. Add scoreboard teams for blue [MOD] and gold [OWNER] overhead tags.

  2. Refresh tags on startup, joins, and moderator grant/revoke; give Mikey_ZA the owner tag in place of the mod tag.

Added scoreboard overhead tags: protected moderators display [MOD] in blue, while Mikey_ZA displays [OWNER] in gold. Tags refresh when players join or their moderator status changes.

slxps_za

also make it so they cant blow up stuff when they are mod and cant break blocks taht players have placed and cant place in places blocks withing 4 chunks of any players or 4 chunk of where any player logged off

Kodari AI
KodariOct 2 at 2:53 pm 1
  1. Cancel explosions caused by moderators so they can’t damage blocks.

  2. Track player-placed blocks and prevent moderators from breaking them.

  3. Block moderator block placement within four chunks of online players or saved logout locations.

Added the protections for enabled moderators:

  • Their TNT, fireballs, and other attributed explosions are cancelled; explosive items and bed/respawn-anchor triggers are blocked.

  • They can’t break blocks placed by players. Placed-block records persist across restarts.

  • They can’t place blocks within four chunks of any online player—including themselves—or a player’s saved most recent logout location.

Logout locations and placed-block records are saved in the plugin config.

slxps_za

and make it so they cant spawn in any hostile mobs with spawn eggs but they can /spawn it in

Kodari AI
KodariOct 2 at 2:53 pm 1

Plan:

  1. Block hostile-mob spawn eggs for protected moderators.

  2. Keep command-based spawning available by allowing /summon (while /execute remains blocked).

Protected moderators can no longer use hostile-mob spawn eggs. /summon remains available for command-based spawning; /execute is still blocked to prevent bypassing command restrictions.

slxps_za

fix the mod menu it is not working anymore when i try do /mod it is a paper server version 1.21.11

Kodari AI
KodariOct 2 at 2:57 pm 1

Plan:

  1. Allow protected moderators to access /mod instead of blocking it in command preprocessing.

  2. Update the plugin build target and metadata for Paper 1.21.11.

Fixed the /mod menu access: protected moderators were having the command blocked before it could open. Updated the build to target Paper 1.21.11 and Java 21 as well.

slxps_za

no make it so protected mod cant acces the /mod

Kodari AI
KodariOct 2 at 2:58 pm 1
  1. Deny /mod to players in the protected-moderator list, even though OP would otherwise grant command permission.

  2. Close and reject interactions with an already-open mod menu for protected players.

Protected moderators are now denied /mod even though they’re OP. If they already have the menu open, clicking it closes the menu and denies access.

slxps_za

and make it so they cant /op or deop anyone to

Kodari AI
KodariOct 2 at 2:59 pm 1

I’ll block /op and /deop for protected moderators even when the global protection toggle is off; their restrictions won’t depend on that toggle.

Protected moderators can no longer use /op or /deop, even when the global protection toggle is disabled.

slxps_za

can you make the menu show all the players that have played the server not just the ones online

Kodari AI
KodariOct 2 at 3:09 pm 1
  1. Find how /mod builds and paginates its player menu.

  2. Add previously seen server players to the menu while preserving online player actions.

The /mod menu now lists players the server knows have joined, including offline players. Offline entries are labeled and can be clicked to grant or revoke protected OP status; their overhead tag updates when they next join.

slxps_za

can you see what is wrong in this plugin it made the server crash and the server just wont start up it says this [17:34:32 WARN]: [spark] Timed out waiting for world statistics everytime

Kodari AI
KodariOct 2 at 3:37 pm 1

The code does synchronously rewrite the entire config—including every tracked placed block—on each block place/break and player logout. That can cause severe lag as the list grows, though the Spark timeout alone doesn’t prove it caused the startup failure. I’m batching those writes and flushing pending changes on shutdown. If the server still won’t start, the full startup log is needed to identify a definitive crash cause.

I found a likely performance problem: every block place/break and player logout rewrote the entire config, including the growing list of tracked blocks. I changed it to batch writes every five seconds and flush pending changes when the plugin shuts down.

The Spark timeout by itself doesn’t confirm the cause, and this change may not fix an already oversized plugins/CreativeModGuard/config.yml; the plugin still loads the saved block list at startup. Back up that file and check how large player-placed-blocks has grown. If startup still fails, temporarily disable the plugin to test whether it’s involved, then share the full startup log—especially the first error or exception, not just the Spark warning.

slxps_za

please fix anything you can

Kodari AI
KodariOct 2 at 3:41 pm 1

I’ll inspect the plugin’s startup and persistence paths, then fix concrete causes of slow or failed startup that the code reveals.

  • Move the growing placed-block index out of config.yml so normal settings saves stay small.

  • Keep existing block records compatible and write future snapshots off the server thread.

  • Check plugin metadata for startup issues before patching.

I changed CreativeModGuardPlugin so the growing player-placed-block list is stored in player-placed-blocks.txt instead of repeatedly rewriting the whole config.yml. Updates are batched, written asynchronously with an atomic file replacement, and flushed during shutdown. Existing entries in the config are migrated when the plugin next loads successfully.

The Spark world-statistics timeout is only a warning, not enough to identify the startup crash. If the server still won’t start, share the first exception or error from the startup log; the one-time migration still has to read the existing config.

slxps_za

can you also make it so i can search for certain players in the mod menu add that please

Kodari AI
KodariOct 2 at 3:46 pm 1
  1. Locate the /mod player menu and its pagination/click handling.

  2. Add a search flow that filters the full online/offline player list.

Added player search to the /mod menu. Click Search players, type a name or part of a name in chat, and the menu filters online and offline players. Use Clear search to show everyone again, or type cancel to keep the current filter.

slxps_za

make the player on the mod thing appear in alphabetical order and make the sereach thing be a search bar i can type in on the menu adn fix the search cuasei t didnt work when i search the player name or something simliar it msut show a list of player or that player name depending on what i typed

Kodari AI
KodariOct 2 at 4:07 pm 1
  1. Sort the menu’s full player list alphabetically.

  2. Replace chat-based search with an in-menu search input and make partial-name matches filter correctly.

Players in /mod are now sorted alphabetically. The search button opens a Paper text-input dialog instead of asking you to type in chat, and the menu now displays the filtered results. Search matches partial names without regard to capitalization; an empty search or Clear search shows everyone again.

slxps_za

and make it so they cant use the /fill comand

Kodari AI
KodariOct 2 at 4:09 pm 1

Protected moderators can no longer use /fill, even when the plugin’s general protection toggle is disabled. Namespaced forms such as /minecraft:fill are blocked too.

slxps_za

and if they have number in thier user put the numbaer at the back of the lettersor names from smallest to biggest number adn if they have any special character infront of thier user but them at the back on numbers on the menu

Kodari AI
KodariOct 3 at 5:58 am 1

I’ll sort regular names first, names containing numbers next with numeric suffixes in numeric order, and names starting with special characters last.

The /mod menu now sorts names alphabetically, places names containing numbers after letter-only names with numeric suffixes ordered numerically (so Player2 comes before Player10), and puts names starting with special characters last.

slxps_za

so as far as i know people with normal names and no number or special characters in front of their names they will apear first then people with numbers infron of thier name will appear then people with speacial characters right

Kodari AI
KodariOct 3 at 6:00 am 1

Almost. Names with no numbers appear first; names containing numbers come next, ordered numerically; names starting with special characters come last. So a name like Alex2 is in the number group too—not just names that start with a number.

slxps_za

and can you make it so people that are protected moderators cant use the /combat setting or any /combat commands

Kodari AI
KodariOct 3 at 6:01 am 1
  • Block the combat command root for protected moderators before the general protection toggle check.

  • Keep the restriction active even when creative protection is disabled.

Protected moderators are now blocked from /combat and all its subcommands, even when the plugin’s general protection toggle is disabled. Namespaced forms are blocked too.

slxps_za

and make sure if they are protected mod they are not able to break any blocks in creative

Kodari AI
KodariOct 3 at 6:22 am 1
  • Cancel block breaks for protected moderators in Creative, regardless of the general protection toggle.

  • Preserve the existing restriction on breaking tracked player-placed blocks.

Protected moderators can no longer break any blocks while in Creative, even when the general protection toggle is disabled. The existing restriction on breaking tracked player-placed blocks remains in place.

slxps_za

you see where the red lines are put the roles admin builder and mod and all the thing that i said like they are able to breaks blocks and build and extra put those in the green area and make it so i can disable and enable and make it that that menu will appear when i clikc on the person i am editing or giving builder admin or mod tag to

1 image attached
Kodari AI
KodariOct 4 at 11:13 am 1
  1. Find the moderator/player menu and current protection/role settings.

  2. Move role and permission toggles into the selected player’s edit menu, including enable/disable controls.

  • Make clicking a player open a dedicated edit menu instead of immediately changing their status.

  • Add Admin/Builder/Mod tag controls plus toggles for building, Creative block breaking, /fill, and /combat.

  • Save each player’s roles and permission overrides, and apply them to gameplay and displayed tags.

Clicking a player in /mod now opens their edit menu instead of immediately toggling their status. From there, you can enable or disable Admin, Builder, and Mod tags, block placement, Creative block breaking, /fill, and /combat access. Role and permission settings are saved per player; protected moderators keep the existing restrictions by default until you change their toggles.

slxps_za

and make it so if they are selcted as a builder they have acces to no commands at all beside the ones that are given thhier on the menu also add on the menu to disable and enable if they can change thier own gamemode and others gamemode and also make sure the menu is neat and centured and also add if they can tp to other players or not

Kodari AI
KodariOct 4 at 12:21 pm 1
  1. Restrict Builder commands to the commands explicitly enabled in their player menu.

  2. Add menu toggles for changing their own/others’ gamemode and teleporting to players.

  3. Tidy and center the player-edit menu layout.

Builder-tagged players are now blocked from all commands unless you explicitly enable them in their player menu. The menu includes toggles for /fill, /combat, changing their own gamemode, changing other players’ gamemode, and teleporting with /tp or /teleport. I also centered and spaced out the role and permission controls.

slxps_za

and change the builder colour to purple and moderator to green and owner yellow or gold

Kodari AI
KodariOct 4 at 12:21 pm 1
  • Set the Builder tag to purple and Moderator tag to green.

  • Keep Owner gold; it already matches your requested color.

Builder tags are now purple, Moderator tags green, and Owner tags remain gold.

slxps_za

also add an option to use /vanish and use /invsee and /endersee and /announce /clear /lifestealz /pardon /luckperms or /lp and /give items to themself

Kodari AI
KodariOct 5 at 1:44 pm 1
  1. Add per-player menu toggles for /vanish, /invsee, /endersee, /announce, /clear, /lifestealz, /pardon, and /luckperms//lp.

  2. Add a restricted /give option that only permits giving items to themselves.

  3. Persist the options and enforce them for Builders alongside existing command restrictions.

Added saved, per-player menu toggles for /vanish, /invsee, /endersee, /announce, /clear, /lifestealz, /pardon, /luckperms and /lp, plus /give on self only. Builders and protected moderators have these disabled by default; enabling /give still won’t let them target another player.

slxps_za

and make a search menu come up when i search and i must type the user then click on search and if i dont want to i click on close or back and if i want to clear the search i click reset

Kodari AI
KodariOct 5 at 1:47 pm 2
  • Keep the name field in the search dialog and add Search, Reset, Back, and Close actions.

  • Make Back preserve the current filter and page; make Reset clear the filter and show all players.

Added Search, Reset, Back, and Close buttons to the player search dialog. Search applies the typed name, Reset clears the filter, Back returns to the same player-list page without changing the filter, and Close exits the menu.

slxps_za

also /effect them selve and /effect other player and if they can throw potions

Kodari AI
KodariOct 5 at 1:49 pm 1
  1. Trace the player permission menu, saved options, and command restrictions.

  2. Add toggles for /effect on self, /effect on others, and throwing potions; enforce each permission.

Added three saved toggles to each player’s edit menu: /effect on self, /effect on other players, and throwing splash/lingering potions. Effect commands check whether their target is self or another player; potion throws are blocked unless enabled. These options default off for Builders and protected moderators.

slxps_za

and make it so they cant harm any passive mobs in creative to and add an option for me to disable and enable it

Kodari AI
KodariOct 5 at 1:50 pm 1
  1. Add a saved per-player toggle for damaging passive mobs while in Creative.

  2. Show the toggle in the edit menu and enforce it on damage events.

Added Harm passive mobs in Creative to each player’s edit menu. It defaults off for Builders and protected moderators; when off, their Creative attacks against passive mobs are cancelled. You can toggle it on or off per player.

slxps_za

and make sure lingering potions fall under the stuff

Kodari AI
KodariOct 5 at 1:51 pm 1

Lingering potions are already covered: the permission check blocks all ThrownPotion projectiles, including lingering potions, when Throw potions is disabled.

slxps_za

it still makes me search via chat i said a menu must appear for search and make search there is a back button and i click a search button in the menu and it searches and there is not page for the other commands that i said add

Kodari AI
KodariOct 5 at 1:59 pm 3
  1. Replace chat-triggered search with an in-menu search flow and Search/Back/Reset/Close buttons.

  2. Make all requested command and gameplay toggles accessible in the player menu.

The search now opens an in-game menu with a separate rename screen for text entry—no chat prompt. Next I’m checking the player-permission layout and click routing so the remaining options are reachable.

  • Search now opens an in-game menu, not chat. Click Enter player name, type in the rename screen, click its result, then click Search. Back preserves the current search, Reset clears it, and Close exits.

  • Split the player permissions into Roles & Gameplay (1/2) and Additional Commands (2/2) pages, with next/previous controls so the command toggles are accessible.

slxps_za

also make it so when the go in creative thier survival invitory gets cleared and saved so they start with noghting in creative and when they go back in survival they will have thier orginal sruvivial invintory they had and the creative one will be cleared

Kodari AI
KodariOct 5 at 2:09 pm 1
  1. Inspect the existing game-mode handling and saved player data.

  2. Save Survival inventory when entering Creative, clear Creative inventory, then restore Survival inventory and clear Creative inventory when returning to Survival.

Protected players’ Survival storage, armor, and offhand are now saved when they enter Creative, and their inventory is cleared. When they return to Survival, the Creative inventory is cleared and their saved Survival items are restored. The saved inventory persists across restarts.

slxps_za

make sure all the options are toggle able

Kodari AI
KodariOct 5 at 2:09 pm 1

Confirmed: every player permission and role option is wired as a clickable ON/OFF toggle, saved when changed, and refreshed in the menu. They’re split across Roles & Gameplay and Additional Commands; the arrows switch pages, and Back to players returns to the player list.

slxps_za

it still does not show a search menu

Kodari AI
KodariOct 5 at 2:53 pm 1

[Generation stopped]

slxps_za

nvm

Kodari AI
KodariOct 5 at 2:53 pm 1

No changes made.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
5 1,413
src/main/java/com/kodari/creativemodguard/CreativeModGuardPlugin.java
package com.kodari.creativemodguard;

import com.cryptomorin.xseries.XMaterial;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.entity.ThrownPotion;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.entity.EnderCrystal;
import org.bukkit.entity.AbstractVillager;
import org.bukkit.entity.Allay;
import org.bukkit.entity.Ambient;
import org.bukkit.entity.Animals;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Snowman;
import org.bukkit.entity.WaterMob;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockIgniteEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.ProjectileLaunchEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.event.inventory.InventoryDragEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerGameModeChangeEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.SkullMeta;
import org.bukkit.inventory.view.AnvilView;
import org.bukkit.scoreboard.Scoreboard;
import org.bukkit.scoreboard.Team;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitTask;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.AtomicMoveNotSupportedException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import java.nio.file.StandardOpenOption;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.stream.Collectors;

public final class CreativeModGuardPlugin extends JavaPlugin implements Listener, org.bukkit.command.CommandExecutor, TabCompleter {
    private static final String MENU_TITLE = "&8Protected Operators";
    private static final Set<String> BLOCKED_COMMANDS = Set.of(
            "kill", "damage", "execute", "function", "place", "setblock", "clone",
            "item", "enchant", "attribute", "plugins", "pl", "reload", "rl",
            "stop"
    );
    private static final Set<String> HOSTILE_SPAWN_EGGS = Set.of(
            "BLAZE_SPAWN_EGG", "BREEZE_SPAWN_EGG", "CAVE_SPIDER_SPAWN_EGG", "CREEPER_SPAWN_EGG",
            "DROWNED_SPAWN_EGG", "ELDER_GUARDIAN_SPAWN_EGG", "ENDERMITE_SPAWN_EGG", "EVOKER_SPAWN_EGG",
            "GHAST_SPAWN_EGG", "GUARDIAN_SPAWN_EGG", "HOGLIN_SPAWN_EGG", "HUSK_SPAWN_EGG",
            "MAGMA_CUBE_SPAWN_EGG", "PHANTOM_SPAWN_EGG", "PIGLIN_BRUTE_SPAWN_EGG", "PILLAGER_SPAWN_EGG",
            "RAVAGER_SPAWN_EGG", "SHULKER_SPAWN_EGG", "SILVERFISH_SPAWN_EGG", "SKELETON_SPAWN_EGG",
            "SLIME_SPAWN_EGG", "SPIDER_SPAWN_EGG", "STRAY_SPAWN_EGG", "VEX_SPAWN_EGG",
            "VINDICATOR_SPAWN_EGG", "WARDEN_SPAWN_EGG", "WITCH_SPAWN_EGG", "WITHER_SKELETON_SPAWN_EGG",
            "ZOGLIN_SPAWN_EGG", "ZOMBIE_SPAWN_EGG", "ZOMBIE_VILLAGER_SPAWN_EGG", "ZOMBIFIED_PIGLIN_SPAWN_EGG"
    );

    private final Set<UUID> protectedPlayers = new HashSet<>();
    private final Map<UUID, Set<String>> playerRoles = new HashMap<>();
    private final Map<UUID, Map<String, Boolean>> playerPermissionOverrides = new HashMap<>();
    private final Set<String> playerPlacedBlocks = new HashSet<>();
    private final Map<UUID, ChunkPosition> lastLogoutChunks = new HashMap<>();
    private final Map<UUID, SavedInventory> savedSurvivalInventories = new HashMap<>();
    private final Map<Inventory, Integer> openMenus = new HashMap<>();
    private final Map<Inventory, UUID> editMenus = new HashMap<>();
    private final Map<Inventory, Integer> editMenuPages = new HashMap<>();
    private final Map<Inventory, Integer> editMenuSections = new HashMap<>();
    private final Map<Inventory, UUID> searchMenus = new HashMap<>();
    private final Map<Inventory, Integer> searchMenuPages = new HashMap<>();
    private final Map<Inventory, UUID> searchInputs = new HashMap<>();
    private final Map<Inventory, Integer> searchInputPages = new HashMap<>();
    private final Map<UUID, String> menuSearches = new HashMap<>();
    private final Map<UUID, String> pendingSearches = new HashMap<>();
    private final Map<UUID, UUID> explosionOwners = new HashMap<>();
    private final ExecutorService blockStorageExecutor = Executors.newSingleThreadExecutor(task -> {
        Thread thread = new Thread(task, "CreativeModGuard-BlockStorage");
        thread.setDaemon(true);
        return thread;
    });
    private Team modTeam;
    private Team adminTeam;
    private Team builderTeam;
    private Team ownerTeam;
    private boolean enabled;
    private boolean stateDirty;
    private boolean placedBlocksDirty;
    private boolean placedBlocksSidecarReady;
    private BukkitTask saveTask;
    private BukkitTask placedBlockSaveTask;

    private record SavedInventory(ItemStack[] storage, ItemStack[] armor, ItemStack offhand) {
    }

    @Override
    public void onEnable() {
        saveDefaultConfig();
        enabled = getConfig().getBoolean("enabled", true);
        for (String value : getConfig().getStringList("protected-players")) {
            try {
                protectedPlayers.add(UUID.fromString(value));
            } catch (IllegalArgumentException ignored) {
            }
        }
        loadPlayerSettings();
        loadSavedSurvivalInventories();
        loadPlacedBlocks();
        for (String value : getConfig().getStringList("last-logout-chunks")) {
            String[] parts = value.split(":");
            if (parts.length != 4) {
                continue;
            }
            try {
                lastLogoutChunks.put(UUID.fromString(parts[0]), new ChunkPosition(
                        UUID.fromString(parts[1]), Integer.parseInt(parts[2]), Integer.parseInt(parts[3])));
            } catch (IllegalArgumentException ignored) {
            }
        }
        Scoreboard scoreboard = Bukkit.getScoreboardManager().getMainScoreboard();
        modTeam = scoreboard.getTeam("cmg_mod");
        if (modTeam == null) {
            modTeam = scoreboard.registerNewTeam("cmg_mod");
        }
        modTeam.setPrefix(color("&a[MOD] "));
        adminTeam = scoreboard.getTeam("cmg_admin");
        if (adminTeam == null) {
            adminTeam = scoreboard.registerNewTeam("cmg_admin");
        }
        adminTeam.setPrefix(color("&c[ADMIN] "));
        builderTeam = scoreboard.getTeam("cmg_builder");
        if (builderTeam == null) {
            builderTeam = scoreboard.registerNewTeam("cmg_builder");
        }
        builderTeam.setPrefix(color("&5[BUILDER] "));
        ownerTeam = scoreboard.getTeam("cmg_owner");
        if (ownerTeam == null) {
            ownerTeam = scoreboard.registerNewTeam("cmg_owner");
        }
        ownerTeam.setPrefix(color("&6[OWNER] "));
        for (Player player : Bukkit.getOnlinePlayers()) {
            if (protectedPlayers.contains(player.getUniqueId())) {
                player.setOp(true);
            }
            updateNameTag(player);
        }
        Bukkit.getPluginManager().registerEvents(this, this);
        getCommand("mod").setExecutor(this);
        getCommand("mod").setTabCompleter(this);
    }

    @Override
    public void onDisable() {
        openMenus.clear();
        editMenus.clear();
        editMenuPages.clear();
        if (saveTask != null) {
            saveTask.cancel();
            saveTask = null;
        }
        if (placedBlockSaveTask != null) {
            placedBlockSaveTask.cancel();
            placedBlockSaveTask = null;
        }