mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-11-03 01:00:18 +01:00
Prevent some NPE on (auto)purge
This commit is contained in:
parent
35a4e6508c
commit
7ba37d75c9
@ -43,6 +43,7 @@ public class DataManager extends Thread {
|
|||||||
public void purgeAntiXray(List<String> cleared) {
|
public void purgeAntiXray(List<String> cleared) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (String name : cleared) {
|
for (String name : cleared) {
|
||||||
|
try {
|
||||||
org.bukkit.OfflinePlayer player = getOfflinePlayer(name);
|
org.bukkit.OfflinePlayer player = getOfflinePlayer(name);
|
||||||
if (player == null)
|
if (player == null)
|
||||||
continue;
|
continue;
|
||||||
@ -52,6 +53,7 @@ public class DataManager extends Thread {
|
|||||||
playerFile.delete();
|
playerFile.delete();
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {}
|
||||||
}
|
}
|
||||||
ConsoleLogger.info("AutoPurgeDatabase : Remove " + i + " AntiXRayData Files");
|
ConsoleLogger.info("AutoPurgeDatabase : Remove " + i + " AntiXRayData Files");
|
||||||
}
|
}
|
||||||
@ -59,6 +61,7 @@ public class DataManager extends Thread {
|
|||||||
public void purgeLimitedCreative(List<String> cleared) {
|
public void purgeLimitedCreative(List<String> cleared) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (String name : cleared) {
|
for (String name : cleared) {
|
||||||
|
try {
|
||||||
org.bukkit.OfflinePlayer player = getOfflinePlayer(name);
|
org.bukkit.OfflinePlayer player = getOfflinePlayer(name);
|
||||||
if (player == null)
|
if (player == null)
|
||||||
continue;
|
continue;
|
||||||
@ -78,6 +81,7 @@ public class DataManager extends Thread {
|
|||||||
playerFile.delete();
|
playerFile.delete();
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {}
|
||||||
}
|
}
|
||||||
ConsoleLogger.info("AutoPurgeDatabase : Remove " + i + " LimitedCreative Survival, Creative and Adventure files");
|
ConsoleLogger.info("AutoPurgeDatabase : Remove " + i + " LimitedCreative Survival, Creative and Adventure files");
|
||||||
}
|
}
|
||||||
@ -85,6 +89,7 @@ public class DataManager extends Thread {
|
|||||||
public void purgeDat(List<String> cleared) {
|
public void purgeDat(List<String> cleared) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (String name : cleared) {
|
for (String name : cleared) {
|
||||||
|
try {
|
||||||
org.bukkit.OfflinePlayer player = getOfflinePlayer(name);
|
org.bukkit.OfflinePlayer player = getOfflinePlayer(name);
|
||||||
if (player == null)
|
if (player == null)
|
||||||
continue;
|
continue;
|
||||||
@ -94,6 +99,7 @@ public class DataManager extends Thread {
|
|||||||
playerFile.delete();
|
playerFile.delete();
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {}
|
||||||
}
|
}
|
||||||
ConsoleLogger.info("AutoPurgeDatabase : Remove " + i + " .dat Files");
|
ConsoleLogger.info("AutoPurgeDatabase : Remove " + i + " .dat Files");
|
||||||
}
|
}
|
||||||
@ -101,11 +107,13 @@ public class DataManager extends Thread {
|
|||||||
public void purgeEssentials(List<String> cleared) {
|
public void purgeEssentials(List<String> cleared) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (String name : cleared) {
|
for (String name : cleared) {
|
||||||
|
try {
|
||||||
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()) {
|
||||||
playerFile.delete();
|
playerFile.delete();
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {}
|
||||||
}
|
}
|
||||||
ConsoleLogger.info("AutoPurgeDatabase : Remove " + i + " EssentialsFiles");
|
ConsoleLogger.info("AutoPurgeDatabase : Remove " + i + " EssentialsFiles");
|
||||||
}
|
}
|
||||||
|
@ -45,14 +45,12 @@ public class SendMailSSL {
|
|||||||
props.put("mail.smtp.port", String.valueOf(Settings.getMailPort));
|
props.put("mail.smtp.port", String.valueOf(Settings.getMailPort));
|
||||||
|
|
||||||
Session session = Session.getInstance(props, new javax.mail.Authenticator() {
|
Session session = Session.getInstance(props, new javax.mail.Authenticator() {
|
||||||
|
|
||||||
protected PasswordAuthentication getPasswordAuthentication() {
|
protected PasswordAuthentication getPasswordAuthentication() {
|
||||||
return new PasswordAuthentication(Settings.getmailAccount, Settings.getmailPassword);
|
return new PasswordAuthentication(Settings.getmailAccount, Settings.getmailPassword);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
final Message message = new MimeMessage(session);
|
final Message message = new MimeMessage(session);
|
||||||
try {
|
try {
|
||||||
message.setFrom(new InternetAddress(Settings.getmailAccount, sendername));
|
message.setFrom(new InternetAddress(Settings.getmailAccount, sendername));
|
||||||
@ -68,7 +66,6 @@ public class SendMailSSL {
|
|||||||
text = text.replace("<generatedpass>", newPass);
|
text = text.replace("<generatedpass>", newPass);
|
||||||
message.setContent(text, "text/html");
|
message.setContent(text, "text/html");
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
@ -84,5 +81,4 @@ public class SendMailSSL {
|
|||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user