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/Command.java
View file @
3a5503de
...
@@ -9,7 +9,7 @@ public @interface Command {
...
@@ -9,7 +9,7 @@ public @interface Command {
String
usage
()
default
"No usage specified"
;
String
usage
()
default
"No usage specified"
;
String
description
()
default
"
No
description
specified"
;
String
description
()
default
"
commands.generic.no_
description
_
specified"
;
String
[]
aliases
()
default
{};
String
[]
aliases
()
default
{};
...
...
src/main/java/emu/grasscutter/command/CommandHandler.java
View file @
3a5503de
...
@@ -7,8 +7,6 @@ import java.util.List;
...
@@ -7,8 +7,6 @@ import java.util.List;
public
interface
CommandHandler
{
public
interface
CommandHandler
{
default
String
description
()
{
return
null
;
};
/**
/**
* Send a message to the target.
* Send a message to the target.
*
*
...
...
src/main/java/emu/grasscutter/command/CommandMap.java
View file @
3a5503de
...
@@ -85,14 +85,6 @@ public final class CommandMap {
...
@@ -85,14 +85,6 @@ public final class CommandMap {
return
new
LinkedHashMap
<>(
this
.
annotations
);
return
new
LinkedHashMap
<>(
this
.
annotations
);
}
}
public
HashMap
<
CommandHandler
,
Command
>
getHandlersAndAnnotations
()
{
HashMap
<
CommandHandler
,
Command
>
hashMap
=
new
HashMap
<>();
this
.
commands
.
forEach
((
key
,
handler
)
->
{
hashMap
.
put
(
handler
,
this
.
annotations
.
get
(
key
));
});
return
hashMap
;
}
/**
/**
* Returns a list of all registered commands.
* Returns a list of all registered commands.
*
*
...
...
src/main/java/emu/grasscutter/command/commands/AccountCommand.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
=
"account"
,
usage
=
"account <create|delete> <username> [uid]"
)
@Command
(
label
=
"account"
,
usage
=
"account <create|delete> <username> [uid]"
,
description
=
"commands.account.description"
)
public
final
class
AccountCommand
implements
CommandHandler
{
public
final
class
AccountCommand
implements
CommandHandler
{
@Override
public
String
description
()
{
return
translate
(
"commands.account.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/BroadcastCommand.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
=
"broadcast"
,
usage
=
"broadcast <message>"
,
aliases
=
{
"b"
},
permission
=
"server.broadcast"
)
@Command
(
label
=
"broadcast"
,
usage
=
"broadcast <message>"
,
aliases
=
{
"b"
},
permission
=
"server.broadcast"
,
description
=
"commands.broadcast.description"
)
public
final
class
BroadcastCommand
implements
CommandHandler
{
public
final
class
BroadcastCommand
implements
CommandHandler
{
@Override
public
String
description
()
{
return
translate
(
"commands.broadcast.description"
);
}
@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
)
{
...
...
src/main/java/emu/grasscutter/command/commands/ChangeSceneCommand.java
View file @
3a5503de
...
@@ -8,12 +8,8 @@ import java.util.List;
...
@@ -8,12 +8,8 @@ import java.util.List;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
@Command
(
label
=
"changescene"
,
usage
=
"changescene <scene id>"
,
aliases
=
{
"scene"
},
permission
=
"player.changescene"
)
@Command
(
label
=
"changescene"
,
usage
=
"changescene <scene id>"
,
aliases
=
{
"scene"
},
permission
=
"player.changescene"
,
description
=
"commands.changescene.description"
)
public
final
class
ChangeSceneCommand
implements
CommandHandler
{
public
final
class
ChangeSceneCommand
implements
CommandHandler
{
@Override
public
String
description
()
{
return
translate
(
"commands.changescene.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/ClearCommand.java
View file @
3a5503de
...
@@ -13,15 +13,11 @@ import java.util.List;
...
@@ -13,15 +13,11 @@ import java.util.List;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
@Command
(
label
=
"clear"
,
usage
=
"clear <all|wp|art|mat>"
,
//Merged /clearartifacts and /clearweapons to /clear <args> [uid]
@Command
(
label
=
"clear"
,
usage
=
"clear <all|wp|art|mat>"
,
//Merged /clearartifacts and /clearweapons to /clear <args> [uid]
description
=
"commands.clear.description"
,
aliases
=
{
"clear"
},
permission
=
"player.clearinv"
)
aliases
=
{
"clear"
},
permission
=
"player.clearinv"
)
public
final
class
ClearCommand
implements
CommandHandler
{
public
final
class
ClearCommand
implements
CommandHandler
{
@Override
public
String
description
()
{
return
translate
(
"commands.clear.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/CoopCommand.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
=
"coop"
,
usage
=
"coop [host UID]"
,
permission
=
"server.coop"
)
@Command
(
label
=
"coop"
,
usage
=
"coop [host UID]"
,
permission
=
"server.coop"
,
description
=
"commands.coop.description"
)
public
final
class
CoopCommand
implements
CommandHandler
{
public
final
class
CoopCommand
implements
CommandHandler
{
@Override
public
String
description
()
{
return
translate
(
"commands.coop.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/DropCommand.java
View file @
3a5503de
...
@@ -13,14 +13,9 @@ import java.util.List;
...
@@ -13,14 +13,9 @@ import java.util.List;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
@Command
(
label
=
"drop"
,
usage
=
"drop <itemId|itemName> [amount]"
,
aliases
=
{
"d"
,
"dropitem"
},
permission
=
"server.drop"
)
@Command
(
label
=
"drop"
,
usage
=
"drop <itemId|itemName> [amount]"
,
aliases
=
{
"d"
,
"dropitem"
},
permission
=
"server.drop"
,
description
=
"commands.drop.description"
)
public
final
class
DropCommand
implements
CommandHandler
{
public
final
class
DropCommand
implements
CommandHandler
{
@Override
public
String
description
()
{
return
translate
(
"commands.drop.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/EnterDungeonCommand.java
View file @
3a5503de
...
@@ -8,12 +8,8 @@ import java.util.List;
...
@@ -8,12 +8,8 @@ import java.util.List;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
@Command
(
label
=
"enterdungeon"
,
usage
=
"enterdungeon <dungeon id>"
,
aliases
=
{
"dungeon"
},
permission
=
"player.enterdungeon"
)
@Command
(
label
=
"enterdungeon"
,
usage
=
"enterdungeon <dungeon id>"
,
aliases
=
{
"dungeon"
},
permission
=
"player.enterdungeon"
,
description
=
"commands.enter_dungeon.description"
)
public
final
class
EnterDungeonCommand
implements
CommandHandler
{
public
final
class
EnterDungeonCommand
implements
CommandHandler
{
@Override
public
String
description
()
{
return
translate
(
"commands.enter_dungeon.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/GiveAllCommand.java
View file @
3a5503de
...
@@ -15,14 +15,9 @@ import java.util.*;
...
@@ -15,14 +15,9 @@ import java.util.*;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
@Command
(
label
=
"giveall"
,
usage
=
"giveall [amount]"
,
aliases
=
{
"givea"
},
permission
=
"player.giveall"
,
threading
=
true
)
@Command
(
label
=
"giveall"
,
usage
=
"giveall [amount]"
,
aliases
=
{
"givea"
},
permission
=
"player.giveall"
,
threading
=
true
,
description
=
"commands.giveAll.description"
)
public
final
class
GiveAllCommand
implements
CommandHandler
{
public
final
class
GiveAllCommand
implements
CommandHandler
{
@Override
public
String
description
()
{
return
translate
(
"commands.giveAll.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/GiveArtifactCommand.java
View file @
3a5503de
...
@@ -16,12 +16,8 @@ import java.util.List;
...
@@ -16,12 +16,8 @@ import java.util.List;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
@Command
(
label
=
"giveart"
,
usage
=
"giveart <artifactId> <mainPropId> [<appendPropId>[,<times>]]... [level]"
,
aliases
=
{
"gart"
},
permission
=
"player.giveart"
)
@Command
(
label
=
"giveart"
,
usage
=
"giveart <artifactId> <mainPropId> [<appendPropId>[,<times>]]... [level]"
,
aliases
=
{
"gart"
},
permission
=
"player.giveart"
,
description
=
"commands.giveArtifact.description"
)
public
final
class
GiveArtifactCommand
implements
CommandHandler
{
public
final
class
GiveArtifactCommand
implements
CommandHandler
{
@Override
public
String
description
()
{
return
translate
(
"commands.giveArtifact.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/GiveCharCommand.java
View file @
3a5503de
...
@@ -12,14 +12,9 @@ import java.util.List;
...
@@ -12,14 +12,9 @@ import java.util.List;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
@Command
(
label
=
"givechar"
,
usage
=
"givechar <avatarId> [level]"
,
aliases
=
{
"givec"
},
permission
=
"player.givechar"
)
@Command
(
label
=
"givechar"
,
usage
=
"givechar <avatarId> [level]"
,
aliases
=
{
"givec"
},
permission
=
"player.givechar"
,
description
=
"commands.giveChar.description"
)
public
final
class
GiveCharCommand
implements
CommandHandler
{
public
final
class
GiveCharCommand
implements
CommandHandler
{
@Override
public
String
description
()
{
return
translate
(
"commands.giveChar.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/GiveCommand.java
View file @
3a5503de
...
@@ -17,7 +17,7 @@ import java.util.regex.Pattern;
...
@@ -17,7 +17,7 @@ import java.util.regex.Pattern;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
@Command
(
label
=
"give"
,
usage
=
"give <itemId|itemName> [amount] [level]"
,
aliases
=
{
@Command
(
label
=
"give"
,
usage
=
"give <itemId|itemName> [amount] [level]"
,
aliases
=
{
"g"
,
"item"
,
"giveitem"
},
permission
=
"player.give"
)
"g"
,
"item"
,
"giveitem"
},
permission
=
"player.give"
,
description
=
"commands.give.description"
)
public
final
class
GiveCommand
implements
CommandHandler
{
public
final
class
GiveCommand
implements
CommandHandler
{
Pattern
lvlRegex
=
Pattern
.
compile
(
"l(?:vl?)?(\\d+)"
);
// Java is a joke of a proglang that doesn't have raw string literals
Pattern
lvlRegex
=
Pattern
.
compile
(
"l(?:vl?)?(\\d+)"
);
// Java is a joke of a proglang that doesn't have raw string literals
Pattern
refineRegex
=
Pattern
.
compile
(
"r(\\d+)"
);
Pattern
refineRegex
=
Pattern
.
compile
(
"r(\\d+)"
);
...
@@ -31,11 +31,6 @@ public final class GiveCommand implements CommandHandler {
...
@@ -31,11 +31,6 @@ public final class GiveCommand implements CommandHandler {
return
-
1
;
return
-
1
;
}
}
@Override
public
String
description
()
{
return
translate
(
"commands.give.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/GodModeCommand.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
=
"godmode"
,
usage
=
"godmode [on|off|toggle]"
,
permission
=
"player.godmode"
)
@Command
(
label
=
"godmode"
,
usage
=
"godmode [on|off|toggle]"
,
permission
=
"player.godmode"
,
description
=
"commands.godmode.description"
)
public
final
class
GodModeCommand
implements
CommandHandler
{
public
final
class
GodModeCommand
implements
CommandHandler
{
@Override
public
String
description
()
{
return
translate
(
"commands.godmode.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/HealCommand.java
View file @
3a5503de
...
@@ -11,12 +11,8 @@ import java.util.List;
...
@@ -11,12 +11,8 @@ import java.util.List;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
@Command
(
label
=
"heal"
,
usage
=
"heal|h"
,
aliases
=
{
"h"
},
permission
=
"player.heal"
)
@Command
(
label
=
"heal"
,
usage
=
"heal|h"
,
aliases
=
{
"h"
},
permission
=
"player.heal"
,
description
=
"commands.heal.description"
)
public
final
class
HealCommand
implements
CommandHandler
{
public
final
class
HealCommand
implements
CommandHandler
{
@Override
public
String
description
()
{
return
translate
(
"commands.heal.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/HelpCommand.java
View file @
3a5503de
...
@@ -10,26 +10,21 @@ import java.util.*;
...
@@ -10,26 +10,21 @@ import java.util.*;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
@Command
(
label
=
"help"
,
usage
=
"help [command]"
)
@Command
(
label
=
"help"
,
usage
=
"help [command]"
,
description
=
"commands.help.description"
)
public
final
class
HelpCommand
implements
CommandHandler
{
public
final
class
HelpCommand
implements
CommandHandler
{
@Override
public
String
description
()
{
return
translate
(
"commands.help.description"
);
}
@Override
@Override
public
void
execute
(
Player
player
,
Player
targetPlayer
,
List
<
String
>
args
)
{
public
void
execute
(
Player
player
,
Player
targetPlayer
,
List
<
String
>
args
)
{
if
(
args
.
size
()
<
1
)
{
if
(
args
.
size
()
<
1
)
{
HashMap
<
String
,
CommandHandler
>
handlers
=
CommandMap
.
getInstance
().
getHandlers
();
HashMap
<
String
,
CommandHandler
>
handlers
=
CommandMap
.
getInstance
().
getHandlers
();
HashMap
<
Command
,
CommandHandler
>
annotations
=
new
HashMap
<>();
List
<
Command
>
annotations
=
new
ArrayList
<>();
for
(
String
key
:
handlers
.
keySet
())
{
for
(
String
key
:
handlers
.
keySet
())
{
Command
annotation
=
handlers
.
get
(
key
).
getClass
().
getAnnotation
(
Command
.
class
);
Command
annotation
=
handlers
.
get
(
key
).
getClass
().
getAnnotation
(
Command
.
class
);
if
(!
Arrays
.
asList
(
annotation
.
aliases
()).
contains
(
key
))
{
if
(!
Arrays
.
asList
(
annotation
.
aliases
()).
contains
(
key
))
{
if
(
player
!=
null
&&
!
Objects
.
equals
(
annotation
.
permission
(),
""
)
&&
!
player
.
getAccount
().
hasPermission
(
annotation
.
permission
()))
if
(
player
!=
null
&&
!
Objects
.
equals
(
annotation
.
permission
(),
""
)
&&
!
player
.
getAccount
().
hasPermission
(
annotation
.
permission
()))
continue
;
continue
;
annotations
.
put
(
annotation
,
handlers
.
get
(
key
)
);
annotations
.
add
(
annotation
);
}
}
}
}
...
@@ -43,7 +38,7 @@ public final class HelpCommand implements CommandHandler {
...
@@ -43,7 +38,7 @@ public final class HelpCommand implements CommandHandler {
}
else
{
}
else
{
Command
annotation
=
handler
.
getClass
().
getAnnotation
(
Command
.
class
);
Command
annotation
=
handler
.
getClass
().
getAnnotation
(
Command
.
class
);
builder
.
append
(
" "
).
append
(
handler
.
description
()
==
null
?
annotation
.
description
()
:
handler
.
description
(
)).
append
(
"\n"
);
builder
.
append
(
" "
).
append
(
translate
(
annotation
.
description
())).
append
(
"\n"
);
builder
.
append
(
translate
(
"commands.help.usage"
)).
append
(
annotation
.
usage
());
builder
.
append
(
translate
(
"commands.help.usage"
)).
append
(
annotation
.
usage
());
if
(
annotation
.
aliases
().
length
>=
1
)
{
if
(
annotation
.
aliases
().
length
>=
1
)
{
builder
.
append
(
"\n"
).
append
(
translate
(
"commands.help.aliases"
));
builder
.
append
(
"\n"
).
append
(
translate
(
"commands.help.aliases"
));
...
@@ -60,12 +55,12 @@ public final class HelpCommand implements CommandHandler {
...
@@ -60,12 +55,12 @@ public final class HelpCommand implements CommandHandler {
}
}
}
}
void
SendAllHelpMessage
(
Player
player
,
HashMap
<
Command
,
CommandHandler
>
annotations
)
{
void
SendAllHelpMessage
(
Player
player
,
List
<
Command
>
annotations
)
{
if
(
player
==
null
)
{
if
(
player
==
null
)
{
StringBuilder
builder
=
new
StringBuilder
(
"\n"
+
translate
(
"commands.help.available_commands"
)
+
"\n"
);
StringBuilder
builder
=
new
StringBuilder
(
"\n"
+
translate
(
"commands.help.available_commands"
)
+
"\n"
);
annotations
.
forEach
(
(
annotation
,
handler
)
->
{
annotations
.
forEach
(
annotation
->
{
builder
.
append
(
annotation
.
label
()).
append
(
"\n"
);
builder
.
append
(
annotation
.
label
()).
append
(
"\n"
);
builder
.
append
(
" "
).
append
(
handler
.
description
()
==
null
?
annotation
.
description
()
:
handler
.
description
(
)).
append
(
"\n"
);
builder
.
append
(
" "
).
append
(
translate
(
annotation
.
description
())).
append
(
"\n"
);
builder
.
append
(
translate
(
"commands.help.usage"
)).
append
(
annotation
.
usage
());
builder
.
append
(
translate
(
"commands.help.usage"
)).
append
(
annotation
.
usage
());
if
(
annotation
.
aliases
().
length
>=
1
)
{
if
(
annotation
.
aliases
().
length
>=
1
)
{
builder
.
append
(
"\n"
).
append
(
translate
(
"commands.help.aliases"
));
builder
.
append
(
"\n"
).
append
(
translate
(
"commands.help.aliases"
));
...
@@ -80,9 +75,9 @@ public final class HelpCommand implements CommandHandler {
...
@@ -80,9 +75,9 @@ public final class HelpCommand implements CommandHandler {
CommandHandler
.
sendMessage
(
null
,
builder
.
toString
());
CommandHandler
.
sendMessage
(
null
,
builder
.
toString
());
}
else
{
}
else
{
CommandHandler
.
sendMessage
(
player
,
translate
(
"commands.help.available_commands"
));
CommandHandler
.
sendMessage
(
player
,
translate
(
"commands.help.available_commands"
));
annotations
.
forEach
(
(
annotation
,
handler
)
->
{
annotations
.
forEach
(
annotation
->
{
StringBuilder
builder
=
new
StringBuilder
(
annotation
.
label
()).
append
(
"\n"
);
StringBuilder
builder
=
new
StringBuilder
(
annotation
.
label
()).
append
(
"\n"
);
builder
.
append
(
" "
).
append
(
handler
.
description
()
==
null
?
annotation
.
description
()
:
handler
.
description
(
)).
append
(
"\n"
);
builder
.
append
(
" "
).
append
(
translate
(
annotation
.
description
())).
append
(
"\n"
);
builder
.
append
(
translate
(
"commands.help.usage"
)).
append
(
annotation
.
usage
());
builder
.
append
(
translate
(
"commands.help.usage"
)).
append
(
annotation
.
usage
());
if
(
annotation
.
aliases
().
length
>=
1
)
{
if
(
annotation
.
aliases
().
length
>=
1
)
{
builder
.
append
(
"\n"
).
append
(
translate
(
"commands.help.aliases"
));
builder
.
append
(
"\n"
).
append
(
translate
(
"commands.help.aliases"
));
...
...
src/main/java/emu/grasscutter/command/commands/KickCommand.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
=
"kick"
,
usage
=
"kick"
,
permission
=
"server.kick"
)
@Command
(
label
=
"kick"
,
usage
=
"kick"
,
permission
=
"server.kick"
,
description
=
"commands.kick.description"
)
public
final
class
KickCommand
implements
CommandHandler
{
public
final
class
KickCommand
implements
CommandHandler
{
@Override
public
String
description
()
{
return
translate
(
"commands.kick.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/KillAllCommand.java
View file @
3a5503de
...
@@ -12,14 +12,9 @@ import java.util.List;
...
@@ -12,14 +12,9 @@ import java.util.List;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
@Command
(
label
=
"killall"
,
usage
=
"killall [sceneId]"
,
permission
=
"server.killall"
)
@Command
(
label
=
"killall"
,
usage
=
"killall [sceneId]"
,
permission
=
"server.killall"
,
description
=
"commands.kill.description"
)
public
final
class
KillAllCommand
implements
CommandHandler
{
public
final
class
KillAllCommand
implements
CommandHandler
{
@Override
public
String
description
()
{
return
translate
(
"commands.kill.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/KillCharacterCommand.java
View file @
3a5503de
...
@@ -13,14 +13,9 @@ import java.util.List;
...
@@ -13,14 +13,9 @@ import java.util.List;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
import
static
emu
.
grasscutter
.
utils
.
Language
.
translate
;
@Command
(
label
=
"killcharacter"
,
usage
=
"killcharacter"
,
aliases
=
{
"suicide"
,
"kill"
},
permission
=
"player.killcharacter"
)
@Command
(
label
=
"killcharacter"
,
usage
=
"killcharacter"
,
aliases
=
{
"suicide"
,
"kill"
},
permission
=
"player.killcharacter"
,
description
=
"commands.list.description"
)
public
final
class
KillCharacterCommand
implements
CommandHandler
{
public
final
class
KillCharacterCommand
implements
CommandHandler
{
@Override
public
String
description
()
{
return
translate
(
"commands.killCharacter.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
)
{
...
...
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