RobertHerhold / BLWarps

Sponge plugin for warping players
MIT License
6 stars 5 forks source link

Replace warp names in chat with clickable links #12

Closed RobertHerhold closed 9 years ago

RobertHerhold commented 9 years ago

onClick: Execute /warp <warp name> onHover: Display "Warp to <warp name>"

Currently in master, but does not do anything

Dependent on SpongePowered/SpongeAPI#639

codeHusky commented 9 years ago

Was planning on making a feature like this in Spongy, but I think it would work better surrounding the warp name in some kind of markup type thing so that you don't have keywords being made warps and people saying stuff and.. you know.

RobertHerhold commented 9 years ago

I get your point, but I would tend to leave it without any special markup. If some new person on a server says "Where can I get food?" and someone replies "At the farm", then I would like farm to be automatically formatted to be a warp.

Maybe I'll make it configurable

codeHusky commented 9 years ago

Yeah. People chatting might not like "adware" seeming links

TomyLobo commented 9 years ago

If I were you, I'd make it only recommend text, not send it.

RobertHerhold commented 9 years ago

How so? Suppose I said "Let's go to the farm", would the plugin say "Did you mean "Let's go to the farm"" (farm is the warp text)? I think that would be a bit cumbersome and annoying to have to address every time you use a warp name in chat.

TomyLobo commented 9 years ago

Oh, you want to do this just for the text emitted by your plugin? That's kind of backwards :) What you really should do is format that stuff in. It's what I did in FoxBukkit for /autoexec command, which, when invoked as without arguments, presents you with a list of commands that are currently in your autoexec, with clickable links to remove them. Here's the helper function I use to generate those clickable links: https://github.com/FoxelBox/FoxBukkit/blob/master/src/main/java/com/foxelbox/foxbukkit/core/util/MessageHelper.java#L90-L93 I'm still manually escaping the arguments here, but there's also this function, which puts escaping, formatting and sending into one neat package: https://github.com/FoxelBox/FoxBukkit/blob/master/src/main/java/com/foxelbox/foxbukkit/core/util/MessageHelper.java#L125-L127 We could have that in Sponge, too

RobertHerhold commented 9 years ago

Sorry if I explained poorly, but this is meant to format player chat messages that contain the names of any warps, not format text sent by the plugin to players (I have a method to generate a clickable warp-text here)

TomyLobo commented 9 years ago

But who is to say they actually meant the warp farm when they said "farm"? This is probably be more annoying and intrusive than anything. Have you thought about adding an invite feature instead? You could add /warp invite farm Robert or even /warp invite farm Robert check out this cool farm. Since you have a warp permission system, you could make it so that gives them a link that allows them to temporarily (a minute? once? until revoked?) bypass permissions and go there anyway, if the inviter has enough rights.

RobertHerhold commented 9 years ago

This is a planned feature, along with private warps EDIT: Not sure how annoying it would actually, but I can also make it configurable