Small Downloader Bug Fix

This commit is contained in:
LikeWhat 2019-04-16 21:01:40 +02:00
parent dc147bfc2d
commit 5786bb3737
2 changed files with 4 additions and 4 deletions

View File

@ -432,6 +432,7 @@ public class InventoryListener implements Listener {
} else if (args[0].equalsIgnoreCase("retrySearch")) {
openSearchGUI(player, args[1], event.getInventory().getItem(18) == null ? new String[]{"willClose"} : CustomHeads.getTagEditor().getTags(event.getInventory().getItem(18)).toArray(new String[0]));
} else if (args[0].equalsIgnoreCase("downloadLanguage")) {
player.closeInventory();
GitHubDownloader downloader = new GitHubDownloader("MrSteinMC", "CustomHeads").enableAutoUnzipping();
downloader.download(CustomHeads.getInstance().getDescription().getVersion(), args[1], new File(CustomHeads.getInstance().getDataFolder(), "language"), (AsyncFileDownloader.AfterTask) () -> player.sendMessage(CustomHeads.getLanguageManager().LANGUAGE_DOWNLOAD_SUCCESSFUL.replace("{LANGUAGE}", args[1])));
}

View File

@ -160,12 +160,11 @@ public class CHCommand implements CommandExecutor {
return true;
}
if (args[1].equalsIgnoreCase("download")) {
Inventory inventory = Bukkit.createInventory(null, 9 * 4, CustomHeads.getLanguageManager().LANGUAGE_DOWNLOAD_TITLE);
Inventory inventory = Bukkit.createInventory(player, 9 * 4, CustomHeads.getLanguageManager().LANGUAGE_DOWNLOAD_TITLE);
inventory.setItem(13, new ItemEditor(Material.SKULL_ITEM, (byte) 3).setTexture("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNzMxNmMxNmIxYWM0NzBkMmMxMTQ0MzRmZjg3MzBmMTgxNTcwOTM4M2RiNmYzY2Y3MjBjMzliNmRjZTIxMTYifX19").setDisplayName(CustomHeads.getLanguageManager().LANGUAGE_DOWNLOAD_FETCHING).getItem());
player.openInventory(inventory);
BukkitTask animationTask = new BukkitRunnable() {
boolean orange = true;
boolean orange = false;
public void run() {
// Fancy Animations =P
inventory.setItem(13, new ItemEditor(Material.SKULL_ITEM, (byte) 3).setTexture((orange = !orange) ? "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMmQ5MzBlZTIxYWQzYmMzOWRkZmRkZmI0YWE2MjA5MDU2ZTJkOWMxMTVmMTM3ZDc2YWQzYmY2MTI3YzNkMiJ9fX0=" : "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNzMxNmMxNmIxYWM0NzBkMmMxMTQ0MzRmZjg3MzBmMTgxNTcwOTM4M2RiNmYzY2Y3MjBjMzliNmRjZTIxMTYifX19").setDisplayName(CustomHeads.getLanguageManager().LANGUAGE_DOWNLOAD_FETCHING).getItem());
@ -177,7 +176,7 @@ public class CHCommand implements CommandExecutor {
animationTask.cancel();
inventory.setItem(13, null);
for (String language : languages) {
inventory.addItem(CustomHeads.getTagEditor().addTags(new ItemEditor(Material.PAPER).setDisplayName(language).getItem(), "blockMoving", "invAction", "downloadLanguage", language));
inventory.addItem(CustomHeads.getTagEditor().addTags(new ItemEditor(Material.PAPER).setDisplayName("§e" + language).getItem(), "blockMoving", "invAction", "downloadLanguage#>" + language));
}
}