TheMrJezza / HorseTpWithMe

A Bukkit Plugin that allows the simple teleportation of Rideable LivingEntities in Minecraft.
MIT License
14 stars 6 forks source link

Feature/permission request - per-world permissions #5

Open mrcoffee1026 opened 3 years ago

mrcoffee1026 commented 3 years ago

The permission you have currently: horsetpwithme.disabled_world.world Prevent vehicle teleportation into the world: world

Is almost what is needed, but since this permission only blocks teleportation INTO and not OUT OF, therein the problem lies. The intention would be to have a player NOT be able to teleport OUT OF a creative world with a horse/boat/etc. that was obtained from a creative inventory and then placed into a non-creative world. My only way to cancel this currently is prevent ALL crossworld teleportation, but I feel crossing between the world, the end, and the nether should be allowed. While there is an empty chest option with the permission, this doesn't stop someone from bringing in an infinite amount of entity containers from a creative world. I feel like it would be enough to simply expand the functionality of this permission to include "out of", but I could see why a person might desire unidirectional travel into a world so possibly splitting the permission into two would be useful on some level to other people. Thanks!

mrcoffee1026 commented 3 years ago

Issue is also evident with attempting to set up contextual permissions for any of these. It is a somewhat simple matter of preventing a user of teleporting OUT OF a given region with boats or animals, but impossible to stop them from teleporting INTO the region with boats and animals... so they can leave these items all over our spawn and there's no way to stop it without disabling the plugin in its entirety.

TheMrJezza commented 3 years ago

If your permissions plugin supports Per World Permissions, you could apply the horsetpwithme.deny_cross_world perm to any problematic worlds, other than that however, I guess I could add more permissions.

Would horsetpwithme.disabled_world_from.<world_name> be appropriate?

mrcoffee1026 commented 3 years ago

It does support per world permission but the problem would still exist as the permission only works unidirectionally. But yeah I think if i just add these crossworld deny permissions to each creative world without you doing anything additional, that may work... although would not prevent a user from taking a boat or horse into creative... and then not being able to retrieve it from there.

However... setting a contextual permission on a region seems absolutely impossible as it only stops you from leaving a region you are already in with a vehicle or animal. If you want to just drop a pile of boats in someone's spawn region... there's no way of preventing it without simply denying ALL transportation of boats. I have tried every variation of contextual permissions available on this: nothing works. If a user should not be able to tp out of a place with animals/vehicles, then they should also not be able to tp into that area with animals/vehicles... I believe the plugin should just just be verifying when they're going OR coming that they have the permission to do so instead of assuming they always have the permission to enter wherever they please.

TheMrJezza commented 3 years ago

I'm sorry, but I don't quite understand your scenario. Could you please be more precise of what you would like changed, and how you would like it to be changed.

I gather that you have one or more creative worlds attached to an otherwise standard Survival Server. Typically other people in this situation block all teleporting into and out of creative worlds because of the issues you've talked about. (Bringing Creative Items/Entities into Survival). The easiest solution is to prevent survival vehicles going to the Creative worlds, and vice versa. Best to keep those two game modes separate. Of course, I don't know your particular requirments, and I am eager to hear them.

Other than tracking each entity from when they spawn, there isn't any real way to know if an entity is a "creative" entity or not, so I can't impose limits along those lines... As much as I would like to.

Furthermore, I believe horsetpwithme.disabled_world_from.<world_name> is a permission node that I should add anyway, regardless of what comes out of this Issue, and as such, I will be adding it in the near future.

Also, when you say region, are you talking about WorldGuard Regions? If so, we definitely can prevent vehicles going there. GriefPrevention claims as well.

mrcoffee1026 commented 3 years ago

Yes more than one creative world, more than one survival world. The permission "horsetpwithme.deny_cross_world" could be contextually applied to all players that are in one of the creative worlds... but this would not prevent them from teleporting INTO a creative world from a survival world with their animal or vehicle... and if they were to do that, that animal/vehicle would be stuck in that world... likely at the spawn point which they also should not have permissions to place items... so they won't even be able to remove their item from the creative mode all they can do is leave their rubbish behind instead. Again, the permission is not checked in BOTH directions... it's only checked for on the way out of the world, not the way INTO that world. Since this is a world, I can remedy this shortcoming by ALSO applying the "horsetpwithme.disabled_world.EVERY_creative_world_name" globally, since that permissions node does not by itself prevent players from leaving with vehicles/animals while inside the "disabled_world", it is necessary to work around both of the limitations of the permissions with each other.

