vsvdfhcb
📎 1 file 21,852 chars
📄
pasted-code-1788545357460.txt
txt 1449 lines
▶
Create a complete production-ready Minecraft plugin called **PotatoJobs**.

# POTATOJOBS — COMPLETE PLUGIN SPECIFICATION

## 1. PLATFORM

Plugin name:
`PotatoJobs`

Main package:
`me.potatocraft.potatojobs`

Target server:

* Purpur 1.21.11
* Paper 1.21.11 compatible
* Java 21
* Maven

The plugin must be lightweight and optimized for a production Minecraft server.

Do not require MySQL.

Use YAML and/or SQLite for persistent data.

The plugin must survive server restarts without losing any player, job, kit, recipe, invitation or cooldown data.

---

# 2. MAIN IDEA

PotatoJobs is a completely configurable and expandable Job System.

The most important requirement:

**Jobs must NOT be hard-coded into Java.**

I must be able to create new jobs later without rewriting the plugin.

Examples:

* Miner
* Farmer
* Builder
* Fisher
* Guard
* Shopkeeper
* Mayor
* Fantasy Herbalist
* Any future custom job

Every job should be stored permanently.

The plugin architecture must be modular so different jobs can have completely different mechanics.

---

# 3. PLAYER JOB SYSTEM

Normally, one player can belong to only ONE job.

Commands:

`/job`

`/job list`

`/job info`

`/job info `

`/job leave`

`/job accept`

`/job invite `

If a player already has a job, they cannot join another job until they leave their current job.

---

# 4. JOB CREATION

Administrators can create jobs dynamically.

Command:

`/job create `

Example:

`/job create Miner`

`/job create Farmer`

`/job create Builder`

`/job create Materials`

The job must immediately become available to the plugin.

Do NOT require Java code changes.

Do NOT require recompiling the plugin.

Job data must be stored permanently.

---

# 5. JOB DELETE

Admin command:

`/job delete `

Before deleting a job, show a confirmation message.

Example:

`/job delete Miner`

Then:

`Are you sure? Use /job delete Miner confirm`

When deleted:

* Remove the job
* Remove its invitations
* Remove its kits
* Remove its job-specific data
* Players belonging to the deleted job should safely become jobless
* Do not delete unrelated jobs

---

# 6. JOB DISPLAY NAME

Every job must have:

* Internal ID
* Display name
* Description
* Icon
* Color
* Leader
* Members
* Kits
* Optional modules

Example:

```yaml
miner:
  display-name: "&7Miner"
  icon: "DIAMOND_PICKAXE"
  description:
    - "&7Mine resources"
```

The internal ID should remain stable even if the display name changes.

Admin command:

`/job setdisplay  `

Example:

`/job setdisplay Miner "&6Miner"`

---

# 7. JOB MEMBERSHIP

Every player can have:

* One job
* One role

Roles:

`MEMBER`

or

`LEADER`

The player's job must persist after:

* Relog
* Server restart
* Server crash/restart

---

# 8. JOB LEADERS

Admins can assign a leader:

`/job leader  `

Example:

`/job leader Steve Miner`

Steve becomes the leader of Miner.

A job can have one primary leader.

The system should safely handle changing leaders.

When a new leader is assigned:

* Previous leader loses leadership
* New leader becomes leader
* Scoreboard placeholders update
* TAB placeholders update
* Permissions/checks update immediately

---

# 9. LEADER RESTRICTIONS

A leader can ONLY manage their own job.

For example:

Miner Leader:

* Can invite players to Miner
* Can manage Miner kits
* Can view Miner information

Miner Leader CANNOT:

* Invite players to Farmer
* Edit Farmer kits
* Delete Farmer
* Change Farmer's leader
* Manage another job

Admins can manage every job.

---

# 10. INVITATION SYSTEM

Leader command:

`/job invite `

The invitation belongs to the leader's current job.

Example:

Steve is Miner Leader.

Steve uses:

`/job invite Alex`

Alex receives:

`Steve invited you to join Miner.`

Alex accepts:

`/job accept`

