mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 08:27:43 +01:00
Add option for always showing item in player death messages
This commit is contained in:
@@ -1,5 +1,14 @@
|
||||
--- a/net/minecraft/world/damagesource/CombatTracker.java
|
||||
+++ b/net/minecraft/world/damagesource/CombatTracker.java
|
||||
@@ -54,7 +_,7 @@
|
||||
|
||||
private Component getMessageForAssistedFall(Entity entity, Component entityDisplayName, String hasWeaponTranslationKey, String noWeaponTranslationKey) {
|
||||
ItemStack itemStack = entity instanceof LivingEntity livingEntity ? livingEntity.getMainHandItem() : ItemStack.EMPTY;
|
||||
- return !itemStack.isEmpty() && itemStack.has(DataComponents.CUSTOM_NAME)
|
||||
+ return !itemStack.isEmpty() && (org.purpurmc.purpur.PurpurConfig.playerDeathsAlwaysShowItem || itemStack.has(DataComponents.CUSTOM_NAME)) // Purpur - always show item in player death messages
|
||||
? Component.translatable(hasWeaponTranslationKey, this.mob.getDisplayName(), entityDisplayName, itemStack.getDisplayName())
|
||||
: Component.translatable(noWeaponTranslationKey, this.mob.getDisplayName(), entityDisplayName);
|
||||
}
|
||||
@@ -98,6 +_,15 @@
|
||||
Component component = ComponentUtils.wrapInSquareBrackets(Component.translatable(string + ".link")).withStyle(INTENTIONAL_GAME_DESIGN_STYLE);
|
||||
return Component.translatable(string + ".message", this.mob.getDisplayName(), component);
|
||||
|
||||
@@ -46,7 +46,13 @@
|
||||
return damageSource;
|
||||
}
|
||||
// CraftBukkit end
|
||||
@@ -187,6 +_,15 @@
|
||||
@@ -182,11 +_,20 @@
|
||||
} else {
|
||||
Component component = this.causingEntity == null ? this.directEntity.getDisplayName() : this.causingEntity.getDisplayName();
|
||||
ItemStack itemStack = this.causingEntity instanceof LivingEntity livingEntity1 ? livingEntity1.getMainHandItem() : ItemStack.EMPTY;
|
||||
- return !itemStack.isEmpty() && itemStack.has(DataComponents.CUSTOM_NAME)
|
||||
+ return !itemStack.isEmpty() && (org.purpurmc.purpur.PurpurConfig.playerDeathsAlwaysShowItem || itemStack.has(DataComponents.CUSTOM_NAME)) // Purpur - always show item in player death messages
|
||||
? Component.translatable(string + ".item", livingEntity.getDisplayName(), component, itemStack.getDisplayName())
|
||||
: Component.translatable(string, livingEntity.getDisplayName(), component);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -573,4 +573,9 @@ public class PurpurConfig {
|
||||
block.fallDistanceMultiplier = fallDistanceMultiplier.floatValue();
|
||||
});
|
||||
}
|
||||
|
||||
public static boolean playerDeathsAlwaysShowItem = false;
|
||||
private static void playerDeathsAlwaysShowItem() {
|
||||
playerDeathsAlwaysShowItem = getBoolean("settings.player-deaths-always-show-item", playerDeathsAlwaysShowItem);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user