mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-12-22 16:48:21 +01:00
#989 Ensure config comments never exceed 90 chars
- Prevents horizontal scrollbar on markdown page (and in users' editors) - Add test that each property is accompanied with a comment
This commit is contained in:
parent
b7a7d5b3bd
commit
9466577993
@ -1,5 +1,5 @@
|
||||
<!-- AUTO-GENERATED FILE! Do not edit this directly -->
|
||||
<!-- File auto-generated on Sun Oct 23 18:25:12 CEST 2016. See docs/config/config.tpl.md -->
|
||||
<!-- File auto-generated on Sun Oct 23 21:08:57 CEST 2016. See docs/config/config.tpl.md -->
|
||||
|
||||
## AuthMe Configuration
|
||||
The first time you run AuthMe it will create a config.yml file in the plugins/AuthMe folder,
|
||||
@ -99,7 +99,8 @@ settings:
|
||||
# Should the session expire if the player tries to log in with
|
||||
# another IP address?
|
||||
sessionExpireOnIpChange: true
|
||||
# Message language, available: en, de, br, cz, pl, fr, ru, hu, sk, es, zhtw, fi, zhcn, lt, it, ko, pt
|
||||
# Message language, available languages:
|
||||
# https://github.com/AuthMe/AuthMeReloaded/blob/master/docs/translations.md
|
||||
messagesLanguage: 'en'
|
||||
restrictions:
|
||||
# Keeps collisions disabled for logged players
|
||||
@ -131,9 +132,9 @@ settings:
|
||||
# This setting will prevent potential security exploits.
|
||||
ForceSingleSession: true
|
||||
ForceSpawnLocOnJoin:
|
||||
# If enabled, every player that spawn in one of the world listed in "ForceSpawnLocOnJoin.worlds"
|
||||
# will be teleported to the spawnpoint after successful authentication.
|
||||
# The quit location of the player will be overwritten.
|
||||
# If enabled, every player that spawn in one of the world listed in
|
||||
# "ForceSpawnLocOnJoin.worlds" will be teleported to the spawnpoint after successful
|
||||
# authentication. The quit location of the player will be overwritten.
|
||||
# This is different from "teleportUnAuthedToSpawn" that teleport player
|
||||
# to the spawnpoint on join.
|
||||
enabled: false
|
||||
@ -202,8 +203,8 @@ settings:
|
||||
# FINE for some additional detailed ones (like password failed),
|
||||
# and DEBUG for debugging
|
||||
logLevel: 'FINE'
|
||||
# By default we schedule async tasks when talking to the database
|
||||
# If you want typical communication with the database to happen synchronously, set this to false
|
||||
# By default we schedule async tasks when talking to the database. If you want
|
||||
# typical communication with the database to happen synchronously, set this to false
|
||||
useAsyncTasks: true
|
||||
GameMode:
|
||||
# Force survival gamemode when player joins?
|
||||
@ -277,19 +278,23 @@ settings:
|
||||
forceLoginAfterRegister: false
|
||||
# Force these commands after /login, without any '/', use %p to replace with player name
|
||||
forceCommands: []
|
||||
# Force these commands after /login as service console, without any '/'. Use %p to replace with player name
|
||||
# Force these commands after /login as service console, without any '/'.
|
||||
# Use %p to replace with player name
|
||||
forceCommandsAsConsole: []
|
||||
# Force these commands after /register, without any '/', use %p to replace with player name
|
||||
forceRegisterCommands: []
|
||||
# Force these commands after /register as a server console, without any '/'. Use %p to replace with player name
|
||||
# Force these commands after /register as a server console, without any '/'.
|
||||
# Use %p to replace with player name
|
||||
forceRegisterCommandsAsConsole: []
|
||||
# Enable to display the welcome message (welcome.txt) after a login
|
||||
# You can use colors in this welcome.txt + some replaced strings:
|
||||
# {PLAYER}: player name, {ONLINE}: display number of online players, {MAXPLAYERS}: display server slots,
|
||||
# {IP}: player ip, {LOGINS}: number of players logged, {WORLD}: player current world, {SERVER}: server name
|
||||
# {PLAYER}: player name, {ONLINE}: display number of online players,
|
||||
# {MAXPLAYERS}: display server slots, {IP}: player ip, {LOGINS}: number of players logged,
|
||||
# {WORLD}: player current world, {SERVER}: server name
|
||||
# {VERSION}: get current bukkit version, {COUNTRY}: player country
|
||||
useWelcomeMessage: true
|
||||
# Do we need to broadcast the welcome message to all server or only to the player? set true for server or false for player
|
||||
# Broadcast the welcome message to the server or only to the player?
|
||||
# set true for server or false for player
|
||||
broadcastWelcomeMessage: false
|
||||
# Should we delay the join message and display it once the player has logged in?
|
||||
delayJoinMessage: false
|
||||
@ -361,7 +366,8 @@ Protection:
|
||||
enableProtection: false
|
||||
# Apply the protection also to registered usernames
|
||||
enableProtectionRegistered: true
|
||||
# Countries allowed to join the server and register, see http://dev.bukkit.org/bukkit-plugins/authme-reloaded/pages/countries-codes/ for countries' codes
|
||||
# Countries allowed to join the server and register. For country codes, see
|
||||
# http://dev.bukkit.org/bukkit-plugins/authme-reloaded/pages/countries-codes/
|
||||
# PLEASE USE QUOTES!
|
||||
countries:
|
||||
- 'US'
|
||||
@ -372,7 +378,8 @@ Protection:
|
||||
- 'A1'
|
||||
# Do we need to enable automatic antibot system?
|
||||
enableAntiBot: true
|
||||
# Max number of players allowed to login in 5 secs before the AntiBot system is enabled automatically
|
||||
# Max number of players allowed to login in 5 secs
|
||||
# before the AntiBot system is enabled automatically
|
||||
antiBotSensibility: 10
|
||||
# Duration in minutes of the antibot automatic system
|
||||
antiBotDuration: 10
|
||||
@ -381,7 +388,7 @@ Protection:
|
||||
Purge:
|
||||
# If enabled, AuthMe automatically purges old, unused accounts
|
||||
useAutoPurge: false
|
||||
# Number of Days an account become Unused
|
||||
# Number of days after which an account should be purged
|
||||
daysBeforeRemovePlayer: 60
|
||||
# Do we need to remove the player.dat file during purge process?
|
||||
removePlayerDat: false
|
||||
@ -389,7 +396,7 @@ Purge:
|
||||
removeEssentialsFile: false
|
||||
# World where are players.dat stores
|
||||
defaultWorld: 'world'
|
||||
# Do we need to remove LimitedCreative/inventories/player.yml, player_creative.yml files during purge process ?
|
||||
# Remove LimitedCreative/inventories/player.yml, player_creative.yml files during purge?
|
||||
removeLimitedCreativesInventories: false
|
||||
# Do we need to remove the AntiXRayData/PlayerData/player file during purge process?
|
||||
removeAntiXRayFile: false
|
||||
@ -448,4 +455,4 @@ To change settings on a running server, save your changes to config.yml and use
|
||||
|
||||
---
|
||||
|
||||
This page was automatically generated on the [AuthMe/AuthMeReloaded repository](https://github.com/AuthMe/AuthMeReloaded/tree/master/docs/) on Sun Oct 23 18:25:12 CEST 2016
|
||||
This page was automatically generated on the [AuthMe/AuthMeReloaded repository](https://github.com/AuthMe/AuthMeReloaded/tree/master/docs/) on Sun Oct 23 21:08:57 CEST 2016
|
||||
|
@ -36,7 +36,10 @@ public class PluginSettings implements SettingsHolder {
|
||||
public static final Property<Boolean> SESSIONS_EXPIRE_ON_IP_CHANGE =
|
||||
newProperty("settings.sessions.sessionExpireOnIpChange", true);
|
||||
|
||||
@Comment("Message language, available: en, de, br, cz, pl, fr, ru, hu, sk, es, zhtw, fi, zhcn, lt, it, ko, pt")
|
||||
@Comment({
|
||||
"Message language, available languages:",
|
||||
"https://github.com/AuthMe/AuthMeReloaded/blob/master/docs/translations.md"
|
||||
})
|
||||
public static final Property<String> MESSAGES_LANGUAGE =
|
||||
newProperty("settings.messagesLanguage", "en");
|
||||
|
||||
@ -65,8 +68,8 @@ public class PluginSettings implements SettingsHolder {
|
||||
newProperty(LogLevel.class, "settings.logLevel", LogLevel.FINE);
|
||||
|
||||
@Comment({
|
||||
"By default we schedule async tasks when talking to the database",
|
||||
"If you want typical communication with the database to happen synchronously, set this to false"
|
||||
"By default we schedule async tasks when talking to the database. If you want",
|
||||
"typical communication with the database to happen synchronously, set this to false"
|
||||
})
|
||||
public static final Property<Boolean> USE_ASYNC_TASKS =
|
||||
newProperty("settings.useAsyncTasks", true);
|
||||
|
@ -20,12 +20,15 @@ public class ProtectionSettings implements SettingsHolder {
|
||||
public static final Property<Boolean> ENABLE_PROTECTION_REGISTERED =
|
||||
newProperty("Protection.enableProtectionRegistered", true);
|
||||
|
||||
@Comment({"Countries allowed to join the server and register, see http://dev.bukkit.org/bukkit-plugins/authme-reloaded/pages/countries-codes/ for countries' codes",
|
||||
@Comment({
|
||||
"Countries allowed to join the server and register. For country codes, see",
|
||||
"http://dev.bukkit.org/bukkit-plugins/authme-reloaded/pages/countries-codes/",
|
||||
"PLEASE USE QUOTES!"})
|
||||
public static final Property<List<String>> COUNTRIES_WHITELIST =
|
||||
newListProperty("Protection.countries", "US", "GB");
|
||||
|
||||
@Comment({"Countries not allowed to join the server and register",
|
||||
@Comment({
|
||||
"Countries not allowed to join the server and register",
|
||||
"PLEASE USE QUOTES!"})
|
||||
public static final Property<List<String>> COUNTRIES_BLACKLIST =
|
||||
newListProperty("Protection.countriesBlacklist", "A1");
|
||||
@ -34,7 +37,9 @@ public class ProtectionSettings implements SettingsHolder {
|
||||
public static final Property<Boolean> ENABLE_ANTIBOT =
|
||||
newProperty("Protection.enableAntiBot", true);
|
||||
|
||||
@Comment("Max number of players allowed to login in 5 secs before the AntiBot system is enabled automatically")
|
||||
@Comment({
|
||||
"Max number of players allowed to login in 5 secs",
|
||||
"before the AntiBot system is enabled automatically"})
|
||||
public static final Property<Integer> ANTIBOT_SENSIBILITY =
|
||||
newProperty("Protection.antiBotSensibility", 10);
|
||||
|
||||
|
@ -12,7 +12,7 @@ public class PurgeSettings implements SettingsHolder {
|
||||
public static final Property<Boolean> USE_AUTO_PURGE =
|
||||
newProperty("Purge.useAutoPurge", false);
|
||||
|
||||
@Comment("Number of Days an account become Unused")
|
||||
@Comment("Number of days after which an account should be purged")
|
||||
public static final Property<Integer> DAYS_BEFORE_REMOVE_PLAYER =
|
||||
newProperty("Purge.daysBeforeRemovePlayer", 60);
|
||||
|
||||
@ -28,7 +28,7 @@ public class PurgeSettings implements SettingsHolder {
|
||||
public static final Property<String> DEFAULT_WORLD =
|
||||
newProperty("Purge.defaultWorld", "world");
|
||||
|
||||
@Comment("Do we need to remove LimitedCreative/inventories/player.yml, player_creative.yml files during purge process ?")
|
||||
@Comment("Remove LimitedCreative/inventories/player.yml, player_creative.yml files during purge?")
|
||||
public static final Property<Boolean> REMOVE_LIMITED_CREATIVE_INVENTORIES =
|
||||
newProperty("Purge.removeLimitedCreativesInventories", false);
|
||||
|
||||
|
@ -52,8 +52,9 @@ public class RegistrationSettings implements SettingsHolder {
|
||||
public static final Property<List<String>> FORCE_COMMANDS =
|
||||
newListProperty("settings.forceCommands");
|
||||
|
||||
@Comment("Force these commands after /login as service console, without any '/'. "
|
||||
+ "Use %p to replace with player name")
|
||||
@Comment({
|
||||
"Force these commands after /login as service console, without any '/'.",
|
||||
"Use %p to replace with player name"})
|
||||
public static final Property<List<String>> FORCE_COMMANDS_AS_CONSOLE =
|
||||
newListProperty("settings.forceCommandsAsConsole");
|
||||
|
||||
@ -61,22 +62,25 @@ public class RegistrationSettings implements SettingsHolder {
|
||||
public static final Property<List<String>> FORCE_REGISTER_COMMANDS =
|
||||
newListProperty("settings.forceRegisterCommands");
|
||||
|
||||
@Comment("Force these commands after /register as a server console, without any '/'. "
|
||||
+ "Use %p to replace with player name")
|
||||
@Comment({
|
||||
"Force these commands after /register as a server console, without any '/'.",
|
||||
"Use %p to replace with player name"})
|
||||
public static final Property<List<String>> FORCE_REGISTER_COMMANDS_AS_CONSOLE =
|
||||
newListProperty("settings.forceRegisterCommandsAsConsole");
|
||||
|
||||
@Comment({
|
||||
"Enable to display the welcome message (welcome.txt) after a login",
|
||||
"You can use colors in this welcome.txt + some replaced strings:",
|
||||
"{PLAYER}: player name, {ONLINE}: display number of online players, {MAXPLAYERS}: display server slots,",
|
||||
"{IP}: player ip, {LOGINS}: number of players logged, {WORLD}: player current world, {SERVER}: server name",
|
||||
"{PLAYER}: player name, {ONLINE}: display number of online players,",
|
||||
"{MAXPLAYERS}: display server slots, {IP}: player ip, {LOGINS}: number of players logged,",
|
||||
"{WORLD}: player current world, {SERVER}: server name",
|
||||
"{VERSION}: get current bukkit version, {COUNTRY}: player country"})
|
||||
public static final Property<Boolean> USE_WELCOME_MESSAGE =
|
||||
newProperty("settings.useWelcomeMessage", true);
|
||||
|
||||
@Comment("Do we need to broadcast the welcome message to all server or only to the player? set true for "
|
||||
+ "server or false for player")
|
||||
@Comment({
|
||||
"Broadcast the welcome message to the server or only to the player?",
|
||||
"set true for server or false for player"})
|
||||
public static final Property<Boolean> BROADCAST_WELCOME_MESSAGE =
|
||||
newProperty("settings.broadcastWelcomeMessage", false);
|
||||
|
||||
|
@ -50,9 +50,9 @@ public class RestrictionSettings implements SettingsHolder {
|
||||
newProperty("settings.restrictions.ForceSingleSession", true);
|
||||
|
||||
@Comment({
|
||||
"If enabled, every player that spawn in one of the world listed in \"ForceSpawnLocOnJoin.worlds\"",
|
||||
"will be teleported to the spawnpoint after successful authentication.",
|
||||
"The quit location of the player will be overwritten.",
|
||||
"If enabled, every player that spawn in one of the world listed in",
|
||||
"\"ForceSpawnLocOnJoin.worlds\" will be teleported to the spawnpoint after successful",
|
||||
"authentication. The quit location of the player will be overwritten.",
|
||||
"This is different from \"teleportUnAuthedToSpawn\" that teleport player",
|
||||
"to the spawnpoint on join."})
|
||||
public static final Property<Boolean> FORCE_SPAWN_LOCATION_AFTER_LOGIN =
|
||||
|
@ -0,0 +1,69 @@
|
||||
package fr.xephi.authme.settings;
|
||||
|
||||
import com.github.authme.configme.knownproperties.ConfigurationData;
|
||||
import com.github.authme.configme.properties.Property;
|
||||
import fr.xephi.authme.settings.properties.AuthMeSettingsRetriever;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
/**
|
||||
* Tests the consistency of the settings configuration.
|
||||
*/
|
||||
public class SettingsConsistencyTest {
|
||||
|
||||
/**
|
||||
* Maximum characters one comment line may have (prevents horizontal scrolling).
|
||||
*/
|
||||
private static final int MAX_COMMENT_LENGTH = 90;
|
||||
|
||||
private static ConfigurationData configurationData;
|
||||
|
||||
@BeforeClass
|
||||
public static void buildConfigurationData() {
|
||||
configurationData = AuthMeSettingsRetriever.buildConfigurationData();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldHaveCommentOnEachProperty() {
|
||||
// given
|
||||
List<Property<?>> properties = configurationData.getProperties();
|
||||
|
||||
// when / then
|
||||
for (Property<?> property : properties) {
|
||||
if (configurationData.getCommentsForSection(property.getPath()).length == 0) {
|
||||
fail("No comment defined for '" + property + "'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldNotHaveVeryLongCommentLines() {
|
||||
// given
|
||||
List<Property<?>> properties = configurationData.getProperties();
|
||||
List<Property<?>> badProperties = new ArrayList<>();
|
||||
|
||||
// when
|
||||
for (Property<?> property : properties) {
|
||||
for (String comment : configurationData.getCommentsForSection(property.getPath())) {
|
||||
if (comment.length() > MAX_COMMENT_LENGTH) {
|
||||
badProperties.add(property);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// then
|
||||
if (!badProperties.isEmpty()) {
|
||||
fail("Comment lines should not be longer than " + MAX_COMMENT_LENGTH + " chars, "
|
||||
+ "but found too long comments for:\n- "
|
||||
+ badProperties.stream().map(Property::getPath).collect(Collectors.joining("\n- ")));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user