Add prefixes and make FAWE more translatable

This commit is contained in:
NotMyFault
2019-04-07 01:13:23 +02:00
parent 6558e549fd
commit ab3394c35e
16 changed files with 110 additions and 90 deletions

View File

@@ -19,6 +19,7 @@
package com.sk89q.worldedit;
import com.boydti.fawe.config.BBC;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import com.sk89q.worldedit.blocks.BaseItem;
@@ -611,7 +612,7 @@ public final class WorldEdit {
String ext = filename.substring(index + 1);
if (!ext.equalsIgnoreCase("js")) {
player.printError("Only .js scripts are currently supported");
player.printError(BBC.getPrefix() + "Only .js scripts are currently supported");
return;
}
@@ -624,7 +625,7 @@ public final class WorldEdit {
file = WorldEdit.class.getResourceAsStream("craftscripts/" + filename);
if (file == null) {
player.printError("Script does not exist: " + filename);
player.printError(BBC.getPrefix() + "Script does not exist: " + filename);
return;
}
} else {
@@ -637,7 +638,7 @@ public final class WorldEdit {
in.close();
script = new String(data, 0, data.length, StandardCharsets.UTF_8);
} catch (IOException e) {
player.printError("Script read error: " + e.getMessage());
player.printError(BBC.getPrefix() + "Script read error: " + e.getMessage());
return;
}
@@ -650,8 +651,8 @@ public final class WorldEdit {
try {
engine = new RhinoCraftScriptEngine();
} catch (NoClassDefFoundError e) {
player.printError("Failed to find an installed script engine.");
player.printError("Please see http://wiki.sk89q.com/wiki/WorldEdit/Installation");
player.printError(BBC.getPrefix() + "Failed to find an installed script engine.");
player.printError(BBC.getPrefix() + "Please see http://wiki.sk89q.com/wiki/WorldEdit/Installation");
return;
}
@@ -665,15 +666,15 @@ public final class WorldEdit {
try {
engine.evaluate(script, filename, vars);
} catch (ScriptException e) {
player.printError("Failed to execute:");
player.printError(BBC.getPrefix() + "Failed to execute:");
player.printRaw(e.getMessage());
logger.warn("Failed to execute script", e);
logger.warn(BBC.getPrefix() + "Failed to execute script", e);
} catch (NumberFormatException | WorldEditException e) {
throw e;
} catch (Throwable e) {
player.printError("Failed to execute (see console):");
player.printError(BBC.getPrefix() + "Failed to execute (see console):");
player.printRaw(e.getClass().getCanonicalName());
logger.warn("Failed to execute script", e);
logger.warn(BBC.getPrefix() + "Failed to execute script", e);
} finally {
for (EditSession editSession : scriptContext.getEditSessions()) {
editSession.flushSession();