Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-08 04:20:06 +01: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:
Ursprung
39081e62c9
Commit
f8e6feb1f2
@ -33,6 +33,7 @@ import com.sk89q.worldedit.command.util.annotation.Preload;
|
|||||||
import com.sk89q.worldedit.entity.Player;
|
import com.sk89q.worldedit.entity.Player;
|
||||||
import com.sk89q.worldedit.extension.platform.Actor;
|
import com.sk89q.worldedit.extension.platform.Actor;
|
||||||
import com.sk89q.worldedit.extension.platform.Capability;
|
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.RegionFunction;
|
||||||
import com.sk89q.worldedit.function.RegionMaskingFilter;
|
import com.sk89q.worldedit.function.RegionMaskingFilter;
|
||||||
import com.sk89q.worldedit.function.biome.BiomeReplace;
|
import com.sk89q.worldedit.function.biome.BiomeReplace;
|
||||||
@ -112,7 +113,7 @@ public class BiomeCommands {
|
|||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.biome.info")
|
@CommandPermissions("worldedit.biome.info")
|
||||||
public void biomeInfo(
|
public void biomeInfo(
|
||||||
Player player, LocalSession session,
|
Actor actor, World world, LocalSession session,
|
||||||
@Switch(name = 't', desc = "Use the block you are looking at.")
|
@Switch(name = 't', desc = "Use the block you are looking at.")
|
||||||
boolean useLineOfSight,
|
boolean useLineOfSight,
|
||||||
@Switch(name = 'p', desc = "Use the block you are currently in.")
|
@Switch(name = 'p', desc = "Use the block you are currently in.")
|
||||||
@ -124,23 +125,33 @@ public class BiomeCommands {
|
|||||||
String messageKey;
|
String messageKey;
|
||||||
|
|
||||||
if (useLineOfSight) {
|
if (useLineOfSight) {
|
||||||
Location blockPosition = player.getBlockTrace(300);
|
if (actor instanceof Player) {
|
||||||
if (blockPosition == null) {
|
Location blockPosition = ((Player) actor).getBlockTrace(300);
|
||||||
player.print(Caption.of("worldedit.raytrace.noblock"));
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
BiomeType biome = player.getWorld().getBiome(blockPosition.toVector().toBlockPoint());
|
|
||||||
biomes.add(biome);
|
|
||||||
|
|
||||||
messageKey = "worldedit.biomeinfo.lineofsight";
|
|
||||||
} else if (usePosition) {
|
} else if (usePosition) {
|
||||||
BiomeType biome = player.getWorld().getBiome(player.getLocation().toVector().toBlockPoint());
|
if (actor instanceof Locatable) {
|
||||||
biomes.add(biome);
|
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 {
|
} else {
|
||||||
World world = player.getWorld();
|
|
||||||
Region region = session.getSelection(world);
|
Region region = session.getSelection(world);
|
||||||
|
|
||||||
for (BlockVector3 pt : region) {
|
for (BlockVector3 pt : region) {
|
||||||
@ -155,7 +166,7 @@ public class BiomeCommands {
|
|||||||
HoverEvent.showText(TextComponent.of(biome.getId()))
|
HoverEvent.showText(TextComponent.of(biome.getId()))
|
||||||
)
|
)
|
||||||
).collect(Collectors.toList());
|
).collect(Collectors.toList());
|
||||||
player.print(Caption.of(messageKey, TextUtils.join(components, TextComponent.of(", "))));
|
actor.print(Caption.of(messageKey, TextUtils.join(components, TextComponent.of(", "))));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
@ -168,18 +179,22 @@ public class BiomeCommands {
|
|||||||
@Confirm(Confirm.Processor.REGION)
|
@Confirm(Confirm.Processor.REGION)
|
||||||
@CommandPermissions("worldedit.biome.set")
|
@CommandPermissions("worldedit.biome.set")
|
||||||
public void setBiome(
|
public void setBiome(
|
||||||
Player player, LocalSession session, EditSession editSession,
|
Actor actor, World world, LocalSession session, EditSession editSession,
|
||||||
@Arg(desc = "Biome type.") BiomeType target,
|
@Arg(desc = "Biome type.") BiomeType target,
|
||||||
@Switch(name = 'p', desc = "Use your current position")
|
@Switch(name = 'p', desc = "Use your current position")
|
||||||
boolean atPosition
|
boolean atPosition
|
||||||
) throws WorldEditException {
|
) throws WorldEditException {
|
||||||
World world = player.getWorld();
|
|
||||||
Region region;
|
Region region;
|
||||||
Mask mask = editSession.getMask();
|
Mask mask = editSession.getMask();
|
||||||
|
|
||||||
if (atPosition) {
|
if (atPosition) {
|
||||||
final BlockVector3 pos = player.getLocation().toVector().toBlockPoint();
|
if (actor instanceof Locatable) {
|
||||||
region = new CuboidRegion(pos, pos);
|
final BlockVector3 pos = ((Locatable) actor).getLocation().toVector().toBlockPoint();
|
||||||
|
region = new CuboidRegion(pos, pos);
|
||||||
|
} else {
|
||||||
|
actor.print(Caption.of("worldedit.setbiome.not-locatable"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
region = session.getSelection(world);
|
region = session.getSelection(world);
|
||||||
}
|
}
|
||||||
@ -191,7 +206,7 @@ public class BiomeCommands {
|
|||||||
RegionVisitor visitor = new RegionVisitor(region, replace);
|
RegionVisitor visitor = new RegionVisitor(region, replace);
|
||||||
Operations.completeLegacy(visitor);
|
Operations.completeLegacy(visitor);
|
||||||
|
|
||||||
player.print(Caption.of(
|
actor.print(Caption.of(
|
||||||
"worldedit.setbiome.changed",
|
"worldedit.setbiome.changed",
|
||||||
TextComponent.of(visitor.getAffected() / (editSession.getMaxY() - editSession.getMinY()))
|
TextComponent.of(visitor.getAffected() / (editSession.getMaxY() - editSession.getMinY()))
|
||||||
));
|
));
|
||||||
|
@ -348,7 +348,7 @@ public class GenerationCommands {
|
|||||||
name = "/generate",
|
name = "/generate",
|
||||||
aliases = {"/gen", "/g"},
|
aliases = {"/gen", "/g"},
|
||||||
desc = "Generates a shape according to a formula.",
|
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")
|
@CommandPermissions("worldedit.generation.shape")
|
||||||
@Logging(ALL)
|
@Logging(ALL)
|
||||||
@ -432,7 +432,7 @@ public class GenerationCommands {
|
|||||||
desc = "Sets biome according to a formula.",
|
desc = "Sets biome according to a formula.",
|
||||||
descFooter = "Formula must return positive numbers (true) if the point is inside the shape\n"
|
descFooter = "Formula must return positive numbers (true) if the point is inside the shape\n"
|
||||||
+ "Sets the biome of blocks in that 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")
|
@CommandPermissions("worldedit.generation.shape.biome")
|
||||||
@Logging(ALL)
|
@Logging(ALL)
|
||||||
|
@ -724,7 +724,7 @@ public class RegionCommands {
|
|||||||
desc = "Deforms a selected region with an expression",
|
desc = "Deforms a selected region with an expression",
|
||||||
descFooter = "The expression is executed for each block and is expected\n"
|
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 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")
|
@CommandPermissions("worldedit.region.deform")
|
||||||
@Logging(ALL)
|
@Logging(ALL)
|
||||||
|
@ -76,7 +76,7 @@ public class WorldEditCommands {
|
|||||||
String fVerStr = fVer == null ? "unknown" : "-" + fVer.build;
|
String fVerStr = fVer == null ? "unknown" : "-" + fVer.build;
|
||||||
actor.print(TextComponent.of("FastAsyncWorldEdit" + fVerStr));
|
actor.print(TextComponent.of("FastAsyncWorldEdit" + fVerStr));
|
||||||
actor.print(TextComponent.of("Authors: Empire92, MattBDev, IronApollo, dordsor21 and NotMyFault"));
|
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/")));
|
.clickEvent(ClickEvent.openUrl("https://intellectualsites.github.io/fastasyncworldedit-documentation/")));
|
||||||
actor.print(TextComponent.of("Discord: https://discord.gg/intellectualsites")
|
actor.print(TextComponent.of("Discord: https://discord.gg/intellectualsites")
|
||||||
.clickEvent(ClickEvent.openUrl("https://discord.gg/intellectualsites")));
|
.clickEvent(ClickEvent.openUrl("https://discord.gg/intellectualsites")));
|
||||||
|
@ -204,6 +204,7 @@
|
|||||||
"worldedit.biomeinfo.lineofsight": "Biomes at line of sight point: {0}",
|
"worldedit.biomeinfo.lineofsight": "Biomes at line of sight point: {0}",
|
||||||
"worldedit.biomeinfo.position": "Biomes at your position: {0}",
|
"worldedit.biomeinfo.position": "Biomes at your position: {0}",
|
||||||
"worldedit.biomeinfo.selection": "Biomes in your selection: {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.disabled": "This functionality is disabled (see WorldEdit configuration).",
|
||||||
"worldedit.error.no-match": "No match for '{0}'.",
|
"worldedit.error.no-match": "No match for '{0}'.",
|
||||||
"worldedit.error.unknown": "Unknown error occurred: {0}",
|
"worldedit.error.unknown": "Unknown error occurred: {0}",
|
||||||
@ -278,6 +279,7 @@
|
|||||||
"worldedit.brush.operation.equip": "Set brush to {0}.",
|
"worldedit.brush.operation.equip": "Set brush to {0}.",
|
||||||
"worldedit.brush.none.equip": "Brush unbound from your current item.",
|
"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.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.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.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.",
|
"worldedit.drawsel.disabled.already": "Server CUI already disabled.",
|
||||||
@ -319,6 +321,7 @@
|
|||||||
"worldedit.redo.none": "Nothing left to redo.",
|
"worldedit.redo.none": "Nothing left to redo.",
|
||||||
"worldedit.clearhistory.cleared": "History cleared.",
|
"worldedit.clearhistory.cleared": "History cleared.",
|
||||||
"worldedit.raytrace.noblock": "No block in sight!",
|
"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-configured": "Snapshot/backup restore is not configured.",
|
||||||
"worldedit.restore.not-available": "That snapshot does not exist or is not available.",
|
"worldedit.restore.not-available": "That snapshot does not exist or is not available.",
|
||||||
"worldedit.restore.failed": "Failed to load snapshot: {0}",
|
"worldedit.restore.failed": "Failed to load snapshot: {0}",
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren