-
-
Notifications
You must be signed in to change notification settings - Fork 979
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
Implement tpauto command #2310
Implement tpauto command #2310
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.
This PR looks good - I've just made a couple of comments on potential improvements.
private boolean autoTeleportEnabled; | ||
|
||
private boolean _getAutoTeleportEnabled() { | ||
return config.getBoolean("autoteleportenabled", false); |
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.
I'd use a different config key (though I appreciate this is based on teleportenabled
as used above) - perhaps "teleportauto"
?
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.
Sounds good 👍
@@ -35,6 +38,15 @@ public void run(Server server, User user, String commandLabel, String[] args) th | |||
&& player.isTpRequestHere() == false) { // Make sure the last teleport request was actually tpa and not tpahere | |||
throw new Exception(tl("requestSentAlready", player.getDisplayName())); | |||
} | |||
if(player.isAutoTeleportEnabled() && !player.isIgnoredPlayer(user)) { |
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.
Spacing: if (
@@ -19,6 +19,10 @@ antiBuildInteract=\u00a74You are not permitted to interact with\u00a7c {0}\u00a7 | |||
antiBuildPlace=\u00a74You are not permitted to place\u00a7c {0} \u00a74here. | |||
antiBuildUse=\u00a74You are not permitted to use\u00a7c {0}\u00a74. | |||
autoAfkKickReason=You have been kicked for idling more than {0} minutes. | |||
autoTeleportDisabled=\u00a76Automatic teleportation request approval \u00a7cdisabled\u00a76. |
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.
I think "You are now automatically approving teleport requests."
and "You are no longer automatically approving teleport requests."
might be better - opinions?
Also, should we warn users if they enable automatic teleport requests while having teleportation disabled?
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.
Yeah I think that sounds better. I was just trying to force "enabled" and "disabled" in the wording, since that seems to be the norm for toggle commands.
Instead of a warning, perhaps it should automatically enable teleportation and notify you. In most cases the player probably wants to do this anyway. Although, I could see people arguing either way on this.
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.
Although, I could see people arguing either way on this.
I think changing it automatically could annoy players. Server admins can add aliases to turn it on/off if they want, I guess.
Alternatively it could be a config option, but then that itself might confuse players when it doesn't behave consistently across different servers.
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.
Yeah It's pretty harmless but I definitely see how it could be annoying (in cases where the player is just testing the command or for some reason still wants teleportation disabled). I think there's already enough config options as-is and this probably doesn't need to be another one. It's probably just fine to handle the case where teleportation is disabled by printing an additional message like "Note that players will not be able to teleport to you until you have enabled teleportation".
@md678685 Got around to updating the messages, hope you like it! |
Reopening as this was closed by mistake. |
Players already found a way to abuse it, use an alt and enable this for a free public warp! Use them as a trap/shop. |
This pull request closes #2307.
The
/tpauto
command is implemented in a similar manner to tptoggle, in that it is also a toggle command (as suggested by @md678685) that causes side effects on other teleportation commands. However, whereas tptoggle is enabled by default and prevents teleportation requests when disabled, tpauto is disabled by default and automatically accepts teleportation requests when enabled. It also respects tptoggle, and only accepts teleport requests to the user (eg. /tpa, not /tpahere). The locale strings might need some re-wording, but I tried my best to make it sound right.I have tested that this code works, although if something needs to be changed or I missed something please let me know :)