diff --git a/src/main/java/emu/grasscutter/game/inventory/Inventory.java b/src/main/java/emu/grasscutter/game/inventory/Inventory.java index 328134f70..12f5cbfba 100644 --- a/src/main/java/emu/grasscutter/game/inventory/Inventory.java +++ b/src/main/java/emu/grasscutter/game/inventory/Inventory.java @@ -1,5 +1,7 @@ package emu.grasscutter.game.inventory; +import static emu.grasscutter.config.Configuration.INVENTORY_LIMITS; + import emu.grasscutter.Grasscutter; import emu.grasscutter.data.GameData; import emu.grasscutter.data.common.ItemParamData; @@ -20,14 +22,11 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.longs.Long2ObjectMap; import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; - import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; -import static emu.grasscutter.config.Configuration.INVENTORY_LIMITS; - public class Inventory extends BasePlayerManager implements Iterable { private final Long2ObjectMap store; private final Int2ObjectMap inventoryTypes; @@ -455,14 +454,10 @@ public class Inventory extends BasePlayerManager implements Iterable { * @return True if the item was removed, false otherwise. */ public synchronized boolean removeItemById(int itemId, int count) { - var item = this.getItems().values().stream() - .filter(i -> i.getItemId() == itemId) - .findFirst(); + var item = this.getItems().values().stream().filter(i -> i.getItemId() == itemId).findFirst(); // Check if the item is in the player's inventory. - return item.filter( - gameItem -> this.removeItem(gameItem, count) - ).isPresent(); + return item.filter(gameItem -> this.removeItem(gameItem, count)).isPresent(); } public synchronized boolean removeItem(GameItem item) { diff --git a/src/main/java/emu/grasscutter/game/systems/InventorySystem.java b/src/main/java/emu/grasscutter/game/systems/InventorySystem.java index 4d3c5db1c..86210bb0c 100644 --- a/src/main/java/emu/grasscutter/game/systems/InventorySystem.java +++ b/src/main/java/emu/grasscutter/game/systems/InventorySystem.java @@ -26,10 +26,9 @@ import emu.grasscutter.server.game.GameServer; import emu.grasscutter.server.packet.send.*; import emu.grasscutter.utils.Utils; import it.unimi.dsi.fastutil.ints.*; -import lombok.val; - import java.util.*; import java.util.stream.Stream; +import lombok.val; public class InventorySystem extends BaseGameSystem { private static final Int2IntMap weaponRefundMaterials = new Int2IntArrayMap(); diff --git a/src/main/java/emu/grasscutter/game/world/Scene.java b/src/main/java/emu/grasscutter/game/world/Scene.java index 8909ac43c..fdc02b06b 100644 --- a/src/main/java/emu/grasscutter/game/world/Scene.java +++ b/src/main/java/emu/grasscutter/game/world/Scene.java @@ -41,15 +41,14 @@ import emu.grasscutter.server.packet.send.*; import emu.grasscutter.utils.KahnsSort; import emu.grasscutter.utils.Position; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -import lombok.Getter; -import lombok.Setter; -import lombok.val; - -import javax.annotation.Nullable; import java.util.*; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.CopyOnWriteArrayList; import java.util.stream.Collectors; +import javax.annotation.Nullable; +import lombok.Getter; +import lombok.Setter; +import lombok.val; public final class Scene { @Getter private final World world; diff --git a/src/main/java/emu/grasscutter/game/world/World.java b/src/main/java/emu/grasscutter/game/world/World.java index b6f70ccf1..6d1f8af9f 100644 --- a/src/main/java/emu/grasscutter/game/world/World.java +++ b/src/main/java/emu/grasscutter/game/world/World.java @@ -1,5 +1,7 @@ package emu.grasscutter.game.world; +import static emu.grasscutter.server.event.player.PlayerTeleportEvent.TeleportType.SCRIPT; + import emu.grasscutter.data.GameData; import emu.grasscutter.data.excels.dungeon.DungeonData; import emu.grasscutter.game.player.Player; @@ -22,17 +24,14 @@ import emu.grasscutter.utils.Position; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectMaps; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; -import lombok.Getter; -import lombok.val; -import org.jetbrains.annotations.NotNull; - import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.stream.Collectors; - -import static emu.grasscutter.server.event.player.PlayerTeleportEvent.TeleportType.SCRIPT; +import lombok.Getter; +import lombok.val; +import org.jetbrains.annotations.NotNull; public final class World implements Iterable { @Getter private final GameServer server; @@ -535,14 +534,10 @@ public final class World implements Iterable { player -> player.getQuestManager().queueEvent(QuestContent.QUEST_CONTENT_GAME_TIME_TICK)); } - /** - * Notifies all players of the current world time. - */ + /** Notifies all players of the current world time. */ public void updateTime() { - this.getPlayers().forEach(p -> - p.sendPacket(new PacketPlayerGameTimeNotify(p))); - this.getPlayers().forEach(p -> - p.sendPacket(new PacketSceneTimeNotify(p))); + this.getPlayers().forEach(p -> p.sendPacket(new PacketPlayerGameTimeNotify(p))); + this.getPlayers().forEach(p -> p.sendPacket(new PacketSceneTimeNotify(p))); } /** @@ -559,8 +554,7 @@ public final class World implements Iterable { .forEach(player -> player.setProperty(PlayerProperty.PROP_IS_GAME_TIME_LOCKED, locked)); } - @NotNull - @Override + @NotNull @Override public Iterator iterator() { return this.getPlayers().iterator(); } diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerSetPauseRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerSetPauseRsp.java index ab3036630..902fd18e7 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerSetPauseRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerSetPauseRsp.java @@ -10,7 +10,6 @@ public class PacketPlayerSetPauseRsp extends BasePacket { public PacketPlayerSetPauseRsp(Retcode retcode) { super(PacketOpcodes.PlayerSetPauseRsp); - this.setData(PlayerSetPauseRsp.newBuilder() - .setRetcode(retcode.getNumber())); + this.setData(PlayerSetPauseRsp.newBuilder().setRetcode(retcode.getNumber())); } }