#setEnchantmentLevel

1 messages · Page 1 of 1 (latest)

umbral topaz
#

lets talk here ^^

dawn karma
#

sure

umbral topaz
#

so what is the display name set to

dawn karma
#

so as i've said, the setEnchantmentLevel does pretty much nothing

#

it changes the level

#

for example if I set the enchantment to be a level 5 enchant it would show it in lore as <Enchant> V

#

but when you enchant it, the item recieves a different level enchant

#

here let me take a sceren shot rq

umbral topaz
#

did you try cancelling the enchant event?

#

maybe it overwrites it

dawn karma
#

... no i didnt

#

i'll try that real quick

umbral topaz
#

kk

dawn karma
#

yeah i don't think canceling the event is helping lol

umbral topaz
#

no wait

#

dont cancel the prepareitemenchant event

#

as you said, the prepareenchant returns the expected result

#

but actually enchanting it overwrites it right?

dawn karma
#

i think so yeah

umbral topaz
#

so you might have to listen for the actual enchant event and modify its value there

#

I never used enchants before but it seems like the logical decision for me

dawn karma
#

yeah i thought so too but then i saw that the EnchantmentOffer class had a function to change the offer's level

umbral topaz
dawn karma
#

also, the setEnchantment does work so i think it is logical that it would also work with level imo

umbral topaz
#

wait so it always enchants with knockback?

dawn karma
#

ye

umbral topaz
#

that's... odd

dawn karma
#

yep

dawn karma
#

yeah i will

#

still think it's quite weird that it does let you change the enchant but not it's level

#

but thanks anyways 😄

umbral topaz
#

let me look into the prepare Event a bit

dawn karma
#

sure no problem

umbral topaz
#

can you print out the Map resulting from "getEnchantsToAdd" from the EnchantItemEvent class?

#

with your custom enchant code active

dawn karma
#

sec

umbral topaz
#

is the knockback level always 2?

dawn karma
#

no it's set to 5

umbral topaz
#

yes but when you enchant

#

is it always 2

dawn karma
#

oh no

#

it changes

umbral topaz
#

can you set it to 1 in the method?

dawn karma
#

ok one sec

#

yeah didn't help

umbral topaz
#

okay then

#

create another Event listening for EnchantItemEvent

#

and check if it is knockback in the first button

#

then set the resulting level to like 5

dawn karma
#

yeah this should help obviously

#

I... uhh

#

hmmm...

#

mmmmmmmmm......

umbral topaz
#

wa-

dawn karma
#

I think spigot's just fing with me

umbral topaz
#

one sec txting rn

#

okay how about you just try forcing the enchantment into the resulting map from EnchantItemEvent

dawn karma
#

yeah so now it works

#

...

#

thanks spigot api very cool

umbral topaz
#

what'd you change

dawn karma
#

forced the enchantment into the map lol

#

without checking if it's in there

umbral topaz
#

kk

#

sooo it works all good now?

dawn karma
#

not quite kk but whatever thanks spigot

dawn karma
umbral topaz
#

anything else you might need a hand with?

dawn karma
#

not right now i don't think so

umbral topaz
#

btw what are you tryna do with your plugin?

dawn karma
#

thanks for the support and thanks spigot for fing with me

dawn karma
#

just wanted to try doing custom enchants

umbral topaz
#

ah okay