Minor PS fix + undo fastmode error

This commit is contained in:
Jesse Boyd 2016-07-31 09:58:28 +10:00
parent 1835748d85
commit ffc23f4020
5 changed files with 26 additions and 29 deletions

View File

@ -28,14 +28,14 @@ public class PreciousStonesFeature extends BukkitMaskManager implements Listener
public FaweMask getMask(final FawePlayer<Player> fp) {
final Player player = fp.parent;
final Location location = player.getLocation();
final List<Field> fields = PreciousStones.API().getFieldsProtectingArea(FieldFlag.PLOT, location);
final List<Field> fields = PreciousStones.API().getFieldsProtectingArea(FieldFlag.ALL, location);
if (fields.isEmpty()) {
return null;
}
String name = player.getName();
boolean member = fp.hasPermission("fawe.preciousstones.member");
for (final Field myField : fields) {
if (myField.isOwner(name) || (member && myField.getAllowed().contains(player.getName()))) {
if (myField.isOwner(name) || (member && myField.getAllAllowed().contains(player.getName()))) {
BlockVector pos1 = new BlockVector(myField.getMinx(), myField.getMiny(), myField.getMinz());
BlockVector pos2 = new BlockVector(myField.getMaxx(), myField.getMaxy(), myField.getMaxz());
return new FaweMask(pos1, pos2, "FIELD: " + myField);

View File

@ -56,7 +56,6 @@ import java.util.UUID;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
import javax.annotation.Nonnull;
import org.bukkit.Location;
/**
* The FaweAPI class offers a few useful functions.<br>
@ -426,21 +425,6 @@ public class FaweAPI {
return count;
}
/**
* If a schematic is too large to be pasted normally<br>
* - Skips any block history
* - Ignores nbt
* - No, technically I haven't added proper streaming yet (WIP)
* @param file
* @param loc
* @return
*/
@Deprecated
public static void streamSchematic(final File file, final Location loc) {
final FaweLocation fl = new FaweLocation(loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
streamSchematic(file, fl);
}
/**
* If a schematic is too large to be pasted normally<br>
* - Skips any block history

View File

@ -291,6 +291,8 @@ public abstract class FaweQueue {
} catch (FaweException ignore) {
session.debug(BBC.WORLDEDIT_FAILED_LOAD_CHUNK, x >> 4, z >> 4);
return def;
} catch (Throwable e) {
return 0;
}
}

View File

@ -531,12 +531,16 @@ public class EditSession implements Extent {
}
ExtentTraverser traverseHistory = new ExtentTraverser(this.extent).find(HistoryExtent.class);
if (disableHistory) {
if (traverseHistory != null) {
if (traverseHistory != null && traverseHistory.exists()) {
ExtentTraverser beforeHistory = traverseHistory.previous();
ExtentTraverser afterHistory = traverseHistory.next();
if (beforeHistory != null && beforeHistory.exists()) {
beforeHistory.setNext(afterHistory.get());
} else {
extent = afterHistory.get();
}
} else if (traverseHistory == null) {
}
} else if (traverseHistory == null || !traverseHistory.exists()) {
ExtentTraverser traverseBypass = new ExtentTraverser(this.extent).find(bypassHistory);
if (traverseBypass != null) {
ExtentTraverser beforeHistory = traverseBypass.previous();

View File

@ -21,6 +21,7 @@ package com.sk89q.worldedit;
import com.boydti.fawe.object.FawePlayer;
import com.boydti.fawe.object.clipboard.DiskOptimizedClipboard;
import com.boydti.fawe.util.EditSessionBuilder;
import com.boydti.fawe.util.MainUtil;
import com.sk89q.jchronic.Chronic;
import com.sk89q.jchronic.Options;
@ -259,10 +260,13 @@ public class LocalSession {
--historyPointer;
if (historyPointer >= 0) {
EditSession editSession = history.get(historyPointer);
EditSession newEditSession = WorldEdit.getInstance().getEditSessionFactory()
.getEditSession(editSession.getWorld(), -1, newBlockBag, null);
newEditSession.enableQueue();
newEditSession.setFastMode(fastMode);
EditSession newEditSession = new EditSessionBuilder(editSession.getWorld())
.allowedRegionsEverywhere()
.checkMemory(false)
.changeSetNull()
.fastmode(true)
.limitUnlimited()
.build();
editSession.undo(newEditSession);
return editSession;
} else {
@ -293,10 +297,13 @@ public class LocalSession {
checkNotNull(player);
if (historyPointer < history.size()) {
EditSession editSession = history.get(historyPointer);
EditSession newEditSession = WorldEdit.getInstance().getEditSessionFactory()
.getEditSession(editSession.getWorld(), -1, newBlockBag, null);
newEditSession.enableQueue();
newEditSession.setFastMode(fastMode);
EditSession newEditSession = new EditSessionBuilder(editSession.getWorld())
.allowedRegionsEverywhere()
.checkMemory(false)
.changeSetNull()
.fastmode(true)
.limitUnlimited()
.build();
editSession.redo(newEditSession);
++historyPointer;
return editSession;