From 45bf5edb138b396e15a06d66b96d096af50f9ad7 Mon Sep 17 00:00:00 2001 From: "Breno A." Date: Sun, 9 Jun 2024 10:01:03 -0300 Subject: [PATCH] perf: stream api can be simplified here --- .../emu/grasscutter/game/managers/forging/ForgingManager.java | 2 +- .../server/packet/send/PacketCreateVehicleRsp.java | 4 ++-- .../server/packet/send/PacketStoreItemDelNotify.java | 2 +- src/main/java/emu/grasscutter/utils/lang/Language.java | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/emu/grasscutter/game/managers/forging/ForgingManager.java b/src/main/java/emu/grasscutter/game/managers/forging/ForgingManager.java index e8edc63b7..07a9685a6 100644 --- a/src/main/java/emu/grasscutter/game/managers/forging/ForgingManager.java +++ b/src/main/java/emu/grasscutter/game/managers/forging/ForgingManager.java @@ -314,6 +314,6 @@ public final class ForgingManager extends BasePlayerManager { this.sendForgeQueueDataNotify(); // Reset changed flags. - this.player.getActiveForges().stream().forEach(forge -> forge.setChanged(false)); + this.player.getActiveForges().forEach(forge -> forge.setChanged(false)); } } diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketCreateVehicleRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketCreateVehicleRsp.java index 3f7a8a088..2d6403e42 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketCreateVehicleRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketCreateVehicleRsp.java @@ -26,13 +26,13 @@ public class PacketCreateVehicleRsp extends BasePacket { && ((EntityVehicle) entity).getOwner().equals(player)) .toList(); - previousVehicles.stream() + previousVehicles .forEach( entity -> { List vehicleMembers = ((EntityVehicle) entity).getVehicleMembers().stream().toList(); - vehicleMembers.stream() + vehicleMembers .forEach( vehicleMember -> player .getScene() diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketStoreItemDelNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketStoreItemDelNotify.java index aa1ea7bed..c1183a935 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketStoreItemDelNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketStoreItemDelNotify.java @@ -29,7 +29,7 @@ public class PacketStoreItemDelNotify extends BasePacket { StoreItemDelNotify.Builder proto = StoreItemDelNotify.newBuilder().setStoreType(StoreType.STORE_TYPE_PACK); - items.stream().forEach(item -> proto.addGuidList(item.getGuid())); + items.forEach(item -> proto.addGuidList(item.getGuid())); this.setData(proto); } diff --git a/src/main/java/emu/grasscutter/utils/lang/Language.java b/src/main/java/emu/grasscutter/utils/lang/Language.java index fe172270e..0ef2207c4 100644 --- a/src/main/java/emu/grasscutter/utils/lang/Language.java +++ b/src/main/java/emu/grasscutter/utils/lang/Language.java @@ -264,7 +264,7 @@ public final class Language { List> languageMaps = IntStream.range(0, TextStrings.NUM_LANGUAGES) .mapToObj(mapLanguageMaps::get) - .collect(Collectors.toList()); + .toList(); Map canonicalTextStrings = new HashMap<>(); return new Int2ObjectOpenHashMap<>(