Update messages + Fix MaxJoin/LoginPerIP

This commit is contained in:
Xephi
2014-07-23 20:20:39 +02:00
parent 964e66a370
commit a55e99a2c5
9 changed files with 214 additions and 138 deletions
+9 -3
View File
@@ -737,7 +737,7 @@ public class AuthMe extends JavaPlugin {
}
private Location getAuthMeSpawn(Player player) {
if ((!database.isAuthAvailable(player.getName().toLowerCase()) || !player.hasPlayedBefore()) && Spawn.getInstance().getFirstSpawn() != null)
if ((!database.isAuthAvailable(player.getName().toLowerCase()) || !player.hasPlayedBefore()) && (Spawn.getInstance().getFirstSpawn() != null))
return Spawn.getInstance().getFirstSpawn();
if (Spawn.getInstance().getSpawn() != null)
return Spawn.getInstance().getSpawn();
@@ -848,18 +848,24 @@ public class AuthMe extends JavaPlugin {
}
public boolean isLoggedIp(String name, String ip) {
int count = 0;
for (Player player : this.getServer().getOnlinePlayers()) {
if(ip.equalsIgnoreCase(getIP(player)) && database.isLogged(player.getName().toLowerCase()) && !player.getName().equalsIgnoreCase(name))
return true;
count++;
}
if (count >= Settings.getMaxLoginPerIp)
return true;
return false;
}
public boolean hasJoinedIp(String name, String ip) {
int count = 0;
for (Player player : this.getServer().getOnlinePlayers()) {
if(ip.equalsIgnoreCase(getIP(player)) && !player.getName().equalsIgnoreCase(name))
return true;
count++;
}
if (count >= Settings.getMaxJoinPerIp)
return true;
return false;
}
@@ -729,6 +729,12 @@ public class AuthMePlayerListener implements Listener {
player.teleport(spawnLoc);
return;
}
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) {
m._(player, "unsafe_spawn");
player.teleport(spawnLoc);
return;
}
}
@EventHandler(priority = EventPriority.MONITOR)
@@ -7,10 +7,9 @@ public class ROYALAUTH implements EncryptionMethod {
@Override
public String getHash(String password, String salt, String name) throws NoSuchAlgorithmException {
String data = "";
for (int i = 0; i < 25; i++)
data = hash(data, salt);
return data;
password = hash(password, salt);
return password;
}
public String hash(String password, String salt) throws NoSuchAlgorithmException {
@@ -726,6 +726,6 @@ public static void reloadConfigOptions(YamlConfiguration newConfig) {
}
public enum messagesLang {
en, de, br, cz, pl, fr, uk, ru, hu, sk, es, fi, zhtw, zhhk, zhcn, lt, it, ko, pt, nl
en, de, br, cz, pl, fr, uk, ru, hu, sk, es, fi, zhtw, zhhk, zhcn, lt, it, ko, pt, nl, gl
}
}