[SPIGOT-4225] allow adding recipes when "load: startup" is specified in plugin.yml Created: 03/Aug/18  Updated: 20/Jan/19

Status: Open
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Minor
Reporter: gizmo Assignee: Unassigned
Resolution: Unresolved Votes: 1
Labels: 1.13, load, recipe, yml
Environment:

java 8 windows


Version: git-Spigot-69774b3-6 71581e (MC: 1.13) (Implementing API version 1.13-R0.1-SNAPSHOT)
Guidelines Read: Yes

 Description   

Bukkit.addRecipe() currently silently fails to add both shaped and shapeless recipes when "load: startup" is set in the plugin's plugin.yml file. It would be nice to be able to add recipes with this option enabled.

Im attempting to add the recipes in the plugin's onEnable() method.

 

 

EDIT:

     I found a work around, this feature request is therefore technically invalid i suppose, because it can be done with existing API.



 Comments   
Comment by gizmo [ 20/Jan/19 ]

sorry Jumpin Carrot, took a long break from coding. Ya a ServerLoadEvent listener is one way to do it. If you want to do it without registering a ServerLoadEvent listener you can also schedule a task with a delay of 0 inside of your onEnable(). This works (i think) because tasks don't run until after the server has finished loading. This feels like a much more jankey way of doing things though.

Comment by Jumpin Carrot [ 29/Nov/18 ]

Nevermind.

The solution is to register a ServerLoadEvent listener.

Comment by Jumpin Carrot [ 29/Nov/18 ]

gizmo , could you post your workaround, please?

Comment by gizmo [ 04/Aug/18 ]

A ServerEvent that is called when the info message:

"Done (2.059s)! For help, type "help""

is printed would be a good alternative to adding an onEnableLate method.

Comment by gizmo [ 04/Aug/18 ]

hmm, nope, i misunderstood your text diagram, however I did misunderstand the order and after re-reading your diagram i understand. However onLoad() is not a viable solution. Having a method named something like onEnableLate with the order:

onLoad STARTUP < onLoad DEFAULT < onEnable STARTUP <<< onEnableLate STARTUP < onEnable DEFAULT

would provide load: startup plugins a way to do tag/datapack things.

 

I have tried to do e.getWorld().setKeepSpawnInMemory(false); in the onWorldInit(e) event and it does not work unless load: startup is specified. (the method is never called because the worlds have all already initialized by the time the plugin has been enabled)

 

wouldn't the regular loadtime plugin need to overwrite all of the spawn chunks in order to re-generate them again? since the server preloads (and generates) the spawn chunks before regular load time plugins are enabled.

Comment by md_5 [ 04/Aug/18 ]

If onEnable doesn't work, then onLoad won't work for recipes.

I think the advice in that Bukkit post is outdated(2011...), and generators will work for regular load time plugins.

Comment by gizmo [ 04/Aug/18 ]

Thanks for clearing up the order for me, as i was under the impression that onLoad() was always called immediately after onEnable(), seems as though i understood it both upside down and backwards.

 

I will attempt adding the recipes via onLoad() then and if it works then this feature request is invalid and i apologize for wasting your time.

ill reply soon. 

Comment by md_5 [ 04/Aug/18 ]

>do you mean that onLoad() is always called when regular plugins are loaded, regardless of if load: startup is specified?

Yes.

onLoad STARTUP < onLoad DEFAULT < onEnable STARTUP <<< onEnable DEFAULT

Comment by gizmo [ 03/Aug/18 ]

custom chunk generators and the WorldInitEvent seem to require load: startup in order to  function properly.

an old post on the bukkit forums by dinnerbone from when he added custom chunk generators states that load: startup is to be used.

https://bukkit.org/threads/chunkgenerators-blockpopulators-faq.22795/

 

im slightly confused by your reply:

do you mean that onLoad() is always called when regular plugins are loaded, regardless of if load: startup is specified?

Comment by md_5 [ 03/Aug/18 ]

How come you're using load: startup anyway.
Given this ticket and some other tickets recently, I think it should just be removed.

Bukkit already provides onLoad(..) which fires at the same time as onEnable(..) for STARTUP plugins.

Comment by gizmo [ 03/Aug/18 ]

perhaps an onInitialized() method for use with load: startup that is called when the onEnable() method of plugins that do not have load: startup specified or something? Otherwise, just a callback or method that allows plugins to know when the server is prepared enough for things like tags and recipes to be modified.

Comment by md_5 [ 03/Aug/18 ]

load: startup is not for the general use case.
The server is not initialized much at all at this point.

I agree it shhouldn't silently fail, but I also don't think it should be allowed (similar to tags... datapacks are only loaded after)

Generated at Sat Dec 13 15:18:41 UTC 2025 using Jira 10.3.13#10030013-sha1:56dd970ae30ebfeda3a697d25be1f6388b68a422.