3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-09-06 16:12:51 +02:00

Update upstream

17b9f00 Move tinyurls to ehub.to (2033)
76ec878 Allow biome commands to be used from non-player actors (2034)
Dieser Commit ist enthalten in:
NotMyFault 2022-02-20 14:18:58 +01:00
Ursprung 39081e62c9
Commit f8e6feb1f2
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 158F5701A6AAD00C
5 geänderte Dateien mit 40 neuen und 22 gelöschten Zeilen

Datei anzeigen

@ -33,6 +33,7 @@ import com.sk89q.worldedit.command.util.annotation.Preload;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extension.platform.Capability;
import com.sk89q.worldedit.extension.platform.Locatable;
import com.sk89q.worldedit.function.RegionFunction;
import com.sk89q.worldedit.function.RegionMaskingFilter;
import com.sk89q.worldedit.function.biome.BiomeReplace;
@ -112,7 +113,7 @@ public class BiomeCommands {
)
@CommandPermissions("worldedit.biome.info")
public void biomeInfo(
Player player, LocalSession session,
Actor actor, World world, LocalSession session,
@Switch(name = 't', desc = "Use the block you are looking at.")
boolean useLineOfSight,
@Switch(name = 'p', desc = "Use the block you are currently in.")
@ -124,23 +125,33 @@ public class BiomeCommands {
String messageKey;
if (useLineOfSight) {
Location blockPosition = player.getBlockTrace(300);
if (blockPosition == null) {
player.print(Caption.of("worldedit.raytrace.noblock"));
if (actor instanceof Player) {
Location blockPosition = ((Player) actor).getBlockTrace(300);
if (blockPosition == null) {
actor.print(Caption.of("worldedit.raytrace.noblock"));
return;
}
BiomeType biome = world.getBiome(blockPosition.toVector().toBlockPoint());
biomes.add(biome);
messageKey = "worldedit.biomeinfo.lineofsight";
} else {
actor.print(Caption.of("worldedit.raytrace.require-player"));
return;
}
BiomeType biome = player.getWorld().getBiome(blockPosition.toVector().toBlockPoint());
biomes.add(biome);
messageKey = "worldedit.biomeinfo.lineofsight";
} else if (usePosition) {
BiomeType biome = player.getWorld().getBiome(player.getLocation().toVector().toBlockPoint());
biomes.add(biome);
if (actor instanceof Locatable) {
BiomeType biome = world.getBiome(((Locatable) actor).getLocation().toVector().toBlockPoint());
biomes.add(biome);
messageKey = "worldedit.biomeinfo.position";
messageKey = "worldedit.biomeinfo.position";
} else {
actor.print(Caption.of("worldedit.biomeinfo.not-locatable"));
return;
}
} else {
World world = player.getWorld();
Region region = session.getSelection(world);
for (BlockVector3 pt : region) {
@ -155,7 +166,7 @@ public class BiomeCommands {
HoverEvent.showText(TextComponent.of(biome.getId()))
)
).collect(Collectors.toList());
player.print(Caption.of(messageKey, TextUtils.join(components, TextComponent.of(", "))));
actor.print(Caption.of(messageKey, TextUtils.join(components, TextComponent.of(", "))));
}
@Command(
@ -168,18 +179,22 @@ public class BiomeCommands {
@Confirm(Confirm.Processor.REGION)
@CommandPermissions("worldedit.biome.set")
public void setBiome(
Player player, LocalSession session, EditSession editSession,
Actor actor, World world, LocalSession session, EditSession editSession,
@Arg(desc = "Biome type.") BiomeType target,
@Switch(name = 'p', desc = "Use your current position")
boolean atPosition
) throws WorldEditException {
World world = player.getWorld();
Region region;
Mask mask = editSession.getMask();
if (atPosition) {
final BlockVector3 pos = player.getLocation().toVector().toBlockPoint();
region = new CuboidRegion(pos, pos);
if (actor instanceof Locatable) {
final BlockVector3 pos = ((Locatable) actor).getLocation().toVector().toBlockPoint();
region = new CuboidRegion(pos, pos);
} else {
actor.print(Caption.of("worldedit.setbiome.not-locatable"));
return;
}
} else {
region = session.getSelection(world);
}
@ -191,7 +206,7 @@ public class BiomeCommands {
RegionVisitor visitor = new RegionVisitor(region, replace);
Operations.completeLegacy(visitor);
player.print(Caption.of(
actor.print(Caption.of(
"worldedit.setbiome.changed",
TextComponent.of(visitor.getAffected() / (editSession.getMaxY() - editSession.getMinY()))
));

Datei anzeigen

@ -348,7 +348,7 @@ public class GenerationCommands {
name = "/generate",
aliases = {"/gen", "/g"},
desc = "Generates a shape according to a formula.",
descFooter = "See also https://tinyurl.com/weexpr."
descFooter = "For details, see https://ehub.to/we/expr"
)
@CommandPermissions("worldedit.generation.shape")
@Logging(ALL)
@ -432,7 +432,7 @@ public class GenerationCommands {
desc = "Sets biome according to a formula.",
descFooter = "Formula must return positive numbers (true) if the point is inside the shape\n"
+ "Sets the biome of blocks in that shape.\n"
+ "See also https://tinyurl.com/weexpr."
+ "For details, see https://ehub.to/we/expr"
)
@CommandPermissions("worldedit.generation.shape.biome")
@Logging(ALL)

Datei anzeigen

@ -724,7 +724,7 @@ public class RegionCommands {
desc = "Deforms a selected region with an expression",
descFooter = "The expression is executed for each block and is expected\n"
+ "to modify the variables x, y and z to point to a new block\n"
+ "to fetch. See also https://tinyurl.com/weexpr"
+ "to fetch. For details, see https://ehub.to/we/expr"
)
@CommandPermissions("worldedit.region.deform")
@Logging(ALL)

Datei anzeigen

@ -76,7 +76,7 @@ public class WorldEditCommands {
String fVerStr = fVer == null ? "unknown" : "-" + fVer.build;
actor.print(TextComponent.of("FastAsyncWorldEdit" + fVerStr));
actor.print(TextComponent.of("Authors: Empire92, MattBDev, IronApollo, dordsor21 and NotMyFault"));
actor.print(TextComponent.of("Wiki: https://git.io/JMEPa")
actor.print(TextComponent.of("Wiki: https://intellectualsites.github.io/fastasyncworldedit-documentation/")
.clickEvent(ClickEvent.openUrl("https://intellectualsites.github.io/fastasyncworldedit-documentation/")));
actor.print(TextComponent.of("Discord: https://discord.gg/intellectualsites")
.clickEvent(ClickEvent.openUrl("https://discord.gg/intellectualsites")));

Datei anzeigen

@ -204,6 +204,7 @@
"worldedit.biomeinfo.lineofsight": "Biomes at line of sight point: {0}",
"worldedit.biomeinfo.position": "Biomes at your position: {0}",
"worldedit.biomeinfo.selection": "Biomes in your selection: {0}",
"worldedit.biomeinfo.not-locatable": "Command sender must be present in the world to use the -p flag.",
"worldedit.error.disabled": "This functionality is disabled (see WorldEdit configuration).",
"worldedit.error.no-match": "No match for '{0}'.",
"worldedit.error.unknown": "Unknown error occurred: {0}",
@ -278,6 +279,7 @@
"worldedit.brush.operation.equip": "Set brush to {0}.",
"worldedit.brush.none.equip": "Brush unbound from your current item.",
"worldedit.setbiome.changed": "Biomes were changed in {0} columns. You may have to rejoin your game (or close and reopen your world) to see a change.",
"worldedit.setbiome.not-locatable": "Command sender must be present in the world to use the -p flag.",
"worldedit.drawsel.disabled": "Server CUI disabled.",
"worldedit.drawsel.enabled": "Server CUI enabled. This only supports cuboid regions, with a maximum size of {0}x{1}x{2}.",
"worldedit.drawsel.disabled.already": "Server CUI already disabled.",
@ -319,6 +321,7 @@
"worldedit.redo.none": "Nothing left to redo.",
"worldedit.clearhistory.cleared": "History cleared.",
"worldedit.raytrace.noblock": "No block in sight!",
"worldedit.raytrace.require-player": "Raytracing commands require a player!",
"worldedit.restore.not-configured": "Snapshot/backup restore is not configured.",
"worldedit.restore.not-available": "That snapshot does not exist or is not available.",
"worldedit.restore.failed": "Failed to load snapshot: {0}",