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

[Feature Request] Region warnings and “I accept the risks” #113

Open
Tsuser1 opened this issue Jul 23, 2023 · 3 comments · May be fixed by #118
Open

[Feature Request] Region warnings and “I accept the risks” #113

Tsuser1 opened this issue Jul 23, 2023 · 3 comments · May be fixed by #118
Labels
enhancement New feature or request

Comments

@Tsuser1
Copy link

Tsuser1 commented Jul 23, 2023

Is your feature request related to a problem? Please describe.
No

Describe the solution you'd like
The ability to define regions in the configuration that show a configurable warning and require a /tpaccept confirm or clicking “I accept these risks” before starting the teleportation warm-up. This is a preferable alternative to outright denying teleportation into dangerous areas which degrades the user experience.

Describe alternatives you've considered
Forking the distribution and adding the functionality myself. This plugin is complex, and would require substantially more effort on my part to add this compared against someone already familiar with the codebase.

@Thatsmusic99
Copy link
Collaborator

I'll be honest, my memory may just be hazy because there's a lot going on in the plugin itself and I've been on holiday, but are there any instances of the plugin outright denying teleportation? Just to confirm there's no issues.

That being said though, that is a neat suggestion, I'll add it to the project board on this repo. I have been spending the last couple of weeks on a break though and don't expect to be out of it too soon, only working on bug fixes mainly.

If you're familiar with Java itself, then you are more than free to contribute to the plugin! The main branch for features is currently v6 but I can only really see this needing a WorldGuard hook, have a flag added and then prior to teleportation (often using the internal teleport method in ATPlayer), check the flag and request confirmation. Can probably use /tpconfirm for the confirm command?

If you're happy with waiting though I'll be able to get it done when possible. :)

@Thatsmusic99 Thatsmusic99 added the enhancement New feature or request label Jul 23, 2023
@Tsuser1
Copy link
Author

Tsuser1 commented Jul 23, 2023

There are no issues with current functionality; it’s just that the only alternative to a warning would be to completely disable access to teleportation commands within ‘dangerous’ areas, which is a hacky solution to the issue.

As for using WorldGuard, I estimate this cubic 'region' will be approximately 4611686018427387903 (I know, what an edge case!) blocks on either side, and I’m not sure it will handle that too well. Haven’t tried, and I’m not sure I should.

If you know what classes I would need to modify to start on this, any pointer would be helpful. I should be able to figure it out from there.

@Thatsmusic99
Copy link
Collaborator

Ahh, that's good to hear, thank you for the confirmation!

I'm not sure how WorldGuard works internally, but considering WorldGuard already has a "global" region that generally doesn't affect performance, would it just be a case of comparing boundaries? That's mainly me asking, don't worry about answering.

I did speak to the original developer (Niestrat) and he did say "sure we can do that" so well we can probably look into it in the next couple of days 😂 but if you do want to give it a shot:

  • CoreClass is the main JavaPlugin class where listeners and hooks are registered, e.g. initial WorldGuard flag creation can be done there.
  • ATPlayer is the API class that handles internal teleportation checks, with the teleport function doing the heavy lifting.
  • CommandManager registers commands, so if you add anything new, it'll be pushed through there.

I believe that covers the main class tweaks but from there it can be new classes. Give me a yell if you have any questions about the general structure of the plugin!

@Thatsmusic99 Thatsmusic99 linked a pull request Aug 2, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: PR Open
Development

Successfully merging a pull request may close this issue.

2 participants