Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dca689ec37 | ||
|
|
ee4d52377f | ||
|
|
ac41c9413c | ||
|
|
596968f869 | ||
|
|
0d2221d195 | ||
|
|
23fa59f98f | ||
|
|
cb81b61096 | ||
|
|
186917992c | ||
|
|
6b70e4fee4 | ||
|
|
79c98c8b86 | ||
|
|
b8e0830b0b |
No files matched your search
Binary file not shown.
@@ -70,7 +70,7 @@ VoteReminding:
|
||||
# Can add titles and more in the reward file
|
||||
Rewards:
|
||||
Messages:
|
||||
Player: '&aRemeber to vote!'
|
||||
Player: '&aRemember to vote!'
|
||||
Title:
|
||||
Enabled: false
|
||||
Title: '&cRemember to vote!'
|
||||
@@ -706,6 +706,10 @@ DailyAwards:
|
||||
# Most of these values can be left untouched
|
||||
# ------------------------------------------------
|
||||
|
||||
# Number of points to give on vote
|
||||
# Set to 0 to give no points
|
||||
PointsOnVote: 1
|
||||
|
||||
# Wether or not to check on world change
|
||||
# Should only be used if you do per world rewards
|
||||
CheckOnWorldChange: false
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.Ben12345rocks</groupId>
|
||||
<artifactId>VotingPlugin</artifactId>
|
||||
<version>5.8.7</version>
|
||||
<version>5.9</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>VotingPlugin</name>
|
||||
<properties>
|
||||
@@ -179,5 +179,12 @@
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/Jars/GAListener.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.mythicacraft</groupId>
|
||||
<artifactId>voteroulette</artifactId>
|
||||
<version>3.2.2</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/Jars/VoteRoulette.jar</systemPath>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -2,10 +2,14 @@ package com.Ben12345rocks.VotingPlugin.Commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
@@ -40,6 +44,14 @@ import com.Ben12345rocks.VotingPlugin.Objects.VoteSite;
|
||||
import com.Ben12345rocks.VotingPlugin.UserManager.UserManager;
|
||||
import com.Ben12345rocks.VotingPlugin.VoteParty.VoteParty;
|
||||
import com.Ben12345rocks.VotingPlugin.VoteShop.VoteShop;
|
||||
import com.google.common.collect.ListMultimap;
|
||||
import com.google.common.collect.Table;
|
||||
import com.google.common.collect.Table.Cell;
|
||||
import com.mythicacraft.voteroulette.VoteRoulette;
|
||||
import com.mythicacraft.voteroulette.Voter;
|
||||
import com.swifteh.GAL.GAL;
|
||||
import com.swifteh.GAL.GALVote;
|
||||
import com.swifteh.GAL.VoteType;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
@@ -122,6 +134,71 @@ public class CommandLoader {
|
||||
}
|
||||
});
|
||||
|
||||
plugin.adminVoteCommand.add(new CommandHandler(new String[] { "ConvertFrom", "GAL" },
|
||||
"VotingPlugin.Commands.AdminVote.ConvertFrom.GAL|" + adminPerm, "Convert from GAL") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
if (Bukkit.getServer().getPluginManager().getPlugin("GAListener") != null) {
|
||||
Table<String, Integer, Long> totals = GAL.p.db.getTotals();
|
||||
for (Cell<String, Integer, Long> entry : totals.cellSet()) {
|
||||
String name = entry.getRowKey();
|
||||
int total = entry.getColumnKey();
|
||||
User user = UserManager.getInstance().getVotingPluginUser(name);
|
||||
user.setAllTimeTotal(user.getAllTimeTotal() + total);
|
||||
}
|
||||
sender.sendMessage("Totals added");
|
||||
|
||||
ListMultimap<VoteType, GALVote> votes = GAL.p.galVote;
|
||||
for (Entry<VoteType, GALVote> entry : votes.entries()) {
|
||||
if (entry.getKey().equals(VoteType.NORMAL)) {
|
||||
String msg = entry.getValue().message;
|
||||
List<String> cmds = entry.getValue().commands;
|
||||
String service = entry.getValue().key;
|
||||
if (service.equalsIgnoreCase("default")) {
|
||||
|
||||
} else {
|
||||
VoteSite site = plugin.getVoteSite(service);
|
||||
if (site == null) {
|
||||
sender.sendMessage("Failed to create vote site, autogeneratesites false?");
|
||||
return;
|
||||
}
|
||||
ConfigurationSection data = configVoteSites.getData()
|
||||
.getConfigurationSection(configVoteSites.getRewardsPath(site.getKey()));
|
||||
data.set("Commands.Console", cmds);
|
||||
data.set("Messages.Player", msg);
|
||||
configVoteSites.saveData();
|
||||
sender.sendMessage("created vote site: " + site.getKey());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage("GAL not loaded");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
plugin.adminVoteCommand.add(new CommandHandler(new String[] { "ConvertFrom", "VoteRoulette" },
|
||||
"VotingPlugin.Commands.AdminVote.ConvertFrom.GAL|" + adminPerm, "Convert from VoteRoulette") {
|
||||
|
||||
@SuppressWarnings("static-access")
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
if (Bukkit.getServer().getPluginManager().getPlugin("VoteRoulette") != null) {
|
||||
for (OfflinePlayer offPlayer : Bukkit.getOfflinePlayers()) {
|
||||
Voter voter = VoteRoulette.getInstance().getVoterManager().getVoter(offPlayer.getUniqueId(),
|
||||
offPlayer.getName());
|
||||
User user = UserManager.getInstance().getVotingPluginUser(offPlayer);
|
||||
user.setAllTimeTotal(user.getAllTimeTotal() + voter.getStatSheet().getLifetimeVotes());
|
||||
user.setMonthTotal(user.getMonthTotal() + voter.getStatSheet().getCurrentMonthVotes());
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage("VoteRoulette not loaded");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
plugin.adminVoteCommand.add(new CommandHandler(new String[] { "SetPoints", "(player)", "(number)" },
|
||||
"VotingPlugin.Commands.AdminVote.SetPoints|" + adminPerm, "Set players voting points") {
|
||||
|
||||
@@ -279,8 +356,10 @@ public class CommandLoader {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
sender.sendMessage("Starting to convert");
|
||||
UserStorage prevStorage = UserStorage.valueOf(args[1].toUpperCase());
|
||||
plugin.convertDataStorage(prevStorage, AdvancedCoreHook.getInstance().getStorageType());
|
||||
sender.sendMessage("Finished converting!");
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -1057,6 +1057,10 @@ public class Config extends YMLFile {
|
||||
public String getVotePartyBroadcast() {
|
||||
return getData().getString("VoteParty.Broadcast", "");
|
||||
}
|
||||
|
||||
public int getPointsOnVote() {
|
||||
return getData().getInt("PointsOnVote", 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the vote party votes required.
|
||||
|
||||
@@ -47,7 +47,7 @@ public class VotiferEvent implements Listener {
|
||||
public void run() {
|
||||
synchronized (plugin) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(playerName);
|
||||
if (!user.hasJoinedBefore() && !config.allowUnJoined()) {
|
||||
if (!user.hasLoggedOnBefore() && !config.allowUnJoined()) {
|
||||
plugin.getLogger().warning("Player " + playerName
|
||||
+ " has not joined before, disregarding vote, set AllowUnjoined to true to prevent this");
|
||||
return;
|
||||
|
||||
@@ -126,78 +126,39 @@ public class Main extends JavaPlugin {
|
||||
throw new RuntimeException("Invalid Storage Method");
|
||||
}
|
||||
UserStorage cur = AdvancedCoreHook.getInstance().getStorageType();
|
||||
AdvancedCoreHook.getInstance().setStorageType(from);
|
||||
loadMySQL();
|
||||
HashMap<User, HashMap<String, String>> data = new HashMap<User, HashMap<String, String>>();
|
||||
for (String uuid : UserManager.getInstance().getAllUUIDs()) {
|
||||
try {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(new UUID(uuid));
|
||||
|
||||
AdvancedCoreHook.getInstance().setStorageType(from);
|
||||
|
||||
HashMap<String, String> values = new HashMap<String, String>();
|
||||
for (String key : user.getData().getKeys()) {
|
||||
values.put(key, user.getData().getString(key));
|
||||
}
|
||||
|
||||
/*
|
||||
* ArrayList<String> choiceRewards = user.getChoiceRewards();
|
||||
* String inputMethod = user.getInputMethod(); ArrayList<String>
|
||||
* offlineRewards = user.getOfflineRewards(); HashMap<Reward,
|
||||
* ArrayList<Long>> timed = user.getTimedRewards(); int allTime
|
||||
* = user.getAllTimeTotal(); int dailyTotal =
|
||||
* user.getDailyTotal(); HashMap<String, Boolean> mileStone =
|
||||
* user.getHasGottenMilestone(); HashMap<VoteSite, Long>
|
||||
* lastVotes = user.getLastVotes(); int monthTotals =
|
||||
* user.getMonthTotal(); ArrayList<String> otherRewards =
|
||||
* user.getOfflineOtherRewards(); ArrayList<String> offlineVotes
|
||||
* = user.getOfflineVotes(); int points = user.getPoints(); int
|
||||
* votePartyVotes = user.getVotePartyVotes(); int weeklyTotal =
|
||||
* user.getWeeklyTotal();
|
||||
*
|
||||
* int highestDailyTotal = user.getHighestDailyTotal(); int
|
||||
* highestWeeklyTotal = user.getHighestWeeklyTotal(); int
|
||||
* highestMonthlyTotal = user.getHighestMonthlyTotal(); int
|
||||
* voteStreakDay = user.getDayVoteStreak(); int voteStreakWeek =
|
||||
* user.getWeekVoteStreak(); int voteStreakMonth =
|
||||
* user.getMonthVoteStreak(); int bestVoteStreakDay =
|
||||
* user.getBestDayVoteStreak(); int bestVoteStreakWeek =
|
||||
* user.getBestWeekVoteStreak(); int bestVoteStreakMonth =
|
||||
* user.getBestMonthVoteStreak();
|
||||
*/
|
||||
|
||||
AdvancedCoreHook.getInstance().setStorageType(to);
|
||||
|
||||
/*
|
||||
* user.setChoiceRewards(choiceRewards);
|
||||
* user.setInputMethod(inputMethod);
|
||||
* user.setOfflineRewards(offlineRewards);
|
||||
* user.setTimedRewards(timed); user.setAllTimeTotal(allTime);
|
||||
* user.setDailyTotal(dailyTotal);
|
||||
* user.setHasGottenMilestone(mileStone);
|
||||
* user.setLastVotes(lastVotes);
|
||||
* user.setMonthTotal(monthTotals);
|
||||
* user.setOfflineOtherRewards(otherRewards);
|
||||
* user.setOfflineVotes(offlineVotes); user.setPoints(points);
|
||||
* user.setVotePartyVotes(votePartyVotes);
|
||||
* user.setWeeklyTotal(weeklyTotal);
|
||||
*
|
||||
* user.setHighestDailyTotal(highestDailyTotal);
|
||||
* user.setHighestWeeklyTotal(highestWeeklyTotal);
|
||||
* user.setHighestMonthlyTotal(highestMonthlyTotal);
|
||||
* user.setDayVoteStreak(voteStreakDay);
|
||||
* user.setWeekVoteStreak(voteStreakWeek);
|
||||
* user.setMonthVoteStreak(voteStreakMonth);
|
||||
* user.setBestDayVoteStreak(bestVoteStreakDay);
|
||||
* user.setBestWeekVoteStreak(bestVoteStreakWeek);
|
||||
* user.setBestMonthVoteStreak(bestVoteStreakMonth);
|
||||
*/
|
||||
for (Entry<String, String> entry : values.entrySet()) {
|
||||
user.getData().setString(entry.getKey(), entry.getValue());
|
||||
}
|
||||
data.put(user, values);
|
||||
} catch (Exception e) {
|
||||
AdvancedCoreHook.getInstance().debug(e);
|
||||
plugin.getLogger().warning("Exception occoured for '" + uuid + "': " + e.getMessage()
|
||||
+ ", turn debug on to see full stack traces");
|
||||
}
|
||||
}
|
||||
|
||||
AdvancedCoreHook.getInstance().setStorageType(to);
|
||||
loadMySQL();
|
||||
|
||||
for (Entry<User, HashMap<String, String>> entry : data.entrySet()) {
|
||||
try {
|
||||
for (Entry<String, String> values : entry.getValue().entrySet()) {
|
||||
entry.getKey().getData().setString(values.getKey(), values.getValue());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
plugin.getLogger().warning("Exception occoured for '" + entry.getKey().getUUID() + "': "
|
||||
+ e.getMessage() + ", turn debug on to see full stack traces");
|
||||
}
|
||||
}
|
||||
AdvancedCoreHook.getInstance().setStorageType(cur);
|
||||
}
|
||||
|
||||
@@ -845,6 +806,21 @@ public class Main extends JavaPlugin {
|
||||
AdvancedCoreHook.getInstance().allowDownloadingFromSpigot(15358);
|
||||
AdvancedCoreHook.getInstance().setExtraDebug(Config.getInstance().getExtraDebug());
|
||||
AdvancedCoreHook.getInstance().setStorageType(UserStorage.valueOf(Config.getInstance().getDataStorage()));
|
||||
loadMySQL();
|
||||
|
||||
AdvancedCoreHook.getInstance().setCheckOnWorldChange(Config.getInstance().getCheckOnWorldChange());
|
||||
AdvancedCoreHook.getInstance().setDebug(Config.getInstance().getDebugEnabled());
|
||||
AdvancedCoreHook.getInstance().setDebugIngame(Config.getInstance().getDebugInfoIngame());
|
||||
AdvancedCoreHook.getInstance().setDefaultRequestMethod(Config.getInstance().getRequestAPIDefaultMethod());
|
||||
AdvancedCoreHook.getInstance().setDisabledRequestMethods(Config.getInstance().getRequestAPIDisabledMethods());
|
||||
AdvancedCoreHook.getInstance().setFormatNoPerms(Config.getInstance().getFormatNoPerms());
|
||||
AdvancedCoreHook.getInstance().setFormatNotNumber(Config.getInstance().getFormatNotNumber());
|
||||
AdvancedCoreHook.getInstance().setHelpLine(Config.getInstance().getFormatHelpLine());
|
||||
AdvancedCoreHook.getInstance().setLogDebugToFile(Config.getInstance().getLogDebugToFile());
|
||||
AdvancedCoreHook.getInstance().setSendScoreboards(Config.getInstance().getSendScoreboards());
|
||||
}
|
||||
|
||||
private void loadMySQL() {
|
||||
if (AdvancedCoreHook.getInstance().getStorageType().equals(UserStorage.MYSQL)) {
|
||||
Thread.getInstance().run(new Runnable() {
|
||||
|
||||
@@ -859,17 +835,6 @@ public class Main extends JavaPlugin {
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
AdvancedCoreHook.getInstance().setCheckOnWorldChange(Config.getInstance().getCheckOnWorldChange());
|
||||
AdvancedCoreHook.getInstance().setDebug(Config.getInstance().getDebugEnabled());
|
||||
AdvancedCoreHook.getInstance().setDebugIngame(Config.getInstance().getDebugInfoIngame());
|
||||
AdvancedCoreHook.getInstance().setDefaultRequestMethod(Config.getInstance().getRequestAPIDefaultMethod());
|
||||
AdvancedCoreHook.getInstance().setDisabledRequestMethods(Config.getInstance().getRequestAPIDisabledMethods());
|
||||
AdvancedCoreHook.getInstance().setFormatNoPerms(Config.getInstance().getFormatNoPerms());
|
||||
AdvancedCoreHook.getInstance().setFormatNotNumber(Config.getInstance().getFormatNotNumber());
|
||||
AdvancedCoreHook.getInstance().setHelpLine(Config.getInstance().getFormatHelpLine());
|
||||
AdvancedCoreHook.getInstance().setLogDebugToFile(Config.getInstance().getLogDebugToFile());
|
||||
AdvancedCoreHook.getInstance().setSendScoreboards(Config.getInstance().getSendScoreboards());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -113,7 +113,7 @@ public class User extends com.Ben12345rocks.AdvancedCore.Objects.User {
|
||||
* Adds the points.
|
||||
*/
|
||||
public void addPoints() {
|
||||
setPoints(getPoints() + 1);
|
||||
addPoints(Config.getInstance().getPointsOnVote());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -36,7 +36,7 @@ public class VoteShop {
|
||||
ItemBuilder builder = new ItemBuilder(Config.getInstance().getIdentifierSection(identifier));
|
||||
|
||||
inv.addButton(Config.getInstance().getIdentifierSlot(identifier),
|
||||
new BInventoryButton(builder.toItemStack()) {
|
||||
new BInventoryButton(builder) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
|
||||
Reference in new issue
Block a user