Refine JavaDoc and move Log filters to 'output'

This commit is contained in:
ljacqu 2015-12-01 21:53:18 +01:00
parent 690a8d67a3
commit b0e619d412
7 changed files with 21 additions and 19 deletions

View File

@ -17,6 +17,8 @@ import fr.xephi.authme.hooks.BungeeCordMessage;
import fr.xephi.authme.hooks.EssSpawn; import fr.xephi.authme.hooks.EssSpawn;
import fr.xephi.authme.listener.*; import fr.xephi.authme.listener.*;
import fr.xephi.authme.modules.ModuleManager; import fr.xephi.authme.modules.ModuleManager;
import fr.xephi.authme.output.ConsoleFilter;
import fr.xephi.authme.output.Log4JFilter;
import fr.xephi.authme.output.MessageKey; import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.output.Messages; import fr.xephi.authme.output.Messages;
import fr.xephi.authme.permission.PermissionsManager; import fr.xephi.authme.permission.PermissionsManager;

View File

@ -1,4 +1,4 @@
package fr.xephi.authme; package fr.xephi.authme.output;
import java.util.logging.Filter; import java.util.logging.Filter;
import java.util.logging.LogRecord; import java.util.logging.LogRecord;
@ -7,20 +7,9 @@ import java.util.logging.LogRecord;
* Console filter Class * Console filter Class
* *
* @author Xephi59 * @author Xephi59
* @version $Revision: 1.0 $
*/ */
public class ConsoleFilter implements Filter { public class ConsoleFilter implements Filter {
public ConsoleFilter() {
}
/**
* Method isLoggable.
*
* @param record LogRecord
*
* @return boolean * @see java.util.logging.Filter#isLoggable(LogRecord)
*/
@Override @Override
public boolean isLoggable(LogRecord record) { public boolean isLoggable(LogRecord record) {
try { try {

View File

@ -1,4 +1,4 @@
package fr.xephi.authme; package fr.xephi.authme.output;
import fr.xephi.authme.util.StringUtils; import fr.xephi.authme.util.StringUtils;
import org.apache.logging.log4j.Level; import org.apache.logging.log4j.Level;
@ -11,7 +11,6 @@ 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 org.apache.logging.log4j.core.Filter {

View File

@ -6,6 +6,8 @@ import org.bukkit.command.CommandSender;
/** /**
* Class for retrieving and sending translatable messages to players. * Class for retrieving and sending translatable messages to players.
* This class detects when the language settings have changed and will
* automatically update to use a new language file.
*/ */
public class Messages { public class Messages {
@ -19,6 +21,11 @@ public class Messages {
this.manager = manager; this.manager = manager;
} }
/**
* Get the instance of Messages.
*
* @return The Messages instance
*/
public static Messages getInstance() { public static Messages getInstance() {
if (singleton == null) { if (singleton == null) {
MessagesManager manager = new MessagesManager(Settings.messageFile); MessagesManager manager = new MessagesManager(Settings.messageFile);
@ -65,6 +72,9 @@ public class Messages {
return StringUtils.join("\n", retrieve(key)); return StringUtils.join("\n", retrieve(key));
} }
/**
* Reload the messages manager.
*/
public void reloadManager() { public void reloadManager() {
manager = new MessagesManager(Settings.messageFile); manager = new MessagesManager(Settings.messageFile);
} }

View File

@ -6,7 +6,10 @@ import fr.xephi.authme.settings.CustomConfiguration;
import java.io.File; import java.io.File;
/** /**
* Class for retrieving and sending translatable messages to players. * Class responsible for reading messages from a file and formatting them for Minecraft.
* <p />
* This class is used within {@link Messages}, which offers a high-level interface for accessing
* or sending messages from a properties file.
*/ */
class MessagesManager extends CustomConfiguration { class MessagesManager extends CustomConfiguration {

View File

@ -1,4 +1,4 @@
package fr.xephi.authme; package fr.xephi.authme.output;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat; import static org.junit.Assert.assertThat;
@ -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 {

View File

@ -20,7 +20,8 @@ public class PlayerPermissionTest {
// when/then // when/then
for (PlayerPermission permission : PlayerPermission.values()) { for (PlayerPermission permission : PlayerPermission.values()) {
if (!permission.getNode().startsWith(requiredPrefix)) { if (!permission.getNode().startsWith(requiredPrefix)) {
fail("The permission '" + permission + "' does not start with the required prefix '" + requiredPrefix + "'"); fail("The permission '" + permission + "' does not start with the required prefix '" + requiredPrefix
+ "'");
} }
} }
} }