Commit 55389d3a authored by Melledy's avatar Melledy
Browse files

Optimize invoke packet handling

parent 2dfdc627
......@@ -30,7 +30,7 @@ public class InvokeHandler<T> {
}
public synchronized void update(Player player) {
if (player.getWorld() == null) {
if (player.getWorld() == null || player.getScene() == null) {
this.entryListForwardAll.clear();
this.entryListForwardAllExceptCur.clear();
this.entryListForwardHost.clear();
......
......@@ -19,10 +19,6 @@ public class HandlerAbilityInvocationsNotify extends PacketHandler {
session.getPlayer().getAbilityManager().onAbilityInvoke(entry);
session.getPlayer().getAbilityInvokeHandler().addEntry(entry.getForwardType(), entry);
}
if (notif.getInvokesList().size() > 0) {
session.getPlayer().getAbilityInvokeHandler().update(session.getPlayer());
}
}
}
......@@ -74,14 +74,6 @@ public class HandlerCombatInvocationsNotify extends PacketHandler {
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) {
......
......@@ -15,5 +15,14 @@ public class HandlerUnionCmdNotify extends PacketHandler {
for (UnionCmd cmd : req.getCmdListList()) {
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());
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment