Fix legacy converter.

This commit is contained in:
Alexander Söderberg 2020-02-23 21:10:01 +01:00
parent 8956aedd20
commit e39c7dfcde
3 changed files with 7 additions and 3 deletions

View File

@ -7,6 +7,7 @@ import com.github.intellectualsites.plotsquared.plot.object.Location;
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlockQueue;
import com.github.intellectualsites.plotsquared.plot.util.world.PatternUtil;
import com.google.common.base.Preconditions;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.world.biome.BiomeType;
@ -20,9 +21,9 @@ import org.bukkit.World;
import org.bukkit.block.Biome;
import org.bukkit.generator.ChunkGenerator.BiomeGrid;
import org.bukkit.generator.ChunkGenerator.ChunkData;
import org.jetbrains.annotations.NotNull;
import java.util.Arrays;
import org.jetbrains.annotations.NotNull;
public class GenChunk extends ScopedLocalBlockQueue {
@ -109,7 +110,7 @@ public class GenChunk extends ScopedLocalBlockQueue {
}
@Override public boolean setBlock(int x, int y, int z, @NotNull Pattern pattern) {
return setBlock(x, y, z, PatternUtil.apply(pattern, x, y, z));
return setBlock(x, y, z, PatternUtil.apply(Preconditions.checkNotNull(pattern, "Pattern may not be null"), x, y, z));
}
@Override public boolean setBlock(int x, int y, int z, BlockState id) {

View File

@ -78,7 +78,7 @@ public final class BlockBucket implements ConfigurationSerializable {
private void addBlock(@NonNull final BlockState block, double chance) {
if (chance == -1) chance = 1;
String prefix = input.length() == 0 ? "" : ",";
input.append(prefix).append(chance).append("%").append(prefix);
input.append(prefix).append(chance).append("%").append(block.toString());
this.compiled = false;
}

View File

@ -3,6 +3,7 @@ package com.github.intellectualsites.plotsquared.plot.util.world;
import com.github.intellectualsites.plotsquared.commands.Command;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import com.google.common.base.Preconditions;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.input.InputParseException;
@ -18,7 +19,9 @@ import com.sk89q.worldedit.world.block.BlockType;
import org.jetbrains.annotations.NotNull;
public class PatternUtil {
public static BaseBlock apply(@NotNull Pattern pattern, int x, int y, int z) {
Preconditions.checkNotNull(pattern, "Pattern may not be null");
if (pattern instanceof BlockPattern
|| pattern instanceof RandomPattern
|| pattern instanceof BlockState