mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-06 04:46:40 +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.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
@ -56,7 +55,7 @@ public class ToolCommands {
|
||||
min = 0,
|
||||
max = 0
|
||||
)
|
||||
public void none(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
|
||||
public void none(Player player, LocalSession session) throws WorldEditException {
|
||||
|
||||
session.setTool(player.getItemInHand(HandSide.MAIN_HAND).getType(), null);
|
||||
player.print("Tool unbound from your current item.");
|
||||
@ -70,7 +69,7 @@ public class ToolCommands {
|
||||
max = 0
|
||||
)
|
||||
@CommandPermissions("worldedit.tool.info")
|
||||
public void info(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
|
||||
public void info(Player player, LocalSession session) throws WorldEditException {
|
||||
|
||||
BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND);
|
||||
session.setTool(itemStack.getType(), new QueryTool());
|
||||
@ -86,7 +85,7 @@ public class ToolCommands {
|
||||
max = 1
|
||||
)
|
||||
@CommandPermissions("worldedit.tool.tree")
|
||||
public void tree(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
|
||||
public void tree(Player player, LocalSession session, CommandContext args) throws WorldEditException {
|
||||
|
||||
TreeGenerator.TreeType type = args.argsLength() > 0
|
||||
? TreeGenerator.lookup(args.getString(0))
|
||||
@ -124,7 +123,7 @@ public class ToolCommands {
|
||||
max = 0
|
||||
)
|
||||
@CommandPermissions("worldedit.tool.data-cycler")
|
||||
public void cycler(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
|
||||
public void cycler(Player player, LocalSession session) throws WorldEditException {
|
||||
|
||||
BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND);
|
||||
session.setTool(itemStack.getType(), new BlockDataCyler());
|
||||
@ -161,7 +160,7 @@ public class ToolCommands {
|
||||
max = 0
|
||||
)
|
||||
@CommandPermissions("worldedit.tool.deltree")
|
||||
public void deltree(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
|
||||
public void deltree(Player player, LocalSession session) throws WorldEditException {
|
||||
|
||||
BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND);
|
||||
session.setTool(itemStack.getType(), new FloatingTreeRemover());
|
||||
@ -177,7 +176,7 @@ public class ToolCommands {
|
||||
max = 0
|
||||
)
|
||||
@CommandPermissions("worldedit.tool.farwand")
|
||||
public void farwand(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
|
||||
public void farwand(Player player, LocalSession session) throws WorldEditException {
|
||||
|
||||
BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND);
|
||||
session.setTool(itemStack.getType(), new DistanceWand());
|
||||
|
Reference in New Issue
Block a user