Alex becomes a Miner member.

The invitation must expire.

Config:

```yaml
invitation:
  expire-seconds: 60
```

If the player has no pending invitation:

`You do not have a pending job invitation.`

If the player already belongs to another job:

`You must leave your current job first.`

---

# 11. JOB INFORMATION

`/job info`

Shows the player's own information.

Example:

```text
===== PotatoJobs =====

Player: Steve
Job: Miner
Role: Leader
Leader: Steve
Members: 8

======================
```

`/job info `

Shows another player's job.

Example:

```text
Player: Alex
Job: Miner
Role: Member
Leader: Steve
```

If they have no job:

`Job: None`

---

# 12. JOB LIST

Command:

`/job list`

Example:

```text
===== PotatoJobs =====

- Miner
- Farmer
- Builder
- Fisher
- Materials

======================
```

Only existing jobs should appear.

---

# 13. JOB GUI

Command:

`/job`

Open a chest-style GUI.

Each job appears as an item.

Example:

Miner:
`DIAMOND_PICKAXE`

Farmer:
`WHEAT`

Builder:
`BRICKS`

Fisher:
`FISHING_ROD`

Materials:
`DEAD_BUSH`

Each job item should show:

* Job name
* Description
* Leader
* Member count
* Player's current status
* Available kits

Clicking the job opens job information.

Do not automatically join the player unless the job system explicitly allows it.

---

# 14. JOB KITS

Every job can have its own kits.

Commands:

`/job kit create `

`/job kit edit `

`/job kit `

`/job kit delete `

A job leader can create kits for their own job.

Admins can create kits for any job.

---

# 15. KIT CREATION GUI

When using:

`/job kit create `

Open a chest-style inventory.

The creator can place any vanilla Minecraft items inside.

The GUI must have:

`SAVE`

`CANCEL`

buttons.

When Save is clicked:

* Save every ItemStack
* Save amount
* Save enchantments
* Save lore
* Save custom name
* Save ItemFlags
* Save potion information
* Save standard Minecraft ItemMeta data

The kit must persist after restart.

---

# 16. KIT CLAIM

Normal members can use:

`/job kit `

They can only claim kits belonging to their current job.

Example:

Miner members can use Miner kits.

Miner members cannot use Farmer kits.

Admins can bypass this restriction.

---

# 17. KIT COOLDOWN

Every kit has a configurable cooldown.

Default example:

```yaml
kit-cooldown: 86400
```

86400 seconds = 24 hours.

The cooldown must persist after:

* Relog
* Server restart

Players must not bypass the cooldown by reconnecting.

Admin permission can bypass cooldown.

---

# 18. PLACEHOLDERAPI

Add official PlaceholderAPI support.

Required placeholders:

`%potatojobs_job%`

Returns internal/current job name.

`%potatojobs_job_display%`

Returns the colored display name.

`%potatojobs_role%`

Returns:

`Member`

or:

`Leader`

`%potatojobs_is_leader%`

Returns:

`true`

or:

`false`

`%potatojobs_leader%`

Returns leader name.

`%potatojobs_members%`

Returns member count.

`%potatojobs_job_kit_count%`

Returns number of kits belonging to the player's job.

`%potatojobs_job_description%`

Returns the configured description.

All placeholders must update dynamically.

---

# 19. SCOREBOARD INTEGRATION

PotatoJobs MUST connect to the server scoreboard system through PlaceholderAPI.

The job should be displayed on the player's scoreboard.

Example:

```text
&6&lPOTATO CRAFT

&7Player: &f%player_name%
&7Job: &a%potatojobs_job_display%
&7Role: &e%potatojobs_role%
&7Leader: &f%potatojobs_leader%
&7Members: &f%potatojobs_members%

&7Online: &f%server_online%

&6Potato Craft
```

The scoreboard information must update automatically when:

* Player joins a job
* Player leaves a job
* Player becomes leader
* Player loses leadership
* Leader changes
* Job display name changes
* Member count changes
* Job is deleted

No reconnect should be required.

No server restart should be required.

---

