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.FactionsHook;
|
||||||
import net.theprogrammersworld.herobrine.hooks.GriefPreventionHook;
|
import net.theprogrammersworld.herobrine.hooks.GriefPreventionHook;
|
||||||
import net.theprogrammersworld.herobrine.hooks.PreciousStonesHook;
|
import net.theprogrammersworld.herobrine.hooks.PreciousStonesHook;
|
||||||
|
import net.theprogrammersworld.herobrine.hooks.RedProtectHook;
|
||||||
import net.theprogrammersworld.herobrine.hooks.ResidenceHook;
|
import net.theprogrammersworld.herobrine.hooks.ResidenceHook;
|
||||||
import net.theprogrammersworld.herobrine.hooks.TownyHook;
|
import net.theprogrammersworld.herobrine.hooks.TownyHook;
|
||||||
import net.theprogrammersworld.herobrine.hooks.WorldGuardHook;
|
import net.theprogrammersworld.herobrine.hooks.WorldGuardHook;
|
||||||
@ -19,6 +20,7 @@ public class Support {
|
|||||||
private boolean B_CustomItems = false;
|
private boolean B_CustomItems = false;
|
||||||
private boolean B_PreciousStones;
|
private boolean B_PreciousStones;
|
||||||
private boolean B_Factions;
|
private boolean B_Factions;
|
||||||
|
private boolean B_RedProtect;
|
||||||
private ResidenceHook ResidenceCore;
|
private ResidenceHook ResidenceCore;
|
||||||
private GriefPreventionHook GriefPreventionCore;
|
private GriefPreventionHook GriefPreventionCore;
|
||||||
private TownyHook TownyCore;
|
private TownyHook TownyCore;
|
||||||
@ -26,6 +28,7 @@ public class Support {
|
|||||||
private CustomItemsHook CustomItems = null;
|
private CustomItemsHook CustomItems = null;
|
||||||
private PreciousStonesHook PreciousStones;
|
private PreciousStonesHook PreciousStones;
|
||||||
private FactionsHook Factions;
|
private FactionsHook Factions;
|
||||||
|
private RedProtectHook RedProtect;
|
||||||
|
|
||||||
public Support() {
|
public Support() {
|
||||||
ResidenceCore = new ResidenceHook();
|
ResidenceCore = new ResidenceHook();
|
||||||
@ -35,6 +38,7 @@ public class Support {
|
|||||||
WorldGuard = new WorldGuardHook();
|
WorldGuard = new WorldGuardHook();
|
||||||
PreciousStones = new PreciousStonesHook();
|
PreciousStones = new PreciousStonesHook();
|
||||||
Factions = new FactionsHook();
|
Factions = new FactionsHook();
|
||||||
|
RedProtect = new RedProtectHook();
|
||||||
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Herobrine.getPluginCore(), new Runnable() {
|
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Herobrine.getPluginCore(), new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@ -67,6 +71,10 @@ public class Support {
|
|||||||
return B_Factions;
|
return B_Factions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isRedProtect() {
|
||||||
|
return B_RedProtect;
|
||||||
|
}
|
||||||
|
|
||||||
public void CheckForPlugins() {
|
public void CheckForPlugins() {
|
||||||
if (ResidenceCore.Check()) {
|
if (ResidenceCore.Check()) {
|
||||||
B_Residence = true;
|
B_Residence = true;
|
||||||
@ -92,6 +100,10 @@ public class Support {
|
|||||||
B_Factions = true;
|
B_Factions = true;
|
||||||
Herobrine.log.info("[Herobrine] Factions plugin detected on server");
|
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()) {
|
if (this.CustomItems.Check()) {
|
||||||
this.B_CustomItems = true;
|
this.B_CustomItems = true;
|
||||||
Herobrine.log.info("[Herobrine] Custom Items plugin detected on server");
|
Herobrine.log.info("[Herobrine] Custom Items plugin detected on server");
|
||||||
@ -100,22 +112,28 @@ public class Support {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSecuredArea(final Location loc) {
|
public boolean isSecuredArea(final Location loc) {
|
||||||
if (B_Residence) {
|
if (B_Residence && ResidenceCore.isSecuredArea(loc)) {
|
||||||
return ResidenceCore.isSecuredArea(loc);
|
return true;
|
||||||
}
|
}
|
||||||
if (B_GriefPrevention) {
|
if (B_GriefPrevention && GriefPreventionCore.isSecuredArea(loc)) {
|
||||||
return GriefPreventionCore.isSecuredArea(loc);
|
return true;
|
||||||
}
|
}
|
||||||
if (B_Towny) {
|
if (B_Towny && TownyCore.isSecuredArea(loc)) {
|
||||||
return TownyCore.isSecuredArea(loc);
|
return true;
|
||||||
}
|
}
|
||||||
if (B_WorldGuard) {
|
if (B_WorldGuard && WorldGuard.isSecuredArea(loc)) {
|
||||||
return WorldGuard.isSecuredArea(loc);
|
return true;
|
||||||
}
|
}
|
||||||
if (B_PreciousStones) {
|
if (B_PreciousStones && PreciousStones.isSecuredArea(loc)) {
|
||||||
return 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) {
|
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