Merge branch 'master' of https://github.com/Bkm016/TabooLib
This commit is contained in:
commit
81fb265a8f
@ -118,16 +118,22 @@ public class TranslateUUID {
|
|||||||
ScheduledExecutorService threadPool = Executors.newScheduledThreadPool(32);
|
ScheduledExecutorService threadPool = Executors.newScheduledThreadPool(32);
|
||||||
|
|
||||||
AtomicInteger i = new AtomicInteger();
|
AtomicInteger i = new AtomicInteger();
|
||||||
|
AtomicInteger fail = new AtomicInteger();
|
||||||
int size = playerDataFolder.listFiles().length;
|
int size = playerDataFolder.listFiles().length;
|
||||||
|
|
||||||
TLogger.getGlobalLogger().info("Start importing the local data...");
|
TLogger.getGlobalLogger().info("Start importing the local data...");
|
||||||
for (File file : playerDataFolder.listFiles()) {
|
for (File file : playerDataFolder.listFiles()) {
|
||||||
|
if (fail.get() > 10) {
|
||||||
|
TLogger.getGlobalLogger().info("The number of failures exceeds the threshold! import stopped..");
|
||||||
|
break;
|
||||||
|
}
|
||||||
threadPool.submit(() -> {
|
threadPool.submit(() -> {
|
||||||
try {
|
try {
|
||||||
String username = getUsernameInDatFile(file);
|
String username = getUsernameInDatFile(file);
|
||||||
updateUsername(UUID.fromString(file.getName().split("\\.")[0]), username);
|
updateUsername(UUID.fromString(file.getName().split("\\.")[0]), username);
|
||||||
TLogger.getGlobalLogger().info("importing... " + username + "(" + i.getAndIncrement() + "/" + size + ")");
|
TLogger.getGlobalLogger().info("importing... " + username + "(" + i.getAndIncrement() + "/" + size + ")");
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
|
fail.getAndIncrement();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user