mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-01-25 03:53:00 +08:00
Refactor game server managers to systems
This commit is contained in:
parent
d20e9d1f72
commit
2e19e70fe1
@ -22,7 +22,7 @@ public final class AnnounceCommand implements CommandHandler {
|
||||
|
||||
@Override
|
||||
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
||||
var manager = Grasscutter.getGameServer().getAnnouncementManager();
|
||||
var manager = Grasscutter.getGameServer().getAnnouncementSystem();
|
||||
if (args.size() < 1) {
|
||||
CommandHandler.sendTranslatedMessage(sender, "commands.announce.command_usage");
|
||||
return;
|
||||
|
@ -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()));
|
||||
}
|
||||
}
|
||||
|
@ -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"));
|
||||
|
@ -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"));
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ public final class SetPropCommand implements CommandHandler {
|
||||
}
|
||||
|
||||
private boolean setTowerLevel(Player sender, Player targetPlayer, int topFloor) {
|
||||
List<Integer> floorIds = targetPlayer.getServer().getTowerScheduleManager().getAllFloors();
|
||||
List<Integer> floorIds = targetPlayer.getServer().getTowerSystem().getAllFloors();
|
||||
if (topFloor < 0 || topFloor > floorIds.size()) {
|
||||
String min = Integer.toString(0);
|
||||
String max = Integer.toString(floorIds.size());
|
||||
|
@ -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
|
||||
|
@ -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<WatcherTriggerType, List<BattlePassMissionData>> 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()) {
|
@ -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<List<Integer>> 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() {
|
||||
|
@ -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<List<DropData>> getDropData() {
|
||||
return dropData;
|
||||
}
|
||||
|
||||
public class DropSystem extends BaseGameSystem {
|
||||
private final Int2ObjectMap<List<DropData>> dropData;
|
||||
|
||||
public DropManager(GameServer gameServer) {
|
||||
this.gameServer = gameServer;
|
||||
public DropSystem(GameServer server) {
|
||||
super(server);
|
||||
this.dropData = new Int2ObjectOpenHashMap<>();
|
||||
this.load();
|
||||
}
|
||||
|
||||
public Int2ObjectMap<List<DropData>> getDropData() {
|
||||
return dropData;
|
||||
}
|
||||
|
||||
public synchronized void load() {
|
||||
try (Reader fileReader = new InputStreamReader(DataLoader.load("Drop.json"))) {
|
@ -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) {
|
@ -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());
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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<List<ExpeditionRewardDataList>> getExpeditionRewardDataList() { return expeditionRewardData; }
|
||||
|
||||
public class ExpeditionSystem extends BaseGameSystem {
|
||||
private final Int2ObjectMap<List<ExpeditionRewardDataList>> expeditionRewardData;
|
||||
|
||||
public ExpeditionManager(GameServer gameServer) {
|
||||
this.gameServer = gameServer;
|
||||
public ExpeditionSystem(GameServer server) {
|
||||
super(server);
|
||||
this.expeditionRewardData = new Int2ObjectOpenHashMap<>();
|
||||
this.load();
|
||||
}
|
||||
|
||||
public Int2ObjectMap<List<ExpeditionRewardDataList>> getExpeditionRewardDataList() {
|
||||
return expeditionRewardData;
|
||||
}
|
||||
|
||||
public synchronized void load() {
|
||||
try (Reader fileReader = new InputStreamReader(DataLoader.load("ExpeditionReward.json"))) {
|
@ -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<GachaBanner> 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<GachaBanner> getGachaBanners() {
|
||||
return gachaBanners;
|
||||
}
|
@ -260,11 +260,11 @@ public class Inventory extends BasePlayerManager implements Iterable<GameItem> {
|
||||
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
|
||||
|
@ -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<Integer, AnnounceConfigItem> announceConfigItemMap;
|
||||
|
||||
public AnnouncementSystem(GameServer server){
|
||||
super(server);
|
||||
this.announceConfigItemMap = new HashMap<>();
|
||||
loadConfig();
|
||||
}
|
||||
Map<Integer, AnnounceConfigItem> announceConfigItemMap = new HashMap<>();
|
||||
|
||||
private int loadConfig() {
|
||||
try (var fileReader = new InputStreamReader(DataLoader.load("Announcement.json"))) {
|
||||
List<AnnounceConfigItem> 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);
|
||||
}
|
@ -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<ShopChestTable> shopChestTableList = player.getServer().getShopManager().getShopChestData();
|
||||
List<ShopChestTable> shopChestTableList = player.getServer().getShopSystem().getShopChestData();
|
||||
List<GameItem> rewardItemList = new ArrayList<>();
|
||||
for (ShopChestTable shopChestTable : shopChestTableList) {
|
||||
if (shopChestTable.getItemId() != useItem.getItemId()) {
|
||||
@ -914,7 +909,7 @@ public class InventoryManager {
|
||||
if (optionId < 1) {
|
||||
break;
|
||||
}
|
||||
List<ShopChestBatchUseTable> shopChestBatchUseTableList = player.getServer().getShopManager().getShopChestBatchUseData();
|
||||
List<ShopChestBatchUseTable> shopChestBatchUseTableList = player.getServer().getShopSystem().getShopChestBatchUseData();
|
||||
for (ShopChestBatchUseTable shopChestBatchUseTable : shopChestBatchUseTableList) {
|
||||
if (shopChestBatchUseTable.getItemId() != useItem.getItemId()) {
|
||||
continue;
|
@ -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) {
|
@ -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) {
|
||||
|
@ -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());
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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<QuestBaseHandler> condHandlers;
|
||||
private final Int2ObjectMap<QuestBaseHandler> contHandlers;
|
||||
private final Int2ObjectMap<QuestExecHandler> execHandlers;
|
||||
|
||||
public ServerQuestHandler() {
|
||||
public QuestSystem(GameServer server) {
|
||||
super(server);
|
||||
|
||||
this.condHandlers = new Int2ObjectOpenHashMap<>();
|
||||
this.contHandlers = new Int2ObjectOpenHashMap<>();
|
||||
this.execHandlers = new Int2ObjectOpenHashMap<>();
|
@ -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<List<ShopInfo>> getShopData() {
|
||||
return shopData;
|
||||
}
|
||||
|
||||
public List<ShopChestTable> getShopChestData() {
|
||||
return shopChestData;
|
||||
}
|
||||
|
||||
public List<ShopChestBatchUseTable> getShopChestBatchUseData() {
|
||||
return shopChestBatchUseData;
|
||||
}
|
||||
|
||||
public class ShopSystem extends BaseGameSystem {
|
||||
private final Int2ObjectMap<List<ShopInfo>> shopData;
|
||||
private final List<ShopChestTable> shopChestData;
|
||||
private final List<ShopChestBatchUseTable> 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<List<ShopInfo>> 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<ShopChestTable> getShopChestData() {
|
||||
return shopChestData;
|
||||
}
|
||||
|
||||
public List<ShopChestBatchUseTable> getShopChestBatchUseData() {
|
||||
return shopChestBatchUseData;
|
||||
}
|
||||
|
||||
public static int getShopNextRefreshTime(ShopInfo shopInfo) {
|
||||
return switch (shopInfo.getShopRefreshType()) {
|
@ -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<Integer, TowerLevelRecord> 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;
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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<String, ChestInteractHandler> chestInteractHandlerMap; // chestType-Handler
|
||||
private final Map<String, SceneGroup> sceneInvestigationGroupMap; // <sceneId_groupId, Group>
|
||||
|
||||
public WorldDataManager(GameServer gameServer){
|
||||
this.gameServer = gameServer;
|
||||
public WorldDataSystem(GameServer server){
|
||||
super(server);
|
||||
this.chestInteractHandlerMap = new HashMap<>();
|
||||
this.sceneInvestigationGroupMap = new ConcurrentHashMap<>();
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -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<Integer, Player> players;
|
||||
private final Set<World> worlds;
|
||||
private final Map<Integer, Player> players;
|
||||
private final Set<World> 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<Integer, Player> getPlayers() {
|
||||
return players;
|
||||
}
|
||||
|
||||
public Set<World> 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;
|
||||
|
@ -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.
|
||||
|
@ -34,8 +34,8 @@ public class HandlerAvatarExpeditionGetRewardReq extends PacketHandler {
|
||||
|
||||
List<GameItem> 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()) {
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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(),
|
||||
|
@ -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<ShopInfo> configShop = session.getServer().getShopManager().getShopData().get(buyGoodsReq.getShopType());
|
||||
List<ShopInfo> 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
|
||||
|
@ -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<ItemParam> returnOres = session.getServer().getInventoryManager().calcWeaponUpgradeReturnItems(
|
||||
List<ItemParam> returnOres = session.getServer().getInventorySystem().calcWeaponUpgradeReturnItems(
|
||||
session.getPlayer(),
|
||||
req.getTargetWeaponGuid(),
|
||||
req.getFoodWeaponGuidListList(),
|
||||
|
@ -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){
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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()));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ public class HandlerGetInvestigationMonsterReq extends PacketHandler {
|
||||
|
||||
session.send(new PacketGetInvestigationMonsterRsp(
|
||||
session.getPlayer(),
|
||||
session.getServer().getWorldDataManager(),
|
||||
session.getServer().getWorldDataSystem(),
|
||||
req.getCityIdListList()));
|
||||
|
||||
}
|
||||
|
@ -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()));
|
||||
}
|
||||
|
||||
|
@ -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()));
|
||||
}
|
||||
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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()
|
||||
));
|
||||
}
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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(),
|
||||
|
@ -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));
|
||||
|
@ -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<Integer> cityIdListList) {
|
||||
public PacketGetInvestigationMonsterRsp(Player player, WorldDataSystem worldDataManager, List<Integer> cityIdListList) {
|
||||
|
||||
super(PacketOpcodes.GetInvestigationMonsterRsp);
|
||||
|
||||
|
@ -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<ShopInfo> list = manager.getShopData().get(shopType);
|
||||
List<ShopGoods> 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);
|
||||
|
@ -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()
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user