WorldGuard integration - UNTESTED

master
Auke Kok 2013-12-13 11:11:15 -08:00
parent 5e5c726ba0
commit 9ac2ed31e5
2 changed files with 22 additions and 3 deletions

View File

@ -1,7 +1,7 @@
name: Sedimentology
main: org.foo_projects.sofar.Sedimentology.Sedimentology
version: 6
softdepend: [Factions, Towny]
softdepend: [Factions, Towny, WorldGuard]
commands:
sedimentology:
aliases: sed

View File

@ -34,6 +34,9 @@ import com.massivecraft.mcore.ps.PS;
import com.palmergames.bukkit.towny.Towny;
import com.palmergames.bukkit.towny.object.TownyUniverse;
import com.sk89q.worldguard.bukkit.WGBukkit;
import com.sk89q.worldguard.protection.ApplicableRegionSet;
/*
* Sedimentology concepts
*
@ -89,6 +92,7 @@ public final class Sedimentology extends JavaPlugin {
private boolean have_factions = false;
private boolean have_towny = false;
private boolean have_worldguard = false;
private Object towny_universe = null;
@ -297,6 +301,10 @@ public final class Sedimentology extends JavaPlugin {
if (((TownyUniverse)towny_universe).getTownBlock(block.getLocation()) != null)
return true;
}
if (have_worldguard) {
ApplicableRegionSet set = WGBukkit.getRegionManager(block.getWorld()).getApplicableRegions(block.getLocation());
return (set.size() > 0);
}
return false;
}
@ -1080,7 +1088,8 @@ displace:
/* Detect Factions */
if (org.bukkit.Bukkit.getPluginManager().isPluginEnabled("Factions"))
have_factions = true;
getLogger().info("Factions support is " + (have_factions ? "enabled" : "disabled"));
/* Towny */
if (org.bukkit.Bukkit.getPluginManager().isPluginEnabled("Towny")) {
Plugin p = org.bukkit.Bukkit.getPluginManager().getPlugin("Towny");
if (p != null) {
@ -1088,7 +1097,17 @@ displace:
have_towny = true;
}
}
getLogger().info("Towny support is " + (have_towny ? "enabled" : "disabled"));
/* WorldGuard */
if (org.bukkit.Bukkit.getPluginManager().isPluginEnabled("WorldGuard"))
have_worldguard = true;
getLogger().info("Protection plugins: " +
(have_factions ? "+" : "-") + "Factions, " +
(have_towny ? "+" : "-") + "Towny, " +
(have_worldguard ? "+" : "-") + "WorldGuard, "
);
conf_protect = getConfig().getBoolean("protect");
getLogger().info("protection is " + (conf_protect ? "on" : "off"));