Add IceMage kit and playstyle support

Introduce a new IceMage kit and wire playstyle support across the plugin. Changes include:

- Add IceMageKit with aggressive/defensive active & passive abilities, item distribution, and lifecycle hooks; caches ability instances and given items to reduce allocations.
- Register IceMageKit in SpeedHG on plugin startup.
- Update KitCommand to require a playstyle argument, validate it, select the kit's playstyle, and provide tab-completion for playstyles.
- Extend KitEventDispatcher with IceMage-specific handlers: spawn a circular volley of snowballs on ability use (cancelling the original projectile), mark spawned snowballs with persistent data, and apply freeze/slow effects on hit.
- Adjust GoblinKit to use a plugin getter and make inner ability classes static to avoid capturing the outer instance.
- Update language lines and plugin.yml usage to reflect the new /kit <kitName> <playstyle> usage.

These changes implement the IceMage feature and ensure proper playstyle selection and event handling while keeping allocations low and behavior consistent.
This commit is contained in:
TDSTOS
2026-03-25 05:02:59 +01:00
parent 19bd708b59
commit ea86272c01
7 changed files with 294 additions and 8 deletions

View File

@@ -1,6 +1,7 @@
package club.mcscrims.speedhg.command
import club.mcscrims.speedhg.SpeedHG
import club.mcscrims.speedhg.kit.Playstyle
import club.mcscrims.speedhg.util.legacySerializer
import club.mcscrims.speedhg.util.sendMsg
import org.bukkit.command.Command
@@ -28,7 +29,7 @@ class KitCommand : CommandExecutor, TabCompleter {
return true
}
if ( args.isNullOrEmpty() )
if ( args.isNullOrEmpty() || args.size < 2 )
{
player.sendMsg( "commands.kit.usage" )
return true
@@ -43,8 +44,18 @@ class KitCommand : CommandExecutor, TabCompleter {
return true
}
val playstyle = Playstyle.entries.firstOrNull { it.name.equals( args[1], true ) }
if ( playstyle == null )
{
player.sendMsg( "commands.kit.playstyleNotFound", "playstyle" to args[1] )
return true
}
plugin.kitManager.selectKit( player, kit )
player.sendMsg( "commands.kit.selected", "kit" to legacySerializer.serialize( kit.displayName ))
plugin.kitManager.selectPlaystyle( player, playstyle )
player.sendMsg( "commands.kit.selected", "playstyle" to playstyle.displayName, "kit" to legacySerializer.serialize( kit.displayName ))
return true
}
@@ -61,6 +72,9 @@ class KitCommand : CommandExecutor, TabCompleter {
if ( args.size == 1 )
return plugin.kitManager.getRegisteredKits().map { it.id }
if ( args.size == 2 )
return Playstyle.entries.map { it.name.lowercase() }
return listOf()
}