Get rid of the string equality and convert a few more ID uses over.

This commit is contained in:
Matthew Miller
2018-01-03 16:39:03 +10:00
parent 41a80064f5
commit f5f1d357d9
39 changed files with 658 additions and 115 deletions

View File

@ -25,6 +25,7 @@ import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.blocks.BlockID;
import com.sk89q.worldedit.blocks.type.BlockTypes;
import javax.annotation.Nullable;
import java.util.Collections;
@ -198,8 +199,8 @@ public class TreeGenerator {
int trunkHeight = (int) Math.floor(Math.random() * 2) + 3;
int height = (int) Math.floor(Math.random() * 5) + 8;
BaseBlock logBlock = new BaseBlock(BlockID.LOG);
BaseBlock leavesBlock = new BaseBlock(BlockID.LEAVES);
BaseBlock logBlock = new BaseBlock(BlockTypes.OAK_LOG);
BaseBlock leavesBlock = new BaseBlock(BlockTypes.OAK_LEAVES);
// Create trunk
for (int i = 0; i < trunkHeight; ++i) {

View File

@ -21,6 +21,7 @@ package com.sk89q.worldedit.util.formatting;
import com.google.common.base.Joiner;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
@ -183,9 +184,7 @@ public class ColorCodeBuilder {
if ((transformed = transform(wordStr)) != null) {
line.append(transformed);
} else {
for (String partialWord : word.toString().split("(?<=\\G.{" + lineLength + "})")) {
lines.add(partialWord);
}
lines.addAll(Arrays.asList(word.toString().split("(?<=\\G.{" + lineLength + "})")));
}
} else if (line.length() + word.length() - lineColorChars == lineLength) { // Line exactly the correct length...newline
line.append(' ');