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
ef3579da
Commit
ef3579da
authored
May 08, 2022
by
方块君
Committed by
Melledy
May 08, 2022
Browse files
add Command description
parent
a46d58e5
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/command/Command.java
View file @
ef3579da
...
...
@@ -9,6 +9,8 @@ public @interface Command {
String
usage
()
default
"No usage specified"
;
String
description
()
default
"No description specified"
;
String
[]
aliases
()
default
{};
String
permission
()
default
""
;
...
...
src/main/java/emu/grasscutter/command/CommandHandler.java
View file @
ef3579da
...
...
@@ -7,7 +7,7 @@ import java.util.List;
public
interface
CommandHandler
{
String
description
();
default
String
description
()
{
return
null
;
}
;
/**
* Send a message to the target.
...
...
src/main/java/emu/grasscutter/command/commands/HelpCommand.java
View file @
ef3579da
...
...
@@ -43,7 +43,7 @@ public final class HelpCommand implements CommandHandler {
}
else
{
Command
annotation
=
handler
.
getClass
().
getAnnotation
(
Command
.
class
);
builder
.
append
(
" "
).
append
(
handler
.
description
()).
append
(
"\n"
);
builder
.
append
(
" "
).
append
(
handler
.
description
()
==
null
?
annotation
.
description
():
handler
.
description
()
).
append
(
"\n"
);
builder
.
append
(
translate
(
"commands.help.usage"
)).
append
(
annotation
.
usage
());
if
(
annotation
.
aliases
().
length
>=
1
)
{
builder
.
append
(
"\n"
).
append
(
translate
(
"commands.help.aliases"
));
...
...
@@ -65,7 +65,7 @@ public final class HelpCommand implements CommandHandler {
StringBuilder
builder
=
new
StringBuilder
(
"\n"
+
translate
(
"commands.help.available_commands"
)
+
"\n"
);
annotations
.
forEach
((
annotation
,
handler
)
->
{
builder
.
append
(
annotation
.
label
()).
append
(
"\n"
);
builder
.
append
(
" "
).
append
(
handler
.
description
()).
append
(
"\n"
);
builder
.
append
(
" "
).
append
(
handler
.
description
()
==
null
?
annotation
.
description
()
:
handler
.
description
()
).
append
(
"\n"
);
builder
.
append
(
translate
(
"commands.help.usage"
)).
append
(
annotation
.
usage
());
if
(
annotation
.
aliases
().
length
>=
1
)
{
builder
.
append
(
"\n"
).
append
(
translate
(
"commands.help.aliases"
));
...
...
@@ -82,7 +82,7 @@ public final class HelpCommand implements CommandHandler {
CommandHandler
.
sendMessage
(
player
,
translate
(
"commands.help.available_commands"
));
annotations
.
forEach
((
annotation
,
handler
)
->
{
StringBuilder
builder
=
new
StringBuilder
(
annotation
.
label
()).
append
(
"\n"
);
builder
.
append
(
" "
).
append
(
handler
.
description
()).
append
(
"\n"
);
builder
.
append
(
" "
).
append
(
handler
.
description
()
==
null
?
annotation
.
description
()
:
handler
.
description
()
).
append
(
"\n"
);
builder
.
append
(
translate
(
"commands.help.usage"
)).
append
(
annotation
.
usage
());
if
(
annotation
.
aliases
().
length
>=
1
)
{
builder
.
append
(
"\n"
).
append
(
translate
(
"commands.help.aliases"
));
...
...
src/main/java/emu/grasscutter/tools/Tools.java
View file @
ef3579da
...
...
@@ -121,7 +121,7 @@ final class ToolsWithLanguageOption {
while
(
cmdName
.
length
()
<=
15
)
{
cmdName
=
" "
+
cmdName
;
}
writer
.
println
(
cmdName
+
" : "
+
handler
.
description
());
writer
.
println
(
cmdName
+
" : "
+
(
handler
.
description
()
==
null
?
command
.
description
()
:
handler
.
description
())
);
});
writer
.
println
();
...
...
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