correct the comments and add description field for AbilityKey.

This commit is contained in:
Daydreamer-ia 2023-07-10 22:44:52 +08:00
parent 1e17db923e
commit ae148b86be
3 changed files with 20 additions and 18 deletions

View File

@ -30,29 +30,33 @@ import java.util.stream.Collectors;
**/
public enum AbilityKey {
/**.
* just for junit test
*/
TEST_1("test_1"),
TEST_1("test_1", "just for junit test"),
/**.
* just for junit test
*/
TEST_2("test_2");
TEST_2("test_2", "just for junit test");
/**.
* the name of a certain ability
*/
private final String keyName;
AbilityKey(String name) {
/**
* description or comment about this ability.
*/
private final String description;
AbilityKey(String name, String description) {
this.keyName = name;
this.description = description;
}
public String getName() {
return keyName;
}
public String getDescription() {
return description;
}
/**.
* All key set
*/

View File

@ -37,11 +37,10 @@ public class ClientAbilities extends AbstractAbilityRegistry {
* The key is from <p>AbilityKey</p>, the value is whether turn on.
*
* You can add a new public field in <p>AbilityKey</p> like:
* <code>DATA_COMPRESSION("compression", 1)</code>
* This field can be used outside, and the offset should be unique.
* <code>DATA_COMPRESSION("compression", "description about this ability")</code>
*
* And then you need to declare whether turn on in the ability table, you can:
* <code>supportedAbilities.put(AbilityKey.DATA_COMPRESSION, true);</code> means that current client support AbilityKey.DATA_COMPRESSION.
* <code>supportedAbilities.put(AbilityKey.DATA_COMPRESSION, true);</code> means that current client support compression.
*
*/
// put ability here, which you want current client supports

View File

@ -37,11 +37,10 @@ public class ServerAbilities extends AbstractAbilityRegistry {
* The key is from <p>AbilityKey</p>, the value is whether turn on.
*
* You can add a new public field in <p>AbilityKey</p> like:
* <code>DATA_COMPRESSION("compression", 1)</code>
* This field can be used outside, and the offset should be unique.
* <code>DATA_COMPRESSION("compression", "description about this ability")</code>
*
* And then you need to declare whether turn on in the ability table, you can:
* <code>supportedAbilities.put(AbilityKey.DATA_COMPRESSION, true);</code> means that current client support AbilityKey.DATA_COMPRESSION.
* <code>supportedAbilities.put(AbilityKey.DATA_COMPRESSION, true);</code> means that current client support compression.
*
*/
// put ability here, which you want current server supports