📄
pasted-code-1790874133249.txt
txt
309 lines
▶
I am creating a Minecraft Java SMP plugin called "PowerSMP".
TARGET:
- Minecraft Java Edition 1.21.11
- Server: Paper
- Java 21
- Players must NOT need Fabric, Forge, or any client-side mod.
- The plugin must work using vanilla Minecraft controls/interactions.
- A server resource pack will eventually be added, but DO NOT depend on the resource pack yet.
- For development, use vanilla items as placeholders for custom items.
IMPORTANT:
I cannot code Java myself. Whenever you make a change, provide complete files or a complete buildable project rather than telling me to manually edit a few lines.
CORE CONCEPT:
The server has special powers represented by Power Crystals.
There will eventually be 24 normal powers:
- 12 PvP powers
- 12 grinding/utility powers
There will also be 10 special unique powers/resources that are controlled by a first-craft system.
DO NOT IMPLEMENT ALL 24 POWERS YET.
For this first version, ONLY build the core Power Crystal system and /powers GUI.
==================================================
POWER CRYSTALS
==================================================
A Power Crystal represents ownership of a power.
Example:
- Glow Crystal
- Kinetic Crystal
- Rift Bow Crystal
- Fortune Fisher Crystal
The actual power item and the Power Crystal are separate concepts.
The Crystal determines which power the player owns.
The physical power item is how the player activates/uses the power.
For example:
- Glow Crystal = gives access to Glow Horn
- Kinetic Crystal = gives access to Kinetic Orb
- Rift Bow Crystal = gives access to Rift Bow
For Version 0.1, use a clearly identifiable vanilla placeholder item for Power Crystals, such as an Amethyst Shard with custom name/lore/PDC.
DO NOT create the final resource-pack models yet.
==================================================
FOUR CORE SLOTS
==================================================
Every player has exactly 4 Power Core slots.
These are the only slots where an installed Power Crystal is considered equipped.
Create a /powers command.
When a player uses:
/powers
open a custom inventory GUI.
The GUI should clearly show:
POWER CORES
[ CORE 1 ] [ CORE 2 ]
[ CORE 3 ] [ CORE 4 ]
Use a clean Minecraft-style GUI.
The player must be able to:
- Put a Power Crystal into an empty Core Slot.
- Remove a Power Crystal from a Core Slot.
- Move a Power Crystal between their Core Slots.
- Switch which powers they have equipped.
The Core GUI must NOT allow normal random items to be placed into Core Slots.
Only valid Power Crystals can be installed.
==================================================
CRYSTAL REMOVAL
==================================================
Players MUST be able to remove an installed Crystal.
Removing it returns the Crystal to their normal inventory.
This is necessary because players can switch their four equipped powers.
Example:
Player currently has:
Slot 1: Glow Crystal
Slot 2: Kinetic Crystal
Slot 3: Rift Crystal
Slot 4: Fortune Fisher Crystal
They can remove Fortune Fisher and replace it with another Crystal.
==================================================
CRYSTAL STORAGE RULE
==================================================
A Power Crystal cannot be permanently stored in a container.
Eventually the plugin must prevent Power Crystals from being stored in:
- Chests
- Barrels
- Shulker Boxes
- Ender Chests
- Hoppers
- Furnaces
- Other storage/container inventories
However, players MUST temporarily be able to hold a Crystal in their normal player inventory while switching Core Slots.
Do NOT implement the full anti-storage/death system in Version 0.1 yet unless necessary for the GUI.
==================================================
DEATH SYSTEM
==================================================
Eventually, when a player dies:
- Every Power Crystal currently equipped in their 4 Core Slots must drop.
- Crystals in their normal inventory must also be lootable normally.
- Another player can pick up the Crystal and install it into their own Core Slots.
DO NOT fully implement the death system yet.
==================================================
ONE-OF-EACH-POWER SYSTEM
==================================================
Eventually every individual power can only be crafted ONCE on the entire server.
Example:
The first Glow Crystal is crafted.
After that:
- No second Glow Crystal can ever be crafted.
- The original Glow Crystal can change owners through PvP/trading.
- If the owner dies, the same Crystal can be picked up.
- The Crystal does not respawn.
- The Crystal is never duplicated.
DO NOT implement the global one-time crafting system yet.
==================================================
DATA/PERSISTENCE
==================================================
The player's equipped Core Slots must eventually persist through:
- Logout
- Server restart
- Server crash
Do not use temporary in-memory storage for the final system.
For Version 0.1, implement proper persistent storage if practical.
The system must identify each Crystal by a unique Power ID using PersistentDataContainer/PDC.
Example IDs:
powersmp:glow
powersmp:kinetic_orb
powersmp:rift_bow
powersmp:fortune_fisher
Do NOT identify powers only by display name.
==================================================
COMMAND
==================================================
Create:
/powers
Permission:
powersmp.powers
Default permission should be true for normal players.
The command should open the player's Power Core GUI.
==================================================
PLACEHOLDER TESTING
==================================================
For development/testing, create a temporary way for an OP/admin to obtain test Power Crystals.
For example:
/powers give
But make it clearly marked as a DEVELOPMENT/TEST command.
It should support at least:
/powers give test
The resulting item should be:
Test Power Crystal
and should be recognized as a valid Power Crystal.
This command is temporary and will eventually be replaced by the real crafting system.
==================================================
GUI SAFETY
==================================================
The GUI must prevent:
- Duplication
- Losing items
- Taking decorative GUI items
- Putting random items into Core Slots
- Taking items from non-core GUI slots
- Shift-click exploits
- Dragging items into invalid GUI slots
Normal inventory behavior outside the GUI should continue to work.
==================================================
CODE QUALITY
==================================================
Use clean modular Java code.
Do NOT put the entire plugin into one enormous class.
Create appropriate managers/classes such as:
PowerManager
CoreManager
PowerCrystal
PowerGUI
PowerCommand
You may choose better class names if appropriate.
Use Paper API events and PersistentDataContainer where appropriate.
Do not use NMS unless absolutely necessary.
Do not require any client-side mod.
==================================================
VERSION
==================================================
Call this:
PowerSMP 0.1
Version 0.1 ONLY needs:
1. Plugin loads successfully.
2. /powers works.
3. Four Core Slots exist.
4. Test Power Crystal can be obtained.
5. Test Crystal can be installed.
6. Test Crystal can be removed.
7. Test Crystal can be switched.
8. Invalid items cannot be installed.
9. GUI cannot be exploited for duplication.
10. Core data persists correctly if implemented.
11. Plugin works on Paper 1.21.11 with Java 21.
DO NOT implement the actual 24 powers yet.
After this version works, we will add the actual powers one at a time.
Then the build order
After it successfully makes Part 1, send it these in order:
Part 2 — Crystal rules
Death drops
Anti-storage
Logout handling
Duplication protection
One-time global ownership
Part 3 — Activation framework
Make the plugin support powers through normal vanilla interactions, not keybinds:
Right-click
Left-click
Sneak + right-click
Throwing
Shooting
Placing
Blocking
Fishing
etc.
Set up the Java 21 / Paper project and plugin metadata.
Add PDC-identified test crystals and synchronous YAML persistence for four core slots.
Implement
/powers, the protected core GUI, and the admin-only test crystal command.
Created the PowerSMP 0.1 project with Java 21 and Paper 1.21.11 configuration.
/powersopens a protected four-slot Core GUI.Install a crystal by placing it in an empty slot, or shift-click it in your inventory. Click an installed crystal to return it to your inventory.
Test crystals use a PDC power ID; equipped cores persist in
plugins/PowerSMP/cores.yml./powers give <player> testgrants the development crystal to an admin.Decorative slots and invalid items are blocked; drag, shift-click, and other GUI interactions are handled to prevent item exploits.
The 24 powers and future death, storage, and one-time crafting systems are not included. I haven’t run a server build or runtime test.
📄
pasted-code-1790875276972.txt
txt
801 lines
▶
# PART 5 — IMPLEMENT THE ACTUAL POWERS
Now implement the actual power mechanics.
**IMPORTANT: Do NOT redesign, rename, replace, merge, or remove any existing powers, crystals, slots, recipes, or activation framework from Parts 1–4. Preserve everything that already works.**
Before implementing mechanics, fix and verify the item architecture.
---
## 1. CRITICAL ITEM/CRYSTAL RULE
There are TWO different things:
### A. Power Crystal
The Crystal is the player's ownership/access item.
Example:
* `rift_bow_crystal`
* `kinetic_orb_crystal`
* `glow_horn_crystal`
The Crystal is NOT the physical weapon/tool.
### B. Physical Power Item
This is the actual item used to activate the power.
Examples:
* Rift Bow → Bow
* Kinetic Orb → Ender Pearl/orb
* Glow Horn → Goat Horn
* Growth Totem → Totem item
The physical item grants access to the corresponding power only when the player owns/equips the appropriate Crystal.
**DO NOT turn physical power items into Power Crystals.**
---
## 2. IMPORTANT BUG TO FIX — RIFT BOW CRYSTAL
The current plugin incorrectly gave me a **Rift Bow as a Crystal**.
This is WRONG.
The Rift Bow Crystal and Rift Bow physical item must be separate.
Correct structure:
### Rift Bow Crystal
* Unique Power Crystal
* ID: `rift_bow_crystal`
* Represents ownership of the Rift Bow power
* Goes into the `/powers` system
* Is globally unique
* Can drop on death
* Cannot be duplicated
### Rift Bow
* Physical Bow item
* ID: `rift_bow_item`
* Used to shoot Rift Arrows
* Must NOT be treated as a Crystal
* Must NOT count as one of the 4 Crystal slots
* Must NOT be craftable as another Crystal
Fix any existing code that currently confuses these two.
Do the same separation for EVERY other power.
The naming, PDC IDs, registry entries, and item checks must clearly distinguish:
`_crystal`
from
`_item`
---
# 3. ABSOLUTELY NO DUPLICATE POWER CRYSTALS
Every power has exactly ONE Crystal globally.
For example:
There can only ever be:
* 1 Rift Bow Crystal
* 1 Kinetic Orb Crystal
* 1 Glow Horn Crystal
* 1 Growth Totem Crystal
* etc.
The plugin must maintain a persistent global ownership/creation state.
If the Rift Bow Crystal has already been crafted:
* The recipe must stop producing another one.
* Reloading the server must not reset the state.
* Restarting the server must not reset the state.
* Rejoining must not reset the state.
* A player cannot use commands to create a legitimate second Crystal.
* Admin/test commands should be clearly separated from normal gameplay and must not alter the global "crafted once" state unless explicitly intended.
If the Crystal owner dies:
* The SAME physical Crystal drops.
* Another player can pick it up.
* The original owner no longer owns it.
* No replacement Crystal is created.
---
# 4. ALL CUSTOM POWER ITEMS MUST BE UNBREAKABLE
Every physical Power Item and every Power Crystal must be completely unbreakable.
This includes:
* Power Crystals
* Rift Bow
* Hunter's Crossbow
* Polarity Staff
* Tether Bow
* Impact Shield
* Momentum Blade
* Orbit Orb
* Kinetic Orb
* Anchor
* Death Mark item
* Counter Mirror
* Chainshot Bow
* Prospector Core
* Harvester Charm
* Collector Core
* Growth Totem
* Beast Call
* Fortune Fisher
* Explorer's Compass
* Ore Scanner
* Recycler's Core
* Glider Charm
* Climber's Hook
* Smelter Core
* Glow Horn
* all future custom power items
* all unique-resource power items
Use the proper Paper/Minecraft item durability/unbreakable system.
Do NOT rely only on lore saying "Unbreakable."
The item must actually never lose durability.
---
# 5. CUSTOM ITEMS MUST NOT BREAK OR DISAPPEAR FROM NORMAL USE
Power items must survive their normal activation.
Examples:
* Rift Bow never loses durability.
* Hunter's Crossbow never loses durability.
* Impact Shield never loses durability.
* Glow Horn never loses durability.
* Climber's Hook never loses durability.
* Ore Scanner never loses durability.
* Growth Totem never loses durability.
* etc.
If an item normally has durability, cancel/prevent durability damage for the custom item.
Do NOT cancel normal durability for unrelated vanilla items.
Only items identified by the plugin's PDC/custom ID should receive this protection.
---
# 6. DO NOT IDENTIFY CUSTOM ITEMS BY DISPLAY NAME
Never detect a power item using:
* display name
* lore
* material alone
Use the persistent custom ID/PDC system created in the previous parts.
For example:
`power_item_id = rift_bow_item`
and
`power_crystal_id = rift_bow_crystal`
Display names and lore are cosmetic only.
This is extremely important because the resource pack will change names/models later.
---
# 7. IMPLEMENT THESE FOUR POWERS FIRST
Do NOT implement all 35 powers at once.
Implement and fully test:
1. Growth Totem
2. Kinetic Orb
3. Glow Horn
4. Rift Bow
Do not modify the mechanics of the other powers yet.
---
# 8. GROWTH TOTEM
Power ID:
`growth_totem`
Crystal ID:
`growth_totem_crystal`
Physical item ID:
`growth_totem_item`
## Activation
The player uses the Growth Totem on a block.
The Totem becomes a placed Growth Totem at that location.
It should visually/physically behave as a placed object using the best available vanilla/Paper-compatible method.
The placed Totem accelerates NATURAL growth of crops and saplings within its configured radius.
It must NOT instantly grow everything.
It should simply make natural growth happen faster.
## Important
It must NOT:
* duplicate crops
* create items from nothing
* instantly mature every crop
* break blocks
* destroy crops
* affect unrelated blocks
## Pickup
The owner can:
**Shift + Right Click**
the placed Growth Totem to pick it back up.
Only the player who originally placed that specific Totem can pick it up.
Other players cannot steal it.
If the owner dies, the placed Totem should remain in place unless explicitly configured otherwise.
## Upgrade
Upgrade increases the Growth Totem's radius.
Do not massively increase growth speed.
---
# 9. KINETIC ORB
Power ID:
`kinetic_orb`
Crystal ID:
`kinetic_orb_crystal`
Physical item ID:
`kinetic_orb_item`
## Activation
Right-click to throw the Kinetic Orb like an Ender Pearl.
It should behave as a projectile.
When it hits a player:
1. Record that player's movement for a short configurable period.
2. Record their movement/velocity/position changes.
3. After the recording period ends, force/replay the recorded movement on that player.
The goal is to temporarily control/replay the target's recent movement.
Example:
Target runs forward → turns left → jumps.
The Kinetic Orb records this movement.
Then the effect forces the target to repeat/retrace that movement pattern.
## Important
It must:
* work on players
* have a configurable duration
* have a cooldown
* be server-authoritative
* prevent infinite stacking
* prevent multiple Kinetic Orbs from creating an unlimited movement loop
Do NOT permanently control players.
Do NOT freeze players indefinitely.
## Upgrade
Upgrade increases the recording duration slightly.
Do not massively increase the effect.
---
# 10. GLOW HORN
Power ID:
`glow_horn`
Crystal ID:
`glow_horn_crystal`
Physical item ID:
`glow_horn_item`
Material:
Goat Horn
Special Type:
`Glow`
This is NOT Dream Horn.
This is NOT another vanilla horn variant.
It is specifically:
**Special Type: Glow**
## Activation
Blow the Glow Horn normally.
When activated:
* Search for players within a 300-block radius.
* Every player within the radius receives Glowing.
* Duration: 1 minute.
* The effect works through walls and underground.
* Only players are affected.
* The user is also affected if they are inside the radius, which they normally will be.
The radius is based on actual distance from the player who blew the horn.
Do NOT require line of sight.
Do NOT require the target to be visible.
## Cooldown
Exactly:
**8 minutes**
The cooldown must be server-side.
A player cannot bypass it by:
* dropping the horn
* switching hotbar slots
* relogging
* dying
* moving the horn to another inventory slot
The cooldown belongs to the player/power activation, not the item stack.
## Upgrade
Upgrade:
**Radiant Glow**
Changes:
* Range: 400 blocks
* Duration: still 1 minute
* Cooldown: still 8 minutes
Do not increase the cooldown reduction unless explicitly configured later.
---
# 11. RIFT BOW
Power ID:
`rift_bow`
Crystal ID:
`rift_bow_crystal`
Physical item ID:
`rift_bow_item`
## Activation
Use the Rift Bow to shoot.
The Rift Bow creates a special Rift Arrow.
The arrow:
* behaves like a projectile
* can damage players
* travels normally
* remains trackable by the plugin
Exactly **5 seconds after the arrow is fired**, teleport the shooter to the arrow's CURRENT location.
This means the teleport target is where the arrow is at the 5-second mark.
It does NOT teleport to where the arrow was originally fired.
## Safety
Before teleporting:
Check that the destination is safe.
Do NOT teleport the player into:
* solid blocks
* lava
* dangerous suffocation positions
* unloaded/invalid locations
If the exact arrow position is unsafe, find the nearest safe location around the arrow.
If no safe location can be found, cancel the teleport rather than killing or trapping the player.
## Arrow damage
The Rift Arrow can damage players normally.
Do not make it massively stronger than a normal arrow.
## Important edge cases
Handle:
* arrow hitting a player
* arrow hitting a block
* arrow falling
* arrow being removed
* shooter disconnecting
* shooter dying
* world changes
* unloaded chunks
The plugin must not teleport an unrelated player.
The teleport must always reference the original shooter.
## Rift Accelerator Upgrade
Upgrade:
**Rift Accelerator**
The Rift Arrow travels significantly faster.
It must STILL:
* damage players
* remain trackable
* teleport the original shooter after the configured 5 seconds
Do not turn the upgrade into a different power.
---
# 12. POWER OWNERSHIP CHECK
Every power activation must verify that the player actually has the corresponding Power Crystal equipped/authorized.
Examples:
Player has Rift Bow physical item but does NOT have Rift Bow Crystal:
→ Rift Bow ability does not activate.
Player has Rift Bow Crystal and Rift Bow physical item:
→ Rift Bow works.
Player has Kinetic Orb item but no Kinetic Orb Crystal:
→ It behaves only as configured for unauthorized use / does not activate the custom power.
Do NOT allow players to use another player's power simply by picking up their physical item.
The Crystal is the authorization.
---
# 13. ITEM SECURITY
Custom Power Items must be resistant to common item manipulation problems.
Do not allow normal vanilla mechanics to accidentally convert, consume, or destroy a Power Item.
For example, carefully handle:
* crafting
* anvils
* smithing
* enchanting
* brewing
* grindstones
* dispensers
* hoppers
* droppers
* furnaces
* explosions
* fire
* lava
* cactus
* item entity despawning
* death drops
* container movement
Do NOT break normal vanilla gameplay globally.
Only protect items identified as custom Power Items/Crystals.
---
# 14. DEATH/DROP BEHAVIOR
Power Crystals are physical items and must drop on death according to the system from previous parts.
The same Crystal must drop.
Do NOT create a replacement.
Physical Power Items should follow their configured normal behavior, except that they must remain unbreakable.
Do not accidentally delete Power Crystals when the player dies.
Do not duplicate them through death/respawn handling.
---
# 15. COOLDOWN SYSTEM
All active abilities must use the existing centralized cooldown system.
Do NOT create separate random cooldown implementations for each power.
Cooldowns must be:
* server authoritative
* persistent through item movement
* not bypassable by swapping items
* not bypassable by reconnecting
* not bypassable by death unless explicitly configured
Cooldown messages should identify the actual power.
---
# 16. NO POWER CROSS-CONTAMINATION
This is extremely important.
Do NOT accidentally make:
* Rift Bow trigger Kinetic Orb
* Kinetic Orb trigger Glow Horn
* Glow Horn count as a Rift Bow
* Growth Totem count as another power
* one Crystal authorize another power
* one physical item activate another power
Every power must have its own unique ID.
Use exact matching.
Example:
`rift_bow_crystal` → authorizes `rift_bow`
`kinetic_orb_crystal` → authorizes `kinetic_orb`
`glow_horn_crystal` → authorizes `glow_horn`
`growth_totem_crystal` → authorizes `growth_totem`
Nothing else.
---
# 17. DO NOT MODIFY THE OTHER POWERS YET
The following powers should remain registered but NOT have their mechanics implemented in this Part unless required by existing framework code:
* Hunter's Crossbow
* Polarity Staff
* Tether Bow
* Impact Shield
* Momentum Blade
* Orbit Orb
* Anchor
* Death Mark
* Counter Mirror
* Chainshot
* Prospector Core
* Harvester Charm
* Collector Core
* Beast Call
* Fortune Fisher
* Explorer's Compass
* Ore Scanner
* Recycler's Core
* Glider Charm
* Climber's Hook
* Smelter Core
* Royal Apiary
* Monster Hunter
* Verdant Gardener
* Ancient Lumberjack
* Treasure Seeker
* Alchemist
* Abyss Diver
* Deep Miner
* Relic Smith
Do not replace them with placeholder mechanics.
---
# 18. TEST COMMANDS
Provide separate test commands for:
### Crystals
`/powers test crystal rift_bow`
`/powers test crystal kinetic_orb`
`/powers test crystal glow_horn`
`/powers test crystal growth_totem`
### Physical items
`/powers test item rift_bow`
`/powers test item kinetic_orb`
`/powers test item glow_horn`
`/powers test item growth_totem`
These test commands must create the correct item type.
For example:
`/powers test crystal rift_bow`
MUST give a **Rift Bow Crystal**, NOT a Bow.
`/powers test item rift_bow`
MUST give the **Rift Bow physical Bow**, NOT a Crystal.
The same rule applies to all four.
---
# 19. TEST CHECKLIST
After implementation, verify all of these:
### Rift Bow
* [ ] Crystal is actually a Crystal
* [ ] Physical Rift Bow is actually a Bow
* [ ] Crystal and Bow have different PDC IDs
* [ ] Bow only works with Rift Bow Crystal
* [ ] Arrow damages players
* [ ] Teleports shooter after 5 seconds
* [ ] Teleports to arrow's current position
* [ ] Safe teleport checking works
* [ ] Upgrade increases arrow speed
* [ ] Bow never loses durability
### Kinetic Orb
* [ ] Crystal and physical orb are separate
* [ ] Right-click throws orb
* [ ] Orb can hit players
* [ ] Movement is recorded
* [ ] Movement is replayed/forced
* [ ] Effect cannot stack infinitely
* [ ] Cooldown works
* [ ] Orb never loses durability / cannot be accidentally consumed incorrectly
### Glow Horn
* [ ] Crystal and Goat Horn are separate
* [ ] Special Type = Glow
* [ ] Blowing horn affects players within 300 blocks
* [ ] Works through walls
* [ ] Works underground
* [ ] 1 minute Glowing
* [ ] 8 minute cooldown
* [ ] Upgrade = 400 block range
* [ ] Upgrade does NOT change cooldown
* [ ] Horn never loses durability
### Growth Totem
* [ ] Crystal and physical Totem are separate
* [ ] Totem can be placed
* [ ] Crops/saplings grow faster naturally
* [ ] No instant growth
* [ ] No item duplication
* [ ] Shift + right-click picks it up
* [ ] Only original owner can pick it up
* [ ] Upgrade increases radius
* [ ] Totem item never loses durability
---
# 20. FINAL SAFETY RULE
Before finishing Part 5, inspect the existing Part 1–4 code and make sure this implementation does NOT break:
* `/powers`
* the 4 Crystal slots
* Crystal ownership
* one-Crystal-per-power rule
* recipes
* PDC IDs
* upgrades
* activation framework
* cooldown manager
* existing commands
If there is a conflict, preserve the existing architecture and make the smallest change necessary.
**Do not rewrite the plugin from scratch.**
**Do not create duplicate systems.**
**Do not rename existing IDs without a migration plan.**
**Do not change existing powers' designs.**
The goal of Part 5 is to make the first four powers actually work while making the item/Crystal separation and unbreakable-item system completely reliable.
Inspect the existing item, core, command, and activation systems.
Preserve their IDs and architecture while adding the four specified powers.
Check the build configuration and resolve any integration gaps.
Implemented the first four powers and kept Crystals separate from their physical items, using distinct PDC IDs. The existing test Crystal ID and four-slot core system remain intact.
Added authorized activation for Growth Totem, Kinetic Orb, Glow Horn, and Rift Bow. Glow Horn applies Glowing within 300 blocks for one minute, with an eight-minute player cooldown; upgrades are supported for all four mechanics.
Added persistent cooldowns, upgrade data, and a persistent one-time Crystal claim registry. Development test commands create explicitly marked test items and do not claim a unique Crystal.
Equipped Crystals drop on death; placed Growth Totems remain and can only be picked up by their original placer.
Custom items are unbreakable and protected against common container transfers, despawning, fire, lava, cactus, and explosions.
Added
/powers test crystal <power>,/powers test item <power>, and/powers test upgrade <player> <upgrade>.
The project I inspected contained the initial core/GUI foundation, but no Parts 2–4 activation, cooldown, upgrade, or recipe systems. No crafting recipes were present, so the unique-Crystal registry is ready for a future crafting integration; no recipes were invented here. I haven’t run a server build or gameplay test.
package com.kodari.powersmp;
import org.bukkit.Bukkit;
import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.java.JavaPlugin;
public final class PowerSMP extends JavaPlugin {
private CoreManager coreManager;
private UniqueCrystalRegistry uniqueCrystalRegistry;
private AbilityCooldownManager cooldownManager;
private PowerUpgradeManager upgradeManager;
@Override
public void onEnable() {
saveDefaultConfig();
PowerCrystal powerCrystal = new PowerCrystal(this);
uniqueCrystalRegistry = new UniqueCrystalRegistry(this);
PowerManager powerManager = new PowerManager(powerCrystal, uniqueCrystalRegistry);
coreManager = new CoreManager(this, powerManager);
PowerGUI powerGUI = new PowerGUI(coreManager, powerManager);
PowerItemManager powerItemManager = new PowerItemManager(this);
cooldownManager = new AbilityCooldownManager(this);
upgradeManager = new PowerUpgradeManager(this);
Bukkit.getPluginManager().registerEvents(powerGUI, this);
Bukkit.getPluginManager().registerEvents(
new PowerAbilityListener(this, coreManager, powerItemManager, cooldownManager, upgradeManager), this
);
Bukkit.getPluginManager().registerEvents(new CustomItemProtectionListener(powerItemManager, powerCrystal), this);
PluginCommand powersCommand = getCommand("powers");
if (powersCommand == null) {
getLogger().severe("The /powers command is missing from plugin.yml.");
Bukkit.getPluginManager().disablePlugin(this);
return;
}
PowerCommand commandHandler = new PowerCommand(powerGUI, powerManager, powerItemManager, upgradeManager);
powersCommand.setExecutor(commandHandler);
powersCommand.setTabCompleter(commandHandler);
}
@Override
public void onDisable() {
if (coreManager != null) {
coreManager.save();
}
if (uniqueCrystalRegistry != null) {
uniqueCrystalRegistry.save();
}
if (cooldownManager != null) {
cooldownManager.save();
}
if (upgradeManager != null) {
upgradeManager.save();
}
}
}