Skip to content

Commit

Permalink
potential fix to heart effect, added explosion effect
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeebiss committed Mar 25, 2013
1 parent cc8faa5 commit 650e4fa
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
2 changes: 2 additions & 0 deletions src/main/java/net/aufdemrand/denizen/CommandHandler.java
Expand Up @@ -564,6 +564,8 @@ public void playEffect(CommandContext args, CommandSender sender, NPC npc) throw
trait.setEffect("POTION");
} else if (name.equalsIgnoreCase("heart")) {
trait.setEffect("HEART");
} else if (name.equalsIgnoreCase("explosion")) {
trait.setEffect("EXPLOSION");
} else Messaging.send(sender, ChatColor.RED + "Not a valid effect name!");

} else Messaging.send(sender, ChatColor.RED + "Please specify an effect name!");
Expand Down
Expand Up @@ -13,11 +13,12 @@
import org.bukkit.World;
import org.bukkit.craftbukkit.v1_5_R2.CraftWorld;
import org.bukkit.craftbukkit.v1_5_R2.entity.CraftLivingEntity;
import org.bukkit.craftbukkit.v1_5_R2.entity.CraftWolf;
import org.bukkit.entity.Wolf;

public class ParticlesTrait extends Trait {

public enum EffectType { NONE, SMOKE, FLAME, ENDER, POTBREAK, HEART, POTION }
public enum EffectType { NONE, SMOKE, FLAME, ENDER, POTBREAK, HEART, POTION, EXPLOSION }

//DataWatcher dw;
//EntityLiving el;
Expand Down Expand Up @@ -87,6 +88,13 @@ public void run() {
counter = 0;
}
break;
case EXPLOSION:
if (counter > wait) {
dB.log("...playing explosion effect");
playExplosionEffect();
counter = 0;
}
break;
}


Expand Down Expand Up @@ -121,14 +129,9 @@ public void playPotionBreakEffect() {
public void playHeartEffect() {
Location location = npc.getBukkitEntity().getLocation();
Wolf tempWolf = (Wolf) world.spawn(location, Wolf.class);
((CraftWolf)tempWolf).getHandle().setInvisible(true);
tempWolf.playEffect(EntityEffect.WOLF_HEARTS);
tempWolf.remove();

//((CraftWorld) world).getHandle().a(
// "heart",
// location.getBlockX(),
// location.getBlockY(),
// location.getBlockZ());
}

public void playSmokeEffect() {
Expand All @@ -144,6 +147,11 @@ public void playSmokeEffect() {
world.playEffect(location, Effect.SMOKE, 8);
}

public void playExplosionEffect() {
Location location = npc.getBukkitEntity().getLocation();
world.createExplosion(location, 0);
}

public void setEffect(String effectType) {
this.effectType = EffectType.valueOf(effectType.toUpperCase());
}
Expand Down

0 comments on commit 650e4fa

Please sign in to comment.