[SPIGOT-4984] EnchantmentOffer.getCost() documentation/wording is misleading Created: 25/May/19  Updated: 14/Jun/19  Resolved: 14/Jun/19

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Kuinox Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: documentation

Attachments: PNG File image-2019-05-25-21-35-40-897.png    
Version: 1.14.1-R0.1-SNAPSHOT
Guidelines Read: Yes

 Description   

Hey,

I was searching the minimum level required of an enchantment offer, but it was actually the getter "getCost" documented as Gets the cost in experience levels the player has to pay to enchant his item with this enchantment.

The value returned is the level required to do the enchantment (what i want), 

the cost should be 1/2/3 meanwhile it return 6/11/30



 Comments   
Comment by Black Hole [ 26/May/19 ]

Correct.

Comment by md_5 [ 26/May/19 ]

So the number on the left is the cost, but the number on the right is the minimum number of experience you must have to unlock that enchant?

Comment by Kuinox [ 25/May/19 ]

There is the same "bug" on EnchantItemEvent.getExpLevelCost().
It should be called getMinimumExpRequired() or something like that.

Comment by Kuinox [ 25/May/19 ]

I had no issue with the real cost of the enchantment, but i was searching for the minimum level indicated.

Comment by Black Hole [ 25/May/19 ]

Some years ago the value shown on the right was the level costs. So maybe JavaDoc could be updated to reflect that.

For the levels shown to the left you could just assume that the entries are always 1, 2, 3. Minecraft assumes that too, there is no field in the protocol to send different levels to the client.

Generated at Tue Apr 22 03:30:25 UTC 2025 using Jira 10.3.5#10030005-sha1:190c783f2bd6c69cd5accdb70f97e48812a78d14.