Add changes missed during merge

This commit is contained in:
ljacqu 2015-12-01 20:44:44 +01:00
parent c4df2589b7
commit 54d8ede5bc
3 changed files with 15 additions and 29 deletions

View File

@ -3,6 +3,7 @@ package fr.xephi.authme;
import fr.xephi.authme.util.StringUtils; import fr.xephi.authme.util.StringUtils;
import org.apache.logging.log4j.Level; import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.Marker; import org.apache.logging.log4j.Marker;
import org.apache.logging.log4j.core.Filter;
import org.apache.logging.log4j.core.LogEvent; import org.apache.logging.log4j.core.LogEvent;
import org.apache.logging.log4j.core.Logger; import org.apache.logging.log4j.core.Logger;
import org.apache.logging.log4j.message.Message; import org.apache.logging.log4j.message.Message;
@ -11,9 +12,8 @@ import org.apache.logging.log4j.message.Message;
* Implements a filter for Log4j to skip sensitive AuthMe commands. * Implements a filter for Log4j to skip sensitive AuthMe commands.
* *
* @author Xephi59 * @author Xephi59
* @version $Revision: 1.0 $
*/ */
public class Log4JFilter implements org.apache.logging.log4j.core.Filter { public class Log4JFilter implements Filter {
/** /**
* List of commands (lower-case) to skip. * List of commands (lower-case) to skip.
@ -30,8 +30,7 @@ public class Log4JFilter implements org.apache.logging.log4j.core.Filter {
/** /**
* Validates a Message instance and returns the {@link Result} value * Validates a Message instance and returns the {@link Result} value
* depending depending on whether the message contains sensitive AuthMe * depending on whether the message contains sensitive AuthMe data.
* data.
* *
* @param message the Message object to verify * @param message the Message object to verify
* *
@ -46,7 +45,7 @@ public class Log4JFilter implements org.apache.logging.log4j.core.Filter {
/** /**
* Validates a message and returns the {@link Result} value depending * Validates a message and returns the {@link Result} value depending
* depending on whether the message contains sensitive AuthMe data. * on whether the message contains sensitive AuthMe data.
* *
* @param message the message to verify * @param message the message to verify
* *
@ -74,14 +73,12 @@ public class Log4JFilter implements org.apache.logging.log4j.core.Filter {
} }
@Override @Override
public Result filter(Logger arg0, Level arg1, Marker arg2, String message, public Result filter(Logger arg0, Level arg1, Marker arg2, String message, Object... arg4) {
Object... arg4) {
return validateMessage(message); return validateMessage(message);
} }
@Override @Override
public Result filter(Logger arg0, Level arg1, Marker arg2, Object message, public Result filter(Logger arg0, Level arg1, Marker arg2, Object message, Throwable arg4) {
Throwable arg4) {
if (message == null) { if (message == null) {
return Result.NEUTRAL; return Result.NEUTRAL;
} }
@ -89,8 +86,7 @@ public class Log4JFilter implements org.apache.logging.log4j.core.Filter {
} }
@Override @Override
public Result filter(Logger arg0, Level arg1, Marker arg2, Message message, public Result filter(Logger arg0, Level arg1, Marker arg2, Message message, Throwable arg4) {
Throwable arg4) {
return validateMessage(message); return validateMessage(message);
} }

View File

@ -87,11 +87,9 @@ public final class CommandInitializer {
.labels("register", "reg", "r") .labels("register", "reg", "r")
.description("Register a player") .description("Register a player")
.detailedDescription("Register the specified player with the specified password.") .detailedDescription("Register the specified player with the specified password.")
.parent(authMeBaseCommand)
.permissions(OP_ONLY, PlayerPermission.REGISTER)
.withArgument("player", "Player name", false) .withArgument("player", "Player name", false)
.withArgument("password", "Password", false) .withArgument("password", "Password", false)
.permissions(OP_ONLY, UserPermission.REGISTER) .permissions(OP_ONLY, PlayerPermission.REGISTER)
.executableCommand(new RegisterCommand()) .executableCommand(new RegisterCommand())
.build(); .build();
@ -101,10 +99,8 @@ public final class CommandInitializer {
.labels("unregister", "unreg", "unr") .labels("unregister", "unreg", "unr")
.description("Unregister a player") .description("Unregister a player")
.detailedDescription("Unregister the specified player.") .detailedDescription("Unregister the specified player.")
.parent(authMeBaseCommand)
.permissions(OP_ONLY, PlayerPermission.UNREGISTER)
.withArgument("player", "Player name", false) .withArgument("player", "Player name", false)
.permissions(OP_ONLY, UserPermission.UNREGISTER) .permissions(OP_ONLY, PlayerPermission.UNREGISTER)
.executableCommand(new UnregisterCommand()) .executableCommand(new UnregisterCommand())
.build(); .build();
@ -114,10 +110,8 @@ public final class CommandInitializer {
.labels("forcelogin", "login") .labels("forcelogin", "login")
.description("Enforce login player") .description("Enforce login player")
.detailedDescription("Enforce the specified player to login.") .detailedDescription("Enforce the specified player to login.")
.parent(authMeBaseCommand)
.permissions(OP_ONLY, PlayerPermission.CAN_LOGIN_BE_FORCED)
.withArgument("player", "Online player name", true) .withArgument("player", "Online player name", true)
.permissions(OP_ONLY, UserPermission.CAN_LOGIN_BE_FORCED) .permissions(OP_ONLY, PlayerPermission.CAN_LOGIN_BE_FORCED)
.executableCommand(new ForceLoginCommand()) .executableCommand(new ForceLoginCommand())
.build(); .build();
@ -127,11 +121,9 @@ public final class CommandInitializer {
.labels("password", "changepassword", "changepass", "cp") .labels("password", "changepassword", "changepass", "cp")
.description("Change a player's password") .description("Change a player's password")
.detailedDescription("Change the password of a player.") .detailedDescription("Change the password of a player.")
.parent(authMeBaseCommand)
.permissions(OP_ONLY, PlayerPermission.CHANGE_PASSWORD)
.withArgument("player", "Player name", false) .withArgument("player", "Player name", false)
.withArgument("pwd", "New password", false) .withArgument("pwd", "New password", false)
.permissions(OP_ONLY, UserPermission.CHANGE_PASSWORD) .permissions(OP_ONLY, PlayerPermission.CHANGE_PASSWORD)
.executableCommand(new ChangePasswordCommand()) .executableCommand(new ChangePasswordCommand())
.build(); .build();
@ -158,23 +150,23 @@ public final class CommandInitializer {
.build(); .build();
// Register the getemail command // Register the getemail command
CommandDescription getEmailCommand = CommandDescription.builder() CommandDescription.builder()
.executableCommand(new GetEmailCommand()) .parent(AUTHME_BASE)
.labels("getemail", "getmail", "email", "mail") .labels("getemail", "getmail", "email", "mail")
.description("Display player's email") .description("Display player's email")
.detailedDescription("Display the email address of the specified player if set.") .detailedDescription("Display the email address of the specified player if set.")
.parent(authMeBaseCommand)
.permissions(OP_ONLY, AdminPermission.GET_EMAIL) .permissions(OP_ONLY, AdminPermission.GET_EMAIL)
.withArgument("player", "Player name", true) .withArgument("player", "Player name", true)
.executableCommand(new GetEmailCommand())
.build(); .build();
// Register the setemail command // Register the setemail command
CommandDescription setEmailCommand = CommandDescription.builder() CommandDescription setEmailCommand = CommandDescription.builder()
.executableCommand(new SetEmailCommand()) .executableCommand(new SetEmailCommand())
.parent(AUTHME_BASE)
.labels("chgemail", "chgmail", "setemail", "setmail") .labels("chgemail", "chgmail", "setemail", "setmail")
.description("Change player's email") .description("Change player's email")
.detailedDescription("Change the email address of the specified player.") .detailedDescription("Change the email address of the specified player.")
.parent(authMeBaseCommand)
.permissions(OP_ONLY, AdminPermission.CHANGE_EMAIL) .permissions(OP_ONLY, AdminPermission.CHANGE_EMAIL)
.withArgument("player", "Player name", false) .withArgument("player", "Player name", false)
.withArgument("email", "Player email", false) .withArgument("email", "Player email", false)

View File

@ -12,8 +12,6 @@ import org.mockito.Mockito;
/** /**
* Test for {@link Log4JFilter}. * Test for {@link Log4JFilter}.
* @author Gabriele
* @version $Revision: 1.0 $
*/ */
public class Log4JFilterTest { public class Log4JFilterTest {