Allow check isSecure if the server uses more than one antigrief plugin.
Added support to redprotect.
This commit is contained in:
parent
1b822d1bde
commit
28ab22e305
BIN
libs/RedProtect.jar
Normal file
BIN
libs/RedProtect.jar
Normal file
Binary file not shown.
@ -4,6 +4,7 @@ import net.theprogrammersworld.herobrine.hooks.CustomItemsHook;
|
||||
import net.theprogrammersworld.herobrine.hooks.FactionsHook;
|
||||
import net.theprogrammersworld.herobrine.hooks.GriefPreventionHook;
|
||||
import net.theprogrammersworld.herobrine.hooks.PreciousStonesHook;
|
||||
import net.theprogrammersworld.herobrine.hooks.RedProtectHook;
|
||||
import net.theprogrammersworld.herobrine.hooks.ResidenceHook;
|
||||
import net.theprogrammersworld.herobrine.hooks.TownyHook;
|
||||
import net.theprogrammersworld.herobrine.hooks.WorldGuardHook;
|
||||
@ -19,6 +20,7 @@ public class Support {
|
||||
private boolean B_CustomItems = false;
|
||||
private boolean B_PreciousStones;
|
||||
private boolean B_Factions;
|
||||
private boolean B_RedProtect;
|
||||
private ResidenceHook ResidenceCore;
|
||||
private GriefPreventionHook GriefPreventionCore;
|
||||
private TownyHook TownyCore;
|
||||
@ -26,6 +28,7 @@ public class Support {
|
||||
private CustomItemsHook CustomItems = null;
|
||||
private PreciousStonesHook PreciousStones;
|
||||
private FactionsHook Factions;
|
||||
private RedProtectHook RedProtect;
|
||||
|
||||
public Support() {
|
||||
ResidenceCore = new ResidenceHook();
|
||||
@ -35,6 +38,7 @@ public class Support {
|
||||
WorldGuard = new WorldGuardHook();
|
||||
PreciousStones = new PreciousStonesHook();
|
||||
Factions = new FactionsHook();
|
||||
RedProtect = new RedProtectHook();
|
||||
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Herobrine.getPluginCore(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@ -66,7 +70,11 @@ public class Support {
|
||||
public boolean isFactions() {
|
||||
return B_Factions;
|
||||
}
|
||||
|
||||
|
||||
public boolean isRedProtect() {
|
||||
return B_RedProtect;
|
||||
}
|
||||
|
||||
public void CheckForPlugins() {
|
||||
if (ResidenceCore.Check()) {
|
||||
B_Residence = true;
|
||||
@ -92,6 +100,10 @@ public class Support {
|
||||
B_Factions = true;
|
||||
Herobrine.log.info("[Herobrine] Factions plugin detected on server");
|
||||
}
|
||||
if (RedProtect.Check()) {
|
||||
B_RedProtect = true;
|
||||
Herobrine.log.info("[Herobrine] RedProtect plugin detected on server");
|
||||
}
|
||||
if (this.CustomItems.Check()) {
|
||||
this.B_CustomItems = true;
|
||||
Herobrine.log.info("[Herobrine] Custom Items plugin detected on server");
|
||||
@ -100,22 +112,28 @@ public class Support {
|
||||
}
|
||||
|
||||
public boolean isSecuredArea(final Location loc) {
|
||||
if (B_Residence) {
|
||||
return ResidenceCore.isSecuredArea(loc);
|
||||
if (B_Residence && ResidenceCore.isSecuredArea(loc)) {
|
||||
return true;
|
||||
}
|
||||
if (B_GriefPrevention) {
|
||||
return GriefPreventionCore.isSecuredArea(loc);
|
||||
if (B_GriefPrevention && GriefPreventionCore.isSecuredArea(loc)) {
|
||||
return true;
|
||||
}
|
||||
if (B_Towny) {
|
||||
return TownyCore.isSecuredArea(loc);
|
||||
if (B_Towny && TownyCore.isSecuredArea(loc)) {
|
||||
return true;
|
||||
}
|
||||
if (B_WorldGuard) {
|
||||
return WorldGuard.isSecuredArea(loc);
|
||||
if (B_WorldGuard && WorldGuard.isSecuredArea(loc)) {
|
||||
return true;
|
||||
}
|
||||
if (B_PreciousStones) {
|
||||
return PreciousStones.isSecuredArea(loc);
|
||||
if (B_PreciousStones && PreciousStones.isSecuredArea(loc)) {
|
||||
return true;
|
||||
}
|
||||
return B_Factions && Factions.isSecuredArea(loc);
|
||||
if (B_Factions && Factions.isSecuredArea(loc)) {
|
||||
return true;
|
||||
}
|
||||
if (B_RedProtect && RedProtect.isSecuredArea(loc)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean checkBuild(final Location loc) {
|
||||
|
@ -0,0 +1,16 @@
|
||||
package net.theprogrammersworld.herobrine.hooks;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
|
||||
import br.net.fabiozumbi12.RedProtect.RedProtect;
|
||||
|
||||
public class RedProtectHook {
|
||||
public boolean Check() {
|
||||
return Bukkit.getServer().getPluginManager().getPlugin("RedProtect") != null;
|
||||
}
|
||||
|
||||
public boolean isSecuredArea(final Location loc) {
|
||||
return RedProtect.rm.getTopRegion(loc) != null;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user