Pass LocalPlayers to the EditSession getters for easy external access

This commit is contained in:
Ammar Askar
2012-11-13 15:07:08 +05:00
committed by Wizjany
parent 94a549214d
commit 4b50e0e453
8 changed files with 42 additions and 17 deletions

View File

@@ -136,14 +136,15 @@ public class LocalSession {
* Performs an undo.
*
* @param newBlockBag
* @param player
* @return whether anything was undone
*/
public EditSession undo(BlockBag newBlockBag) {
public EditSession undo(BlockBag newBlockBag, LocalPlayer player) {
--historyPointer;
if (historyPointer >= 0) {
EditSession editSession = history.get(historyPointer);
EditSession newEditSession = WorldEdit.getInstance().getEditSessionFactory()
.getEditSession(editSession.getWorld(), -1, newBlockBag);
.getEditSession(editSession.getWorld(), -1, newBlockBag, player);
newEditSession.enableQueue();
newEditSession.setFastMode(fastMode);
editSession.undo(newEditSession);
@@ -158,13 +159,14 @@ public class LocalSession {
* Performs a redo
*
* @param newBlockBag
* @param player
* @return whether anything was redone
*/
public EditSession redo(BlockBag newBlockBag) {
public EditSession redo(BlockBag newBlockBag, LocalPlayer player) {
if (historyPointer < history.size()) {
EditSession editSession = history.get(historyPointer);
EditSession newEditSession = WorldEdit.getInstance().getEditSessionFactory()
.getEditSession(editSession.getWorld(), -1, newBlockBag);
.getEditSession(editSession.getWorld(), -1, newBlockBag, player);
newEditSession.enableQueue();
newEditSession.setFastMode(fastMode);
editSession.redo(newEditSession);
@@ -700,7 +702,7 @@ public class LocalSession {
// Create an edit session
EditSession editSession = WorldEdit.getInstance().getEditSessionFactory()
.getEditSession(player.isPlayer() ? player.getWorld() : null,
getBlockChangeLimit(), blockBag);
getBlockChangeLimit(), blockBag, player);
editSession.setFastMode(fastMode);
if (mask != null) {
mask.prepare(this, player, null);