Merge remote-tracking branch 'origin/master' into develop-fix

# Conflicts:
#	pom.xml
This commit is contained in:
BONNe 2022-10-11 09:55:16 +03:00
commit b48a5a73b8
3 changed files with 9 additions and 9 deletions

View File

@ -138,8 +138,8 @@ public class BlueprintPaster {
// Tell the owner we're pasting blocks and how much time it might take // Tell the owner we're pasting blocks and how much time it might take
owner.ifPresent(user -> tellOwner(user, blocks.size(), attached.size(), entities.size(), plugin.getSettings().getPasteSpeed())); owner.ifPresent(user -> tellOwner(user, blocks.size(), attached.size(), entities.size(), plugin.getSettings().getPasteSpeed()));
Bits bits = new Bits(blocks, attached, entities, Bits bits = new Bits(blocks, attached, entities,
blocks.entrySet().iterator(), attached.entrySet().iterator(), entities.entrySet().iterator(), blocks.entrySet().iterator(), attached.entrySet().iterator(), entities.entrySet().iterator(),
plugin.getSettings().getPasteSpeed()); plugin.getSettings().getPasteSpeed());
pastingTask = Bukkit.getScheduler().runTaskTimer(plugin, () -> pasterTask(result, owner, bits), 0L, 1L); pastingTask = Bukkit.getScheduler().runTaskTimer(plugin, () -> pasterTask(result, owner, bits), 0L, 1L);
@ -237,7 +237,7 @@ public class BlueprintPaster {
if (island == null && clipboard != null) { if (island == null && clipboard != null) {
clipboard.setPos1(pos1); clipboard.setPos1(pos1);
clipboard.setPos2(pos2); clipboard.setPos2(pos2);
} }
pasteState = PasteState.CANCEL; pasteState = PasteState.CANCEL;
result.complete(true); result.complete(true);
} else if (pasteState.equals(PasteState.CANCEL)) { } else if (pasteState.equals(PasteState.CANCEL)) {
@ -247,13 +247,13 @@ public class BlueprintPaster {
} }
} }
private void tellOwner(User user, int blocksSize, int attachedSize, int entitiesSize, int pasteSpeed) { private void tellOwner(User user, int blocksSize, int attachedSize, int entitiesSize, int pasteSpeed) {
// Estimated time: // Estimated time:
double total = (double) blocksSize + attachedSize + entitiesSize; double total = (double) blocksSize + attachedSize + entitiesSize;
BigDecimal time = BigDecimal.valueOf(total / (pasteSpeed * 20.0D) + (chunkLoadTime / 1000.0D)).setScale(1, RoundingMode.UP); BigDecimal time = BigDecimal.valueOf(total / (pasteSpeed * 20.0D) + (chunkLoadTime / 1000.0D)).setScale(1, RoundingMode.UP);
user.sendMessage("commands.island.create.pasting.estimated-time", TextVariables.NUMBER, String.valueOf(time.doubleValue())); user.sendMessage("commands.island.create.pasting.estimated-time", TextVariables.NUMBER, String.valueOf(time.doubleValue()));
// We're pasting blocks! // We're pasting blocks!
user.sendMessage("commands.island.create.pasting.blocks", TextVariables.NUMBER, String.valueOf(blocksSize + attachedSize)); user.sendMessage("commands.island.create.pasting.blocks", TextVariables.NUMBER, String.valueOf(blocksSize + attachedSize));
} }
/** /**

View File

@ -945,7 +945,7 @@ public class Island implements DataObject, MetaDataAble {
public BoundingBox getProtectionBoundingBox(Environment environment) public BoundingBox getProtectionBoundingBox(Environment environment)
{ {
BoundingBox boundingBox; BoundingBox boundingBox;
if (Environment.NORMAL.equals(environment)) if (Environment.NORMAL.equals(environment))
{ {
// Return normal world bounding box. // Return normal world bounding box.
@ -982,7 +982,7 @@ public class Island implements DataObject, MetaDataAble {
{ {
boundingBox = null; boundingBox = null;
} }
return boundingBox; return boundingBox;
} }

View File

@ -16,7 +16,7 @@ import java.util.stream.Collectors;
public class PasteHandlerImpl implements PasteHandler { public class PasteHandlerImpl implements PasteHandler {
@Override @Override
public CompletableFuture<Void> pasteBlocks(Island island, World world, Map<Location, BlueprintBlock> blockMap) { public CompletableFuture<Void> pasteBlocks(Island island, World world, Map<Location, BlueprintBlock> blockMap) {
return blockMap.entrySet().parallelStream() return blockMap.entrySet().stream()
.map(entry -> DefaultPasteUtil.setBlock(island, entry.getKey(), entry.getValue())) .map(entry -> DefaultPasteUtil.setBlock(island, entry.getKey(), entry.getValue()))
.collect( .collect(
Collectors.collectingAndThen( Collectors.collectingAndThen(
@ -28,7 +28,7 @@ public class PasteHandlerImpl implements PasteHandler {
@Override @Override
public CompletableFuture<Void> pasteEntities(Island island, World world, Map<Location, List<BlueprintEntity>> entityMap) { public CompletableFuture<Void> pasteEntities(Island island, World world, Map<Location, List<BlueprintEntity>> entityMap) {
return entityMap.entrySet().parallelStream() return entityMap.entrySet().stream()
.map(entry -> DefaultPasteUtil.setEntity(island, entry.getKey(), entry.getValue())) .map(entry -> DefaultPasteUtil.setEntity(island, entry.getKey(), entry.getValue()))
.collect( .collect(
Collectors.collectingAndThen( Collectors.collectingAndThen(