Some minor automatic fixes and changes

This commit is contained in:
Tim Visée 2015-11-23 21:43:40 +01:00
parent 1cdf49f7e1
commit f15eaae67f
5 changed files with 283 additions and 273 deletions

View File

@ -878,8 +878,8 @@ public class AuthMe extends JavaPlugin {
ip = realIp.get(name);
}
if (Settings.checkVeryGames)
if (getVeryGamesIP(player) != null)
ip = getVeryGamesIP(player);
if (getVeryGamesIp(player) != null)
ip = getVeryGamesIp(player);
return ip;
}
@ -908,11 +908,12 @@ public class AuthMe extends JavaPlugin {
/**
* Gets a player's real IP through VeryGames method.
*
* @param player the player to process
* @return the real IP of the player
* @param player The player to process.
*
* @return The real IP of the player.
*/
@Deprecated
public String getVeryGamesIP(Player player) {
public String getVeryGamesIp(Player player) {
String realIP = player.getAddress().getAddress().getHostAddress();
String sUrl = "http://monitor-1.verygames.net/api/?action=ipclean-real-ip&out=raw&ip=%IP%&port=%PORT%";
sUrl = sUrl.replace("%IP%", player.getAddress().getAddress().getHostAddress()).replace("%PORT%", "" + player.getAddress().getPort());

View File

@ -30,8 +30,8 @@ public class ConsoleFilter implements Filter {
return true;
if (!logM.contains("/login ") && !logM.contains("/l ") && !logM.contains("/reg ") && !logM.contains("/changepassword ") && !logM.contains("/unregister ") && !logM.contains("/authme register ") && !logM.contains("/authme changepassword ") && !logM.contains("/authme reg ") && !logM.contains("/authme cp ") && !logM.contains("/register "))
return true;
String playername = record.getMessage().split(" ")[0];
record.setMessage(playername + " issued an AuthMe command!");
String playerName = record.getMessage().split(" ")[0];
record.setMessage(playerName + " issued an AuthMe command!");
return true;
} catch (NullPointerException npe) {
return true;

View File

@ -50,7 +50,7 @@ public class DataManager {
result = op;
break;
}
} catch (Exception e) {
} catch (Exception ignored) {
}
return result;
}
@ -79,10 +79,11 @@ public class DataManager {
String playerName = player.getName();
File playerFile = new File("." + File.separator + "plugins" + File.separator + "AntiXRayData" + File.separator + "PlayerData" + File.separator + playerName);
if (playerFile.exists()) {
//noinspection ResultOfMethodCallIgnored
playerFile.delete();
i++;
}
} catch (Exception e) {
} catch (Exception ignored) {
}
}
ConsoleLogger.info("AutoPurgeDatabase : Remove " + i + " AntiXRayData Files");
@ -103,20 +104,23 @@ public class DataManager {
String playerName = player.getName();
File playerFile = new File("." + File.separator + "plugins" + File.separator + "LimitedCreative" + File.separator + "inventories" + File.separator + playerName + ".yml");
if (playerFile.exists()) {
//noinspection ResultOfMethodCallIgnored
playerFile.delete();
i++;
}
playerFile = new File("." + File.separator + "plugins" + File.separator + "LimitedCreative" + File.separator + "inventories" + File.separator + playerName + "_creative.yml");
if (playerFile.exists()) {
//noinspection ResultOfMethodCallIgnored
playerFile.delete();
i++;
}
playerFile = new File("." + File.separator + "plugins" + File.separator + "LimitedCreative" + File.separator + "inventories" + File.separator + playerName + "_adventure.yml");
if (playerFile.exists()) {
//noinspection ResultOfMethodCallIgnored
playerFile.delete();
i++;
}
} catch (Exception e) {
} catch (Exception ignored) {
}
}
ConsoleLogger.info("AutoPurgeDatabase : Remove " + i + " LimitedCreative Survival, Creative and Adventure files");
@ -138,11 +142,13 @@ public class DataManager {
try {
File playerFile = new File(plugin.getServer().getWorldContainer() + File.separator + Settings.defaultWorld + File.separator + "players" + File.separator + player.getUniqueId() + ".dat");
//noinspection ResultOfMethodCallIgnored
playerFile.delete();
i++;
} catch (Exception ignore) {
File playerFile = new File(plugin.getServer().getWorldContainer() + File.separator + Settings.defaultWorld + File.separator + "players" + File.separator + player.getName() + ".dat");
if (playerFile.exists()) {
//noinspection ResultOfMethodCallIgnored
playerFile.delete();
i++;
}
@ -164,11 +170,13 @@ public class DataManager {
for (String name : cleared) {
try {
File playerFile = new File(plugin.ess.getDataFolder() + File.separator + "userdata" + File.separator + plugin.getServer().getOfflinePlayer(name).getUniqueId() + ".yml");
//noinspection ResultOfMethodCallIgnored
playerFile.delete();
i++;
} catch (Exception e) {
File playerFile = new File(plugin.ess.getDataFolder() + File.separator + "userdata" + File.separator + name + ".yml");
if (playerFile.exists()) {
//noinspection ResultOfMethodCallIgnored
playerFile.delete();
i++;
}
@ -194,7 +202,7 @@ public class DataManager {
try {
permsMan.removeAllGroups(this.getOnlinePlayerLower(name.toLowerCase()));
i++;
} catch (Exception e) {
} catch (Exception ignored) {
}
}
ConsoleLogger.info("AutoPurgeDatabase : Removed " + i + " permissions");

View File

@ -154,7 +154,7 @@ public class PerformBackup {
*/
private boolean checkWindows(String windowsPath) {
String isWin = System.getProperty("os.name").toLowerCase();
if (isWin.indexOf("win") >= 0) {
if (isWin.contains("win")) {
if (new File(windowsPath + "\\bin\\mysqldump.exe").exists()) {
return true;
} else {

View File

@ -34,15 +34,15 @@ public class SendMailSSL {
* @param newPass String
*/
public void main(final PlayerAuth auth, final String newPass) {
String sendername;
String senderName;
if (Settings.getmailSenderName == null || Settings.getmailSenderName.isEmpty()) {
sendername = Settings.getmailAccount;
senderName = Settings.getmailAccount;
} else {
sendername = Settings.getmailSenderName;
senderName = Settings.getmailSenderName;
}
final String sender = sendername;
final String sender = senderName;
final int port = Settings.getMailPort;
final String acc = Settings.getmailAccount;
final String subject = Settings.getMailSubject;
@ -90,6 +90,7 @@ public class SendMailSSL {
ConsoleLogger.showError("Fail to send a mail to " + mail);
}
if (file != null)
//noinspection ResultOfMethodCallIgnored
file.delete();
} catch (Exception e) {