Skip to content
Permalink
Browse files

Fixed most issues from PR

  • Loading branch information...
me4502 committed Aug 2, 2019
1 parent f8b10de commit ecf74cef19ebaa72ad3ffc2577314ab6561a830b
@@ -28,7 +28,9 @@
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.auth.AuthorizationException;
import com.sk89q.worldedit.util.formatting.text.Component;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.formatting.text.adapter.bukkit.TextAdapter;
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
import org.bukkit.Material;
import org.bukkit.command.BlockCommandSender;

@@ -68,21 +70,21 @@ public void printRaw(String msg) {
@Override
public void print(String msg) {
for (String part : msg.split("\n")) {
sender.sendMessage("\u00A7d" + part);
print(TextComponent.of(part, TextColor.LIGHT_PURPLE));
}
}

@Override
public void printDebug(String msg) {
for (String part : msg.split("\n")) {
sender.sendMessage("\u00A77" + part);
print(TextComponent.of(part, TextColor.GRAY));
}
}

@Override
public void printError(String msg) {
for (String part : msg.split("\n")) {
sender.sendMessage("\u00A7c" + part);
print(TextComponent.of(part, TextColor.RED));
}
}

@@ -68,10 +68,10 @@ public void printRaw(String msg) {
}
}

public static final String ANSI_PURPLE = "\u001B[35m";
public static final String ANSI_RED = "\u001B[31m";
public static final String ANSI_GREEN = "\u001B[32m";
public static final String ANSI_RESET = "\u001B[0m";
private static final String ANSI_PURPLE = "\u001B[35m";
private static final String ANSI_RED = "\u001B[31m";
private static final String ANSI_GREEN = "\u001B[32m";
private static final String ANSI_RESET = "\u001B[0m";

@Override
public void print(String msg) {
@@ -26,7 +26,7 @@
public class CLIConfiguration extends PropertiesConfiguration {

public CLIConfiguration(CLIWorldEdit app) {
super(new File(app.getWorkingDir(), "worldedit.properties"));
super(app.getWorkingDir().resolve("worldedit.properties").toFile());
}

@Override
@@ -35,6 +35,6 @@ protected void loadExtra() {

@Override
public File getWorkingDirectory() {
return CLIWorldEdit.inst.getWorkingDir();
return CLIWorldEdit.inst.getWorkingDir().toFile();
}
}
@@ -59,6 +59,7 @@
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.util.Map;
import java.util.Scanner;
@@ -153,7 +154,7 @@ public void setupRegistries() {

public void onInitialized() {
// Setup working directory
workingDir = new File("worldedit").toPath();
workingDir = Paths.get("worldedit");
if (!Files.exists(workingDir)) {
try {
Files.createDirectory(workingDir);
@@ -212,8 +213,8 @@ public Platform getPlatform() {
*
* @return the working directory
*/
public File getWorkingDir() {
return this.workingDir.toFile();
public Path getWorkingDir() {
return this.workingDir;
}

/**
@@ -14,9 +14,6 @@
</Appenders>
<Loggers>
<Root level="info">
<filters>
<MarkerFilter marker="NETWORK_PACKETS" onMatch="DENY" onMismatch="NEUTRAL" />
</filters>
<AppenderRef ref="SysOut"/>
<AppenderRef ref="File"/>
</Root>
@@ -34,6 +34,7 @@

import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class WorldConverter implements ArgumentConverter<World> {

@@ -54,19 +55,22 @@ public Component describeAcceptableArguments() {
return this.choices;
}

private Stream<? extends World> getWorlds() {
return WorldEdit.getInstance().getPlatformManager()
.queryCapability(Capability.GAME_HOOKS).getWorlds().stream();
}

@Override
public List<String> getSuggestions(String input) {
return WorldEdit.getInstance().getPlatformManager()
.queryCapability(Capability.GAME_HOOKS).getWorlds().stream()
return getWorlds()
.map(World::getId)
.filter(world -> world.startsWith(input))
.collect(Collectors.toList());
}

@Override
public ConversionResult<World> convert(String s, InjectedValueAccess injectedValueAccess) {
World result = WorldEdit.getInstance().getPlatformManager()
.queryCapability(Capability.GAME_HOOKS).getWorlds().stream()
World result = getWorlds()
.filter(world -> world.getId().equals(s))
.findAny().orElse(null);
return result == null

0 comments on commit ecf74ce

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