Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't set name of entity. Intended? #2139

Closed
HAHAYOUDEAD opened this issue Jun 4, 2019 · 5 comments
Closed

Can't set name of entity. Intended? #2139

HAHAYOUDEAD opened this issue Jun 4, 2019 · 5 comments
Labels
bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. completed The issue has been fully resolved and the change will be in the next Skript update. priority: low Issues that are not harmful to the experience but are related to useful changes or additions.

Comments

@HAHAYOUDEAD
Copy link

If type of object (mob) is entity, not living entity, you can't change it's name via Skript effects. Is this intended?

import:
    org.bukkit.Bukkit
    java.util.UUID

function efromUUID(uuid: text) :: entity:
    set {_uuid} to UUID.fromString({_uuid})
    return Bukkit.getEntity({_uuid})

on rightclick with stick:
    set {_c} to clicked entity
    {_c}.setCustomName("shmek") #works
    set name of efromUUID(uuid of clicked entity) to "kek" #error #1
    set name of {_c} to "pek" #no errors, does not work


    apply swiftness 1 to {_c} #works
    apply swiftness 1 to efromUUID(uuid of clicked entity) #error #2

изображение

If it is intended, why can I apply potion effects to this entity (while it's in a variable) but cannot change it's name?

I expected Skript to take in any entity and then decide whether effect can be applied to it, it seemed logical to me.

@TheLimeGlass
Copy link
Collaborator

TheLimeGlass commented Jun 6, 2019

Because Entities aren't allowed to be stored in variables, entities will not be of the same object on a server restart, and yes that includes local variables as it goes through the same system as global variables, and I understand that it could work for local variables. Sometimes it works, it's been a known issue for a long time.

on rightclick with stick:
    set name of clicked entity to "Works"

Use it's reference of clicked entity directly, also next time only use Skript syntaxes when reporting a bug, and only have Skript installed with no addons as intended in the readme.

@HAHAYOUDEAD
Copy link
Author

I was creating a question, not a bug report, but I guess there is no difference when it's posted.

Thank you for response, but my issue is not with the variables, but with that you can't change name of entity, but can of living entity. I understand, that you can't actually change name of any but living entity, but what if I have a function that returns entity which is not always living, but sometimes is, and I need to change it's name? (I hope it makes sense) Here is another example without using skript-mirror or variables (unless it's the same way with fuctions):

function efromTarget(p: player) :: entity:
    return target of {_p}

function efromTarget_living(p: player) :: living entity:
    return target of {_p}

on rightclick with stick:
    set name of efromTarget_living(player) to "test_l" #works
    set name of efromTarget(player) to "test" #the same error as #1 in original post

@Pikachu920
Copy link
Member

@TheLimeGlass they absolutely are allowed to be - any object can be. They just aren't serializable and can't persist restarts.

@TheBentoBox TheBentoBox added bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. priority: low Issues that are not harmful to the experience but are related to useful changes or additions. labels Jun 11, 2019
@TheBentoBox
Copy link
Member

This definitely doesn't make sense because non-living entities do support custom names. I actually do so regularly on my server with names on item stacks for displays and stuff.

@jaylawl
Copy link
Contributor

jaylawl commented Jun 22, 2019

I can confirm this issue happening, but only when an entity is residing within a local variable (didnt test with normal variables)

@FranKusmiruk FranKusmiruk added the completed The issue has been fully resolved and the change will be in the next Skript update. label Sep 2, 2019
@bensku bensku closed this as completed Sep 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. completed The issue has been fully resolved and the change will be in the next Skript update. priority: low Issues that are not harmful to the experience but are related to useful changes or additions.
Projects
None yet
Development

No branches or pull requests

7 participants