Skip to content

Commit 0db984e

Browse files
Added GriefPrevention support. Close #53
1 parent 8c10970 commit 0db984e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/me/crafter/mc/lockettepro/Dependency.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import org.bukkit.Bukkit;
77
import org.bukkit.Location;
8+
import org.bukkit.Material;
89
import org.bukkit.block.Block;
910
import org.bukkit.entity.Player;
1011
import org.bukkit.plugin.Plugin;
@@ -29,6 +30,8 @@
2930
import com.wasteofplastic.askyblock.ASkyBlockAPI;
3031
import com.wasteofplastic.askyblock.Island;
3132

33+
import me.ryanhamshire.GriefPrevention.Claim;
34+
import me.ryanhamshire.GriefPrevention.GriefPrevention;
3235
import net.milkbowl.vault.permission.Permission;
3336
import net.sacredlabyrinth.phaed.simpleclans.Clan;
3437
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
@@ -48,6 +51,7 @@ public class Dependency {
4851
protected static PlotAPI plotapi;
4952
protected static Plugin simpleclans = null;
5053
protected static ClanManager clanmanager = null;
54+
protected static Plugin griefprevention = null;
5155

5256
public Dependency(Plugin plugin){
5357
// WorldGuard
@@ -81,6 +85,8 @@ public Dependency(Plugin plugin){
8185
if (simpleclans != null){
8286
clanmanager = ((SimpleClans)simpleclans).getClanManager();
8387
}
88+
// GreifPrevention
89+
griefprevention = plugin.getServer().getPluginManager().getPlugin("GriefPrevention");
8490
}
8591

8692
@SuppressWarnings("deprecation")
@@ -160,6 +166,12 @@ public static boolean isProtectedFrom(Block block, Player player){
160166
if (simpleclans != null){
161167
// TODO or not todo
162168
}
169+
if (griefprevention != null){
170+
Claim claim = GriefPrevention.instance.dataStore.getClaimAt(block.getLocation(), false, null);
171+
if (claim != null){
172+
if (claim.allowBuild(player, Material.WALL_SIGN) != null) return true;
173+
}
174+
}
163175
return false;
164176
}
165177

0 commit comments

Comments
 (0)