mirror of
https://github.com/YouHaveTrouble/PreventStabby.git
synced 2026-05-12 13:26:56 +00:00
1aeb245666
The source of damage detection for PvP interactions has been updated to improve accuracy and flexibility. A 'Target' sub-class has been implemented in the PlayerManager class, removing the need for a separate DamageCheck class. The PlayerManager class was also moved to the 'data' package. Distribution of feedback messages has been simplified using the new DamageCheckResult class.
55 lines
1.3 KiB
Java
55 lines
1.3 KiB
Java
package me.youhavetrouble.preventstabby.api.event;
|
|
|
|
import me.youhavetrouble.preventstabby.PreventStabby;
|
|
import me.youhavetrouble.preventstabby.data.PlayerData;
|
|
import org.bukkit.entity.Player;
|
|
import org.bukkit.event.Cancellable;
|
|
import org.bukkit.event.Event;
|
|
import org.bukkit.event.HandlerList;
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
|
/**
|
|
* Fired when player leaves combat. If cancelled, it will refresh combat timer to the value set in the config.
|
|
*/
|
|
public class PlayerLeaveCombatEvent extends Event implements Cancellable {
|
|
|
|
private static final HandlerList HANDLERS = new HandlerList();
|
|
private final Player player;
|
|
private boolean cancelled;
|
|
|
|
public PlayerLeaveCombatEvent(Player player) {
|
|
this.player = player;
|
|
this.cancelled = false;
|
|
}
|
|
|
|
public Player getPlayer() {
|
|
return player;
|
|
}
|
|
|
|
public PlayerData getPlayerData() {
|
|
return PreventStabby.getPlugin().getPlayerManager().getPlayer(player.getUniqueId());
|
|
}
|
|
|
|
@Override
|
|
public boolean isCancelled() {
|
|
return cancelled;
|
|
}
|
|
|
|
@Override
|
|
public void setCancelled(boolean cancel) {
|
|
cancelled = cancel;
|
|
}
|
|
|
|
@NotNull
|
|
@Override
|
|
public HandlerList getHandlers() {
|
|
return HANDLERS;
|
|
}
|
|
|
|
@NotNull
|
|
public static HandlerList getHandlerList() {
|
|
return HANDLERS;
|
|
}
|
|
|
|
}
|