diff --git a/src/main/java/emu/grasscutter/command/commands/AchievementCommand.java b/src/main/java/emu/grasscutter/command/commands/AchievementCommand.java index 7510895e5..c78425c90 100644 --- a/src/main/java/emu/grasscutter/command/commands/AchievementCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/AchievementCommand.java @@ -136,20 +136,18 @@ public final class AchievementCommand implements CommandHandler { parseInt(args.remove(0)) .ifPresentOrElse( - integer -> { - parseInt(args.remove(0)) - .ifPresentOrElse( - progress -> { - var ret = achievements.progress(integer, progress); - switch (ret.getRet()) { - case SUCCESS -> sendSuccessMessage( - sender, "progress", targetPlayer.getNickname(), integer, progress); - case ACHIEVEMENT_NOT_FOUND -> CommandHandler.sendTranslatedMessage( - sender, ret.getRet().getKey()); - } - }, - () -> this.sendUsageMessage(sender)); - }, + integer -> parseInt(args.remove(0)) + .ifPresentOrElse( + progress -> { + var ret = achievements.progress(integer, progress); + switch (ret.getRet()) { + case SUCCESS -> sendSuccessMessage( + sender, "progress", targetPlayer.getNickname(), integer, progress); + case ACHIEVEMENT_NOT_FOUND -> CommandHandler.sendTranslatedMessage( + sender, ret.getRet().getKey()); + } + }, + () -> this.sendUsageMessage(sender)), () -> this.sendUsageMessage(sender)); } } diff --git a/src/main/java/emu/grasscutter/command/commands/SetSceneTagCommand.java b/src/main/java/emu/grasscutter/command/commands/SetSceneTagCommand.java index fb743f0f8..d16c97213 100644 --- a/src/main/java/emu/grasscutter/command/commands/SetSceneTagCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/SetSceneTagCommand.java @@ -95,9 +95,7 @@ public final class SetSceneTagCommand implements CommandHandler { // Only remove for big world as some other scenes only have defaults .filter(sceneTag -> sceneTag.getSceneId() == 3) .forEach( - sceneTag -> { - targetPlayer.getSceneTags().get(sceneTag.getSceneId()).remove(sceneTag.getId()); - }); + sceneTag -> targetPlayer.getSceneTags().get(sceneTag.getSceneId()).remove(sceneTag.getId())); this.setSceneTags(targetPlayer); } diff --git a/src/main/java/emu/grasscutter/data/ResourceLoader.java b/src/main/java/emu/grasscutter/data/ResourceLoader.java index 5db5d09b8..13be4c4a2 100644 --- a/src/main/java/emu/grasscutter/data/ResourceLoader.java +++ b/src/main/java/emu/grasscutter/data/ResourceLoader.java @@ -140,25 +140,23 @@ public final class ResourceLoader { getResourceDefClassesPrioritySets() .forEach( - classes -> { - classes.stream() - .parallel() - .unordered() - .forEach( - c -> { - val type = c.getAnnotation(ResourceType.class); - if (type == null) return; + classes -> classes.stream() + .parallel() + .unordered() + .forEach( + c -> { + val type = c.getAnnotation(ResourceType.class); + if (type == null) return; - val map = GameData.getMapByResourceDef(c); - if (map == null) return; + val map = GameData.getMapByResourceDef(c); + if (map == null) return; - try { - loadFromResource(c, type, map, doReload); - } catch (Exception e) { - errors.add(Pair.of(Arrays.toString(type.name()), e)); - } - }); - }); + try { + loadFromResource(c, type, map, doReload); + } catch (Exception e) { + errors.add(Pair.of(Arrays.toString(type.name()), e)); + } + })); errors.forEach( pair -> Grasscutter.getLogger() diff --git a/src/main/java/emu/grasscutter/game/achievement/Achievements.java b/src/main/java/emu/grasscutter/game/achievement/Achievements.java index 929c382cb..40b180bb0 100644 --- a/src/main/java/emu/grasscutter/game/achievement/Achievements.java +++ b/src/main/java/emu/grasscutter/game/achievement/Achievements.java @@ -61,11 +61,9 @@ public class Achievements { GameData.getAchievementDataMap().values().stream() .filter(AchievementData::isUsed) .forEach( - a -> { - map.put( - a.getId(), - new Achievement(Status.STATUS_UNFINISHED, a.getId(), a.getProgress(), 0, 0)); - }); + a -> map.put( + a.getId(), + new Achievement(Status.STATUS_UNFINISHED, a.getId(), a.getProgress(), 0, 0))); return map; } @@ -177,14 +175,12 @@ public class Achievements { return this.getAchievementList() .computeIfAbsent( achievementId, - id -> { - return new Achievement( - Status.STATUS_UNFINISHED, - id, - GameData.getAchievementDataMap().get(id.intValue()).getProgress(), - 0, - 0); - }); + id -> new Achievement( + Status.STATUS_UNFINISHED, + id, + GameData.getAchievementDataMap().get(id.intValue()).getProgress(), + 0, + 0)); } public boolean isInvalid(int achievementId) { diff --git a/src/main/java/emu/grasscutter/game/avatar/Avatar.java b/src/main/java/emu/grasscutter/game/avatar/Avatar.java index fe3b5e424..a3070c609 100644 --- a/src/main/java/emu/grasscutter/game/avatar/Avatar.java +++ b/src/main/java/emu/grasscutter/game/avatar/Avatar.java @@ -776,12 +776,10 @@ public class Avatar { Stream.of(entry.getSkillPointModifiers()) .mapToInt(SkillPointModifier::getSkillId) .forEach( - skillId -> { - this.getPlayer() - .sendPacket( - new PacketAvatarSkillMaxChargeCountNotify( - this, skillId, this.getSkillExtraChargeMap().getOrDefault(skillId, 0))); - }); + skillId -> this.getPlayer() + .sendPacket( + new PacketAvatarSkillMaxChargeCountNotify( + this, skillId, this.getSkillExtraChargeMap().getOrDefault(skillId, 0)))); } } diff --git a/src/main/java/emu/grasscutter/game/combine/CombineManger.java b/src/main/java/emu/grasscutter/game/combine/CombineManger.java index 08305cae1..9fff60cf2 100644 --- a/src/main/java/emu/grasscutter/game/combine/CombineManger.java +++ b/src/main/java/emu/grasscutter/game/combine/CombineManger.java @@ -28,9 +28,7 @@ public class CombineManger extends BaseGameSystem { try { DataLoader.loadList("ReliquaryDecompose.json", ReliquaryDecomposeEntry.class) .forEach( - entry -> { - reliquaryDecomposeData.put(entry.getConfigId(), entry.getItems()); - }); + entry -> reliquaryDecomposeData.put(entry.getConfigId(), entry.getItems())); Grasscutter.getLogger() .debug("Loaded {} reliquary decompose entries.", reliquaryDecomposeData.size()); } catch (Exception ex) { diff --git a/src/main/java/emu/grasscutter/game/home/GameHome.java b/src/main/java/emu/grasscutter/game/home/GameHome.java index 10d488aa2..fd6ce6368 100644 --- a/src/main/java/emu/grasscutter/game/home/GameHome.java +++ b/src/main/java/emu/grasscutter/game/home/GameHome.java @@ -281,12 +281,10 @@ public class GameHome { return this.finishedTalkIdMap.entrySet().stream() .map( - e -> { - return HomeAvatarTalkFinishInfo.newBuilder() - .setAvatarId(e.getKey()) - .addAllFinishTalkIdList(e.getValue()) - .build(); - }) + e -> HomeAvatarTalkFinishInfo.newBuilder() + .setAvatarId(e.getKey()) + .addAllFinishTalkIdList(e.getValue()) + .build()) .toList(); } @@ -395,13 +393,9 @@ public class GameHome { .get(player.getCurrentRealmId() + 2000) .getBlockItems() .forEach( - (i, e) -> { - e.getDeployNPCList() - .forEach( - id -> { - invitedAvatars.add(id.getAvatarId()); - }); - }); + (i, e) -> e.getDeployNPCList() + .forEach( + id -> invitedAvatars.add(id.getAvatarId()))); // Check as realm 5 inside is not in defaults and will be null if (Objects.nonNull(mainHouseMap.get(player.getCurrentRealmId() + 2000))) { @@ -410,13 +404,9 @@ public class GameHome { .get(player.getCurrentRealmId() + 2000) .getBlockItems() .forEach( - (i, e) -> { - e.getDeployNPCList() - .forEach( - id -> { - invitedAvatars.add(id.getAvatarId()); - }); - }); + (i, e) -> e.getDeployNPCList() + .forEach( + id -> invitedAvatars.add(id.getAvatarId()))); } // Add exp to all avatars diff --git a/src/main/java/emu/grasscutter/game/home/HomeModuleManager.java b/src/main/java/emu/grasscutter/game/home/HomeModuleManager.java index 6d824d584..9297ce1fd 100644 --- a/src/main/java/emu/grasscutter/game/home/HomeModuleManager.java +++ b/src/main/java/emu/grasscutter/game/home/HomeModuleManager.java @@ -93,26 +93,24 @@ public class HomeModuleManager { .map(HomeBlockItem::getDeployNPCList) .flatMap(Collection::stream) .forEach( - avatar -> { - suites.forEach( - suite -> { - var data = - SuiteEventType.HOME_AVATAR_REWARD_EVENT.getEventDataFrom( - avatar.getAvatarId(), suite.getSuiteId()); - if (data == null || this.home.isRewardEventFinished(data.getId())) { - return; - } + avatar -> suites.forEach( + suite -> { + var data = + SuiteEventType.HOME_AVATAR_REWARD_EVENT.getEventDataFrom( + avatar.getAvatarId(), suite.getSuiteId()); + if (data == null || this.home.isRewardEventFinished(data.getId())) { + return; + } - this.rewardEvents.add( - new HomeAvatarRewardEvent( - homeOwner, - data.getId(), - data.getRewardID(), - data.getAvatarID(), - data.getSuiteId(), - suite.getGuid())); - }); - }); + this.rewardEvents.add( + new HomeAvatarRewardEvent( + homeOwner, + data.getId(), + data.getRewardID(), + data.getAvatarID(), + data.getSuiteId(), + suite.getGuid())); + })); if (this.summonEvents != null) { var suiteIdList = this.rewardEvents.stream().map(HomeAvatarRewardEvent::getSuiteId).toList(); diff --git a/src/main/java/emu/grasscutter/game/home/HomeSceneItem.java b/src/main/java/emu/grasscutter/game/home/HomeSceneItem.java index 111dba9cf..1b0acee86 100644 --- a/src/main/java/emu/grasscutter/game/home/HomeSceneItem.java +++ b/src/main/java/emu/grasscutter/game/home/HomeSceneItem.java @@ -103,13 +103,11 @@ public class HomeSceneItem { homeAnimalItem -> GameData.getHomeWorldAnimalDataMap().containsKey(homeAnimalItem.getFurnitureId())) .map( - homeAnimalItem -> { - return new EntityHomeAnimal( - scene, - GameData.getHomeWorldAnimalDataMap().get(homeAnimalItem.getFurnitureId()), - homeAnimalItem.getSpawnPos(), - homeAnimalItem.getSpawnRot()); - }) + homeAnimalItem -> new EntityHomeAnimal( + scene, + GameData.getHomeWorldAnimalDataMap().get(homeAnimalItem.getFurnitureId()), + homeAnimalItem.getSpawnPos(), + homeAnimalItem.getSpawnRot())) .toList(); } diff --git a/src/main/java/emu/grasscutter/game/managers/energy/EnergyManager.java b/src/main/java/emu/grasscutter/game/managers/energy/EnergyManager.java index 8be641b19..981f87881 100644 --- a/src/main/java/emu/grasscutter/game/managers/energy/EnergyManager.java +++ b/src/main/java/emu/grasscutter/game/managers/energy/EnergyManager.java @@ -46,9 +46,7 @@ public class EnergyManager extends BasePlayerManager { try { DataLoader.loadList("EnergyDrop.json", EnergyDropEntry.class) .forEach( - entry -> { - energyDropData.put(entry.getDropId(), entry.getDropList()); - }); + entry -> energyDropData.put(entry.getDropId(), entry.getDropList())); Grasscutter.getLogger().debug("Energy drop data successfully loaded."); } catch (Exception ex) { @@ -59,9 +57,7 @@ public class EnergyManager extends BasePlayerManager { try { DataLoader.loadList("SkillParticleGeneration.json", SkillParticleGenerationEntry.class) .forEach( - entry -> { - skillParticleGenerationData.put(entry.getAvatarId(), entry.getAmountList()); - }); + entry -> skillParticleGenerationData.put(entry.getAvatarId(), entry.getAmountList())); Grasscutter.getLogger().debug("Skill particle generation data successfully loaded."); } catch (Exception ex) { diff --git a/src/main/java/emu/grasscutter/game/props/ItemUseOp.java b/src/main/java/emu/grasscutter/game/props/ItemUseOp.java index 7ff42db0b..6fd704e6a 100644 --- a/src/main/java/emu/grasscutter/game/props/ItemUseOp.java +++ b/src/main/java/emu/grasscutter/game/props/ItemUseOp.java @@ -52,9 +52,7 @@ public enum ItemUseOp { static { Stream.of(values()) .forEach( - e -> { - map.put(e.getValue(), e); - }); + e -> map.put(e.getValue(), e)); } private final int value; diff --git a/src/main/java/emu/grasscutter/game/props/ItemUseTarget.java b/src/main/java/emu/grasscutter/game/props/ItemUseTarget.java index 99641d085..c1eda8fa3 100644 --- a/src/main/java/emu/grasscutter/game/props/ItemUseTarget.java +++ b/src/main/java/emu/grasscutter/game/props/ItemUseTarget.java @@ -16,9 +16,7 @@ public enum ItemUseTarget { static { Stream.of(values()) .forEach( - e -> { - map.put(e.getValue(), e); - }); + e -> map.put(e.getValue(), e)); } private final int value; diff --git a/src/main/java/emu/grasscutter/game/props/ServerBuffType.java b/src/main/java/emu/grasscutter/game/props/ServerBuffType.java index b9a082590..7393fbf9d 100644 --- a/src/main/java/emu/grasscutter/game/props/ServerBuffType.java +++ b/src/main/java/emu/grasscutter/game/props/ServerBuffType.java @@ -14,9 +14,7 @@ public enum ServerBuffType { static { Stream.of(values()) .forEach( - e -> { - map.put(e.getValue(), e); - }); + e -> map.put(e.getValue(), e)); } private final int value; diff --git a/src/main/java/emu/grasscutter/game/quest/GameQuest.java b/src/main/java/emu/grasscutter/game/quest/GameQuest.java index 6ac1d1313..d4b9e4839 100644 --- a/src/main/java/emu/grasscutter/game/quest/GameQuest.java +++ b/src/main/java/emu/grasscutter/game/quest/GameQuest.java @@ -295,9 +295,7 @@ public class GameQuest { getMainQuest().getChildQuests().values().stream() .filter(p -> p.getQuestData().getOrder() > this.getQuestData().getOrder()) .forEach( - q -> { - q.clearProgress(notifyDelete); - }); + q -> q.clearProgress(notifyDelete)); clearProgress(notifyDelete); this.start(); return true; diff --git a/src/main/java/emu/grasscutter/scripts/ScriptLib.java b/src/main/java/emu/grasscutter/scripts/ScriptLib.java index e5ce947df..6eaac1849 100644 --- a/src/main/java/emu/grasscutter/scripts/ScriptLib.java +++ b/src/main/java/emu/grasscutter/scripts/ScriptLib.java @@ -632,9 +632,7 @@ public class ScriptLib { worktop.removeWorktopOption(callParams.param2); var scene = getSceneScriptManager().getScene(); - Grasscutter.getGameServer().getScheduler().scheduleDelayedTask(() -> { - scene.broadcastPacket(new PacketWorktopOptionNotify(gadget)); - }, 1); + Grasscutter.getGameServer().getScheduler().scheduleDelayedTask(() -> scene.broadcastPacket(new PacketWorktopOptionNotify(gadget)), 1); return 0; } diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerHomeKickPlayerReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerHomeKickPlayerReq.java index 6e80b6fb2..f0b084f27 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerHomeKickPlayerReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerHomeKickPlayerReq.java @@ -17,13 +17,11 @@ public class HandlerHomeKickPlayerReq extends PacketHandler { .filter(player -> player.getUid() == req.getTargetUid()) .findFirst() .ifPresent( - player -> { - success.set( - session - .getServer() - .getHomeWorldMPSystem() - .kickPlayerFromHome(session.getPlayer(), player.getUid())); - }); + player -> success.set( + session + .getServer() + .getHomeWorldMPSystem() + .kickPlayerFromHome(session.getPlayer(), player.getUid()))); session.send( new PacketHomeKickPlayerRsp( diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketActivityScheduleInfoNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketActivityScheduleInfoNotify.java index 08908c5cb..f50d1b022 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketActivityScheduleInfoNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketActivityScheduleInfoNotify.java @@ -14,16 +14,14 @@ public class PacketActivityScheduleInfoNotify extends BasePacket { var proto = ActivityScheduleInfoNotifyOuterClass.ActivityScheduleInfoNotify.newBuilder(); activityConfigItemList.forEach( - item -> { - proto.addActivityScheduleList( - ActivityScheduleInfoOuterClass.ActivityScheduleInfo.newBuilder() - .setActivityId(item.getActivityId()) - .setScheduleId(item.getScheduleId()) - .setIsOpen(true) - .setBeginTime(DateHelper.getUnixTime(item.getBeginTime())) - .setEndTime(DateHelper.getUnixTime(item.getEndTime())) - .build()); - }); + item -> proto.addActivityScheduleList( + ActivityScheduleInfoOuterClass.ActivityScheduleInfo.newBuilder() + .setActivityId(item.getActivityId()) + .setScheduleId(item.getScheduleId()) + .setIsOpen(true) + .setBeginTime(DateHelper.getUnixTime(item.getBeginTime())) + .setEndTime(DateHelper.getUnixTime(item.getEndTime())) + .build())); this.setData(proto); } diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketBattlePassMissionUpdateNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketBattlePassMissionUpdateNotify.java index 1d65c6bc5..74a02ea09 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketBattlePassMissionUpdateNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketBattlePassMissionUpdateNotify.java @@ -22,9 +22,7 @@ public class PacketBattlePassMissionUpdateNotify extends BasePacket { var proto = BattlePassMissionUpdateNotify.newBuilder(); missions.forEach( - mission -> { - proto.addMissionList(mission.toProto()); - }); + mission -> proto.addMissionList(mission.toProto())); this.setData(proto.build()); } diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketCodexDataFullNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketCodexDataFullNotify.java index 14e2755a2..67e464d03 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketCodexDataFullNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketCodexDataFullNotify.java @@ -93,11 +93,9 @@ public class PacketCodexDataFullNotify extends BasePacket { .getCodex() .getUnlockedReliquarySuitCodex() .forEach( - reliquarySuit -> { - reliquaryData - .addCodexIdList(reliquarySuit) - .addAllHaveViewedList(Collections.singleton(true)); - }); + reliquarySuit -> reliquaryData + .addCodexIdList(reliquarySuit) + .addAllHaveViewedList(Collections.singleton(true))); CodexDataFullNotify.Builder proto = CodexDataFullNotify.newBuilder() 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 6d9537e19..3f7a8a088 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketCreateVehicleRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketCreateVehicleRsp.java @@ -34,16 +34,14 @@ public class PacketCreateVehicleRsp extends BasePacket { vehicleMembers.stream() .forEach( - vehicleMember -> { - player - .getScene() - .broadcastPacket( - new PacketVehicleInteractRsp( - ((EntityVehicle) entity), - vehicleMember, - VehicleInteractTypeOuterClass.VehicleInteractType - .VEHICLE_INTERACT_TYPE_OUT)); - }); + vehicleMember -> player + .getScene() + .broadcastPacket( + new PacketVehicleInteractRsp( + ((EntityVehicle) entity), + vehicleMember, + VehicleInteractTypeOuterClass.VehicleInteractType + .VEHICLE_INTERACT_TYPE_OUT))); player.getScene().killEntity(entity, 0); }); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerDataNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerDataNotify.java index dca56bf9b..6d25619cd 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerDataNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerDataNotify.java @@ -20,10 +20,8 @@ public class PacketPlayerDataNotify extends BasePacket { player .getProperties() .forEach( - (key, value) -> { - p.putPropMap( - key, PropValue.newBuilder().setType(key).setIval(value).setVal(value).build()); - }); + (key, value) -> p.putPropMap( + key, PropValue.newBuilder().setType(key).setIval(value).setVal(value).build())); this.setData(p.build()); } diff --git a/src/main/java/emu/grasscutter/tools/Tools.java b/src/main/java/emu/grasscutter/tools/Tools.java index ab382e59a..35b9a4e54 100644 --- a/src/main/java/emu/grasscutter/tools/Tools.java +++ b/src/main/java/emu/grasscutter/tools/Tools.java @@ -189,12 +189,10 @@ public final class Tools { achievementDataMap.values().stream() .filter(AchievementData::isUsed) .forEach( - data -> { - h.newTranslatedLine( - padAchievementId.formatted(data.getId()) + "{0} - {1}", - data.getTitleTextMapHash(), - data.getDescTextMapHash()); - }); + data -> h.newTranslatedLine( + padAchievementId.formatted(data.getId()) + "{0} - {1}", + data.getTitleTextMapHash(), + data.getDescTextMapHash())); // Write txt files for (int i = 0; i < TextStrings.NUM_LANGUAGES; i++) { @@ -352,14 +350,12 @@ public final class Tools { try { Files.newDirectoryStream(getResourcePath("TextMap"), "TextMap*.json") .forEach( - path -> { - availableLangList.add( - path.getFileName() - .toString() - .replace("TextMap", "") - .replace(".json", "") - .toLowerCase()); - }); + path -> availableLangList.add( + path.getFileName() + .toString() + .replace("TextMap", "") + .replace(".json", "") + .toLowerCase())); } catch (IOException e) { Grasscutter.getLogger().error("Failed to get available languages:", e); }