Merge branch 'master' of https://github.com/AuthMe-Team/AuthMeReloaded into 358-encryptn-mthd-refactor

This commit is contained in:
ljacqu
2015-12-29 10:54:09 +01:00
5 changed files with 45828 additions and 7 deletions
@@ -222,7 +222,7 @@ public class AuthMePlayerListener implements Listener {
@EventHandler(priority = EventPriority.HIGHEST)
public void onPreLogin(AsyncPlayerPreLoginEvent event) {
PlayerAuth auth = plugin.database.getAuth(event.getName());
if (auth != null && !auth.getRealName().equals("Player") && !auth.getRealName().equals(event.getName())) {
if (auth != null && auth.getRealName() != null && !auth.getRealName().isEmpty() && !auth.getRealName().equals("Player") && !auth.getRealName().equals(event.getName())) {
event.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_OTHER);
event.setKickMessage("You should join using username: " + ChatColor.AQUA + auth.getRealName() +
ChatColor.RESET + "\nnot: " + ChatColor.RED + event.getName()); // TODO: write a better message
@@ -24,7 +24,6 @@ public final class ListenerConsistencyTest {
AuthMePlayerListener.class, AuthMePlayerListener16.class, AuthMePlayerListener18.class,
AuthMeServerListener.class };
// TODO #368: Ensure that these exceptions are really intentional, if not fix them and remove them here
private static final Set<String> CANCELED_EXCEPTIONS = Sets.newHashSet("AuthMePlayerListener#onPlayerJoin",
"AuthMePlayerListener#onPreLogin", "AuthMePlayerListener#onPlayerLogin",
"AuthMePlayerListener#onPlayerQuit", "AuthMeServerListener#onPluginDisable",
@@ -57,7 +56,7 @@ public final class ListenerConsistencyTest {
Set<String> events = new HashSet<>();
for (Class<?> listener : LISTENERS) {
for (Method method : listener.getDeclaredMethods()) {
if (events.contains(method.getName())) {
if (isTestableMethod(method) && events.contains(method.getName())) {
fail("More than one method '" + method.getName() + "' exists (e.g. class: " + listener + ")");
}
events.add(method.getName());
@@ -103,9 +102,10 @@ public final class ListenerConsistencyTest {
}
private static boolean isTestableMethod(Method method) {
// A method like "access$000" is created by the compiler when a private member is being accessed by an inner
// class, so we need to ignore such methods
return !Modifier.isPrivate(method.getModifiers()) && !method.getName().startsWith("access$");
// Exclude any methods with "$" in it: jacoco creates a "$jacocoInit" method we want to ignore, and
// methods like "access$000" are created by the compiler when a private member is being accessed by an inner
// class, which is not of interest for us
return !Modifier.isPrivate(method.getModifiers()) && !method.getName().contains("$");
}
}