Cleanup unused code.

This commit is contained in:
MattBDev
2020-03-05 16:07:20 -05:00
parent 417cbd585f
commit 915ab43f6e
31 changed files with 192 additions and 358 deletions

View File

@@ -1052,7 +1052,7 @@ public class BrushCommands {
tool.setFill(null);
tool.setBrush(new OperationFactoryBrush(factory, shape, session), permission);
player.print("Set brush to " + factory);
player.print(TextComponent.of("Set brush to " + factory));
}
@Command(

View File

@@ -161,11 +161,11 @@ public class ChunkCommands {
throw new StopExecutionException(TextComponent.of("Failed to write chunk list: " + e.getMessage()));
}
actor.print(String.format("%d chunk(s) have been marked for deletion the next time the server starts.",
newBatch.getChunkCount()));
actor.print(TextComponent.of(String.format("%d chunk(s) have been marked for deletion the next time the server starts.",
newBatch.getChunkCount())));
if (currentInfo.batches.size() > 1) {
actor.printDebug(String.format("%d chunks total marked for deletion. (May have overlaps).",
currentInfo.batches.stream().mapToInt(ChunkDeletionInfo.ChunkBatch::getChunkCount).sum()));
actor.printDebug(TextComponent.of(String.format("%d chunks total marked for deletion. (May have overlaps).",
currentInfo.batches.stream().mapToInt(ChunkDeletionInfo.ChunkBatch::getChunkCount).sum())));
}
actor.print(TextComponent.of("You can mark more chunks for deletion, or to stop now, run: ", TextColor.LIGHT_PURPLE)
.append(TextComponent.of("/stop", TextColor.AQUA)

View File

@@ -182,7 +182,7 @@ public class HistorySubCommands {
RollbackDatabase db = DBHandler.IMP
.getDatabase(world);
db.logEdit(rollback);
actor.print("Logging: " + historyFile);
actor.print(TextComponent.of("Logging: " + historyFile));
}
}
} catch (IllegalArgumentException e) {
@@ -192,7 +192,7 @@ public class HistorySubCommands {
}
}
}
actor.print("Done import!");
actor.print(TextComponent.of("Done import!"));
}
}
@@ -289,7 +289,7 @@ public class HistorySubCommands {
return elem;
} else {
// TODO
return TextComponent.of("");
return TextComponent.empty();
}
}
});

View File

