3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-07 20:10:06 +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; return result;
} catch (Throwable e2) { } catch (Throwable e2) {
e2.printStackTrace(); 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; throw rethrow;
} catch (Throwable e) { } catch (Throwable e) {
e.printStackTrace(); e.printStackTrace();
throw new InputParseException(Caption.of(e.getMessage()), e); throw new InputParseException(TextComponent.of(e.getMessage()), e);
} }
List<Mask> maskUnions = new ArrayList<>(); List<Mask> maskUnions = new ArrayList<>();
for (List<Mask> maskList : masks) { for (List<Mask> maskList : masks) {

Datei anzeigen

@ -57,7 +57,7 @@ public class LinearPatternParser extends RichParser<Pattern> {
Set<Pattern> patterns = ((RandomPattern) inner).getPatterns(); Set<Pattern> patterns = ((RandomPattern) inner).getPatterns();
return new LinearBlockPattern(patterns.toArray(new Pattern[0])); 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())); + " cannot be used with " + getPrefix()));
} }

Datei anzeigen

@ -94,7 +94,7 @@ public class RandomFullClipboardPatternParser extends RichParser<Pattern> {
} }
return new RandomFullClipboardPattern(clipboards, rotate, flip); return new RandomFullClipboardPattern(clipboards, rotate, flip);
} catch (IOException e) { } 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; return result;
} catch (Throwable e2) { } catch (Throwable e2) {
e2.printStackTrace(); 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; throw rethrow;
} catch (Throwable e) { } catch (Throwable e) {
e.printStackTrace(); e.printStackTrace();
throw new InputParseException(Caption.of(e.getMessage()), e); throw new InputParseException(TextComponent.of(e.getMessage()), e);
} }
if (patterns.isEmpty()) { if (patterns.isEmpty()) {
return null; return null;

Datei anzeigen

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

Datei anzeigen

@ -168,7 +168,7 @@ public class ConsumeBindings extends Bindings {
try { try {
return getWorldEdit().getBlockFactory().parseFromInput(argument, parserContext); return getWorldEdit().getBlockFactory().parseFromInput(argument, parserContext);
} catch (NoMatchException e) { } 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); backupRegions.add(region);
} }
} else { } else {
player.print(Caption.of("Invalid Mask")); player.print(Caption.of("fawe.error.region-mask-invalid", mask.getClass().getSimpleName()));
removed = true; removed = true;
iterator.remove(); iterator.remove();
} }

Datei anzeigen

@ -179,7 +179,7 @@ public class ImageUtil {
try { try {
return MainUtil.readImage(getInputStream(uri)); return MainUtil.readImage(getInputStream(uri));
} catch (IOException e) { } 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(); return new URL(uriStr).openStream();
} catch (IOException e) { } 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))); throw new InputParseException(Caption.of("fawe.error.invalid-image", TextComponent.of(arg)));
} catch (IOException e) { } 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))); throw new InputParseException(Caption.of("fawe.error.invalid-image", TextComponent.of(arg)));
} catch (IOException | URISyntaxException e) { } 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))); throw new NoMatchException(Caption.of("worldedit.error.unknown-block", TextComponent.of(input)));
} }
//FAWE start
if (blockAndExtraData.length > 1 && blockAndExtraData[1].startsWith("{")) { if (blockAndExtraData.length > 1 && blockAndExtraData[1].startsWith("{")) {
String joined = StringMan.join(Arrays.copyOfRange(blockAndExtraData, 1, blockAndExtraData.length), "|"); String joined = StringMan.join(Arrays.copyOfRange(blockAndExtraData, 1, blockAndExtraData.length), "|");
try { try {
nbt = JSON2NBT.getTagFromJson(joined); nbt = JSON2NBT.getTagFromJson(joined);
} catch (NBTException e) { } 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 // Check if the item is allowed
BlockType blockType = state.getBlockType(); 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.fastasyncworldedit.core.util.task.AsyncNotifyQueue;
import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.internal.cui.CUIEvent; import com.sk89q.worldedit.internal.cui.CUIEvent;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import java.io.File; import java.io.File;
import java.util.Map; import java.util.Map;
@ -72,7 +73,7 @@ public abstract class AbstractNonPlayerActor implements Actor {
throwable = throwable.getCause(); throwable = throwable.getCause();
} }
if (throwable instanceof WorldEditException) { if (throwable instanceof WorldEditException) {
printError(Caption.of(throwable.getLocalizedMessage())); printError(TextComponent.of(throwable.getLocalizedMessage()));
} else { } else {
FaweException fe = FaweException.get(throwable); FaweException fe = FaweException.get(throwable);
if (fe != null) { 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.Location;
import com.sk89q.worldedit.util.TargetBlock; import com.sk89q.worldedit.util.TargetBlock;
import com.sk89q.worldedit.util.auth.AuthorizationException; 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.World;
import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockCategories; import com.sk89q.worldedit.world.block.BlockCategories;
@ -86,7 +87,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
throwable = throwable.getCause(); throwable = throwable.getCause();
} }
if (throwable instanceof WorldEditException) { if (throwable instanceof WorldEditException) {
printError(Caption.of(throwable.getLocalizedMessage())); printError(TextComponent.of(throwable.getLocalizedMessage()));
} else { } else {
FaweException fe = FaweException.get(throwable); FaweException fe = FaweException.get(throwable);
if (fe != null) { if (fe != null) {

Datei anzeigen

@ -448,7 +448,7 @@ public class PlatformManager {
actor.print(Caption.of("fawe.cancel.reason", faweException.getComponent())); actor.print(Caption.of("fawe.cancel.reason", faweException.getComponent()));
} else { } else {
actor.print(Caption.of("worldedit.command.error.report")); 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(); e.printStackTrace();
} }
} }
@ -502,7 +502,7 @@ public class PlatformManager {
player.print(Caption.of("fawe.cancel.reason", faweException.getComponent())); player.print(Caption.of("fawe.cancel.reason", faweException.getComponent()));
} else { } else {
player.print(Caption.of("worldedit.command.error.report")); 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(); e.printStackTrace();
} }
//FAWE end //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.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-block": "Your limit disallows use of block '{0}'",
"fawe.error.limit.disallowed-property": "Your limit disallows use of property '{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.count": "Cancelled {0} edits.",
"fawe.cancel.reason.confirm": "Use //confirm to execute {0}", "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}", "fawe.cancel.reason.confirm.region": "Your selection is large ({0} -> {1}, containing {3} blocks). Use //confirm to execute {2}",