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 org.apache.logging.log4j.Level;
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.Logger;
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.
*
* @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.
@ -30,8 +30,7 @@ public class Log4JFilter implements org.apache.logging.log4j.core.Filter {
/**
* Validates a Message instance and returns the {@link Result} value
* depending depending on whether the message contains sensitive AuthMe
* data.
* depending on whether the message contains sensitive AuthMe data.
*
* @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
* depending on whether the message contains sensitive AuthMe data.
* on whether the message contains sensitive AuthMe data.
*
* @param message the message to verify
*
@ -74,14 +73,12 @@ public class Log4JFilter implements org.apache.logging.log4j.core.Filter {
}
@Override
public Result filter(Logger arg0, Level arg1, Marker arg2, String message,
Object... arg4) {
public Result filter(Logger arg0, Level arg1, Marker arg2, String message, Object... arg4) {
return validateMessage(message);
}
@Override
public Result filter(Logger arg0, Level arg1, Marker arg2, Object message,
Throwable arg4) {
public Result filter(Logger arg0, Level arg1, Marker arg2, Object message, Throwable arg4) {
if (message == null) {
return Result.NEUTRAL;
}
@ -89,8 +86,7 @@ public class Log4JFilter implements org.apache.logging.log4j.core.Filter {
}
@Override
public Result filter(Logger arg0, Level arg1, Marker arg2, Message message,
Throwable arg4) {
public Result filter(Logger arg0, Level arg1, Marker arg2, Message message, Throwable arg4) {
return validateMessage(message);
}

View File

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

View File

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