diff --git a/Feli.OpenMod.Teleporting/Services/TeleportsManager.cs b/Feli.OpenMod.Teleporting/Services/TeleportsManager.cs index f6a07a3..ea4094c 100644 --- a/Feli.OpenMod.Teleporting/Services/TeleportsManager.cs +++ b/Feli.OpenMod.Teleporting/Services/TeleportsManager.cs @@ -228,6 +228,17 @@ private async Task ValidateRequest(Tuple reque return false; } + if (!sender.Player.IsAlive || !target.Player.IsAlive) + { + var dead = !sender.Player.IsAlive ? sender : target; + var alive = sender.Player.IsAlive ? sender : target; + + await Say(dead, _stringLocalizer["tpaValidation:dead:dead"]); + await Say(alive, _stringLocalizer["tpaValidation:dead:alive", dead.DisplayName]); + + return false; + } + if (_configuration.GetSection("teleportCost:enabled").Get()) { var balance = await _economyProvider.GetBalanceAsync(sender.Id, KnownActorTypes.Player); diff --git a/Feli.OpenMod.Teleporting/translations.yaml b/Feli.OpenMod.Teleporting/translations.yaml index fcc64ae..e89d923 100644 --- a/Feli.OpenMod.Teleporting/translations.yaml +++ b/Feli.OpenMod.Teleporting/translations.yaml @@ -46,4 +46,8 @@ tpaValidation: balance: sender: "You dont have enough balance to teleport. Teleport cost: {0}" - target: "The teleport was cancelled because {0} does not have enough balance" \ No newline at end of file + target: "The teleport was cancelled because {0} does not have enough balance" + + dead: + alive: "The teleport was cancelled because {0} is dead" + dead: "The teleport was cancelled because you died" \ No newline at end of file diff --git a/Feli.RocketMod.Teleporting/Plugin.cs b/Feli.RocketMod.Teleporting/Plugin.cs index c3a58f5..9af42c2 100644 --- a/Feli.RocketMod.Teleporting/Plugin.cs +++ b/Feli.RocketMod.Teleporting/Plugin.cs @@ -23,7 +23,7 @@ protected override void Load() ? new ExperienceEconomyProvider() as IEconomyProvider : new UconomyEconomyProvider(); - Logger.Log($"Teleporting plugin v1.6.1 loaded !"); + Logger.Log($"Teleporting plugin v1.6.2 loaded !"); Logger.Log("Do you want more cool plugins? Join now: https://discord.gg/4FF2548 !"); Logger.Log($"Economy Provider: {EconomyProvider.GetType().Name}"); } @@ -65,7 +65,9 @@ protected override void Unload() {"TpaValidation:Combat:Sender", "The teleport was cancelled because you are in combat. The combat mode expires in {0} seconds"}, {"TpaValidation:Combat:Target", "The teleport was cancelled because {0} is in combat"}, {"TpaValidation:Balance:Sender", "You dont have enough balance to teleport. Teleport cost: {0}"}, - {"TpaValidation:Balance:Target", "The teleport was cancelled because {0} does not have enough balance"} + {"TpaValidation:Balance:Target", "The teleport was cancelled because {0} does not have enough balance"}, + {"TpaValidation:Dead:Alive", "The teleport was cancelled because {0} is dead" }, + {"TpaValidation:Dead:Dead", "The teleport was cancelled because you died" } }; } } \ No newline at end of file diff --git a/Feli.RocketMod.Teleporting/Properties/AssemblyInfo.cs b/Feli.RocketMod.Teleporting/Properties/AssemblyInfo.cs index 2e964a8..36bb33f 100644 --- a/Feli.RocketMod.Teleporting/Properties/AssemblyInfo.cs +++ b/Feli.RocketMod.Teleporting/Properties/AssemblyInfo.cs @@ -14,5 +14,6 @@ [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("795C0322-F7CE-4896-B0E7-09B37D0F8440")] -[assembly: AssemblyVersion("1.5.*")] -[assembly: AssemblyFileVersion("1.5.0.0")] \ No newline at end of file +[assembly: AssemblyInformationalVersion("1.6.2")] +[assembly: AssemblyVersion("1.6.2")] +[assembly: AssemblyFileVersion("1.6.2")] \ No newline at end of file diff --git a/Feli.RocketMod.Teleporting/TeleportsManager.cs b/Feli.RocketMod.Teleporting/TeleportsManager.cs index e5befbc..27cd075 100644 --- a/Feli.RocketMod.Teleporting/TeleportsManager.cs +++ b/Feli.RocketMod.Teleporting/TeleportsManager.cs @@ -202,6 +202,17 @@ private bool ValidateRequest(Tuple request) return false; } + if(sender.Dead || target.Dead) + { + var dead = sender.Dead ? sender : target; + var alive = !sender.Dead ? sender : target; + + Say(dead, _plugin.Translate("TpaValidation:Dead:Dead"), _messageColor, _messageIcon); + Say(alive, _plugin.Translate("TpaValidation:Dead:Alive", dead.DisplayName), _messageColor, _messageIcon); + + return false; + } + if (_configuration.TeleportCost.Enabled && _plugin.EconomyProvider.GetBalance(sender.Id) < _configuration.TeleportCost.TpaCost) { Say(sender, _plugin.Translate("TpaValidation:Balance:Sender", _configuration.TeleportCost.TpaCost), _messageColor, _messageIcon);