Add tests for CommandUtils, move purgeDirectory to its only use
This commit is contained in:
@@ -15,7 +15,6 @@ import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Arrays;
|
||||
@@ -207,27 +206,6 @@ public final class Utils {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a given directory and all his content.
|
||||
*
|
||||
* @param directory File
|
||||
*/
|
||||
public static void purgeDirectory(File directory) {
|
||||
if (!directory.isDirectory()) {
|
||||
return;
|
||||
}
|
||||
File[] files = directory.listFiles();
|
||||
if (files == null) {
|
||||
return;
|
||||
}
|
||||
for (File target : files) {
|
||||
if (target.isDirectory()) {
|
||||
purgeDirectory(target);
|
||||
}
|
||||
target.delete();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Safe way to retrieve the list of online players from the server. Depending on the
|
||||
* implementation of the server, either an array of {@link Player} instances is being returned,
|
||||
|
||||
Reference in New Issue
Block a user