use of com.Ben12345rocks.AdvancedCore.Util.Javascript.JavascriptPlaceholderRequest in project VotingPlugin by Ben12345rocks.
the class Main method onEnable.
/*
* (non-Javadoc)
*
* @see org.bukkit.plugin.java.JavaPlugin#onEnable()
*/
@Override
public void onEnable() {
plugin = this;
setupFiles();
loadVoteSites();
updateAdvancedCoreHook();
AdvancedCoreHook.getInstance().loadHook(this);
if (AdvancedCoreHook.getInstance().getStorageType().equals(UserStorage.MYSQL)) {
debug("UseBatchUpdates: " + AdvancedCoreHook.getInstance().getMysql().isUseBatchUpdates());
}
registerCommands();
registerEvents();
checkVotifier();
CheckUpdate.getInstance().startUp();
VoteReminding.getInstance().loadRemindChecking();
plugin.signs = new ArrayList<SignHandler>();
Bukkit.getScheduler().runTask(plugin, new Runnable() {
@Override
public void run() {
Signs.getInstance().loadSigns();
}
});
topVoterMonthly = new LinkedHashMap<User, Integer>();
topVoterWeekly = new LinkedHashMap<User, Integer>();
topVoterDaily = new LinkedHashMap<User, Integer>();
voteToday = new LinkedHashMap<User, HashMap<VoteSite, LocalDateTime>>();
topVoterAllTime = new LinkedHashMap<User, Integer>();
voteLog = new Logger(plugin, new File(plugin.getDataFolder() + File.separator + "Log", "votelog.txt"));
AdminGUI.getInstance().loadHook();
if (Config.getInstance().getVotePartyEnabled()) {
VoteParty.getInstance().check();
}
VoteParty.getInstance().register();
TopVoterHandler.getInstance().register();
metrics();
AdvancedCoreHook.getInstance().getJavascriptEngineRequests().add(new JavascriptPlaceholderRequest("User") {
@Override
public Object getObject(OfflinePlayer player) {
return getUserManager().getVotingPluginUser(player);
}
});
loadTimer();
plugin.getLogger().info("Enabled VotingPlugin " + plugin.getDescription().getVersion());
boolean hasRewards = RewardHandler.getInstance().hasRewards(ConfigVoteSites.getInstance().getData(), ConfigVoteSites.getInstance().getEverySiteRewardPath());
boolean noIssues = true;
ArrayList<String> services = ServerData.getInstance().getServiceSites();
for (VoteSite site : getVoteSites()) {
if (!site.hasRewards() && !hasRewards) {
noIssues = false;
plugin.getLogger().warning("No rewards detected for the site: " + site.getKey() + ". See https://github.com/Ben12345rocks/AdvancedCore/wiki/Rewards on how to add rewards");
}
boolean contains = false;
for (String service : services) {
if (service.equalsIgnoreCase(site.getServiceSite())) {
contains = true;
}
}
if (!contains) {
noIssues = false;
plugin.getLogger().warning("No vote has been recieved from " + site.getServiceSite() + ", may be an invalid service site. Vote on the site and look in console for a service site, if you get nothing then there is an issue with votifier");
}
}
if (!noIssues) {
Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
@Override
public void run() {
plugin.getLogger().warning("Detected an issue with voting sites, check the plugin startup log for more details");
}
}, 30l);
}
}
Aggregations