Communicating among events
The plugin works exactly as intended, but what if we have a change of heart and begin to miss the sound of rain? Alternatively, what if our town bursts into flames and it must be extinguished quickly? We do not want to limit our power as an administrator by denying ourselves the use of the
/toggledownfall command. Next, we will listen for this command to be issued, and when it is issued, we will allow the weather to change. Ultimately, we will still be able to control the weather manually, but the weather will not start on its own.
Let's create another
EventHandler method. This time, we will listen for a console command being sent so that we can set a Boolean flag, as follows:
@EventHandler (ignoreCancelled = true, priority ...