Immature crop replanting, green thumb tweaks, replant accidental break

protection
This commit is contained in:
nossr50
2020-02-19 15:58:53 -08:00
parent 8f26544188
commit e2073ff9f7
8 changed files with 179 additions and 27 deletions

View File

@ -1,6 +1,8 @@
package com.gmail.nossr50.util.skills;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.util.sounds.SoundManager;
import com.gmail.nossr50.util.sounds.SoundType;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
@ -14,6 +16,12 @@ public final class ParticleEffectUtils {
private ParticleEffectUtils() {};
public static void playGreenThumbEffect(Location location) {
World world = location.getWorld();
playSmokeEffect(location);
SoundManager.worldSendSoundMaxPitch(world, location, SoundType.POP);
}
public static void playBleedEffect(LivingEntity livingEntity) {
if (!Config.getInstance().getBleedEffectEnabled()) {
return;
@ -27,7 +35,7 @@ public final class ParticleEffectUtils {
return;
}
playSmokeEffect(player);
playSmokeEffect(player.getLocation());
}
public static void playFluxEffect(Location location) {
@ -38,9 +46,8 @@ public final class ParticleEffectUtils {
location.getWorld().playEffect(location, Effect.MOBSPAWNER_FLAMES, 1);
}
public static void playSmokeEffect(LivingEntity livingEntity) {
Location location = livingEntity.getEyeLocation();
World world = livingEntity.getWorld();
public static void playSmokeEffect(Location location) {
World world = location.getWorld();
// Have to do it this way, because not all block directions are valid for smoke
world.playEffect(location, Effect.SMOKE, BlockFace.SOUTH_EAST);

View File

@ -39,6 +39,11 @@ public class SoundManager {
world.playSound(location, getSound(soundType), getVolume(soundType), getPitch(soundType));
}
public static void worldSendSoundMaxPitch(World world, Location location, SoundType soundType) {
if(SoundConfig.getInstance().getIsEnabled(soundType))
world.playSound(location, getSound(soundType), getVolume(soundType), 2.0F);
}
/**
* All volume is multiplied by the master volume to get its final value
* @param soundType target soundtype