Page 1 of 4

[IMPLEMENTED] Extend private plot protection to passive mobs

Posted: Sat Mar 15, 2014 10:19 pm
by jeniansmom
Only players who are members of a private plot would be able to interact with a passive mob on that plot. (Could breed it, feed it, milk it, saddle it, kill it, etc.)
If a passive mob left the plot it would lose the protection.

Re: Idea: Extend private plot protection to passive mobs

Posted: Sun Mar 16, 2014 12:17 am
by Rokkrwolf
I'm rather curious how this could even be possibly implemented as it has never been done before/probably can't be done as far as I am aware.

Re: Idea: Extend private plot protection to passive mobs

Posted: Sun Mar 16, 2014 2:33 am
by Bu1ld0g
I know it's probably completely different coding but a local Aussie server uses essentials and a few others I'm unsure about, MCMMO etc.
But their plugins include mobs being protected by precious stones that cover a set radius rendering any mob within private. So I'm guessing it could be similar in coding theory.

No hiding mobs in nuclear bunkers there ;)

Oh, also named horses are protected anywhere there if it makes a difference.

Re: Idea: Extend private plot protection to passive mobs

Posted: Sun Mar 16, 2014 4:54 am
by jeniansmom
Rokkrwolf312 wrote:I'm rather curious how this could even be possibly implemented as it has never been done before/probably can't be done as far as I am aware.
Not being a programmer, I'm not sure about that either, Rokkr. But Intelli does a lot of things with coding that make me go "whaaat?...how?...that's so cool!" so I have faith that if anyone can do it, he can. Also, it seems like it might be possible due to the fact that coreprotect can log who killed a mob and roll it back.

Re: Idea: Extend private plot protection to passive mobs

Posted: Sun Mar 16, 2014 5:31 am
by monkeychunks
I like killing other peoples animals as well as sneaking into their sheep farms and getting wool.
-1

Re: Idea: Extend private plot protection to passive mobs

Posted: Sun Mar 16, 2014 5:47 am
by cubeguy314
I like it. If a mob is unsecured in a private realm, you can still use a lead to take it out of the realm.

Re: Idea: Extend private plot protection to passive mobs

Posted: Sun Mar 16, 2014 5:50 am
by eah
Firstly, I need to mention that if this goes through, something needs to be done about wolves since they're potential attackers and weapons in pvp. That is, they need to be damageable at least with pvp on.

https://github.com/Bukkit/Bukkit-JavaDo ... Event.java
https://github.com/Bukkit/Bukkit-JavaDo ... Event.java
https://github.com/Bukkit/Bukkit-JavaDo ... lable.java
https://github.com/Bukkit/Bukkit-JavaDo ... ntity.java
https://github.com/Bukkit/Bukkit-JavaDo ... ntity.java
https://github.com/Bukkit/Bukkit-JavaDo ... ation.java
https://github.com/Bukkit/Bukkit-JavaDo ... Event.java
https://github.com/Bukkit/Bukkit-JavaDo ... Event.java
https://github.com/Bukkit/Bukkit-JavaDo ... Event.java

Do some entity handling hoodoo with PlayerInteractEntityEvent. Get the entity the player is interacting with. If it is a passive mob and the passive mob is in a private plot that the player does not have permissions in, cancel the event.

For stuff like snowballs, eggs, fishing hooks, and arrows (all projectiles), I kinda doubt these count as PlayerInteractEntityEvent. So you need to handle DamageByEntityEvent and its parent, EntityDamageEvent. Luckily, these keep track of who launched the projectile. If the damaged entity is a passive mob and this passive mob is in a private plot that the projectile's shooter does not have permissions in, cancel the event.

If you want, you could also try assigning the plot owner to the shooter of a projectile released from a dispenser since projectiles shot from these are born without a shooter. Use ProjectileLaunchEvent. Reason for doing this is to stop people from using dispensers and arrows to circumvent animal protection.

The reason this is not yet implemented is likely not due to the impossibility or difficulty.

Re: Idea: Extend private plot protection to passive mobs

Posted: Sun Mar 16, 2014 5:57 am
by jeniansmom
eah2119 wrote: WONDERFULLY GEEKY STUFF
:D

also:
eah2119 wrote: Firstly, I need to mention that if this goes through, something needs to be done about wolves since they're potential attackers and weapons in pvp. That is, they need to be damageable at least with pvp on.
Yes, should be strictly passive mobs.

Excerpted from: http://minecraft.gamepedia.com/Mobs#Passive_mobs :

Passive mobs
Passive mobs will not attack the player under any circumstances. This category includes most of the "farm animals" present in the game, which can be bred for food and/or other resources. Also included are bats and squid, both of which have special spawning conditions and cannot be bred. Ocelots are technically passive, in that they will not attack the player, but they are actually coded as hostile mobs.

Re: Idea: Extend private plot protection to passive mobs

Posted: Sun Mar 16, 2014 6:11 am
by eah
The reason I mentioned wolves is because they're grouped with the rest of the animals (sheep, horses, ocelots, etc) in the code. Can't simply check whether it's in the animal group. Need to check whether it's a wolf as well. Also, I forgot to mention villagers. They're not in the animals group, but should still be protected.

Re: Idea: Extend private plot protection to passive mobs

Posted: Sun Mar 16, 2014 6:31 am
by AegisMN
Everything from chests to blocks of dirt are protected on claimed land. Every form of theft and destruction on someone else's land is against the rules. Animals/Mobs should be no different.