SteamWar/BauSystem2.0
Archiviert
12
0

Fix IncompleteRegionException for ColorReplaceCommand and TypeReplaceCommand
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2023-07-22 15:50:19 +02:00
Ursprung 27798df7ce
Commit 1ece69a6e2
2 geänderte Dateien mit 43 neuen und 33 gelöschten Zeilen

Datei anzeigen

@ -20,6 +20,7 @@
package de.steamwar.bausystem.features.worldedit;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.IncompleteRegionException;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.util.formatting.text.Component;
@ -73,6 +74,7 @@ public class ColorReplaceCommand extends SWCommand {
replacements.put("minecraft:" + from.getValue().name().toLowerCase() + "_" + type.toLowerCase(), "minecraft:" + to.name().toLowerCase() + "_" + type.toLowerCase());
}
try {
Region region = WorldEditUtils.getRegion(player);
EditSession editSession = WorldEditUtils.getEditSession(player);
@ -81,6 +83,9 @@ public class ColorReplaceCommand extends SWCommand {
editSession.flushSession();
WorldEditUtils.addToPlayer(player, editSession);
BukkitAdapter.adapt(player).printInfo(TranslatableComponent.of("worldedit.replace.replaced", new Component[]{TextComponent.of(affected)}));
} catch (IncompleteRegionException e) {
BukkitAdapter.adapt(player).printError(TranslatableComponent.of("worldedit.error.incomplete-region"));
}
}
@ClassMapper(value = Pair.class, local = true)

Datei anzeigen

@ -20,6 +20,7 @@
package de.steamwar.bausystem.features.worldedit;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.IncompleteRegionException;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.util.formatting.text.Component;
@ -72,6 +73,7 @@ public class TypeReplaceCommand extends SWCommand {
return;
}
try {
Region region = WorldEditUtils.getRegion(player);
EditSession editSession = WorldEditUtils.getEditSession(player);
@ -99,6 +101,9 @@ public class TypeReplaceCommand extends SWCommand {
editSession.flushSession();
WorldEditUtils.addToPlayer(player, editSession);
BukkitAdapter.adapt(player).printInfo(TranslatableComponent.of("worldedit.replace.replaced", new Component[]{TextComponent.of(affected)}));
} catch (IncompleteRegionException e) {
BukkitAdapter.adapt(player).printError(TranslatableComponent.of("worldedit.error.incomplete-region"));
}
}
@ClassMapper(value = Pair.class, local = true)