@Override public void tick(Hero hero) { super.tick(hero); Player player = hero.getPlayer(); double healAmount = hero.getMaxHealth() * tickHealPercent; hero.setHealth(hero.getHealth() + healAmount); hero.syncHealth(); if (hero.isVerbose()) { player.sendMessage(Messaging.createFullHealthBar(hero.getHealth(), hero.getMaxHealth())); } }
@Override public void onPlayerRespawn(PlayerRespawnEvent event) { Player player = event.getPlayer(); final Hero hero = plugin.getHeroManager().getHero(player); hero.setHealth(hero.getMaxHealth()); hero.setMana(0); CraftPlayer craftPlayer = (CraftPlayer) player; EntityPlayer entityPlayer = craftPlayer.getHandle(); entityPlayer.exp = 0; entityPlayer.expTotal = 0; entityPlayer.expLevel = 0; Bukkit.getScheduler() .scheduleSyncDelayedTask( plugin, new Runnable() { @Override public void run() { hero.syncExperience(); } }, 20L); }