itzrealmeglazer
๐Ÿ“Ž 1 file 10,051 chars
๐Ÿ“„
pasted-code-1781173175988.txt
txt 606 lines
โ–ถ
Overview

Create a fully configurable Minecraft plugin that provides a complete territory-control experience with teams, elections, leader crowns, territory claiming, net worth tracking, team-colored player names, and administrative utilities.

All major functionality must be configurable through commands and configuration files without requiring code changes.

1. Teams System
Features
Teams can be created and managed by server operators.
Team settings are configurable.
Teams can:
Participate in territory control.
Participate in leadership elections.
Own territories.
Each team has a configurable color.
Players automatically receive the color associated with their team.
Team colors are displayed consistently throughout the server.
Team Color System

Each team has a configurable color that is automatically applied to all team members.

The color may be shown in:

Player name tags
TAB list
Chat messages
Scoreboards
Team information displays
Placeholder outputs

Example:

Red Team โ†’ Player name displayed in red

Blue Team โ†’ Player name displayed in blue

Green Team โ†’ Player name displayed in green

Color settings must be fully configurable through configuration files and commands.

Operator-Only Team System

By default, all team management functionality is restricted to server operators (OPs).

Regular players without operator status cannot use team management commands.

This means non-OP players cannot:

Create teams
Delete teams
Invite players
Kick players
Claim territory
Unclaim territory
Start elections
Stop elections
Change team settings
Transfer leadership
Manage territory
Add players to teams
Remove players from teams

Only server operators may manage teams and assign players to teams.

All team configuration, territory management, election management, and membership management is performed by operators.

Regular players do not have access to team management commands.

Team Commands

The following commands are OP-only by default:

/team create

/team invite

/team kick

/team disband

/team claim

/team unclaim

/team election start

/team election stop

/team forcejoin

Forcibly places a player into the specified team regardless of current membership status.

If the player already belongs to another team, they are automatically removed from their current team and added to the new team.

The player's team color updates instantly.

Team Information Commands

Operators may use informational commands:

/team info

/team list

Administrative Commands

/teamadmin create

/teamadmin delete

/teamadmin setleader

/teamadmin election start

/teamadmin election stop

/teamadmin forcejoin

/teamadmin forceteamcolor

Configuration

Server owners may optionally override this behavior through configuration and permission nodes.

However, the default behavior must be:

Only players with operator status can manage teams.
Only players with operator status can assign players to teams.
Only players with operator status can move players between teams.
Only players with operator status can manage territories.
Only players with operator status can start or stop elections.
Only players with operator status can modify team settings.
Only players with operator status can transfer leadership.
2. Team Leader Election System
Overview

Each team may elect a leader.

Leaders gain ownership of the team's crown and receive crown bonuses.

Voting Rules
Players may vote once per election.
Players may vote for any eligible teammate.
Self-voting is prohibited.
Offline voting is configurable.
Vote tracking is configurable.
Election Winner

The player with the highest vote count becomes leader.

Configurable tie handling:

Random winner
Previous leader remains
Runoff election
Election Commands
Start Election

/team election start

Stop Election

/team election stop

Election stop behavior configurable:

Cancel election entirely
End immediately using current votes
Keep previous leader
Election Status

/team election status

Vote

/team vote

Admin Election Commands

/teamadmin election start

/teamadmin election stop

Boss Bar Election Timer

When an election begins:

Every team member sees a boss bar.
The boss bar counts down in real time.
The boss bar gradually shrinks as time decreases.
Displays remaining election time.
Updates continuously.

Example:

Election Ends In: 04:32

The boss bar reaches zero when the election ends.

Boss Bar Configuration

Configurable:

Enabled
Color
Style
Text
Progress behavior
Visibility
Election Configuration

Configurable:

Voting duration
Election cooldown
Minimum votes required
Minimum team size
Tie handling
Automatic elections
Boss bar settings
Election Configuration Commands

/teamadmin election duration

/teamadmin election cooldown

/teamadmin election minvotes

/teamadmin election bossbar enable

/teamadmin election bossbar disable

3. Territory Control System
Territory Claims

Teams can claim territory.

No Costs

Claiming territory is completely free.

Removed:

Economy costs
Resource costs
Purchase requirements
No Limits

Removed:

Maximum claims
Maximum territory size
Maximum chunk count
Maximum territory count

Teams may claim unlimited territory.

Territory Commands

/team claim

/team unclaim

/team territory info

Territory Notifications

Players receive notifications when:

