GetOwner() and SetOwner() on horse

Discussion in 'Plugin Development' started by Ahrigumi, Jun 1, 2019.

  1. Offline


    Hi there!, so.. i was looking the documentation and i dont really understand, how the getOwner and setOwner works. Basically im doing a horse plugin and i want to make a command to set an owner to a tamed horse . I know how to check if a horse is tamed and more stuff.
  2. Offline


    @Ahrigumi I've never tried this before but after reading this:
    I'm thinking the owner is the one who tamed the horse, if it has an owner then it's tamed, if the owner is set to null, it'll be set as a wild horse.
    The 'setOwner' requires an 'AnimalTamer' and 'Player' implements 'AnimalTamer', so you should be able to set a player as the owner.
    The 'getOwner' returns an 'AnimalTamer', you should be able to check if it's instanceof 'Player' and then cast it to 'Player'.
  3. Offline


    Oh, thank you so much. Now i can understand better how works, i will try more later :D

    Edit: Fixed! thanks!
    Last edited: Jun 3, 2019
    KarimAKL likes this.

Share This Page