Solved Remove ownership of the wolf

Discussion in 'Plugin Development' started by MDev, Apr 14, 2021.

Thread Status:
Not open for further replies.
  1. Offline

    MDev

    Hello,
    I need help with a plugin that removes the owner of the wolf and the wolf can be tamed again by anyone else.

    Now I have this code but it doesn't work for me:
    upload_2021-4-14_14-5-44.png
     

    Attached Files:

  2. Offline

    Chr0mosom3

    Can you post your entire class formatted with the [ CODE ] [ /CODE ] tags (without the spaces)?

    The problem that I notice, is that you compare the name of the owner, with the owner player variable.

    Change
    Code:
    if (((Tambeable) entity).getOwner().getName().equals(p)
    to
    Code:
    if (((Tambeable) entity).getOwner().getName().equals(p.getName())
    or
    Code:
    if (((Tambeable) entity).getOwner().equals(p)
    (It's a better idea to compare UUIDs instead of names, as names can be changed by plugins and if the server has authentication disabled, and UUIDs never change)
     
  3. Offline

    MDev

    Ah thank you, it works. :)
     
    Chr0mosom3 likes this.
  4. Offline

    MDev

    Ah, SOLVED!
     
    Last edited: Apr 20, 2021
    Chr0mosom3 likes this.
Thread Status:
Not open for further replies.

Share This Page