Skip to content

Commit

Permalink
Update to game version 0.78a
Browse files Browse the repository at this point in the history
* Fixed a bug with selling your apartment
* Logs bans in console now
  • Loading branch information
UserR00T committed May 17, 2018
1 parent 7fbbb90 commit a083b10
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
3 changes: 2 additions & 1 deletion source/BP-Essentials/Chat/Commands/Everyone/Confirm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class Confirm : EssentialsChatPlugin
public static bool Run(object oPlayer)
{
var player = (SvPlayer)oPlayer;

foreach (var shPlayer in UnityEngine.Object.FindObjectsOfType<ShPlayer>())
if (shPlayer.svPlayer == player && shPlayer.IsRealPlayer())
if (shPlayer.ownedApartment)
Expand All @@ -26,4 +27,4 @@ public static bool Run(object oPlayer)
return true;
}
}
}
}
17 changes: 13 additions & 4 deletions source/BP-Essentials/EssentialsMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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, $"<color={warningColor}>Are you sure you want to sell your apartment? Type '</color><color={argColor}>{CmdConfirm}</color><color={warningColor}>' to confirm.</color>");
return true;
}
Expand All @@ -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));
Expand Down Expand Up @@ -84,7 +89,10 @@ public static void SvBan(SvPlayer player, ref int otherID)
foreach (var shPlayer in UnityEngine.Object.FindObjectsOfType<ShPlayer>())
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, $"<color={argColor}>{shPlayer.username}</color> <color={warningColor}>Just got banned by</color> <color={argColor}>{player.playerData.username}</color>");
}
}

[Hook("SvPlayer.SvStartVote")]
Expand Down Expand Up @@ -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"))
Expand Down Expand Up @@ -322,6 +331,7 @@ public static bool SvFunctionKey(SvPlayer player, ref byte key)
if (item.Key.LastMenu == CurrentMenu.Main)
{
var sb = new StringBuilder().Append("<color=#00ffffff>Staff menu:</color>\n\n");

if (HasPermission.Run(player, AccessMoneyMenu))
sb.Append("<color=#00ffffff>F2:</color> Give Money\n");
if (HasPermission.Run(player, AccessItemMenu))
Expand All @@ -338,7 +348,6 @@ public static bool SvFunctionKey(SvPlayer player, ref byte key)
break;
}
}

}
return true;
}
Expand All @@ -352,19 +361,19 @@ public static bool SvFunctionKey(SvPlayer player, ref byte key)
ErrorLogging.Run(ex);
}
return true;

}

[Hook("SvPlayer.SvSuicide")]
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;
Expand Down
2 changes: 1 addition & 1 deletion source/BP-Essentials/EssentialsVariables.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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/";
Expand Down

0 comments on commit a083b10

Please sign in to comment.