Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /** Gets or creates section if it doesn't exist.
- * @return */
- public static ConfigurationSection getRaffleSection() {
- rafflesConfig.saveDefaultConfig();
- FileConfiguration config = rafflesConfig.getConfig();
- return getOrCreateSection(config, "raffles");
- }
- public static ConfigurationSection getOrCreateSection(ConfigurationSection parent, String name) {
- ConfigurationSection ret = parent.getConfigurationSection(name);
- return (ret != null) ? ret : parent.createSection(name);
- }
- /** Saves the current raffle. */
- public static void saveRaffle() {
- if (currentRaffle == null) {
- ChatUtil.logSevere(Messages.RAFFLE_FAILED_TO_SAVE);
- return;
- }
- ChatUtil.logInfo(getRaffleSection().getCurrentPath());
- ConfigurationSection cs = getOrCreateSection(getRaffleSection(), currentRaffle.getId() + "");
- cs.set("end-time", currentRaffle.getEndTime());
- cs = getOrCreateSection(cs, "players");
- for (String player : currentRaffle.getPlayers().keySet()) {
- cs.set(player, currentRaffle.getPlayers().get(player));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement