Answers for "loc.getworld().playsound(_"

1

loc.getworld().playsound(_

@EventHandler(ignoreCancelled = true)
public void onPickupToQuickSlot(PlayerPickupItemEvent event) {
    Player player = event.getPlayer();

    if (!InventoryManager.playerIsLoaded(player) || !ItemManager.allowedForPlayer(player, event.getItem().getItemStack(), false)) {
        return;
    }

    for (Slot quickSlot : SlotManager.instance().getQuickSlots()) {
        int slotId = quickSlot.getQuickSlot();
        if (quickSlot.isCup(player.getInventory().getItem(slotId)) && quickSlot.isValidItem(event.getItem().getItemStack())) {
            player.getInventory().setItem(slotId, event.getItem().getItemStack());
            event.getItem().remove();

            player.playSound(player.getLocation(), Sound.ENTITY_ITEM_PICKUP, .3f, 1.7f);
            if (Config.getConfig().getBoolean("attack.auto-held")) {
                player.getInventory().setHeldItemSlot(quickSlot.getQuickSlot());
            }

            event.setCancelled(true);
        }
    }
}
Posted by: Guest on March-27-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language