diff --git a/src/main/java/emu/grasscutter/command/commands/AnnounceCommand.java b/src/main/java/emu/grasscutter/command/commands/AnnounceCommand.java index 7f8ed3680..455e79453 100644 --- a/src/main/java/emu/grasscutter/command/commands/AnnounceCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/AnnounceCommand.java @@ -22,7 +22,7 @@ public final class AnnounceCommand implements CommandHandler { @Override public void execute(Player sender, Player targetPlayer, List args) { - var manager = Grasscutter.getGameServer().getAnnouncementManager(); + var manager = Grasscutter.getGameServer().getAnnouncementSystem(); if (args.size() < 1) { CommandHandler.sendTranslatedMessage(sender, "commands.announce.command_usage"); return; diff --git a/src/main/java/emu/grasscutter/command/commands/CoopCommand.java b/src/main/java/emu/grasscutter/command/commands/CoopCommand.java index 86de192bc..8c1479718 100644 --- a/src/main/java/emu/grasscutter/command/commands/CoopCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/CoopCommand.java @@ -41,10 +41,10 @@ public final class CoopCommand implements CommandHandler { // There's no target==host check but this just places them in multiplayer in their own world which seems fine. if (targetPlayer.isInMultiplayer()) { - targetPlayer.getServer().getMultiplayerManager().leaveCoop(targetPlayer); + targetPlayer.getServer().getMultiplayerSystem().leaveCoop(targetPlayer); } - host.getServer().getMultiplayerManager().applyEnterMp(targetPlayer, host.getUid()); - targetPlayer.getServer().getMultiplayerManager().applyEnterMpReply(host, targetPlayer.getUid(), true); + host.getServer().getMultiplayerSystem().applyEnterMp(targetPlayer, host.getUid()); + targetPlayer.getServer().getMultiplayerSystem().applyEnterMpReply(host, targetPlayer.getUid(), true); CommandHandler.sendMessage(sender, translate(sender, "commands.coop.success", targetPlayer.getNickname(), host.getNickname())); } } diff --git a/src/main/java/emu/grasscutter/command/commands/EnterDungeonCommand.java b/src/main/java/emu/grasscutter/command/commands/EnterDungeonCommand.java index b2d21a1b1..94de4a294 100644 --- a/src/main/java/emu/grasscutter/command/commands/EnterDungeonCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/EnterDungeonCommand.java @@ -25,7 +25,7 @@ public final class EnterDungeonCommand implements CommandHandler { return; } - boolean result = targetPlayer.getServer().getDungeonManager().enterDungeon(targetPlayer.getSession().getPlayer(), 0, dungeonId); + boolean result = targetPlayer.getServer().getDungeonSystem().enterDungeon(targetPlayer.getSession().getPlayer(), 0, dungeonId); if (!result) { CommandHandler.sendMessage(sender, translate(sender, "commands.enter_dungeon.not_found_error")); diff --git a/src/main/java/emu/grasscutter/command/commands/ReloadCommand.java b/src/main/java/emu/grasscutter/command/commands/ReloadCommand.java index d18567f9b..0d052da3b 100644 --- a/src/main/java/emu/grasscutter/command/commands/ReloadCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/ReloadCommand.java @@ -18,9 +18,9 @@ public final class ReloadCommand implements CommandHandler { Grasscutter.loadConfig(); Grasscutter.loadLanguage(); - Grasscutter.getGameServer().getGachaManager().load(); - Grasscutter.getGameServer().getDropManager().load(); - Grasscutter.getGameServer().getShopManager().load(); + Grasscutter.getGameServer().getGachaSystem().load(); + Grasscutter.getGameServer().getDropSystem().load(); + Grasscutter.getGameServer().getShopSystem().load(); CommandHandler.sendMessage(sender, translate(sender, "commands.reload.reload_done")); } diff --git a/src/main/java/emu/grasscutter/command/commands/SetPropCommand.java b/src/main/java/emu/grasscutter/command/commands/SetPropCommand.java index 2248d2b1a..122eb782e 100644 --- a/src/main/java/emu/grasscutter/command/commands/SetPropCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/SetPropCommand.java @@ -146,7 +146,7 @@ public final class SetPropCommand implements CommandHandler { } private boolean setTowerLevel(Player sender, Player targetPlayer, int topFloor) { - List floorIds = targetPlayer.getServer().getTowerScheduleManager().getAllFloors(); + List floorIds = targetPlayer.getServer().getTowerSystem().getAllFloors(); if (topFloor < 0 || topFloor > floorIds.size()) { String min = Integer.toString(0); String max = Integer.toString(floorIds.size()); diff --git a/src/main/java/emu/grasscutter/game/battlepass/BattlePassManager.java b/src/main/java/emu/grasscutter/game/battlepass/BattlePassManager.java index 2f74819f1..6c95db479 100644 --- a/src/main/java/emu/grasscutter/game/battlepass/BattlePassManager.java +++ b/src/main/java/emu/grasscutter/game/battlepass/BattlePassManager.java @@ -140,11 +140,11 @@ public class BattlePassManager extends BasePlayerDataManager { // Mission triggers public void triggerMission(WatcherTriggerType triggerType) { - getPlayer().getServer().getBattlePassMissionManager().triggerMission(getPlayer(), triggerType); + getPlayer().getServer().getBattlePassSystem().triggerMission(getPlayer(), triggerType); } public void triggerMission(WatcherTriggerType triggerType, int param, int progress) { - getPlayer().getServer().getBattlePassMissionManager().triggerMission(getPlayer(), triggerType, param, progress); + getPlayer().getServer().getBattlePassSystem().triggerMission(getPlayer(), triggerType, param, progress); } // Handlers diff --git a/src/main/java/emu/grasscutter/game/battlepass/BattlePassMissionManager.java b/src/main/java/emu/grasscutter/game/battlepass/BattlePassSystem.java similarity index 93% rename from src/main/java/emu/grasscutter/game/battlepass/BattlePassMissionManager.java rename to src/main/java/emu/grasscutter/game/battlepass/BattlePassSystem.java index d45c4d978..240bcb473 100644 --- a/src/main/java/emu/grasscutter/game/battlepass/BattlePassMissionManager.java +++ b/src/main/java/emu/grasscutter/game/battlepass/BattlePassSystem.java @@ -11,16 +11,17 @@ import emu.grasscutter.game.player.Player; import emu.grasscutter.game.props.BattlePassMissionRefreshType; import emu.grasscutter.game.props.BattlePassMissionStatus; import emu.grasscutter.game.props.WatcherTriggerType; +import emu.grasscutter.server.game.BaseGameSystem; import emu.grasscutter.server.game.GameServer; import emu.grasscutter.server.packet.send.PacketBattlePassMissionUpdateNotify; -public class BattlePassMissionManager { - private final GameServer server; +public class BattlePassSystem extends BaseGameSystem { private final Map> cachedTriggers; // BP Mission manager for the server, contains cached triggers so we dont have to load it for each player - public BattlePassMissionManager(GameServer server) { - this.server = server; + public BattlePassSystem(GameServer server) { + super(server); + this.cachedTriggers = new HashMap<>(); for (BattlePassMissionData missionData : GameData.getBattlePassMissionDataMap().values()) { diff --git a/src/main/java/emu/grasscutter/game/combine/CombineManger.java b/src/main/java/emu/grasscutter/game/combine/CombineManger.java index dbe179c43..555440a85 100644 --- a/src/main/java/emu/grasscutter/game/combine/CombineManger.java +++ b/src/main/java/emu/grasscutter/game/combine/CombineManger.java @@ -12,6 +12,7 @@ import emu.grasscutter.game.player.Player; import emu.grasscutter.game.props.ActionReason; import emu.grasscutter.net.proto.RetcodeOuterClass; import emu.grasscutter.net.proto.RetcodeOuterClass.Retcode; +import emu.grasscutter.server.game.BaseGameSystem; import emu.grasscutter.server.game.GameServer; import emu.grasscutter.server.packet.send.PacketCombineFormulaDataNotify; import emu.grasscutter.server.packet.send.PacketCombineRsp; @@ -29,16 +30,11 @@ import java.util.List; import com.google.gson.reflect.TypeToken; -public class CombineManger { - private final GameServer gameServer; +public class CombineManger extends BaseGameSystem { private final static Int2ObjectMap> reliquaryDecomposeData = new Int2ObjectOpenHashMap<>(); - public GameServer getGameServer() { - return gameServer; - } - - public CombineManger(GameServer gameServer) { - this.gameServer = gameServer; + public CombineManger(GameServer server) { + super(server); } public static void initialize() { diff --git a/src/main/java/emu/grasscutter/game/drop/DropManager.java b/src/main/java/emu/grasscutter/game/drop/DropSystem.java similarity index 95% rename from src/main/java/emu/grasscutter/game/drop/DropManager.java rename to src/main/java/emu/grasscutter/game/drop/DropSystem.java index a19e0b28b..4e94bfe98 100644 --- a/src/main/java/emu/grasscutter/game/drop/DropManager.java +++ b/src/main/java/emu/grasscutter/game/drop/DropSystem.java @@ -12,6 +12,7 @@ import emu.grasscutter.game.inventory.ItemType; import emu.grasscutter.game.player.Player; import emu.grasscutter.game.props.ActionReason; import emu.grasscutter.game.world.Scene; +import emu.grasscutter.server.game.BaseGameSystem; import emu.grasscutter.server.game.GameServer; import emu.grasscutter.utils.Position; import emu.grasscutter.utils.Utils; @@ -23,24 +24,18 @@ import java.io.Reader; import java.util.Collection; import java.util.List; -public class DropManager { - public GameServer getGameServer() { - return gameServer; - } - - private final GameServer gameServer; - - public Int2ObjectMap> getDropData() { - return dropData; - } - +public class DropSystem extends BaseGameSystem { private final Int2ObjectMap> dropData; - public DropManager(GameServer gameServer) { - this.gameServer = gameServer; + public DropSystem(GameServer server) { + super(server); this.dropData = new Int2ObjectOpenHashMap<>(); this.load(); } + + public Int2ObjectMap> getDropData() { + return dropData; + } public synchronized void load() { try (Reader fileReader = new InputStreamReader(DataLoader.load("Drop.json"))) { diff --git a/src/main/java/emu/grasscutter/game/dungeons/DungeonManager.java b/src/main/java/emu/grasscutter/game/dungeons/DungeonSystem.java similarity index 95% rename from src/main/java/emu/grasscutter/game/dungeons/DungeonManager.java rename to src/main/java/emu/grasscutter/game/dungeons/DungeonSystem.java index 011b233a3..7ed773baa 100644 --- a/src/main/java/emu/grasscutter/game/dungeons/DungeonManager.java +++ b/src/main/java/emu/grasscutter/game/dungeons/DungeonSystem.java @@ -11,6 +11,7 @@ import emu.grasscutter.game.quest.enums.QuestTrigger; import emu.grasscutter.game.world.Scene; import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; +import emu.grasscutter.server.game.BaseGameSystem; import emu.grasscutter.server.game.GameServer; import emu.grasscutter.server.packet.send.PacketDungeonEntryInfoRsp; import emu.grasscutter.server.packet.send.PacketPlayerEnterDungeonRsp; @@ -18,15 +19,11 @@ import emu.grasscutter.utils.Position; import java.util.List; -public class DungeonManager { - private final GameServer server; +public class DungeonSystem extends BaseGameSystem { private static final BasicDungeonSettleListener basicDungeonSettleObserver = new BasicDungeonSettleListener(); - public DungeonManager(GameServer server) { - this.server = server; - } - - public GameServer getServer() { - return server; + + public DungeonSystem(GameServer server) { + super(server); } public void getEntryInfo(Player player, int pointId) { diff --git a/src/main/java/emu/grasscutter/game/entity/gadget/GadgetChest.java b/src/main/java/emu/grasscutter/game/entity/gadget/GadgetChest.java index 371919b27..02da258fc 100644 --- a/src/main/java/emu/grasscutter/game/entity/gadget/GadgetChest.java +++ b/src/main/java/emu/grasscutter/game/entity/gadget/GadgetChest.java @@ -19,7 +19,7 @@ public class GadgetChest extends GadgetContent { } public boolean onInteract(Player player, GadgetInteractReq req) { - var chestInteractHandlerMap = getGadget().getScene().getWorld().getServer().getWorldDataManager().getChestInteractHandlerMap(); + var chestInteractHandlerMap = getGadget().getScene().getWorld().getServer().getWorldDataSystem().getChestInteractHandlerMap(); var handler = chestInteractHandlerMap.get(getGadget().getGadgetData().getJsonName()); if(handler == null){ Grasscutter.getLogger().warn("Could not found the handler of this type of Chests {}", getGadget().getGadgetData().getJsonName()); diff --git a/src/main/java/emu/grasscutter/game/entity/gadget/chest/BossChestInteractHandler.java b/src/main/java/emu/grasscutter/game/entity/gadget/chest/BossChestInteractHandler.java index 491bfd9bd..3bc62f4f9 100644 --- a/src/main/java/emu/grasscutter/game/entity/gadget/chest/BossChestInteractHandler.java +++ b/src/main/java/emu/grasscutter/game/entity/gadget/chest/BossChestInteractHandler.java @@ -19,7 +19,7 @@ public class BossChestInteractHandler implements ChestInteractHandler{ @Override public boolean onInteract(GadgetChest chest, Player player) { - var worldDataManager = chest.getGadget().getScene().getWorld().getServer().getWorldDataManager(); + var worldDataManager = chest.getGadget().getScene().getWorld().getServer().getWorldDataSystem(); var monster = chest.getGadget().getMetaGadget().group.monsters.get(chest.getGadget().getMetaGadget().boss_chest.monster_config_id); var reward = worldDataManager.getRewardByBossId(monster.monster_id); diff --git a/src/main/java/emu/grasscutter/game/expedition/ExpeditionManager.java b/src/main/java/emu/grasscutter/game/expedition/ExpeditionSystem.java similarity index 85% rename from src/main/java/emu/grasscutter/game/expedition/ExpeditionManager.java rename to src/main/java/emu/grasscutter/game/expedition/ExpeditionSystem.java index 9b129259e..9dba624a6 100644 --- a/src/main/java/emu/grasscutter/game/expedition/ExpeditionManager.java +++ b/src/main/java/emu/grasscutter/game/expedition/ExpeditionSystem.java @@ -3,6 +3,7 @@ package emu.grasscutter.game.expedition; import com.google.gson.reflect.TypeToken; import emu.grasscutter.Grasscutter; import emu.grasscutter.data.DataLoader; +import emu.grasscutter.server.game.BaseGameSystem; import emu.grasscutter.server.game.GameServer; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; @@ -15,22 +16,18 @@ import java.util.List; import static emu.grasscutter.Configuration.*; -public class ExpeditionManager { - public GameServer getGameServer() { - return gameServer; - } - - private final GameServer gameServer; - - public Int2ObjectMap> getExpeditionRewardDataList() { return expeditionRewardData; } - +public class ExpeditionSystem extends BaseGameSystem { private final Int2ObjectMap> expeditionRewardData; - public ExpeditionManager(GameServer gameServer) { - this.gameServer = gameServer; + public ExpeditionSystem(GameServer server) { + super(server); this.expeditionRewardData = new Int2ObjectOpenHashMap<>(); this.load(); } + + public Int2ObjectMap> getExpeditionRewardDataList() { + return expeditionRewardData; + } public synchronized void load() { try (Reader fileReader = new InputStreamReader(DataLoader.load("ExpeditionReward.json"))) { diff --git a/src/main/java/emu/grasscutter/game/gacha/GachaManager.java b/src/main/java/emu/grasscutter/game/gacha/GachaSystem.java similarity index 98% rename from src/main/java/emu/grasscutter/game/gacha/GachaManager.java rename to src/main/java/emu/grasscutter/game/gacha/GachaSystem.java index 661bfca5e..6365561eb 100644 --- a/src/main/java/emu/grasscutter/game/gacha/GachaManager.java +++ b/src/main/java/emu/grasscutter/game/gacha/GachaSystem.java @@ -33,6 +33,7 @@ import emu.grasscutter.net.proto.GachaTransferItemOuterClass.GachaTransferItem; import emu.grasscutter.net.proto.GetGachaInfoRspOuterClass.GetGachaInfoRsp; import emu.grasscutter.net.proto.ItemParamOuterClass.ItemParam; import emu.grasscutter.net.proto.RetcodeOuterClass.Retcode; +import emu.grasscutter.server.game.BaseGameSystem; import emu.grasscutter.server.game.GameServer; import emu.grasscutter.server.game.GameServerTickEvent; import emu.grasscutter.server.packet.send.PacketDoGachaRsp; @@ -46,8 +47,7 @@ import org.greenrobot.eventbus.Subscribe; import static emu.grasscutter.Configuration.*; -public class GachaManager { - private final GameServer server; +public class GachaSystem extends BaseGameSystem { private final Int2ObjectMap gachaBanners; private WatchService watchService; @@ -56,17 +56,13 @@ public class GachaManager { private int[] fallbackItems4Pool2Default = {11401, 11402, 11403, 11405, 12401, 12402, 12403, 12405, 13401, 13407, 14401, 14402, 14403, 14409, 15401, 15402, 15403, 15405}; private int[] fallbackItems5Pool2Default = {11501, 11502, 12501, 12502, 13502, 13505, 14501, 14502, 15501, 15502}; - public GachaManager(GameServer server) { - this.server = server; + public GachaSystem(GameServer server) { + super(server); this.gachaBanners = new Int2ObjectOpenHashMap<>(); this.load(); this.startWatcher(server); } - public GameServer getServer() { - return server; - } - public Int2ObjectMap getGachaBanners() { return gachaBanners; } diff --git a/src/main/java/emu/grasscutter/game/inventory/Inventory.java b/src/main/java/emu/grasscutter/game/inventory/Inventory.java index f5660a955..15eb9710d 100644 --- a/src/main/java/emu/grasscutter/game/inventory/Inventory.java +++ b/src/main/java/emu/grasscutter/game/inventory/Inventory.java @@ -260,11 +260,11 @@ public class Inventory extends BasePlayerManager implements Iterable { private void addVirtualItem(int itemId, int count) { switch (itemId) { case 101 -> // Character exp - this.player.getServer().getInventoryManager().upgradeAvatar(this.player, this.player.getTeamManager().getCurrentAvatarEntity().getAvatar(), count); + this.player.getServer().getInventorySystem().upgradeAvatar(this.player, this.player.getTeamManager().getCurrentAvatarEntity().getAvatar(), count); case 102 -> // Adventure exp this.player.addExpDirectly(count); case 105 -> // Companionship exp - this.player.getServer().getInventoryManager().upgradeAvatarFetterLevel(this.player, this.player.getTeamManager().getCurrentAvatarEntity().getAvatar(), count); + this.player.getServer().getInventorySystem().upgradeAvatarFetterLevel(this.player, this.player.getTeamManager().getCurrentAvatarEntity().getAvatar(), count); case 106 -> // Resin this.player.getResinManager().addResin(count); case 107 -> // Legendary Key diff --git a/src/main/java/emu/grasscutter/game/managers/AnnouncementManager.java b/src/main/java/emu/grasscutter/game/managers/AnnouncementSystem.java similarity index 90% rename from src/main/java/emu/grasscutter/game/managers/AnnouncementManager.java rename to src/main/java/emu/grasscutter/game/managers/AnnouncementSystem.java index 163d0f5d7..201079fa3 100644 --- a/src/main/java/emu/grasscutter/game/managers/AnnouncementManager.java +++ b/src/main/java/emu/grasscutter/game/managers/AnnouncementSystem.java @@ -6,6 +6,7 @@ import emu.grasscutter.data.DataLoader; import emu.grasscutter.game.player.Player; import emu.grasscutter.game.world.World; import emu.grasscutter.net.proto.AnnounceDataOuterClass; +import emu.grasscutter.server.game.BaseGameSystem; import emu.grasscutter.server.game.GameServer; import emu.grasscutter.server.packet.send.PacketServerAnnounceNotify; import emu.grasscutter.server.packet.send.PacketServerAnnounceRevokeNotify; @@ -19,24 +20,22 @@ import java.io.InputStreamReader; import java.util.*; @Getter -public class AnnouncementManager { - - public final GameServer server; - public AnnouncementManager(GameServer server){ - this.server = server; +public class AnnouncementSystem extends BaseGameSystem { + private final Map announceConfigItemMap; + + public AnnouncementSystem(GameServer server){ + super(server); + this.announceConfigItemMap = new HashMap<>(); loadConfig(); } - Map announceConfigItemMap = new HashMap<>(); private int loadConfig() { try (var fileReader = new InputStreamReader(DataLoader.load("Announcement.json"))) { List announceConfigItems = Grasscutter.getGsonFactory().fromJson(fileReader, TypeToken.getParameterized(List.class, AnnounceConfigItem.class).getType()); - announceConfigItemMap = new HashMap<>(); + announceConfigItemMap.clear(); announceConfigItems.forEach(i -> announceConfigItemMap.put(i.getTemplateId(), i)); - - } catch (Exception e) { Grasscutter.getLogger().error("Unable to load server announce config.", e); } diff --git a/src/main/java/emu/grasscutter/game/managers/InventoryManager.java b/src/main/java/emu/grasscutter/game/managers/InventorySystem.java similarity index 98% rename from src/main/java/emu/grasscutter/game/managers/InventoryManager.java rename to src/main/java/emu/grasscutter/game/managers/InventorySystem.java index 01224ea37..bf38f64cb 100644 --- a/src/main/java/emu/grasscutter/game/managers/InventoryManager.java +++ b/src/main/java/emu/grasscutter/game/managers/InventorySystem.java @@ -27,15 +27,14 @@ import emu.grasscutter.game.shop.ShopChestBatchUseTable; import emu.grasscutter.game.shop.ShopChestTable; import emu.grasscutter.net.proto.ItemParamOuterClass.ItemParam; import emu.grasscutter.net.proto.MaterialInfoOuterClass.MaterialInfo; +import emu.grasscutter.server.game.BaseGameSystem; import emu.grasscutter.server.game.GameServer; import emu.grasscutter.server.packet.send.*; import emu.grasscutter.utils.Utils; import it.unimi.dsi.fastutil.ints.Int2IntMap; import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap; -public class InventoryManager { - private final GameServer server; - +public class InventorySystem extends BaseGameSystem { private final static int RELIC_MATERIAL_1 = 105002; // Sanctifying Unction private final static int RELIC_MATERIAL_2 = 105003; // Sanctifying Essence private final static int RELIC_MATERIAL_EXP_1 = 2500; // Sanctifying Unction @@ -55,12 +54,8 @@ public class InventoryManager { private final static int AVATAR_BOOK_EXP_2 = 5000; // Adventurer's Experience private final static int AVATAR_BOOK_EXP_3 = 20000; // Hero's Wit - public InventoryManager(GameServer server) { - this.server = server; - } - - public GameServer getServer() { - return server; + public InventorySystem(GameServer server) { + super(server); } public void lockEquip(Player player, long targetEquipGuid, boolean isLocked) { @@ -850,7 +845,7 @@ public class InventoryManager { // Handle combine diagrams. if (useItem.getItemData().getItemUse().get(0).getUseOp().equals("ITEM_USE_UNLOCK_COMBINE")) { // Unlock. - useSuccess = player.getServer().getCombineManger().unlockCombineDiagram(player, useItem); + useSuccess = player.getServer().getCombineSystem().unlockCombineDiagram(player, useItem); } // Handle cooking recipies. if (useItem.getItemData().getItemUse().get(0).getUseOp().equals("ITEM_USE_UNLOCK_COOK_RECIPE")) { @@ -883,7 +878,7 @@ public class InventoryManager { } break; case MATERIAL_CHEST: - List shopChestTableList = player.getServer().getShopManager().getShopChestData(); + List shopChestTableList = player.getServer().getShopSystem().getShopChestData(); List rewardItemList = new ArrayList<>(); for (ShopChestTable shopChestTable : shopChestTableList) { if (shopChestTable.getItemId() != useItem.getItemId()) { @@ -914,7 +909,7 @@ public class InventoryManager { if (optionId < 1) { break; } - List shopChestBatchUseTableList = player.getServer().getShopManager().getShopChestBatchUseData(); + List shopChestBatchUseTableList = player.getServer().getShopSystem().getShopChestBatchUseData(); for (ShopChestBatchUseTable shopChestBatchUseTable : shopChestBatchUseTableList) { if (shopChestBatchUseTable.getItemId() != useItem.getItemId()) { continue; diff --git a/src/main/java/emu/grasscutter/game/managers/MultiplayerManager.java b/src/main/java/emu/grasscutter/game/managers/MultiplayerSystem.java similarity index 96% rename from src/main/java/emu/grasscutter/game/managers/MultiplayerManager.java rename to src/main/java/emu/grasscutter/game/managers/MultiplayerSystem.java index 91566ef20..053121f66 100644 --- a/src/main/java/emu/grasscutter/game/managers/MultiplayerManager.java +++ b/src/main/java/emu/grasscutter/game/managers/MultiplayerSystem.java @@ -8,20 +8,16 @@ import emu.grasscutter.net.proto.PlayerApplyEnterMpReasonOuterClass.PlayerApplyE import emu.grasscutter.game.player.Player; import emu.grasscutter.game.player.Player.SceneLoadState; import emu.grasscutter.net.proto.PlayerApplyEnterMpResultNotifyOuterClass; +import emu.grasscutter.server.game.BaseGameSystem; import emu.grasscutter.server.game.GameServer; import emu.grasscutter.server.packet.send.PacketPlayerApplyEnterMpNotify; import emu.grasscutter.server.packet.send.PacketPlayerApplyEnterMpResultNotify; import emu.grasscutter.server.packet.send.PacketPlayerEnterSceneNotify; -public class MultiplayerManager { - private final GameServer server; - - public MultiplayerManager(GameServer server) { - this.server = server; - } +public class MultiplayerSystem extends BaseGameSystem { - public GameServer getServer() { - return server; + public MultiplayerSystem(GameServer server) { + super(server); } public void applyEnterMp(Player player, int targetUid) { diff --git a/src/main/java/emu/grasscutter/game/player/Player.java b/src/main/java/emu/grasscutter/game/player/Player.java index e287fcb1e..bfc090b93 100644 --- a/src/main/java/emu/grasscutter/game/player/Player.java +++ b/src/main/java/emu/grasscutter/game/player/Player.java @@ -1436,7 +1436,7 @@ public class Player { getStaminaManager().stopSustainedStaminaHandler(); // force to leave the dungeon (inside has a "if") - this.getServer().getDungeonManager().exitDungeon(this); + this.getServer().getDungeonSystem().exitDungeon(this); // Leave world if (this.getWorld() != null) { diff --git a/src/main/java/emu/grasscutter/game/quest/GameQuest.java b/src/main/java/emu/grasscutter/game/quest/GameQuest.java index 7d1fe5ade..87e31a6fb 100644 --- a/src/main/java/emu/grasscutter/game/quest/GameQuest.java +++ b/src/main/java/emu/grasscutter/game/quest/GameQuest.java @@ -58,7 +58,7 @@ public class GameQuest { this.mainQuest.getChildQuests().put(this.questId, this); - this.getData().getBeginExec().forEach(e -> getOwner().getServer().getQuestHandler().triggerExec(this, e, e.getParam())); + this.getData().getBeginExec().forEach(e -> getOwner().getServer().getQuestSystem().triggerExec(this, e, e.getParam())); this.getOwner().getQuestManager().triggerEvent(QuestTrigger.QUEST_CONTENT_QUEST_STATE_EQUAL, this.questId, this.state.getValue()); @@ -171,7 +171,7 @@ public class GameQuest { this.save(); } - this.getData().getFinishExec().forEach(e -> getOwner().getServer().getQuestHandler().triggerExec(this, e, e.getParam())); + this.getData().getFinishExec().forEach(e -> getOwner().getServer().getQuestSystem().triggerExec(this, e, e.getParam())); this.getOwner().getQuestManager().triggerEvent(QuestTrigger.QUEST_CONTENT_QUEST_STATE_EQUAL, this.questId, this.state.getValue()); @@ -205,7 +205,7 @@ public class GameQuest { // TODO for (int i = 0; i < questData.getAcceptCond().size(); i++) { QuestCondition condition = questData.getAcceptCond().get(i); - boolean result = getOwner().getServer().getQuestHandler().triggerCondition(this, condition, + boolean result = getOwner().getServer().getQuestSystem().triggerCondition(this, condition, condition.getParamStr(), condition.getParam()); diff --git a/src/main/java/emu/grasscutter/game/quest/QuestManager.java b/src/main/java/emu/grasscutter/game/quest/QuestManager.java index 69ae3819d..28a17973f 100644 --- a/src/main/java/emu/grasscutter/game/quest/QuestManager.java +++ b/src/main/java/emu/grasscutter/game/quest/QuestManager.java @@ -153,7 +153,7 @@ public class QuestManager extends BasePlayerManager { continue; } - boolean result = getPlayer().getServer().getQuestHandler().triggerContent(quest, condition, paramStr, params); + boolean result = getPlayer().getServer().getQuestSystem().triggerContent(quest, condition, paramStr, params); if (result) { quest.getFinishProgressList()[i] = 1; diff --git a/src/main/java/emu/grasscutter/game/quest/ServerQuestHandler.java b/src/main/java/emu/grasscutter/game/quest/QuestSystem.java similarity index 93% rename from src/main/java/emu/grasscutter/game/quest/ServerQuestHandler.java rename to src/main/java/emu/grasscutter/game/quest/QuestSystem.java index 19c779470..24f78b9d4 100644 --- a/src/main/java/emu/grasscutter/game/quest/ServerQuestHandler.java +++ b/src/main/java/emu/grasscutter/game/quest/QuestSystem.java @@ -4,6 +4,9 @@ import java.util.Set; import emu.grasscutter.data.excels.QuestData; import emu.grasscutter.game.quest.handlers.QuestExecHandler; +import emu.grasscutter.server.game.BaseGameSystem; +import emu.grasscutter.server.game.GameServer; + import org.reflections.Reflections; import emu.grasscutter.Grasscutter; @@ -13,12 +16,14 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; @SuppressWarnings("unchecked") -public class ServerQuestHandler { +public class QuestSystem extends BaseGameSystem { private final Int2ObjectMap condHandlers; private final Int2ObjectMap contHandlers; private final Int2ObjectMap execHandlers; - public ServerQuestHandler() { + public QuestSystem(GameServer server) { + super(server); + this.condHandlers = new Int2ObjectOpenHashMap<>(); this.contHandlers = new Int2ObjectOpenHashMap<>(); this.execHandlers = new Int2ObjectOpenHashMap<>(); diff --git a/src/main/java/emu/grasscutter/game/shop/ShopManager.java b/src/main/java/emu/grasscutter/game/shop/ShopSystem.java similarity index 90% rename from src/main/java/emu/grasscutter/game/shop/ShopManager.java rename to src/main/java/emu/grasscutter/game/shop/ShopSystem.java index 6fb138be8..d6afb07ab 100644 --- a/src/main/java/emu/grasscutter/game/shop/ShopManager.java +++ b/src/main/java/emu/grasscutter/game/shop/ShopSystem.java @@ -6,6 +6,7 @@ import emu.grasscutter.data.DataLoader; import emu.grasscutter.data.GameData; import emu.grasscutter.data.common.ItemParamData; import emu.grasscutter.data.excels.ShopGoodsData; +import emu.grasscutter.server.game.BaseGameSystem; import emu.grasscutter.server.game.GameServer; import emu.grasscutter.utils.Utils; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; @@ -21,35 +22,33 @@ import java.util.List; import static emu.grasscutter.Configuration.*; -public class ShopManager { - private final GameServer server; - - public Int2ObjectMap> getShopData() { - return shopData; - } - - public List getShopChestData() { - return shopChestData; - } - - public List getShopChestBatchUseData() { - return shopChestBatchUseData; - } - +public class ShopSystem extends BaseGameSystem { private final Int2ObjectMap> shopData; private final List shopChestData; private final List shopChestBatchUseData; + + private static final int REFRESH_HOUR = 4; // In GMT+8 server + private static final String TIME_ZONE = "Asia/Shanghai"; // GMT+8 Timezone - public ShopManager(GameServer server) { - this.server = server; + public ShopSystem(GameServer server) { + super(server); this.shopData = new Int2ObjectOpenHashMap<>(); this.shopChestData = new ArrayList<>(); this.shopChestBatchUseData = new ArrayList<>(); this.load(); } + + public Int2ObjectMap> getShopData() { + return shopData; + } - private static final int REFRESH_HOUR = 4; // In GMT+8 server - private static final String TIME_ZONE = "Asia/Shanghai"; // GMT+8 Timezone + public List getShopChestData() { + return shopChestData; + } + + public List getShopChestBatchUseData() { + return shopChestBatchUseData; + } public static int getShopNextRefreshTime(ShopInfo shopInfo) { return switch (shopInfo.getShopRefreshType()) { diff --git a/src/main/java/emu/grasscutter/game/tower/TowerManager.java b/src/main/java/emu/grasscutter/game/tower/TowerManager.java index a862b1587..19a6d860c 100644 --- a/src/main/java/emu/grasscutter/game/tower/TowerManager.java +++ b/src/main/java/emu/grasscutter/game/tower/TowerManager.java @@ -74,7 +74,7 @@ public class TowerManager extends BasePlayerManager { notifyCurLevelRecordChange(); // use team user choose player.getTeamManager().useTemporaryTeam(0); - player.getServer().getDungeonManager().handoffDungeon(player, dungeonId, + player.getServer().getDungeonSystem().handoffDungeon(player, dungeonId, towerDungeonSettleListener); // make sure user can exit dungeon correctly @@ -116,10 +116,10 @@ public class TowerManager extends BasePlayerManager { return getTowerData().currentLevel < 3; } public int getNextFloorId() { - return player.getServer().getTowerScheduleManager().getNextFloorId(getTowerData().currentFloorId); + return player.getServer().getTowerSystem().getNextFloorId(getTowerData().currentFloorId); } public boolean hasNextFloor(){ - return player.getServer().getTowerScheduleManager().getNextFloorId(getTowerData().currentFloorId) > 0; + return player.getServer().getTowerSystem().getNextFloorId(getTowerData().currentFloorId) > 0; } public void clearEntry() { @@ -128,10 +128,10 @@ public class TowerManager extends BasePlayerManager { public boolean canEnterScheduleFloor(){ Map recordMap = getRecordMap(); - if(!recordMap.containsKey(player.getServer().getTowerScheduleManager().getLastEntranceFloor())){ + if(!recordMap.containsKey(player.getServer().getTowerSystem().getLastEntranceFloor())){ return false; } - return recordMap.get(player.getServer().getTowerScheduleManager().getLastEntranceFloor()) + return recordMap.get(player.getServer().getTowerSystem().getLastEntranceFloor()) .getStarCount() >= 6; } diff --git a/src/main/java/emu/grasscutter/game/tower/TowerScheduleManager.java b/src/main/java/emu/grasscutter/game/tower/TowerSystem.java similarity index 92% rename from src/main/java/emu/grasscutter/game/tower/TowerScheduleManager.java rename to src/main/java/emu/grasscutter/game/tower/TowerSystem.java index 0455a9769..206bab462 100644 --- a/src/main/java/emu/grasscutter/game/tower/TowerScheduleManager.java +++ b/src/main/java/emu/grasscutter/game/tower/TowerSystem.java @@ -4,6 +4,7 @@ import emu.grasscutter.Grasscutter; import emu.grasscutter.data.DataLoader; import emu.grasscutter.data.GameData; import emu.grasscutter.data.excels.TowerScheduleData; +import emu.grasscutter.server.game.BaseGameSystem; import emu.grasscutter.server.game.GameServer; import java.io.FileReader; @@ -14,15 +15,10 @@ import java.util.List; import static emu.grasscutter.Configuration.*; -public class TowerScheduleManager { - private final GameServer gameServer; - - public GameServer getGameServer() { - return gameServer; - } - - public TowerScheduleManager(GameServer gameServer) { - this.gameServer = gameServer; +public class TowerSystem extends BaseGameSystem { + + public TowerSystem(GameServer server) { + super(server); this.load(); } diff --git a/src/main/java/emu/grasscutter/game/world/Scene.java b/src/main/java/emu/grasscutter/game/world/Scene.java index d3af36c9f..105e22ff6 100644 --- a/src/main/java/emu/grasscutter/game/world/Scene.java +++ b/src/main/java/emu/grasscutter/game/world/Scene.java @@ -399,7 +399,7 @@ public class Scene { // Reward drop if (target instanceof EntityMonster && this.getSceneType() != SceneType.SCENE_DUNGEON) { - getWorld().getServer().getDropManager().callDrop((EntityMonster) target); + getWorld().getServer().getDropSystem().callDrop((EntityMonster) target); } this.removeEntity(target); diff --git a/src/main/java/emu/grasscutter/game/world/WorldDataManager.java b/src/main/java/emu/grasscutter/game/world/WorldDataSystem.java similarity index 97% rename from src/main/java/emu/grasscutter/game/world/WorldDataManager.java rename to src/main/java/emu/grasscutter/game/world/WorldDataSystem.java index dcffe5417..a4be78686 100644 --- a/src/main/java/emu/grasscutter/game/world/WorldDataManager.java +++ b/src/main/java/emu/grasscutter/game/world/WorldDataSystem.java @@ -14,6 +14,7 @@ import emu.grasscutter.game.player.Player; import emu.grasscutter.net.proto.InvestigationMonsterOuterClass; import emu.grasscutter.scripts.data.SceneGroup; import emu.grasscutter.scripts.data.SceneMonster; +import emu.grasscutter.server.game.BaseGameSystem; import emu.grasscutter.server.game.GameServer; import java.io.InputStream; @@ -24,13 +25,12 @@ import java.util.Map; import java.util.Objects; import java.util.concurrent.ConcurrentHashMap; -public class WorldDataManager { - private final GameServer gameServer; +public class WorldDataSystem extends BaseGameSystem { private final Map chestInteractHandlerMap; // chestType-Handler private final Map sceneInvestigationGroupMap; // - public WorldDataManager(GameServer gameServer){ - this.gameServer = gameServer; + public WorldDataSystem(GameServer server){ + super(server); this.chestInteractHandlerMap = new HashMap<>(); this.sceneInvestigationGroupMap = new ConcurrentHashMap<>(); diff --git a/src/main/java/emu/grasscutter/server/game/BaseGameSystem.java b/src/main/java/emu/grasscutter/server/game/BaseGameSystem.java new file mode 100644 index 000000000..536e90575 --- /dev/null +++ b/src/main/java/emu/grasscutter/server/game/BaseGameSystem.java @@ -0,0 +1,13 @@ +package emu.grasscutter.server.game; + +public abstract class BaseGameSystem { + protected final GameServer server; + + public BaseGameSystem(GameServer server) { + this.server = server; + } + + public GameServer getServer() { + return this.server; + } +} diff --git a/src/main/java/emu/grasscutter/server/game/GameServer.java b/src/main/java/emu/grasscutter/server/game/GameServer.java index 7db3ae0da..5b53e31dc 100644 --- a/src/main/java/emu/grasscutter/server/game/GameServer.java +++ b/src/main/java/emu/grasscutter/server/game/GameServer.java @@ -5,27 +5,27 @@ import emu.grasscutter.Grasscutter; import emu.grasscutter.command.CommandMap; import emu.grasscutter.database.DatabaseHelper; import emu.grasscutter.game.Account; -import emu.grasscutter.game.battlepass.BattlePassMissionManager; +import emu.grasscutter.game.battlepass.BattlePassSystem; import emu.grasscutter.game.combine.CombineManger; -import emu.grasscutter.game.drop.DropManager; -import emu.grasscutter.game.dungeons.DungeonManager; +import emu.grasscutter.game.drop.DropSystem; +import emu.grasscutter.game.dungeons.DungeonSystem; import emu.grasscutter.game.dungeons.challenge.DungeonChallenge; -import emu.grasscutter.game.expedition.ExpeditionManager; -import emu.grasscutter.game.gacha.GachaManager; -import emu.grasscutter.game.managers.AnnouncementManager; +import emu.grasscutter.game.expedition.ExpeditionSystem; +import emu.grasscutter.game.gacha.GachaSystem; +import emu.grasscutter.game.managers.AnnouncementSystem; import emu.grasscutter.game.managers.CookingManager; -import emu.grasscutter.game.managers.InventoryManager; -import emu.grasscutter.game.managers.MultiplayerManager; +import emu.grasscutter.game.managers.InventorySystem; +import emu.grasscutter.game.managers.MultiplayerSystem; import emu.grasscutter.game.managers.chat.ChatManager; import emu.grasscutter.game.managers.chat.ChatManagerHandler; import emu.grasscutter.game.managers.energy.EnergyManager; import emu.grasscutter.game.managers.stamina.StaminaManager; import emu.grasscutter.game.player.Player; -import emu.grasscutter.game.quest.ServerQuestHandler; -import emu.grasscutter.game.shop.ShopManager; -import emu.grasscutter.game.tower.TowerScheduleManager; +import emu.grasscutter.game.quest.QuestSystem; +import emu.grasscutter.game.shop.ShopSystem; +import emu.grasscutter.game.tower.TowerSystem; import emu.grasscutter.game.world.World; -import emu.grasscutter.game.world.WorldDataManager; +import emu.grasscutter.game.world.WorldDataSystem; import emu.grasscutter.net.packet.PacketHandler; import emu.grasscutter.net.proto.SocialDetailOuterClass.SocialDetail; import emu.grasscutter.server.event.types.ServerEvent; @@ -47,30 +47,35 @@ import java.util.concurrent.ConcurrentHashMap; import static emu.grasscutter.utils.Language.translate; import static emu.grasscutter.Configuration.*; +@Getter public final class GameServer extends KcpServer { - private final InetSocketAddress address; + // Game server base + private final InetSocketAddress address; private final GameServerPacketHandler packetHandler; - private final ServerQuestHandler questHandler; - @Getter private final ServerTaskScheduler scheduler; - - private final Map players; - private final Set worlds; + private final Map players; + private final Set worlds; + // Server systems + private final InventorySystem inventorySystem; + private final GachaSystem gachaSystem; + private final ShopSystem shopSystem; + private final MultiplayerSystem multiplayerSystem; + private final DungeonSystem dungeonSystem; + private final ExpeditionSystem expeditionSystem; + private final DropSystem dropSystem; + private final WorldDataSystem worldDataSystem; + private final BattlePassSystem battlePassSystem; + private final CombineManger combineSystem; + private final TowerSystem towerSystem; + private final AnnouncementSystem announcementSystem; + private final QuestSystem questSystem; + + // Extra + private final ServerTaskScheduler scheduler; + private final CommandMap commandMap; + private final TaskMap taskMap; + private ChatManagerHandler chatManager; - @Getter private final InventoryManager inventoryManager; - @Getter private final GachaManager gachaManager; - @Getter private final ShopManager shopManager; - @Getter private final MultiplayerManager multiplayerManager; - @Getter private final DungeonManager dungeonManager; - @Getter private final ExpeditionManager expeditionManager; - @Getter private final CommandMap commandMap; - @Getter private final TaskMap taskMap; - @Getter private final DropManager dropManager; - @Getter private final WorldDataManager worldDataManager; - @Getter private final BattlePassMissionManager battlePassMissionManager; - @Getter private final CombineManger combineManger; - @Getter private final TowerScheduleManager towerScheduleManager; - @Getter private final AnnouncementManager announcementManager; public GameServer() { this(getAdapterInetSocketAddress()); @@ -78,11 +83,11 @@ public final class GameServer extends KcpServer { public GameServer(InetSocketAddress address) { ChannelConfig channelConfig = new ChannelConfig(); - channelConfig.nodelay(true,40,2,true); + channelConfig.nodelay(true, 40, 2, true); channelConfig.setMtu(1400); channelConfig.setSndwnd(256); channelConfig.setRcvwnd(256); - channelConfig.setTimeoutMillis(30*1000);//30s + channelConfig.setTimeoutMillis(30 * 1000);//30s channelConfig.setUseConvChannel(true); channelConfig.setAckNoDelay(false); @@ -94,56 +99,56 @@ public final class GameServer extends KcpServer { CookingManager.initialize(); CombineManger.initialize(); + // Game Server base this.address = address; this.packetHandler = new GameServerPacketHandler(PacketHandler.class); - this.questHandler = new ServerQuestHandler(); - this.scheduler = new ServerTaskScheduler(); this.players = new ConcurrentHashMap<>(); this.worlds = Collections.synchronizedSet(new HashSet<>()); - - this.chatManager = new ChatManager(this); - this.inventoryManager = new InventoryManager(this); - this.gachaManager = new GachaManager(this); - this.shopManager = new ShopManager(this); - this.multiplayerManager = new MultiplayerManager(this); - this.dungeonManager = new DungeonManager(this); + + // Extra + this.scheduler = new ServerTaskScheduler(); this.commandMap = new CommandMap(true); - this.taskMap = new TaskMap(true); - this.dropManager = new DropManager(this); - this.expeditionManager = new ExpeditionManager(this); - this.combineManger = new CombineManger(this); - this.towerScheduleManager = new TowerScheduleManager(this); - this.worldDataManager = new WorldDataManager(this); - this.battlePassMissionManager = new BattlePassMissionManager(this); - this.announcementManager = new AnnouncementManager(this); + this.taskMap = new TaskMap(true); + + // Create game systems + this.inventorySystem = new InventorySystem(this); + this.gachaSystem = new GachaSystem(this); + this.shopSystem = new ShopSystem(this); + this.multiplayerSystem = new MultiplayerSystem(this); + this.dungeonSystem = new DungeonSystem(this); + this.dropSystem = new DropSystem(this); + this.expeditionSystem = new ExpeditionSystem(this); + this.combineSystem = new CombineManger(this); + this.towerSystem = new TowerSystem(this); + this.worldDataSystem = new WorldDataSystem(this); + this.battlePassSystem = new BattlePassSystem(this); + this.announcementSystem = new AnnouncementSystem(this); + this.questSystem = new QuestSystem(this); + + // Chata manager + this.chatManager = new ChatManager(this); + // Hook into shutdown event. Runtime.getRuntime().addShutdownHook(new Thread(this::onServerShutdown)); } + + @Deprecated + public ChatManagerHandler getChatManager() { + return chatManager; + } + + @Deprecated + public void setChatManager(ChatManagerHandler chatManager) { + this.chatManager = chatManager; + } + + public ChatManagerHandler getChatSystem() { + return chatManager; + } - public GameServerPacketHandler getPacketHandler() { - return packetHandler; - } - - public ServerQuestHandler getQuestHandler() { - return questHandler; - } - - public Map getPlayers() { - return players; - } - - public Set getWorlds() { - return worlds; - } - - public ChatManagerHandler getChatManager() { - return chatManager; - } - - public void setChatManager(ChatManagerHandler chatManager) { - this.chatManager = chatManager; - } - + public void setChatSystem(ChatManagerHandler chatManager) { + this.chatManager = chatManager; + } private static InetSocketAddress getAdapterInetSocketAddress(){ InetSocketAddress inetSocketAddress; diff --git a/src/main/java/emu/grasscutter/server/http/handlers/GachaHandler.java b/src/main/java/emu/grasscutter/server/http/handlers/GachaHandler.java index 69a0c67ce..6032e774f 100644 --- a/src/main/java/emu/grasscutter/server/http/handlers/GachaHandler.java +++ b/src/main/java/emu/grasscutter/server/http/handlers/GachaHandler.java @@ -4,7 +4,7 @@ import emu.grasscutter.Grasscutter; import emu.grasscutter.database.DatabaseHelper; import emu.grasscutter.game.Account; import emu.grasscutter.game.gacha.GachaBanner; -import emu.grasscutter.game.gacha.GachaManager; +import emu.grasscutter.game.gacha.GachaSystem; import emu.grasscutter.game.player.Player; import emu.grasscutter.server.http.Router; import emu.grasscutter.tools.Tools; @@ -108,7 +108,7 @@ public final class GachaHandler implements Router { // Get the banner info for the banner we want. int scheduleId = Integer.parseInt(request.query("scheduleId")); - GachaManager manager = Grasscutter.getGameServer().getGachaManager(); + GachaSystem manager = Grasscutter.getGameServer().getGachaSystem(); GachaBanner banner = manager.getGachaBanners().get(scheduleId); // Add 5-star items. diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerAvatarExpeditionGetRewardReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerAvatarExpeditionGetRewardReq.java index 3e3bed9f1..aaacd7954 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerAvatarExpeditionGetRewardReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerAvatarExpeditionGetRewardReq.java @@ -34,8 +34,8 @@ public class HandlerAvatarExpeditionGetRewardReq extends PacketHandler { List items = new LinkedList<>(); - if (session.getServer().getExpeditionManager().getExpeditionRewardDataList().containsKey(expInfo.getExpId())) { - for (ExpeditionRewardDataList RewardDataList : session.getServer().getExpeditionManager().getExpeditionRewardDataList().get(expInfo.getExpId())) { + if (session.getServer().getExpeditionSystem().getExpeditionRewardDataList().containsKey(expInfo.getExpId())) { + for (ExpeditionRewardDataList RewardDataList : session.getServer().getExpeditionSystem().getExpeditionRewardDataList().get(expInfo.getExpId())) { if(RewardDataList.getHourTime() == expInfo.getHourTime()){ if(!RewardDataList.getExpeditionRewardData().isEmpty()){ for (ExpeditionRewardData RewardData :RewardDataList.getExpeditionRewardData()) { diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerAvatarPromoteReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerAvatarPromoteReq.java index cd863f5bf..5914f98c9 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerAvatarPromoteReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerAvatarPromoteReq.java @@ -14,7 +14,7 @@ public class HandlerAvatarPromoteReq extends PacketHandler { AvatarPromoteReq req = AvatarPromoteReq.parseFrom(payload); // Ascend avatar - session.getServer().getInventoryManager().promoteAvatar(session.getPlayer(), req.getGuid()); + session.getServer().getInventorySystem().promoteAvatar(session.getPlayer(), req.getGuid()); } } diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerAvatarSkillUpgradeReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerAvatarSkillUpgradeReq.java index e179bcd8e..188e754fe 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerAvatarSkillUpgradeReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerAvatarSkillUpgradeReq.java @@ -14,7 +14,7 @@ public class HandlerAvatarSkillUpgradeReq extends PacketHandler { AvatarSkillUpgradeReq req = AvatarSkillUpgradeReq.parseFrom(payload); // Level up avatar talent - session.getServer().getInventoryManager().upgradeAvatarSkill(session.getPlayer(), req.getAvatarGuid(), req.getAvatarSkillId()); + session.getServer().getInventorySystem().upgradeAvatarSkill(session.getPlayer(), req.getAvatarGuid(), req.getAvatarSkillId()); } } diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerAvatarUpgradeReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerAvatarUpgradeReq.java index 3254b2327..93fa0a7a3 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerAvatarUpgradeReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerAvatarUpgradeReq.java @@ -14,7 +14,7 @@ public class HandlerAvatarUpgradeReq extends PacketHandler { AvatarUpgradeReq req = AvatarUpgradeReq.parseFrom(payload); // Level up avatar - session.getServer().getInventoryManager().upgradeAvatar( + session.getServer().getInventorySystem().upgradeAvatar( session.getPlayer(), req.getAvatarGuid(), req.getItemId(), diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerBuyGoodsReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerBuyGoodsReq.java index 7e8a9d8a0..2b645cc11 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerBuyGoodsReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerBuyGoodsReq.java @@ -6,7 +6,7 @@ import emu.grasscutter.game.inventory.GameItem; import emu.grasscutter.game.props.ActionReason; import emu.grasscutter.game.shop.ShopInfo; import emu.grasscutter.game.shop.ShopLimit; -import emu.grasscutter.game.shop.ShopManager; +import emu.grasscutter.game.shop.ShopSystem; import emu.grasscutter.net.packet.Opcodes; import emu.grasscutter.net.packet.PacketHandler; import emu.grasscutter.net.packet.PacketOpcodes; @@ -29,7 +29,7 @@ public class HandlerBuyGoodsReq extends PacketHandler { @Override public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { BuyGoodsReqOuterClass.BuyGoodsReq buyGoodsReq = BuyGoodsReqOuterClass.BuyGoodsReq.parseFrom(payload); - List configShop = session.getServer().getShopManager().getShopData().get(buyGoodsReq.getShopType()); + List configShop = session.getServer().getShopSystem().getShopData().get(buyGoodsReq.getShopType()); if (configShop == null) return; @@ -46,7 +46,7 @@ public class HandlerBuyGoodsReq extends PacketHandler { int bought = 0; if (shopLimit != null) { if (currentTs > shopLimit.getNextRefreshTime()) { - shopLimit.setNextRefreshTime(ShopManager.getShopNextRefreshTime(sg)); + shopLimit.setNextRefreshTime(ShopSystem.getShopNextRefreshTime(sg)); } else { bought = shopLimit.getHasBoughtInPeriod(); } @@ -65,7 +65,7 @@ public class HandlerBuyGoodsReq extends PacketHandler { return; } - session.getPlayer().addShopLimit(sg.getGoodsId(), buyGoodsReq.getBuyCount(), ShopManager.getShopNextRefreshTime(sg)); + session.getPlayer().addShopLimit(sg.getGoodsId(), buyGoodsReq.getBuyCount(), ShopSystem.getShopNextRefreshTime(sg)); GameItem item = new GameItem(GameData.getItemDataMap().get(sg.getGoodsItem().getId())); item.setCount(buyGoodsReq.getBuyCount() * sg.getGoodsItem().getCount()); session.getPlayer().getInventory().addItem(item, ActionReason.Shop, true); // fix: not notify when got virtual item from shop diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerCalcWeaponUpgradeReturnItemsReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerCalcWeaponUpgradeReturnItemsReq.java index 79f199ee9..cc7a06e7b 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerCalcWeaponUpgradeReturnItemsReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerCalcWeaponUpgradeReturnItemsReq.java @@ -17,7 +17,7 @@ public class HandlerCalcWeaponUpgradeReturnItemsReq extends PacketHandler { public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { CalcWeaponUpgradeReturnItemsReq req = CalcWeaponUpgradeReturnItemsReq.parseFrom(payload); - List returnOres = session.getServer().getInventoryManager().calcWeaponUpgradeReturnItems( + List returnOres = session.getServer().getInventorySystem().calcWeaponUpgradeReturnItems( session.getPlayer(), req.getTargetWeaponGuid(), req.getFoodWeaponGuidListList(), diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerCombineReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerCombineReq.java index c5b52fab0..b8d80eb3d 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerCombineReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerCombineReq.java @@ -21,7 +21,7 @@ public class HandlerCombineReq extends PacketHandler { CombineReqOuterClass.CombineReq req = CombineReqOuterClass.CombineReq.parseFrom(payload); - var result = session.getServer().getCombineManger() + var result = session.getServer().getCombineSystem() .combineItem(session.getPlayer(), req.getCombineId(), req.getCombineCount()); if(result == null){ diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerDestroyMaterialReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerDestroyMaterialReq.java index e39239f68..35626e97a 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerDestroyMaterialReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerDestroyMaterialReq.java @@ -13,6 +13,6 @@ public class HandlerDestroyMaterialReq extends PacketHandler { DestroyMaterialReq req = DestroyMaterialReq.parseFrom(payload); // Delete items - session.getServer().getInventoryManager().destroyMaterial(session.getPlayer(), req.getMaterialListList()); + session.getServer().getInventorySystem().destroyMaterial(session.getPlayer(), req.getMaterialListList()); } } diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerDoGachaReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerDoGachaReq.java index 1c06dbbfa..8a69f3edc 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerDoGachaReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerDoGachaReq.java @@ -12,6 +12,6 @@ public class HandlerDoGachaReq extends PacketHandler { public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { DoGachaReq req = DoGachaReq.parseFrom(payload); - session.getServer().getGachaManager().doPulls(session.getPlayer(), req.getGachaScheduleId(), req.getGachaTimes()); + session.getServer().getGachaSystem().doPulls(session.getPlayer(), req.getGachaScheduleId(), req.getGachaTimes()); } } diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerDungeonEntryInfoReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerDungeonEntryInfoReq.java index 286fbdc67..006f3c73c 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerDungeonEntryInfoReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerDungeonEntryInfoReq.java @@ -13,7 +13,7 @@ public class HandlerDungeonEntryInfoReq extends PacketHandler { public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { DungeonEntryInfoReq req = DungeonEntryInfoReq.parseFrom(payload); - session.getServer().getDungeonManager().getEntryInfo(session.getPlayer(), req.getPointId()); + session.getServer().getDungeonSystem().getEntryInfo(session.getPlayer(), req.getPointId()); } } diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerGachaWishReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerGachaWishReq.java index ce3159dc5..ff0e68944 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerGachaWishReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerGachaWishReq.java @@ -16,7 +16,7 @@ public class HandlerGachaWishReq extends PacketHandler { public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { GachaWishReq req = GachaWishReq.parseFrom(payload); - GachaBanner banner = session.getServer().getGachaManager().getGachaBanners().get(req.getGachaScheduleId()); + GachaBanner banner = session.getServer().getGachaSystem().getGachaBanners().get(req.getGachaScheduleId()); PlayerGachaBannerInfo gachaInfo = session.getPlayer().getGachaInfo().getBannerInfo(banner); gachaInfo.setFailedChosenItemPulls(0); diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerGetGachaInfoReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerGetGachaInfoReq.java index b4a9f9fe7..afa4c9612 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerGetGachaInfoReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerGetGachaInfoReq.java @@ -14,7 +14,7 @@ public class HandlerGetGachaInfoReq extends PacketHandler { @Override public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { - session.send(new PacketGetGachaInfoRsp(session.getServer().getGachaManager(), session.getPlayer())); + session.send(new PacketGetGachaInfoRsp(session.getServer().getGachaSystem(), session.getPlayer())); } } diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerGetInvestigationMonsterReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerGetInvestigationMonsterReq.java index f326731c8..f3ca23ce0 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerGetInvestigationMonsterReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerGetInvestigationMonsterReq.java @@ -16,7 +16,7 @@ public class HandlerGetInvestigationMonsterReq extends PacketHandler { session.send(new PacketGetInvestigationMonsterRsp( session.getPlayer(), - session.getServer().getWorldDataManager(), + session.getServer().getWorldDataSystem(), req.getCityIdListList())); } diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerPlayerApplyEnterMpReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerPlayerApplyEnterMpReq.java index ed5591a1b..e2e1309ad 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerPlayerApplyEnterMpReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerPlayerApplyEnterMpReq.java @@ -14,7 +14,7 @@ public class HandlerPlayerApplyEnterMpReq extends PacketHandler { public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { PlayerApplyEnterMpReq req = PlayerApplyEnterMpReq.parseFrom(payload); - session.getServer().getMultiplayerManager().applyEnterMp(session.getPlayer(), req.getTargetUid()); + session.getServer().getMultiplayerSystem().applyEnterMp(session.getPlayer(), req.getTargetUid()); session.send(new PacketPlayerApplyEnterMpRsp(req.getTargetUid())); } diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerPlayerApplyEnterMpResultReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerPlayerApplyEnterMpResultReq.java index 7a9c41db2..7589190aa 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerPlayerApplyEnterMpResultReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerPlayerApplyEnterMpResultReq.java @@ -14,7 +14,7 @@ public class HandlerPlayerApplyEnterMpResultReq extends PacketHandler { public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { PlayerApplyEnterMpResultReq req = PlayerApplyEnterMpResultReq.parseFrom(payload); - session.getServer().getMultiplayerManager().applyEnterMpReply(session.getPlayer(), req.getApplyUid(), req.getIsAgreed()); + session.getServer().getMultiplayerSystem().applyEnterMpReply(session.getPlayer(), req.getApplyUid(), req.getIsAgreed()); session.send(new PacketPlayerApplyEnterMpResultRsp(req.getApplyUid(), req.getIsAgreed())); } diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerPlayerEnterDungeonReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerPlayerEnterDungeonReq.java index ce05c8ccf..162eec998 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerPlayerEnterDungeonReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerPlayerEnterDungeonReq.java @@ -14,7 +14,7 @@ public class HandlerPlayerEnterDungeonReq extends PacketHandler { // Auto template PlayerEnterDungeonReq req = PlayerEnterDungeonReq.parseFrom(payload); - session.getServer().getDungeonManager().enterDungeon(session.getPlayer(), req.getPointId(), req.getDungeonId()); + session.getServer().getDungeonSystem().enterDungeon(session.getPlayer(), req.getPointId(), req.getDungeonId()); } } diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerPlayerGetForceQuitBanInfoReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerPlayerGetForceQuitBanInfoReq.java index 65740c7fd..f0b5311a9 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerPlayerGetForceQuitBanInfoReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerPlayerGetForceQuitBanInfoReq.java @@ -13,7 +13,7 @@ public class HandlerPlayerGetForceQuitBanInfoReq extends PacketHandler { @Override public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { - if (session.getServer().getMultiplayerManager().leaveCoop(session.getPlayer())) { + if (session.getServer().getMultiplayerSystem().leaveCoop(session.getPlayer())) { // Success session.send(new PacketPlayerGetForceQuitBanInfoRsp(RetcodeOuterClass.Retcode.RET_SUCC_VALUE)); } else { diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerPlayerQuitDungeonReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerPlayerQuitDungeonReq.java index e33190847..9bc450149 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerPlayerQuitDungeonReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerPlayerQuitDungeonReq.java @@ -10,7 +10,7 @@ public class HandlerPlayerQuitDungeonReq extends PacketHandler { @Override public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { - session.getPlayer().getServer().getDungeonManager().exitDungeon(session.getPlayer()); + session.getPlayer().getServer().getDungeonSystem().exitDungeon(session.getPlayer()); } } diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerReliquaryDecomposeReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerReliquaryDecomposeReq.java index d34833596..a098ef0d6 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerReliquaryDecomposeReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerReliquaryDecomposeReq.java @@ -11,6 +11,6 @@ public class HandlerReliquaryDecomposeReq extends PacketHandler { @Override public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { ReliquaryDecomposeReq req = ReliquaryDecomposeReq.parseFrom(payload); - session.getServer().getCombineManger().decomposeReliquaries(session.getPlayer(), req.getConfigId(), req.getTargetCount(), req.getGuidListList()); + session.getServer().getCombineSystem().decomposeReliquaries(session.getPlayer(), req.getConfigId(), req.getTargetCount(), req.getGuidListList()); } } diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerReliquaryUpgradeReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerReliquaryUpgradeReq.java index bd8ec9e58..6eb19b7ed 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerReliquaryUpgradeReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerReliquaryUpgradeReq.java @@ -13,7 +13,7 @@ public class HandlerReliquaryUpgradeReq extends PacketHandler { public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { ReliquaryUpgradeReq req = ReliquaryUpgradeReq.parseFrom(payload); - session.getServer().getInventoryManager().upgradeRelic(session.getPlayer(), req.getTargetReliquaryGuid(), req.getFoodReliquaryGuidListList(), req.getItemParamListList()); + session.getServer().getInventorySystem().upgradeRelic(session.getPlayer(), req.getTargetReliquaryGuid(), req.getFoodReliquaryGuidListList(), req.getItemParamListList()); } } diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerSceneKickPlayerReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerSceneKickPlayerReq.java index 732664481..fec303b4b 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerSceneKickPlayerReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerSceneKickPlayerReq.java @@ -14,7 +14,7 @@ public class HandlerSceneKickPlayerReq extends PacketHandler { public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { SceneKickPlayerReq req = SceneKickPlayerReq.parseFrom(payload); - if (session.getServer().getMultiplayerManager().kickPlayer(session.getPlayer(), req.getTargetUid())) { + if (session.getServer().getMultiplayerSystem().kickPlayer(session.getPlayer(), req.getTargetUid())) { // Success session.send(new PacketSceneKickPlayerRsp(req.getTargetUid())); } else { diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerSetEquipLockStateReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerSetEquipLockStateReq.java index 27bd8b1cb..2467650f9 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerSetEquipLockStateReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerSetEquipLockStateReq.java @@ -13,7 +13,7 @@ public class HandlerSetEquipLockStateReq extends PacketHandler { public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { SetEquipLockStateReq req = SetEquipLockStateReq.parseFrom(payload); - session.getServer().getInventoryManager().lockEquip(session.getPlayer(), req.getTargetEquipGuid(), req.getIsLocked()); + session.getServer().getInventorySystem().lockEquip(session.getPlayer(), req.getTargetEquipGuid(), req.getIsLocked()); } } diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerTowerAllDataReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerTowerAllDataReq.java index 38462882f..c9fa5b112 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerTowerAllDataReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerTowerAllDataReq.java @@ -12,7 +12,7 @@ public class HandlerTowerAllDataReq extends PacketHandler { @Override public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { session.send(new PacketTowerAllDataRsp( - session.getServer().getTowerScheduleManager(), + session.getServer().getTowerSystem(), session.getPlayer().getTowerManager() )); } diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerUnlockAvatarTalentReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerUnlockAvatarTalentReq.java index 93cf1cad7..d37df8618 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerUnlockAvatarTalentReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerUnlockAvatarTalentReq.java @@ -14,7 +14,7 @@ public class HandlerUnlockAvatarTalentReq extends PacketHandler { UnlockAvatarTalentReq req = UnlockAvatarTalentReq.parseFrom(payload); // Unlock avatar const - session.getServer().getInventoryManager().unlockAvatarConstellation(session.getPlayer(), req.getAvatarGuid()); + session.getServer().getInventorySystem().unlockAvatarConstellation(session.getPlayer(), req.getAvatarGuid()); } } diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerUseItemReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerUseItemReq.java index daf4e4c04..0941dafed 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerUseItemReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerUseItemReq.java @@ -15,7 +15,7 @@ public class HandlerUseItemReq extends PacketHandler { public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { UseItemReq req = UseItemReq.parseFrom(payload); - GameItem useItem = session.getServer().getInventoryManager().useItem(session.getPlayer(), req.getTargetGuid(), req.getGuid(), req.getCount(), req.getOptionIdx()); + GameItem useItem = session.getServer().getInventorySystem().useItem(session.getPlayer(), req.getTargetGuid(), req.getGuid(), req.getCount(), req.getOptionIdx()); if (useItem != null) { session.send(new PacketUseItemRsp(req.getTargetGuid(), useItem)); } else { diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerWeaponAwakenReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerWeaponAwakenReq.java index b33510ad0..0c9fcd68c 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerWeaponAwakenReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerWeaponAwakenReq.java @@ -14,7 +14,7 @@ public class HandlerWeaponAwakenReq extends PacketHandler { WeaponAwakenReq req = WeaponAwakenReq.parseFrom(payload); // Weapon refinement - session.getServer().getInventoryManager().refineWeapon(session.getPlayer(), req.getTargetWeaponGuid(), req.getItemGuid()); + session.getServer().getInventorySystem().refineWeapon(session.getPlayer(), req.getTargetWeaponGuid(), req.getItemGuid()); } } diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerWeaponPromoteReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerWeaponPromoteReq.java index 0b3c23b49..bbb50bd5d 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerWeaponPromoteReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerWeaponPromoteReq.java @@ -14,7 +14,7 @@ public class HandlerWeaponPromoteReq extends PacketHandler { WeaponPromoteReq req = WeaponPromoteReq.parseFrom(payload); // Ascend weapon - session.getServer().getInventoryManager().promoteWeapon(session.getPlayer(), req.getTargetWeaponGuid()); + session.getServer().getInventorySystem().promoteWeapon(session.getPlayer(), req.getTargetWeaponGuid()); } } diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerWeaponUpgradeReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerWeaponUpgradeReq.java index f099c976a..3e531afa6 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerWeaponUpgradeReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerWeaponUpgradeReq.java @@ -14,7 +14,7 @@ public class HandlerWeaponUpgradeReq extends PacketHandler { WeaponUpgradeReq req = WeaponUpgradeReq.parseFrom(payload); // Level up weapon - session.getServer().getInventoryManager().upgradeWeapon( + session.getServer().getInventorySystem().upgradeWeapon( session.getPlayer(), req.getTargetWeaponGuid(), req.getFoodWeaponGuidListList(), diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketGetGachaInfoRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketGetGachaInfoRsp.java index 1bd3ea876..bc1e3f1e3 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketGetGachaInfoRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketGetGachaInfoRsp.java @@ -1,13 +1,13 @@ package emu.grasscutter.server.packet.send; -import emu.grasscutter.game.gacha.GachaManager; +import emu.grasscutter.game.gacha.GachaSystem; import emu.grasscutter.game.player.Player; import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; public class PacketGetGachaInfoRsp extends BasePacket { - public PacketGetGachaInfoRsp(GachaManager manager, Player player) { + public PacketGetGachaInfoRsp(GachaSystem manager, Player player) { super(PacketOpcodes.GetGachaInfoRsp); this.setData(manager.toProto(player)); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketGetInvestigationMonsterRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketGetInvestigationMonsterRsp.java index 51e88a71e..306cbca57 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketGetInvestigationMonsterRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketGetInvestigationMonsterRsp.java @@ -1,7 +1,7 @@ package emu.grasscutter.server.packet.send; import emu.grasscutter.game.player.Player; -import emu.grasscutter.game.world.WorldDataManager; +import emu.grasscutter.game.world.WorldDataSystem; import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.GetActivityInfoRspOuterClass; @@ -11,7 +11,7 @@ import java.util.List; public class PacketGetInvestigationMonsterRsp extends BasePacket { - public PacketGetInvestigationMonsterRsp(Player player, WorldDataManager worldDataManager, List cityIdListList) { + public PacketGetInvestigationMonsterRsp(Player player, WorldDataSystem worldDataManager, List cityIdListList) { super(PacketOpcodes.GetInvestigationMonsterRsp); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketGetShopRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketGetShopRsp.java index f76f3d198..0bee63451 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketGetShopRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketGetShopRsp.java @@ -4,7 +4,7 @@ import emu.grasscutter.Grasscutter; import emu.grasscutter.game.player.Player; import emu.grasscutter.game.shop.ShopInfo; import emu.grasscutter.game.shop.ShopLimit; -import emu.grasscutter.game.shop.ShopManager; +import emu.grasscutter.game.shop.ShopSystem; import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.GetShopRspOuterClass; @@ -27,7 +27,7 @@ public class PacketGetShopRsp extends BasePacket { .setCityId(1) //mock .setCityReputationLevel(10); //mock - ShopManager manager = Grasscutter.getGameServer().getShopManager(); + ShopSystem manager = Grasscutter.getGameServer().getShopSystem(); if (manager.getShopData().get(shopType) != null) { List list = manager.getShopData().get(shopType); List goodsList = new ArrayList<>(); @@ -54,7 +54,7 @@ public class PacketGetShopRsp extends BasePacket { int currentTs = Utils.getCurrentSeconds(); ShopLimit currentShopLimit = inv.getGoodsLimit(info.getGoodsId()); - int nextRefreshTime = ShopManager.getShopNextRefreshTime(info); + int nextRefreshTime = ShopSystem.getShopNextRefreshTime(info); if (currentShopLimit != null) { if (currentShopLimit.getNextRefreshTime() < currentTs) { // second game day currentShopLimit.setHasBoughtInPeriod(0); diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketTowerAllDataRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketTowerAllDataRsp.java index 654aa4a07..e7adf1833 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketTowerAllDataRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketTowerAllDataRsp.java @@ -1,7 +1,7 @@ package emu.grasscutter.server.packet.send; import emu.grasscutter.game.tower.TowerManager; -import emu.grasscutter.game.tower.TowerScheduleManager; +import emu.grasscutter.game.tower.TowerSystem; import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.TowerAllDataRspOuterClass.TowerAllDataRsp; @@ -17,7 +17,7 @@ import java.util.stream.IntStream; public class PacketTowerAllDataRsp extends BasePacket { - public PacketTowerAllDataRsp(TowerScheduleManager towerScheduleManager, TowerManager towerManager) { + public PacketTowerAllDataRsp(TowerSystem towerScheduleManager, TowerManager towerManager) { super(PacketOpcodes.TowerAllDataRsp); var recordList = towerManager.getRecordMap().values().stream() diff --git a/src/main/java/emu/grasscutter/task/tasks/AnnouncementTask.java b/src/main/java/emu/grasscutter/task/tasks/AnnouncementTask.java index bb717221f..c6ec1619b 100644 --- a/src/main/java/emu/grasscutter/task/tasks/AnnouncementTask.java +++ b/src/main/java/emu/grasscutter/task/tasks/AnnouncementTask.java @@ -1,7 +1,7 @@ package emu.grasscutter.task.tasks; import emu.grasscutter.Grasscutter; -import emu.grasscutter.game.managers.AnnouncementManager; +import emu.grasscutter.game.managers.AnnouncementSystem; import emu.grasscutter.task.Task; import emu.grasscutter.task.TaskHandler; import org.quartz.JobExecutionContext; @@ -29,11 +29,11 @@ public final class AnnouncementTask extends TaskHandler { @Override public synchronized void execute(JobExecutionContext context) throws JobExecutionException { var current = new Date(); - var announceConfigItems = Grasscutter.getGameServer().getAnnouncementManager().getAnnounceConfigItemMap().values().stream() - .filter(AnnouncementManager.AnnounceConfigItem::isTick) + var announceConfigItems = Grasscutter.getGameServer().getAnnouncementSystem().getAnnounceConfigItemMap().values().stream() + .filter(AnnouncementSystem.AnnounceConfigItem::isTick) .filter(i -> current.after(i.getBeginTime())) .filter(i -> current.before(i.getEndTime())) - .collect(Collectors.toMap(AnnouncementManager.AnnounceConfigItem::getTemplateId, y -> y)); + .collect(Collectors.toMap(AnnouncementSystem.AnnounceConfigItem::getTemplateId, y -> y)); announceConfigItems.values().forEach(i -> intervalMap.compute(i.getTemplateId(), (k,v) -> v == null ? 1 : v + 1)); @@ -43,7 +43,7 @@ public final class AnnouncementTask extends TaskHandler { .map(i -> announceConfigItems.get(i.getKey())) .toList(); - Grasscutter.getGameServer().getAnnouncementManager().broadcast(toSend); + Grasscutter.getGameServer().getAnnouncementSystem().broadcast(toSend); Grasscutter.getLogger().debug("Broadcast {} announcement(s) to all online players", toSend.size()); // clear the interval count