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
ae2d1fe4
Commit
ae2d1fe4
authored
Jul 21, 2022
by
github-actions
Committed by
Melledy
Jul 21, 2022
Browse files
Fix whitespace [skip actions]
parent
510d564b
Changes
166
Show whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/GameConstants.java
View file @
ae2d1fe4
src/main/java/emu/grasscutter/Grasscutter.java
View file @
ae2d1fe4
...
...
@@ -217,7 +217,7 @@ public final class Grasscutter {
*/
private
static
void
onShutdown
()
{
// Disable all plugins.
if
(
pluginManager
!=
null
)
if
(
pluginManager
!=
null
)
pluginManager
.
disablePlugins
();
}
...
...
src/main/java/emu/grasscutter/auth/DefaultAuthentication.java
View file @
ae2d1fe4
...
...
@@ -21,7 +21,7 @@ public final class DefaultAuthentication implements AuthenticationSystem {
private
OAuthAuthenticator
oAuthAuthenticator
=
new
OAuthAuthentication
();
public
DefaultAuthentication
()
{
if
(
ACCOUNT
.
EXPERIMENTAL_RealPassword
)
{
if
(
ACCOUNT
.
EXPERIMENTAL_RealPassword
)
{
passwordAuthenticator
=
new
ExperimentalPasswordAuthenticator
();
}
else
{
passwordAuthenticator
=
new
PasswordAuthenticator
();
...
...
src/main/java/emu/grasscutter/command/CommandMap.java
View file @
ae2d1fe4
...
...
@@ -237,7 +237,7 @@ public final class CommandMap {
Command
annotation
=
this
.
annotations
.
get
(
label
);
// Resolve targetPlayer
try
{
try
{
targetPlayer
=
getTargetPlayer
(
playerId
,
player
,
targetPlayer
,
args
);
}
catch
(
IllegalArgumentException
e
)
{
return
;
...
...
src/main/java/emu/grasscutter/command/commands/AccountCommand.java
View file @
ae2d1fe4
...
...
@@ -39,8 +39,8 @@ public final class AccountCommand implements CommandHandler {
int
uid
=
0
;
String
password
=
""
;
if
(
Configuration
.
ACCOUNT
.
EXPERIMENTAL_RealPassword
==
true
)
{
if
(
args
.
size
()
<
3
)
{
if
(
Configuration
.
ACCOUNT
.
EXPERIMENTAL_RealPassword
==
true
)
{
if
(
args
.
size
()
<
3
)
{
CommandHandler
.
sendMessage
(
null
,
"EXPERIMENTAL_RealPassword requires a password argument"
);
CommandHandler
.
sendMessage
(
null
,
"Usage: account create <username> <password> [uid]"
);
...
...
@@ -53,7 +53,7 @@ public final class AccountCommand implements CommandHandler {
uid
=
Integer
.
parseInt
(
args
.
get
(
3
));
}
catch
(
NumberFormatException
ignored
)
{
CommandHandler
.
sendMessage
(
null
,
translate
(
sender
,
"commands.account.invalid"
));
if
(
Configuration
.
ACCOUNT
.
EXPERIMENTAL_RealPassword
==
true
)
{
if
(
Configuration
.
ACCOUNT
.
EXPERIMENTAL_RealPassword
==
true
)
{
CommandHandler
.
sendMessage
(
null
,
"EXPERIMENTAL_RealPassword requires argument 2 to be a password, not a uid"
);
CommandHandler
.
sendMessage
(
null
,
"Usage: account create <username> <password> [uid]"
);
}
...
...
@@ -76,7 +76,7 @@ public final class AccountCommand implements CommandHandler {
CommandHandler
.
sendMessage
(
null
,
translate
(
sender
,
"commands.account.exists"
));
return
;
}
else
{
if
(
Configuration
.
ACCOUNT
.
EXPERIMENTAL_RealPassword
==
true
)
{
if
(
Configuration
.
ACCOUNT
.
EXPERIMENTAL_RealPassword
==
true
)
{
account
.
setPassword
(
BCrypt
.
withDefaults
().
hashToString
(
12
,
password
.
toCharArray
()));
}
account
.
addPermission
(
"*"
);
...
...
@@ -106,12 +106,12 @@ public final class AccountCommand implements CommandHandler {
CommandHandler
.
sendMessage
(
null
,
translate
(
sender
,
"commands.account.delete"
));
return
;
case
"resetpass"
:
if
(
Configuration
.
ACCOUNT
.
EXPERIMENTAL_RealPassword
!=
true
)
{
if
(
Configuration
.
ACCOUNT
.
EXPERIMENTAL_RealPassword
!=
true
)
{
CommandHandler
.
sendMessage
(
null
,
"resetpass requires EXPERIMENTAL_RealPassword to be true."
);
return
;
}
if
(
args
.
size
()
!=
3
)
{
if
(
args
.
size
()
!=
3
)
{
CommandHandler
.
sendMessage
(
null
,
"Invalid Args"
);
CommandHandler
.
sendMessage
(
null
,
"Usage: account resetpass <username> <password>"
);
return
;
...
...
src/main/java/emu/grasscutter/command/commands/AnnounceCommand.java
View file @
ae2d1fe4
...
...
@@ -28,7 +28,7 @@ public final class AnnounceCommand implements CommandHandler {
return
;
}
switch
(
args
.
get
(
0
)){
switch
(
args
.
get
(
0
))
{
case
"tpl"
:
if
(
args
.
size
()
<
2
)
{
CommandHandler
.
sendTranslatedMessage
(
sender
,
"commands.announce.command_usage"
);
...
...
@@ -37,7 +37,7 @@ public final class AnnounceCommand implements CommandHandler {
var
templateId
=
Integer
.
parseInt
(
args
.
get
(
1
));
var
tpl
=
manager
.
getAnnounceConfigItemMap
().
get
(
templateId
);
if
(
tpl
==
null
){
if
(
tpl
==
null
)
{
CommandHandler
.
sendMessage
(
sender
,
translate
(
sender
,
"commands.announce.not_found"
,
templateId
));
return
;
}
...
...
src/main/java/emu/grasscutter/command/commands/CoopCommand.java
View file @
ae2d1fe4
src/main/java/emu/grasscutter/command/commands/EnterDungeonCommand.java
View file @
ae2d1fe4
src/main/java/emu/grasscutter/command/commands/GiveCommand.java
View file @
ae2d1fe4
...
...
@@ -257,7 +257,7 @@ public final class GiveCommand implements CommandHandler {
if
(
avatar
.
getAvatarId
()
==
GameConstants
.
MAIN_CHARACTER_MALE
)
{
avatar
.
setSkillDepotData
(
GameData
.
getAvatarSkillDepotDataMap
().
get
(
504
));
}
else
if
(
avatar
.
getAvatarId
()
==
GameConstants
.
MAIN_CHARACTER_FEMALE
)
{
else
if
(
avatar
.
getAvatarId
()
==
GameConstants
.
MAIN_CHARACTER_FEMALE
)
{
avatar
.
setSkillDepotData
(
GameData
.
getAvatarSkillDepotDataMap
().
get
(
704
));
}
...
...
src/main/java/emu/grasscutter/command/commands/HelpCommand.java
View file @
ae2d1fe4
...
...
@@ -22,13 +22,13 @@ public final class HelpCommand implements CommandHandler {
}
}
builder
.
append
(
"\n\t"
).
append
(
translate
(
player
,
"commands.help.tip_need_permission"
));
if
(
annotation
.
permission
().
isEmpty
()
||
annotation
.
permission
().
isBlank
())
{
if
(
annotation
.
permission
().
isEmpty
()
||
annotation
.
permission
().
isBlank
())
{
builder
.
append
(
translate
(
player
,
"commands.help.tip_need_no_permission"
));
}
else
{
builder
.
append
(
annotation
.
permission
());
}
if
(!
annotation
.
permissionTargeted
().
isEmpty
()
&&
!
annotation
.
permissionTargeted
().
isBlank
())
{
if
(!
annotation
.
permissionTargeted
().
isEmpty
()
&&
!
annotation
.
permissionTargeted
().
isBlank
())
{
String
permissionTargeted
=
annotation
.
permissionTargeted
();
builder
.
append
(
" "
).
append
(
translate
(
player
,
"commands.help.tip_permission_targeted"
,
permissionTargeted
));
}
...
...
src/main/java/emu/grasscutter/command/commands/ReloadCommand.java
View file @
ae2d1fe4
src/main/java/emu/grasscutter/command/commands/SendMailCommand.java
View file @
ae2d1fe4
...
...
@@ -27,7 +27,7 @@ public final class SendMailCommand implements CommandHandler {
@Override
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
int
senderId
;
if
(
sender
!=
null
)
{
if
(
sender
!=
null
)
{
senderId
=
sender
.
getUid
();
}
else
{
senderId
=
-
1
;
...
...
@@ -162,7 +162,7 @@ public final class SendMailCommand implements CommandHandler {
}
private
String
getConstructionArgs
(
int
stage
,
Player
sender
)
{
return
switch
(
stage
)
{
return
switch
(
stage
)
{
case
0
->
translate
(
sender
,
"commands.sendMail.title"
);
case
1
->
translate
(
sender
,
"commands.sendMail.message"
);
case
2
->
translate
(
sender
,
"commands.sendMail.sender"
);
...
...
src/main/java/emu/grasscutter/command/commands/SetPropCommand.java
View file @
ae2d1fe4
...
...
@@ -107,7 +107,7 @@ public final class SetPropCommand implements CommandHandler {
return
;
}
try
{
value
=
switch
(
valueStr
.
toLowerCase
())
{
value
=
switch
(
valueStr
.
toLowerCase
())
{
case
"on"
,
"true"
->
1
;
case
"off"
,
"false"
->
0
;
case
"toggle"
->
-
1
;
...
...
src/main/java/emu/grasscutter/command/commands/SpawnCommand.java
View file @
ae2d1fe4
...
...
@@ -86,7 +86,7 @@ public final class SpawnCommand implements CommandHandler {
double
maxRadius
=
Math
.
sqrt
(
amount
*
0.2
/
Math
.
PI
);
for
(
int
i
=
0
;
i
<
amount
;
i
++)
{
Position
pos
=
GetRandomPositionInCircle
(
targetPlayer
.
getPosition
(),
maxRadius
).
addY
(
3
);
if
(
x
!=
0
&&
y
!=
0
&&
z
!=
0
)
{
if
(
x
!=
0
&&
y
!=
0
&&
z
!=
0
)
{
pos
=
GetRandomPositionInCircle
(
new
Position
(
x
,
y
,
z
),
maxRadius
).
addY
(
3
);
}
GameEntity
entity
=
null
;
...
...
@@ -120,7 +120,7 @@ public final class SpawnCommand implements CommandHandler {
CommandHandler
.
sendMessage
(
sender
,
translate
(
sender
,
"commands.spawn.success"
,
Integer
.
toString
(
amount
),
Integer
.
toString
(
id
)));
}
private
Position
GetRandomPositionInCircle
(
Position
origin
,
double
radius
){
private
Position
GetRandomPositionInCircle
(
Position
origin
,
double
radius
)
{
Position
target
=
origin
.
clone
();
double
angle
=
Math
.
random
()
*
360
;
double
r
=
Math
.
sqrt
(
Math
.
random
()
*
radius
*
radius
);
...
...
src/main/java/emu/grasscutter/command/commands/TeamCommand.java
View file @
ae2d1fe4
...
...
@@ -142,7 +142,7 @@ public final class TeamCommand implements CommandHandler {
try
{
index
=
Integer
.
parseInt
(
args
.
get
(
1
))
-
1
;
if
(
index
<
0
)
index
=
0
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
CommandHandler
.
sendTranslatedMessage
(
sender
,
"commands.team.failed_to_parse_index"
,
args
.
get
(
1
));
return
false
;
}
...
...
@@ -155,7 +155,7 @@ public final class TeamCommand implements CommandHandler {
int
avatarId
;
try
{
avatarId
=
Integer
.
parseInt
(
args
.
get
(
2
));
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
CommandHandler
.
sendTranslatedMessage
(
sender
,
"commands.team.failed_parse_avatar_id"
,
args
.
get
(
2
));
return
false
;
}
...
...
src/main/java/emu/grasscutter/command/commands/TeleportAllCommand.java
View file @
ae2d1fe4
src/main/java/emu/grasscutter/command/commands/TeleportCommand.java
View file @
ae2d1fe4
src/main/java/emu/grasscutter/config/ConfigContainer.java
View file @
ae2d1fe4
...
...
@@ -28,7 +28,7 @@ public class ConfigContainer {
try
{
// Check if the server is using a legacy config.
JsonObject
configObject
=
Grasscutter
.
getGsonFactory
()
.
fromJson
(
new
FileReader
(
Grasscutter
.
configFile
),
JsonObject
.
class
);
if
(!
configObject
.
has
(
"version"
))
{
if
(!
configObject
.
has
(
"version"
))
{
Grasscutter
.
getLogger
().
info
(
"Updating legacy .."
);
Grasscutter
.
saveConfig
(
null
);
}
...
...
@@ -37,7 +37,7 @@ public class ConfigContainer {
var
existing
=
config
.
version
;
var
latest
=
version
();
if
(
existing
==
latest
)
if
(
existing
==
latest
)
return
;
// Create a new configuration instance.
...
...
src/main/java/emu/grasscutter/config/Configuration.java
View file @
ae2d1fe4
src/main/java/emu/grasscutter/data/DataLoader.java
View file @
ae2d1fe4
Prev
1
2
3
4
5
…
9
Next
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