Update Upstream

98adde2 Allow toggleplace to work on any Actor + Locatable
This commit is contained in:
NotMyFault 2021-04-10 11:15:41 +02:00
parent 19592df1f6
commit 88764d8d46
No known key found for this signature in database
GPG Key ID: 158F5701A6AAD00C
2 changed files with 9 additions and 3 deletions

View File

@ -44,6 +44,7 @@ import com.sk89q.worldedit.extension.input.InputParseException;
import com.sk89q.worldedit.extension.input.ParserContext;
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.extent.clipboard.Clipboard;
import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.internal.command.CommandRegistrationHandler;
@ -405,11 +406,15 @@ public class GeneralCommands {
desc = "Switch between your position and pos1 for placement"
)
@CommandPermissions("worldedit.toggleplace")
public void togglePlace(Player player, LocalSession session) {
public void togglePlace(Actor actor, LocalSession session) {
if (!(actor instanceof Locatable)) {
actor.print(Caption.of("worldedit.toggleplace.not-locatable"));
return;
}
if (session.togglePlacementPosition()) {
player.print(Caption.of("worldedit.toggleplace.pos1"));
actor.print(Caption.of("worldedit.toggleplace.pos1"));
} else {
player.print(Caption.of("worldedit.toggleplace.player"));
actor.print(Caption.of("worldedit.toggleplace.player"));
}
}

View File

@ -297,6 +297,7 @@
"worldedit.gmask.set": "Global mask set.",
"worldedit.toggleplace.pos1": "Now placing at pos #1.",
"worldedit.toggleplace.player": "Now placing at the block you stand in.",
"worldedit.toggleplace.not-locatable": "Cannot toggle placing in this context.",
"worldedit.searchitem.too-short": "Enter a longer search string (len > 2).",
"worldedit.searchitem.either-b-or-i": "You cannot use both the 'b' and 'i' flags simultaneously.",
"worldedit.searchitem.searching": "(Please wait... searching items.)",