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 ...
Get Building Minecraft Server Modifications - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.