1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-29 14:05:25 +01:00

Disabling item enchant for boosted items in anvils

This commit is contained in:
Zrips 2022-06-24 13:02:58 +03:00
parent 5e001047ad
commit 6822508631

View File

@ -71,6 +71,7 @@ import org.bukkit.event.inventory.InventoryAction;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryMoveItemEvent;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.inventory.PrepareAnvilEvent;
import org.bukkit.event.inventory.InventoryType.SlotType;
import org.bukkit.event.player.PlayerFishEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent;
@ -88,6 +89,7 @@ import org.bukkit.inventory.meta.PotionMeta;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.metadata.MetadataValue;
import org.bukkit.permissions.PermissionAttachmentInfo;
import org.checkerframework.checker.nullness.qual.Nullable;
import com.bgsoftware.wildstacker.api.enums.StackSplit;
import com.gamingmesh.jobs.ItemBoostManager;
@ -1078,6 +1080,17 @@ public final class JobsPaymentListener implements Listener {
Jobs.action(jPlayer, new ItemActionInfo(resultStack, ActionType.ENCHANT));
}
@EventHandler(priority = EventPriority.NORMAL)
public void PrepareAnvilEvent(final PrepareAnvilEvent event) {
if (!Jobs.getPlayerManager().containsItemBoostByNBT(event.getInventory().getContents()[0]))
return;
if (!CMIMaterial.get(event.getInventory().getContents()[1]).equals(CMIMaterial.ENCHANTED_BOOK))
return;
event.setResult(null);
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onInventoryMoveItemEventToFurnace(InventoryMoveItemEvent event) {
if (!Jobs.getGCManager().PreventHopperFillUps || event.getItem().getType() == Material.AIR)