# 20. BUILT-IN SCOREBOARD

Add an optional built-in scoreboard.

Config:

```yaml
scoreboard:
  enabled: false

  title: "&6&lPOTATO CRAFT"

  lines:
    - "&7Player: &f%player_name%"
    - "&7Job: &a%potatojobs_job_display%"
    - "&7Role: &e%potatojobs_role%"
    - "&7Leader: &f%potatojobs_leader%"
    - "&7Members: &f%potatojobs_members%"
    - ""
    - "&6Potato Craft"
```

If:

`enabled: false`

do not create a scoreboard.

If:

`enabled: true`

create and manage the scoreboard.

The built-in scoreboard must support PlaceholderAPI.

---

# 21. TAB INTEGRATION

Do NOT force the job above the player's head.

Instead, provide PlaceholderAPI support for TAB.

Example TAB format:

```text
[%potatojobs_job_display%] %player_name%
```

This allows the server owner to decide where the job appears.

Do not modify player nametags automatically unless explicitly enabled.

---

# 22. MODULAR JOB SYSTEM

This is one of the most important parts.

Every job must be able to have different modules.

Possible modules:

* Farming
* Mining
* Fishing
* Building
* Collecting
* Crafting
* Selling
* Missions
* Rewards
* Kits
* Custom recipes
* Custom GUI
* Custom item production
* Custom interactions
* Custom progression

A job does NOT need to use every module.

For example:

Miner can use mining missions.

Farmer can use crop missions.

Fisher can use fishing missions.

Materials can use a custom cauldron system.

The architecture must allow new modules to be added later.

---

# 23. SPECIAL EXAMPLE JOB — MATERIALS / FANTASY HERBALIST

Include one example of a completely custom job.

Display name:

`&cمواد فروش`

This job is purely fictional Minecraft gameplay.

It must NOT represent real-world drugs or alcohol.

Use only vanilla Minecraft items.

---

# 24. FANTASY PLANT

Use:

`DEAD_BUSH`

as the visual base.

The fictional plant name can be:

`گیاه سایه`

When harvested, the player receives a custom-named vanilla Minecraft item.

Example:

`&aگیاه سایه`

Lore:

```text
&7یک گیاه کمیاب
&7برای ساخت محصولات فانتزی Potato Craft
```

---

# 25. CAULDRON CRAFTING

The Materials job must support a custom configurable cauldron crafting system.

The player:

1. Finds a cauldron.
2. Adds water.
3. Adds the configured vanilla ingredients.
4. The plugin checks the recipe.
5. A valid heat source must be underneath.
6. Start a configurable timer.
7. Show the timer.
8. Complete the recipe.
9. Give the configured result.
10. Remove the used ingredients safely.

Supported heat sources:

* FIRE
* SOUL_FIRE
* CAMPFIRE
* SOUL_CAMPFIRE

---

# 26. EXAMPLE FANTASY RECIPES

These recipes are fictional Minecraft recipes.

## Shadow Elixir

Ingredients:

`DEAD_BUSH x2`

`POPPY x1`

`GLOWSTONE_DUST x2`

Result:

`POTION`

Name:

`&fتریاق سایه`

Lore:

```text
&7یک محصول کاملاً فانتزی
&7ساخته‌شده در دنیای Potato Craft
```

---

## Green Fantasy Brew

Ingredients:

`WHEAT x2`

`APPLE x1`

`GREEN_DYE x1`

Result:

`POTION`

Name:

`&fا&aر&fغ &aوطنی`

---

## Red Fantasy Brew

Ingredients:

`RED_MUSHROOM x2`

`COCOA_BEANS x1`

`SUGAR x1`

Result:

`POTION`

Name:

`&fا&cر&fغ &cسگی`

These are fictional Minecraft items only.

Do not implement real-world preparation instructions.

---

# 27. BREWING TIMER

Default brewing time:

`10 seconds`

Display countdown:

```text
در حال آماده‌سازی... 10
در حال آماده‌سازی... 9
در حال آماده‌سازی... 8
...
در حال آماده‌سازی... 1
آماده شد!
```

