Skip to content

Commit 4753ec3

Browse files
Fix the bug where players were able to buy doors without enough money in their balance, so their balance went negative and they got the door (critical fix!)
1 parent 5f2b1ea commit 4753ec3

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

SellDoor/Commands/BuyDoorCommand.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,8 @@ public static void BuyDoor(UnturnedPlayer player, System.Action successCallback
6767

6868
if (balance < door.Price)
6969
{
70-
ThreadHelper.RunSynchronously(() =>
71-
{
72-
MessageHelper.Send(player, "BuyDoorCantAfford", door.PriceString);
73-
return;
74-
});
70+
MessageHelper.Send(player, "BuyDoorCantAfford", door.PriceString);
71+
return;
7572
}
7673

7774
UconomyHelper.IncreaseBalance(player.Id, -door.Price);

SellDoor/Helpers/MessageHelper.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,18 @@ public class MessageHelper
99

1010
public static void Send(IRocketPlayer player, string translationKey, params object[] placeholder)
1111
{
12-
UnturnedChat.Say(player, pluginInstance.Translate(translationKey, placeholder).Replace("{", "<").Replace("}", ">"), pluginInstance.MessageColor, true);
12+
ThreadHelper.RunSynchronously(() =>
13+
{
14+
UnturnedChat.Say(player, pluginInstance.Translate(translationKey, placeholder).Replace("{", "<").Replace("}", ">"), pluginInstance.MessageColor, true);
15+
});
1316
}
1417

1518
public static void Send(string translationKey, params object[] placeholder)
1619
{
17-
UnturnedChat.Say(pluginInstance.Translate(translationKey, placeholder).Replace("{", "<").Replace("}", ">"), pluginInstance.MessageColor, true);
20+
ThreadHelper.RunSynchronously(() =>
21+
{
22+
UnturnedChat.Say(pluginInstance.Translate(translationKey, placeholder).Replace("{", "<").Replace("}", ">"), pluginInstance.MessageColor, true);
23+
});
1824
}
1925
}
2026
}

SellDoor/SellDoor.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<TargetFramework>net48</TargetFramework>
55
<LangVersion>latest</LangVersion>
66
<RootNamespace>RestoreMonarchy.SellDoor</RootNamespace>
7-
<Version>3.2.0</Version>
7+
<Version>3.2.1</Version>
88
</PropertyGroup>
99

1010
<ItemGroup>

0 commit comments

Comments
 (0)