Add an option to allow unlogged users to run all the commands

Fix #456
This commit is contained in:
Gabriele C 2016-02-04 15:03:52 +01:00
parent 15ca8284f4
commit 4c265f1879
3 changed files with 12 additions and 1 deletions

View File

@ -108,6 +108,9 @@ public class AuthMePlayerListener implements Listener {
if (Settings.useEssentialsMotd && cmd.equals("/motd")) {
return;
}
if(!Settings.isForcedRegistrationEnabled && Settings.allowAllCommandsIfRegIsOptional) {
return;
}
if (Settings.allowCommands.contains(cmd)) {
return;
}

View File

@ -77,7 +77,7 @@ public final class Settings {
enableProtection, enableAntiBot, recallEmail, useWelcomeMessage,
broadcastWelcomeMessage, forceRegKick, forceRegLogin,
checkVeryGames, delayJoinLeaveMessages, noTeleport, applyBlindEffect,
kickPlayersBeforeStopping,
kickPlayersBeforeStopping, allowAllCommandsIfRegIsOptional,
customAttributes, generateImage, isRemoveSpeedEnabled, preventOtherCase;
public static String helpHeader, getNickRegex, getUnloggedinGroup, getMySQLHost,
getMySQLPort, getMySQLUsername, getMySQLPassword, getMySQLDatabase,
@ -211,6 +211,7 @@ public final class Settings {
isStopEnabled = configFile.getBoolean("Security.SQLProblem.stopServer", true);
reloadSupport = configFile.getBoolean("Security.ReloadCommand.useReloadCommandSupport", true);
allowAllCommandsIfRegIsOptional = configFile.getBoolean("settings.restrictions.allowAllCommandsIfRegistrationIsOptional", false);
allowCommands = new ArrayList<>();
allowCommands.addAll(Arrays.asList("/login", "/l", "/register", "/reg", "/email", "/captcha"));
for (String cmd : configFile.getStringList("settings.restrictions.allowCommands")) {
@ -576,6 +577,10 @@ public final class Settings {
set("settings.restrictions.enablePasswordVerifier", null);
changes = true;
}
if(!contains("settings.restrictions.allowAllCommandsIfRegistrationIsOptional")) {
set("settings.restrictions.allowAllCommandsIfRegistrationIsOptional", false);
changes = true;
}
if (!contains("settings.security.unsafePasswords")) {
List<String> str = new ArrayList<>();
str.add("123456");

View File

@ -67,6 +67,9 @@ settings:
# Care that this feature blocks also all the commands not
# listed in the list below.
allowChat: false
# WARNING: use this only if you need it!
# Allow unlogged users to use all the commands if registration is not forced!
allowAllCommandsIfRegistrationIsOptional: false
# Commands allowed when a player is not authenticated
allowCommands:
- /login