Fix food decreasing (#1834)

* Update InventorySystem.java

Fix some food didn't reduce after use.

* Update InventorySystem.java
This commit is contained in:
atArtyom 2022-10-07 18:14:29 +03:00 committed by GitHub
parent a520bc9416
commit 004a765e5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -851,7 +851,8 @@ public class InventorySystem extends BaseGameSystem {
switch (useData.getUseOp()) {
case ITEM_USE_ADD_SERVER_BUFF -> {
int buffId = Integer.parseInt(useData.getUseParam()[0]);
float time = Float.parseFloat(useData.getUseParam()[1]);
String timeString = useData.getUseParam()[1];
float time = timeString.isEmpty() ? 0 : Float.parseFloat(timeString);
player.getBuffManager().addBuff(buffId, time);
}