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
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ fair, heart-pounding battles that keep players on their toes. Here’s a rundown
in action:
![Combat log anti logout feature](https://github.com/EternalCodeTeam/EternalCombat/blob/master/assets/combatlog.gif?raw=true)

- **Customize combat experience**
Add custom effects to players in combat or death. Everything should be configurable and user-friendly:
![Lightning strikes when players die](https://github.com/EternalCodeTeam/EternalCombat/blob/master/assets/lightning.gif?raw=true)

- **Spawn Protection (Configurable)**
Stop players from fleeing to safety! Block access to spawn or safe zones during combat – tweak it to fit your server’s
rules. See how it works:
Expand Down
Binary file added assets/lightning.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import com.eternalcode.combat.fight.controller.FightBypassCreativeController;
import com.eternalcode.combat.fight.controller.FightBypassPermissionController;
import com.eternalcode.combat.fight.controller.FightInventoryController;
import com.eternalcode.combat.fight.death.DeathEffectController;
import com.eternalcode.combat.fight.drop.DropKeepInventoryService;
import com.eternalcode.combat.fight.FightManager;
import com.eternalcode.combat.fight.drop.DropService;
Expand Down Expand Up @@ -181,6 +182,7 @@ public void onEnable() {
new FightBypassCreativeController(server, pluginConfig),
new FightActionBlockerController(this.fightManager, noticeService, pluginConfig, server),
new FightPearlController(pluginConfig.pearl, noticeService, this.fightManager, this.fightPearlService),
new DeathEffectController(pluginConfig),
new UpdaterNotificationController(updaterService, pluginConfig, this.audienceProvider, miniMessage),
new KnockbackRegionController(noticeService, this.regionProvider, this.fightManager, knockbackService, server),
new FightEffectController(pluginConfig.effect, this.fightEffectService, this.fightManager, server),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.eternalcode.combat.config.implementation;

import com.eternalcode.combat.border.BorderSettings;
import com.eternalcode.combat.fight.death.DeathSettings;
import com.eternalcode.combat.fight.drop.DropSettings;
import com.eternalcode.combat.fight.effect.FightEffectSettings;
import com.eternalcode.combat.fight.knockback.KnockbackSettings;
Expand Down Expand Up @@ -42,6 +43,12 @@ public class PluginConfig extends OkaeriConfig {
})
public FightEffectSettings effect = new FightEffectSettings();

@Comment({
" ",
"# This section contains effects displayed on death of the player"
})
public DeathSettings death = new DeathSettings();

@Comment({
" ",
"# Customize how items are dropped when a player dies during combat.",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.eternalcode.combat.fight.death;

import com.eternalcode.combat.config.implementation.PluginConfig;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.PlayerDeathEvent;

public class DeathEffectController implements Listener {

private final PluginConfig pluginConfig;

public DeathEffectController(PluginConfig pluginConfig) {
this.pluginConfig = pluginConfig;
}

@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPlayerDeathEvent(PlayerDeathEvent event) {
if (!this.pluginConfig.death.lightning) {
return;
}

Player player = event.getEntity();
player.getWorld().strikeLightningEffect(player.getLocation());

}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.eternalcode.combat.fight.death;

import eu.okaeri.configs.OkaeriConfig;
import eu.okaeri.configs.annotation.Comment;

public class DeathSettings extends OkaeriConfig {

@Comment("Should lightning strike when a player dies")
public boolean lightning = true;
}