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.
36 lines
1.1 KiB
36 lines
1.1 KiB
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 (_plugin.Permissions != null && _plugin.Permissions.has(player, "LightningEvent.onDeath"))
|
|
_plugin.castLightningAtLocation(player.getLocation());
|
|
|
|
_plugin.getMinecraftLogger().info("OnDeath: "+player.getLocation().toString());
|
|
|
|
}
|
|
}
|
|
}
|
|
|