Compare commits

...
8 Commits
Author SHA1 Message Date
Ben12345rocks 5618d4b479 Update version number 2018-01-28 14:34:04 -05:00
Ben 898b2985e5 Merge pull request #339 from Ben12345rocks/5.12.2
5.12.2
2018-01-28 14:32:39 -05:00
Ben12345rocks cd7fa2cd39 Minor change 2018-01-28 13:55:43 -05:00
Ben12345rocks 62afcfc820 Add more debug 2018-01-24 17:28:17 -05:00
Ben12345rocks 12233d1061 Bug fix, closes #338 2018-01-22 16:51:44 -05:00
Ben12345rocks c2b3178f2e Bug fixes 2018-01-21 19:05:38 -05:00
Ben12345rocks 2e01c1eafd Bug fix 2018-01-21 15:07:19 -05:00
Ben12345rocks 384ace3013 Add option to clear cache on vote 2018-01-20 17:47:31 -05:00
6 changed files with 48 additions and 8 deletions

No files matched your search

+5
View File
@@ -798,6 +798,11 @@ DelayBetweenUpdates: 3
# Clear cache on update, setting to true reduces performance
ClearCacheOnUpdate: false
# Clears cache for the player who voted only
# Only effects if using mysql
# Would recommend for some bungee setups
ClearCacheOnVote: false
# Set to true to disable no service site message on voting
# You should never have to touch this if everything is setup properly
# Will also disable a few other warnings about vote sites
+1 -1
View File
@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.Ben12345rocks</groupId>
<artifactId>VotingPlugin</artifactId>
<version>5.12.1</version>
<version>5.12.2</version>
<packaging>jar</packaging>
<name>VotingPlugin</name>
<properties>
@@ -1478,4 +1478,8 @@ public class Config extends YMLFile {
saveData();
}
public boolean getClearCacheOnVote() {
return getData().getBoolean("ClearCacheOnVote");
}
}
@@ -57,7 +57,7 @@ public class PlayerJoinEvent implements Listener {
// run remind
user.loginMessage();
if (UserManager.getInstance().getAllUUIDs().contains(player.getUniqueId().toString())) {
if (user.getData().hasData()) {
// give offline vote (if they voted
// offline)
@@ -7,6 +7,8 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import com.Ben12345rocks.AdvancedCore.AdvancedCoreHook;
import com.Ben12345rocks.AdvancedCore.Objects.UserStorage;
import com.Ben12345rocks.AdvancedCore.Util.Misc.ArrayUtils;
import com.Ben12345rocks.AdvancedCore.Util.Misc.PlayerUtils;
import com.Ben12345rocks.VotingPlugin.Main;
@@ -115,6 +117,12 @@ public class VotiferEvent implements Listener {
OtherVoteReward.getInstance().checkAllSites(user);
OtherVoteReward.getInstance().checkCumualativeVotes(user);
OtherVoteReward.getInstance().checkMilestone(user);
if (Config.getInstance().getClearCacheOnVote()) {
if (AdvancedCoreHook.getInstance().getStorageType().equals(UserStorage.MYSQL)) {
AdvancedCoreHook.getInstance().getMysql().removePlayer(user.getUUID());
}
}
}
plugin.setUpdate(true);
@@ -177,6 +185,7 @@ public class VotiferEvent implements Listener {
plugin.getServer().getPluginManager().callEvent(voteEvent);
if (voteEvent.isCancelled()) {
plugin.debug("Vote cancelled");
return;
}
@@ -142,6 +142,7 @@ public class Main extends JavaPlugin {
values.put(key, user.getData().getString(key));
}
data.put(user, values);
debug("[Convert] Added " + uuid);
} catch (Exception e) {
AdvancedCoreHook.getInstance().debug(e);
plugin.getLogger().warning("Exception occoured for '" + uuid + "': " + e.getMessage()
@@ -149,6 +150,8 @@ public class Main extends JavaPlugin {
}
}
plugin.getLogger().info("Finished getting data from " + from.toString());
AdvancedCoreHook.getInstance().setStorageType(to);
loadMySQL();
@@ -164,6 +167,8 @@ public class Main extends JavaPlugin {
}
}
AdvancedCoreHook.getInstance().setStorageType(cur);
plugin.getLogger().info("Finished convertting");
}
public ArrayList<User> convertSet(Set<User> set) {
@@ -281,13 +286,20 @@ public class Main extends JavaPlugin {
}
private void loadTimer() {
AdvancedCoreHook.getInstance().getTimer().schedule(new TimerTask() {
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
@Override
public void run() {
update();
AdvancedCoreHook.getInstance().getTimer().schedule(new TimerTask() {
@Override
public void run() {
update();
}
}, 1000, 1000 * 60 * Config.getInstance().getDelayBetweenUpdates());
}
}, 1000, 1000 * 60 * Config.getInstance().getDelayBetweenUpdates());
});
}
/**
@@ -699,14 +711,22 @@ public class Main extends JavaPlugin {
loadTimer();
plugin.getLogger().info("Enabled VotingPlgin " + plugin.getDescription().getVersion());
plugin.getLogger().info("Enabled VotingPlugin " + plugin.getDescription().getVersion());
ArrayList<String> services = ServerData.getInstance().getServiceSites();
for (VoteSite site : getVoteSites()) {
if (!site.hasRewards()) {
plugin.getLogger().warning("No rewards detected for the site: " + site.getKey()
+ ". See https://github.com/Ben12345rocks/AdvancedCore/wiki/Rewards on how to add rewards");
}
if (!ServerData.getInstance().getServiceSites().contains(site.getServiceSite())) {
boolean contains = false;
for (String service : services) {
if (service.equalsIgnoreCase(site.getServiceSite())) {
contains = true;
}
}
if (!contains) {
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");
}
@@ -825,7 +845,7 @@ public class Main extends JavaPlugin {
updateAdvancedCoreHook();
plugin.loadVoteSites();
AdvancedCoreHook.getInstance().reload();
loadTimer();
// loadTimer();
}
@@ -900,6 +920,8 @@ public class Main extends JavaPlugin {
if (uuid != null && !uuid.isEmpty()) {
User user = UserManager.getInstance().getVotingPluginUser(new UUID(uuid));
users.add(user);
// AdvancedCoreHook.getInstance().extraDebug("Loading " + uuid);
// java.lang.Thread.sleep(5000);
}
}
update = false;