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
2cfbe781
Commit
2cfbe781
authored
Jul 18, 2022
by
AnimeGitB
Committed by
Luke H-W
Jul 22, 2022
Browse files
Refactor Command usage and description strings
parent
e9464784
Changes
40
Hide whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/command/commands/ReloadCommand.java
View file @
2cfbe781
...
...
@@ -9,7 +9,7 @@ import java.util.List;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
@Command
(
label
=
"reload"
,
usage
=
"reload"
,
permission
=
"server.reload"
,
description
=
"commands.reload.description"
,
targetRequirement
=
Command
.
TargetRequirement
.
NONE
)
@Command
(
label
=
"reload"
,
permission
=
"server.reload"
,
targetRequirement
=
Command
.
TargetRequirement
.
NONE
)
public
final
class
ReloadCommand
implements
CommandHandler
{
@Override
...
...
src/main/java/emu/grasscutter/command/commands/ResetConstCommand.java
View file @
2cfbe781
...
...
@@ -10,8 +10,12 @@ import java.util.List;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
@Command
(
label
=
"resetconst"
,
usage
=
"resetconst [all]"
,
aliases
=
{
"resetconstellation"
},
permission
=
"player.resetconstellation"
,
permissionTargeted
=
"player.resetconstellation.others"
,
description
=
"commands.resetConst.description"
)
@Command
(
label
=
"resetConst"
,
aliases
=
{
"resetconstellation"
},
usage
=
"[all]"
,
permission
=
"player.resetconstellation"
,
permissionTargeted
=
"player.resetconstellation.others"
)
public
final
class
ResetConstCommand
implements
CommandHandler
{
@Override
...
...
src/main/java/emu/grasscutter/command/commands/ResetShopLimitCommand.java
View file @
2cfbe781
...
...
@@ -9,7 +9,7 @@ import java.util.List;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
@Command
(
label
=
"reset
s
hop
"
,
usage
=
"resetshop"
,
permission
=
"server.resetshop"
,
permissionTargeted
=
"server.resetshop.others"
,
description
=
"commands.resetShopLimit.description"
)
@Command
(
label
=
"reset
S
hop
Limit"
,
aliases
=
{
"resetshop"
}
,
permission
=
"server.resetshop"
,
permissionTargeted
=
"server.resetshop.others"
)
public
final
class
ResetShopLimitCommand
implements
CommandHandler
{
@Override
...
...
src/main/java/emu/grasscutter/command/commands/SendMailCommand.java
View file @
2cfbe781
...
...
@@ -13,7 +13,11 @@ import java.util.List;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
@SuppressWarnings
(
"ConstantConditions"
)
@Command
(
label
=
"sendmail"
,
usage
=
"sendmail <userId|all|help> [templateId]"
,
permission
=
"server.sendmail"
,
description
=
"commands.sendMail.description"
,
targetRequirement
=
Command
.
TargetRequirement
.
NONE
)
@Command
(
label
=
"sendMail"
,
usage
=
{
"(<userId>|all) [<templateId>]"
,
"help"
},
permission
=
"server.sendmail"
,
targetRequirement
=
Command
.
TargetRequirement
.
NONE
)
public
final
class
SendMailCommand
implements
CommandHandler
{
// TODO: You should be able to do /sendmail and then just send subsequent messages until you finish
...
...
src/main/java/emu/grasscutter/command/commands/SendMessageCommand.java
View file @
2cfbe781
...
...
@@ -10,8 +10,13 @@ import java.util.List;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
@Command
(
label
=
"sendmessage"
,
usage
=
"sendmessage <message>"
,
aliases
=
{
"say"
,
"sendservmsg"
,
"sendservermessage"
,
"b"
,
"broadcast"
},
permission
=
"server.sendmessage"
,
permissionTargeted
=
"server.sendmessage.others"
,
description
=
"commands.sendMessage.description"
,
targetRequirement
=
TargetRequirement
.
NONE
)
@Command
(
label
=
"sendMessage"
,
aliases
=
{
"say"
,
"sendservmsg"
,
"sendservermessage"
,
"b"
,
"broadcast"
},
usage
=
{
"<message>"
},
permission
=
"server.sendmessage"
,
permissionTargeted
=
"server.sendmessage.others"
,
targetRequirement
=
TargetRequirement
.
NONE
)
public
final
class
SendMessageCommand
implements
CommandHandler
{
@Override
...
...
src/main/java/emu/grasscutter/command/commands/SetFetterLevelCommand.java
View file @
2cfbe781
...
...
@@ -11,8 +11,12 @@ import emu.grasscutter.server.packet.send.PacketAvatarFetterDataNotify;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
@Command
(
label
=
"setfetterlevel"
,
usage
=
"setfetterlevel <level>"
,
aliases
=
{
"setfetterlvl"
,
"setfriendship"
},
permission
=
"player.setfetterlevel"
,
permissionTargeted
=
"player.setfetterlevel.others"
,
description
=
"commands.setFetterLevel.description"
)
@Command
(
label
=
"setFetterLevel"
,
usage
=
{
"<level>"
},
aliases
=
{
"setfetterlvl"
,
"setfriendship"
},
permission
=
"player.setfetterlevel"
,
permissionTargeted
=
"player.setfetterlevel.others"
)
public
final
class
SetFetterLevelCommand
implements
CommandHandler
{
@Override
...
...
src/main/java/emu/grasscutter/command/commands/SetPropCommand.java
View file @
2cfbe781
...
...
@@ -10,7 +10,7 @@ import emu.grasscutter.game.player.Player;
import
emu.grasscutter.game.props.PlayerProperty
;
import
emu.grasscutter.game.tower.TowerLevelRecord
;
@Command
(
label
=
"set
p
rop"
,
usage
=
"setprop|prop <prop> <value>"
,
aliases
=
{
"prop
"
},
permission
=
"player.setprop"
,
permissionTargeted
=
"player.setprop.others"
,
description
=
"commands.setProp.description"
)
@Command
(
label
=
"set
P
rop"
,
aliases
=
{
"prop"
},
usage
=
{
"<prop> <value>
"
},
permission
=
"player.setprop"
,
permissionTargeted
=
"player.setprop.others"
)
public
final
class
SetPropCommand
implements
CommandHandler
{
static
enum
PseudoProp
{
NONE
,
...
...
src/main/java/emu/grasscutter/command/commands/SetStatsCommand.java
View file @
2cfbe781
...
...
@@ -11,7 +11,7 @@ import emu.grasscutter.game.player.Player;
import
emu.grasscutter.game.props.FightProperty
;
import
emu.grasscutter.server.packet.send.PacketEntityFightPropUpdateNotify
;
@Command
(
label
=
"set
s
tats"
,
usage
=
"
set
stats
|stats <stat> <value>"
,
aliases
=
{
"stats
"
},
permission
=
"player.setstats"
,
permissionTargeted
=
"player.setstats.others"
,
description
=
"commands.setStats.description"
)
@Command
(
label
=
"set
S
tats"
,
aliases
=
{
"stats
"
,
"stat"
},
usage
=
{
"<stat> <value>
"
},
permission
=
"player.setstats"
,
permissionTargeted
=
"player.setstats.others"
)
public
final
class
SetStatsCommand
implements
CommandHandler
{
static
class
Stat
{
String
name
;
...
...
src/main/java/emu/grasscutter/command/commands/SpawnCommand.java
View file @
2cfbe781
package
emu.grasscutter.command.commands
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.command.Command
;
import
emu.grasscutter.command.CommandHandler
;
import
emu.grasscutter.data.GameData
;
import
emu.grasscutter.data.excels.AvatarData
;
import
emu.grasscutter.data.excels.GadgetData
;
import
emu.grasscutter.data.excels.ItemData
;
import
emu.grasscutter.data.excels.MonsterData
;
import
emu.grasscutter.game.avatar.Avatar
;
import
emu.grasscutter.game.entity.*
;
import
emu.grasscutter.game.player.Player
;
import
emu.grasscutter.game.props.EntityType
;
import
emu.grasscutter.game.props.FightProperty
;
import
emu.grasscutter.utils.Position
;
import
emu.grasscutter.game.world.Scene
;
import
javax.swing.text.html.parser.Entity
;
import
java.util.List
;
import
java.util.Random
;
import
static
emu
.
grasscutter
.
config
.
Configuration
.*;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
@Command
(
label
=
"spawn"
,
usage
=
"spawn <entityId> [amount] [level(monster only)] [<x> <y> <z>(monster only, optional)]"
,
aliases
=
{
"drop"
},
permission
=
"server.spawn"
,
permissionTargeted
=
"server.spawn.others"
,
description
=
"commands.spawn.description"
)
@Command
(
label
=
"spawn"
,
usage
=
{
"spawn <entityId> [amount] [level(monster only)] [<x> <y> <z>(monster only)]"
},
aliases
=
{
"drop"
},
permission
=
"server.spawn"
,
permissionTargeted
=
"server.spawn.others"
)
public
final
class
SpawnCommand
implements
CommandHandler
{
@Override
...
...
src/main/java/emu/grasscutter/command/commands/StopCommand.java
View file @
2cfbe781
...
...
@@ -9,7 +9,7 @@ import java.util.List;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
@Command
(
label
=
"stop"
,
usage
=
"stop"
,
permission
=
"server.stop"
,
description
=
"commands.stop.description"
,
targetRequirement
=
Command
.
TargetRequirement
.
NONE
)
@Command
(
label
=
"stop"
,
permission
=
"server.stop"
,
targetRequirement
=
Command
.
TargetRequirement
.
NONE
)
public
final
class
StopCommand
implements
CommandHandler
{
@Override
...
...
src/main/java/emu/grasscutter/command/commands/TalentCommand.java
View file @
2cfbe781
package
emu.grasscutter.command.commands
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.command.Command
;
import
emu.grasscutter.command.CommandHandler
;
import
emu.grasscutter.data.excels.AvatarSkillDepotData
;
...
...
@@ -14,7 +13,11 @@ import java.util.List;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
@Command
(
label
=
"talent"
,
usage
=
"talent <talentId> <value>"
,
permission
=
"player.settalent"
,
permissionTargeted
=
"player.settalent.others"
,
description
=
"commands.talent.description"
)
@Command
(
label
=
"talent"
,
usage
=
{
"set <talentId> <level>"
,
"(n|e|q) <level>"
,
"getid"
},
permission
=
"player.settalent"
,
permissionTargeted
=
"player.settalent.others"
)
public
final
class
TalentCommand
implements
CommandHandler
{
private
void
setTalentLevel
(
Player
sender
,
Player
player
,
Avatar
avatar
,
int
talentId
,
int
talentLevel
)
{
int
oldLevel
=
avatar
.
getSkillLevelMap
().
get
(
talentId
);
...
...
src/main/java/emu/grasscutter/command/commands/TeamCommand.java
View file @
2cfbe781
...
...
@@ -12,8 +12,13 @@ import static emu.grasscutter.config.Configuration.*;
import
java.util.ArrayList
;
import
java.util.HashSet
;
@Command
(
label
=
"team"
,
usage
=
"team <add|remove|set> [avatarId,...] [index|first|last|index-index,...]"
,
permission
=
"player.team"
,
permissionTargeted
=
"player.team.others"
,
description
=
"commands.team.description"
)
import
static
emu
.
grasscutter
.
Configuration
.*;
@Command
(
label
=
"team"
,
usage
=
{
"add <avatarId,...>"
,
"(remove|set) [index|first|last|index-index,...]"
},
permission
=
"player.team"
,
permissionTargeted
=
"player.team.others"
)
public
final
class
TeamCommand
implements
CommandHandler
{
private
static
final
int
BASE_AVATARID
=
10000000
;
...
...
src/main/java/emu/grasscutter/command/commands/TeleportAllCommand.java
View file @
2cfbe781
package
emu.grasscutter.command.commands
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.command.Command
;
import
emu.grasscutter.command.CommandHandler
;
import
emu.grasscutter.game.player.Player
;
...
...
@@ -10,7 +9,7 @@ import java.util.List;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
@Command
(
label
=
"t
pall"
,
usage
=
"tpall"
,
permission
=
"player.tpall"
,
permissionTargeted
=
"player.tpall.others"
,
description
=
"commands.teleportAll.description"
)
@Command
(
label
=
"t
eleportAll"
,
aliases
=
{
"tpall"
}
,
permission
=
"player.tpall"
,
permissionTargeted
=
"player.tpall.others"
)
public
final
class
TeleportAllCommand
implements
CommandHandler
{
@Override
...
...
src/main/java/emu/grasscutter/command/commands/TeleportCommand.java
View file @
2cfbe781
package
emu.grasscutter.command.commands
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.command.Command
;
import
emu.grasscutter.command.CommandHandler
;
import
emu.grasscutter.game.player.Player
;
...
...
@@ -10,7 +9,7 @@ import java.util.List;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
@Command
(
label
=
"teleport"
,
usage
=
"teleport
<x> <y> <z> [sceneId]"
,
aliases
=
{
"tp"
},
permission
=
"player.teleport"
,
permissionTargeted
=
"player.teleport.others"
,
description
=
"commands.teleport.description"
)
@Command
(
label
=
"teleport"
,
aliases
=
{
"tp"
},
usage
=
{
"
<x> <y> <z> [sceneId]"
},
permission
=
"player.teleport"
,
permissionTargeted
=
"player.teleport.others"
)
public
final
class
TeleportCommand
implements
CommandHandler
{
private
float
parseRelative
(
String
input
,
Float
current
)
{
// TODO: Maybe this will be useful elsewhere later
...
...
src/main/java/emu/grasscutter/command/commands/UnBanCommand.java
View file @
2cfbe781
...
...
@@ -9,8 +9,6 @@ import emu.grasscutter.game.player.Player;
@Command
(
label
=
"unban"
,
usage
=
"unban <@player>"
,
description
=
"commands.unban.description"
,
permission
=
"server.ban"
,
targetRequirement
=
Command
.
TargetRequirement
.
PLAYER
)
...
...
src/main/java/emu/grasscutter/command/commands/WeatherCommand.java
View file @
2cfbe781
...
...
@@ -4,11 +4,10 @@ import emu.grasscutter.command.Command;
import
emu.grasscutter.command.CommandHandler
;
import
emu.grasscutter.game.player.Player
;
import
emu.grasscutter.game.props.ClimateType
;
import
emu.grasscutter.game.world.Scene
;
import
java.util.List
;
@Command
(
label
=
"weather"
,
usage
=
"weather [weatherId] [climateType]
"
,
aliases
=
{
"w
"
},
permission
=
"player.weather"
,
permissionTargeted
=
"player.weather.others"
,
description
=
"commands.weather.description"
)
@Command
(
label
=
"weather"
,
aliases
=
{
"w"
},
usage
=
{
"weather [
<
weatherId
>
] [
<
climateType
>
]"
},
permission
=
"player.weather"
,
permissionTargeted
=
"player.weather.others"
)
public
final
class
WeatherCommand
implements
CommandHandler
{
@Override
...
...
src/main/java/emu/grasscutter/game/Account.java
View file @
2cfbe781
...
...
@@ -187,6 +187,7 @@ public class Account {
}
public
boolean
hasPermission
(
String
permission
)
{
if
(
permission
.
isEmpty
())
return
true
;
if
(
this
.
permissions
.
contains
(
"*"
)
&&
this
.
permissions
.
size
()
==
1
)
return
true
;
// Add default permissions if it doesn't exist
...
...
src/main/java/emu/grasscutter/server/http/documentation/HandbookRequestHandler.java
View file @
2cfbe781
...
...
@@ -81,10 +81,10 @@ final class HandbookRequestHandler implements DocumentationHandler {
.
replace
(
"{{HEADER_SCENE}}"
,
translate
(
"documentation.handbook.header_scene"
))
.
replace
(
"{{HEADER_MONSTER}}"
,
translate
(
"documentation.handbook.header_monster"
))
// Commands table
.
replace
(
"{{COMMANDS_TABLE}}"
,
cmdMap
.
get
Annotation
sAsList
()
.
replace
(
"{{COMMANDS_TABLE}}"
,
cmdMap
.
get
Handler
sAsList
()
.
stream
()
.
map
(
cmd
->
"<tr><td><code>"
+
cmd
.
l
abel
()
+
"</code></td><td>"
+
cmd
.
d
escription
(
)
+
"</td></tr>"
)
.
map
(
cmd
->
"<tr><td><code>"
+
cmd
.
getL
abel
()
+
"</code></td><td>"
+
cmd
.
getD
escription
String
(
null
)
+
"</td></tr>"
)
.
collect
(
Collectors
.
joining
(
"\n"
)))
// Avatars table
.
replace
(
"{{AVATARS_TABLE}}"
,
GameData
.
getAvatarDataMap
().
keySet
()
...
...
src/main/java/emu/grasscutter/tools/Tools.java
View file @
2cfbe781
...
...
@@ -16,6 +16,7 @@ import com.google.gson.reflect.TypeToken;
import
emu.grasscutter.GameConstants
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.command.Command
;
import
emu.grasscutter.command.CommandHandler
;
import
emu.grasscutter.command.CommandMap
;
import
emu.grasscutter.data.GameData
;
import
emu.grasscutter.data.ResourceLoader
;
...
...
@@ -106,16 +107,15 @@ final class ToolsWithLanguageOption {
writer
.
println
(
"// Grasscutter "
+
GameConstants
.
VERSION
+
" GM Handbook"
);
writer
.
println
(
"// Created "
+
dtf
.
format
(
now
)
+
System
.
lineSeparator
()
+
System
.
lineSeparator
());
CommandMap
cmdMap
=
new
CommandMap
(
true
);
List
<
Command
>
cmdList
=
new
ArrayList
<>(
cmdMap
.
getAnnotationsAsList
());
List
<
CommandHandler
>
cmdList
=
new
CommandMap
(
true
).
getHandlersAsList
();
writer
.
println
(
"// Commands"
);
for
(
Command
cmd
:
cmdList
)
{
StringBuilder
cmdName
=
new
StringBuilder
(
cmd
.
l
abel
());
for
(
Command
Handler
cmd
:
cmdList
)
{
StringBuilder
cmdName
=
new
StringBuilder
(
cmd
.
getL
abel
());
while
(
cmdName
.
length
()
<=
15
)
{
cmdName
.
insert
(
0
,
" "
);
}
writer
.
println
(
cmdName
+
" : "
+
translate
(
cmd
.
d
escription
(
)));
writer
.
println
(
cmdName
+
" : "
+
translate
(
cmd
.
getD
escription
String
(
null
)));
}
writer
.
println
();
...
...
src/main/resources/languages/en-US.json
View file @
2cfbe781
...
...
@@ -94,6 +94,7 @@
}
},
"execution"
:
{
"usage_prefix"
:
"Usage: "
,
"player_exist_error"
:
"Player not found."
,
"player_offline_error"
:
"Player is not online."
,
"item_player_exist_error"
:
"Invalid item or UID."
,
...
...
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