Critical bug fixes, reformatting, and cleaning

Signed-off-by: matt <4009945+MattBDev@users.noreply.github.com>
This commit is contained in:
matt 2019-02-21 21:14:48 -05:00
parent c5d9412c6c
commit 2f18ef6828
35 changed files with 274 additions and 239 deletions

View File

@ -2,7 +2,7 @@
issueOpened: > issueOpened: >
Thank your for raising a issue. We will try and get back to you as soon as possible. Thank your for raising a issue. We will try and get back to you as soon as possible.
Please make sure that you followed the issue template, and provied all neccessary information. Please make sure that you followed the issue template, and provided all neccessary information.
Failure to do so will prevent us from resolving the issue in a timely manner. Failure to do so will prevent us from resolving the issue in a timely manner.
Please note that suggestions are now to be submitted to https://git.io/fN5B4 rather than this issue tracker! Please note that suggestions are now to be submitted to https://git.io/fN5B4 rather than this issue tracker!

View File

@ -125,8 +125,9 @@ public class EntitySpawnListener implements Listener {
@EventHandler public void onTeleport(EntityTeleportEvent event) { @EventHandler public void onTeleport(EntityTeleportEvent event) {
Entity ent = event.getEntity(); Entity ent = event.getEntity();
if (ent instanceof Vehicle || ent instanceof ArmorStand) if (ent instanceof Vehicle || ent instanceof ArmorStand) {
test(event.getEntity()); test(event.getEntity());
}
} }
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)

View File

