3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-03 01:50:07 +01:00

Switch some Caption#of to TextComponent#of

Dieser Commit ist enthalten in:
dordsor21 2021-11-03 18:33:19 +00:00
Ursprung c4d0a4e921
Commit 21b6f582e1
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 1E53E88969FFCF0B
13 geänderte Dateien mit 23 neuen und 18 gelöschten Zeilen

Datei anzeigen

@ -213,7 +213,7 @@ public class RichMaskParser extends FaweParser<Mask> {
return result;
} catch (Throwable e2) {
e2.printStackTrace();
throw new InputParseException(Caption.of(e2.getMessage()));
throw new InputParseException(TextComponent.of(e2.getMessage()));
}
});
}
@ -227,7 +227,7 @@ public class RichMaskParser extends FaweParser<Mask> {
throw rethrow;
} catch (Throwable e) {
e.printStackTrace();
throw new InputParseException(Caption.of(e.getMessage()), e);
throw new InputParseException(TextComponent.of(e.getMessage()), e);
}
List<Mask> maskUnions = new ArrayList<>();
for (List<Mask> maskList : masks) {

Datei anzeigen

@ -57,7 +57,7 @@ public class LinearPatternParser extends RichParser<Pattern> {
Set<Pattern> patterns = ((RandomPattern) inner).getPatterns();
return new LinearBlockPattern(patterns.toArray(new Pattern[0]));
}
throw new InputParseException(Caption.of("Pattern " + inner.getClass().getSimpleName()
throw new InputParseException(TextComponent.of("Pattern " + inner.getClass().getSimpleName()
+ " cannot be used with " + getPrefix()));
}

Datei anzeigen

@ -94,7 +94,7 @@ public class RandomFullClipboardPatternParser extends RichParser<Pattern> {
}
return new RandomFullClipboardPattern(clipboards, rotate, flip);
} catch (IOException e) {
throw new InputParseException(Caption.of(e.getMessage()), e);
throw new InputParseException(TextComponent.of(e.getMessage()), e);
}
}

Datei anzeigen

@ -175,7 +175,7 @@ public class RichPatternParser extends FaweParser<Pattern> {
return result;
} catch (Throwable e2) {
e2.printStackTrace();
throw new InputParseException(Caption.of(e2.getMessage()));
throw new InputParseException(TextComponent.of(e2.getMessage()));
}
});
}
@ -189,7 +189,7 @@ public class RichPatternParser extends FaweParser<Pattern> {
throw rethrow;
} catch (Throwable e) {
e.printStackTrace();
throw new InputParseException(Caption.of(e.getMessage()), e);
throw new InputParseException(TextComponent.of(e.getMessage()), e);
}
if (patterns.isEmpty()) {
return null;

Datei anzeigen

@ -126,7 +126,7 @@ public class RichTransformParser extends FaweParser<ResettableExtent> {
}
}
} catch (Throwable e) {
throw new InputParseException(Caption.of(e.getMessage()), e);
throw new InputParseException(TextComponent.of(e.getMessage()), e);
}
if (!intersection.isEmpty()) {
if (intersection.size() == 1) {

Datei anzeigen

@ -168,7 +168,7 @@ public class ConsumeBindings extends Bindings {
try {
return getWorldEdit().getBlockFactory().parseFromInput(argument, parserContext);
} catch (NoMatchException e) {
throw new InputParseException(Caption.of(e.getMessage()));
throw new InputParseException(TextComponent.of(e.getMessage()));
}
}

Datei anzeigen

@ -114,7 +114,7 @@ public class WEManager {
backupRegions.add(region);
}
} else {
player.print(Caption.of("Invalid Mask"));
player.print(Caption.of("fawe.error.region-mask-invalid", mask.getClass().getSimpleName()));
removed = true;
iterator.remove();
}

Datei anzeigen

@ -179,7 +179,7 @@ public class ImageUtil {
try {
return MainUtil.readImage(getInputStream(uri));
} catch (IOException e) {
throw new InputParseException(Caption.of(e.getMessage()));
throw new InputParseException(TextComponent.of(e.getMessage()));
}
}
@ -192,7 +192,7 @@ public class ImageUtil {
}
return new URL(uriStr).openStream();
} catch (IOException e) {
throw new InputParseException(Caption.of(e.getMessage()));
throw new InputParseException(TextComponent.of(e.getMessage()));
}
}
@ -219,7 +219,7 @@ public class ImageUtil {
}
throw new InputParseException(Caption.of("fawe.error.invalid-image", TextComponent.of(arg)));
} catch (IOException e) {
throw new InputParseException(Caption.of(e.getMessage()));
throw new InputParseException(TextComponent.of(e.getMessage()));
}
}
@ -253,7 +253,7 @@ public class ImageUtil {
}
throw new InputParseException(Caption.of("fawe.error.invalid-image", TextComponent.of(arg)));
} catch (IOException | URISyntaxException e) {
throw new InputParseException(Caption.of(e.getMessage()));
throw new InputParseException(TextComponent.of(e.getMessage()));
}
}

