Add message prefix to the worldedit commands

This commit is contained in:
Jesse Boyd 2016-12-21 05:56:41 +11:00
parent f5f326bf89
commit 0e26ce6e1e
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
12 changed files with 66 additions and 68 deletions

View File

@ -69,7 +69,7 @@ public class AnvilCommands {
}
}
});
player.print(BBC.VISITOR_BLOCK.format(count.longValue()));
player.print(BBC.getPrefix() + BBC.VISITOR_BLOCK.format(count.longValue()));
}
@Command(
@ -114,7 +114,7 @@ public class AnvilCommands {
}
}
});
player.print(BBC.VISITOR_BLOCK.format(count.longValue()));
player.print(BBC.getPrefix() + BBC.VISITOR_BLOCK.format(count.longValue()));
}
@Command(
@ -189,7 +189,7 @@ public class AnvilCommands {
};
}
queue.filterWorld(filter);
player.print(BBC.SELECTION_COUNT.format(count.longValue()));
player.print(BBC.getPrefix() + BBC.SELECTION_COUNT.format(count.longValue()));
}
}

View File

@ -85,7 +85,6 @@ public enum BBC {
SELECTION_OUTSET("Region outset", "WorldEdit.Selection"),
SELECTION_SHIFT("Region shifted", "WorldEdit.Selection"),
SELECTION_CLEARED("Selection cleared", "WorldEdit.Selection"),
SELECTION_NONE("Make a region selection first", "WorldEdit.Selection"),
BRUSH_NONE("You aren't holding a brush!", "WorldEdit.Brush"),
BRUSH_BUTCHER("Butcher brush equiped (%s0)", "WorldEdit.Brush"),
@ -95,7 +94,7 @@ public enum BBC {
BRUSH_GRAVITY("Gravity brush equipped (%s0)", "WorldEdit.Brush"),
BRUSH_HEIGHT("Height brush equipped (%s0)", "WorldEdit.Brush"),
BRUSH_TRY_OTHER("&cFAWE adds other, more suitable brushes e.g.\n&8 - &7//br height [radius=5] [#clipboard|file=null] [rotation=0] [yscale=1.00]", "WorldEdit.Brush"),
BRUSH_COPY("Copy brush equipped (%s0)", "WorldEdit.Brush"),
BRUSH_COPY("Copy brush equipped (%s0). Left click the base of an object to copy, right click to paste. Increase the brush radius if necessary.", "WorldEdit.Brush"),
BRUSH_COMMAND("Command brush equipped (%s0)", "WorldEdit.Brush"),
BRUSH_HEIGHT_INVALID("Invalid height map file (%s0)", "WorldEdit.Brush"),
BRUSH_SMOOTH("Smooth brush equipped (%s0 x %s1 using %s2).", "WorldEdit.Brush"),
@ -220,7 +219,7 @@ public enum BBC {
SEL_MAX("%s0 points maximum.", "Selection"),
SEL_FUZZY("Fuzzy selector: Left click to select all contingent blocks, right click to add", "Selection"),
SEL_CONVEX_POLYHEDRAL("Convex polyhedral selector: Left click=First vertex, right click to add more.", "Selection"),
SEL_LIST("For a list of selection types use:&c //sel", "Selection"),
SEL_LIST("For a list of selection types use:&c //sel list", "Selection"),
SEL_MODES("Select one of the modes below:", "Selection"),

View File

@ -74,7 +74,7 @@ public class CopyPastaBrush implements DoubleActionBrush {
ClipboardHolder holder = new ClipboardHolder(clipboard, editSession.getWorld().getWorldData());
session.setClipboard(holder);
int blocks = builder.size();
player.print(BBC.COMMAND_COPY.format(blocks));
player.print(BBC.getPrefix() + BBC.COMMAND_COPY.format(blocks));
return;
}
case PRIMARY: {
@ -90,7 +90,7 @@ public class CopyPastaBrush implements DoubleActionBrush {
.build();
Operations.completeLegacy(operation);
} catch (EmptyClipboardException e) {
player.print(BBC.BRUSH_PASTE_NONE.s());
player.print(BBC.getPrefix() + BBC.BRUSH_PASTE_NONE.s());
}
}
}

View File

@ -59,11 +59,11 @@ public class InspectBrush extends BrushTool implements DoubleActionTraceTool {
public boolean perform(final Player player, LocalSession session, boolean rightClick) {
if (!session.isToolControlEnabled() || !player.hasPermission("worldedit.tool.inspect")) {
player.print(BBC.NO_PERM.f("worldedit.tool.inspect"));
player.print(BBC.getPrefix() + BBC.NO_PERM.f("worldedit.tool.inspect"));
return false;
}
if (!Settings.HISTORY.USE_DATABASE) {
player.print(BBC.SETTING_DISABLE.f("history.use-database"));
player.print(BBC.getPrefix() + BBC.SETTING_DISABLE.f("history.use-database"));
return false;
}
WorldVector target = getTarget(player, rightClick);

View File

@ -1,6 +1,5 @@
package com.boydti.fawe.object.brush;
import com.boydti.fawe.config.BBC;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.Vector;
@ -23,7 +22,7 @@ public class LineBrush implements DoubleActionBrush {
switch (action) {
case PRIMARY:
if (pos1 == null) {
editSession.debug(BBC.SELECTION_NONE);
pos1 = position;
return;
}
editSession.drawLine(Patterns.wrap(pattern), pos1, position, size, !shell, flat);

View File

@ -68,12 +68,12 @@ public class SplineBrush implements DoubleActionBrush {
numSplines = points.size();
}
this.positionSets.add(points);
player.print(BBC.BRUSH_SPLINE_PRIMARY.s());
player.print(BBC.getPrefix() + BBC.BRUSH_SPLINE_PRIMARY.s());
break;
}
case SECONDARY: {
if (positionSets.size() < 2) {
player.print(BBC.BRUSH_SPLINE_SECONDARY_ERROR.s());
player.print(BBC.getPrefix() + BBC.BRUSH_SPLINE_SECONDARY_ERROR.s());
return;
}
List<Vector> centroids = new ArrayList<>();
@ -112,7 +112,7 @@ public class SplineBrush implements DoubleActionBrush {
}
editSession.drawSpline(Patterns.wrap(pattern), currentSpline, 0, 0, 0, 10, 0, true);
}
player.print(BBC.BRUSH_SPLINE_SECONDARY.s());
player.print(BBC.getPrefix() + BBC.BRUSH_SPLINE_SECONDARY.s());
positionSets.clear();
numSplines = 0;
break;

View File

@ -100,7 +100,7 @@ public class BrushCommands {
BrushTool tool = session.getBrushTool(player.getItemInHand());
tool.setSize(radius);
tool.setBrush(new BlendBall(), "worldedit.brush.blendball");
player.print(BBC.BRUSH_BLEND_BALL.f(radius));
player.print(BBC.getPrefix() + BBC.BRUSH_BLEND_BALL.f(radius));
}
@Command(
@ -117,7 +117,7 @@ public class BrushCommands {
DoubleActionBrushTool tool = session.getDoubleActionBrushTool(player.getItemInHand());
tool.setSize(radius);
tool.setBrush(new ErodeBrush(), "worldedit.brush.erode");
player.print(BBC.BRUSH_ERODE.f(radius));
player.print(BBC.getPrefix() + BBC.BRUSH_ERODE.f(radius));
}
@Command(
@ -137,7 +137,7 @@ public class BrushCommands {
tool.setBrush(new RecurseBrush(tool, depthFirst), "worldedit.brush.recursive");
tool.setMask(new IdMask(editSession));
tool.setFill(fill);
player.print(BBC.BRUSH_RECURSIVE.f(radius));
player.print(BBC.getPrefix() + BBC.BRUSH_RECURSIVE.f(radius));
}
@Command(
@ -160,7 +160,7 @@ public class BrushCommands {
tool.setFill(fill);
tool.setSize(radius);
tool.setBrush(new LineBrush(shell, select, flat), "worldedit.brush.line");
player.print(BBC.BRUSH_LINE.f(radius));
player.print(BBC.getPrefix() + BBC.BRUSH_LINE.f(radius));
}
@Command(
@ -178,7 +178,7 @@ public class BrushCommands {
tool.setFill(fill);
tool.setSize(radius);
tool.setBrush(new SplineBrush(player, session, tool), "worldedit.brush.spline");
player.print(BBC.BRUSH_SPLINE.f(radius));
player.print(BBC.getPrefix() + BBC.BRUSH_SPLINE.f(radius));
}
@Command(
@ -213,7 +213,7 @@ public class BrushCommands {
BBC.BRUSH_TRY_OTHER.send(player);
}
}
player.print(BBC.BRUSH_SPHERE.f(radius));
player.print(BBC.getPrefix() + BBC.BRUSH_SPHERE.f(radius));
}
@Command(
@ -242,7 +242,7 @@ public class BrushCommands {
} else {
tool.setBrush(new CylinderBrush(height), "worldedit.brush.cylinder");
}
player.print(BBC.BRUSH_SPHERE.f(radius, height));
player.print(BBC.getPrefix() + BBC.BRUSH_SPHERE.f(radius, height));
}
@Command(
@ -269,7 +269,7 @@ public class BrushCommands {
BrushTool tool = session.getBrushTool(player.getItemInHand());
tool.setBrush(new ClipboardBrush(holder, ignoreAir, usingOrigin), "worldedit.brush.clipboard");
player.print(BBC.BRUSH_CLIPBOARD.s());
player.print(BBC.getPrefix() + BBC.BRUSH_CLIPBOARD.s());
}
@Command(
@ -297,7 +297,7 @@ public class BrushCommands {
tool.setSize(radius);
tool.setBrush(new SmoothBrush(iterations, naturalBlocksOnly), "worldedit.brush.smooth");
player.print(BBC.BRUSH_SMOOTH.f(radius, iterations, (naturalBlocksOnly ? "natural blocks only" : "any block")));
player.print(BBC.getPrefix() + BBC.BRUSH_SMOOTH.f(radius, iterations, (naturalBlocksOnly ? "natural blocks only" : "any block")));
}
@Command(
@ -318,7 +318,7 @@ public class BrushCommands {
tool.setMask(new BlockMask(editSession, new BaseBlock(BlockID.FIRE)));
tool.setBrush(new SphereBrush(), "worldedit.brush.ex");
BBC.BRUSH_EXTINGUISHER.send(player, radius);
player.print(BBC.BRUSH_EXTINGUISHER.f(radius));
player.print(BBC.getPrefix() + BBC.BRUSH_EXTINGUISHER.f(radius));
}
@Command(
@ -340,7 +340,7 @@ public class BrushCommands {
BrushTool tool = session.getBrushTool(player.getItemInHand());
tool.setSize(radius);
tool.setBrush(new GravityBrush(fromMaxY, tool), "worldedit.brush.gravity");
player.print(BBC.BRUSH_GRAVITY.f(radius));
player.print(BBC.getPrefix() + BBC.BRUSH_GRAVITY.f(radius));
}
@Command(
@ -364,7 +364,7 @@ public class BrushCommands {
} catch (EmptyClipboardException ignore) {
tool.setBrush(new HeightBrush(file, rotation, yscale, tool, null), "worldedit.brush.height");
}
player.print(BBC.BRUSH_HEIGHT.f(radius));
player.print(BBC.getPrefix() + BBC.BRUSH_HEIGHT.f(radius));
}
@Command(
@ -383,7 +383,7 @@ public class BrushCommands {
DoubleActionBrushTool tool = session.getDoubleActionBrushTool(player.getItemInHand());
tool.setSize(radius);
tool.setBrush(new CopyPastaBrush(player, session, tool), "worldedit.brush.copy");
player.print(BBC.BRUSH_COPY.f(radius));
player.print(BBC.getPrefix() + BBC.BRUSH_COPY.f(radius));
}
@Command(
@ -400,7 +400,7 @@ public class BrushCommands {
BrushTool tool = session.getBrushTool(player.getItemInHand());
String cmd = args.getJoinedStrings(1);
tool.setBrush(new CommandBrush(player, tool, cmd, radius), "worldedit.brush.copy");
player.print(BBC.BRUSH_COMMAND.f(cmd));
player.print(BBC.getPrefix() + BBC.BRUSH_COMMAND.f(cmd));
}
@Command(
@ -445,7 +445,7 @@ public class BrushCommands {
BrushTool tool = session.getBrushTool(player.getItemInHand());
tool.setSize(radius);
tool.setBrush(new ButcherBrush(flags), "worldedit.brush.butcher");
player.print(BBC.BRUSH_BUTCHER.f(radius));
player.print(BBC.getPrefix() + BBC.BRUSH_BUTCHER.f(radius));
}
public static Class<?> inject() {

View File

@ -64,9 +64,9 @@ public class GeneralCommands {
session.setBlockChangeLimit(limit);
if (limit != -1) {
player.print("Block change limit set to " + limit + ". (Use //limit -1 to go back to the default.)");
player.print(BBC.getPrefix() + "Block change limit set to " + limit + ". (Use //limit -1 to go back to the default.)");
} else {
player.print("Block change limit set to " + limit + ".");
player.print(BBC.getPrefix() + "Block change limit set to " + limit + ".");
}
}
@ -88,7 +88,7 @@ public class GeneralCommands {
}
session.setFastMode(false);
player.print("Fast mode disabled.");
player.print(BBC.getPrefix() + "Fast mode disabled.");
} else {
if ("off".equals(newState)) {
player.printError("Fast mode already disabled.");
@ -96,7 +96,7 @@ public class GeneralCommands {
}
session.setFastMode(true);
player.print("Fast mode enabled. Lighting in the affected chunks may be wrong and/or you may need to rejoin to see changes.");
player.print(BBC.getPrefix() + "Fast mode enabled. Lighting in the affected chunks may be wrong and/or you may need to rejoin to see changes.");
}
}
@ -182,9 +182,9 @@ public class GeneralCommands {
public void togglePlace(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
if (session.togglePlacementPosition()) {
player.print("Now placing at pos #1.");
player.print(BBC.getPrefix() + "Now placing at pos #1.");
} else {
player.print("Now placing at the block you stand in.");
player.print(BBC.getPrefix() + "Now placing at the block you stand in.");
}
}

View File

@ -119,7 +119,7 @@ public class HistoryCommands {
rollback.setTime(historyFile.lastModified());
RollbackDatabase db = DBHandler.IMP.getDatabase(world);
db.logEdit(rollback);
player.print("Logging: " + historyFile);
player.print(BBC.getPrefix() + "Logging: " + historyFile);
}
}
} catch (IllegalArgumentException e) {
@ -128,7 +128,7 @@ public class HistoryCommands {
}
}
}
player.print("Done import!");
player.print(BBC.getPrefix() + "Done import!");
return;
}
UUID other = Fawe.imp().getUUID(user);

View File

@ -249,7 +249,7 @@ public class SchematicCommands {
first = false;
}
first = true;
actor.print(builder.toString());
actor.print(BBC.getPrefix() + builder.toString());
}
}
@ -323,7 +323,7 @@ public class SchematicCommands {
}
}
actor.print(build.toString());
actor.print(BBC.getPrefix() + build.toString());
}

View File

@ -589,10 +589,10 @@ public class SelectionCommands {
Vector size = region.getMaximumPoint().subtract(region.getMinimumPoint());
Vector origin = clipboard.getOrigin();
player.print("Cuboid dimensions (max - min): " + size);
player.print("Offset: " + origin);
player.print("Cuboid distance: " + size.distance(Vector.ONE));
player.print("# of blocks: " + (int) (size.getX() * size.getY() * size.getZ()));
player.print(BBC.getPrefix() + "Cuboid dimensions (max - min): " + size);
player.print(BBC.getPrefix() + "Offset: " + origin);
player.print(BBC.getPrefix() + "Cuboid distance: " + size.distance(Vector.ONE));
player.print(BBC.getPrefix() + "# of blocks: " + (int) (size.getX() * size.getY() * size.getZ()));
return;
}
@ -601,17 +601,17 @@ public class SelectionCommands {
.subtract(region.getMinimumPoint())
.add(1, 1, 1);
player.print("Type: " + session.getRegionSelector(player.getWorld())
player.print(BBC.getPrefix() + "Type: " + session.getRegionSelector(player.getWorld())
.getTypeName());
for (String line : session.getRegionSelector(player.getWorld())
.getInformationLines()) {
player.print(line);
player.print(BBC.getPrefix() + line);
}
player.print("Size: " + size);
player.print("Cuboid distance: " + region.getMaximumPoint().distance(region.getMinimumPoint()));
player.print("# of blocks: " + region.getArea());
player.print(BBC.getPrefix() + "Size: " + size);
player.print(BBC.getPrefix() + "Cuboid distance: " + region.getMaximumPoint().distance(region.getMinimumPoint()));
player.print(BBC.getPrefix() + "# of blocks: " + region.getArea());
}
@ -688,7 +688,7 @@ public class SelectionCommands {
c.getAmount() / (double) size * 100,
name == null ? "Unknown" : name,
c.getID().getType(), c.getID().getData());
player.print(str);
player.print(BBC.getPrefix() + str);
}
} else {
for (Countable<Integer> c : distribution) {
@ -697,7 +697,7 @@ public class SelectionCommands {
String.valueOf(c.getAmount()),
c.getAmount() / (double) size * 100,
block == null ? "Unknown" : block.getName(), c.getID());
player.print(str);
player.print(BBC.getPrefix() + str);
}
}
}
@ -725,35 +725,35 @@ public class SelectionCommands {
final RegionSelector selector;
if (typeName.equalsIgnoreCase("cuboid")) {
selector = new CuboidRegionSelector(oldSelector);
player.print(BBC.SEL_CUBOID.s());
player.print(BBC.getPrefix() + BBC.SEL_CUBOID.s());
} else if (typeName.equalsIgnoreCase("extend")) {
selector = new ExtendingCuboidRegionSelector(oldSelector);
player.print(BBC.SEL_CUBOID_EXTEND.s());
player.print(BBC.getPrefix() + BBC.SEL_CUBOID_EXTEND.s());
} else if (typeName.equalsIgnoreCase("poly")) {
selector = new Polygonal2DRegionSelector(oldSelector);
player.print(BBC.SEL_2D_POLYGON.s());
player.print(BBC.getPrefix() + BBC.SEL_2D_POLYGON.s());
Optional<Integer> limit = ActorSelectorLimits.forActor(player).getPolygonVertexLimit();
if (limit.isPresent()) {
player.print(BBC.SEL_MAX.f(limit.get()));
player.print(BBC.getPrefix() + BBC.SEL_MAX.f(limit.get()));
}
player.print(BBC.SEL_LIST.s());
player.print(BBC.getPrefix() + BBC.SEL_LIST.s());
} else if (typeName.equalsIgnoreCase("ellipsoid")) {
selector = new EllipsoidRegionSelector(oldSelector);
player.print(BBC.SEL_ELLIPSIOD.s());
player.print(BBC.getPrefix() + BBC.SEL_ELLIPSIOD.s());
} else if (typeName.equalsIgnoreCase("sphere")) {
selector = new SphereRegionSelector(oldSelector);
player.print(BBC.SEL_SPHERE.s());
player.print(BBC.getPrefix() + BBC.SEL_SPHERE.s());
} else if (typeName.equalsIgnoreCase("cyl")) {
selector = new CylinderRegionSelector(oldSelector);
player.print(BBC.SEL_CYLINDRICAL.s());
player.print(BBC.getPrefix() + BBC.SEL_CYLINDRICAL.s());
} else if (typeName.equalsIgnoreCase("convex") || typeName.equalsIgnoreCase("hull") || typeName.equalsIgnoreCase("polyhedron")) {
selector = new ConvexPolyhedralRegionSelector(oldSelector);
player.print(BBC.SEL_CONVEX_POLYHEDRAL.s());
player.print(BBC.getPrefix() + BBC.SEL_CONVEX_POLYHEDRAL.s());
Optional<Integer> limit = ActorSelectorLimits.forActor(player).getPolyhedronVertexLimit();
if (limit.isPresent()) {
player.print(BBC.SEL_MAX.f(limit.get()));
player.print(BBC.getPrefix() + BBC.SEL_MAX.f(limit.get()));
}
player.print(BBC.SEL_LIST.s());
player.print(BBC.getPrefix() + BBC.SEL_LIST.s());
} else if (typeName.startsWith("fuzzy") || typeName.startsWith("magic")) {
Mask mask;
if (typeName.length() > 6) {
@ -767,13 +767,13 @@ public class SelectionCommands {
mask = new IdMask(editSession);
}
selector = new FuzzyRegionSelector(player, editSession, mask);
player.print(BBC.SEL_FUZZY.s());
player.print(BBC.SEL_LIST.s());
player.print(BBC.getPrefix() + BBC.SEL_FUZZY.f());
player.print(BBC.getPrefix() + BBC.SEL_LIST.f());
} else {
CommandListBox box = new CommandListBox("Selection modes");
StyledFragment contents = box.getContents();
StyledFragment tip = contents.createFragment(Style.RED);
tip.append(BBC.SEL_MODES.s()).newLine();
tip.append(BBC.getPrefix() + BBC.SEL_MODES.s()).newLine();
box.appendCommand("//sel cuboid", "Select two corners of a cuboid");
box.appendCommand("//sel extend", "Fast cuboid selection mode");
@ -799,7 +799,7 @@ public class SelectionCommands {
if (found != null) {
session.setDefaultRegionSelector(found);
player.print("Your default region selector is now " + found.name() + ".");
player.print(BBC.getPrefix() + "Your default region selector is now " + found.name() + ".");
} else {
throw new RuntimeException("Something unexpected happened. Please report this.");
}

View File

@ -71,7 +71,7 @@ public class ToolUtilCommands {
public void mask(Player player, LocalSession session, EditSession editSession, @Optional CommandContext context) throws WorldEditException {
Tool tool = session.getTool(player.getItemInHand());
if (tool == null) {
player.print(BBC.BRUSH_NONE.f());
player.print(BBC.getPrefix() + BBC.BRUSH_NONE.f());
return;
}
if (context == null || context.argsLength() == 0) {
@ -108,7 +108,7 @@ public class ToolUtilCommands {
public void smask(Player player, LocalSession session, EditSession editSession, @Optional CommandContext context) throws WorldEditException {
Tool tool = session.getTool(player.getItemInHand());
if (tool == null) {
player.print(BBC.BRUSH_NONE.f());
player.print(BBC.getPrefix() + BBC.BRUSH_NONE.f());
return;
}
if (context == null || context.argsLength() == 0) {