This commit is contained in:
Jesse Boyd 2018-09-08 03:11:56 +10:00
parent 11fe5061cc
commit fc949e3efc
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
3 changed files with 11 additions and 27 deletions

View File

@ -27,22 +27,4 @@ public class AsyncTabCompleteListener extends ATabCompleteListener {
} }
} }
} }
// Fix for the event being borked with paper
private List<String> completions = null;
private CommandSender sender;
@EventHandler
public void onTabComplete(TabCompleteEvent event) {
if (event.isCommand()) {
if (sender == event.getSender()) {
event.setCompletions(completions);
sender = null;
} else {
sender = event.getSender();
completions = event.getCompletions();
event.setCompletions(Collections.emptyList());
}
}
}
} }

View File

@ -354,7 +354,7 @@ public class BrushCommands extends BrushProcessor {
InputStream stream = getHeightmapStream(image); InputStream stream = getHeightmapStream(image);
HeightBrush brush; HeightBrush brush;
try { try {
brush = new StencilBrush(stream, rotation, yscale, onlyWhite, image.equalsIgnoreCase("#clipboard") ? session.getClipboard().getClipboard() : null); brush = new StencilBrush(stream, rotation, yscale, onlyWhite, "#clipboard".equalsIgnoreCase(image) ? session.getClipboard().getClipboard() : null);
} catch (EmptyClipboardException ignore) { } catch (EmptyClipboardException ignore) {
brush = new StencilBrush(stream, rotation, yscale, onlyWhite, null); brush = new StencilBrush(stream, rotation, yscale, onlyWhite, null);
} }
@ -735,13 +735,13 @@ public class BrushCommands extends BrushProcessor {
HeightBrush brush; HeightBrush brush;
if (flat) { if (flat) {
try { try {
brush = new FlattenBrush(stream, rotation, yscale, layers, smooth, image.equalsIgnoreCase("#clipboard") ? session.getClipboard().getClipboard() : null, shape); brush = new FlattenBrush(stream, rotation, yscale, layers, smooth, "#clipboard".equalsIgnoreCase(image) ? session.getClipboard().getClipboard() : null, shape);
} catch (EmptyClipboardException ignore) { } catch (EmptyClipboardException ignore) {
brush = new FlattenBrush(stream, rotation, yscale, layers, smooth, null, shape); brush = new FlattenBrush(stream, rotation, yscale, layers, smooth, null, shape);
} }
} else { } else {
try { try {
brush = new HeightBrush(stream, rotation, yscale, layers, smooth, image.equalsIgnoreCase("#clipboard") ? session.getClipboard().getClipboard() : null); brush = new HeightBrush(stream, rotation, yscale, layers, smooth, "#clipboard".equalsIgnoreCase(image) ? session.getClipboard().getClipboard() : null);
} catch (EmptyClipboardException ignore) { } catch (EmptyClipboardException ignore) {
brush = new HeightBrush(stream, rotation, yscale, layers, smooth, null); brush = new HeightBrush(stream, rotation, yscale, layers, smooth, null);
} }
@ -755,6 +755,7 @@ public class BrushCommands extends BrushProcessor {
} }
private InputStream getHeightmapStream(String filename) throws FileNotFoundException, ParameterException { private InputStream getHeightmapStream(String filename) throws FileNotFoundException, ParameterException {
if (filename == null) return null;
String filenamePng = (filename.endsWith(".png") ? filename : filename + ".png"); String filenamePng = (filename.endsWith(".png") ? filename : filename + ".png");
File file = new File(Fawe.imp().getDirectory(), Settings.IMP.PATHS.HEIGHTMAP + File.separator + filenamePng); File file = new File(Fawe.imp().getDirectory(), Settings.IMP.PATHS.HEIGHTMAP + File.separator + filenamePng);
if (file.exists()) return new FileInputStream(file); if (file.exists()) return new FileInputStream(file);

View File

@ -28,8 +28,8 @@ import com.sk89q.jnbt.NBTUtils;
import com.sk89q.jnbt.Tag; import com.sk89q.jnbt.Tag;
import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.BlockVector;
import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.registry.state.Property; import com.sk89q.worldedit.registry.state.Property;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.DataException; import com.sk89q.worldedit.world.DataException;
import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockType;
@ -230,7 +230,7 @@ public class AnvilChunk13 implements Chunk {
} }
@Override @Override
public BaseBlock getBlock(Vector position) throws DataException { public BlockState getBlock(Vector position) throws DataException {
int x = position.getBlockX() - rootX * 16; int x = position.getBlockX() - rootX * 16;
int y = position.getBlockY(); int y = position.getBlockY();
int z = position.getBlockZ() - rootZ * 16; int z = position.getBlockZ() - rootZ * 16;
@ -244,10 +244,11 @@ public class AnvilChunk13 implements Chunk {
BlockState[] sectionBlocks = blocks[section]; BlockState[] sectionBlocks = blocks[section];
BlockState state = sectionBlocks != null ? sectionBlocks[(yIndex << 8) | (z << 4) | x] : BlockTypes.AIR.getDefaultState(); BlockState state = sectionBlocks != null ? sectionBlocks[(yIndex << 8) | (z << 4) | x] : BlockTypes.AIR.getDefaultState();
if (state.getMaterial().hasContainer()) {
CompoundTag tileEntity = getBlockTileEntity(position); CompoundTag tileEntity = getBlockTileEntity(position);
if (tileEntity != null) return new BaseBlock(state, tileEntity);
return state.toBaseBlock(tileEntity); }
return state;
} }
} }