refactor: make getGoodsLimit one liner

This commit is contained in:
Breno A. 2024-06-09 08:50:40 -03:00
parent 6bb349d92b
commit da61d30f44

View File

@ -896,10 +896,8 @@ public class Player implements PlayerHook, FieldFetch {
} }
public ShopLimit getGoodsLimit(int goodsId) { public ShopLimit getGoodsLimit(int goodsId) {
Optional<ShopLimit> shopLimit = this.shopLimit.stream().filter(x -> x.getShopGoodId() == goodsId).findFirst(); Optional<ShopLimit> limitOptional = this.shopLimit.stream().filter(x -> x.getShopGoodId() == goodsId).findFirst();
if (shopLimit.isEmpty()) return limitOptional.orElse(null);
return null;
return shopLimit.get();
} }
public void addShopLimit(int goodsId, int boughtCount, int nextRefreshTime) { public void addShopLimit(int goodsId, int boughtCount, int nextRefreshTime) {