diff --git a/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hook/hooks/HookASkyBlock.java b/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hook/hooks/HookASkyBlock.java index 689f072..f99ae2a 100644 --- a/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hook/hooks/HookASkyBlock.java +++ b/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hook/hooks/HookASkyBlock.java @@ -1,7 +1,7 @@ -package com.songoda.epicspawners.hook.hooks; +package com.songoda.epichoppers.hook.hooks; -import com.songoda.epicspawners.hook.HookType; -import com.songoda.epicspawners.hook.ProtectionPluginHook; +import com.songoda.epichoppers.hook.HookType; +import com.songoda.epichoppers.hook.ProtectionPluginHook; import com.wasteofplastic.askyblock.ASkyBlock; import com.wasteofplastic.askyblock.ASkyBlockAPI; import com.wasteofplastic.askyblock.Island; diff --git a/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hook/hooks/HookFactions.java b/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hook/hooks/HookFactions.java index 87a4296..aac5762 100644 --- a/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hook/hooks/HookFactions.java +++ b/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hook/hooks/HookFactions.java @@ -1,7 +1,7 @@ -package com.songoda.epicspawners.hook.hooks; +package com.songoda.epichoppers.hook.hooks; -import com.songoda.epicspawners.hook.HookType; -import com.songoda.epicspawners.hook.ProtectionPluginHook; +import com.songoda.epichoppers.hook.HookType; +import com.songoda.epichoppers.hook.ProtectionPluginHook; import me.markeh.factionsframework.FactionsFramework; import me.markeh.factionsframework.entities.FPlayer; import me.markeh.factionsframework.entities.FPlayers; diff --git a/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hook/hooks/HookGriefPrevention.java b/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hook/hooks/HookGriefPrevention.java index b0db7a9..d8e808f 100644 --- a/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hook/hooks/HookGriefPrevention.java +++ b/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hook/hooks/HookGriefPrevention.java @@ -1,7 +1,7 @@ -package com.songoda.epicspawners.hook.hooks; +package com.songoda.epichoppers.hook.hooks; -import com.songoda.epicspawners.hook.HookType; -import com.songoda.epicspawners.hook.ProtectionPluginHook; +import com.songoda.epichoppers.hook.HookType; +import com.songoda.epichoppers.hook.ProtectionPluginHook; import me.ryanhamshire.GriefPrevention.Claim; import me.ryanhamshire.GriefPrevention.GriefPrevention; import org.bukkit.Location; @@ -30,7 +30,7 @@ public class HookGriefPrevention implements ProtectionPluginHook { @Override public boolean canBuild(Player player, Location location) { Claim claim = griefPrevention.dataStore.getClaimAt(location, false, null); - return claim != null && claim.allowBuild(player, Material.MOB_SPAWNER) == null; + return claim != null && claim.allowBuild(player, Material.HOPPER) == null; } @Override diff --git a/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hook/hooks/HookKingdoms.java b/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hook/hooks/HookKingdoms.java index 82e64a5..b9801d8 100644 --- a/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hook/hooks/HookKingdoms.java +++ b/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hook/hooks/HookKingdoms.java @@ -1,7 +1,7 @@ -package com.songoda.epicspawners.hook.hooks; +package com.songoda.epichoppers.hook.hooks; -import com.songoda.epicspawners.hook.HookType; -import com.songoda.epicspawners.hook.ProtectionPluginHook; +import com.songoda.epichoppers.hook.HookType; +import com.songoda.epichoppers.hook.ProtectionPluginHook; import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; diff --git a/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hook/hooks/HookPlotSquared.java b/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hook/hooks/HookPlotSquared.java index 877f377..bc3a2e6 100644 --- a/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hook/hooks/HookPlotSquared.java +++ b/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hook/hooks/HookPlotSquared.java @@ -1,9 +1,10 @@ -package com.songoda.epicspawners.hook.hooks; +package com.songoda.epichoppers.hook.hooks; -import com.intellectualcrafters.plot.api.PlotAPI; -import com.plotsquared.bukkit.BukkitMain; -import com.songoda.epicspawners.hook.HookType; -import com.songoda.epicspawners.hook.ProtectionPluginHook; +import com.github.intellectualsites.plotsquared.api.PlotAPI; +import com.github.intellectualsites.plotsquared.bukkit.BukkitMain; +import com.github.intellectualsites.plotsquared.plot.object.Plot; +import com.songoda.epichoppers.hook.HookType; +import com.songoda.epichoppers.hook.ProtectionPluginHook; import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; @@ -28,13 +29,25 @@ public class HookPlotSquared implements ProtectionPluginHook { @Override public boolean canBuild(Player player, Location location) { - return plotSquared.getPlot(location) != null && plotSquared.isInPlot(player) - && plotSquared.getPlot(location) == plotSquared.getPlot(player); + com.github.intellectualsites.plotsquared.plot.object.Location plotLocation = + new com.github.intellectualsites.plotsquared.plot.object.Location(location.getWorld().getName(), + location.getBlockX(), location.getBlockY(), location.getBlockZ()); + + Plot plot = plotLocation.getPlot(); + + return plot != null + && plot.getOwners().contains(player.getUniqueId()) + && plot.getMembers().contains(player.getUniqueId()); } @Override public boolean isInClaim(Location location) { - return plotSquared.getPlot(location) != null; + com.github.intellectualsites.plotsquared.plot.object.Location plotLocation = + new com.github.intellectualsites.plotsquared.plot.object.Location(location.getWorld().getName(), + location.getBlockX(), location.getBlockY(), location.getBlockZ()); + + Plot plot = plotLocation.getPlot(); + return plot != null; } @Override diff --git a/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hook/hooks/HookRedProtect.java b/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hook/hooks/HookRedProtect.java index 05bf1c6..e4399de 100644 --- a/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hook/hooks/HookRedProtect.java +++ b/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hook/hooks/HookRedProtect.java @@ -1,10 +1,10 @@ -package com.songoda.epicspawners.hook.hooks; +package com.songoda.epichoppers.hook.hooks; import br.net.fabiozumbi12.RedProtect.Bukkit.API.RedProtectAPI; import br.net.fabiozumbi12.RedProtect.Bukkit.RedProtect; import br.net.fabiozumbi12.RedProtect.Bukkit.Region; -import com.songoda.epicspawners.hook.HookType; -import com.songoda.epicspawners.hook.ProtectionPluginHook; +import com.songoda.epichoppers.hook.HookType; +import com.songoda.epichoppers.hook.ProtectionPluginHook; import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; diff --git a/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hook/hooks/HookSkyBlockEarth.java b/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hook/hooks/HookSkyBlockEarth.java index 4647896..8ad5fdf 100644 --- a/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hook/hooks/HookSkyBlockEarth.java +++ b/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hook/hooks/HookSkyBlockEarth.java @@ -1,7 +1,7 @@ -package com.songoda.epicspawners.hook.hooks; +package com.songoda.epichoppers.hook.hooks; -import com.songoda.epicspawners.hook.HookType; -import com.songoda.epicspawners.hook.ProtectionPluginHook; +import com.songoda.epichoppers.hook.HookType; +import com.songoda.epichoppers.hook.ProtectionPluginHook; import me.goodandevil.skyblock.SkyBlock; import me.goodandevil.skyblock.island.Island; import org.bukkit.Location; diff --git a/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hook/hooks/HookTowny.java b/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hook/hooks/HookTowny.java index 82fe2e6..4cd7232 100644 --- a/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hook/hooks/HookTowny.java +++ b/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hook/hooks/HookTowny.java @@ -1,12 +1,12 @@ -package com.songoda.epicspawners.hook.hooks; +package com.songoda.epichoppers.hook.hooks; import com.palmergames.bukkit.towny.Towny; import com.palmergames.bukkit.towny.exceptions.NotRegisteredException; import com.palmergames.bukkit.towny.object.Resident; import com.palmergames.bukkit.towny.object.TownyUniverse; -import com.songoda.epicspawners.hook.HookType; -import com.songoda.epicspawners.hook.ProtectionPluginHook; -import com.songoda.epicspawners.utils.Debugger; +import com.songoda.epichoppers.hook.HookType; +import com.songoda.epichoppers.hook.ProtectionPluginHook; +import com.songoda.epichoppers.utils.Debugger; import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; diff --git a/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hook/hooks/HookUSkyBlock.java b/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hook/hooks/HookUSkyBlock.java index a35ebe2..32f8fab 100644 --- a/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hook/hooks/HookUSkyBlock.java +++ b/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hook/hooks/HookUSkyBlock.java @@ -1,7 +1,7 @@ -package com.songoda.epicspawners.hook.hooks; +package com.songoda.epichoppers.hook.hooks; -import com.songoda.epicspawners.hook.HookType; -import com.songoda.epicspawners.hook.ProtectionPluginHook; +import com.songoda.epichoppers.hook.HookType; +import com.songoda.epichoppers.hook.ProtectionPluginHook; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.entity.Player; diff --git a/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hook/hooks/HookWorldGuard.java b/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hook/hooks/HookWorldGuard.java index 454b57d..b808072 100644 --- a/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hook/hooks/HookWorldGuard.java +++ b/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hook/hooks/HookWorldGuard.java @@ -1,23 +1,28 @@ -package com.songoda.epicspawners.hook.hooks; +package com.songoda.epichoppers.hook.hooks; +import com.sk89q.worldedit.bukkit.BukkitAdapter; +import com.sk89q.worldguard.WorldGuard; import com.sk89q.worldguard.bukkit.WorldGuardPlugin; -import com.songoda.epicspawners.hook.HookType; -import com.songoda.epicspawners.hook.ProtectionPluginHook; +import com.sk89q.worldguard.protection.ApplicableRegionSet; +import com.sk89q.worldguard.protection.flags.Flags; +import com.sk89q.worldguard.protection.regions.RegionQuery; +import com.songoda.epichoppers.hook.HookType; +import com.songoda.epichoppers.hook.ProtectionPluginHook; import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; public class HookWorldGuard implements ProtectionPluginHook { - private final WorldGuardPlugin worldGuard; + private final WorldGuard worldGuard; public HookWorldGuard() { - this.worldGuard = WorldGuardPlugin.inst(); + this.worldGuard = WorldGuard.getInstance(); } @Override public JavaPlugin getPlugin() { - return worldGuard; + return WorldGuardPlugin.inst(); } @Override @@ -27,7 +32,9 @@ public class HookWorldGuard implements ProtectionPluginHook { @Override public boolean canBuild(Player player, Location location) { - return worldGuard.canBuild(player, location); + RegionQuery q = worldGuard.getPlatform().getRegionContainer().createQuery(); + ApplicableRegionSet ars = q.getApplicableRegions(BukkitAdapter.adapt(player.getLocation())); + return ars.testState(WorldGuardPlugin.inst().wrapPlayer(player), Flags.BUILD); } @Override