Commit Graph
4261 Commits
Author SHA1 Message Date
bigguy345 7f4bc87d7a Extract overload selection to OverloadSelector helper with scoring algorithm
Problem:
- schedule("TpGainAction", function(act){...}) resolved to wrong overload
- TypeInfo.getBestMethodOverload rejected candidates when argType == null
- Fell back to arbitrary overloads.get(0) based on reflection order
- Result: selected 1-arg varargs overload instead of 2-arg fixed-arity

Solution:
- Created OverloadSelector helper class implementing scoring algorithm
- Scoring tiers (lower is better):
  * Arity mismatch: +10000 + distance penalty (hard disqualifier)
  * Varargs: +1000 penalty (fixed-arity strongly preferred)
  * Unknown arg type (null): +10 (penalty but doesn't disqualify)
  * Compatible type: +5 (modest preference for matching)
  * Exact match: +0 (best case)
- Closest arity fallback when no arity-applicable overload exists
- TypeInfo.getBestMethodOverload now delegates (4 lines vs 220)

Impact:
- Deterministic overload selection (no reflection-order dependence)
- schedule("TpGainAction", function(act){...}) now resolves correctly
- Unknown arg types no longer cause fallback to unrelated overloads
- Fixed-arity methods preferred over varargs when both viable
- Removed 220 lines of complex nested logic from TypeInfo

Testing:
- OverloadResolutionTest with 6 test cases (all passing)
- Verifies fixed-arity preference, unknown arg handling, arity fallback
2026-02-03 22:13:15 +02:00
bigguy345 6fc0bf4d6b Fix expression typing gate to route JS function/lambda expressions into ExpressionParser
Problem:
- function(act){...} expressions not reaching ExpressionParser
- resolveExpressionType only checked containsOperators() or startsWith("(")
- Function expressions went through simple resolver and returned null type

Solution:
- Added looksLikeFunctionOrLambda helper (lines 4766-4773) to detect:
  * JS functions: function(...)
  * Arrow functions: =>
  * Java lambdas: ->
- Updated gate condition at line 4144 to route these into ExpressionParser
- Function expressions now reach ExpressionTypeResolver.resolveJSFunctionType

Impact:
- SAM typing now works in pass-2 when expected type is known
- Fixes schedule("TpGainAction", function(act){...}) argument typing
- Enables proper overload resolution for function/lambda parameters
2026-02-03 22:12:43 +02:00
Kam a49df51ad9 Fixes to Ability Load, Reference Handling 2026-02-03 15:09:20 -05:00
Vidal 87d511dae1 Merge remote-tracking branch 'origin/dev' into dev 2026-02-03 16:09:12 -03:00
Kam ead3c5944c Fix Anchor Point Helper issue on NPCs 2026-02-03 14:06:30 -05:00
Vidal 75de803700 Added interfaces to energy data, refactored names 2026-02-03 15:45:45 -03:00
Vidal 87d511c38e Fixed some GUI stuff and added animation to AbilityOrbDual 2026-02-03 15:27:28 -03:00
bigguy345 ba7e4cc3b2 Merge remote-tracking branch 'origin/dev' into syntax-highlighter-unified
# Conflicts:
#	src/api
#	src/main/java/kamkeel/npcs/util/BukkitUtil.java
#	src/main/java/kamkeel/npcs/util/VaultUtil.java
#	src/main/java/noppes/npcs/CustomNpcsPermissions.java
2026-02-03 18:26:30 +02:00
Vidal 2d47aa00d8 - Added standalone min max methods to FieldDef
- Increased lightning density and radius minmax on all energy abilities
- Made AbilityOrbBarrage interruptible during active state
- Renamed AbilityEnergyBeam to AbilityBeam
- Updated imports
2026-02-03 12:32:30 -03:00
Vidal 1a8b8fb5f3 Made staves shoot EntityAbilityOrb 2026-02-03 11:58:39 -03:00
Vidal eb2d904bac Color-only overload to EnergyColorData 2026-02-03 11:57:47 -03:00
Vidal 4889c8b881 Added animation to shockwave 2026-02-03 11:57:19 -03:00
Vidal c5822023a0 Added modifyVisibility to FieldDef
AbilityGuard tweaks
2026-02-03 07:45:02 -03:00
Kam fd85215592 Fix Ability Def Handler 2026-02-03 05:07:54 -05:00
Kam b368871e4f Update Ability.java 2026-02-03 04:45:31 -05:00
Kam 8aa6e926f6 Some Ability Helpers 2026-02-03 04:27:54 -05:00
Vidal 8fc0155df8 Attempt at damage reduction 2026-02-03 06:22:24 -03:00
Vidal 4f629c5679 Made ability abort after the counter has been triggered 2026-02-03 05:57:40 -03:00
Vidal 60b846b35e - Added onDamageTaken to Ability
- Reworked AbilityGuard
- Added AbilityOrbBarrage
- Updated translation
- Updated onDamageTaken method calls
2026-02-03 05:43:50 -03:00
bigguy345 9db8a0b2e7 Forgotten Merge resolution for 'Add Tooltips.' commit 2026-02-03 07:20:24 +02:00
bigguy345 074c780d50 Add inner callable scope locals and expression type resolution
ScriptDocument now tracks locals inside lambdas/function expressions and resolves identifiers by consulting the innermost callable scope before falling back to method/global scope.

Adds expression resolver nodes/type resolver and wires position-aware resolution for lambda bodies, plus basic lambda operator marking and return type validation against expected functional interface SAM.
2026-02-03 07:03:33 +02:00
bigguy345 4e78ffb024 Fix autocomplete trigger after dot 2026-02-03 06:54:09 +02:00
bigguy345 d63a1b8d4c hussar bukkit fixes 2026-02-03 05:50:57 +02:00
Kam 0004029de9 Remove Bukkit from this 2026-02-02 21:54:51 -05:00
Kam 8985ab0f12 Merge branch 'dev' of https://github.com/KAMKEEL/CustomNPC-Plus into dev 2026-02-02 21:51:22 -05:00
Kam 2c6ec0ce34 Better GUI handling for Ability Making System 2026-02-02 21:51:21 -05:00
somehussar 11444946cb Go back to reflections 2026-02-03 03:27:32 +01:00
bigguy345 98351bbc3c dev merge 2026-02-03 04:25:16 +02:00
somehussar fcaf1b0017 Merge remote-tracking branch 'origin/dev' into dev 2026-02-03 03:19:17 +01:00
somehussar 35e76ea9eb gay janino 2026-02-03 03:19:03 +01:00
Kam 38d305ab99 Merge branch 'dev' of https://github.com/KAMKEEL/CustomNPC-Plus into dev 2026-02-02 20:40:19 -05:00
Kam d3167df1b9 Fix to Type Tab 2026-02-02 20:40:17 -05:00
somehussar b5971f258b No class def handling 2026-02-03 02:38:55 +01:00
somehussar e030986d0d gay ass reflections 2026-02-03 02:33:42 +01:00
somehussar 157bbcd3b4 Test 2026-02-03 01:50:09 +01:00
somehussar 650a13edb1 Merge branch 'dev' into kam-cant-make-plugin-integrations-part-2
# Conflicts:
#	dependencies.gradle
2026-02-03 01:10:40 +01:00
somehussar f6342b2335 Fix integration with bukkit and plugins codewise 2026-02-03 01:04:34 +01:00
Kam 0cbc30f8cb Better GUI Handling for Abilities 2026-02-02 18:53:36 -05:00
Kam 911f185400 Fields Builder for Ability GUIs 2026-02-02 18:26:52 -05:00
KamandClaude Opus 4.5 0ff501bb16 Declarative ability GUI: replace 18 SubGui classes with FieldDef system
All ability GUI tabs (General, Target, Effects, Type, Visual) are now
fully declarative via FieldDef definitions. Deleted 18 SubGuiAbility*
classes (~3100 lines) and rewrote SubGuiAbilityConfig to use
GuiScrollWindow for every tab with a unified field renderer.

- Add FieldDef, FieldType, TabTarget, ColumnHint, TabDef gui framework
- Add getFieldDefinitions() to all 18 ability subclasses
- Add getBaseFieldDefinitions() to Ability.java for shared tabs
- Merge COLOR/EFFECTS into SUB_GUI with convenience factories
- Net reduction: ~3100 lines removed

Co-Authored-By: Claude Opus 4.5 <[email protected]>
2026-02-02 16:17:37 -05:00
Kam 3651643f26 Fix GL Issues? 2026-02-02 14:59:55 -05:00
Vidal bcc9d790d6 Added Disc Dual animation 2026-02-02 03:00:35 -03:00
Vidal b74149d98d Added Heavy Hit and Cutter animations 2026-02-02 00:52:43 -03:00
Vidal 0369b6de83 oopsie >< 2026-02-01 20:53:12 -03:00
Vidal bc88c88982 Changed animation name reading logic 2026-02-01 20:49:34 -03:00
Vidal 8ae3bcff1c nevermind 2026-02-01 20:44:23 -03:00
Vidal 0883d7fb94 Cast register animation to builtin 2026-02-01 20:39:15 -03:00
Vidal 9d7ad714a1 WIP Animations Register 2026-02-01 20:27:21 -03:00
Vidal b254ad0ba9 WIP Animations Register 2026-02-01 20:25:16 -03:00
Vidal c168702970 WIP Animations Register 2026-02-01 20:09:12 -03:00