Run non-thread-safe addPotionEffect sync on unregister (Fixes #828)
This commit is contained in:
parent
42ef99cf15
commit
6be58ee2e2
@ -14,7 +14,9 @@ import fr.xephi.authme.settings.Settings;
|
|||||||
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 fr.xephi.authme.task.PlayerDataTaskManager;
|
import fr.xephi.authme.task.PlayerDataTaskManager;
|
||||||
|
import fr.xephi.authme.util.BukkitService;
|
||||||
import fr.xephi.authme.util.TeleportationService;
|
import fr.xephi.authme.util.TeleportationService;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
@ -37,6 +39,9 @@ public class AsynchronousUnregister implements AsynchronousProcess {
|
|||||||
@Inject
|
@Inject
|
||||||
private PlayerCache playerCache;
|
private PlayerCache playerCache;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private BukkitService bukktiService;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private LimboCache limboCache;
|
private LimboCache limboCache;
|
||||||
|
|
||||||
@ -49,7 +54,7 @@ public class AsynchronousUnregister implements AsynchronousProcess {
|
|||||||
AsynchronousUnregister() { }
|
AsynchronousUnregister() { }
|
||||||
|
|
||||||
|
|
||||||
public void unregister(Player player, String password, boolean force) {
|
public void unregister(final Player player, String password, boolean force) {
|
||||||
final String name = player.getName().toLowerCase();
|
final String name = player.getName().toLowerCase();
|
||||||
PlayerAuth cachedAuth = playerCache.getAuth(name);
|
PlayerAuth cachedAuth = playerCache.getAuth(name);
|
||||||
if (force || passwordSecurity.comparePassword(password, cachedAuth.getPassword(), player.getName())) {
|
if (force || passwordSecurity.comparePassword(password, cachedAuth.getPassword(), player.getName())) {
|
||||||
@ -80,10 +85,16 @@ public class AsynchronousUnregister implements AsynchronousProcess {
|
|||||||
playerCache.removePlayer(name);
|
playerCache.removePlayer(name);
|
||||||
|
|
||||||
// Apply blind effect
|
// Apply blind effect
|
||||||
int timeout = service.getProperty(RestrictionSettings.TIMEOUT) * TICKS_PER_SECOND;
|
final int timeout = service.getProperty(RestrictionSettings.TIMEOUT) * TICKS_PER_SECOND;
|
||||||
if (service.getProperty(RegistrationSettings.APPLY_BLIND_EFFECT)) {
|
bukktiService.runTask(new Runnable() {
|
||||||
player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, timeout, 2));
|
@Override
|
||||||
}
|
public void run() {
|
||||||
|
if (service.getProperty(RegistrationSettings.APPLY_BLIND_EFFECT)) {
|
||||||
|
player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, timeout, 2));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
service.send(player, MessageKey.UNREGISTERED_SUCCESS);
|
service.send(player, MessageKey.UNREGISTERED_SUCCESS);
|
||||||
ConsoleLogger.info(player.getName() + " unregistered himself");
|
ConsoleLogger.info(player.getName() + " unregistered himself");
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -12,7 +12,7 @@ login: '&aConnexion effectuée !'
|
|||||||
vb_nonActiv: '&fCe compte n''est pas actif, consultez vos emails !'
|
vb_nonActiv: '&fCe compte n''est pas actif, consultez vos emails !'
|
||||||
user_regged: '&cCe nom est déjà utilisé.'
|
user_regged: '&cCe nom est déjà utilisé.'
|
||||||
usage_reg: '&cUtilisez la commande /register motdepasse confirmermotdepasse'
|
usage_reg: '&cUtilisez la commande /register motdepasse confirmermotdepasse'
|
||||||
# TODO max_reg: Missing tag %reg_count
|
# TODO max_reg: Missing tag %reg_count
|
||||||
max_reg: '&cVous ne pouvez pas enregistrer plus de %max_acc compte(s). &o(Compte(s): %reg_names)'
|
max_reg: '&cVous ne pouvez pas enregistrer plus de %max_acc compte(s). &o(Compte(s): %reg_names)'
|
||||||
no_perm: '&cVous n''avez pas la permission.'
|
no_perm: '&cVous n''avez pas la permission.'
|
||||||
password_error_nick: '&fTu ne peux pas utiliser ton pseudo comme mot de passe.'
|
password_error_nick: '&fTu ne peux pas utiliser ton pseudo comme mot de passe.'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user