Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
ziqian zhang
Grasscutter
Commits
55389d3a
Commit
55389d3a
authored
May 08, 2022
by
Melledy
Browse files
Optimize invoke packet handling
parent
2dfdc627
Changes
4
Show whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/game/player/InvokeHandler.java
View file @
55389d3a
...
@@ -30,7 +30,7 @@ public class InvokeHandler<T> {
...
@@ -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
();
...
...
src/main/java/emu/grasscutter/server/packet/recv/HandlerAbilityInvocationsNotify.java
View file @
55389d3a
...
@@ -19,10 +19,6 @@ public class HandlerAbilityInvocationsNotify extends PacketHandler {
...
@@ -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
());
}
}
}
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerCombatInvocationsNotify.java
View file @
55389d3a
...
@@ -74,14 +74,6 @@ public class HandlerCombatInvocationsNotify extends PacketHandler {
...
@@ -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
)
{
...
...
src/main/java/emu/grasscutter/server/packet/recv/HandlerUnionCmdNotify.java
View file @
55389d3a
...
@@ -15,5 +15,14 @@ public class HandlerUnionCmdNotify extends PacketHandler {
...
@@ -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
());
}
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment