mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-11-28 05:05:14 +01:00
Code cleanup
This commit is contained in:
parent
223fff4b52
commit
47211ab803
@ -1,5 +1,6 @@
|
|||||||
package fr.xephi.authme;
|
package fr.xephi.authme;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -209,4 +210,15 @@ public class Utils {
|
|||||||
LOGGEDIN
|
LOGGEDIN
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void purgeDirectory(File dir) {
|
||||||
|
if (dir != null && dir.listFiles() != null)
|
||||||
|
for (File file : dir.listFiles()) {
|
||||||
|
if (file != null){
|
||||||
|
if (file.isDirectory())
|
||||||
|
purgeDirectory(file);
|
||||||
|
file.delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ import fr.xephi.authme.AuthMe;
|
|||||||
import fr.xephi.authme.ConsoleLogger;
|
import fr.xephi.authme.ConsoleLogger;
|
||||||
import fr.xephi.authme.api.API;
|
import fr.xephi.authme.api.API;
|
||||||
import fr.xephi.authme.settings.Settings;
|
import fr.xephi.authme.settings.Settings;
|
||||||
|
import fr.xephi.authme.Utils;
|
||||||
|
|
||||||
public class FileCache {
|
public class FileCache {
|
||||||
|
|
||||||
@ -547,15 +548,7 @@ public class FileCache {
|
|||||||
}
|
}
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
if (file.isDirectory() && file.listFiles() != null) {
|
if (file.isDirectory() && file.listFiles() != null) {
|
||||||
for (File f : file.listFiles()) {
|
Utils.purgeDirectory(file);
|
||||||
if (f.isDirectory() && f.listFiles() != null) {
|
|
||||||
for (File a : f.listFiles()) {
|
|
||||||
a.delete();
|
|
||||||
}
|
|
||||||
f.delete();
|
|
||||||
} else f.delete();
|
|
||||||
}
|
|
||||||
file.delete();
|
|
||||||
} else file.delete();
|
} else file.delete();
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -141,7 +141,7 @@ public class AsyncronousJoin {
|
|||||||
SpawnTeleportEvent tpEvent = new SpawnTeleportEvent(player, player.getLocation(), spawnLoc, PlayerCache.getInstance().isAuthenticated(name));
|
SpawnTeleportEvent tpEvent = new SpawnTeleportEvent(player, player.getLocation(), spawnLoc, PlayerCache.getInstance().isAuthenticated(name));
|
||||||
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.isOnline() && tpEvent.getTo() != null) {
|
||||||
if (tpEvent.getTo().getWorld() != null)
|
if (tpEvent.getTo().getWorld() != null)
|
||||||
player.teleport(tpEvent.getTo());
|
player.teleport(tpEvent.getTo());
|
||||||
}
|
}
|
||||||
@ -185,7 +185,7 @@ public class AsyncronousJoin {
|
|||||||
SpawnTeleportEvent tpEvent = new SpawnTeleportEvent(player, player.getLocation(), spawnLoc, PlayerCache.getInstance().isAuthenticated(name));
|
SpawnTeleportEvent tpEvent = new SpawnTeleportEvent(player, player.getLocation(), spawnLoc, PlayerCache.getInstance().isAuthenticated(name));
|
||||||
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.isOnline() && tpEvent.getTo() != null) {
|
||||||
if (tpEvent.getTo().getWorld() != null)
|
if (tpEvent.getTo().getWorld() != null)
|
||||||
player.teleport(tpEvent.getTo());
|
player.teleport(tpEvent.getTo());
|
||||||
}
|
}
|
||||||
@ -291,7 +291,7 @@ public class AsyncronousJoin {
|
|||||||
FirstSpawnTeleportEvent tpEvent = new FirstSpawnTeleportEvent(player, player.getLocation(), loc);
|
FirstSpawnTeleportEvent tpEvent = new FirstSpawnTeleportEvent(player, player.getLocation(), loc);
|
||||||
plugin.getServer().getPluginManager().callEvent(tpEvent);
|
plugin.getServer().getPluginManager().callEvent(tpEvent);
|
||||||
if (!tpEvent.isCancelled()) {
|
if (!tpEvent.isCancelled()) {
|
||||||
if (player != null && player.isOnline() && tpEvent.getTo() != null && tpEvent.getTo().getWorld() != null) {
|
if (player.isOnline() && tpEvent.getTo() != null && tpEvent.getTo().getWorld() != null) {
|
||||||
player.teleport(tpEvent.getTo());
|
player.teleport(tpEvent.getTo());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user