Skip to content
Permalink
Browse files

Properly load tags

  • Loading branch information...
me4502 committed Jul 18, 2019
1 parent cbadaa9 commit 436348e4212e4458cd40ca3932241f5bacf2caf6
@@ -22,14 +22,15 @@
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.registry.BlockCategoryRegistry;

import java.util.ArrayList;
import java.util.Set;
import java.util.stream.Collectors;

public class CLIBlockCategoryRegistry implements BlockCategoryRegistry {

@Override
public Set<BlockType> getCategorisedByName(String category) {
return CLIWorldEdit.inst.getFileRegistries().getDataFile().blocktags.get(category).stream()
return CLIWorldEdit.inst.getFileRegistries().getDataFile().blocktags.getOrDefault(category, new ArrayList<>()).stream()
.map(BlockType.REGISTRY::get)
.collect(Collectors.toSet());
}
@@ -228,13 +228,13 @@ public void run() {
String line = scanner.nextLine();
if (line.equalsIgnoreCase("stop")) {
commandSender.print("Stopping!");
return;
break;
}
if (line.startsWith("save")) {
String[] bits = line.split(" ");
if (bits.length == 0) {
commandSender.print("Usage: save <filename>");
return;
continue;
}
World world = platform.getWorlds().get(0);
if (world instanceof ClipboardWorld) {
@@ -246,16 +246,17 @@ public void run() {
}
if (file == null) {
commandSender.printError("Please choose a file.");
return;
continue;
}
try(ClipboardWriter writer = BuiltInClipboardFormat.SPONGE_SCHEMATIC.getWriter(new FileOutputStream(file))) {
writer.write((Clipboard) world);
commandSender.print("Saved to file");
} catch (IOException e) {
e.printStackTrace();
}
}

return;
continue;
}
WorldEdit.getInstance().getEventBus().post(new CommandEvent(
commandSender,

0 comments on commit 436348e

Please sign in to comment.
You can’t perform that action at this time.