1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-20 11:45:51 +00:00

Ancient altar no longer able to craft items that are not unlocked

This commit is contained in:
AlexLander123 2019-11-06 02:17:52 +08:00
parent 9442fa65ca
commit c13ec9903c

View File

@ -110,14 +110,24 @@ public class AncientAltarListener implements Listener {
ItemStack result = Pedestals.getRecipeOutput(catalyst, input); ItemStack result = Pedestals.getRecipeOutput(catalyst, input);
if (result != null) { if (result != null) {
List<ItemStack> consumed = new ArrayList<>(); if (Slimefun.hasUnlocked(e.getPlayer(), result, true)) {
consumed.add(catalyst); List<ItemStack> consumed = new ArrayList<>();
consumed.add(catalyst);
if (e.getPlayer().getGameMode() != GameMode.CREATIVE) { if (e.getPlayer().getGameMode() != GameMode.CREATIVE) {
ItemUtils.consumeItem(e.getPlayer().getInventory().getItemInMainHand(), false); ItemUtils.consumeItem(e.getPlayer().getInventory().getItemInMainHand(), false);
}
Bukkit.getScheduler().scheduleSyncDelayedTask(SlimefunPlugin.instance, new RitualAnimation(altars, b, b.getLocation().add(0.5, 1.3, 0.5), result, pedestals, consumed), 10L);
} }
else {
altars.remove(e.getClickedBlock());
Bukkit.getScheduler().scheduleSyncDelayedTask(SlimefunPlugin.instance, new RitualAnimation(altars, b, b.getLocation().add(0.5, 1.3, 0.5), result, pedestals, consumed), 10L); pedestals.forEach(block -> utilities.altarinuse.remove(block.getLocation()));
// Item not unlocked, no longer in use.
utilities.altarinuse.remove(b.getLocation());
}
} }
else { else {
altars.remove(e.getClickedBlock()); altars.remove(e.getClickedBlock());