Message updates

This commit is contained in:
MattBDev
2019-11-02 15:53:25 -04:00
parent 678a99667d
commit f262271519
26 changed files with 221 additions and 236 deletions

View File

@ -61,7 +61,6 @@ import com.boydti.fawe.util.MainUtil;
import com.boydti.fawe.util.MathMan;
import com.boydti.fawe.util.StringMan;
import com.boydti.fawe.util.image.ImageUtil;
import com.sk89q.minecraft.util.commands.CommandLocals;
import com.sk89q.minecraft.util.commands.Step;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.EmptyClipboardException;
@ -383,7 +382,7 @@ public class BrushCommands {
switch (type.getInternalId()) {
case BlockID.SAND:
case BlockID.GRAVEL:
BBC.BRUSH_TRY_OTHER.send(player);
player.print(BBC.BRUSH_TRY_OTHER.s());
falling = true;
}
}
@ -1017,7 +1016,7 @@ public class BrushCommands {
}
BBC.SCHEMATIC_SAVED.send(player, name);
} else {
BBC.BRUSH_NONE.send(player);
player.printError(BBC.BRUSH_NONE.s());
}
}
@ -1050,7 +1049,7 @@ public class BrushCommands {
BBC.BRUSH_EQUIPPED.send(player, name);
} catch (Throwable e) {
e.printStackTrace();
BBC.BRUSH_INCOMPATIBLE.send(player);
player.printError(BBC.BRUSH_INCOMPATIBLE.s());
}
}

View File

