Skip to content
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

Merged
merged 2 commits into from
Mar 8, 2019
Merged

Implement tpauto command #2310

merged 2 commits into from
Mar 8, 2019

Conversation

pop4959
Copy link
Member

@pop4959 pop4959 commented Dec 19, 2018

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 :)

@mdcfe mdcfe added the type: enhancement Features and feature requests. label Dec 19, 2018
@mdcfe mdcfe self-requested a review December 19, 2018 11:35
@mdcfe mdcfe self-assigned this Dec 19, 2018
@mdcfe mdcfe added this to the 2.17.0 (future) milestone Dec 19, 2018
Copy link
Member

@mdcfe mdcfe left a 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);
Copy link
Member

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"?

Copy link
Member Author

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)) {
Copy link
Member

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.
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

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.

Copy link
Member Author

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".

@pop4959
Copy link
Member Author

pop4959 commented Dec 21, 2018

@md678685 Got around to updating the messages, hope you like it!

@mdcfe mdcfe closed this Jan 5, 2019
@mdcfe mdcfe changed the base branch from 1.13 to 2.x January 5, 2019 19:59
@mdcfe
Copy link
Member

mdcfe commented Jan 5, 2019

Reopening as this was closed by mistake.

@mdcfe mdcfe reopened this Jan 5, 2019
@mdcfe mdcfe merged commit 585f2be into EssentialsX:2.x Mar 8, 2019
@TomLewis
Copy link

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.
/sadface

mdcfe added a commit that referenced this pull request Jun 27, 2019
Add messages from #2310 to the `messages.properties` file. Fixes #2634.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement Features and feature requests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Command to automatically accept teleport requests
4 participants