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
de0a14a5
Commit
de0a14a5
authored
Apr 20, 2022
by
iTruth
Browse files
Fix playerOpt is always throw an exception when it's null
parent
7fc587e7
Changes
1
Show whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/server/game/GameServer.java
View file @
de0a14a5
...
@@ -145,7 +145,7 @@ public final class GameServer extends MihoyoKcpServer {
...
@@ -145,7 +145,7 @@ public final class GameServer extends MihoyoKcpServer {
public
Account
getAccountByName
(
String
username
)
{
public
Account
getAccountByName
(
String
username
)
{
Optional
<
GenshinPlayer
>
playerOpt
=
getPlayers
().
values
().
stream
().
filter
(
player
->
player
.
getAccount
().
getUsername
().
equals
(
username
)).
findFirst
();
Optional
<
GenshinPlayer
>
playerOpt
=
getPlayers
().
values
().
stream
().
filter
(
player
->
player
.
getAccount
().
getUsername
().
equals
(
username
)).
findFirst
();
if
(
playerOpt
.
get
()
!=
null
)
{
if
(
playerOpt
.
isPresent
()
)
{
return
playerOpt
.
get
().
getAccount
();
return
playerOpt
.
get
().
getAccount
();
}
}
return
DatabaseHelper
.
getAccountByName
(
username
);
return
DatabaseHelper
.
getAccountByName
(
username
);
...
...
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