加了一个大屁眼子

This commit is contained in:
坏黑 2018-06-23 23:31:43 +08:00
parent 3c2d87889e
commit 8564b0bafe

View File

@ -118,16 +118,22 @@ public class TranslateUUID {
ScheduledExecutorService threadPool = Executors.newScheduledThreadPool(32);
AtomicInteger i = new AtomicInteger();
AtomicInteger fail = new AtomicInteger();
int size = playerDataFolder.listFiles().length;
TLogger.getGlobalLogger().info("Start importing the local data...");
for (File file : playerDataFolder.listFiles()) {
if (fail.get() > 10) {
TLogger.getGlobalLogger().info("The number of failures exceeds the threshold! import stopped..");
break;
}
threadPool.submit(() -> {
try {
String username = getUsernameInDatFile(file);
updateUsername(UUID.fromString(file.getName().split("\\.")[0]), username);
TLogger.getGlobalLogger().info("importing... " + username + "(" + i.getAndIncrement() + "/" + size + ")");
} catch (Exception ignored) {
fail.getAndIncrement();
}
});
}