Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-07 20:10:06 +01:00
Added config option to set the default for the /up and /ceil commands.
The config option defaults to glass as that is consistent across gamemodes. Use -f to force flight (if available). Use -g to force glass.
Dieser Commit ist enthalten in:
Ursprung
99fae3e716
Commit
c25b9a53f2
@ -101,6 +101,7 @@ public abstract class LocalConfiguration {
|
|||||||
public boolean useInventory = false;
|
public boolean useInventory = false;
|
||||||
public boolean useInventoryOverride = false;
|
public boolean useInventoryOverride = false;
|
||||||
public boolean useInventoryCreativeOverride = false;
|
public boolean useInventoryCreativeOverride = false;
|
||||||
|
public boolean navigationUseGlass = true;
|
||||||
public int navigationWand = ItemID.COMPASS;
|
public int navigationWand = ItemID.COMPASS;
|
||||||
public int navigationWandMaxDistance = 50;
|
public int navigationWandMaxDistance = 50;
|
||||||
public int scriptTimeout = 3000;
|
public int scriptTimeout = 3000;
|
||||||
|
@ -26,6 +26,7 @@ import com.sk89q.minecraft.util.commands.CommandContext;
|
|||||||
import com.sk89q.minecraft.util.commands.CommandPermissions;
|
import com.sk89q.minecraft.util.commands.CommandPermissions;
|
||||||
import com.sk89q.minecraft.util.commands.Logging;
|
import com.sk89q.minecraft.util.commands.Logging;
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
|
import com.sk89q.worldedit.LocalConfiguration;
|
||||||
import com.sk89q.worldedit.LocalPlayer;
|
import com.sk89q.worldedit.LocalPlayer;
|
||||||
import com.sk89q.worldedit.LocalSession;
|
import com.sk89q.worldedit.LocalSession;
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
@ -118,7 +119,7 @@ public class NavigationCommands {
|
|||||||
aliases = { "ceil" },
|
aliases = { "ceil" },
|
||||||
usage = "[clearance]",
|
usage = "[clearance]",
|
||||||
desc = "Go to the celing",
|
desc = "Go to the celing",
|
||||||
flags = "f",
|
flags = "fg",
|
||||||
min = 0,
|
min = 0,
|
||||||
max = 1
|
max = 1
|
||||||
)
|
)
|
||||||
@ -127,11 +128,11 @@ public class NavigationCommands {
|
|||||||
public void ceiling(CommandContext args, LocalSession session, LocalPlayer player,
|
public void ceiling(CommandContext args, LocalSession session, LocalPlayer player,
|
||||||
EditSession editSession) throws WorldEditException {
|
EditSession editSession) throws WorldEditException {
|
||||||
|
|
||||||
int clearence = args.argsLength() > 0 ?
|
final int clearance = args.argsLength() > 0 ?
|
||||||
Math.max(0, args.getInteger(0)) : 0;
|
Math.max(0, args.getInteger(0)) : 0;
|
||||||
|
|
||||||
final boolean useFlight = args.hasFlag('f');
|
final boolean alwaysGlass = getAlwaysGlass(args);
|
||||||
if (player.ascendToCeiling(clearence, !useFlight)) {
|
if (player.ascendToCeiling(clearance, alwaysGlass)) {
|
||||||
player.print("Whoosh!");
|
player.print("Whoosh!");
|
||||||
} else {
|
} else {
|
||||||
player.printError("No free spot above you found.");
|
player.printError("No free spot above you found.");
|
||||||
@ -179,7 +180,7 @@ public class NavigationCommands {
|
|||||||
aliases = { "up" },
|
aliases = { "up" },
|
||||||
usage = "<block>",
|
usage = "<block>",
|
||||||
desc = "Go upwards some distance",
|
desc = "Go upwards some distance",
|
||||||
flags = "f",
|
flags = "fg",
|
||||||
min = 1,
|
min = 1,
|
||||||
max = 1
|
max = 1
|
||||||
)
|
)
|
||||||
@ -188,13 +189,28 @@ public class NavigationCommands {
|
|||||||
public void up(CommandContext args, LocalSession session, LocalPlayer player,
|
public void up(CommandContext args, LocalSession session, LocalPlayer player,
|
||||||
EditSession editSession) throws WorldEditException {
|
EditSession editSession) throws WorldEditException {
|
||||||
|
|
||||||
int distance = args.getInteger(0);
|
final int distance = args.getInteger(0);
|
||||||
|
|
||||||
final boolean useFlight = args.hasFlag('f');
|
final boolean alwaysGlass = getAlwaysGlass(args);
|
||||||
if (player.ascendUpwards(distance, !useFlight)) {
|
if (player.ascendUpwards(distance, alwaysGlass)) {
|
||||||
player.print("Whoosh!");
|
player.print("Whoosh!");
|
||||||
} else {
|
} else {
|
||||||
player.printError("You would hit something above you.");
|
player.printError("You would hit something above you.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper function for /up and /ceil.
|
||||||
|
*
|
||||||
|
* @param args The {@link CommandContext} to extract the flags from.
|
||||||
|
* @return true, if glass should always be put under the player
|
||||||
|
*/
|
||||||
|
private boolean getAlwaysGlass(CommandContext args) {
|
||||||
|
final LocalConfiguration config = we.getConfiguration();
|
||||||
|
|
||||||
|
final boolean forceFlight = args.hasFlag('f');
|
||||||
|
final boolean forceGlass = args.hasFlag('g');
|
||||||
|
|
||||||
|
return forceGlass || (config.navigationUseGlass && !forceFlight);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -101,6 +101,7 @@ public class PropertiesConfiguration extends LocalConfiguration {
|
|||||||
useInventoryCreativeOverride = getBool("use-inventory-creative-override", useInventoryCreativeOverride);
|
useInventoryCreativeOverride = getBool("use-inventory-creative-override", useInventoryCreativeOverride);
|
||||||
navigationWand = getInt("nav-wand-item", navigationWand);
|
navigationWand = getInt("nav-wand-item", navigationWand);
|
||||||
navigationWandMaxDistance = getInt("nav-wand-distance", navigationWandMaxDistance);
|
navigationWandMaxDistance = getInt("nav-wand-distance", navigationWandMaxDistance);
|
||||||
|
navigationUseGlass = getBool("nav-use-glass", navigationUseGlass);
|
||||||
scriptTimeout = getInt("scripting-timeout", scriptTimeout);
|
scriptTimeout = getInt("scripting-timeout", scriptTimeout);
|
||||||
saveDir = getString("schematic-save-dir", saveDir);
|
saveDir = getString("schematic-save-dir", saveDir);
|
||||||
scriptsDir = getString("craftscript-dir", scriptsDir);
|
scriptsDir = getString("craftscript-dir", scriptsDir);
|
||||||
|
@ -98,6 +98,7 @@ public class YAMLConfiguration extends LocalConfiguration {
|
|||||||
|
|
||||||
navigationWand = config.getInt("navigation-wand.item", navigationWand);
|
navigationWand = config.getInt("navigation-wand.item", navigationWand);
|
||||||
navigationWandMaxDistance = config.getInt("navigation-wand.max-distance", navigationWandMaxDistance);
|
navigationWandMaxDistance = config.getInt("navigation-wand.max-distance", navigationWandMaxDistance);
|
||||||
|
navigationUseGlass = config.getBoolean("navigation.use-glass", navigationUseGlass);
|
||||||
|
|
||||||
scriptTimeout = config.getInt("scripting.timeout", scriptTimeout);
|
scriptTimeout = config.getInt("scripting.timeout", scriptTimeout);
|
||||||
scriptsDir = config.getString("scripting.dir", scriptsDir);
|
scriptsDir = config.getString("scripting.dir", scriptsDir);
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren