mirror of
https://github.com/TotalFreedomMC/TF-LibsDisguises.git
synced 2025-02-05 06:12:48 +00:00
Guess I have to modify this after all
This commit is contained in:
parent
67a86ddcdd
commit
0cfa32159a
4 changed files with 6 additions and 21 deletions
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
*.iml
|
||||||
|
.idea/
|
||||||
|
target/
|
|
@ -253,9 +253,6 @@ public class DisguiseConfig {
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
private static boolean saveUserPreferences;
|
private static boolean saveUserPreferences;
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
private static long lastUpdateRequest;
|
|
||||||
|
|
||||||
public static boolean isArmorstandsName() {
|
public static boolean isArmorstandsName() {
|
||||||
return getPlayerNameType() == PlayerNameType.ARMORSTANDS;
|
return getPlayerNameType() == PlayerNameType.ARMORSTANDS;
|
||||||
|
@ -314,20 +311,12 @@ public class DisguiseConfig {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
long timeSinceLast = System.currentTimeMillis() - (getLastUpdateRequest() + TimeUnit.HOURS.toMillis(6));
|
|
||||||
|
|
||||||
if (timeSinceLast > 0) {
|
|
||||||
timeSinceLast /= 50;
|
|
||||||
} else {
|
|
||||||
timeSinceLast = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
updaterTask = Bukkit.getScheduler().runTaskTimerAsynchronously(LibsDisguises.getInstance(), new Runnable() {
|
updaterTask = Bukkit.getScheduler().runTaskTimerAsynchronously(LibsDisguises.getInstance(), new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
LibsDisguises.getInstance().getUpdateChecker().doAutoUpdateCheck();
|
LibsDisguises.getInstance().getUpdateChecker().doAutoUpdateCheck();
|
||||||
}
|
}
|
||||||
}, timeSinceLast, (20 * TimeUnit.HOURS.toSeconds(6))); // Check every 6 hours
|
}, 0, (20 * TimeUnit.HOURS.toSeconds(6))); // Check every 6 hours
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setUsingReleaseBuilds(boolean useReleaseBuilds) {
|
public static void setUsingReleaseBuilds(boolean useReleaseBuilds) {
|
||||||
|
@ -361,7 +350,6 @@ public class DisguiseConfig {
|
||||||
bisectHosted = configuration.getBoolean("Bisect-Hosted", isBisectHosted());
|
bisectHosted = configuration.getBoolean("Bisect-Hosted", isBisectHosted());
|
||||||
savedServerIp = configuration.getString("Server-IP", getSavedServerIp());
|
savedServerIp = configuration.getString("Server-IP", getSavedServerIp());
|
||||||
usingReleaseBuild = configuration.getBoolean("ReleaseBuild", isUsingReleaseBuild());
|
usingReleaseBuild = configuration.getBoolean("ReleaseBuild", isUsingReleaseBuild());
|
||||||
lastUpdateRequest = configuration.getLong("LastUpdateRequest", 0L);
|
|
||||||
|
|
||||||
if (!configuration.contains("Bisect-Hosted") || !configuration.contains("Server-IP") ||
|
if (!configuration.contains("Bisect-Hosted") || !configuration.contains("Server-IP") ||
|
||||||
!configuration.contains("ReleaseBuild")) {
|
!configuration.contains("ReleaseBuild")) {
|
||||||
|
@ -376,8 +364,7 @@ public class DisguiseConfig {
|
||||||
.getResourceAsString(LibsDisguises.getInstance().getFile(), "internal.yml");
|
.getResourceAsString(LibsDisguises.getInstance().getFile(), "internal.yml");
|
||||||
|
|
||||||
// Bisect hosted, server ip, release builds
|
// Bisect hosted, server ip, release builds
|
||||||
for (Object s : new Object[]{isBisectHosted(), getSavedServerIp(), isUsingReleaseBuild(),
|
for (Object s : new Object[]{isBisectHosted(), getSavedServerIp(), isUsingReleaseBuild()}) {
|
||||||
getLastUpdateRequest()}) {
|
|
||||||
internalConfig = internalConfig.replaceFirst("%data%", "" + s);
|
internalConfig = internalConfig.replaceFirst("%data%", "" + s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -156,9 +156,6 @@ public class UpdateChecker {
|
||||||
}
|
}
|
||||||
|
|
||||||
public LibsMsg doUpdateCheck() {
|
public LibsMsg doUpdateCheck() {
|
||||||
DisguiseConfig.setLastUpdateRequest(System.currentTimeMillis());
|
|
||||||
DisguiseConfig.saveInternalConfig();
|
|
||||||
|
|
||||||
downloading.set(true);
|
downloading.set(true);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -5,6 +5,4 @@
|
||||||
Bisect-Hosted: %data%
|
Bisect-Hosted: %data%
|
||||||
Server-IP: %data%
|
Server-IP: %data%
|
||||||
# Should the plugin be doing release or dev builds updating?
|
# Should the plugin be doing release or dev builds updating?
|
||||||
ReleaseBuild: %data%
|
ReleaseBuild: %data%
|
||||||
# Make sure the plugin aint spamming update requests
|
|
||||||
LastUpdateCheck: %data%
|
|
Loading…
Reference in a new issue