From c08ab19d848c517ca4beaaaee6485721813510ca Mon Sep 17 00:00:00 2001 From: KingRainbow44 Date: Sat, 2 Sep 2023 19:49:38 -0400 Subject: [PATCH] Various removals of '&' for Javadoc to be happy --- .../emu/grasscutter/config/ConfigContainer.java | 2 +- .../game/ability/actions/ActionSetGlobalValue.java | 2 +- .../grasscutter/game/activity/ActivityManager.java | 5 +++-- .../java/emu/grasscutter/game/avatar/Avatar.java | 13 +++++++------ .../emu/grasscutter/game/quest/BargainRecord.java | 2 +- .../emu/grasscutter/game/quest/GameMainQuest.java | 13 +++++++------ .../emu/grasscutter/game/quest/QuestManager.java | 13 +++++++------ src/main/java/emu/grasscutter/game/world/World.java | 9 +++++---- .../server/http/dispatch/RegionHandler.java | 9 +++++---- 9 files changed, 37 insertions(+), 31 deletions(-) diff --git a/src/main/java/emu/grasscutter/config/ConfigContainer.java b/src/main/java/emu/grasscutter/config/ConfigContainer.java index 3125796eef7..d68936cec10 100644 --- a/src/main/java/emu/grasscutter/config/ConfigContainer.java +++ b/src/main/java/emu/grasscutter/config/ConfigContainer.java @@ -68,7 +68,7 @@ public static void updateConfig() { } }); 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 f85e91ff536..bc04e4dee81 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 a3da2524b97..233f1c587e3 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.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 fc272ed9562..690f86275ad 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.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 TrialAvatarInfo toTrialInfo() { // 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 1b41a86b45e..89e7a7a7faf 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 BargainResultType applyOffer(int offer) { 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 d2ddc7af33a..4ecf6de2c08 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.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 boolean hasRewindPosition(int subId, List posAndRot) { } /** - * 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 boolean hasTeleportPosition(int subId, List posAndRot) { 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 9817227ba4a..1e33f2212a7 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.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 QuestManager(Player player) { 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 c89b0f670c6..5e5b1179820 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.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 boolean transferPlayerToScene(Player player, TeleportProperties teleportP // 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 7368ac0c0db..8cef49fec59 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.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);