Merge branch 'master' into task-sync-hotfix

This commit is contained in:
Gabriele C 2019-11-18 21:54:48 +01:00
commit 69cd899e2e
88 changed files with 353 additions and 484 deletions

View File

@ -14,6 +14,4 @@ jobs:
with:
java-version: 1.8
- name: Build with Maven
run: mvn clean package --file pom.xml
- name: Tests with Maven
run: mvn test --file pom.xml
run: mvn -B clean package --file pom.xml

View File

@ -1,9 +1,9 @@
<!-- AUTO-GENERATED FILE! Do not edit this directly -->
<!-- File auto-generated on Tue Apr 23 17:17:02 CEST 2019. See docs/config/config.tpl.md -->
<!-- File auto-generated on Thu Oct 17 08:29:25 CEST 2019. See docs/config/config.tpl.md -->
## AuthMe Configuration
The first time you run AuthMe it will create a config.yml file in the plugins/AuthMe folder,
with which you can configure various settings. This following is the initial contents of
with which you can configure various settings. The following is the initial contents of
the generated config.yml file.
```yml
@ -70,6 +70,8 @@ DataSource:
mySQLlastlocYaw: yaw
# Column for storing player LastLocation - Pitch
mySQLlastlocPitch: pitch
# Column for storing players uuids (optional)
mySQLPlayerUUID: ''
# Overrides the size of the DB Connection Pool, default = 10
poolSize: 10
# The maximum lifetime of a connection in the pool, default = 1800 seconds
@ -124,10 +126,6 @@ settings:
# By default we schedule async tasks when talking to the database. If you want
# typical communication with the database to happen synchronously, set this to false
useAsyncTasks: true
# By default we handle the AsyncPlayerPreLoginEvent which makes the plugin faster
# but it is incompatible with any permission plugin not included in our compatibility list.
# If you have issues with permission checks on player join please disable this option.
useAsyncPreLoginEvent: true
# The name of the server, used in some placeholders.
serverName: Your Minecraft Server
restrictions:
@ -327,7 +325,7 @@ settings:
removeJoinMessage: false
# Should we remove leave messages altogether?
removeLeaveMessage: false
# Do we need to add potion effect Blinding before login/reigster?
# Do we need to add potion effect Blinding before login/register?
applyBlindEffect: false
# Do we need to prevent people to login with another case?
# If Xephi is registered, then Xephi can login, but not XEPHI/xephi/XePhI
@ -578,4 +576,4 @@ To change settings on a running server, save your changes to config.yml and use
---
This page was automatically generated on the [AuthMe/AuthMeReloaded repository](https://github.com/AuthMe/AuthMeReloaded/tree/master/docs/) on Tue Apr 23 17:17:02 CEST 2019
This page was automatically generated on the [AuthMe/AuthMeReloaded repository](https://github.com/AuthMe/AuthMeReloaded/tree/master/docs/) on Thu Oct 17 08:29:25 CEST 2019

16
pom.xml
View File

@ -205,7 +205,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.4</version>
<version>0.8.5</version>
<executions>
<execution>
<id>pre-unit-test</id>
@ -241,7 +241,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.2</version>
<version>3.2.0</version>
</plugin>
<!-- Generate a jar containing the source javadoc -->
<plugin>
@ -265,7 +265,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.1.0</version>
<version>3.2.0</version>
<configuration>
<finalName>${project.finalNameBase}</finalName>
</configuration>
@ -583,7 +583,7 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.28</version>
<version>1.7.29</version>
<optional>true</optional>
</dependency>
@ -607,7 +607,7 @@
<dependency>
<groupId>com.warrenstrange</groupId>
<artifactId>googleauth</artifactId>
<version>1.2.0</version>
<version>1.4.0</version>
<optional>true</optional>
</dependency>
@ -856,7 +856,7 @@
<dependency>
<groupId>at.favre.lib</groupId>
<artifactId>bcrypt</artifactId>
<version>0.8.0</version>
<version>0.9.0</version>
<optional>true</optional>
</dependency>
@ -914,7 +914,7 @@
<dependency>
<groupId>org.checkerframework</groupId>
<artifactId>checker-qual</artifactId>
<version>2.11.1</version>
<version>3.0.0</version>
<scope>test</scope>
</dependency>
@ -928,7 +928,7 @@
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.199</version>
<version>1.4.200</version>
<scope>test</scope>
</dependency>

View File

@ -316,12 +316,12 @@ settings:
# When this setting is enabled, online players can't be kicked out
# due to "Logged in from another Location"
# This setting will prevent potetial security exploits.
# This setting will prevent potential security exploits.
ForceSingleSession: true
# To activate the restricted user feature you need
# to enable this option and configure the
# AllowedRestrctedUser field.
# AllowedRestrictedUser field.
AllowRestrictedUser: false
# The restricted user feature will kick players listed below
# if they dont match of the defined ip address.

View File

@ -13,6 +13,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
/**
* AuthMe player data.
*/
@SuppressWarnings("checkstyle:FinalClass") // Justification: class is mocked in multiple tests
public class PlayerAuth {
/** Default email used in the database if the email column is defined to be NOT NULL. */

View File

@ -170,6 +170,7 @@ public class MySQL extends AbstractSqlDataSource {
/**
* Creates the table or any of its required columns if they don't exist.
*/
@SuppressWarnings({"checkstyle:CyclomaticComplexity", "checkstyle:JavaNCSS"})
private void checkTablesAndColumns() throws SQLException {
try (Connection con = getConnection(); Statement st = con.createStatement()) {
// Create table with ID column if it doesn't exist

View File

@ -98,6 +98,7 @@ public class SQLite extends AbstractSqlDataSource {
* @throws SQLException when an SQL error occurs while initializing the database
*/
@VisibleForTesting
@SuppressWarnings("checkstyle:CyclomaticComplexity")
protected void setup() throws SQLException {
try (Statement st = con.createStatement()) {
// Note: cannot add unique fields later on in SQLite, so we add it on initialization

View File

@ -30,73 +30,55 @@ class WordpressExtension extends MySqlExtension {
}
}
/**
* Saves the required data to Wordpress tables.
*
* @param auth the player data
* @param id the player id
* @param con the sql connection
* @throws SQLException .
*/
private void saveSpecifics(PlayerAuth auth, int id, Connection con) throws SQLException {
String sql = "INSERT INTO " + wordpressPrefix + "usermeta (user_id, meta_key, meta_value) VALUES (?,?,?)";
try (PreparedStatement pst = con.prepareStatement(sql)) {
// First Name
pst.setInt(1, id);
pst.setString(2, "first_name");
pst.setString(3, "");
pst.addBatch();
// Last Name
pst.setInt(1, id);
pst.setString(2, "last_name");
pst.setString(3, "");
pst.addBatch();
// Nick Name
pst.setInt(1, id);
pst.setString(2, "nickname");
pst.setString(3, auth.getNickname());
pst.addBatch();
// Description
pst.setInt(1, id);
pst.setString(2, "description");
pst.setString(3, "");
pst.addBatch();
// Rich_Editing
pst.setInt(1, id);
pst.setString(2, "rich_editing");
pst.setString(3, "true");
pst.addBatch();
// Comments_Shortcuts
pst.setInt(1, id);
pst.setString(2, "comment_shortcuts");
pst.setString(3, "false");
pst.addBatch();
// admin_color
pst.setInt(1, id);
pst.setString(2, "admin_color");
pst.setString(3, "fresh");
pst.addBatch();
// use_ssl
pst.setInt(1, id);
pst.setString(2, "use_ssl");
pst.setString(3, "0");
pst.addBatch();
// show_admin_bar_front
pst.setInt(1, id);
pst.setString(2, "show_admin_bar_front");
pst.setString(3, "true");
pst.addBatch();
// wp_capabilities
pst.setInt(1, id);
pst.setString(2, wordpressPrefix + "capabilities");
pst.setString(3, "a:1:{s:10:\"subscriber\";b:1;}");
pst.addBatch();
// wp_user_level
pst.setInt(1, id);
pst.setString(2, wordpressPrefix + "user_level");
pst.setString(3, "0");
pst.addBatch();
// default_password_nag
pst.setInt(1, id);
pst.setString(2, "default_password_nag");
pst.setString(3, "");
pst.addBatch();
new UserMetaBatchAdder(pst, id)
.addMetaRow("first_name", "")
.addMetaRow("last_name", "")
.addMetaRow("nickname", auth.getNickname())
.addMetaRow("description", "")
.addMetaRow("rich_editing", "true")
.addMetaRow("comment_shortcuts", "false")
.addMetaRow("admin_color", "fresh")
.addMetaRow("use_ssl", "0")
.addMetaRow("show_admin_bar_front", "true")
.addMetaRow(wordpressPrefix + "capabilities", "a:1:{s:10:\"subscriber\";b:1;}")
.addMetaRow(wordpressPrefix + "user_level", "0")
.addMetaRow("default_password_nag", "");
// Execute queries
pst.executeBatch();
pst.clearBatch();
}
}
/** Helper to add batch entries to the wrapped prepared statement. */
private static final class UserMetaBatchAdder {
private final PreparedStatement pst;
private final int userId;
UserMetaBatchAdder(PreparedStatement pst, int userId) {
this.pst = pst;
this.userId = userId;
}
UserMetaBatchAdder addMetaRow(String metaKey, String metaValue) throws SQLException {
pst.setInt(1, userId);
pst.setString(2, metaKey);
pst.setString(3, metaValue);
pst.addBatch();
return this;
}
}
}

View File

@ -69,6 +69,11 @@ class InventoryPacketAdapter extends PacketAdapter {
}
}
/**
* Registers itself to ProtocolLib and blanks out the inventory packet to any applicable players.
*
* @param bukkitService the bukkit service (for retrieval of online players)
*/
public void register(BukkitService bukkitService) {
ProtocolLibrary.getProtocolManager().addPacketListener(this);
@ -85,6 +90,11 @@ class InventoryPacketAdapter extends PacketAdapter {
ProtocolLibrary.getProtocolManager().removePacketListener(this);
}
/**
* Sends a blanked out packet to the given player in order to hide the inventory.
*
* @param player the player to send the blank inventory packet to
*/
public void sendBlankInventoryPacket(Player player) {
ProtocolManager protocolManager = ProtocolLibrary.getProtocolManager();
PacketContainer inventoryPacket = protocolManager.createPacket(PacketType.Play.Server.WINDOW_ITEMS);

View File

@ -30,8 +30,8 @@ public class BungeeReceiver implements PluginMessageListener, SettingsDependent
private boolean isEnabled;
@Inject
BungeeReceiver(final AuthMe plugin, final BukkitService bukkitService, final Management management,
final DataSource dataSource, final Settings settings) {
BungeeReceiver(AuthMe plugin, BukkitService bukkitService, Management management,
DataSource dataSource, Settings settings) {
this.plugin = plugin;
this.bukkitService = bukkitService;
this.management = management;
@ -51,6 +51,11 @@ public class BungeeReceiver implements PluginMessageListener, SettingsDependent
}
}
/**
* Processes the given data input and attempts to translate it to a message for the "AuthMe.v2.Broadcast" channel.
*
* @param in the input to handle
*/
private void handleBroadcast(final ByteArrayDataInput in) {
// Read data byte array
final short dataLength = in.readShort();
@ -91,7 +96,12 @@ public class BungeeReceiver implements PluginMessageListener, SettingsDependent
}
}
private void handle(final ByteArrayDataInput in) {
/**
* Processes the given data input and attempts to translate it to a message for the "AuthMe.v2" channel.
*
* @param in the input to handle
*/
private void handle(ByteArrayDataInput in) {
// Parse type
final String typeId = in.readUTF();
final Optional<MessageType> type = MessageType.fromId(typeId);

View File

@ -97,7 +97,7 @@ public final class RegistrationSettings implements SettingsHolder {
public static final Property<Boolean> REMOVE_LEAVE_MESSAGE =
newProperty("settings.removeLeaveMessage", false);
@Comment("Do we need to add potion effect Blinding before login/reigster?")
@Comment("Do we need to add potion effect Blinding before login/register?")
public static final Property<Boolean> APPLY_BLIND_EFFECT =
newProperty("settings.applyBlindEffect", false);

View File

@ -30,7 +30,7 @@ section:
# -------------------------------------------------------
# Vous pouvez traduire tous les textes d'aide en utilisant la syntaxe ci-dessous.
# Par exemple, pour traduire l'aide du "/authme reload" créez une section nommée "authme.reload", ou "login" pour "/login".
# Si la commande a des arguments, vour pouvez utiliser "arg1" pour traduire le premier argument, "arg2" pour le 2ème, ainsi de suite.
# Si la commande a des arguments, vous pouvez utiliser "arg1" pour traduire le premier argument, "arg2" pour le 2ème, ainsi de suite.
# Les sections non traduites auront leur texte par défaut (en anglais), il n'est donc pas obligatoire de tout traduire.
# Important: Il faut mettre la commande principale (authme) avant sa sous-commande (ex. "authme.register" pour "/authme register")
commands:

View File

@ -82,7 +82,7 @@ on_join_validation:
country_banned: 'Votre pays est banni de ce serveur.'
not_owner_error: 'Vous n''êtes pas le propriétaire de ce compte. Veuillez utiliser un autre pseudo !'
invalid_name_case: 'Veuillez vous connecter avec "%valid" et non pas avec "%invalid".'
quick_command: '&cUtilisation trop rapide de commande! Veuillez vous reconnecter et attendre un peu avant d''executer une commande.'
quick_command: '&cUtilisation trop rapide de commande! Veuillez vous reconnecter et attendre un peu avant d''exécuter une commande.'
# Email
email:
@ -122,7 +122,7 @@ captcha:
usage_captcha: '&cTrop de tentatives de connexion ont échoué, faites: /captcha %captcha_code'
wrong_captcha: '&cCaptcha incorrect, écrivez de nouveau: /captcha %captcha_code'
valid_captcha: '&aCaptcha validé! Vous pouvez maintenant réessayer de vous connecter.'
captcha_for_registration: 'Avant de vous inscrire veuillez rentrer un captcha en faisant "/captcha %captcha_code"'
captcha_for_registration: 'Avant de vous inscrire, veuillez rentrer un captcha en faisant "/captcha %captcha_code"'
register_captcha_valid: '&aCaptcha validé! Vous pouvez maintenant vous inscrire.'
# Verification code

View File

@ -6,9 +6,6 @@ import org.bukkit.entity.Player;
import org.mockito.Mockito;
import java.io.File;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Modifier;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.URI;
@ -95,33 +92,6 @@ public final class TestHelper {
return logger;
}
/**
* Check that a class only has a hidden, zero-argument constructor, preventing the
* instantiation of such classes (utility classes). Invokes the hidden constructor
* as to register the code coverage.
*
* @param clazz The class to validate
*/
public static void validateHasOnlyPrivateEmptyConstructor(Class<?> clazz) {
Constructor<?>[] constructors = clazz.getDeclaredConstructors();
if (constructors.length > 1) {
throw new IllegalStateException("Class " + clazz.getSimpleName() + " has more than one constructor");
} else if (constructors[0].getParameterTypes().length != 0) {
throw new IllegalStateException("Constructor of " + clazz + " does not have empty parameter list");
} else if (!Modifier.isPrivate(constructors[0].getModifiers())) {
throw new IllegalStateException("Constructor of " + clazz + " is not private");
}
// Ugly hack to get coverage on the private constructors
// http://stackoverflow.com/questions/14077842/how-to-test-a-private-constructor-in-java-application
try {
constructors[0].setAccessible(true);
constructors[0].newInstance();
} catch (InvocationTargetException | InstantiationException | IllegalAccessException e) {
throw new UnsupportedOperationException(e);
}
}
/**
* Configures the player mock to return the given IP address.
*

View File

@ -24,11 +24,11 @@ import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import java.time.Instant;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import java.time.Instant;
import static fr.xephi.authme.IsEqualByReflectionMatcher.hasEqualValuesOnAllFields;
import static org.hamcrest.Matchers.contains;
@ -43,7 +43,7 @@ import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.only;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoInteractions;
import static org.mockito.hamcrest.MockitoHamcrest.argThat;
/**
@ -478,7 +478,7 @@ public class AuthMeApiTest {
// then
assertThat(result, equalTo(false));
verify(dataSource, only()).isAuthAvailable(name);
verifyZeroInteractions(management, passwordSecurity);
verifyNoInteractions(management, passwordSecurity);
}
@Test

View File

@ -1,6 +1,5 @@
package fr.xephi.authme.command;
import fr.xephi.authme.TestHelper;
import org.bukkit.ChatColor;
import org.junit.BeforeClass;
import org.junit.Test;
@ -83,12 +82,6 @@ public class CommandUtilsTest {
checkArgumentCount(command, 1, 3);
}
@Test
public void shouldHaveHiddenConstructor() {
// given / when / then
TestHelper.validateHasOnlyPrivateEmptyConstructor(CommandUtils.class);
}
@Test
public void shouldFormatSimpleArgument() {
// given

View File

@ -33,7 +33,7 @@ import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoInteractions;
import static org.mockito.hamcrest.MockitoHamcrest.argThat;
/**
@ -64,7 +64,7 @@ public class HelpCommandTest {
// then
verify(sender).sendMessage(argThat(containsString("Could not get base command")));
verifyZeroInteractions(helpProvider);
verifyNoInteractions(helpProvider);
}
@Test
@ -102,7 +102,7 @@ public class HelpCommandTest {
ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class);
verify(sender).sendMessage(captor.capture());
assertThat(removeColors(captor.getValue()), containsString("Unknown command"));
verifyZeroInteractions(helpProvider);
verifyNoInteractions(helpProvider);
}
@Test

View File

@ -17,7 +17,7 @@ import java.util.Arrays;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoInteractions;
/**
* Test for {@link ChangePasswordAdminCommand}.
@ -68,6 +68,6 @@ public class ChangePasswordAdminCommandTest {
// then
verify(validationService).validatePassword(pass, name);
verify(commonService).send(sender, MessageKey.INVALID_PASSWORD_LENGTH, "7");
verifyZeroInteractions(management);
verifyNoInteractions(management);
}
}

View File

@ -29,8 +29,8 @@ import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoInteractions;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.hamcrest.MockitoHamcrest.argThat;
/**
@ -67,7 +67,7 @@ public class ConverterCommandTest {
// then
String converters = String.join(", ", ConverterCommand.CONVERTERS.keySet());
verify(sender).sendMessage(argThat(containsString(converters)));
verifyZeroInteractions(commonService, converterFactory, bukkitService);
verifyNoInteractions(commonService, converterFactory, bukkitService);
}
@Test
@ -81,7 +81,7 @@ public class ConverterCommandTest {
// then
String converters = String.join(", ", ConverterCommand.CONVERTERS.keySet());
verify(sender).sendMessage(argThat(containsString(converters)));
verifyZeroInteractions(commonService, converterFactory, bukkitService);
verifyNoInteractions(commonService, converterFactory, bukkitService);
}
@Test

View File

@ -18,7 +18,7 @@ import static org.hamcrest.Matchers.containsString;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoInteractions;
import static org.mockito.hamcrest.MockitoHamcrest.argThat;
/**
@ -53,7 +53,7 @@ public class ForceLoginCommandTest {
// then
verify(bukkitService).getPlayerExact(playerName);
verify(sender).sendMessage("Player needs to be online!");
verifyZeroInteractions(management);
verifyNoInteractions(management);
}
@Test
@ -69,7 +69,7 @@ public class ForceLoginCommandTest {
// then
verify(bukkitService).getPlayerExact(playerName);
verify(sender).sendMessage("Player needs to be online!");
verifyZeroInteractions(management);
verifyNoInteractions(management);
}
@Test
@ -87,7 +87,7 @@ public class ForceLoginCommandTest {
// then
verify(bukkitService).getPlayerExact(playerName);
verify(sender).sendMessage(argThat(containsString("You cannot force login the player")));
verifyZeroInteractions(management);
verifyNoInteractions(management);
}
@Test

View File

@ -19,7 +19,7 @@ import static org.junit.Assert.assertThat;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoInteractions;
import static org.mockito.hamcrest.MockitoHamcrest.argThat;
/**
@ -45,7 +45,7 @@ public class PurgeCommandTest {
// then
verify(sender).sendMessage(argThat(containsString("The value you've entered is invalid")));
verifyZeroInteractions(purgeService);
verifyNoInteractions(purgeService);
}
@Test
@ -59,7 +59,7 @@ public class PurgeCommandTest {
// then
verify(sender).sendMessage(argThat(containsString("You can only purge data older than 30 days")));
verifyZeroInteractions(purgeService);
verifyNoInteractions(purgeService);
}
@Test

View File

@ -18,7 +18,7 @@ import static org.hamcrest.Matchers.containsString;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoInteractions;
import static org.mockito.hamcrest.MockitoHamcrest.argThat;
/**
@ -52,7 +52,7 @@ public class PurgePlayerCommandTest {
// then
verify(sender).sendMessage(argThat(containsString("This player is still registered")));
verifyZeroInteractions(purgeExecutor);
verifyNoInteractions(purgeExecutor);
}
@Test

View File

@ -22,8 +22,8 @@ import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoInteractions;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.verifyZeroInteractions;
/**
* Test for {@link SetEmailCommand}.
@ -63,7 +63,7 @@ public class SetEmailCommandTest {
// then
verify(validationService).validateEmail(email);
verify(commandService).send(sender, MessageKey.INVALID_EMAIL);
verifyZeroInteractions(dataSource);
verifyNoInteractions(dataSource);
}
@Test
@ -107,7 +107,7 @@ public class SetEmailCommandTest {
verify(validationService).isEmailFreeForRegistration(email, sender);
verify(commandService).send(sender, MessageKey.EMAIL_ALREADY_USED_ERROR);
verifyNoMoreInteractions(dataSource);
verifyZeroInteractions(auth);
verifyNoInteractions(auth);
}
@Test

View File

@ -18,7 +18,7 @@ import java.util.Collections;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoInteractions;
/**
* Test for {@link UpdateHelpMessagesCommand}.
@ -65,6 +65,6 @@ public class UpdateHelpMessagesCommandTest {
// then
verify(sender).sendMessage("Could not update help file: Couldn't do the thing");
verifyZeroInteractions(helpMessagesService);
verifyNoInteractions(helpMessagesService);
}
}

View File

@ -58,11 +58,6 @@ public class DebugSectionUtilsTest {
assertThat(DebugSectionUtils.formatLocation(null), equalTo("null"));
}
@Test
public void shouldHaveHiddenConstructor() {
TestHelper.validateHasOnlyPrivateEmptyConstructor(DebugSectionUtils.class);
}
@Test
public void shouldFetchMapInLimboService() {
// given

View File

@ -19,7 +19,7 @@ import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoInteractions;
/**
* Test for {@link AddEmailCommand}.
@ -45,7 +45,7 @@ public class AddEmailCommandTest {
command.executeCommand(sender, Collections.emptyList());
// then
verifyZeroInteractions(management);
verifyNoInteractions(management);
}
@Test
@ -71,7 +71,7 @@ public class AddEmailCommandTest {
command.executeCommand(sender, Arrays.asList(email, "wrongConf"));
// then
verifyZeroInteractions(management);
verifyNoInteractions(management);
verify(commandService).send(sender, MessageKey.CONFIRM_EMAIL_MESSAGE);
}

View File

@ -21,7 +21,7 @@ import static org.junit.Assert.assertThat;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoInteractions;
import static org.mockito.Mockito.when;
/**
@ -52,7 +52,7 @@ public class ChangeEmailCommandTest {
command.executeCommand(sender, Collections.emptyList());
// then
verifyZeroInteractions(management);
verifyNoInteractions(management);
}
@Test
@ -68,7 +68,7 @@ public class ChangeEmailCommandTest {
// then
verify(codeManager).codeExistOrGenerateNew(name);
verify(commonService).send(player, MessageKey.VERIFICATION_CODE_REQUIRED);
verifyZeroInteractions(management);
verifyNoInteractions(management);
}
@Test

View File

@ -21,7 +21,7 @@ import java.util.Collections;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoInteractions;
/**
* Tests for {@link EmailSetPasswordCommand}.
@ -102,7 +102,7 @@ public class EmailSetPasswordCommandTest {
command.runCommand(player, Collections.singletonList("abc123"));
// then
verifyZeroInteractions(validationService, dataSource);
verifyNoInteractions(validationService, dataSource);
verify(commonService).send(player, MessageKey.CHANGE_PASSWORD_EXPIRED);
}
}

View File

@ -30,8 +30,8 @@ import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoInteractions;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.verifyZeroInteractions;
/**
* Test for {@link RecoverEmailCommand}.
@ -89,7 +89,7 @@ public class RecoverEmailCommandTest {
// then
verify(commonService).send(sender, MessageKey.INCOMPLETE_EMAIL_SETTINGS);
verifyZeroInteractions(dataSource, passwordSecurity);
verifyNoInteractions(dataSource, passwordSecurity);
}
@Test
@ -106,7 +106,7 @@ public class RecoverEmailCommandTest {
// then
verify(emailService).hasAllInformation();
verifyZeroInteractions(dataSource);
verifyNoInteractions(dataSource);
verify(commonService).send(sender, MessageKey.ALREADY_LOGGED_IN_ERROR);
}

View File

@ -18,7 +18,7 @@ import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoInteractions;
import static org.mockito.hamcrest.MockitoHamcrest.argThat;
/**
@ -43,7 +43,7 @@ public class LoginCommandTest {
command.executeCommand(sender, Collections.emptyList());
// then
verifyZeroInteractions(management);
verifyNoInteractions(management);
verify(sender).sendMessage(argThat(containsString("/authme forcelogin <player>")));
}

View File

@ -16,7 +16,7 @@ import java.util.Collections;
import static org.hamcrest.Matchers.containsString;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoInteractions;
import static org.mockito.hamcrest.MockitoHamcrest.argThat;
/**
@ -41,7 +41,7 @@ public class LogoutCommandTest {
command.executeCommand(sender, new ArrayList<String>());
// then
verifyZeroInteractions(management);
verifyNoInteractions(management);
verify(sender).sendMessage(argThat(containsString("only for players")));
}

View File

@ -37,7 +37,7 @@ import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoInteractions;
import static org.mockito.hamcrest.MockitoHamcrest.argThat;
/**
@ -86,7 +86,7 @@ public class RegisterCommandTest {
// then
verify(sender).sendMessage(argThat(containsString("Player only!")));
verifyZeroInteractions(management, emailService);
verifyNoInteractions(management, emailService);
}
@Test
@ -102,7 +102,7 @@ public class RegisterCommandTest {
verify(registrationCaptchaManager).isCaptchaRequired("test2");
verify(management).performRegister(eq(RegistrationMethod.TWO_FACTOR_REGISTRATION),
argThat(hasEqualValuesOnAllFields(TwoFactorRegisterParams.of(player))));
verifyZeroInteractions(emailService);
verifyNoInteractions(emailService);
}
@Test
@ -115,7 +115,7 @@ public class RegisterCommandTest {
// then
verify(commonService).send(player, MessageKey.USAGE_REGISTER);
verifyZeroInteractions(management, emailService);
verifyNoInteractions(management, emailService);
}
@Test
@ -130,7 +130,7 @@ public class RegisterCommandTest {
// then
verify(commonService).send(player, MessageKey.USAGE_REGISTER);
verifyZeroInteractions(management, emailService);
verifyNoInteractions(management, emailService);
}
@Test
@ -147,7 +147,7 @@ public class RegisterCommandTest {
// then
verify(commonService).send(player, MessageKey.USAGE_REGISTER);
verifyZeroInteractions(management);
verifyNoInteractions(management);
}
@Test
@ -163,7 +163,7 @@ public class RegisterCommandTest {
// then
verify(commonService).send(player, MessageKey.INCOMPLETE_EMAIL_SETTINGS);
verify(emailService).hasAllInformation();
verifyZeroInteractions(management);
verifyNoInteractions(management);
}
@Test
@ -181,7 +181,7 @@ public class RegisterCommandTest {
// then
verify(validationService).validateEmail(playerMail);
verify(commonService).send(player, MessageKey.INVALID_EMAIL);
verifyZeroInteractions(management);
verifyNoInteractions(management);
}
@Test
@ -200,7 +200,7 @@ public class RegisterCommandTest {
// then
verify(commonService).send(player, MessageKey.USAGE_REGISTER);
verify(emailService).hasAllInformation();
verifyZeroInteractions(management);
verifyNoInteractions(management);
}
@Test
@ -236,7 +236,7 @@ public class RegisterCommandTest {
// then
verify(commonService).send(player, MessageKey.PASSWORD_MATCH_ERROR);
verifyZeroInteractions(management, emailService);
verifyNoInteractions(management, emailService);
}
@Test
@ -287,7 +287,7 @@ public class RegisterCommandTest {
verify(registrationCaptchaManager).isCaptchaRequired("Waaa");
verify(validationService).validateEmail(email);
verify(commonService).send(player, MessageKey.INVALID_EMAIL);
verifyZeroInteractions(management);
verifyNoInteractions(management);
}
@Test
@ -321,7 +321,7 @@ public class RegisterCommandTest {
// then
verify(registrationCaptchaManager).isCaptchaRequired(name);
verify(commonService).send(player, MessageKey.CAPTCHA_FOR_REGISTRATION_REQUIRED, captcha);
verifyZeroInteractions(management, validationService);
verifyNoInteractions(management, validationService);
}
private static Player mockPlayerWithName(String name) {

View File

@ -18,7 +18,7 @@ import java.util.Collections;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoInteractions;
/**
* Test for {@link AddTotpCommand}.
@ -47,7 +47,7 @@ public class AddTotpCommandTest {
// then
verify(messages).send(player, MessageKey.NOT_LOGGED_IN);
verifyZeroInteractions(generateTotpService);
verifyNoInteractions(generateTotpService);
}
@Test
@ -63,7 +63,7 @@ public class AddTotpCommandTest {
// then
verify(messages).send(player, MessageKey.TWO_FACTOR_ALREADY_ENABLED);
verifyZeroInteractions(generateTotpService);
verifyNoInteractions(generateTotpService);
}
@Test

View File

@ -27,7 +27,7 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.only;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoInteractions;
/**
* Test for {@link ConfirmTotpCommand}.
@ -98,7 +98,7 @@ public class ConfirmTotpCommandTest {
verify(generateTotpService, never()).removeGenerateTotpKey(any(Player.class));
verify(playerCache, only()).getAuth(playerName);
verify(messages).send(player, MessageKey.TWO_FACTOR_ENABLE_ERROR_WRONG_CODE);
verifyZeroInteractions(dataSource);
verifyNoInteractions(dataSource);
}
@Test
@ -118,7 +118,7 @@ public class ConfirmTotpCommandTest {
verify(generateTotpService, only()).getGeneratedTotpKey(player);
verify(playerCache, only()).getAuth(playerName);
verify(messages).send(player, MessageKey.TWO_FACTOR_ENABLE_ERROR_NO_CODE);
verifyZeroInteractions(dataSource);
verifyNoInteractions(dataSource);
}
@Test
@ -135,7 +135,7 @@ public class ConfirmTotpCommandTest {
// then
verify(playerCache, only()).getAuth(playerName);
verifyZeroInteractions(generateTotpService, dataSource);
verifyNoInteractions(generateTotpService, dataSource);
verify(messages).send(player, MessageKey.TWO_FACTOR_ALREADY_ENABLED);
}
@ -152,7 +152,7 @@ public class ConfirmTotpCommandTest {
// then
verify(playerCache, only()).getAuth(playerName);
verifyZeroInteractions(generateTotpService, dataSource);
verifyNoInteractions(generateTotpService, dataSource);
verify(messages).send(player, MessageKey.NOT_LOGGED_IN);
}
}

View File

@ -22,7 +22,7 @@ import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.only;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoInteractions;
/**
* Test for {@link RemoveTotpCommand}.
@ -105,7 +105,7 @@ public class RemoveTotpCommandTest {
command.runCommand(player, singletonList(inputCode));
// then
verifyZeroInteractions(dataSource);
verifyNoInteractions(dataSource);
verify(messages, only()).send(player, MessageKey.TWO_FACTOR_INVALID_CODE);
verify(playerCache, only()).getAuth(name);
}
@ -124,7 +124,7 @@ public class RemoveTotpCommandTest {
command.runCommand(player, singletonList(inputCode));
// then
verifyZeroInteractions(dataSource, totpAuthenticator);
verifyNoInteractions(dataSource, totpAuthenticator);
verify(messages, only()).send(player, MessageKey.TWO_FACTOR_NOT_ENABLED_ERROR);
verify(playerCache, only()).getAuth(name);
}
@ -142,7 +142,7 @@ public class RemoveTotpCommandTest {
command.runCommand(player, singletonList(inputCode));
// then
verifyZeroInteractions(dataSource, totpAuthenticator);
verifyNoInteractions(dataSource, totpAuthenticator);
verify(messages, only()).send(player, MessageKey.NOT_LOGGED_IN);
verify(playerCache, only()).getAuth(name);
}

View File

@ -21,7 +21,7 @@ import static org.junit.Assert.assertThat;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoInteractions;
import static org.mockito.hamcrest.MockitoHamcrest.argThat;
/**
@ -60,7 +60,7 @@ public class UnregisterCommandTest {
// then
verify(playerCache).isAuthenticated(name);
verify(commonService).send(player, MessageKey.NOT_LOGGED_IN);
verifyZeroInteractions(management);
verifyNoInteractions(management);
}
@Test
@ -79,7 +79,7 @@ public class UnregisterCommandTest {
verify(playerCache).isAuthenticated(name);
verify(codeManager).codeExistOrGenerateNew(name);
verify(commonService).send(player, MessageKey.VERIFICATION_CODE_REQUIRED);
verifyZeroInteractions(management);
verifyNoInteractions(management);
}
@Test
@ -110,7 +110,7 @@ public class UnregisterCommandTest {
command.executeCommand(sender, Collections.singletonList("password"));
// then
verifyZeroInteractions(playerCache, management);
verifyNoInteractions(playerCache, management);
verify(sender).sendMessage(argThat(containsString("/authme unregister <player>")));
}

View File

@ -29,7 +29,7 @@ import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoInteractions;
/**
* Test for {@link TempbanManager}.
@ -139,7 +139,7 @@ public class TempbanManagerTest {
manager.tempbanPlayer(player);
// then
verifyZeroInteractions(player, bukkitService);
verifyNoInteractions(player, bukkitService);
}
@Test

View File

@ -20,7 +20,7 @@ import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.only;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoInteractions;
/**
* Test for {@link VerificationCodeManager}.
@ -82,7 +82,7 @@ public class VerificationCodeManagerTest {
// then
assertThat(result, equalTo(false));
verifyZeroInteractions(permissionsManager, dataSource);
verifyNoInteractions(permissionsManager, dataSource);
}
@Test
@ -98,7 +98,7 @@ public class VerificationCodeManagerTest {
// then
assertThat(result, equalTo(false));
verify(permissionsManager).hasPermission(player, PlayerPermission.VERIFICATION_CODE);
verifyZeroInteractions(dataSource);
verifyNoInteractions(dataSource);
}
@Test

View File

@ -6,7 +6,7 @@ import org.junit.Test;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoInteractions;
/**
* Test for {@link AllowFlightRestoreType}.
@ -78,7 +78,7 @@ public class AllowFlightRestoreTypeTest {
AllowFlightRestoreType.NOTHING.restoreAllowFlight(player2, limboWithoutFly);
// then
verifyZeroInteractions(player1, player2);
verifyNoInteractions(player1, player2);
}
@Test
@ -94,7 +94,7 @@ public class AllowFlightRestoreTypeTest {
// then
if (type == noInteractionType) {
verifyZeroInteractions(player);
verifyNoInteractions(player);
} else {
verify(player).setAllowFlight(false);
}

View File

@ -34,7 +34,7 @@ import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoInteractions;
/**
* Test for {@link LimboPlayerTaskManager}.
@ -97,7 +97,7 @@ public class LimboPlayerTaskManagerTest {
limboPlayerTaskManager.registerMessageTask(player, limboPlayer, LimboMessageType.LOG_IN);
// then
verifyZeroInteractions(limboPlayer, bukkitService);
verifyNoInteractions(limboPlayer, bukkitService);
}
@Test
@ -173,7 +173,7 @@ public class LimboPlayerTaskManagerTest {
limboPlayerTaskManager.registerTimeoutTask(player, limboPlayer);
// then
verifyZeroInteractions(limboPlayer, bukkitService);
verifyNoInteractions(limboPlayer, bukkitService);
}
@Test

View File

@ -15,7 +15,7 @@ import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.nullValue;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoInteractions;
/**
* Test for {@link LimboServiceHelper}.
@ -83,7 +83,7 @@ public class LimboServiceHelperTest {
LimboPlayer result3 = limboServiceHelper.merge(null, null);
// then
verifyZeroInteractions(limbo);
verifyNoInteractions(limbo);
assertThat(result1, equalTo(limbo));
assertThat(result2, equalTo(limbo));
assertThat(result3, nullValue());

View File

@ -34,7 +34,7 @@ import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.only;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoInteractions;
/**
* Test for {@link LimboService}, and {@link LimboServiceHelper}.
@ -222,7 +222,7 @@ public class LimboServiceTest {
limboService.replaceTasksAfterRegistration(player);
// then
verifyZeroInteractions(taskManager);
verifyNoInteractions(taskManager);
verify(authGroupHandler).setGroup(player, null, AuthGroupType.REGISTERED_UNAUTHENTICATED);
}

View File

@ -9,9 +9,11 @@ import org.junit.runners.Parameterized;
import java.lang.reflect.Method;
import java.sql.Connection;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import static org.mockito.Mockito.mock;
@ -21,7 +23,7 @@ import static org.mockito.Mockito.mock;
public abstract class AbstractSqlDataSourceResourceClosingTest extends AbstractResourceClosingTest {
/** List of DataSource method names not to test. */
private static final Set<String> IGNORED_METHODS = ImmutableSet.of("reload", "getType");
private static final Set<String> IGNORED_METHODS = ImmutableSet.of("reload", "getType", "isCached");
private static Settings settings;
@ -64,12 +66,8 @@ public abstract class AbstractSqlDataSourceResourceClosingTest extends AbstractR
/* Get all methods of the DataSource interface, minus the ones in the ignored list. */
private static List<Method> getDataSourceMethods() {
List<Method> publicMethods = new ArrayList<>();
for (Method method : DataSource.class.getDeclaredMethods()) {
if (!IGNORED_METHODS.contains(method.getName()) && !method.isSynthetic()) {
publicMethods.add(method);
}
}
return publicMethods;
return Arrays.stream(DataSource.class.getDeclaredMethods())
.filter(method -> !IGNORED_METHODS.contains(method.getName()) && !method.isSynthetic())
.collect(Collectors.toList());
}
}

View File

@ -47,7 +47,7 @@ public class SQLiteIntegrationTest extends AbstractDataSourceIntegrationTest {
TestHelper.returnDefaultsForAllProperties(settings);
set(DatabaseSettings.MYSQL_DATABASE, "sqlite-test");
set(DatabaseSettings.MYSQL_TABLE, "authme");
TestHelper.setRealLogger();
TestHelper.setupLogger();
Path sqlInitFile = TestHelper.getJarPath(TestHelper.PROJECT_ROOT + "datasource/sql-initialize.sql");
// Note ljacqu 20160221: It appears that we can only run one statement per Statement.execute() so we split

View File

@ -30,11 +30,6 @@ public class SqlDataSourceUtilsTest {
logger = TestHelper.setupLogger();
}
@Test
public void shouldHaveHiddenConstructor() {
TestHelper.validateHasOnlyPrivateEmptyConstructor(SqlDataSourceUtils.class);
}
@Test
public void shouldLogException() {
// given

View File

@ -21,8 +21,8 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.only;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoInteractions;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.hamcrest.MockitoHamcrest.argThat;
/**
@ -51,7 +51,7 @@ public class AbstractDataSourceConverterTest {
// then
verify(sender).sendMessage(argThat(containsString("Please configure your connection to SQLITE")));
verify(destination, only()).getType();
verifyZeroInteractions(source);
verifyNoInteractions(source);
}
@Test
@ -72,7 +72,7 @@ public class AbstractDataSourceConverterTest {
// then
verify(sender).sendMessage("The data source to convert from could not be initialized");
verify(destination, only()).getType();
verifyZeroInteractions(source);
verifyNoInteractions(source);
}
@Test

View File

@ -26,7 +26,7 @@ import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoInteractions;
import static org.mockito.hamcrest.MockitoHamcrest.argThat;
/**
@ -81,7 +81,7 @@ public class CrazyLoginConverterTest {
crazyLoginConverter.execute(sender);
// then
verifyZeroInteractions(dataSource);
verifyNoInteractions(dataSource);
verify(sender).sendMessage(argThat(containsString("file not found")));
}

View File

@ -14,7 +14,7 @@ import java.sql.Connection;
import java.sql.SQLException;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoInteractions;
/**
* Test for {@link NoOpExtension}.
@ -49,6 +49,6 @@ public class NoOpExtensionTest {
extension.saveAuth(auth, connection);
// then
verifyZeroInteractions(connection, auth);
verifyNoInteractions(connection, auth);
}
}

View File

@ -27,7 +27,7 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.only;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoInteractions;
/**
* Test for {@link EntityListener}.
@ -76,7 +76,7 @@ public class EntityListenerTest {
// then
verify(listenerService).shouldCancelEvent(event);
verifyZeroInteractions(event);
verifyNoInteractions(event);
}
@Test
@ -140,7 +140,7 @@ public class EntityListenerTest {
// then
verify(listenerService).shouldCancelEvent(event);
verifyZeroInteractions(event);
verifyNoInteractions(event);
}
@Test
@ -156,7 +156,7 @@ public class EntityListenerTest {
listener.onProjectileLaunch(event);
// then
verifyZeroInteractions(listenerService);
verifyNoInteractions(listenerService);
verify(event, never()).setCancelled(anyBoolean());
}

View File

@ -10,7 +10,7 @@ import java.util.function.Consumer;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoInteractions;
/**
* Tests simple listener methods that should cancel an event when the listener service says so.
@ -54,7 +54,7 @@ public final class EventCancelVerifier {
event = mock(clazz);
mockShouldCancel(false, listenerService, event);
listenerMethod.accept(event);
verifyZeroInteractions(event);
verifyNoInteractions(event);
return this;
}

View File

@ -22,7 +22,7 @@ import static org.junit.Assert.assertThat;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoInteractions;
/**
* Test for {@link ListenerService}.
@ -91,7 +91,7 @@ public class ListenerServiceTest {
// then
assertThat(result, equalTo(false));
verify(playerCache).isAuthenticated(playerName);
verifyZeroInteractions(dataSource);
verifyNoInteractions(dataSource);
}
@Test
@ -110,7 +110,7 @@ public class ListenerServiceTest {
assertThat(result, equalTo(true));
verify(playerCache).isAuthenticated(playerName);
// makes sure the setting is checked first = avoid unnecessary DB operation
verifyZeroInteractions(dataSource);
verifyNoInteractions(dataSource);
}
@Test
@ -147,7 +147,7 @@ public class ListenerServiceTest {
// then
assertThat(result, equalTo(false));
verifyZeroInteractions(dataSource);
verifyNoInteractions(dataSource);
}
@Test
@ -182,7 +182,7 @@ public class ListenerServiceTest {
// then
assertThat(result, equalTo(false));
verify(playerCache).isAuthenticated(playerName);
verifyZeroInteractions(dataSource);
verifyNoInteractions(dataSource);
}
@Test
@ -210,7 +210,7 @@ public class ListenerServiceTest {
// then
assertThat(result, equalTo(true));
verify(playerCache).isAuthenticated(playerName);
verifyZeroInteractions(dataSource);
verifyNoInteractions(dataSource);
}
private static Player mockPlayerWithName(String name) {

View File

@ -39,8 +39,8 @@ import static org.junit.Assert.fail;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoInteractions;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.verifyZeroInteractions;
/**
* Test for {@link OnJoinVerifier}.
@ -89,7 +89,7 @@ public class OnJoinVerifierTest {
assertThat(result, equalTo(false));
verify(event).getResult();
verifyNoMoreInteractions(event);
verifyZeroInteractions(bukkitService, dataSource, permissionsManager);
verifyNoInteractions(bukkitService, dataSource, permissionsManager);
}
@Test
@ -109,7 +109,7 @@ public class OnJoinVerifierTest {
assertThat(result, equalTo(true));
assertThat(event.getResult(), equalTo(PlayerLoginEvent.Result.KICK_FULL));
assertThat(event.getKickMessage(), equalTo(serverFullMessage));
verifyZeroInteractions(bukkitService, dataSource);
verifyNoInteractions(bukkitService, dataSource);
}
@Test
@ -133,7 +133,7 @@ public class OnJoinVerifierTest {
assertThat(result, equalTo(false));
assertThat(event.getResult(), equalTo(PlayerLoginEvent.Result.ALLOWED));
// First player is VIP, so expect no interactions there and second player to have been kicked
verifyZeroInteractions(onlinePlayers.get(0));
verifyNoInteractions(onlinePlayers.get(0));
verify(onlinePlayers.get(1)).kickPlayer("kick for vip");
}
@ -157,7 +157,7 @@ public class OnJoinVerifierTest {
assertThat(result, equalTo(true));
assertThat(event.getResult(), equalTo(PlayerLoginEvent.Result.KICK_FULL));
assertThat(event.getKickMessage(), equalTo("kick full server"));
verifyZeroInteractions(onlinePlayers.get(0));
verifyNoInteractions(onlinePlayers.get(0));
}
@Test
@ -254,7 +254,7 @@ public class OnJoinVerifierTest {
onJoinVerifier.checkNameCasing(name, auth);
// then
verifyZeroInteractions(dataSource);
verifyNoInteractions(dataSource);
}
@Test
@ -269,7 +269,7 @@ public class OnJoinVerifierTest {
// when / then
onJoinVerifier.checkNameCasing(name, auth);
verifyZeroInteractions(dataSource);
verifyNoInteractions(dataSource);
}
@Test
@ -311,7 +311,7 @@ public class OnJoinVerifierTest {
onJoinVerifier.checkNameCasing(name, auth);
// then
verifyZeroInteractions(dataSource);
verifyNoInteractions(dataSource);
}
@Test
@ -324,7 +324,7 @@ public class OnJoinVerifierTest {
onJoinVerifier.checkNameCasing(name, auth);
// then
verifyZeroInteractions(dataSource);
verifyNoInteractions(dataSource);
}
@Test
@ -368,7 +368,7 @@ public class OnJoinVerifierTest {
onJoinVerifier.checkSingleSession(name);
// then
verifyZeroInteractions(bukkitService);
verifyNoInteractions(bukkitService);
}
@Test
@ -397,7 +397,7 @@ public class OnJoinVerifierTest {
onJoinVerifier.checkAntibot(name, isAuthAvailable);
// then
verifyZeroInteractions(permissionsManager, antiBotService);
verifyNoInteractions(permissionsManager, antiBotService);
}
@Test
@ -412,7 +412,7 @@ public class OnJoinVerifierTest {
// then
verify(permissionsManager).hasPermissionOffline(name, PlayerStatePermission.BYPASS_ANTIBOT);
verifyZeroInteractions(antiBotService);
verifyNoInteractions(antiBotService);
}
@Test
@ -446,12 +446,12 @@ public class OnJoinVerifierTest {
given(settings.getProperty(ProtectionSettings.ENABLE_PROTECTION)).willReturn(false);
given(settings.getProperty(ProtectionSettings.ENABLE_PROTECTION_REGISTERED)).willReturn(true);
onJoinVerifier.checkPlayerCountry(name, ip, false);
verifyZeroInteractions(validationService);
verifyNoInteractions(validationService);
// protection for registered players disabled
given(settings.getProperty(ProtectionSettings.ENABLE_PROTECTION_REGISTERED)).willReturn(false);
onJoinVerifier.checkPlayerCountry(name, ip, true);
verifyZeroInteractions(validationService);
verifyNoInteractions(validationService);
}
@Test

View File

@ -83,8 +83,8 @@ import static org.mockito.Mockito.only;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoInteractions;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.verifyZeroInteractions;
/**
* Test for {@link PlayerListener}.
@ -140,7 +140,7 @@ public class PlayerListenerTest {
// then
assertThat(event.isCancelled(), equalTo(true));
verifyZeroInteractions(player, management, antiBotService);
verifyNoInteractions(player, management, antiBotService);
}
@Test
@ -176,7 +176,7 @@ public class PlayerListenerTest {
// then
assertThat(event.isCancelled(), equalTo(false));
verify(antiBotService).wasPlayerKicked(name);
verifyZeroInteractions(management);
verifyNoInteractions(management);
}
@Test
@ -205,7 +205,7 @@ public class PlayerListenerTest {
// then
verify(event, only()).getMessage();
verifyZeroInteractions(listenerService, messages);
verifyNoInteractions(listenerService, messages);
}
@Test
@ -220,7 +220,7 @@ public class PlayerListenerTest {
// then
verify(event, only()).getMessage();
verifyZeroInteractions(listenerService, messages);
verifyNoInteractions(listenerService, messages);
}
@Test
@ -241,7 +241,7 @@ public class PlayerListenerTest {
verify(event).getMessage();
verifyNoMoreInteractions(event);
verify(listenerService).shouldCancelEvent(player);
verifyZeroInteractions(messages);
verifyNoInteractions(messages);
}
@Test
@ -290,7 +290,7 @@ public class PlayerListenerTest {
listener.onPlayerChat(event);
// then
verifyZeroInteractions(event, listenerService, messages);
verifyNoInteractions(event, listenerService, messages);
}
@Test
@ -324,7 +324,7 @@ public class PlayerListenerTest {
// then
verify(listenerService).shouldCancelEvent(event.getPlayer());
verifyZeroInteractions(event, messages);
verifyNoInteractions(event, messages);
}
@Test
@ -400,7 +400,7 @@ public class PlayerListenerTest {
listener.onPlayerMove(event);
// then
verifyZeroInteractions(event);
verifyNoInteractions(event);
}
@Test
@ -551,7 +551,7 @@ public class PlayerListenerTest {
listener.onPlayerRespawn(event);
// then
verifyZeroInteractions(listenerService);
verifyNoInteractions(listenerService);
verify(event, never()).setRespawnLocation(any());
}
@ -568,7 +568,7 @@ public class PlayerListenerTest {
listener.onPlayerRespawn(event);
// then
verifyZeroInteractions(spawnLoader);
verifyNoInteractions(spawnLoader);
verify(event, never()).setRespawnLocation(any());
}
@ -659,7 +659,7 @@ public class PlayerListenerTest {
// then
verify(validationService).isUnrestricted(name);
verifyNoModifyingCalls(event);
verifyZeroInteractions(onJoinVerifier);
verifyNoInteractions(onJoinVerifier);
}
@Test
@ -717,7 +717,7 @@ public class PlayerListenerTest {
verify(validationService).isUnrestricted(name);
verify(onJoinVerifier).checkSingleSession(name);
verify(onJoinVerifier).checkIsValidName(name);
verifyZeroInteractions(dataSource);
verifyNoInteractions(dataSource);
verifyNoModifyingCalls(preLoginEvent);
}
@ -780,7 +780,7 @@ public class PlayerListenerTest {
// then
verify(validationService).isUnrestricted(name);
verify(onJoinVerifier).refusePlayerForFullServer(loginEvent);
verifyZeroInteractions(dataSource);
verifyNoInteractions(dataSource);
verifyNoModifyingCalls(loginEvent);
}
@ -805,7 +805,7 @@ public class PlayerListenerTest {
verify(validationService).isUnrestricted(name);
verify(onJoinVerifier).checkIsValidName(name);
// Check that we don't talk with the data source before performing checks that don't require it
verifyZeroInteractions(dataSource);
verifyNoInteractions(dataSource);
verify(event).setKickMessage(message);
verify(event).setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_OTHER);
}
@ -844,7 +844,7 @@ public class PlayerListenerTest {
// then
assertThat(event.getQuitMessage(), nullValue());
verify(antiBotService).wasPlayerKicked(name);
verifyZeroInteractions(management);
verifyNoInteractions(management);
}
@Test
@ -942,7 +942,7 @@ public class PlayerListenerTest {
// then
assertThat(event.isCancelled(), equalTo(false));
verifyZeroInteractions(bukkitService);
verifyNoInteractions(bukkitService);
}
@Test
@ -980,7 +980,7 @@ public class PlayerListenerTest {
// then
assertThat(event.getJoinMessage(), equalTo(joinMsg));
verifyZeroInteractions(joinMessageService);
verifyNoInteractions(joinMessageService);
}
@Test
@ -996,7 +996,7 @@ public class PlayerListenerTest {
// then
assertThat(event.getJoinMessage(), nullValue());
verifyZeroInteractions(joinMessageService);
verifyNoInteractions(joinMessageService);
}
@Test
@ -1017,7 +1017,7 @@ public class PlayerListenerTest {
// then
assertThat(event.getJoinMessage(), equalTo("Hello doooew (aka Displ)"));
verifyZeroInteractions(joinMessageService);
verifyNoInteractions(joinMessageService);
}
@Test

View File

@ -1,9 +1,9 @@
package fr.xephi.authme.listener;
import fr.xephi.authme.TestHelper;
import fr.xephi.authme.service.PluginHookService;
import fr.xephi.authme.listener.protocollib.ProtocolLibService;
import fr.xephi.authme.permission.PermissionsManager;
import fr.xephi.authme.service.PluginHookService;
import fr.xephi.authme.settings.SpawnLoader;
import org.bukkit.event.server.PluginDisableEvent;
import org.bukkit.event.server.PluginEnableEvent;
@ -20,8 +20,8 @@ import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoInteractions;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.verifyZeroInteractions;
/**
* Test for {@link ServerListener}.
@ -65,7 +65,7 @@ public class ServerListenerTest {
});
checkEnableHandling(MULTIVERSE, () -> verify(pluginHookService).tryHookToMultiverse());
checkEnableHandling(PROTOCOL_LIB, () -> verify(protocolLibService).setup());
checkEnableHandling("UnknownPlugin", () -> verifyZeroInteractions(pluginHookService, spawnLoader));
checkEnableHandling("UnknownPlugin", () -> verifyNoInteractions(pluginHookService, spawnLoader));
}
@Test
@ -78,7 +78,7 @@ public class ServerListenerTest {
});
checkDisableHandling(MULTIVERSE, () -> verify(pluginHookService).unhookMultiverse());
checkDisableHandling(PROTOCOL_LIB, () -> verify(protocolLibService).disable());
checkDisableHandling("UnknownPlugin", () -> verifyZeroInteractions(pluginHookService, spawnLoader));
checkDisableHandling("UnknownPlugin", () -> verifyNoInteractions(pluginHookService, spawnLoader));
}
private void checkEnableHandling(String pluginName, Runnable verifier) {

View File

@ -64,7 +64,7 @@ public class PermissionsManagerInitializationTest {
@BeforeClass
public static void setUpLogger() {
TestHelper.setRealLogger();
TestHelper.setupLogger();
}
@Before

View File

@ -36,7 +36,7 @@ import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoInteractions;
import static org.mockito.internal.verification.VerificationModeFactory.only;
/**
@ -78,7 +78,7 @@ public class AsynchronousLoginTest {
// then
verify(playerCache, only()).isAuthenticated(name);
verify(commonService).send(player, MessageKey.ALREADY_LOGGED_IN_ERROR);
verifyZeroInteractions(dataSource);
verifyNoInteractions(dataSource);
}
@Test
@ -198,7 +198,7 @@ public class AsynchronousLoginTest {
// then
assertThat(result, equalTo(false));
verifyZeroInteractions(bukkitService);
verifyNoInteractions(bukkitService);
}
@Test
@ -214,7 +214,7 @@ public class AsynchronousLoginTest {
// then
assertThat(result, equalTo(false));
verify(commonService).hasPermission(player, PlayerStatePermission.ALLOW_MULTIPLE_ACCOUNTS);
verifyZeroInteractions(bukkitService);
verifyNoInteractions(bukkitService);
}
@Test

View File

@ -28,7 +28,7 @@ import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.only;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoInteractions;
/**
* Test for {@link AsyncRegister}.
@ -64,7 +64,7 @@ public class AsyncRegisterTest {
// then
verify(commonService).send(player, MessageKey.ALREADY_LOGGED_IN_ERROR);
verifyZeroInteractions(dataSource, executor);
verifyNoInteractions(dataSource, executor);
}
@Test
@ -82,7 +82,7 @@ public class AsyncRegisterTest {
// then
verify(commonService).send(player, MessageKey.REGISTRATION_DISABLED);
verifyZeroInteractions(dataSource, executor);
verifyNoInteractions(dataSource, executor);
}
@Test
@ -102,7 +102,7 @@ public class AsyncRegisterTest {
// then
verify(commonService).send(player, MessageKey.NAME_ALREADY_REGISTERED);
verify(dataSource, only()).isAuthAvailable(name);
verifyZeroInteractions(executor);
verifyNoInteractions(executor);
}
@Test

View File

@ -28,7 +28,7 @@ import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoInteractions;
/**
* Test for {@link EmailRegisterExecutor}.
@ -158,7 +158,7 @@ public class EmailRegisterExecutorTest {
// then
verify(emailService).sendPasswordMail("Laleh", "test@example.com", password);
verify(commonService).send(player, MessageKey.EMAIL_SEND_FAILURE);
verifyZeroInteractions(syncProcessManager);
verifyNoInteractions(syncProcessManager);
}
private static void assertIsCloseTo(long value1, long value2, long tolerance) {

View File

@ -31,7 +31,7 @@ import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoInteractions;
/**
* Test for {@link PasswordRegisterExecutor}.
@ -138,7 +138,7 @@ public class PasswordRegisterExecutorTest {
executor.executePostPersistAction(params);
// then
verifyZeroInteractions(bukkitService, asynchronousLogin);
verifyNoInteractions(bukkitService, asynchronousLogin);
verify(syncProcessManager).processSyncPasswordRegister(player);
}

View File

@ -38,10 +38,4 @@ public class PlayerAuthBuilderHelperTest {
assertThat(Math.abs(auth.getRegistrationDate() - System.currentTimeMillis()), lessThan(1000L));
assertThat(auth.getPassword(), equalToHash("myHash0001"));
}
@Test
public void shouldHaveHiddenConstructor() {
TestHelper.validateHasOnlyPrivateEmptyConstructor(PlayerAuthBuilderHelper.class);
}
}

View File

@ -40,7 +40,7 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.only;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoInteractions;
/**
* Test for {@link AsynchronousUnregister}.
@ -94,7 +94,7 @@ public class AsynchronousUnregisterTest {
// then
verify(service).send(player, MessageKey.WRONG_PASSWORD);
verify(passwordSecurity).comparePassword(userPassword, password, name);
verifyZeroInteractions(dataSource, limboService, teleportationService, bukkitService, bungeeSender);
verifyNoInteractions(dataSource, limboService, teleportationService, bukkitService, bungeeSender);
verify(player, only()).getName();
}
@ -189,7 +189,7 @@ public class AsynchronousUnregisterTest {
verify(passwordSecurity).comparePassword(userPassword, password, name);
verify(dataSource).removeAuth(name);
verify(playerCache).removePlayer(name);
verifyZeroInteractions(teleportationService, limboService);
verifyNoInteractions(teleportationService, limboService);
verifyCalledUnregisterEventFor(player);
verify(bungeeSender).sendAuthMeBungeecordMessage(MessageType.UNREGISTER, name);
verify(commandManager).runCommandsOnUnregister(player);
@ -216,7 +216,7 @@ public class AsynchronousUnregisterTest {
verify(passwordSecurity).comparePassword(userPassword, password, name);
verify(dataSource).removeAuth(name);
verify(service).send(player, MessageKey.ERROR);
verifyZeroInteractions(teleportationService, bukkitService, bungeeSender);
verifyNoInteractions(teleportationService, bukkitService, bungeeSender);
}
@Test
@ -241,7 +241,7 @@ public class AsynchronousUnregisterTest {
verify(passwordSecurity).comparePassword(userPassword, password, name);
verify(dataSource).removeAuth(name);
verify(playerCache).removePlayer(name);
verifyZeroInteractions(teleportationService);
verifyNoInteractions(teleportationService);
verifyCalledUnregisterEventFor(player);
verify(bungeeSender).sendAuthMeBungeecordMessage(MessageType.UNREGISTER, name);
}
@ -285,7 +285,7 @@ public class AsynchronousUnregisterTest {
// then
verify(dataSource).removeAuth(name);
verify(playerCache).removePlayer(name);
verifyZeroInteractions(teleportationService);
verifyNoInteractions(teleportationService);
verifyCalledUnregisterEventFor(null);
verify(bungeeSender).sendAuthMeBungeecordMessage(MessageType.UNREGISTER, name);
}
@ -303,7 +303,7 @@ public class AsynchronousUnregisterTest {
// then
verify(dataSource).removeAuth(name);
verify(service).send(initiator, MessageKey.ERROR);
verifyZeroInteractions(playerCache, teleportationService, bukkitService, bungeeSender);
verifyNoInteractions(playerCache, teleportationService, bukkitService, bungeeSender);
}
@SuppressWarnings("unchecked")

View File

@ -24,7 +24,7 @@ import static org.junit.Assert.assertThat;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoInteractions;
/**
* Test for {@link TotpAuthenticator}.
@ -62,9 +62,9 @@ public class TotpAuthenticatorTest {
// then
assertThat(key1.getTotpKey(), stringWithLength(16));
assertThat(key2.getTotpKey(), stringWithLength(16));
assertThat(key1.getAuthenticatorQrCodeUrl(), startsWith("https://chart.googleapis.com/chart?chs=200x200"));
assertThat(key1.getAuthenticatorQrCodeUrl(), startsWith("https://api.qrserver.com/v1/create-qr-code/?data="));
assertThat(key1.getAuthenticatorQrCodeUrl(), containsString("MCtopia"));
assertThat(key2.getAuthenticatorQrCodeUrl(), startsWith("https://chart.googleapis.com/chart?chs=200x200"));
assertThat(key2.getAuthenticatorQrCodeUrl(), startsWith("https://api.qrserver.com/v1/create-qr-code/?data="));
assertThat(key1.getTotpKey(), not(equalTo(key2.getTotpKey())));
}
@ -92,7 +92,7 @@ public class TotpAuthenticatorTest {
// then
assertThat(result, equalTo(false));
verifyZeroInteractions(googleAuthenticator);
verifyNoInteractions(googleAuthenticator);
}
@Test

View File

@ -29,7 +29,7 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.only;
import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoInteractions;
/**
* Test for {@link AntiBotService}.
@ -76,7 +76,7 @@ public class AntiBotServiceTest {
// then
assertThat(antiBotService.getAntiBotStatus(), equalTo(AntiBotService.AntiBotStatus.DISABLED));
verifyZeroInteractions(bukkitService);
verifyNoInteractions(bukkitService);
}
@Test

View File

@ -29,7 +29,7 @@ import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.only;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoInteractions;
/**
* Test for {@link BukkitService}.
@ -127,7 +127,7 @@ public class BukkitServiceTest {
// then
verify(spy).scheduleSyncDelayedTask(task);
verifyZeroInteractions(task);
verifyNoInteractions(task);
}
@Test
@ -188,7 +188,7 @@ public class BukkitServiceTest {
spy.runTaskOptionallyAsync(task);
// then
verifyZeroInteractions(task);
verifyNoInteractions(task);
verify(spy).runTaskAsynchronously(task);
}

View File

@ -12,9 +12,7 @@ import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.junit.MockitoJUnitRunner;
import org.mockito.stubbing.Answer;
import java.util.Arrays;
@ -110,11 +108,6 @@ public class MigrationServiceTest {
verifyNoMoreInteractions(settings, dataSource, sha256);
}
@Test
public void shouldHaveHiddenEmptyConstructorOnly() {
TestHelper.validateHasOnlyPrivateEmptyConstructor(MigrationService.class);
}
private static PlayerAuth authWithNickAndHash(String nick, String hash) {
return PlayerAuth.builder()
.name(nick)
@ -123,12 +116,9 @@ public class MigrationServiceTest {
}
private static void setSha256MockToUppercase(Sha256 sha256) {
given(sha256.computeHash(anyString(), anyString())).willAnswer(new Answer<HashedPassword>() {
@Override
public HashedPassword answer(InvocationOnMock invocation) {
given(sha256.computeHash(anyString(), anyString())).willAnswer(invocation -> {
String plainPassword = invocation.getArgument(0);
return new HashedPassword(plainPassword.toUpperCase(), null);
}
});
}
}

View File

@ -25,8 +25,8 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.only;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoInteractions;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.verifyZeroInteractions;
/**
* Test for {@link SessionService}.
@ -66,7 +66,7 @@ public class SessionServiceTest {
// then
assertThat(result, equalTo(false));
verifyZeroInteractions(dataSource);
verifyNoInteractions(dataSource);
}
@Test

View File

@ -32,7 +32,7 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoInteractions;
/**
* Test for {@link TeleportationService}.
@ -77,8 +77,8 @@ public class TeleportationServiceTest {
teleportationService.teleportOnJoin(player);
// then
verifyZeroInteractions(player);
verifyZeroInteractions(bukkitService);
verifyNoInteractions(player);
verifyNoInteractions(bukkitService);
}
@Test
@ -134,7 +134,7 @@ public class TeleportationServiceTest {
verify(player, never()).teleport(any(Location.class));
verify(spawnLoader).getFirstSpawn();
verify(spawnLoader, never()).getSpawnLocation(any(Player.class));
verifyZeroInteractions(bukkitService);
verifyNoInteractions(bukkitService);
}
@Test
@ -148,7 +148,7 @@ public class TeleportationServiceTest {
// then
verify(player, never()).teleport(any(Location.class));
verifyZeroInteractions(bukkitService);
verifyNoInteractions(bukkitService);
}
@Test
@ -162,7 +162,7 @@ public class TeleportationServiceTest {
// then
verify(player, never()).teleport(any(Location.class));
verifyZeroInteractions(bukkitService);
verifyNoInteractions(bukkitService);
}
@Test
@ -226,7 +226,7 @@ public class TeleportationServiceTest {
teleportationService.teleportOnLogin(player, auth, limbo);
// then
verifyZeroInteractions(player, auth, limbo, bukkitService, spawnLoader);
verifyNoInteractions(player, auth, limbo, bukkitService, spawnLoader);
}
@Test
@ -270,7 +270,7 @@ public class TeleportationServiceTest {
// then
verify(player, never()).teleport(spawn);
verifyZeroInteractions(bukkitService, spawnLoader);
verifyNoInteractions(bukkitService, spawnLoader);
}
@Test
@ -387,7 +387,7 @@ public class TeleportationServiceTest {
teleportationService.teleportOnLogin(player, auth, limbo);
// then
verifyZeroInteractions(player);
verifyNoInteractions(player);
verify(limbo, times(2)).getLocation();
}

View File

@ -33,7 +33,7 @@ import static org.junit.Assert.assertThat;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoInteractions;
/**
* Test for {@link ValidationService}.
@ -277,7 +277,7 @@ public class ValidationServiceTest {
// then
assertThat(result, equalTo(true));
verifyZeroInteractions(geoIpService);
verifyNoInteractions(geoIpService);
}
@Test

View File

@ -21,7 +21,7 @@ import java.util.logging.Logger;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoInteractions;
import static org.mockito.internal.verification.VerificationModeFactory.times;
/**
@ -76,6 +76,6 @@ public class SettingsWarnerTest {
settingsWarner.logWarningsForMisconfigurations();
// then
verifyZeroInteractions(logger);
verifyNoInteractions(logger);
}
}

View File

@ -32,7 +32,7 @@ import static org.hamcrest.Matchers.hasSize;
import static org.junit.Assert.assertThat;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoInteractions;
/**
* Test for {@link WelcomeMessageConfiguration}.
@ -81,7 +81,7 @@ public class WelcomeMessageConfigurationTest {
// then
assertThat(result, hasSize(2));
assertThat(result, contains(welcomeMessage.split("\\n")));
verifyZeroInteractions(player, playerCache, geoIpService, bukkitService, server);
verifyNoInteractions(player, playerCache, geoIpService, bukkitService, server);
}
@Test
@ -104,7 +104,7 @@ public class WelcomeMessageConfigurationTest {
assertThat(result.get(0), equalTo("Hello Bobby, your IP is 123.45.66.77"));
assertThat(result.get(1), equalTo("Your country is Syldavia."));
assertThat(result.get(2), equalTo("Welcome to CrazyServer!"));
verifyZeroInteractions(server, playerCache);
verifyNoInteractions(server, playerCache);
}
@Test

View File

@ -28,8 +28,8 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.only;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoInteractions;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.verifyZeroInteractions;
/**
* Test for {@link CommandManager}.
@ -80,7 +80,7 @@ public class CommandManagerTest {
verify(bukkitService).scheduleSyncDelayedTask(any(Runnable.class), eq(60L));
verify(bukkitService).scheduleSyncDelayedTask(any(Runnable.class), eq(120L));
verifyNoMoreInteractions(bukkitService);
verifyZeroInteractions(geoIpService);
verifyNoInteractions(geoIpService);
}
@Test
@ -101,7 +101,7 @@ public class CommandManagerTest {
verify(bukkitService).scheduleSyncDelayedTask(any(Runnable.class), eq(120L));
verify(bukkitService).scheduleSyncDelayedTask(any(Runnable.class), eq(180L));
verifyNoMoreInteractions(bukkitService);
verifyZeroInteractions(geoIpService);
verifyNoInteractions(geoIpService);
}
@Test
@ -124,7 +124,7 @@ public class CommandManagerTest {
verify(bukkitService).scheduleSyncDelayedTask(any(Runnable.class), eq(180L));
verify(bukkitService).scheduleSyncDelayedTask(any(Runnable.class), eq(240L));
verifyNoMoreInteractions(bukkitService);
verifyZeroInteractions(geoIpService);
verifyNoInteractions(geoIpService);
}
@Test
@ -145,7 +145,7 @@ public class CommandManagerTest {
verify(bukkitService).scheduleSyncDelayedTask(any(Runnable.class), eq(120L));
verify(bukkitService).scheduleSyncDelayedTask(any(Runnable.class), eq(180L));
verifyNoMoreInteractions(bukkitService);
verifyZeroInteractions(geoIpService);
verifyNoInteractions(geoIpService);
}
@Test
@ -163,7 +163,7 @@ public class CommandManagerTest {
verify(bukkitService).dispatchCommand(any(Player.class), eq("list"));
verify(bukkitService).scheduleSyncDelayedTask(any(Runnable.class), eq(100L));
verifyNoMoreInteractions(bukkitService);
verifyZeroInteractions(geoIpService);
verifyNoInteractions(geoIpService);
}
@Test
@ -178,7 +178,7 @@ public class CommandManagerTest {
// then
verify(bukkitService).dispatchConsoleCommand("msg Bobby Session login!");
verifyNoMoreInteractions(bukkitService);
verifyZeroInteractions(geoIpService);
verifyNoInteractions(geoIpService);
}
@Test
@ -193,7 +193,7 @@ public class CommandManagerTest {
// then
verify(bukkitService).dispatchConsoleCommand("pay Bobby 30");
verifyNoMoreInteractions(bukkitService);
verifyZeroInteractions(geoIpService);
verifyNoInteractions(geoIpService);
}
@Test
@ -206,7 +206,7 @@ public class CommandManagerTest {
manager.runCommandsOnFirstLogin(player, Arrays.asList("u", "wot", "m8"));
// then
verifyZeroInteractions(bukkitService, geoIpService);
verifyNoInteractions(bukkitService, geoIpService);
}
@Test
@ -220,7 +220,7 @@ public class CommandManagerTest {
// then
verify(bukkitService, only()).dispatchConsoleCommand("broadcast bob has joined");
verifyZeroInteractions(geoIpService);
verifyNoInteractions(geoIpService);
}
@Test
@ -234,7 +234,7 @@ public class CommandManagerTest {
// then
verify(bukkitService, only()).dispatchConsoleCommand("broadcast Bobby has joined");
verifyZeroInteractions(geoIpService);
verifyNoInteractions(geoIpService);
}
@Test
@ -265,7 +265,7 @@ public class CommandManagerTest {
// then
verify(bukkitService).dispatchConsoleCommand("broadcast Bobby (127.0.0.3) logged out");
verifyNoMoreInteractions(bukkitService);
verifyZeroInteractions(geoIpService);
verifyNoInteractions(geoIpService);
}
@Test
@ -278,7 +278,7 @@ public class CommandManagerTest {
manager.runCommandsOnRegister(player);
// then
verifyZeroInteractions(bukkitService, geoIpService);
verifyNoInteractions(bukkitService, geoIpService);
}
@Test
@ -294,12 +294,6 @@ public class CommandManagerTest {
verify(bukkitService).dispatchConsoleCommand("msg Bobby sad to see you go!");
}
@Test
public void shouldHaveHiddenConstructorInSettingsHolderClass() {
// given / when / then
TestHelper.validateHasOnlyPrivateEmptyConstructor(CommandSettingsHolder.class);
}
private void initManager() {
manager = new CommandManager(testFolder, bukkitService, geoIpService, commandMigrationService);
}

View File

@ -1,7 +1,6 @@
package fr.xephi.authme.settings.properties;
import ch.jalu.configme.configurationdata.ConfigurationData;
import fr.xephi.authme.TestHelper;
import org.junit.Test;
import static org.hamcrest.Matchers.closeTo;
@ -24,9 +23,4 @@ public class AuthMeSettingsRetrieverTest {
assertThat((double) configurationData.getProperties().size(),
closeTo(182, 10));
}
@Test
public void shouldHaveHiddenConstructor() {
TestHelper.validateHasOnlyPrivateEmptyConstructor(AuthMeSettingsRetriever.class);
}
}

View File

@ -98,13 +98,6 @@ public class SettingsClassConsistencyTest {
configData.getProperties(), hasSize((int) totalProperties));
}
@Test
public void shouldHaveHiddenEmptyConstructorOnly() {
for (Class<?> clazz : classes) {
TestHelper.validateHasOnlyPrivateEmptyConstructor(clazz);
}
}
private static boolean isValidConstantField(Field field) {
int modifiers = field.getModifiers();
return Modifier.isPublic(modifiers) && Modifier.isStatic(modifiers) && Modifier.isFinal(modifiers);

View File

@ -39,7 +39,7 @@ import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoInteractions;
import static org.mockito.hamcrest.MockitoHamcrest.argThat;
/**
@ -77,7 +77,7 @@ public class PurgeServiceTest {
purgeService.runAutoPurge();
// then
verifyZeroInteractions(bukkitService, dataSource);
verifyNoInteractions(bukkitService, dataSource);
}
@Test
@ -90,7 +90,7 @@ public class PurgeServiceTest {
purgeService.runAutoPurge();
// then
verifyZeroInteractions(bukkitService, dataSource);
verifyNoInteractions(bukkitService, dataSource);
}
@Test
@ -127,7 +127,7 @@ public class PurgeServiceTest {
verify(dataSource).getRecordsToPurge(delay);
verify(dataSource, never()).purgeRecords(anyCollection());
verify(sender).sendMessage("No players to purge");
verifyZeroInteractions(bukkitService, permissionsManager);
verifyNoInteractions(bukkitService, permissionsManager);
}
@Test
@ -160,7 +160,7 @@ public class PurgeServiceTest {
// then
verify(sender).sendMessage(argThat(containsString("Purge is already in progress")));
verifyZeroInteractions(bukkitService, dataSource, permissionsManager);
verifyNoInteractions(bukkitService, dataSource, permissionsManager);
}
@Test

View File

@ -1,7 +1,6 @@
package fr.xephi.authme.util;
import fr.xephi.authme.ReflectionTestUtils;
import fr.xephi.authme.TestHelper;
import org.junit.Test;
import java.net.MalformedURLException;
@ -55,12 +54,6 @@ public class ExceptionUtilsTest {
assertThat(resultUoe, sameInstance(uoe));
}
@Test
public void shouldHaveHiddenConstructor() {
// given / when / then
TestHelper.validateHasOnlyPrivateEmptyConstructor(ExceptionUtils.class);
}
@Test
public void shouldFormatException() {
// given

View File

@ -185,12 +185,6 @@ public class FileUtilsTest {
assertThat(dirAsFile.isFile(), equalTo(true));
}
@Test
public void shouldHaveHiddenConstructor() {
TestHelper.validateHasOnlyPrivateEmptyConstructor(FileUtils.class);
}
@Test
public void shouldCreateCurrentTimestampString() {
// given / when

View File

@ -1,6 +1,5 @@
package fr.xephi.authme.util;
import fr.xephi.authme.TestHelper;
import org.junit.Test;
import static org.hamcrest.Matchers.equalTo;
@ -50,10 +49,4 @@ public class InternetProtocolUtilsTest {
assertThat(InternetProtocolUtils.isLoopbackAddress("127.0.0.1"), equalTo(true));
assertThat(InternetProtocolUtils.isLoopbackAddress("::1"), equalTo(true));
}
@Test
public void shouldHavePrivateConstructor() {
// given / when / then
TestHelper.validateHasOnlyPrivateEmptyConstructor(InternetProtocolUtils.class);
}
}

View File

@ -5,11 +5,9 @@ import org.bukkit.entity.Player;
import org.junit.BeforeClass;
import org.junit.Test;
import java.util.UUID;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.mock;
/**
@ -36,12 +34,6 @@ public class PlayerUtilsTest {
assertThat(result, equalTo(ip));
}
@Test
public void shouldHaveHiddenConstructor() {
// given / when / then
TestHelper.validateHasOnlyPrivateEmptyConstructor(PlayerUtils.class);
}
@Test
public void shouldCheckIfIsNpc() {
// given

View File

@ -1,6 +1,5 @@
package fr.xephi.authme.util;
import fr.xephi.authme.TestHelper;
import org.junit.Test;
import java.util.regex.Pattern;
@ -84,11 +83,4 @@ public class RandomStringUtilsTest {
// then - throw exception
}
@Test
public void shouldHaveHiddenConstructor() {
// given / when / then
TestHelper.validateHasOnlyPrivateEmptyConstructor(RandomStringUtils.class);
}
}

View File

@ -1,6 +1,5 @@
package fr.xephi.authme.util;
import fr.xephi.authme.TestHelper;
import org.junit.Test;
import static java.util.Arrays.asList;
@ -77,11 +76,6 @@ public class StringUtilsTest {
assertThat(StringUtils.getDifference("test", "something"), greaterThan(0.88));
}
@Test
public void shouldHaveHiddenConstructor() {
TestHelper.validateHasOnlyPrivateEmptyConstructor(StringUtils.class);
}
@Test
public void shouldCheckIfHasNeedleInWord() {
// given/when/then

View File

@ -16,11 +16,10 @@ import java.util.logging.Logger;
import java.util.regex.Pattern;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.greaterThan;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoInteractions;
/**
* Test for {@link Utils}.
@ -56,12 +55,6 @@ public class UtilsTest {
assertThat(result.toString(), equalTo(".*?"));
}
@Test
public void shouldHavePrivateConstructorOnly() {
// given / when / then
TestHelper.validateHasOnlyPrivateEmptyConstructor(Utils.class);
}
@Test
public void shouldLogAndSendMessage() {
// given
@ -102,7 +95,7 @@ public class UtilsTest {
// then
verify(logger).info(message);
verifyZeroInteractions(sender);
verifyNoInteractions(sender);
}
@Test
@ -144,7 +137,7 @@ public class UtilsTest {
// then
verify(logger).warning(message);
verifyZeroInteractions(sender);
verifyNoInteractions(sender);
}
@Test

View File

@ -1,6 +1,5 @@
package fr.xephi.authme.util.lazytags;
import fr.xephi.authme.TestHelper;
import org.junit.Test;
import java.util.function.Function;
@ -40,11 +39,4 @@ public class TagBuilderTest {
assertThat(tag, instanceOf(DependentTag.class));
assertThat(tag.getValue(24d), equalTo("26.4"));
}
@Test
public void shouldHaveHiddenConstructor() {
// given / when / then
TestHelper.validateHasOnlyPrivateEmptyConstructor(TagBuilder.class);
}
}

View File

@ -3,7 +3,7 @@
## AuthMe Configuration
The first time you run AuthMe it will create a config.yml file in the plugins/AuthMe folder,
with which you can configure various settings. This following is the initial contents of
with which you can configure various settings. The following is the initial contents of
the generated config.yml file.
```yml

