geforkt von Mirrors/FastAsyncWorldEdit
Allow a command to be passed to /ascend and /descend which ascends/descends multiple floors.
Dieser Commit ist enthalten in:
Ursprung
1e9c5b2c76
Commit
fce942e130
@ -48,39 +48,74 @@ public class NavigationCommands {
|
|||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
aliases = {"ascend"},
|
aliases = {"ascend"},
|
||||||
usage = "",
|
usage = "[# of levels]",
|
||||||
desc = "Go up a floor",
|
desc = "Go up a floor",
|
||||||
min = 0,
|
min = 0,
|
||||||
max = 0
|
max = 1
|
||||||
)
|
)
|
||||||
@CommandPermissions({"worldedit.navigation.ascend"})
|
@CommandPermissions({"worldedit.navigation.ascend"})
|
||||||
public static void ascend(CommandContext args, WorldEdit we,
|
public static void ascend(CommandContext args, WorldEdit we,
|
||||||
LocalSession session, LocalPlayer player, EditSession editSession)
|
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||||
throws WorldEditException {
|
throws WorldEditException {
|
||||||
|
if (args.argsLength() == 0) {
|
||||||
if (player.ascendLevel()) {
|
if (player.ascendLevel()) {
|
||||||
player.print("Ascended a level.");
|
player.print("Ascended a level.");
|
||||||
|
} else {
|
||||||
|
player.printError("No free spot above you found.");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
player.printError("No free spot above you found.");
|
Boolean ascentDone = false;
|
||||||
|
int ascentLevels = 1;
|
||||||
|
int levelsToAscend = args.getInteger(0);
|
||||||
|
while (!ascentDone) {
|
||||||
|
if (player.ascendLevel() && levelsToAscend != ascentLevels) {
|
||||||
|
ascentLevels++;
|
||||||
|
} else {
|
||||||
|
ascentDone = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ascentLevels == 0) {
|
||||||
|
player.printError("No free spot above you found.");
|
||||||
|
} else {
|
||||||
|
player.print("Ascended " + Integer.toString(ascentLevels) + " levels.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
aliases = {"descend"},
|
aliases = {"descend"},
|
||||||
usage = "",
|
usage = "[# of floors]",
|
||||||
desc = "Go down a floor",
|
desc = "Go down a floor",
|
||||||
min = 0,
|
min = 0,
|
||||||
max = 0
|
max = 1
|
||||||
)
|
)
|
||||||
@CommandPermissions({"worldedit.navigation.descend"})
|
@CommandPermissions({"worldedit.navigation.descend"})
|
||||||
public static void descend(CommandContext args, WorldEdit we,
|
public static void descend(CommandContext args, WorldEdit we,
|
||||||
LocalSession session, LocalPlayer player, EditSession editSession)
|
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||||
throws WorldEditException {
|
throws WorldEditException {
|
||||||
|
|
||||||
if (player.descendLevel()) {
|
if (args.argsLength() == 0) {
|
||||||
player.print("Descended a level.");
|
if (player.descendLevel()) {
|
||||||
|
player.print("Descended a level.");
|
||||||
|
} else {
|
||||||
|
player.printError("No free spot above you found.");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
player.printError("No free spot below you found.");
|
Boolean descentDone = false;
|
||||||
|
int descentLevels = 1;
|
||||||
|
int levelsToDescend = args.getInteger(0);
|
||||||
|
while (!descentDone) {
|
||||||
|
if (player.descendLevel() && levelsToDescend != descentLevels) {
|
||||||
|
descentLevels++;
|
||||||
|
} else {
|
||||||
|
descentDone = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (descentLevels == 0) {
|
||||||
|
player.printError("No free spot above you found.");
|
||||||
|
} else {
|
||||||
|
player.print("Descended " + Integer.toString(descentLevels) + " levels.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren