use of com.Ben12345rocks.VotingPlugin.Objects.SignHandler 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);
}
}
use of com.Ben12345rocks.VotingPlugin.Objects.SignHandler in project VotingPlugin by Ben12345rocks.
the class BlockBreak method onBlockBreak.
/**
* On block break.
*
* @param event
* the event
*/
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onBlockBreak(BlockBreakEvent event) {
if (event.getBlock().getState() instanceof Sign) {
Sign s = (Sign) event.getBlock().getState();
final Location loc = s.getLocation();
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
@Override
public void run() {
for (SignHandler sign : plugin.signs) {
if (sign.getLocation().equals(loc)) {
sign.removeSign();
sign.setValid(false);
}
}
}
});
}
}
use of com.Ben12345rocks.VotingPlugin.Objects.SignHandler in project VotingPlugin by Ben12345rocks.
the class ServerData method addSign.
/**
* Adds the sign.
*
* @param location
* the location
* @param data
* the data
* @param position
* the position
*/
public void addSign(Location location, String data, int position) {
int count = nextSignNumber();
getData().set("Signs." + count + ".World", location.getWorld().getName());
getData().set("Signs." + count + ".X", location.getBlockX());
getData().set("Signs." + count + ".Y", location.getBlockY());
getData().set("Signs." + count + ".Z", location.getBlockZ());
getData().set("Signs." + count + ".Data", data);
getData().set("Signs." + count + ".Position", position);
saveData();
plugin.signs.add(new SignHandler("" + count, getSignLocation("" + count), getSignData("" + count), getSignPosition("" + count)));
}
Aggregations