Skip to content
This repository was archived by the owner on Nov 7, 2023. It is now read-only.

Commit 64d3b66

Browse files
committed
chore(SEconomy): remove SEconomy support
SEconomy support for /tradechest is temporarily removed.
1 parent cf25537 commit 64d3b66

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

Implementation/ChestManager.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,10 +268,12 @@ public void SetUpTradeChest(TSPlayer player, DPoint tileLocation, int sellAmount
268268

269269
bool isNewTradeChest = (protection.TradeChestData == null);
270270
if (isNewTradeChest && checkPermissions && this.CooperationHandler.IsSeconomyAvailable && !player.Group.HasPermission(ProtectorPlugin.FreeTradeChests_Permission)) {
271+
#if SEconomy
271272
if (this.CooperationHandler.Seconomy_GetBalance(player.Name) < this.Config.TradeChestPayment)
272273
throw new PaymentException(this.Config.TradeChestPayment);
273274

274275
this.CooperationHandler.Seconomy_TransferToWorld(player.Name, this.Config.TradeChestPayment, "Trade Chest", "Setup Price");
276+
#endif
275277
}
276278

277279
protection.TradeChestData = protection.TradeChestData ?? new TradeChestMetadata();

Implementation/PluginCooperationHandler.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@
1111

1212
using TShockAPI;
1313
using TShockAPI.DB;
14+
15+
#if SEconomy
1416
using Wolfje.Plugins.SEconomy;
1517
using Wolfje.Plugins.SEconomy.Journal;
18+
#endif // SEconomy
1619

1720
namespace Terraria.Plugins.CoderCow.Protector {
1821
public class PluginCooperationHandler {
@@ -276,6 +279,7 @@ public void InfiniteSigns_SignDataImport(
276279
#endregion
277280

278281
#region Seconomy
282+
#if SEconomy
279283
public Money Seconomy_GetBalance(string playerName) => this.Seconomy_Instance().GetPlayerBankAccount(playerName).Balance;
280284

281285
public void Seconomy_TransferToWorld(string playerName, Money amount, string journalMsg, string transactionMsg) {
@@ -297,6 +301,7 @@ private SEconomy Seconomy_Instance() {
297301

298302
return seconomy;
299303
}
304+
#endif // SEconomy
300305
#endregion
301306
}
302307
}

Implementation/UserInteractionHandler.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2051,8 +2051,10 @@ private void TradeChestCommand_Exec(CommandArgs args) {
20512051
};
20522052

20532053
string priceInfo = "";
2054+
#if SEconomy
20542055
if (this.PluginCooperationHandler.IsSeconomyAvailable && this.Config.TradeChestPayment > 0 && !args.Player.Group.HasPermission(ProtectorPlugin.FreeTradeChests_Permission))
20552056
priceInfo = $" This will cost you {this.Config.TradeChestPayment} {this.PluginCooperationHandler.Seconomy_MoneyName()}";
2057+
#endif
20562058

20572059
args.Player.SendInfoMessage("Open a chest to convert it into a trade chest." + priceInfo);
20582060
}
@@ -3866,9 +3868,11 @@ public bool TrySetUpTradeChest(TSPlayer player, DPoint tileLocation, int sellAmo
38663868
} catch (MissingPermissionException) {
38673869
if (sendMessages)
38683870
player.SendErrorMessage("You are not allowed to define trade chests.");
3871+
#if SEconomy
38693872
} catch (PaymentException ex) {
38703873
if (sendMessages)
38713874
player.SendErrorMessage("You don't have the necessary amount of {0} {1} to set up a trade chest!", ex.PaymentAmount, this.PluginCooperationHandler.Seconomy_MoneyName());
3875+
#endif
38723876
} catch (InvalidBlockTypeException) {
38733877
if (sendMessages)
38743878
player.SendErrorMessage("Only chests can be converted to trade chests.");

0 commit comments

Comments
 (0)