1.7.0 beta 8

This commit is contained in:
Tyler Murphy 2022-11-21 16:54:32 -05:00
parent efb2cf40e8
commit 934c04388d
5 changed files with 34 additions and 37 deletions

View file

@ -281,4 +281,9 @@ public class Main extends JavaPlugin implements Listener {
return loaded;
}
public void scheduleTask(Runnable task) {
if(!isEnabled()) return;
Bukkit.getServer().getScheduler().runTask(this, task);
}
}

View file

@ -3,8 +3,10 @@ package net.tylermurphy.hideAndSeek.command.world;
import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.command.util.ICommand;
import net.tylermurphy.hideAndSeek.util.Location;
import org.bukkit.Bukkit;
import org.bukkit.WorldType;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
import java.util.Arrays;

View file

@ -84,7 +84,7 @@ public class Location {
public void teleport(Player player) {
if(!exists()) return;
if(load() == null) return;
player.teleport(toBukkit());
Main.getInstance().scheduleTask(() -> player.teleport(toBukkit()));
}
public Location changeWorld(String world) {

View file

@ -19,7 +19,9 @@
package net.tylermurphy.hideAndSeek.world;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.Biome;
import org.bukkit.generator.BlockPopulator;
import org.bukkit.generator.ChunkGenerator;
import org.jetbrains.annotations.NotNull;
@ -36,41 +38,27 @@ public class VoidGenerator extends ChunkGenerator {
return Collections.emptyList();
}
public boolean shouldGenerateNoise() {
return false;
}
public boolean shouldGenerateSurface() {
return false;
}
public boolean shouldGenerateBedrock() {
return false;
}
public boolean shouldGenerateCaves() {
return false;
}
public boolean shouldGenerateDecorations() {
return false;
}
public boolean shouldGenerateMobs() {
return false;
}
public boolean shouldGenerateStructures() {
return false;
}
public boolean canSpawn(@NotNull World world, int x, int z) {
@Override
public boolean canSpawn(World world, int x, int z) {
return true;
}
@Override
public Location getFixedSpawnLocation(World world, Random random) {
return new Location(world, 0, 100, 0);
}
// 1.13 And Prev
public @NotNull ChunkData generateChunkData(@NotNull World world, @NotNull Random random, int x, int z, @NotNull BiomeGrid biome) {
return createChunkData(world);
public ChunkData generateChunkData(World world, Random random, int chunkX, int chunkZ, BiomeGrid biome) {
ChunkData chunkData = super.createChunkData(world);
for(int x = 0; x < 16; x++) {
for(int z = 0; z < 16; z++) {
biome.setBiome(x, z, Biome.PLAINS);
}
}
return chunkData;
}
// 1.8

View file

@ -50,11 +50,13 @@ public class WorldLoader {
return;
}
world.getPlayers().forEach(player -> exitPosition.teleport(player));
if (Bukkit.getServer().unloadWorld(world, false)) {
Main.getInstance().getLogger().info("Successfully unloaded " + map.getGameSpawnName());
}else{
Main.getInstance().getLogger().severe("COULD NOT UNLOAD " + map.getGameSpawnName());
}
Main.getInstance().scheduleTask(() -> {
if (Bukkit.getServer().unloadWorld(world, false)) {
Main.getInstance().getLogger().info("Successfully unloaded " + map.getGameSpawnName());
} else {
Main.getInstance().getLogger().severe("COULD NOT UNLOAD " + map.getGameSpawnName());
}
});
}
public void loadMap() {