mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-12-26 18:47:37 +01:00
Merge please
This commit is contained in:
parent
93484a3449
commit
fda7822644
@ -14,6 +14,8 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
public class LimboCache {
|
public class LimboCache {
|
||||||
@ -117,9 +119,8 @@ public class LimboCache {
|
|||||||
* @param name String
|
* @param name String
|
||||||
*/
|
*/
|
||||||
public void deleteLimboPlayer(String name) {
|
public void deleteLimboPlayer(String name) {
|
||||||
if (name == null)
|
checkNotNull(name);
|
||||||
return;
|
cache.remove(name.toLowerCase());
|
||||||
cache.remove(name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -130,9 +131,8 @@ public class LimboCache {
|
|||||||
* @return LimboPlayer
|
* @return LimboPlayer
|
||||||
*/
|
*/
|
||||||
public LimboPlayer getLimboPlayer(String name) {
|
public LimboPlayer getLimboPlayer(String name) {
|
||||||
if (name == null)
|
checkNotNull(name);
|
||||||
return null;
|
return cache.get(name.toLowerCase());
|
||||||
return cache.get(name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -143,9 +143,8 @@ public class LimboCache {
|
|||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public boolean hasLimboPlayer(String name) {
|
public boolean hasLimboPlayer(String name) {
|
||||||
if (name == null)
|
checkNotNull(name);
|
||||||
return false;
|
return cache.containsKey(name.toLowerCase());
|
||||||
return cache.containsKey(name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -154,9 +153,8 @@ public class LimboCache {
|
|||||||
* @param player Player
|
* @param player Player
|
||||||
*/
|
*/
|
||||||
public void updateLimboPlayer(Player player) {
|
public void updateLimboPlayer(Player player) {
|
||||||
if (this.hasLimboPlayer(player.getName().toLowerCase())) {
|
checkNotNull(player);
|
||||||
this.deleteLimboPlayer(player.getName().toLowerCase());
|
deleteLimboPlayer(player.getName().toLowerCase());
|
||||||
}
|
|
||||||
addLimboPlayer(player);
|
addLimboPlayer(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,10 +9,10 @@ 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.cache.limbo.LimboPlayer;
|
import fr.xephi.authme.cache.limbo.LimboPlayer;
|
||||||
|
import fr.xephi.authme.output.MessageKey;
|
||||||
|
import fr.xephi.authme.output.Messages;
|
||||||
import fr.xephi.authme.permission.PermissionsManager;
|
import fr.xephi.authme.permission.PermissionsManager;
|
||||||
import fr.xephi.authme.permission.UserPermission;
|
import fr.xephi.authme.permission.PlayerPermission;
|
||||||
import fr.xephi.authme.settings.MessageKey;
|
|
||||||
import fr.xephi.authme.settings.Messages;
|
|
||||||
import fr.xephi.authme.settings.Settings;
|
import fr.xephi.authme.settings.Settings;
|
||||||
import fr.xephi.authme.util.GeoLiteAPI;
|
import fr.xephi.authme.util.GeoLiteAPI;
|
||||||
import fr.xephi.authme.util.Utils;
|
import fr.xephi.authme.util.Utils;
|
||||||
@ -32,8 +32,6 @@ import org.bukkit.event.player.*;
|
|||||||
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import static fr.xephi.authme.output.MessageKey.USERNAME_ALREADY_ONLINE_ERROR;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
public class AuthMePlayerListener implements Listener {
|
public class AuthMePlayerListener implements Listener {
|
||||||
@ -169,20 +167,21 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||||
if (event.getPlayer() == null || Utils.isNPC(event.getPlayer())) {
|
if (event.getPlayer() == null || Utils.isNPC(event.getPlayer())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
final String name = player.getName().toLowerCase();
|
String name = player.getName().toLowerCase();
|
||||||
final String joinMsg = event.getJoinMessage();
|
String joinMsg = event.getJoinMessage();
|
||||||
final boolean delay = Settings.delayJoinLeaveMessages && joinMsg != null;
|
boolean delay = Settings.delayJoinLeaveMessages && joinMsg != null;
|
||||||
|
|
||||||
// Remove the join message while the player isn't logging in
|
// Remove the join message while the player isn't logging in
|
||||||
if (delay) {
|
if (delay) {
|
||||||
event.setJoinMessage(null);
|
event.setJoinMessage(null);
|
||||||
|
joinMessage.put(name, joinMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Shedule login task so works after the prelogin
|
// Shedule login task so works after the prelogin
|
||||||
@ -190,9 +189,6 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
Bukkit.getScheduler().runTask(plugin, new Runnable() {
|
Bukkit.getScheduler().runTask(plugin, new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (delay) {
|
|
||||||
joinMessage.put(name, joinMsg);
|
|
||||||
}
|
|
||||||
plugin.getManagement().performJoin(player);
|
plugin.getManagement().performJoin(player);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -453,7 +449,7 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
String name = player.getName().toLowerCase();
|
String name = player.getName().toLowerCase();
|
||||||
Location spawn = plugin.getSpawnLocation(player);
|
Location spawn = plugin.getSpawnLocation(player);
|
||||||
if (Settings.isSaveQuitLocationEnabled && plugin.database.isAuthAvailable(name)) {
|
if (Settings.isSaveQuitLocationEnabled && plugin.database.isAuthAvailable(name)) {
|
||||||
final PlayerAuth auth = new PlayerAuth(name, spawn.getX(), spawn.getY(), spawn.getZ(), spawn.getWorld().getName(), player.getName());
|
PlayerAuth auth = new PlayerAuth(name, spawn.getX(), spawn.getY(), spawn.getZ(), spawn.getWorld().getName(), player.getName());
|
||||||
plugin.database.updateQuitLoc(auth);
|
plugin.database.updateQuitLoc(auth);
|
||||||
}
|
}
|
||||||
if (spawn != null && spawn.getWorld() != null) {
|
if (spawn != null && spawn.getWorld() != null) {
|
||||||
@ -468,7 +464,7 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
if (plugin.getPermissionsManager().hasPermission(player, UserPermission.BYPASS_FORCE_SURVIVAL)) {
|
if (plugin.getPermissionsManager().hasPermission(player, PlayerPermission.BYPASS_FORCE_SURVIVAL)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,10 +5,10 @@ import fr.xephi.authme.ConsoleLogger;
|
|||||||
import fr.xephi.authme.cache.auth.PlayerAuth;
|
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.datasource.DataSource;
|
import fr.xephi.authme.datasource.DataSource;
|
||||||
import fr.xephi.authme.permission.PlayerPermission;
|
|
||||||
import fr.xephi.authme.security.PasswordSecurity;
|
|
||||||
import fr.xephi.authme.output.MessageKey;
|
import fr.xephi.authme.output.MessageKey;
|
||||||
import fr.xephi.authme.output.Messages;
|
import fr.xephi.authme.output.Messages;
|
||||||
|
import fr.xephi.authme.permission.PlayerPermission;
|
||||||
|
import fr.xephi.authme.security.PasswordSecurity;
|
||||||
import fr.xephi.authme.settings.Settings;
|
import fr.xephi.authme.settings.Settings;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ public class AsyncRegister {
|
|||||||
m.send(player, MessageKey.NAME_ALREADY_REGISTERED);
|
m.send(player, MessageKey.NAME_ALREADY_REGISTERED);
|
||||||
return false;
|
return false;
|
||||||
} else if (Settings.getmaxRegPerIp > 0
|
} else if (Settings.getmaxRegPerIp > 0
|
||||||
&& !plugin.getPermissionsManager().hasPermission(player, UserPermission.ALLOW_MULTIPLE_ACCOUNTS)
|
&& !plugin.getPermissionsManager().hasPermission(player, PlayerPermission.ALLOW_MULTIPLE_ACCOUNTS)
|
||||||
&& !ip.equalsIgnoreCase("127.0.0.1")
|
&& !ip.equalsIgnoreCase("127.0.0.1")
|
||||||
&& !ip.equalsIgnoreCase("localhost")
|
&& !ip.equalsIgnoreCase("localhost")
|
||||||
&& database.getAllAuthsByIp(ip).size() >= Settings.getmaxRegPerIp) {
|
&& database.getAllAuthsByIp(ip).size() >= Settings.getmaxRegPerIp) {
|
||||||
@ -89,7 +89,7 @@ public class AsyncRegister {
|
|||||||
|
|
||||||
private void emailRegister() throws Exception {
|
private void emailRegister() throws Exception {
|
||||||
if (Settings.getmaxRegPerEmail > 0
|
if (Settings.getmaxRegPerEmail > 0
|
||||||
&& !plugin.getPermissionsManager().hasPermission(player, UserPermission.ALLOW_MULTIPLE_ACCOUNTS)
|
&& !plugin.getPermissionsManager().hasPermission(player, PlayerPermission.ALLOW_MULTIPLE_ACCOUNTS)
|
||||||
&& database.getAllAuthsByEmail(email).size() >= Settings.getmaxRegPerEmail) {
|
&& database.getAllAuthsByEmail(email).size() >= Settings.getmaxRegPerEmail) {
|
||||||
m.send(player, MessageKey.MAX_REGISTER_EXCEEDED);
|
m.send(player, MessageKey.MAX_REGISTER_EXCEEDED);
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user