View File

@ -2,9 +2,8 @@ package tools.docs.translations;
import ch.jalu.configme.resource.PropertyReader;
import ch.jalu.configme.resource.YamlFileReader;
import fr.xephi.authme.message.MessagePathHelper;
import fr.xephi.authme.message.MessageKey;
import tools.utils.ToolsConstants;
import fr.xephi.authme.message.MessagePathHelper;
import java.io.File;
import java.util.ArrayList;
@ -12,13 +11,14 @@ import java.util.Comparator;
import java.util.List;
import static tools.utils.FileIoUtils.listFilesOrThrow;
import static tools.utils.ToolsConstants.MAIN_RESOURCES_ROOT;
/**
* Gathers all available translations of AuthMe.
*/
public class TranslationsGatherer {
private static final String MESSAGES_FOLDER = ToolsConstants.MAIN_RESOURCES_ROOT + MessagePathHelper.MESSAGES_FOLDER;
private static final String MESSAGES_FOLDER = MAIN_RESOURCES_ROOT + MessagePathHelper.MESSAGES_FOLDER;
private List<TranslationInfo> translationInfo = new ArrayList<>();

View File

@ -109,6 +109,12 @@ public class HelpTranslationVerifier {
return commandPaths;
}
/**
* Creates all paths of the properties that are used to define the help translation of the given command definition.
*
* @param command the command to create the paths for
* @return all yaml paths that can be used to translate the command
*/
private List<String> getYamlPaths(CommandDescription command) {
// e.g. commands.authme.register
String commandPath = "commands." + CommandUtils.constructParentList(command).stream()

View File

@ -1,13 +1,12 @@
package tools.messages;
import com.google.common.collect.Multimap;
import fr.xephi.authme.message.MessagePathHelper;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.message.MessagePathHelper;
import fr.xephi.authme.util.StringUtils;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import tools.utils.ToolTask;
import tools.utils.ToolsConstants;
import java.io.File;
import java.util.ArrayList;
@ -19,6 +18,7 @@ import java.util.Set;
import static fr.xephi.authme.message.MessagePathHelper.DEFAULT_MESSAGES_FILE;
import static tools.utils.FileIoUtils.listFilesOrThrow;
import static tools.utils.ToolsConstants.MAIN_RESOURCES_ROOT;
/**
* Task to verify the keys in the messages files.
@ -26,7 +26,7 @@ import static tools.utils.FileIoUtils.listFilesOrThrow;
public final class VerifyMessagesTask implements ToolTask {
/** The folder containing the message files. */
private static final String MESSAGES_FOLDER = ToolsConstants.MAIN_RESOURCES_ROOT + MessagePathHelper.MESSAGES_FOLDER;
private static final String MESSAGES_FOLDER = MAIN_RESOURCES_ROOT + MessagePathHelper.MESSAGES_FOLDER;
@Override
public String getTaskName() {
@ -47,13 +47,14 @@ public final class VerifyMessagesTask implements ToolTask {
if (StringUtils.isEmpty(inputFile)) {
messageFiles = getMessagesFiles();
} else {
File customFile = new File(ToolsConstants.MAIN_RESOURCES_ROOT, MessagePathHelper.createMessageFilePath(inputFile));
File customFile = new File(MAIN_RESOURCES_ROOT, MessagePathHelper.createMessageFilePath(inputFile));
messageFiles = Collections.singletonList(customFile);
}
FileConfiguration defaultFileConfiguration = null;
if (addMissingKeys) {
defaultFileConfiguration = YamlConfiguration.loadConfiguration(new File(ToolsConstants.MAIN_RESOURCES_ROOT, DEFAULT_MESSAGES_FILE));
defaultFileConfiguration = YamlConfiguration.loadConfiguration(
new File(MAIN_RESOURCES_ROOT, DEFAULT_MESSAGES_FILE));
}
// Verify the given files

View File

@ -42,7 +42,7 @@ settings:
maxNicknameLength: 16
# When this setting is enabled, online players can't be kicked out
# due to "Logged in from another Location"
# This setting will prevent potetial security exploits.
# This setting will prevent potential security exploits.
ForceSingleSession: true
ForceSpawnLocOnJoin:
# If enabled, every player will be teleported to the world spawnpoint
@ -61,7 +61,7 @@ settings:
SaveQuitLocation: false
# To activate the restricted user feature you need
# to enable this option and configure the
# AllowedRestrctedUser field.
# AllowedRestrictedUser field.
AllowRestrictedUser: false
# The restricted user feature will kick players listed below
# if they don't match of the defined ip address.
@ -87,7 +87,7 @@ settings:
# After how many time players who fail to login or register
# should be kicked? Set to 0 to disable.
timeout: 30
# Regex sintax of allowed characters in the player name.
# Regex syntax of allowed characters in the player name.
allowedNicknameCharacters: '[a-zA-Z0-9_]*'
# How far can unregistered players walk? Set to 0
# for unlimited radius

View File

@ -0,0 +1,2 @@
# Suppress INFO statements when a new Hikari pool is being created
org.slf4j.simpleLogger.log.com.zaxxer.hikari=WARN