Own Territory
Entering own territory
Leaving own territory
Enemy Territory
Entering another team's territory
Leaving another team's territory
Notification Types

Configurable:

Chat message
Action bar
Titles
Sounds

Example Messages:

You entered your team's territory.

You left your team's territory.

You entered territory owned by .

You left enemy territory.

All messages fully configurable.

4. Leader Crown System
Overview

When a player becomes team leader they automatically receive a special crown.

Only one crown exists per team.

If leadership changes:

Crown transfers automatically.
Previous leader loses crown benefits immediately.
New leader receives crown instantly.
Crown Item

Base Item:

Custom-Textured Netherite Helmet

Enchantments
Protection IV
Respiration III
Aqua Affinity
Properties
Unbreakable
Custom texture support
Custom model data support
Custom name configurable
Custom lore configurable
Crown Protection

The crown:

Cannot be dropped
Cannot be burned
Cannot be destroyed
Cannot be lost on death
Cannot be removed permanently
Cannot be placed into containers (configurable)
Cannot be placed into shulker boxes (configurable)
Automatically restores if removed
Persists through reconnects
Persists through restarts
Crown Bonus
Health Bonus

The crown grants:

+10 Hearts

Minecraft Conversion:

1 Heart = 2 Health
10 Hearts = 20 Additional Health

Leader Health:

Base Health: 20
Crown Bonus: +20
Total Health: 40

Equivalent to:

20 Hearts Total

Bonus only applies while wearing the crown.

Removing the crown instantly removes the bonus.

Crown Commands

/crown give

/crown remove

/crown restore

/crown reload

Crown Configuration

Configurable:

Health bonus
Texture
Enchantments
Lore
Name
Restoration behavior
Container restrictions
Drop restrictions
5. Net Worth System
Overview

Track total player wealth using configurable item values.

Default Item Values

DIRT = $0.01

COBBLESTONE = $0.02

IRON_INGOT = $25

GOLD_INGOT = $50

EMERALD = $25

DIAMOND = $100

NETHERITE_INGOT = $5000

EMERALD_BLOCK = $225

DIAMOND_BLOCK = $900

All values must be editable in configuration files.

Emeralds should be worth significantly less than diamonds by default.

Net Worth Calculation

Includes:

Inventory
Main inventory
Armor inventory
Off-hand inventory
Storage
Ender Chest
Recursive Containers

Count contents inside:

Shulker Boxes
Nested Shulker Boxes

Recursive calculations required.

Net Worth Display
TAB List

PlayerName [$12,500]

Name Tags

[$12,500] PlayerName

Commands

/networth

/networth

PlaceholderAPI

%pointcapture_networth%

%pointcapture_team_networth%

Performance Requirements

Must use:

Caching
Scheduled updates
Incremental recalculation
Async processing where possible

Configurable refresh intervals.

6. Random Scatter Command
Command

/scatterall

Permission:

pointcapture.scatterall

Operator access configurable.

Features

Teleports every online player to:

Unique location
Safe location
Random location

Default radius:

5,500 blocks from world spawn

Configurable.

Safe Teleport Requirements

Avoid:

Lava
Fire
Inside blocks
Void drops
Water (optional)

Players must spawn on safe ground.

Countdown System

Configurable countdown.

Example:

Scatter begins in 10 seconds...

9...

8...

7...

Teleport.

Spawn Protection

Optional:

Temporary invulnerability
Fall damage protection
PvP protection

Duration configurable.

Scatter Configuration Commands

/scatterconfig radius

/scatterconfig countdown

/scatterconfig protection

7. Configuration System

Everything must be configurable through:

Commands
Configuration files

No code changes required.

Configurable Categories
Teams
Team permissions
Team settings
Team roles
Team colors
Team name formatting
Elections
Duration
Cooldowns
Vote requirements
Tie handling
Boss bar settings
Stop behavior
Territory
Notifications
Protections
Claim visualization
Crown
Texture
Health bonus
Enchantments
Restrictions
Restoration
Net Worth
Item values
Display formats
Update intervals
Scatter
Radius
Countdown
Protection
Messages
Chat
Action Bar
Titles
Sounds
Permissions
All permission nodes configurable
Goal

The plugin should provide:

