From 9bd833c6e730e02059768baf5417e5504b6ad876 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 1 Jun 2023 02:30:23 +0000 Subject: [PATCH] Format code [skip actions] --- .../emu/grasscutter/data/ResourceLoader.java | 13 +++++---- .../data/binout/AbilityModifier.java | 3 +-- .../emu/grasscutter/game/ability/Ability.java | 7 +++-- .../game/ability/AbilityManager.java | 10 +++---- .../actions/ActionAvatarSkillStart.java | 4 +-- .../game/activity/ActivityManager.java | 5 ++-- .../grasscutter/game/entity/EntityAvatar.java | 3 +-- .../grasscutter/game/entity/GameEntity.java | 7 ++--- .../game/player/PlayerProgressManager.java | 27 ++++++++++--------- .../grasscutter/game/quest/GameMainQuest.java | 8 +++--- .../emu/grasscutter/game/quest/GameQuest.java | 9 +++---- .../emu/grasscutter/plugin/PluginConfig.java | 3 +-- .../emu/grasscutter/plugin/PluginManager.java | 21 +++++++++------ 13 files changed, 57 insertions(+), 63 deletions(-) diff --git a/src/main/java/emu/grasscutter/data/ResourceLoader.java b/src/main/java/emu/grasscutter/data/ResourceLoader.java index debb00572..c967fe0a1 100644 --- a/src/main/java/emu/grasscutter/data/ResourceLoader.java +++ b/src/main/java/emu/grasscutter/data/ResourceLoader.java @@ -1,5 +1,8 @@ package emu.grasscutter.data; +import static emu.grasscutter.utils.FileUtils.*; +import static emu.grasscutter.utils.lang.Language.translate; + import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; import emu.grasscutter.Grasscutter; @@ -19,10 +22,6 @@ import emu.grasscutter.scripts.*; import emu.grasscutter.utils.*; import it.unimi.dsi.fastutil.Pair; import it.unimi.dsi.fastutil.ints.*; -import lombok.*; -import org.reflections.Reflections; - -import javax.script.*; import java.io.*; import java.nio.file.*; import java.util.*; @@ -30,9 +29,9 @@ import java.util.Map.Entry; import java.util.concurrent.*; import java.util.regex.Pattern; import java.util.stream.*; - -import static emu.grasscutter.utils.FileUtils.*; -import static emu.grasscutter.utils.lang.Language.translate; +import javax.script.*; +import lombok.*; +import org.reflections.Reflections; public final class ResourceLoader { diff --git a/src/main/java/emu/grasscutter/data/binout/AbilityModifier.java b/src/main/java/emu/grasscutter/data/binout/AbilityModifier.java index 14c4b8704..7986f851d 100644 --- a/src/main/java/emu/grasscutter/data/binout/AbilityModifier.java +++ b/src/main/java/emu/grasscutter/data/binout/AbilityModifier.java @@ -3,9 +3,8 @@ package emu.grasscutter.data.binout; import com.google.gson.annotations.SerializedName; import emu.grasscutter.data.common.DynamicFloat; import emu.grasscutter.game.props.ElementType; -import lombok.ToString; - import java.io.Serializable; +import lombok.ToString; public class AbilityModifier implements Serializable { private static final long serialVersionUID = -2001232313615923575L; diff --git a/src/main/java/emu/grasscutter/game/ability/Ability.java b/src/main/java/emu/grasscutter/game/ability/Ability.java index be292c7e2..4bd07c8fd 100644 --- a/src/main/java/emu/grasscutter/game/ability/Ability.java +++ b/src/main/java/emu/grasscutter/game/ability/Ability.java @@ -7,9 +7,8 @@ import emu.grasscutter.game.player.Player; import emu.grasscutter.net.proto.AbilityStringOuterClass.AbilityString; import emu.grasscutter.utils.Utils; import it.unimi.dsi.fastutil.objects.*; -import lombok.Getter; - import java.util.*; +import lombok.Getter; public class Ability { @Getter private AbilityData data; @@ -56,7 +55,7 @@ public class Ability { @Override public String toString() { - return "Ability Name: %s; Entity Owner: %s; Player Owner: %s".formatted( - data.abilityName, owner, playerOwner); + return "Ability Name: %s; Entity Owner: %s; Player Owner: %s" + .formatted(data.abilityName, owner, playerOwner); } } diff --git a/src/main/java/emu/grasscutter/game/ability/AbilityManager.java b/src/main/java/emu/grasscutter/game/ability/AbilityManager.java index 72f814c74..e525c6410 100644 --- a/src/main/java/emu/grasscutter/game/ability/AbilityManager.java +++ b/src/main/java/emu/grasscutter/game/ability/AbilityManager.java @@ -17,11 +17,10 @@ import emu.grasscutter.net.proto.AbilityScalarTypeOuterClass.AbilityScalarType; import emu.grasscutter.net.proto.AbilityScalarValueEntryOuterClass.AbilityScalarValueEntry; import emu.grasscutter.net.proto.ModifierActionOuterClass.ModifierAction; import io.netty.util.concurrent.FastThreadLocalThread; -import lombok.Getter; -import org.reflections.Reflections; - import java.util.HashMap; import java.util.concurrent.*; +import lombok.Getter; +import org.reflections.Reflections; public final class AbilityManager extends BasePlayerManager { @@ -491,8 +490,9 @@ public final class AbilityManager extends BasePlayerManager { if (!Float.isNaN(entry.getFloatValue())) entity.getGlobalAbilityValues().put(key, entry.getFloatValue()); } - case AbilityScalarType.ABILITY_SCALAR_TYPE_UINT_VALUE -> - entity.getGlobalAbilityValues().put(key, (float) entry.getUintValue()); + case AbilityScalarType.ABILITY_SCALAR_TYPE_UINT_VALUE -> entity + .getGlobalAbilityValues() + .put(key, (float) entry.getUintValue()); default -> { return; } diff --git a/src/main/java/emu/grasscutter/game/ability/actions/ActionAvatarSkillStart.java b/src/main/java/emu/grasscutter/game/ability/actions/ActionAvatarSkillStart.java index 6899d2e09..8280bf45f 100644 --- a/src/main/java/emu/grasscutter/game/ability/actions/ActionAvatarSkillStart.java +++ b/src/main/java/emu/grasscutter/game/ability/actions/ActionAvatarSkillStart.java @@ -9,9 +9,7 @@ import emu.grasscutter.game.entity.GameEntity; public final class ActionAvatarSkillStart extends AbilityActionHandler { @Override public boolean execute( - Ability ability, AbilityModifierAction action, - ByteString abilityData, GameEntity target - ) { + Ability ability, AbilityModifierAction action, ByteString abilityData, GameEntity target) { return false; } } diff --git a/src/main/java/emu/grasscutter/game/activity/ActivityManager.java b/src/main/java/emu/grasscutter/game/activity/ActivityManager.java index a342a4ff1..5a19f3036 100644 --- a/src/main/java/emu/grasscutter/game/activity/ActivityManager.java +++ b/src/main/java/emu/grasscutter/game/activity/ActivityManager.java @@ -8,11 +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 org.reflections.Reflections; - import java.util.*; import java.util.concurrent.*; +import lombok.Getter; +import org.reflections.Reflections; @Getter public class ActivityManager extends BasePlayerManager { diff --git a/src/main/java/emu/grasscutter/game/entity/EntityAvatar.java b/src/main/java/emu/grasscutter/game/entity/EntityAvatar.java index d567ae378..a6517582c 100644 --- a/src/main/java/emu/grasscutter/game/entity/EntityAvatar.java +++ b/src/main/java/emu/grasscutter/game/entity/EntityAvatar.java @@ -401,8 +401,7 @@ public class EntityAvatar extends GameEntity { var count = this.getGlobalAbilityValues().get("_ABILITY_UziExplode_Count"); if (count == 2f) { this.getGlobalAbilityValues().remove("_ABILITY_UziExplode_Count"); - this.getPlayer().getQuestManager() - .queueEvent(QuestContent.QUEST_CONTENT_SKILL, 10006); + this.getPlayer().getQuestManager().queueEvent(QuestContent.QUEST_CONTENT_SKILL, 10006); } } } diff --git a/src/main/java/emu/grasscutter/game/entity/GameEntity.java b/src/main/java/emu/grasscutter/game/entity/GameEntity.java index 5e66c6b91..b33840f71 100644 --- a/src/main/java/emu/grasscutter/game/entity/GameEntity.java +++ b/src/main/java/emu/grasscutter/game/entity/GameEntity.java @@ -14,9 +14,8 @@ import emu.grasscutter.scripts.data.controller.EntityController; import emu.grasscutter.server.event.entity.*; import emu.grasscutter.server.packet.send.PacketEntityFightPropUpdateNotify; import it.unimi.dsi.fastutil.ints.*; -import lombok.*; - import java.util.*; +import lombok.*; public abstract class GameEntity { @Getter private final Scene scene; @@ -256,9 +255,7 @@ public abstract class GameEntity { } } - /** - * Invoked when a global ability value is updated. - */ + /** Invoked when a global ability value is updated. */ public void onAbilityValueUpdate() { // Does nothing. } diff --git a/src/main/java/emu/grasscutter/game/player/PlayerProgressManager.java b/src/main/java/emu/grasscutter/game/player/PlayerProgressManager.java index 63c83f7cb..e2872787a 100644 --- a/src/main/java/emu/grasscutter/game/player/PlayerProgressManager.java +++ b/src/main/java/emu/grasscutter/game/player/PlayerProgressManager.java @@ -1,5 +1,8 @@ package emu.grasscutter.game.player; +import static emu.grasscutter.config.Configuration.GAME_OPTIONS; +import static emu.grasscutter.scripts.constants.EventType.EVENT_UNLOCK_TRANS_POINT; + import emu.grasscutter.data.GameData; import emu.grasscutter.data.binout.ScenePointEntry; import emu.grasscutter.data.excels.OpenStateData; @@ -9,13 +12,9 @@ import emu.grasscutter.game.quest.enums.*; import emu.grasscutter.net.proto.RetcodeOuterClass.Retcode; import emu.grasscutter.scripts.data.ScriptArgs; import emu.grasscutter.server.packet.send.*; - import java.util.Set; import java.util.stream.Collectors; -import static emu.grasscutter.config.Configuration.GAME_OPTIONS; -import static emu.grasscutter.scripts.constants.EventType.EVENT_UNLOCK_TRANS_POINT; - // @Entity public final class PlayerProgressManager extends BasePlayerDataManager { /****************************************************************************************************************** @@ -30,12 +29,16 @@ public final class PlayerProgressManager extends BasePlayerDataManager { 48 // blacklist OPEN_STATE_LIMIT_REGION_GLOBAL to make Meledy happy. =D Remove this as // soon as quest unlocks are fully implemented. ); - public static final Set IGNORED_OPEN_STATES = Set.of( - 1404, // OPEN_STATE_MENGDE_INFUSEDCRYSTAL, causes quest 'Mine Craft' to be given to the player at the start of the game. - // This should be removed when city reputation is implemented. - 57 // OPEN_STATE_PERSONAL_LINE, causes the prompt for showing character hangout quests to be permanently shown. - // This should be removed when character story quests are implemented. - ); + + public static final Set IGNORED_OPEN_STATES = + Set.of( + 1404, // OPEN_STATE_MENGDE_INFUSEDCRYSTAL, causes quest 'Mine Craft' to be given to the + // player at the start of the game. + // This should be removed when city reputation is implemented. + 57 // OPEN_STATE_PERSONAL_LINE, causes the prompt for showing character hangout quests to + // be permanently shown. + // This should be removed when character story quests are implemented. + ); // Set of open states that are set per default for all accounts. Can be overwritten by an entry in // `map`. public static final Set DEFAULT_OPEN_STATES = @@ -58,10 +61,10 @@ public final class PlayerProgressManager extends BasePlayerDataManager { // working chat. || s.getId() == 1) .map(OpenStateData::getId) + .filter(s -> !BLACKLIST_OPEN_STATES.contains(s)) // Filter out states in the blacklist. .filter( s -> - !BLACKLIST_OPEN_STATES.contains(s)) // Filter out states in the blacklist. - .filter(s -> !IGNORED_OPEN_STATES.contains(s)) // Filter out states in the default ignore list. + !IGNORED_OPEN_STATES.contains(s)) // Filter out states in the default ignore list. .collect(Collectors.toSet()); public PlayerProgressManager(Player player) { diff --git a/src/main/java/emu/grasscutter/game/quest/GameMainQuest.java b/src/main/java/emu/grasscutter/game/quest/GameMainQuest.java index f73fc7475..a0088cb44 100644 --- a/src/main/java/emu/grasscutter/game/quest/GameMainQuest.java +++ b/src/main/java/emu/grasscutter/game/quest/GameMainQuest.java @@ -16,11 +16,10 @@ import emu.grasscutter.net.proto.ChildQuestOuterClass.ChildQuest; import emu.grasscutter.net.proto.ParentQuestOuterClass.ParentQuest; import emu.grasscutter.server.packet.send.*; import emu.grasscutter.utils.ConversionUtils; -import lombok.*; -import org.bson.types.ObjectId; - import java.util.*; import java.util.stream.Collectors; +import lombok.*; +import org.bson.types.ObjectId; @Entity(value = "quests", useDiscriminator = false) public class GameMainQuest { @@ -495,7 +494,8 @@ public class GameMainQuest { subQuestWithCond.getFinishProgressList()); var questManager = this.getQuestManager(); - if (questManager != null && questManager.getLoggedQuests().contains(subQuestWithCond.getSubQuestId())) { + if (questManager != null + && questManager.getLoggedQuests().contains(subQuestWithCond.getSubQuestId())) { Grasscutter.getLogger() .debug( ">>> Quest {} will be {} as a result of content trigger {} ({}, {}).", diff --git a/src/main/java/emu/grasscutter/game/quest/GameQuest.java b/src/main/java/emu/grasscutter/game/quest/GameQuest.java index 9db0cff9d..f3503ad48 100644 --- a/src/main/java/emu/grasscutter/game/quest/GameQuest.java +++ b/src/main/java/emu/grasscutter/game/quest/GameQuest.java @@ -15,10 +15,9 @@ import emu.grasscutter.scripts.data.SceneGroup; import emu.grasscutter.server.packet.send.*; import emu.grasscutter.utils.Utils; import it.unimi.dsi.fastutil.ints.IntIntImmutablePair; -import lombok.*; - -import javax.script.Bindings; import java.util.*; +import javax.script.Bindings; +import lombok.*; @Entity public class GameQuest { @@ -326,8 +325,6 @@ public class GameQuest { @Override public String toString() { return "Main Quest: %s; Sub Quest: %s; State: %s" - .formatted(this.getMainQuestId(), - this.getSubQuestId(), - this.getState()); + .formatted(this.getMainQuestId(), this.getSubQuestId(), this.getState()); } } diff --git a/src/main/java/emu/grasscutter/plugin/PluginConfig.java b/src/main/java/emu/grasscutter/plugin/PluginConfig.java index e9a0f95fa..d0925e850 100644 --- a/src/main/java/emu/grasscutter/plugin/PluginConfig.java +++ b/src/main/java/emu/grasscutter/plugin/PluginConfig.java @@ -15,7 +15,6 @@ public final class PluginConfig { */ @SuppressWarnings("BooleanMethodIsAlwaysInverted") public boolean validate() { - return name != null && description != null && - mainClass != null && api != null; + return name != null && description != null && mainClass != null && api != null; } } diff --git a/src/main/java/emu/grasscutter/plugin/PluginManager.java b/src/main/java/emu/grasscutter/plugin/PluginManager.java index 51e3413e6..fb07a614e 100644 --- a/src/main/java/emu/grasscutter/plugin/PluginManager.java +++ b/src/main/java/emu/grasscutter/plugin/PluginManager.java @@ -1,18 +1,17 @@ package emu.grasscutter.plugin; +import static emu.grasscutter.utils.lang.Language.translate; + import emu.grasscutter.Grasscutter; import emu.grasscutter.server.event.*; import emu.grasscutter.utils.*; -import lombok.*; - -import javax.annotation.Nullable; import java.io.*; import java.lang.reflect.Method; import java.net.*; import java.util.*; import java.util.jar.*; - -import static emu.grasscutter.utils.lang.Language.translate; +import javax.annotation.Nullable; +import lombok.*; /** Manages the server's plugins and the event system. */ public final class PluginManager { @@ -80,11 +79,17 @@ public final class PluginManager { PluginConfig pluginConfig = JsonUtils.loadToClass(fileReader, PluginConfig.class); // Check the plugin's API version. if (pluginConfig.api == null) { - Grasscutter.getLogger().warn(translate("plugin.invalid_api.not_present", plugin.getName())); + Grasscutter.getLogger() + .warn(translate("plugin.invalid_api.not_present", plugin.getName())); return; } else if (pluginConfig.api != API_VERSION) { - Grasscutter.getLogger().warn(translate("plugin.invalid_api.lower", - plugin.getName(), pluginConfig.api, API_VERSION)); + Grasscutter.getLogger() + .warn( + translate( + "plugin.invalid_api.lower", + plugin.getName(), + pluginConfig.api, + API_VERSION)); return; }