mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-11-28 05:05:14 +01:00
Add Third Party PreLogin Event
This commit is contained in:
parent
86e1b8df7c
commit
e1eb22239a
@ -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 AuthMe try to teleport a player
|
||||||
|
*
|
||||||
|
* @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.auth.PlayerCache;
|
||||||
import fr.xephi.authme.cache.limbo.LimboCache;
|
import fr.xephi.authme.cache.limbo.LimboCache;
|
||||||
import fr.xephi.authme.datasource.DataSource;
|
import fr.xephi.authme.datasource.DataSource;
|
||||||
|
import fr.xephi.authme.events.AuthMeAsyncPreLoginEvent;
|
||||||
import fr.xephi.authme.listener.AuthMePlayerListener;
|
import fr.xephi.authme.listener.AuthMePlayerListener;
|
||||||
import fr.xephi.authme.security.PasswordSecurity;
|
import fr.xephi.authme.security.PasswordSecurity;
|
||||||
import fr.xephi.authme.security.RandomString;
|
import fr.xephi.authme.security.RandomString;
|
||||||
@ -113,6 +114,10 @@ public class AsyncronousLogin {
|
|||||||
m.send(player, "vb_nonActiv");
|
m.send(player, "vb_nonActiv");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
AuthMeAsyncPreLoginEvent event = new AuthMeAsyncPreLoginEvent(player);
|
||||||
|
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||||
|
if (!event.canLogin())
|
||||||
|
return null;
|
||||||
return pAuth;
|
return pAuth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user