mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2024-11-23 20:39:52 +00:00
fix: HomeModuleManager isnt ticked unless player changes module (#2365)
This commit is contained in:
parent
c4dbb6851b
commit
5458d36102
@ -59,11 +59,11 @@ public class HomeModuleManager {
|
||||
}
|
||||
|
||||
public void onUpdateArrangement() {
|
||||
this.fireAllAvatarRewardEvent();
|
||||
this.cancelSummonEventIfAvatarLeave();
|
||||
this.fireAllAvatarRewardEvents();
|
||||
this.cancelSummonEventsIfAvatarLeave();
|
||||
}
|
||||
|
||||
private void fireAllAvatarRewardEvent() {
|
||||
private void fireAllAvatarRewardEvents() {
|
||||
this.rewardEvents.clear();
|
||||
var allBlockItems =
|
||||
Stream.of(this.getOutdoorSceneItem(), this.getIndoorSceneItem())
|
||||
@ -111,7 +111,7 @@ public class HomeModuleManager {
|
||||
}
|
||||
}
|
||||
|
||||
private void cancelSummonEventIfAvatarLeave() {
|
||||
private void cancelSummonEventsIfAvatarLeave() {
|
||||
var avatars =
|
||||
Stream.of(this.getOutdoorSceneItem(), this.getIndoorSceneItem())
|
||||
.map(HomeSceneItem::getBlockItems)
|
||||
@ -225,10 +225,14 @@ public class HomeModuleManager {
|
||||
|
||||
this.outdoor.addEntities(this.getOutdoorSceneItem().getAnimals(this.outdoor));
|
||||
this.indoor.addEntities(this.getIndoorSceneItem().getAnimals(this.indoor));
|
||||
this.fireAllAvatarRewardEvent();
|
||||
this.fireAllAvatarRewardEvents();
|
||||
}
|
||||
|
||||
public void onRemovedModule() {
|
||||
if (this.moduleId == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.outdoor.getEntities().clear();
|
||||
this.indoor.getEntities().clear();
|
||||
}
|
||||
|
@ -11,13 +11,15 @@ import emu.grasscutter.server.game.GameServer;
|
||||
import emu.grasscutter.server.packet.send.PacketDelTeamEntityNotify;
|
||||
import emu.grasscutter.server.packet.send.PacketPlayerChatNotify;
|
||||
import emu.grasscutter.server.packet.send.PacketPlayerGameTimeNotify;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@Getter
|
||||
public class HomeWorld extends World {
|
||||
@Getter private final GameHome home;
|
||||
@Getter private HomeModuleManager moduleManager;
|
||||
private final GameHome home;
|
||||
private HomeModuleManager moduleManager;
|
||||
|
||||
public HomeWorld(GameServer server, Player owner) {
|
||||
super(server, owner);
|
||||
@ -60,7 +62,11 @@ public class HomeWorld extends World {
|
||||
}
|
||||
|
||||
public int getActiveIndoorSceneId() {
|
||||
return this.getSceneById(this.getActiveOutdoorSceneId()).getSceneItem().getRoomSceneId();
|
||||
return this.isRealmIdValid() ? this.getSceneById(this.getActiveOutdoorSceneId()).getSceneItem().getRoomSceneId() : -1;
|
||||
}
|
||||
|
||||
public boolean isRealmIdValid() {
|
||||
return this.getHost().getCurrentRealmId() > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -14,6 +14,7 @@ public class HandlerHomeChooseModuleReq extends PacketHandler {
|
||||
HomeChooseModuleReqOuterClass.HomeChooseModuleReq.parseFrom(payload);
|
||||
session.getPlayer().addRealmList(req.getModuleId());
|
||||
session.getPlayer().setCurrentRealmId(req.getModuleId());
|
||||
session.getPlayer().getCurHomeWorld().refreshModuleManager();
|
||||
session.send(new PacketHomeChooseModuleRsp(req.getModuleId()));
|
||||
session.send(new PacketPlayerHomeCompInfoNotify(session.getPlayer()));
|
||||
session.send(new PacketHomeComfortInfoNotify(session.getPlayer()));
|
||||
|
Loading…
Reference in New Issue
Block a user