@ -39,8 +39,6 @@ import com.boydti.fawe.object.schematic.Schematic;
import com.boydti.fawe.util.ImgurUtility;
import com.boydti.fawe.util.MainUtil;
import com.boydti.fawe.util.MaskTraverser;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession;
@ -381,7 +379,7 @@ public class ClipboardCommands {
}
}
if (url == null) {
BBC.GENERATING_LINK_FAILED.send(player);
player.printError(BBC.GENERATING_LINK_FAILED.s());
} else {
String urlText = url.toString();
if (Settings.IMP.WEB.SHORTEN_URLS) {
@ -422,7 +420,7 @@ public class ClipboardCommands {
}
URL url = format.uploadPublic(target, category.replaceAll("[/|\\\\]", "."), player.getName());
if (url == null) {
BBC.GENERATING_LINK_FAILED.send(player);
player.printError(BBC.GENERATING_LINK_FAILED.s());
} else {
BBC.DOWNLOAD_LINK.send(player, Settings.IMP.WEB.ASSETS);
}

View File

@ -37,7 +37,6 @@ import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.command.util.CommandPermissions;
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
import com.sk89q.worldedit.command.util.WorldEditAsyncCommandBuilder;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.input.DisallowedUsageException;
import com.sk89q.worldedit.extension.input.InputParseException;
@ -318,7 +317,7 @@ public class GeneralCommands {
// TODO NOT IMPLEMENTED convert this to an ArgumentConverter
if (arguments.isEmpty()) {
session.setTextureUtil(null);
BBC.TEXTURE_DISABLED.send(player);
player.print(BBC.TEXTURE_DISABLED.s());
} else {
String arg = arguments.get(0);
String argLower = arg.toLowerCase(Locale.ROOT);
@ -375,9 +374,9 @@ public class GeneralCommands {
public void gsmask(Player player, LocalSession session, EditSession editSession, @Arg(desc = "The mask to set", def = "") Mask maskOpt) throws WorldEditException {
session.setSourceMask(maskOpt);
if (maskOpt == null) {
BBC.SOURCE_MASK_DISABLED.send(player);
player.print(BBC.SOURCE_MASK_DISABLED.s());
} else {
BBC.SOURCE_MASK.send(player);
player.print(BBC.SOURCE_MASK.s());
}
}
@ -391,9 +390,9 @@ public class GeneralCommands {
public void gtransform(Player player, EditSession editSession, LocalSession session, ResettableExtent transform) throws WorldEditException {
session.setTransform(transform);
if (transform == null) {
BBC.TRANSFORM_DISABLED.send(player);
player.print(BBC.TRANSFORM_DISABLED.s());
} else {
BBC.TRANSFORM.send(player);
player.print(BBC.TRANSFORM.s());
}
}
@ -405,9 +404,9 @@ public class GeneralCommands {
@CommandPermissions("fawe.tips")
public void tips(Player player, LocalSession session) throws WorldEditException {
if (player.togglePermission("fawe.tips")) {
BBC.WORLDEDIT_TOGGLE_TIPS_ON.send(player);
player.print(BBC.WORLDEDIT_TOGGLE_TIPS_ON.s());
} else {
BBC.WORLDEDIT_TOGGLE_TIPS_OFF.send(player);
player.print(BBC.WORLDEDIT_TOGGLE_TIPS_OFF.s());
}
}
}

View File

@ -186,7 +186,7 @@ public class HistoryCommands {
Region[] allowedRegions = player.getCurrentRegions(FaweMaskManager.MaskType.OWNER);
if (allowedRegions == null) {
BBC.NO_REGION.send(player);
player.printError(BBC.NO_REGION.s());
return;
}
// TODO mask the regions bot / top to the bottom and top coord in the allowedRegions

View File

@ -175,14 +175,14 @@ public class RegionCommands {
public void nbtinfo(Player player, EditSession editSession) {
Location pos = player.getBlockTrace(128);
if (pos == null) {
BBC.NO_BLOCK.send(player);
player.printError(BBC.NO_BLOCK.s());
return;
}
CompoundTag nbt = editSession.getFullBlock(pos.toBlockPoint()).getNbtData();
if (nbt != null) {
player.print(nbt.getValue().toString());
} else {
BBC.NO_BLOCK.send(player);
player.printError(BBC.NO_BLOCK.s());
}
}
@ -314,8 +314,8 @@ public class RegionCommands {
)
@CommandPermissions("worldedit.region.overlay")
@Logging(REGION)
public void lay(Player fp, EditSession editSession, @Selection Region region, @Arg(name = "pattern", desc = "The pattern of blocks to lay") Pattern patternArg, InjectedValueAccess context) throws WorldEditException {
fp.checkConfirmationRegion(() -> {
public void lay(Player player, EditSession editSession, @Selection Region region, @Arg(name = "pattern", desc = "The pattern of blocks to lay") Pattern patternArg, InjectedValueAccess context) throws WorldEditException {
player.checkConfirmationRegion(() -> {
BlockVector3 max = region.getMaximumPoint();
int maxY = max.getBlockY();
Iterable<BlockVector2> flat = Regions.asFlatRegion(region).asFlatRegion();
@ -330,7 +330,7 @@ public class RegionCommands {
editSession.setBlock(x, y, z, patternArg);
affected++;
}
BBC.VISITOR_BLOCK.send(fp, affected);
BBC.VISITOR_BLOCK.send(player, affected);
}, getArguments(context), region, context);
}
@ -629,27 +629,27 @@ public class RegionCommands {
)
@CommandPermissions("worldedit.regen")
@Logging(REGION)
public void regenerateChunk(Player fp, LocalSession session, EditSession editSession, @Selection Region region,
public void regenerateChunk(Player player, LocalSession session, EditSession editSession, @Selection Region region,
@Arg(def = "", desc = "Regenerate with biome") BiomeType biome,
@Arg(def = "", desc = "Regenerate with seed") Long seed,
InjectedValueAccess context) throws WorldEditException {
fp.checkConfirmationRegion(() -> {
player.checkConfirmationRegion(() -> {
Mask mask = session.getMask();
session.setMask((Mask) null);
session.setSourceMask((Mask) null);
editSession.regenerate(region, biome, seed);
session.setMask(mask);
session.setSourceMask(mask);
if (!fp.hasPermission("fawe.tips")) {
BBC.COMMAND_REGEN_2.send(fp);
if (!player.hasPermission("fawe.tips")) {
player.print(BBC.COMMAND_REGEN_2.s());
} else if (biome == null) {
BBC.COMMAND_REGEN_0.send(fp);
if (!fp.hasPermission("fawe.tips")) BBC.TIP_REGEN_0.send(fp);
BBC.COMMAND_REGEN_0.send(player);
if (!player.hasPermission("fawe.tips")) player.print(BBC.TIP_REGEN_0.s());
} else if (seed == null) {
BBC.COMMAND_REGEN_1.send(fp);
if (!fp.hasPermission("fawe.tips")) BBC.TIP_REGEN_1.send(fp);
player.print(BBC.COMMAND_REGEN_1.s());
if (!player.hasPermission("fawe.tips")) BBC.TIP_REGEN_1.send(player);
} else {
BBC.COMMAND_REGEN_2.send(fp);
player.print(BBC.COMMAND_REGEN_2.s());
}
}, getArguments(context), region, context);

View File

@ -28,7 +28,6 @@ import com.boydti.fawe.config.Settings;
import com.boydti.fawe.object.clipboard.MultiClipboardHolder;
import com.boydti.fawe.object.clipboard.URIClipboardHolder;
import com.boydti.fawe.object.clipboard.remap.ClipboardRemapper;
import com.boydti.fawe.object.function.QuadFunction;
import com.boydti.fawe.object.schematic.MinecraftStructure;
import com.boydti.fawe.util.MainUtil;
import com.boydti.fawe.util.MathMan;
@ -152,7 +151,7 @@ public class SchematicCommands {
@CommandPermissions({"worldedit.clipboard.clear", "worldedit.schematic.clear"})
public void clear(Player player, LocalSession session) throws WorldEditException {
session.setClipboard(null);
BBC.CLIPBOARD_CLEARED.send(player);
player.print(BBC.CLIPBOARD_CLEARED.s());
}
@Command(
@ -182,7 +181,7 @@ public class SchematicCommands {
} else {
session.setClipboard(null);
}
BBC.CLIPBOARD_CLEARED.send(player);
player.print(BBC.CLIPBOARD_CLEARED.s());
return;
}
}
@ -398,7 +397,7 @@ public class SchematicCommands {
ClipboardHolder clipboard = session.getClipboard();
List<File> sources = getFiles(clipboard);
if (sources.isEmpty()) {
BBC.SCHEMATIC_NONE.send(player);
player.printError(BBC.SCHEMATIC_NONE.s());
return;
}
if (!destDir.exists() && !destDir.mkdirs()) {
@ -449,7 +448,7 @@ public class SchematicCommands {
}
if (files.isEmpty()) {
BBC.SCHEMATIC_NONE.send(actor);
actor.printError(BBC.SCHEMATIC_NONE.s());
return;
}
for (File f : files) {
@ -604,12 +603,12 @@ public class SchematicCommands {
File dir = worldEdit.getWorkingDirectoryFile(config.saveDir);
String schemCmd = "/schematic";
String loadSingle = schemCmd + " " + "load";
String loadMulti = schemCmd + " " + "loadall";
String unload = schemCmd + " " + "unload";
String delete = schemCmd + " " + "delete";
String list = schemCmd + " " + "list";
String showCmd = schemCmd + " " + "show";
String loadSingle = schemCmd + " load";
String loadMulti = schemCmd + " loadall";
String unload = schemCmd + " unload";
String delete = schemCmd + " delete";
String list = schemCmd + " list";
String showCmd = schemCmd + " show";
List<String> args = filter.isEmpty() ? Collections.emptyList() : Arrays.asList(filter.split(" "));
@ -634,9 +633,8 @@ public class SchematicCommands {
Function<URI, Boolean> isLoaded = multi == null ? f -> false : multi::contains;
List<Component> components = UtilityCommands.entryToComponent(dir, entries, isLoaded, new QuadFunction<String, String, UtilityCommands.URIType, Boolean, Component>() {
@Override
public Component apply(String name, String path, UtilityCommands.URIType type, Boolean loaded) {
List<Component> components = UtilityCommands.entryToComponent(dir, entries, isLoaded,
(name, path, type, loaded) -> {
TextColor color = TextColor.GRAY;
switch (type) {
case URL:
@ -685,8 +683,7 @@ public class SchematicCommands {
msg.append(msgElem);
return msg.create();
}
});
});
PaginationBox paginationBox = PaginationBox.fromStrings("Available schematics", pageCommand, components);
actor.print(paginationBox.create(page));
}
@ -764,7 +761,7 @@ public class SchematicCommands {
log.info(actor.getName() + " saved " + file.getCanonicalPath());
BBC.SCHEMATIC_SAVED.send(actor, file.getName());
} else {
BBC.WORLDEDIT_CANCEL_REASON_MANUAL.send(actor);
actor.printError(BBC.WORLDEDIT_CANCEL_REASON_MANUAL.s());
}
}
return null;

View File

@ -190,7 +190,7 @@ public class ToolUtilCommands {
)
public void none(Player player, LocalSession session) throws WorldEditException {
session.setTool(player, null);
BBC.TOOL_NONE.send(player);
player.print(BBC.TOOL_NONE.s());
}
@Command(
@ -203,20 +203,19 @@ public class ToolUtilCommands {
@Arg(desc = "state", def = "on") String state) throws WorldEditException {
if (session.hasSuperPickAxe()) {
if ("on".equals(state)) {
BBC.SUPERPICKAXE_ENABLED.send(player);
player.print(BBC.SUPERPICKAXE_ENABLED.s());
return;
}
session.disableSuperPickAxe();
BBC.SUPERPICKAXE_DISABLED.send(player);
player.print(BBC.SUPERPICKAXE_DISABLED.s());
} else {
if ("off".equals(state)) {
BBC.SUPERPICKAXE_DISABLED.send(player);
player.print(BBC.SUPERPICKAXE_DISABLED.s());
return;
}
session.enableSuperPickAxe();
BBC.SUPERPICKAXE_ENABLED.send(player);
player.print(BBC.SUPERPICKAXE_ENABLED.s());
}
}

View File

@ -19,6 +19,8 @@
package com.sk89q.worldedit.command;
import static com.sk89q.worldedit.command.util.Logging.LogMode.PLACEMENT;
import com.boydti.fawe.Fawe;
import com.boydti.fawe.config.BBC;
import com.boydti.fawe.config.Settings;
@ -68,13 +70,6 @@ import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BlockTypes;
import org.enginehub.piston.annotation.Command;
import org.enginehub.piston.annotation.CommandContainer;
import org.enginehub.piston.annotation.param.Arg;
import org.enginehub.piston.annotation.param.ArgFlag;
import org.enginehub.piston.annotation.param.Switch;
import javax.imageio.ImageIO;
import java.awt.RenderingHints;
import java.awt.image.BufferedImage;
import java.io.File;
@ -93,8 +88,12 @@ import java.util.Map;
import java.util.UUID;
import java.util.function.Consumer;
import java.util.function.Supplier;
import static com.sk89q.worldedit.command.util.Logging.LogMode.PLACEMENT;
import javax.imageio.ImageIO;
import org.enginehub.piston.annotation.Command;
import org.enginehub.piston.annotation.CommandContainer;
import org.enginehub.piston.annotation.param.Arg;
import org.enginehub.piston.annotation.param.ArgFlag;
import org.enginehub.piston.annotation.param.Switch;
/**
* Utility commands.
@ -176,9 +175,9 @@ public class UtilityCommands {
)
@CommandPermissions("fawe.cancel")
@SkipQueue
public void cancel(Player fp) {
int cancelled = fp.cancel(false);
BBC.WORLDEDIT_CANCEL_COUNT.send(fp, cancelled);
public void cancel(Player player) {
int cancelled = player.cancel(false);
BBC.WORLDEDIT_CANCEL_COUNT.send(player, cancelled);
}
@Command(