HomeJavaModsDiseasesAPI
DiseasesAPI
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:

Code (YAML):
depends : DiseasesAPI
Or as soft depend:

Code (YAML):
softdepend : DiseasesAPI
How to use the plugin API

Spoiler
Create a new Disease:
Code (Java):
Disease diseasename = new Disease (DiseaseType ) ;

Set a display name for the Disease:
Code (Java):
diseasename. setDiseaseName ( "Name of the Disease" ) ;

Set danger level:
Code (Java):
diseasename. setDangerLevel (DangerLevel. LOW |MEDIUM |HIGH ) ;

Get danger level:
Code (Java):
diseasename. getDangerLevel ( ) ;

Get disease name:
Code (Java):
diseasename. getDiseaseName ( ) ;

Infect a player (This also fires the "PlayerInfectedEvent" event):
Code (Java):
diseasename. infectPlayer (Player ) ;

Uninfect a player (This also fires the "PlayerCuredEvent" event):
Code (Java):
diseasename. uninfectPlayer (Player ) ;

Gets the names of infected players:
Code (Java):
diseasename. getInfectedPlayersNames ( ) ;

Checks if a player is infected;
Code (Java):
diseasename. isPlayerInfected (Player ) ;

Gets the number of infected players:
Code (Java):
diseasename. getInfectedPlayers ( ) ;

Set complexity for a Disease:
1 = low, 2 = medium, 3+ = high.
Code (Java):
diseasename. setComplexity ( int ) ;
Get complexity for a Disease:
Code (Java):
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.
Code (Java):
diseasename. curePlayer (Player ) ;
Get disease's health on a player:
Code (Java):
diseasename. getDiseaseHealth (Player ) ;

Get disease type:
Code (Java):
diseasename. getType ( ) ;
Get a Disease:
Code (Java):
Disease. getDisease (Disease ) ;

Get all the Diseases:
Code (Java):
Disease. getDiseases ( ) ;

Get all Diseases names:
Code (Java):
Disease. getDiseasesNames ( ) ;

Get number of Diseases:
Code (Java):
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:
Code (Java):

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.

Commands

Plugin details

Read from the plugin's own plugin.yml.

Quick facts

Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.

DiseasesAPI is a free Minecraft Java mod. Compatible with Minecraft 1.8, 1.15. Downloaded 2,972 times (via Spigot). Download it and open it directly in the game.

Explore more