Prevents removal of leashes

This commit is contained in:
Kristian Knarvik 2023-04-04 00:20:45 +02:00
parent bccb24b1e8
commit 8d7dea9f84
2 changed files with 7 additions and 5 deletions

View File

@ -560,7 +560,7 @@ public class MConf extends Entity<MConf> {
// PERMISSIONS // PERMISSIONS
// -------------------------------------------- // // -------------------------------------------- //
public Map<String, Set<String>> perm2default = MUtil.map( public final Map<String, Set<String>> perm2default = MUtil.map(
MPerm.ID_BUILD, MUtil.set("LEADER", "OFFICER", "MEMBER"), MPerm.ID_BUILD, MUtil.set("LEADER", "OFFICER", "MEMBER"),
MPerm.ID_PAINBUILD, MUtil.set(), MPerm.ID_PAINBUILD, MUtil.set(),
MPerm.ID_DOOR, MUtil.set("LEADER", "OFFICER", "MEMBER", "RECRUIT", "ALLY"), MPerm.ID_DOOR, MUtil.set("LEADER", "OFFICER", "MEMBER", "RECRUIT", "ALLY"),

View File

@ -3,6 +3,7 @@ package com.massivecraft.factions.util;
import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.entity.MConf;
import com.massivecraft.massivecore.collections.BackstringSet; import com.massivecraft.massivecore.collections.BackstringSet;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Tag;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
public class EnumerationUtil { public class EnumerationUtil {
@ -57,6 +58,7 @@ public class EnumerationUtil {
); );
public static boolean isMaterialEditOnInteract(Material material) { 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); return MATERIALS_EDIT_ON_INTERACT.contains(material) || MConf.get().materialsEditOnInteract.contains(material);
} }
@ -83,13 +85,12 @@ public class EnumerationUtil {
"SIGN_POST", // Minecraft 1.? "SIGN_POST", // Minecraft 1.?
"TRAPPED_CHEST", // Minecraft 1.? "TRAPPED_CHEST", // Minecraft 1.?
"SIGN", // Minecraft 1.? "SIGN", // Minecraft 1.?
"WOOD_DOOR", // Minecraft 1.?
"IRON_DOOR", // Minecraft 1.?
"BONE_MEAL" // Minecraft 1.? "BONE_MEAL" // Minecraft 1.?
); );
public static boolean isMaterialEditTool(Material material) { 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. // Interacting with these entities results in an edit.
public static final BackstringSet<EntityType> ENTITY_TYPES_EDIT_ON_INTERACT = new BackstringSet<>(EntityType.class, public static final BackstringSet<EntityType> ENTITY_TYPES_EDIT_ON_INTERACT = new BackstringSet<>(EntityType.class,
"ITEM_FRAME", // Minecraft 1.? "ITEM_FRAME", // Minecraft 1.?
"ARMOR_STAND" // Minecraft 1.8 "ARMOR_STAND", // Minecraft 1.8
"LEASH_HITCH"
); );
public static boolean isEntityTypeEditOnInteract(EntityType entityType) { public static boolean isEntityTypeEditOnInteract(EntityType entityType) {