From 65c814df60a165040bcd012a35cd3798b103d033 Mon Sep 17 00:00:00 2001 From: r59q Date: Mon, 1 Jul 2024 20:21:38 +0200 Subject: [PATCH] Add territoryTruceDenyCommands --- src/main/java/com/massivecraft/factions/Conf.java | 1 + .../factions/listeners/FactionsPlayerListener.java | 5 +++++ src/main/java/com/massivecraft/factions/zcore/util/TL.java | 1 + 3 files changed, 7 insertions(+) diff --git a/src/main/java/com/massivecraft/factions/Conf.java b/src/main/java/com/massivecraft/factions/Conf.java index eb0e1e890..5189ecb8b 100644 --- a/src/main/java/com/massivecraft/factions/Conf.java +++ b/src/main/java/com/massivecraft/factions/Conf.java @@ -204,6 +204,7 @@ public class Conf { public static Set permanentFactionMemberDenyCommands = new LinkedHashSet<>(); // commands which will be prevented when in claimed territory of another faction public static Set territoryNeutralDenyCommands = new LinkedHashSet<>(); + public static Set territoryTruceDenyCommands = new LinkedHashSet<>(); public static Set territoryEnemyDenyCommands = new LinkedHashSet<>(); public static Set territoryAllyDenyCommands = new LinkedHashSet<>(); public static Set warzoneDenyCommands = new LinkedHashSet<>(); diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java index 27215109c..9b34b8141 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java @@ -262,6 +262,11 @@ public static boolean preventCommand(String fullCmd, Player player) { return true; } + if (at.isNormal() && rel.isTruce() && !Conf.territoryTruceDenyCommands.isEmpty() && !me.isAdminBypassing() && isCommandInList(fullCmd, shortCmd, Conf.territoryTruceDenyCommands.iterator())) { + me.msg(TL.PLAYER_COMMAND_TRUCE, fullCmd); + return true; + } + if (at.isNormal() && rel.isNeutral() && !Conf.territoryNeutralDenyCommands.isEmpty() && !me.isAdminBypassing() && isCommandInList(fullCmd, shortCmd, Conf.territoryNeutralDenyCommands.iterator())) { me.msg(TL.PLAYER_COMMAND_NEUTRAL, fullCmd); return true; diff --git a/src/main/java/com/massivecraft/factions/zcore/util/TL.java b/src/main/java/com/massivecraft/factions/zcore/util/TL.java index 9aa618bb6..17fcaaa19 100644 --- a/src/main/java/com/massivecraft/factions/zcore/util/TL.java +++ b/src/main/java/com/massivecraft/factions/zcore/util/TL.java @@ -1391,6 +1391,7 @@ public enum TL { PLAYER_COMMAND_ENEMY("You can't use the command '%s' in enemy territory."), PLAYER_COMMAND_PERMANENT("You can't use the command '%s' because you are in a permanent faction."), PLAYER_COMMAND_ALLY("You can't use the command '%s' in ally territory."), + PLAYER_COMMAND_TRUCE("You can't use the command '%s' in truce territory."), PLAYER_COMMAND_WILDERNESS("You can't use the command '%s' in the wilderness."), PLAYER_POWER_NOLOSS_PEACEFUL("You didn't lose any power since you are in a peaceful faction."),