Skip to content

Commit

Permalink
Added GriefPrevention support. Close #53
Browse files Browse the repository at this point in the history
  • Loading branch information
connection-lost committed Aug 11, 2017
1 parent 8c10970 commit 0db984e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/me/crafter/mc/lockettepro/Dependency.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
Expand All @@ -29,6 +30,8 @@
import com.wasteofplastic.askyblock.ASkyBlockAPI;
import com.wasteofplastic.askyblock.Island;

import me.ryanhamshire.GriefPrevention.Claim;
import me.ryanhamshire.GriefPrevention.GriefPrevention;
import net.milkbowl.vault.permission.Permission;
import net.sacredlabyrinth.phaed.simpleclans.Clan;
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
Expand All @@ -48,6 +51,7 @@ public class Dependency {
protected static PlotAPI plotapi;
protected static Plugin simpleclans = null;
protected static ClanManager clanmanager = null;
protected static Plugin griefprevention = null;

public Dependency(Plugin plugin){
// WorldGuard
Expand Down Expand Up @@ -81,6 +85,8 @@ public Dependency(Plugin plugin){
if (simpleclans != null){
clanmanager = ((SimpleClans)simpleclans).getClanManager();
}
// GreifPrevention
griefprevention = plugin.getServer().getPluginManager().getPlugin("GriefPrevention");
}

@SuppressWarnings("deprecation")
Expand Down Expand Up @@ -160,6 +166,12 @@ public static boolean isProtectedFrom(Block block, Player player){
if (simpleclans != null){
// TODO or not todo
}
if (griefprevention != null){
Claim claim = GriefPrevention.instance.dataStore.getClaimAt(block.getLocation(), false, null);
if (claim != null){
if (claim.allowBuild(player, Material.WALL_SIGN) != null) return true;
}
}
return false;
}

Expand Down

0 comments on commit 0db984e

Please sign in to comment.