mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-11-09 04:02:10 +01:00
commit
876b3858ec
@ -0,0 +1,41 @@
|
||||
package fr.xephi.authme.events;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
*
|
||||
* This event is call when a player try to /login
|
||||
*
|
||||
* @author Xephi59
|
||||
*/
|
||||
public class AuthMeAsyncPreLoginEvent extends Event {
|
||||
|
||||
private Player player;
|
||||
private boolean canLogin = true;
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
public AuthMeAsyncPreLoginEvent(Player player) {
|
||||
super(true);
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
public boolean canLogin() {
|
||||
return canLogin;
|
||||
}
|
||||
|
||||
public void setCanLogin(boolean canLogin) {
|
||||
this.canLogin = canLogin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
}
|
@ -13,6 +13,7 @@ import fr.xephi.authme.cache.auth.PlayerAuth;
|
||||
import fr.xephi.authme.cache.auth.PlayerCache;
|
||||
import fr.xephi.authme.cache.limbo.LimboCache;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.events.AuthMeAsyncPreLoginEvent;
|
||||
import fr.xephi.authme.listener.AuthMePlayerListener;
|
||||
import fr.xephi.authme.security.PasswordSecurity;
|
||||
import fr.xephi.authme.security.RandomString;
|
||||
@ -113,6 +114,10 @@ public class AsyncronousLogin {
|
||||
m.send(player, "vb_nonActiv");
|
||||
return null;
|
||||
}
|
||||
AuthMeAsyncPreLoginEvent event = new AuthMeAsyncPreLoginEvent(player);
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
if (!event.canLogin())
|
||||
return null;
|
||||
return pAuth;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user