Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ public enum CauseOfTag {
ENDER_PEARL,


/**
* The player's combat tag was kept active because they were below the void combat height.
*/
VOID,

/**
* A custom cause, typically defined by external plugins or systems, applied the combat tag.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,19 @@ public class CombatSettings extends OkaeriConfig {
})
public EventPriority quitPunishmentEventPriority = EventPriority.NORMAL;

@Comment({
"# Keep a player's combat tag continuously active while they are below 'voidCombatHeight'.",
"# This prevents players from evading combat by falling into the void (e.g. in the End).",
"# Set to 'true' to keep resetting the combat timer to its full duration while below that height."
})
public boolean keepCombatActiveInVoid = false;

@Comment({
"# The Y height below which the combat timer is kept active (see 'keepCombatActiveInVoid').",
"# Default: 0, matching the void threshold in worlds such as the End."
})
public double voidCombatHeight = 0;

@Comment({
"# List of kick reasons where players will NOT be punished for combat logging.",
"# If this list is empty, players are ALWAYS punished when kicked during combat.",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.eternalcode.combat.fight;

import com.eternalcode.combat.config.implementation.PluginConfig;
import com.eternalcode.combat.fight.event.CauseOfTag;
import com.eternalcode.combat.fight.event.CauseOfUnTag;
import com.eternalcode.combat.fight.event.FightTagEvent;
import com.eternalcode.combat.notification.NoticeService;
import com.eternalcode.combat.util.DurationUtil;
import java.util.Optional;
Expand Down Expand Up @@ -41,6 +43,16 @@ public void run() {
return;
}

if (this.config.combat.keepCombatActiveInVoid
&& player.getLocation().getY() < this.config.combat.voidCombatHeight
&& !this.config.settings.ignoredWorlds.contains(player.getWorld().getName())) {
FightTagEvent tagEvent = this.fightManager.tag(playerUniqueId, this.config.settings.combatTimerDuration, CauseOfTag.VOID, fightTag.getTagger());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid replaying tag-start side effects on every void refresh

When this option is enabled and a tagged player remains below the configured height, FightTask invokes tag once per second, which synchronously publishes a normal FightTagEvent. Existing listeners do not distinguish CauseOfTag.VOID: for example, KnockbackRegionController.onTag knocks the player again when they are inside a configured region, while BorderTriggerController recomputes the border and external API listeners may treat every refresh as a new tag. Refresh the deadline without replaying tag-start behavior, or make the affected listeners explicitly ignore refresh events.

Useful? React with 👍 / 👎.


if (!tagEvent.isCancelled()) {
fightTag = this.fightManager.getTag(playerUniqueId);
}
}

Duration remaining = fightTag.getRemainingDuration();

String opponent = Optional.ofNullable(fightTag.getTagger())
Expand Down
Loading