Get shop as Optional

This commit is contained in:
P0nk
2023-03-30 06:40:16 +02:00
parent fe9dd75a23
commit 39d759595d
4 changed files with 13 additions and 16 deletions

View File

@@ -54,6 +54,7 @@ import tools.Pair;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Optional;
import static java.util.concurrent.TimeUnit.DAYS;
import static java.util.concurrent.TimeUnit.SECONDS;
@@ -511,9 +512,9 @@ public final class UseCashItemHandler extends AbstractPacketHandler {
}
} else if (itemType == 545) { // MiuMiu's travel store
if (player.getShop() == null) {
Shop shop = shopFactory.getShop(MIU_MIU_SHOP_ID);
if (shop != null) {
shop.sendShop(c);
Optional<Shop> shop = shopFactory.getShop(MIU_MIU_SHOP_ID);
if (shop.isPresent()) {
shop.get().sendShop(c);
remove(c, position, itemId);
}
} else {