@@ -27,7 +27,6 @@ import static com.sk89q.worldedit.regions.Regions.asFlatRegion;
import static com.sk89q.worldedit.regions.Regions.maximumBlockY;
import static com.sk89q.worldedit.regions.Regions.minimumBlockY;
import com.boydti.fawe.FaweAPI;
import com.boydti.fawe.FaweCache;
import com.boydti.fawe.config.Caption;
import com.boydti.fawe.object.FaweLimit;
@@ -71,7 +70,6 @@ import com.sk89q.worldedit.util.TreeGenerator.TreeType;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockTypes;
import java.util.ArrayList;
@@ -132,7 +130,7 @@ public class RegionCommands {
@CommandPermissions("worldedit.region.test")
@Logging(REGION)
public void test(Player player, EditSession editSession, @Arg(desc = "test") double testValue) throws WorldEditException {
player.print("" + testValue);
player.print(TextComponent.of(testValue));
}
@Command(
@@ -141,7 +139,7 @@ public class RegionCommands {
)
@CommandPermissions("worldedit.light.fix")
public void fixLighting(Player player) throws WorldEditException {
player.print("Temporarily not working");
player.print(TextComponent.of("Temporarily not working"));
// final Location loc = player.getLocation();
// Region selection = player.getSelection();
// if (selection == null) {
@@ -162,7 +160,7 @@ public class RegionCommands {
final Location loc = player.getLocation();
int block = editSession.getBlockLight(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
int sky = editSession.getSkyLight(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
player.print("Light: " + block + " | " + sky);
player.print(TextComponent.of("Light: " + block + " | " + sky));
}
@Command(
@@ -171,7 +169,7 @@ public class RegionCommands {
)
@CommandPermissions("worldedit.light.remove")
public void removeLighting(Player player) {
player.print("Temporarily not working");
player.print(TextComponent.of("Temporarily not working"));
// Region selection = player.getSelection();
// if (selection == null) {
// final int cx = player.getLocation().getBlockX() >> 4;
@@ -196,7 +194,7 @@ public class RegionCommands {
}
CompoundTag nbt = editSession.getFullBlock(pos.toBlockPoint()).getNbtData();
if (nbt != null) {
player.print(nbt.getValue().toString());
player.print(TextComponent.of(nbt.getValue().toString()));
} else {
player.printError(TranslatableComponent.of("fawe.navigation.no.block"));
}
@@ -208,7 +206,7 @@ public class RegionCommands {
)
@CommandPermissions("worldedit.light.set")
public void setlighting(Player player, EditSession editSession, @Selection Region region, @Range(from = 0, to = 15) int value) {
player.print("Temporarily not working");
player.print(TextComponent.of("Temporarily not working"));
}
@Command(
@@ -217,7 +215,7 @@ public class RegionCommands {
)
@CommandPermissions("worldedit.light.set")
public void setskylighting(Player player, @Selection Region region, @Range(from = 0, to= 15) int value) {
player.print("Temporarily not working");
player.printInfo(TextComponent.of("Temporarily not working"));
}
@Command(

View File

@@ -76,7 +76,7 @@ public class WorldEditCommands {
public void version(Actor actor) {
FaweVersion fVer = Fawe.get().getVersion();
String fVerStr = fVer == null ? "unknown" : "-" + fVer.build;
actor.print("FastAsyncWorldEdit" + fVerStr + " created by Empire92");
actor.print(TextComponent.of("FastAsyncWorldEdit" + fVerStr + " created by Empire92"));
if (fVer != null) {
FaweVersion version = Fawe.get().getVersion();
@@ -170,7 +170,7 @@ public class WorldEditCommands {
name = "cui",
desc = "Complete CUI handshake (internal usage)"
)
@CommandPermissions({})
@CommandPermissions()
public void cui(Player player, LocalSession session) {
session.setCUISupport(true);
session.dispatchCUISetup(player);

View File

@@ -78,9 +78,7 @@ public interface Actor extends Identifiable, SessionOwner, Subject, MapMetadatab
* @deprecated Use component-based functions (printDebug)
*/
@Deprecated
default void printDebug(String msg) {
printDebug(TextComponent.of(msg));
}
void printDebug(String msg);
/**
* Print a WorldEdit message.
@@ -89,9 +87,7 @@ public interface Actor extends Identifiable, SessionOwner, Subject, MapMetadatab
* @deprecated Use component-based functions (printInfo)
*/
@Deprecated
default void print(String msg) {
printInfo(TextComponent.of(msg));
}
void print(String msg);
/**
* Print a WorldEdit error.
@@ -100,9 +96,7 @@ public interface Actor extends Identifiable, SessionOwner, Subject, MapMetadatab
* @deprecated Use component-based functions (printError)
*/
@Deprecated
default void printError(String msg) {
printError(TextComponent.of(msg));
}
void printError(String msg);
/**

View File

@@ -33,6 +33,7 @@ import com.sk89q.worldedit.session.SessionKey;
import com.sk89q.worldedit.util.HandSide;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.formatting.text.Component;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockStateHolder;
@@ -141,7 +142,22 @@ public class PlayerProxy extends AbstractPlayerActor {
@Override
public void printRaw(String msg) {
basePlayer.printRaw(msg);
basePlayer.print(TextComponent.of(msg));
}
@Override
public void printDebug(String msg) {
basePlayer.printDebug(TextComponent.of(msg));
}
@Override
public void print(String msg) {
basePlayer.printInfo(TextComponent.of(msg));
}
@Override
public void printError(String msg) {
basePlayer.printError(TextComponent.of(msg));
}
@Override

View File

@@ -280,9 +280,9 @@ public interface Region extends Iterable<BlockVector3>, Cloneable, IBatchProcess
BlockVector3 min = getMinimumPoint();
BlockVector3 max = getMaximumPoint();
boolean processExtra = false;
if (tx >= min.getX() && bx <= max.getX() && tz >= min.getZ() && bz <= max.getZ()) {
// contains some
boolean processExtra = false;
for (int layer = 0; layer < 16; layer++) {
int by = layer << 4;
int ty = by + 15;

View File

@@ -54,7 +54,7 @@ public final class ActorCallbackPaste {
AsyncCommandBuilder.wrap(task, sender)
.registerWithSupervisor(supervisor, "Submitting content to a pastebin service.")
.sendMessageAfterDelay("(Please wait... sending output to pastebin...)")
.onSuccess((String) null, url -> sender.print(String.format(successMessage, url)))
.onSuccess((String) null, url -> sender.print(TextComponent.of(String.format(successMessage, url))))
.onFailure("Failed to submit paste", null)
.buildAndExec(Pasters.getExecutor());
}