Various minor fixes

Fix drain
Fix some messages lacking prefix
Fix non persistent brushes
This commit is contained in:
Jesse Boyd 2018-10-13 15:15:20 +11:00
parent 1b7ac7a0bc
commit 1a12c065a1
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
6 changed files with 24 additions and 15 deletions

View File

@ -33,7 +33,6 @@ public class VoxelList
public void add(BlockMask mask) public void add(BlockMask mask)
{ {
this.mask = (BlockMask) mask.and(mask); this.mask = (BlockMask) mask.and(mask);
} }

View File

@ -2018,7 +2018,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
MaskIntersection mask = new MaskIntersection( MaskIntersection mask = new MaskIntersection(
new BoundedHeightMask(0, Math.min(origin.getBlockY(), getMaximumPoint().getBlockY())), new BoundedHeightMask(0, Math.min(origin.getBlockY(), getMaximumPoint().getBlockY())),
new RegionMask(new EllipsoidRegion(null, origin, new Vector(radius, radius, radius))), new RegionMask(new EllipsoidRegion(null, origin, new Vector(radius, radius, radius))),
liquidMask, new BlockTypeMask(this, BlockTypes.AIR, BlockTypes.CAVE_AIR, BlockTypes.VOID_AIR)); liquidMask);
BlockReplace replace = new BlockReplace(this, BlockTypes.AIR.getDefaultState()); BlockReplace replace = new BlockReplace(this, BlockTypes.AIR.getDefaultState());
NonRisingVisitor visitor = new NonRisingVisitor(mask, replace, (int) (radius * 2 + 1), this); NonRisingVisitor visitor = new NonRisingVisitor(mask, replace, (int) (radius * 2 + 1), this);

View File

@ -1043,6 +1043,15 @@ public class LocalSession implements TextureHolder {
} else { } else {
previous = this.tools[type.getInternalId()]; previous = this.tools[type.getInternalId()];
this.tools[type.getInternalId()] = tool; this.tools[type.getInternalId()] = tool;
if (tool != null) {
hasTool = true;
} else {
hasTool = false;
for (Tool i : this.tools) if (i != null) {
hasTool = true;
break;
}
}
} }
if (previous != null && player != null && previous instanceof BrushTool) { if (previous != null && player != null && previous instanceof BrushTool) {
BrushTool brushTool = (BrushTool) previous; BrushTool brushTool = (BrushTool) previous;

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit.command.composition; package com.sk89q.worldedit.command.composition;
import com.boydti.fawe.config.BBC;
import com.sk89q.minecraft.util.commands.CommandException; import com.sk89q.minecraft.util.commands.CommandException;
import com.sk89q.minecraft.util.commands.CommandLocals; import com.sk89q.minecraft.util.commands.CommandLocals;
import com.sk89q.minecraft.util.commands.CommandPermissionsException; import com.sk89q.minecraft.util.commands.CommandPermissionsException;
@ -79,7 +80,7 @@ public class ShapedBrushCommand extends SimpleCommand<Object> {
WorldEdit.getInstance().getPlatformManager().getCommandManager().getExceptionConverter().convert(e); WorldEdit.getInstance().getPlatformManager().getCommandManager().getExceptionConverter().convert(e);
} }
player.print("Set brush to " + factory); player.print(BBC.getPrefix() + "Set brush to " + factory);
return true; return true;
} }

View File

@ -476,9 +476,9 @@ public final class CommandManager {
} catch (CommandException e) { } catch (CommandException e) {
String message = e.getMessage(); String message = e.getMessage();
if (message != null) { if (message != null) {
actor.printError(e.getMessage()); actor.printError(BBC.getPrefix() + e.getMessage());
} else { } else {
actor.printError("An unknown FAWE error has occurred! Please see console."); actor.printError(BBC.getPrefix() + "An unknown FAWE error has occurred! Please see console.");
log.log(Level.SEVERE, "An unknown FAWE error occurred", e); log.log(Level.SEVERE, "An unknown FAWE error occurred", e);
} }
} catch (Throwable e) { } catch (Throwable e) {
@ -487,7 +487,7 @@ public final class CommandManager {
if (faweException != null) { if (faweException != null) {
BBC.WORLDEDIT_CANCEL_REASON.send(actor, faweException.getMessage()); BBC.WORLDEDIT_CANCEL_REASON.send(actor, faweException.getMessage());
} else { } else {
actor.printError("There was an error handling a FAWE command: [See console]"); actor.printError(BBC.getPrefix() + "There was an error handling a FAWE command: [See console]");
actor.printRaw(e.getClass().getName() + ": " + e.getMessage()); actor.printRaw(e.getClass().getName() + ": " + e.getMessage());
log.log(Level.SEVERE, "An unexpected error occurred while handling a FAWE command", e); log.log(Level.SEVERE, "An unexpected error occurred while handling a FAWE command", e);
} }

View File

@ -48,6 +48,15 @@ public class MaskIntersection extends AbstractMask {
formArray(); formArray();
} }
/**
* Create a new intersection.
*
* @param mask a list of masks
*/
public MaskIntersection(Mask... mask) {
this(Arrays.asList(checkNotNull(mask)));
}
private void formArray() { private void formArray() {
if (masks.isEmpty()) { if (masks.isEmpty()) {
masksArray = new Mask[]{Masks.alwaysFalse()}; masksArray = new Mask[]{Masks.alwaysFalse()};
@ -123,15 +132,6 @@ public class MaskIntersection extends AbstractMask {
return hasOptimized; return hasOptimized;
} }
/**
* Create a new intersection.
*
* @param mask a list of masks
*/
public MaskIntersection(Mask... mask) {
this(Arrays.asList(checkNotNull(mask)));
}
/** /**
* Add some masks to the list. * Add some masks to the list.
* *