Compare commits

...
19 Commits
Author SHA1 Message Date
BenCodez 116eda2866 Update version number to 6.8.3 2022-02-20 13:44:33 -05:00
BuildTools 30f1576510 Fix creating milestones in GUI not working correctly 2022-02-19 17:00:05 -05:00
BuildTools 64e897615a use java timer for login/logout event 2022-02-18 19:16:18 -05:00
BuildTools 2dfd8dcfa5 Update version number to 6.8.2 2022-02-13 15:59:08 -05:00
BuildTools 00791766f1 Change default value of config option 2022-02-13 14:28:26 -05:00
ben 4d2c783d85 Improve getting uuid on proxy setups, more efficient 2022-02-11 17:14:05 -05:00
ben 19f1664662 Ignore casing when checking for disabled votesites 2022-02-06 12:34:01 -05:00
ben ca2e6fb530 Add extra null check 2022-02-02 16:57:28 -05:00
Ben eca7c6641a Merge pull request #1220 from pseudoforceyt/patch-1
Fix bungee setup wiki link
2022-01-24 16:46:52 -05:00
Ilamparithi M 47fe6b57e2 Fix bungee setup wiki link 2022-01-24 19:34:57 +05:30
ben 911819c69b Fix weekly top voters rewards feeding off monthly top voters 2022-01-23 14:03:25 -05:00
ben cda72b5c5b Let AdvancedCore handle vanished players 2022-01-23 13:18:16 -05:00
ben 75a3da98fa Change dependency 2022-01-22 15:24:13 -05:00
ben ced74fdee3 Changes to vanish event 2022-01-22 14:22:58 -05:00
ben b8460ff755 Add debug message for vanish login 2022-01-21 22:08:29 -05:00
ben 50bb1facc4 Modify event handling for playershowevent 2022-01-21 21:20:54 -05:00
ben 5ed21949e1 Add soft depends 2022-01-19 21:28:09 -05:00
ben 253e4937db Fix playershowevent not working completely 2022-01-19 19:51:32 -05:00
ben 192685ceec Add playershowevent for vanished players 2022-01-19 17:10:38 -05:00
16 changed files with 55 additions and 30 deletions

No files matched your search

