EssentialsX

EssentialsX

2M Downloads

/vanish is unpredictable

Moosfet opened this issue ยท 5 comments

commented

Type of bug

Other unexpected behaviour

/ess dump all output

https://essentialsx.net/dump.html?id=81ef9f64172b47609a492210df45c27e

Error log (if applicable)

No response

Bug description

Sometimes /vanish will cause a player to vanish. Other times, it does not cause the player to vanish.

I realize this is "working as intended" and that "toggle" commands are quite common, but any command that guesses what the user intended to happen is a bad user interface design choice, and I doubt that any user typing "/vanish" is thinking "whether I am visible or not, I just want the opposite to be true." They definitely want one status or the other. It only generally works because, usually, the user knows which state they're in, although I personally have found myself confused about that a few times in just the last hour of testing this, so even that isn't a given.

My problem arises from trying to write a script that can vanish and unvanish people. When I type one command, I want to be vanished and a bunch of other commands like "/dynmap hide" to be executed, and then teleported somewhere. When I type another command, I want to be unvanished and a bunch of other commands like "/dynmap show" to be executed, and then teleported back to my original location. The fact that there isn't a "/unvanish" command is making this difficult.

To cope, I'm keeping track of whether I presently think I'm in the vanished or unvanished state, and issuing the command only when I think I'm in the wrong state. The key word here is "think" because ultimately my script has no idea if the user is presently vanished or not. All that it can do is know whether it has executed "/vanish" an odd or even number of times. So the script can make me vanish, then I disconnect and return to the server, but the script still thinks I'm vanished. So I can make my script reset the state when I join the server, but is that the only time that the vanish state is changed outside of typing "/vanish?" Maybe, but even if it is, will it always be, or will my script be broken when a future update to EssentialsX causes the vanish state to be changed in other situations as well? As a programmer hoping to create a fairly reliable interface, having one command do two different things, and no way to know for sure which thing it will do, is a bit of a nightmare.

Thus, I'm hoping to convince you to do something about it. Even if you don't change what "/vanish" does, at least give me an "/justvanish" and an "/justunvanish" and then users can continue being happy with "/vanish" doing something random but at least my script can actually know what is going to happen when it executes "/justvanish" or "/justunvanish".

Steps to reproduce

  1. Type "/vanish"
  2. Type "/vanish" again

Expected behaviour

On the second use of "/vanish" it should either again say "Vanish for Username: enabled" again, or maybe say "Error: Username is already vanished," but whatever it does should result in the user still being vanished.

Actual behaviour

The command is like: Oh, but you're already vanished. I still want to do something though, so I guess I'll make you visible instead.

commented

Have you ever tried typing /vanish (with the space) into the chat box then pressing Tab? I ask because that reveals the exact behaviour you're asking for.

commented

To add to my above comment, regarding this:

As a programmer hoping to create a fairly reliable interface

EssentialsX already has a 100% reliable interface for programmers to use, called an API. You can call it from Java plugin code, and when used correctly, it removes any and all doubt about whether a player is vanished when you call its methods.

commented

/vanish on and /vanish off is already a thing

commented

Interesting. I swear I tried that and it just wanted to let me specify another player to vanish or unvanish.

Well, anyway, thanks for your help.

commented

To be clear, I tried it again and it's now prompting me to choose "enable" or "disable" so I don't know why I didn't see that before.