Operator-controlled teams
Operator-controlled team membership
Forced player assignment to teams
Automatic team-colored player names
Territory ownership and control
Unlimited free territory claiming
Fully configurable elections
Startable and stoppable elections
Boss bar election countdown timer
Automatic leader crown transfers
Custom-textured crown
+10 hearts (+20 health) while wearing the crown
Recursive net worth calculations
TAB, nametag, command, and PlaceholderAPI net worth displays
Administrative scatter tools
Full command and configuration control
No code changes required for customization
Kodari AI
KodariJun 11 at 10:25 am 18

Iโ€™ll create the PointCapture plugin - a complete territory-control plugin with teams, elections, crowns, net worth tracking, and scattering.

PointCapture
A fully configurable territory-control plugin with operator-managed teams, elections with boss bar countdowns, leader crowns granting +10 health, unlimited free territory claiming, recursive net worth tracking with PlaceholderAPI, scattering, and team-colored player names. All configuration is command-driven without requiring code changes.

Starting with the foundation files.

Let me check what Iโ€™ve built so far and continue with the remaining files.

Now Iโ€™ll create all the remaining classes. Starting with the core managers and main plugin.

</create>

Now let me add the ConfigManager getString method that TerritoryListener needs, and ensure the Election.java import is fixed:

itzrealmeglazer

The compilation failed with this error:

code
Compilation failed with 6 error(s):

ERROR in src/main/java/com/pointcapture/crown/CrownManager.java at line 104: cannot find symbol
        AttributeInstance attr = player.getAttribute(Attribute.GENERIC_MAX_HEALTH);
                                                              ^
  symbol: variable GENERIC_MAX_HEALTH
  location: interface Attribute

ERROR in src/main/java/com/pointcapture/crown/CrownManager.java at line 112: cannot find symbol
        AttributeInstance attr = player.getAttribute(Attribute.GENERIC_MAX_HEALTH);
                                                              ^
  symbol: variable GENERIC_MAX_HEALTH
  location: interface Attribute

ERROR in src/main/java/com/pointcapture/election/Election.java at line 64: cannot find symbol
        List<UUID> topCandidates = tally.entrySet().stream()
        ^
  symbol: class List
  location: class Election

ERROR in src/main/java/com/pointcapture/territory/TerritoryListener.java at line 68: cannot find symbol
        String type = configManager.getString("territory.notifications." + path + ".type");
                                   ^
  symbol: method getString(String)
  location: variable configManager of type ConfigManager

ERROR in src/main/java/com/pointcapture/territory/TerritoryListener.java at line 69: cannot find symbol
        String message = configManager.getString("territory.notifications." + path + ".message");
                                      ^
  symbol: method getString(String)
  location: variable configManager of type ConfigManager

ERROR in src/main/java/com/pointcapture/territory/TerritoryListener.java at line 85: cannot find symbol
        String type = configManager.getString("territory.notifications." + path + ".type");
                                   ^
  symbol: method getString(String)
  location: variable configManager of type ConfigManager


=== COMPILATION ERROR ANALYSIS ===

MISSING CLASSES:
  - List
ACTION: Create these classes or check imports

MISSING METHODS:
  - getString(String)
ACTION: Check method names and signatures

FILES TO INVESTIGATE:
  - src/main/java/com/pointcapture/crown/CrownManager.java
  - src/main/java/com/pointcapture/election/Election.java
  - src/main/java/com/pointcapture/territory/TerritoryListener.java

Please fix this error by creating a new artifact with the corrected code.

itzrealmeglazer

The compilation failed with this error:

code
Compilation failed with 6 error(s):

ERROR in src/main/java/com/pointcapture/crown/CrownManager.java at line 104: cannot find symbol
        AttributeInstance attr = player.getAttribute(Attribute.GENERIC_MAX_HEALTH);
                                                              ^
  symbol: variable GENERIC_MAX_HEALTH
  location: interface Attribute

ERROR in src/main/java/com/pointcapture/crown/CrownManager.java at line 112: cannot find symbol
        AttributeInstance attr = player.getAttribute(Attribute.GENERIC_MAX_HEALTH);
                                                              ^
  symbol: variable GENERIC_MAX_HEALTH
  location: interface Attribute

ERROR in src/main/java/com/pointcapture/election/Election.java at line 64: cannot find symbol
        List<UUID> topCandidates = tally.entrySet().stream()
        ^
  symbol: class List
  location: class Election

ERROR in src/main/java/com/pointcapture/territory/TerritoryListener.java at line 68: cannot find symbol
        String type = configManager.getString("territory.notifications." + path + ".type");
                                   ^
  symbol: method getString(String)
  location: variable configManager of type ConfigManager

