Search in sources :

Example 1 with Attribute

use of pl.themolka.arcade.attribute.Attribute in project Arcade2 by ShootGame.

the class GamePlayer method reset.

public void reset() {
    if (!this.isOnline()) {
        return;
    }
    Player bukkit = this.getBukkit();
    this.refresh();
    bukkit.closeInventory();
    this.getPlayer().clearInventory(true);
    this.resetHealth();
    this.setLevel(PlayerLevel.getDefaultLevel());
    bukkit.setAbsorption(AbsorptionContent.Config.DEFAULT_ABSORPTION);
    bukkit.setAllowFlight(CanFlyContent.Config.DEFAULT_CAN_FLY);
    bukkit.setArrowsStuck(RemoveArrowsContent.FINAL_COUNT);
    bukkit.setExhaustion(ExhaustionContent.Config.DEFAULT_LEVEL);
    bukkit.setExp((float) ExperienceContent.Config.DEFAULT_EXPERIENCE.getValue());
    bukkit.setFallDistance(FallDistanceContent.Config.DEFAULT_DISTANCE);
    bukkit.setFireTicks(TimeUtils.toTicksInt(BurnContent.Config.DEFAULT_TIME));
    bukkit.setFlying(FlyContent.Config.DEFAULT_FLY);
    bukkit.setFlySpeed(FlySpeedContent.Config.DEFAULT_SPEED);
    bukkit.setFoodLevel(HungerContent.Config.DEFAULT_LEVEL);
    bukkit.setGameMode(GameModeContent.Config.DEFAULT_GAME_MODE);
    bukkit.setGlowing(GlowContent.Config.DEFAULT_GLOW);
    bukkit.setGravity(GravityContent.Config.DEFAULT_GRAVITY);
    bukkit.setKnockbackReduction(KnockbackContent.Config.DEFAULT_KNOCKBACK);
    bukkit.setSaturation(SaturationContent.Config.DEFAULT_SATURATION);
    bukkit.setSilent(SilentContent.Config.DEFAULT_SILENT);
    bukkit.setSneaking(false);
    bukkit.setSprinting(false);
    bukkit.setVelocity(VelocityContent.Config.DEFAULT_VELOCITY);
    bukkit.setWalkSpeed(WalkSpeedContent.Config.DEFAULT_SPEED);
    bukkit.resetPlayerTime();
    bukkit.resetPlayerWeather();
    bukkit.resetTitle();
    for (PotionEffectType effect : PotionEffectType.values()) {
        bukkit.removePotionEffect(effect);
    }
    if (this.attributeMap != null) {
        for (AttributeKey key : this.attributeMap.getTracking()) {
            Attribute attribute = this.attributeMap.getAttribute(key);
            if (attribute != null) {
                attribute.removeAllModifers();
            }
        }
        this.attributeMap.unsubscribeAll();
    }
    this.getMojang().reset();
}
Also used : AttributeKey(pl.themolka.arcade.attribute.AttributeKey) EntityPlayer(net.minecraft.server.EntityPlayer) Player(org.bukkit.entity.Player) ArcadePlayer(pl.themolka.arcade.session.ArcadePlayer) Attribute(pl.themolka.arcade.attribute.Attribute) PotionEffectType(org.bukkit.potion.PotionEffectType)

Aggregations

EntityPlayer (net.minecraft.server.EntityPlayer)1 Player (org.bukkit.entity.Player)1 PotionEffectType (org.bukkit.potion.PotionEffectType)1 Attribute (pl.themolka.arcade.attribute.Attribute)1 AttributeKey (pl.themolka.arcade.attribute.AttributeKey)1 ArcadePlayer (pl.themolka.arcade.session.ArcadePlayer)1