Add perk system with GUI and integrations
Introduce a complete passive perk system: Perk base class, PerkManager (registration, selection, lifecycle, persistence), and PlayerPerksRepository (DB schema + upsert/find). Add four example perks (Oracle, Vampire, Featherweight, Bloodlust) and a single PerkEventDispatcher to route combat/environment/kill events to active perks. Provide PerkSelectorMenu GUI and /perks command, integrate perk initialization, registration, application and cleanup into SpeedHG and GameManager, and hook load/evict into StatsListener. Also add language entries and register the command in plugin.yml. This change enables players to select up to two passive perks, persists selections, and dispatches relevant events to perk implementations.
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
package club.mcscrims.speedhg.command
|
||||
|
||||
import club.mcscrims.speedhg.SpeedHG
|
||||
import club.mcscrims.speedhg.gui.menu.PerkSelectorMenu
|
||||
import org.bukkit.command.Command
|
||||
import org.bukkit.command.CommandExecutor
|
||||
import org.bukkit.command.CommandSender
|
||||
import org.bukkit.entity.Player
|
||||
|
||||
class PerksCommand : CommandExecutor {
|
||||
|
||||
private val plugin get() = SpeedHG.instance
|
||||
|
||||
override fun onCommand(
|
||||
sender: CommandSender,
|
||||
command: Command,
|
||||
label: String,
|
||||
args: Array<out String>
|
||||
): Boolean {
|
||||
val player = sender as? Player ?: run {
|
||||
sender.sendMessage("§cNur Spieler können diesen Befehl nutzen.")
|
||||
return true
|
||||
}
|
||||
|
||||
PerkSelectorMenu(player).open(player)
|
||||
return true
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user