mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-11-04 09:40:05 +01:00
Some fixs
This commit is contained in:
parent
2d148860d5
commit
fba07fa7e5
@ -71,7 +71,7 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
public AuthMe plugin;
|
public AuthMe plugin;
|
||||||
private DataSource data;
|
private DataSource data;
|
||||||
private FileCache playerBackup;
|
private FileCache playerBackup;
|
||||||
public boolean causeByAuthMe = false;
|
public static HashMap<String, Boolean> causeByAuthMe = new HashMap<String, Boolean>();
|
||||||
private HashMap<String, PlayerLoginEvent> antibot = new HashMap<String, PlayerLoginEvent>();
|
private HashMap<String, PlayerLoginEvent> antibot = new HashMap<String, PlayerLoginEvent>();
|
||||||
|
|
||||||
public AuthMePlayerListener(AuthMe plugin, DataSource data) {
|
public AuthMePlayerListener(AuthMe plugin, DataSource data) {
|
||||||
@ -369,11 +369,12 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
int radius = Settings.getMovementRadius;
|
int radius = Settings.getMovementRadius;
|
||||||
Location spawn = plugin.getSpawnLocation(player);
|
Location spawn = plugin.getSpawnLocation(player);
|
||||||
|
|
||||||
if (!event.getPlayer().getWorld().equals(spawn.getWorld())) {
|
if (spawn != null && spawn.getWorld() != null)
|
||||||
event.getPlayer().teleport(spawn);
|
if (!event.getPlayer().getWorld().equals(spawn.getWorld())) {
|
||||||
return;
|
event.getPlayer().teleport(spawn);
|
||||||
}
|
return;
|
||||||
if ((spawn.distance(player.getLocation()) > radius)) {
|
}
|
||||||
|
if ((spawn.distance(player.getLocation()) > radius) && spawn.getWorld() != null) {
|
||||||
event.getPlayer().teleport(spawn);
|
event.getPlayer().teleport(spawn);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -583,9 +584,9 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
String ip = plugin.getIP(player);
|
String ip = plugin.getIP(player);
|
||||||
if (Settings.isAllowRestrictedIp && !Settings.getRestrictedIp(name, ip)) {
|
if (Settings.isAllowRestrictedIp && !Settings.getRestrictedIp(name, ip)) {
|
||||||
GameMode gM = gameMode.get(name);
|
GameMode gM = gameMode.get(name);
|
||||||
this.causeByAuthMe = true;
|
causeByAuthMe.put(name, true);
|
||||||
player.setGameMode(gM);
|
player.setGameMode(gM);
|
||||||
this.causeByAuthMe = false;
|
causeByAuthMe.put(name, false);
|
||||||
player.kickPlayer("You are not the Owner of this account, please try another name!");
|
player.kickPlayer("You are not the Owner of this account, please try another name!");
|
||||||
if (Settings.banUnsafeIp)
|
if (Settings.banUnsafeIp)
|
||||||
plugin.getServer().banIP(ip);
|
plugin.getServer().banIP(ip);
|
||||||
@ -618,25 +619,25 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
} else if (!Settings.sessionExpireOnIpChange) {
|
} else if (!Settings.sessionExpireOnIpChange) {
|
||||||
GameMode gM = gameMode.get(name);
|
GameMode gM = gameMode.get(name);
|
||||||
this.causeByAuthMe = true;
|
causeByAuthMe.put(name, true);
|
||||||
player.setGameMode(gM);
|
player.setGameMode(gM);
|
||||||
this.causeByAuthMe = false;
|
causeByAuthMe.put(name, false);
|
||||||
player.kickPlayer(m._("unvalid_session")[0]);
|
player.kickPlayer(m._("unvalid_session")[0]);
|
||||||
return;
|
return;
|
||||||
} else if (auth.getNickname().equalsIgnoreCase(name)) {
|
} else if (auth.getNickname().equalsIgnoreCase(name)) {
|
||||||
if (Settings.isForceSurvivalModeEnabled && !Settings.forceOnlyAfterLogin) {
|
if (Settings.isForceSurvivalModeEnabled && !Settings.forceOnlyAfterLogin) {
|
||||||
this.causeByAuthMe = true;
|
causeByAuthMe.put(name, true);
|
||||||
Utils.forceGM(player);
|
Utils.forceGM(player);
|
||||||
this.causeByAuthMe = false;
|
causeByAuthMe.put(name, false);
|
||||||
}
|
}
|
||||||
// Player change his IP between 2 relog-in
|
// Player change his IP between 2 relog-in
|
||||||
PlayerCache.getInstance().removePlayer(name);
|
PlayerCache.getInstance().removePlayer(name);
|
||||||
data.setUnlogged(name);
|
data.setUnlogged(name);
|
||||||
} else {
|
} else {
|
||||||
GameMode gM = gameMode.get(name);
|
GameMode gM = gameMode.get(name);
|
||||||
this.causeByAuthMe = true;
|
causeByAuthMe.put(name, true);
|
||||||
player.setGameMode(gM);
|
player.setGameMode(gM);
|
||||||
this.causeByAuthMe = false;
|
causeByAuthMe.put(name, false);
|
||||||
player.kickPlayer(m._("unvalid_session")[0]);
|
player.kickPlayer(m._("unvalid_session")[0]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -648,9 +649,9 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
// isent in session or session was ended correctly
|
// isent in session or session was ended correctly
|
||||||
if (Settings.isForceSurvivalModeEnabled && !Settings.forceOnlyAfterLogin) {
|
if (Settings.isForceSurvivalModeEnabled && !Settings.forceOnlyAfterLogin) {
|
||||||
this.causeByAuthMe = true;
|
causeByAuthMe.put(name, true);
|
||||||
Utils.forceGM(player);
|
Utils.forceGM(player);
|
||||||
this.causeByAuthMe = false;
|
causeByAuthMe.put(name, false);
|
||||||
}
|
}
|
||||||
if (!Settings.noTeleport)
|
if (!Settings.noTeleport)
|
||||||
if (Settings.isTeleportToSpawnEnabled || (Settings.isForceSpawnLocOnJoinEnabled && Settings.getForcedWorlds.contains(player.getWorld().getName()))) {
|
if (Settings.isTeleportToSpawnEnabled || (Settings.isForceSpawnLocOnJoinEnabled && Settings.getForcedWorlds.contains(player.getWorld().getName()))) {
|
||||||
@ -658,7 +659,8 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
plugin.getServer().getPluginManager().callEvent(tpEvent);
|
plugin.getServer().getPluginManager().callEvent(tpEvent);
|
||||||
if (!tpEvent.isCancelled()) {
|
if (!tpEvent.isCancelled()) {
|
||||||
if (player != null && player.isOnline() && tpEvent.getTo() != null) {
|
if (player != null && player.isOnline() && tpEvent.getTo() != null) {
|
||||||
player.teleport(tpEvent.getTo());
|
if (tpEvent.getTo().getWorld() != null)
|
||||||
|
player.teleport(tpEvent.getTo());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -668,9 +670,9 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
playerBackup.createCache(player, dataFile, LimboCache.getInstance().getLimboPlayer(name).getGroup(), LimboCache.getInstance().getLimboPlayer(name).getOperator(), LimboCache.getInstance().getLimboPlayer(name).isFlying());
|
playerBackup.createCache(player, dataFile, LimboCache.getInstance().getLimboPlayer(name).getGroup(), LimboCache.getInstance().getLimboPlayer(name).getOperator(), LimboCache.getInstance().getLimboPlayer(name).isFlying());
|
||||||
} else {
|
} else {
|
||||||
if (Settings.isForceSurvivalModeEnabled && !Settings.forceOnlyAfterLogin) {
|
if (Settings.isForceSurvivalModeEnabled && !Settings.forceOnlyAfterLogin) {
|
||||||
this.causeByAuthMe = true;
|
causeByAuthMe.put(name, true);
|
||||||
Utils.forceGM(player);
|
Utils.forceGM(player);
|
||||||
this.causeByAuthMe = false;
|
causeByAuthMe.put(name, false);
|
||||||
}
|
}
|
||||||
if (!Settings.unRegisteredGroup.isEmpty()) {
|
if (!Settings.unRegisteredGroup.isEmpty()) {
|
||||||
utils.setGroup(player, Utils.groupType.UNREGISTERED);
|
utils.setGroup(player, Utils.groupType.UNREGISTERED);
|
||||||
@ -681,7 +683,8 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
plugin.getServer().getPluginManager().callEvent(tpEvent);
|
plugin.getServer().getPluginManager().callEvent(tpEvent);
|
||||||
if (!tpEvent.isCancelled()) {
|
if (!tpEvent.isCancelled()) {
|
||||||
if (player != null && player.isOnline() && tpEvent.getTo() != null) {
|
if (player != null && player.isOnline() && tpEvent.getTo() != null) {
|
||||||
player.teleport(tpEvent.getTo());
|
if (tpEvent.getTo().getWorld() != null)
|
||||||
|
player.teleport(tpEvent.getTo());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -754,13 +757,15 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
Block b = player.getLocation().getBlock();
|
Block b = player.getLocation().getBlock();
|
||||||
if (b.getType() == Material.PORTAL || b.getType() == Material.ENDER_PORTAL || b.getType() == Material.LAVA || b.getType() == Material.STATIONARY_LAVA) {
|
if (b.getType() == Material.PORTAL || b.getType() == Material.ENDER_PORTAL || b.getType() == Material.LAVA || b.getType() == Material.STATIONARY_LAVA) {
|
||||||
m._(player, "unsafe_spawn");
|
m._(player, "unsafe_spawn");
|
||||||
player.teleport(spawnLoc);
|
if (spawnLoc.getWorld() != null)
|
||||||
|
player.teleport(spawnLoc);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Block c = player.getLocation().add(0D, 1D, 0D).getBlock();
|
Block c = player.getLocation().add(0D, 1D, 0D).getBlock();
|
||||||
if (c.getType() == Material.PORTAL || c.getType() == Material.ENDER_PORTAL || c.getType() == Material.LAVA || c.getType() == Material.STATIONARY_LAVA) {
|
if (c.getType() == Material.PORTAL || c.getType() == Material.ENDER_PORTAL || c.getType() == Material.LAVA || c.getType() == Material.STATIONARY_LAVA) {
|
||||||
m._(player, "unsafe_spawn");
|
m._(player, "unsafe_spawn");
|
||||||
player.teleport(spawnLoc);
|
if (spawnLoc.getWorld() != null)
|
||||||
|
player.teleport(spawnLoc);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -887,7 +892,8 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
plugin.getServer().getPluginManager().callEvent(tpEvent);
|
plugin.getServer().getPluginManager().callEvent(tpEvent);
|
||||||
if (!tpEvent.isCancelled()) {
|
if (!tpEvent.isCancelled()) {
|
||||||
if (player != null && player.isOnline() && tpEvent.getTo() != null) {
|
if (player != null && player.isOnline() && tpEvent.getTo() != null) {
|
||||||
player.teleport(tpEvent.getTo());
|
if (tpEvent.getTo().getWorld() != null)
|
||||||
|
player.teleport(tpEvent.getTo());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (NullPointerException npe) {
|
} catch (NullPointerException npe) {
|
||||||
@ -1190,7 +1196,7 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
if (!Settings.isForcedRegistrationEnabled)
|
if (!Settings.isForcedRegistrationEnabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (this.causeByAuthMe)
|
if (causeByAuthMe.containsKey(name) && causeByAuthMe.get(name))
|
||||||
return;
|
return;
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
@ -45,8 +45,11 @@ public class TimeoutTask implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
GameMode gm = AuthMePlayerListener.gameMode.get(name);
|
GameMode gm = AuthMePlayerListener.gameMode.get(name);
|
||||||
player.setGameMode(gm);
|
if (gm != null)
|
||||||
ConsoleLogger.info("Set " + player.getName() + " to gamemode: " + gm.name());
|
{
|
||||||
|
player.setGameMode(gm);
|
||||||
|
ConsoleLogger.info("Set " + player.getName() + " to gamemode: " + gm.name());
|
||||||
|
}
|
||||||
player.kickPlayer(m._("timeout")[0]);
|
player.kickPlayer(m._("timeout")[0]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user