O'Reilly logo

Building Minecraft Server Modifications - Second Edition by Cody M. Sommer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required