mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-11-27 12:45:57 +01:00
add getPlayer method into Utils class
This commit is contained in:
parent
3e1c7edb2d
commit
9a79332933
@ -225,10 +225,10 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onPreLogin(AsyncPlayerPreLoginEvent event) {
|
public void onPreLogin(AsyncPlayerPreLoginEvent event) {
|
||||||
final String name = event.getName().toLowerCase();
|
final String name = event.getName().toLowerCase();
|
||||||
@SuppressWarnings("deprecation")
|
final Player player = Utils.getPlayer(name);
|
||||||
final Player player = plugin.getServer().getPlayer(name);
|
if (player == null) {
|
||||||
if (player == null)
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Check if forceSingleSession is set to true, so kick player that has
|
// Check if forceSingleSession is set to true, so kick player that has
|
||||||
// joined with same nick of online player
|
// joined with same nick of online player
|
||||||
|
@ -273,6 +273,12 @@ public class Utils {
|
|||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
public static Player getPlayer(String name) {
|
||||||
|
name = name.toLowerCase();
|
||||||
|
return plugin.getServer().getPlayer(name);
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean isNPC(final Entity player) {
|
public static boolean isNPC(final Entity player) {
|
||||||
try {
|
try {
|
||||||
if (player.hasMetadata("NPC")) {
|
if (player.hasMetadata("NPC")) {
|
||||||
|
Loading…
Reference in New Issue
Block a user