Hidendra / LWC

Lightweight Protection for Chests, Furnaces, Dispensers, and more for the Minecraft server mod Bukkit
Other
167 stars 123 forks source link

[Suggestion] Entity protection (e.g. Item Frames and Paintings) #392

Open WolfieMario opened 11 years ago

WolfieMario commented 11 years ago

Reposting this after the bulk closing; sorry if this one falls under the "will never see the light of day" category, but I'm still hopeful.

Basically, if LWC can let players protect entities, then paintings and the upcoming Item Frame (and perhaps other interesting things, such as storage minecarts, or even general minecarts) could be protected. As players tend to think of paintings as blocks, and will invariably do the same for Item Frames, they'd be disappointed to learn there are no protection options out there.

Obviously, adding entity protection is a big thing, and likely rather complicated (especially once you start considering special cases such as checking if a player shot an arrow at their own item frame), but I still feel it would be better within LWC (instead of a separate plugin with its own database and commands).

Also, is anybody allowed to contribute? I.e. if nobody else tries to work on this, and I decide to take it up, would my pull request be considered? (assuming of course it isn't buggy and does the job right)

Hidendra commented 11 years ago

Also, is anybody allowed to contribute? I.e. if nobody else tries to work on this, and I decide to take it up, would my pull request be considered? (assuming of course it isn't buggy and does the job right)

Of course, if it works and is secure, then there's no reason for me not to.

When I last looked at protecting paintings it wasn't feasible (something to do with either the event wasn't that good or there wasn't a persisted unique ID however the latter definitely isn't an issue now). Mind you when I last looked at something like this it was probably at least a year ago so it's probably safe to say it's possible now :)

... (especially once you start considering special cases such as checking if a player shot an arrow at their own item frame)

It could be like redstone: either always allow it or always deny it. Trying to figure that out would probably have false positives at times which isn't always the best when trying to decide if they can destroy it or not :(

If you do manage to look at it before I do (given you were quick to resubmit this I imagine you realise how long I can take for things at times) and you have questions about anything feel free to hop in IRC I can answer anything there ;)

WolfieMario commented 11 years ago

Ah sweet, good to know this may someday be a reality. I'm a bit swamped in schoolwork, so I wouldn't actually be able to start working on it anytime soon (last time I did any work on plugins was during summer break). But I'll likely try come winter break, if it isn't already being done by then.

Also, yeah, I was thinking redstone-like protection would be afforded to protectable entities. There is another matter - for paintings and item frames, sign-like protection would also be necessary (so the entity imparts its protection onto the blocks it is attached to, as signs do). That detail may be tricky for variable-sized paintings, of course.

I wonder, should all protected entities be immune to all forms of damage? Perhaps aside from void damage, that is. Default protectable entities could be simply paintings, item frames, boats, and all forms of minecarts - damage immunity may be overpowered for mobs. Also, right and left-click interactions can be fully analogous to how they apply to blocks (so, for example, a cpublic minecart could be ridden by anybody but only destroyed by the owner, and a cpublic sheep could be sheared by anybody, but only attacked by the owner). It seems most things would translate well in terms of gameplay, though I'd imagine some bits will be hairier in the code.

Anyways, thanks for the response, and thanks for keeping up the good work!

ghost commented 11 years ago

You can make the "Pig wih saddle" protection with /cprivate, /cpassword, /cpublic. I think that will allow RolePlay servers to make something like a cars.

[Sorry for my english; I came from Poland]

Travja commented 11 years ago

Couldn't you get the UUID for the Item Frame/Entity and then when another player interacts with it ie: hitting or just plain interacting in the case of a villager then it checks perms for that specific UUID? This would make my server shop better as they wouldn't be able to break the itemframes.

mikeloeven commented 11 years ago

the introduction of item frames is defiantly something of a security risk and if lwc doesn't start expanding beyond chests and start allowing the protection of valuable blocks than it is going to start lagging behind in player controlled protection to be honest i will never use item frames until they are safe because frankly their current implementation is just asking for someone to steal your set of enchanted dia armor or whatever you want to show off. this needs ti be added to make frames viable because unless your on a server with region wide protections for your property lwc doesn't cut it anymore

Hidendra commented 11 years ago

It is more of a technical problem. I'm also looking into allowing Storage Minecarts to be protected and have working test versions of that (although need to be heavily improved to be release/dev build ready). Item frames are something I want to look into soon. LWC was designed for blocks so getting it to work with entities requires a bit of fancy footwork ;) The rewrite should support it a lot more easily but obviously I want to have it in the current version as the rewrite is still a few months away

