#setEnchantmentLevel
1 messages · Page 1 of 1 (latest)
sure
so what is the display name set to
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
kk
yeah i don't think canceling the event is helping lol
no wait
dont cancel the prepareitemenchant event
as you said, the prepareenchant returns the expected result
but actually enchanting it overwrites it right?
i think so yeah
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
yeah i thought so too but then i saw that the EnchantmentOffer class had a function to change the offer's level
What if you just look into https://helpch.at/docs/1.8.8/index.html?org/bukkit/event/enchantment/EnchantItemEvent.html and change the resulting item
also, the setEnchantment does work so i think it is logical that it would also work with level imo
wait so it always enchants with knockback?
ye
that's... odd
yep
still, try with that anyways
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 😄
let me look into the prepare Event a bit
sure no problem
can you print out the Map resulting from "getEnchantsToAdd" from the EnchantItemEvent class?
with your custom enchant code active
is the knockback level always 2?
no it's set to 5
can you set it to 1 in the method?
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
declaration: package: org.bukkit.event.enchantment, class: EnchantItemEvent
wa-
I think spigot's just fing with me
one sec txting rn
okay how about you just try forcing the enchantment into the resulting map from EnchantItemEvent
what'd you change
not quite kk but whatever thanks spigot
more or less yeah
anything else you might need a hand with?
not right now i don't think so
btw what are you tryna do with your plugin?
thanks for the support and thanks spigot for fing with me
nothing yet
just wanted to try doing custom enchants
ah okay