Compare commits

...
23 Commits
Author SHA1 Message Date
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
BenCodez 17a899407d Update version number 2020-11-27 20:46:01 -05:00
BenCodez 1a194c684d Little change 2020-11-27 17:03:01 -05:00
BenCodez 93e06e431d Bug fix 2020-11-26 16:47:06 -05:00
BenCodez 8fede65b79 Little change 2020-11-25 21:23:44 -05:00
BenCodez 601d23d5cc Undo 2020-11-25 20:50:38 -05:00
BenCodez 536bacb96a Deprecate class 2020-11-25 19:55:39 -05:00
BenCodez 07b4c36490 Temp change to support plugins until update 2020-11-25 19:51:08 -05:00
BenCodez 39a86b824e Change default option 2020-11-24 19:01:04 -05:00
BenCodez 204c17affc Bug fix 2020-11-24 18:58:54 -05:00
BenCodez ff92dccf47 Bug fix 2020-11-24 18:54:50 -05:00
BenCodez ec69a4db70 Bug fix 2020-11-24 17:08:48 -05:00
Ben c9e0880ce9 Update README.md 2020-11-23 17:48:28 -05:00
20 changed files with 83 additions and 34 deletions

No files matched your search

+1 -1
View File
@@ -18,7 +18,7 @@ https://github.com/Ben12345rocks/VotingPlugin/blob/master/VotingPlugin/Resources
</repository>
<dependency>
<groupId>com.github.Ben12345rocks</groupId>
<groupId>com.github.BenCodez</groupId>
<artifactId>VotingPlugin</artifactId>
<version>LATEST</version>
<scope>provided</scope>
+5 -1
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:
+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
+8 -8
View File
@@ -3,8 +3,8 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.bencodez</groupId>
<artifactId>votingplugin</artifactId>
<version>6.0</version>
<artifactId>VotingPlugin</artifactId>
<version>6.0.3</version>
<packaging>jar</packaging>
<name>VotingPlugin</name>
<properties>
@@ -106,29 +106,29 @@
other plugins -->
<relocation>
<pattern>com.bencodez.advancedcore</pattern>
<shadedPattern>${project.groupId}.${project.artifactId}.advancedcore</shadedPattern>
<shadedPattern>${project.groupId}.votingplugin.advancedcore</shadedPattern>
</relocation>
<!-- Lets relocate the shaded API so we dont cause any conflicts with
other plugins -->
<relocation>
<pattern>net.pl3x.bukkit.chatapi</pattern>
<shadedPattern>${project.groupId}.${project.artifactId}</shadedPattern>
<shadedPattern>${project.groupId}.votingplugin</shadedPattern>
</relocation>
<relocation>
<pattern>me.mrten.mysqlapi</pattern>
<shadedPattern>${project.groupId}.${project.artifactId}.mysqlapi</shadedPattern>
<shadedPattern>${project.groupId}.votingplugin.mysqlapi</shadedPattern>
</relocation>
<relocation>
<pattern>com.zaxxer.HikariCP</pattern>
<shadedPattern>${project.groupId}.${project.artifactId}.HikariCP</shadedPattern>
<shadedPattern>${project.groupId}.votingplugin.HikariCP</shadedPattern>
</relocation>
<relocation>
<pattern>com.zaxxer.hikari</pattern>
<shadedPattern>${project.groupId}.${project.artifactId}.hikari</shadedPattern>
<shadedPattern>${project.groupId}.votingplugin.hikari</shadedPattern>
</relocation>
<relocation>
<pattern>org.slf4j.slf4j-simple</pattern>
<shadedPattern>${project.groupId}.${project.artifactId}.slf4j-simple</shadedPattern>
<shadedPattern>${project.groupId}.votingplugin.slf4j-simple</shadedPattern>
</relocation>
</relocations>
</configuration>
@@ -0,0 +1,30 @@
package com.Ben12345rocks.VotingPlugin.Objects;
import org.bukkit.entity.Player;
import com.bencodez.votingplugin.user.UserManager;
import com.bencodez.votingplugin.user.VotingPluginUser;
@Deprecated
public class User {
private VotingPluginUser user;
public User(Player p) {
user = UserManager.getInstance().getVotingPluginUser(p);
}
public int getPoints() {
return user.getPoints();
}
public void setPoints(int points) {
user.setPoints(points);
}
public void addPoints(int points) {
user.addPoints(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".toLowerCase());
} else if (method.equals(BungeeMethod.PLUGINMESSAGING)) {
voteCacheFile = new VoteCache(this);
@@ -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());
}
}
@@ -1938,7 +1938,7 @@ public class CommandLoader {
@Override
public void execute(CommandSender sender, String[] args) {
new VoteURL(plugin, sender, null, true).open();
new VoteURL(plugin, sender, null, true).open(GUIMethod.CHAT);
}
});
@@ -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);
}
@@ -4,10 +4,8 @@ import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.HashMap;
import org.bukkit.Material;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import com.bencodez.advancedcore.api.gui.GUIHandler;
import com.bencodez.advancedcore.api.gui.GUIMethod;
@@ -89,7 +87,7 @@ public class VoteToday extends GUIHandler {
msg = StringParser.getInstance().replacePlaceHolder(msg, placeholders);
ItemBuilder item = null;
if (plugin.getGui().isChestVoteTodayUseSkull() && !NMSManager.getInstance().isVersion("1.12")) {
item = new ItemBuilder(new ItemStack(Material.PLAYER_HEAD, 1)).setSkullOwner(player);
item = new ItemBuilder(user.getPlayerHead());
} else {
item = new ItemBuilder(plugin.getGui().getChestVoteTodayPlayerItem());
}
@@ -41,7 +41,7 @@ public class VoteURL extends GUIHandler {
if (user == null && player instanceof Player) {
this.user = UserManager.getInstance().getVotingPluginUser((Player) player);
}
if (player.getName().equals(user.getPlayerName())) {
if (player != null && user != null && player.getName().equals(user.getPlayerName())) {
if (plugin.getConfigFile().isUsePrimaryAccountForPlaceholders() && user.hasPrimaryAccount()) {
user = UserManager.getInstance().getVotingPluginUser(user.getPrimaryAccount());
}
@@ -27,7 +27,7 @@ public class BungeeSettings extends YMLFile {
@ConfigDataString(path = "BungeeMethod")
@Getter
private String bungeeMethod = "SOCKETS";
private String bungeeMethod = "PLUGINMESSAGING";
@ConfigDataString(path = "BungeeServer.Host")
@Getter
@@ -640,7 +640,7 @@ public class Config extends YMLFile {
}
public boolean getLoadTopVoterDaily() {
return getData().getBoolean("LoadTopVoter.Daily");
return getData().getBoolean("LoadTopVoter.Daily", false);
}
public boolean getLoadTopVoterMonthly() {
@@ -648,7 +648,7 @@ public class Config extends YMLFile {
}
public boolean getLoadTopVoterWeekly() {
return getData().getBoolean("LoadTopVoter.Weekly");
return getData().getBoolean("LoadTopVoter.Weekly", false);
}
public int getPointsOnVote() {
@@ -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
@@ -64,8 +64,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()) {
@@ -60,7 +60,7 @@ public enum TopVoter {
if (next > list.size() - 1) {
next = 0;
}
return TopVoter.values()[next];
return list.get(next);
}
}
return TopVoter.AllTime;
@@ -86,7 +86,7 @@ public enum TopVoter {
if (prev < 0) {
prev = list.size() - 1;
}
return TopVoter.values()[prev];
return list.get(prev);
}
}
return TopVoter.AllTime;