@ -672,8 +672,9 @@ import java.util.regex.Pattern;
if (passenger instanceof Player) { if (passenger instanceof Player) {
final Player player = (Player) passenger; final Player player = (Player) passenger;
// reset // reset
if (moveTmp == null) if (moveTmp == null) {
moveTmp = new PlayerMoveEvent(null, from, to); moveTmp = new PlayerMoveEvent(null, from, to);
}
moveTmp.setFrom(from); moveTmp.setFrom(from);
moveTmp.setTo(to); moveTmp.setTo(to);
moveTmp.setCancelled(false); moveTmp.setCancelled(false);
@ -859,8 +860,9 @@ import java.util.regex.Pattern;
} }
@EventHandler(priority = EventPriority.LOW) public void onChat(AsyncPlayerChatEvent event) { @EventHandler(priority = EventPriority.LOW) public void onChat(AsyncPlayerChatEvent event) {
if (event.isCancelled()) if (event.isCancelled()) {
return; return;
}
PlotPlayer plotPlayer = BukkitUtil.getPlayer(event.getPlayer()); PlotPlayer plotPlayer = BukkitUtil.getPlayer(event.getPlayer());
Location location = plotPlayer.getLocation(); Location location = plotPlayer.getLocation();
@ -1077,8 +1079,9 @@ import java.util.regex.Pattern;
PlotArea area = location.getPlotArea(); PlotArea area = location.getPlotArea();
if (area != null) { if (area != null) {
Plot plot = area.getOwnedPlot(location); Plot plot = area.getOwnedPlot(location);
if (plot != null && Flags.MOB_BREAK.isTrue(plot)) if (plot != null && Flags.MOB_BREAK.isTrue(plot)) {
return; return;
}
event.setCancelled(true); event.setCancelled(true);
} }
} }
@ -1446,8 +1449,9 @@ import java.util.regex.Pattern;
switch (type) { switch (type) {
case WATER_BUCKET: case WATER_BUCKET:
case LAVA_BUCKET: { case LAVA_BUCKET: {
if (event.getBlock().getType() == Material.DROPPER) if (event.getBlock().getType() == Material.DROPPER) {
return; return;
}
BlockFace targetFace = BlockFace targetFace =
((Directional) event.getBlock().getState().getData()).getFacing(); ((Directional) event.getBlock().getState().getData()).getFacing();
Location location = Location location =
@ -1570,8 +1574,9 @@ import java.util.regex.Pattern;
switch (newItem.getType()) { switch (newItem.getType()) {
case LEGACY_BANNER: case LEGACY_BANNER:
case PLAYER_HEAD: case PLAYER_HEAD:
if (newMeta != null) if (newMeta != null) {
break; break;
}
default: default:
return; return;
} }
@ -1587,11 +1592,13 @@ import java.util.regex.Pattern;
switch (stateType) { switch (stateType) {
case LEGACY_STANDING_BANNER: case LEGACY_STANDING_BANNER:
case LEGACY_WALL_BANNER: case LEGACY_WALL_BANNER:
if (itemType == Material.LEGACY_BANNER) if (itemType == Material.LEGACY_BANNER) {
break; break;
}
case LEGACY_SKULL: case LEGACY_SKULL:
if (itemType == Material.LEGACY_SKULL_ITEM) if (itemType == Material.LEGACY_SKULL_ITEM) {
break; break;
}
default: default:
return; return;
} }

View File

@ -42,14 +42,18 @@ import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils
public void markChunkAsClean(Chunk chunk) { public void markChunkAsClean(Chunk chunk) {
try { try {
Object nmsChunk = methodGetHandleChunk.invoke(chunk); Object nmsChunk = methodGetHandleChunk.invoke(chunk);
if (done != null) if (done != null) {
this.done.set(nmsChunk, true); this.done.set(nmsChunk, true);
if (mustSave != null) }
if (mustSave != null) {
this.mustSave.set(nmsChunk, false); this.mustSave.set(nmsChunk, false);
if (lit != null) }
if (lit != null) {
this.lit.set(nmsChunk, false); this.lit.set(nmsChunk, false);
if (s != null) }
if (s != null) {
this.s.set(nmsChunk, false); this.s.set(nmsChunk, false);
}
} catch (Throwable e) { } catch (Throwable e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -59,10 +63,12 @@ import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils
World world = event.getWorld(); World world = event.getWorld();
String name = world.getName(); String name = world.getName();
PlotAreaManager man = PlotSquared.get().getPlotAreaManager(); PlotAreaManager man = PlotSquared.get().getPlotAreaManager();
if (!(man instanceof SinglePlotAreaManager)) if (!(man instanceof SinglePlotAreaManager)) {
return; return;
if (!isPlotId(name)) }
if (!isPlotId(name)) {
return; return;
}
markChunkAsClean(event.getChunk()); markChunkAsClean(event.getChunk());
} }

View File

@ -126,10 +126,12 @@ public class BukkitPlayer extends PlotPlayer {
String end = perm.substring(stubPlus.length()); String end = perm.substring(stubPlus.length());
if (MathMan.isInteger(end)) { if (MathMan.isInteger(end)) {
int val = Integer.parseInt(end); int val = Integer.parseInt(end);
if (val > range) if (val > range) {
return val; return val;
if (val > max) }
if (val > max) {
max = val; max = val;
}
} }
} }
} }

View File

@ -145,7 +145,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
ChestedHorse horse1 = (ChestedHorse) horse; ChestedHorse horse1 = (ChestedHorse) horse;
this.horse.chest = horse1.isCarryingChest(); this.horse.chest = horse1.isCarryingChest();
} }
//todo these horse feeatures need fixing //todo these horse features need fixing
//this.horse.variant = horse.getVariant(); //this.horse.variant = horse.getVariant();
//this.horse.style = horse.getStyle(); //this.horse.style = horse.getStyle();
//this.horse.color = horse.getColor(); //this.horse.color = horse.getColor();

View File

@ -109,8 +109,9 @@ public class TitleManager_1_11 {
} }
private static boolean equalsTypeArray(Class<?>[] a, Class<?>[] o) { private static boolean equalsTypeArray(Class<?>[] a, Class<?>[] o) {
if (a.length != o.length) if (a.length != o.length) {
return false; return false;
}
return IntStream.range(0, a.length) return IntStream.range(0, a.length)
.noneMatch(i -> !a[i].equals(o[i]) && !a[i].isAssignableFrom(o[i])); .noneMatch(i -> !a[i].equals(o[i]) && !a[i].isAssignableFrom(o[i]));
} }
@ -202,8 +203,9 @@ public class TitleManager_1_11 {
Integer.TYPE).newInstance(actions[3], null, fadeInTime * (ticks ? 1 : 20), Integer.TYPE).newInstance(actions[3], null, fadeInTime * (ticks ? 1 : 20),
stayTime * (ticks ? 1 : 20), fadeOutTime * (ticks ? 1 : 20)); stayTime * (ticks ? 1 : 20), fadeOutTime * (ticks ? 1 : 20));
// Send if set // Send if set
if (fadeInTime != -1 && fadeOutTime != -1 && stayTime != -1) if (fadeInTime != -1 && fadeOutTime != -1 && stayTime != -1) {
sendPacket.invoke(connection, packet); sendPacket.invoke(connection, packet);
}
Object serialized; Object serialized;
if (!subtitle.equals("")) { if (!subtitle.equals("")) {
@ -339,8 +341,9 @@ public class TitleManager_1_11 {
private Class<?>[] toPrimitiveTypeArray(Class<?>[] classes) { private Class<?>[] toPrimitiveTypeArray(Class<?>[] classes) {
int a = classes != null ? classes.length : 0; int a = classes != null ? classes.length : 0;
Class<?>[] types = new Class<?>[a]; Class<?>[] types = new Class<?>[a];
for (int i = 0; i < a; i++) for (int i = 0; i < a; i++) {
types[i] = getPrimitiveType(classes[i]); types[i] = getPrimitiveType(classes[i]);
}
return types; return types;
} }
@ -357,8 +360,9 @@ public class TitleManager_1_11 {
Class<?>[] t = toPrimitiveTypeArray(paramTypes); Class<?>[] t = toPrimitiveTypeArray(paramTypes);
for (Method m : clazz.getMethods()) { for (Method m : clazz.getMethods()) {
Class<?>[] types = toPrimitiveTypeArray(m.getParameterTypes()); Class<?>[] types = toPrimitiveTypeArray(m.getParameterTypes());
if (m.getName().equals(name) && equalsTypeArray(types, t)) if (m.getName().equals(name) && equalsTypeArray(types, t)) {
return m; return m;
}
} }
return null; return null;
} }
@ -403,24 +407,26 @@ public class TitleManager_1_11 {
} }
private Method getMethod(Class<?> clazz, String name, Class<?>... args) { private Method getMethod(Class<?> clazz, String name, Class<?>... args) {
for (Method m : clazz.getMethods()) for (Method m : clazz.getMethods()) {
if (m.getName().equals(name) && (args.length == 0 || ClassListEqual(args, if (m.getName().equals(name) && (args.length == 0 || ClassListEqual(args, m.getParameterTypes()))) {
m.getParameterTypes()))) {
m.setAccessible(true); m.setAccessible(true);
return m; return m;
} }
}
return null; return null;
} }
private boolean ClassListEqual(Class<?>[] l1, Class<?>[] l2) { private boolean ClassListEqual(Class<?>[] l1, Class<?>[] l2) {
boolean equal = true; boolean equal = true;
if (l1.length != l2.length) if (l1.length != l2.length) {
return false; return false;
for (int i = 0; i < l1.length; i++) }
for (int i = 0; i < l1.length; i++) {
if (l1[i] != l2[i]) { if (l1[i] != l2[i]) {
equal = false; equal = false;
break; break;
} }
}
return equal; return equal;
} }

View File

@ -476,6 +476,7 @@ public class BukkitChunkManager extends ChunkManager {
case SNOWBALL: case SNOWBALL:
case ENDER_PEARL: case ENDER_PEARL:
case ARROW: case ARROW:
case TRIDENT:
case TIPPED_ARROW: case TIPPED_ARROW:
case SHULKER_BULLET: case SHULKER_BULLET:
case SPECTRAL_ARROW: case SPECTRAL_ARROW:
@ -537,6 +538,13 @@ public class BukkitChunkManager extends ChunkManager {
case SKELETON_HORSE: case SKELETON_HORSE:
case ZOMBIE_HORSE: case ZOMBIE_HORSE:
case MULE: case MULE:
case DOLPHIN:
case TURTLE:
case COD:
case PARROT:
case SALMON:
case PUFFERFISH:
case TROPICAL_FISH:
// animal // animal
count[3]++; count[3]++;
count[1]++; count[1]++;

View File

@ -70,8 +70,9 @@ public class BukkitHybridUtils extends HybridUtils {
PlotArea area = PlotSquared.get().getPlotArea(world, null); PlotArea area = PlotSquared.get().getPlotArea(world, null);
if (!(area instanceof HybridPlotWorld)) if (!(area instanceof HybridPlotWorld)) {
return; return;
}
HybridPlotWorld hpw = (HybridPlotWorld) area; HybridPlotWorld hpw = (HybridPlotWorld) area;
final BlockBucket[][] result = hpw.getBlockBucketChunk(); final BlockBucket[][] result = hpw.getBlockBucketChunk();

View File

@ -74,7 +74,7 @@ public final class BukkitLegacyMappings extends LegacyMappings {
new LegacyBlock(19, 1, "sponge", "wet_sponge"), new LegacyBlock(20, "glass"), new LegacyBlock(19, 1, "sponge", "wet_sponge"), new LegacyBlock(20, "glass"),
new LegacyBlock(21, "lapis_ore"), new LegacyBlock(22, "lapis_block"), new LegacyBlock(21, "lapis_ore"), new LegacyBlock(22, "lapis_block"),
new LegacyBlock(23, "dispenser"), new LegacyBlock(24, "sandstone"), new LegacyBlock(23, "dispenser"), new LegacyBlock(24, "sandstone"),
new LegacyBlock(24, 1, "sandstone", "chisled_sandstone"), new LegacyBlock(24, 1, "sandstone", "chiseled_sandstone"),
new LegacyBlock(24, 2, "sandstone", "cut_sandstone"), new LegacyBlock(25, "note_block"), new LegacyBlock(24, 2, "sandstone", "cut_sandstone"), new LegacyBlock(25, "note_block"),
new LegacyBlock(26, "bed_block"), new LegacyBlock(27, "powered_rail"), new LegacyBlock(26, "bed_block"), new LegacyBlock(27, "powered_rail"),
new LegacyBlock(28, "detector_rail"), new LegacyBlock(28, "detector_rail"),
@ -181,10 +181,10 @@ public final class BukkitLegacyMappings extends LegacyMappings {
new LegacyBlock(95, 15, "stained_glass", "black_stained_glass"), new LegacyBlock(95, 15, "stained_glass", "black_stained_glass"),
new LegacyBlock(96, "trap_door", "oak_trapdoor"), new LegacyBlock(96, "trap_door", "oak_trapdoor"),
new LegacyBlock(97, "monster_eggs", "infested_stone"), new LegacyBlock(97, "monster_eggs", "infested_stone"),
new LegacyBlock(97, 1, "monster_eggs", "infested_coblestone"), new LegacyBlock(97, 1, "monster_eggs", "infested_cobblestone"),
new LegacyBlock(97, 2, "monster_eggs", "infested_stone_bricks"), new LegacyBlock(97, 2, "monster_eggs", "infested_stone_bricks"),
new LegacyBlock(97, 3, "monster_eggs", "infested_mossy_stone_bricks"), new LegacyBlock(97, 3, "monster_eggs", "infested_mossy_stone_bricks"),
new LegacyBlock(97, 4, "monster_eggs", "infested_crcked_stone_bricks"), new LegacyBlock(97, 4, "monster_eggs", "infested_cracked_stone_bricks"),
new LegacyBlock(97, 5, "monster_eggs", "infested_chiseled_stone_bricks"), new LegacyBlock(97, 5, "monster_eggs", "infested_chiseled_stone_bricks"),
new LegacyBlock(98, "smooth_brick", "stone_bricks"), new LegacyBlock(98, "smooth_brick", "stone_bricks"),
new LegacyBlock(98, 1, "smooth_brick", "mossy_stone_bricks"), new LegacyBlock(98, 1, "smooth_brick", "mossy_stone_bricks"),
@ -207,7 +207,7 @@ public final class BukkitLegacyMappings extends LegacyMappings {
new LegacyBlock(100, 10, "huge_mushroom_2", "mushroom_stem"), new LegacyBlock(100, 10, "huge_mushroom_2", "mushroom_stem"),
new LegacyBlock(100, 14, "huge_mushroom_2"), new LegacyBlock(100, 14, "huge_mushroom_2"),
new LegacyBlock(100, 15, "huge_mushroom_2"), new LegacyBlock(100, 15, "huge_mushroom_2"),
new LegacyBlock(101, "iron_fence", "ironbars"), new LegacyBlock(101, "iron_fence", "iron_bars"),
new LegacyBlock(102, "thin_glass", "glass_pane"), new LegacyBlock(103, "melon_block"), new LegacyBlock(102, "thin_glass", "glass_pane"), new LegacyBlock(103, "melon_block"),
new LegacyBlock(104, "pumpkin_stem"), new LegacyBlock(105, "melon_stem"), new LegacyBlock(104, "pumpkin_stem"), new LegacyBlock(105, "melon_stem"),
new LegacyBlock(106, "vine"), new LegacyBlock(107, "fence_gate", "oak_fence_gate"), new LegacyBlock(106, "vine"), new LegacyBlock(107, "fence_gate", "oak_fence_gate"),
@ -540,7 +540,7 @@ public final class BukkitLegacyMappings extends LegacyMappings {
new LegacyBlock(383, 5, "monster_egg", "wither_skeleton_spawn_egg"), new LegacyBlock(383, 5, "monster_egg", "wither_skeleton_spawn_egg"),
new LegacyBlock(383, 6, "monster_egg", "stray_spawn_egg"), new LegacyBlock(383, 6, "monster_egg", "stray_spawn_egg"),
new LegacyBlock(383, 23, "monster_egg", "husk_spawn_egg"), new LegacyBlock(383, 23, "monster_egg", "husk_spawn_egg"),
new LegacyBlock(383, 27, "monster_egg", "zombe_villager_spawn_egg"), new LegacyBlock(383, 27, "monster_egg", "zombie_villager_spawn_egg"),
new LegacyBlock(383, 28, "monster_egg", "skeleton_horse_spawn_egg"), new LegacyBlock(383, 28, "monster_egg", "skeleton_horse_spawn_egg"),
new LegacyBlock(383, 29, "monster_egg", "zombie_horse_spawn_egg"), new LegacyBlock(383, 29, "monster_egg", "zombie_horse_spawn_egg"),
new LegacyBlock(383, 31, "monster_egg", "donkey_spawn_egg"), new LegacyBlock(383, 31, "monster_egg", "donkey_spawn_egg"),

View File

@ -264,34 +264,28 @@ import java.util.*;
return getWorld(world).getBiome(x, z).name(); return getWorld(world).getBiome(x, z).name();
} }
@Override @SuppressWarnings("deprecation") @Override public int getHighestBlock(@NonNull final String world, final int x, final int z) {
public void setSign(@NonNull final String worldName, final int x, final int y, final int z, final World bukkitWorld = getWorld(world);
@NonNull final String[] lines) { // Skip top and bottom block
final World world = getWorld(worldName); int air = 1;
final Block block = world.getBlockAt(x, y, z); for (int y = bukkitWorld.getMaxHeight() - 1; y >= 0; y--) {
// block.setType(Material.AIR); Block block = bukkitWorld.getBlockAt(x, y, z);
final Material type = block.getType(); if (block != null) {
if (type != Material.SIGN && type != Material.WALL_SIGN) { Material type = block.getType();
BlockFace facing = BlockFace.EAST; if (type.isSolid()) {
if (world.getBlockAt(x, y, z + 1).getType().isSolid()) if (air > 1) {
facing = BlockFace.NORTH; return y;
else if (world.getBlockAt(x + 1, y, z).getType().isSolid()) }
facing = BlockFace.WEST; air = 0;
else if (world.getBlockAt(x, y, z - 1).getType().isSolid()) } else {
facing = BlockFace.SOUTH; if (block.isLiquid()) {
block.setType(Material.WALL_SIGN, false); return y;
final WallSign sign = (WallSign) block.getBlockData(); }
sign.setFacing(facing); air++;
block.setBlockData(sign, false); }
}
final BlockState blockstate = block.getState();
if (blockstate instanceof Sign) {
final Sign sign = (Sign) blockstate;
for (int i = 0; i < lines.length; i++) {
sign.setLine(i, lines[i]);
} }
sign.update(true);
} }
return bukkitWorld.getMaxHeight() - 1;
} }
@Override @Nullable public String[] getSign(@NonNull final Location location) { @Override @Nullable public String[] getSign(@NonNull final Location location) {
@ -330,27 +324,35 @@ import java.util.*;
} }
} }
@Override public int getHighestBlock(@NonNull final String world, final int x, final int z) { @Override @SuppressWarnings("deprecation")
final World bukkitWorld = getWorld(world); public void setSign(@NonNull final String worldName, final int x, final int y, final int z,
// Skip top and bottom block @NonNull final String[] lines) {
int air = 1; final World world = getWorld(worldName);
for (int y = bukkitWorld.getMaxHeight() - 1; y >= 0; y--) { final Block block = world.getBlockAt(x, y, z);
Block block = bukkitWorld.getBlockAt(x, y, z); // block.setType(Material.AIR);
if (block != null) { final Material type = block.getType();
Material type = block.getType(); if (type != Material.SIGN && type != Material.WALL_SIGN) {
if (type.isSolid()) { BlockFace facing = BlockFace.EAST;
if (air > 1) if (world.getBlockAt(x, y, z + 1).getType().isSolid()) {
return y; facing = BlockFace.NORTH;
air = 0; } else if (world.getBlockAt(x + 1, y, z).getType().isSolid()) {
} else { facing = BlockFace.WEST;
if (block.isLiquid()) { } else if (world.getBlockAt(x, y, z - 1).getType().isSolid()) {
return y; facing = BlockFace.SOUTH;
}
air++;
}
} }
block.setType(Material.WALL_SIGN, false);
final WallSign sign = (WallSign) block.getBlockData();
sign.setFacing(facing);
block.setBlockData(sign, false);
}
final BlockState blockstate = block.getState();
if (blockstate instanceof Sign) {
final Sign sign = (Sign) blockstate;
for (int i = 0; i < lines.length; i++) {
sign.setLine(i, lines[i]);
}
sign.update(true);
} }
return bukkitWorld.getMaxHeight() - 1;
} }
@Override public int getBiomeFromString(@NonNull final String biomeString) { @Override public int getBiomeFromString(@NonNull final String biomeString) {

File diff suppressed because one or more lines are too long

View File

@ -15,11 +15,8 @@ import java.util.ArrayList;
import java.util.Objects; import java.util.Objects;
import java.util.Set; import java.util.Set;
@CommandDeclaration(command = "area", permission = "plots.area", @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)
category = CommandCategory.ADMINISTRATION, requiredType = RequiredType.NONE, public class Area extends SubCommand {
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) { @Override public boolean onCommand(final PlotPlayer player, String[] args) {
if (args.length == 0) { if (args.length == 0) {
@ -104,36 +101,34 @@ import java.util.Set;
final String path = final String path =
"worlds." + area.worldname + ".areas." + area.id + '-' "worlds." + area.worldname + ".areas." + area.id + '-'
+ object.min + '-' + object.max; + object.min + '-' + object.max;
Runnable run = new Runnable() { Runnable run = () -> {
@Override public void run() { if (offsetX != 0) {
if (offsetX != 0) { PlotSquared.get().worlds
PlotSquared.get().worlds .set(path + ".road.offset.x", offsetX);
.set(path + ".road.offset.x", offsetX); }
} if (offsetZ != 0) {
if (offsetZ != 0) { PlotSquared.get().worlds
PlotSquared.get().worlds .set(path + ".road.offset.z", offsetZ);
.set(path + ".road.offset.z", offsetZ); }
} final String world = SetupUtils.manager.setupWorld(object);
final String world = SetupUtils.manager.setupWorld(object); if (WorldUtil.IMP.isWorld(world)) {
if (WorldUtil.IMP.isWorld(world)) { PlotSquared.get().loadWorld(world, null);
PlotSquared.get().loadWorld(world, null); C.SETUP_FINISHED.send(player);
C.SETUP_FINISHED.send(player); player.teleport(WorldUtil.IMP.getSpawn(world));
player.teleport(WorldUtil.IMP.getSpawn(world)); if (area.TERRAIN != 3) {
if (area.TERRAIN != 3) { ChunkManager.largeRegionTask(world, region,
ChunkManager.largeRegionTask(world, region, new RunnableVal<ChunkLoc>() {
new RunnableVal<ChunkLoc>() { @Override public void run(ChunkLoc value) {
@Override public void run(ChunkLoc value) { AugmentedUtils
AugmentedUtils .generate(world, value.x, value.z,
.generate(world, value.x, value.z, null);
null); }
} }, null);
}, null);
}
} else {
MainUtil.sendMessage(player,
"An error occurred while creating the world: "
+ area.worldname);
} }
} else {
MainUtil.sendMessage(player,
"An error occurred while creating the world: "
+ area.worldname);
} }
}; };
if (hasConfirmation(player)) { if (hasConfirmation(player)) {
@ -228,32 +223,30 @@ import java.util.Set;
C.SETUP_WORLD_TAKEN.send(player, pa.worldname); C.SETUP_WORLD_TAKEN.send(player, pa.worldname);
return false; return false;
} }
Runnable run = new Runnable() { Runnable run = () -> {
@Override public void run() { String path = "worlds." + pa.worldname;
String path = "worlds." + pa.worldname; if (!PlotSquared.get().worlds.contains(path)) {
if (!PlotSquared.get().worlds.contains(path)) { PlotSquared.get().worlds.createSection(path);
PlotSquared.get().worlds.createSection(path); }
} ConfigurationSection section =
ConfigurationSection section = PlotSquared.get().worlds.getConfigurationSection(path);
PlotSquared.get().worlds.getConfigurationSection(path); pa.saveConfiguration(section);
pa.saveConfiguration(section); pa.loadConfiguration(section);
pa.loadConfiguration(section); object.plotManager = PlotSquared.imp().getPluginName();
object.plotManager = PlotSquared.imp().getPluginName(); object.setupGenerator = PlotSquared.imp().getPluginName();
object.setupGenerator = PlotSquared.imp().getPluginName(); String world = SetupUtils.manager.setupWorld(object);
String world = SetupUtils.manager.setupWorld(object); if (WorldUtil.IMP.isWorld(world)) {
if (WorldUtil.IMP.isWorld(world)) { C.SETUP_FINISHED.send(player);
C.SETUP_FINISHED.send(player); player.teleport(WorldUtil.IMP.getSpawn(world));
player.teleport(WorldUtil.IMP.getSpawn(world)); } else {
} else { MainUtil.sendMessage(player,
MainUtil.sendMessage(player, "An error occurred while creating the world: "
"An error occurred while creating the world: " + pa.worldname);
+ pa.worldname); }
} try {
try { PlotSquared.get().worlds.save(PlotSquared.get().worldsFile);
PlotSquared.get().worlds.save(PlotSquared.get().worldsFile); } catch (IOException e) {
} catch (IOException e) { e.printStackTrace();
e.printStackTrace();
}
} }
}; };
if (hasConfirmation(player)) { if (hasConfirmation(player)) {
@ -422,11 +415,7 @@ import java.util.Set;
@Override public void run(ChunkLoc value) { @Override public void run(ChunkLoc value) {
AugmentedUtils.generate(area.worldname, value.x, value.z, null); AugmentedUtils.generate(area.worldname, value.x, value.z, null);
} }
}, new Runnable() { }, () -> player.sendMessage("Regen complete"));
@Override public void run() {
player.sendMessage("Regen complete");
}
});
return true; return true;
} }
case "goto": case "goto":

View File

@ -22,8 +22,9 @@ public class Auto extends SubCommand {
private static boolean checkAllowedPlots(PlotPlayer player, PlotArea plotarea, private static boolean checkAllowedPlots(PlotPlayer player, PlotArea plotarea,
@Nullable Integer allowed_plots, int size_x, int size_z) { @Nullable Integer allowed_plots, int size_x, int size_z) {
if (allowed_plots == null) if (allowed_plots == null) {
allowed_plots = player.getAllowedPlots(); allowed_plots = player.getAllowedPlots();
}
int currentPlots = int currentPlots =
Settings.Limit.GLOBAL ? player.getPlotCount() : player.getPlotCount(plotarea.worldname); Settings.Limit.GLOBAL ? player.getPlotCount() : player.getPlotCount(plotarea.worldname);
int diff = currentPlots - allowed_plots; int diff = currentPlots - allowed_plots;
@ -189,8 +190,9 @@ public class Auto extends SubCommand {
} }
final int allowed_plots = player.getAllowedPlots(); final int allowed_plots = player.getAllowedPlots();
if (player.getMeta(Auto.class.getName(), false) || !checkAllowedPlots(player, plotarea, if (player.getMeta(Auto.class.getName(), false) || !checkAllowedPlots(player, plotarea,
allowed_plots, size_x, size_z)) allowed_plots, size_x, size_z)) {
return false; return false;
}
if (schematic != null && !schematic.isEmpty()) { if (schematic != null && !schematic.isEmpty()) {
if (!plotarea.SCHEMATICS.contains(schematic.toLowerCase())) { if (!plotarea.SCHEMATICS.contains(schematic.toLowerCase())) {

View File

@ -70,7 +70,7 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
RunnableVal3<Command, Runnable, Runnable> confirm, RunnableVal3<Command, Runnable, Runnable> confirm,
RunnableVal2<Command, CommandResult> whenDone) { RunnableVal2<Command, CommandResult> whenDone) {
PlotArea area = player.getApplicablePlotArea(); PlotArea area = player.getApplicablePlotArea();
boolean chat = area == null ? false : area.PLOT_CHAT; boolean chat = area != null && area.PLOT_CHAT;
if (toggle(player, "disabletitles") != chat) { if (toggle(player, "disabletitles") != chat) {
MainUtil.sendMessage(player, C.TOGGLE_ENABLED, command.toString()); MainUtil.sendMessage(player, C.TOGGLE_ENABLED, command.toString());
} else { } else {

View File

@ -64,8 +64,9 @@ import java.util.*;
page = Integer.parseInt(args[1]); page = Integer.parseInt(args[1]);
case 1: case 1:
UUID user = args[0].length() >= 2 ? UUIDHandler.getUUIDFromString(args[0]) : null; 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; user = null;
}
if (page == Integer.MIN_VALUE && user == null && MathMan.isInteger(args[0])) { if (page == Integer.MIN_VALUE && user == null && MathMan.isInteger(args[0])) {
page = Integer.parseInt(args[0]); page = Integer.parseInt(args[0]);
unsorted = PlotSquared.get().getBasePlots(player); unsorted = PlotSquared.get().getBasePlots(player);

View File

@ -45,7 +45,7 @@ public interface AbstractDB {
void createTables() throws Exception; void createTables() throws Exception;
/** /**
* Deletess a plot. * Deletes a plot.
* *
* @param plot the plot to delete * @param plot the plot to delete
*/ */

View File

@ -1001,14 +1001,16 @@ import java.util.concurrent.atomic.AtomicInteger;
+ "plot_settings`(`plot_plot_id`) VALUES(?)"); + "plot_settings`(`plot_plot_id`) VALUES(?)");
} }
}); });
if (success != null) if (success != null) {
addNotifyTask(success); addNotifyTask(success);
}
return; return;
} }
} }
} }
if (failure != null) if (failure != null) {
failure.run(); failure.run();
}
} }
}); });
} }

