Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4ccc5def2b | ||
|
|
5378d4e372 | ||
|
|
8d37d39b1c | ||
|
|
473a83604c | ||
|
|
4f72fbab78 | ||
|
|
1f62d68aed | ||
|
|
7c063bbe68 | ||
|
|
4c11df4b37 | ||
|
|
f859caf1ee |
No files matched your search
@@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.Ben12345rocks</groupId>
|
||||
<artifactId>VotingPlugin</artifactId>
|
||||
<version>5.12.8</version>
|
||||
<version>5.13</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>VotingPlugin</name>
|
||||
<properties>
|
||||
|
||||
@@ -1346,7 +1346,7 @@ public class Config extends YMLFile {
|
||||
public boolean getVoteURLViewAllUrlsButtonEnabled() {
|
||||
return getData().getBoolean("GUI.VoteURL.ViewAllUrlsButtonEnabled");
|
||||
}
|
||||
|
||||
|
||||
public String getWeeklyAwardRewardsPath(String path) {
|
||||
return "WeeklyAwards." + path + ".Rewards";
|
||||
}
|
||||
@@ -1422,6 +1422,10 @@ public class Config extends YMLFile {
|
||||
saveData();
|
||||
}
|
||||
|
||||
public int getConvertDelay() {
|
||||
return getData().getInt("ConvertDelay", 10000);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the debug info ingame.
|
||||
*
|
||||
|
||||
@@ -129,30 +129,72 @@ public class Main extends JavaPlugin {
|
||||
}
|
||||
UserStorage cur = AdvancedCoreHook.getInstance().getStorageType();
|
||||
AdvancedCoreHook.getInstance().setStorageType(from);
|
||||
AdvancedCoreHook.getInstance().reload();
|
||||
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));
|
||||
if (AdvancedCoreHook.getInstance().getStorageType().equals(UserStorage.MYSQL)
|
||||
&& AdvancedCoreHook.getInstance().getMysql() != null) {
|
||||
AdvancedCoreHook.getInstance().getMysql().clearCache();
|
||||
}
|
||||
ArrayList<String> uuids = new ArrayList<String>(UserManager.getInstance().getAllUUIDs());
|
||||
|
||||
HashMap<String, String> values = new HashMap<String, String>();
|
||||
for (String key : user.getData().getKeys()) {
|
||||
values.put(key, user.getData().getString(key));
|
||||
}
|
||||
data.put(user, values);
|
||||
debug("[Convert] Added " + uuid);
|
||||
} catch (Exception e) {
|
||||
AdvancedCoreHook.getInstance().debug(e);
|
||||
plugin.getLogger().warning("Exception occoured for '" + uuid + "': " + e.getMessage()
|
||||
+ ", turn debug on to see full stack traces");
|
||||
while (uuids.size() > 0) {
|
||||
HashMap<User, HashMap<String, String>> data = new HashMap<User, HashMap<String, String>>();
|
||||
AdvancedCoreHook.getInstance().setStorageType(from);
|
||||
if (AdvancedCoreHook.getInstance().getStorageType().equals(UserStorage.MYSQL)
|
||||
&& AdvancedCoreHook.getInstance().getMysql() != null)
|
||||
|
||||
{
|
||||
AdvancedCoreHook.getInstance().getMysql().clearCache();
|
||||
}
|
||||
ArrayList<String> converted = new ArrayList<String>();
|
||||
int i = 0;
|
||||
while (i < 500 && 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));
|
||||
}
|
||||
i++;
|
||||
converted.add(uuid);
|
||||
data.put(user, values);
|
||||
debug("[Convert] Added " + uuid);
|
||||
} catch (Exception e) {
|
||||
AdvancedCoreHook.getInstance().debug(e);
|
||||
plugin.getLogger().warning("Exception occoured for '" + uuid + "': " + e.getMessage()
|
||||
+ ", turn debug on to see full stack traces");
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
wait(Config.getInstance().getConvertDelay());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
uuids.removeAll(converted);
|
||||
|
||||
plugin.getLogger()
|
||||
.info("Finished getting data from " + from.toString() + " Converting " + data.size() + " users");
|
||||
|
||||
AdvancedCoreHook.getInstance().setStorageType(to);
|
||||
if (AdvancedCoreHook.getInstance().getStorageType().equals(UserStorage.MYSQL)
|
||||
&& AdvancedCoreHook.getInstance().getMysql() != null)
|
||||
|
||||
{
|
||||
AdvancedCoreHook.getInstance().getMysql().clearCache();
|
||||
}
|
||||
|
||||
writeConvertData(data);
|
||||
}
|
||||
|
||||
plugin.getLogger().info("Finished getting data from " + from.toString());
|
||||
|
||||
AdvancedCoreHook.getInstance().setStorageType(to);
|
||||
AdvancedCoreHook.getInstance().setStorageType(cur);
|
||||
AdvancedCoreHook.getInstance().reload();
|
||||
|
||||
plugin.getLogger().info("Finished convertting");
|
||||
}
|
||||
|
||||
private void writeConvertData(HashMap<User, HashMap<String, String>> data) {
|
||||
for (Entry<User, HashMap<String, String>> entry : data.entrySet()) {
|
||||
try {
|
||||
for (Entry<String, String> values : entry.getValue().entrySet()) {
|
||||
@@ -164,10 +206,6 @@ public class Main extends JavaPlugin {
|
||||
+ e.getMessage() + ", turn debug on to see full stack traces");
|
||||
}
|
||||
}
|
||||
AdvancedCoreHook.getInstance().setStorageType(cur);
|
||||
AdvancedCoreHook.getInstance().reload();
|
||||
|
||||
plugin.getLogger().info("Finished convertting");
|
||||
}
|
||||
|
||||
public ArrayList<User> convertSet(Set<User> set) {
|
||||
@@ -776,8 +814,8 @@ public class Main extends JavaPlugin {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
plugin.getLogger()
|
||||
.warning("Detected an issue with voting sites, check the plugin startup log for more details");
|
||||
plugin.getLogger().warning(
|
||||
"Detected an issue with voting sites, check the plugin startup log for more details");
|
||||
}
|
||||
}, 30l);
|
||||
}
|
||||
|
||||
@@ -204,7 +204,7 @@ public class User extends com.Ben12345rocks.AdvancedCore.Objects.User {
|
||||
|
||||
return now.isAfter(nextvote);
|
||||
} else {
|
||||
if (now.getDayOfYear() != lastVote.getDayOfYear() && now.getYear() != lastVote.getYear()) {
|
||||
if (now.getDayOfYear() != lastVote.getDayOfYear() || now.getYear() != lastVote.getYear()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -129,7 +129,12 @@ public class VoteParty implements Listener {
|
||||
}
|
||||
|
||||
public int getVotesRequired() {
|
||||
return Config.getInstance().getVotePartyVotesRequired() + ServerData.getInstance().getVotePartyExtraRequired();
|
||||
int required = Config.getInstance().getVotePartyVotesRequired();
|
||||
int extra = ServerData.getInstance().getVotePartyExtraRequired();
|
||||
if (extra > 0) {
|
||||
return required + extra;
|
||||
}
|
||||
return required;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user