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.
28 lines
683 B
Kotlin
28 lines
683 B
Kotlin
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
|
|
}
|
|
} |