Unify head display strings

This commit is contained in:
NotAlexNoyle committed 2026-04-22 06:49:54 -04:00
1 parent e687076830
commit 67d9de29fb
3 files changed
+10 -34

No files matched your search

@@ -122,7 +122,7 @@ public final class BountyHeadLabelListener implements Listener {
final ArmorStand existing = activeLabels.get(target.key());
if (existing != null && existing.isValid()) {
existing.customName(plugin.getBountyHeadFormatter().buildHoverLabel(target.data()));
existing.customName(plugin.getBountyHeadFormatter().buildCanonicalLine(target.data()));
return;
}
@@ -139,7 +139,7 @@ public final class BountyHeadLabelListener implements Listener {
stand.setPersistent(false);
stand.setBasePlate(false);
stand.setArms(false);
stand.customName(plugin.getBountyHeadFormatter().buildHoverLabel(target.data()));
stand.customName(plugin.getBountyHeadFormatter().buildCanonicalLine(target.data()));
stand.setCustomNameVisible(true);
});
@@ -11,10 +11,10 @@ import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.persistence.PersistentDataContainer;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.SkullMeta;
import org.bukkit.persistence.PersistentDataContainer;
import com.tcoded.playerbountiesplus.PlayerBountiesOG;
import com.tcoded.playerbountiesplus.hook.logging.CoreProtectHook;
@@ -169,7 +169,7 @@ public class BountyHeadListener implements Listener {
}
player.sendActionBar(plugin.getBountyHeadFormatter().buildClaimedByActionBar(headData));
player.sendActionBar(plugin.getBountyHeadFormatter().buildCanonicalLine(headData));
}
@@ -179,4 +179,4 @@ public class BountyHeadListener implements Listener {
}
}
}
@@ -1,6 +1,5 @@
package com.tcoded.playerbountiesplus.util;
import java.util.List;
import java.util.Locale;
import java.util.UUID;
@@ -9,7 +8,6 @@ import org.bukkit.inventory.meta.SkullMeta;
import com.destroystokyo.paper.profile.PlayerProfile;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.TextComponent;
import net.luckperms.api.LuckPerms;
import net.luckperms.api.cacheddata.CachedMetaData;
@@ -37,37 +35,15 @@ public final class BountyHeadFormatter {
}
meta.displayName(buildHeadDisplayName(data));
meta.lore(buildHeadLore(data));
meta.displayName(buildCanonicalLine(data));
metadata.write(meta.getPersistentDataContainer(), data);
}
public TextComponent buildHeadDisplayName(BountyHeadData data) {
public TextComponent buildCanonicalLine(BountyHeadData data) {
return UtilitiesOG.trueogColorize(resolvePlayerDisplay(data.targetUuid(), data.targetName()) + " &7(&b"
+ formatDiamonds(data.bountyAmount()) + " &bDiamonds&7)");
}
public List<TextComponent> buildHeadLore(BountyHeadData data) {
final String bounty = formatDiamonds(data.bountyAmount());
return List.of(UtilitiesOG.trueogColorize("&7Slain for &b" + bounty + " &bDiamonds"));
}
public TextComponent buildClaimedByActionBar(BountyHeadData data) {
return UtilitiesOG.trueogColorize("&7Claimed by " + resolveClaimantDisplay(data));
}
public Component buildHoverLabel(BountyHeadData data) {
return UtilitiesOG.trueogColorize(resolvePlayerDisplay(data.targetUuid(), data.targetName())
+ "\n&7Slain for &b" + formatDiamonds(data.bountyAmount()) + " &bDiamonds");
return UtilitiesOG.trueogColorize(resolvePlayerDisplay(data.targetUuid(), data.targetName()) + " &cslain by "
+ resolveClaimantDisplay(data) + " &cfor &b" + formatDiamonds(data.bountyAmount()) + " &bDiamonds");
}
@@ -172,4 +148,4 @@ public final class BountyHeadFormatter {
}
}
}