Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static Timer timer = new Timer();
- public static void sendDeathMessage(PlayerEntity player) {
- for (int counter = 0; counter < 1; counter++) {
- timer.schedule(new TimerTask() {
- public void run() {
- if (player.getServer() != null) {
- for (net.minecraft.entity.player.ServerPlayerEntity serverPlayerEntity : player.getServer().getPlayerList().getPlayers()) {
- if (player.getMaxHealth() >= 2 && player.getMaxHealth() <= 18) {
- float maxHealth = player.getMaxHealth();
- int lives = (int) (10 - (maxHealth / 2));
- XLifeHealthMod.LOGGER.info(player.getGameProfile().getName());
- if (lives >= 2) {
- SendMessage.sendMessage(serverPlayerEntity, TextFormatting.RED + player.getGameProfile().getName() + " has " + lives + " lives remaining . . .");
- } else if (lives == 1) {
- SendMessage.sendMessage(serverPlayerEntity, TextFormatting.RED + player.getGameProfile().getName() + " has one life remaining . . .");
- }
- } else {
- SendMessage.sendMessage(serverPlayerEntity, TextFormatting.RED + player.getGameProfile().getName() + " has been eliminated . . .");
- }
- }
- }
- }
- }, 8);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement