diff --git a/.github/dependabot.yml b/.github/dependabot.yml index a5e98502f..da58b8db3 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -9,8 +9,8 @@ updates: - dependency-name: com.google.code.gson:gson - dependency-name: com.google.guava:guava - dependency-name: org.apache.logging.log4j:log4j-core - - dependency-name: com.zaxxer:HikariCP - - dependency-name: "org.mockito:mockito-core" # Mockito 5 requires Java 11 + - dependency-name: "org.mockito:mockito-core" versions: ">= 5" + - dependency-name: ch.jalu:configme - dependency-name: "org.slf4j:slf4j-simple" versions: ">= 1.7.36" diff --git a/.travis.yml b/.travis.yml index 7ca0e106e..e380fd20a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,12 +4,8 @@ language: java matrix: include: - - env: - - JDK_VERSION=8 - env: - JDK_VERSION=11 - - env: - - JDK_VERSION=17 before_install: - "[[ -d $HOME/.sdkman/ ]] && [[ -d $HOME/.sdkman/bin/ ]] || rm -rf $HOME/.sdkman/" diff --git a/pom.xml b/pom.xml index 31343c8fb..80323f5a4 100644 --- a/pom.xml +++ b/pom.xml @@ -60,14 +60,11 @@ UTF-8 UTF-8 - 1.8 - 1.8 - 8 - 11 - 3.6.3 - - - 1.21.1-R0.1-SNAPSHOT + 17 + 17 + 17 + 17 + 3.8.8 AuthMe @@ -80,13 +77,43 @@ ${project.versionCode} ${project.groupId}.${project.artifactId}.${pluginDescription.name} sgdc3, games647, Hex3l, krusic22 + + + 1.0 + 1.0.0 + 4.2.0 + 2.5 + 1.6.0 + 5.1.0 + 2.0.13 + 0.1.2 + 8.4.0 + 3.4.0 + 42.7.3 + 1.1.4 + 2.11 + 0.10.2 + 1.5.0 + 1.3.1 + + 1.21.1-R0.1-SNAPSHOT + 2.20.0 + + 3.0.2 + + 4.17.0 + 4.3.4 + clean package - + + . @@ -139,7 +166,7 @@ ${maven.minimumVersion} - [17,) + [${java.compiler.minimumVersion},) true @@ -180,6 +207,12 @@ org.jacoco jacoco-maven-plugin 0.8.12 + + + fr/xephi/authme/* + fr/xephi/authme/**/* + + pre-unit-test @@ -215,7 +248,7 @@ ${project.finalNameBase} - 8 + ${java.source} @@ -257,31 +290,7 @@ ${project.finalNameBase}-Lite - - - - com.google.guava:guava - com.google.guava:failureaccess - com.google.guava:listenablefuture - com.google.errorprone:error_prone_annotations - com.google.j2objc:j2objc-annotations - - com.google.code.gson:gson - - - - org.apache.http - fr.xephi.authme.libs.org.apache.http - - - org.apache.commons - fr.xephi.authme.libs.org.apache.commons - - - waffle - fr.xephi.authme.libs.waffle - com.github.benmanes.caffeine fr.xephi.authme.libs.com.github.benmanes.caffeine @@ -308,38 +317,6 @@ ${project.finalNameBase}-Universal - - com.google.common - fr.xephi.authme.libs.com.google.common - - - com.google.thirdparty - fr.xephi.authme.libs.com.google.thirdparty - - - com.google.j2objc - fr.xephi.authme.libs.com.google.j2objc - - - com.google.errorprone - fr.xephi.authme.libs.com.google.errorprone - - - com.google.gson - fr.xephi.authme.libs.com.google.gson - - - org.apache.http - fr.xephi.authme.libs.org.apache.http - - - org.apache.commons - fr.xephi.authme.libs.org.apache.commons - - - waffle - fr.xephi.authme.libs.waffle - com.github.benmanes.caffeine fr.xephi.authme.libs.com.github.benmanes.caffeine @@ -361,111 +338,14 @@ than already loaded libs --> - - ch.jalu - fr.xephi.authme.libs.ch.jalu - - - com.zaxxer.hikari - fr.xephi.authme.libs.com.zaxxer.hikari - - - org.slf4j - fr.xephi.authme.libs.org.slf4j - - - com.maxmind.db - fr.xephi.authme.libs.com.maxmind.db - - - com.ice.tar - fr.xephi.authme.libs.com.icetar.tar - - - net.ricecode.similarity - fr.xephi.authme.libs.ricecode.net.ricecode.similarity - - - de.rtner - fr.xephi.authme.libs.de.rtner - - - org.picketbox - fr.xephi.authme.libs.org.picketbox - - - org.jboss.crypto - fr.xephi.authme.libs.org.jboss.crypto - - - org.jboss.security - fr.xephi.authme.libs.org.jboss.security - - - de.mkammerer - fr.xephi.authme.libs.de.mkammerer - - - com.warrenstrange - fr.xephi.authme.libs.com.warrenstrange - - - javax.inject - fr.xephi.authme.libs.javax.inject - - - at.favre.lib - fr.xephi.authme.libs.at.favre.lib - - - org.postgresql - fr.xephi.authme.libs.org.postgresql - - - - org.bstats - fr.xephi.authme.libs.org.bstats - - - org.mariadb.jdbc - fr.xephi.authme.libs.org.mariadb.jdbc - com.github.Anon8281.universalScheduler fr.xephi.authme.libs.com.github.Anon8281.universalScheduler - - com.mysql - fr.xephi.authme.libs.com.mysql - - - com.google.protobuf - fr.xephi.authme.libs.com.google.protobuf - - - io.netty - fr.xephi.authme.libs.io.netty - - - org.apache.commons.validator - fr.xephi.authme.libs.org.apache.commons.validator - com.alessiodp.libby fr.xephi.authme.libs.com.alessiodp.libby - - net.kyori.adventure - fr.xephi.authme.libs.net.kyori.adventure - - - net.kyori.examination - fr.xephi.authme.libs.net.kyori.examination - - - net.kyori.option - fr.xephi.authme.libs.net.kyori.option - @@ -642,6 +522,13 @@ + + + alessiodp-repo-snapshots + AlessioDP Maven Repository + https://repo.alessiodp.com/snapshots + + opencollab-snapshot https://repo.opencollab.dev/maven-snapshots/ @@ -685,46 +572,31 @@ net.ricecode string-similarity - 1.0.0 - true + ${dependencies.string-similarity.version} + provided - - + - com.maxmind.db - maxmind-db-gson - 2.0.3 - true - - - com.google.code.gson - gson - - + com.maxmind.geoip2 + geoip2 + ${dependencies.geoip2.version} + provided javatar javatar - 2.5 - true + ${dependencies.javatar.version} + provided org.apache.commons commons-email - 1.6-SNAPSHOT - true - - - - - org.apache.logging.log4j - log4j-core - 2.20.0 + ${dependencies.commons-email.version} provided @@ -740,84 +612,60 @@ com.zaxxer HikariCP - 4.0.3 - true + ${dependencies.hikaricp.version} + provided - slf4j-api org.slf4j + slf4j-api - org.slf4j slf4j-simple - 1.7.36 - true + ${dependencies.slf4j.version} + provided - + - de.rtner - PBKDF2 - 1.1.4 - true + ch.jalu + datasourcecolumns + ${dependencies.datasourcecolumns.version} + provided - + com.mysql mysql-connector-j - 8.0.33 - true + ${dependencies.mysql-connector-j.version} + provided org.mariadb.jdbc mariadb-java-client - 3.3.3 - true - - - - - de.mkammerer - argon2-jvm-nolibs - 2.11 - true - - - - - com.warrenstrange - googleauth - 1.5.0 - true - - - - - org.spigotmc - spigot-api - ${spigot.version} + ${dependencies.mariadb-java-client.version} provided - junit - junit + org.checkerframework + checker-qual - com.googlecode.json-simple - json-simple + com.google.errorprone + error_prone_annotations - + + - com.google.guava - guava - 31.1-jre - true + org.postgresql + postgresql + ${dependencies.postgresql.version} + provided org.checkerframework @@ -825,20 +673,45 @@ - + + - com.google.code.gson - gson - 2.10.1 - true + de.rtner + PBKDF2 + ${dependencies.pbkdf2.version} + provided + + + + + de.mkammerer + argon2-jvm-nolibs + ${dependencies.argon2-jvm-nolibs.version} + provided + + + + + at.favre.lib + bcrypt + ${dependencies.bcrypt.version} + provided + + + + + com.warrenstrange + googleauth + ${dependencies.googleauth.version} + provided ch.jalu configme - 1.3.1 - true + ${dependencies.configme.version} + provided org.yaml @@ -847,19 +720,45 @@ + + + org.spigotmc + spigot-api + ${dependencies.spigot.version} + provided + + + org.joml + joml + + + net.md-5 + bungeecord-chat + + + + + org.apache.logging.log4j + log4j-core + ${dependencies.log4j-core.version} + provided + + + + org.bstats bstats-bukkit - 3.0.2 - true + ${dependencies.bstats.version} + provided - com.comphenix.protocol + net.dmulloy2 ProtocolLib - 5.1.0 + 5.4.0 provided @@ -881,17 +780,20 @@ net.kyori adventure-text-minimessage - 4.17.0 + ${dependencies.adventure.version} + provided net.kyori adventure-platform-bukkit - 4.3.4 + ${dependencies.adventure-platform.version} + provided net.kyori adventure-text-serializer-gson - 4.17.0 + ${dependencies.adventure.version} + provided @@ -970,7 +872,7 @@ com.onarandombox.multiversecore multiverse-core - 4.3.14 + 4.3.16 jar provided @@ -1087,14 +989,6 @@ - - - at.favre.lib - bcrypt - 0.10.2 - true - - de.luricos.bukkit @@ -1103,26 +997,6 @@ provided - - ch.jalu - datasourcecolumns - 0.1.1-SNAPSHOT - true - - - - org.postgresql - postgresql - 42.7.3 - true - - - org.checkerframework - checker-qual - - - - org.checkerframework @@ -1145,11 +1019,17 @@ sqlite-jdbc 3.47.1.0 test + + + org.slf4j + slf4j-api + + com.h2database h2 - 2.2.224 + 2.4.240 provided diff --git a/src/main/java/fr/xephi/authme/initialization/OnStartupTasks.java b/src/main/java/fr/xephi/authme/initialization/OnStartupTasks.java index 705f3bcc1..f80ce09de 100644 --- a/src/main/java/fr/xephi/authme/initialization/OnStartupTasks.java +++ b/src/main/java/fr/xephi/authme/initialization/OnStartupTasks.java @@ -32,7 +32,7 @@ */ public class OnStartupTasks { - private static ConsoleLogger consoleLogger = ConsoleLoggerFactory.get(OnStartupTasks.class); + private static final ConsoleLogger consoleLogger = ConsoleLoggerFactory.get(OnStartupTasks.class); @Inject private DataSource dataSource; @@ -53,6 +53,8 @@ public class OnStartupTasks { * @param settings the settings */ public static void sendMetrics(AuthMe plugin, Settings settings) { + // We do not relocate as the library is downloaded at runtime + System.setProperty("bstats.relocatecheck", "false"); final Metrics metrics = new Metrics(plugin, 18479); metrics.addCustomChart(new SimplePie("messages_language", diff --git a/src/main/java/fr/xephi/authme/listener/protocollib/InventoryPacketAdapter.java b/src/main/java/fr/xephi/authme/listener/protocollib/InventoryPacketAdapter.java index c83b992ba..9a73a5128 100644 --- a/src/main/java/fr/xephi/authme/listener/protocollib/InventoryPacketAdapter.java +++ b/src/main/java/fr/xephi/authme/listener/protocollib/InventoryPacketAdapter.java @@ -40,7 +40,7 @@ class InventoryPacketAdapter extends PacketAdapter { private static final int PLAYER_INVENTORY = 0; - // http://wiki.vg/Inventory#Inventory (0-4 crafting, 5-8 armor, 9-35 main inventory, 36-44 hotbar, 45 off hand) + // http://wiki.vg/Inventory#Inventory (0-4 crafting, 5-8 armor, 9-35 main inventory, 36-44 hotbar, 45 off-hand) // +1 because an index starts with 0 private static final int CRAFTING_SIZE = 5; private static final int ARMOR_SIZE = 4; diff --git a/src/main/java/fr/xephi/authme/process/login/ProcessSyncPlayerLogin.java b/src/main/java/fr/xephi/authme/process/login/ProcessSyncPlayerLogin.java index ac022405d..30d686199 100644 --- a/src/main/java/fr/xephi/authme/process/login/ProcessSyncPlayerLogin.java +++ b/src/main/java/fr/xephi/authme/process/login/ProcessSyncPlayerLogin.java @@ -93,11 +93,9 @@ public void processPlayerLogin(Player player, boolean isFirstLogin, List final PlayerAuth auth = playerCache.getAuth(name); - // AuthMeReReloaded start - Fix #57 - if (isFirstLogin) { + if (isFirstLogin) { // Save quit location before login teleport auth.setQuitLocation(player.getLocation()); } - // AuthMeReReloaded end - Fix #57 teleportationService.teleportOnLogin(player, auth, limbo); diff --git a/src/main/java/fr/xephi/authme/process/quit/ProcessSyncPlayerQuit.java b/src/main/java/fr/xephi/authme/process/quit/ProcessSyncPlayerQuit.java index 41e713e83..5f6fb2d9e 100644 --- a/src/main/java/fr/xephi/authme/process/quit/ProcessSyncPlayerQuit.java +++ b/src/main/java/fr/xephi/authme/process/quit/ProcessSyncPlayerQuit.java @@ -28,9 +28,6 @@ public void processSyncQuit(Player player, boolean wasLoggedIn) { commandManager.runCommandsOnLogout(player); } else { limboService.restoreData(player); - if (!UniversalScheduler.isFolia) { // AuthMeReReloaded - Fix #146 (Very stupid solution, but works) - // player.saveData(); // #1238: Speed is sometimes not restored properly - } } player.leaveVehicle(); } diff --git a/src/main/java/fr/xephi/authme/service/GeoIpService.java b/src/main/java/fr/xephi/authme/service/GeoIpService.java index f18a85fa3..a71cfdb87 100644 --- a/src/main/java/fr/xephi/authme/service/GeoIpService.java +++ b/src/main/java/fr/xephi/authme/service/GeoIpService.java @@ -1,12 +1,12 @@ package fr.xephi.authme.service; import com.google.common.annotations.VisibleForTesting; -import com.maxmind.db.GeoIp2Provider; -import com.maxmind.db.Reader; +import com.maxmind.db.CHMCache; import com.maxmind.db.Reader.FileMode; -import com.maxmind.db.cache.CHMCache; -import com.maxmind.db.model.Country; -import com.maxmind.db.model.CountryResponse; +import com.maxmind.geoip2.DatabaseReader; +import com.maxmind.geoip2.exception.GeoIp2Exception; +import com.maxmind.geoip2.model.AbstractCountryResponse; +import com.maxmind.geoip2.record.Country; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.initialization.DataFolder; import fr.xephi.authme.output.ConsoleLoggerFactory; @@ -33,19 +33,19 @@ public class GeoIpService { private final ConsoleLogger logger = ConsoleLoggerFactory.get(GeoIpService.class); private final Path dataFile; - private GeoIp2Provider databaseReader; + private DatabaseReader databaseReader; private volatile boolean downloading; @Inject - GeoIpService(@DataFolder File dataFolder) { + public GeoIpService(@DataFolder File dataFolder) { this.dataFile = dataFolder.toPath().resolve(DATABASE_FILE); - // Fires download of recent data or the initialization of the look up service + // Fires download of recent data or the initialization of the look-up service isDataAvailable(); } @VisibleForTesting - GeoIpService(@DataFolder File dataFolder, GeoIp2Provider reader) { + GeoIpService(@DataFolder File dataFolder, DatabaseReader reader) { this.dataFile = dataFolder.toPath().resolve(DATABASE_FILE); this.databaseReader = reader; @@ -87,14 +87,17 @@ private synchronized boolean isDataAvailable() { */ private void startReading() throws IOException { - databaseReader = new Reader(dataFile.toFile(), FileMode.MEMORY, new CHMCache()); + databaseReader = new DatabaseReader.Builder(dataFile.toFile()) + .withCache(new CHMCache()) + .fileMode(FileMode.MEMORY) + .build(); // clear downloading flag, because we now have working reader instance downloading = false; } /** - * Downloads the archive to the destination file if it's newer than the locally version. + * Downloads the archive to the destination file if it's newer than the local version. * * @param lastModified modification timestamp of the already present file * @param destination save file @@ -103,7 +106,7 @@ private void startReading() throws IOException { */ /** - * Downloads the archive to the destination file if it's newer than the locally version. + * Downloads the archive to the destination file if it's newer than the local version. * * @param destination save file * @return null if no updates were found, the MD5 hash of the downloaded archive if successful @@ -175,11 +178,11 @@ private Optional getCountry(String ip) { InetAddress address = InetAddress.getByName(ip); // Reader.getCountry() can be null for unknown addresses - return Optional.ofNullable(databaseReader.getCountry(address)).map(CountryResponse::getCountry); + return Optional.ofNullable(databaseReader.country(address)).map(AbstractCountryResponse::getCountry); } catch (UnknownHostException e) { // Ignore invalid ip addresses // Legacy GEO IP Database returned a unknown country object with Country-Code: '--' and Country-Name: 'N/A' - } catch (IOException ioEx) { + } catch (GeoIp2Exception | IOException ioEx) { logger.logException("Cannot lookup country for " + ip + " at GEO IP database", ioEx); } diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 7203312c3..fc4679547 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -21,6 +21,27 @@ softdepend: - ProtocolLib - floodgate - PlaceholderAPI +libraries: + - ch.jalu:injector:${dependencies.injector.version} + - net.ricecode:string-similarity:${dependencies.string-similarity.version} + - com.maxmind.geoip2:geoip2:${dependencies.geoip2.version} + - javatar:javatar:${dependencies.javatar.version} + - org.apache.commons:commons-email:${dependencies.commons-email.version} + - com.zaxxer:HikariCP:${dependencies.hikaricp.version} + - org.slf4j:slf4j-simple:${dependencies.slf4j.version} + - ch.jalu:datasourcecolumns:${dependencies.datasourcecolumns.version} + - com.mysql:mysql-connector-j:${dependencies.mysql-connector-j.version} + - org.mariadb.jdbc:mariadb-java-client:${dependencies.mariadb-java-client.version} + - org.postgresql:postgresql:${dependencies.postgresql.version} + - de.rtner:PBKDF2:${dependencies.pbkdf2.version} + - de.mkammerer:argon2-jvm-nolibs:${dependencies.argon2-jvm-nolibs.version} + - at.favre.lib:bcrypt:${dependencies.bcrypt.version} + - com.warrenstrange:googleauth:${dependencies.googleauth.version} + - ch.jalu:configme:${dependencies.configme.version} + - org.bstats:bstats-bukkit:${dependencies.bstats.version} + - net.kyori:adventure-text-minimessage:${dependencies.adventure.version} + - net.kyori:adventure-platform-bukkit:${dependencies.adventure-platform.version} + - net.kyori:adventure-text-serializer-gson:${dependencies.adventure.version} commands: authme: description: AuthMe op commands