-
Notifications
You must be signed in to change notification settings - Fork 4
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
Conversation
There was a problem hiding this 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())); |
There was a problem hiding this comment.
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())); |
There was a problem hiding this comment.
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)){ |
There was a problem hiding this comment.
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)){ |
There was a problem hiding this comment.
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)
src/main/resources/config.yml
Outdated
global-announce-death-coordinates: false | ||
|
||
# should the coordinates of the grave be announced to the player who died ? | ||
private-announce-death-coordinates: true |
There was a problem hiding this comment.
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
src/main/resources/config.yml
Outdated
version: 5 |
There was a problem hiding this comment.
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
I added the requested changes |
I updated the config.yml version because release 1.5.0 changed it |
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. |
Thanks for the reply, but I ended up forking the Graves plugin of Ranull here. That had everything (and more) but the gravestone. |
Closing this as this as there is already a similiar feature like this for a while now. |
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.