From a083b10debd5dc7fc04b8b0c039841f397b7ad26 Mon Sep 17 00:00:00 2001 From: UserR00T Date: Thu, 17 May 2018 21:45:28 +0200 Subject: [PATCH] Update to game version 0.78a * Fixed a bug with selling your apartment * Logs bans in console now --- .../Chat/Commands/Everyone/Confirm.cs | 3 ++- source/BP-Essentials/EssentialsMethods.cs | 17 +++++++++++++---- source/BP-Essentials/EssentialsVariables.cs | 2 +- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/source/BP-Essentials/Chat/Commands/Everyone/Confirm.cs b/source/BP-Essentials/Chat/Commands/Everyone/Confirm.cs index 6454aec3..01df0866 100644 --- a/source/BP-Essentials/Chat/Commands/Everyone/Confirm.cs +++ b/source/BP-Essentials/Chat/Commands/Everyone/Confirm.cs @@ -13,6 +13,7 @@ class Confirm : EssentialsChatPlugin public static bool Run(object oPlayer) { var player = (SvPlayer)oPlayer; + foreach (var shPlayer in UnityEngine.Object.FindObjectsOfType()) if (shPlayer.svPlayer == player && shPlayer.IsRealPlayer()) if (shPlayer.ownedApartment) @@ -26,4 +27,4 @@ public static bool Run(object oPlayer) return true; } } -} +} \ No newline at end of file diff --git a/source/BP-Essentials/EssentialsMethods.cs b/source/BP-Essentials/EssentialsMethods.cs index 185ed923..50ebca0f 100644 --- a/source/BP-Essentials/EssentialsMethods.cs +++ b/source/BP-Essentials/EssentialsMethods.cs @@ -13,12 +13,16 @@ namespace BP_Essentials { public class EssentialsMethodsPlugin : EssentialsCorePlugin { + [Hook("SvPlayer.SvSellApartment")] public static bool SvSellApartment(SvPlayer player) { - Confirmed = false; if (Confirmed) + { + Confirmed = false; return false; + } + Confirmed = false; player.SendToSelf(Channel.Unsequenced, ClPacket.GameMessage, $"Are you sure you want to sell your apartment? Type '{CmdConfirm}' to confirm."); return true; } @@ -27,6 +31,7 @@ public static bool SvSellApartment(SvPlayer player) public static void Initialize(SvPlayer player) { ShPlayer shPlayer = (ShPlayer)typeof(SvPlayer).GetField(nameof(player), BindingFlags.NonPublic | BindingFlags.Instance).GetValue(player); + if (shPlayer.IsRealPlayer()) { var thread1 = new Thread(new ParameterizedThreadStart(WriteIpToFile.Run)); @@ -84,7 +89,10 @@ public static void SvBan(SvPlayer player, ref int otherID) foreach (var shPlayer in UnityEngine.Object.FindObjectsOfType()) if (shPlayer.ID == otherID) if (shPlayer.IsRealPlayer() && !shPlayer.svPlayer.IsServerside()) + { + Debug.Log($"{SetTimeStamp.Run()}[INFO] {shPlayer.username} Got banned by {player.playerData.username}"); player.SendToAll(Channel.Unsequenced, ClPacket.GameMessage, $"{shPlayer.username} Just got banned by {player.playerData.username}"); + } } [Hook("SvPlayer.SvStartVote")] @@ -251,6 +259,7 @@ public static bool SvFunctionKey(SvPlayer player, ref byte key) else if (item.Key.LastMenu == CurrentMenu.ServerInfo) { player.SendToSelf(Channel.Reliable, ClPacket.CloseFunctionMenu); + var builder = new StringBuilder(); builder.Append("All admins on this server:\n\n"); foreach (var line in File.ReadAllLines("admin_list.txt")) @@ -322,6 +331,7 @@ public static bool SvFunctionKey(SvPlayer player, ref byte key) if (item.Key.LastMenu == CurrentMenu.Main) { var sb = new StringBuilder().Append("Staff menu:\n\n"); + if (HasPermission.Run(player, AccessMoneyMenu)) sb.Append("F2: Give Money\n"); if (HasPermission.Run(player, AccessItemMenu)) @@ -338,7 +348,6 @@ public static bool SvFunctionKey(SvPlayer player, ref byte key) break; } } - } return true; } @@ -352,7 +361,6 @@ public static bool SvFunctionKey(SvPlayer player, ref byte key) ErrorLogging.Run(ex); } return true; - } [Hook("SvPlayer.SvSuicide")] @@ -360,11 +368,12 @@ public static bool SvSuicide(SvPlayer player) { if (player.IsServerside()) return true; + var shPlayer = GetShBySv.Run(player); + if (shPlayer.IsDead()) return true; - shPlayer.ShDie(); player.SendToLocalAndSelf(Channel.Reliable, ClPacket.UpdateHealth, shPlayer.ID, shPlayer.health); return true; diff --git a/source/BP-Essentials/EssentialsVariables.cs b/source/BP-Essentials/EssentialsVariables.cs index 8760aa44..ba662400 100644 --- a/source/BP-Essentials/EssentialsVariables.cs +++ b/source/BP-Essentials/EssentialsVariables.cs @@ -7,7 +7,7 @@ namespace BP_Essentials { public class EssentialsVariablesPlugin : EssentialsCorePlugin { - public const string Version = "2.2.12"; + public const string Version = "2.2.13"; // Generic Constants public const string FileDirectory = "Essentials/";