Search in sources :

Example 1 with YMLFileHandler

use of com.Ben12345rocks.AdvancedCore.YML.YMLFileHandler in project VotingPlugin by Ben12345rocks.

the class TopVoterHandler method storeWeeklyTopVoters.

public void storeWeeklyTopVoters() {
    LocalDateTime time = LocalDateTime.now().minusHours(10);
    String month = time.getMonth().toString();
    int year = time.getYear();
    int week = time.getDayOfYear();
    YMLFileHandler file = new YMLFileHandler(new File(plugin.getDataFolder(), "TopVoter" + File.separator + "Weekly" + File.separator + year + "_" + month + "_" + week + ".yml"));
    file.setup();
    ArrayList<String> topVoters = new ArrayList<String>();
    int count = 1;
    for (Entry<User, Integer> entry : plugin.topVoterWeekly.entrySet()) {
        topVoters.add(count + ": " + entry.getKey().getPlayerName() + ": " + entry.getValue());
        count++;
    }
    file.getData().set("Week", topVoters);
    file.saveData();
}
Also used : LocalDateTime(java.time.LocalDateTime) User(com.Ben12345rocks.VotingPlugin.Objects.User) YMLFileHandler(com.Ben12345rocks.AdvancedCore.YML.YMLFileHandler) ArrayList(java.util.ArrayList) File(java.io.File)

Example 2 with YMLFileHandler

use of com.Ben12345rocks.AdvancedCore.YML.YMLFileHandler in project VotingPlugin by Ben12345rocks.

the class TopVoterHandler method storeDailyTopVoters.

public void storeDailyTopVoters() {
    LocalDateTime time = LocalDateTime.now().minusHours(5);
    String month = time.getMonth().toString();
    int year = time.getYear();
    int day = time.getDayOfMonth();
    YMLFileHandler file = new YMLFileHandler(new File(plugin.getDataFolder(), "TopVoter" + File.separator + "Daily" + File.separator + year + "_" + month + "_" + day + ".yml"));
    file.setup();
    ArrayList<String> topVoters = new ArrayList<String>();
    int count = 1;
    for (Entry<User, Integer> entry : plugin.topVoterDaily.entrySet()) {
        topVoters.add(count + ": " + entry.getKey().getPlayerName() + ": " + entry.getValue());
        count++;
    }
    file.getData().set("Day", topVoters);
    file.saveData();
}
Also used : LocalDateTime(java.time.LocalDateTime) User(com.Ben12345rocks.VotingPlugin.Objects.User) YMLFileHandler(com.Ben12345rocks.AdvancedCore.YML.YMLFileHandler) ArrayList(java.util.ArrayList) File(java.io.File)

Example 3 with YMLFileHandler

use of com.Ben12345rocks.AdvancedCore.YML.YMLFileHandler in project VotingPlugin by Ben12345rocks.

the class TopVoterHandler method storeMonthlyTopVoters.

public void storeMonthlyTopVoters() {
    LocalDateTime time = LocalDateTime.now().minusHours(10);
    String month = time.getMonth().toString();
    int year = time.getYear();
    YMLFileHandler file = new YMLFileHandler(new File(plugin.getDataFolder(), "TopVoter" + File.separator + "Monthly" + File.separator + month + "_" + year + ".yml"));
    file.setup();
    ArrayList<String> topVoters = new ArrayList<String>();
    int count = 1;
    for (Entry<User, Integer> entry : plugin.topVoterMonthly.entrySet()) {
        topVoters.add(count + ": " + entry.getKey().getPlayerName() + ": " + entry.getValue());
        count++;
    }
    file.getData().set("Month", topVoters);
    file.saveData();
}
Also used : LocalDateTime(java.time.LocalDateTime) User(com.Ben12345rocks.VotingPlugin.Objects.User) YMLFileHandler(com.Ben12345rocks.AdvancedCore.YML.YMLFileHandler) ArrayList(java.util.ArrayList) File(java.io.File)

Aggregations

YMLFileHandler (com.Ben12345rocks.AdvancedCore.YML.YMLFileHandler)3 User (com.Ben12345rocks.VotingPlugin.Objects.User)3 File (java.io.File)3 LocalDateTime (java.time.LocalDateTime)3 ArrayList (java.util.ArrayList)3