mirror of
https://github.com/YouHaveTrouble/PreventStabby.git
synced 2026-05-12 05:16:55 +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.
30 lines
943 B
Java
30 lines
943 B
Java
package me.youhavetrouble.preventstabby.api;
|
|
|
|
import me.youhavetrouble.preventstabby.PreventStabby;
|
|
import me.youhavetrouble.preventstabby.data.DamageCheckResult;
|
|
import me.youhavetrouble.preventstabby.util.PvpState;
|
|
import org.bukkit.entity.Entity;
|
|
|
|
public class PreventStabbyAPI {
|
|
|
|
/**
|
|
* @return Current state of forced PvP
|
|
*/
|
|
public static PvpState getForcedPvpState() {
|
|
return PreventStabby.getPlugin().getPlayerManager().getForcedPvpState();
|
|
}
|
|
|
|
/**
|
|
* Sets forced PvP state until server restart or changed with override command or this method.
|
|
*/
|
|
public static void setForcedPvpState(PvpState newForcedPvpState) {
|
|
PreventStabby.getPlugin().getPlayerManager().setForcedPvpState(newForcedPvpState);
|
|
}
|
|
|
|
public static DamageCheckResult canDamage(Entity attacker, Entity victim) {
|
|
return PreventStabby.getPlugin().getPlayerManager().canDamage(attacker, victim);
|
|
}
|
|
|
|
}
|
|
|