Finish up transition to captions

This commit is contained in:
NotMyFault
2021-04-04 19:56:57 +02:00
parent 7b9e8a0d79
commit a9d1202ce1
36 changed files with 259 additions and 128 deletions

View File

@ -1,6 +1,7 @@
package com.boydti.fawe.command;
import com.sk89q.worldedit.extension.input.InputParseException;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import java.lang.reflect.InvocationTargetException;
import java.util.List;

View File

@ -9,6 +9,7 @@ import com.sk89q.worldedit.function.visitor.RecursiveVisitor;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.AbstractRegion;
import com.sk89q.worldedit.regions.RegionOperationException;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.world.World;
import org.jetbrains.annotations.NotNull;
@ -105,12 +106,12 @@ public class FuzzyRegion extends AbstractRegion {
@Override
public void expand(BlockVector3... changes) throws RegionOperationException {
throw new RegionOperationException("Selection cannot expand");
throw new RegionOperationException(TranslatableComponent.of("fawe.error.selection-expand"));
}
@Override
public void contract(BlockVector3... changes) throws RegionOperationException {
throw new RegionOperationException("Selection cannot contract");
throw new RegionOperationException(TranslatableComponent.of("fawe.error.selection-contract"));
}
@Override
@ -120,7 +121,7 @@ public class FuzzyRegion extends AbstractRegion {
@Override
public void shift(BlockVector3 change) throws RegionOperationException {
throw new RegionOperationException("Selection cannot be shifted");
throw new RegionOperationException(TranslatableComponent.of("fawe.error.selection-shift"));
}
public void setExtent(EditSession extent) {

View File

@ -240,11 +240,11 @@ public class EditSessionBuilder {
}
if (Settings.IMP.EXTENT.DEBUG) {
if (event.getActor() != null) {
event.getActor().printDebug("Potentially unsafe extent blocked: " + toReturn.getClass().getName());
event.getActor().printDebug(" - For area restrictions, it is recommended to use the FaweAPI");
event.getActor().printDebug(" - For block logging, it is recommended to use BlocksHub");
event.getActor().printDebug(" - To allow this plugin add it to the FAWE `allowed-plugins` list");
event.getActor().printDebug(" - To hide this message set `debug` to false in the FAWE config.yml");
event.getActor().printDebug(TranslatableComponent.of("Potentially unsafe extent blocked: " + toReturn.getClass().getName()));
event.getActor().printDebug(TranslatableComponent.of(" - For area restrictions, it is recommended to use the FaweAPI"));
event.getActor().printDebug(TranslatableComponent.of(" - For block logging, it is recommended to use BlocksHub"));
event.getActor().printDebug(TranslatableComponent.of(" - To allow this plugin add it to the FAWE `allowed-plugins` list"));
event.getActor().printDebug(TranslatableComponent.of(" - To hide this message set `debug` to false in the FAWE config.yml"));
} else {
LOGGER.debug("Potentially unsafe extent blocked: " + toReturn.getClass().getName());
LOGGER.debug(" - For area restrictions, it is recommended to use the FaweAPI");

View File

@ -6,6 +6,9 @@ import com.boydti.fawe.util.MainUtil;
import com.boydti.fawe.util.MathMan;
import com.sk89q.worldedit.extension.input.InputParseException;
import com.sk89q.worldedit.extension.platform.binding.ProvideBindings;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import org.w3c.dom.Text;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
@ -172,7 +175,7 @@ public class ImageUtil {
try {
return MainUtil.readImage(getInputStream(uri));
} catch (IOException e) {
throw new InputParseException(e.getMessage());
throw new InputParseException(TranslatableComponent.of(e.getMessage()));
}
}
@ -185,7 +188,7 @@ public class ImageUtil {
}
return new URL(uriStr).openStream();
} catch (IOException e) {
throw new InputParseException(e.getMessage());
throw new InputParseException(TranslatableComponent.of(e.getMessage()));
}
}
@ -208,9 +211,9 @@ public class ImageUtil {
Settings.IMP.PATHS.HEIGHTMAP), arg);
return MainUtil.readImage(file);
}
throw new InputParseException("Invalid image " + arg);
throw new InputParseException(TranslatableComponent.of("fawe.error.invalid-image", TextComponent.of(arg)));
} catch (IOException e) {
throw new InputParseException(e.getMessage());
throw new InputParseException(TranslatableComponent.of(e.getMessage()));
}
}
@ -227,16 +230,16 @@ public class ImageUtil {
File file = MainUtil.getFile(MainUtil.getFile(Fawe.imp().getDirectory(),
Settings.IMP.PATHS.HEIGHTMAP), arg);
if (!file.exists()) {
throw new InputParseException("File not found " + file);
throw new InputParseException(TranslatableComponent.of("fawe.error.file-not-found", TextComponent.of(String.valueOf(file))));
}
if (file.isDirectory()) {
throw new InputParseException("File is a directory " + file);
throw new InputParseException(TranslatableComponent.of("fawe.error.file-is-invalid-directory", TextComponent.of(String.valueOf(file))));
}
return file.toURI();
}
throw new InputParseException("Invalid image " + arg);
throw new InputParseException(TranslatableComponent.of("fawe.error.invalid-image", TextComponent.of(arg)));
} catch (IOException | URISyntaxException e) {
throw new InputParseException(e.getMessage());
throw new InputParseException(TranslatableComponent.of(e.getMessage()));
}
}
}