You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
986 B
33 lines
986 B
package net.mcbat.LightningEvent.Listeners;
|
|
|
|
import net.mcbat.LightningEvent.LightningEvent;
|
|
|
|
import org.bukkit.entity.Player;
|
|
import org.bukkit.event.Event;
|
|
import org.bukkit.event.Event.Priority;
|
|
import org.bukkit.event.entity.EntityDeathEvent;
|
|
import org.bukkit.event.entity.EntityListener;
|
|
import org.bukkit.plugin.PluginManager;
|
|
|
|
public class LightningEventEntityListener extends EntityListener {
|
|
private final LightningEvent _plugin;
|
|
|
|
public LightningEventEntityListener(LightningEvent plugin) {
|
|
_plugin = plugin;
|
|
}
|
|
|
|
public void registerEvents() {
|
|
PluginManager pm = _plugin.getServer().getPluginManager();
|
|
|
|
pm.registerEvent(Event.Type.ENTITY_DEATH, this, Priority.Monitor, _plugin);
|
|
}
|
|
|
|
public void onEntityDeath(EntityDeathEvent event) {
|
|
if (event.getEntity() instanceof Player) {
|
|
Player player = (Player)event.getEntity();
|
|
|
|
if (player.hasPermission("lightningevent.events.death"))
|
|
_plugin.castFakeLightningAtLocation(player.getLocation());
|
|
}
|
|
}
|
|
}
|
|
|