Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5618d4b479 | ||
|
|
898b2985e5 | ||
|
|
cd7fa2cd39 | ||
|
|
62afcfc820 | ||
|
|
12233d1061 | ||
|
|
c2b3178f2e | ||
|
|
2e01c1eafd | ||
|
|
384ace3013 | ||
|
|
2693874d99 | ||
|
|
f5b780453c | ||
|
|
7a7bb93091 | ||
|
|
8933dac0db | ||
|
|
822e0a5766 | ||
|
|
e1fdc5cd6b | ||
|
|
3b0451b348 | ||
|
|
4de380318f | ||
|
|
1c7afc8bb3 | ||
|
|
7b15289c43 |
No files matched your search
@@ -25,6 +25,7 @@ MySQL:
|
||||
MaxSize: -1
|
||||
# Table name prefix, for use with mutliple servers
|
||||
Prefix: ''
|
||||
#UseSSL: true
|
||||
|
||||
# Let players who never joined before vote
|
||||
# Recommend: False (Will prevent creating random user data files)
|
||||
@@ -797,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
|
||||
@@ -823,3 +829,7 @@ PurgeOldData: false
|
||||
|
||||
# Minimum number of days offline in order to purge
|
||||
PurgeMin: 90
|
||||
|
||||
# Whether or not to disable checking names on mojang, disable if you hit the rate limit
|
||||
# Shouldn't make a noticeable impact if set to false
|
||||
CheckNameMojang: true
|
||||
@@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.Ben12345rocks</groupId>
|
||||
<artifactId>VotingPlugin</artifactId>
|
||||
<version>5.12</version>
|
||||
<version>5.12.2</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>VotingPlugin</name>
|
||||
<properties>
|
||||
|
||||
@@ -720,7 +720,15 @@ public class CommandLoader {
|
||||
sender.sendMessage(StringUtils.getInstance()
|
||||
.colorize("&cServiceSite is invalid, votes may not work properly"));
|
||||
} else {
|
||||
sender.sendMessage(StringUtils.getInstance().colorize("&aServiceSite is properly setup"));
|
||||
String service = ConfigVoteSites.getInstance().getServiceSite(siteName);
|
||||
if (ServerData.getInstance().getServiceSites().contains(service)) {
|
||||
sender.sendMessage(StringUtils.getInstance().colorize("&aServiceSite is properly setup"));
|
||||
} else {
|
||||
sender.sendMessage(StringUtils.getInstance()
|
||||
.colorize("&cService may not be valid, haven't recieved a vote from " + service
|
||||
+ ", see /av servicesites"));
|
||||
}
|
||||
|
||||
}
|
||||
if (!ConfigVoteSites.getInstance().isVoteURLGood(siteName)) {
|
||||
sender.sendMessage(StringUtils.getInstance().colorize("&cVoteURL is invalid"));
|
||||
|
||||
@@ -4,7 +4,6 @@ import java.time.format.DateTimeFormatter;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -377,6 +376,7 @@ public class PlayerGUIs {
|
||||
"topvoter", topVoter));
|
||||
int pos = 1;
|
||||
for (Entry<User, Integer> entry : users) {
|
||||
|
||||
inv.addButton(new BInventoryButton(
|
||||
new ItemBuilder(MiscUtils.getInstance().setSkullOwner(entry.getKey().getOfflinePlayer()))
|
||||
.setName(Config.getInstance().getGUIVoteTopItemName())
|
||||
@@ -387,13 +387,14 @@ public class PlayerGUIs {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
ItemBuilder item = new ItemBuilder(clickEvent.getClickedItem());
|
||||
String name = ChatColor.stripColor(item.getName()).split(":")[1].trim();
|
||||
//ItemBuilder item = new ItemBuilder(clickEvent.getClickedItem());
|
||||
// String name = ChatColor.stripColor(item.getName()).split(":")[1].trim();
|
||||
String name = (String) clickEvent.getButton().getData("player");
|
||||
|
||||
User user = UserManager.getInstance().getVotingPluginUser(name);
|
||||
openVoteGUI(player, user);
|
||||
}
|
||||
});
|
||||
}.addData("player", entry.getKey().getPlayerName()));
|
||||
pos++;
|
||||
}
|
||||
final TopVoter cur = top;
|
||||
|
||||
@@ -838,7 +838,15 @@ public class Config extends YMLFile {
|
||||
}
|
||||
|
||||
public Set<String> getIdentifiers() {
|
||||
return getData().getConfigurationSection("Shop").getKeys(false);
|
||||
ConfigurationSection shop = getData().getConfigurationSection("Shop");
|
||||
if (shop != null) {
|
||||
return shop.getKeys(false);
|
||||
}
|
||||
return new HashSet<String>();
|
||||
}
|
||||
|
||||
public boolean getCheckNameMojang() {
|
||||
return getData().getBoolean("CheckNameMojang", true);
|
||||
}
|
||||
|
||||
public ConfigurationSection getIdentifierSection(String identifier) {
|
||||
@@ -1470,4 +1478,8 @@ public class Config extends YMLFile {
|
||||
saveData();
|
||||
}
|
||||
|
||||
public boolean getClearCacheOnVote() {
|
||||
return getData().getBoolean("ClearCacheOnVote");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -49,7 +49,7 @@ public class ServerData {
|
||||
ServerData.plugin = plugin;
|
||||
}
|
||||
|
||||
public void addServiceSite(String site) {
|
||||
public synchronized void addServiceSite(String site) {
|
||||
ArrayList<String> l = getServiceSites();
|
||||
if (!getServiceSites().contains(site)) {
|
||||
l.add(site);
|
||||
|
||||
@@ -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,11 +711,24 @@ 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() && !Config.getInstance().getDisableNoServiceSiteMessage()) {
|
||||
plugin.getLogger().warning("No rewards detected for the site: " + site.getKey());
|
||||
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");
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -820,7 +845,7 @@ public class Main extends JavaPlugin {
|
||||
updateAdvancedCoreHook();
|
||||
plugin.loadVoteSites();
|
||||
AdvancedCoreHook.getInstance().reload();
|
||||
loadTimer();
|
||||
// loadTimer();
|
||||
|
||||
}
|
||||
|
||||
@@ -892,8 +917,12 @@ public class Main extends JavaPlugin {
|
||||
ArrayList<String> uuids = UserManager.getInstance().getAllUUIDs();
|
||||
ArrayList<User> users = new ArrayList<User>();
|
||||
for (String uuid : uuids) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(new UUID(uuid));
|
||||
users.add(user);
|
||||
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;
|
||||
long time1 = ((System.currentTimeMillis() - time) / 1000);
|
||||
@@ -944,6 +973,7 @@ public class Main extends JavaPlugin {
|
||||
|
||||
AdvancedCoreHook.getInstance().setPurgeOldData(Config.getInstance().getPurgeOldData());
|
||||
AdvancedCoreHook.getInstance().setPurgeMinimumDays(Config.getInstance().getPurgeMin());
|
||||
AdvancedCoreHook.getInstance().setCheckNameMojang(Config.getInstance().getCheckNameMojang());
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user