Improved performance of rollback/restore previews
This commit is contained in:
parent
635a2b0d95
commit
6a978128af
1 changed files with 9 additions and 10 deletions
|
|
@ -360,7 +360,6 @@ public class Rollback extends Queue {
|
||||||
|
|
||||||
if (preview > 0) {
|
if (preview > 0) {
|
||||||
if (rowAction != 3) { // entity kill
|
if (rowAction != 3) { // entity kill
|
||||||
Player player = (Player) finalUser;
|
|
||||||
String world = Util.getWorldName(rowWorldId);
|
String world = Util.getWorldName(rowWorldId);
|
||||||
if (world.length() == 0) {
|
if (world.length() == 0) {
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -370,23 +369,18 @@ public class Rollback extends Queue {
|
||||||
if (bukkitWorld == null) {
|
if (bukkitWorld == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Location location1 = new Location(bukkitWorld, rowX, rowY, rowZ);
|
|
||||||
|
|
||||||
|
Block block = new Location(bukkitWorld, rowX, rowY, rowZ).getBlock();
|
||||||
if (preview == 2) {
|
if (preview == 2) {
|
||||||
Block block = location1.getBlock();
|
|
||||||
Material blockType = block.getType();
|
Material blockType = block.getType();
|
||||||
if (!BukkitAdapter.ADAPTER.isItemFrame(blockType) && !blockType.equals(Material.PAINTING) && !blockType.equals(Material.ARMOR_STAND) && !blockType.equals(Material.END_CRYSTAL)) {
|
if (!BukkitAdapter.ADAPTER.isItemFrame(blockType) && !blockType.equals(Material.PAINTING) && !blockType.equals(Material.ARMOR_STAND) && !blockType.equals(Material.END_CRYSTAL)) {
|
||||||
Util.sendBlockChange(player, location1, block.getBlockData());
|
Util.prepareTypeAndData(chunkChanges, block, blockType, block.getBlockData(), true);
|
||||||
blockCount1++;
|
blockCount1++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ((!BukkitAdapter.ADAPTER.isItemFrame(rowType)) && (rowType != Material.PAINTING) && (rowType != Material.ARMOR_STAND) && (rowType != Material.END_CRYSTAL)) {
|
if ((!BukkitAdapter.ADAPTER.isItemFrame(rowType)) && (rowType != Material.PAINTING) && (rowType != Material.ARMOR_STAND) && (rowType != Material.END_CRYSTAL)) {
|
||||||
BlockData sendBlockData = blockData;
|
Util.prepareTypeAndData(chunkChanges, block, rowType, blockData, true);
|
||||||
if (sendBlockData == null) {
|
|
||||||
sendBlockData = rowType.createBlockData();
|
|
||||||
}
|
|
||||||
Util.sendBlockChange(player, location1, sendBlockData);
|
|
||||||
blockCount1++;
|
blockCount1++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -982,8 +976,13 @@ public class Rollback extends Queue {
|
||||||
for (Entry<Block, BlockData> chunkChange : chunkChanges.entrySet()) {
|
for (Entry<Block, BlockData> chunkChange : chunkChanges.entrySet()) {
|
||||||
Block changeBlock = chunkChange.getKey();
|
Block changeBlock = chunkChange.getKey();
|
||||||
BlockData changeBlockData = chunkChange.getValue();
|
BlockData changeBlockData = chunkChange.getValue();
|
||||||
|
if (preview > 0) {
|
||||||
|
Util.sendBlockChange((Player) finalUser, changeBlock.getLocation(), changeBlockData);
|
||||||
|
}
|
||||||
|
else {
|
||||||
Util.setTypeAndData(changeBlock, null, changeBlockData, true);
|
Util.setTypeAndData(changeBlock, null, changeBlockData, true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
chunkChanges.clear();
|
chunkChanges.clear();
|
||||||
|
|
||||||
Object container = null;
|
Object container = null;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue