mirror of
https://github.com/darksaid98/AlathranWars.git
synced 2026-12-01 22:14:45 +00:00
Redo File Search and War ID
This commit is contained in:
1 parent
388c600ce5
commit
471a03bb7b
2 files changed
+12
-5
No files matched your search
@@ -19,6 +19,7 @@ import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
@@ -50,8 +51,6 @@ public class WarData
|
||||
this.configFile = new File(this.plugin.getDataFolder(), "wars.yml");
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Gather all war files in this
|
||||
warsData.clear();
|
||||
Stream<Path> stream = null;
|
||||
@@ -62,7 +61,10 @@ public class WarData
|
||||
.map(Path::toFile)
|
||||
.filter(file -> {
|
||||
if (file.getName().split(".").length > 1) {
|
||||
if (file.getName().split(".")[1].equalsIgnoreCase("yml")) {
|
||||
String[] parse = file.getName().split(".");
|
||||
int extensionCheck = Arrays.binarySearch(parse, "yml");
|
||||
// -1 if search fail
|
||||
if (extensionCheck >= 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -75,7 +77,6 @@ public class WarData
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
|
||||
int i = 0;
|
||||
for(File file : warsFiles) {
|
||||
this.warsData.add(i, new Pair(YamlConfiguration.loadConfiguration(file), file));
|
||||
|
||||
Reference in new issue
Block a user