Files
PreventStabby/src/main/java/me/youhavetrouble/preventstabby/data/DamageCheckResult.java
T
YouHaveTrouble 096599081b Improve exception handling and PvP process in DatabaseSQLite and PlayerManager
Refactored exception handling in DatabaseSQLite to use logger instead of printStackTrace() for better error tracking. Streamlined player PvP process in PlayerManager with clear conditions and appropriate responses. Enhancements in other classes were also made to ensure smooth execution and maintain code standards.
2024-03-02 16:57:32 +01:00

40 lines
1.0 KiB
Java

package me.youhavetrouble.preventstabby.data;
import javax.annotation.Nullable;
import java.util.UUID;
/**
* @param ableToDamage Result of the damage check
* @param feedbackForAttacker Feedback to send to the attacker
* @param attackerId UUID of attacker player
* @param victimId UUID of victim player
*/
public record DamageCheckResult(
boolean ableToDamage,
@Nullable UUID attackerId,
@Nullable UUID victimId,
@Nullable String feedbackForAttacker,
boolean shouldVictimBePutInCombat
) {
public static DamageCheckResult positive() {
return new DamageCheckResult(
true,
null,
null,
null,
true
);
}
public static DamageCheckResult positive(UUID attackerId, UUID victimId, boolean shouldVictimBePutInCombat) {
return new DamageCheckResult(
true,
attackerId,
victimId,
null,
shouldVictimBePutInCombat
);
}
}