Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion eternalcombat-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ bukkit {

tasks {
runServer {
minecraftVersion("1.21.10")
minecraftVersion("1.21.11")
downloadPlugins.modrinth("WorldEdit", Versions.WORLDEDIT)
downloadPlugins.modrinth("PacketEvents", "${Versions.PACKETEVENTS}+spigot")
downloadPlugins.modrinth("WorldGuard", Versions.WORLDGUARD)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,24 @@ public class MessagesSettings extends OkaeriConfig {
" ",
"# Configure the combat log notification displayed to players.",
"# You can use the {TIME} variable to display the remaining combat time.",
"# Placeholder {OPPONENT} will be replaced with player name or 'unknownPlayerPlaceholder' variable",
Comment thread
CitralFlo marked this conversation as resolved.
Outdated
" ",
})
public Notice combatNotification = BukkitNotice.builder()
.actionBar("Combat ends in: <red>{TIME}</red>")
.actionBar("Combat ends in: <red>{TIME}</red> | Enemy: <red>{OPPONENT}</red> ⚔")
Comment thread
CitralFlo marked this conversation as resolved.
Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't like that you set this as the default.

The goal is clear: a simple plugin for combat tagging, with advanced options

.build();

@Comment({
"# Would you like to display milliseconds instead of seconds in combat notification "
})
public boolean withoutMillis = true;

@Comment({
" ",
"# When player is not known this text will be used as {OPPONENT} in 'combatNotification'"
Comment thread
CitralFlo marked this conversation as resolved.
})
public String unknownPlayerPlaceholder = "Unknown";

@Comment({
"# Message displayed when a player lacks permission to execute a command.",
"# The {PERMISSION} placeholder is replaced with the required permission."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.eternalcode.combat.fight.event.CauseOfUnTag;
import com.eternalcode.combat.notification.NoticeService;
import com.eternalcode.combat.util.DurationUtil;
import java.util.Optional;
import org.bukkit.Server;
import org.bukkit.entity.Player;

Expand All @@ -17,7 +18,7 @@ public class FightTask implements Runnable {
private final FightManager fightManager;
private final NoticeService noticeService;

public FightTask(Server server, PluginConfig config, FightManager fightManager, NoticeService noticeService) {
public FightTask(Server server, PluginConfig config, FightManager fightManager, NoticeService noticeService) {
this.server = server;
this.config = config;
this.fightManager = fightManager;
Expand All @@ -42,10 +43,17 @@ public void run() {

Duration remaining = fightTag.getRemainingDuration();

String opponent = Optional.ofNullable(fightTag.getTagger())
.filter(uuid -> !uuid.equals(playerUniqueId))
.map(this.server::getPlayer)
.map(Player::getName)
.orElse(this.config.messagesSettings.unknownPlayerPlaceholder);
Comment thread
CitralFlo marked this conversation as resolved.

this.noticeService.create()
.player(player.getUniqueId())
.notice(this.config.messagesSettings.combatNotification)
.placeholder("{TIME}", DurationUtil.format(remaining, this.config.messagesSettings.withoutMillis))
.placeholder("{OPPONENT}", opponent)
Comment thread
CitralFlo marked this conversation as resolved.
.send();

}
Expand Down