Sync with upstream & Bump version number

This commit is contained in:
HaHaWTH 2024-06-27 11:57:17 +08:00
parent 5186d09116
commit 7d255dfa30
7 changed files with 22 additions and 13 deletions

View File

@ -699,7 +699,7 @@
</dependency> </dependency>
<!-- MaxMind GEO IP with our modifications to use GSON in replacement of the big Jackson dependency --> <!-- MaxMind GEO IP with our modifications to use GSON in replacement of the big Jackson dependency -->
<!-- GSON is already included and therefore it reduces the file size in comparison to the original version --> <!-- GSON is already included, and therefore it reduces the file size in comparison to the original version -->
<dependency> <dependency>
<groupId>com.maxmind.db</groupId> <groupId>com.maxmind.db</groupId>
<artifactId>maxmind-db-gson</artifactId> <artifactId>maxmind-db-gson</artifactId>

View File

@ -74,9 +74,9 @@ public class AuthMe extends JavaPlugin {
private static final int CLEANUP_INTERVAL = 5 * TICKS_PER_MINUTE; private static final int CLEANUP_INTERVAL = 5 * TICKS_PER_MINUTE;
// Version and build number values // 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 final String pluginBuild = "b";
private static String pluginBuildNumber = "50"; private static String pluginBuildNumber = "51";
// Private instances // Private instances
private EmailService emailService; private EmailService emailService;
private CommandHandler commandHandler; private CommandHandler commandHandler;

View File

@ -29,8 +29,6 @@ import fr.xephi.authme.util.PlayerUtils;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import javax.inject.Inject; import javax.inject.Inject;
import java.util.Locale; import java.util.Locale;
@ -208,7 +206,7 @@ public class AsynchronousJoin implements AsynchronousProcess {
int blindTimeOut = (registrationTimeout <= 0) ? 99999 : registrationTimeout; int blindTimeOut = (registrationTimeout <= 0) ? 99999 : registrationTimeout;
// AuthMeReReloaded - Fix potion apply on Folia // 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); commandManager.runCommandsOnJoin(player);
}); });

View File

@ -14,8 +14,6 @@ import fr.xephi.authme.settings.commandconfig.CommandManager;
import fr.xephi.authme.settings.properties.RegistrationSettings; import fr.xephi.authme.settings.properties.RegistrationSettings;
import fr.xephi.authme.settings.properties.RestrictionSettings; import fr.xephi.authme.settings.properties.RestrictionSettings;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import javax.inject.Inject; import javax.inject.Inject;
@ -75,7 +73,7 @@ public class ProcessSyncPlayerLogout implements SynchronousProcess {
// Apply Blindness effect // Apply Blindness effect
if (service.getProperty(RegistrationSettings.APPLY_BLIND_EFFECT)) { if (service.getProperty(RegistrationSettings.APPLY_BLIND_EFFECT)) {
int timeout = service.getProperty(RestrictionSettings.TIMEOUT) * TICKS_PER_SECOND; 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 // Set player's data to unauthenticated

View File

@ -23,8 +23,6 @@ import fr.xephi.authme.settings.properties.RegistrationSettings;
import fr.xephi.authme.settings.properties.RestrictionSettings; import fr.xephi.authme.settings.properties.RestrictionSettings;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import javax.inject.Inject; import javax.inject.Inject;
@ -150,7 +148,7 @@ public class AsynchronousUnregister implements AsynchronousProcess {
private void applyBlindEffect(Player player) { private void applyBlindEffect(Player player) {
if (service.getProperty(RegistrationSettings.APPLY_BLIND_EFFECT)) { if (service.getProperty(RegistrationSettings.APPLY_BLIND_EFFECT)) {
int timeout = service.getProperty(RestrictionSettings.TIMEOUT) * TICKS_PER_SECOND; 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)));
} }
} }

View File

@ -18,6 +18,8 @@ import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Event; import org.bukkit.event.Event;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import javax.inject.Inject; import javax.inject.Inject;
import java.util.Collection; import java.util.Collection;
@ -327,6 +329,16 @@ public class BukkitService implements SettingsDependent {
return event; 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. * Gets the world with the given name.
* *

View File

@ -1,10 +1,13 @@
# noinspection YAMLSchemaValidation
name: ${pluginDescription.name} name: ${pluginDescription.name}
# noinspection YAMLSchemaValidation
authors: [${pluginDescription.authors}] authors: [${pluginDescription.authors}]
website: https://github.com/HaHaWTH/AuthMeReReloaded/ website: https://github.com/HaHaWTH/AuthMeReReloaded/
description: A fork of AuthMeReloaded that contains bug fixes description: A fork of AuthMeReloaded that contains bug fixes
# noinspection YAMLSchemaValidation
main: ${pluginDescription.main} main: ${pluginDescription.main}
folia-supported: true folia-supported: true
version: 5.6.0-FORK-b50 version: 5.6.1-FORK-b51
api-version: 1.13 api-version: 1.13
softdepend: softdepend:
- Vault - Vault