Discussion in 'Archived: Plugin Requests' started by xpopy, Jun 15, 2013.

  1. Offline


    What is ClaimPet for?
    To protect animals, dogs, cats & future horses & donkeys (including their inventory).

    How? (Sorry for the extreme amount of text, check the bottom for simplified commandlist)

    /Claimpet claim - hit pet, required xp levels/item/money will be taken (configurable), and the pet is locked for only that player.

    By locking a pet, only the player who locked the pet can ride it, hurt it or move it with its breeding item. The pet should also be protected from fire, lava and drowning.

    Breeded animals are not automatically locked by a player. Same with animals dispensed from dispensers.

    To see if the animal is locked, anyone can just walk up to it, and the animal will display the owners name above the head.
    Or they can just punch the animal. If it's claimed, it won't take damage and it will display who has claimed it.
    The distance should be configurable, but the default can be around 10 blocks.

    Players can add other players to all of their claims with the command: /claimpet addplayer (player).
    The added players can then move, hurt or ride any of the claimed pets.

    To view a list of players, do the command /claimpet list [player].
    If you run the command without the brackets, it returns every player that you have added.
    But if you replace the brackets with a name, it shows you all players added for the specified player.
    This would require some extra permission nodes, useful for admins.

    To remove a player from your claims: /claimpet removeplayer (player).

    Just to make things clear, list of commands:

    Help, commandlist and flags with explanations.

    /claimpet claim [player]
    Right or Left click an animal, dog, cat or horse to add it to your claim. (A cost can be specified, such as items, experience or money). If a player is specified, that player will become the owner of the pet. (Requires a permission node, and cost will only be taken from the one executing the command)

    /claimpet remove
    Right or Left click an claimed animal to remove the claim. Can also be executed by admins with an extra permission node.

    /claimpet addplayer (player)
    Adds a player to all your claims.

    /claimpet list [player]
    Displays all players and their flags for you, or any other player specified.

    /claimpet removeplayer (player)
    Removes specified player from your claims.

    Aliases: /clp can be used instead of /claimpet for any command.

    Sorry for the long text, I just wanted to explain all I had in mind xD
  2. If no one takes it by Tuesday, I will make it ;)
  3. Offline


    Awesome, good to hear xD I have really longed for a plugin like this :)
  4. Offline



    Calling it "LivestockLock". My main criteria for whether or not to code a plugin is whether or not I can come up with a clever name :)
    Williscool98 likes this.
  5. Offline


    Yeah, I'm not really so good with names.
    Go for any name you would like, only as long as the commands work with it ^^
  6. Offline


    Gotta go to dinner for father's day, but I'll have a development build online at some point tonight. I've got plugins that already do similar things, and I've already started putting this one together, it won't be a problem. expect it soon.
  7. Offline


    Out of curiosity, have you found a good way to disable the tempting item (wheat,seeds,etc)? As far as I know the only way to disable it is to remove the pathfindergoal for the tempt item. meaning the only real way to do this according to the request is to track players next to it and add/remove that pathfindergoal when the "correct" player is near the entity. If you go this route (which may be better not adding the feature at all, after all, most people will have animals in a protected pen), then you should use reflection to remove/add the pathfindergoals, instead of despawing/adding custom entities all the time.

    If you have no idea what I'm talking about, here is the sheep pathfindergoal that does this:
  8. Offline


    Hadn't given it a lot of thought TBH but I've done a lot of work with pathfinders in the past, I would Imagine what i'll do is just replace the Tempt AI with a custom one as soon as the animal is claimed. the custom one will just check for it's owner before it decides to proceed. That feature probably won't make the first couple of builds. Dinner ran a bit late and a tad boozy :) if You're interested in helping at all I'll have it on github soon.

    EDIT: source code here:

    like I said, my evening ran a bit late so the first build may be missing a fair bit of functionality, but it'll come tomorrow :)

    about to dig into the nms part, and I bet will make it into 1.6 and make it all unnecessary. the whole thing will be replaced by cancelling an event :)

    xpopy about this part:

    If an animal is named via anvil + spawn egg or nametag (in 1.6+) the name is displayed over the animals head when a player is near, exactly as you describe here. so this feature would conflict with named animals and give them the name of their owner. I think the only feasible way to implement this is on-click of the animal, display it as a chat message. I'm open to other suggestions but I don't think there are any that will prevent the conflict with named mobs.

    I put a little bit of work into but its not quite there yet. What I did was create a new PathfinderGoalTempt with one small change (the link goes to relevant lines) which just checks to see if the tempter is on the animals 'accesslist' before continuing with the goal.

    My plan was to find the mob, and replace the AI, but because PathfinderGoalSelectorItem hasn't been included in the CB Source, I'm not able to access the individual members of the animals PathfinderGoalSelector, so what I'm left with is completely clearing the GoalSelector and re-adding the appropriate AI, but since i can't inspect those, I need to hard-code the right ones for each entity type. I'm sort of considering leaving out the tempt part now after seeing the pull request that will reduce this to a single line.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Jun 2, 2016
  9. Offline


    Oh right, forgot about that haha. ^^
    The click-to-see-owner way does seem a bit easier to make, but wouldn't it be possible to just temporarily change the name if you are, let's say 3 blocks from it? And then it changes back if you leave.

    Incase you still want to use click-to-see-owner, please use the rightclick too, don't want to accidently hurt any animal :)
  10. Offline


    possible, but it would require tracking all player movements all the time and constantly scanning for nearby animals. its a performance nightmare.

    First actually working development build is here:

    I added group-based limits to how many animals a person can claim.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Jun 2, 2016
  11. Offline


    Oh right, that is true ^^
    Alright, let's just go with hitting them, haha.

    Awesome! Will try when I get time.
  12. Offline


    How about just changing the name above the head for 5 seconds when it is clicked? Instead on in chat, you remove the tracking player movement, and just do your idea b4, just change the name on the entity itself and remove chat messages.
  13. Offline


    That seems like a pretty reasonable compromise actually, I'll do that. Thing is though, right clicking an animal USUALLY already has an effect (feeding, saddling, mouting, opening inventory etc) so if you don't own that animal and you right click it in a way that one of these actions would happen (or left click to damage it in any way) the chat message is still goign to print that says "You can't hurt that animal, it belongs to .... "
  14. Offline


    Shift click?

    if(player.isSneaking && is right click or whatever)
    //do stuff
  15. Offline


    I wasn't so much looking for an alternative, as pointing out that its really just unnecessary. clicking the animal in any way already, by necessity, tells you that it belongs to someone else. I don't see much point in adding another way to get the same information, especially a non-obvious way... everyone will try a normal left/right click first, and get the information they were looking for. I'll still consider adding it but not until everything else is finished.
  16. Offline


    Awesome, I like this idea very much.
  17. Offline


    If you haven't already, add protections from shearing animals, such as sheeps and mooshrooms. :)
  18. Offline


    I haven't tested it yet but its a right click action like any other so it should be fine. by default the config file is only set up for pigs, dogs and cats, but you can add others easily (with customized costs in money, xp and/or items)
  19. Offline


    Alright, that's cool :D

Share This Page