Optimize invoke packet handling

This commit is contained in:
Melledy 2022-05-08 05:39:12 -07:00
parent 1f86e7bb17
commit b9fbc4975d
4 changed files with 10 additions and 13 deletions

View File

@ -30,7 +30,7 @@ public class InvokeHandler<T> {
} }
public synchronized void update(Player player) { public synchronized void update(Player player) {
if (player.getWorld() == null) { if (player.getWorld() == null || player.getScene() == null) {
this.entryListForwardAll.clear(); this.entryListForwardAll.clear();
this.entryListForwardAllExceptCur.clear(); this.entryListForwardAllExceptCur.clear();
this.entryListForwardHost.clear(); this.entryListForwardHost.clear();

View File

@ -19,10 +19,6 @@ public class HandlerAbilityInvocationsNotify extends PacketHandler {
session.getPlayer().getAbilityManager().onAbilityInvoke(entry); session.getPlayer().getAbilityManager().onAbilityInvoke(entry);
session.getPlayer().getAbilityInvokeHandler().addEntry(entry.getForwardType(), entry); session.getPlayer().getAbilityInvokeHandler().addEntry(entry.getForwardType(), entry);
} }
if (notif.getInvokesList().size() > 0) {
session.getPlayer().getAbilityInvokeHandler().update(session.getPlayer());
}
} }
} }

View File

@ -74,14 +74,6 @@ public class HandlerCombatInvocationsNotify extends PacketHandler {
session.getPlayer().getCombatInvokeHandler().addEntry(entry.getForwardType(), entry); session.getPlayer().getCombatInvokeHandler().addEntry(entry.getForwardType(), entry);
} }
if (notif.getInvokeListList().size() > 0) {
session.getPlayer().getCombatInvokeHandler().update(session.getPlayer());
}
// Handle attack results last
while (!session.getPlayer().getAttackResults().isEmpty()) {
session.getPlayer().getScene().handleAttack(session.getPlayer().getAttackResults().poll());
}
} }
private void handleFallOnGround(GameSession session, GameEntity entity, MotionState motionState) { private void handleFallOnGround(GameSession session, GameEntity entity, MotionState motionState) {

View File

@ -15,5 +15,14 @@ public class HandlerUnionCmdNotify extends PacketHandler {
for (UnionCmd cmd : req.getCmdListList()) { for (UnionCmd cmd : req.getCmdListList()) {
session.getServer().getPacketHandler().handle(session, cmd.getMessageId(), EMPTY_BYTE_ARRAY, cmd.getBody().toByteArray()); session.getServer().getPacketHandler().handle(session, cmd.getMessageId(), EMPTY_BYTE_ARRAY, cmd.getBody().toByteArray());
} }
// Update
session.getPlayer().getCombatInvokeHandler().update(session.getPlayer());
session.getPlayer().getAbilityInvokeHandler().update(session.getPlayer());
// Handle attack results last
while (!session.getPlayer().getAttackResults().isEmpty()) {
session.getPlayer().getScene().handleAttack(session.getPlayer().getAttackResults().poll());
}
} }
} }