Compare commits

...
17 Commits
Author SHA1 Message Date
BenCodez ad6a09ba85 Bug fix 2020-12-22 16:58:55 -05:00
BenCodez 1791ec5e46 Merge branch 'master' of https://github.com/BenCodez/VotingPlugin 2020-12-22 16:57:24 -05:00
BenCodez 46457a9e61 Update version number 2020-12-22 16:56:23 -05:00
Ben 38ab221fd8 Little bug fix 2020-12-22 05:39:59 -05:00
BenCodez fc2317655e Change default option 2020-12-21 20:12:52 -05:00
BenCodez fb183b9f1f Add option 2020-12-21 18:40:49 -05:00
BenCodez 64057723b6 Update version number 2020-12-19 17:51:20 -05:00
BenCodez 703662c0c0 Bug fix 2020-12-19 17:51:01 -05:00
BenCodez ac72b47362 Update version number 2020-12-19 16:57:43 -05:00
BenCodez 6ca0e26e9c Add per shop message for purchases 2020-12-19 16:45:59 -05:00
BenCodez 168f2fbce2 Improvements 2020-12-17 19:21:51 -05:00
BenCodez a45370011e Little change 2020-12-14 16:58:21 -05:00
BenCodez f85c97f50a Bug fix 2020-12-09 17:14:01 -05:00
BenCodez 1651f8b626 Add option 2020-12-08 21:27:31 -05:00
BenCodez ad08e4cfcf Little fix 2020-12-06 12:08:17 -05:00
BenCodez 91ec3456f5 Little change 2020-12-06 12:02:36 -05:00
BenCodez 4c4f0ef6ae Add per vote shop purchase confirmations 2020-11-30 19:04:51 -05:00
17 changed files with 62 additions and 24 deletions

No files matched your search