With exams starting very soon it will be difficult to get much work in so I can't make any guarantees for dates.

Travja commented 11 years ago

What you need to do is get the UUID and use that to lock the entity right?

:D

On Nov 29, 2012, at 4:28 PM, Tyler Blair notifications@github.com wrote:

It is more of a technical problem. I'm also looking into allowing Storage Minecarts to be protected and have working test versions of that (although need to be heavily improved to be release/dev build ready). Item frames are something I want to look into soon. LWC was designed for blocks so getting it to work with entities requires a bit of fancy footwork ;) The rewrite should support it a lot more easily but obviously I want to have it in the current version as the rewrite is still a few months away

With exams starting very soon it will be difficult to get much work in so I can't make any guarantees for dates.

— Reply to this email directly or view it on GitHub.

Hidendra commented 11 years ago

Correct however you would need to understand that LWC depends on protections being a "Block" in many places so it of course can be done using a hack (which I've already done for storage minecarts which can be extended to item frames) or a semi-hack (by making it work properly for just actions you'd want to use on them anyway -- likely what I'd be okay) and the proper solution which just wouldn't be possible on the current version.

Travja commented 11 years ago

I understand...

:D

On Nov 29, 2012, at 4:57 PM, Tyler Blair notifications@github.com wrote:

Correct however you would need to understand that LWC depends on protections being a "Block" in many places so it of course can be done using a hack (which I've already done for storage minecarts which can be extended to item frames) or a semi-hack (by making it work properly for just actions you'd want to use on them anyway -- likely what I'd be okay) and the proper solution just wouldn't be possible on the current version.

— Reply to this email directly or view it on GitHub.

ghost commented 11 years ago

Looking forward to this, actually it is one of the reasons my server is still on 1.3.2-R3.0 :-)

Hidendra commented 11 years ago

Is not having item frames not protectable really that bad? Can't players simply just not use them if they don't want to be stolen? (not saying that to justify not doing it BTW just curious)

Hidendra commented 11 years ago

Patched up my test stuff a bit more. I will look into this more later on.

http://puu.sh/1w2RO

WolfieMario commented 11 years ago

Wow, excellent progress! :D @xcanner: Since item frames are entirely optional, that is a rather strange decision. If you wanted to use them yourself, as an admin, you actually could: it's now possible to set an entity to "invulnerable" (this works even in vanilla maps), and it applies to item frames as well. However, if the block the frame is attached to is destroyed, the frame will drop as normal (just protect that block and it's safe). Obviously, your players don't have those options, but thankfully Hidendra is working on that ;)

Travja commented 11 years ago

@Tyler the same could be said about doors and other blocks, don't use them if you don't want them stolen

:D

On Nov 30, 2012, at 11:52 AM, Tyler Blair notifications@github.com wrote:

Is not having item frames not protectable really that bad? Can't players simply just not use them if they don't want to be stolen? (not saying that to justify not doing it BTW just curious)

— Reply to this email directly or view it on GitHub.

ghost commented 11 years ago

Well I did say, one of the reasons :-) We are always "slow" to update, to make sure everything is working as we expect. Besides, this is a "free server" no donating or such, so we dont need to update on first CB dev build as many others...

Hidendra commented 11 years ago

Wow, excellent progress!

Indeed - although it doesn't support preventing the block behind it from being destroyed. If a frame (or any protected entity, really) is destroyed by the world (e.g removing a block from behind it) should the frame just stay there? Or should LWC try and prevent the block from being broken in the first place? admittedly the former seems safer because it prevents stuff such as water from sending it into oblivion.

WolfieMario commented 11 years ago

Yeah, it would probably be a lot safer and easier to implement "ignore the destruction of this entity", even if it does lead to floating item frames. As a bonus, paintings would be able to ride on the exact same implementation. Otherwise, you'd have to worry about the different blocks a large painting is attached to.

And honestly, now that you mention it, it would be neat to see an underwater room with paintings/frames that don't pop off :p

Hidendra commented 11 years ago

Otherwise, you'd have to worry about the different blocks a large painting is attached to.

oh man the horror

Hidendra commented 11 years ago

This is now a part of #783+. Please read the commit above carefully because I simply cannot guarantee what happens if you use this build. I can however provide a relatively good chance that you'll be able to protect entities ;)

strontkever commented 11 years ago

adding

'389': enabled: true

to the list of protectable blocks doesnt allow me to add a protecting, instead the item frame pops off and nothing happens

using the latest dev build #836

AaronMcHale commented 9 years ago

Any update on this, maybe Armour Stands as well, as we have been having issues with people stealing form those.