diff --git a/src/main/java/emu/grasscutter/config/ConfigContainer.java b/src/main/java/emu/grasscutter/config/ConfigContainer.java index 3125796ee..d68936cec 100644 --- a/src/main/java/emu/grasscutter/config/ConfigContainer.java +++ b/src/main/java/emu/grasscutter/config/ConfigContainer.java @@ -68,7 +68,7 @@ public class ConfigContainer { } }); updated.version = version(); - try { // Save configuration & reload. + try { // Save configuration and reload. Grasscutter.saveConfig(updated); Grasscutter.loadConfig(); } catch (Exception exception) { diff --git a/src/main/java/emu/grasscutter/game/ability/actions/ActionSetGlobalValue.java b/src/main/java/emu/grasscutter/game/ability/actions/ActionSetGlobalValue.java index f85e91ff5..bc04e4dee 100644 --- a/src/main/java/emu/grasscutter/game/ability/actions/ActionSetGlobalValue.java +++ b/src/main/java/emu/grasscutter/game/ability/actions/ActionSetGlobalValue.java @@ -11,7 +11,7 @@ public final class ActionSetGlobalValue extends AbilityActionHandler { @Override public boolean execute( Ability ability, AbilityModifierAction action, ByteString abilityData, GameEntity target) { - // Get the key & value. + // Get the key and value. var valueKey = action.key; var value = action.ratio; diff --git a/src/main/java/emu/grasscutter/game/activity/ActivityManager.java b/src/main/java/emu/grasscutter/game/activity/ActivityManager.java index a3da2524b..233f1c587 100644 --- a/src/main/java/emu/grasscutter/game/activity/ActivityManager.java +++ b/src/main/java/emu/grasscutter/game/activity/ActivityManager.java @@ -8,9 +8,10 @@ import emu.grasscutter.game.player.*; import emu.grasscutter.game.props.*; import emu.grasscutter.net.proto.ActivityInfoOuterClass; import emu.grasscutter.server.packet.send.PacketActivityScheduleInfoNotify; +import lombok.Getter; + import java.util.*; import java.util.concurrent.*; -import lombok.Getter; @SuppressWarnings("unchecked") @Getter @@ -26,7 +27,7 @@ public class ActivityManager extends BasePlayerManager { } public static void loadActivityConfigData() { - // scan activity type handler & watcher type + // scan activity type handler and watcher type var activityHandlerTypeMap = new HashMap>(); var activityWatcherTypeMap = new HashMap>(); Grasscutter.reflector diff --git a/src/main/java/emu/grasscutter/game/avatar/Avatar.java b/src/main/java/emu/grasscutter/game/avatar/Avatar.java index fc272ed95..690f86275 100644 --- a/src/main/java/emu/grasscutter/game/avatar/Avatar.java +++ b/src/main/java/emu/grasscutter/game/avatar/Avatar.java @@ -1,7 +1,5 @@ package emu.grasscutter.game.avatar; -import static emu.grasscutter.config.Configuration.GAME_OPTIONS; - import dev.morphia.annotations.*; import emu.grasscutter.GameConstants; import emu.grasscutter.data.GameData; @@ -32,12 +30,15 @@ import emu.grasscutter.net.proto.TrialAvatarInfoOuterClass.TrialAvatarInfo; import emu.grasscutter.server.packet.send.*; import emu.grasscutter.utils.helpers.ProtoHelper; import it.unimi.dsi.fastutil.ints.*; -import java.util.*; -import java.util.stream.Stream; -import javax.annotation.*; import lombok.*; import org.bson.types.ObjectId; +import javax.annotation.*; +import java.util.*; +import java.util.stream.Stream; + +import static emu.grasscutter.config.Configuration.GAME_OPTIONS; + @Entity(value = "avatars", useDiscriminator = false) public class Avatar { @Transient @Getter private final Int2ObjectMap equips; @@ -1299,7 +1300,7 @@ public class Avatar { // Check if the avatar is a trial avatar. if (this.getTrialAvatarId() > 0) { - // Add the artifacts & weapons for the avatar. + // Add the artifacts and weapons for the avatar. trialAvatar.addAllTrialEquipList( this.getEquips().values().stream().map(GameItem::toProto).toList()); } diff --git a/src/main/java/emu/grasscutter/game/quest/BargainRecord.java b/src/main/java/emu/grasscutter/game/quest/BargainRecord.java index 1b41a86b4..89e7a7a7f 100644 --- a/src/main/java/emu/grasscutter/game/quest/BargainRecord.java +++ b/src/main/java/emu/grasscutter/game/quest/BargainRecord.java @@ -71,7 +71,7 @@ public final class BargainRecord { return this.result = BargainResultType.BARGAIN_COMPLETE_SUCC; } - // Compare the offer against the mood & expected price. + // Compare the offer against the mood and expected price. // The mood is out of 100; 1 mood should decrease the price by 100. var moodAdjustment = (int) Math.floor(this.getCurrentMood() / 100.0); var expectedPrice = this.getExpectedPrice() - moodAdjustment; diff --git a/src/main/java/emu/grasscutter/game/quest/GameMainQuest.java b/src/main/java/emu/grasscutter/game/quest/GameMainQuest.java index d2ddc7af3..4ecf6de2c 100644 --- a/src/main/java/emu/grasscutter/game/quest/GameMainQuest.java +++ b/src/main/java/emu/grasscutter/game/quest/GameMainQuest.java @@ -16,11 +16,12 @@ import emu.grasscutter.net.proto.ChildQuestOuterClass.ChildQuest; import emu.grasscutter.net.proto.ParentQuestOuterClass.ParentQuest; import emu.grasscutter.server.packet.send.*; import emu.grasscutter.utils.*; -import java.util.*; -import java.util.stream.Collectors; import lombok.*; import org.bson.types.ObjectId; +import java.util.*; +import java.util.stream.Collectors; + @Entity(value = "quests", useDiscriminator = false) public class GameMainQuest { @Id private ObjectId id; @@ -328,11 +329,11 @@ public class GameMainQuest { } /** - * Checks if the quest has a teleport position. Returns true if it does & adds the target position - * & rotation to the list. + * Checks if the quest has a teleport position. Returns true if it does and adds the target position + * and rotation to the list. * * @param subId The sub-quest ID. - * @param posAndRot A list which will contain the position & rotation if the quest has a teleport. + * @param posAndRot A list which will contain the position and rotation if the quest has a teleport. * @return True if the quest has a teleport position. False otherwise. */ public boolean hasTeleportPosition(int subId, List posAndRot) { @@ -340,7 +341,7 @@ public class GameMainQuest { if (questTransmit == null) return false; TeleportData.TransmitPoint transmitPoint = - questTransmit.getTransmit_points().size() > 0 + !questTransmit.getTransmit_points().isEmpty() ? questTransmit.getTransmit_points().get(0) : null; if (transmitPoint == null) return false; diff --git a/src/main/java/emu/grasscutter/game/quest/QuestManager.java b/src/main/java/emu/grasscutter/game/quest/QuestManager.java index 9817227ba..1e33f2212 100644 --- a/src/main/java/emu/grasscutter/game/quest/QuestManager.java +++ b/src/main/java/emu/grasscutter/game/quest/QuestManager.java @@ -1,8 +1,5 @@ package emu.grasscutter.game.quest; -import static emu.grasscutter.GameConstants.DEBUG; -import static emu.grasscutter.config.Configuration.*; - import emu.grasscutter.Grasscutter; import emu.grasscutter.data.GameData; import emu.grasscutter.data.binout.*; @@ -15,12 +12,16 @@ import emu.grasscutter.net.proto.GivingRecordOuterClass.GivingRecord; import emu.grasscutter.server.packet.send.*; import io.netty.util.concurrent.FastThreadLocalThread; import it.unimi.dsi.fastutil.ints.*; +import lombok.*; + +import javax.annotation.Nonnull; import java.util.*; import java.util.concurrent.*; import java.util.function.Consumer; import java.util.stream.Collectors; -import javax.annotation.Nonnull; -import lombok.*; + +import static emu.grasscutter.GameConstants.DEBUG; +import static emu.grasscutter.config.Configuration.*; public final class QuestManager extends BasePlayerManager { @Getter private final Player player; @@ -57,7 +58,7 @@ public final class QuestManager extends BasePlayerManager { this.loggedQuests.addAll( List.of( 31101, // Quest which holds talks 30902 and 30904. - 35001, // Quest which unlocks world border & starts act 2. + 35001, // Quest which unlocks world border and starts act 2. 30901, // Quest which is completed upon finishing all 3 initial dungeons. 30903, // Quest which is finished when re-entering scene 3. (home world) 30904, // Quest which unlocks the Adventurers' Guild diff --git a/src/main/java/emu/grasscutter/game/world/World.java b/src/main/java/emu/grasscutter/game/world/World.java index c89b0f670..5e5b11798 100644 --- a/src/main/java/emu/grasscutter/game/world/World.java +++ b/src/main/java/emu/grasscutter/game/world/World.java @@ -1,7 +1,5 @@ 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.entity.*; @@ -20,10 +18,13 @@ import emu.grasscutter.server.game.GameServer; import emu.grasscutter.server.packet.send.*; import emu.grasscutter.utils.ConversionUtils; import it.unimi.dsi.fastutil.ints.*; -import java.util.*; import lombok.*; import org.jetbrains.annotations.NotNull; +import java.util.*; + +import static emu.grasscutter.server.event.player.PlayerTeleportEvent.TeleportType.SCRIPT; + public class World implements Iterable { @Getter private final GameServer server; @Getter private Player host; @@ -386,7 +387,7 @@ public class World implements Iterable { // Call player teleport event. PlayerTeleportEvent event = new PlayerTeleportEvent(player, teleportProperties, player.getPosition()); - // Call event & check if it was canceled. + // Call event and check if it was canceled. event.call(); if (event.isCanceled()) { return false; // Teleport was canceled. diff --git a/src/main/java/emu/grasscutter/server/http/dispatch/RegionHandler.java b/src/main/java/emu/grasscutter/server/http/dispatch/RegionHandler.java index 7368ac0c0..8cef49fec 100644 --- a/src/main/java/emu/grasscutter/server/http/dispatch/RegionHandler.java +++ b/src/main/java/emu/grasscutter/server/http/dispatch/RegionHandler.java @@ -1,7 +1,5 @@ package emu.grasscutter.server.http.dispatch; -import static emu.grasscutter.config.Configuration.*; - import com.google.gson.*; import com.google.protobuf.ByteString; import emu.grasscutter.*; @@ -18,11 +16,14 @@ import emu.grasscutter.server.http.objects.QueryCurRegionRspJson; import emu.grasscutter.utils.*; import io.javalin.Javalin; import io.javalin.http.Context; +import org.slf4j.Logger; + import java.time.Instant; import java.util.*; import java.util.concurrent.ConcurrentHashMap; import java.util.regex.Pattern; -import org.slf4j.Logger; + +import static emu.grasscutter.config.Configuration.*; /** Handles requests related to region queries. */ public final class RegionHandler implements Router { @@ -31,7 +32,7 @@ public final class RegionHandler implements Router { private static String regionListResponseCN; public RegionHandler() { - try { // Read & initialize region data. + try { // Read and initialize region data. this.initialize(); } catch (Exception exception) { Grasscutter.getLogger().error("Failed to initialize region data.", exception);