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
3a5503de
Commit
3a5503de
authored
May 08, 2022
by
方块君
Committed by
Melledy
May 08, 2022
Browse files
Using annotation key translation
parent
ef3579da
Changes
40
Show whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/command/commands/ListCommand.java
View file @
3a5503de
...
@@ -10,14 +10,9 @@ import java.util.Map;
...
@@ -10,14 +10,9 @@ import java.util.Map;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
@Command
(
label
=
"list"
,
usage
=
"list [uid]"
,
aliases
=
{
"players"
})
@Command
(
label
=
"list"
,
usage
=
"list [uid]"
,
aliases
=
{
"players"
}
,
description
=
"commands.list.description"
)
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 @
3a5503de
...
@@ -10,14 +10,9 @@ import java.util.List;
...
@@ -10,14 +10,9 @@ 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>"
,
permission
=
"*"
)
@Command
(
label
=
"permission"
,
usage
=
"permission <add|remove> <permission>"
,
permission
=
"*"
,
description
=
"commands.permission.description"
)
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 @
3a5503de
...
@@ -9,14 +9,9 @@ import java.util.List;
...
@@ -9,14 +9,9 @@ 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
=
"commands.position.description"
)
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 @
3a5503de
...
@@ -9,14 +9,9 @@ import java.util.List;
...
@@ -9,14 +9,9 @@ import java.util.List;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
@Command
(
label
=
"reload"
,
usage
=
"reload"
,
permission
=
"server.reload"
)
@Command
(
label
=
"reload"
,
usage
=
"reload"
,
permission
=
"server.reload"
,
description
=
"commands.reload.description"
)
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 @
3a5503de
...
@@ -11,14 +11,9 @@ import java.util.List;
...
@@ -11,14 +11,9 @@ 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]"
,
aliases
=
{
"resetconstellation"
},
permission
=
"player.resetconstellation"
)
aliases
=
{
"resetconstellation"
},
permission
=
"player.resetconstellation"
,
description
=
"commands.resetConst.description"
)
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 @
3a5503de
...
@@ -9,12 +9,8 @@ import java.util.List;
...
@@ -9,12 +9,8 @@ import java.util.List;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
@Command
(
label
=
"resetshop"
,
usage
=
"resetshop"
,
permission
=
"server.resetshop"
)
@Command
(
label
=
"resetshop"
,
usage
=
"resetshop"
,
permission
=
"server.resetshop"
,
description
=
"commands.status.description"
)
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
)
{
...
...
src/main/java/emu/grasscutter/command/commands/RestartCommand.java
View file @
3a5503de
...
@@ -8,14 +8,9 @@ import java.util.List;
...
@@ -8,14 +8,9 @@ import java.util.List;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
@Command
(
label
=
"restart"
,
usage
=
"restart"
)
@Command
(
label
=
"restart"
,
usage
=
"restart"
,
description
=
"commands.restart.description"
)
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 @
3a5503de
...
@@ -13,7 +13,7 @@ import java.util.List;
...
@@ -13,7 +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]"
,
permission
=
"server.sendmail"
)
@Command
(
label
=
"sendmail"
,
usage
=
"sendmail <userId|all|help> [templateId]"
,
permission
=
"server.sendmail"
,
description
=
"commands.sendMail.description"
)
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
...
@@ -23,11 +23,6 @@ public final class SendMailCommand implements CommandHandler {
...
@@ -23,11 +23,6 @@ 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
)
{
...
@@ -44,7 +39,7 @@ public final class SendMailCommand implements CommandHandler {
...
@@ -44,7 +39,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
,
t
his
.
description
()
+
"\nUsage: "
+
this
.
getClass
().
getAnnotation
(
Command
.
class
).
usage
());
CommandHandler
.
sendMessage
(
sender
,
t
ranslate
(
this
.
getClass
().
getAnnotation
(
Command
.
class
)
.
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 @
3a5503de
...
@@ -9,14 +9,9 @@ import java.util.List;
...
@@ -9,14 +9,9 @@ import java.util.List;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
@Command
(
label
=
"say"
,
usage
=
"say <message>"
,
@Command
(
label
=
"say"
,
usage
=
"say <message>"
,
aliases
=
{
"sendservmsg"
,
"sendservermessage"
,
"sendmessage"
},
permission
=
"server.sendmessage"
)
aliases
=
{
"sendservmsg"
,
"sendservermessage"
,
"sendmessage"
},
permission
=
"server.sendmessage"
,
description
=
"commands.sendMessage.description"
)
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 @
3a5503de
...
@@ -12,14 +12,9 @@ import emu.grasscutter.server.packet.send.PacketAvatarFetterDataNotify;
...
@@ -12,14 +12,9 @@ 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>"
,
aliases
=
{
"setfetterlvl"
,
"setfriendship"
},
permission
=
"player.setfetterlevel"
)
aliases
=
{
"setfetterlvl"
,
"setfriendship"
},
permission
=
"player.setfetterlevel"
,
description
=
"commands.setFetterLevel.description"
)
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 @
3a5503de
...
@@ -15,7 +15,7 @@ import emu.grasscutter.utils.Language;
...
@@ -15,7 +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>"
,
aliases
=
{
"stats"
},
permission
=
"player.setstats"
)
@Command
(
label
=
"setstats"
,
usage
=
"setstats|stats <stat> <value>"
,
aliases
=
{
"stats"
},
permission
=
"player.setstats"
,
description
=
"commands.setStats.description"
)
public
final
class
SetStatsCommand
implements
CommandHandler
{
public
final
class
SetStatsCommand
implements
CommandHandler
{
static
class
Stat
{
static
class
Stat
{
String
name
;
String
name
;
...
@@ -173,11 +173,6 @@ public final class SetStatsCommand implements CommandHandler {
...
@@ -173,11 +173,6 @@ 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 @
3a5503de
...
@@ -10,14 +10,9 @@ import java.util.List;
...
@@ -10,14 +10,9 @@ 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>"
,
aliases
=
{
"setworldlvl"
},
permission
=
"player.setworldlevel"
)
aliases
=
{
"setworldlvl"
},
permission
=
"player.setworldlevel"
,
description
=
"commands.setWorldLevel.description"
)
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 @
3a5503de
...
@@ -22,14 +22,9 @@ import java.util.Random;
...
@@ -22,14 +22,9 @@ 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)]"
,
permission
=
"server.spawn"
)
@Command
(
label
=
"spawn"
,
usage
=
"spawn <entityId> [amount] [level(monster only)]"
,
permission
=
"server.spawn"
,
description
=
"commands.spawn.description"
)
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 @
3a5503de
...
@@ -9,14 +9,9 @@ import java.util.List;
...
@@ -9,14 +9,9 @@ import java.util.List;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
@Command
(
label
=
"stop"
,
usage
=
"stop"
,
permission
=
"server.stop"
)
@Command
(
label
=
"stop"
,
usage
=
"stop"
,
permission
=
"server.stop"
,
description
=
"commands.stop.description"
)
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 @
3a5503de
...
@@ -14,7 +14,7 @@ import java.util.List;
...
@@ -14,7 +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>"
,
permission
=
"player.settalent"
)
@Command
(
label
=
"talent"
,
usage
=
"talent <talentID> <value>"
,
permission
=
"player.settalent"
,
description
=
"commands.talent.description"
)
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
);
...
@@ -43,11 +43,6 @@ public final class TalentCommand implements CommandHandler {
...
@@ -43,11 +43,6 @@ 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 @
3a5503de
...
@@ -10,12 +10,8 @@ import java.util.List;
...
@@ -10,12 +10,8 @@ import java.util.List;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
@Command
(
label
=
"tpall"
,
usage
=
"tpall"
,
permission
=
"player.tpall"
)
@Command
(
label
=
"tpall"
,
usage
=
"tpall"
,
permission
=
"player.tpall"
,
description
=
"commands.teleportAll.description"
)
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
)
{
...
...
src/main/java/emu/grasscutter/command/commands/TeleportCommand.java
View file @
3a5503de
...
@@ -10,7 +10,7 @@ import java.util.List;
...
@@ -10,7 +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"
},
permission
=
"player.teleport"
)
@Command
(
label
=
"teleport"
,
usage
=
"teleport <x> <y> <z> [scene id]"
,
aliases
=
{
"tp"
},
permission
=
"player.teleport"
,
description
=
"commands.teleport.description"
)
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
...
@@ -24,11 +24,6 @@ public final class TeleportCommand implements CommandHandler {
...
@@ -24,11 +24,6 @@ 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 @
3a5503de
...
@@ -11,14 +11,9 @@ import java.util.List;
...
@@ -11,14 +11,9 @@ 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]"
,
aliases
=
{
"w"
},
permission
=
"player.weather"
)
@Command
(
label
=
"weather"
,
usage
=
"weather <weatherId> [climateId]"
,
aliases
=
{
"w"
},
permission
=
"player.weather"
,
description
=
"commands.weather.description"
)
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 @
3a5503de
...
@@ -31,6 +31,8 @@ import emu.grasscutter.data.def.MonsterData;
...
@@ -31,6 +31,8 @@ import emu.grasscutter.data.def.MonsterData;
import
emu.grasscutter.data.def.SceneData
;
import
emu.grasscutter.data.def.SceneData
;
import
emu.grasscutter.utils.Utils
;
import
emu.grasscutter.utils.Utils
;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
public
final
class
Tools
{
public
final
class
Tools
{
public
static
void
createGmHandbook
()
throws
Exception
{
public
static
void
createGmHandbook
()
throws
Exception
{
ToolsWithLanguageOption
.
createGmHandbook
(
getLanguageOption
());
ToolsWithLanguageOption
.
createGmHandbook
(
getLanguageOption
());
...
@@ -113,16 +115,16 @@ final class ToolsWithLanguageOption {
...
@@ -113,16 +115,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
);
HashMap
<
Command
Handler
,
Command
>
cmdList
=
cmdMap
.
getHandlersAnd
Annotations
(
);
List
<
Command
>
cmdList
=
new
ArrayList
<>(
cmdMap
.
get
Annotations
AsList
()
);
writer
.
println
(
"// Commands"
);
writer
.
println
(
"// Commands"
);
cmdList
.
forEach
((
handler
,
command
)
->
{
for
(
Command
cmd
:
cmdList
)
{
String
cmdName
=
c
omman
d
.
label
();
String
cmdName
=
c
m
d
.
label
();
while
(
cmdName
.
length
()
<=
15
)
{
while
(
cmdName
.
length
()
<=
15
)
{
cmdName
=
" "
+
cmdName
;
cmdName
=
" "
+
cmdName
;
}
}
writer
.
println
(
cmdName
+
" : "
+
(
handler
.
description
()
==
null
?
command
.
description
()
:
handler
.
description
()));
writer
.
println
(
cmdName
+
" : "
+
translate
(
cmd
.
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 @
3a5503de
...
@@ -56,6 +56,7 @@
...
@@ -56,6 +56,7 @@
"console_execute_error"
:
"This command can only be run from the console."
,
"console_execute_error"
:
"This command can only be run from the console."
,
"player_execute_error"
:
"Run this command in-game."
,
"player_execute_error"
:
"Run this command in-game."
,
"command_exist_error"
:
"No command found."
,
"command_exist_error"
:
"No command found."
,
"no_description_specified"
:
"No description specified"
,
"invalid"
:
{
"invalid"
:
{
"amount"
:
"Invalid amount."
,
"amount"
:
"Invalid amount."
,
"artifactId"
:
"Invalid artifactId."
,
"artifactId"
:
"Invalid artifactId."
,
...
...
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