mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-02 03:16:41 +00:00
Better enforce the Request lifetime.
Previously, the current request would just get a new EditSession when one was created. Now, a Request is reset before and after: - a command is used and - an interact is fired with the platform This means each action taken will get a single, non-reusable Request. Note that this only applies to actions taken through the platform. API users will not be using requests anyway, since things like Masks, etc. will be constructed directly instead of being passed through the platform's parsers and so on. (e.g. if a plugin loads a schematic into the world with a mask, they should create the EditSession and mask it directly, and not use that Mask again for another EditSession in another World). Also, get rid of a bunch of (some now-)unnecessary EditSession creation during command dispatching. Note that this also fixed the dynamic selection mask, which apparently has been broken for some unknown amount of time.
This commit is contained in:
@ -22,7 +22,6 @@ package com.sk89q.worldedit.command;
|
||||
import com.sk89q.minecraft.util.commands.Command;
|
||||
import com.sk89q.minecraft.util.commands.CommandContext;
|
||||
import com.sk89q.minecraft.util.commands.CommandPermissions;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
@ -50,7 +49,7 @@ public class ToolUtilCommands {
|
||||
max = 1
|
||||
)
|
||||
@CommandPermissions("worldedit.superpickaxe")
|
||||
public void togglePickaxe(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
|
||||
public void togglePickaxe(Player player, LocalSession session, CommandContext args) throws WorldEditException {
|
||||
|
||||
String newState = args.getString(0, null);
|
||||
if (session.hasSuperPickAxe()) {
|
||||
@ -80,7 +79,7 @@ public class ToolUtilCommands {
|
||||
max = -1
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.options.mask")
|
||||
public void mask(Player player, LocalSession session, EditSession editSession, @Optional Mask mask) throws WorldEditException {
|
||||
public void mask(Player player, LocalSession session, @Optional Mask mask) throws WorldEditException {
|
||||
if (mask == null) {
|
||||
session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()).setMask(null);
|
||||
player.print("Brush mask disabled.");
|
||||
@ -98,7 +97,7 @@ public class ToolUtilCommands {
|
||||
max = 1
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.options.material")
|
||||
public void material(Player player, LocalSession session, EditSession editSession, Pattern pattern) throws WorldEditException {
|
||||
public void material(Player player, LocalSession session, Pattern pattern) throws WorldEditException {
|
||||
session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()).setFill(pattern);
|
||||
player.print("Brush material set.");
|
||||
}
|
||||
@ -111,7 +110,7 @@ public class ToolUtilCommands {
|
||||
max = 1
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.options.range")
|
||||
public void range(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
|
||||
public void range(Player player, LocalSession session, CommandContext args) throws WorldEditException {
|
||||
int range = args.getInteger(0);
|
||||
session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()).setRange(range);
|
||||
player.print("Brush range set.");
|
||||
@ -125,7 +124,7 @@ public class ToolUtilCommands {
|
||||
max = 1
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.options.size")
|
||||
public void size(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
|
||||
public void size(Player player, LocalSession session, CommandContext args) throws WorldEditException {
|
||||
|
||||
int radius = args.getInteger(0);
|
||||
we.checkMaxBrushRadius(radius);
|
||||
|
Reference in New Issue
Block a user