mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-12 10:48:34 +00:00
Javadoc and Formatting fixes. (#619)
Javadoc and Formatting fixes. Also, extremely minor code changes which have been tested. This commit is only part one of two commits that aim to fix problems with formatting in our project. In part two I will modify the Google Java Style Guide (since it closely matches our code style) for our project so there is guidance on how to format and document. * Updated PlotSquared URL * Removed plugin acronyms * Fixed a typo * Fixed grammar * Use modern block id's * Update YouTube video URL
This commit is contained in:
@ -9,7 +9,6 @@ import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import java.util.ArrayList;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.event.EventException;
|
||||
@ -17,6 +16,9 @@ import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.plugin.RegisteredListener;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Locale;
|
||||
|
||||
public class FreeBuildRegion extends BukkitMaskManager {
|
||||
private final ArrayList<RegisteredListener> listeners;
|
||||
|
||||
@ -25,8 +27,12 @@ public class FreeBuildRegion extends BukkitMaskManager {
|
||||
this.listeners = new ArrayList<>();
|
||||
RegisteredListener[] listeners = BlockBreakEvent.getHandlerList().getRegisteredListeners();
|
||||
for (RegisteredListener listener : listeners) {
|
||||
if (listener.getPriority() == EventPriority.MONITOR) continue;
|
||||
if (!listener.isIgnoringCancelled()) continue;
|
||||
if (listener.getPriority() == EventPriority.MONITOR) {
|
||||
continue;
|
||||
}
|
||||
if (!listener.isIgnoringCancelled()) {
|
||||
continue;
|
||||
}
|
||||
this.listeners.add(listener);
|
||||
}
|
||||
}
|
||||
@ -38,14 +44,20 @@ public class FreeBuildRegion extends BukkitMaskManager {
|
||||
|
||||
@Override
|
||||
public FaweMask getMask(Player player, MaskType type) {
|
||||
if (type != MaskType.MEMBER) return null;
|
||||
if (type != MaskType.MEMBER) {
|
||||
return null;
|
||||
}
|
||||
ArrayList<RegisteredListener> currRegList = new ArrayList<>();
|
||||
for (RegisteredListener listener : this.listeners) {
|
||||
String name = listener.getPlugin().getName();
|
||||
if (!player.hasPermission("fawe.freebuild." + name.toLowerCase())) continue;
|
||||
if (!player.hasPermission("fawe.freebuild." + name.toLowerCase(Locale.ROOT))) {
|
||||
continue;
|
||||
}
|
||||
currRegList.add(listener);
|
||||
}
|
||||
if (currRegList.isEmpty()) return null;
|
||||
if (currRegList.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
RegisteredListener[] listeners = currRegList.toArray(new RegisteredListener[0]);
|
||||
|
||||
World bukkitWorld = BukkitAdapter.adapt(player.getWorld());
|
||||
@ -73,12 +85,15 @@ public class FreeBuildRegion extends BukkitMaskManager {
|
||||
return contains(x, 127, z);
|
||||
}
|
||||
|
||||
private int lastX = Integer.MIN_VALUE, lastZ = Integer.MIN_VALUE;
|
||||
private int lastX = Integer.MIN_VALUE;
|
||||
private int lastZ = Integer.MIN_VALUE;
|
||||
private boolean lastResult;
|
||||
|
||||
@Override
|
||||
public boolean contains(int x, int y, int z) {
|
||||
if (x == lastX && z == lastZ) return lastResult;
|
||||
if (x == lastX && z == lastZ) {
|
||||
return lastResult;
|
||||
}
|
||||
lastX = x;
|
||||
lastZ = z;
|
||||
event.setCancelled(false);
|
||||
|
@ -43,7 +43,7 @@ public class ResidenceFeature extends BukkitMaskManager implements Listener {
|
||||
final Location pos2 = area.getHighLoc();
|
||||
final ClaimedResidence finalResidence = residence;
|
||||
return new FaweMask(new CuboidRegion(BukkitAdapter.asBlockVector(pos1), BukkitAdapter.asBlockVector(pos2))) {
|
||||
@Override
|
||||
@Override
|
||||
public boolean isValid(com.sk89q.worldedit.entity.Player player, MaskType type) {
|
||||
return isAllowed(BukkitAdapter.adapt(player), finalResidence, type);
|
||||
}
|
||||
|
@ -38,7 +38,8 @@ public class TownyFeature extends BukkitMaskManager implements Listener {
|
||||
if (block.getResident().equals(resident)) {
|
||||
return true;
|
||||
}
|
||||
} catch (NotRegisteredException ignore) {}
|
||||
} catch (NotRegisteredException ignored) {
|
||||
}
|
||||
Town town = block.getTown();
|
||||
if (town.isMayor(resident)) {
|
||||
return true;
|
||||
@ -54,7 +55,8 @@ public class TownyFeature extends BukkitMaskManager implements Listener {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} catch (NotRegisteredException ignore) {}
|
||||
} catch (NotRegisteredException ignored) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -87,7 +89,8 @@ public class TownyFeature extends BukkitMaskManager implements Listener {
|
||||
}
|
||||
};
|
||||
}
|
||||
} catch (Exception ignored) {}
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,8 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class Worldguard extends BukkitMaskManager implements Listener {
|
||||
private final WorldGuardPlugin worldguard;
|
||||
|
||||
@ -63,7 +65,7 @@ public class Worldguard extends BukkitMaskManager implements Listener {
|
||||
}
|
||||
final ApplicableRegionSet regions = manager.getApplicableRegions(BlockVector3.at(location.getX(), location.getY(), location.getZ()));
|
||||
//Merge WorldGuardFlag
|
||||
if(player.hasPermission("fawe.worldguardflag") && !regions.testState(player, Flags.BUILD, Flags.BLOCK_PLACE, Flags.BLOCK_BREAK)){
|
||||
if (player.hasPermission("fawe.worldguardflag") && !regions.testState(player, Flags.BUILD, Flags.BLOCK_PLACE, Flags.BLOCK_BREAK)) {
|
||||
return null;
|
||||
}
|
||||
for (ProtectedRegion region : regions) {
|
||||
@ -78,9 +80,9 @@ public class Worldguard extends BukkitMaskManager implements Listener {
|
||||
//Check if player is the owner of the region, the region's ID contains the player's name (why?), or if the region's owners contains "*".
|
||||
if (region.isOwner(localplayer) || region.isOwner(localplayer.getName())) {
|
||||
return true;
|
||||
} else if (region.getId().toLowerCase().equals(localplayer.getName().toLowerCase())) {
|
||||
} else if (region.getId().toLowerCase(Locale.ROOT).equals(localplayer.getName().toLowerCase(Locale.ROOT))) {
|
||||
return true;
|
||||
} else if (region.getId().toLowerCase().contains(localplayer.getName().toLowerCase() + "//")) {
|
||||
} else if (region.getId().toLowerCase(Locale.ROOT).contains(localplayer.getName().toLowerCase(Locale.ROOT) + "//")) {
|
||||
return true;
|
||||
} else if (region.isOwner("*")) {
|
||||
return true;
|
||||
@ -90,8 +92,9 @@ public class Worldguard extends BukkitMaskManager implements Listener {
|
||||
if (localplayer.hasPermission("fawe.worldguard.member")) {
|
||||
if (region.isMember(localplayer) || region.isMember(localplayer.getName())) {
|
||||
return true;
|
||||
} else
|
||||
} else {
|
||||
return region.isMember("*");
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -122,8 +125,7 @@ public class Worldguard extends BukkitMaskManager implements Listener {
|
||||
}
|
||||
}
|
||||
return new FaweMask(new CuboidRegion(pos1, pos2)) {
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public boolean isValid(com.sk89q.worldedit.entity.Player player, MaskType type) {
|
||||
return isAllowed(worldguard.wrapPlayer(BukkitAdapter.adapt(player)), myregion);
|
||||
}
|
||||
|
@ -136,8 +136,8 @@ public class FaweRegionManager extends RegionManager {
|
||||
clipboard.setBlocks(fillingRegion, filling);
|
||||
clipboard.setBlocks(floorRegion, plotfloor);
|
||||
clipboard.setBlocks(airRegion, air);
|
||||
for (int x = pos1.getX(); x <= pos2.getX(); x ++) {
|
||||
for (int z = pos1.getZ(); z <= pos2.getZ(); z ++) {
|
||||
for (int x = pos1.getX(); x <= pos2.getX(); x++) {
|
||||
for (int z = pos1.getZ(); z <= pos2.getZ(); z++) {
|
||||
clipboard.setBiome(BlockVector2.at(x, z), biome);
|
||||
}
|
||||
}
|
||||
@ -178,7 +178,7 @@ public class FaweRegionManager extends RegionManager {
|
||||
//todo because of the following code this should proably be in the Bukkit module
|
||||
World pos1World = BukkitAdapter.adapt(getWorld(pos1.getWorld()));
|
||||
World pos3World = BukkitAdapter.adapt(getWorld(pos3.getWorld()));
|
||||
WorldEdit.getInstance().getEditSessionFactory().getEditSession(pos1World,-1);
|
||||
WorldEdit.getInstance().getEditSessionFactory().getEditSession(pos1World, -1);
|
||||
EditSession sessionA = new EditSessionBuilder(pos1World).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build();
|
||||
EditSession sessionB = new EditSessionBuilder(pos3World).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build();
|
||||
CuboidRegion regionA = new CuboidRegion(BlockVector3.at(pos1.getX(), pos1.getY(), pos1.getZ()), BlockVector3.at(pos2.getX(), pos2.getY(), pos2.getZ()));
|
||||
|
@ -1,7 +1,5 @@
|
||||
package com.boydti.fawe.bukkit.regions.plotsquared;
|
||||
|
||||
import static org.bukkit.Bukkit.getWorld;
|
||||
|
||||
import com.boydti.fawe.FaweAPI;
|
||||
import com.boydti.fawe.FaweCache;
|
||||
import com.boydti.fawe.object.clipboard.ReadOnlyClipboard;
|
||||
@ -29,6 +27,8 @@ import com.sk89q.worldedit.extent.clipboard.io.FastSchematicWriter;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import net.jpountz.lz4.LZ4BlockInputStream;
|
||||
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
@ -39,7 +39,8 @@ import java.net.URL;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import net.jpountz.lz4.LZ4BlockInputStream;
|
||||
|
||||
import static org.bukkit.Bukkit.getWorld;
|
||||
|
||||
public class FaweSchematicHandler extends SchematicHandler {
|
||||
@Override
|
||||
|
@ -62,7 +62,7 @@ public class MoveTo512 /*extends Command*/ {
|
||||
// if (yMax != 15) {
|
||||
// Arrays.fill(ids, yMax158 + 256, 4096, (byte) 0);
|
||||
// }
|
||||
// } else if (layer == 0){
|
||||
// } else if (layer == 0) {
|
||||
// Arrays.fill(ids, 256, 4096, (byte) 3);
|
||||
// Arrays.fill(ids, 0, 256, (byte) 7);
|
||||
// } else {
|
||||
@ -113,7 +113,7 @@ public class MoveTo512 /*extends Command*/ {
|
||||
// int yMax158 = yMax15 << 8;
|
||||
// Arrays.fill(ids, yMax158 + 256, 4096, (byte) 0);
|
||||
// }
|
||||
// } else if (layer == 0){
|
||||
// } else if (layer == 0) {
|
||||
// Arrays.fill(ids, 256, 4096, (byte) hpw.ROAD_BLOCK.id);
|
||||
// Arrays.fill(ids, 0, 256, (byte) 7);
|
||||
// } else {
|
||||
|
@ -1,14 +1,15 @@
|
||||
package com.boydti.fawe.bukkit.regions.plotsquared;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.boydti.fawe.regions.general.CuboidRegionFilter;
|
||||
import com.plotsquared.core.location.Location;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.plot.PlotArea;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
public class PlotRegionFilter extends CuboidRegionFilter {
|
||||
private final PlotArea area;
|
||||
|
||||
@ -16,6 +17,7 @@ public class PlotRegionFilter extends CuboidRegionFilter {
|
||||
checkNotNull(area);
|
||||
this.area = area;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void calculateRegions() {
|
||||
ArrayList<Plot> plots = new ArrayList<>(area.getPlots());
|
||||
|
@ -24,11 +24,12 @@ import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.biome.BiomeTypes;
|
||||
import com.sk89q.worldedit.world.biome.Biomes;
|
||||
import com.sk89q.worldedit.world.registry.BiomeRegistry;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
@CommandDeclaration(
|
||||
command = "generatebiome",
|
||||
|
@ -23,13 +23,15 @@ import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.regions.RegionIntersection;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class PlotSquaredFeature extends FaweMaskManager {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(PlotSquaredFeature.class);
|
||||
@ -46,15 +48,15 @@ public class PlotSquaredFeature extends FaweMaskManager {
|
||||
} catch (Throwable ignored) {
|
||||
log.debug("Please update PlotSquared: https://www.spigotmc.org/resources/plotsquared-v5.77506/");
|
||||
}
|
||||
if (Settings.PLATFORM.toLowerCase().startsWith("bukkit")) {
|
||||
if (Settings.PLATFORM.toLowerCase(Locale.ROOT).startsWith("bukkit")) {
|
||||
new FaweTrim();
|
||||
}
|
||||
if (MainCommand.getInstance().getCommand("generatebiome") == null) {
|
||||
new PlotSetBiome();
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO: revisit this later on
|
||||
/*
|
||||
// TODO: revisit this later on
|
||||
/*
|
||||
try {
|
||||
if (Settings.Enabled_Components.WORLDS) {
|
||||
new ReplaceAll();
|
||||
@ -62,7 +64,7 @@ public class PlotSquaredFeature extends FaweMaskManager {
|
||||
} catch (Throwable e) {
|
||||
log.debug("You need to update PlotSquared to access the CFI and REPLACEALL commands");
|
||||
}
|
||||
*/
|
||||
*/
|
||||
}
|
||||
|
||||
public static String getName(UUID uuid) {
|
||||
@ -93,12 +95,9 @@ public class PlotSquaredFeature extends FaweMaskManager {
|
||||
return false;
|
||||
}
|
||||
UUID uid = player.getUniqueId();
|
||||
return !plot.getFlag(NoWorldeditFlag.class) && (plot.isOwner(uid)
|
||||
|| type == MaskType.MEMBER && (plot.getTrusted().contains(uid) || plot.getTrusted()
|
||||
.contains(DBFunc.EVERYONE)
|
||||
|| (plot.getMembers().contains(uid) || plot.getMembers().contains(DBFunc.EVERYONE))
|
||||
&& player.hasPermission("fawe.plotsquared.member")) || player
|
||||
.hasPermission("fawe.plotsquared.admin"));
|
||||
return !plot.getFlag(NoWorldeditFlag.class) && (plot.isOwner(uid) || type == MaskType.MEMBER && (plot.getTrusted().contains(uid) || plot
|
||||
.getTrusted().contains(DBFunc.EVERYONE) || (plot.getMembers().contains(uid) || plot.getMembers().contains(DBFunc.EVERYONE)) && player
|
||||
.hasPermission("fawe.plotsquared.member")) || player.hasPermission("fawe.plotsquared.admin"));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -111,7 +110,7 @@ public class PlotSquaredFeature extends FaweMaskManager {
|
||||
Plot plot = pp.getCurrentPlot();
|
||||
if (isAllowed(player, plot, type)) {
|
||||
regions = plot.getRegions();
|
||||
} else {
|
||||
} else {
|
||||
plot = null;
|
||||
regions = WEManager.getMask(pp);
|
||||
if (regions.size() == 1) {
|
||||
@ -141,7 +140,10 @@ public class PlotSquaredFeature extends FaweMaskManager {
|
||||
maskedRegion = new CuboidRegion(pos1, pos2);
|
||||
} else {
|
||||
World world = FaweAPI.getWorld(area.getWorldName());
|
||||
maskedRegion = new RegionIntersection(world, new ArrayList<>(regions));
|
||||
List<Region> weRegions = regions.stream().map(
|
||||
r -> new CuboidRegion(world, BlockVector3.at(r.getMinimumX(), r.getMinimumY(), r.getMinimumZ()),
|
||||
BlockVector3.at(r.getMaximumX(), r.getMaximumY(), r.getMaximumZ()))).collect(Collectors.toList());
|
||||
maskedRegion = new RegionIntersection(world, weRegions);
|
||||
}
|
||||
|
||||
return new FaweMask(maskedRegion) {
|
||||
@ -158,7 +160,9 @@ public class PlotSquaredFeature extends FaweMaskManager {
|
||||
@Override
|
||||
public RegionFilter getFilter(String world) {
|
||||
PlotArea area = PlotSquared.get().getPlotArea(world, null);
|
||||
if (area != null) return new PlotRegionFilter(area);
|
||||
if (area != null) {
|
||||
return new PlotRegionFilter(area);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,5 @@
|
||||
package com.boydti.fawe.bukkit.regions.plotsquaredv4;
|
||||
|
||||
import static org.bukkit.Bukkit.getWorld;
|
||||
|
||||
import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.util.EditSessionBuilder;
|
||||
import com.boydti.fawe.util.TaskManager;
|
||||
@ -18,8 +16,11 @@ import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
import static org.bukkit.Bukkit.getWorld;
|
||||
|
||||
public class FaweChunkManager extends ChunkManager {
|
||||
|
||||
private ChunkManager parent;
|
||||
|
@ -1,7 +1,5 @@
|
||||
package com.boydti.fawe.bukkit.regions.plotsquaredv4;
|
||||
|
||||
import static org.bukkit.Bukkit.getWorld;
|
||||
|
||||
import com.boydti.fawe.FaweAPI;
|
||||
import com.boydti.fawe.FaweCache;
|
||||
import com.boydti.fawe.object.clipboard.ReadOnlyClipboard;
|
||||
@ -29,6 +27,8 @@ import com.sk89q.worldedit.extent.clipboard.io.FastSchematicWriter;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import net.jpountz.lz4.LZ4BlockInputStream;
|
||||
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
@ -39,7 +39,8 @@ import java.net.URL;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import net.jpountz.lz4.LZ4BlockInputStream;
|
||||
|
||||
import static org.bukkit.Bukkit.getWorld;
|
||||
|
||||
public class FaweSchematicHandler extends SchematicHandler {
|
||||
@Override
|
||||
|
@ -1,14 +1,15 @@
|
||||
package com.boydti.fawe.bukkit.regions.plotsquaredv4;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.boydti.fawe.regions.general.CuboidRegionFilter;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
public class PlotRegionFilter extends CuboidRegionFilter {
|
||||
private final PlotArea area;
|
||||
|
||||
@ -16,6 +17,7 @@ public class PlotRegionFilter extends CuboidRegionFilter {
|
||||
checkNotNull(area);
|
||||
this.area = area;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void calculateRegions() {
|
||||
ArrayList<Plot> plots = new ArrayList<>(area.getPlots());
|
||||
|
@ -10,7 +10,6 @@ import com.github.intellectualsites.plotsquared.plot.commands.MainCommand;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
||||
import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.listener.WEManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||
@ -18,21 +17,21 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.ChunkManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.SchematicHandler;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.block.QueueProvider;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.regions.RegionIntersection;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class PlotSquaredFeature extends FaweMaskManager {
|
||||
|
||||
@ -48,17 +47,17 @@ public class PlotSquaredFeature extends FaweMaskManager {
|
||||
setupSchematicHandler();
|
||||
setupChunkManager();
|
||||
} catch (Throwable ignored) {
|
||||
log.debug("Please update PlotSquared: http://ci.athion.net/job/PlotSquared/");
|
||||
log.debug("Please update PlotSquared: https://www.spigotmc.org/resources/77506/");
|
||||
}
|
||||
if (Settings.PLATFORM.toLowerCase().startsWith("bukkit")) {
|
||||
if (Settings.PLATFORM.toLowerCase(Locale.ROOT).startsWith("bukkit")) {
|
||||
new FaweTrim();
|
||||
}
|
||||
if (MainCommand.getInstance().getCommand("generatebiome") == null) {
|
||||
new PlotSetBiome();
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO: revisit this later on
|
||||
/*
|
||||
// TODO: revisit this later on
|
||||
/*
|
||||
try {
|
||||
if (Settings.Enabled_Components.WORLDS) {
|
||||
new ReplaceAll();
|
||||
@ -66,7 +65,7 @@ public class PlotSquaredFeature extends FaweMaskManager {
|
||||
} catch (Throwable e) {
|
||||
log.debug("You need to update PlotSquared to access the CFI and REPLACEALL commands");
|
||||
}
|
||||
*/
|
||||
*/
|
||||
}
|
||||
|
||||
public static String getName(UUID uuid) {
|
||||
@ -115,7 +114,7 @@ public class PlotSquaredFeature extends FaweMaskManager {
|
||||
Plot plot = pp.getCurrentPlot();
|
||||
if (isAllowed(player, plot, type)) {
|
||||
regions = plot.getRegions();
|
||||
} else {
|
||||
} else {
|
||||
plot = null;
|
||||
regions = WEManager.getMask(pp);
|
||||
if (regions.size() == 1) {
|
||||
@ -149,8 +148,8 @@ public class PlotSquaredFeature extends FaweMaskManager {
|
||||
} else {
|
||||
World world = FaweAPI.getWorld(area.worldname);
|
||||
List<Region> weRegions = regions.stream()
|
||||
.map(r -> new CuboidRegion(world, BlockVector3.at(r.getMinimumX(), r.getMinimumY(), r.getMinimumZ()), BlockVector3.at(r.getMaximumX(), r.getMaximumY(), r.getMaximumZ())))
|
||||
.collect(Collectors.toList());
|
||||
.map(r -> new CuboidRegion(world, BlockVector3.at(r.getMinimumX(), r.getMinimumY(), r.getMinimumZ()), BlockVector3.at(r.getMaximumX(), r.getMaximumY(), r.getMaximumZ())))
|
||||
.collect(Collectors.toList());
|
||||
maskedRegion = new RegionIntersection(world, weRegions);
|
||||
}
|
||||
|
||||
@ -168,7 +167,9 @@ public class PlotSquaredFeature extends FaweMaskManager {
|
||||
@Override
|
||||
public RegionFilter getFilter(String world) {
|
||||
PlotArea area = PlotSquared.get().getPlotArea(world, null);
|
||||
if (area != null) return new PlotRegionFilter(area);
|
||||
if (area != null) {
|
||||
return new PlotRegionFilter(area);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user