From 473e7dff1a043dfd85eeb1aaa77ca81b6cd1bb7e Mon Sep 17 00:00:00 2001 From: test Date: Fri, 10 May 2024 20:57:02 +1000 Subject: [PATCH] t --- .../commands/manager/v2/impl/pw/commands/BankCommands.java | 6 +++--- .../link/locutus/discord/db/guild/SendInternalTask.java | 3 ++- .../locutus/discord/util/offshore/OffshoreInstance.java | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/link/locutus/discord/commands/manager/v2/impl/pw/commands/BankCommands.java b/src/main/java/link/locutus/discord/commands/manager/v2/impl/pw/commands/BankCommands.java index 7851eae4..6d73a916 100644 --- a/src/main/java/link/locutus/discord/commands/manager/v2/impl/pw/commands/BankCommands.java +++ b/src/main/java/link/locutus/discord/commands/manager/v2/impl/pw/commands/BankCommands.java @@ -3463,7 +3463,7 @@ public String send(@Me IMessageIO channel, @Me JSONObject command, @Me GuildDB s @Default DBAlliance sender_alliance, @Switch("f") boolean force) throws IOException { - if (OffshoreInstance.DISABLE_TRANSFERS) throw new IllegalArgumentException("Error: Maintenance"); + if (OffshoreInstance.DISABLE_TRANSFERS && user.getIdLong() != Settings.INSTANCE.ADMIN_USER_ID) throw new IllegalArgumentException("Error: Maintenance"); return sendAA(channel, command, senderDB, user, me, amount, receiver_account, receiver_nation, sender_alliance, me, force); } @@ -3495,8 +3495,8 @@ public String sendAA(@Me IMessageIO channel, @Me JSONObject command, @Me GuildDB "Defaults to your nation", group = 2) @Default DBNation sender_nation, @Switch("f") boolean force) throws IOException { - if (me.getId() != Settings.INSTANCE.NATION_ID) return "WIP"; - if (OffshoreInstance.DISABLE_TRANSFERS) throw new IllegalArgumentException("Error: Maintenance"); + if (user.getIdLong() != Settings.INSTANCE.ADMIN_USER_ID) return "WIP"; + if (OffshoreInstance.DISABLE_TRANSFERS && user.getIdLong() != Settings.INSTANCE.ADMIN_USER_ID) throw new IllegalArgumentException("Error: Maintenance"); if (sender_alliance != null && !senderDB.isAllianceId(sender_alliance.getId())) { throw new IllegalArgumentException("Sender alliance is not in this guild"); } diff --git a/src/main/java/link/locutus/discord/db/guild/SendInternalTask.java b/src/main/java/link/locutus/discord/db/guild/SendInternalTask.java index 9c31c2ee..53010ad7 100644 --- a/src/main/java/link/locutus/discord/db/guild/SendInternalTask.java +++ b/src/main/java/link/locutus/discord/db/guild/SendInternalTask.java @@ -5,6 +5,7 @@ import link.locutus.discord.apiv1.enums.ResourceType; import link.locutus.discord.commands.manager.v2.binding.annotation.Me; import link.locutus.discord.commands.manager.v2.impl.pw.refs.CM; +import link.locutus.discord.config.Settings; import link.locutus.discord.db.GuildDB; import link.locutus.discord.db.entities.DBAlliance; import link.locutus.discord.db.entities.DBNation; @@ -52,7 +53,7 @@ public class SendInternalTask { private final OffshoreInstance receiverOffshore; public SendInternalTask(@Me User banker, @Me DBNation bankerNation, GuildDB senderDB, DBAlliance senderAlliance, DBNation senderNation, GuildDB receiverDB, DBAlliance receiverAlliance, DBNation receiverNation, double[] amount) throws IOException { - if (OffshoreInstance.DISABLE_TRANSFERS) throw new IllegalArgumentException("Error: Maintenance"); + if (OffshoreInstance.DISABLE_TRANSFERS && banker.getIdLong() != Settings.INSTANCE.ADMIN_USER_ID) throw new IllegalArgumentException("Error: Maintenance"); checkNotNull(bankerNation, "No banker specified. Register with " + CM.register.cmd.toSlashMention()); checkArgsNotNull(senderDB, senderAlliance, senderNation, receiverDB, receiverAlliance, receiverNation); checkNonNegative(amount); diff --git a/src/main/java/link/locutus/discord/util/offshore/OffshoreInstance.java b/src/main/java/link/locutus/discord/util/offshore/OffshoreInstance.java index 525bd494..af9a2e58 100644 --- a/src/main/java/link/locutus/discord/util/offshore/OffshoreInstance.java +++ b/src/main/java/link/locutus/discord/util/offshore/OffshoreInstance.java @@ -72,7 +72,7 @@ public class OffshoreInstance { public static final ConcurrentHashMap NATION_LOCKS = new ConcurrentHashMap<>(); public static final ConcurrentHashMap FROZEN_ESCROW = new ConcurrentHashMap<>(); - public static final boolean DISABLE_TRANSFERS = false; + public static final boolean DISABLE_TRANSFERS = true; private final int allianceId; private GuildDB guildDBCached;