Death Firework
This plugin launches a Red Firework wherever any player dies. (I made this to make it easier to tell when you had killed somebody in the Survival Games.)
**EDIT**
I probably won't bother with changing anything else on this plugin. It as of now fulfills the goal I originally designed it to do. I welcome any Bukkit coders to have at it if they think they can improve this plugin. You are free to use the source code of this plugin in anything you want to without needing to credit me in any way. I hope this can help somebody out!
Plugin Source Code: (This was coded for 1.7.2, so it may need a bit of updating for newer versions of Bukkit.)
_________________________________________________________________________________________________________________________
import org.bukkit.Bukkit;
import org.bukkit.Color;
import org.bukkit.FireworkEffect;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.entity.Firework;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.inventory.meta.FireworkMeta;
import org.bukkit.plugin.java.JavaPlugin;
public class Main extends JavaPlugin implements Listener {
public void onEnable() {
Bukkit.getServer().getPluginManager().registerEvents(this, this);
getConfig().options().copyDefaults(true);
saveConfig();
}
@EventHandler
public void onEntityDeath(final PlayerDeathEvent e) {
if (e.getEntity() instanceof Player)
if(this.getConfig().getBoolean("Firework-air-launch")) {
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
public void run() {
Firework f = (Firework) e.getEntity().getWorld().spawn(e.getEntity().getLocation(), Firework.class);
FireworkMeta fm = f.getFireworkMeta();
fm.addEffect(FireworkEffect.builder()
.flicker(true)
.trail(true)
.with(Type.BALL_LARGE)
.withColor(Color.RED)
.withFade(Color.RED)
.build());
fm.setPower(0);
f.setFireworkMeta(fm);
}
}, 20);}
else
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
public void run() {
Firework f = (Firework) e.getEntity().getWorld().spawn(e.getEntity().getLocation(), Firework.class);
FireworkMeta fm = f.getFireworkMeta();
fm.addEffect(FireworkEffect.builder()
.flicker(true)
.trail(true)
.with(Type.BALL_LARGE)
.withColor(Color.RED)
.withFade(Color.RED)
.build());
fm.setPower(0);
f.setFireworkMeta(fm);
f.detonate();
}
}, 20);
}
}
_____________________
**Config.yml contents**
version: 1.0
Firework-air-launch: true
_____________________
I use it on my Server. It's nice please update it when its outdated!
@SupahPOW31
Is there any Permissions for this plugin or not? :)
hey can u make plugins for me i will pay :)
Can you pleeeaaas make it compitable with java 6 (:
@SupahPOW31 nice plugin! Could you give a link of the source code? I'd like to use this concept in one of my plugins. (Credit is possible if you want that).
@Stereus
Done. The new version will support this feature. All you have to wait for is Bukkit to approve the file!
This plugin would work great on my server. The only thing though like others have said. Make a config with an option like:
firework-air-launch: false
I too would like this if it could explode the player where they are, instead of shooting up fireworks.
You can see a great example of this in action at: play.mcball.net
@rustyshakelford2
I'll see what I can do. (I'm also working on configurable colors and effects xD)
@SupahPOW31
Maybe add it as an option in the config?
@rustyshakelford2
I tried that, but it seemed a little awkward to leave it like that. The firework effects being so close to the ground seemed weird xD
Very cool plugin, it's working great on my server. It would be cool if you could make the firework explode right where the player died instead of launching it in the air.
Thanks! Exactly what I needed! It might be simple by the way, but you're still the first to come up with this. (I think so atleast)
Thank You; This Plugin Is Perfect
Go Go Go