📄
pasted-code-1779759989468.txt
txt
827 lines
▶
# FalseCode — Paper/Purpur 1.21+ Plugin Design
This is a production-oriented architecture and implementation plan for a polished SMP PvP plugin designed around **Fragments**, **Legendary Artifacts**, and high-risk progression.
The design prioritizes:
- low overhead
- vanilla-feeling combat
- tactical PvP
- anti-duplication safety
- future expandability
- clean code structure
---
# Tech Stack
## Platform
- Paper / Purpur `1.21+`
## Language
- Java 21
## Build
- Gradle Kotlin DSL
## Storage
- YAML + persistent serialized player data
- Optional future migration path to SQLite
---
# Recommended Project Structure
```text
falsecode/
│
├── api/
│ ├── fragment/
│ ├── legendary/
│ └── ability/
│
├── abilities/
│ ├── fragment/
│ └── legendary/
│
├── commands/
│
├── config/
│
├── cooldown/
│
├── data/
│
├── fragments/
│
├── INVENTORY GUI/
│
├── items/
│
├── listeners/
│
├── managers/
│
├── placeholders/
│
├── tasks/
│
├── util/
│
└── FalseCodePlugin.java
```
---
# Gradle Build File
## `build.gradle.kts`
```kotlin
plugins {
java
}
group = "dev.falsecode"
version = "1.0.0"
repositories {
mavenCentral()
maven("https://repo.papermc.io/repository/maven-public/")
maven("https://repo.extendedclip.com/content/repositories/placeholderapi/")
}
dependencies {
compileOnly("io.papermc.paper:paper-api:1.21-R0.1-SNAPSHOT")
compileOnly("me.clip:placeholderapi:2.11.6")
}
java {
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
}
```
---
# plugin.yml
```yaml
name: FalseCode
version: 1.0.0
main: dev.falsecode.FalseCodePlugin
api-version: '1.21'
authors:
- YourName
softdepend:
- PlaceholderAPI
commands:
fragment:
permission: falsecode.admin
fragmentcore:
permission: falsecode.admin
falsecode:
permission: falsecode.admin
usespecialability1:
aliases: [usa1]
usespecialability2:
aliases: [usa2]
permissions:
falsecode.admin:
default: op
falsecode.use:
default: true
```
---
# Core Architecture
# Fragment System
Fragments are:
- physical items
- UUID-tracked
- soulbound
- offhand-required
- unstackable
- owner-locked
Each fragment contains:
```java
public interface Fragment {
FragmentType getType();
void applyPassive(Player player);
void removePassive(Player player);
void useAbilityOne(Player player);
void useAbilityTwo(Player player);
long getAbilityOneCooldown();
long getAbilityTwoCooldown();
}
```
---
# FragmentType Enum
```java
public enum FragmentType {
VOID,
BLOOD,
ECHO,
EMBER,
FROST,
STORM,
IRON,
SHADE
}
```
---
# Persistent Data Keys
Use `PersistentDataContainer`.
## Namespaced Keys
```java
public final class Keys {
public static NamespacedKey FRAGMENT_ID;
public static NamespacedKey FRAGMENT_OWNER;
public static NamespacedKey FRAGMENT_TYPE;
public static NamespacedKey LEGENDARY_TYPE;
}
```
---
# Player Data Model
```java
public class PlayerProfile {
private UUID uuid;
private FragmentType fragment;
private UUID fragmentItemId;
private int potential;
private boolean awakened;
private int rerolls;
private Set legendaries;
private Map cooldowns;
}
```
---
# Data Storage
## Recommended
```text
plugins/FalseCode/data/
```
Per-player YAML:
```yaml
fragment: VOID
fragment-id: xxxxx
potential: 3
awakened: false
rerolls: 1
```
Use:
```java
CompletableFuture.runAsync(...)
```
for disk writes.
Never access Bukkit API async.
---
# Offhand Detection System
Listen to:
- `PlayerSwapHandItemsEvent`
- `InventoryClickEvent`
- `InventoryDragEvent`
- `PlayerJoinEvent`
- `PlayerRespawnEvent`
## Passive Synchronization
```java
public void syncPassives(Player player) {
ItemStack offhand = player.getInventory().getItemInOffHand();
boolean valid = fragmentManager.isPlayerFragment(player, offhand);
if (valid) {
passiveManager.enable(player);
} else {
passiveManager.disable(player);
}
}
```
---
# Ability Controls
# Detection
## F Key
```java
@EventHandler
public void onSwap(PlayerSwapHandItemsEvent event) {
Player player = event.getPlayer();
event.setCancelled(true);
if (player.isSneaking()) {
abilityManager.useAbilityOne(player);
} else {
abilityManager.useAbilityTwo(player);
}
}
```
---
# Cooldown System
```java
public class CooldownManager {
private final Map> cooldowns = new HashMap<>();
public boolean onCooldown(Player player, String id) {
return getRemaining(player, id) > 0;
}
public long getRemaining(Player player, String id) {
return Math.max(
0,
cooldowns
.getOrDefault(player.getUniqueId(), Map.of())
.getOrDefault(id, 0L)
- System.currentTimeMillis()
);
}
public void setCooldown(Player player, String id, long millis) {
cooldowns
.computeIfAbsent(player.getUniqueId(), k -> new HashMap<>())
.put(id, System.currentTimeMillis() + millis);
}
}
```
---
# ActionBar Cooldowns
```java
player.sendActionBar(
Component.text("Rift Dash: ")
.append(Component.text("4.2s", NamedTextColor.RED))
);
```
Update every 10 ticks only while cooldowns exist.
---
# Fragment Item Factory
```java
public ItemStack createFragment(Player owner, FragmentType type) {
ItemStack item = new ItemStack(Material.AMETHYST_SHARD);
ItemMeta meta = item.getItemMeta();
meta.displayName(Component.text(type.name() + " Fragment"));
meta.setEnchantmentGlintOverride(true);
meta.setUnbreakable(true);
meta.getPersistentDataContainer().set(
Keys.FRAGMENT_OWNER,
PersistentDataType.STRING,
owner.getUniqueId().toString()
);
UUID fragmentId = UUID.randomUUID();
meta.getPersistentDataContainer().set(
Keys.FRAGMENT_ID,
PersistentDataType.STRING,
fragmentId.toString()
);
meta.getPersistentDataContainer().set(
Keys.FRAGMENT_TYPE,
PersistentDataType.STRING,
type.name()
);
item.setItemMeta(meta);
return item;
}
```
---
# Anti-Dupe System
You need deep inventory protection.
## Validate On:
- inventory click
- drag
- hopper move
- item pickup
- container open
- death drops
- player join
- chunk load
- shulker insertion
- bundle insertion
---
# Ownership Lock
```java
public boolean canUse(Player player, ItemStack item) {
String owner = item.getItemMeta()
.getPersistentDataContainer()
.get(Keys.FRAGMENT_OWNER, PersistentDataType.STRING);
return player.getUniqueId().toString().equals(owner);
}
```
---
# Potential System
# Kill Tracking
```java
@EventHandler
public void onDeath(PlayerDeathEvent event) {
Player victim = event.getPlayer();
Player killer = victim.getKiller();
if (killer == null) return;
profileManager.addPotential(killer, 1);
}
```
---
# Awakening
At 5 potential:
```java
if (profile.getPotential() >= 5 && !profile.isAwakened()) {
profile.setAwakened(true);
Bukkit.broadcast(
Component.text(player.getName() + " has AWAKENED.")
);
}
```
---
# Ascendant Fragment
Award only if:
- killer awakened
- victim awakened
- anti-farm cooldown valid
---
# Anti-Farming
Track:
```java
Map recentKills;
```
Prevent repeated rewards within config cooldown.
Also compare:
- IP hash
- account age
- repeated kill patterns
---
# Fragment Core INVENTORY GUI
## Menu
```text
+-------------------+
| Fragment Core |
| |
| [Reroll] [Restore]|
| |
+-------------------+
```
Use a reusable INVENTORY GUI framework:
```java
public abstract class Menu {
}
```
---
# Reroll Logic
```java
public void reroll(Player player) {
FragmentType oldType = profile.getFragment();
FragmentType newType = fragmentRegistry.roll(player);
removeOldFragment(player);
giveFragment(player, newType);
cooldownManager.clear(player);
Bukkit.broadcast(
Component.text(
player.getName()
+ " has abandoned the "
+ oldType.name()
+ " Fragment and awakened the "
+ newType.name()
+ " Fragment."
)
);
}
```
---
# Restore Logic
Checks:
- player has no fragment item
- profile contains valid fragment UUID
Then regenerates safely.
---
# Fragment Ability Design Notes
# VOID
## Rift Dash
- teleport 5 blocks
- raytrace collision
- invulnerability: 4 ticks max
## Void Mark
- apply custom metadata debuff
- shield disable reduction
- extra knockback
---
# BLOOD
Use custom bleed scheduler instead of potion spam.
---
# ECHO
Store location snapshots every second.
```java
Map>
```
---
# FROST Icewall
Use temporary block tracker.
Never allow permanent placement.
Auto-revert after duration.
---
# SHADE Silence
Apply metadata:
```java
player.setMetadata("silenced", ...)
```
Abilities check silence before activation.
---
# Legendary Artifact System
Legendary abilities activate only while main hand equipped.
Use:
```java
PlayerItemHeldEvent
```
for synchronization.
---
# Legendary Interface
```java
public interface LegendaryArtifact {
void passive(Player player);
void abilityOne(Player player);
void abilityTwo(Player player);
}
```
---
# PlaceholderAPI Support
Examples:
```text
%falsecode_fragment%
%falsecode_potential%
%falsecode_awakened%
```
---
# Config Example
## `config.yml`
```yaml
debug: false
fragments:
VOID:
enabled: true
weight: 10
SHADE:
enabled: true
weight: 5
cooldowns:
VOID:
ability1: 12
ability2: 18
potential:
max: 5
reroll:
cooldown-hours: 24
max-rerolls: 5
anti-farm:
kill-cooldown-minutes: 30
```
---
# Performance Notes
# Avoid
- constant potion effect reapplication
- large repeating scans
- async Bukkit access
- NBT spam
# Prefer
- metadata flags
- event-driven logic
- cached player profiles
- lightweight scheduled tasks
---
# Recommended Tick Systems
## Every 20 ticks
- passive validation
- cooldown actionbars
## Every 5 ticks
- temporary effects
- silence tracking
---
# Security / Exploit Protection
# Prevent
- hopper dupes
- death duplication
- creative cloning
- reload duplication
- shulker nesting abuse
- bundle storage
- anvil renaming exploits
Use immutable fragment UUID validation everywhere.
---
# Recommended Combat Balancing
# Goal
Abilities should:
- enhance PvP
- not replace sword skill
# Suggested Limits
- most active abilities: 10–25s cooldown
- hard CC: under 2 seconds
- mobility: short range
- sustain: moderate only
---
# Example Broadcast Style
```text
Kyro has awakened the Void Fragment.
Kyro has AWAKENED.
Kyro has forged the NULLBLADE.
```
---
# Future Expansion Support
The architecture supports:
- new fragments
- new legendaries
- relics
- factions
- territory systems
- seasonal resets
- ranked duels
without rewriting core systems.
---
# Recommended Next Steps
If you want, I can also generate:
1. Full Java source implementation
2. Kotlin implementation
3. Complete ability classes
4. Full INVENTORY GUI framework
5. All 8 Fragment implementations
6. All 4 Legendary implementations
7. Anti-dupe listener suite
8. PlaceholderAPI expansion
9. Config package
10. Complete Gradle project tree
11. Production-ready cooldown/actionbar system
12. Full Paper 1.21-compatible codebase
13. Resource pack model JSON structure
14. CustomModelData mappings
15. Database-backed version
16. Unit-testable service architecture
17. Redis/network sync support
18. Adventure API message system
19. Packet-level optimizations
20. Fully balanced default values for competitive SMP play
I’ll create a production-ready Paper 1.21+ plugin for the FalseCode Fragment and Legendary Artifact system.
Project Analysis
Building comprehensive Fragment/Legendary system with:
8 Fragment types with dual abilities (F key + Shift+F)
Offhand-required Fragment validation
Potential/Awakening progression
GUI-based Fragment Core (reroll/restore)
Anti-dupe protection
Cooldown management with ActionBar
PlaceholderAPI integration
Continuing with core system files:
Continuing with Fragment implementations and listeners in next response…
The compilation failed with this error:
Compilation failed with 22 error(s):
ERROR in src/main/java/dev/falsecode/FalseCodePlugin.java at line 3: package dev.falsecode.commands does not exist
import dev.falsecode.commands.FalseCodeCommand;
^
ERROR in src/main/java/dev/falsecode/FalseCodePlugin.java at line 4: package dev.falsecode.commands does not exist
import dev.falsecode.commands.FragmentCommand;
^
ERROR in src/main/java/dev/falsecode/FalseCodePlugin.java at line 5: package dev.falsecode.commands does not exist
import dev.falsecode.commands.FragmentCoreCommand;
^
ERROR in src/main/java/dev/falsecode/FalseCodePlugin.java at line 6: package dev.falsecode.config does not exist
import dev.falsecode.config.ConfigManager;
^
ERROR in src/main/java/dev/falsecode/FalseCodePlugin.java at line 7: package dev.falsecode.cooldown does not exist
import dev.falsecode.cooldown.CooldownManager;
^
ERROR in src/main/java/dev/falsecode/FalseCodePlugin.java at line 8: cannot find symbol
import dev.falsecode.data.ProfileManager;
^
symbol: class ProfileManager
location: package dev.falsecode.data
ERROR in src/main/java/dev/falsecode/FalseCodePlugin.java at line 9: package dev.falsecode.inventory.INVENTORY GUI does not exist
import dev.falsecode.inventory.INVENTORY GUI.GUIListener;
^
ERROR in src/main/java/dev/falsecode/FalseCodePlugin.java at line 10: package dev.falsecode.inventory.INVENTORY GUI does not exist
import dev.falsecode.inventory.INVENTORY GUI.GUIManager;
^
ERROR in src/main/java/dev/falsecode/FalseCodePlugin.java at line 11: package dev.falsecode.listeners does not exist
import dev.falsecode.listeners.AbilityListener;
^
ERROR in src/main/java/dev/falsecode/FalseCodePlugin.java at line 12: package dev.falsecode.listeners does not exist
import dev.falsecode.listeners.AntiDupeListener;
^
ERROR in src/main/java/dev/falsecode/FalseCodePlugin.java at line 13: package dev.falsecode.listeners does not exist
import dev.falsecode.listeners.FragmentListener;
^
ERROR in src/main/java/dev/falsecode/FalseCodePlugin.java at line 14: package dev.falsecode.listeners does not exist
import dev.falsecode.listeners.PassiveListener;
^
ERROR in src/main/java/dev/falsecode/FalseCodePlugin.java at line 18: package dev.falsecode.placeholders does not exist
import dev.falsecode.placeholders.FalseCodeExpansion;
^
ERROR in src/main/java/dev/falsecode/FalseCodePlugin.java at line 19: package dev.falsecode.tasks does not exist
import dev.falsecode.tasks.CooldownDisplayTask;
^
ERROR in src/main/java/dev/falsecode/FalseCodePlugin.java at line 27: cannot find symbol
private ConfigManager configManager;
^
symbol: class ConfigManager
location: class FalseCodePlugin
ERROR in src/main/java/dev/falsecode/FalseCodePlugin.java at line 28: cannot find symbol
private ProfileManager profileManager;
^
symbol: class ProfileManager
location: class FalseCodePlugin
ERROR in src/main/java/dev/falsecode/FalseCodePlugin.java at line 30: cannot find symbol
private CooldownManager cooldownManager;
^
symbol: class CooldownManager
location: class FalseCodePlugin
ERROR in src/main/java/dev/falsecode/FalseCodePlugin.java at line 33: cannot find symbol
private GUIManager guiManager;
^
symbol: class GUIManager
location: class FalseCodePlugin
ERROR in src/main/java/dev/falsecode/FalseCodePlugin.java at line 27: cannot find symbol
private ConfigManager configManager;
^
symbol: class ConfigManager
location: class FalseCodePlugin
ERROR in src/main/java/dev/falsecode/FalseCodePlugin.java at line 28: cannot find symbol
private ProfileManager profileManager;
^
symbol: class ProfileManager
location: class FalseCodePlugin
ERROR in src/main/java/dev/falsecode/FalseCodePlugin.java at line 30: cannot find symbol
private CooldownManager cooldownManager;
^
symbol: class CooldownManager
location: class FalseCodePlugin
ERROR in src/main/java/dev/falsecode/FalseCodePlugin.java at line 33: cannot find symbol
private GUIManager guiManager;
^
symbol: class GUIManager
location: class FalseCodePlugin
=== COMPILATION ERROR ANALYSIS ===
MISSING CLASSES:
- ProfileManager
- ConfigManager
- CooldownManager
- GUIManager
ACTION: Create these classes or check imports
FILES TO INVESTIGATE:
- src/main/java/dev/falsecode/FalseCodePlugin.java
Please fix this error by creating a new artifact with the corrected code.
I need to read the main plugin file to see what’s happening and then create the missing classes.
Now I’ll create all the missing classes to fix the compilation errors. Let me start with the core infrastructure:
Now let me fix the main plugin class to use
Perfect! I’ve created all the missing classes. Now let me add the command definitions to plugin.yml:
Fixed Compilation Errors
I’ve created all the missing classes and fixed the import errors. Here’s what was done:
Fixed Imports in FalseCodePlugin.java
Changed
dev.falsecode.cooldown.CooldownManager→dev.falsecode.managers.CooldownManagerChanged
dev.falsecode.data.ProfileManager→dev.falsecode.managers.ProfileManagerAdded
saveAll()method to ProfileManager
Created Core Infrastructure
Config Management:
ConfigManager- Handles plugin configuration
GUI Framework:
InventoryHandler- Interface for inventory eventsInventoryButton- Builder for clickable buttonsInventoryGUI- Abstract base class with lazy initializationGUIManager- Centralized GUI trackerGUIListener- Event handler for all GUIs
Commands:
FalseCodeCommand- Main admin command with reloadFragmentCommand- Admin commands (give, remove, info, potential)FragmentCoreCommand- Opens Fragment Core GUI
Listeners:
FragmentListener- Join/quit + Fragment item interactionsAbilityListener- Handles ability usagePassiveListener- Handles passive effectsAntiDupeListener- Prevents Fragment duplication
Tasks:
CooldownDisplayTask- Shows cooldowns in action bar
Integration:
FalseCodeExpansion- PlaceholderAPI support (%falsecode_fragment%, %falsecode_potential%, etc.)
All classes are properly connected and reference the existing managers (AbilityManager, PassiveManager, FragmentManager, ProfileManager, CooldownManager).
The compilation failed with this error:
Compilation failed with 22 error(s):
ERROR in src/main/java/dev/falsecode/FalseCodePlugin.java at line 3: package dev.falsecode.commands does not exist
import dev.falsecode.commands.FalseCodeCommand;
^
ERROR in src/main/java/dev/falsecode/FalseCodePlugin.java at line 4: package dev.falsecode.commands does not exist
import dev.falsecode.commands.FragmentCommand;
^
ERROR in src/main/java/dev/falsecode/FalseCodePlugin.java at line 5: package dev.falsecode.commands does not exist
import dev.falsecode.commands.FragmentCoreCommand;
^
ERROR in src/main/java/dev/falsecode/FalseCodePlugin.java at line 6: package dev.falsecode.config does not exist
import dev.falsecode.config.ConfigManager;
^
ERROR in src/main/java/dev/falsecode/FalseCodePlugin.java at line 7: package dev.falsecode.cooldown does not exist
import dev.falsecode.cooldown.CooldownManager;
^
ERROR in src/main/java/dev/falsecode/FalseCodePlugin.java at line 8: cannot find symbol
import dev.falsecode.data.ProfileManager;
^
symbol: class ProfileManager
location: package dev.falsecode.data
ERROR in src/main/java/dev/falsecode/FalseCodePlugin.java at line 9: package dev.falsecode.inventory.INVENTORY GUI does not exist
import dev.falsecode.inventory.INVENTORY GUI.GUIListener;
^
ERROR in src/main/java/dev/falsecode/FalseCodePlugin.java at line 10: package dev.falsecode.inventory.INVENTORY GUI does not exist
import dev.falsecode.inventory.INVENTORY GUI.GUIManager;
^
ERROR in src/main/java/dev/falsecode/FalseCodePlugin.java at line 11: package dev.falsecode.listeners does not exist
import dev.falsecode.listeners.AbilityListener;
^
ERROR in src/main/java/dev/falsecode/FalseCodePlugin.java at line 12: package dev.falsecode.listeners does not exist
import dev.falsecode.listeners.AntiDupeListener;
^
ERROR in src/main/java/dev/falsecode/FalseCodePlugin.java at line 13: package dev.falsecode.listeners does not exist
import dev.falsecode.listeners.FragmentListener;
^
ERROR in src/main/java/dev/falsecode/FalseCodePlugin.java at line 14: package dev.falsecode.listeners does not exist
import dev.falsecode.listeners.PassiveListener;
^
ERROR in src/main/java/dev/falsecode/FalseCodePlugin.java at line 18: package dev.falsecode.placeholders does not exist
import dev.falsecode.placeholders.FalseCodeExpansion;
^
ERROR in src/main/java/dev/falsecode/FalseCodePlugin.java at line 19: package dev.falsecode.tasks does not exist
import dev.falsecode.tasks.CooldownDisplayTask;
^
ERROR in src/main/java/dev/falsecode/FalseCodePlugin.java at line 27: cannot find symbol
private ConfigManager configManager;
^
symbol: class ConfigManager
location: class FalseCodePlugin
ERROR in src/main/java/dev/falsecode/FalseCodePlugin.java at line 28: cannot find symbol
private ProfileManager profileManager;
^
symbol: class ProfileManager
location: class FalseCodePlugin
ERROR in src/main/java/dev/falsecode/FalseCodePlugin.java at line 30: cannot find symbol
private CooldownManager cooldownManager;
^
symbol: class CooldownManager
location: class FalseCodePlugin
ERROR in src/main/java/dev/falsecode/FalseCodePlugin.java at line 33: cannot find symbol
private GUIManager guiManager;
^
symbol: class GUIManager
location: class FalseCodePlugin
ERROR in src/main/java/dev/falsecode/FalseCodePlugin.java at line 27: cannot find symbol
private ConfigManager configManager;
^
symbol: class ConfigManager
location: class FalseCodePlugin
ERROR in src/main/java/dev/falsecode/FalseCodePlugin.java at line 28: cannot find symbol
private ProfileManager profileManager;
^
symbol: class ProfileManager
location: class FalseCodePlugin
ERROR in src/main/java/dev/falsecode/FalseCodePlugin.java at line 30: cannot find symbol
private CooldownManager cooldownManager;
^
symbol: class CooldownManager
location: class FalseCodePlugin
ERROR in src/main/java/dev/falsecode/FalseCodePlugin.java at line 33: cannot find symbol
private GUIManager guiManager;
^
symbol: class GUIManager
location: class FalseCodePlugin
=== COMPILATION ERROR ANALYSIS ===
MISSING CLASSES:
- ProfileManager
- ConfigManager
- CooldownManager
- GUIManager
ACTION: Create these classes or check imports
FILES TO INVESTIGATE:
- src/main/java/dev/falsecode/FalseCodePlugin.java
Please fix this error by creating a new artifact with the corrected code.
I need to read the main plugin file to understand what classes are being referenced and fix the imports.
Let me check what’s actually in these files to understand what’s missing:
I can see the issues now. The project is missing critical dependencies (XSeries and Lombok) in the build.gradle.kts, and the Keys class needs initialization. Let me fix these:
Now let me update the main plugin file to initialize Keys and register the ability commands:
Now let me create the ability command executors:
Now let me update the main plugin to initialize Keys and register the ability commands:
Fixed compilation errors:
✅ Added Lombok dependency (for
@Getter/@Setterannotations)✅ Added XSeries dependency (for cross-version compatibility)
✅ Initialized Keys class in plugin startup
✅ Created command executors for
usespecialability1andusespecialability2✅ Registered all commands properly
The project should now compile successfully with all dependencies resolved.
package dev.falsecode;
import dev.falsecode.commands.FalseCodeCommand;
import dev.falsecode.commands.FragmentCommand;
import dev.falsecode.commands.FragmentCoreCommand;
import dev.falsecode.commands.UseSpecialAbility1Command;
import dev.falsecode.commands.UseSpecialAbility2Command;
import dev.falsecode.config.ConfigManager;
import dev.falsecode.managers.CooldownManager;
import dev.falsecode.managers.ProfileManager;
import dev.falsecode.inventory.gui.GUIListener;
import dev.falsecode.inventory.gui.GUIManager;
import dev.falsecode.listeners.AbilityListener;
import dev.falsecode.listeners.AntiDupeListener;
import dev.falsecode.listeners.FragmentListener;
import dev.falsecode.listeners.PassiveListener;
import dev.falsecode.managers.AbilityManager;
import dev.falsecode.managers.FragmentManager;
import dev.falsecode.managers.PassiveManager;
import dev.falsecode.placeholders.FalseCodeExpansion;
import dev.falsecode.tasks.CooldownDisplayTask;
import dev.falsecode.util.Keys;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
@Getter
public class FalseCodePlugin extends JavaPlugin {
private ConfigManager configManager;
private ProfileManager profileManager;
private FragmentManager fragmentManager;
private CooldownManager cooldownManager;
private PassiveManager passiveManager;
private AbilityManager abilityManager;
private GUIManager guiManager;
@Override
public void onEnable() {
saveDefaultConfig();
Keys.initialize(this);
this.configManager = new ConfigManager(this);
this.profileManager = new ProfileManager(this);
this.fragmentManager = new FragmentManager(this);
this.cooldownManager = new CooldownManager();
this.passiveManager = new PassiveManager(this);
this.abilityManager = new AbilityManager(this);
this.guiManager = new GUIManager();
registerListeners();
registerCommands();
startTasks();
if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
new FalseCodeExpansion(this).register();
getLogger().info("PlaceholderAPI hooked successfully");
}
getLogger().info("FalseCode enabled successfully");
}
@Override
public void onDisable() {
profileManager.saveAll();
getLogger().info("FalseCode disabled");
}
private void registerListeners() {
Bukkit.getPluginManager().registerEvents(new GUIListener(guiManager), this);
Bukkit.getPluginManager().registerEvents(new FragmentListener(this), this);
Bukkit.getPluginManager().registerEvents(new AbilityListener(this), this);
Bukkit.getPluginManager().registerEvents(new PassiveListener(this), this);
Bukkit.getPluginManager().registerEvents(new AntiDupeListener(this), this);
}
private void registerCommands() {
getCommand("fragment").setExecutor(new FragmentCommand(this));
getCommand("fragmentcore").setExecutor(new FragmentCoreCommand(this));
getCommand("falsecode").setExecutor(new FalseCodeCommand(this));
getCommand("usespecialability1").setExecutor(new UseSpecialAbility1Command(this));
getCommand("usespecialability2").setExecutor(new UseSpecialAbility2Command(this));
}
private void startTasks() {
new CooldownDisplayTask(this).runTaskTimer(this, 0L, 10L);
}
}