mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-24 00:11:31 +00:00
Optimize invoke packet handling
This commit is contained in:
parent
1f86e7bb17
commit
b9fbc4975d
@ -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();
|
||||||
|
@ -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());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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) {
|
||||||
|
@ -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());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user