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); ip = realIp.get(name);
} }
if (Settings.checkVeryGames) if (Settings.checkVeryGames)
if (getVeryGamesIP(player) != null) if (getVeryGamesIp(player) != null)
ip = getVeryGamesIP(player); ip = getVeryGamesIp(player);
return ip; return ip;
} }
@ -908,11 +908,12 @@ public class AuthMe extends JavaPlugin {
/** /**
* Gets a player's real IP through VeryGames method. * Gets a player's real IP through VeryGames method.
* *
* @param player the player to process * @param player The player to process.
* @return the real IP of the player *
* @return The real IP of the player.
*/ */
@Deprecated @Deprecated
public String getVeryGamesIP(Player player) { public String getVeryGamesIp(Player player) {
String realIP = player.getAddress().getAddress().getHostAddress(); String realIP = player.getAddress().getAddress().getHostAddress();
String sUrl = "http://monitor-1.verygames.net/api/?action=ipclean-real-ip&out=raw&ip=%IP%&port=%PORT%"; 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()); 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; 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 ")) 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; return true;
String playername = record.getMessage().split(" ")[0]; String playerName = record.getMessage().split(" ")[0];
record.setMessage(playername + " issued an AuthMe command!"); record.setMessage(playerName + " issued an AuthMe command!");
return true; return true;
} catch (NullPointerException npe) { } catch (NullPointerException npe) {
return true; return true;

View File

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

View File

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

View File

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