#(virtualbox) My trait is not registering
1 messages · Page 1 of 1 (latest)
(virtualbox) My trait is not registering
Hi I'm AutoThreadBot! Don't mind me, I'll just be adding the helper team to this thread so they can see it. A human will get to you soon.
You can block this bot if you don't want to see these messages, I won't mind.
<@&525394568410038282>
Citizens has an extensive API for working with NPCs. Make sure you always are using an up-to-date build of the CitizensAPI to ensure that your plugin works with the latest release of Citizens.
i did do it exactly like in the api
wheres the rest of yer code?
Use this page to make a Java paste that you can share.
Content of Java Paste #103566: 'aaaaa'... pasted 2022/11/30 10:39:59 UTC-08:00, Paste length: 234 characters across 7 lines
and traitmanager is initialized on enable
hi?
That's an api question, not everyone of us is capable to read java or help with api related questions
but er, behr asked for the full code, what you provided seems to be like a snipped of something
!api
+++ Info api: https://wiki.citizensnpcs.co/API
Citizens has an extensive API for working with NPCs. Make sure you always are using an up-to-date build of the CitizensAPI to ensure that your plugin works with the latest release of Citizens.
API wiki page explains how and where to use trait related stuff, even has an example
Your code does not match the example at all
🥹
?
i just read the api and i have it almost the same
but instead i register the traits in different class
Do you mean you updated your code to match, or you don't understand why your current code is different?
i dont understand why it does not work
one question
can i pass an instance of an object to TraitInfo.create ?
you should be referencing the class of your trait, not instances, as the API page shows
the register example on the API page uses TraitInfo.create(MyTrait.class)
your code should match that
it shows examples of how to add traits as: npc.getOrAddTrait(Equipment.class)
your code again should match that
the API page shows the register goes in onEnable, and adding to an NPC goes elsewhere
your code should match that
soo i cannot store them as an instance in list?
wat
i wanna store the traits in list
for some reasons
and also wanna register them
but apparently i cant register it as an instance
are you confused?
You're confused about what traits are and how they work
Please follow the examples on the API page and make working traits and learn how they work before trying to muck with them
once you have an understanding of the core concepts, you can play with ideas of going beyond their standard design
but before then, that's just going to make a mess
@forest canopy
Thread was closed either automatically by timeout or by the Discord manual close button. If closing was intentional, please use </resolved:1028673926114594866> or </invalid:1028673926898909185>.
Thread closed as resolved.
Duplicate thread of #1047893725180858408 message
did you-
delete the opening po-
@brave cairn warn @forest canopy normal rule 8 and abusing threads
Warning from @covert cipher to @forest canopy recorded.
Reason: "rule 8 and abusing threads"
If you have more issues related to the same topic, continue using the same thread
this whole post system is so confusing
so uhm
im now copied it basically from the api
and it still does not work
switvhed to java 17, updated paper and denizen
!pastejava
Help us help you by pasting your Java code to https://paste.denizenscript.com/New/Other?selected=other-java and linking it back here.
please post any relevant information in this thread
ye just gimme a minute
Content of Java Paste #103576: 'Unnamed Java Paste'... pasted 2022/12/01 07:17:55 UTC-08:00, Paste length: 461 characters across 20 lines
where do you add the trait to the NPC?
it says it does not exist
!logs
Please post your full latest log file.
Background Info: One of the most helpful tools to identifying the source of a problem is your server logs file! Logs contain all sorts of important information like server and plugin versions, any error messages, and a lot more important information (More Info).
How To: Your log can be found in the logs folder within your server folder. The most recent log is a text file labeled latest.log. To get help using these logs, please open that file in a text editor and copy all of the text, then open https://paste.denizenscript.com/New/Log and paste the text into the box on the page. Then click "Submit" and copy the URL and paste that back into this channel.
Please do not upload the file to Discord or to other pastebin services, use the log pastebin linked above.
here we go again
Content of Server Log Paste #103610: 'Unnamed Server Log Paste'... pasted 2022/12/02 00:32:57 UTC-08:00, Paste length: 24582 characters across 256 lines
are you gonna logcheck
Are you sure the trait registration onEnable is running in a normal spigot plugin
yes
And the citizensapi trait factory returns your class when asked?
how do i ask it
getTrait()?
Yes
nowhere in this log do you join the server, create an npc, and attempt to add a trait to it
if you're hoping to get things working
you need to try your best to provide as much information as possible
like full logs of you attempting the thing that isn'tworking
ye
what in the duck
i think i fixed it
if i register it before i connect to sql database
it works
so i guess that was my issue lol
thanks anyways and sorry for my dumbness
Has your issue been resolved, or your question been answered?
If so, please type </resolved:1028673926114594866> to close your thread.
Or </invalid:1028673926898909185> if it's not possible to resolve.
If not yet resolved, please reply below to tell us what you still need.
(Note that if there is no reply for a few days, this thread will eventually close itself.)
@forest canopy
Has your issue been resolved, or your question been answered?
If so, please type </resolved:1028673926114594866> to close your thread.
Or </invalid:1028673926898909185> if it's not possible to resolve.
If not yet resolved, please reply below to tell us what you still need.
(Note that if there is no reply for a few days, this thread will eventually close itself.)
@forest canopy
oh wait