Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
21c4be4148 | ||
|
|
d44290dcdc | ||
|
|
702c739ec8 | ||
|
|
c1122bd939 | ||
|
|
bdaa896fc1 | ||
|
|
3b1c051fd2 | ||
|
|
11194f819e | ||
|
|
662eb16fdd | ||
|
|
d65070973c | ||
|
|
cef41348cc | ||
|
|
bcba694308 | ||
|
|
fbd7c6d3fc | ||
|
|
f842c08d62 | ||
|
|
4e58a6915f | ||
|
|
4336644fbc | ||
|
|
e32909ac58 | ||
|
|
bd16e2ccaf | ||
|
|
36fa55139e | ||
|
|
b128280d5f | ||
|
|
51e3f05031 | ||
|
|
19b83070c6 | ||
|
|
5622956e75 | ||
|
|
1ac3ea4916 | ||
|
|
391cc0edf1 | ||
|
|
a59a98f8cb | ||
|
|
e62213bfd5 | ||
|
|
61b77c4754 | ||
|
|
758aaa3dd7 | ||
|
|
51389a27fb | ||
|
|
37b94cc36c | ||
|
|
1e4796d418 | ||
|
|
62b0d6012d | ||
|
|
52726c8bb3 | ||
|
|
ede06e0923 | ||
|
|
6eb2c95cc0 |
No files matched your search
@@ -575,6 +575,7 @@ VoteShopLimitReached: '&aYou reached your limit'
|
||||
Shop:
|
||||
# Identifier
|
||||
# Used in placeholders for formats
|
||||
# Do not have spaces in the identifier
|
||||
Diamond:
|
||||
# Item
|
||||
Material: 'DIAMOND'
|
||||
@@ -608,13 +609,12 @@ Shop:
|
||||
# To disable reward set value to []
|
||||
# Eg:
|
||||
# FirstVote: [] (All in one line)
|
||||
# By default all rewards are disabled
|
||||
# Rewards will be given if there is a reward to give
|
||||
|
||||
# First vote rewards
|
||||
FirstVote:
|
||||
Messages:
|
||||
Player: '&aYou voted for your first time!'
|
||||
Money: 100
|
||||
|
||||
# All vote rewards
|
||||
# Reward for voting on all sites in one day
|
||||
@@ -949,9 +949,27 @@ LoadSkulls: true
|
||||
# May not work on some plugins
|
||||
UseVaultPermissions: false
|
||||
|
||||
# List of disabled commands from /vote
|
||||
# List the specific permission
|
||||
# E.g:
|
||||
# - PERMISSION
|
||||
DisabledCommands: []
|
||||
|
||||
# Enable to true for extra player checks
|
||||
ExtraBackgroundUpdate: false
|
||||
|
||||
# --------------------------
|
||||
# Bungee Setup
|
||||
# Only if using votingplugin bungee to send votes
|
||||
# REQUIRES RESTART FOR CHANGES TO TAKE EFFECT
|
||||
# --------------------------
|
||||
|
||||
# Plugin using bungee, requires plugin on bungee server
|
||||
UseBungeecoord: false
|
||||
|
||||
# Get the plugin to broadcast to all servers
|
||||
BungeeBroadcast: false
|
||||
|
||||
# What server this is in bungee (must match)
|
||||
# Also can be applied to rewards
|
||||
Server: PleaseSet
|
||||
@@ -964,16 +982,7 @@ BungeeServer:
|
||||
# Bungee communication, add this to bungee server
|
||||
SpigotServer:
|
||||
Host: '127.0.0.1'
|
||||
POrt: 1298
|
||||
|
||||
# Get the plugin to broadcast to all servers
|
||||
BungeeBroadcast: false
|
||||
|
||||
# List of disabled commands from /vote
|
||||
# List the specific permission
|
||||
# E.g:
|
||||
# - PERMISSION
|
||||
DisabledCommands: []
|
||||
Port: 1298
|
||||
|
||||
# ---------------------------------------------------------
|
||||
# Mysql cache options
|
||||
|
||||
@@ -4,7 +4,7 @@ main: com.Ben12345rocks.VotingPlugin.Main
|
||||
description: Highly Customizable Voting Listener!
|
||||
website: https://www.spigotmc.org/resources/votingplugin.15358/
|
||||
author: Ben12345rocks
|
||||
softdepend: [MVdWPlaceholders, Votifier, CMI]
|
||||
softdepend: [MVdWPlaceholders, Votifier, CMI, Vault, PlaceholderAPI, ProtocolLib]
|
||||
api-version: 1.13
|
||||
commands:
|
||||
vote:
|
||||
@@ -225,4 +225,6 @@ permissions:
|
||||
default: false
|
||||
VotingPlugin.Sign.Create:
|
||||
description: Permission to create sign
|
||||
VotingPlugin.Admin.GenerateServiceSite:
|
||||
description: Permission for generating votesite message
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.Ben12345rocks</groupId>
|
||||
<artifactId>VotingPlugin</artifactId>
|
||||
<version>5.20.6</version>
|
||||
<version>5.21</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>VotingPlugin</name>
|
||||
<properties>
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
@@ -21,6 +22,8 @@ import com.Ben12345rocks.AdvancedCore.CommandAPI.CommandHandler;
|
||||
import com.Ben12345rocks.AdvancedCore.CommandAPI.TabCompleteHandle;
|
||||
import com.Ben12345rocks.AdvancedCore.CommandAPI.TabCompleteHandler;
|
||||
import com.Ben12345rocks.AdvancedCore.Commands.GUI.UserGUI;
|
||||
import com.Ben12345rocks.AdvancedCore.Rewards.RewardHandler;
|
||||
import com.Ben12345rocks.AdvancedCore.Rewards.RewardOptions;
|
||||
import com.Ben12345rocks.AdvancedCore.UserManager.UUID;
|
||||
import com.Ben12345rocks.AdvancedCore.UserManager.UserStorage;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Inventory.BInventory;
|
||||
@@ -340,6 +343,19 @@ public class CommandLoader {
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand().add(new CommandHandler(new String[] { "ResyncMilestones", "(player)" },
|
||||
"VotingPlugin.Commands.AdminVote.SetResyncMilestones|" + adminPerm, "Resync Milestones") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(args[1]);
|
||||
user.setMilestoneCount(user.getTotal(TopVoter.AllTime));
|
||||
|
||||
sendMessage(sender, "&cResynced milestones for " + args[1]);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand()
|
||||
.add(new CommandHandler(new String[] { "User", "(player)", "AddPoints", "(number)" },
|
||||
"VotingPlugin.Commands.AdminVote.AddPoints|" + adminPerm, "Add to players voting points") {
|
||||
@@ -509,6 +525,8 @@ public class CommandLoader {
|
||||
});
|
||||
|
||||
}
|
||||
sendMessage(sender,
|
||||
"Using AdvancedCore " + plugin.getVersion() + "' built on '" + plugin.getBuildTime());
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1085,6 +1103,7 @@ public class CommandLoader {
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(args[1]);
|
||||
SpecialRewards.getInstance().giveMilestoneVoteReward(user, user.isOnline(), parseInt(args[3]));
|
||||
sendMessage(sender, "&cMilestone " + args[3] + " forced");
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1096,6 +1115,7 @@ public class CommandLoader {
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(args[1]);
|
||||
SpecialRewards.getInstance().giveCumulativeVoteReward(user, user.isOnline(), parseInt(args[3]));
|
||||
sendMessage(sender, "&cCummulative " + args[3] + " forced");
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1106,6 +1126,7 @@ public class CommandLoader {
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(args[1]);
|
||||
SpecialRewards.getInstance().giveAllSitesRewards(user, user.isOnline());
|
||||
sendMessage(sender, "&cAllSites forced");
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1116,6 +1137,7 @@ public class CommandLoader {
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(args[1]);
|
||||
SpecialRewards.getInstance().giveFirstVoteRewards(user, user.isOnline());
|
||||
sendMessage(sender, "&cFirstVote forced");
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1128,6 +1150,7 @@ public class CommandLoader {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(args[1]);
|
||||
SpecialRewards.getInstance().giveVoteStreakReward(user, user.isOnline(), args[3], args[4],
|
||||
parseInt(args[4]));
|
||||
sendMessage(sender, "&cVoteStreak " + args[3] + " " + args[4] + " forced");
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1408,6 +1431,83 @@ public class CommandLoader {
|
||||
PlayerGUIs.getInstance().openVoteShop((Player) sender);
|
||||
}
|
||||
});
|
||||
plugin.getVoteCommand().add(new CommandHandler(new String[] { "Shop", "(Text)" },
|
||||
"VotingPlugin.Commands.Vote.Shop|" + playerPerm, "Open VoteShop GUI", false) {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
if (!Config.getInstance().getVoteShopEnabled()) {
|
||||
sender.sendMessage(StringParser.getInstance().colorize("&cVote shop disabled"));
|
||||
return;
|
||||
}
|
||||
|
||||
String identifier = args[1];
|
||||
Set<String> identifiers = Config.getInstance().getIdentifiers();
|
||||
if (ArrayUtils.getInstance().containsIgnoreCase(identifiers, identifier)) {
|
||||
for (String ident : identifiers) {
|
||||
if (ident.equalsIgnoreCase(args[1])) {
|
||||
identifier = ident;
|
||||
}
|
||||
}
|
||||
|
||||
String perm = Config.getInstance().getVoteShopPermission(identifier);
|
||||
boolean hasPerm = false;
|
||||
if (perm.isEmpty()) {
|
||||
hasPerm = true;
|
||||
} else {
|
||||
hasPerm = sender.hasPermission(perm);
|
||||
}
|
||||
|
||||
int limit = Config.getInstance().getIdentifierLimit(identifier);
|
||||
|
||||
User user = UserManager.getInstance().getVotingPluginUser(sender.getName());
|
||||
boolean limitPass = true;
|
||||
if (limit > 0) {
|
||||
|
||||
if (user.getVoteShopIdentifierLimit(identifier) >= limit) {
|
||||
limitPass = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!Config.getInstance().getVoteShopNotBuyable(identifier)) {
|
||||
if (hasPerm) {
|
||||
user.clearCache();
|
||||
int points = Config.getInstance().getIdentifierCost(identifier);
|
||||
if (identifier != null) {
|
||||
|
||||
if (limitPass) {
|
||||
HashMap<String, String> placeholders = new HashMap<String, String>();
|
||||
placeholders.put("identifier", identifier);
|
||||
placeholders.put("points", "" + points);
|
||||
placeholders.put("limit", "" + limit);
|
||||
if (user.removePoints(points)) {
|
||||
|
||||
RewardHandler.getInstance().giveReward(user, Config.getInstance().getData(),
|
||||
Config.getInstance().getIdentifierRewardsPath(identifier),
|
||||
new RewardOptions().setPlaceholders(placeholders));
|
||||
|
||||
user.sendMessage(StringParser.getInstance().replacePlaceHolder(
|
||||
Config.getInstance().getFormatShopPurchaseMsg(), placeholders));
|
||||
if (limit > 0) {
|
||||
user.setVoteShopIdentifierLimit(identifier,
|
||||
user.getVoteShopIdentifierLimit(identifier) + 1);
|
||||
}
|
||||
} else {
|
||||
user.sendMessage(StringParser.getInstance().replacePlaceHolder(
|
||||
Config.getInstance().getFormatShopFailedMsg(), placeholders));
|
||||
}
|
||||
} else {
|
||||
user.sendMessage(Config.getInstance().getVoteShopLimitReached());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sendMessage(sender, "&cWrong voteshop item");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
plugin.getVoteCommand().add(new CommandHandler(new String[] { "URL" },
|
||||
|
||||
@@ -924,7 +924,7 @@ public class Commands {
|
||||
MessageBuilder message = new MessageBuilder(config.getFormatCommandsVoteURLS());
|
||||
message.replacePlaceholder("num", Integer.toString(counter)).replacePlaceholder("url", voteURL)
|
||||
.replacePlaceholder("SiteName", voteSite.getDisplayName())
|
||||
.replacePlaceholder("player", user.getPlayerName())
|
||||
.replacePlaceholder("player", "" + user.getPlayerName())
|
||||
.replacePlaceholder("Next", "" + voteCommandNextInfo(user, voteSite)).colorize();
|
||||
sites.add(message.getText());
|
||||
}
|
||||
|
||||
@@ -56,6 +56,10 @@ public class Config extends YMLFile {
|
||||
@ConfigDataBoolean(path = "Commands.VoteRewardFromVoteURL")
|
||||
@Getter
|
||||
private boolean commandsVoteRewardFromVoteURL = false;
|
||||
|
||||
@ConfigDataBoolean(path = "ExtraBackgroundUpdate")
|
||||
@Getter
|
||||
private boolean extraBackgroundUpdate = false;
|
||||
|
||||
@ConfigDataString(path = "Format.Commands.Vote.Last.TimeFormat", defaultValue = "%amount% %TimeType%")
|
||||
@Getter
|
||||
@@ -69,9 +73,9 @@ public class Config extends YMLFile {
|
||||
@Getter
|
||||
private String formatCommandsVoteLastNeverVoted;
|
||||
|
||||
@ConfigDataString(path = "Format.Commands.Vote.Last.LastVoted", defaultValue = "%times% ago")
|
||||
@ConfigDataString(path = "Format.Commands.Vote.Last.LastVoted")
|
||||
@Getter
|
||||
private String formatCommandsVoteLastLastVoted;
|
||||
private String formatCommandsVoteLastLastVoted = "%times% ago";
|
||||
|
||||
@ConfigDataString(path = "Format.TimeFormats.Days", defaultValue = "Days")
|
||||
@Getter
|
||||
@@ -125,6 +129,10 @@ public class Config extends YMLFile {
|
||||
@Getter
|
||||
private boolean addTotals = true;
|
||||
|
||||
@ConfigDataBoolean(path = "AlterColumns")
|
||||
@Getter
|
||||
private boolean alterColumns = true;
|
||||
|
||||
@Getter
|
||||
private String allSitesRewardPath = "AllSites";
|
||||
|
||||
|
||||
@@ -6,11 +6,14 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Messages.StringParser;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Misc.ArrayUtils;
|
||||
import com.Ben12345rocks.AdvancedCore.YML.YMLFile;
|
||||
import com.Ben12345rocks.VotingPlugin.Main;
|
||||
@@ -65,6 +68,13 @@ public class ConfigVoteSites extends YMLFile {
|
||||
set(siteName, "Rewards.Messages.Player", "&aThanks for voting on %ServiceSite%!");
|
||||
|
||||
plugin.loadVoteSites();
|
||||
|
||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
if (p.hasPermission("VotingPlugin.Admin.GenerateServiceSite")) {
|
||||
p.sendMessage(StringParser.getInstance().colorize("&cGenerating votesite for service site "
|
||||
+ siteName + ", please check console for details"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ public class VotiferEvent implements Listener {
|
||||
}
|
||||
|
||||
plugin.getLogger()
|
||||
.info("Recieved a vote from service site '" + voteSite + "' by player '" + voteUsername + "'!");
|
||||
.info("Received a vote from service site '" + voteSite + "' by player '" + voteUsername + "'!");
|
||||
|
||||
plugin.debug("PlayerUsername: " + voteUsername);
|
||||
plugin.debug("VoteSite: " + voteSite);
|
||||
|
||||
@@ -137,6 +137,8 @@ public class Main extends AdvancedCorePlugin {
|
||||
@Getter
|
||||
private boolean ymlError = false;
|
||||
|
||||
private boolean votifierLoaded = true;
|
||||
|
||||
/**
|
||||
* Check votifier.
|
||||
*/
|
||||
@@ -144,8 +146,13 @@ public class Main extends AdvancedCorePlugin {
|
||||
try {
|
||||
Class.forName("com.vexsoftware.votifier.model.VotifierEvent");
|
||||
} catch (ClassNotFoundException e) {
|
||||
plugin.getLogger()
|
||||
.warning("No VotifierEvent found, install Votifier, NuVotifier, or another Votifier plugin");
|
||||
if (!Config.getInstance().isUseBungeeCoord()) {
|
||||
plugin.getLogger()
|
||||
.warning("No VotifierEvent found, install Votifier, NuVotifier, or another Votifier plugin");
|
||||
} else {
|
||||
plugin.debug("No VotifierEvent found, but usebungeecoord enabled");
|
||||
}
|
||||
votifierLoaded = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -417,6 +424,18 @@ public class Main extends AdvancedCorePlugin {
|
||||
}
|
||||
}, 1000 * 60 * 10, 1000 * 60 * 5);
|
||||
|
||||
getTimer().schedule(new TimerTask() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (plugin != null && Config.getInstance().isExtraBackgroundUpdate()) {
|
||||
basicBungeeUpdate();
|
||||
} else {
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
}, 1000, 1000 * 30);
|
||||
|
||||
}
|
||||
}, 40L);
|
||||
|
||||
@@ -767,8 +786,8 @@ public class Main extends AdvancedCorePlugin {
|
||||
}
|
||||
|
||||
registerCommands();
|
||||
registerEvents();
|
||||
checkVotifier();
|
||||
registerEvents();
|
||||
CheckUpdate.getInstance().startUp();
|
||||
VoteReminding.getInstance().loadRemindChecking();
|
||||
plugin.signs = new ArrayList<SignHandler>();
|
||||
@@ -830,7 +849,7 @@ public class Main extends AdvancedCorePlugin {
|
||||
}
|
||||
|
||||
// set columns
|
||||
if (getStorageType().equals(UserStorage.MYSQL)) {
|
||||
if (getStorageType().equals(UserStorage.MYSQL) && Config.getInstance().isAlterColumns()) {
|
||||
getMysql().alterColumnType("TopVoterIgnore", "VARCHAR(5)");
|
||||
getMysql().alterColumnType("CheckWorld", "VARCHAR(5)");
|
||||
getMysql().alterColumnType("Reminded", "VARCHAR(5)");
|
||||
@@ -1006,7 +1025,11 @@ public class Main extends AdvancedCorePlugin {
|
||||
}, 0);
|
||||
HandlerList.unregisterAll(plugin);
|
||||
if (Config.getInstance().isUseBungeeCoord()) {
|
||||
BungeeHandler.getInstance().close();
|
||||
try {
|
||||
BungeeHandler.getInstance().close();
|
||||
} catch (Exception e) {
|
||||
debug(e);
|
||||
}
|
||||
}
|
||||
plugin = null;
|
||||
}
|
||||
@@ -1051,7 +1074,9 @@ public class Main extends AdvancedCorePlugin {
|
||||
PluginManager pm = getServer().getPluginManager();
|
||||
|
||||
pm.registerEvents(new PlayerJoinEvent(this), this);
|
||||
pm.registerEvents(new VotiferEvent(this), this);
|
||||
if (votifierLoaded) {
|
||||
pm.registerEvents(new VotiferEvent(this), this);
|
||||
}
|
||||
pm.registerEvents(new PlayerVoteListener(this), this);
|
||||
pm.registerEvents(new SignChange(this), this);
|
||||
pm.registerEvents(new BlockBreak(this), this);
|
||||
@@ -1150,9 +1175,11 @@ public class Main extends AdvancedCorePlugin {
|
||||
ServerData.getInstance().updateValues();
|
||||
Signs.getInstance().updateSigns();
|
||||
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(player);
|
||||
user.offVote();
|
||||
if (!Config.getInstance().isExtraBackgroundUpdate()) {
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(player);
|
||||
user.offVote();
|
||||
}
|
||||
}
|
||||
time1 = ((System.currentTimeMillis() - time) / 1000);
|
||||
plugin.debug("Background task finished in " + time1 + " seconds");
|
||||
@@ -1168,6 +1195,15 @@ public class Main extends AdvancedCorePlugin {
|
||||
}
|
||||
}
|
||||
|
||||
public void basicBungeeUpdate() {
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(player);
|
||||
user.clearCache();
|
||||
user.offVote();
|
||||
user.checkOfflineRewards();
|
||||
}
|
||||
}
|
||||
|
||||
public void updateAdvancedCoreHook() {
|
||||
getJavascriptEngine().put("VotingPlugin", this);
|
||||
allowDownloadingFromSpigot(15358);
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.Ben12345rocks.VotingPlugin.Util.PlaceHolders;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Locale;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.bukkit.OfflinePlayer;
|
||||
@@ -236,6 +238,15 @@ public class PlaceHolders {
|
||||
}
|
||||
}.withDescription("User points"));
|
||||
|
||||
placeholders.add(new PlaceHolder<User>("Points_Format") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
NumberFormat numberFormat = NumberFormat.getNumberInstance(Locale.US);
|
||||
return numberFormat.format(user.getPoints());
|
||||
}
|
||||
}.withDescription("User points"));
|
||||
|
||||
placeholders.add(new PlaceHolder<User>("CanVote") {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -15,6 +15,7 @@ import lombok.Getter;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.api.plugin.Plugin;
|
||||
import net.md_5.bungee.config.Configuration;
|
||||
import net.md_5.bungee.event.EventHandler;
|
||||
|
||||
public class Bungee extends Plugin implements net.md_5.bungee.api.plugin.Listener {
|
||||
|
||||
@@ -96,8 +97,10 @@ public class Bungee extends Plugin implements net.md_5.bungee.api.plugin.Listene
|
||||
config.load();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onVote(VotifierEvent event) {
|
||||
Vote vote = event.getVote();
|
||||
getLogger().info("Vote received " + vote.getUsername() + " from service site " + vote.getServiceName());
|
||||
saveVote(vote.getUsername(), vote.getServiceName());
|
||||
}
|
||||
|
||||
@@ -129,10 +132,10 @@ public class Bungee extends Plugin implements net.md_5.bungee.api.plugin.Listene
|
||||
ProxiedPlayer p = getProxy().getPlayer(name);
|
||||
|
||||
String server = "";
|
||||
if (p.isConnected()) {
|
||||
if (p != null && p.isConnected()) {
|
||||
server = p.getServer().getInfo().getName();
|
||||
} else {
|
||||
server = p.getReconnectServer().getName();
|
||||
server = config.getFallBack();
|
||||
}
|
||||
if (config.getBlockedServers().contains(server)) {
|
||||
server = config.getFallBack();
|
||||
|
||||
@@ -56,7 +56,7 @@ public class Config {
|
||||
}
|
||||
|
||||
public boolean getSendToOnlineServer() {
|
||||
return getData().getBoolean("SendVotesToAllServers");
|
||||
return getData().getBoolean("SendToOnlineServer");
|
||||
}
|
||||
|
||||
public String getBungeeHost() {
|
||||
|
||||
@@ -25,6 +25,7 @@ public class VotingPluginBungeeCommand extends Command {
|
||||
String user = args[1];
|
||||
String site = args[2];
|
||||
bungee.saveVote(user, site);
|
||||
sender.sendMessage(new TextComponent("Sending vote"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user