Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cc010d9738 | ||
|
|
cbe58a1f18 | ||
|
|
c29247d2a0 | ||
|
|
a28cdfc6bf | ||
|
|
7db5cd59da | ||
|
|
0ebb0c9a70 | ||
|
|
9ba20ddd02 | ||
|
|
7fddc0af12 | ||
|
|
475e6059eb | ||
|
|
b552928b8c |
No files matched your search
@@ -17,6 +17,7 @@ https://github.com/Ben12345rocks/VotingPlugin/blob/master/VotingPlugin/LICENSE.t
|
||||
<groupId>com.github.Ben12345rocks</groupId>
|
||||
<artifactId>VotingPlugin</artifactId>
|
||||
<version>LATEST</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
Versions:
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
org.jboss.ide.eclipse.as.core.singledeployable.deployableList=\n
|
||||
@@ -319,13 +319,22 @@ GUI:
|
||||
Amount: 1
|
||||
Name: '&4Today'
|
||||
Slot: 5
|
||||
Rewards:
|
||||
Shop:
|
||||
Item:
|
||||
Material: 'DIAMOND'
|
||||
Data: 0
|
||||
Amount: 1
|
||||
Name: '&4Voting Rewards'
|
||||
Name: '&4Vote Shop'
|
||||
Slot: 6
|
||||
# /vote Reward gui item
|
||||
# Uncomment to use, most likely will be unused
|
||||
#Rewards:
|
||||
# Item:
|
||||
# Material: 'DIAMOND'
|
||||
# Data: 0
|
||||
# Amount: 1
|
||||
# Name: '&4Voting Rewards'
|
||||
# Slot: 7
|
||||
|
||||
# GUI for /vote url
|
||||
# And /vote if enabled in Config.yml
|
||||
@@ -567,6 +576,9 @@ VoteParty:
|
||||
# Reward files to give
|
||||
Rewards: []
|
||||
|
||||
# Reset milestons at end of the month
|
||||
ResetMilestonesMonthly: false
|
||||
|
||||
MileStones:
|
||||
# Number of votes required
|
||||
# Allows multiple milestones
|
||||
@@ -577,7 +589,6 @@ MileStones:
|
||||
Rewards:
|
||||
Messages:
|
||||
Player: '&aYou got %milestone% milestone votes!'
|
||||
ResetMonthly: false
|
||||
|
||||
VoteStreak:
|
||||
# Valid options: Day, Week, Month
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.Ben12345rocks</groupId>
|
||||
<artifactId>VotingPlugin</artifactId>
|
||||
<version>5.8.2</version>
|
||||
<version>5.8.4</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>VotingPlugin</name>
|
||||
<properties>
|
||||
@@ -55,25 +55,25 @@
|
||||
other plugins -->
|
||||
<relocation>
|
||||
<pattern>com.Ben12345rocks.AdvancedCore</pattern>
|
||||
<shadedPattern>${groupId}.${artifactId}.AdvancedCore</shadedPattern>
|
||||
<shadedPattern>${project.groupId}.${project.artifactId}.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>${groupId}.${artifactId}</shadedPattern>
|
||||
<shadedPattern>${project.groupId}.${project.artifactId}</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>me.mrten.mysqlapi</pattern>
|
||||
<shadedPattern>${groupId}.${artifactId}.mysqlapi</shadedPattern>
|
||||
<shadedPattern>${project.groupId}.${project.artifactId}.mysqlapi</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>com.zaxxer.HikariCP</pattern>
|
||||
<shadedPattern>${groupId}.${artifactId}.HikariCP</shadedPattern>
|
||||
<shadedPattern>${project.groupId}.${project.artifactId}.HikariCP</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>org.slf4j.slf4j-simple</pattern>
|
||||
<shadedPattern>${groupId}.${artifactId}.slf4j-simple</shadedPattern>
|
||||
<shadedPattern>${project.groupId}.${project.artifactId}.slf4j-simple</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
</configuration>
|
||||
@@ -162,7 +162,7 @@
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.11.2-R0.1-SNAPSHOT</version>
|
||||
<version>1.12-pre6-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
||||
@@ -16,7 +16,6 @@ import com.Ben12345rocks.AdvancedCore.Util.ValueRequest.Listeners.BooleanListene
|
||||
import com.Ben12345rocks.AdvancedCore.Util.ValueRequest.Listeners.NumberListener;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.ValueRequest.Listeners.StringListener;
|
||||
import com.Ben12345rocks.VotingPlugin.Main;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.Config;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.ConfigVoteSites;
|
||||
import com.Ben12345rocks.VotingPlugin.Objects.VoteSite;
|
||||
|
||||
@@ -59,7 +58,7 @@ public class AdminGUI {
|
||||
if (event.getWhoClicked() instanceof Player) {
|
||||
Player player = event.getWhoClicked();
|
||||
if (event.getClick().equals(ClickType.MIDDLE)) {
|
||||
player.closeInventory();
|
||||
|
||||
new ValueRequest().requestString(player, new StringListener() {
|
||||
|
||||
@Override
|
||||
@@ -76,19 +75,6 @@ public class AdminGUI {
|
||||
}
|
||||
});
|
||||
|
||||
lore = new ArrayList<String>();
|
||||
buttons.add(new BInventoryButton("&cConfig", ArrayUtils.getInstance().convert(lore),
|
||||
new ItemStack(Material.STONE)) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
if (event.getWhoClicked() instanceof Player) {
|
||||
Player player = event.getWhoClicked();
|
||||
openAdminGUIConfig(player);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
lore = new ArrayList<String>();
|
||||
buttons.add(new BInventoryButton("&cReload Plugin", ArrayUtils.getInstance().convert(lore),
|
||||
new ItemStack(Material.STONE, 1, (short) 3)) {
|
||||
@@ -108,39 +94,6 @@ public class AdminGUI {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Open admin GUI config.
|
||||
*
|
||||
* @param player
|
||||
* the player
|
||||
*/
|
||||
public void openAdminGUIConfig(Player player) {
|
||||
BInventory inv = new BInventory("Config");
|
||||
inv.addButton(inv.getNextSlot(),
|
||||
new BInventoryButton("BroadcastVote",
|
||||
new String[] { "Currently: " + Config.getInstance().getBroadCastVotesEnabled() },
|
||||
new ItemStack(Material.STONE)) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
Player player = event.getWhoClicked();
|
||||
new ValueRequest().requestBoolean(player, "" + Config.getInstance().getBroadCastVotesEnabled(),
|
||||
new BooleanListener() {
|
||||
|
||||
@Override
|
||||
public void onInput(Player player, boolean value) {
|
||||
Config.getInstance().setBroadcastVoteEnabled(value);
|
||||
player.sendMessage("Value set");
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
inv.openInventory(player);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Open admin GUI vote sites.
|
||||
*
|
||||
@@ -215,7 +168,7 @@ public class AdminGUI {
|
||||
public void onClick(ClickEvent event) {
|
||||
if (event.getWhoClicked() instanceof Player) {
|
||||
Player player = event.getWhoClicked();
|
||||
player.closeInventory();
|
||||
|
||||
new ValueRequest().requestString(player, voteSite.getServiceSite(), null,
|
||||
new StringListener() {
|
||||
|
||||
@@ -239,7 +192,6 @@ public class AdminGUI {
|
||||
public void onClick(ClickEvent event) {
|
||||
if (event.getWhoClicked() instanceof Player) {
|
||||
Player player = event.getWhoClicked();
|
||||
player.closeInventory();
|
||||
new ValueRequest().requestString(player, voteSite.getServiceSite(), null, new StringListener() {
|
||||
|
||||
@Override
|
||||
@@ -262,7 +214,7 @@ public class AdminGUI {
|
||||
public void onClick(ClickEvent event) {
|
||||
if (event.getWhoClicked() instanceof Player) {
|
||||
Player player = event.getWhoClicked();
|
||||
player.closeInventory();
|
||||
|
||||
new ValueRequest().requestString(player, voteSite.getVoteURL(), null, new StringListener() {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.Ben12345rocks.VotingPlugin.Commands.GUI;
|
||||
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -25,6 +24,7 @@ import com.Ben12345rocks.VotingPlugin.Objects.User;
|
||||
import com.Ben12345rocks.VotingPlugin.Objects.VoteSite;
|
||||
import com.Ben12345rocks.VotingPlugin.TopVoter.TopVoterHandler;
|
||||
import com.Ben12345rocks.VotingPlugin.UserManager.UserManager;
|
||||
import com.Ben12345rocks.VotingPlugin.VoteShop.VoteShop;
|
||||
|
||||
public class PlayerGUIs {
|
||||
static PlayerGUIs instance = new PlayerGUIs();
|
||||
@@ -130,9 +130,7 @@ public class PlayerGUIs {
|
||||
} else if (slot.equalsIgnoreCase("today")) {
|
||||
lore = Commands.getInstance().voteToday();
|
||||
} else if (slot.equalsIgnoreCase("help")) {
|
||||
ArrayList<String> loreSt = new ArrayList<String>();
|
||||
loreSt = ArrayUtils.getInstance().comptoString(Commands.getInstance().voteHelpText(player));
|
||||
lore = ArrayUtils.getInstance().convert(loreSt);
|
||||
lore[0] = "Click to view help";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,7 +159,9 @@ public class PlayerGUIs {
|
||||
} else if (slot.equalsIgnoreCase("today")) {
|
||||
openVoteToday(player);
|
||||
} else if (slot.equalsIgnoreCase("help")) {
|
||||
player.performCommand("v help");
|
||||
player.performCommand("vote help");
|
||||
} else if (slot.equalsIgnoreCase("shop")) {
|
||||
VoteShop.getInstance().voteShop(player);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -804,8 +804,8 @@ public class Config extends YMLFile {
|
||||
return getData().getBoolean("LogVotesToFile");
|
||||
}
|
||||
|
||||
public boolean getMilestoneResetMonthly(int milestones) {
|
||||
return getData().getBoolean("MileStones." + milestones + ".ResetMonthly");
|
||||
public boolean getResetMilestonesMonthly() {
|
||||
return getData().getBoolean("ResetMilestonesMonthly");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -15,6 +15,7 @@ import java.util.TimerTask;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
@@ -631,6 +632,7 @@ public class Main extends JavaPlugin {
|
||||
Signs.getInstance().storeSigns();
|
||||
}
|
||||
}, 0);
|
||||
HandlerList.unregisterAll(plugin);
|
||||
plugin = null;
|
||||
}
|
||||
|
||||
|
||||
@@ -156,6 +156,14 @@ public class User extends com.Ben12345rocks.AdvancedCore.Objects.User {
|
||||
public void addWeekVoteStreak() {
|
||||
setWeekVoteStreak(getWeekVoteStreak() + 1);
|
||||
}
|
||||
|
||||
public int getMilestoneCount() {
|
||||
return getData().getInt("MilestoneCount",getAllTimeTotal());
|
||||
}
|
||||
|
||||
public void setMilestoneCount(int value) {
|
||||
getData().setInt("MilestoneCount", value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Can vote all.
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.Ben12345rocks.VotingPlugin.OtherRewards;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
@@ -155,7 +156,7 @@ public class OtherVoteReward implements Listener {
|
||||
&& RewardHandler.getInstance().hasRewards(Config.getInstance().getData(),
|
||||
Config.getInstance().getMilestoneRewardsPath(votesRequired))) {
|
||||
|
||||
int userVotesTotal = user.getAllTimeTotal();
|
||||
int userVotesTotal = user.getMilestoneCount();
|
||||
if (userVotesTotal >= votesRequired && !user.hasGottenMilestone(votesRequired)) {
|
||||
giveMilestoneVoteReward(user, user.isOnline(), votesRequired);
|
||||
user.setHasGotteMilestone(votesRequired, true);
|
||||
@@ -270,25 +271,13 @@ public class OtherVoteReward implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onMonthChange(MonthChangeEvent event) {
|
||||
Set<String> votes = Config.getInstance().getMilestoneVotes();
|
||||
for (String vote : votes) {
|
||||
if (StringUtils.getInstance().isInt(vote)) {
|
||||
int votesRequired = Integer.parseInt(vote);
|
||||
plugin.debug("Is int: " + vote);
|
||||
if (votesRequired != 0) {
|
||||
plugin.debug("not 0");
|
||||
if (Config.getInstance().getMilestoneRewardEnabled(votesRequired)
|
||||
&& RewardHandler.getInstance().hasRewards(Config.getInstance().getData(),
|
||||
Config.getInstance().getMilestoneRewardsPath(votesRequired))) {
|
||||
if (Config.getInstance().getMilestoneResetMonthly(votesRequired)) {
|
||||
for (String uuid : UserManager.getInstance().getAllUUIDs()) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(new UUID(uuid));
|
||||
user.setHasGotteMilestone(votesRequired, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Config.getInstance().getResetMilestonesMonthly()) {
|
||||
for (String uuid : UserManager.getInstance().getAllUUIDs()) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(new UUID(uuid));
|
||||
user.setMilestoneCount(0);
|
||||
user.setHasGottenMilestone(new HashMap<String, Boolean>());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -61,6 +61,6 @@ public class VoteShop {
|
||||
});
|
||||
}
|
||||
|
||||
BInventory.openInventory(player, inv);
|
||||
inv.openInventory(player);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user