Fix #346 , minor hook changes

- Removed deprecated FaweMaskManager#getMask(Player)
- Removed deprecated constructor FaweMask(BlockVector3, BlockVector3)
This commit is contained in:
IronApollo 2020-02-26 10:17:11 -05:00
parent 12431e7b7a
commit d2bcc6dd35
7 changed files with 14 additions and 27 deletions

View File

@ -57,7 +57,7 @@ public class FreeBuildRegion extends BukkitMaskManager {
AsyncBlock block = new AsyncBlock(asyncWorld, 0, 0, 0); AsyncBlock block = new AsyncBlock(asyncWorld, 0, 0, 0);
BlockBreakEvent event = new BlockBreakEvent(block, ((BukkitPlayer) player).getPlayer()); BlockBreakEvent event = new BlockBreakEvent(block, ((BukkitPlayer) player).getPlayer());
return new FaweMask(pos1, pos2) { return new FaweMask(new CuboidRegion(pos1, pos2)) {
@Override @Override
public boolean isValid(Player player, MaskType type) { public boolean isValid(Player player, MaskType type) {

View File

@ -5,6 +5,7 @@ import com.boydti.fawe.regions.FaweMask;
import com.boydti.fawe.regions.general.RegionFilter; import com.boydti.fawe.regions.general.RegionFilter;
import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.CuboidRegion;
import me.ryanhamshire.GriefPrevention.Claim; import me.ryanhamshire.GriefPrevention.Claim;
import me.ryanhamshire.GriefPrevention.GriefPrevention; import me.ryanhamshire.GriefPrevention.GriefPrevention;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@ -33,7 +34,7 @@ public class GriefPreventionFeature extends BukkitMaskManager implements Listene
claim.getGreaterBoundaryCorner().getBlockX(); claim.getGreaterBoundaryCorner().getBlockX();
final BlockVector3 pos1 = BlockVector3.at(claim.getLesserBoundaryCorner().getBlockX(), 0, claim.getLesserBoundaryCorner().getBlockZ()); final BlockVector3 pos1 = BlockVector3.at(claim.getLesserBoundaryCorner().getBlockX(), 0, claim.getLesserBoundaryCorner().getBlockZ());
final BlockVector3 pos2 = BlockVector3.at(claim.getGreaterBoundaryCorner().getBlockX(), 256, claim.getGreaterBoundaryCorner().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 @Override
public boolean isValid(com.sk89q.worldedit.entity.Player wePlayer, MaskType type) { public boolean isValid(com.sk89q.worldedit.entity.Player wePlayer, MaskType type) {

View File

@ -6,6 +6,7 @@ import com.bekvon.bukkit.residence.protection.CuboidArea;
import com.boydti.fawe.bukkit.FaweBukkit; import com.boydti.fawe.bukkit.FaweBukkit;
import com.boydti.fawe.regions.FaweMask; import com.boydti.fawe.regions.FaweMask;
import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.regions.CuboidRegion;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
@ -41,7 +42,7 @@ public class ResidenceFeature extends BukkitMaskManager implements Listener {
final Location pos1 = area.getLowLoc(); final Location pos1 = area.getLowLoc();
final Location pos2 = area.getHighLoc(); final Location pos2 = area.getHighLoc();
final ClaimedResidence finalResidence = residence; 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 @Override
public boolean isValid(com.sk89q.worldedit.entity.Player player, MaskType type) { public boolean isValid(com.sk89q.worldedit.entity.Player player, MaskType type) {
return isAllowed(BukkitAdapter.adapt(player), finalResidence, type); return isAllowed(BukkitAdapter.adapt(player), finalResidence, type);

View File

@ -11,6 +11,7 @@ import com.palmergames.bukkit.towny.object.TownyUniverse;
import com.palmergames.bukkit.towny.object.WorldCoord; import com.palmergames.bukkit.towny.object.WorldCoord;
import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.CuboidRegion;
import org.bukkit.Chunk; import org.bukkit.Chunk;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -37,8 +38,7 @@ public class TownyFeature extends BukkitMaskManager implements Listener {
if (block.getResident().equals(resident)) { if (block.getResident().equals(resident)) {
return true; return true;
} }
} catch (NotRegisteredException ignore) { } catch (NotRegisteredException ignore) {}
}
Town town = block.getTown(); Town town = block.getTown();
if (town.isMayor(resident)) { if (town.isMayor(resident)) {
return true; return true;
@ -54,14 +54,12 @@ public class TownyFeature extends BukkitMaskManager implements Listener {
return true; return true;
} }
} }
} catch (NotRegisteredException e) { } catch (NotRegisteredException ignore) {}
return false;
}
return false; return false;
} }
@Override @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 Player player = BukkitAdapter.adapt(wePlayer);
final Location location = player.getLocation(); final Location location = player.getLocation();
try { try {
@ -82,15 +80,14 @@ public class TownyFeature extends BukkitMaskManager implements Listener {
final BlockVector3 pos2 = BlockVector3.at( final BlockVector3 pos2 = BlockVector3.at(
chunk.getX() * 16 + 15, 156, chunk.getZ() * 16 chunk.getX() * 16 + 15, 156, chunk.getZ() * 16
+ 15); + 15);
return new FaweMask(pos1, pos2) { return new FaweMask(new CuboidRegion(pos1, pos2)) {
@Override @Override
public boolean isValid(com.sk89q.worldedit.entity.Player player, MaskType type) { 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; return null;
} }
} }

View File

@ -113,7 +113,7 @@ public class Worldguard extends BukkitMaskManager implements Listener {
}; };
} }
} }
return new FaweMask(pos1, pos2) { return new FaweMask(new CuboidRegion(pos1, pos2)) {
@Override @Override
public boolean isValid(com.sk89q.worldedit.entity.Player player, MaskType type) { public boolean isValid(com.sk89q.worldedit.entity.Player player, MaskType type) {

View File

@ -9,11 +9,6 @@ import com.sk89q.worldedit.regions.Region;
public class FaweMask implements IDelegateRegion { public class FaweMask implements IDelegateRegion {
private final Region region; private final Region region;
@Deprecated
public FaweMask(final BlockVector3 pos1, final BlockVector3 pos2) {
this(new CuboidRegion(pos1, pos2));
}
public FaweMask(Region region) { public FaweMask(Region region) {
this.region = region; this.region = region;
} }

View File

@ -36,14 +36,7 @@ public abstract class FaweMaskManager {
return this.key; return this.key;
} }
@Deprecated public abstract FaweMask getMask(final Player player, MaskType type);
public FaweMask getMask(final Player player) {
return getMask(player, MaskType.getDefaultMaskType());
}
public FaweMask getMask(final Player player, MaskType type) {
return getMask(player);
}
public boolean isValid(FaweMask mask) { public boolean isValid(FaweMask mask) {
return true; return true;