Hello there, I have a question and I don't know to do that... What's is the best begin to make a code for Item Weight Example: If I have 10 gold in my inventory, I have to walk slower. It is therefore the intention that the inventory needs to be updated since you can also get the gold from your inventory. thanks in advance!
@JustRik I'm not really sure but, i guess you could create a Map<Material, Double> with the material and the weight. Then listen to inventory events so that you can update the movement speed using this: Code:Java Player player = ...; // Your playerdouble speed = ...; // Get the item change, or loop the player's inventory, then get the weight and calculate the speed based on that player.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).setBaseValue(speed);
Exactly as Karim suggests. You have the data pertaining to item weight somewhere and on every inventory event, you calculate the players inventory weight and set their movement speed accordingly.