3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-03 01:50:07 +01:00

Merge pull request #322 from flaminscotsman/tools_fix

Fix for WORLDEDIT-3270
Dieser Commit ist enthalten in:
Wizjany 2015-03-11 00:36:35 -04:00
Commit 2db5d8b11a
3 geänderte Dateien mit 16 neuen und 7 gelöschten Zeilen

Datei anzeigen

@ -19,9 +19,12 @@
package com.sk89q.worldedit.command.tool; package com.sk89q.worldedit.command.tool;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.blocks.BlockData;
import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.extension.platform.Platform;
@ -54,12 +57,19 @@ public class BlockDataCyler implements DoubleActionBlockTool {
} }
int increment = forward ? 1 : -1; 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) { if (data < 0) {
player.printError("That block's data cannot be cycled!"); player.printError("That block's data cannot be cycled!");
} else { } 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; return true;

Datei anzeigen

@ -46,10 +46,9 @@ public class BlockReplacer implements DoubleActionBlockTool {
@Override @Override
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) { 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 = session.createEditSession(player);
EditSession editSession = WorldEdit.getInstance().getEditSessionFactory().getEditSession(world, -1, bag, player);
try { try {
editSession.setBlock(clicked.toVector(), targetBlock); editSession.setBlock(clicked.toVector(), targetBlock);
@ -68,7 +67,7 @@ BlockBag bag = session.getBlockBag(player);
@Override @Override
public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) { public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) {
World world = (World) clicked.getExtent(); World world = (World) clicked.getExtent();
EditSession editSession = WorldEdit.getInstance().getEditSessionFactory().getEditSession(world, -1, player); EditSession editSession = session.createEditSession(player);
targetBlock = (editSession).getBlock(clicked.toVector()); targetBlock = (editSession).getBlock(clicked.toVector());
BlockType type = BlockType.fromID(targetBlock.getType()); BlockType type = BlockType.fromID(targetBlock.getType());

Datei anzeigen

@ -43,7 +43,7 @@ public class QueryTool implements BlockTool {
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) { public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) {
World world = (World) clicked.getExtent(); 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()); BaseBlock block = (editSession).rawGetBlock(clicked.toVector());
BlockType type = BlockType.fromID(block.getType()); BlockType type = BlockType.fromID(block.getType());