Fix IllegalStateException when execute toMap (#1879)

This commit is contained in:
iTruth
2022-10-21 19:19:48 +08:00
committed by GitHub
parent be8fbcbc02
commit c331a7f288
4 changed files with 11 additions and 8 deletions

View File

@@ -16,10 +16,13 @@ public class ItemUseOpenRandomChest extends ItemUseInt {
@Override
public boolean useItem(UseItemParams params) { // cash shop material bundles
var rewardItems = params.player.getServer().getShopSystem().getShopChestData(this.i).stream().map(GameItem::new).toList();
var data = params.player.getServer().getShopSystem().getShopChestData(this.i);
if (data == null)
return false;
var rewardItems = data.stream().map(GameItem::new).toList();
if (!rewardItems.isEmpty()) {
params.player.getInventory().addItems(rewardItems, ActionReason.Shop);
}
return false;
return true;
}
}