-
-
Notifications
You must be signed in to change notification settings - Fork 830
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WorldEdit 6.x #293
WorldEdit 6.x #293
Conversation
We have to check to some serious breakage across the board before we can release.
RegionMaskFilter handles it.
Most of the changes should not break *most* WorldEdit-using plugins, but implementations of WorldEdit are broken by this change.
There should probably be a means to "cancel" an edit. That way a block protector could stop a block change without giving a block logger invalid data. |
@DarkArc You can just implement a regular WorldEdit.getInstance().getEventBus().register(new Object() {
@Subscribe(priority = EventHandler.Priority.EARLY)
public void wrapToDestroyEverything(EditSessionEvent event) {
LocalPlayer player = event.getPlayer();
event.setExtent(new ExtentDelegate(event.getExtent()) {
@Override
public boolean setBlock(Vector location, BaseBlock block) {
throw new RuntimeException("No block for you");
}
});
}
}); Or rather a |
Suggested by TomyLobo
Deprecated getBlock, getBlockPattern, and so-on in WorldEdit.
@TomyLobo What does anything I'm saying have to do with the transaction system? Here's how I understand the program at the moment. Extents are chained more or less so it goes extent - > extent - > extent - > extent until it runs out of things to do. A block logger would use onBlockChange(); as would a block protector. However, they would have differing priorities. I see no problem if the block protector immediately throws an exception stopping the chain. However, if a block protector throws an exception half way through the chain being evaluated, we have just set several blocks for an edit that was not fully completed, and will probably be undone by the user. This means that for all the extents which have already been executed, extent will have made a block logger log the chain, and edited the world. While it is not a necessary an issue, I think it would be better if we first checked to see if the transaction could be completed in full before we began editing anything, and before any block loggers received data. That way we avoid the case where someone //paste, their edit is denied at the 1,000,000th out of 1.540,000 blocks which would as I understand the program trigger the logging of 1m edits, and 1m block changes. Then it would also be likely that this user is unsatisfied with the edit because 540,000 blocks were not placed. This will then leave us with the additional 1m edits and logs from the user reverting their mistake. totaling 2 million avoidable log records, and 2m blocks worth of CPU. If that's not how this system works, please feel free to correct me. However, if it is, I think we should do something to prevent the above case while everything is being redesigned. |
You are misunderstanding how this works. It works like an OutputStream. How do you stop a byte from being written? outputStream = new FileOutputStream(...);
outputStream = new OutputStream() {
@Override
public void write(int b) throws IOException {
}
}; A block protector would not use onBlockChange. That method only exists if you use AbstractLoggingExtent, which explicitly is for logging. |
Merge in WorldEdit 6.x branch -- contains breaking API changes
no slow reflection-based events for worldedit logging - good |
Speaking of loggers, LogBlock/LogBlock#542, how's this look? |
|
Also, one thing that may want to decide is whether we want to add If we do this, we should do this ASAP. |
This breaks backwards compatibility for all getWorld() methods, but shim methods were added for binary compatibility with method calls that use LocalWorld.
This changes the version of WorldEdit to 6.0.0-SNAPSHOT. I would like to merge this into
master
within the next 1-2 days unless something comes up.Ideally, I would like to test various WorldEdit-using plugins to see if anything breaks that we can rectify on our end.
Performance and functionality are unaffected.
Goals
Pattern
s,Mask
s,Region
s and other long-available abstractions in WorldEdit.EditSession
.EditSession
.EditSessionFactory
with a better alternative that is forward-compatible and can support multiple plugins at a time.Challenges
LinkageError
s such asNoClassDefFoundError
.Changes
What's New
Operation
interface and related classes that supports executing tasks over several ticks.Extent
interface that abstracts block operations (and in the future, entity operations) as they apply to worlds, clipboards, .schematic files, and so on.Pattern
andMask
interfaces to replace the old ones, which are still in WorldEdit but are deprecated. The new classes use the new pattern and mask interfaces.Transform
interface for performingVector
transforms, withAffineTransform
andIdentity
as implementations.ChangeSet
andChange
history objects that supports storing changes other than for blocks.EventBus
class (borrowed from Guava, but with changes) for sending events internally within WorldEdit.NoiseGenerator
for generating noise in 2D and 3D.internal.*
package for internal classes.What's Changed
EditSession
to use a functional approach that reduces code duplication.EditSession
into a dozen differentExtent
implementations.EditSessionFactory
. Added a new event bus to allow block loggers and other plugins to hook into block setting.snapshots.*
anddata.*
foundation.*
package.What's Broke
EditSessionFactory
no longer can do so via that method, and may break due to a binary-incompatible change toEditSessionFactory
(a change may be added to reduce this binary-incompatibility change, but the removal ofEditSessionFactory
will proceed).BlockBag
was moved to a different package.What Shouldn't Have Broken
What's Left
EditSession
to use the new visitor pattern.Extent
-compatible.EditSession
into a set of utility classes with static methods that createOperation
s for the various commands. (i.e.AnalyisCommands.count(Region, Mask)
would return anOperation
that can be run). All methods inEditSession
would then be deprecated.BlockID
andBlockType
.new-commands
branch or something similar).WorldEdit.getInstance().registerImpl(bukkit)
).Sample Code
Stacking a Region (//stack)
ForwardExtentCopy
is a general purposeExtent
toExtent
copy operation that can be used for stacking, copying, pasting, and so on.Adding a Block Logger
AbstractLoggingExtent
is an abstract class that is intended for block loggers, as it will automatically simplify the logging operation to the act of overriding aonBlockChange
method.