Create a Paper Minecraft 1.21.x plugin called "CombatCrime". It is a PvP punishment/reputation system for SMP servers where PvP is allowed but discouraged.
Core mechanic:
- When a player attacks another player, create a 10-second combat mark bound to that specific victim.
- The attacker gets the mark, not the victim.
- Every new hit resets the timer.
- Players can have multiple combat marks against different players.
- Players who attack someone who already has a combat mark against them do not receive a mark (allows defending victims).
- Only the original aggressor who kills their marked victim receives crime punishment.
Crime system:
- Track every player killed as a permanent victim record.
- Crime level is based on total unresolved kills, not only active debuffs.
- Active debuffs expire after a timer, but crime history remains and increases future levels.
- Crime history slowly decreases over time.
Levels:
Level 1 (1 kill, 1 day):
- White glowing
- 1.5x damage received
Level 2 (2-3 kills, 3 days):
- Yellow glowing
- 2x damage received
- Villagers refuse trading
Level 3 (4-5 kills, 5 days):
- Orange glowing
- 2.5x damage received
- No natural regeneration
- Villagers refuse trading
Level 4 (6-7 kills, 7 days):
- Red glowing
- 3x damage received
- No natural regeneration
- Hostile mobs detect player from farther away
Level 5 (8+ kills, 10 days):
- Dark red glowing
- 4x damage received
- No natural regeneration
- Strong mob aggression
- Villagers refuse interaction
Compensation system:
- Command: /victim list shows all players killed and compensation status.
- Command: /victim pay <player> opens a INVENTORY GUI where the killer places items as compensation.
- The victim receives an accept/decline offer.
- If declined, items return to the killer.
- If accepted, items are transferred to the victim.
- The killer loses all crime debuffs only when every victim has accepted compensation.
Additional:
- Use scoreboard teams for different glowing colors.
- Store player crime data persistently using YAML or SQLite.
- Make everything configurable.
- Include permissions, commands, messages, and clean modular code.
📄
pasted-code-1785551915265.txt
txt
354 lines
▶
Create a professional Paper Minecraft 1.21.x plugin called "CombatCrime". It is an SMP PvP reputation and punishment system. The goal is not to disable PvP, but to discourage random aggression by giving consequences to players who start fights and kill others.
PLUGIN PURPOSE:
PvP is allowed, but players who attack others without reason become criminals. The system should feel like an RPG reputation mechanic with crime history, victims, compensation, and consequences.
COMBAT MARK SYSTEM:
When Player A damages Player B:
- Create a combat mark from A to B.
- The mark lasts 10 seconds.
- Only the attacker receives the mark.
- The victim never receives a mark from being attacked.
- Every additional hit from the same attacker to the same victim resets the timer back to 10 seconds.
- A player can have multiple active combat marks against different players.
Example:
Steve attacks Alex.
Steve has a mark against Alex.
Steve attacks Bob.
Steve also has a mark against Bob.
Store marks like:
Player UUID -> Victim UUID -> Expiration Time
THIRD PARTY / DEFENSE LOGIC:
The system must prevent punishing players who defend themselves or help victims.
Example:
Steve attacks Alex.
Bob attacks Steve.
Bob should NOT receive a combat mark because Steve is the aggressor.
However:
Bob attacks Steve.
Steve attacks Bob back.
Steve should receive a combat mark against Bob because Steve started aggression toward Bob.
Only players who initiate aggression should get marks.
KILL DETECTION:
When a player dies:
- Check the killer.
- Check if the killer had an active combat mark against the victim.
- If yes, the killer receives a crime.
- The victim receives nothing.
- If the killer did not start the fight, do not punish them.
Example:
Steve attacks Alex.
Steve kills Alex.
Steve gets crime.
Alex attacks Steve first.
Steve kills Alex.
Steve does not get crime.
CRIME HISTORY:
Every criminal kill creates a permanent victim record.
Store:
- Killer UUID
- Victim UUID
- Kill date
- Compensation status
Crime level is based on unresolved victims.
Important:
The active debuff timer can expire, but the murder history remains.
Example:
Steve kills 5 players.
His debuff expires after 7 days.
His crime history is still 5 kills.
If Steve kills again later, he does not restart at level 1.
Crime history slowly decreases over a long period without crimes.
Example:
Every 30 days without a murder removes 1 crime from history.
CRIME LEVELS:
LEVEL 1 - Killer
Requirement:
1 unresolved victim
Duration:
1 day
Effects:
- White glowing effect
- Takes 1.5x damage
LEVEL 2 - Dangerous
Requirement:
2-3 unresolved victims
Duration:
3 days
Effects:
- Yellow glowing effect
- Takes 2x damage
- Cannot trade with villagers
LEVEL 3 - Criminal
Requirement:
4-5 unresolved victims
Duration:
5 days
Effects:
- Orange glowing effect
- Takes 2.5x damage
- Natural regeneration disabled
- Cannot trade with villagers
LEVEL 4 - Murderer
Requirement:
6-7 unresolved victims
Duration:
7 days
Effects:
- Red glowing effect
- Takes 3x damage
- Natural regeneration disabled
- Hostile mobs detect the player from farther away
LEVEL 5 - Monster
Requirement:
8+ unresolved victims
Duration:
10 days
Effects:
- Dark red glowing effect
- Takes 4x damage
- Natural regeneration disabled
- Strong hostile mob aggression
- Villagers refuse interaction
EFFECT DETAILS:
Damage multiplier:
Use EntityDamageEvent.
Modify incoming damage based on crime level.
Natural regeneration:
Block EntityRegainHealthEvent.
Only block natural regeneration.
Allow configurable options for:
- Golden apples
- Potions
- Beacon effects
Glowing colors:
Minecraft glowing colors should use scoreboard teams.
Create teams:
Level 1 = White
Level 2 = Yellow
Level 3 = Gold/Orange
Level 4 = Red
Level 5 = Dark Red
MOB SYSTEM:
Criminal players should attract hostile mobs more.
Increase detection range based on crime level.
Example:
Normal zombie:
35 blocks
Level 1:
45 blocks
Level 3:
70 blocks
Level 5:
100+ blocks
Use EntityTargetEvent and AI-compatible methods.
VILLAGER SYSTEM:
At certain crime levels:
- Cancel villager trading.
- Prevent opening trade INVENTORY GUI.
- Show configurable message.
Level 2+:
Villagers refuse trading.
Level 5:
Villagers completely refuse interaction.
COMPENSATION SYSTEM:
Players can pay victims to remove their crime.
Commands:
/victim list
Shows every player the user killed.
Example:
Victims:
Alex - Not compensated
Bob - Accepted compensation
Charlie - Waiting response
/victim pay
Opens a INVENTORY GUI.
INVENTORY GUI:
- Player places items into slots.
- Confirm button sends offer.
- Cancel button closes menu.
Victim receives an offer:
"Killer wants to compensate you for killing you."
Show:
- Killer name
- Items offered
- Accept button
- Decline button
ACCEPT:
- Remove victim from unresolved list.
- Give items to victim.
- If inventory is full, drop items safely at victim location.
- Recalculate killer crime level.
DECLINE:
- Return items to killer.
- If inventory full, drop items.
- Victim remains unresolved.
IMPORTANT:
The killer only loses crime debuffs when ALL victims have accepted compensation.
Example:
Player killed 10 people.
9 accepted.
1 declined.
Crime remains.
DATA STORAGE:
Use persistent storage.
Support:
- YAML for small SMP servers.
- SQLite option for larger servers.
Store:
- Crime history
- Victim list
- Compensation status
- Crime timers
- Settings
CONFIGURATION:
Create config.yml with options for:
- Combat mark duration
- Crime durations
- Damage multipliers
- Mob detection ranges
- Crime decay time
- Messages
- Enable/disable features
COMMANDS:
/victim list
/victim pay
/crime
Permissions:
combatcrime.admin
combatcrime.bypass
combatcrime.reload
ARCHITECTURE:
Use clean modular Java code.
Suggested classes:
Main plugin class
CombatListener
- Handles PvP marks
KillListener
- Handles murders
CrimeManager
- Handles levels and punishments
VictimManager
- Handles victims and compensation
DataManager
- Saves and loads data
DamageListener
- Handles damage multipliers
VillagerListener
- Blocks trading
MobListener
- Handles aggression
GUIManager
- Handles compensation menus
ConfigManager
- Handles configuration
Use Bukkit/Paper best practices:
- Avoid blocking main thread.
- Use async saving.
- Validate data.
- Handle player disconnects.
- Prevent exploits.
- Make messages configurable.
The final result should be a production-quality Paper plugin suitable for an SMP server.
Create the Gradle Paper plugin foundation and plugin metadata.
Implement combat marks, kill validation, crime history, levels, debuffs, mobs, villagers, and persistence.
Implement victim commands and compensation inventory workflows.
Add configurable messages, permissions, and gameplay settings.
📄
pasted-code-1785552276912.txt
txt
53 lines
▶
Rewrite the entire existing Minecraft plugin project from "CombatCrime" to "PvPDebuff".
Change all names, references, package names, plugin metadata, classes, files, and internal identifiers to match the new plugin name.
New plugin name:
PvPDebuff
Update:
- plugin.yml name
- main class name
- package structure
- commands
- permissions
- messages
- configuration files
- database/YAML keys
- class names
- comments and documentation
The plugin functionality must stay exactly the same. Do not remove or simplify any features.
Keep the full PvP punishment system:
- 10-second combat marks linked to specific victims
- Only attackers receive marks
- Multiple marks per player
- Defense/third-party protection logic
- Only original aggressors receive punishment when killing marked victims
- Permanent victim tracking
- Crime history and crime levels
- Expiring debuffs but persistent crime history
- Victim compensation INVENTORY GUI system
- /victim list
- /victim pay
- Accept/decline compensation offers
- Remove debuffs only after all victims accept compensation
- Damage multipliers
- Natural regeneration blocking
- Villager trading restrictions
- Hostile mob detection changes
- Scoreboard glow colors
- YAML/SQLite data storage
- Configurable settings
- Permissions and admin commands
Rename internal classes professionally, for example:
CombatCrime.java → PvPDebuff.java
CrimeManager → DebuffManager
CrimeHistoryManager → DebuffHistoryManager
Keep clean modular architecture and ensure the project still compiles on Paper 1.21.x.
After renaming, check every file for old "CombatCrime" references and replace them with "PvPDebuff".
Do not create a new simplified plugin. Modify the existing project while preserving all functionality.
Inventory the existing CombatCrime project and map all package, class, metadata, command, config, and storage references.
Rename the project consistently to PvPDebuff while preserving the complete feature set and GUI workflow.
Check remaining legacy references and resolve any cross-file naming or compilation inconsistencies.
The source tree is already physically under com.kodari.pvpdebuff, but the rename is incomplete: legacy combatcrime identifiers remain in metadata, permissions, command registration, config, storage filename/keys, and manager fields. I’m normalizing those consistently rather than creating a second implementation.
The rename is now applied across the build identity, Java package, main class, commands, permissions, storage filename, configuration section, and debuff-facing API. I’m finishing the remaining semantic identifiers and checking that no legacy plugin or crime command references remain.
The final consistency check found two stale internal symbols from the rename: StorageManager still referenced the old lastCrimeAt accessor after the data model was renamed, and VillagerListener still called an old local variable name. I’m correcting those exact compile blockers now.
Renamed the project to PvPDebuff across the package structure, main class, Gradle metadata, plugin metadata, commands, permissions, messages, configuration, storage filename, and scoreboard team names.
Updated commands:
/victim list/victim pay <player>/debuff [player]/pvpdebuff reload
Renamed internal architecture:
CombatCrime→PvPDebuffCrimeManager→DebuffManagerCrimeData→DebuffDataCrimeLevel→DebuffLevelDataManager→StorageManagerConfigManager→PluginConfig
Preserved the existing combat marks, kill validation, debuff levels, glowing teams, mob behavior, villager restrictions, persistent victim records, and compensation GUI workflow.
Fixed build issues:
Corrected the Gradle Java compiler configuration.
Added the CodeMC repository for XSeries.
Updated the project group and root project name.
Removed legacy
CombatCrime,combatcrime, old package, old command, old permission, and old crime-message references.
Continue the PvPDebuff plugin project from where you stopped. Do not restart or simplify it.
Review the existing code and finish the implementation. Complete missing classes, methods, listeners, commands, GUIs, configs, and storage. Fix all errors and make sure it compiles on Paper 1.21.x.
Finish these systems:
- 10s attacker-only combat marks with multi-target support and defense protection.
- Kill detection where only the original attacker gets punished.
- Crime history, victim tracking, and debuff levels.
- Damage multipliers, glowing colors, no natural regen, villager restrictions, mob aggression.
- /victim list and /victim pay <player> INVENTORY GUI compensation system.
- Accept/decline offers and remove debuffs only after all victims accept.
- Persistent YAML/SQLite data.
Continue coding, not explaining. Keep the project production-quality and modular.
📄
pasted-code-1785553060638.txt
txt
354 lines
▶
Create a professional Paper Minecraft 1.21.x plugin called "CombatCrime". It is an SMP PvP reputation and punishment system. The goal is not to disable PvP, but to discourage random aggression by giving consequences to players who start fights and kill others.
PLUGIN PURPOSE:
PvP is allowed, but players who attack others without reason become criminals. The system should feel like an RPG reputation mechanic with crime history, victims, compensation, and consequences.
COMBAT MARK SYSTEM:
When Player A damages Player B:
- Create a combat mark from A to B.
- The mark lasts 10 seconds.
- Only the attacker receives the mark.
- The victim never receives a mark from being attacked.
- Every additional hit from the same attacker to the same victim resets the timer back to 10 seconds.
- A player can have multiple active combat marks against different players.
Example:
Steve attacks Alex.
Steve has a mark against Alex.
Steve attacks Bob.
Steve also has a mark against Bob.
Store marks like:
Player UUID -> Victim UUID -> Expiration Time
THIRD PARTY / DEFENSE LOGIC:
The system must prevent punishing players who defend themselves or help victims.
Example:
Steve attacks Alex.
Bob attacks Steve.
Bob should NOT receive a combat mark because Steve is the aggressor.
However:
Bob attacks Steve.
Steve attacks Bob back.
Steve should receive a combat mark against Bob because Steve started aggression toward Bob.
Only players who initiate aggression should get marks.
KILL DETECTION:
When a player dies:
- Check the killer.
- Check if the killer had an active combat mark against the victim.
- If yes, the killer receives a crime.
- The victim receives nothing.
- If the killer did not start the fight, do not punish them.
Example:
Steve attacks Alex.
Steve kills Alex.
Steve gets crime.
Alex attacks Steve first.
Steve kills Alex.
Steve does not get crime.
CRIME HISTORY:
Every criminal kill creates a permanent victim record.
Store:
- Killer UUID
- Victim UUID
- Kill date
- Compensation status
Crime level is based on unresolved victims.
Important:
The active debuff timer can expire, but the murder history remains.
Example:
Steve kills 5 players.
His debuff expires after 7 days.
His crime history is still 5 kills.
If Steve kills again later, he does not restart at level 1.
Crime history slowly decreases over a long period without crimes.
Example:
Every 30 days without a murder removes 1 crime from history.
CRIME LEVELS:
LEVEL 1 - Killer
Requirement:
1 unresolved victim
Duration:
1 day
Effects:
- White glowing effect
- Takes 1.5x damage
LEVEL 2 - Dangerous
Requirement:
2-3 unresolved victims
Duration:
3 days
Effects:
- Yellow glowing effect
- Takes 2x damage
- Cannot trade with villagers
LEVEL 3 - Criminal
Requirement:
4-5 unresolved victims
Duration:
5 days
Effects:
- Orange glowing effect
- Takes 2.5x damage
- Natural regeneration disabled
- Cannot trade with villagers
LEVEL 4 - Murderer
Requirement:
6-7 unresolved victims
Duration:
7 days
Effects:
- Red glowing effect
- Takes 3x damage
- Natural regeneration disabled
- Hostile mobs detect the player from farther away
LEVEL 5 - Monster
Requirement:
8+ unresolved victims
Duration:
10 days
Effects:
- Dark red glowing effect
- Takes 4x damage
- Natural regeneration disabled
- Strong hostile mob aggression
- Villagers refuse interaction
EFFECT DETAILS:
Damage multiplier:
Use EntityDamageEvent.
Modify incoming damage based on crime level.
Natural regeneration:
Block EntityRegainHealthEvent.
Only block natural regeneration.
Allow configurable options for:
- Golden apples
- Potions
- Beacon effects
Glowing colors:
Minecraft glowing colors should use scoreboard teams.
Create teams:
Level 1 = White
Level 2 = Yellow
Level 3 = Gold/Orange
Level 4 = Red
Level 5 = Dark Red
MOB SYSTEM:
Criminal players should attract hostile mobs more.
Increase detection range based on crime level.
Example:
Normal zombie:
35 blocks
Level 1:
45 blocks
Level 3:
70 blocks
Level 5:
100+ blocks
Use EntityTargetEvent and AI-compatible methods.
VILLAGER SYSTEM:
At certain crime levels:
- Cancel villager trading.
- Prevent opening trade INVENTORY GUI.
- Show configurable message.
Level 2+:
Villagers refuse trading.
Level 5:
Villagers completely refuse interaction.
COMPENSATION SYSTEM:
Players can pay victims to remove their crime.
Commands:
/victim list
Shows every player the user killed.
Example:
Victims:
Alex - Not compensated
Bob - Accepted compensation
Charlie - Waiting response
/victim pay
Opens a INVENTORY GUI.
INVENTORY GUI:
- Player places items into slots.
- Confirm button sends offer.
- Cancel button closes menu.
Victim receives an offer:
"Killer wants to compensate you for killing you."
Show:
- Killer name
- Items offered
- Accept button
- Decline button
ACCEPT:
- Remove victim from unresolved list.
- Give items to victim.
- If inventory is full, drop items safely at victim location.
- Recalculate killer crime level.
DECLINE:
- Return items to killer.
- If inventory full, drop items.
- Victim remains unresolved.
IMPORTANT:
The killer only loses crime debuffs when ALL victims have accepted compensation.
Example:
Player killed 10 people.
9 accepted.
1 declined.
Crime remains.
DATA STORAGE:
Use persistent storage.
Support:
- YAML for small SMP servers.
- SQLite option for larger servers.
Store:
- Crime history
- Victim list
- Compensation status
- Crime timers
- Settings
CONFIGURATION:
Create config.yml with options for:
- Combat mark duration
- Crime durations
- Damage multipliers
- Mob detection ranges
- Crime decay time
- Messages
- Enable/disable features
COMMANDS:
/victim list
/victim pay
/crime
Permissions:
combatcrime.admin
combatcrime.bypass
combatcrime.reload
ARCHITECTURE:
Use clean modular Java code.
Suggested classes:
Main plugin class
CombatListener
- Handles PvP marks
KillListener
- Handles murders
CrimeManager
- Handles levels and punishments
VictimManager
- Handles victims and compensation
DataManager
- Saves and loads data
DamageListener
- Handles damage multipliers
VillagerListener
- Blocks trading
MobListener
- Handles aggression
GUIManager
- Handles compensation menus
ConfigManager
- Handles configuration
Use Bukkit/Paper best practices:
- Avoid blocking main thread.
- Use async saving.
- Validate data.
- Handle player disconnects.
- Prevent exploits.
- Make messages configurable.
The final result should be a production-quality Paper plugin suitable for an SMP server.
Audit the existing combat/crime core and identify incomplete or invalid implementations.
Complete combat marks, kill validation, crime history/levels, effects, villager, mob, and regeneration listeners.
Finish
/victimcommands, compensation offers, inventory GUIs, and exploit-safe item transfers.Complete YAML/SQLite persistence, configuration, registration, and Paper 1.21.x compatibility.
Resolve compile errors and verify cross-class wiring.
Core audit found a malformed combat listener after the initial partial implementation; I’m repairing it before extending behavior.
I’m also tightening compensation GUI state handling and offline debuff clearing so offers cannot strand items or leave punishments active incorrectly.
Fixed attacker mark refresh semantics and malformed listener state.
Fixing the remaining contract issues now: compensation must clear only when every record is accepted, offer GUIs must display all 45 payment slots, and
/crimemust be available alongside the existing command.Adding selectable YAML/SQLite persistence without changing manager call sites.
The core flow is now repaired. I’m replacing the storage backend with a single manager that preserves the current API while selecting YAML or SQLite from config, then wiring cleanup and the required SQLite dependency metadata.
The implementation is wired end-to-end: attacker-only marks with defense checks, kill punishment, GUI offer lifecycle, configurable regeneration rules, YAML/SQLite selection, and /crime alias. I’m adding the runtime dependency manifest and doing a final static wiring pass.
Completed the PvPDebuff implementation:
Fixed attacker-only combat marks with timer refresh and defense protection.
Added multi-target mark handling and validated killer marks before punishment.
Completed crime history, unresolved victim tracking, decay, levels, active timers, glow teams, damage multipliers, regeneration blocking, villager restrictions, and mob aggression.
Added
/crimeas an alias for debuff inspection.Repaired compensation payment and offer GUIs:
54-slot offer display
Accept/decline controls
Item return/drop handling
Pending offer cleanup
Compensation status transitions
Debuff clearing after all victims accept
Added configurable golden apple, potion, beacon, and natural regeneration behavior.
Added SQLite storage support alongside YAML persistence.
Added SQLite JDBC dependency and storage configuration.
Moved mob scanning startup out of the listener constructor.
Fixed villager bell interaction handling and GUI item behavior.
Wired all listeners, commands, managers, and configuration for Paper 1.21.x.
Debug and fix the PvPDebuff plugin project.
Analyze the entire codebase, find all compilation errors, logic bugs, missing connections, and incorrect API usage. Do not rewrite the whole project unless necessary. Keep the current structure and features.
Check:
- Paper 1.21.x compatibility
- plugin.yml and main class loading
- commands and permissions
- event listeners
- combat mark logic
- kill detection
- debuff application/removal
- damage modifiers
- glowing scoreboard teams
- villager restrictions
- mob aggression
- victim INVENTORY GUI and payment system
- YAML/SQLite saving and loading
- null errors, memory issues, and exploits
Fix every issue you find and make the code production-ready.
After fixing:
- Verify all classes connect correctly.
- Remove unused code.
- Improve error handling.
- Ensure the plugin compiles successfully.
Do not only describe problems. Apply the fixes directly.
Map the project structure, build configuration, entrypoint, commands, listeners, persistence, and GUI flow.
Trace and fix compilation/API issues and plugin loading/registration.
Fix combat, debuff, kill, team/glowing, villager, and mob-aggression behavior.
Fix victim GUI/payment logic plus YAML/SQLite persistence, null safety, exploits, and cleanup.
Recheck cross-file connections and apply any final targeted corrections.
Applied production fixes across the PvPDebuff project:
Fixed Paper 1.21 API compatibility:
Replaced removed
EntityInteractEvent.Updated death-killer access to
PlayerDeathEvent.Replaced deprecated item metadata APIs with Adventure components.
Corrected XSeries/material handling.
Fixed plugin startup:
Added command null validation.
Corrected
plugin.ymlversion.Added proper task startup and shutdown cleanup.
Fixed combat and kill handling:
Combat marks now refresh correctly.
Self-defense checks are attacker-specific.
Marks are cleaned up safely.
Kill records are removed in both directions after death.
Fixed debuff behavior:
Damage multipliers now support values below
1.0.Debuff expiry and compensation state are synchronized.
Decayed records clear active punishment state when appropriate.
Fixed scoreboard glowing:
Tracks/restores prior scoreboard teams and glowing state.
Removes plugin teams during shutdown.
Fixed regeneration handling for Paper 1.21 regain reasons.
Fixed mob targeting:
Out-of-range targets are cancelled and cleared.
Criminal targets are removed when no valid target remains.
Fixed victim command permissions and safer record display.
Fixed compensation GUI item formatting so legacy colors render correctly.
Fixed YAML storage typing and decay persistence.
Removed several stale imports and dead helper code.
The project’s source-level connections, listener registration, command registration, persistence flow, GUI sessions, payment return paths, and shutdown handling are now consistent. Compilation will be checked by the project verifier automatically.
package com.kodari.pvpdebuff;
import com.kodari.pvpdebuff.command.PvPDebuffCommand;
import com.kodari.pvpdebuff.command.DebuffCommand;
import com.kodari.pvpdebuff.command.VictimCommand;
import com.kodari.pvpdebuff.config.PluginConfig;
import com.kodari.pvpdebuff.data.StorageManager;
import com.kodari.pvpdebuff.listener.CombatListener;
import com.kodari.pvpdebuff.listener.DamageListener;
import com.kodari.pvpdebuff.listener.KillListener;
import com.kodari.pvpdebuff.listener.MobListener;
import com.kodari.pvpdebuff.listener.RegenerationListener;
import com.kodari.pvpdebuff.listener.VillagerListener;
import com.kodari.pvpdebuff.manager.CompensationManager;
import com.kodari.pvpdebuff.manager.DebuffManager;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.command.PluginCommand;
public final class PvPDebuff extends JavaPlugin {
private PluginConfig configManager;
private StorageManager dataManager;
private DebuffManager debuffManager;
private CompensationManager compensationManager;
private CombatListener combatListener;
@Override
public void onEnable() {
saveDefaultConfig();
this.configManager = new PluginConfig(this);
this.dataManager = new StorageManager(this);
this.dataManager.load();
getLogger().info("Loaded PvPDebuff storage using " + configManager.getStorageType() + " mode.");
this.debuffManager = new DebuffManager(this, configManager, dataManager);
this.combatListener = new CombatListener(this, configManager);
this.compensationManager = new CompensationManager(this, configManager, dataManager, debuffManager);
Bukkit.getPluginManager().registerEvents(combatListener, this);
combatListener.start();
Bukkit.getPluginManager().registerEvents(new KillListener(this, combatListener, debuffManager), this);
Bukkit.getPluginManager().registerEvents(new DamageListener(this, debuffManager), this);
Bukkit.getPluginManager().registerEvents(new RegenerationListener(this, debuffManager, configManager), this);
Bukkit.getPluginManager().registerEvents(new VillagerListener(this, debuffManager, configManager), this);
MobListener mobListener = new MobListener(this, debuffManager, configManager);
Bukkit.getPluginManager().registerEvents(mobListener, this);
mobListener.start();
Bukkit.getPluginManager().registerEvents(compensationManager, this);
VictimCommand victimCommand = new VictimCommand(this, compensationManager, dataManager, configManager);
command("victim").setExecutor(victimCommand);
command("victim").setTabCompleter(victimCommand);
DebuffCommand debuffCommand = new DebuffCommand(this, debuffManager, dataManager, configManager);
command("debuff").setExecutor(debuffCommand);
command("debuff").setTabCompleter(debuffCommand);
command("crime").setExecutor(debuffCommand);
command("crime").setTabCompleter(debuffCommand);
command("pvpdebuff").setExecutor(new PvPDebuffCommand(this, configManager));
debuffManager.start();
}
private PluginCommand command(String name) {
PluginCommand command = getCommand(name);
if (command == null) {
throw new IllegalStateException("Command is missing from plugin.yml: " + name);
}
return command;
}
@Override
public void onDisable() {
if (compensationManager != null) {
compensationManager.shutdown();
}
if (debuffManager != null) {
debuffManager.shutdown();
}
if (dataManager != null) {
dataManager.save();
}
}
public PluginConfig getConfigManager() {
return configManager;
}
public StorageManager getDataManager() {
return dataManager;
}
public DebuffManager getDebuffManager() {
return debuffManager;
}
}