From d2bcc6dd356f7d0beb863bd5c92916f6381fe8d3 Mon Sep 17 00:00:00 2001 From: IronApollo Date: Wed, 26 Feb 2020 10:17:11 -0500 Subject: [PATCH] Fix #346 , minor hook changes - Removed deprecated FaweMaskManager#getMask(Player) - Removed deprecated constructor FaweMask(BlockVector3, BlockVector3) --- .../fawe/bukkit/regions/FreeBuildRegion.java | 2 +- .../bukkit/regions/GriefPreventionFeature.java | 3 ++- .../fawe/bukkit/regions/ResidenceFeature.java | 3 ++- .../fawe/bukkit/regions/TownyFeature.java | 17 +++++++---------- .../boydti/fawe/bukkit/regions/Worldguard.java | 2 +- .../java/com/boydti/fawe/regions/FaweMask.java | 5 ----- .../boydti/fawe/regions/FaweMaskManager.java | 9 +-------- 7 files changed, 14 insertions(+), 27 deletions(-) diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/regions/FreeBuildRegion.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/regions/FreeBuildRegion.java index 6d9c78668..aeb6ffb9f 100644 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/regions/FreeBuildRegion.java +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/regions/FreeBuildRegion.java @@ -57,7 +57,7 @@ public class FreeBuildRegion extends BukkitMaskManager { AsyncBlock block = new AsyncBlock(asyncWorld, 0, 0, 0); BlockBreakEvent event = new BlockBreakEvent(block, ((BukkitPlayer) player).getPlayer()); - return new FaweMask(pos1, pos2) { + return new FaweMask(new CuboidRegion(pos1, pos2)) { @Override public boolean isValid(Player player, MaskType type) { diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/regions/GriefPreventionFeature.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/regions/GriefPreventionFeature.java index 1dd4b7a0d..0371ec6cd 100644 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/regions/GriefPreventionFeature.java +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/regions/GriefPreventionFeature.java @@ -5,6 +5,7 @@ import com.boydti.fawe.regions.FaweMask; import com.boydti.fawe.regions.general.RegionFilter; import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.regions.CuboidRegion; import me.ryanhamshire.GriefPrevention.Claim; import me.ryanhamshire.GriefPrevention.GriefPrevention; import org.bukkit.Bukkit; @@ -33,7 +34,7 @@ public class GriefPreventionFeature extends BukkitMaskManager implements Listene claim.getGreaterBoundaryCorner().getBlockX(); final BlockVector3 pos1 = BlockVector3.at(claim.getLesserBoundaryCorner().getBlockX(), 0, claim.getLesserBoundaryCorner().getBlockZ()); final BlockVector3 pos2 = BlockVector3.at(claim.getGreaterBoundaryCorner().getBlockX(), 256, claim.getGreaterBoundaryCorner().getBlockZ()); - return new FaweMask(pos1, pos2) { + return new FaweMask(new CuboidRegion(pos1, pos2)) { @Override public boolean isValid(com.sk89q.worldedit.entity.Player wePlayer, MaskType type) { diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/regions/ResidenceFeature.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/regions/ResidenceFeature.java index 0bb3811a0..c20f7ca43 100644 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/regions/ResidenceFeature.java +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/regions/ResidenceFeature.java @@ -6,6 +6,7 @@ import com.bekvon.bukkit.residence.protection.CuboidArea; import com.boydti.fawe.bukkit.FaweBukkit; import com.boydti.fawe.regions.FaweMask; import com.sk89q.worldedit.bukkit.BukkitAdapter; +import com.sk89q.worldedit.regions.CuboidRegion; import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.event.Listener; @@ -41,7 +42,7 @@ public class ResidenceFeature extends BukkitMaskManager implements Listener { final Location pos1 = area.getLowLoc(); final Location pos2 = area.getHighLoc(); final ClaimedResidence finalResidence = residence; - return new FaweMask(BukkitAdapter.asBlockVector(pos1), BukkitAdapter.asBlockVector(pos2)) { + return new FaweMask(new CuboidRegion(BukkitAdapter.asBlockVector(pos1), BukkitAdapter.asBlockVector(pos2))) { @Override public boolean isValid(com.sk89q.worldedit.entity.Player player, MaskType type) { return isAllowed(BukkitAdapter.adapt(player), finalResidence, type); diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/regions/TownyFeature.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/regions/TownyFeature.java index 4ae7ff7e7..3cb636bee 100644 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/regions/TownyFeature.java +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/regions/TownyFeature.java @@ -11,6 +11,7 @@ import com.palmergames.bukkit.towny.object.TownyUniverse; import com.palmergames.bukkit.towny.object.WorldCoord; import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.regions.CuboidRegion; import org.bukkit.Chunk; import org.bukkit.Location; import org.bukkit.entity.Player; @@ -37,8 +38,7 @@ public class TownyFeature extends BukkitMaskManager implements Listener { if (block.getResident().equals(resident)) { return true; } - } catch (NotRegisteredException ignore) { - } + } catch (NotRegisteredException ignore) {} Town town = block.getTown(); if (town.isMayor(resident)) { return true; @@ -54,14 +54,12 @@ public class TownyFeature extends BukkitMaskManager implements Listener { return true; } } - } catch (NotRegisteredException e) { - return false; - } + } catch (NotRegisteredException ignore) {} return false; } @Override - public FaweMask getMask(com.sk89q.worldedit.entity.Player wePlayer) { + public FaweMask getMask(final com.sk89q.worldedit.entity.Player wePlayer, MaskType type) { final Player player = BukkitAdapter.adapt(wePlayer); final Location location = player.getLocation(); try { @@ -82,15 +80,14 @@ public class TownyFeature extends BukkitMaskManager implements Listener { final BlockVector3 pos2 = BlockVector3.at( chunk.getX() * 16 + 15, 156, chunk.getZ() * 16 + 15); - return new FaweMask(pos1, pos2) { + return new FaweMask(new CuboidRegion(pos1, pos2)) { @Override public boolean isValid(com.sk89q.worldedit.entity.Player player, MaskType type) { - return isAllowed(BukkitAdapter.adapt(player),myplot); + return isAllowed(BukkitAdapter.adapt(player), myplot); } }; } - } catch (Exception ignored) { - } + } catch (Exception ignored) {} return null; } } diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/regions/Worldguard.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/regions/Worldguard.java index d415aae11..dde69e76d 100644 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/regions/Worldguard.java +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/regions/Worldguard.java @@ -113,7 +113,7 @@ public class Worldguard extends BukkitMaskManager implements Listener { }; } } - return new FaweMask(pos1, pos2) { + return new FaweMask(new CuboidRegion(pos1, pos2)) { @Override public boolean isValid(com.sk89q.worldedit.entity.Player player, MaskType type) { diff --git a/worldedit-core/src/main/java/com/boydti/fawe/regions/FaweMask.java b/worldedit-core/src/main/java/com/boydti/fawe/regions/FaweMask.java index 5e508015c..ed3f9d99d 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/regions/FaweMask.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/regions/FaweMask.java @@ -9,11 +9,6 @@ import com.sk89q.worldedit.regions.Region; public class FaweMask implements IDelegateRegion { private final Region region; - @Deprecated - public FaweMask(final BlockVector3 pos1, final BlockVector3 pos2) { - this(new CuboidRegion(pos1, pos2)); - } - public FaweMask(Region region) { this.region = region; } diff --git a/worldedit-core/src/main/java/com/boydti/fawe/regions/FaweMaskManager.java b/worldedit-core/src/main/java/com/boydti/fawe/regions/FaweMaskManager.java index aaa404809..4a2e7512c 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/regions/FaweMaskManager.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/regions/FaweMaskManager.java @@ -36,14 +36,7 @@ public abstract class FaweMaskManager { return this.key; } - @Deprecated - public FaweMask getMask(final Player player) { - return getMask(player, MaskType.getDefaultMaskType()); - } - - public FaweMask getMask(final Player player, MaskType type) { - return getMask(player); - } + public abstract FaweMask getMask(final Player player, MaskType type); public boolean isValid(FaweMask mask) { return true;