[+] Parse user data files

This commit is contained in:
Hykilpikonna
2021-03-07 16:59:11 -05:00
parent 35b9106ed7
commit 69e350259a
@@ -46,6 +46,20 @@ class ActiveList : JavaPlugin(), CommandExecutor
}
val page = args.getOrNull(0)?.toIntOrNull() ?: 1
val pageSize = args.getOrNull(1)?.toIntOrNull() ?: 10
// Read user dates
var list = dir.listFiles()?.filter { it.name.lowercase().endsWith("yml") }?.mapNotNull {
try
{
val yml = YamlConfiguration.loadConfiguration(it)
val name = yml.getString("lastAccountName")
val logoutDate = yml.getLong("timestamps.logout")
val money = yml.getString("money") ?: ""
User(name, Date(logoutDate), money)
}
catch (e: Exception) { e.printStackTrace(); null }
}
}
}