Compare commits

...
9 Commits
Author SHA1 Message Date
Ben12345rocks 1cd1a0ab75 Update build path 2017-06-18 20:26:48 -04:00
Ben 481510a1e8 Merge pull request #205 from Ben12345rocks/5.8.7
5.8.7
2017-06-18 20:16:10 -04:00
Ben12345rocks 3a95ef9b23 Slight improvement 2017-06-18 20:16:44 -04:00
Ben12345rocks f7af9210cb Minor changes to bstats 2017-06-18 19:57:31 -04:00
Ben12345rocks 9f5fe338f4 Update version number, closes #201, closes #203 2017-06-18 19:42:46 -04:00
Ben12345rocks 967be0aa19 Add broadcast for vote party 2017-06-18 18:01:32 -04:00
Ben12345rocks 6e0b62a1dd Add every site reward 2017-06-18 17:57:22 -04:00
Ben12345rocks a8ec557c9e Bug fix 2017-06-16 16:02:41 -04:00
Ben12345rocks 252263da74 Update version number 2017-06-14 15:28:14 -04:00
9 changed files with 56 additions and 53 deletions

No files matched your search

+2
View File
@@ -573,6 +573,8 @@ VoteParty:
ResetEachDay: false
# Number of user votes that apply to vote party total the user needs to get rewards
UserVotesRequired: 0
# Broadcast when vote party reached
Broadcast: '&cReached the vote party amount!'
# Reward files to give
Rewards: []
+5 -1
View File
@@ -35,4 +35,8 @@ VoteSites:
# List of reward files to give to voter
Rewards:
- 'ExampleReward'
- 'ExampleReward'
# Reward for any site
# Similar to AnySiteReward
EverySiteReward: []
+1 -1
View File
@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.Ben12345rocks</groupId>
<artifactId>VotingPlugin</artifactId>
<version>5.8.5</version>
<version>5.8.7</version>
<packaging>jar</packaging>
<name>VotingPlugin</name>
<properties>
@@ -130,7 +130,7 @@ public class PlayerGUIs {
} else if (slot.equalsIgnoreCase("today")) {
lore = Commands.getInstance().voteToday();
} else if (slot.equalsIgnoreCase("help")) {
lore[0] = "Click to view help";
lore = new String[] {"Click to view help"};
}
}
@@ -1054,6 +1054,10 @@ public class Config extends YMLFile {
return "VoteParty.Rewards";
}
public String getVotePartyBroadcast() {
return getData().getString("VoteParty.Broadcast", "");
}
/**
* Gets the vote party votes required.
*
@@ -66,31 +66,6 @@ public class ConfigVoteSites extends YMLFile {
}
}
/**
* Gets the cumulative rewards.
*
* @param siteName
* the site name
* @return the cumulative rewards
*/
@SuppressWarnings("unchecked")
public ArrayList<String> getCumulativeRewards(String siteName) {
return (ArrayList<String>) getData(siteName).getList("Cumulative.Rewards", new ArrayList<String>());
}
/**
* Gets the cumulative reward votes amount.
*
* @param siteName
* the site name
* @return the cumulative reward votes amount
*/
public int getCumulativeRewardVotesAmount(String siteName) {
return getData(siteName).getInt("Cumulative.Votes");
}
/**
* Gets the data.
*
@@ -131,6 +106,10 @@ public class ConfigVoteSites extends YMLFile {
public String getRewardsPath(String siteName) {
return "VoteSites." + siteName + ".Rewards";
}
public String getEverySiteRewardPath() {
return "EverySiteReward";
}
/**
* Gets the service site.
@@ -348,13 +348,7 @@ public class Main extends JavaPlugin {
}
BStatsMetrics metrics = new BStatsMetrics(this);
metrics.addCustomChart(new BStatsMetrics.SimplePie("requestapi_defaultmethod") {
@Override
public String getValue() {
return Config.getInstance().getRequestAPIDefaultMethod();
}
});
metrics.addCustomChart(new BStatsMetrics.SimplePie("extrarewards_firstvote") {
@Override
@@ -367,6 +361,18 @@ public class Main extends JavaPlugin {
}
}
});
metrics.addCustomChart(new BStatsMetrics.SimplePie("extrarewards_everysite") {
@Override
public String getValue() {
if (RewardHandler.getInstance().hasRewards(ConfigVoteSites.getInstance().getData(),
ConfigVoteSites.getInstance().getEverySiteRewardPath())) {
return "True";
} else {
return "False";
}
}
});
metrics.addCustomChart(new BStatsMetrics.SimplePie("extrarewards_allsites") {
@Override
@@ -799,31 +805,33 @@ public class Main extends JavaPlugin {
/**
* Update.
*/
public synchronized void update() {
public void update() {
if (update && plugin != null) {
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
@Override
public void run() {
if (AdvancedCoreHook.getInstance().getStorageType().equals(UserStorage.MYSQL)) {
if (AdvancedCoreHook.getInstance().getMysql() == null) {
plugin.debug("MySQL not loaded yet");
return;
} else {
AdvancedCoreHook.getInstance().getMysql().clearCache();
synchronized (plugin) {
if (AdvancedCoreHook.getInstance().getStorageType().equals(UserStorage.MYSQL)) {
if (AdvancedCoreHook.getInstance().getMysql() == null) {
plugin.debug("MySQL not loaded yet");
return;
} else {
AdvancedCoreHook.getInstance().getMysql().clearCache();
}
}
update = false;
plugin.debug("Starting background task");
try {
TopVoterHandler.getInstance().updateTopVoters();
Commands.getInstance().updateVoteToday();
ServerData.getInstance().updateValues();
Signs.getInstance().updateSigns();
plugin.debug("Background task ran");
} catch (Exception ex) {
ex.printStackTrace();
plugin.getLogger().info("Looks like something went wrong.");
}
}
update = false;
plugin.debug("Starting background task");
try {
TopVoterHandler.getInstance().updateTopVoters();
Commands.getInstance().updateVoteToday();
ServerData.getInstance().updateValues();
Signs.getInstance().updateSigns();
plugin.debug("Background task ran");
} catch (Exception ex) {
ex.printStackTrace();
plugin.getLogger().info("Looks like something went wrong.");
}
}
@@ -149,6 +149,10 @@ public class VoteSite {
new RewardBuilder(configVoteSites.getData(), configVoteSites.getRewardsPath(key)).setOnline(online)
.withPlaceHolder("ServiceSite", getServiceSite()).withPlaceHolder("SiteName", getDisplayName())
.withPlaceHolder("VoteDelay", "" + getVoteDelay()).withPlaceHolder("VoteURL", getVoteURL()).send(user);
new RewardBuilder(configVoteSites.getData(), configVoteSites.getEverySiteRewardPath()).setOnline(online)
.withPlaceHolder("ServiceSite", getServiceSite()).withPlaceHolder("SiteName", getDisplayName())
.withPlaceHolder("VoteDelay", "" + getVoteDelay()).withPlaceHolder("VoteURL", getVoteURL()).send(user);
}
/**
@@ -11,6 +11,7 @@ import com.Ben12345rocks.AdvancedCore.Listeners.DayChangeEvent;
import com.Ben12345rocks.AdvancedCore.Objects.RewardBuilder;
import com.Ben12345rocks.AdvancedCore.Objects.UUID;
import com.Ben12345rocks.AdvancedCore.Util.Misc.ArrayUtils;
import com.Ben12345rocks.AdvancedCore.Util.Misc.MiscUtils;
import com.Ben12345rocks.VotingPlugin.Main;
import com.Ben12345rocks.VotingPlugin.Config.Config;
import com.Ben12345rocks.VotingPlugin.Data.ServerData;
@@ -84,6 +85,7 @@ public class VoteParty implements Listener {
if (getTotalVotes() >= Config.getInstance().getVotePartyVotesRequired()) {
setTotalVotes(getTotalVotes() - Config.getInstance().getVotePartyVotesRequired());
giveRewards();
MiscUtils.getInstance().broadcast(Config.getInstance().getVotePartyBroadcast());
}
}