Skip to content

Commit

Permalink
add PlayerKillEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
matsu1213 committed Aug 4, 2024
1 parent b835dbd commit 5a08634
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
35 changes: 35 additions & 0 deletions src/main/java/net/azisaba/lgw/core/events/PlayerKillEvent.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package net.azisaba.lgw.core.events;

import lombok.Getter;
import net.azisaba.lgw.core.LeonGunWar;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;

public class PlayerKillEvent extends Event {

@Getter
private final Player player;
@Getter
private final String weaponTitle;
@Getter
private final int killStreaks;

private static final HandlerList HANDLERS_LIST = new HandlerList();

public PlayerKillEvent(Player player, String weaponTitle){
this.player = player;
this.weaponTitle = weaponTitle;
this.killStreaks = LeonGunWar.getPlugin().getKillStreaks().get(player).get();
}

@Override
public HandlerList getHandlers() {
return HANDLERS_LIST;
}

public static HandlerList getHandlerList() {
return HANDLERS_LIST;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.util.Map;
import java.util.Objects;

import net.azisaba.lgw.core.events.PlayerKillEvent;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.Sound;
Expand Down Expand Up @@ -210,6 +211,8 @@ public void deathMessageChanger(PlayerDeathEvent e) {
if ( itemName == null ) {
itemName = item.getItemMeta().getDisplayName();
}

Bukkit.getPluginManager().callEvent(new PlayerKillEvent(killer, nodes));
} else { // それ以外
itemName = Chat.f("&6{0}", item.getType().name());
}
Expand Down

0 comments on commit 5a08634

Please sign in to comment.