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
a46d58e5
Commit
a46d58e5
authored
May 08, 2022
by
方块君
Committed by
Melledy
May 08, 2022
Browse files
Add command description multilingual
parent
257a92f3
Changes
40
Hide whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/command/commands/ListCommand.java
View file @
a46d58e5
...
@@ -10,10 +10,14 @@ import java.util.Map;
...
@@ -10,10 +10,14 @@ import java.util.Map;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
@Command
(
label
=
"list"
,
usage
=
"list [uid]"
,
@Command
(
label
=
"list"
,
usage
=
"list [uid]"
,
aliases
=
{
"players"
})
description
=
"List online players"
,
aliases
=
{
"players"
})
public
final
class
ListCommand
implements
CommandHandler
{
public
final
class
ListCommand
implements
CommandHandler
{
@Override
public
String
description
()
{
return
translate
(
"commands.list.description"
);
}
@Override
@Override
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
Map
<
Integer
,
Player
>
playersMap
=
Grasscutter
.
getGameServer
().
getPlayers
();
Map
<
Integer
,
Player
>
playersMap
=
Grasscutter
.
getGameServer
().
getPlayers
();
...
...
src/main/java/emu/grasscutter/command/commands/PermissionCommand.java
View file @
a46d58e5
...
@@ -10,10 +10,14 @@ import java.util.List;
...
@@ -10,10 +10,14 @@ import java.util.List;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
@Command
(
label
=
"permission"
,
usage
=
"permission <add|remove> <permission>"
,
@Command
(
label
=
"permission"
,
usage
=
"permission <add|remove> <permission>"
,
permission
=
"*"
)
description
=
"Grants or removes a permission for a user"
,
permission
=
"*"
)
public
final
class
PermissionCommand
implements
CommandHandler
{
public
final
class
PermissionCommand
implements
CommandHandler
{
@Override
public
String
description
()
{
return
translate
(
"commands.permission.description"
);
}
@Override
@Override
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
if
(
targetPlayer
==
null
)
{
if
(
targetPlayer
==
null
)
{
...
...
src/main/java/emu/grasscutter/command/commands/PositionCommand.java
View file @
a46d58e5
...
@@ -9,10 +9,14 @@ import java.util.List;
...
@@ -9,10 +9,14 @@ import java.util.List;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
@Command
(
label
=
"position"
,
usage
=
"position"
,
aliases
=
{
"pos"
},
@Command
(
label
=
"position"
,
usage
=
"position"
,
aliases
=
{
"pos"
})
description
=
"Get coordinates."
)
public
final
class
PositionCommand
implements
CommandHandler
{
public
final
class
PositionCommand
implements
CommandHandler
{
@Override
public
String
description
()
{
return
translate
(
"commands.position.description"
);
}
@Override
@Override
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
if
(
targetPlayer
==
null
)
{
if
(
targetPlayer
==
null
)
{
...
...
src/main/java/emu/grasscutter/command/commands/ReloadCommand.java
View file @
a46d58e5
...
@@ -9,10 +9,14 @@ import java.util.List;
...
@@ -9,10 +9,14 @@ import java.util.List;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
@Command
(
label
=
"reload"
,
usage
=
"reload"
,
@Command
(
label
=
"reload"
,
usage
=
"reload"
,
permission
=
"server.reload"
)
description
=
"Reload server config"
,
permission
=
"server.reload"
)
public
final
class
ReloadCommand
implements
CommandHandler
{
public
final
class
ReloadCommand
implements
CommandHandler
{
@Override
public
String
description
()
{
return
translate
(
"commands.reload.description"
);
}
@Override
@Override
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
CommandHandler
.
sendMessage
(
sender
,
translate
(
"commands.reload.reload_start"
));
CommandHandler
.
sendMessage
(
sender
,
translate
(
"commands.reload.reload_start"
));
...
...
src/main/java/emu/grasscutter/command/commands/ResetConstCommand.java
View file @
a46d58e5
...
@@ -11,10 +11,14 @@ import java.util.List;
...
@@ -11,10 +11,14 @@ import java.util.List;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
@Command
(
label
=
"resetconst"
,
usage
=
"resetconst [all]"
,
@Command
(
label
=
"resetconst"
,
usage
=
"resetconst [all]"
,
description
=
"Resets the constellation level on your current active character, will need to relog after using the command to see any changes."
,
aliases
=
{
"resetconstellation"
},
permission
=
"player.resetconstellation"
)
aliases
=
{
"resetconstellation"
},
permission
=
"player.resetconstellation"
)
public
final
class
ResetConstCommand
implements
CommandHandler
{
public
final
class
ResetConstCommand
implements
CommandHandler
{
@Override
public
String
description
()
{
return
translate
(
"commands.resetConst.description"
);
}
@Override
@Override
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
if
(
targetPlayer
==
null
)
{
if
(
targetPlayer
==
null
)
{
...
...
src/main/java/emu/grasscutter/command/commands/ResetShopLimitCommand.java
View file @
a46d58e5
...
@@ -9,9 +9,13 @@ import java.util.List;
...
@@ -9,9 +9,13 @@ import java.util.List;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
@Command
(
label
=
"resetshop"
,
usage
=
"resetshop"
,
@Command
(
label
=
"resetshop"
,
usage
=
"resetshop"
,
permission
=
"server.resetshop"
)
description
=
"Reset target player's shop refresh time."
,
permission
=
"server.resetshop"
)
public
final
class
ResetShopLimitCommand
implements
CommandHandler
{
public
final
class
ResetShopLimitCommand
implements
CommandHandler
{
@Override
public
String
description
()
{
return
translate
(
"commands.status.description"
);
}
@Override
@Override
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
if
(
targetPlayer
==
null
)
{
if
(
targetPlayer
==
null
)
{
...
...
src/main/java/emu/grasscutter/command/commands/RestartCommand.java
View file @
a46d58e5
...
@@ -6,9 +6,16 @@ import emu.grasscutter.game.player.Player;
...
@@ -6,9 +6,16 @@ import emu.grasscutter.game.player.Player;
import
java.util.List
;
import
java.util.List
;
@Command
(
label
=
"restart"
,
usage
=
"restart - Restarts the current session"
)
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
@Command
(
label
=
"restart"
,
usage
=
"restart"
)
public
final
class
RestartCommand
implements
CommandHandler
{
public
final
class
RestartCommand
implements
CommandHandler
{
@Override
public
String
description
()
{
return
translate
(
"commands.restart.description"
);
}
@Override
@Override
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
if
(
sender
==
null
)
{
if
(
sender
==
null
)
{
...
...
src/main/java/emu/grasscutter/command/commands/SendMailCommand.java
View file @
a46d58e5
...
@@ -13,8 +13,7 @@ import java.util.List;
...
@@ -13,8 +13,7 @@ import java.util.List;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
@SuppressWarnings
(
"ConstantConditions"
)
@SuppressWarnings
(
"ConstantConditions"
)
@Command
(
label
=
"sendmail"
,
usage
=
"sendmail <userId|all|help> [templateId]"
,
@Command
(
label
=
"sendmail"
,
usage
=
"sendmail <userId|all|help> [templateId]"
,
permission
=
"server.sendmail"
)
description
=
"Sends mail to the specified user. The usage of this command changes based on it's composition state."
,
permission
=
"server.sendmail"
)
public
final
class
SendMailCommand
implements
CommandHandler
{
public
final
class
SendMailCommand
implements
CommandHandler
{
// TODO: You should be able to do /sendmail and then just send subsequent messages until you finish
// TODO: You should be able to do /sendmail and then just send subsequent messages until you finish
...
@@ -24,6 +23,11 @@ public final class SendMailCommand implements CommandHandler {
...
@@ -24,6 +23,11 @@ public final class SendMailCommand implements CommandHandler {
// Key = User that is constructing the mail.
// Key = User that is constructing the mail.
private
static
final
HashMap
<
Integer
,
MailBuilder
>
mailBeingConstructed
=
new
HashMap
<
Integer
,
MailBuilder
>();
private
static
final
HashMap
<
Integer
,
MailBuilder
>
mailBeingConstructed
=
new
HashMap
<
Integer
,
MailBuilder
>();
@Override
public
String
description
()
{
return
translate
(
"commands.sendMail.description"
);
}
// Yes this is awful and I hate it.
// Yes this is awful and I hate it.
@Override
@Override
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
...
@@ -40,7 +44,7 @@ public final class SendMailCommand implements CommandHandler {
...
@@ -40,7 +44,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
.
sendMessage
(
sender
,
this
.
getClass
().
getAnnotation
(
Command
.
class
).
description
()
+
"\nUsage: "
+
this
.
getClass
().
getAnnotation
(
Command
.
class
).
usage
());
CommandHandler
.
sendMessage
(
sender
,
this
.
description
()
+
"\nUsage: "
+
this
.
getClass
().
getAnnotation
(
Command
.
class
).
usage
());
return
;
return
;
}
}
case
"all"
->
mailBuilder
=
new
MailBuilder
(
true
,
new
Mail
());
case
"all"
->
mailBuilder
=
new
MailBuilder
(
true
,
new
Mail
());
...
...
src/main/java/emu/grasscutter/command/commands/SendMessageCommand.java
View file @
a46d58e5
...
@@ -8,10 +8,15 @@ import java.util.List;
...
@@ -8,10 +8,15 @@ import java.util.List;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
@Command
(
label
=
"say"
,
usage
=
"say <message>"
,
description
=
"Sends a message to a player as the server"
,
@Command
(
label
=
"say"
,
usage
=
"say <message>"
,
aliases
=
{
"sendservmsg"
,
"sendservermessage"
,
"sendmessage"
},
permission
=
"server.sendmessage"
)
aliases
=
{
"sendservmsg"
,
"sendservermessage"
,
"sendmessage"
},
permission
=
"server.sendmessage"
)
public
final
class
SendMessageCommand
implements
CommandHandler
{
public
final
class
SendMessageCommand
implements
CommandHandler
{
@Override
public
String
description
()
{
return
translate
(
"commands.sendMessage.description"
);
}
@Override
@Override
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
if
(
targetPlayer
==
null
)
{
if
(
targetPlayer
==
null
)
{
...
...
src/main/java/emu/grasscutter/command/commands/SetFetterLevelCommand.java
View file @
a46d58e5
...
@@ -12,10 +12,14 @@ import emu.grasscutter.server.packet.send.PacketAvatarFetterDataNotify;
...
@@ -12,10 +12,14 @@ import emu.grasscutter.server.packet.send.PacketAvatarFetterDataNotify;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
@Command
(
label
=
"setfetterlevel"
,
usage
=
"setfetterlevel <level>"
,
@Command
(
label
=
"setfetterlevel"
,
usage
=
"setfetterlevel <level>"
,
description
=
"Sets your fetter level for your current active character"
,
aliases
=
{
"setfetterlvl"
,
"setfriendship"
},
permission
=
"player.setfetterlevel"
)
aliases
=
{
"setfetterlvl"
,
"setfriendship"
},
permission
=
"player.setfetterlevel"
)
public
final
class
SetFetterLevelCommand
implements
CommandHandler
{
public
final
class
SetFetterLevelCommand
implements
CommandHandler
{
@Override
public
String
description
()
{
return
translate
(
"commands.setFetterLevel.description"
);
}
@Override
@Override
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
if
(
targetPlayer
==
null
)
{
if
(
targetPlayer
==
null
)
{
...
...
src/main/java/emu/grasscutter/command/commands/SetStatsCommand.java
View file @
a46d58e5
...
@@ -15,8 +15,7 @@ import emu.grasscutter.utils.Language;
...
@@ -15,8 +15,7 @@ import emu.grasscutter.utils.Language;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
@Command
(
label
=
"setstats"
,
usage
=
"setstats|stats <stat> <value>"
,
@Command
(
label
=
"setstats"
,
usage
=
"setstats|stats <stat> <value>"
,
aliases
=
{
"stats"
},
permission
=
"player.setstats"
)
description
=
"Set fight property for your current active character"
,
aliases
=
{
"stats"
},
permission
=
"player.setstats"
)
public
final
class
SetStatsCommand
implements
CommandHandler
{
public
final
class
SetStatsCommand
implements
CommandHandler
{
static
class
Stat
{
static
class
Stat
{
String
name
;
String
name
;
...
@@ -174,6 +173,11 @@ public final class SetStatsCommand implements CommandHandler {
...
@@ -174,6 +173,11 @@ public final class SetStatsCommand implements CommandHandler {
stats
.
put
(
"_nonextra_physical_add_hurt"
,
new
Stat
(
"NONEXTRA_PHYSICAL_ADD_HURT"
,
FightProperty
.
FIGHT_PROP_NONEXTRA_PHYSICAL_ADD_HURT
,
true
));
stats
.
put
(
"_nonextra_physical_add_hurt"
,
new
Stat
(
"NONEXTRA_PHYSICAL_ADD_HURT"
,
FightProperty
.
FIGHT_PROP_NONEXTRA_PHYSICAL_ADD_HURT
,
true
));
}
}
@Override
public
String
description
()
{
return
translate
(
"commands.setStats.description"
);
}
@Override
@Override
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
String
syntax
=
sender
==
null
?
translate
(
"commands.setStats.usage_console"
)
:
translate
(
"commands.setStats.ingame"
);
String
syntax
=
sender
==
null
?
translate
(
"commands.setStats.usage_console"
)
:
translate
(
"commands.setStats.ingame"
);
...
...
src/main/java/emu/grasscutter/command/commands/SetWorldLevelCommand.java
View file @
a46d58e5
...
@@ -10,10 +10,14 @@ import java.util.List;
...
@@ -10,10 +10,14 @@ import java.util.List;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
@Command
(
label
=
"setworldlevel"
,
usage
=
"setworldlevel <level>"
,
@Command
(
label
=
"setworldlevel"
,
usage
=
"setworldlevel <level>"
,
description
=
"Sets your world level (Relog to see proper effects)"
,
aliases
=
{
"setworldlvl"
},
permission
=
"player.setworldlevel"
)
aliases
=
{
"setworldlvl"
},
permission
=
"player.setworldlevel"
)
public
final
class
SetWorldLevelCommand
implements
CommandHandler
{
public
final
class
SetWorldLevelCommand
implements
CommandHandler
{
@Override
public
String
description
()
{
return
translate
(
"commands.setWorldLevel.description"
);
}
@Override
@Override
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
if
(
targetPlayer
==
null
)
{
if
(
targetPlayer
==
null
)
{
...
...
src/main/java/emu/grasscutter/command/commands/SpawnCommand.java
View file @
a46d58e5
...
@@ -22,10 +22,14 @@ import java.util.Random;
...
@@ -22,10 +22,14 @@ import java.util.Random;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
@Command
(
label
=
"spawn"
,
usage
=
"spawn <entityId> [amount] [level(monster only)]"
,
@Command
(
label
=
"spawn"
,
usage
=
"spawn <entityId> [amount] [level(monster only)]"
,
permission
=
"server.spawn"
)
description
=
"Spawns an entity near you"
,
permission
=
"server.spawn"
)
public
final
class
SpawnCommand
implements
CommandHandler
{
public
final
class
SpawnCommand
implements
CommandHandler
{
@Override
public
String
description
()
{
return
translate
(
"commands.spawn.description"
);
}
@Override
@Override
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
if
(
targetPlayer
==
null
)
{
if
(
targetPlayer
==
null
)
{
...
...
src/main/java/emu/grasscutter/command/commands/StopCommand.java
View file @
a46d58e5
...
@@ -9,10 +9,14 @@ import java.util.List;
...
@@ -9,10 +9,14 @@ import java.util.List;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
@Command
(
label
=
"stop"
,
usage
=
"stop"
,
@Command
(
label
=
"stop"
,
usage
=
"stop"
,
permission
=
"server.stop"
)
description
=
"Stops the server"
,
permission
=
"server.stop"
)
public
final
class
StopCommand
implements
CommandHandler
{
public
final
class
StopCommand
implements
CommandHandler
{
@Override
public
String
description
()
{
return
translate
(
"commands.stop.description"
);
}
@Override
@Override
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
CommandHandler
.
sendMessage
(
null
,
translate
(
"commands.stop.success"
));
CommandHandler
.
sendMessage
(
null
,
translate
(
"commands.stop.success"
));
...
...
src/main/java/emu/grasscutter/command/commands/TalentCommand.java
View file @
a46d58e5
...
@@ -14,8 +14,7 @@ import java.util.List;
...
@@ -14,8 +14,7 @@ import java.util.List;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
@Command
(
label
=
"talent"
,
usage
=
"talent <talentID> <value>"
,
@Command
(
label
=
"talent"
,
usage
=
"talent <talentID> <value>"
,
permission
=
"player.settalent"
)
description
=
"Set talent level for your current active character"
,
permission
=
"player.settalent"
)
public
final
class
TalentCommand
implements
CommandHandler
{
public
final
class
TalentCommand
implements
CommandHandler
{
private
void
setTalentLevel
(
Player
sender
,
Player
player
,
Avatar
avatar
,
int
talentId
,
int
talentLevel
)
{
private
void
setTalentLevel
(
Player
sender
,
Player
player
,
Avatar
avatar
,
int
talentId
,
int
talentLevel
)
{
int
oldLevel
=
avatar
.
getSkillLevelMap
().
get
(
talentId
);
int
oldLevel
=
avatar
.
getSkillLevelMap
().
get
(
talentId
);
...
@@ -44,6 +43,11 @@ public final class TalentCommand implements CommandHandler {
...
@@ -44,6 +43,11 @@ public final class TalentCommand implements CommandHandler {
CommandHandler
.
sendMessage
(
sender
,
translate
(
successMessage
,
talentLevel
));
CommandHandler
.
sendMessage
(
sender
,
translate
(
successMessage
,
talentLevel
));
}
}
@Override
public
String
description
()
{
return
translate
(
"commands.talent.description"
);
}
@Override
@Override
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
if
(
targetPlayer
==
null
)
{
if
(
targetPlayer
==
null
)
{
...
...
src/main/java/emu/grasscutter/command/commands/TeleportAllCommand.java
View file @
a46d58e5
...
@@ -10,9 +10,13 @@ import java.util.List;
...
@@ -10,9 +10,13 @@ import java.util.List;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
@Command
(
label
=
"tpall"
,
usage
=
"tpall"
,
@Command
(
label
=
"tpall"
,
usage
=
"tpall"
,
permission
=
"player.tpall"
)
description
=
"Teleports all players in your world to your position"
,
permission
=
"player.tpall"
)
public
final
class
TeleportAllCommand
implements
CommandHandler
{
public
final
class
TeleportAllCommand
implements
CommandHandler
{
@Override
public
String
description
()
{
return
translate
(
"commands.teleportAll.description"
);
}
@Override
@Override
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
if
(
targetPlayer
==
null
)
{
if
(
targetPlayer
==
null
)
{
...
...
src/main/java/emu/grasscutter/command/commands/TeleportCommand.java
View file @
a46d58e5
...
@@ -10,8 +10,7 @@ import java.util.List;
...
@@ -10,8 +10,7 @@ import java.util.List;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
@Command
(
label
=
"teleport"
,
usage
=
"teleport <x> <y> <z> [scene id]"
,
aliases
=
{
"tp"
},
@Command
(
label
=
"teleport"
,
usage
=
"teleport <x> <y> <z> [scene id]"
,
aliases
=
{
"tp"
},
permission
=
"player.teleport"
)
description
=
"Change the player's position."
,
permission
=
"player.teleport"
)
public
final
class
TeleportCommand
implements
CommandHandler
{
public
final
class
TeleportCommand
implements
CommandHandler
{
private
float
parseRelative
(
String
input
,
Float
current
)
{
// TODO: Maybe this will be useful elsewhere later
private
float
parseRelative
(
String
input
,
Float
current
)
{
// TODO: Maybe this will be useful elsewhere later
...
@@ -25,6 +24,11 @@ public final class TeleportCommand implements CommandHandler {
...
@@ -25,6 +24,11 @@ public final class TeleportCommand implements CommandHandler {
return
current
;
return
current
;
}
}
@Override
public
String
description
()
{
return
translate
(
"commands.teleport.description"
);
}
@Override
@Override
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
if
(
targetPlayer
==
null
)
{
if
(
targetPlayer
==
null
)
{
...
...
src/main/java/emu/grasscutter/command/commands/WeatherCommand.java
View file @
a46d58e5
...
@@ -11,10 +11,14 @@ import java.util.List;
...
@@ -11,10 +11,14 @@ import java.util.List;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
@Command
(
label
=
"weather"
,
usage
=
"weather <weatherId> [climateId]"
,
@Command
(
label
=
"weather"
,
usage
=
"weather <weatherId> [climateId]"
,
aliases
=
{
"w"
},
permission
=
"player.weather"
)
description
=
"Changes the weather."
,
aliases
=
{
"w"
},
permission
=
"player.weather"
)
public
final
class
WeatherCommand
implements
CommandHandler
{
public
final
class
WeatherCommand
implements
CommandHandler
{
@Override
public
String
description
()
{
return
translate
(
"commands.weather.description"
);
}
@Override
@Override
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
public
void
execute
(
Player
sender
,
Player
targetPlayer
,
List
<
String
>
args
)
{
if
(
targetPlayer
==
null
)
{
if
(
targetPlayer
==
null
)
{
...
...
src/main/java/emu/grasscutter/tools/Tools.java
View file @
a46d58e5
...
@@ -21,6 +21,7 @@ import com.google.gson.reflect.TypeToken;
...
@@ -21,6 +21,7 @@ import com.google.gson.reflect.TypeToken;
import
emu.grasscutter.GameConstants
;
import
emu.grasscutter.GameConstants
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.command.Command
;
import
emu.grasscutter.command.Command
;
import
emu.grasscutter.command.CommandHandler
;
import
emu.grasscutter.command.CommandMap
;
import
emu.grasscutter.command.CommandMap
;
import
emu.grasscutter.data.GameData
;
import
emu.grasscutter.data.GameData
;
import
emu.grasscutter.data.ResourceLoader
;
import
emu.grasscutter.data.ResourceLoader
;
...
@@ -112,17 +113,16 @@ final class ToolsWithLanguageOption {
...
@@ -112,17 +113,16 @@ final class ToolsWithLanguageOption {
writer
.
println
(
"// Created "
+
dtf
.
format
(
now
)
+
System
.
lineSeparator
()
+
System
.
lineSeparator
());
writer
.
println
(
"// Created "
+
dtf
.
format
(
now
)
+
System
.
lineSeparator
()
+
System
.
lineSeparator
());
CommandMap
cmdMap
=
new
CommandMap
(
true
);
CommandMap
cmdMap
=
new
CommandMap
(
true
);
List
<
Command
>
cmdList
=
new
ArrayList
<>(
cmdMap
.
get
Annotations
AsList
()
);
HashMap
<
Command
Handler
,
Command
>
cmdList
=
cmdMap
.
getHandlersAnd
Annotations
(
);
writer
.
println
(
"// Commands"
);
writer
.
println
(
"// Commands"
);
for
(
Command
cmd
:
cmdList
)
{
cmdList
.
forEach
((
handler
,
command
)
->
{
String
cmdName
=
c
m
d
.
label
();
String
cmdName
=
c
omman
d
.
label
();
while
(
cmdName
.
length
()
<=
15
)
{
while
(
cmdName
.
length
()
<=
15
)
{
cmdName
=
" "
+
cmdName
;
cmdName
=
" "
+
cmdName
;
}
}
writer
.
println
(
cmdName
+
" : "
+
cmd
.
description
());
writer
.
println
(
cmdName
+
" : "
+
handler
.
description
());
}
});
writer
.
println
();
writer
.
println
();
list
=
new
ArrayList
<>(
GameData
.
getAvatarDataMap
().
keySet
());
list
=
new
ArrayList
<>(
GameData
.
getAvatarDataMap
().
keySet
());
...
...
src/main/resources/languages/en-US.json
View file @
a46d58e5
...
@@ -95,17 +95,20 @@
...
@@ -95,17 +95,20 @@
"create"
:
"Account created with UID %s."
,
"create"
:
"Account created with UID %s."
,
"delete"
:
"Account deleted."
,
"delete"
:
"Account deleted."
,
"no_account"
:
"Account not found."
,
"no_account"
:
"Account not found."
,
"command_usage"
:
"Usage: account <create|delete> <username> [uid]"
"command_usage"
:
"Usage: account <create|delete> <username> [uid]"
,
"description"
:
"Modify user accounts"
},
},
"broadcast"
:
{
"broadcast"
:
{
"command_usage"
:
"Usage: broadcast <message>"
,
"command_usage"
:
"Usage: broadcast <message>"
,
"message_sent"
:
"Message sent."
"message_sent"
:
"Message sent."
,
"description"
:
"Sends a message to all the players"
},
},
"changescene"
:
{
"changescene"
:
{
"usage"
:
"Usage: changescene <sceneId>"
,
"usage"
:
"Usage: changescene <sceneId>"
,
"already_in_scene"
:
"You are already in that scene."
,
"already_in_scene"
:
"You are already in that scene."
,
"success"
:
"Changed to scene %s."
,
"success"
:
"Changed to scene %s."
,
"exists_error"
:
"The specified scene does not exist."
"exists_error"
:
"The specified scene does not exist."
,
"description"
:
"Changes your scene"
},
},
"clear"
:
{
"clear"
:
{
"command_usage"
:
"Usage: clear <all|wp|art|mat>"
,
"command_usage"
:
"Usage: clear <all|wp|art|mat>"
,
...
@@ -115,35 +118,41 @@
...
@@ -115,35 +118,41 @@
"furniture"
:
"Cleared furniture for %s."
,
"furniture"
:
"Cleared furniture for %s."
,
"displays"
:
"Cleared displays for %s."
,
"displays"
:
"Cleared displays for %s."
,
"virtuals"
:
"Cleared virtuals for %s."
,
"virtuals"
:
"Cleared virtuals for %s."
,
"everything"
:
"Cleared everything for %s."
"everything"
:
"Cleared everything for %s."
,
"description"
:
"Deletes unequipped unlocked items, including yellow rarity ones from your inventory"
},
},
"coop"
:
{
"coop"
:
{
"usage"
:
"Usage: coop <playerId> <target playerId>"
,
"usage"
:
"Usage: coop <playerId> <target playerId>"
,
"success"
:
"Summoned %s to %s's world."
"success"
:
"Summoned %s to %s's world."
,
"description"
:
"Forces someone to join the world of others"
},
},
"enter_dungeon"
:
{
"enter_dungeon"
:
{
"usage"
:
"Usage: enterdungeon <dungeon id>"
,
"usage"
:
"Usage: enterdungeon <dungeon id>"
,
"changed"
:
"Changed to dungeon %s"
,
"changed"
:
"Changed to dungeon %s"
,
"not_found_error"
:
"Dungeon does not exist"
,
"not_found_error"
:
"Dungeon does not exist"
,
"in_dungeon_error"
:
"You are already in that dungeon"
"in_dungeon_error"
:
"You are already in that dungeon"
,
"description"
:
"Enter a dungeon"
},
},
"giveAll"
:
{
"giveAll"
:
{
"usage"
:
"Usage: giveall [player] [amount]"
,
"usage"
:
"Usage: giveall [player] [amount]"
,
"started"
:
"Receiving all items..."
,
"started"
:
"Receiving all items..."
,
"success"
:
"Successfully gave all items to %s."
,
"success"
:
"Successfully gave all items to %s."
,
"invalid_amount_or_playerId"
:
"Invalid amount or player ID."
"invalid_amount_or_playerId"
:
"Invalid amount or player ID."
,
"description"
:
"Gives all items"
},
},
"giveArtifact"
:
{
"giveArtifact"
:
{
"usage"
:
"Usage: giveart|gart [player] <artifactId> <mainPropId> [<appendPropId>[,<times>]]... [level]"
,
"usage"
:
"Usage: giveart|gart [player] <artifactId> <mainPropId> [<appendPropId>[,<times>]]... [level]"
,
"id_error"
:
"Invalid artifact ID."
,
"id_error"
:
"Invalid artifact ID."
,
"success"
:
"Given %s to %s."
"success"
:
"Given %s to %s."
,
"description"
:
"Gives the player a specified artifact"
},
},
"giveChar"
:
{
"giveChar"
:
{
"usage"
:
"Usage: givechar <player> <itemId|itemName> [amount]"
,
"usage"
:
"Usage: givechar <player> <itemId|itemName> [amount]"
,
"given"
:
"Given %s with level %s to %s."
,
"given"
:
"Given %s with level %s to %s."
,
"invalid_avatar_id"
:
"Invalid avatar id."
,
"invalid_avatar_id"
:
"Invalid avatar id."
,
"invalid_avatar_level"
:
"Invalid avatar level."
,
"invalid_avatar_level"
:
"Invalid avatar level."
,
"invalid_avatar_or_player_id"
:
"Invalid avatar or player ID."
"invalid_avatar_or_player_id"
:
"Invalid avatar or player ID."
,
"description"
:
"Gives the player a specified character"
},
},
"give"
:
{
"give"
:
{
"usage"
:
"Usage: give <player> <itemId|itemName> [amount] [level]"
,
"usage"
:
"Usage: give <player> <itemId|itemName> [amount] [level]"
,
...
@@ -151,29 +160,36 @@
...
@@ -151,29 +160,36 @@
"refinement_must_between_1_and_5"
:
"Refinement must be between 1 and 5."
,
"refinement_must_between_1_and_5"
:
"Refinement must be between 1 and 5."
,
"given"
:
"Given %s of %s to %s."
,
"given"
:
"Given %s of %s to %s."
,
"given_with_level_and_refinement"
:
"Given %s with level %s, refinement %s %s times to %s"
,
"given_with_level_and_refinement"
:
"Given %s with level %s, refinement %s %s times to %s"
,
"given_level"
:
"Given %s with level %s %s times to %s"
"given_level"
:
"Given %s with level %s %s times to %s"
,
"description"
:
"Gives an item to you or the specified player"
},
},
"godmode"
:
{
"godmode"
:
{
"success"
:
"Godmode is now %s for %s."
"success"
:
"Godmode is now %s for %s."
,
"description"
:
"Prevents you from taking damage. Defaults to toggle."
},
},
"heal"
:
{
"heal"
:
{
"success"
:
"All characters have been healed."
"success"
:
"All characters have been healed."
,
"description"
:
"Heal all characters in your current team."
},
},
"kick"
:
{
"kick"
:
{
"player_kick_player"
:
"Player [%s:%s] has kicked player [%s:%s]"
,
"player_kick_player"
:
"Player [%s:%s] has kicked player [%s:%s]"
,
"server_kick_player"
:
"Kicking player [%s:%s]"
"server_kick_player"
:
"Kicking player [%s:%s]"
,
"description"
:
"Kicks the specified player from the server (WIP)"
},
},
"kill"
:
{
"kill"
:
{
"usage"
:
"Usage: killall [playerUid] [sceneId]"
,
"usage"
:
"Usage: killall [playerUid] [sceneId]"
,
"scene_not_found_in_player_world"
:
"Scene not found in player world"
,
"scene_not_found_in_player_world"
:
"Scene not found in player world"
,
"kill_monsters_in_scene"
:
"Killing %s monsters in scene %s"
"kill_monsters_in_scene"
:
"Killing %s monsters in scene %s"
,
"description"
:
"Kill all entities"
},
},
"killCharacter"
:
{
"killCharacter"
:
{
"usage"
:
"Usage: /killcharacter [playerId]"
,
"usage"
:
"Usage: /killcharacter [playerId]"
,
"success"
:
"Killed %s's current character."
"success"
:
"Killed %s's current character."
,
"description"
:
"Kills the players current character"
},
},
"list"
:
{
"list"
:
{
"success"
:
"There are %s player(s) online:"
"success"
:
"There are %s player(s) online:"
,
"description"
:
"List online players"
},
},
"permission"
:
{
"permission"
:
{
"usage"
:
"Usage: permission <add|remove> <username> <permission>"
,
"usage"
:
"Usage: permission <add|remove> <username> <permission>"
,
...
@@ -181,21 +197,26 @@
...
@@ -181,21 +197,26 @@
"has_error"
:
"They already have this permission!"
,
"has_error"
:
"They already have this permission!"
,
"remove"
:
"Permission removed."
,
"remove"
:
"Permission removed."
,
"not_have_error"
:
"They don't have this permission!"
,
"not_have_error"
:
"They don't have this permission!"
,
"account_error"
:
"The account cannot be found."
"account_error"
:
"The account cannot be found."
,
"description"
:
"Grants or removes a permission for a user"
},
},
"position"
:
{
"position"
:
{
"success"
:
"Coordinates: %s, %s, %s
\n
Scene id: %s"
"success"
:
"Coordinates: %s, %s, %s
\n
Scene id: %s"
,
"description"
:
"Get coordinates."
},
},
"reload"
:
{
"reload"
:
{
"reload_start"
:
"Reloading config."
,
"reload_start"
:
"Reloading config."
,
"reload_done"
:
"Reload complete."
"reload_done"
:
"Reload complete."
,
"description"
:
"Reload server config"
},
},
"resetConst"
:
{
"resetConst"
:
{
"reset_all"
:
"Reset all avatars' constellations."
,
"reset_all"
:
"Reset all avatars' constellations."
,
"success"
:
"Constellations for %s have been reset. Please relog to see changes."
"success"
:
"Constellations for %s have been reset. Please relog to see changes."
,
"description"
:
"Resets the constellation level on your current active character, will need to relog after using the command to see any changes."
},
},
"resetShopLimit"
:
{
"resetShopLimit"
:
{
"usage"
:
"Usage: /resetshop <player id>"
"usage"
:
"Usage: /resetshop <player id>"
,
"description"
:
"Reset target player's shop refresh time."
},
},
"sendMail"
:
{
"sendMail"
:
{
"usage"
:
"Usage: give [player] <itemId|itemName> [amount]"
,
"usage"
:
"Usage: give [player] <itemId|itemName> [amount]"
,
...
@@ -217,17 +238,20 @@
...
@@ -217,17 +238,20 @@
"message"
:
"<message>"
,
"message"
:
"<message>"
,
"sender"
:
"<sender>"
,
"sender"
:
"<sender>"
,
"arguments"
:
"<itemId|itemName|finish> [amount] [level]"
,
"arguments"
:
"<itemId|itemName|finish> [amount] [level]"
,
"error"
:
"ERROR: invalid construction stage %s. Check console for stacktrace."
"error"
:
"ERROR: invalid construction stage %s. Check console for stacktrace."
,
"description"
:
"Sends mail to the specified user. The usage of this command changes based on it's composition state."
},
},
"sendMessage"
:
{
"sendMessage"
:
{
"usage"
:
"Usage: sendmessage <player> <message>"
,
"usage"
:
"Usage: sendmessage <player> <message>"
,
"success"
:
"Message sent."
"success"
:
"Message sent."
,
"description"
:
"Sends a message to a player as the server"
},
},
"setFetterLevel"
:
{
"setFetterLevel"
:
{
"usage"
:
"Usage: setfetterlevel <level>"
,
"usage"
:
"Usage: setfetterlevel <level>"
,
"range_error"
:
"Fetter level must be between 0 and 10."
,
"range_error"
:
"Fetter level must be between 0 and 10."
,
"success"
:
"Fetter level set to %s"
,
"success"
:
"Fetter level set to %s"
,
"level_error"
:
"Invalid fetter level."
"level_error"
:
"Invalid fetter level."
,
"description"
:
"Sets your fetter level for your current active character"
},
},
"setStats"
:
{
"setStats"
:
{
"usage_console"
:
"Usage: setstats|stats @<UID> <stat> <value>"
,
"usage_console"
:
"Usage: setstats|stats @<UID> <stat> <value>"
,
...
@@ -238,20 +262,24 @@
...
@@ -238,20 +262,24 @@
"player_error"
:
"Player not found or offline."
,
"player_error"
:
"Player not found or offline."
,
"set_self"
:
"%s set to %s."
,
"set_self"
:
"%s set to %s."
,
"set_for_uid"
:
"%s for %s set to %s."
,
"set_for_uid"
:
"%s for %s set to %s."
,
"set_max_hp"
:
"MAX HP set to %s."
"set_max_hp"
:
"MAX HP set to %s."
,
"description"
:
"Set fight property for your current active character"
},
},
"setWorldLevel"
:
{
"setWorldLevel"
:
{
"usage"
:
"Usage: setworldlevel <level>"
,
"usage"
:
"Usage: setworldlevel <level>"
,
"value_error"
:
"World level must be between 0-8"
,
"value_error"
:
"World level must be between 0-8"
,
"success"
:
"World level set to %s."
,
"success"
:
"World level set to %s."
,
"invalid_world_level"
:
"Invalid world level."
"invalid_world_level"
:
"Invalid world level."
,
"description"
:
"Sets your world level (Relog to see proper effects)"
},
},
"spawn"
:
{
"spawn"
:
{
"usage"
:
"Usage: spawn <entityId> [amount] [level(monster only)]"
,
"usage"
:
"Usage: spawn <entityId> [amount] [level(monster only)]"
,
"success"
:
"Spawned %s of %s."
"success"
:
"Spawned %s of %s."
,
"description"
:
"Spawns an entity near you"
},
},
"stop"
:
{
"stop"
:
{
"success"
:
"Server shutting down..."
"success"
:
"Server shutting down..."
,
"description"
:
"Stops the server"
},
},
"talent"
:
{
"talent"
:
{
"usage_1"
:
"To set talent level: /talent set <talentID> <value>"
,
"usage_1"
:
"To set talent level: /talent set <talentID> <value>"
,
...
@@ -267,32 +295,41 @@
...
@@ -267,32 +295,41 @@
"invalid_level"
:
"Invalid talent level."
,
"invalid_level"
:
"Invalid talent level."
,
"normal_attack_id"
:
"Normal Attack ID %s."
,
"normal_attack_id"
:
"Normal Attack ID %s."
,
"e_skill_id"
:
"E skill ID %s."
,
"e_skill_id"
:
"E skill ID %s."
,
"q_skill_id"
:
"Q skill ID %s."
"q_skill_id"
:
"Q skill ID %s."
,
"description"
:
"Set talent level for your current active character"
},
},
"teleportAll"
:
{
"teleportAll"
:
{
"success"
:
"Summoned all players to your location."
,
"success"
:
"Summoned all players to your location."
,
"error"
:
"You only can use this command in MP mode."
"error"
:
"You only can use this command in MP mode."
,
"description"
:
"Teleports all players in your world to your position"
},
},
"teleport"
:
{
"teleport"
:
{
"usage_server"
:
"Usage: /tp @<player id> <x> <y> <z> [scene id]"
,
"usage_server"
:
"Usage: /tp @<player id> <x> <y> <z> [scene id]"
,
"usage"
:
"Usage: /tp [@<player id>] <x> <y> <z> [scene id]"
,
"usage"
:
"Usage: /tp [@<player id>] <x> <y> <z> [scene id]"
,
"specify_player_id"
:
"You must specify a player id."
,
"specify_player_id"
:
"You must specify a player id."
,
"invalid_position"
:
"Invalid position."
,
"invalid_position"
:
"Invalid position."
,
"success"
:
"Teleported %s to %s, %s, %s in scene %s"
"success"
:
"Teleported %s to %s, %s, %s in scene %s"
,
"description"
:
"Change the player's position."
},
},
"weather"
:
{
"weather"
:
{
"usage"
:
"Usage: weather <weatherId> [climateId]"
,
"usage"
:
"Usage: weather <weatherId> [climateId]"
,
"success"
:
"Changed weather to %s with climate %s"
,
"success"
:
"Changed weather to %s with climate %s"
,
"invalid_id"
:
"Invalid ID."
"invalid_id"
:
"Invalid ID."
,
"description"
:
"Changes the weather."
},
},
"drop"
:
{
"drop"
:
{
"command_usage"
:
"Usage: drop <itemId|itemName> [amount]"
,
"command_usage"
:
"Usage: drop <itemId|itemName> [amount]"
,
"success"
:
"Dropped %s of %s."
"success"
:
"Dropped %s of %s."
,
"description"
:
"Drops an item near you"
},
},
"help"
:
{
"help"
:
{
"usage"
:
"Usage: "
,
"usage"
:
"Usage: "
,
"aliases"
:
"Aliases: "
,
"aliases"
:
"Aliases: "
,
"available_commands"
:
"Available commands: "
"available_commands"
:
"Available commands: "
,
"description"
:
"Sends the help message or shows information about a specified command"
},
"restart"
:
{
"description"
:
"Restarts the current session"
}
}
}
}
}
}
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