-
-
Save Paxination/f4d354e524f0e96fede6 to your computer and use it in GitHub Desktop.
suggested implementation for hospital beds for Disease bukkit plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.UUID; | |
import org.bukkit.plugin.Plugin; | |
public class HospitalBed implements Runnable{ | |
private Plugin plugin; | |
UUID uuid; | |
int count = 6000; | |
//Default value for count; | |
public HospitalBed(Plugin plugin, UUID uuid){ | |
this.plugin = plugin; | |
this.uuid = uuid; | |
count=plugin.getConfig().getInt("PATH.TO.INTEGER.IN.MINS")*1200; | |
//there is 1200 ticks in each minute. So we have to multiply by this. | |
} | |
@Override | |
public void run() { | |
if(plugin.getServer().getPlayer(uuid).isSleeping()){ | |
count++; | |
//if they are sleeping, increase our counter. | |
//we count to make sure they are sleeping every tick of the time. | |
} else { | |
cancel(); | |
//if they are not sleeping any more, we cancel this runnable | |
} | |
if(count==6000){ | |
//clear their disease | |
} | |
} | |
public void cancel(){ | |
this.cancel(); | |
//cancels this runnable | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment