mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2024-11-24 19:45:43 +01:00
Improve and fix DInstancePlayer#clearPlayerState(); resolves #809
This commit is contained in:
parent
4ddfea0205
commit
5cc5073062
@ -24,6 +24,7 @@ import de.erethon.dungeonsxl.api.world.InstanceWorld;
|
|||||||
import de.erethon.dungeonsxl.config.MainConfig;
|
import de.erethon.dungeonsxl.config.MainConfig;
|
||||||
import de.erethon.dungeonsxl.util.ParsingUtil;
|
import de.erethon.dungeonsxl.util.ParsingUtil;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.attribute.Attribute;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
|
||||||
@ -73,9 +74,16 @@ public abstract class DInstancePlayer extends DGlobalPlayer implements InstanceP
|
|||||||
player.getInventory().setArmorContents(null);
|
player.getInventory().setArmorContents(null);
|
||||||
player.setExp(0f);
|
player.setExp(0f);
|
||||||
player.setLevel(0);
|
player.setLevel(0);
|
||||||
player.setMaxHealth(20);
|
double maxHealth;
|
||||||
player.setHealth(20);
|
if (is1_9) {
|
||||||
|
maxHealth = player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue();
|
||||||
|
} else {
|
||||||
|
maxHealth = player.getMaxHealth();
|
||||||
|
}
|
||||||
|
player.setHealth(maxHealth);
|
||||||
player.setFoodLevel(20);
|
player.setFoodLevel(20);
|
||||||
|
player.setExp(0f);
|
||||||
|
player.setLevel(0);
|
||||||
for (PotionEffect effect : player.getActivePotionEffects()) {
|
for (PotionEffect effect : player.getActivePotionEffects()) {
|
||||||
player.removePotionEffect(effect.getType());
|
player.removePotionEffect(effect.getType());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user