mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-02 22:17:17 +00:00
More refactor work, encapsulate classes
This commit is contained in:
1 parent
3e1ec09487
commit
1cebdac9b8
51 files changed
+756
-621
No files matched your search
@@ -46,7 +46,7 @@ public class NormalDistributionEngine extends RandomTeleportEngine {
|
||||
final float z = (float) (radius * Math.cos(angle));
|
||||
final float x = (float) (radius * Math.sin(angle));
|
||||
|
||||
return new Location(Math.round(origin.x) + x, 128d, Math.round(origin.z) + z, origin.world);
|
||||
return new Location(Math.round(origin.getX()) + x, 128d, Math.round(origin.getZ()) + z, origin.getWorld());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -85,7 +85,7 @@ public class NormalDistributionEngine extends RandomTeleportEngine {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Optional<Position> getRandomPosition(@NotNull World world, @NotNull String[] args) {
|
||||
public Optional<Position> getRandomPosition(@NotNull World world, @NotNull String[] args) {
|
||||
Optional<Location> location = generateSafeLocation(world).join();
|
||||
int attempts = 0;
|
||||
while (location.isEmpty()) {
|
||||
|
||||
@@ -6,7 +6,6 @@ import net.william278.huskhomes.position.World;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
/**
|
||||
* Represents an engine for generating random position targets
|
||||
@@ -46,7 +45,7 @@ public abstract class RandomTeleportEngine {
|
||||
protected final Position getOrigin(@NotNull World world) {
|
||||
return plugin.getLocalCachedSpawn()
|
||||
.flatMap(spawn -> {
|
||||
if (!spawn.worldUuid.equals(world.uuid.toString())) {
|
||||
if (!spawn.worldUuid.equals(world.getUuid().toString())) {
|
||||
return Optional.empty();
|
||||
}
|
||||
return spawn.getPosition(plugin.getServerName());
|
||||
|
||||
Reference in new issue
Block a user