The timer must be configurable.

Example:

```yaml
brew-time: 10
```

Each recipe can have its own brewing time.

---

# 28. BREWING EFFECTS

Products may optionally have normal Minecraft potion effects.

Allowed examples:

* SPEED
* SLOWNESS
* JUMP_BOOST
* WEAKNESS
* NAUSEA
* GLOWING
* REGENERATION

Effects must be completely configurable.

Example:

```yaml
effects:
  - "SPEED:1:30"
```

Format:

`EFFECT:AMPLIFIER:DURATION`

Duration is seconds.

Do not implement realistic drug/alcohol effects.

---

# 29. FULL RECIPE CONFIGURATION

Recipes must be stored in configuration.

Example:

```yaml
jobs:

  materials:

    display-name: "&cمواد فروش"

    icon: "DEAD_BUSH"

    recipes:

      shadow_elixir:

        ingredients:
          - "DEAD_BUSH:2"
          - "POPPY:1"
          - "GLOWSTONE_DUST:2"

        result:
          material: "POTION"
          name: "&fتریاق سایه"

          lore:
            - "&7محصول فانتزی Potato Craft"

        brew-time: 10

        heat-sources:
          - "FIRE"
          - "CAMPFIRE"
```

The admin must be able to modify recipes without changing Java code.

---

# 30. FUTURE JOB CREATION

I should be able to add a completely new job through configuration.

Example:

```yaml
jobs:

  miner:
    display-name: "&7Miner"
    icon: "DIAMOND_PICKAXE"

  farmer:
    display-name: "&aFarmer"
    icon: "WHEAT"

  builder:
    display-name: "&eBuilder"
    icon: "BRICKS"

  materials:
    display-name: "&cمواد فروش"
    icon: "DEAD_BUSH"
```

The plugin must automatically recognize configured jobs.

Do not hard-code the names.

---

# 31. PERMISSIONS

Create:

`potatojobs.use`

`potatojobs.info`

`potatojobs.invite`

`potatojobs.kit`

`potatojobs.leader`

`potatojobs.admin`

`potatojobs.admin.*`

Admins must have access to everything.

The plugin must work correctly with LuckPerms.

---

# 32. CONFIGURATION FILES

Create:

`config.yml`

`messages.yml`

`jobs.yml`

`kits.yml`

`recipes.yml`

All important values must be configurable.

Support Minecraft color codes.

Prefer MiniMessage where appropriate, but also support traditional `&` color codes if practical.

---

# 33. EXAMPLE MESSAGES

```yaml
messages:

  no-job: "&cشما عضو هیچ جابی نیستید."

  joined-job: "&aشما وارد جاب %job% شدید."

  left-job: "&eشما از جاب %job% خارج شدید."

  no-permission: "&cشما اجازه انجام این کار را ندارید."

  invite-sent: "&aدعوت جاب ارسال شد."

  invite-received: "&eشما به جاب %job% دعوت شدید."

  invite-accepted: "&aشما دعوت جاب %job% را قبول کردید."

  invite-expired: "&cدعوت جاب منقضی شده است."

  already-have-job: "&cشما در حال حاضر عضو جاب %job% هستید."

  leader-only: "&cفقط لیدر جاب می‌تواند این کار را انجام دهد."

  admin-only: "&cفقط ادمین می‌تواند این کار را انجام دهد."

  kit-cooldown: "&eاین کیت هنوز آماده نیست. زمان باقی‌مانده: %time%"

  brewing: "&eدر حال آماده‌سازی... %time%"

  brew-complete: "&aمحصول آماده شد!"
```

---

# 34. DATA STORAGE

Persist:

* Player UUID
* Player job
* Player role
* Job leader
* Job members
* Invitations
* Invitation expiration
* Kits
* Kit ItemStacks
* Kit cooldowns
* Job configuration
* Recipes
* Brewing data if necessary

Use UUID instead of player names for permanent player identification.

---

# 35. RESTART SAFETY

After server restart:

* Jobs remain
* Leaders remain
* Members remain
* Kits remain
* Recipes remain
* Cooldowns remain
* Configurations remain

