Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvement: Pet Display V2 #3475

Draft
wants to merge 148 commits into
base: beta
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
148 commits
Select commit Hold shift + click to select a range
96ecad2
do most of tab detection
martimavocado Sep 26, 2024
d0d41bf
hi empa
martimavocado Sep 27, 2024
e1745f2
add petxp calculation
martimavocado Sep 27, 2024
14294c5
finish widget detection
martimavocado Sep 27, 2024
de154f6
fix function names
martimavocado Sep 27, 2024
847a96d
fix pet item detection
martimavocado Sep 27, 2024
c408256
fix petxp on event
martimavocado Sep 27, 2024
c610e88
this is my best commit yet
martimavocado Sep 27, 2024
dbac55e
start handling autopet
martimavocado Sep 28, 2024
9543721
prepare for pet menu (oh no)
martimavocado Sep 28, 2024
535dd39
add pet menu support
martimavocado Sep 28, 2024
28ba77e
add pet menu despawn logic
martimavocado Sep 28, 2024
9b285e0
move pet levels to repo
martimavocado Sep 28, 2024
04d1fe3
add event description and move to neu repo
martimavocado Sep 28, 2024
90fd5f5
fix pet item xp parsing, cleanup
martimavocado Sep 28, 2024
0533bc5
more cleanup
martimavocado Sep 28, 2024
2ea237b
remove debugdata
martimavocado Sep 28, 2024
6419bdb
add support for changing pet item
martimavocado Oct 3, 2024
f0814a4
stop hardcoding pet line
martimavocado Oct 3, 2024
d3db01f
hypixel successfully trolled everyone
martimavocado Oct 3, 2024
007f275
update pattern names
martimavocado Oct 12, 2024
b974cc0
parse pet nbt
martimavocado Oct 12, 2024
48c0621
Merge remote-tracking branch 'hannibal002/beta' into petapi-v2
martimavocado Oct 13, 2024
4658db8
use more repo data
martimavocado Oct 13, 2024
0cabf6d
cleanup, use internalname instead of string for pet name
martimavocado Oct 13, 2024
975f7d7
move DiscordStatus.kt to petapi
martimavocado Oct 14, 2024
8c36dca
a
martimavocado Oct 14, 2024
c189a23
Merge branch 'refs/heads/beta' into fork/martimavocado/petapi-v2
CalMWolfs Oct 15, 2024
a79f5be
moved command, fixed typos
CalMWolfs Oct 15, 2024
ee7a920
Merge remote-tracking branch 'hannibal002/beta' into petapi-v2
martimavocado Oct 16, 2024
a3635de
misc review changes
martimavocado Oct 16, 2024
90e053a
remove skin
martimavocado Oct 16, 2024
ceddf65
is this correct
martimavocado Oct 16, 2024
971e6c6
use neurepo for custom display to internalname
martimavocado Oct 16, 2024
d31fae6
fix equals and hashcode, make petItem nullable
martimavocado Oct 16, 2024
d951402
fix fakeinternalname
martimavocado Oct 16, 2024
1376426
Merge remote-tracking branch 'hannibal002/beta' into petapi-v2
martimavocado Oct 18, 2024
929dc41
empa review
martimavocado Oct 18, 2024
17d7c7a
a
martimavocado Oct 18, 2024
9339726
Merge branch 'refs/heads/beta' into fork/martimavocado/petapi-v2
hannibal002 Oct 20, 2024
3420fb5
fix regex test
hannibal002 Oct 20, 2024
10769ad
misc reviews
martimavocado Oct 20, 2024
d04ad5d
more unknown rarity errors
martimavocado Oct 20, 2024
d58dd48
fix isPetMenu usages
martimavocado Oct 20, 2024
c41924c
Merge branch 'beta' into petapi-v2
CalMWolfs Oct 20, 2024
f7b1ad6
remove petdata default values
martimavocado Oct 22, 2024
d2d19c2
intellij gave up on me, i give up on this (for now)
martimavocado Oct 22, 2024
82584b9
thanks david for adding detekt
martimavocado Oct 22, 2024
afb18f8
detekt
martimavocado Oct 22, 2024
365c566
better caching
martimavocado Oct 22, 2024
45b6d40
Merge remote-tracking branch 'hannibal002/beta' into petapi-v2
martimavocado Oct 22, 2024
5008ddf
does it work this time
martimavocado Oct 22, 2024
ec3b7e4
i need help why does detekt on my pc not complain as much
martimavocado Oct 22, 2024
8c47e05
Merge branch 'refs/heads/beta' into fork/martimavocado/petapi-v2
hannibal002 Oct 22, 2024
a969880
i thought this didn't work because i forgot the @Expose
martimavocado Oct 22, 2024
13925e5
code cleanup
hannibal002 Oct 22, 2024
a254f69
removed test
hannibal002 Oct 22, 2024
9c48ba3
Merge remote-tracking branch 'martimavocado/petapi-v2' into fork/mart…
hannibal002 Oct 22, 2024
32f6be7
Inital round of fixes, imps
DavidArthurCole Dec 10, 2024
5d550d3
Merge
DavidArthurCole Dec 10, 2024
ea21a70
Merge cleanup
DavidArthurCole Dec 10, 2024
f6d45aa
Detekt
DavidArthurCole Dec 10, 2024
2245290
Extract data parsing logic to PetData
DavidArthurCole Dec 10, 2024
9239dc4
Refactor to Utils + API, improvements
DavidArthurCole Dec 10, 2024
affe691
Bump storage name
DavidArthurCole Dec 10, 2024
6a99621
improvements
DavidArthurCole Dec 10, 2024
ecf71f8
More work
DavidArthurCole Dec 11, 2024
3b97537
Detekt
DavidArthurCole Dec 11, 2024
47252e2
Merge branch 'hannibal002:beta' into PetDisplay
DavidArthurCole Dec 13, 2024
72bf4e5
Merge branch 'refs/heads/beta' into fork/DavidArthurCole/PetDisplay
CalMWolfs Dec 14, 2024
b969988
fix merge
CalMWolfs Dec 14, 2024
f98f2b5
Rip out new display
DavidArthurCole Dec 14, 2024
e3ed99b
Merge branch 'beta' into PetDisplay
DavidArthurCole Dec 14, 2024
482a7ad
Merge cleanup
DavidArthurCole Dec 14, 2024
da7e2d1
Done
DavidArthurCole Dec 14, 2024
f42004b
Detekt :(
DavidArthurCole Dec 14, 2024
ceb3e7b
Remove strict reliance on eventType=
DavidArthurCole Dec 14, 2024
18153c6
Combine some dupe logic, split up monster function
DavidArthurCole Dec 14, 2024
bb4513b
Merge branch 'hannibal002:beta' into PetDisplay
DavidArthurCole Dec 16, 2024
95f3a14
Merge branch 'hannibal002:beta' into HandleEventOptionalProcessor
DavidArthurCole Dec 20, 2024
215cae5
Merge branch 'hannibal002:beta' into PetDisplay
DavidArthurCole Dec 20, 2024
c8c6c16
Merge
DavidArthurCole Jan 4, 2025
cd5f57d
Merge
DavidArthurCole Jan 4, 2025
c272cfb
Cleanup
DavidArthurCole Jan 4, 2025
68f0759
More cleanup
DavidArthurCole Jan 4, 2025
f382ad5
Merge
DavidArthurCole Jan 7, 2025
fe5960e
Merge branch 'refs/heads/beta' into fork/DavidArthurCole/PetDisplay
CalMWolfs Jan 8, 2025
b6fcdff
regression
CalMWolfs Jan 8, 2025
b99f9f2
Merge branch 'beta' into PetDisplay
DavidArthurCole Jan 9, 2025
dce4a83
Merge branch 'beta' into PetDisplay
DavidArthurCole Jan 9, 2025
f5335d6
Merge branch 'beta' into PetDisplay
CalMWolfs Jan 10, 2025
c5db619
Merge
DavidArthurCole Jan 12, 2025
6272e5c
Merge branch 'beta' into PetDisplay
DavidArthurCole Jan 14, 2025
4c1231f
Merge branch 'beta' into HandleEventOptionalProcessor
DavidArthurCole Jan 14, 2025
2fdba87
Fix regression
DavidArthurCole Jan 14, 2025
95c793b
Merge branch 'beta' into PetDisplay
CalMWolfs Jan 16, 2025
46b801f
Merge branch 'beta' into HandleEventOptionalProcessor
CalMWolfs Jan 16, 2025
c0a7eec
Merge branch 'beta' into PetDisplay
DavidArthurCole Jan 20, 2025
4689518
Merge branch 'beta' into HandleEventOptionalProcessor
DavidArthurCole Jan 20, 2025
51dff4f
Merge
DavidArthurCole Jan 23, 2025
6fedb04
Merge branch 'beta' into PetDisplay
DavidArthurCole Jan 24, 2025
abeaf32
Merge branch 'refs/heads/beta' into fork/DavidArthurCole/PetDisplay
CalMWolfs Jan 24, 2025
c5d3194
Merge cleanup
DavidArthurCole Jan 24, 2025
2949052
Merge branch 'beta' into HandleEventOptionalProcessor
CalMWolfs Jan 24, 2025
e1d9e8b
Detekt
DavidArthurCole Jan 24, 2025
525f914
Merge branch 'beta' into PetDisplay
DavidArthurCole Jan 24, 2025
89fd31c
Merge branch 'beta' into HandleEventOptionalProcessor
DavidArthurCole Jan 24, 2025
4f88b58
Merge branch 'beta' into HandleEventOptionalProcessor
DavidArthurCole Jan 24, 2025
e2ca8ae
Merge branch 'beta' into PetDisplay
DavidArthurCole Jan 24, 2025
639d6e4
Merge
DavidArthurCole Jan 25, 2025
247659f
Cleanup
DavidArthurCole Jan 25, 2025
3598abc
Rename
DavidArthurCole Jan 25, 2025
c0c4559
Merge branch 'beta' into PetDisplay
CalMWolfs Jan 25, 2025
6546390
Merge branch 'beta' into HandleEventOptionalProcessor
DavidArthurCole Jan 25, 2025
e73e290
Merge
DavidArthurCole Jan 29, 2025
00dab13
Merge remote-tracking branch 'upstream/beta' into PetDisplay
DavidArthurCole Jan 31, 2025
e93b7e1
Merge remote-tracking branch 'upstream/beta' into HandleEventOptional…
DavidArthurCole Jan 31, 2025
828e50d
Merge
DavidArthurCole Feb 1, 2025
3d03395
Merge branch 'beta' into HandleEventOptionalProcessor
DavidArthurCole Feb 1, 2025
9363047
Merge branch 'beta' into PetDisplay
DavidArthurCole Feb 6, 2025
6156166
Merge branch 'beta' into HandleEventOptionalProcessor
DavidArthurCole Feb 10, 2025
c9ca4f0
Add multi
DavidArthurCole Feb 10, 2025
f6baad5
Merge
DavidArthurCole Feb 10, 2025
1b4f559
Plugin config
DavidArthurCole Feb 10, 2025
4f9dcfe
Oops.
DavidArthurCole Feb 10, 2025
d71f31c
Merge branch 'refs/heads/beta' into fork/DavidArthurCole/PetDisplay
hannibal002 Feb 11, 2025
d562417
merge conflict
hannibal002 Feb 11, 2025
1fd21d2
Merge branch 'beta' into PetDisplay
DavidArthurCole Feb 11, 2025
c06cb92
Merge branch 'beta' into HandleEventOptionalProcessor
DavidArthurCole Feb 17, 2025
8e7acf8
Merge branch 'beta' into PetDisplay
DavidArthurCole Feb 17, 2025
e727378
Merge branch 'beta' into PetDisplay
DavidArthurCole Feb 18, 2025
87d082f
Merge branch 'beta' into HandleEventOptionalProcessor
DavidArthurCole Feb 18, 2025
3be221a
Merge branch 'hannibal002:beta' into PetAPIV2
DavidArthurCole Feb 22, 2025
78a9221
Sto
DavidArthurCole Feb 22, 2025
6d597cf
Sto
DavidArthurCole Feb 22, 2025
4122beb
Fix
DavidArthurCole Feb 22, 2025
3714464
More fixes
DavidArthurCole Feb 22, 2025
91282d4
Improvements
DavidArthurCole Feb 22, 2025
b8999bd
:(
DavidArthurCole Feb 22, 2025
ec7cb59
More progress
DavidArthurCole Feb 22, 2025
6db1758
Merge branch 'HandleEventOptionalProcessor' into PetDisplayV2
DavidArthurCole Feb 22, 2025
f4bb6dd
Fixes
DavidArthurCole Feb 22, 2025
66197d5
Fixes
DavidArthurCole Feb 22, 2025
ee76a0d
Add smoothing
DavidArthurCole Feb 22, 2025
aad2493
better way
Thunderblade73 Feb 22, 2025
9abd715
semicircle
Thunderblade73 Feb 22, 2025
48c5086
Merge pull request #347 from Thunderblade73/pr/DavidArthurCole/PetDis…
DavidArthurCole Feb 22, 2025
500793a
More progress
DavidArthurCole Feb 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .idea/dictionaries/default_user.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 19 additions & 1 deletion .live-plugins/event/plugin.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import org.jetbrains.kotlin.types.typeUtil.supertypes

val skyhanniEvent = "at.hannibal2.skyhanni.api.event.SkyHanniEvent"
val handleEvent = "HandleEvent"
val eventType = "eventType"

registerInspection(HandleEventInspectionKotlin())

Expand All @@ -28,16 +29,33 @@ class HandleEventInspectionKotlin : AbstractKotlinInspection() {
val visitor = object : KtVisitorVoid() {
override fun visitNamedFunction(function: KtNamedFunction) {
val hasEventAnnotation = function.annotationEntries.any { it.shortName!!.asString() == handleEvent }

// Check if the function's parameter is a SkyHanniEvent or its subtype
val isEvent = function.valueParameters.firstOrNull()?.type()?.supertypes()
?.any { it.fqName?.asString() == skyhanniEvent } ?: false

// Find the annotation entry
val annotationEntry = function.annotationEntries
.find { it.shortName!!.asString() == handleEvent }

// Check if the annotation specifies the eventType explicitly or as a positional parameter
val hasEventType = annotationEntry?.valueArguments
?.any { argument ->
val argName = argument.getArgumentName()?.asName?.asString()
argName == eventType || argName == "eventTypes" ||
// Check if it is a positional argument (first argument)
(annotationEntry.valueArguments.indexOf(argument) == 0 &&
argument.getArgumentExpression()?.text != null)
} ?: false

// Validate function annotation and parameters
if (isEvent && !hasEventAnnotation && function.valueParameters.size == 1 && function.isPublic) {
holder.registerProblem(
function,
"Event handler function should be annotated with @HandleEvent",
HandleEventQuickFix()
)
} else if (!isEvent && hasEventAnnotation) {
} else if (!isEvent && !hasEventType && hasEventAnnotation) {
holder.registerProblem(
function,
"Function should not be annotated with @HandleEvent if it does not take a SkyHanniEvent",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,13 @@ class ModuleProcessor(private val codeGenerator: CodeGenerator, private val logg
}

if (function.annotations.any { it.shortName.asString() == "HandleEvent" }) {
val firstParameter = function.parameters.firstOrNull()?.type?.resolve()!!
if (!skyHanniEvent!!.isAssignableFrom(firstParameter)) {
val firstParameter = function.parameters.firstOrNull()?.type?.resolve()
val handleEventAnnotation = function.annotations.find { it.shortName.asString() == "HandleEvent" }
val eventType = handleEventAnnotation?.arguments?.find { it.name?.asString() == "eventType" }?.value
val isFirstParameterProblem = firstParameter == null && eventType == null
val notAssignable = firstParameter != null && !skyHanniEvent!!.isAssignableFrom(firstParameter)

if (isFirstParameterProblem || notAssignable) {
warnings.add("Function in $className must have an event assignable from $skyHanniEvent because it is annotated with @HandleEvent")
}
}
Expand Down
Loading
Loading