#(virtualbox) My trait is not registering

1 messages · Page 1 of 1 (latest)

raw ironBOT
#

(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>

spiral copper
forest canopy
#

i did do it exactly like in the api

spiral copper
#

wheres the rest of yer code?

forest canopy
#

and traitmanager is initialized on enable

forest canopy
#

hi?

drifting ridge
#

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

forest canopy
#

it's what is needed for it to be built

#

the class is being initiated at onEnable

covert cipher
gusty ferryBOT
#
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.

covert cipher
#

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

forest canopy
#

🥹

covert cipher
forest canopy
#

but instead i register the traits in different class

covert cipher
#

Do you mean you updated your code to match, or you don't understand why your current code is different?

forest canopy
#

i dont understand why it does not work

#

one question

#

can i pass an instance of an object to TraitInfo.create ?

covert cipher
#

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

forest canopy
#

soo i cannot store them as an instance in list?

covert cipher
#

wat

forest canopy
#

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?

covert cipher
#

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
#

alright

#

thanks i guess

wheat kiteBOT
#

@forest canopy

Thread Close Blocked

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>.

#
Resolved

Thread closed as resolved.

covert cipher
#

Duplicate thread of #1047893725180858408 message

#

did you-

#

delete the opening po-

#

@brave cairn warn @forest canopy normal rule 8 and abusing threads

brave cairnBOT
#
Warning Recorded

Warning from @covert cipher to @forest canopy recorded.
Reason: "rule 8 and abusing threads"

covert cipher
#

If you have more issues related to the same topic, continue using the same thread

forest canopy
#

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

covert cipher
#

!pastejava

gusty ferryBOT
forest canopy
#

i already showed it in the other thread

#

alr

covert cipher
#

please post any relevant information in this thread

forest canopy
#

ye just gimme a minute

covert cipher
#

where do you add the trait to the NPC?

forest canopy
#

/npc sel

#

/trait add test

covert cipher
#

is there any errors or anything?

#

or just doesn't show the message?

forest canopy
#

it says it does not exist

covert cipher
#

!logs

gusty ferryBOT
# covert cipher !logs
Info: 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.

forest canopy
#

here we go again

forest canopy
#

are you gonna logcheck

white rapids
#

Are you sure the trait registration onEnable is running in a normal spigot plugin

forest canopy
#

yes

white rapids
#

And the citizensapi trait factory returns your class when asked?

forest canopy
#

getTrait()?

white rapids
#

Yes

covert cipher
forest canopy
#

🥹

#

i said there is no error

#

i can reproduce it if you want to

covert cipher
#

if you're hoping to get things working

forest canopy
#

yeah i hope

#

cuz i already spent 3 ducking days on this

covert cipher
#

you need to try your best to provide as much information as possible

#

like full logs of you attempting the thing that isn'tworking

forest canopy
#

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

wheat kiteBOT
#
Thread Closing Reminder

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

wheat kiteBOT
#
Thread Closing Reminder

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

forest canopy
#

oh wait