No data should be lost.

---

# 36. EXPLOIT PROTECTION

Prevent:

* Kit duplication
* Item duplication
* Double claiming
* Cauldron duplication
* Brewing duplication
* Inventory desynchronization
* Disconnect exploits
* Double-click exploits
* Shift-click exploits
* Recipe duplication

If a player disconnects during brewing, safely cancel the active brewing process and ensure no items are duplicated.

---

# 37. RELOAD

Command:

`/job reload`

Reload:

* config.yml
* messages.yml
* jobs.yml
* kits.yml
* recipes.yml

Do not require a server restart for normal configuration changes.

---

# 38. COMMAND TAB COMPLETION

Implement tab completion for all commands.

Examples:

`/job `

Shows:

* create
* delete
* list
* info
* invite
* accept
* leave
* leader
* kit
* reload
* setdisplay

For:

`/job info `

show online player names.

For:

`/job kit `

show kits available to the player's current job.

For:

`/job leader  `

show available jobs.

---

# 39. COMMAND PERMISSION CHECKS

Every administrative command must verify permissions.

A leader must never be able to bypass job restrictions by manually entering another job's name.

For example:

If Steve is Miner Leader:

`/job invite Alex Farmer`

must fail.

He can only invite Alex to Miner.

Admins can use:

`/job invite Alex Farmer`

---

# 40. SCOREBOARD + JOB DATA ARCHITECTURE

The scoreboard system must never contain hard-coded job names.

Example:

If I create:

`Miner`

the scoreboard displays:

`Job: Miner`

If I create:

`Fisher`

the same scoreboard displays:

`Job: Fisher`

If I rename Miner to:

`&6Master Miner`

the scoreboard updates automatically.

If Steve changes from Miner to Farmer:

The scoreboard changes automatically from:

`Job: Miner`

to:

`Job: Farmer`

No reconnect.

No restart.

---

# 41. API

Create a simple internal Java API so other plugins can access PotatoJobs.

Example methods:

`getPlayerJob(UUID player)`

`setPlayerJob(UUID player, String job)`

`isLeader(UUID player)`

`getJobLeader(String job)`

`getJobMembers(String job)`

`getJobs()`

`getJob(String job)`

This API should allow future Potato Craft plugins to integrate with PotatoJobs.

---

# 42. EVENTS

Create custom Bukkit events where appropriate.

Examples:

`PlayerJobJoinEvent`

`PlayerJobLeaveEvent`

`PlayerJobLeaderChangeEvent`

`JobCreateEvent`

`JobDeleteEvent`

`JobKitClaimEvent`

This will allow other Potato Craft plugins to react to job changes.

---

# 43. PERFORMANCE

The plugin must be lightweight.

Do not run unnecessary repeating tasks.

Do not constantly scan all players.

Only update scoreboard/placeholder information when required.

Brewing timers should only exist while an active brewing process exists.

Use asynchronous database operations if SQLite is used, while respecting Bukkit API thread-safety.

---

# 44. PACKAGE STRUCTURE

Use clean Java architecture.

Recommended:

```text
me.potatocraft.potatojobs

├── PotatoJobs.java
│
├── command
│   ├── JobCommand.java
│   └── JobTabCompleter.java
│
├── job
│   ├── Job.java
│   ├── JobManager.java
│   ├── JobMember.java
│   └── JobRole.java
│
├── kit
│   ├── JobKit.java
│   ├── KitManager.java
│   └── KitGUI.java
│
├── recipe
│   ├── JobRecipe.java
│   ├── RecipeManager.java
│   └── RecipeIngredient.java
│
├── brewing
│   ├── BrewingManager.java
│   └── BrewingSession.java
│
├── gui
│   ├── JobGUI.java
│   └── GUIListener.java
│
├── listener
│   ├── PlayerJoinListener.java
│   ├── InventoryListener.java
│   ├── CauldronListener.java
│   └── PlayerQuitListener.java
│
├── placeholder
│   └── PotatoJobsExpansion.java
│
├── storage
│   ├── StorageManager.java
│   ├── YAMLStorage.java
│   └── SQLiteStorage.java
│
├── api
│   └── PotatoJobsAPI.java
│
├── event
│   ├── PlayerJobJoinEvent.java
│   ├── PlayerJobLeaveEvent.java
│   ├── PlayerJobLeaderChangeEvent.java
│   ├── JobCreateEvent.java
│   └── JobDeleteEvent.java
│
└── util
    ├── MessageUtil.java
    └── ItemUtil.java
```

