Updated to 2.0.7 (view the changelog on the Spigot update).

This commit is contained in:
CoderMarido 2018-09-13 14:06:10 +02:00
parent fe4a0553ae
commit 3943fbfb81
4 changed files with 28 additions and 26 deletions

View File

@ -20,6 +20,7 @@ import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitRunnable;
import nl.marido.deluxeheads.cache.CacheFile;
import nl.marido.deluxeheads.cache.CacheHead;
@ -108,23 +109,25 @@ public class DeluxeHeads extends JavaPlugin implements Listener {
}
private void checkForUpdates() {
async(() -> {
try {
String currentVersion = UpdateChecker.getCurrentVersion();
String latestVersion = UpdateChecker.getLatestVersion();
if (!UpdateChecker.isNewerVersion(latestVersion)) {
String newversion = Lang.Updater.newVersion().toString();
newversion = newversion.replaceAll("%version%", currentVersion);
severe(newversion);
return;
new BukkitRunnable() {
public void run() {
try {
String currentVersion = UpdateChecker.getCurrentVersion();
String latestVersion = UpdateChecker.getLatestVersion();
if (!UpdateChecker.isNewerVersion(latestVersion)) {
String newversion = Lang.Updater.newVersion().toString();
newversion = newversion.replaceAll("%version%", currentVersion);
severe(newversion);
return;
}
String oldversion = Lang.Updater.oldVersion().toString();
oldversion = oldversion.replaceAll("%version%", currentVersion);
warning(oldversion);
} catch (IOException e) {
severe("There was an error checking for an update for Heads");
}
String oldversion = Lang.Updater.oldVersion().toString();
oldversion = oldversion.replaceAll("%version%", currentVersion);
warning(oldversion);
} catch (IOException e) {
severe("There was an error checking for an update for Heads");
}
});
}.runTaskAsynchronously(DeluxeHeads.getInstance());
}
private void registerCommands() {
@ -421,10 +424,6 @@ public class DeluxeHeads extends JavaPlugin implements Listener {
Bukkit.getScheduler().runTask(instance, task);
}
public static void async(Runnable task) {
Bukkit.getScheduler().runTaskAsynchronously(instance, task);
}
public static FileConfigFile getVersionedConfig(String resource) {
if (Version.isBelow(Version.v1_13))
return new FileConfigFile(resource, "pre1_13/" + resource);

View File

@ -21,6 +21,8 @@ import java.util.function.Consumer;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
import org.bukkit.scheduler.BukkitRunnable;
import nl.marido.deluxeheads.DeluxeHeads;
import nl.marido.deluxeheads.handlers.Search;
import nl.marido.deluxeheads.util.Checks;
@ -97,12 +99,13 @@ public final class CacheFile implements Mod {
public void searchHeadsAsync(String query, Consumer<List<CacheHead>> onResult) {
List<CacheHead> headsCopy = new ArrayList<>(heads);
new BukkitRunnable() {
public void run() {
List<CacheHead> matches = Search.searchHeads(query, headsCopy, 0.4d);
DeluxeHeads.async(() -> {
List<CacheHead> matches = Search.searchHeads(query, headsCopy, 0.4d);
DeluxeHeads.sync(() -> onResult.accept(matches));
});
DeluxeHeads.sync(() -> onResult.accept(matches));
}
}.runTaskAsynchronously(DeluxeHeads.getInstance());
}
public CacheHead findHead(int id) {

View File

@ -44,7 +44,7 @@ public class GetMode extends BaseMode {
@Override
public boolean canOpenCategory(String category) {
if (getPlayer().hasPermission("heads.category." + category.toLowerCase().replace(' ', '_'))) {
if (getPlayer().hasPermission("deluxeheads.category." + category.toLowerCase().replace(' ', '_'))) {
return true;
} else {
Lang.Menu.Get.categoryPermission(category).send(getPlayer());

View File

@ -2,7 +2,7 @@ main: nl.marido.deluxeheads.DeluxeHeads
author: Marido
name: DeluxeHeads
description: Enhance your server with over 17,000 awesome unique heads with amazing features.
version: 2.1.6
version: 2.1.7
api-version: 1.13
softdepend: [Vault, PlayerPoints, BlockStore]
loadbefore: [DeluxeMenus]