Creating Disasters
Starting a disaster is much easier than you would think, all you need to do is create the disaster instance and then call the start()
method. Here is an example of starting a sinkhole on a player named Steve:
As you may have noticed inside the new Sinkhole(1)
there is a '1' this stands for the level of the disaster. There are two types of disasters in the API, DestructionDisaster and WeatherDisaster. As you may have already guessed, the WeatherDisaster type is for weather-based disasters like acidstorms, blizzards, soulstorms, meteorshowers, etc. And the DestructionDisaster type is for disasters that are not weather affiliated such as sinkholes, earthquakes, supernovas, etc. All DestructionDisaster type disasters share the same constructor for creating and starting the disaster, this is the super constructor for DestructionDisaster:
And here are the constructors for creating and starting a WeatherDisaster:
This means that all disasters have either the same syntax as the DestructionDisaster or the WeatherDisaster. The reason why Player is nullable in the start()
syntax is because you do not need to define an origin player for the disaster (Except purges). Defining an origin player just lets you and other plugins keep track of what player caused the disaster. You can also start disasters with a delay before they actually start, the reason why you would do this is for the end totem pet to be able to detect the disaster before it happens and also for the listplayer command to display the disaster and how much time before it happens. All disasters that naturally occur are started like this:
The delaySeconds is how many seconds before the disaster starts. The offset vector is the disasters offset as a vector value. The player is not optional, if you are creating a delay for a disaster to start you must specify the player that it will start on. The offset vector is applied to the location of the player when the disaster actually occurs.
Disasters will start at the location you define in the parameter, sinkholes work best at ground level so here is a quick method to start a sinkhole below the player on solid ground:
Some disasters have tools to assist in finding a location suitable for the disaster such as Tsunamis spawning where water is deep enough:
Each disaster has its own unique variables you can manipulate such as size, damage, volume, etc. Here is an example of starting an Earthquake with a custom size:
Some disasters such as Geysers can be customized and do not need to be started but instead have internal features that you can use, for example, this method will create a water geyser under our player that will not do any damage:
Here is an example of creating an acid storm with no start delay and custom damage that will not melt players armor or items:
Here is an example of creating a meteor shower that will last 60 seconds and force the time to night, keep in mind that the time variable is in-game ticks and counts down.
This example will start a plague and infect 6 additional mobs (the level of the plague is the number of mobs that will be infected).
Last updated