@@ -28,6 +28,10 @@ BungeeDebug: false
# If false you need to enable
BungeeBroadcast: false
# If true & AllowUnJoined is false (Config.yml) it will remove any invalid players
# Not fully tested, could cause some trouble in some cases
RemoveInvalidUsers: false
# What server this is in bungee (must match)
# Also can be applied to rewards
Server: PleaseSet
+8 -4
View File
@@ -288,7 +288,7 @@ Format:
Amount: 1
Name: '&aNext Page'
InvFull: '&cInventory full, dropping items on ground'
InvFull: '&cInventory full'
# Display text
# Used in /vote top (GUI)
@@ -351,6 +351,10 @@ PointsOnVote: 1
# Not really recommended
AddTotals: true
# If true, items given for rewards are dropped on the ground
# If false, items will be given when there is space
DropOnFullInv: true
# Click sound when using gui
# Set to none for no sound
ClickSound:
@@ -362,9 +366,9 @@ ClickSound:
# case sensitive
VotingBroadcastBlacklist: []
# Set to false to prevent javascript
# parsing on placeholderapi placeholders
UseJavascriptPlaceholders: true
# When enabled, javascript will be parsed on placeholders (from placeholderapi)
# allows more fancy placeholders with math for example
UseJavascriptPlaceholders: false
# Limit monthly votes to number of days of a month multipled by the number of sites
LimitMonthlyVotes: false
+4
View File
@@ -276,6 +276,10 @@ CHEST:
Permission: ''
# Whether or not to keep GUI open after purchase
CloseGUI: true
# Require confirmation on purchase, overrides global option above
RequireConfirmation: false
# Overrides other purchase message
#PurchaseMessage: 'Thanks for the purchase'
# Limit how many times you can buy this
#Limit: 3
# Reset limit daily/weekly/monthly
@@ -15,6 +15,9 @@ AllSites:
Messages:
Player: '&aYou voted on all sites in 1 day!'
# NOTE: This is not a 1 time reward, that's what milestones are for!
# If total votes (Can be changed) divided by cumulative amount
# and as no remainder (So divides perfectly)then a reward is given
Cumulative:
# Number of votes required
# Allows multiple cumulative rewards
@@ -42,6 +45,7 @@ VoteParty:
#IncreaseVotesRquired: 10
# If true, players who did not vote to reach the votes required will
# recieve the reward
# If false, only players who voted get rewards
GiveAllPlayers: false
# If true, the vote count will reset each day
ResetEachDay: false
@@ -62,6 +66,8 @@ VoteParty:
Commands: []
# Rewards to give per player
Rewards:
# Uncomment below for online player rewards only
#RewardType: ONLINE
Commands:
- say %player%
Items:
@@ -72,6 +78,7 @@ VoteParty:
# Reset milestones at end of the month
ResetMilestonesMonthly: false
# One time reward to be given (unless you reset it somehow)
MileStones:
# Number of votes required
# Allows multiple milestones
@@ -143,6 +150,8 @@ LoginRewards: []
# Will queue until player logs in unless forceoffline is enabled
LogoutRewards: []
EnableMonthlyAwards: true
# Rewards to give
MonthlyAwards:
# Position. 1 is first in top voter, 2 is second, etc...
-3
View File
@@ -141,9 +141,6 @@ commands:
adminvoteClearCache:
description: Command Alias
aliases: avClearCache
adminvoteConvertFrom:
description: Command Alias
aliases: avConvertFrom
adminvoteServiceSites:
description: Command Alias
aliases: avServiceSites
+1 -1
View File
@@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.bencodez</groupId>
<artifactId>VotingPlugin</artifactId>
<version>6.0.1</version>
<version>6.0.4</version>
<packaging>jar</packaging>
<name>VotingPlugin</name>
<properties>
@@ -24,7 +24,7 @@ public class User {
user.addPoints(points);
}
public void removePoints(int points) {
user.removePoints(points);
public boolean removePoints(int points) {
return user.removePoints(points);
}
}
@@ -47,9 +47,9 @@ public class BungeeHandler {
plugin.getLogger().info("Using BungeeMethod: " + method.toString());
if (method.equals(BungeeMethod.MYSQL)) {
plugin.registerBungeeChannels();
plugin.registerBungeeChannels("vp:vp");
} else if (method.equals(BungeeMethod.PLUGINMESSAGING)) {
plugin.registerBungeeChannels();
plugin.registerBungeeChannels("vp:vp");
plugin.getPluginMessaging().add(new PluginMessageHandler("Vote") {
@Override
@@ -240,7 +240,7 @@ public class VotingPluginBungee extends Plugin implements net.md_5.bungee.api.pl
method = BungeeMethod.getByName(config.getBungeeMethod());
if (method.equals(BungeeMethod.MYSQL)) {
this.getProxy().registerChannel("VotingPlugin:VotingPlugin".toLowerCase());
this.getProxy().registerChannel("vp:vp");
} else if (method.equals(BungeeMethod.PLUGINMESSAGING)) {
voteCacheFile = new VoteCache(this);
@@ -292,7 +292,7 @@ public class VotingPluginBungee extends Plugin implements net.md_5.bungee.api.pl
}
}, 15l, TimeUnit.SECONDS);
this.getProxy().registerChannel("VotingPlugin:VotingPlugin".toLowerCase());
this.getProxy().registerChannel("vp:vp");
} else if (method.equals(BungeeMethod.SOCKETS)) {
encryptionHandler = new EncryptionHandler(new File(getDataFolder(), "secretkey.key"));
@@ -352,7 +352,7 @@ public class VotingPluginBungee extends Plugin implements net.md_5.bungee.api.pl
@EventHandler
public void onPluginMessage(PluginMessageEvent ev) {
if (!ev.getTag().equals("VotingPlugin:VotingPlugin".toLowerCase())) {
if (!ev.getTag().equals("vp:vp".toLowerCase())) {
return;
}
ByteArrayInputStream instream = new ByteArrayInputStream(ev.getData());
@@ -369,7 +369,7 @@ public class VotingPluginBungee extends Plugin implements net.md_5.bungee.api.pl
}
for (String send : getProxy().getServers().keySet()) {
if (getProxy().getServers().get(send).getPlayers().size() > 0) {
getProxy().getServers().get(send).sendData("VotingPlugin:VotingPlugin".toLowerCase(),
getProxy().getServers().get(send).sendData("vp:vp".toLowerCase(),
outstream.toByteArray());
}
}
@@ -434,7 +434,7 @@ public class VotingPluginBungee extends Plugin implements net.md_5.bungee.api.pl
out.writeUTF(message);
}
if (getProxy().getServers().get(server).getPlayers().size() > 0) {
getProxy().getServers().get(server).sendData("VotingPlugin:VotingPlugin".toLowerCase(),
getProxy().getServers().get(server).sendData("vp:vp".toLowerCase(),
byteOutStream.toByteArray(), false);
}
out.close();
@@ -1205,6 +1205,9 @@ public class CommandLoader {
plugin.getCommand("vote" + arg)
.setTabCompleter(new AliasesTabCompleter().setCMDHandle(cmdHandle, false));
if (plugin.getConfigFile().isDisableAdvancedTab()) {
plugin.getCommand("vote" + arg).setPermission(cmdHandle.getPerm().split("|")[0]);
}
for (String str : plugin.getCommand("vote" + arg).getAliases()) {
commands.put(str, cmdHandle);
}
@@ -1226,6 +1229,9 @@ public class CommandLoader {
plugin.getCommand("adminvote" + arg)
.setTabCompleter(new AliasesTabCompleter().setCMDHandle(cmdHandle, true));
if (plugin.getConfigFile().isDisableAdvancedTab()) {
plugin.getCommand("adminvote" + arg).setPermission(cmdHandle.getPerm().split("|")[0]);
}
for (String str : plugin.getCommand("adminvote" + arg).getAliases()) {
commands.put(str, cmdHandle);
}
@@ -106,7 +106,7 @@ public class VoteShop extends GUIHandler {
}
if (limitPass) {
if (!plugin.getGui().isChestVoteShopRequireConfirmation()) {
if (!plugin.getGui().isChestVoteShopRequireConfirmation(identifier)) {
HashMap<String, String> placeholders = new HashMap<String, String>();
placeholders.put("identifier",
plugin.getGui().getChestShopIdentifierIdentifierName(identifier));
@@ -119,7 +119,7 @@ public class VoteShop extends GUIHandler {
new RewardOptions().setPlaceholders(placeholders));
user.sendMessage(StringParser.getInstance().replacePlaceHolder(
plugin.getConfigFile().getFormatShopPurchaseMsg(), placeholders));
plugin.getGui().getCHESTVoteShopPurchase(identifier), placeholders));
if (limit > 0) {
user.setVoteShopIdentifierLimit(identifier,
user.getVoteShopIdentifierLimit(identifier) + 1);
@@ -66,7 +66,7 @@ public class VoteShopConfirm extends GUIHandler {
new RewardOptions().setPlaceholders(placeholders));
user.sendMessage(StringParser.getInstance()
.replacePlaceHolder(plugin.getConfigFile().getFormatShopPurchaseMsg(), placeholders));
.replacePlaceHolder(plugin.getGui().getCHESTVoteShopPurchase(identifier), placeholders));
if (limit > 0) {
user.setVoteShopIdentifierLimit(identifier, user.getVoteShopIdentifierLimit(identifier) + 1);
}
@@ -37,6 +37,10 @@ public class BungeeSettings extends YMLFile {
@Getter
private int bungeeServerPort = 1297;
@ConfigDataBoolean(path = "RemoveInvalidUsers")
@Getter
private boolean removeInvalidUsers = false;
@ConfigDataString(path = "Server")
@Getter
private String server = "PleaseSet";
@@ -217,7 +217,7 @@ public class Config extends YMLFile {
@ConfigDataBoolean(path = "UseJavascriptPlaceholders")
@Getter
private boolean useJavascriptPlaceholders = true;
private boolean useJavascriptPlaceholders = false;
@ConfigDataBoolean(path = "UsePrimaryAccountForPlaceholders")
@Getter
@@ -143,6 +143,10 @@ public class GUI extends YMLFile {
private boolean lastMonthGUI = false;
private VotingPluginMain plugin;
public String getCHESTVoteShopPurchase(String identifier) {
return getData().getString("CHEST.Shop." + identifier +".PurchaseMessage", plugin.getConfigFile().getFormatShopPurchaseMsg());
}
public GUI(VotingPluginMain plugin) {
super(plugin, new File(plugin.getDataFolder(), "GUI.yml"));
@@ -497,4 +501,9 @@ public class GUI extends YMLFile {
public void onFileCreation() {
plugin.saveResource("GUI.yml", true);
}
public boolean isChestVoteShopRequireConfirmation(String identifier) {
return getData().getBoolean("CHEST.Shop." + identifier + ".RequireConfirmation",
isChestVoteShopRequireConfirmation());
}
}
@@ -27,7 +27,7 @@ public class SpecialRewardsConfig extends YMLFile {
@ConfigDataBoolean(path = "EnableMonthlyAwards")
@Getter
private boolean enableMonthlyAwards = false;
private boolean enableMonthlyAwards = true;
@ConfigDataBoolean(path = "EnableWeeklyAwards")
@Getter
@@ -49,6 +49,9 @@ public class PlayerVoteListener implements Listener {
if (!plugin.getConfigFile().isAllowUnjoined()) {
plugin.getLogger().warning("Player " + playerName
+ " has not joined before, disregarding vote, set AllowUnjoined to true to prevent this");
if (event.isBungee() && plugin.getBungeeSettings().isRemoveInvalidUsers()) {
UserManager.getInstance().getVotingPluginUser(playerName).remove();
}
return;
}
}
@@ -64,8 +67,6 @@ public class PlayerVoteListener implements Listener {
if (voteSite == null) {
if (!plugin.getConfigFile().isDisableNoServiceSiteMessage()) {
plugin.getLogger().warning("No voting site with the service site: '" + event.getServiceSite() + "'");
plugin.getLogger().warning(
"Please read here on how to fix it: https://github.com/Ben12345rocks/VotingPlugin/wiki/Common-Problems");
ArrayList<String> services = new ArrayList<String>();
for (VoteSite site : plugin.getVoteSites()) {