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

World reload causes worlds in location variables to not work correctly until restart #1144

Closed
ghost opened this issue Mar 11, 2018 · 5 comments
Labels
completed The issue has been fully resolved and the change will be in the next Skript update. enhancement Feature request, an issue about something that could be improved, or a PR improving something. priority: low Issues that are not harmful to the experience but are related to useful changes or additions.

Comments

@ghost
Copy link

ghost commented Mar 11, 2018

this has been a bug in Skript for a while, it would be nice if it would get fixed.
example:
you go to a world which isn't the main world, but an additional world created by world management plugins like Multiverse-Core or some other
you use !set {spawn} to location of player
then you unload and load back that world and do !teleport player to {spawn}, it will teleport to that location, but in the main server's world, not the one in which you set it
it can be fixed if you use !set world of {spawn} to "%world of {spawn}%" parsed as a world or if you restart the server it also gets fixed
it would be nice if it wouldn't break with world reloads, because I reload worlds for world resetting

@TheLimeGlass
Copy link
Contributor

TheLimeGlass commented Mar 21, 2018

Putting this here for reference. I talked about this in #1020 but this is not a duplicate issue. It's been known in the Skript community for awhile. It's mainly the users issue but it would be nice to have a feature to get rid of those un-used world variables.

The main problem (And I think Njol knew this) is that the world could have been unloaded (in your case) or deleted by mistake and so then the user goes to re-add the world. When they re-add the world, they realize the world variables were deleted and they're like wtf? I think Njol did this so that he could keep the users data. No one wants to have all their data reset to then have to re-add it all again.

A option to clean the variable database would be nice though, which is highlighted in the other issue I just referenced.

In your case I suggest setting local variables of the location if you unload/load the world constantly. You can do so by using the location function

#The world type returns the main default world if not set, Not the string of the world, I did that for representation only.
#Remember Yaw and Pitch are of 360 degrees, anything inputted that is above 360 will loop again from 0 degrees
#(Yaw and Pitch) and World are optional.

location(x: number, y: number, z: number, w: world = "world", yaw: number = 0, pitch: number = 0)

Example usage:

set {_location} to location(50, 100, 0, player's world, yaw of player, pitch of player)
set {_location} to location(50, 100, 0, world "ExampleWorld")
set {_location} to location(50, 100, 0) #Will be the default world of the server

You can also check out an addon I made to handle the main problems that Skript has with worlds https://github.com/TheLimeGlass/skript-world

Source code of this internal function if interested: https://github.com/bensku/Skript/blob/8e17c858f6f3ee11942390675b94f0dd07b11103/src/main/java/ch/njol/skript/classes/data/DefaultFunctions.java#L305-L320

@TheBentoBox TheBentoBox added enhancement Feature request, an issue about something that could be improved, or a PR improving something. priority: low Issues that are not harmful to the experience but are related to useful changes or additions. labels Apr 11, 2018
@TheBentoBox
Copy link
Member

Thanks for the detailed info @TheLimeGlass. I agree it would be nice to fix this, but I imagine it only affects most users pretty rarely.

@Whimsyturtle
Copy link
Member

From #341: Worlds that are not loaded before Skript is initialized cannot be accessed properly

@TheLimeGlass
Copy link
Contributor

Yup

@TPGamesNL
Copy link
Member

When #4408 is merged, this issue will be fixed with #3971 (comment)

@TPGamesNL TPGamesNL added PR available Issues which have a yet-to-be merged PR resolving it completed The issue has been fully resolved and the change will be in the next Skript update. and removed PR available Issues which have a yet-to-be merged PR resolving it labels Nov 6, 2021
@TPGamesNL TPGamesNL added PR available Issues which have a yet-to-be merged PR resolving it and removed completed The issue has been fully resolved and the change will be in the next Skript update. labels Jan 4, 2022
@TPGamesNL TPGamesNL added completed The issue has been fully resolved and the change will be in the next Skript update. and removed PR available Issues which have a yet-to-be merged PR resolving it labels Mar 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
completed The issue has been fully resolved and the change will be in the next Skript update. enhancement Feature request, an issue about something that could be improved, or a PR improving something. 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

5 participants