ERROR in src/main/java/com/pointcapture/territory/TerritoryListener.java at line 69: cannot find symbol
        String message = configManager.getString("territory.notifications." + path + ".message");
                                      ^
  symbol: method getString(String)
  location: variable configManager of type ConfigManager

ERROR in src/main/java/com/pointcapture/territory/TerritoryListener.java at line 85: cannot find symbol
        String type = configManager.getString("territory.notifications." + path + ".type");
                                   ^
  symbol: method getString(String)
  location: variable configManager of type ConfigManager


=== COMPILATION ERROR ANALYSIS ===

MISSING CLASSES:
  - List
ACTION: Create these classes or check imports

MISSING METHODS:
  - getString(String)
ACTION: Check method names and signatures

FILES TO INVESTIGATE:
  - src/main/java/com/pointcapture/crown/CrownManager.java
  - src/main/java/com/pointcapture/election/Election.java
  - src/main/java/com/pointcapture/territory/TerritoryListener.java

Please fix this error by creating a new artifact with the corrected code.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
25 2,963
src/main/java/com/pointcapture/PointCapturePlugin.java
package com.pointcapture;

import com.pointcapture.config.ConfigManager;
import com.pointcapture.crown.CrownListener;
import com.pointcapture.crown.CrownManager;
import com.pointcapture.election.ElectionManager;
import com.pointcapture.listener.PlayerListener;
import com.pointcapture.networth.NetWorthManager;
import com.pointcapture.networth.NetWorthPlaceholder;
import com.pointcapture.territory.TerritoryListener;
import com.pointcapture.territory.TerritoryManager;
import com.pointcapture.commands.*;
import com.pointcapture.teams.TeamManager;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

public class PointCapturePlugin extends JavaPlugin {

    private static PointCapturePlugin instance;
    private ConfigManager configManager;
    private TeamManager teamManager;
    private ElectionManager electionManager;
    private CrownManager crownManager;
    private NetWorthManager netWorthManager;
    private TerritoryManager territoryManager;

    @Override
    public void onEnable() {
        instance = this;
        saveDefaultConfig();

        this.configManager = new ConfigManager(this);
        this.teamManager = new TeamManager(this);
        this.electionManager = new ElectionManager(this);
        this.crownManager = new CrownManager(this);
        this.netWorthManager = new NetWorthManager(this);
        this.territoryManager = new TerritoryManager(this);

        registerListeners();
        registerCommands();
        registerPlaceholderAPI();
    }

    @Override
    public void onDisable() {
        if (electionManager != null) electionManager.stopAll();
        if (teamManager != null) teamManager.saveTeams();
        if (netWorthManager != null) netWorthManager.shutdown();
    }

    private void registerListeners() {
        Bukkit.getPluginManager().registerEvents(new CrownListener(crownManager), this);
        Bukkit.getPluginManager().registerEvents(new TerritoryListener(territoryManager, configManager, teamManager), this);
        Bukkit.getPluginManager().registerEvents(new PlayerListener(teamManager, crownManager, netWorthManager), this);
    }

    private void registerCommands() {
        TeamCommand teamCmd = new TeamCommand(this);
        getCommand("team").setExecutor(teamCmd);
        getCommand("team").setTabCompleter(new TeamTabCompleter());

        TeamAdminCommand adminCmd = new TeamAdminCommand(this);
        getCommand("teamadmin").setExecutor(adminCmd);
        getCommand("teamadmin").setTabCompleter(new TeamTabCompleter());

        getCommand("crown").setExecutor(new CrownCommand(crownManager));
        getCommand("networth").setExecutor(new NetWorthCommand(netWorthManager));
        getCommand("scatterall").setExecutor(new ScatterCommand(this));
        getCommand("scatterconfig").setExecutor(new ScatterConfigCommand(this));
    }

    private void registerPlaceholderAPI() {
        if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
            new NetWorthPlaceholder(netWorthManager, teamManager).register();
            getLogger().info("PlaceholderAPI expansion registered.");
        }
    }

    public static PointCapturePlugin getInstance() {
        return instance;
    }

    public ConfigManager getConfigManager() {
        return configManager;
    }

    public TeamManager getTeamManager() {
        return teamManager;
    }

    public ElectionManager getElectionManager() {
        return electionManager;
    }

    public CrownManager getCrownManager() {
        return crownManager;
    }

    public NetWorthManager getNetWorthManager() {
        return netWorthManager;
    }

    public TerritoryManager getTerritoryManager() {
        return territoryManager;
    }
}