The final architecture can differ if there is a better implementation, but keep the same modular concept.

---

# 45. MAVEN

Create a complete Maven project.

Java:

`21`

Server API:

Paper/Purpur 1.21.11 compatible API.

The project must compile using:

`mvn clean package`

Final output:

`target/PotatoJobs.jar`

Do not include unnecessary dependencies.

---

# 46. PLUGIN.YML

Create a valid `plugin.yml`.

Include:

* Plugin name
* Version
* Main class
* API version
* Commands
* Permissions
* Soft dependencies

PlaceholderAPI should be an optional dependency if possible.

---

# 47. FINAL TEST REQUIREMENTS

Before considering the plugin complete, test:

1. Create a job.
2. Delete a job.
3. Assign a leader.
4. Invite a player.
5. Accept invitation.
6. Leave job.
7. Display job information.
8. Create a kit.
9. Edit a kit.
10. Claim a kit.
11. Verify cooldown.
12. Restart server.
13. Verify data persistence.
14. Verify PlaceholderAPI.
15. Verify scoreboard.
16. Verify TAB placeholders.
17. Create a new job without Java modification.
18. Test the Materials/Fantasy Herbalist job.
19. Test cauldron recipes.
20. Test 10-second brewing timer.
21. Test incorrect recipes.
22. Test disconnect during brewing.
23. Test leader restrictions.
24. Test admin bypass.
25. Test command tab completion.

---

# 48. MOST IMPORTANT REQUIREMENT

The final PotatoJobs plugin must be a **general-purpose dynamic Job Framework**, not a plugin containing only a few hard-coded jobs.

I should be able to create future jobs and configure them without rebuilding the entire plugin.

The example Materials/Fantasy Herbalist job exists only to demonstrate that PotatoJobs can support a completely different custom gameplay system.

The Job System, Kit System, Recipe System, Cauldron System, PlaceholderAPI, Scoreboard and TAB integration must all work together.

Target:

**Potato Craft — Purpur 1.21.11 — Java 21**

Final file:

**PotatoJobs.jar**
Kodari AI
KodariSep 4 at 6:20 pm 2
PotatoJobs
A dynamic, configurable job framework for Minecraft servers. Players join jobs, receive kits, and participate in custom gameplay modules like cauldron brewing. Admins create jobs without code changes. Features include persistent storage, PlaceholderAPI integration, scoreboard support, invitation system, kit cooldowns, and a modular architecture for future expansion.
  1. Create the Maven/Paper project and configurable resources.

  2. Implement persistent jobs, invitations, leaders, kits, cooldowns, and API/events.

  3. Add job/kit GUIs, dynamic recipes, cauldron brewing, placeholders, and scoreboard integration.

  4. Register commands, listeners, permissions, and reload/persistence lifecycle.

Created the PotatoJobs Maven plugin project with:

  • Paper/Purpur Java 21 Maven setup

  • Dynamic YAML-configured jobs

  • Persistent jobs, members, roles, leaders, invitations, kits, cooldowns

  • Job management commands and tab completion

  • Job and kit GUIs

  • Configurable fantasy Materials job recipes

  • Cauldron brewing system with timers and potion effects

  • PlaceholderAPI expansion

  • Optional built-in scoreboard

  • Public PotatoJobs API

  • Bukkit job and kit events

  • YAML persistence files and reload support

  • Permissions and plugin metadata

The project outputs target/PotatoJobs.jar through Maven.

