cancel projectile launch if disable interaction flag is set to true

This commit is contained in:
Blackdigits 2020-01-17 21:59:39 +07:00
parent 500c3c60f9
commit a4ccb2fa89

View File

@ -6,6 +6,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.enchantment.EnchantItemEvent;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.entity.ProjectileLaunchEvent;
import org.bukkit.event.inventory.CraftItemEvent;
import org.bukkit.event.inventory.FurnaceSmeltEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
@ -153,4 +154,16 @@ public class DisableInteractions implements Listener {
}
return -1;
}
@EventHandler
public void projectileLaunchCheck(ProjectileLaunchEvent event) {
if(!(event.getEntity().getShooter() instanceof Player))
return;
Player player = (Player) event.getEntity().getShooter();
NBTItem item = NBTItem.get(player.getInventory().getItemInMainHand());
if(item.getBoolean("MMOITEMS_DISABLE_INTERACTION"))
return;
}
}