Coded Death Listener
This commit is contained in:
parent
f60952ee3f
commit
d18533f0f6
4 changed files with 21 additions and 20 deletions
|
@ -3,8 +3,8 @@ package alisolarflare.magic;
|
|||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import alisolarflare.Module;
|
||||
import alisolarflare.magic.tricks.AliArrowDeathListener;
|
||||
import alisolarflare.magic.tricks.AliArrowListener;
|
||||
import alisolarflare.magic.tricks.BoomBowDeathListener;
|
||||
import alisolarflare.magic.tricks.BoomBowListener;
|
||||
|
||||
public class MagicModule extends Module{
|
||||
|
@ -12,7 +12,7 @@ public class MagicModule extends Module{
|
|||
@Override
|
||||
public void register(JavaPlugin plugin) {
|
||||
registerListener(plugin, new AliArrowListener(plugin));
|
||||
registerListener(plugin, new AliArrowDeathListener());
|
||||
registerListener(plugin, new BoomBowDeathListener());
|
||||
registerListener(plugin, new BoomBowListener());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
package alisolarflare.magic.tricks;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
|
||||
public class AliArrowDeathListener implements Listener{
|
||||
@EventHandler
|
||||
public void onBoomBowDeath(PlayerDeathEvent event){
|
||||
Player player = event.getEntity();
|
||||
if (player.getKiller() != player)
|
||||
return;
|
||||
player.sendMessage(player.getLastDamageCause().toString());
|
||||
player.sendMessage(event.getEventName());
|
||||
}
|
||||
}
|
18
src/alisolarflare/magic/tricks/BoomBowDeathListener.java
Normal file
18
src/alisolarflare/magic/tricks/BoomBowDeathListener.java
Normal file
|
@ -0,0 +1,18 @@
|
|||
package alisolarflare.magic.tricks;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
|
||||
public class BoomBowDeathListener implements Listener{
|
||||
@EventHandler
|
||||
public void onBoomBowDeath(PlayerDeathEvent event){
|
||||
Player player = event.getEntity();
|
||||
if (player.getLastDamage() == 7.000042)
|
||||
event.setDeathMessage(player.getCustomName() + player.getDisplayName() + player.getPlayerListName() + player.getName() + "got trigger happy with the Boom Bow");
|
||||
if (player.getLastDamage() < 7.000041 || player.getLastDamage() > 7.000043)
|
||||
player.sendMessage("meaning of lyyyyyyfffe");
|
||||
|
||||
}
|
||||
}
|
|
@ -89,7 +89,7 @@ public class BoomBowListener implements Listener {
|
|||
//CREATE - Explosion + damage
|
||||
player.getWorld().playSound(playerLocation, Sound.ENTITY_GENERIC_EXPLODE, 10, -20);
|
||||
player.getWorld().spawnParticle(Particle.EXPLOSION_HUGE, playerLocation, 2);
|
||||
player.damage(7.0, player);
|
||||
player.damage(7.000042, player);
|
||||
boomBow.setDurability((short) (boomBow.getDurability() + 3));
|
||||
if(boomBow.getDurability() < 0){
|
||||
player.getInventory().setItemInMainHand(null);
|
||||
|
|
Loading…
Reference in a new issue