Datei anzeigen

@ -495,14 +495,16 @@ public class DefaultBlockParser extends InputParser<BaseBlock> {
throw new NoMatchException(Caption.of("worldedit.error.unknown-block", TextComponent.of(input)));
}
//FAWE start
if (blockAndExtraData.length > 1 && blockAndExtraData[1].startsWith("{")) {
String joined = StringMan.join(Arrays.copyOfRange(blockAndExtraData, 1, blockAndExtraData.length), "|");
try {
nbt = JSON2NBT.getTagFromJson(joined);
} catch (NBTException e) {
throw new NoMatchException(Caption.of(e.getMessage()));
throw new NoMatchException(TextComponent.of(e.getMessage()));
}
}
//FAWE end
// Check if the item is allowed
BlockType blockType = state.getBlockType();

Datei anzeigen

@ -25,6 +25,7 @@ import com.fastasyncworldedit.core.util.TaskManager;
import com.fastasyncworldedit.core.util.task.AsyncNotifyQueue;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.internal.cui.CUIEvent;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import java.io.File;
import java.util.Map;
@ -72,7 +73,7 @@ public abstract class AbstractNonPlayerActor implements Actor {
throwable = throwable.getCause();
}
if (throwable instanceof WorldEditException) {
printError(Caption.of(throwable.getLocalizedMessage()));
printError(TextComponent.of(throwable.getLocalizedMessage()));
} else {
FaweException fe = FaweException.get(throwable);
if (fe != null) {

Datei anzeigen

@ -50,6 +50,7 @@ import com.sk89q.worldedit.util.HandSide;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.TargetBlock;
import com.sk89q.worldedit.util.auth.AuthorizationException;
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.BlockCategories;
@ -86,7 +87,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
throwable = throwable.getCause();
}
if (throwable instanceof WorldEditException) {
printError(Caption.of(throwable.getLocalizedMessage()));
printError(TextComponent.of(throwable.getLocalizedMessage()));
} else {
FaweException fe = FaweException.get(throwable);
if (fe != null) {

Datei anzeigen

@ -448,7 +448,7 @@ public class PlatformManager {
actor.print(Caption.of("fawe.cancel.reason", faweException.getComponent()));
} else {
actor.print(Caption.of("worldedit.command.error.report"));
actor.print(Caption.of(e.getClass().getName(), TextComponent.of(": "), TextComponent.of(e.getMessage())));
actor.print(TextComponent.of(e.getClass().getName()+ ": " + e.getMessage()));
e.printStackTrace();
}
}
@ -502,7 +502,7 @@ public class PlatformManager {
player.print(Caption.of("fawe.cancel.reason", faweException.getComponent()));
} else {
player.print(Caption.of("worldedit.command.error.report"));
player.print(Caption.of(e.getClass().getName() + ": " + e.getMessage()));
player.print(TextComponent.of(e.getClass().getName() + ": " + e.getMessage()));
e.printStackTrace();
}
//FAWE end

Datei anzeigen

@ -129,6 +129,7 @@
"fawe.error.clipboard.on.disk.version.mismatch": "Clipboard version mismatch. Please delete your clipboards folder and restart the server.",
"fawe.error.limit.disallowed-block": "Your limit disallows use of block '{0}'",
"fawe.error.limit.disallowed-property": "Your limit disallows use of property '{0}'",
"fawe.error.region-mask-invalid": "Invalid region mask: {0}",
"fawe.cancel.count": "Cancelled {0} edits.",
"fawe.cancel.reason.confirm": "Use //confirm to execute {0}",
"fawe.cancel.reason.confirm.region": "Your selection is large ({0} -> {1}, containing {3} blocks). Use //confirm to execute {2}",