Compare commits

...
21 Commits
Author SHA1 Message Date
Ben12345rocks 0ee3706190 Update version number to 5.14.2 2018-08-11 11:29:31 -04:00
Ben12345rocks 9f7fc3dafd Bug fix 2018-08-11 11:29:03 -04:00
Ben12345rocks d8ce4a9578 Minor config addition 2018-08-11 11:03:45 -04:00
Ben12345rocks 574e8d4a54 Update version number to 5.14.1 2018-08-11 10:59:09 -04:00
Ben12345rocks 19a7a6a733 Change /vote last to show time since vote 2018-08-11 10:43:43 -04:00
Ben12345rocks 1e131e57c3 Minor config change 2018-08-05 12:28:35 -04:00
Ben12345rocks 57795bdb23 Update version number 2018-07-25 19:17:46 -04:00
Ben12345rocks 52bbb76aad Change version to beta 2018-07-22 14:55:01 -04:00
Ben12345rocks 1257ac4600 Update to 1.13 2018-07-22 13:56:34 -04:00
Ben12345rocks 64ffc38405 Convert many users at a time 2018-07-22 13:36:20 -04:00
Ben12345rocks f8009b05bc Bug fixes 2018-07-22 13:28:14 -04:00
Ben12345rocks 114f217046 Bug fixes 2018-07-21 21:44:56 -04:00
Ben12345rocks 2de309cccc Bug fix 2018-07-21 18:38:52 -04:00
Ben12345rocks 7f827857bc Improvements 2018-07-21 17:13:02 -04:00
Ben12345rocks 75e244f678 Quick change 2018-07-18 17:02:58 -04:00
Ben12345rocks a346f28df1 Bug fix 2018-07-18 17:00:56 -04:00
Ben12345rocks afa57566da Update version number 2018-07-16 16:56:17 -04:00
Ben12345rocks 6f46469ff6 Add nickname to broadcast 2018-07-15 20:54:55 -04:00
Ben12345rocks 7edf33a448 Undo, for bug fix 2018-07-15 19:10:39 -04:00
Ben12345rocks 4d7b30eb20 Update config 2018-07-15 15:39:44 -04:00
Ben12345rocks ed8d92e4a4 Update to 1.13 2018-07-15 15:04:47 -04:00
10 changed files with 203 additions and 43 deletions

No files matched your search

