diff --git a/pom.xml b/pom.xml index 7de8a295..937c234b 100644 --- a/pom.xml +++ b/pom.xml @@ -699,7 +699,7 @@ - + com.maxmind.db maxmind-db-gson diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 8731693b..780fcf6a 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -74,9 +74,9 @@ public class AuthMe extends JavaPlugin { private static final int CLEANUP_INTERVAL = 5 * TICKS_PER_MINUTE; // Version and build number values - private static String pluginVersion = "5.6.0-Fork"; + private static String pluginVersion = "5.6.1-Fork"; private static final String pluginBuild = "b"; - private static String pluginBuildNumber = "50"; + private static String pluginBuildNumber = "51"; // Private instances private EmailService emailService; private CommandHandler commandHandler; diff --git a/src/main/java/fr/xephi/authme/process/join/AsynchronousJoin.java b/src/main/java/fr/xephi/authme/process/join/AsynchronousJoin.java index dbfd9df0..424c4989 100644 --- a/src/main/java/fr/xephi/authme/process/join/AsynchronousJoin.java +++ b/src/main/java/fr/xephi/authme/process/join/AsynchronousJoin.java @@ -29,8 +29,6 @@ import fr.xephi.authme.util.PlayerUtils; import org.bukkit.GameMode; import org.bukkit.Server; import org.bukkit.entity.Player; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; import javax.inject.Inject; import java.util.Locale; @@ -208,7 +206,7 @@ public class AsynchronousJoin implements AsynchronousProcess { int blindTimeOut = (registrationTimeout <= 0) ? 99999 : registrationTimeout; // AuthMeReReloaded - Fix potion apply on Folia - bukkitService.runTaskIfFolia(player,() -> player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, blindTimeOut, 2))); + bukkitService.runTaskIfFolia(player, () -> player.addPotionEffect(bukkitService.createBlindnessEffect(blindTimeOut))); } commandManager.runCommandsOnJoin(player); }); diff --git a/src/main/java/fr/xephi/authme/process/logout/ProcessSyncPlayerLogout.java b/src/main/java/fr/xephi/authme/process/logout/ProcessSyncPlayerLogout.java index 6aeed332..96865e21 100644 --- a/src/main/java/fr/xephi/authme/process/logout/ProcessSyncPlayerLogout.java +++ b/src/main/java/fr/xephi/authme/process/logout/ProcessSyncPlayerLogout.java @@ -14,8 +14,6 @@ import fr.xephi.authme.settings.commandconfig.CommandManager; import fr.xephi.authme.settings.properties.RegistrationSettings; import fr.xephi.authme.settings.properties.RestrictionSettings; import org.bukkit.entity.Player; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; import javax.inject.Inject; @@ -75,7 +73,7 @@ public class ProcessSyncPlayerLogout implements SynchronousProcess { // Apply Blindness effect if (service.getProperty(RegistrationSettings.APPLY_BLIND_EFFECT)) { int timeout = service.getProperty(RestrictionSettings.TIMEOUT) * TICKS_PER_SECOND; - player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, timeout, 2)); + player.addPotionEffect(bukkitService.createBlindnessEffect(timeout)); } // Set player's data to unauthenticated diff --git a/src/main/java/fr/xephi/authme/process/unregister/AsynchronousUnregister.java b/src/main/java/fr/xephi/authme/process/unregister/AsynchronousUnregister.java index b69b9930..caecd295 100644 --- a/src/main/java/fr/xephi/authme/process/unregister/AsynchronousUnregister.java +++ b/src/main/java/fr/xephi/authme/process/unregister/AsynchronousUnregister.java @@ -23,8 +23,6 @@ import fr.xephi.authme.settings.properties.RegistrationSettings; import fr.xephi.authme.settings.properties.RestrictionSettings; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; import javax.inject.Inject; @@ -150,7 +148,7 @@ public class AsynchronousUnregister implements AsynchronousProcess { private void applyBlindEffect(Player player) { if (service.getProperty(RegistrationSettings.APPLY_BLIND_EFFECT)) { int timeout = service.getProperty(RestrictionSettings.TIMEOUT) * TICKS_PER_SECOND; - player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, timeout, 2)); + bukkitService.runTaskIfFolia(player, () -> player.addPotionEffect(bukkitService.createBlindnessEffect(timeout))); } } diff --git a/src/main/java/fr/xephi/authme/service/BukkitService.java b/src/main/java/fr/xephi/authme/service/BukkitService.java index d78ea92e..8a899795 100644 --- a/src/main/java/fr/xephi/authme/service/BukkitService.java +++ b/src/main/java/fr/xephi/authme/service/BukkitService.java @@ -18,6 +18,8 @@ import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.event.Event; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; import javax.inject.Inject; import java.util.Collection; @@ -327,6 +329,16 @@ public class BukkitService implements SettingsDependent { return event; } + /** + * Creates a PotionEffect with blindness for the given duration in ticks. + * + * @param timeoutInTicks duration of the effect in ticks + * @return blindness potion effect + */ + public PotionEffect createBlindnessEffect(int timeoutInTicks) { + return new PotionEffect(PotionEffectType.BLINDNESS, timeoutInTicks, 2); + } + /** * Gets the world with the given name. * diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 7219d0b2..6d014c34 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,10 +1,13 @@ +# noinspection YAMLSchemaValidation name: ${pluginDescription.name} +# noinspection YAMLSchemaValidation authors: [${pluginDescription.authors}] website: https://github.com/HaHaWTH/AuthMeReReloaded/ description: A fork of AuthMeReloaded that contains bug fixes +# noinspection YAMLSchemaValidation main: ${pluginDescription.main} folia-supported: true -version: 5.6.0-FORK-b50 +version: 5.6.1-FORK-b51 api-version: 1.13 softdepend: - Vault