Sueta

DiseasesAPI

1.15.0

Create a Disease plugin.

·Plugin

Attention:
Do put more than a disease in 1 class, create a class for each disease.

To use this api in your plugin add this depend line in your plugin.yml or the plugin will not work:

depends: DiseasesAPI

Or as soft depend:

softdepend: DiseasesAPI

How to use the plugin API

Spoiler

Create a new Disease:

Disease diseasename = new Disease(DiseaseType);


Set a display name for the Disease:

diseasename.setDiseaseName("Name of the Disease");


Set danger level:

diseasename.setDangerLevel(DangerLevel.LOW|MEDIUM|HIGH);


Get danger level:

diseasename.getDangerLevel();


Get disease name:

diseasename.getDiseaseName();


Infect a player (This also fires the "PlayerInfectedEvent" event):

diseasename.infectPlayer(Player);


Uninfect a player (This also fires the "PlayerCuredEvent" event):

diseasename.uninfectPlayer(Player);


Gets the names of infected players:

diseasename.getInfectedPlayersNames();


Checks if a player is infected;

diseasename.isPlayerInfected(Player);


Gets the number of infected players:

diseasename.getInfectedPlayers();


Set complexity for a Disease:
1 = low, 2 = medium, 3+ = high.

diseasename.setComplexity(int);

Get complexity for a Disease:

diseasename.getComplexity();

Cure a disease for a player (Not instantly):
If complexity equals or is lower than 1:

If cure is common, substacts 35/100 from disease's health on the player.
If cure is well_made, substacts 50/100 from disease's health on the player.
If cure is super, substacts 100/100 from disease's health on the player.
If complexity equals 2:
If cure is common, substacts 20/100 from disease's health on the player.
If cure is well_made, substacts 35/100 from disease's health on the player.
If cure is super, substacts 50/100 from disease's health on the player.
If complexity equals or is greater than 3:
If cure is common, substacts 5/100 from disease's health on the player.
If cure is well_made, substacts 15/100 from disease's health on the player.
If cure is super, substacts 30/100 from disease's health on the player.

diseasename.curePlayer(Player);

Get disease's health on a player:

diseasename.getDiseaseHealth(Player);


Get disease type:

diseasename.getType();

Get a Disease:

Disease.getDisease(Disease);


Get all the Diseases:

Disease.getDiseases();


Get all Diseases names:

Disease.getDiseasesNames();


Get number of Diseases:

Disease.getNumDiseases();


PS: diseasename = the disease you created, Disease = class, not the disease you created.

Commands and Permissions

Spoiler


/dapi - Display Plugin Help | dapi.help
/dapi infect (Player) (Disease) - Force infect a player | dapi.forceinfect
/dapi forcecure (Player) (Disease) - Instantly cure a player | dapi.forcecure
/dapi diseaselist - Display a list of diseases | dapi.list
/dapi infectlist (Disease) - Display a list of players infected from a specific disease | dapi.infectlist
/temperature [Player] - Check your or a player's temperature | None


Example

Spoiler

Class of the Disease:

public class DiseaseName {
  public DiseaseName() {
    Disease DiseaseName = new Disease(DiseaseType diseaseType);
    
    // Your code
  }
}


Pre-Made diseases avaible:

- BlackPlague
- Ebola
- SpanishFever
- Coronavirus
- Smallpox



ToDo List:
- Add Complexity.

- Add Cures.
- Add some commands.
- Add more ways to get a disease.
- Add Pre-made diseases.
- Add Temperature.
- Add player trasmission.
- Add Disease types.

Green = Done
Yellow = Working on it
Red = To do
Underline = Done, but still working on it in case of bugs etc.

Everything is done!

How to download:
1. Click on "download".

2. Put the .jar file in "your server folder/plugins".
3. Stop and Start the server.
If you're going to use the API to make a plugin, import it as if you're importing Spigot.

Before posting a review:
Please do not post any bug report or errors below, pm me instead.

As I said above, this is just an API for developers to make plugins. If you own a server and you're making a plugin with this API, don't forget to put this API in your plugins folder or else your plugin will not work.

If you're interested in the API click the buttons above, if you need any help related to this API pm me.
And if you're going to post your plugin on spigot or any other website do not forget to specify that your plugin depends on this one.

Similar projects

Plugin →