mirror of
https://github.com/amalthea-mc/ShopChest.git
synced 2024-11-08 19:51:05 +00:00
Improved support for GriefPrevention
Now checks if the claim where the shop is located allows container access for the player. If there is no claim, shop creation is allowed (except it has been denied by other plugins)
This commit is contained in:
parent
0f4f421f76
commit
d44e30b625
@ -20,6 +20,7 @@ import de.epiceric.shopchest.shop.Shop;
|
||||
import de.epiceric.shopchest.utils.Permissions;
|
||||
import de.epiceric.shopchest.utils.ShopUtils;
|
||||
import de.epiceric.shopchest.utils.Utils;
|
||||
import me.ryanhamshire.GriefPrevention.Claim;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@ -212,7 +213,10 @@ public class ChestProtectListener implements Listener {
|
||||
}
|
||||
|
||||
if (externalPluginsAllowed && plugin.hasGriefPrevention() && config.enable_griefprevention_integration) {
|
||||
externalPluginsAllowed &= plugin.getGriefPrevention().allowBuild(p, b.getLocation()) == null;
|
||||
Claim claim = plugin.getGriefPrevention().dataStore.getClaimAt(b.getLocation(), false, null);
|
||||
if (claim != null) {
|
||||
externalPluginsAllowed &= claim.allowContainers(p) == null;
|
||||
}
|
||||
}
|
||||
|
||||
if (externalPluginsAllowed || p.hasPermission(Permissions.EXTEND_PROTECTED)) {
|
||||
|
@ -30,6 +30,7 @@ import de.epiceric.shopchest.utils.Permissions;
|
||||
import de.epiceric.shopchest.utils.ShopUtils;
|
||||
import de.epiceric.shopchest.utils.Utils;
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import me.ryanhamshire.GriefPrevention.Claim;
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
import net.milkbowl.vault.economy.EconomyResponse;
|
||||
import org.bukkit.Bukkit;
|
||||
@ -231,11 +232,15 @@ public class ShopInteractListener implements Listener {
|
||||
|
||||
if (externalPluginsAllowed && plugin.hasGriefPrevention() && config.enable_griefprevention_integration) {
|
||||
plugin.debug("Checking if GriefPrevention allows shop creation...");
|
||||
String gpDenyReason = "";
|
||||
String gpDenyReason = null;
|
||||
for (Location loc : chestLocations) {
|
||||
if (loc != null) {
|
||||
gpDenyReason = plugin.getGriefPrevention().allowBuild(p, loc);
|
||||
externalPluginsAllowed &= gpDenyReason == null;
|
||||
Claim claim = plugin.getGriefPrevention().dataStore.getClaimAt(loc, false, null);
|
||||
if (claim != null) {
|
||||
plugin.debug("Checking if claim allows container access");
|
||||
gpDenyReason = claim.allowContainers(p);
|
||||
externalPluginsAllowed &= gpDenyReason == null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user