Remove BukkitMask

Dieser Commit ist enthalten in:
MattBDev 2019-06-21 19:58:40 -04:00
Ursprung eddb1ec677
Commit 1e02560039
21 geänderte Dateien mit 88 neuen und 195 gelöschten Zeilen

Datei anzeigen

@ -115,9 +115,6 @@ public class VoxelSniperListener implements Listener {
}
}
/**
* @param event
*/
@EventHandler(ignoreCancelled = false)
public final void onPlayerInteract(final PlayerInteractEvent event) {
Player player = event.getPlayer();
@ -131,14 +128,11 @@ public class VoxelSniperListener implements Listener {
if (sniper.isEnabled() && sniper.snipe(event.getAction(), event.getMaterial(), event.getClickedBlock(), event.getBlockFace())) {
event.setCancelled(true);
}
} catch (final Throwable ignored) {
ignored.printStackTrace();
} catch (final Throwable throwable) {
throwable.printStackTrace();
}
}
/**
* @param event
*/
@EventHandler
public final void onPlayerJoin(final PlayerJoinEvent event) {
Player player = event.getPlayer();

Datei anzeigen

@ -7,6 +7,7 @@ import com.boydti.fawe.object.FawePlayer;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;
public class BukkitCommand implements CommandExecutor {
@ -17,7 +18,7 @@ public class BukkitCommand implements CommandExecutor {
}
@Override
public boolean onCommand(final CommandSender sender, final Command cmd, final String label, final String[] args) {
public boolean onCommand(@NotNull final CommandSender sender, final Command cmd, final String label, final String[] args) {
final FawePlayer plr = Fawe.imp().wrap(sender);
if (!sender.hasPermission(this.cmd.getPerm()) && !sender.isOp()) {
BBC.NO_PERM.send(plr, this.cmd.getPerm());

Datei anzeigen

@ -73,8 +73,6 @@ public class FaweBukkit implements IFawe, Listener {
private BukkitImageListener imageListener;
//private CFIPacketListener packetListener;
//private boolean listeningCui;
//private CUIListener cuiListener;
public VaultUtil getVault() {
return this.vault;
@ -436,7 +434,7 @@ public class FaweBukkit implements IFawe, Listener {
Fawe.debug("Plugin 'FactionsUUID' found. Using it now.");
} catch (Throwable e2) {
try {
managers.add(new FactionsOneFeature(factionsPlugin, this));
managers.add(new FactionsOneFeature(factionsPlugin));
Fawe.debug("Plugin 'FactionsUUID' found. Using it now.");
} catch (Throwable e3) {
MainUtil.handleError(e);
@ -457,7 +455,7 @@ public class FaweBukkit implements IFawe, Listener {
final Plugin griefpreventionPlugin = Bukkit.getServer().getPluginManager().getPlugin("GriefPrevention");
if ((griefpreventionPlugin != null) && griefpreventionPlugin.isEnabled()) {
try {
managers.add(new GriefPreventionFeature(griefpreventionPlugin, this));
managers.add(new GriefPreventionFeature(griefpreventionPlugin));
Fawe.debug("Plugin 'GriefPrevention' found. Using it now.");
} catch (final Throwable e) {
MainUtil.handleError(e);
@ -477,7 +475,7 @@ public class FaweBukkit implements IFawe, Listener {
final Plugin aSkyBlock = Bukkit.getServer().getPluginManager().getPlugin("ASkyBlock");
if ((aSkyBlock != null) && aSkyBlock.isEnabled()) {
try {
managers.add(new ASkyBlockHook(aSkyBlock, this));
managers.add(new ASkyBlockHook(aSkyBlock));
Fawe.debug("Plugin 'ASkyBlock' found. Using it now.");
} catch (final Throwable e) {
MainUtil.handleError(e);

Datei anzeigen

@ -1,9 +1,11 @@
package com.boydti.fawe.bukkit.adapter.v1_13_1;
import com.sk89q.util.ReflectionUtil;
import com.sk89q.worldedit.world.registry.BlockMaterial;
import net.minecraft.server.v1_13_R2.*;
import net.minecraft.server.v1_13_R2.Block;
import net.minecraft.server.v1_13_R2.EnumPistonReaction;
import net.minecraft.server.v1_13_R2.IBlockData;
import net.minecraft.server.v1_13_R2.ITileEntity;
import net.minecraft.server.v1_13_R2.Material;
import org.bukkit.craftbukkit.v1_13_R2.block.data.CraftBlockData;
public class BlockMaterial_1_13 implements BlockMaterial {
@ -22,7 +24,7 @@ public class BlockMaterial_1_13 implements BlockMaterial {
this.defaultState = defaultState;
this.material = defaultState.getMaterial();
this.craftBlockData = CraftBlockData.fromData(defaultState);
this.isTranslucent = ReflectionUtil.getField(Block.class, block, "n");
this.isTranslucent = block.f(defaultState); //isSolid
}
public Block getBlock() {

Datei anzeigen

@ -4,13 +4,12 @@ import com.boydti.fawe.object.RunnableVal;
import com.boydti.fawe.regions.general.CuboidRegionFilter;
import com.boydti.fawe.util.TaskManager;
import com.sk89q.worldedit.math.BlockVector2;
import java.util.ArrayDeque;
import java.util.Collection;
import me.ryanhamshire.GriefPrevention.Claim;
import me.ryanhamshire.GriefPrevention.GriefPrevention;
import org.bukkit.World;
import java.util.ArrayDeque;
import java.util.Collection;
import static com.google.common.base.Preconditions.checkNotNull;
@ -23,7 +22,7 @@ public class GriefPreventionFilter extends CuboidRegionFilter {
this.claims = TaskManager.IMP.sync(new RunnableVal<Collection<Claim>>() {
@Override
public void run(Collection<Claim> claims) {
this.value = new ArrayDeque(GriefPrevention.instance.dataStore.getClaims());
this.value = new ArrayDeque<>(GriefPrevention.instance.dataStore.getClaims());
}
});
this.world = world;

Datei anzeigen

@ -1,8 +1,8 @@
package com.boydti.fawe.bukkit.regions;
import com.boydti.fawe.bukkit.FaweBukkit;
import com.boydti.fawe.object.FawePlayer;
import com.boydti.fawe.regions.FaweMask;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.wasteofplastic.askyblock.ASkyBlockAPI;
import com.wasteofplastic.askyblock.Island;
import org.bukkit.Location;
@ -12,13 +12,9 @@ import org.bukkit.event.Listener;
import org.bukkit.plugin.Plugin;
public class ASkyBlockHook extends BukkitMaskManager implements Listener {
FaweBukkit plugin;
Plugin aSkyBlock;
public ASkyBlockHook(final Plugin aSkyBlock, final FaweBukkit p3) {
public ASkyBlockHook(final Plugin aSkyBlock) {
super(aSkyBlock.getName());
this.aSkyBlock = aSkyBlock;
this.plugin = p3;
}
@ -33,8 +29,6 @@ public class ASkyBlockHook extends BukkitMaskManager implements Listener {
Island island = ASkyBlockAPI.getInstance().getIslandAt(location);
if (island != null && isAllowed(player, island, type)) {
int minX = island.getMinProtectedX();
int minZ = island.getMinProtectedZ();
World world = location.getWorld();
Location center = island.getCenter();
@ -42,7 +36,7 @@ public class ASkyBlockHook extends BukkitMaskManager implements Listener {
Location pos2 = center.add(center.subtract(pos1));
pos2.setY(255);
return new BukkitMask(pos1, pos2, "ISLAND: " + minX + "," + minZ) {
return new FaweMask(BukkitAdapter.adapt(pos1).toBlockPoint(), BukkitAdapter.adapt(pos2).toBlockPoint()) {
@Override
public boolean isValid(FawePlayer player, MaskType type) {
return isAllowed((Player) player.parent, island, type);
@ -52,4 +46,4 @@ public class ASkyBlockHook extends BukkitMaskManager implements Listener {
return null;
}
}
}

Datei anzeigen

@ -1,17 +0,0 @@
package com.boydti.fawe.bukkit.regions;
import com.boydti.fawe.regions.FaweMask;
import com.sk89q.worldedit.math.BlockVector3;
import org.bukkit.Location;
public class BukkitMask extends FaweMask {
public BukkitMask(Location pos1, Location pos2) {
this(pos1, pos2, null);
}
public BukkitMask(Location pos1, Location pos2, String name) {
super(BlockVector3.at(pos1.getBlockX(), pos1.getBlockY(), pos1.getBlockZ()), BlockVector3.at(pos2.getBlockX(), pos2.getBlockY(), pos2.getBlockZ()), name);
}
}

Datei anzeigen

@ -1,10 +1,12 @@
package com.boydti.fawe.bukkit.regions;
import com.boydti.fawe.object.FawePlayer;
import com.boydti.fawe.regions.FaweMask;
import com.massivecraft.factions.entity.BoardColl;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.MPlayer;
import com.massivecraft.massivecore.ps.PS;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.entity.Player;
@ -18,7 +20,7 @@ public class FactionsFeature extends BukkitMaskManager implements Listener {
}
@Override
public BukkitMask getMask(final FawePlayer<Player> fp, MaskType type) {
public FaweMask getMask(final FawePlayer<Player> fp, MaskType type) {
final Player player = fp.parent;
final Location loc = player.getLocation();
final PS ps = PS.valueOf(loc);
@ -30,24 +32,14 @@ public class FactionsFeature extends BukkitMaskManager implements Listener {
final Chunk chunk = loc.getChunk();
final Location pos1 = new Location(loc.getWorld(), chunk.getX() * 16, 0, chunk.getZ() * 16);
final Location pos2 = new Location(loc.getWorld(), (chunk.getX() * 16) + 15, 156, (chunk.getZ() * 16) + 15);
return new BukkitMask(pos1, pos2) {
@Override
public String getName() {
return "CHUNK:" + loc.getChunk().getX() + "," + loc.getChunk().getZ();
}
};
return new FaweMask(BukkitAdapter.adapt(pos1).toBlockPoint(), BukkitAdapter.adapt(pos2).toBlockPoint());
}
} else if (fac.getOnlinePlayers().contains(player)) {
if (!fac.getComparisonName().equals("wilderness")) {
final Chunk chunk = loc.getChunk();
final Location pos1 = new Location(loc.getWorld(), chunk.getX() * 16, 0, chunk.getZ() * 16);
final Location pos2 = new Location(loc.getWorld(), (chunk.getX() * 16) + 15, 156, (chunk.getZ() * 16) + 15);
return new BukkitMask(pos1, pos2) {
@Override
public String getName() {
return "CHUNK:" + loc.getChunk().getX() + "," + loc.getChunk().getZ();
}
};
return new FaweMask(BukkitAdapter.adapt(pos1).toBlockPoint(), BukkitAdapter.adapt(pos2).toBlockPoint());
}
}
}

Datei anzeigen

@ -1,13 +1,12 @@
package com.boydti.fawe.bukkit.regions;
import com.boydti.fawe.bukkit.FaweBukkit;
import com.boydti.fawe.object.FawePlayer;
import com.boydti.fawe.object.RegionWrapper;
import com.boydti.fawe.regions.FaweMask;
import com.boydti.fawe.util.MainUtil;
import com.boydti.fawe.util.Perm;
import com.massivecraft.factions.FLocation;
import java.lang.reflect.Method;
import java.util.List;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.World;
@ -15,19 +14,21 @@ import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.plugin.Plugin;
import java.lang.reflect.Method;
import java.util.List;
public class FactionsOneFeature extends BukkitMaskManager implements Listener {
private final Class clazzBoard;
private final Method methodGetFactionAt;
public FactionsOneFeature(final Plugin factionsPlugin, final FaweBukkit p3) throws Throwable {
public FactionsOneFeature(final Plugin factionsPlugin) throws Throwable {
super(factionsPlugin.getName());
this.clazzBoard = Class.forName("com.massivecraft.factions.Board");
Class clazzBoard = Class.forName("com.massivecraft.factions.Board");
this.methodGetFactionAt = clazzBoard.getDeclaredMethod("getFactionAt", FLocation.class);
}
@Override
public BukkitMask getMask(final FawePlayer<Player> fp, MaskType type) {
public FaweMask getMask(final FawePlayer<Player> fp, MaskType type) {
final Player player = fp.parent;
final Chunk chunk = player.getLocation().getChunk();
final boolean perm = Perm.hasPermission(FawePlayer.wrap(player), "fawe.factions.wilderness");
@ -40,13 +41,12 @@ public class FactionsOneFeature extends BukkitMaskManager implements Listener {
if (this.isAdded(locs, world, player, perm, type)) {
boolean hasPerm = true;
RegionWrapper chunkSelection;
while (hasPerm && (count > 0)) {
count--;
hasPerm = false;
chunkSelection = new RegionWrapper(locs.maxX + 1, locs.maxX + 1, locs.minZ, locs.maxZ);
RegionWrapper chunkSelection = new RegionWrapper(locs.maxX + 1, locs.maxX + 1, locs.minZ, locs.maxZ);
if (this.isAdded(chunkSelection, world, player, perm, type)) {
locs = new RegionWrapper(locs.minX, locs.maxX + 1, locs.minZ, locs.maxZ);
@ -77,12 +77,7 @@ public class FactionsOneFeature extends BukkitMaskManager implements Listener {
final Location pos1 = new Location(world, locs.minX << 4, 1, locs.minZ << 4);
final Location pos2 = new Location(world, 15 + (locs.maxX << 4), 256, 15 + (locs.maxZ << 4));
return new BukkitMask(pos1, pos2) {
@Override
public String getName() {
return "CHUNK:" + pos1.getChunk().getX() + "," + pos1.getChunk().getZ();
}
};
return new FaweMask(BukkitAdapter.adapt(pos1).toBlockPoint(), BukkitAdapter.adapt(pos2).toBlockPoint());
}
return null;
}

Datei anzeigen

@ -3,10 +3,12 @@ package com.boydti.fawe.bukkit.regions;
import com.boydti.fawe.bukkit.FaweBukkit;
import com.boydti.fawe.object.FawePlayer;
import com.boydti.fawe.object.RegionWrapper;
import com.boydti.fawe.regions.FaweMask;
import com.boydti.fawe.util.Perm;
import com.massivecraft.factions.Board;
import com.massivecraft.factions.FLocation;
import com.massivecraft.factions.Faction;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.World;
@ -23,7 +25,7 @@ public class FactionsUUIDFeature extends BukkitMaskManager implements Listener {
}
@Override
public BukkitMask getMask(final FawePlayer<Player> fp, MaskType type) {
public FaweMask getMask(final FawePlayer<Player> fp, MaskType type) {
final Player player = fp.parent;
final Chunk chunk = player.getLocation().getChunk();
final boolean perm = Perm.hasPermission(FawePlayer.wrap(player), "fawe.factions.wilderness");
@ -36,13 +38,12 @@ public class FactionsUUIDFeature extends BukkitMaskManager implements Listener {
if (this.isAdded(locs, world, player, perm, type)) {
boolean hasPerm = true;
RegionWrapper chunkSelection;
while (hasPerm && (count > 0)) {
count--;
hasPerm = false;
chunkSelection = new RegionWrapper(locs.maxX + 1, locs.maxX + 1, locs.minZ, locs.maxZ);
RegionWrapper chunkSelection = new RegionWrapper(locs.maxX + 1, locs.maxX + 1, locs.minZ, locs.maxZ);
if (this.isAdded(chunkSelection, world, player, perm, type)) {
locs = new RegionWrapper(locs.minX, locs.maxX + 1, locs.minZ, locs.maxZ);
@ -73,12 +74,7 @@ public class FactionsUUIDFeature extends BukkitMaskManager implements Listener {
final Location pos1 = new Location(world, locs.minX << 4, 1, locs.minZ << 4);
final Location pos2 = new Location(world, 15 + (locs.maxX << 4), 256, 15 + (locs.maxZ << 4));
return new BukkitMask(pos1, pos2) {
@Override
public String getName() {
return "CHUNK:" + pos1.getChunk().getX() + "," + pos1.getChunk().getZ();
}
};
return new FaweMask(BukkitAdapter.adapt(pos1).toBlockPoint(), BukkitAdapter.adapt(pos2).toBlockPoint());
}
return null;
}

Datei anzeigen

@ -50,33 +50,28 @@ public class FreeBuildRegion extends BukkitMaskManager {
currRegList.add(listener);
}
if (currRegList.isEmpty()) return null;
RegisteredListener[] listeners = currRegList.toArray(new RegisteredListener[currRegList.size()]);
RegisteredListener[] listeners = currRegList.toArray(new RegisteredListener[0]);
World bukkitWorld = player.parent.getWorld();
AsyncWorld asyncWorld = AsyncWorld.wrap(bukkitWorld);
BlockVector3 vec1 = BlockVector3.at(0, 0, 0);
BlockVector3 vec2 = vec1;
Location pos1 = BukkitAdapter.adapt(bukkitWorld, vec1);
Location pos2 = BukkitAdapter.adapt(bukkitWorld, vec2);
Location pos2 = BukkitAdapter.adapt(bukkitWorld, vec1);
AsyncBlock block = new AsyncBlock(asyncWorld, new NullFaweQueue(asyncWorld.getWorldName(), BlockTypes.STONE.getDefaultState()), 0, 0, 0);
BlockBreakEvent event = new BlockBreakEvent(block, player.parent);
return new BukkitMask(pos1, pos2) {
@Override
public String getName() {
return "freebuild-global";
}
return new FaweMask(BukkitAdapter.adapt(pos1).toBlockPoint(), BukkitAdapter.adapt(pos2).toBlockPoint()) {
@Override
@Override
public boolean isValid(FawePlayer player, MaskType type) {
return bukkitWorld == ((FawePlayer<Player>)player).parent.getWorld() && type == MaskType.MEMBER;
}
@Override
public Region getRegion() {
return new CuboidRegion(vec1, vec2) {
return new CuboidRegion(vec1, vec1) {
@Override
public boolean contains(int x, int z) {

Datei anzeigen

@ -1,9 +1,10 @@
package com.boydti.fawe.bukkit.regions;
import com.boydti.fawe.bukkit.FaweBukkit;
import com.boydti.fawe.bukkit.filter.GriefPreventionFilter;
import com.boydti.fawe.object.FawePlayer;
import com.boydti.fawe.regions.FaweMask;
import com.boydti.fawe.regions.general.RegionFilter;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import me.ryanhamshire.GriefPrevention.Claim;
import me.ryanhamshire.GriefPrevention.GriefPrevention;
import org.bukkit.Bukkit;
@ -14,13 +15,9 @@ import org.bukkit.event.Listener;
import org.bukkit.plugin.Plugin;
public class GriefPreventionFeature extends BukkitMaskManager implements Listener {
FaweBukkit plugin;
Plugin griefprevention;
public GriefPreventionFeature(final Plugin griefpreventionPlugin, final FaweBukkit p3) {
public GriefPreventionFeature(final Plugin griefpreventionPlugin) {
super(griefpreventionPlugin.getName());
this.griefprevention = griefpreventionPlugin;
this.plugin = p3;
}
public boolean isAllowed(Player player, Claim claim, MaskType type) {
@ -28,21 +25,16 @@ public class GriefPreventionFeature extends BukkitMaskManager implements Listene
}
@Override
public BukkitMask getMask(final FawePlayer<Player> fp, MaskType type) {
public FaweMask getMask(final FawePlayer<Player> fp, MaskType type) {
final Player player = fp.parent;
final Location location = player.getLocation();
final Claim claim = GriefPrevention.instance.dataStore.getClaimAt(location, true, null);
if (claim != null) {
final String uuid = player.getUniqueId().toString();
if (isAllowed(player, claim, type)) {
claim.getGreaterBoundaryCorner().getBlockX();
final Location pos1 = new Location(location.getWorld(), claim.getLesserBoundaryCorner().getBlockX(), 0, claim.getLesserBoundaryCorner().getBlockZ());
final Location pos2 = new Location(location.getWorld(), claim.getGreaterBoundaryCorner().getBlockX(), 256, claim.getGreaterBoundaryCorner().getBlockZ());
return new BukkitMask(pos1, pos2) {
@Override
public String getName() {
return "CLAIM:" + claim.toString();
}
return new FaweMask(BukkitAdapter.adapt(pos1).toBlockPoint(), BukkitAdapter.adapt(pos2).toBlockPoint()) {
@Override
public boolean isValid(FawePlayer player, MaskType type) {

Datei anzeigen

@ -43,7 +43,7 @@ public class PreciousStonesFeature extends BukkitMaskManager implements Listener
if (isAllowed(player, myField, type, member)) {
BlockVector3 pos1 = BlockVector3.at(myField.getMinx(), myField.getMiny(), myField.getMinz());
BlockVector3 pos2 = BlockVector3.at(myField.getMaxx(), myField.getMaxy(), myField.getMaxz());
return new FaweMask(pos1, pos2, "FIELD: " + myField) {
return new FaweMask(pos1, pos2) {
@Override
public boolean isValid(FawePlayer player, MaskType type) {
return isAllowed((Player) player.parent, myField, type, fp.hasPermission("fawe.preciousstones.member"));

Datei anzeigen

@ -5,6 +5,8 @@ import com.bekvon.bukkit.residence.protection.ClaimedResidence;
import com.bekvon.bukkit.residence.protection.CuboidArea;
import com.boydti.fawe.bukkit.FaweBukkit;
import com.boydti.fawe.object.FawePlayer;
import com.boydti.fawe.regions.FaweMask;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
@ -26,7 +28,7 @@ public class ResidenceFeature extends BukkitMaskManager implements Listener {
}
@Override
public BukkitMask getMask(final FawePlayer<Player> fp, final MaskType type) {
public FaweMask getMask(final FawePlayer<Player> fp, final MaskType type) {
final Player player = fp.parent;
final Location location = player.getLocation();
ClaimedResidence residence = Residence.getInstance().getResidenceManager().getByLoc(location);
@ -40,13 +42,8 @@ public class ResidenceFeature extends BukkitMaskManager implements Listener {
final Location pos1 = area.getLowLoc();
final Location pos2 = area.getHighLoc();
final ClaimedResidence finalResidence = residence;
return new BukkitMask(pos1, pos2) {
@Override
public String getName() {
return "RESIDENCE: " + finalResidence.getName();
}
@Override
return new FaweMask(BukkitAdapter.adapt(pos1).toBlockPoint(), BukkitAdapter.adapt(pos2).toBlockPoint()) {
@Override
public boolean isValid(FawePlayer player, MaskType type) {
return isAllowed((Player) player.parent, finalResidence, type);
}

Datei anzeigen

@ -2,9 +2,11 @@ package com.boydti.fawe.bukkit.regions;
import com.boydti.fawe.bukkit.FaweBukkit;
import com.boydti.fawe.object.FawePlayer;
import com.boydti.fawe.regions.FaweMask;
import com.palmergames.bukkit.towny.Towny;
import com.palmergames.bukkit.towny.exceptions.NotRegisteredException;
import com.palmergames.bukkit.towny.object.*;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.entity.Player;
@ -53,7 +55,7 @@ public class TownyFeature extends BukkitMaskManager implements Listener {
}
@Override
public BukkitMask getMask(final FawePlayer<Player> fp) {
public FaweMask getMask(final FawePlayer<Player> fp) {
final Player player = fp.parent;
final Location location = player.getLocation();
try {
@ -71,12 +73,7 @@ public class TownyFeature extends BukkitMaskManager implements Listener {
final Chunk chunk = location.getChunk();
final Location pos1 = new Location(location.getWorld(), chunk.getX() * 16, 0, chunk.getZ() * 16);
final Location pos2 = new Location(location.getWorld(), (chunk.getX() * 16) + 15, 156, (chunk.getZ() * 16) + 15);
return new BukkitMask(pos1, pos2) {
@Override
public String getName() {
return "PLOT:" + location.getChunk().getX() + "," + location.getChunk().getZ();
}
return new FaweMask(BukkitAdapter.adapt(pos1).toBlockPoint(), BukkitAdapter.adapt(pos2).toBlockPoint()) {
@Override
public boolean isValid(FawePlayer player, MaskType type) {
return isAllowed((Player) player.parent, myplot);

Datei anzeigen

@ -1,14 +1,13 @@
package com.boydti.fawe.bukkit.regions;
import com.boydti.fawe.FaweAPI;
import com.boydti.fawe.bukkit.FaweBukkit;
import com.boydti.fawe.bukkit.filter.WorldGuardFilter;
import com.boydti.fawe.object.FawePlayer;
import com.boydti.fawe.object.RegionWrapper;
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.math.Vector3;
import com.sk89q.worldedit.regions.AbstractRegion;
import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.regions.Polygonal2DRegion;
@ -18,7 +17,11 @@ import com.sk89q.worldguard.WorldGuard;
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
import com.sk89q.worldguard.protection.ApplicableRegionSet;
import com.sk89q.worldguard.protection.managers.RegionManager;
import com.sk89q.worldguard.protection.regions.*;
import com.sk89q.worldguard.protection.regions.GlobalProtectedRegion;
import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion;
import com.sk89q.worldguard.protection.regions.ProtectedPolygonalRegion;
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
import com.sk89q.worldguard.protection.regions.RegionContainer;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Player;
@ -52,7 +55,7 @@ public class Worldguard extends BukkitMaskManager implements Listener {
System.out.println("Region capability is not enabled for WorldGuard.");
return null;
}
RegionManager manager = container.get(FaweAPI.getWorld(location.getWorld().getName()));
RegionManager manager = container.get(BukkitAdapter.adapt(location.getWorld()));
if (manager == null) {
System.out.println("Region capability is not enabled for that world.");
return null;
@ -107,7 +110,7 @@ public class Worldguard extends BukkitMaskManager implements Listener {
pos1 = new Location(location.getWorld(), myregion.getMinimumPoint().getBlockX(), myregion.getMinimumPoint().getBlockY(), myregion.getMinimumPoint().getBlockZ());
pos2 = new Location(location.getWorld(), myregion.getMaximumPoint().getBlockX(), myregion.getMaximumPoint().getBlockY(), myregion.getMaximumPoint().getBlockZ());
} else {
return new FaweMask(adapt(myregion), myregion.getId()) {
return new FaweMask(adapt(myregion)) {
@Override
public boolean isValid(FawePlayer player, MaskType type) {
return isAllowed(worldguard.wrapPlayer((Player) player.parent), myregion);
@ -115,20 +118,15 @@ public class Worldguard extends BukkitMaskManager implements Listener {
};
}
}
return new BukkitMask(pos1, pos2) {
@Override
public String getName() {
return myregion.getId();
}
return new FaweMask(BukkitAdapter.adapt(pos1).toBlockPoint(), BukkitAdapter.adapt(pos2).toBlockPoint()) {
@Override
@Override
public boolean isValid(FawePlayer player, MaskType type) {
return isAllowed(worldguard.wrapPlayer((Player) player.parent), myregion);
}
};
} else {
return null;
}
return null;
}
@Override

Datei anzeigen

@ -166,21 +166,6 @@ public class Fawe {
this.timer = new FaweTimer();
Fawe.this.IMP.setupVault();
File jar = MainUtil.getJarFile();
// TODO FIXME remove extrablocks.json
// File extraBlocks = MainUtil.copyFile(jar, "extrablocks.json", null);
// if (extraBlocks != null && extraBlocks.exists()) {
// TaskManager.IMP.task(() -> {
// try {
// BundledBlockData.getInstance().loadFromResource();
// BundledBlockData.getInstance().add(extraBlocks.toURI().toURL(), true);
// } catch (Throwable ignore) {
// ignore.printStackTrace();
// Fawe.debug("Invalid format: extrablocks.json");
// }
// });
// }
// Delayed worldedit setup
TaskManager.IMP.later(() -> {
try {
@ -207,11 +192,6 @@ public class Fawe {
this.chatManager = chatManager;
}
// @Deprecated
// public boolean isJava8() {
// return isJava8;
// }
public DefaultTransformParser getTransformParser() {
return transformParser;
}

Datei anzeigen

@ -8,24 +8,14 @@ import com.sk89q.worldedit.regions.Region;
public class FaweMask implements IDelegateRegion {
private final Region region;
private String description = null;
@Deprecated
public FaweMask(final BlockVector3 pos1, final BlockVector3 pos2, final String id) {
this(new CuboidRegion(pos1, pos2), id);
}
@Deprecated
public FaweMask(final BlockVector3 pos1, final BlockVector3 pos2) {
this(pos1, pos2, null);
if ((pos1 == null) || (pos2 == null)) {
throw new IllegalArgumentException("BlockVectors cannot be null!");
}
this(new CuboidRegion(pos1, pos2));
}
public FaweMask(Region region, String id) {
public FaweMask(Region region) {
this.region = region;
this.description = id;
}
@Override
@ -33,10 +23,6 @@ public class FaweMask implements IDelegateRegion {
return region;
}
public String getName() {
return this.description;
}
public boolean isValid(FawePlayer player, FaweMaskManager.MaskType type) {
return false;
}
@ -45,4 +31,4 @@ public class FaweMask implements IDelegateRegion {
public Region clone() {
throw new UnsupportedOperationException("Clone not supported");
}
}
}

Datei anzeigen

@ -149,7 +149,7 @@ public class PlotSquaredFeature extends FaweMaskManager {
};
}
return new FaweMask(maskedRegion, "PLOT^2") {
return new FaweMask(maskedRegion) {
@Override
public boolean isValid(FawePlayer player, MaskType type) {
if (Settings.Done.RESTRICT_BUILDING && Flags.DONE.isSet(finalPlot)) {

Datei anzeigen

@ -1,21 +1,21 @@
package com.sk89q.worldedit.regions;
import com.sk89q.worldedit.*;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.Vector2;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.world.World;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nullable;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import javax.annotation.Nullable;
public interface IDelegateRegion extends Region {
public Region getRegion();
Region getRegion();
@Override
@NotNull @Override
default Iterator<BlockVector3> iterator() {
return getRegion().iterator();
}

Datei anzeigen

@ -61,28 +61,28 @@ public interface Region extends Iterable<BlockVector3>, Cloneable {
*
* @return number of blocks
*/
public int getArea();
int getArea();
/**
* Get X-size.
*
* @return width
*/
public int getWidth();
int getWidth();
/**
* Get Y-size.
*
* @return height
*/
public int getHeight();
int getHeight();
/**
* Get Z-size.
*
* @return length
*/
public int getLength();
int getLength();
/**
* Expand the region.
@ -121,12 +121,7 @@ public interface Region extends Iterable<BlockVector3>, Cloneable {
BlockVector3 pos2 = getMaximumPoint();
return pos1.getBlockX() == Integer.MIN_VALUE && pos1.getBlockZ() == Integer.MIN_VALUE && pos2.getBlockX() == Integer.MAX_VALUE && pos2.getBlockZ() == Integer.MAX_VALUE && pos1.getBlockY() <= 0 && pos2.getBlockY() >= 255;
}
/**
* Returns true based on whether the region contains the point.
*
* @param position the position
* @return true if contained
*/
/**
* Returns true based on whether the region contains the point.
*
@ -154,22 +149,21 @@ public interface Region extends Iterable<BlockVector3>, Cloneable {
*
* @return the world, or null
*/
@Nullable
public World getWorld();
@Nullable World getWorld();
/**
* Sets the world that the selection is in.
*
* @param world the world, which may be null
*/
public void setWorld(@Nullable World world);
void setWorld(@Nullable World world);
/**
* Make a clone of the region.
*
* @return a cloned version
*/
public Region clone();
Region clone();
/**
* Polygonizes a cross-section or a 2D projection of the region orthogonal to the Y axis.