mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-25 02:04:44 +02:00
Critical bug fixes, reformatting, and cleaning
Signed-off-by: matt <4009945+MattBDev@users.noreply.github.com>
This commit is contained in:
File diff suppressed because one or more lines are too long
@ -15,11 +15,8 @@ import java.util.ArrayList;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
@CommandDeclaration(command = "area", permission = "plots.area",
|
||||
category = CommandCategory.ADMINISTRATION, requiredType = RequiredType.NONE,
|
||||
description = "Create a new PlotArea", aliases = "world",
|
||||
usage = "/plot area <create|info|list|tp|regen>", confirmation = true) public class Area
|
||||
extends SubCommand {
|
||||
@CommandDeclaration(command = "area", permission = "plots.area", category = CommandCategory.ADMINISTRATION, requiredType = RequiredType.NONE, description = "Create a new PlotArea", aliases = "world", usage = "/plot area <create|info|list|tp|regen>", confirmation = true)
|
||||
public class Area extends SubCommand {
|
||||
|
||||
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
|
||||
if (args.length == 0) {
|
||||
@ -104,36 +101,34 @@ import java.util.Set;
|
||||
final String path =
|
||||
"worlds." + area.worldname + ".areas." + area.id + '-'
|
||||
+ object.min + '-' + object.max;
|
||||
Runnable run = new Runnable() {
|
||||
@Override public void run() {
|
||||
if (offsetX != 0) {
|
||||
PlotSquared.get().worlds
|
||||
.set(path + ".road.offset.x", offsetX);
|
||||
}
|
||||
if (offsetZ != 0) {
|
||||
PlotSquared.get().worlds
|
||||
.set(path + ".road.offset.z", offsetZ);
|
||||
}
|
||||
final String world = SetupUtils.manager.setupWorld(object);
|
||||
if (WorldUtil.IMP.isWorld(world)) {
|
||||
PlotSquared.get().loadWorld(world, null);
|
||||
C.SETUP_FINISHED.send(player);
|
||||
player.teleport(WorldUtil.IMP.getSpawn(world));
|
||||
if (area.TERRAIN != 3) {
|
||||
ChunkManager.largeRegionTask(world, region,
|
||||
new RunnableVal<ChunkLoc>() {
|
||||
@Override public void run(ChunkLoc value) {
|
||||
AugmentedUtils
|
||||
.generate(world, value.x, value.z,
|
||||
null);
|
||||
}
|
||||
}, null);
|
||||
}
|
||||
} else {
|
||||
MainUtil.sendMessage(player,
|
||||
"An error occurred while creating the world: "
|
||||
+ area.worldname);
|
||||
Runnable run = () -> {
|
||||
if (offsetX != 0) {
|
||||
PlotSquared.get().worlds
|
||||
.set(path + ".road.offset.x", offsetX);
|
||||
}
|
||||
if (offsetZ != 0) {
|
||||
PlotSquared.get().worlds
|
||||
.set(path + ".road.offset.z", offsetZ);
|
||||
}
|
||||
final String world = SetupUtils.manager.setupWorld(object);
|
||||
if (WorldUtil.IMP.isWorld(world)) {
|
||||
PlotSquared.get().loadWorld(world, null);
|
||||
C.SETUP_FINISHED.send(player);
|
||||
player.teleport(WorldUtil.IMP.getSpawn(world));
|
||||
if (area.TERRAIN != 3) {
|
||||
ChunkManager.largeRegionTask(world, region,
|
||||
new RunnableVal<ChunkLoc>() {
|
||||
@Override public void run(ChunkLoc value) {
|
||||
AugmentedUtils
|
||||
.generate(world, value.x, value.z,
|
||||
null);
|
||||
}
|
||||
}, null);
|
||||
}
|
||||
} else {
|
||||
MainUtil.sendMessage(player,
|
||||
"An error occurred while creating the world: "
|
||||
+ area.worldname);
|
||||
}
|
||||
};
|
||||
if (hasConfirmation(player)) {
|
||||
@ -228,32 +223,30 @@ import java.util.Set;
|
||||
C.SETUP_WORLD_TAKEN.send(player, pa.worldname);
|
||||
return false;
|
||||
}
|
||||
Runnable run = new Runnable() {
|
||||
@Override public void run() {
|
||||
String path = "worlds." + pa.worldname;
|
||||
if (!PlotSquared.get().worlds.contains(path)) {
|
||||
PlotSquared.get().worlds.createSection(path);
|
||||
}
|
||||
ConfigurationSection section =
|
||||
PlotSquared.get().worlds.getConfigurationSection(path);
|
||||
pa.saveConfiguration(section);
|
||||
pa.loadConfiguration(section);
|
||||
object.plotManager = PlotSquared.imp().getPluginName();
|
||||
object.setupGenerator = PlotSquared.imp().getPluginName();
|
||||
String world = SetupUtils.manager.setupWorld(object);
|
||||
if (WorldUtil.IMP.isWorld(world)) {
|
||||
C.SETUP_FINISHED.send(player);
|
||||
player.teleport(WorldUtil.IMP.getSpawn(world));
|
||||
} else {
|
||||
MainUtil.sendMessage(player,
|
||||
"An error occurred while creating the world: "
|
||||
+ pa.worldname);
|
||||
}
|
||||
try {
|
||||
PlotSquared.get().worlds.save(PlotSquared.get().worldsFile);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Runnable run = () -> {
|
||||
String path = "worlds." + pa.worldname;
|
||||
if (!PlotSquared.get().worlds.contains(path)) {
|
||||
PlotSquared.get().worlds.createSection(path);
|
||||
}
|
||||
ConfigurationSection section =
|
||||
PlotSquared.get().worlds.getConfigurationSection(path);
|
||||
pa.saveConfiguration(section);
|
||||
pa.loadConfiguration(section);
|
||||
object.plotManager = PlotSquared.imp().getPluginName();
|
||||
object.setupGenerator = PlotSquared.imp().getPluginName();
|
||||
String world = SetupUtils.manager.setupWorld(object);
|
||||
if (WorldUtil.IMP.isWorld(world)) {
|
||||
C.SETUP_FINISHED.send(player);
|
||||
player.teleport(WorldUtil.IMP.getSpawn(world));
|
||||
} else {
|
||||
MainUtil.sendMessage(player,
|
||||
"An error occurred while creating the world: "
|
||||
+ pa.worldname);
|
||||
}
|
||||
try {
|
||||
PlotSquared.get().worlds.save(PlotSquared.get().worldsFile);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
};
|
||||
if (hasConfirmation(player)) {
|
||||
@ -422,11 +415,7 @@ import java.util.Set;
|
||||
@Override public void run(ChunkLoc value) {
|
||||
AugmentedUtils.generate(area.worldname, value.x, value.z, null);
|
||||
}
|
||||
}, new Runnable() {
|
||||
@Override public void run() {
|
||||
player.sendMessage("Regen complete");
|
||||
}
|
||||
});
|
||||
}, () -> player.sendMessage("Regen complete"));
|
||||
return true;
|
||||
}
|
||||
case "goto":
|
||||
|
@ -22,8 +22,9 @@ public class Auto extends SubCommand {
|
||||
|
||||
private static boolean checkAllowedPlots(PlotPlayer player, PlotArea plotarea,
|
||||
@Nullable Integer allowed_plots, int size_x, int size_z) {
|
||||
if (allowed_plots == null)
|
||||
if (allowed_plots == null) {
|
||||
allowed_plots = player.getAllowedPlots();
|
||||
}
|
||||
int currentPlots =
|
||||
Settings.Limit.GLOBAL ? player.getPlotCount() : player.getPlotCount(plotarea.worldname);
|
||||
int diff = currentPlots - allowed_plots;
|
||||
@ -189,8 +190,9 @@ public class Auto extends SubCommand {
|
||||
}
|
||||
final int allowed_plots = player.getAllowedPlots();
|
||||
if (player.getMeta(Auto.class.getName(), false) || !checkAllowedPlots(player, plotarea,
|
||||
allowed_plots, size_x, size_z))
|
||||
allowed_plots, size_x, size_z)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (schematic != null && !schematic.isEmpty()) {
|
||||
if (!plotarea.SCHEMATICS.contains(schematic.toLowerCase())) {
|
||||
|
@ -70,7 +70,7 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
RunnableVal3<Command, Runnable, Runnable> confirm,
|
||||
RunnableVal2<Command, CommandResult> whenDone) {
|
||||
PlotArea area = player.getApplicablePlotArea();
|
||||
boolean chat = area == null ? false : area.PLOT_CHAT;
|
||||
boolean chat = area != null && area.PLOT_CHAT;
|
||||
if (toggle(player, "disabletitles") != chat) {
|
||||
MainUtil.sendMessage(player, C.TOGGLE_ENABLED, command.toString());
|
||||
} else {
|
||||
|
@ -64,8 +64,9 @@ import java.util.*;
|
||||
page = Integer.parseInt(args[1]);
|
||||
case 1:
|
||||
UUID user = args[0].length() >= 2 ? UUIDHandler.getUUIDFromString(args[0]) : null;
|
||||
if (user != null && !PlotSquared.get().hasPlot(user))
|
||||
if (user != null && !PlotSquared.get().hasPlot(user)) {
|
||||
user = null;
|
||||
}
|
||||
if (page == Integer.MIN_VALUE && user == null && MathMan.isInteger(args[0])) {
|
||||
page = Integer.parseInt(args[0]);
|
||||
unsorted = PlotSquared.get().getBasePlots(player);
|
||||
|
@ -45,7 +45,7 @@ public interface AbstractDB {
|
||||
void createTables() throws Exception;
|
||||
|
||||
/**
|
||||
* Deletess a plot.
|
||||
* Deletes a plot.
|
||||
*
|
||||
* @param plot the plot to delete
|
||||
*/
|
||||
|
@ -1001,14 +1001,16 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
+ "plot_settings`(`plot_plot_id`) VALUES(?)");
|
||||
}
|
||||
});
|
||||
if (success != null)
|
||||
if (success != null) {
|
||||
addNotifyTask(success);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (failure != null)
|
||||
if (failure != null) {
|
||||
failure.run();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ public class ClassicPlotManager extends SquarePlotManager {
|
||||
Location top = plot.getExtendedTopAbs();
|
||||
LocalBlockQueue queue = plotArea.getQueue(false);
|
||||
int maxY = plotArea.getPlotManager().getWorldHeight();
|
||||
if (!plot.getMerged(0)) {
|
||||
if (!plot.getMerged(Direction.NORTH)) {
|
||||
int z = bottom.getZ();
|
||||
for (int x = bottom.getX(); x <= top.getX(); x++) {
|
||||
for (int y = dpw.PLOT_HEIGHT; y <= maxY; y++) {
|
||||
@ -153,7 +153,7 @@ public class ClassicPlotManager extends SquarePlotManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!plot.getMerged(3)) {
|
||||
if (!plot.getMerged(Direction.WEST)) {
|
||||
int x = bottom.getX();
|
||||
for (int z = bottom.getZ(); z <= top.getZ(); z++) {
|
||||
for (int y = dpw.PLOT_HEIGHT; y <= maxY; y++) {
|
||||
@ -162,7 +162,7 @@ public class ClassicPlotManager extends SquarePlotManager {
|
||||
}
|
||||
}
|
||||
|
||||
if (!plot.getMerged(2)) {
|
||||
if (!plot.getMerged(Direction.SOUTH)) {
|
||||
int z = top.getZ();
|
||||
for (int x = bottom.getX(); x <= top.getX(); x++) {
|
||||
for (int y = dpw.PLOT_HEIGHT; y <= maxY; y++) {
|
||||
@ -170,7 +170,7 @@ public class ClassicPlotManager extends SquarePlotManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!plot.getMerged(1)) {
|
||||
if (!plot.getMerged(Direction.EAST)) {
|
||||
int x = top.getX();
|
||||
for (int z = bottom.getZ(); z <= top.getZ(); z++) {
|
||||
for (int y = dpw.PLOT_HEIGHT; y <= maxY; y++) {
|
||||
@ -196,10 +196,11 @@ public class ClassicPlotManager extends SquarePlotManager {
|
||||
}
|
||||
Plot plot = plotArea.getPlotAbs(plotId);
|
||||
Location bot = plot.getExtendedBottomAbs()
|
||||
.subtract(plot.getMerged(3) ? 0 : 1, 0, plot.getMerged(0) ? 0 : 1);
|
||||
.subtract(plot.getMerged(Direction.WEST) ? 0 : 1, 0,
|
||||
plot.getMerged(Direction.NORTH) ? 0 : 1);
|
||||
Location top = plot.getExtendedTopAbs().add(1, 0, 1);
|
||||
LocalBlockQueue queue = plotArea.getQueue(false);
|
||||
if (!plot.getMerged(0)) {
|
||||
if (!plot.getMerged(Direction.NORTH)) {
|
||||
int z = bot.getZ();
|
||||
for (int x = bot.getX(); x < top.getX(); x++) {
|
||||
for (int y = 1; y <= dpw.WALL_HEIGHT; y++) {
|
||||
@ -207,7 +208,7 @@ public class ClassicPlotManager extends SquarePlotManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!plot.getMerged(3)) {
|
||||
if (!plot.getMerged(Direction.WEST)) {
|
||||
int x = bot.getX();
|
||||
for (int z = bot.getZ(); z < top.getZ(); z++) {
|
||||
for (int y = 1; y <= dpw.WALL_HEIGHT; y++) {
|
||||
@ -215,17 +216,19 @@ public class ClassicPlotManager extends SquarePlotManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!plot.getMerged(2)) {
|
||||
if (!plot.getMerged(Direction.SOUTH)) {
|
||||
int z = top.getZ();
|
||||
for (int x = bot.getX(); x < top.getX() + (plot.getMerged(1) ? 0 : 1); x++) {
|
||||
for (int x = bot.getX();
|
||||
x < top.getX() + (plot.getMerged(Direction.EAST) ? 0 : 1); x++) {
|
||||
for (int y = 1; y <= dpw.WALL_HEIGHT; y++) {
|
||||
queue.setBlock(x, y, z, blocks.getBlock());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!plot.getMerged(1)) {
|
||||
if (!plot.getMerged(Direction.EAST)) {
|
||||
int x = top.getX();
|
||||
for (int z = bot.getZ(); z < top.getZ() + (plot.getMerged(2) ? 0 : 1); z++) {
|
||||
for (int z = bot.getZ();
|
||||
z < top.getZ() + (plot.getMerged(Direction.SOUTH) ? 0 : 1); z++) {
|
||||
for (int y = 1; y <= dpw.WALL_HEIGHT; y++) {
|
||||
queue.setBlock(x, y, z, blocks.getBlock());
|
||||
}
|
||||
@ -242,32 +245,35 @@ public class ClassicPlotManager extends SquarePlotManager {
|
||||
}
|
||||
Plot plot = plotArea.getPlotAbs(plotId);
|
||||
Location bot = plot.getExtendedBottomAbs()
|
||||
.subtract(plot.getMerged(3) ? 0 : 1, 0, plot.getMerged(0) ? 0 : 1);
|
||||
.subtract(plot.getMerged(Direction.WEST) ? 0 : 1, 0,
|
||||
plot.getMerged(Direction.NORTH) ? 0 : 1);
|
||||
Location top = plot.getExtendedTopAbs().add(1, 0, 1);
|
||||
PseudoRandom random = new PseudoRandom();
|
||||
LocalBlockQueue queue = plotArea.getQueue(false);
|
||||
int y = dpw.WALL_HEIGHT + 1;
|
||||
if (!plot.getMerged(0)) {
|
||||
if (!plot.getMerged(Direction.NORTH)) {
|
||||
int z = bot.getZ();
|
||||
for (int x = bot.getX(); x < top.getX(); x++) {
|
||||
queue.setBlock(x, y, z, blocks.getBlock());
|
||||
}
|
||||
}
|
||||
if (!plot.getMerged(3)) {
|
||||
if (!plot.getMerged(Direction.WEST)) {
|
||||
int x = bot.getX();
|
||||
for (int z = bot.getZ(); z < top.getZ(); z++) {
|
||||
queue.setBlock(x, y, z, blocks.getBlock());
|
||||
}
|
||||
}
|
||||
if (!plot.getMerged(2)) {
|
||||
if (!plot.getMerged(Direction.SOUTH)) {
|
||||
int z = top.getZ();
|
||||
for (int x = bot.getX(); x < top.getX() + (plot.getMerged(1) ? 0 : 1); x++) {
|
||||
for (int x = bot.getX();
|
||||
x < top.getX() + (plot.getMerged(Direction.EAST) ? 0 : 1); x++) {
|
||||
queue.setBlock(x, y, z, blocks.getBlock());
|
||||
}
|
||||
}
|
||||
if (!plot.getMerged(1)) {
|
||||
if (!plot.getMerged(Direction.EAST)) {
|
||||
int x = top.getX();
|
||||
for (int z = bot.getZ(); z < top.getZ() + (plot.getMerged(2) ? 0 : 1); z++) {
|
||||
for (int z = bot.getZ();
|
||||
z < top.getZ() + (plot.getMerged(Direction.SOUTH) ? 0 : 1); z++) {
|
||||
queue.setBlock(x, y, z, blocks.getBlock());
|
||||
}
|
||||
}
|
||||
|
@ -95,9 +95,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
||||
return bot.add(-1, 0, -2);
|
||||
} else {
|
||||
bot.setY(0);
|
||||
Location loc =
|
||||
bot.add(SIGN_LOCATION.getX(), SIGN_LOCATION.getY(), SIGN_LOCATION.getZ());
|
||||
return loc;
|
||||
return bot.add(SIGN_LOCATION.getX(), SIGN_LOCATION.getY(), SIGN_LOCATION.getZ());
|
||||
}
|
||||
}
|
||||
|
||||
@ -277,11 +275,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
||||
id = rotate(id);
|
||||
}
|
||||
int pair = MathMan.pair(x, z);
|
||||
BaseBlock[] existing = this.G_SCH.get(pair);
|
||||
if (existing == null) {
|
||||
existing = new BaseBlock[height];
|
||||
this.G_SCH.put(pair, existing);
|
||||
}
|
||||
BaseBlock[] existing = this.G_SCH.computeIfAbsent(pair, k -> new BaseBlock[height]);
|
||||
existing[y] = id;
|
||||
}
|
||||
}
|
||||
|
@ -173,28 +173,28 @@ public abstract class SquarePlotManager extends GridPlotManager {
|
||||
switch (hash) {
|
||||
case 8:
|
||||
// north
|
||||
return plot.getMerged(0) ? id : null;
|
||||
return plot.getMerged(Direction.NORTH) ? id : null;
|
||||
case 4:
|
||||
// east
|
||||
return plot.getMerged(1) ? id : null;
|
||||
return plot.getMerged(Direction.EAST) ? id : null;
|
||||
case 2:
|
||||
// south
|
||||
return plot.getMerged(2) ? id : null;
|
||||
return plot.getMerged(Direction.SOUTH) ? id : null;
|
||||
case 1:
|
||||
// west
|
||||
return plot.getMerged(3) ? id : null;
|
||||
return plot.getMerged(Direction.WEST) ? id : null;
|
||||
case 12:
|
||||
// northest
|
||||
return plot.getMerged(4) ? id : null;
|
||||
// northeast
|
||||
return plot.getMerged(Direction.NORTHEAST) ? id : null;
|
||||
case 6:
|
||||
// southeast
|
||||
return plot.getMerged(5) ? id : null;
|
||||
return plot.getMerged(Direction.SOUTHEAST) ? id : null;
|
||||
case 3:
|
||||
// southwest
|
||||
return plot.getMerged(6) ? id : null;
|
||||
return plot.getMerged(Direction.SOUTHWEST) ? id : null;
|
||||
case 9:
|
||||
// northwest
|
||||
return plot.getMerged(7) ? id : null;
|
||||
return plot.getMerged(Direction.NORTHWEST) ? id : null;
|
||||
}
|
||||
PlotSquared.debug("invalid location: " + Arrays.toString(merged));
|
||||
} catch (Exception ignored) {
|
||||
|
@ -13,7 +13,7 @@ import com.sk89q.worldedit.extent.NullExtent;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
@ -46,21 +46,22 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
@Override public BlockState getBlock(BlockVector3 location) {
|
||||
if (WEManager.maskContains(this.mask, location.getX(), location.getY(), location.getZ())) {
|
||||
return super.getBlock(location);
|
||||
@Override public BlockState getBlock(BlockVector3 position) {
|
||||
if (WEManager.maskContains(this.mask, position.getX(), position.getY(), position.getZ())) {
|
||||
return super.getBlock(position);
|
||||
}
|
||||
return WEExtent.AIRSTATE;
|
||||
}
|
||||
|
||||
@Override public BaseBlock getFullBlock(BlockVector3 location) {
|
||||
if (WEManager.maskContains(this.mask, location.getX(), location.getY(), location.getZ())) {
|
||||
return super.getFullBlock(location);
|
||||
@Override public BaseBlock getFullBlock(BlockVector3 position) {
|
||||
if (WEManager.maskContains(this.mask, position.getX(), position.getY(), position.getZ())) {
|
||||
return super.getFullBlock(position);
|
||||
}
|
||||
return WEExtent.AIRBASE;
|
||||
}
|
||||
|
||||
@Override public boolean setBlock(BlockVector3 location, BlockStateHolder block)
|
||||
@Override
|
||||
public <T extends BlockStateHolder<T>> boolean setBlock(BlockVector3 location, T block)
|
||||
throws WorldEditException {
|
||||
String id = block.getBlockType().getId();
|
||||
switch (id) {
|
||||
@ -171,7 +172,7 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override public boolean setBiome(BlockVector2 position, BaseBiome biome) {
|
||||
@Override public boolean setBiome(BlockVector2 position, BiomeType biome) {
|
||||
return WEManager.maskContains(this.mask, position.getX(), position.getZ()) && super
|
||||
.setBiome(position, biome);
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
@ -42,22 +42,22 @@ public class WEExtent extends AbstractDelegateExtent {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override public boolean setBiome(BlockVector2 position, BaseBiome biome) {
|
||||
return WEManager.maskContains(this.mask, position.getX(), position.getZ()) && super
|
||||
.setBiome(position, biome);
|
||||
}
|
||||
|
||||
@Override public BlockState getBlock(BlockVector3 location) {
|
||||
if (WEManager.maskContains(this.mask, location.getX(), location.getY(), location.getZ())) {
|
||||
return super.getBlock(location);
|
||||
@Override public BlockState getBlock(BlockVector3 position) {
|
||||
if (WEManager.maskContains(this.mask, position.getX(), position.getY(), position.getZ())) {
|
||||
return super.getBlock(position);
|
||||
}
|
||||
return AIRSTATE;
|
||||
}
|
||||
|
||||
@Override public BaseBlock getFullBlock(BlockVector3 location) {
|
||||
if (WEManager.maskContains(this.mask, location.getX(), location.getY(), location.getZ())) {
|
||||
return super.getFullBlock(location);
|
||||
@Override public BaseBlock getFullBlock(BlockVector3 position) {
|
||||
if (WEManager.maskContains(this.mask, position.getX(), position.getY(), position.getZ())) {
|
||||
return super.getFullBlock(position);
|
||||
}
|
||||
return AIRBASE;
|
||||
}
|
||||
|
||||
@Override public boolean setBiome(BlockVector2 position, BiomeType biome) {
|
||||
return WEManager.maskContains(this.mask, position.getX(), position.getZ()) && super
|
||||
.setBiome(position, biome);
|
||||
}
|
||||
}
|
||||
|
@ -3015,4 +3015,8 @@ public class Plot {
|
||||
@SuppressWarnings("deprecation") public void setComments(List<PlotComment> list) {
|
||||
getSettings().setComments(list);
|
||||
}
|
||||
|
||||
public boolean getMerged(Direction direction) {
|
||||
return getMerged(direction.getIndex());
|
||||
}
|
||||
}
|
||||
|
@ -713,8 +713,9 @@ public abstract class PlotArea {
|
||||
if (TYPE == 2) {
|
||||
center = new PlotId(MathMan.average(min.x, max.x), MathMan.average(min.y, max.y));
|
||||
plots = Math.max(max.x - min.x, max.y - min.y) + 1;
|
||||
if (start != null)
|
||||
if (start != null) {
|
||||
start = new PlotId(start.x - center.x, start.y - center.y);
|
||||
}
|
||||
} else {
|
||||
center = new PlotId(0, 0);
|
||||
plots = Integer.MAX_VALUE;
|
||||
|
@ -6,7 +6,6 @@ import com.github.intellectualsites.plotsquared.plot.object.comment.PlotComment;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
/**
|
||||
* Generic settings class.
|
||||
@ -57,13 +56,6 @@ public class PlotSettings {
|
||||
return this.merged[direction];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the plot is merged (i.e. if it's a mega plot)
|
||||
*/
|
||||
public boolean isMerged() {
|
||||
return IntStream.of(0, 1, 2, 3).anyMatch(i -> this.merged[i]);
|
||||
}
|
||||
|
||||
public boolean[] getMerged() {
|
||||
return this.merged;
|
||||
}
|
||||
|
@ -30,8 +30,9 @@ public class SinglePlotArea extends GridPlotWorld {
|
||||
TaskManager.IMP.sync(new RunnableVal<Object>() {
|
||||
@Override public void run(Object value) {
|
||||
String worldName = id.toCommaSeparatedString();
|
||||
if (WorldUtil.IMP.isWorld(worldName))
|
||||
if (WorldUtil.IMP.isWorld(worldName)) {
|
||||
return;
|
||||
}
|
||||
SetupObject setup = new SetupObject();
|
||||
setup.plotManager = "PlotSquared:single";
|
||||
setup.setupGenerator = "PlotSquared:single";
|
||||
|
@ -70,32 +70,36 @@ public class SinglePlotAreaManager extends DefaultPlotAreaManager {
|
||||
|
||||
@Override public PlotArea getApplicablePlotArea(Location location) {
|
||||
PlotArea found = super.getApplicablePlotArea(location);
|
||||
if (found != null)
|
||||
if (found != null) {
|
||||
return found;
|
||||
}
|
||||
String world = location.getWorld();
|
||||
return isWorld(world) || world.equals("*") || super.getAllPlotAreas().length == 0 ?
|
||||
area :
|
||||
null;
|
||||
}
|
||||
|
||||
@Override public PlotArea getPlotArea(Location location) {
|
||||
PlotArea found = super.getPlotArea(location);
|
||||
if (found != null)
|
||||
return found;
|
||||
return isWorld(location.getWorld()) || location.getWorld().equals("*") ? area : null;
|
||||
}
|
||||
|
||||
@Override public PlotArea getPlotArea(String world, String id) {
|
||||
PlotArea found = super.getPlotArea(world, id);
|
||||
if (found != null)
|
||||
if (found != null) {
|
||||
return found;
|
||||
}
|
||||
return isWorld(world) || world.equals("*") ? area : null;
|
||||
}
|
||||
|
||||
@Override public PlotArea getPlotArea(Location location) {
|
||||
PlotArea found = super.getPlotArea(location);
|
||||
if (found != null) {
|
||||
return found;
|
||||
}
|
||||
return isWorld(location.getWorld()) || location.getWorld().equals("*") ? area : null;
|
||||
}
|
||||
|
||||
@Override public PlotArea[] getPlotAreas(String world, RegionWrapper region) {
|
||||
PlotArea[] found = super.getPlotAreas(world, region);
|
||||
if (found != null && found.length != 0)
|
||||
if (found != null && found.length != 0) {
|
||||
return found;
|
||||
}
|
||||
return isWorld(world) || world.equals("*") ? array : noPlotAreas;
|
||||
}
|
||||
|
||||
|
@ -33,8 +33,9 @@ public class SinglePlotManager extends PlotManager {
|
||||
TaskManager.IMP.taskAsync(new Runnable() {
|
||||
@Override public void run() {
|
||||
MainUtil.deleteDirectory(worldFolder);
|
||||
if (whenDone != null)
|
||||
if (whenDone != null) {
|
||||
whenDone.run();
|
||||
}
|
||||
}
|
||||
});
|
||||
return true;
|
||||
@ -46,8 +47,9 @@ public class SinglePlotManager extends PlotManager {
|
||||
}
|
||||
|
||||
@Override public boolean unclaimPlot(PlotArea plotArea, Plot plot, Runnable whenDone) {
|
||||
if (whenDone != null)
|
||||
if (whenDone != null) {
|
||||
whenDone.run();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -264,10 +264,7 @@ public abstract class ChunkManager {
|
||||
}
|
||||
Location top = new Location(world, x2, 0, z2);
|
||||
plot = top.getOwnedPlotAbs();
|
||||
if (plot != null) {
|
||||
return plot;
|
||||
}
|
||||
return null;
|
||||
return plot;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -17,8 +17,9 @@ public class CmdConfirm {
|
||||
public static void addPending(final PlotPlayer player, String commandStr,
|
||||
final Runnable runnable) {
|
||||
removePending(player);
|
||||
if (commandStr != null)
|
||||
if (commandStr != null) {
|
||||
MainUtil.sendMessage(player, C.REQUIRES_CONFIRM, commandStr);
|
||||
}
|
||||
TaskManager.runTaskLater(new Runnable() {
|
||||
@Override public void run() {
|
||||
CmdInstance cmd = new CmdInstance(runnable);
|
||||
|
@ -181,8 +181,9 @@ public class MathMan {
|
||||
|
||||
public static int floorMod(int x, int y) {
|
||||
int i = x % y;
|
||||
if (i < 0)
|
||||
if (i < 0) {
|
||||
i += y;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
|
@ -171,8 +171,9 @@ public abstract class BasicLocalBlockQueue<T> extends LocalBlockQueue {
|
||||
GlobalBlockQueue.IMP.dequeue(this);
|
||||
TaskManager.IMP.sync(new RunnableVal<Object>() {
|
||||
@Override public void run(Object value) {
|
||||
while (next())
|
||||
while (next()) {
|
||||
;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -329,8 +329,9 @@ public class ExpireManager {
|
||||
long diff = time - existing;
|
||||
if (diff > 0) {
|
||||
Long account_age = this.account_age_cache.get(uuid);
|
||||
if (account_age != null)
|
||||
if (account_age != null) {
|
||||
this.account_age_cache.put(uuid, account_age + diff);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -106,8 +106,9 @@ public class ExpiryTask {
|
||||
}
|
||||
|
||||
public boolean appliesAccountAge(long accountAge) {
|
||||
if (settings.SKIP_ACCOUNT_AGE_DAYS != -1)
|
||||
if (settings.SKIP_ACCOUNT_AGE_DAYS != -1) {
|
||||
return accountAge <= TimeUnit.DAYS.toMillis(settings.SKIP_ACCOUNT_AGE_DAYS);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user