^ sum up of above: currently: world permissions can be set up the way I want - right now - if you do nothing since I do have luckperms which can easily handle contextual permissions.

HOWEVER, I am not so fortunate with region restrictions as there is never a check done on the way INTO a region, only a check done on the teleporting OUT OF a region. I can contextually disallow the use of this plugin entirely inside the "spawn" region... but this does not stop a player from teleporting into the spawn region with their vehicle or animal. I have tried several workarounds for this with the extracontexts added checks like values for "worldguard:in-region", but it only has any effect if the user is already IN the spawn region... so it prevents them from leaving spawn with their boat... but not from crafting one and then leaving boats all over spawn. Without the ability to restrict this behavior I basically can't have the plugin enabled unless I want to police spawn areas all day and I do not.

And YES, worldguard regions. I just assume everyone knows what I mean when I say "region". It would be cool if users could tp in/out of their OWN griefprevention claims but other players could not... not sure if that's possible but that would be super too. As far as regions go... If I must, I can do contextual permissions but the current permission check would need to check an incoming user for permissions which it currently doesn't... or there would need to be a secondary needed permission for entering a region with an animal/vehicle so that I could get that applied/taken away when appropriate.

TheMrJezza commented 3 years ago

There used to be an Extension floating around called HTWMAreaBlock. It was designed to allow you to disable teleporting into and out of specified regions and claims. I discontinued it for various reasons (it wasn't scalable, nor was it flexable) and until now, I didn't see a reason to replace it. If you deem it necessary, I would be happy to create a new solution for handling regions/claims (and any other areas).

Let me know your thoughts.

mrcoffee1026 commented 3 years ago

Yeah I would definitely be interested in that if a modification to this plugin can't accomplish it on it's own, especially since with the set up now I have no way of stopping people from dumping boats/horses into spawn regions... and any restrictions I would be able to add in a contextual way would just prevent them from leaving those areas with those items. There is an "entry" flag for worldguard as well as a "exit-via-teleport" flag that can be set to some level but neither of these would have the desired effect with your plugin or any other really... teleports bypass the entry flag and it would be undesirable to deny all people exiting a region via teleport when I'd only want to target those who are passengers. So yes, would even pay for another premium plugin to handle this: it would necessarily need a way to be triggered only when a person is a passenger of an animal/minecart/boat.

mrcoffee1026 commented 3 years ago

Any progress on this?

TheMrJezza commented 3 years ago

Forgive me, progress is slower than I initially planned. My real life job has been taking up a lot of my time recently. I'm also co-developing BungeeCord Support and some other requests at the same time, hopefully to be released soon.

I'll keep this issue open and let you know of any further progress as it happens.

mrcoffee1026 commented 3 years ago

Alright we'll be looking forward to it.

TheMrJezza commented 3 years ago

Forgive me. I forgot to update this issue as I said I would. I've created a Vault style API for adding support for "Area Providers" such as GriefPrevention and WorldGuard etc. so anyone can create a "BlockedArea" implementation and register it. Both GP and WG have basic default implementations.

As it stands, the plugin is ready to ship, however, there isn't any global way to Block/Unblock Areas. I'm just going to add some commands and the plugin is yours.

mrcoffee1026 commented 3 years ago

yeah i've already got the regions created in worldguard, i just need the horsetp plugin to recognize entering that area as a passenger is not permitted. So whatever I need to do to make that happen, I'm fine with the flag being set manually or whatever, I just need to know what flag to set.

TheMrJezza commented 3 years ago

I have the extension made, however, it requires a few things from the next unreleased version of HorseTpWithMe to function. Once I finalise and release version 8, I will post an update here.

mrcoffee1026 commented 3 years ago

cool, let me know :D