tppos does not accept decimal values
SlimeDog opened this issue ยท 18 comments
Spigot 1.12.2 latest
EssentialsX 2.0.1-b579
/tppos 50.5 ~ ~
elicits:
Error: For input string "50.5"
This is true for any non-integer value. Clearly, decimal values should be accepted.
#1805 PR proposed; tested and should be merged any time now.
Not sure why this wasn't in the original Essentials source, but I remember this annoying me quite a bit when I wanted to teleport to a middle of the block to set spawnpoints.
Based on testing, it appears that the pre-#1805 code moves the entity/player to X+0.5,Y,Z+0.5, where X,Y,Z are the requested coordinates, so places the entity/player in the middle of a block. I don't see that in the code, but still...
@SlimeDog Solid catch, it's due to the getSafeDestination method from LocationUtil. I had tested teleporting myself to the .5 of the block, so while the input was valid, the config option teleport-to-center
was truncating it all to .5. I'll update the commit in about 10m with a fix.
More info:
teleport-to-center: true
is set by default in config.yml, so unless changed to false, all teleportations are to int(X)+0.5,Y,int(Z)+0.5.
There have been quite a few releases in the last two weeks, without #1805 PR. Any further testing required? Happy to do so.
@SlimeDog So, to clarify, you were saying tppos was still limited by the configuration option?
And yeah, I'll be making a few more updates to the code tomorrow, got a little caught up in things oof haha
@SlimeDog I'm planning to make my implementation teleport them to the middle dependent on the configuration value if they enter a non-double (so, no decimal points). Otherwise, if they want to forcefully teleport to 11.0 1.0 2.0, I don't see any reason why not to allow it, TPPos should be exempt from the rule if the user specifies a decimal point, but the way that the system is set up makes this exemption going up the chain of command a bit more difficult due to safe-teleportation checks and all.
Thanks for info. This ticket concerns the fact that decimal values are illegal at present.
It is also the case that tppos is limited if
# Whether to make all teleportations go to the center of the block; where the x and z coordinates decimal become .5
teleport-to-center: true
There is nothing wrong with that. It's a choice. Although perhaps the default should be false, but I have no strong opinion. It is clearly documented in config.yml. However, the invoked decimal values should be used if
teleport-to-center: false
This cannot be tested at present, of course.
I agree, that sounds like the correct approach. I appreciate the need to support safe-teleportation and all, and that the chain of command is somewhat fraught.
@SlimeDog Not until after 1.13 at the very least.
Minecraft vanilla /tp supports decimal values. While waiting for this issue to be resolved, I have
- configured Essentials
register-back-in-listener: true
teleport-safety: true
- revoked player permissions essentials:teleport and essentials:tp and variants
- granted player permission minecraft.command.tp
Consequently
/tp ...
/back
works correctly.