@Ollie
JonnyD is right, but don't despair. I've encountered the same problem at the beginning and Emmanuel have helped me.
Now it's my turn.
You have to verify first if the home have more levels.
Study of case:
Code: Select all
Level selectedLevel = getHome().getSelectedLevel();
-New file; draw a room; add an flower and select both. Run the plugin => OK.
-On the same file add a level and then delete it.
Run the plugin => Not OK.
So, in my Select/Hide Special plugin I've use something like this:
Code: Select all
if (selectedLevel == null || selectedLevel.isVisible()) {
userView = new SelectHideView();
contentPanel = userView.createComponents(resource);
}
Of course probably you will need other conditions.
Feel free to take inspiration from other plugin sources. I do it all the time.