mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-24 02:07:39 +00:00
Added //gmask to set a *GLOBAL* mask that affects nearly ALL operations. Now you can confine //sphere to a region or create //walls that do not replace existing blocks.
This commit is contained in:
parent
e1da7c41ad
commit
aa17d2f0e0
@ -65,6 +65,11 @@ commands:
|
|||||||
description: Modify block change limit
|
description: Modify block change limit
|
||||||
usage: /<command> <limit>
|
usage: /<command> <limit>
|
||||||
permissions: 'worldedit.limit'
|
permissions: 'worldedit.limit'
|
||||||
|
/gmask:
|
||||||
|
description: Set the global mask
|
||||||
|
usage: /<command> [mask]
|
||||||
|
aliases: ['gmask']
|
||||||
|
permissions: 'worldedit.global-mask'
|
||||||
/hcyl:
|
/hcyl:
|
||||||
description: Generate a hollow cylinder
|
description: Generate a hollow cylinder
|
||||||
usage: /<command> <block> <radius> [height]
|
usage: /<command> <block> <radius> [height]
|
||||||
|
@ -33,6 +33,7 @@ import com.sk89q.worldedit.regions.*;
|
|||||||
import com.sk89q.worldedit.util.TreeGenerator;
|
import com.sk89q.worldedit.util.TreeGenerator;
|
||||||
import com.sk89q.worldedit.bags.*;
|
import com.sk89q.worldedit.bags.*;
|
||||||
import com.sk89q.worldedit.blocks.*;
|
import com.sk89q.worldedit.blocks.*;
|
||||||
|
import com.sk89q.worldedit.masks.Mask;
|
||||||
import com.sk89q.worldedit.patterns.*;
|
import com.sk89q.worldedit.patterns.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -109,6 +110,11 @@ public class EditSession {
|
|||||||
*/
|
*/
|
||||||
private Set<Integer> missingBlocks = new HashSet<Integer>();
|
private Set<Integer> missingBlocks = new HashSet<Integer>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mask to cover operations.
|
||||||
|
*/
|
||||||
|
private Mask mask;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct the object with a maximum number of blocks.
|
* Construct the object with a maximum number of blocks.
|
||||||
*
|
*
|
||||||
@ -162,6 +168,12 @@ public class EditSession {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mask != null) {
|
||||||
|
if (!mask.matches(this, pt)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int existing = world.getBlockType(pt);
|
int existing = world.getBlockType(pt);
|
||||||
|
|
||||||
// Clear the container block so that it doesn't drop items
|
// Clear the container block so that it doesn't drop items
|
||||||
@ -2245,4 +2257,22 @@ public class EditSession {
|
|||||||
public int getBlockChangeCount() {
|
public int getBlockChangeCount() {
|
||||||
return original.size();
|
return original.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the mask.
|
||||||
|
*
|
||||||
|
* @return mask, may be null
|
||||||
|
*/
|
||||||
|
public Mask getMask() {
|
||||||
|
return mask;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a mask.
|
||||||
|
*
|
||||||
|
* @param mask mask or null
|
||||||
|
*/
|
||||||
|
public void setMask(Mask mask) {
|
||||||
|
this.mask = mask;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,7 @@ import com.sk89q.worldedit.cui.CUIPointBasedRegion;
|
|||||||
import com.sk89q.worldedit.cui.CUIEvent;
|
import com.sk89q.worldedit.cui.CUIEvent;
|
||||||
import com.sk89q.worldedit.cui.SelectionPointEvent;
|
import com.sk89q.worldedit.cui.SelectionPointEvent;
|
||||||
import com.sk89q.worldedit.cui.SelectionShapeEvent;
|
import com.sk89q.worldedit.cui.SelectionShapeEvent;
|
||||||
|
import com.sk89q.worldedit.masks.Mask;
|
||||||
import com.sk89q.worldedit.regions.CuboidRegionSelector;
|
import com.sk89q.worldedit.regions.CuboidRegionSelector;
|
||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
import com.sk89q.worldedit.regions.RegionSelector;
|
import com.sk89q.worldedit.regions.RegionSelector;
|
||||||
@ -74,6 +75,7 @@ public class LocalSession {
|
|||||||
private boolean beenToldVersion = false;
|
private boolean beenToldVersion = false;
|
||||||
private boolean hasCUISupport = false;
|
private boolean hasCUISupport = false;
|
||||||
private boolean fastMode = false;
|
private boolean fastMode = false;
|
||||||
|
private Mask mask;
|
||||||
private TimeZone timezone = TimeZone.getDefault();
|
private TimeZone timezone = TimeZone.getDefault();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -660,6 +662,7 @@ public class LocalSession {
|
|||||||
new EditSession(player.getWorld(),
|
new EditSession(player.getWorld(),
|
||||||
getBlockChangeLimit(), blockBag);
|
getBlockChangeLimit(), blockBag);
|
||||||
editSession.setFastMode(fastMode);
|
editSession.setFastMode(fastMode);
|
||||||
|
editSession.setMask(mask);
|
||||||
|
|
||||||
return editSession;
|
return editSession;
|
||||||
}
|
}
|
||||||
@ -681,4 +684,22 @@ public class LocalSession {
|
|||||||
public void setFastMode(boolean fastMode) {
|
public void setFastMode(boolean fastMode) {
|
||||||
this.fastMode = fastMode;
|
this.fastMode = fastMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the mask.
|
||||||
|
*
|
||||||
|
* @return mask, may be null
|
||||||
|
*/
|
||||||
|
public Mask getMask() {
|
||||||
|
return mask;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a mask.
|
||||||
|
*
|
||||||
|
* @param mask mask or null
|
||||||
|
*/
|
||||||
|
public void setMask(Mask mask) {
|
||||||
|
this.mask = mask;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,7 @@ import com.sk89q.minecraft.util.commands.CommandPermissions;
|
|||||||
import com.sk89q.minecraft.util.commands.NestedCommand;
|
import com.sk89q.minecraft.util.commands.NestedCommand;
|
||||||
import com.sk89q.worldedit.*;
|
import com.sk89q.worldedit.*;
|
||||||
import com.sk89q.worldedit.blocks.ItemType;
|
import com.sk89q.worldedit.blocks.ItemType;
|
||||||
|
import com.sk89q.worldedit.masks.Mask;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* General WorldEdit commands.
|
* General WorldEdit commands.
|
||||||
@ -81,6 +82,27 @@ public class GeneralCommands {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Command(
|
||||||
|
aliases = {"/gmask", "gmask"},
|
||||||
|
usage = "[mask]",
|
||||||
|
desc = "Set the global mask",
|
||||||
|
min = 0,
|
||||||
|
max = -1
|
||||||
|
)
|
||||||
|
@CommandPermissions({"worldedit.global-mask"})
|
||||||
|
public static void mask(CommandContext args, WorldEdit we,
|
||||||
|
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||||
|
throws WorldEditException {
|
||||||
|
if (args.argsLength() == 0) {
|
||||||
|
session.setMask(null);
|
||||||
|
player.print("Global mask disabled.");
|
||||||
|
} else {
|
||||||
|
Mask mask = we.getBlockMask(player, session, args.getJoinedStrings(0));
|
||||||
|
session.setMask(mask);
|
||||||
|
player.print("Global mask set.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
aliases = {"toggleplace"},
|
aliases = {"toggleplace"},
|
||||||
usage = "",
|
usage = "",
|
||||||
|
Loading…
Reference in New Issue
Block a user