diff --git a/RandomTeleport v1.0/pom.xml b/RandomTeleport v1.0/pom.xml
index d3f5e16..58096e3 100644
--- a/RandomTeleport v1.0/pom.xml
+++ b/RandomTeleport v1.0/pom.xml
@@ -28,6 +28,11 @@
bukkit
1.8-R0.1-SNAPSHOT
+
+ de.themoep
+ ClanControl
+ 1.0-SNAPSHOT
+
diff --git a/RandomTeleport v1.0/src/main/java/de/themoep/bukkit/plugin/RandomTeleport/RandomTeleport.java b/RandomTeleport v1.0/src/main/java/de/themoep/bukkit/plugin/RandomTeleport/RandomTeleport.java
index c808636..b090016 100644
--- a/RandomTeleport v1.0/src/main/java/de/themoep/bukkit/plugin/RandomTeleport/RandomTeleport.java
+++ b/RandomTeleport v1.0/src/main/java/de/themoep/bukkit/plugin/RandomTeleport/RandomTeleport.java
@@ -1,6 +1,9 @@
package de.themoep.bukkit.plugin.RandomTeleport;
import de.themoep.bukkit.plugin.RandomTeleport.Listeners.SignListener;
+import de.themoep.clancontrol.ClanControl;
+import de.themoep.clancontrol.Region;
+import de.themoep.clancontrol.RegionStatus;
import org.bukkit.*;
import org.bukkit.World.Environment;
import org.bukkit.block.Biome;
@@ -40,6 +43,7 @@ public class RandomTeleport extends JavaPlugin implements CommandExecutor {
public int factionsApiVersion = 0;
public boolean worldguard = false;
+ public boolean clancontrol = false;
@SuppressWarnings("unchecked")
@@ -61,6 +65,11 @@ public class RandomTeleport extends JavaPlugin implements CommandExecutor {
worldguard = true;
}
+ if(Bukkit.getPluginManager().getPlugin("ClanControl") != null){
+ getLogger().log(Level.INFO, "Detected ClanControl.");
+ clancontrol = true;
+ }
+
if(Bukkit.getPluginManager().getPlugin("Factions") != null){
String version = Bukkit.getPluginManager().getPlugin("Factions").getDescription().getVersion();
if(version.startsWith("2.7") || version.startsWith("2.8") || version.startsWith("2.9") || version.startsWith("2.10")) {
@@ -574,22 +583,34 @@ public class RandomTeleport extends JavaPlugin implements CommandExecutor {
private boolean checkforRegion(Player player, Location location, Boolean forceRegions) {
if(!forceRegions) {
Block block = location.getWorld().getBlockAt(location);
- if (worldguard && !com.sk89q.worldguard.bukkit.WGBukkit.getPlugin().canBuild(player, block)) {
+ if(worldguard && !com.sk89q.worldguard.bukkit.WGBukkit.getPlugin().canBuild(player, block)) {
return false;
}
-
- if (factionsApiVersion == 27) {
- com.massivecraft.factions.entity.Faction faction = com.massivecraft.factions.entity.BoardColl.get().getFactionAt(com.massivecraft.massivecore.ps.PS.valueOf(block));
- if (faction != com.massivecraft.factions.entity.FactionColl.get().getNone()) return false;
- }
- if (factionsApiVersion == 26) {
- com.massivecraft.factions.entity.Faction faction = com.massivecraft.factions.entity.BoardColls.get().getFactionAt(com.massivecraft.massivecore.ps.PS.valueOf(block));
- if (faction != com.massivecraft.factions.entity.FactionColls.get().getForWorld(location.getWorld().getName()).getNone())
+
+ if(clancontrol) {
+ boolean chunkOccupied = ClanControl.getInstance().getRegionManager().getChunk(location) != null;
+ Region region = ClanControl.getInstance().getRegionManager().getRegion(location);
+ if(chunkOccupied || (region != null && region.getStatus() != RegionStatus.FREE)) {
return false;
+ }
}
- if (factionsApiVersion == 16) {
+ if(factionsApiVersion == 27) {
+ com.massivecraft.factions.entity.Faction faction = com.massivecraft.factions.entity.BoardColl.get().getFactionAt(com.massivecraft.massivecore.ps.PS.valueOf(block));
+ if(faction != com.massivecraft.factions.entity.FactionColl.get().getNone()) {
+ return false;
+ }
+ }
+ if(factionsApiVersion == 26) {
+ com.massivecraft.factions.entity.Faction faction = com.massivecraft.factions.entity.BoardColls.get().getFactionAt(com.massivecraft.massivecore.ps.PS.valueOf(block));
+ if(faction != com.massivecraft.factions.entity.FactionColls.get().getForWorld(location.getWorld().getName()).getNone()) {
+ return false;
+ }
+ }
+ if(factionsApiVersion == 16) {
com.massivecraft.factions.Faction faction = com.massivecraft.factions.Board.getInstance().getFactionAt(new com.massivecraft.factions.FLocation(location));
- if (faction != com.massivecraft.factions.Factions.getInstance().getNone()) return false;
+ if(faction != com.massivecraft.factions.Factions.getInstance().getNone()) {
+ return false;
+ }
}
}
return true;