View File

@ -145,7 +145,7 @@ public class ClassicPlotManager extends SquarePlotManager {
Location top = plot.getExtendedTopAbs(); Location top = plot.getExtendedTopAbs();
LocalBlockQueue queue = plotArea.getQueue(false); LocalBlockQueue queue = plotArea.getQueue(false);
int maxY = plotArea.getPlotManager().getWorldHeight(); int maxY = plotArea.getPlotManager().getWorldHeight();
if (!plot.getMerged(0)) { if (!plot.getMerged(Direction.NORTH)) {
int z = bottom.getZ(); int z = bottom.getZ();
for (int x = bottom.getX(); x <= top.getX(); x++) { for (int x = bottom.getX(); x <= top.getX(); x++) {
for (int y = dpw.PLOT_HEIGHT; y <= maxY; y++) { 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(); int x = bottom.getX();
for (int z = bottom.getZ(); z <= top.getZ(); z++) { for (int z = bottom.getZ(); z <= top.getZ(); z++) {
for (int y = dpw.PLOT_HEIGHT; y <= maxY; y++) { 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(); int z = top.getZ();
for (int x = bottom.getX(); x <= top.getX(); x++) { for (int x = bottom.getX(); x <= top.getX(); x++) {
for (int y = dpw.PLOT_HEIGHT; y <= maxY; y++) { 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(); int x = top.getX();
for (int z = bottom.getZ(); z <= top.getZ(); z++) { for (int z = bottom.getZ(); z <= top.getZ(); z++) {
for (int y = dpw.PLOT_HEIGHT; y <= maxY; y++) { for (int y = dpw.PLOT_HEIGHT; y <= maxY; y++) {
@ -196,10 +196,11 @@ public class ClassicPlotManager extends SquarePlotManager {
} }
Plot plot = plotArea.getPlotAbs(plotId); Plot plot = plotArea.getPlotAbs(plotId);
Location bot = plot.getExtendedBottomAbs() 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); Location top = plot.getExtendedTopAbs().add(1, 0, 1);
LocalBlockQueue queue = plotArea.getQueue(false); LocalBlockQueue queue = plotArea.getQueue(false);
if (!plot.getMerged(0)) { if (!plot.getMerged(Direction.NORTH)) {
int z = bot.getZ(); int z = bot.getZ();
for (int x = bot.getX(); x < top.getX(); x++) { for (int x = bot.getX(); x < top.getX(); x++) {
for (int y = 1; y <= dpw.WALL_HEIGHT; y++) { 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(); int x = bot.getX();
for (int z = bot.getZ(); z < top.getZ(); z++) { for (int z = bot.getZ(); z < top.getZ(); z++) {
for (int y = 1; y <= dpw.WALL_HEIGHT; y++) { 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(); 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++) { for (int y = 1; y <= dpw.WALL_HEIGHT; y++) {
queue.setBlock(x, y, z, blocks.getBlock()); queue.setBlock(x, y, z, blocks.getBlock());
} }
} }
} }
if (!plot.getMerged(1)) { if (!plot.getMerged(Direction.EAST)) {
int x = top.getX(); 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++) { for (int y = 1; y <= dpw.WALL_HEIGHT; y++) {
queue.setBlock(x, y, z, blocks.getBlock()); queue.setBlock(x, y, z, blocks.getBlock());
} }
@ -242,32 +245,35 @@ public class ClassicPlotManager extends SquarePlotManager {
} }
Plot plot = plotArea.getPlotAbs(plotId); Plot plot = plotArea.getPlotAbs(plotId);
Location bot = plot.getExtendedBottomAbs() 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); Location top = plot.getExtendedTopAbs().add(1, 0, 1);
PseudoRandom random = new PseudoRandom(); PseudoRandom random = new PseudoRandom();
LocalBlockQueue queue = plotArea.getQueue(false); LocalBlockQueue queue = plotArea.getQueue(false);
int y = dpw.WALL_HEIGHT + 1; int y = dpw.WALL_HEIGHT + 1;
if (!plot.getMerged(0)) { if (!plot.getMerged(Direction.NORTH)) {
int z = bot.getZ(); int z = bot.getZ();
for (int x = bot.getX(); x < top.getX(); x++) { for (int x = bot.getX(); x < top.getX(); x++) {
queue.setBlock(x, y, z, blocks.getBlock()); queue.setBlock(x, y, z, blocks.getBlock());
} }
} }
if (!plot.getMerged(3)) { if (!plot.getMerged(Direction.WEST)) {
int x = bot.getX(); int x = bot.getX();
for (int z = bot.getZ(); z < top.getZ(); z++) { for (int z = bot.getZ(); z < top.getZ(); z++) {
queue.setBlock(x, y, z, blocks.getBlock()); queue.setBlock(x, y, z, blocks.getBlock());
} }
} }
if (!plot.getMerged(2)) { if (!plot.getMerged(Direction.SOUTH)) {
int z = top.getZ(); 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()); queue.setBlock(x, y, z, blocks.getBlock());
} }
} }
if (!plot.getMerged(1)) { if (!plot.getMerged(Direction.EAST)) {
int x = top.getX(); 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()); queue.setBlock(x, y, z, blocks.getBlock());
} }
} }

View File

@ -95,9 +95,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
return bot.add(-1, 0, -2); return bot.add(-1, 0, -2);
} else { } else {
bot.setY(0); bot.setY(0);
Location loc = return bot.add(SIGN_LOCATION.getX(), SIGN_LOCATION.getY(), SIGN_LOCATION.getZ());
bot.add(SIGN_LOCATION.getX(), SIGN_LOCATION.getY(), SIGN_LOCATION.getZ());
return loc;
} }
} }
@ -277,11 +275,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
id = rotate(id); id = rotate(id);
} }
int pair = MathMan.pair(x, z); int pair = MathMan.pair(x, z);
BaseBlock[] existing = this.G_SCH.get(pair); BaseBlock[] existing = this.G_SCH.computeIfAbsent(pair, k -> new BaseBlock[height]);
if (existing == null) {
existing = new BaseBlock[height];
this.G_SCH.put(pair, existing);
}
existing[y] = id; existing[y] = id;
} }
} }