+2 -2
View File
@@ -9,7 +9,7 @@ UseBungeecord: false
# What type of bungee setup
# Requires restart and set on all servers
# https://github.com/BenCodez/VotingPlugin/wiki/Bungeecoord-Setups
# https://github.com/BenCodez/VotingPlugin/wiki/Bungeecord-Setups
# Available:
# SOCKETS
# PLUGINMESSAGING
@@ -66,4 +66,4 @@ BungeeVotePartyRewards: {}
# For socket setup below only
# -----------------------------
# Options available here:
# https://github.com/BenCodez/VotingPlugin/wiki/Bungee-Setup-SOCKETS
# https://github.com/BenCodez/VotingPlugin/wiki/Bungee-Setup-SOCKETS
+2 -1
View File
@@ -444,7 +444,8 @@ UsePrimaryAccountForPlaceholders: false
AlwaysWaitForCachePlaceholders: false
# Enable auto caching placeholders
AutoCachePlaceholders: true
# Generally this works well, but if you need to cache placeholders manually set them below
AutoCachePlaceholders: false
# Set which placeholders to cache at all times
# Use for placeholders to are pulled constantly or on the main thread
+1 -1
View File
@@ -4,7 +4,7 @@ main: com.bencodez.votingplugin.VotingPluginMain
description: Highly Customizable Voting Listener!
website: https://www.spigotmc.org/resources/votingplugin.15358/
author: BenCodez
softdepend: [MVdWPlaceholders, Votifier, VotifierPlus, NuVotifier, CMI, Vault, PlaceholderAPI, ProtocolLib, MVdWPlaceholderAPI, AuthMe]
softdepend: [MVdWPlaceholders, Votifier, VotifierPlus, NuVotifier, CMI, Vault, PlaceholderAPI, ProtocolLib, MVdWPlaceholderAPI, AuthMe, SuperVanish, PremiumVanish]
loadbefore: [MCPerks]
api-version: 1.13
libraries:
+1 -1
View File
@@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.bencodez</groupId>
<artifactId>votingplugin</artifactId>
<version>6.8.1</version>
<version>6.8.3</version>
<packaging>jar</packaging>
<name>VotingPlugin</name>
<properties>
@@ -344,11 +344,10 @@ public class VotingPluginMain extends AdvancedCorePlugin {
return siteName;
}
}
}
for (String siteName : sites) {
if (siteName.equalsIgnoreCase(url)) {
return siteName;
}
}
}
return url;
@@ -20,6 +20,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
import java.util.regex.Pattern;
import java.util.zip.ZipEntry;
@@ -87,6 +88,8 @@ public class VotingPluginBungee extends Plugin implements Listener {
@Getter
private TimeHandle timeHandle;
private ConcurrentHashMap<UUID, String> uuidPlayerNameCache = new ConcurrentHashMap<UUID, String>();
public synchronized void checkCachedVotes(String server) {
if (getProxy().getServerInfo(server) != null) {
if (!getProxy().getServerInfo(server).getPlayers().isEmpty()) {
@@ -153,6 +156,9 @@ public class VotingPluginBungee extends Plugin implements Listener {
}
public UUID fetchUUID(String playerName) throws Exception {
if (playerName == null || playerName.equalsIgnoreCase("null")) {
return null;
}
// Get response from Mojang API
URL url = new URL("https://api.mojang.com/users/profiles/minecraft/" + playerName);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
@@ -188,6 +194,13 @@ public class VotingPluginBungee extends Plugin implements Listener {
if (p != null && p.isConnected()) {
return p.getUniqueId().toString();
}
for (Entry<UUID, String> entry : uuidPlayerNameCache.entrySet()) {
if (entry.getValue().equalsIgnoreCase(playerName)) {
return entry.getKey().toString();
}
}
if (mysql != null) {
String str = mysql.getUUID(playerName);
if (str != null) {
@@ -379,6 +392,8 @@ public class VotingPluginBungee extends Plugin implements Listener {
this.getProxy().registerChannel("vp:vp");
if (mysqlLoaded) {
uuidPlayerNameCache = mysql.getRowsUUIDNameQuery();
voteCacheFile = new VoteCache(this);
voteCacheFile.load();
@@ -806,6 +821,7 @@ public class VotingPluginBungee extends Plugin implements Listener {
return;
}
// one time query to insert player
if (!mysql.getUuids().contains(uuid)) {
mysql.update(uuid, "PlayerName", new DataValueString(player));
}
@@ -27,6 +27,7 @@ import java.util.Map.Entry;
import java.util.Timer;
import java.util.TimerTask;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
import java.util.regex.Pattern;
import java.util.zip.ZipEntry;
@@ -113,6 +114,8 @@ public class VotingPluginVelocity {
@Getter
private TimeHandle timeHandle;
private ConcurrentHashMap<UUID, String> uuidPlayerNameCache = new ConcurrentHashMap<UUID, String>();
@Inject
public VotingPluginVelocity(ProxyServer server, Logger logger, Metrics.Factory metricsFactory,
@DataDirectory Path dataDirectory) {
@@ -229,6 +232,11 @@ public class VotingPluginVelocity {
return p.getUniqueId().toString();
}
}
for (Entry<UUID, String> entry : uuidPlayerNameCache.entrySet()) {
if (entry.getValue().equalsIgnoreCase(playerName)) {
return entry.getKey().toString();
}
}
if (mysql != null) {
String str = mysql.getUUID(playerName);
if (str != null) {
@@ -445,6 +453,8 @@ public class VotingPluginVelocity {
server.getCommandManager().register(meta, new VotingPluginVelocityCommand(this));
if (mysqlLoaded) {
uuidPlayerNameCache = mysql.getRowsUUIDNameQuery();
voteCacheFile = new VoteCache(new File(dataDirectory.toFile(), "votecache.yml"));
nonVotedPlayersCache = new NonVotedPlayersCache(
new File(dataDirectory.toFile(), "nonvotedplayerscache.yml"), this);
@@ -353,8 +353,8 @@ public class SpecialRewardsConfig extends YMLFile {
}
public void setMilestone(int intValue) {
getData().set("Milestones." + intValue + ".Enabled", true);
getData().set("Milestones." + intValue + ".Rewards.Messages.Player", "&aYou got %milestone% milestone votes!");
getData().set("MileStones." + intValue + ".Enabled", true);
getData().set("MileStones." + intValue + ".Rewards.Messages.Player", "&aYou got %milestone% milestone votes!");
saveData();
}
}
@@ -18,7 +18,7 @@ import com.bencodez.votingplugin.signs.SignHandler;
public class BlockBreak implements Listener {
/** The plugin. */
private static VotingPluginMain plugin;
private VotingPluginMain plugin;
/**
* Instantiates a new block break.
@@ -26,7 +26,7 @@ public class BlockBreak implements Listener {
* @param plugin the plugin
*/
public BlockBreak(VotingPluginMain plugin) {
BlockBreak.plugin = plugin;
this.plugin = plugin;
}
/**
@@ -21,7 +21,7 @@ import com.bencodez.votingplugin.user.UserManager;
public class PlayerInteract implements Listener {
/** The plugin. */
private static VotingPluginMain plugin;
private VotingPluginMain plugin;
/**
* Instantiates a new player interact.
@@ -29,7 +29,7 @@ public class PlayerInteract implements Listener {
* @param plugin the plugin
*/
public PlayerInteract(VotingPluginMain plugin) {
PlayerInteract.plugin = plugin;
this.plugin = plugin;
}
/**
@@ -1,6 +1,7 @@
package com.bencodez.votingplugin.listeners;
import org.bukkit.Bukkit;
import java.util.TimerTask;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@@ -21,7 +22,7 @@ import com.bencodez.votingplugin.user.VotingPluginUser;
public class PlayerJoinEvent implements Listener {
/** The plugin. */
private static VotingPluginMain plugin;
private VotingPluginMain plugin;
/**
* Instantiates a new player join event.
@@ -29,7 +30,7 @@ public class PlayerJoinEvent implements Listener {
* @param plugin the plugin
*/
public PlayerJoinEvent(VotingPluginMain plugin) {
PlayerJoinEvent.plugin = plugin;
this.plugin = plugin;
}
private void login(Player player) {
@@ -71,7 +72,7 @@ public class PlayerJoinEvent implements Listener {
if (delay <= 0) {
login(event.getPlayer());
} else {
Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
plugin.getLoginTimer().schedule(new TimerTask() {
@Override
public void run() {
@@ -88,7 +89,7 @@ public class PlayerJoinEvent implements Listener {
return;
}
final java.util.UUID uuid = event.getPlayer().getUniqueId();
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
plugin.getLoginTimer().schedule(new TimerTask() {
@Override
public void run() {
@@ -98,7 +99,7 @@ public class PlayerJoinEvent implements Listener {
user.dontCache();
user.logoutRewards();
}
});
}, 0);
}
}
@@ -150,8 +150,7 @@ public class PlayerVoteListener implements Listener {
// try logging to file
if (plugin.getConfigFile().isLogVotesToFile()) {
try {
VotingPluginMain.plugin.logVote(
LocalDateTime.now().atZone(ZoneId.systemDefault()).toLocalDateTime(), playerName,
plugin.logVote(LocalDateTime.now().atZone(ZoneId.systemDefault()).toLocalDateTime(), playerName,
voteSite.getKey());
} catch (Exception e) {
e.printStackTrace();
@@ -167,9 +166,8 @@ public class PlayerVoteListener implements Listener {
}
// check if player has voted on all sites in one day
if (((user.isOnline() || voteSite.isGiveOffline())
&& VotingPluginMain.plugin.getOptions().isProcessRewards()) || event.isBungee()) {
if (((user.isOnline() || voteSite.isGiveOffline()) && plugin.getOptions().isProcessRewards())
|| event.isBungee()) {
boolean online = true;
if (event.isBungee()) {
online = event.isWasOnline();
@@ -16,7 +16,7 @@ import com.bencodez.votingplugin.VotingPluginMain;
public class SignChange implements Listener {
/** The plugin. */
private static VotingPluginMain plugin;
private VotingPluginMain plugin;
/**
* Instantiates a new sign change.
@@ -24,7 +24,7 @@ public class SignChange implements Listener {
* @param plugin the plugin
*/
public SignChange(VotingPluginMain plugin) {
SignChange.plugin = plugin;
this.plugin = plugin;
}
/**
@@ -82,7 +82,7 @@ public class VotiferEvent implements Listener {
ArrayList<String> sites = plugin.getConfigVoteSites().getVoteSitesNames(false);
boolean createSite = false;
if (sites != null) {
if (!sites.contains(voteSiteNameStr)) {
if (!ArrayUtils.getInstance().containsIgnoreCase(sites, voteSiteNameStr)) {
createSite = true;
}
} else {
@@ -14,7 +14,7 @@ import com.bencodez.votingplugin.VotingPluginMain;
public class VotingPluginUpdateEvent implements Listener {
/** The plugin. */
private static VotingPluginMain plugin;
private VotingPluginMain plugin;
/**
* Instantiates a new advanced core update event.
@@ -22,7 +22,7 @@ public class VotingPluginUpdateEvent implements Listener {
* @param plugin the plugin
*/
public VotingPluginUpdateEvent(VotingPluginMain plugin) {
VotingPluginUpdateEvent.plugin = plugin;
this.plugin = plugin;
}
/**
@@ -335,7 +335,7 @@ public class TopVoterHandler implements Listener {
int lastTotal = -1;
@SuppressWarnings("unchecked")
LinkedHashMap<TopVoterPlayer, Integer> clone = (LinkedHashMap<TopVoterPlayer, Integer>) plugin
.getTopVoter(TopVoter.Monthly).clone();
.getTopVoter(TopVoter.Weekly).clone();
for (Entry<TopVoterPlayer, Integer> entry : clone.entrySet()) {
VotingPluginUser user = entry.getKey().getUser();
user.dontCache();