mirror of
https://github.com/bloodmc/GriefDefender.git
synced 2024-11-25 12:45:48 +01:00
Fix PvP option not working in claims.
This commit is contained in:
parent
57e8f41eb6
commit
ffcc534e35
@ -782,6 +782,10 @@ public boolean inPvpCombat() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getPvpCombatTimeRemaining() {
|
public int getPvpCombatTimeRemaining() {
|
||||||
|
return this.getPvpCombatTimeRemaining(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPvpCombatTimeRemaining(GDClaim claim) {
|
||||||
final Player player = this.getSubject().getOnlinePlayer();
|
final Player player = this.getSubject().getOnlinePlayer();
|
||||||
if (this.lastPvpTimestamp == null || player == null) {
|
if (this.lastPvpTimestamp == null || player == null) {
|
||||||
return 0;
|
return 0;
|
||||||
@ -790,7 +794,7 @@ public int getPvpCombatTimeRemaining() {
|
|||||||
final Instant now = Instant.now();
|
final Instant now = Instant.now();
|
||||||
int combatTimeout = 0;
|
int combatTimeout = 0;
|
||||||
if (GDOptions.isOptionEnabled(Options.PVP_COMBAT_TIMEOUT)) {
|
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) {
|
if (combatTimeout <= 0) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -177,10 +177,10 @@ public void onPlayerCommand(PlayerCommandPreprocessEvent event) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final int combatTimeRemaining = playerData.getPvpCombatTimeRemaining();
|
final int combatTimeRemaining = playerData.getPvpCombatTimeRemaining(claim);
|
||||||
final boolean inPvpCombat = combatTimeRemaining > 0;
|
final boolean inPvpCombat = combatTimeRemaining > 0;
|
||||||
if (GDOptions.isOptionEnabled(Options.PVP_COMBAT_COMMAND)) {
|
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) {
|
if (!pvpCombatCommand && inPvpCombat) {
|
||||||
final Component denyMessage = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.PVP_IN_COMBAT_NOT_ALLOWED,
|
final Component denyMessage = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.PVP_IN_COMBAT_NOT_ALLOWED,
|
||||||
ImmutableMap.of(
|
ImmutableMap.of(
|
||||||
|
@ -787,6 +787,10 @@ public boolean inPvpCombat() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getPvpCombatTimeRemaining() {
|
public int getPvpCombatTimeRemaining() {
|
||||||
|
return this.getPvpCombatTimeRemaining(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPvpCombatTimeRemaining(GDClaim claim) {
|
||||||
final Player player = this.getSubject().getOnlinePlayer();
|
final Player player = this.getSubject().getOnlinePlayer();
|
||||||
if (this.lastPvpTimestamp == null || player == null) {
|
if (this.lastPvpTimestamp == null || player == null) {
|
||||||
return 0;
|
return 0;
|
||||||
@ -795,7 +799,7 @@ public int getPvpCombatTimeRemaining() {
|
|||||||
final Instant now = Instant.now();
|
final Instant now = Instant.now();
|
||||||
int combatTimeout = 0;
|
int combatTimeout = 0;
|
||||||
if (GDOptions.isOptionEnabled(Options.PVP_COMBAT_TIMEOUT)) {
|
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) {
|
if (combatTimeout <= 0) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -346,10 +346,10 @@ public void onPlayerCommand(SendCommandEvent event, @First Player player) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final int combatTimeRemaining = playerData.getPvpCombatTimeRemaining();
|
final int combatTimeRemaining = playerData.getPvpCombatTimeRemaining(claim);
|
||||||
final boolean inPvpCombat = combatTimeRemaining > 0;
|
final boolean inPvpCombat = combatTimeRemaining > 0;
|
||||||
if (GDOptions.isOptionEnabled(Options.PVP_COMBAT_COMMAND)) {
|
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) {
|
if (!pvpCombatCommand && inPvpCombat) {
|
||||||
final Component denyMessage = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.PVP_IN_COMBAT_NOT_ALLOWED,
|
final Component denyMessage = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.PVP_IN_COMBAT_NOT_ALLOWED,
|
||||||
ImmutableMap.of(
|
ImmutableMap.of(
|
||||||
|
Loading…
Reference in New Issue
Block a user