+29 -15
View File
@@ -169,7 +169,11 @@ Format:
Title: '&3&l%player% Last Vote Times:'
# Lines for each vote site
# %time% = time, using timeformat below
Line: '&3%SiteName%: &6%time%'
# %timesince% = time since vote
Line: '&3%SiteName%: &6%timeSince% ago'
# Spelling of TimeType can be changed under Format.Commands.TimeFormats
TimeFormat: '%amount% %TimeType%'
NeverVoted: 'Never voted'
# Format for /vote total
Total:
@@ -246,6 +250,16 @@ Format:
# See https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html
TimeFormat: 'EEE, d MMM yyyy HH:mm'
TimeFomrats:
Day: 'Day'
Days: 'Days'
Hour: 'Hour'
Hours: 'Hours'
Minute: 'Minute'
Minutes: 'Minutes'
Second: 'Second'
Seconds: 'Seconds'
# Format for signs
# SiteName may be all, depending on sign
# %position% = position of player, set by sign
@@ -317,7 +331,7 @@ GUI:
Slot: 1
Last:
Item:
Material: 'WATCH'
Material: 'CLOCK'
Data: 0
Amount: 1
Name: '&4Last'
@@ -443,25 +457,25 @@ GUI:
BackButton: true
DayTotal:
Item:
Material: 'WATCH'
Material: 'CLOCK'
Name: '&cDaily Total'
Lore: '&c&lTotal: &c%Total%'
Amount: 1
WeekTotal:
Item:
Material: 'WATCH'
Material: 'CLOCK'
Name: '&cWeekly Total'
Lore: '&c&lTotal: &c%Total%'
Amount: 1
MonthTotal:
Item:
Material: 'WATCH'
Material: 'CLOCK'
Name: '&cMonthly Total'
Lore: '&c&lTotal: &c%Total%'
Amount: 1
AllTimeTotal:
Item:
Material: 'WATCH'
Material: 'CLOCK'
Name: '&cAllTime Total'
Lore: '&c&lTotal: &c%Total%'
Amount: 1
@@ -469,19 +483,19 @@ GUI:
Name: 'VoteBest: %player%'
DayBest:
Item:
Material: 'WATCH'
Material: 'CLOCK'
Name: '&cDaily Best'
Lore: '&c&lBest: &c%Best%'
Amount: 1
WeekBest:
Item:
Material: 'WATCH'
Material: 'CLOCK'
Name: '&cWeekly Best'
Lore: '&c&lBest: &c%Best%'
Amount: 1
MonthBest:
Item:
Material: 'WATCH'
Material: 'CLOCK'
Name: '&cMonthly Best'
Lore: '&c&lBest: &c%Best%'
Amount: 1
@@ -490,37 +504,37 @@ GUI:
BackButton: false
CurrentDayStreak:
Item:
Material: 'WATCH'
Material: 'CLOCK'
Name: '&cCurrent Daily Streak'
Lore: '&c&lStreak: &c%Streak%'
Amount: 1
CurrentWeekStreak:
Item:
Material: 'WATCH'
Material: 'CLOCK'
Name: '&cCurrent Weekly Streak'
Lore: '&c&lStreak: &c%Streak%'
Amount: 1
CurrentMonthStreak:
Item:
Material: 'WATCH'
Material: 'CLOCK'
Name: '&cCurrent Monthly Streak'
Lore: '&c&lStreak: &c%Streak%'
Amount: 1
HighestDayStreak:
Item:
Material: 'WATCH'
Material: 'CLOCK'
Name: '&cHighest Daily Streak'
Lore: '&c&lStreak: &c%Streak%'
Amount: 1
HighestWeekStreak:
Item:
Material: 'WATCH'
Material: 'CLOCK'
Name: '&cHighest Weekly Streak'
Lore: '&c&lStreak: &c%Streak%'
Amount: 1
HighestMonthStreak:
Item:
Material: 'WATCH'
Material: 'CLOCK'
Name: '&cHighest Monthly Streak'
Lore: '&c&lStreak: &c%Streak%'
Amount: 1
+1 -1
View File
@@ -32,7 +32,7 @@ VoteSites:
VoteDelayDaily: false
# If true, rewards can be executed offline (requires ForceOffline to be true in the reward)
# Setting this to true will execute the reward offline, NOT WHEN THE PLAYER IS OFFLINE
# Setting this to true will execute the reward offline while the player is offline
# This basiclly disables offline voting if set to true, don't misinterpret this option
ForceOffline: false
+1
View File
@@ -5,6 +5,7 @@ description: Highly Customizable Voting Listener!
website: https://www.spigotmc.org/resources/votingplugin.15358/
author: Ben12345rocks
softdepend: [AdvancedCore]
api-version: 1.13
commands:
vote:
description: Vote command
+2 -2
View File
@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.Ben12345rocks</groupId>
<artifactId>VotingPlugin</artifactId>
<version>5.13.4</version>
<version>5.14.2</version>
<packaging>jar</packaging>
<name>VotingPlugin</name>
<properties>
@@ -165,7 +165,7 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.12.2-R0.1-SNAPSHOT</version>
<version>1.13-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -590,6 +590,7 @@ public class Commands {
* the vote site
* @return the string
*/
@Deprecated
public String voteCommandLastDate(User user, VoteSite voteSite) {
long time = user.getTime(voteSite);
if (time > 0) {
@@ -602,9 +603,89 @@ public class Commands {
public String voteCommandLastLine(User user, VoteSite voteSite) {
String timeString = voteCommandLastDate(user, voteSite);
String timeSince = voteCommandLastDuration(user, voteSite);
return config.getFormatCommandsVoteLastLine().replace("%Month% %Day%, %Year% %Hour%:%Minute% %ampm%", "%time%")
.replace("%time%", timeString).replace("%SiteName%", voteSite.getDisplayName());
HashMap<String, String> placeholders = new HashMap<String, String>();
placeholders.put("time", timeString);
placeholders.put("SiteName", voteSite.getDisplayName());
placeholders.put("timesince", timeSince);
return StringUtils.getInstance().replacePlaceHolder(Config.getInstance().formatCommandsVoteLastLine,
placeholders);
}
public String voteCommandLastDuration(User user, VoteSite voteSite) {
long time = user.getTime(voteSite);
if (time > 0) {
LocalDateTime now = LocalDateTime.now();
LocalDateTime lastVote = LocalDateTime.ofInstant(Instant.ofEpochMilli(time), ZoneId.systemDefault());
Duration dur = Duration.between(lastVote, now);
long diffSecond = dur.getSeconds();
int diffDays = (int) (diffSecond / 60 / 60 / 24);
int diffHours = (int) (diffSecond / 60 / 60 - diffDays * 24);
int diffMinutes = (int) (diffSecond / 60 - diffHours * 60 - diffDays * 24 * 60);
int diffSeconds = (int) (diffSecond - diffMinutes * 60 - diffHours * 60 * 60 - diffDays * 24 * 60 * 60);
String info = "";
if (diffDays == 1) {
info += StringUtils.getInstance()
.replacePlaceHolder(StringUtils.getInstance().replacePlaceHolder(
Config.getInstance().formatCommandsVoteLastTimeFormat, "TimeType",
Config.getInstance().formatTimeFormatsDay), "amount", "" + diffDays);
info += " ";
} else if (diffDays > 1) {
info += StringUtils.getInstance()
.replacePlaceHolder(StringUtils.getInstance().replacePlaceHolder(
Config.getInstance().formatCommandsVoteLastTimeFormat, "TimeType",
Config.getInstance().formatTimeFormatsDays), "amount", "" + diffDays);
info += " ";
}
if (diffHours == 1) {
info += StringUtils.getInstance()
.replacePlaceHolder(StringUtils.getInstance().replacePlaceHolder(
Config.getInstance().formatCommandsVoteLastTimeFormat, "TimeType",
Config.getInstance().formatTimeFormatsHour), "amount", "" + diffHours);
info += " ";
} else if (diffHours > 1) {
info += StringUtils.getInstance()
.replacePlaceHolder(StringUtils.getInstance().replacePlaceHolder(
Config.getInstance().formatCommandsVoteLastTimeFormat, "TimeType",
Config.getInstance().formatTimeFormatsHours), "amount", "" + diffHours);
info += " ";
}
if (diffMinutes == 1) {
info += StringUtils.getInstance()
.replacePlaceHolder(StringUtils.getInstance().replacePlaceHolder(
Config.getInstance().formatCommandsVoteLastTimeFormat, "TimeType",
Config.getInstance().formatTimeFormatsMinute), "amount", "" + diffMinutes);
info += " ";
} else if (diffMinutes > 1) {
info += StringUtils.getInstance()
.replacePlaceHolder(StringUtils.getInstance().replacePlaceHolder(
Config.getInstance().formatCommandsVoteLastTimeFormat, "TimeType",
Config.getInstance().formatTimeFormatsMinutes), "amount", "" + diffMinutes);
info += " ";
}
if (diffSeconds == 1) {
info += StringUtils.getInstance()
.replacePlaceHolder(StringUtils.getInstance().replacePlaceHolder(
Config.getInstance().formatCommandsVoteLastTimeFormat, "TimeType",
Config.getInstance().formatTimeFormatsSecond), "amount", "" + diffSeconds);
} else {
info += StringUtils.getInstance()
.replacePlaceHolder(StringUtils.getInstance().replacePlaceHolder(
Config.getInstance().formatCommandsVoteLastTimeFormat, "TimeType",
Config.getInstance().formatTimeFormatsSeconds), "amount", "" + diffSeconds);
}
return info;
}
return Config.getInstance().formatCommandsVoteLastNeverVoted;
}
/**
@@ -600,7 +600,7 @@ public class PlayerGUIs {
}
});
inv.addButton(new BInventoryButton(new ItemBuilder(Material.WATCH).setName("&4Last Vote")
inv.addButton(new BInventoryButton(new ItemBuilder(Material.CLOCK).setName("&4Last Vote")
.addLoreLine(Commands.getInstance().voteCommandLastLine(user, site))) {
@Override
@@ -54,6 +54,39 @@ public class Config extends YMLFile {
@ConfigDataBoolean(path = "Commands.VoteRewardFromVoteURL", defaultValue = false)
public boolean commandsVoteRewardFromVoteURL;
@ConfigDataString(path = "Format.Commands.Vote.Last.TimeFormat", defaultValue = "%amount% %TimeType%")
public String formatCommandsVoteLastTimeFormat;
@ConfigDataString(path = "Format.Commands.Vote.Last.Line", defaultValue = "&3%SiteName%: &6%timeSince% ago")
public String formatCommandsVoteLastLine;
@ConfigDataString(path = "Format.Commands.Vote.Last.NeverVoted", defaultValue = "Never voted")
public String formatCommandsVoteLastNeverVoted;
@ConfigDataString(path = "Format.TimeFormats.Days", defaultValue = "Days")
public String formatTimeFormatsDays;
@ConfigDataString(path = "Format.TimeFormats.Day", defaultValue = "Day")
public String formatTimeFormatsDay;
@ConfigDataString(path = "Format.TimeFormats.Hours", defaultValue = "Hours")
public String formatTimeFormatsHours;
@ConfigDataString(path = "Format.TimeFormats.Hour", defaultValue = "Hour")
public String formatTimeFormatsHour;
@ConfigDataString(path = "Format.TimeFormats.Minutes", defaultValue = "Minutes")
public String formatTimeFormatsMinutes;
@ConfigDataString(path = "Format.TimeFormats.Minute", defaultValue = "Minute")
public String formatTimeFormatsMinute;
@ConfigDataString(path = "Format.TimeFormats.Seconds", defaultValue = "Seconds")
public String formatTimeFormatsSeconds;
@ConfigDataString(path = "Format.TimeFormats.Second", defaultValue = "Second")
public String formatTimeFormatsSecond;
/**
* Allow un joined.
*
@@ -175,7 +208,7 @@ public class Config extends YMLFile {
}
public int getConvertDelay() {
return getData().getInt("ConvertDelay", 10000);
return getData().getInt("ConvertDelay", 30000);
}
public boolean getCountFakeVotes() {
@@ -376,15 +409,6 @@ public class Config extends YMLFile {
}
/**
* Gets the commands vote last line.
*
* @return the commands vote last line
*/
public String getFormatCommandsVoteLastLine() {
return getData().getString("Format.Commands.Vote.Last.Line", "&3%SiteName%: &6%time%");
}
/**
* Gets the commands vote last title.
*
@@ -33,6 +33,7 @@ import com.Ben12345rocks.AdvancedCore.Util.Javascript.JavascriptPlaceholderReque
import com.Ben12345rocks.AdvancedCore.Util.Logger.Logger;
import com.Ben12345rocks.AdvancedCore.Util.Metrics.BStatsMetrics;
import com.Ben12345rocks.AdvancedCore.Util.Metrics.MCStatsMetrics;
import com.Ben12345rocks.AdvancedCore.Util.Misc.StringUtils;
import com.Ben12345rocks.AdvancedCore.Util.Updater.Updater;
import com.Ben12345rocks.VotingPlugin.Commands.CommandLoader;
import com.Ben12345rocks.VotingPlugin.Commands.Commands;
@@ -138,22 +139,26 @@ public class Main extends JavaPlugin {
while (uuids.size() > 0) {
HashMap<User, HashMap<String, String>> data = new HashMap<User, HashMap<String, String>>();
AdvancedCoreHook.getInstance().setStorageType(from);
//AdvancedCoreHook.getInstance().setStorageType(to);
if (AdvancedCoreHook.getInstance().getStorageType().equals(UserStorage.MYSQL)
&& AdvancedCoreHook.getInstance().getMysql() != null)
{
&& AdvancedCoreHook.getInstance().getMysql() != null) {
AdvancedCoreHook.getInstance().getMysql().clearCache();
}
ArrayList<String> converted = new ArrayList<String>();
int i = 0;
while (i < 500 && i < uuids.size()) {
while (i < 250 && i < uuids.size()) {
String uuid = uuids.get(i);
try {
User user = UserManager.getInstance().getVotingPluginUser(new UUID(uuid));
HashMap<String, String> values = new HashMap<String, String>();
for (String key : user.getData().getKeys()) {
values.put(key, user.getData().getString(key));
String value = user.getData().getValue(key);
if (value != null && !value.isEmpty() && !value.equalsIgnoreCase("null")) {
values.put(key, value);
}
}
i++;
converted.add(uuid);
@@ -178,9 +183,7 @@ public class Main extends JavaPlugin {
AdvancedCoreHook.getInstance().setStorageType(to);
if (AdvancedCoreHook.getInstance().getStorageType().equals(UserStorage.MYSQL)
&& AdvancedCoreHook.getInstance().getMysql() != null)
{
&& AdvancedCoreHook.getInstance().getMysql() != null) {
AdvancedCoreHook.getInstance().getMysql().clearCache();
}
@@ -774,7 +777,25 @@ public class Main extends JavaPlugin {
AdvancedCoreHook.getInstance().getMysql().alterColumnType("CheckWorld", "VARCHAR(5)");
AdvancedCoreHook.getInstance().getMysql().alterColumnType("Reminded", "VARCHAR(5)");
AdvancedCoreHook.getInstance().getMysql().alterColumnType("DisableBroadcast", "VARCHAR(5)");
AdvancedCoreHook.getInstance().getMysql().alterColumnType("DailyTotal", "VARCHAR(10)");
AdvancedCoreHook.getInstance().getMysql().alterColumnType("LastOnline", "VARCHAR(20)");
AdvancedCoreHook.getInstance().getMysql().alterColumnType("PlayerName", "VARCHAR(20)");
AdvancedCoreHook.getInstance().getMysql().alterColumnType("DailyTotal", "INT DEFAULT '0'");
AdvancedCoreHook.getInstance().getMysql().alterColumnType("WeeklyTotal", "INT DEFAULT '0'");
AdvancedCoreHook.getInstance().getMysql().alterColumnType("DayVoteStreak", "INT DEFAULT '0'");
AdvancedCoreHook.getInstance().getMysql().alterColumnType("BestDayVoteStreak", "INT DEFAULT '0'");
AdvancedCoreHook.getInstance().getMysql().alterColumnType("WeekVoteStreak", "INT DEFAULT '0'");
AdvancedCoreHook.getInstance().getMysql().alterColumnType("BestWeekVoteStreak", "INT DEFAULT '0'");
AdvancedCoreHook.getInstance().getMysql().alterColumnType("VotePartyVotes", "INT DEFAULT '0'");
AdvancedCoreHook.getInstance().getMysql().alterColumnType("MonthVoteStreak", "INT DEFAULT '0'");
AdvancedCoreHook.getInstance().getMysql().alterColumnType("Points", "INT DEFAULT '0'");
AdvancedCoreHook.getInstance().getMysql().alterColumnType("HighestDailyTotal", "INT DEFAULT '0'");
AdvancedCoreHook.getInstance().getMysql().alterColumnType("MileStoneTotal", "INT DEFAULT '0'");
AdvancedCoreHook.getInstance().getMysql().alterColumnType("AllTimeTotal", "INT DEFAULT '0'");
AdvancedCoreHook.getInstance().getMysql().alterColumnType("HighestMonthlyTotal", "INT DEFAULT '0'");
AdvancedCoreHook.getInstance().getMysql().alterColumnType("MilestoneCount", "INT DEFAULT '0'");
AdvancedCoreHook.getInstance().getMysql().alterColumnType("MonthTotal", "INT DEFAULT '0'");
AdvancedCoreHook.getInstance().getMysql().alterColumnType("HighestWeeklyTotal", "INT DEFAULT '0'");
AdvancedCoreHook.getInstance().getMysql().alterColumnType("LastMonthTotal", "INT DEFAULT '0'");
}
@@ -877,6 +898,7 @@ public class Main extends JavaPlugin {
public void reload() {
setUpdate(true);
config.reloadData();
config.loadValues();
configVoteSites.reloadData();
updateAdvancedCoreHook();
plugin.loadVoteSites();
@@ -992,10 +1014,22 @@ public class Main extends JavaPlugin {
}
private void writeConvertData(HashMap<User, HashMap<String, String>> data) {
boolean checkInt = AdvancedCoreHook.getInstance().getStorageType().equals(UserStorage.MYSQL);
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());
String value = values.getValue();
if (value != null && !value.equalsIgnoreCase("null")) {
if (checkInt) {
if (StringUtils.getInstance().isInt(value)) {
entry.getKey().getData().setInt(values.getKey(), Integer.parseInt(value));
} else {
entry.getKey().getData().setString(values.getKey(), value);
}
} else {
entry.getKey().getData().setString(values.getKey(), value);
}
}
}
} catch (Exception e) {
e.printStackTrace();
@@ -1,6 +1,7 @@
package com.Ben12345rocks.VotingPlugin.Objects;
import java.util.ArrayList;
import java.util.HashMap;
import org.bukkit.Bukkit;
import org.bukkit.Material;
@@ -88,7 +89,12 @@ public class VoteSite {
if (!user.isVanished()) {
String playerName = user.getPlayerName();
String bc = StringUtils.getInstance().colorize(config.getFormatBroadCastMsg());
bc = bc.replace("%player%", playerName).replace("%SiteName%", getDisplayName());
HashMap<String, String> placeholders = new HashMap<String, String>();
placeholders.put("player", playerName);
placeholders.put("nickname",
(user.getPlayer() != null) ? user.getPlayer().getDisplayName() : user.getPlayerName());
placeholders.put("sitename", getDisplayName());
bc = StringUtils.getInstance().replacePlaceHolder(bc, placeholders);
ArrayList<Player> players = new ArrayList<Player>();
for (Player p : Bukkit.getOnlinePlayers()) {
if (!UserManager.getInstance().getVotingPluginUser(p).getDisableBroadcast()) {
@@ -241,7 +241,7 @@ public class PlaceHolders {
}
VoteSite voteSite = plugin.getVoteSite(siteName);
return Commands.getInstance().voteCommandLastDate(user, voteSite);
return Commands.getInstance().voteCommandLastDuration(user, voteSite);
}
public String playerNextVote(User user, String siteName) {