|
|
|
|
@ -15,10 +15,12 @@ import org.bukkit.inventory.ItemStack; |
|
|
|
|
import xyz.mineconomia.mineconomiacore.MineconomiaCore; |
|
|
|
|
|
|
|
|
|
import java.util.Objects; |
|
|
|
|
import java.util.Random; |
|
|
|
|
import java.util.concurrent.TimeUnit; |
|
|
|
|
|
|
|
|
|
public class FHBHandler implements Listener { |
|
|
|
|
@EventHandler |
|
|
|
|
public void onFHBHit(ProjectileHitEvent event){ |
|
|
|
|
public void onFHBHit(ProjectileHitEvent event) throws InterruptedException { |
|
|
|
|
if (event.getEntity() instanceof Snowball){ |
|
|
|
|
Snowball ball = (Snowball) event.getEntity(); |
|
|
|
|
MineconomiaCore.logger.info(ball.getCustomName()); |
|
|
|
|
@ -43,9 +45,12 @@ public class FHBHandler implements Listener { |
|
|
|
|
if (wheatData.getAge() == 7){ |
|
|
|
|
wheatData.setAge(0); |
|
|
|
|
w.playSound(block.getLocation(), "minecraft:block.crop.break", 100, 1); |
|
|
|
|
Random rd = new Random(); |
|
|
|
|
w.playSound(block.getLocation(), "block.note_block.cow_bell", 100, rd.nextFloat()); |
|
|
|
|
block.setBlockData(wheatData); |
|
|
|
|
w.dropItemNaturally(block.getLocation(), new ItemStack(Material.WHEAT, 1)); |
|
|
|
|
w.spawnParticle(Particle.EXPLOSION_NORMAL, block.getLocation(), 0); |
|
|
|
|
TimeUnit.MILLISECONDS.sleep(20); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|