diff --git a/pom.xml b/pom.xml index d2e83c6..1bbed56 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ me.bestemor.villagermarket VillagerMarket - 1.12.0-SNAPSHOT + 1.12.1-SNAPSHOT diff --git a/src/main/java/net/bestemor/villagermarket/shop/PlayerShop.java b/src/main/java/net/bestemor/villagermarket/shop/PlayerShop.java index 111cc5b..76d9353 100644 --- a/src/main/java/net/bestemor/villagermarket/shop/PlayerShop.java +++ b/src/main/java/net/bestemor/villagermarket/shop/PlayerShop.java @@ -1,5 +1,8 @@ package net.bestemor.villagermarket.shop; +import me.angeschossen.lands.api.LandsIntegration; +import me.angeschossen.lands.api.flags.type.Flags; +import me.angeschossen.lands.api.land.LandWorld; import net.bestemor.core.config.ConfigManager; import net.bestemor.core.config.CurrencyBuilder; import net.bestemor.core.config.VersionUtils; @@ -438,7 +441,25 @@ public void removeTrusted(Player player) { } /** Returns true if player is trusted, false if not */ public boolean isTrusted(Player player) { - return trustedPlayers.contains(player.getUniqueId().toString()); + if (trustedPlayers.contains(player.getUniqueId().toString())) { + // If the player is manually trusted, skip the rest of the checks + return true; + } + + //Lands check (Add players as trusted if they have interact container flag) + if (Bukkit.getPluginManager().isPluginEnabled("Lands") && ConfigManager.getBoolean("lands")) { + LandsIntegration api = LandsIntegration.of(plugin); + Entity villager = VMUtils.getEntity(entityUUID); + if (villager == null) { + return false; + } + Location location = villager.getLocation(); + LandWorld world = api.getWorld(villager.getWorld()); + + return world != null && world.hasRoleFlag(player.getUniqueId(), location, Flags.INTERACT_CONTAINER); + } + + return false; } public boolean isDisableNotifications() { diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index b4ff123..cece202 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,6 +1,6 @@ name: VillagerMarket main: net.bestemor.villagermarket.VMPlugin -version: 1.12.0 +version: 1.12.1 author: Bestem0r description: A plugin made by Bestem0r to create Villager Shops