From 7a082c860e79f6204e49b4e113dd64269c44dd36 Mon Sep 17 00:00:00 2001 From: Tyler Murphy Date: Tue, 16 Aug 2022 08:46:16 -0400 Subject: [PATCH] Fix Board Join Exceptions on 1.8, and fixed Failed to Select Seeker --- .../tylermurphy/hideAndSeek/game/Board.java | 12 ----------- .../tylermurphy/hideAndSeek/game/Game.java | 5 +---- .../hideAndSeek/world/VoidGenerator.java | 20 +++++++++++++++++-- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/Board.java b/src/main/java/net/tylermurphy/hideAndSeek/game/Board.java index 6bf0bfb..55dfa3c 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/Board.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/game/Board.java @@ -104,9 +104,6 @@ public class Board { } public void addHider(Player player) { - if(!Main.getInstance().supports(9)){ - player.spigot().setCollidesWithEntities(false); - } Hider.add(player.getUniqueId().toString()); Seeker.remove(player.getUniqueId().toString()); Spectator.remove(player.getUniqueId().toString()); @@ -114,9 +111,6 @@ public class Board { } public void addSeeker(Player player) { - if(!Main.getInstance().supports(9)){ - player.spigot().setCollidesWithEntities(false); - } Hider.remove(player.getUniqueId().toString()); Seeker.add(player.getUniqueId().toString()); Spectator.remove(player.getUniqueId().toString()); @@ -124,9 +118,6 @@ public class Board { } public void addSpectator(Player player) { - if(!Main.getInstance().supports(9)){ - player.spigot().setCollidesWithEntities(false); - } Hider.remove(player.getUniqueId().toString()); Seeker.remove(player.getUniqueId().toString()); Spectator.add(player.getUniqueId().toString()); @@ -134,9 +125,6 @@ public class Board { } public void remove(Player player) { - if(!Main.getInstance().supports(9)){ - player.spigot().setCollidesWithEntities(true); - } Hider.remove(player.getUniqueId().toString()); Seeker.remove(player.getUniqueId().toString()); Spectator.remove(player.getUniqueId().toString()); diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/Game.java b/src/main/java/net/tylermurphy/hideAndSeek/game/Game.java index ac210a3..7c5eaf2 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/Game.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/game/Game.java @@ -107,10 +107,7 @@ public class Game { public void start() { try { Optional rand = board.getPlayers().stream().skip(new Random().nextInt(board.size())).findFirst(); - Player picked = rand.orElse(board.getPlayers().get(0)); - String seekerName = picked.getName(); - Player temp = Bukkit.getPlayer(seekerName); - Player seeker = board.getPlayer(temp.getUniqueId()); + Player seeker = rand.orElse(board.getPlayers().get(0)); start(seeker); } catch (Exception e){ Main.getInstance().getLogger().warning("Failed to select random seeker."); diff --git a/src/main/java/net/tylermurphy/hideAndSeek/world/VoidGenerator.java b/src/main/java/net/tylermurphy/hideAndSeek/world/VoidGenerator.java index a81aa51..eadd0a9 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/world/VoidGenerator.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/world/VoidGenerator.java @@ -29,7 +29,7 @@ import java.util.List; import java.util.Random; @SuppressWarnings({"unused"}) -public class VoidGenerator extends ChunkGenerator{ +public class VoidGenerator extends ChunkGenerator { // 1.14 And On public @NotNull List getDefaultPopulators(@NotNull World world) { @@ -69,6 +69,22 @@ public class VoidGenerator extends ChunkGenerator{ } // 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 @NotNull ChunkData generateChunkData(@NotNull World world, @NotNull Random random, int x, int z, @NotNull BiomeGrid biome) { + return createChunkData(world); + } + + // 1.8 + public byte[] generate(World world, Random random, int x, int z) { + return null; + } + + public short[][] generateExtBlockSections(World world, Random random, int x, int z, ChunkGenerator.BiomeGrid biomes) { + return null; + } + + public byte[][] generateBlockSections(World world, Random random, int x, int z, ChunkGenerator.BiomeGrid biomes) { + return null; + } + }