Skip to content

Commit

Permalink
Merge branch 'master' into release/tf43
Browse files Browse the repository at this point in the history
  • Loading branch information
JeromSar committed Apr 26, 2015
2 parents 8834c1e + 58aac97 commit 4e35cbe
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 8 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,7 @@ public double centralTopLimit() {
*/
private static final Set<Integer> usesData = new HashSet<Integer>();
static {
usesData.add(BlockID.STONE);
usesData.add(BlockID.DIRT);
usesData.add(BlockID.WOOD);
usesData.add(BlockID.SAPLING);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,7 @@ public static boolean shouldNotStack(int id) {
usesDamageValue.add(ItemID.GOLD_APPLE);
usesDamageValue.add(ItemID.RAW_FISH);
usesDamageValue.add(ItemID.COOKED_FISH);
usesDamageValue.add(ItemID.BANNER);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@

package com.sk89q.worldedit.command.tool;

import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.blocks.BlockData;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extension.platform.Platform;
Expand Down Expand Up @@ -54,12 +57,19 @@ private boolean handleCycle(Platform server, LocalConfiguration config,
}

int increment = forward ? 1 : -1;
data = (new BaseBlock(type, data)).cycleData(increment);
BaseBlock block = new BaseBlock(type, BlockData.cycle(type, data, increment));
EditSession editSession = session.createEditSession(player);

if (data < 0) {
player.printError("That block's data cannot be cycled!");
} else {
world.setBlockData(clicked.toVector(), data);
try {
editSession.setBlock(clicked.toVector(), block);
} catch (MaxChangedBlocksException e) {
player.printError("Max blocks change limit reached.");
} finally {
session.remember(editSession);
}
}

return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,9 @@ public boolean canUse(Actor player) {

@Override
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) {
BlockBag bag = session.getBlockBag(player);
BlockBag bag = session.getBlockBag(player);

World world = (World) clicked.getExtent();
EditSession editSession = WorldEdit.getInstance().getEditSessionFactory().getEditSession(world, -1, bag, player);
EditSession editSession = session.createEditSession(player);

try {
editSession.setBlock(clicked.toVector(), targetBlock);
Expand All @@ -68,7 +67,7 @@ public boolean actPrimary(Platform server, LocalConfiguration config, Player pla
@Override
public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) {
World world = (World) clicked.getExtent();
EditSession editSession = WorldEdit.getInstance().getEditSessionFactory().getEditSession(world, -1, player);
EditSession editSession = session.createEditSession(player);
targetBlock = (editSession).getBlock(clicked.toVector());
BlockType type = BlockType.fromID(targetBlock.getType());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public boolean canUse(Actor player) {
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) {

World world = (World) clicked.getExtent();
EditSession editSession = WorldEdit.getInstance().getEditSessionFactory().getEditSession(world, 0, player);
EditSession editSession = session.createEditSession(player);
BaseBlock block = (editSession).rawGetBlock(clicked.toVector());
BlockType type = BlockType.fromID(block.getType());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,10 @@ public int compareTo(ExceptionHandler o) {
return 0;
} else if (cls.isAssignableFrom(o.cls)) {
return 1;
} else {
} else if (o.cls.isAssignableFrom(cls)) {
return -1;
} else {
return cls.getCanonicalName().compareTo(o.cls.getCanonicalName());
}
}
}
Expand Down

0 comments on commit 4e35cbe

Please sign in to comment.