View File

@ -173,28 +173,28 @@ public abstract class SquarePlotManager extends GridPlotManager {
switch (hash) { switch (hash) {
case 8: case 8:
// north // north
return plot.getMerged(0) ? id : null; return plot.getMerged(Direction.NORTH) ? id : null;
case 4: case 4:
// east // east
return plot.getMerged(1) ? id : null; return plot.getMerged(Direction.EAST) ? id : null;
case 2: case 2:
// south // south
return plot.getMerged(2) ? id : null; return plot.getMerged(Direction.SOUTH) ? id : null;
case 1: case 1:
// west // west
return plot.getMerged(3) ? id : null; return plot.getMerged(Direction.WEST) ? id : null;
case 12: case 12:
// northest // northeast
return plot.getMerged(4) ? id : null; return plot.getMerged(Direction.NORTHEAST) ? id : null;
case 6: case 6:
// southeast // southeast
return plot.getMerged(5) ? id : null; return plot.getMerged(Direction.SOUTHEAST) ? id : null;
case 3: case 3:
// southwest // southwest
return plot.getMerged(6) ? id : null; return plot.getMerged(Direction.SOUTHWEST) ? id : null;
case 9: case 9:
// northwest // northwest
return plot.getMerged(7) ? id : null; return plot.getMerged(Direction.NORTHWEST) ? id : null;
} }
PlotSquared.debug("invalid location: " + Arrays.toString(merged)); PlotSquared.debug("invalid location: " + Arrays.toString(merged));
} catch (Exception ignored) { } catch (Exception ignored) {

View File

@ -13,7 +13,7 @@ import com.sk89q.worldedit.extent.NullExtent;
import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.util.Location; 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.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockStateHolder;
@ -46,21 +46,22 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
this.parent = parent; this.parent = parent;
} }
@Override public BlockState getBlock(BlockVector3 location) { @Override public BlockState getBlock(BlockVector3 position) {
if (WEManager.maskContains(this.mask, location.getX(), location.getY(), location.getZ())) { if (WEManager.maskContains(this.mask, position.getX(), position.getY(), position.getZ())) {
return super.getBlock(location); return super.getBlock(position);
} }
return WEExtent.AIRSTATE; return WEExtent.AIRSTATE;
} }
@Override public BaseBlock getFullBlock(BlockVector3 location) { @Override public BaseBlock getFullBlock(BlockVector3 position) {
if (WEManager.maskContains(this.mask, location.getX(), location.getY(), location.getZ())) { if (WEManager.maskContains(this.mask, position.getX(), position.getY(), position.getZ())) {
return super.getFullBlock(location); return super.getFullBlock(position);
} }
return WEExtent.AIRBASE; 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 { throws WorldEditException {
String id = block.getBlockType().getId(); String id = block.getBlockType().getId();
switch (id) { switch (id) {
@ -171,7 +172,7 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
return null; 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 return WEManager.maskContains(this.mask, position.getX(), position.getZ()) && super
.setBiome(position, biome); .setBiome(position, biome);
} }

View File

@ -9,7 +9,7 @@ import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.util.Location; 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.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockStateHolder;
@ -42,22 +42,22 @@ public class WEExtent extends AbstractDelegateExtent {
return null; return null;
} }
@Override public boolean setBiome(BlockVector2 position, BaseBiome biome) { @Override public BlockState getBlock(BlockVector3 position) {
return WEManager.maskContains(this.mask, position.getX(), position.getZ()) && super if (WEManager.maskContains(this.mask, position.getX(), position.getY(), position.getZ())) {
.setBiome(position, biome); return super.getBlock(position);
}
@Override public BlockState getBlock(BlockVector3 location) {
if (WEManager.maskContains(this.mask, location.getX(), location.getY(), location.getZ())) {
return super.getBlock(location);
} }
return AIRSTATE; return AIRSTATE;
} }
@Override public BaseBlock getFullBlock(BlockVector3 location) { @Override public BaseBlock getFullBlock(BlockVector3 position) {
if (WEManager.maskContains(this.mask, location.getX(), location.getY(), location.getZ())) { if (WEManager.maskContains(this.mask, position.getX(), position.getY(), position.getZ())) {
return super.getFullBlock(location); return super.getFullBlock(position);
} }
return AIRBASE; return AIRBASE;
} }
@Override public boolean setBiome(BlockVector2 position, BiomeType biome) {
return WEManager.maskContains(this.mask, position.getX(), position.getZ()) && super
.setBiome(position, biome);
}
} }

View File

@ -3015,4 +3015,8 @@ public class Plot {
@SuppressWarnings("deprecation") public void setComments(List<PlotComment> list) { @SuppressWarnings("deprecation") public void setComments(List<PlotComment> list) {
getSettings().setComments(list); getSettings().setComments(list);
} }
public boolean getMerged(Direction direction) {
return getMerged(direction.getIndex());
}
} }

