/* This override is to add the behavior to the player of when they die they also reset all of their potion effects */ public override void OnEntityDeath(DamageSource damageSourceForDeath) { IServerPlayer player = GetIServerPlayer(); TempEffect tempEffect = new TempEffect(); tempEffect.reset((player.Entity as EntityPlayer), false); base.OnEntityDeath(damageSourceForDeath); }
/* This override is to add the PotionFixBehavior to the player and to reset all of the potion stats to default */ public override void StartServerSide(ICoreServerAPI api) { this.sapi = api; api.Event.PlayerNowPlaying += (IServerPlayer iServerPlayer) => { if (iServerPlayer.Entity is EntityPlayer) { Entity entity = iServerPlayer.Entity; entity.AddBehavior(new PotionFixBehavior(entity, config)); //api.Logger.Debug("[Potion] Adding PotionFixBehavior to spawned EntityPlayer"); TempEffect tempEffect = new TempEffect(); EntityPlayer player = (iServerPlayer.Entity as EntityPlayer); tempEffect.reset(player, false); //api.Logger.Debug("potion player ready"); } }; base.StartServerSide(api); }