mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-11-02 10:57:11 +00: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.
This commit is contained in:
parent
99fae3e716
commit
c25b9a53f2
@ -101,6 +101,7 @@ public abstract class LocalConfiguration {
|
||||
public boolean useInventory = false;
|
||||
public boolean useInventoryOverride = false;
|
||||
public boolean useInventoryCreativeOverride = false;
|
||||
public boolean navigationUseGlass = true;
|
||||
public int navigationWand = ItemID.COMPASS;
|
||||
public int navigationWandMaxDistance = 50;
|
||||
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.Logging;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalPlayer;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
@ -118,7 +119,7 @@ public class NavigationCommands {
|
||||
aliases = { "ceil" },
|
||||
usage = "[clearance]",
|
||||
desc = "Go to the celing",
|
||||
flags = "f",
|
||||
flags = "fg",
|
||||
min = 0,
|
||||
max = 1
|
||||
)
|
||||
@ -127,11 +128,11 @@ public class NavigationCommands {
|
||||
public void ceiling(CommandContext args, LocalSession session, LocalPlayer player,
|
||||
EditSession editSession) throws WorldEditException {
|
||||
|
||||
int clearence = args.argsLength() > 0 ?
|
||||
final int clearance = args.argsLength() > 0 ?
|
||||
Math.max(0, args.getInteger(0)) : 0;
|
||||
|
||||
final boolean useFlight = args.hasFlag('f');
|
||||
if (player.ascendToCeiling(clearence, !useFlight)) {
|
||||
final boolean alwaysGlass = getAlwaysGlass(args);
|
||||
if (player.ascendToCeiling(clearance, alwaysGlass)) {
|
||||
player.print("Whoosh!");
|
||||
} else {
|
||||
player.printError("No free spot above you found.");
|
||||
@ -179,7 +180,7 @@ public class NavigationCommands {
|
||||
aliases = { "up" },
|
||||
usage = "<block>",
|
||||
desc = "Go upwards some distance",
|
||||
flags = "f",
|
||||
flags = "fg",
|
||||
min = 1,
|
||||
max = 1
|
||||
)
|
||||
@ -188,13 +189,28 @@ public class NavigationCommands {
|
||||
public void up(CommandContext args, LocalSession session, LocalPlayer player,
|
||||
EditSession editSession) throws WorldEditException {
|
||||
|
||||
int distance = args.getInteger(0);
|
||||
final int distance = args.getInteger(0);
|
||||
|
||||
final boolean useFlight = args.hasFlag('f');
|
||||
if (player.ascendUpwards(distance, !useFlight)) {
|
||||
final boolean alwaysGlass = getAlwaysGlass(args);
|
||||
if (player.ascendUpwards(distance, alwaysGlass)) {
|
||||
player.print("Whoosh!");
|
||||
} else {
|
||||
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);
|
||||
navigationWand = getInt("nav-wand-item", navigationWand);
|
||||
navigationWandMaxDistance = getInt("nav-wand-distance", navigationWandMaxDistance);
|
||||
navigationUseGlass = getBool("nav-use-glass", navigationUseGlass);
|
||||
scriptTimeout = getInt("scripting-timeout", scriptTimeout);
|
||||
saveDir = getString("schematic-save-dir", saveDir);
|
||||
scriptsDir = getString("craftscript-dir", scriptsDir);
|
||||
|
@ -98,6 +98,7 @@ public class YAMLConfiguration extends LocalConfiguration {
|
||||
|
||||
navigationWand = config.getInt("navigation-wand.item", navigationWand);
|
||||
navigationWandMaxDistance = config.getInt("navigation-wand.max-distance", navigationWandMaxDistance);
|
||||
navigationUseGlass = config.getBoolean("navigation.use-glass", navigationUseGlass);
|
||||
|
||||
scriptTimeout = config.getInt("scripting.timeout", scriptTimeout);
|
||||
scriptsDir = config.getString("scripting.dir", scriptsDir);
|
||||
|
Loading…
Reference in New Issue
Block a user