mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-01 02:46:41 +00:00
Performance improvement based on case study by @me4502
This commit is contained in:
@ -108,12 +108,13 @@ public class DefaultProgressTracker implements BiConsumer<DefaultProgressTracker
|
||||
}
|
||||
|
||||
public void sendTask() {
|
||||
String queue = StringMan.padRight("" + totalQueue, 3);
|
||||
String dispatch = StringMan.padLeft("" + amountDispatch, 3);
|
||||
String queue = StringMan.padRight(String.valueOf(totalQueue), 3);
|
||||
String dispatch = StringMan.padLeft(String.valueOf(amountDispatch), 3);
|
||||
int total = amountDispatch != 0 ? amountDispatch : amountQueue;
|
||||
int speed = total != 0 ? (int) (total / Math.max((System.currentTimeMillis() - start) / 1000d, 1)) : 0;
|
||||
String speedStr = StringMan.padRight("" + speed, 3);
|
||||
String percent = StringMan.padRight("" + (amountDispatch != 0 ? (amountDispatch * 100) / totalQueue : 0), 3);
|
||||
String speedStr = StringMan.padRight(String.valueOf(speed), 3);
|
||||
String percent = StringMan.padRight(
|
||||
String.valueOf(amountDispatch != 0 ? (amountDispatch * 100) / totalQueue : 0), 3);
|
||||
int remaining = speed != 0 ? amountQueue / speed : -1;
|
||||
sendTile(TextComponent.empty(), Caption.of("fawe.progress.progress.message", queue, dispatch, percent, StringMan.padLeft("" + speed, 3), StringMan.padLeft("" + remaining, 3)));
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ import com.sk89q.worldedit.regions.AbstractRegion;
|
||||
import com.sk89q.worldedit.regions.RegionOperationException;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import java.util.Iterator;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class FuzzyRegion extends AbstractRegion {
|
||||
|
||||
@ -56,6 +57,7 @@ public class FuzzyRegion extends AbstractRegion {
|
||||
Operations.completeBlindly(search);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Iterator<BlockVector3> iterator() {
|
||||
return set.iterator();
|
||||
|
@ -249,9 +249,9 @@ public class PolyhedralRegion extends AbstractRegion {
|
||||
for (int i = 0; i < triangles.size(); ++i) {
|
||||
final Triangle triangle = triangles.get(i);
|
||||
|
||||
final BlockVector3 v0 = change.add(triangle.getVertex(0).toBlockPoint());
|
||||
final BlockVector3 v1 = change.add(triangle.getVertex(1).toBlockPoint());
|
||||
final BlockVector3 v2 = change.add(triangle.getVertex(2).toBlockPoint());
|
||||
final BlockVector3 v0 = change.add(triangle.getVertex(0));
|
||||
final BlockVector3 v1 = change.add(triangle.getVertex(1));
|
||||
final BlockVector3 v2 = change.add(triangle.getVertex(2));
|
||||
|
||||
triangles.set(i, new Triangle(v0, v1, v2));
|
||||
}
|
||||
|
@ -62,8 +62,8 @@ public class Triangle {
|
||||
return StringMan.getString(verts);
|
||||
}
|
||||
|
||||
public Vector3 getVertex(int index) {
|
||||
return Vector3.at(verts[index][0], verts[index][1], verts[index][2]);
|
||||
public BlockVector3 getVertex(int index) {
|
||||
return BlockVector3.at(verts[index][0], verts[index][1], verts[index][2]);
|
||||
}
|
||||
|
||||
public boolean contains(BlockVector3 pos) {
|
||||
|
@ -40,7 +40,6 @@ import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.util.eventbus.EventBus;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import java.util.UUID;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -76,7 +75,7 @@ public class EditSessionBuilder {
|
||||
*
|
||||
* @param world A world must be provided for all EditSession(s)
|
||||
*/
|
||||
public EditSessionBuilder(@Nonnull World world) {
|
||||
public EditSessionBuilder(@NotNull World world) {
|
||||
checkNotNull(world);
|
||||
this.world = world;
|
||||
this.worldName = world.getName();
|
||||
@ -88,7 +87,7 @@ public class EditSessionBuilder {
|
||||
this.worldName = worldName;
|
||||
}
|
||||
|
||||
public EditSessionBuilder(@Nonnull String worldName) {
|
||||
public EditSessionBuilder(@NotNull String worldName) {
|
||||
checkNotNull(worldName);
|
||||
this.worldName = worldName;
|
||||
this.world = FaweAPI.getWorld(worldName);
|
||||
@ -108,7 +107,7 @@ public class EditSessionBuilder {
|
||||
return limit(FaweLimit.MAX.copy());
|
||||
}
|
||||
|
||||
public EditSessionBuilder limitUnprocessed(@Nonnull Player player) {
|
||||
public EditSessionBuilder limitUnprocessed(@NotNull Player player) {
|
||||
checkNotNull(player);
|
||||
limitUnlimited();
|
||||
FaweLimit tmp = player.getLimit();
|
||||
|
Reference in New Issue
Block a user