Set world seed to 4894934811986575177

This commit is contained in:
Len 2024-02-17 15:22:55 +01:00
parent d065d7b2f1
commit cccd301cbb
3 changed files with 79 additions and 0 deletions

View File

@ -16,6 +16,7 @@ public class PluginConfiguration implements Configuration {
private WorldGenerator worldGenerator = new WorldGenerator();
@ConfigSerializable @Getter
public static class WorldGenerator {
private long seed = Long.parseLong("4894934811986575177");
private int centerX = 0;
private int centerZ = 0;

View File

@ -0,0 +1,75 @@
package com.alttd.cometskyblock.managers;
import com.alttd.cometskyblock.CometSkyBlockPlugin;
import com.alttd.cometskyblock.island.Island;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.scheduler.BukkitTask;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
// TODO -- finish class
public class TeleportManager {
private final CometSkyBlockPlugin plugin;
public static Map<Player, BukkitTask> teleportTaskQueue = new HashMap<>();
public TeleportManager(CometSkyBlockPlugin plugin) {
this.plugin = plugin;
}
public boolean teleportToIsland(Player player, Location location, boolean visit, List<UUID> members) {
if (player.getFallDistance() > 0 || player.getLocation().getBlock().getType().equals(Material.LAVA)) {
// Message the player about why they can not teleport and queue task again after 5 seconds
teleportTaskQueue.put(player, plugin.getServer().getScheduler().runTaskLater(plugin, () -> {
if (teleportTaskQueue.containsKey(player)) {
teleportToIsland(player, location, visit, members);
}
}, 20 * 5));
return false;
}
PotionEffect potionEffectBlindness = new PotionEffect(PotionEffectType.BLINDNESS, 600, 1);
PotionEffect potionEffectNightVision = new PotionEffect(PotionEffectType.NIGHT_VISION, 600, 1);
player.addPotionEffect(potionEffectBlindness);
player.addPotionEffect(potionEffectNightVision);
World islandWorld = CometSkyBlockPlugin.instance().worldGenerator().loadIslandWorld(location.getWorld().getName());
if (islandWorld == null) {
player.sendRichMessage("<red>Could not load islandWorld. Contact an administrator");
removeTeleportEffects(player);
return false;
}
Island island = Island.getIsland(location.getWorld().getUID());
if (visit && island.islandId() != 0) {
for (UUID uuid : members) {
Player islandMember = Bukkit.getPlayer(uuid);
if (islandMember == null)
continue;
islandMember.sendRichMessage("<player> is visiting your island."); // TODO - load from config and placeholders.
}
}
player.teleportAsync(location).whenComplete((b, e) -> {
removeTeleportEffects(player);
});
teleportTaskQueue.remove(player);
return true;
}
void removeTeleportEffects(Player player) {
player.removePotionEffect(PotionEffectType.BLINDNESS);
player.removePotionEffect(PotionEffectType.NIGHT_VISION);
}
}

View File

@ -35,6 +35,7 @@ public class MasterWorldGenerator {
worldCreator.generator(new CometVoidGenerator());
worldCreator.environment(World.Environment.NORMAL);
worldCreator.generateStructures(true);
worldCreator.seed(plugin.pluginConfiguration().get().worldGenerator().seed());
World world = worldCreator.createWorld();
if (world == null) {
@ -79,6 +80,7 @@ public class MasterWorldGenerator {
worldCreator.generator(new CometIslandGenerator());
worldCreator.environment(World.Environment.NORMAL);
worldCreator.generateStructures(true);
worldCreator.seed(plugin.pluginConfiguration().get().worldGenerator().seed());
World newIsland = worldCreator.createWorld();
if (newIsland == null) {
return;
@ -110,6 +112,7 @@ public class MasterWorldGenerator {
worldCreator.generator(new CometIslandGenerator());
worldCreator.environment(World.Environment.NORMAL);
worldCreator.generateStructures(true);
worldCreator.seed(plugin.pluginConfiguration().get().worldGenerator().seed());
World newIsland = worldCreator.createWorld();
if (newIsland == null) {
plugin.getLogger().warning("Failed to load world " + islandName);