Fix PvP option not working in claims.

This commit is contained in:
bloodshot 2020-11-13 17:03:31 -05:00
parent 57e8f41eb6
commit ffcc534e35
4 changed files with 14 additions and 6 deletions

View File

@ -782,6 +782,10 @@ public boolean inPvpCombat() {
}
public int getPvpCombatTimeRemaining() {
return this.getPvpCombatTimeRemaining(null);
}
public int getPvpCombatTimeRemaining(GDClaim claim) {
final Player player = this.getSubject().getOnlinePlayer();
if (this.lastPvpTimestamp == null || player == null) {
return 0;
@ -790,7 +794,7 @@ public int getPvpCombatTimeRemaining() {
final Instant now = Instant.now();
int combatTimeout = 0;
if (GDOptions.isOptionEnabled(Options.PVP_COMBAT_TIMEOUT)) {
combatTimeout = GDPermissionManager.getInstance().getInternalOptionValue(TypeToken.of(Integer.class), player, Options.PVP_COMBAT_TIMEOUT);
combatTimeout = GDPermissionManager.getInstance().getInternalOptionValue(TypeToken.of(Integer.class), player, Options.PVP_COMBAT_TIMEOUT, claim);
}
if (combatTimeout <= 0) {
return 0;

View File

@ -177,10 +177,10 @@ public void onPlayerCommand(PlayerCommandPreprocessEvent event) {
return;
}
final int combatTimeRemaining = playerData.getPvpCombatTimeRemaining();
final int combatTimeRemaining = playerData.getPvpCombatTimeRemaining(claim);
final boolean inPvpCombat = combatTimeRemaining > 0;
if (GDOptions.isOptionEnabled(Options.PVP_COMBAT_COMMAND)) {
final boolean pvpCombatCommand = GDPermissionManager.getInstance().getInternalOptionValue(TypeToken.of(Boolean.class), player, Options.PVP_COMBAT_COMMAND);
final boolean pvpCombatCommand = GDPermissionManager.getInstance().getInternalOptionValue(TypeToken.of(Boolean.class), player, Options.PVP_COMBAT_COMMAND, claim);
if (!pvpCombatCommand && inPvpCombat) {
final Component denyMessage = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.PVP_IN_COMBAT_NOT_ALLOWED,
ImmutableMap.of(

View File

@ -787,6 +787,10 @@ public boolean inPvpCombat() {
}
public int getPvpCombatTimeRemaining() {
return this.getPvpCombatTimeRemaining(null);
}
public int getPvpCombatTimeRemaining(GDClaim claim) {
final Player player = this.getSubject().getOnlinePlayer();
if (this.lastPvpTimestamp == null || player == null) {
return 0;
@ -795,7 +799,7 @@ public int getPvpCombatTimeRemaining() {
final Instant now = Instant.now();
int combatTimeout = 0;
if (GDOptions.isOptionEnabled(Options.PVP_COMBAT_TIMEOUT)) {
combatTimeout = GDPermissionManager.getInstance().getInternalOptionValue(TypeToken.of(Integer.class), player, Options.PVP_COMBAT_TIMEOUT);
combatTimeout = GDPermissionManager.getInstance().getInternalOptionValue(TypeToken.of(Integer.class), player, Options.PVP_COMBAT_TIMEOUT, claim);
}
if (combatTimeout <= 0) {
return 0;

View File

@ -346,10 +346,10 @@ public void onPlayerCommand(SendCommandEvent event, @First Player player) {
return;
}
final int combatTimeRemaining = playerData.getPvpCombatTimeRemaining();
final int combatTimeRemaining = playerData.getPvpCombatTimeRemaining(claim);
final boolean inPvpCombat = combatTimeRemaining > 0;
if (GDOptions.isOptionEnabled(Options.PVP_COMBAT_COMMAND)) {
final boolean pvpCombatCommand = GDPermissionManager.getInstance().getInternalOptionValue(TypeToken.of(Boolean.class), player, Options.PVP_COMBAT_COMMAND);
final boolean pvpCombatCommand = GDPermissionManager.getInstance().getInternalOptionValue(TypeToken.of(Boolean.class), player, Options.PVP_COMBAT_COMMAND, claim);
if (!pvpCombatCommand && inPvpCombat) {
final Component denyMessage = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.PVP_IN_COMBAT_NOT_ALLOWED,
ImmutableMap.of(