View File

@ -713,8 +713,9 @@ public abstract class PlotArea {
if (TYPE == 2) { if (TYPE == 2) {
center = new PlotId(MathMan.average(min.x, max.x), MathMan.average(min.y, max.y)); 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; 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); start = new PlotId(start.x - center.x, start.y - center.y);
}
} else { } else {
center = new PlotId(0, 0); center = new PlotId(0, 0);
plots = Integer.MAX_VALUE; plots = Integer.MAX_VALUE;

View File

@ -6,7 +6,6 @@ import com.github.intellectualsites.plotsquared.plot.object.comment.PlotComment;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import java.util.*; import java.util.*;
import java.util.stream.IntStream;
/** /**
* Generic settings class. * Generic settings class.
@ -57,13 +56,6 @@ public class PlotSettings {
return this.merged[direction]; 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() { public boolean[] getMerged() {
return this.merged; return this.merged;
} }

View File

@ -30,8 +30,9 @@ public class SinglePlotArea extends GridPlotWorld {
TaskManager.IMP.sync(new RunnableVal<Object>() { TaskManager.IMP.sync(new RunnableVal<Object>() {
@Override public void run(Object value) { @Override public void run(Object value) {
String worldName = id.toCommaSeparatedString(); String worldName = id.toCommaSeparatedString();
if (WorldUtil.IMP.isWorld(worldName)) if (WorldUtil.IMP.isWorld(worldName)) {
return; return;
}
SetupObject setup = new SetupObject(); SetupObject setup = new SetupObject();
setup.plotManager = "PlotSquared:single"; setup.plotManager = "PlotSquared:single";
setup.setupGenerator = "PlotSquared:single"; setup.setupGenerator = "PlotSquared:single";

View File

@ -70,32 +70,36 @@ public class SinglePlotAreaManager extends DefaultPlotAreaManager {
@Override public PlotArea getApplicablePlotArea(Location location) { @Override public PlotArea getApplicablePlotArea(Location location) {
PlotArea found = super.getApplicablePlotArea(location); PlotArea found = super.getApplicablePlotArea(location);
if (found != null) if (found != null) {
return found; return found;
}
String world = location.getWorld(); String world = location.getWorld();
return isWorld(world) || world.equals("*") || super.getAllPlotAreas().length == 0 ? return isWorld(world) || world.equals("*") || super.getAllPlotAreas().length == 0 ?
area : area :
null; 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) { @Override public PlotArea getPlotArea(String world, String id) {
PlotArea found = super.getPlotArea(world, id); PlotArea found = super.getPlotArea(world, id);
if (found != null) if (found != null) {
return found; return found;
}
return isWorld(world) || world.equals("*") ? area : null; 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) { @Override public PlotArea[] getPlotAreas(String world, RegionWrapper region) {
PlotArea[] found = super.getPlotAreas(world, region); PlotArea[] found = super.getPlotAreas(world, region);
if (found != null && found.length != 0) if (found != null && found.length != 0) {
return found; return found;
}
return isWorld(world) || world.equals("*") ? array : noPlotAreas; return isWorld(world) || world.equals("*") ? array : noPlotAreas;
} }

View File

@ -33,8 +33,9 @@ public class SinglePlotManager extends PlotManager {
TaskManager.IMP.taskAsync(new Runnable() { TaskManager.IMP.taskAsync(new Runnable() {
@Override public void run() { @Override public void run() {
MainUtil.deleteDirectory(worldFolder); MainUtil.deleteDirectory(worldFolder);
if (whenDone != null) if (whenDone != null) {
whenDone.run(); whenDone.run();
}
} }
}); });
return true; return true;
@ -46,8 +47,9 @@ public class SinglePlotManager extends PlotManager {
} }
@Override public boolean unclaimPlot(PlotArea plotArea, Plot plot, Runnable whenDone) { @Override public boolean unclaimPlot(PlotArea plotArea, Plot plot, Runnable whenDone) {
if (whenDone != null) if (whenDone != null) {
whenDone.run(); whenDone.run();
}
return true; return true;
} }

View File

@ -264,10 +264,7 @@ public abstract class ChunkManager {
} }
Location top = new Location(world, x2, 0, z2); Location top = new Location(world, x2, 0, z2);
plot = top.getOwnedPlotAbs(); plot = top.getOwnedPlotAbs();
if (plot != null) { return plot;
return plot;
}
return null;
} }
/** /**

View File

@ -17,8 +17,9 @@ public class CmdConfirm {
public static void addPending(final PlotPlayer player, String commandStr, public static void addPending(final PlotPlayer player, String commandStr,
final Runnable runnable) { final Runnable runnable) {
removePending(player); removePending(player);
if (commandStr != null) if (commandStr != null) {
MainUtil.sendMessage(player, C.REQUIRES_CONFIRM, commandStr); MainUtil.sendMessage(player, C.REQUIRES_CONFIRM, commandStr);
}
TaskManager.runTaskLater(new Runnable() { TaskManager.runTaskLater(new Runnable() {
@Override public void run() { @Override public void run() {
CmdInstance cmd = new CmdInstance(runnable); CmdInstance cmd = new CmdInstance(runnable);

View File

@ -181,8 +181,9 @@ public class MathMan {
public static int floorMod(int x, int y) { public static int floorMod(int x, int y) {
int i = x % y; int i = x % y;
if (i < 0) if (i < 0) {
i += y; i += y;
}
return i; return i;
} }

View File

@ -171,8 +171,9 @@ public abstract class BasicLocalBlockQueue<T> extends LocalBlockQueue {
GlobalBlockQueue.IMP.dequeue(this); GlobalBlockQueue.IMP.dequeue(this);
TaskManager.IMP.sync(new RunnableVal<Object>() { TaskManager.IMP.sync(new RunnableVal<Object>() {
@Override public void run(Object value) { @Override public void run(Object value) {
while (next()) while (next()) {
; ;
}
} }
}); });
} }

View File

@ -329,8 +329,9 @@ public class ExpireManager {
long diff = time - existing; long diff = time - existing;
if (diff > 0) { if (diff > 0) {
Long account_age = this.account_age_cache.get(uuid); 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); this.account_age_cache.put(uuid, account_age + diff);
}
} }
} }
} }

View File

@ -106,8 +106,9 @@ public class ExpiryTask {
} }
public boolean appliesAccountAge(long accountAge) { 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 accountAge <= TimeUnit.DAYS.toMillis(settings.SKIP_ACCOUNT_AGE_DAYS);
}
return false; return false;
} }