mirror of
https://github.com/kaboomserver/extras.git
synced 2024-06-03 02:41:23 +00:00
Limit random spawn to half a million blocks, which should hopefully fix the OOB error
This commit is contained in:
parent
341e8834fc
commit
970efe2cd7
|
@ -30,7 +30,6 @@ import pw.kaboom.extras.modules.server.ServerTabComplete;
|
|||
|
||||
public final class PlayerConnection implements Listener {
|
||||
private static final FileConfiguration CONFIG = JavaPlugin.getPlugin(Main.class).getConfig();
|
||||
|
||||
private static final String TITLE = CONFIG.getString("playerJoinTitle");
|
||||
private static final String SUBTITLE = CONFIG.getString("playerJoinSubtitle");
|
||||
private static final int FADE_IN = 10;
|
||||
|
@ -127,11 +126,11 @@ public final class PlayerConnection implements Listener {
|
|||
if (RANDOMIZE_SPAWN
|
||||
&& event.getPlayer().getBedSpawnLocation() != event.getSpawnLocation()) {
|
||||
final World world = event.getPlayer().getWorld();
|
||||
final double x = ThreadLocalRandom.current().nextInt(-300000000, 30000000) + .5;
|
||||
final double y = 100;
|
||||
final double z = ThreadLocalRandom.current().nextInt(-300000000, 30000000) + .5;
|
||||
final ThreadLocalRandom random = ThreadLocalRandom.current();
|
||||
|
||||
event.setSpawnLocation(new Location(world, x, y, z));
|
||||
final double teleportAmount = 500000D;
|
||||
final Location location = new Location(world, random.nextDouble(-teleportAmount, teleportAmount), 100, random.nextDouble(-teleportAmount, teleportAmount));
|
||||
event.setSpawnLocation(location);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue