From 8d7dea9f84965246169d873ca9d2f9a3a5aa6740 Mon Sep 17 00:00:00 2001 From: EpicKnarvik97 Date: Tue, 4 Apr 2023 00:20:45 +0200 Subject: [PATCH] Prevents removal of leashes --- .../java/com/massivecraft/factions/entity/MConf.java | 2 +- .../massivecraft/factions/util/EnumerationUtil.java | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/massivecraft/factions/entity/MConf.java b/src/main/java/com/massivecraft/factions/entity/MConf.java index 39b6504a..50b16bdd 100644 --- a/src/main/java/com/massivecraft/factions/entity/MConf.java +++ b/src/main/java/com/massivecraft/factions/entity/MConf.java @@ -560,7 +560,7 @@ public class MConf extends Entity { // PERMISSIONS // -------------------------------------------- // - public Map> perm2default = MUtil.map( + public final Map> perm2default = MUtil.map( MPerm.ID_BUILD, MUtil.set("LEADER", "OFFICER", "MEMBER"), MPerm.ID_PAINBUILD, MUtil.set(), MPerm.ID_DOOR, MUtil.set("LEADER", "OFFICER", "MEMBER", "RECRUIT", "ALLY"), diff --git a/src/main/java/com/massivecraft/factions/util/EnumerationUtil.java b/src/main/java/com/massivecraft/factions/util/EnumerationUtil.java index 9e4da23e..ba7e5b79 100644 --- a/src/main/java/com/massivecraft/factions/util/EnumerationUtil.java +++ b/src/main/java/com/massivecraft/factions/util/EnumerationUtil.java @@ -3,6 +3,7 @@ package com.massivecraft.factions.util; import com.massivecraft.factions.entity.MConf; import com.massivecraft.massivecore.collections.BackstringSet; import org.bukkit.Material; +import org.bukkit.Tag; import org.bukkit.entity.EntityType; public class EnumerationUtil { @@ -57,6 +58,7 @@ public class EnumerationUtil { ); public static boolean isMaterialEditOnInteract(Material material) { + // Note: As fences may be used to hitch horses, interaction may cause an edit return MATERIALS_EDIT_ON_INTERACT.contains(material) || MConf.get().materialsEditOnInteract.contains(material); } @@ -83,13 +85,12 @@ public class EnumerationUtil { "SIGN_POST", // Minecraft 1.? "TRAPPED_CHEST", // Minecraft 1.? "SIGN", // Minecraft 1.? - "WOOD_DOOR", // Minecraft 1.? - "IRON_DOOR", // Minecraft 1.? "BONE_MEAL" // Minecraft 1.? ); public static boolean isMaterialEditTool(Material material) { - return MATERIALS_EDIT_TOOL.contains(material) || MConf.get().materialsEditTools.contains(material); + return MATERIALS_EDIT_TOOL.contains(material) || Tag.DOORS.isTagged(material) || + MConf.get().materialsEditTools.contains(material); } // -------------------------------------------- // @@ -185,7 +186,8 @@ public class EnumerationUtil { // Interacting with these entities results in an edit. public static final BackstringSet ENTITY_TYPES_EDIT_ON_INTERACT = new BackstringSet<>(EntityType.class, "ITEM_FRAME", // Minecraft 1.? - "ARMOR_STAND" // Minecraft 1.8 + "ARMOR_STAND", // Minecraft 1.8 + "LEASH_HITCH" ); public static boolean isEntityTypeEditOnInteract(EntityType entityType) {