Kodari can make mistakes. Review important code before using.
Files
src
pom.xml
Code
36 1,051
src/main/java/me/potatocraft/potatojobs/PotatoJobs.java
package me.potatocraft.potatojobs;

import me.clip.placeholderapi.PlaceholderAPI;
import me.potatocraft.potatojobs.brewing.BrewingManager;
import me.potatocraft.potatojobs.command.JobCommand;
import me.potatocraft.potatojobs.command.JobTabCompleter;
import me.potatocraft.potatojobs.gui.JobGUI;
import me.potatocraft.potatojobs.job.InvitationManager;
import me.potatocraft.potatojobs.job.JobManager;
import me.potatocraft.potatojobs.kit.KitManager;
import me.potatocraft.potatojobs.listener.CauldronListener;
import me.potatocraft.potatojobs.listener.PlayerListener;
import me.potatocraft.potatojobs.placeholder.PotatoJobsExpansion;
import me.potatocraft.potatojobs.recipe.RecipeManager;
import me.potatocraft.potatojobs.scoreboard.JobScoreboard;
import me.potatocraft.potatojobs.util.MessageUtil;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.java.JavaPlugin;

import java.io.File;

public final class PotatoJobs extends JavaPlugin {
    private static PotatoJobs instance;
    private YamlConfiguration messages;
    private JobManager jobManager;
    private KitManager kitManager;
    private RecipeManager recipeManager;
    private InvitationManager invitationManager;
    private BrewingManager brewingManager;
    private JobScoreboard scoreboard;

    @Override
    public void onEnable() {
        instance = this;
        saveDefaultConfig();
        saveResourceIfMissing("messages.yml");
        saveResourceIfMissing("jobs.yml");
        saveResourceIfMissing("kits.yml");
        saveResourceIfMissing("recipes.yml");
        messages = YamlConfiguration.loadConfiguration(new File(getDataFolder(), "messages.yml"));

        jobManager = new JobManager(this);
        kitManager = new KitManager(this);
        recipeManager = new RecipeManager(this);
        invitationManager = new InvitationManager(this);
        jobManager.load();
        kitManager.load();
        recipeManager.load();
        invitationManager.load();
        brewingManager = new BrewingManager(this);
        scoreboard = new JobScoreboard(this);

        JobCommand command = new JobCommand(this);
        getCommand("job").setExecutor(command);
        getCommand("job").setTabCompleter(new JobTabCompleter(this));
        Bukkit.getPluginManager().registerEvents(new PlayerListener(this), this);
        Bukkit.getPluginManager().registerEvents(new CauldronListener(this), this);

        if (Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI")) {
            new PotatoJobsExpansion(this).register();
            getLogger().info("PlaceholderAPI expansion registered.");
        }
    }

    @Override
    public void onDisable() {
        if (brewingManager != null) brewingManager.cancelAll();
        if (invitationManager != null) invitationManager.save();
        if (kitManager != null) kitManager.save();
        if (jobManager != null) jobManager.save();
    }

    public void reloadPlugin() {
        reloadConfig();
        messages = YamlConfiguration.loadConfiguration(new File(getDataFolder(), "messages.yml"));
        jobManager.load();
        kitManager.load();
        recipeManager.load();
        invitationManager.load();
        scoreboard.updateAll();
    }

    private void saveResourceIfMissing(String name) {
        File file = new File(getDataFolder(), name);
        if (!file.exists()) saveResource(name, false);
    }

    public static PotatoJobs getInstance() { return instance; }
    public YamlConfiguration messages() { return messages; }
    public JobManager jobs() { return jobManager; }
    public KitManager kits() { return kitManager; }
    public RecipeManager recipes() { return recipeManager; }
    public InvitationManager invitations() { return invitationManager; }
    public BrewingManager brewing() { return brewingManager; }
    public JobScoreboard scoreboard() { return scoreboard; }
    public String message(String key, java.util.Map<String, String> replacements) { return MessageUtil.format(messages.getString(key, key), replacements); }
    public String placeholder(String text, org.bukkit.entity.Player player) {
        return Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI") ? PlaceholderAPI.setPlaceholders(player, text) : text;
    }
}