From 0ff07e57e0755ef322601493d851cd668f7d8992 Mon Sep 17 00:00:00 2001 From: Tyler Murphy Date: Sun, 7 Aug 2022 16:39:31 -0400 Subject: [PATCH] 1.8 block and disguise hitbox not loading fix --- .../net/tylermurphy/hideAndSeek/configuration/Config.java | 2 +- .../java/net/tylermurphy/hideAndSeek/game/Disguiser.java | 6 ++++++ .../net/tylermurphy/hideAndSeek/game/util/Disguise.java | 3 ++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Config.java b/src/main/java/net/tylermurphy/hideAndSeek/configuration/Config.java index f988d5a..4130ec7 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Config.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/configuration/Config.java @@ -292,7 +292,7 @@ public class Config { } bungeeLeave = config.getString("leaveType") == null || config.getString("leaveType").equalsIgnoreCase("proxy"); leaveServer = config.getString("leaveServer"); - blockhuntEnabled = config.getBoolean("blockhunt.enabled"); + blockhuntEnabled = config.getBoolean("blockhunt.enabled") && Main.getInstance().supports(9); blockhuntBlocks = new ArrayList<>(); tempInteracts = config.getStringList("blockhunt.blocks"); for(String id : tempInteracts) { diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/Disguiser.java b/src/main/java/net/tylermurphy/hideAndSeek/game/Disguiser.java index a14827b..2f8cbf6 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/Disguiser.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/game/Disguiser.java @@ -1,5 +1,7 @@ package net.tylermurphy.hideAndSeek.game; +import static net.tylermurphy.hideAndSeek.configuration.Config.*; + import net.tylermurphy.hideAndSeek.game.util.Disguise; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -46,6 +48,10 @@ public class Disguiser { } public void disguise(Player player, Material material){ + if(!blockhuntEnabled){ + player.sendMessage(errorPrefix + "Please enable blockhunt in config.yml to enable disguises. Blockhunt does not work on 1.8"); + return; + } if(disguises.containsKey(player)){ disguises.get(player).remove(); } diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/util/Disguise.java b/src/main/java/net/tylermurphy/hideAndSeek/game/util/Disguise.java index b0f18a9..e29350b 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/util/Disguise.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/game/util/Disguise.java @@ -92,7 +92,6 @@ public class Disguise { solid = true; blockLocation = hider.getLocation().getBlock().getLocation(); respawnHitbox(); - teleportEntity(hitBox, true); } sendBlockUpdate(blockLocation, material); } else if(solid){ @@ -104,6 +103,7 @@ public class Disguise { sendBlockUpdate(blockLocation, Material.AIR); } toggleEntityVisibility(block, !solid); + teleportEntity(hitBox, true); teleportEntity(block, solid); } @@ -122,6 +122,7 @@ public class Disguise { } private void teleportEntity(Entity entity, boolean center) { + if(entity == null) return; EntityTeleportPacket packet = new EntityTeleportPacket(); packet.setEntity(entity); double x,y,z;