Fix Board Join Exceptions on 1.8, and fixed Failed to Select Seeker

This commit is contained in:
Tyler Murphy 2022-08-16 08:46:16 -04:00
parent 71db93f2e2
commit 7a082c860e
3 changed files with 19 additions and 18 deletions

View file

@ -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());

View file

@ -107,10 +107,7 @@ public class Game {
public void start() {
try {
Optional<Player> 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.");

View file

@ -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;
}
}