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
104e04f7
Commit
104e04f7
authored
Jul 21, 2022
by
AnimeGitB
Committed by
Luke H-W
Jul 22, 2022
Browse files
Change commands to use new usage message method.
parent
2cfbe781
Changes
34
Hide whitespace changes
Inline
Side-by-side
manage_languages.py
View file @
104e04f7
...
@@ -90,6 +90,7 @@ class JsonHelpers:
...
@@ -90,6 +90,7 @@ class JsonHelpers:
class
LanguageManager
:
class
LanguageManager
:
TRANSLATION_KEY
=
re
.
compile
(
r
'[Tt]ranslate.*"(\w+\.[\w\.]+)"'
)
TRANSLATION_KEY
=
re
.
compile
(
r
'[Tt]ranslate.*"(\w+\.[\w\.]+)"'
)
POTENTIAL_KEY
=
re
.
compile
(
r
'"(\w+\.[\w\.]+)"'
)
POTENTIAL_KEY
=
re
.
compile
(
r
'"(\w+\.[\w\.]+)"'
)
COMMAND_LABEL
=
re
.
compile
(
r
'@Command\s*\([\W\w]*?label\s*=\s*"(\w+)"'
,
re
.
MULTILINE
)
# [\W\w] is a cheeky way to match everything including \n
def
__init__
(
self
):
def
__init__
(
self
):
self
.
load_jsons
()
self
.
load_jsons
()
...
@@ -122,6 +123,8 @@ class LanguageManager:
...
@@ -122,6 +123,8 @@ class LanguageManager:
used
.
add
(
k
)
used
.
add
(
k
)
for
k
in
self
.
POTENTIAL_KEY
.
findall
(
data
):
for
k
in
self
.
POTENTIAL_KEY
.
findall
(
data
):
potential
.
add
(
k
)
potential
.
add
(
k
)
for
label
in
self
.
COMMAND_LABEL
.
findall
(
data
):
used
.
add
(
f
'commands.
{
label
}
.description'
)
return
used
|
(
potential
&
expected_keys
)
return
used
|
(
potential
&
expected_keys
)
def
_lint_report_language
(
self
,
lang
:
str
,
keys
:
set
,
flattened
:
dict
,
primary_language_flattened
:
dict
)
->
None
:
def
_lint_report_language
(
self
,
lang
:
str
,
keys
:
set
,
flattened
:
dict
,
primary_language_flattened
:
dict
)
->
None
:
...
...
src/main/java/emu/grasscutter/auth/DefaultAuthenticators.java
View file @
104e04f7
...
@@ -163,7 +163,7 @@ public final class DefaultAuthenticators {
...
@@ -163,7 +163,7 @@ public final class DefaultAuthenticators {
}
else
{
}
else
{
successfulLogin
=
false
;
successfulLogin
=
false
;
loggerMessage
=
translate
(
"messages.dispatch.account.login_password_storage_error"
,
address
);
loggerMessage
=
translate
(
"messages.dispatch.account.login_password_storage_error"
,
address
);
responseMessage
=
translate
(
"password_storage_error"
);
responseMessage
=
translate
(
"
messages.dispatch.account.
password_storage_error"
);
}
}
}
else
{
}
else
{
loggerMessage
=
translate
(
"messages.dispatch.account.account_login_exist_error"
,
address
);
loggerMessage
=
translate
(
"messages.dispatch.account.account_login_exist_error"
,
address
);
...
...
src/main/java/emu/grasscutter/command/CommandHandler.java
View file @
104e04f7
...
@@ -68,7 +68,6 @@ public interface CommandHandler {
...
@@ -68,7 +68,6 @@ public interface CommandHandler {
default
String
getDescriptionString
(
Player
player
)
{
default
String
getDescriptionString
(
Player
player
)
{
Command
annotation
=
this
.
getClass
().
getAnnotation
(
Command
.
class
);
Command
annotation
=
this
.
getClass
().
getAnnotation
(
Command
.
class
);
String
key
=
"commands.%s.description"
.
formatted
(
annotation
.
label
());
String
key
=
"commands.%s.description"
.
formatted
(
annotation
.
label
());
// TODO: fallback to "commands.generic.no_description_specified"
return
translate
(
player
,
key
);
return
translate
(
player
,
key
);
}
}
...
...
src/main/java/emu/grasscutter/command/CommandMap.java
View file @
104e04f7
...
@@ -35,6 +35,7 @@ public final class CommandMap {
...
@@ -35,6 +35,7 @@ public final class CommandMap {
*/
*/
public
CommandMap
registerCommand
(
String
label
,
CommandHandler
command
)
{
public
CommandMap
registerCommand
(
String
label
,
CommandHandler
command
)
{
Grasscutter
.
getLogger
().
debug
(
"Registered command: "
+
label
);
Grasscutter
.
getLogger
().
debug
(
"Registered command: "
+
label
);
label
=
label
.
toLowerCase
();
// Get command data.
// Get command data.
Command
annotation
=
command
.
getClass
().
getAnnotation
(
Command
.
class
);
Command
annotation
=
command
.
getClass
().
getAnnotation
(
Command
.
class
);
...
@@ -203,7 +204,7 @@ public final class CommandMap {
...
@@ -203,7 +204,7 @@ public final class CommandMap {
// Parse message.
// Parse message.
String
[]
split
=
rawMessage
.
split
(
" "
);
String
[]
split
=
rawMessage
.
split
(
" "
);
List
<
String
>
args
=
new
LinkedList
<>(
Arrays
.
asList
(
split
));
List
<
String
>
args
=
new
LinkedList
<>(
Arrays
.
asList
(
split
));
String
label
=
args
.
remove
(
0
);
String
label
=
args
.
remove
(
0
)
.
toLowerCase
()
;
String
playerId
=
(
player
==
null
)
?
consoleId
:
player
.
getAccount
().
getId
();
String
playerId
=
(
player
==
null
)
?
consoleId
:
player
.
getAccount
().
getId
();
// Check for special cases - currently only target command.
// Check for special cases - currently only target command.
...
...
src/main/java/emu/grasscutter/command/commands/AccountCommand.java
View file @
104e04f7
...
@@ -30,7 +30,7 @@ public final class AccountCommand implements CommandHandler {
...
@@ -30,7 +30,7 @@ public final class AccountCommand implements CommandHandler {
}
}
if
(
args
.
size
()
<
2
)
{
if
(
args
.
size
()
<
2
)
{
CommandHandler
.
sendTranslatedMessage
(
sender
,
"commands.account.command_usage"
);
sendUsageMessage
(
sender
);
return
;
return
;
}
}
...
@@ -39,7 +39,7 @@ public final class AccountCommand implements CommandHandler {
...
@@ -39,7 +39,7 @@ public final class AccountCommand implements CommandHandler {
switch
(
action
)
{
switch
(
action
)
{
default
:
default
:
CommandHandler
.
sendTranslatedMessage
(
sender
,
"commands.account.command_usage"
);
sendUsageMessage
(
sender
);
return
;
return
;
case
"create"
:
case
"create"
:
int
uid
=
0
;
int
uid
=
0
;
...
...
src/main/java/emu/grasscutter/command/commands/AnnounceCommand.java
View file @
104e04f7
...
@@ -23,14 +23,14 @@ public final class AnnounceCommand implements CommandHandler {
...
@@ -23,14 +23,14 @@ public final class AnnounceCommand implements CommandHandler {
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
var
manager
=
Grasscutter
.
getGameServer
().
getAnnouncementSystem
();
var
manager
=
Grasscutter
.
getGameServer
().
getAnnouncementSystem
();
if
(
args
.
size
()
<
1
)
{
if
(
args
.
size
()
<
1
)
{
CommandHandler
.
sendTranslatedMessage
(
sender
,
"commands.announce.command_usage"
);
sendUsageMessage
(
sender
);
return
;
return
;
}
}
switch
(
args
.
get
(
0
))
{
switch
(
args
.
get
(
0
))
{
case
"tpl"
:
case
"tpl"
:
if
(
args
.
size
()
<
2
)
{
if
(
args
.
size
()
<
2
)
{
CommandHandler
.
sendTranslatedMessage
(
sender
,
"commands.announce.command_usage"
);
sendUsageMessage
(
sender
);
return
;
return
;
}
}
...
@@ -52,7 +52,7 @@ public final class AnnounceCommand implements CommandHandler {
...
@@ -52,7 +52,7 @@ public final class AnnounceCommand implements CommandHandler {
case
"revoke"
:
case
"revoke"
:
if
(
args
.
size
()
<
2
)
{
if
(
args
.
size
()
<
2
)
{
CommandHandler
.
sendTranslatedMessage
(
sender
,
"commands.announce.command_usage"
);
sendUsageMessage
(
sender
);
return
;
return
;
}
}
...
...
src/main/java/emu/grasscutter/command/commands/ClearCommand.java
View file @
104e04f7
...
@@ -83,7 +83,7 @@ public final class ClearCommand implements CommandHandler {
...
@@ -83,7 +83,7 @@ public final class ClearCommand implements CommandHandler {
}
}
if
(
args
.
size
()
<
1
)
{
if
(
args
.
size
()
<
1
)
{
CommandHandler
.
sendTranslatedMessage
(
sender
,
"commands.clear.command_usage"
);
sendUsageMessage
(
sender
);
return
;
return
;
}
}
...
...
src/main/java/emu/grasscutter/command/commands/CoopCommand.java
View file @
104e04f7
...
@@ -7,8 +7,6 @@ import emu.grasscutter.game.player.Player;
...
@@ -7,8 +7,6 @@ import emu.grasscutter.game.player.Player;
import
java.util.List
;
import
java.util.List
;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
@Command
(
label
=
"coop"
,
usage
=
{
"[<host UID>]"
},
permission
=
"server.coop"
,
permissionTargeted
=
"server.coop.others"
)
@Command
(
label
=
"coop"
,
usage
=
{
"[<host UID>]"
},
permission
=
"server.coop"
,
permissionTargeted
=
"server.coop.others"
)
public
final
class
CoopCommand
implements
CommandHandler
{
public
final
class
CoopCommand
implements
CommandHandler
{
...
@@ -17,25 +15,26 @@ public final class CoopCommand implements CommandHandler {
...
@@ -17,25 +15,26 @@ public final class CoopCommand implements CommandHandler {
Player
host
=
sender
;
Player
host
=
sender
;
switch
(
args
.
size
())
{
switch
(
args
.
size
())
{
case
0
:
// Summon target to self
case
0
:
// Summon target to self
CommandHandler
.
sendMessage
(
sender
,
translate
(
sender
,
"commands.coop.usage"
));
if
(
sender
==
null
)
{
// Console doesn't have a self to summon to
if
(
sender
==
null
)
// Console doesn't have a self to summon to
sendUsageMessage
(
sender
);
return
;
return
;
}
break
;
break
;
case
1
:
// Summon target to argument
case
1
:
// Summon target to argument
try
{
try
{
int
hostId
=
Integer
.
parseInt
(
args
.
get
(
0
));
int
hostId
=
Integer
.
parseInt
(
args
.
get
(
0
));
host
=
Grasscutter
.
getGameServer
().
getPlayerByUid
(
hostId
);
host
=
Grasscutter
.
getGameServer
().
getPlayerByUid
(
hostId
);
if
(
host
==
null
)
{
if
(
host
==
null
)
{
CommandHandler
.
send
Message
(
sender
,
translat
e
(
sender
,
"commands.execution.player_offline_error"
)
)
;
CommandHandler
.
send
TranslatedMessag
e
(
sender
,
"commands.execution.player_offline_error"
);
return
;
return
;
}
}
break
;
break
;
}
catch
(
NumberFormatException
ignored
)
{
}
catch
(
NumberFormatException
ignored
)
{
CommandHandler
.
send
Message
(
sender
,
translat
e
(
sender
,
"commands.generic.invalid.uid"
)
)
;
CommandHandler
.
send
TranslatedMessag
e
(
sender
,
"commands.generic.invalid.uid"
);
return
;
return
;
}
}
default
:
default
:
CommandHandler
.
send
Mes
sage
(
sender
,
translate
(
sender
,
"commands.coop.usage"
)
);
send
U
sage
Message
(
sender
);
return
;
return
;
}
}
...
@@ -45,6 +44,6 @@ public final class CoopCommand implements CommandHandler {
...
@@ -45,6 +44,6 @@ public final class CoopCommand implements CommandHandler {
}
}
host
.
getServer
().
getMultiplayerSystem
().
applyEnterMp
(
targetPlayer
,
host
.
getUid
());
host
.
getServer
().
getMultiplayerSystem
().
applyEnterMp
(
targetPlayer
,
host
.
getUid
());
targetPlayer
.
getServer
().
getMultiplayerSystem
().
applyEnterMpReply
(
host
,
targetPlayer
.
getUid
(),
true
);
targetPlayer
.
getServer
().
getMultiplayerSystem
().
applyEnterMpReply
(
host
,
targetPlayer
.
getUid
(),
true
);
CommandHandler
.
send
Message
(
sender
,
translat
e
(
sender
,
"commands.coop.success"
,
targetPlayer
.
getNickname
(),
host
.
getNickname
())
)
;
CommandHandler
.
send
TranslatedMessag
e
(
sender
,
"commands.coop.success"
,
targetPlayer
.
getNickname
(),
host
.
getNickname
());
}
}
}
}
src/main/java/emu/grasscutter/command/commands/EnterDungeonCommand.java
View file @
104e04f7
...
@@ -14,7 +14,7 @@ public final class EnterDungeonCommand implements CommandHandler {
...
@@ -14,7 +14,7 @@ public final class EnterDungeonCommand implements CommandHandler {
@Override
@Override
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
if
(
args
.
size
()
<
1
)
{
if
(
args
.
size
()
<
1
)
{
CommandHandler
.
send
Mes
sage
(
sender
,
translate
(
sender
,
"commands.enter_dungeon.usage"
)
);
send
U
sage
Message
(
sender
);
return
;
return
;
}
}
...
@@ -33,7 +33,7 @@ public final class EnterDungeonCommand implements CommandHandler {
...
@@ -33,7 +33,7 @@ public final class EnterDungeonCommand implements CommandHandler {
CommandHandler
.
sendMessage
(
sender
,
translate
(
sender
,
"commands.enter_dungeon.changed"
,
dungeonId
));
CommandHandler
.
sendMessage
(
sender
,
translate
(
sender
,
"commands.enter_dungeon.changed"
,
dungeonId
));
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
CommandHandler
.
send
Mes
sage
(
sender
,
translate
(
sender
,
"commands.enter_dungeon.usage"
)
);
send
U
sage
Message
(
sender
);
}
}
}
}
}
}
src/main/java/emu/grasscutter/command/commands/GiveCommand.java
View file @
104e04f7
...
@@ -67,7 +67,7 @@ public final class GiveCommand implements CommandHandler {
...
@@ -67,7 +67,7 @@ public final class GiveCommand implements CommandHandler {
public
GiveAllType
giveAllType
=
GiveAllType
.
NONE
;
public
GiveAllType
giveAllType
=
GiveAllType
.
NONE
;
};
};
private
static
GiveItemParameters
parseArgs
(
Player
sender
,
List
<
String
>
args
)
throws
IllegalArgumentException
{
private
GiveItemParameters
parseArgs
(
Player
sender
,
List
<
String
>
args
)
throws
IllegalArgumentException
{
GiveItemParameters
param
=
new
GiveItemParameters
();
GiveItemParameters
param
=
new
GiveItemParameters
();
// Extract any tagged arguments (e.g. "lv90", "x100", "r5")
// Extract any tagged arguments (e.g. "lv90", "x100", "r5")
...
@@ -99,7 +99,7 @@ public final class GiveCommand implements CommandHandler {
...
@@ -99,7 +99,7 @@ public final class GiveCommand implements CommandHandler {
// At this point, first remaining argument MUST be itemId/avatarId
// At this point, first remaining argument MUST be itemId/avatarId
if
(
args
.
size
()
<
1
)
{
if
(
args
.
size
()
<
1
)
{
CommandHandler
.
sendTranslatedMessage
(
sender
,
"commands.give.usage"
);
// Reachable if someone does `/give lv90` or similar
sendUsageMessage
(
sender
);
// Reachable if someone does `/give lv90` or similar
throw
new
IllegalArgumentException
();
throw
new
IllegalArgumentException
();
}
}
String
id
=
args
.
remove
(
0
);
String
id
=
args
.
remove
(
0
);
...
@@ -169,7 +169,7 @@ public final class GiveCommand implements CommandHandler {
...
@@ -169,7 +169,7 @@ public final class GiveCommand implements CommandHandler {
throw
e
;
throw
e
;
}
}
}
else
{
}
else
{
CommandHandler
.
sendTranslatedMessage
(
sender
,
"commands.give.usage"
);
sendUsageMessage
(
sender
);
throw
new
IllegalArgumentException
();
throw
new
IllegalArgumentException
();
}
}
}
}
...
@@ -180,7 +180,7 @@ public final class GiveCommand implements CommandHandler {
...
@@ -180,7 +180,7 @@ public final class GiveCommand implements CommandHandler {
@Override
@Override
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
if
(
args
.
size
()
<
1
)
{
// *No args*
if
(
args
.
size
()
<
1
)
{
// *No args*
CommandHandler
.
sendTranslatedMessage
(
sender
,
"commands.give.usage"
);
sendUsageMessage
(
sender
);
return
;
return
;
}
}
try
{
try
{
...
...
src/main/java/emu/grasscutter/command/commands/HelpCommand.java
View file @
104e04f7
...
@@ -59,8 +59,9 @@ public final class HelpCommand implements CommandHandler {
...
@@ -59,8 +59,9 @@ public final class HelpCommand implements CommandHandler {
commands_no_permission
.
add
(
createCommand
(
player
,
command
,
args
));
commands_no_permission
.
add
(
createCommand
(
player
,
command
,
args
));
}
}
}
}
CommandHandler
.
sendTranslatedMessage
(
player
,
"commands.help.available_commands"
);
}
else
{
}
else
{
String
command_str
=
args
.
remove
(
0
);
String
command_str
=
args
.
remove
(
0
)
.
toLowerCase
()
;
CommandHandler
command
=
handlers
.
get
(
command_str
);
CommandHandler
command
=
handlers
.
get
(
command_str
);
if
(
command
==
null
)
{
if
(
command
==
null
)
{
CommandHandler
.
sendTranslatedMessage
(
player
,
"commands.generic.command_exist_error"
);
CommandHandler
.
sendTranslatedMessage
(
player
,
"commands.generic.command_exist_error"
);
...
...
src/main/java/emu/grasscutter/command/commands/KillAllCommand.java
View file @
104e04f7
...
@@ -25,7 +25,7 @@ public final class KillAllCommand implements CommandHandler {
...
@@ -25,7 +25,7 @@ public final class KillAllCommand implements CommandHandler {
scene
=
targetPlayer
.
getWorld
().
getSceneById
(
Integer
.
parseInt
(
args
.
get
(
0
)));
scene
=
targetPlayer
.
getWorld
().
getSceneById
(
Integer
.
parseInt
(
args
.
get
(
0
)));
break
;
break
;
default
:
default
:
CommandHandler
.
send
Mes
sage
(
sender
,
translate
(
sender
,
"commands.killall.usage"
)
);
send
U
sage
Message
(
sender
);
return
;
return
;
}
}
}
catch
(
NumberFormatException
ignored
)
{
}
catch
(
NumberFormatException
ignored
)
{
...
...
src/main/java/emu/grasscutter/command/commands/KillCharacterCommand.java
View file @
104e04f7
...
@@ -18,11 +18,6 @@ public final class KillCharacterCommand implements CommandHandler {
...
@@ -18,11 +18,6 @@ public final class KillCharacterCommand implements CommandHandler {
@Override
@Override
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
if
(
args
.
isEmpty
())
{
CommandHandler
.
sendMessage
(
sender
,
translate
(
sender
,
"commands.killCharacter.usage"
));
return
;
}
EntityAvatar
entity
=
targetPlayer
.
getTeamManager
().
getCurrentAvatarEntity
();
EntityAvatar
entity
=
targetPlayer
.
getTeamManager
().
getCurrentAvatarEntity
();
entity
.
setFightProperty
(
FightProperty
.
FIGHT_PROP_CUR_HP
,
0
f
);
entity
.
setFightProperty
(
FightProperty
.
FIGHT_PROP_CUR_HP
,
0
f
);
// Packets
// Packets
...
...
src/main/java/emu/grasscutter/command/commands/PermissionCommand.java
View file @
104e04f7
...
@@ -17,7 +17,7 @@ public final class PermissionCommand implements CommandHandler {
...
@@ -17,7 +17,7 @@ public final class PermissionCommand implements CommandHandler {
@Override
@Override
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
if
(
args
.
size
()
!=
2
)
{
if
(
args
.
size
()
!=
2
)
{
CommandHandler
.
send
Mes
sage
(
sender
,
translate
(
sender
,
"commands.permission.usage"
)
);
send
U
sage
Message
(
sender
);
return
;
return
;
}
}
...
@@ -37,7 +37,7 @@ public final class PermissionCommand implements CommandHandler {
...
@@ -37,7 +37,7 @@ public final class PermissionCommand implements CommandHandler {
switch
(
action
)
{
switch
(
action
)
{
default
:
default
:
CommandHandler
.
send
Mes
sage
(
sender
,
translate
(
sender
,
"commands.permission.usage"
)
);
send
U
sage
Message
(
sender
);
break
;
break
;
case
"add"
:
case
"add"
:
if
(
account
.
addPermission
(
permission
))
{
if
(
account
.
addPermission
(
permission
))
{
...
...
src/main/java/emu/grasscutter/command/commands/QuestCommand.java
View file @
104e04f7
...
@@ -15,7 +15,7 @@ public final class QuestCommand implements CommandHandler {
...
@@ -15,7 +15,7 @@ public final class QuestCommand implements CommandHandler {
@Override
@Override
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
if
(
args
.
size
()
!=
2
)
{
if
(
args
.
size
()
!=
2
)
{
CommandHandler
.
send
Mes
sage
(
sender
,
translate
(
sender
,
"commands.quest.usage"
)
);
send
U
sage
Message
(
sender
);
return
;
return
;
}
}
...
@@ -53,7 +53,7 @@ public final class QuestCommand implements CommandHandler {
...
@@ -53,7 +53,7 @@ public final class QuestCommand implements CommandHandler {
CommandHandler
.
sendMessage
(
sender
,
translate
(
sender
,
"commands.quest.finished"
,
questId
));
CommandHandler
.
sendMessage
(
sender
,
translate
(
sender
,
"commands.quest.finished"
,
questId
));
}
}
default
->
{
default
->
{
CommandHandler
.
send
Mes
sage
(
sender
,
translate
(
sender
,
"commands.quest.usage"
)
);
send
U
sage
Message
(
sender
);
}
}
}
}
}
}
...
...
src/main/java/emu/grasscutter/command/commands/ResetShopLimitCommand.java
View file @
104e04f7
...
@@ -14,11 +14,6 @@ public final class ResetShopLimitCommand implements CommandHandler {
...
@@ -14,11 +14,6 @@ public final class ResetShopLimitCommand implements CommandHandler {
@Override
@Override
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
if
(
args
.
isEmpty
())
{
CommandHandler
.
sendMessage
(
sender
,
translate
(
sender
,
"commands.resetShopLimit.usage"
));
return
;
}
targetPlayer
.
getShopLimit
().
forEach
(
x
->
x
.
setNextRefreshTime
(
0
));
targetPlayer
.
getShopLimit
().
forEach
(
x
->
x
.
setNextRefreshTime
(
0
));
targetPlayer
.
save
();
targetPlayer
.
save
();
CommandHandler
.
sendMessage
(
sender
,
translate
(
sender
,
"commands.resetShopLimit.success"
));
CommandHandler
.
sendMessage
(
sender
,
translate
(
sender
,
"commands.resetShopLimit.success"
));
...
...
src/main/java/emu/grasscutter/command/commands/SendMailCommand.java
View file @
104e04f7
...
@@ -43,7 +43,7 @@ public final class SendMailCommand implements CommandHandler {
...
@@ -43,7 +43,7 @@ public final class SendMailCommand implements CommandHandler {
MailBuilder
mailBuilder
;
MailBuilder
mailBuilder
;
switch
(
args
.
get
(
0
).
toLowerCase
())
{
switch
(
args
.
get
(
0
).
toLowerCase
())
{
case
"help"
->
{
case
"help"
->
{
CommandHandler
.
send
Mes
sage
(
sender
,
translate
(
sender
,
"commands.sendMail.usage"
)
);
send
U
sage
Message
(
sender
);
return
;
return
;
}
}
case
"all"
->
mailBuilder
=
new
MailBuilder
(
true
,
new
Mail
());
case
"all"
->
mailBuilder
=
new
MailBuilder
(
true
,
new
Mail
());
...
@@ -150,7 +150,7 @@ public final class SendMailCommand implements CommandHandler {
...
@@ -150,7 +150,7 @@ public final class SendMailCommand implements CommandHandler {
}
}
break
;
break
;
default
:
// *No args*
default
:
// *No args*
CommandHandler
.
send
Message
(
sender
,
translat
e
(
sender
,
"commands.give
.
usage"
)
)
;
CommandHandler
.
send
TranslatedMessag
e
(
sender
,
"commands.
sendMail.
give
_
usage"
);
return
;
return
;
}
}
mailBuilder
.
mail
.
itemList
.
add
(
new
Mail
.
MailItem
(
item
,
amount
,
lvl
));
mailBuilder
.
mail
.
itemList
.
add
(
new
Mail
.
MailItem
(
item
,
amount
,
lvl
));
...
...
src/main/java/emu/grasscutter/command/commands/SendMessageCommand.java
View file @
104e04f7
...
@@ -8,8 +8,6 @@ import emu.grasscutter.game.player.Player;
...
@@ -8,8 +8,6 @@ import emu.grasscutter.game.player.Player;
import
java.util.List
;
import
java.util.List
;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
@Command
(
@Command
(
label
=
"sendMessage"
,
label
=
"sendMessage"
,
aliases
=
{
"say"
,
"sendservmsg"
,
"sendservermessage"
,
"b"
,
"broadcast"
},
aliases
=
{
"say"
,
"sendservmsg"
,
"sendservermessage"
,
"b"
,
"broadcast"
},
...
@@ -22,7 +20,7 @@ public final class SendMessageCommand implements CommandHandler {
...
@@ -22,7 +20,7 @@ public final class SendMessageCommand implements CommandHandler {
@Override
@Override
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
if
(
args
.
size
()
==
0
)
{
if
(
args
.
size
()
==
0
)
{
CommandHandler
.
send
Mes
sage
(
sender
,
translate
(
sender
,
"commands.sendMessage.usage"
)
);
send
U
sage
Message
(
sender
);
return
;
return
;
}
}
...
@@ -35,6 +33,6 @@ public final class SendMessageCommand implements CommandHandler {
...
@@ -35,6 +33,6 @@ public final class SendMessageCommand implements CommandHandler {
}
else
{
}
else
{
CommandHandler
.
sendMessage
(
targetPlayer
,
message
);
CommandHandler
.
sendMessage
(
targetPlayer
,
message
);
}
}
CommandHandler
.
send
Message
(
sender
,
translat
e
(
sender
,
"commands.sendMessage.success"
)
)
;
CommandHandler
.
send
TranslatedMessag
e
(
sender
,
"commands.sendMessage.success"
);
}
}
}
}
src/main/java/emu/grasscutter/command/commands/SetFetterLevelCommand.java
View file @
104e04f7
...
@@ -22,7 +22,7 @@ public final class SetFetterLevelCommand implements CommandHandler {
...
@@ -22,7 +22,7 @@ public final class SetFetterLevelCommand implements CommandHandler {
@Override
@Override
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
if
(
args
.
size
()
!=
1
)
{
if
(
args
.
size
()
!=
1
)
{
CommandHandler
.
send
Mes
sage
(
sender
,
translate
(
sender
,
"commands.setFetterLevel.usage"
)
);
send
U
sage
Message
(
sender
);
return
;
return
;
}
}
...
...
src/main/java/emu/grasscutter/command/commands/SetPropCommand.java
View file @
104e04f7
...
@@ -10,7 +10,7 @@ import emu.grasscutter.game.player.Player;
...
@@ -10,7 +10,7 @@ import emu.grasscutter.game.player.Player;
import
emu.grasscutter.game.props.PlayerProperty
;
import
emu.grasscutter.game.props.PlayerProperty
;
import
emu.grasscutter.game.tower.TowerLevelRecord
;
import
emu.grasscutter.game.tower.TowerLevelRecord
;
@Command
(
label
=
"setProp"
,
aliases
=
{
"prop"
},
usage
=
{
"<prop> <value>"
},
permission
=
"player.setprop"
,
permissionTargeted
=
"player.setprop.others"
)
@Command
(
label
=
"setProp"
,
aliases
=
{
"prop"
},
usage
=
{
"<prop> <value>"
},
permission
=
"player.setprop"
,
permissionTargeted
=
"player.setprop.others"
)
public
final
class
SetPropCommand
implements
CommandHandler
{
public
final
class
SetPropCommand
implements
CommandHandler
{
static
enum
PseudoProp
{
static
enum
PseudoProp
{
NONE
,
NONE
,
...
@@ -95,7 +95,7 @@ public final class SetPropCommand implements CommandHandler {
...
@@ -95,7 +95,7 @@ public final class SetPropCommand implements CommandHandler {
@Override
@Override
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
if
(
args
.
size
()
!=
2
)
{
if
(
args
.
size
()
!=
2
)
{
CommandHandler
.
sendTranslatedMessage
(
sender
,
"commands.setProp.usage"
);
sendUsageMessage
(
sender
);
return
;
return
;
}
}
String
propStr
=
args
.
get
(
0
).
toLowerCase
();
String
propStr
=
args
.
get
(
0
).
toLowerCase
();
...
@@ -103,7 +103,7 @@ public final class SetPropCommand implements CommandHandler {
...
@@ -103,7 +103,7 @@ public final class SetPropCommand implements CommandHandler {
int
value
;
int
value
;
if
(!
props
.
containsKey
(
propStr
))
{
if
(!
props
.
containsKey
(
propStr
))
{
CommandHandler
.
sendTranslatedMessage
(
sender
,
"commands.setProp.usage"
);
sendUsageMessage
(
sender
);
return
;
return
;
}
}
try
{
try
{
...
...
Prev
1
2
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