-
-
Notifications
You must be signed in to change notification settings - Fork 382
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
[bug] Fix async script reloading #3324
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this change required? is there a related issue? or an explanation of what was wrong and how this fixed it?
|
so it sounds like the real fix would be to make prescriptloadevent async when needed. if we run it sync all the time, it will not break some aspects of the event when parsing is async |
Here is the context: I tried to execute the |
@Olyno can we just implement Event#isAsynchronous though |
Indeed I didn't know that, let me change that |
So after some tests, we can't only make an event async, we must execute it async. So it doesn't change a lot to make this event async or not, only the execution is enough and work fine. |
it does change things - if parsing is async and the event is called sync then anything listening to the event will be able to modify the script (which is 75% of the point of the event). what prevents you from making it async? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there's a misunderstanding here, the event doesn't have to always be async. You've got to call super with ScriptLoader#isAsync like this:
public PreScriptLoadEvent(List<Config> scripts) {
super(Scriptloader.isAsync());
Validate.notNull(scripts);
this.scripts = scripts;
}
this way you don't have to change how the event is called
There is one problem with |
you can also just do |
So after a lot of try, I still have an issue when Skript loads: https://0bin.net/paste/h3o9zvZx#ZYZlFmhHT1W3B69ALw3VnZ6G7Q95lRcEYHeuGLSgNCE My first way was probably the best to fix that issue I think. |
what did your code look like when you got that exception? |
I simply created an async event, and execute it, like on test:
reload script "test" |
that would go away if you put |
It's exactly what I did. Anyway, it's not the |
we don't want to specify it's execution, we want it to be both async or sync depending on what parsing is. i just took a look at the spigot code and it definitely won't throw that exception if you use
though I can't find the exact line your exception points out - what version of paper are you running? |
The Event constructor's argument is |
nice catch |
@Olyno can you try |
@Olyno are you planning on making this change? |
Yes I am, but it takes me some time due to personnal and profesionnal stuff, I do changes when I can |
7818e75
to
56c114f
Compare
So after did some tests, it seems to solve the problem @Pikachu920 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The following javadoc should be added to the class:
/**
* This event has no guarantee of being on the main thread.
* Please do not use bukkit api before checking {@link Bukkit#isPrimaryThread()}
*/
Up ? |
Description
This pull request includes a small fix for async event with
EffScriptFile
Target Minecraft Versions: /
Requirements: /
Related Issues: /