Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added player death coordinates message upon death #7

Closed
wants to merge 6 commits into from

Conversation

LhAlant
Copy link

@LhAlant LhAlant commented Jan 11, 2024

Added a message in chat when a player dies.
Fixes #2
It can be configured to be a message to every player, only the player who died or to not message anyone.

Copy link
Member

@AverageGithub AverageGithub left a comment

Choose a reason for hiding this comment

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

We really appreciate your contribution! I've requested some changes, if that's not a problem for you 😄


if (CONFIG.getBoolean("global-announce-death-coordinates", true)){
for (Player p : Bukkit.getOnlinePlayers()){
p.sendMessage(String.format("%s died at X:%.2f Y:%.2f Z:%.2f", player.getName(), location.getX(), location.getY(), location.getZ()));
Copy link
Member

Choose a reason for hiding this comment

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

Could you make the message configurable in the messages.yml? (And use the prefix) Also, we would probably want the name of the world in which this happened. Also, we'd want a list of worlds in which if the player dies the messages aren't sent.

Possibly, we'd even want a range for this message, for example:
-1: all worlds
0: only the player's world
other: the range in which we gather the players to send the message to

p.sendMessage(String.format("%s died at X:%.2f Y:%.2f Z:%.2f", player.getName(), location.getX(), location.getY(), location.getZ()));
}
} else if (CONFIG.getBoolean("private-announce-death-coordinates", true)){
player.sendMessage(String.format("You died at X:%.2f Y:%.2f Z:%.2f", location.getX(), location.getY(), location.getZ()));
Copy link
Member

Choose a reason for hiding this comment

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

Please add this into messages.yml aswell (and use the prefix)

@@ -93,6 +93,15 @@ public Grave(Location loc, @NotNull Player player, @NotNull ItemStack[] itemsAr,
msg = msg.replace("%despawn-time%", StringUtils.formatTime(CONFIG.getInt("despawn-time-seconds", 180) * 1_000L - (System.currentTimeMillis() - spawned)));
hologram.addLine(StringUtils.format(msg));
}

if (CONFIG.getBoolean("global-announce-death-coordinates", true)){
Copy link
Member

Choose a reason for hiding this comment

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

This should default to false

for (Player p : Bukkit.getOnlinePlayers()){
p.sendMessage(String.format("%s died at X:%.2f Y:%.2f Z:%.2f", player.getName(), location.getX(), location.getY(), location.getZ()));
}
} else if (CONFIG.getBoolean("private-announce-death-coordinates", true)){
Copy link
Member

Choose a reason for hiding this comment

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

Default to false aswell(, and this would change to a regular if statement if you were to add the configurable range)

global-announce-death-coordinates: false

# should the coordinates of the grave be announced to the player who died ?
private-announce-death-coordinates: true
Copy link
Member

Choose a reason for hiding this comment

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

Should probably default to true, to keep things consistent between versions, and prevent unexpected messages being sent after the plugin updates

version: 5
Copy link
Member

Choose a reason for hiding this comment

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

We'd want to bump the config version, so the new things get added to the already existing configs

@LhAlant
Copy link
Author

LhAlant commented Jan 11, 2024

I added the requested changes

@LhAlant
Copy link
Author

LhAlant commented Jan 20, 2024

I updated the config.yml version because release 1.5.0 changed it

@svaningelgem
Copy link

Is this branch still active? Because I'm looking for a similar feature as well.

@LhAlant
Copy link
Author

LhAlant commented Apr 19, 2024

Is this branch still active? Because I'm looking for a similar feature as well.

No, I just added this feature because I wanted it in a server I made. I'm just waiting for them to deny/merge this branch.

@svaningelgem
Copy link

Thanks for the reply, but I ended up forking the Graves plugin of Ranull here. That had everything (and more) but the gravestone.

@BenceX100
Copy link
Contributor

Closing this as this as there is already a similiar feature like this for a while now.

@BenceX100 BenceX100 closed this Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Could you add a new feature to make it easier for players to find the death chests.
4 participants