Enable own world generator and handling
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
73bb8e4de2
commit
cadc5854ef
@ -1,5 +1,6 @@
|
||||
package wtf.beatrice.limbomanager;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import wtf.beatrice.limbomanager.objects.Coordinates;
|
||||
import wtf.beatrice.limbomanager.objects.LocationCheckRunnable;
|
||||
@ -9,6 +10,8 @@ import java.util.HashMap;
|
||||
public class Cache
|
||||
{
|
||||
|
||||
public static final String worldName = "limbo";
|
||||
public static World limboWorld;
|
||||
public static final Coordinates baseCoords = new Coordinates(1000, 1000);
|
||||
|
||||
public static int islandsDistance = 500;
|
||||
|
@ -8,6 +8,7 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||
import wtf.beatrice.limbomanager.commands.Spawn;
|
||||
import wtf.beatrice.limbomanager.listeners.*;
|
||||
import wtf.beatrice.limbomanager.objects.LocationCheckRunnable;
|
||||
import wtf.beatrice.limbomanager.objects.WorldGenerator;
|
||||
import wtf.beatrice.limbomanager.utils.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
@ -58,6 +59,9 @@ public class LimboManager extends JavaPlugin {
|
||||
Cache.locationCheckRunnable = new LocationCheckRunnable();
|
||||
Cache.locationCheckRunnable.task = Bukkit.getScheduler().runTaskTimerAsynchronously(this, Cache.locationCheckRunnable, 10L, 5L);
|
||||
|
||||
// create limbo world
|
||||
WorldGenerator worldGenerator = new WorldGenerator();
|
||||
worldGenerator.generateWorld();
|
||||
}
|
||||
|
||||
|
||||
|
@ -47,7 +47,7 @@ public class PlayerTeleporter implements Listener
|
||||
Coordinates islandCoords = calcNewCoordinates();
|
||||
Cache.playerIslands.put(playerName, islandCoords);
|
||||
|
||||
Location islandLocation = new Location(player.getWorld(), islandCoords.getX(), 64, islandCoords.getZ());
|
||||
Location islandLocation = new Location(Cache.limboWorld, islandCoords.getX(), 64, islandCoords.getZ());
|
||||
|
||||
// load chunk otherwise it will be buggy (no schem load, no tp)
|
||||
islandLocation.getWorld().loadChunk(islandLocation.getChunk().getX(), islandLocation.getChunk().getZ(), true);
|
||||
@ -64,7 +64,7 @@ public class PlayerTeleporter implements Listener
|
||||
|
||||
// todo: improve and make as async as possible
|
||||
|
||||
World islandWEWorld = BukkitAdapter.adapt(islandLocation.getWorld());
|
||||
World islandWEWorld = BukkitAdapter.adapt(Cache.limboWorld);
|
||||
Clipboard shematicClipboard;
|
||||
|
||||
ClipboardFormat clipboardFormat = ClipboardFormats.findByFile(schematicFile);
|
||||
@ -107,7 +107,7 @@ public class PlayerTeleporter implements Listener
|
||||
int maxRange = Cache.islandWalkingRange + 20;
|
||||
|
||||
Location islandSpawnLocation = LocationUtils.getPlayerSpawnLocation(player);
|
||||
Location startFrom = new Location(islandSpawnLocation.getWorld(),
|
||||
Location startFrom = new Location(Cache.limboWorld,
|
||||
islandSpawnLocation.getX() - maxRange,
|
||||
islandSpawnLocation.getWorld().getMinHeight(),
|
||||
islandSpawnLocation.getZ() - maxRange);
|
||||
|
@ -0,0 +1,21 @@
|
||||
package wtf.beatrice.limbomanager.objects;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.WorldCreator;
|
||||
import org.bukkit.WorldType;
|
||||
import wtf.beatrice.limbomanager.Cache;
|
||||
|
||||
public class WorldGenerator
|
||||
{
|
||||
|
||||
public void generateWorld()
|
||||
{
|
||||
// create world
|
||||
WorldCreator worldCreator = new WorldCreator(Cache.worldName);
|
||||
worldCreator.environment(World.Environment.THE_END);
|
||||
worldCreator.generateStructures(false);
|
||||
worldCreator.type(WorldType.FLAT);
|
||||
worldCreator.generator("VoidGen");
|
||||
Cache.limboWorld = worldCreator.createWorld();
|
||||
}
|
||||
}
|
@ -1,12 +1,13 @@
|
||||
name: LimboManager
|
||||
main: wtf.beatrice.limbomanager.LimboManager
|
||||
version: 0.0.3
|
||||
load: STARTUP
|
||||
# load: STARTUP
|
||||
description: Mix of tools to run a Limbo server
|
||||
api-version: 1.19
|
||||
author: astro_bea
|
||||
depend:
|
||||
- WorldEdit
|
||||
- VoidGen
|
||||
|
||||
commands:
|
||||
spawn:
|
||||
|
Loading…
Reference in New Issue
Block a user