Skip to content

Commit

Permalink
Replace //set with new command version.
Browse files Browse the repository at this point in the history
  • Loading branch information
sk89q committed Oct 30, 2015
1 parent 86c6de7 commit 0e200df
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,20 +77,6 @@ public RegionCommands(WorldEdit worldEdit) {
this.worldEdit = worldEdit;
}

@Command(
aliases = { "/set" },
usage = "<block>",
desc = "Set all the blocks inside the selection to a block",
min = 1,
max = 1
)
@CommandPermissions("worldedit.region.set")
@Logging(REGION)
public void set(Player player, LocalSession session, EditSession editSession, Pattern pattern) throws WorldEditException {
int affected = editSession.setBlocks(session.getSelection(player.getWorld()), Patterns.wrap(pattern));
player.print(affected + " block(s) have been changed.");
}

@Command(
aliases = { "/line" },
usage = "<block> [thickness]",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import com.sk89q.worldedit.command.composition.ApplyCommand;
import com.sk89q.worldedit.command.composition.DeformCommand;
import com.sk89q.worldedit.command.composition.PaintCommand;
import com.sk89q.worldedit.command.composition.SelectionCommand;
import com.sk89q.worldedit.command.composition.ShapedBrushCommand;
import com.sk89q.worldedit.event.platform.CommandEvent;
import com.sk89q.worldedit.event.platform.CommandSuggestionEvent;
Expand Down Expand Up @@ -149,6 +150,7 @@ public final class CommandManager {
.registerMethods(new ToolUtilCommands(worldEdit))
.registerMethods(new ToolCommands(worldEdit))
.registerMethods(new UtilityCommands(worldEdit))
.register(adapt(new SelectionCommand(new ApplyCommand(new ReplaceParser(), "Set all blocks within selection"), "worldedit.region.set")), "/set")
.group("worldedit", "we")
.describeAs("WorldEdit commands")
.registerMethods(new WorldEditCommands(worldEdit))
Expand Down

10 comments on commit 0e200df

@ShadowRanger
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I seem to be getting an error when using the //set command.

Error: java.lang.NoClassDefFoundError:
com/google/common/base/MoreObjects

@sk89q
Copy link
Member Author

@sk89q sk89q commented on 0e200df Nov 12, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this commit currently only works if you're using Forge. Will be fixed at some point.

@Pieter12345
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In build 3409, //set throws a com.sk89q.worldedit.MaxChangedBlocksException when it runs into the block limit of the executing player. I suspect this commit might have caused that.
Stacktrace: http://paste.thezomg.com/19035/14520873/

@TomyLobo
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is how block limits are implemented.
The problem is not that it is thrown, but that it is not caught properly.

@WonderDave
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realize this commit and thread is old, but is the series of 'MaxChangedBlocksException' errors that appear in the console going to be fixed? It's still present in build 3575. When using '//set' to change more blocks than allowed, WE used to give an appropriate message about having reached the block change limit. Now it just throws that error. I can change or eliminate the block change limit, but it would be nicer if this error was handled properly.

@Pieter12345
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@WonderDave I have replied to this about 5 months ago, created an issue on their issue tracker and tried to contact devs on their IRC channel. So far, I've been ignored. If you want to fix this yourself, you can download the source, apply this fix and build WorldEdit yourself:
http://paste.thezomg.com/19689/16747146/
It's not a proper fix in terms of good coding, but it's simple and working.

@DarkArc
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll take care of this -- hopefully tonight -- I assigned myself. Sorry you feel you've been ignored Pieter.
http://dev.enginehub.org/youtrack/issue/WORLDEDIT-3386

@Pieter12345
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DarkArc Thanks for taking care of the bug. Knowing these reports eventually change something, I'll likely create more of them in the future.

If you would like to fix another bug, "//paste -s" is not properly setting the players selection (http://dev.enginehub.org/youtrack/issue/WORLDEDIT-3457). I've written a method that does return the right selection of where the users clipboard would be pasted for either a relative and original (-o flag) paste. The working code is in a CH extension, you can use it as a reference to see which calls can be used to make it work: https://github.com/jb-aero/SKCompat/blob/master/SKCompat-bundle/src/main/java/io/github/jbaero/skcompat/CHWorldEdit.java#L718-L754

Have a nice day :)

@DarkArc
Copy link
Member

@DarkArc DarkArc commented on 0e200df Jun 29, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both are fixed, sorry about the wait, all of the WorldEdit devs -- myself included -- have only gotten older, and, in turn, busier over the years.

Hope you have/have had a good day as well.

@WonderDave
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DarkArc I'm impressed. A quick response to our above requests, and great follow-through in getting the issues resolved. Thank you.

Please sign in to comment.