Search in sources :

Example 1 with DirectlyDefinedReward

use of com.bencodez.advancedcore.api.rewards.DirectlyDefinedReward in project VotingPlugin by Ben12345rocks.

the class VotingPluginMain method loadDirectlyDefined.

public void loadDirectlyDefined() {
    RewardHandler.getInstance().getDirectlyDefinedRewards().clear();
    // AllSites reward
    addDirectlyDefinedRewards(new DirectlyDefinedReward("AllSites") {

        @Override
        public void createSection(String key) {
            getSpecialRewardsConfig().createSection(key);
        }

        @Override
        public ConfigurationSection getFileData() {
            return getSpecialRewardsConfig().getData();
        }

        @Override
        public void save() {
            getSpecialRewardsConfig().saveData();
        }

        @Override
        public void setData(String path, Object value) {
            getSpecialRewardsConfig().setValue(path, value);
        }
    });
    // FirstVote
    addDirectlyDefinedRewards(new DirectlyDefinedReward("FirstVote") {

        @Override
        public void createSection(String key) {
            getSpecialRewardsConfig().createSection(key);
        }

        @Override
        public ConfigurationSection getFileData() {
            return getSpecialRewardsConfig().getData();
        }

        @Override
        public void save() {
            getSpecialRewardsConfig().saveData();
        }

        @Override
        public void setData(String path, Object value) {
            getSpecialRewardsConfig().setValue(path, value);
        }
    });
    addDirectlyDefinedRewards(new DirectlyDefinedReward("FirstVoteToday") {

        @Override
        public void createSection(String key) {
            getSpecialRewardsConfig().createSection(key);
        }

        @Override
        public ConfigurationSection getFileData() {
            return getSpecialRewardsConfig().getData();
        }

        @Override
        public void save() {
            getSpecialRewardsConfig().saveData();
        }

        @Override
        public void setData(String path, Object value) {
            getSpecialRewardsConfig().setValue(path, value);
        }
    });
    addDirectlyDefinedRewards(new DirectlyDefinedReward("VoteReminding.Rewards") {

        @Override
        public void createSection(String key) {
            getConfigFile().saveData();
        }

        @Override
        public ConfigurationSection getFileData() {
            return getConfigFile().getData();
        }

        @Override
        public void save() {
            getConfigFile().saveData();
        }

        @Override
        public void setData(String path, Object value) {
            getConfigFile().setValue(path, value);
        }
    });
    // vote cooldown ended
    addDirectlyDefinedRewards(new DirectlyDefinedReward("VoteCoolDownEndedReward") {

        @Override
        public void createSection(String key) {
            getSpecialRewardsConfig().createSection(key);
        }

        @Override
        public ConfigurationSection getFileData() {
            return getSpecialRewardsConfig().getData();
        }

        @Override
        public void save() {
            getSpecialRewardsConfig().saveData();
        }

        @Override
        public void setData(String path, Object value) {
            getSpecialRewardsConfig().setValue(path, value);
        }
    });
    // any site rewards
    addDirectlyDefinedRewards(new DirectlyDefinedReward("AnySiteRewards") {

        @Override
        public void createSection(String key) {
            getSpecialRewardsConfig().createSection(key);
        }

        @Override
        public ConfigurationSection getFileData() {
            return getSpecialRewardsConfig().getData();
        }

        @Override
        public void save() {
            getSpecialRewardsConfig().saveData();
        }

        @Override
        public void setData(String path, Object value) {
            getSpecialRewardsConfig().setValue(path, value);
        }
    });
    addDirectlyDefinedRewards(new DirectlyDefinedReward("EverySiteReward") {

        @Override
        public void createSection(String key) {
            getConfigVoteSites().createSection(key);
        }

        @Override
        public ConfigurationSection getFileData() {
            return getConfigVoteSites().getData();
        }

        @Override
        public void save() {
            getConfigVoteSites().saveData();
        }

        @Override
        public void setData(String path, Object value) {
            getConfigVoteSites().setValue(path, value);
        }
    });
    // login rewards
    addDirectlyDefinedRewards(new DirectlyDefinedReward("LoginRewards") {

        @Override
        public void createSection(String key) {
            getSpecialRewardsConfig().createSection(key);
        }

        @Override
        public ConfigurationSection getFileData() {
            return getSpecialRewardsConfig().getData();
        }

        @Override
        public void save() {
            getSpecialRewardsConfig().saveData();
        }

        @Override
        public void setData(String path, Object value) {
            getSpecialRewardsConfig().setValue(path, value);
        }
    });
    // logout rewards
    addDirectlyDefinedRewards(new DirectlyDefinedReward("LogoutRewards") {

        @Override
        public void createSection(String key) {
            getSpecialRewardsConfig().createSection(key);
        }

        @Override
        public ConfigurationSection getFileData() {
            return getSpecialRewardsConfig().getData();
        }

        @Override
        public void save() {
            getSpecialRewardsConfig().saveData();
        }

        @Override
        public void setData(String path, Object value) {
            getSpecialRewardsConfig().setValue(path, value);
        }
    });
    // VoteParty
    addDirectlyDefinedRewards(new DirectlyDefinedReward("VoteParty.Rewards") {

        @Override
        public void createSection(String key) {
            getSpecialRewardsConfig().createSection(key);
        }

        @Override
        public ConfigurationSection getFileData() {
            return getSpecialRewardsConfig().getData();
        }

        @Override
        public void save() {
            getSpecialRewardsConfig().saveData();
        }

        @Override
        public void setData(String path, Object value) {
            getSpecialRewardsConfig().setValue(path, value);
        }
    });
    // Cumulative rewards
    for (String num : getSpecialRewardsConfig().getCumulativeVotes()) {
        addDirectlyDefinedRewards(new DirectlyDefinedReward("Cumulative." + num + ".Rewards") {

            @Override
            public void createSection(String key) {
                getSpecialRewardsConfig().createSection(key);
            }

            @Override
            public ConfigurationSection getFileData() {
                return getSpecialRewardsConfig().getData();
            }

            @Override
            public void save() {
                getSpecialRewardsConfig().saveData();
            }

            @Override
            public void setData(String path, Object value) {
                getSpecialRewardsConfig().setValue(path, value);
            }
        });
    }
    // Milestones rewards
    for (String num : getSpecialRewardsConfig().getMilestoneVotes()) {
        addDirectlyDefinedRewards(new DirectlyDefinedReward("MileStones." + num + ".Rewards") {

            @Override
            public void createSection(String key) {
                getSpecialRewardsConfig().createSection(key);
            }

            @Override
            public ConfigurationSection getFileData() {
                return getSpecialRewardsConfig().getData();
            }

            @Override
            public void save() {
                getSpecialRewardsConfig().saveData();
            }

            @Override
            public void setData(String path, Object value) {
                getSpecialRewardsConfig().setValue(path, value);
            }
        });
    }
    // VoteSites
    for (VoteSite site : plugin.getVoteSites()) {
        addDirectlyDefinedRewards(new DirectlyDefinedReward("VoteSites." + site.getKey() + ".Rewards") {

            @Override
            public void createSection(String key) {
                getConfigVoteSites().createSection(key);
            }

            @Override
            public ConfigurationSection getFileData() {
                return getConfigVoteSites().getData();
            }

            @Override
            public void save() {
                getConfigVoteSites().saveData();
            }

            @Override
            public void setData(String path, Object value) {
                getConfigVoteSites().setValue(path, value);
            }
        });
    }
    // vote streaks
    String[] types = new String[] { "Day", "Week", "Month" };
    for (String type : types) {
        for (String str : plugin.getSpecialRewardsConfig().getVoteStreakVotes(type)) {
            addDirectlyDefinedRewards(new DirectlyDefinedReward("VoteStreak." + type + "." + str + ".Rewards") {

                @Override
                public void createSection(String key) {
                    getSpecialRewardsConfig().createSection(key);
                }

                @Override
                public ConfigurationSection getFileData() {
                    return getSpecialRewardsConfig().getData();
                }

                @Override
                public void save() {
                    getSpecialRewardsConfig().saveData();
                }

                @Override
                public void setData(String path, Object value) {
                    getSpecialRewardsConfig().setValue(path, value);
                }
            });
        }
    }
    for (String path : plugin.getSpecialRewardsConfig().getMonthlyPossibleRewardPlaces()) {
        addDirectlyDefinedRewards(new DirectlyDefinedReward(plugin.getSpecialRewardsConfig().getMonthlyAwardRewardsPath(path)) {

            @Override
            public void createSection(String key) {
                getSpecialRewardsConfig().createSection(key);
            }

            @Override
            public ConfigurationSection getFileData() {
                return getSpecialRewardsConfig().getData();
            }

            @Override
            public void save() {
                getSpecialRewardsConfig().saveData();
            }

            @Override
            public void setData(String path, Object value) {
                getSpecialRewardsConfig().setValue(path, value);
            }
        });
    }
    for (String path : plugin.getSpecialRewardsConfig().getWeeklyPossibleRewardPlaces()) {
        addDirectlyDefinedRewards(new DirectlyDefinedReward(plugin.getSpecialRewardsConfig().getWeeklyAwardRewardsPath(path)) {

            @Override
            public void createSection(String key) {
                getSpecialRewardsConfig().createSection(key);
            }

            @Override
            public ConfigurationSection getFileData() {
                return getSpecialRewardsConfig().getData();
            }

            @Override
            public void save() {
                getSpecialRewardsConfig().saveData();
            }

            @Override
            public void setData(String path, Object value) {
                getSpecialRewardsConfig().setValue(path, value);
            }
        });
    }
    for (String path : plugin.getSpecialRewardsConfig().getDailyPossibleRewardPlaces()) {
        addDirectlyDefinedRewards(new DirectlyDefinedReward(plugin.getSpecialRewardsConfig().getDailyAwardRewardsPath(path)) {

            @Override
            public void createSection(String key) {
                getSpecialRewardsConfig().createSection(key);
            }

            @Override
            public ConfigurationSection getFileData() {
                return getSpecialRewardsConfig().getData();
            }

            @Override
            public void save() {
                getSpecialRewardsConfig().saveData();
            }

            @Override
            public void setData(String path, Object value) {
                getSpecialRewardsConfig().setValue(path, value);
            }
        });
    }
    for (String identifier : plugin.getGui().getChestShopIdentifiers()) {
        addDirectlyDefinedRewards(new DirectlyDefinedReward("CHEST.Shop." + identifier + ".Rewards") {

            @Override
            public void createSection(String key) {
                getGui().createSection(key);
            }

            @Override
            public ConfigurationSection getFileData() {
                return getGui().getData();
            }

            @Override
            public void save() {
                getGui().saveData();
            }

            @Override
            public void setData(String path, Object value) {
                getGui().setValue(path, value);
            }
        });
    }
    addDirectlyDefinedRewards(new DirectlyDefinedReward("BungeeVotePartyRewards") {

        @Override
        public void createSection(String key) {
            getBungeeSettings().createSection(key);
        }

        @Override
        public ConfigurationSection getFileData() {
            return getBungeeSettings().getData();
        }

        @Override
        public void save() {
            getBungeeSettings().saveData();
        }

        @Override
        public void setData(String path, Object value) {
            getBungeeSettings().setValue(path, value);
        }
    });
}
Also used : DirectlyDefinedReward(com.bencodez.advancedcore.api.rewards.DirectlyDefinedReward) VoteSite(com.bencodez.votingplugin.objects.VoteSite) ConfigurationSection(org.bukkit.configuration.ConfigurationSection) RewardInjectConfigurationSection(com.bencodez.advancedcore.api.rewards.injected.RewardInjectConfigurationSection)

Aggregations

DirectlyDefinedReward (com.bencodez.advancedcore.api.rewards.DirectlyDefinedReward)1 RewardInjectConfigurationSection (com.bencodez.advancedcore.api.rewards.injected.RewardInjectConfigurationSection)1 VoteSite (com.bencodez.votingplugin.objects.VoteSite)1 ConfigurationSection (org.bukkit.configuration.ConfigurationSection)1