Untested fix I'm 99% sure will fix hide and seek players being blinded

This commit is contained in:
libraryaddict 2014-11-30 13:47:07 +13:00
parent f8869a84ba
commit 54fe312251

View File

@ -50,7 +50,6 @@ import org.bukkit.event.vehicle.VehicleExitEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.FireworkMeta;
import mineplex.core.antihack.AntiHack;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilBlock;
@ -67,11 +66,12 @@ import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.packethandler.IPacketHandler;
import mineplex.core.packethandler.PacketInfo;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.combat.DeathMessageType;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
@ -91,9 +91,9 @@ import nautilus.game.arcade.stats.BadHiderStatTracker;
import nautilus.game.arcade.stats.HunterKillerStatTracker;
import nautilus.game.arcade.stats.HunterOfTheYearStatTracker;
import nautilus.game.arcade.stats.MeowStatTracker;
import net.minecraft.server.v1_7_R4.EntityCreature;
import net.minecraft.server.v1_7_R4.Navigation;
import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntity;
@SuppressWarnings("deprecation")
public class HideSeek extends TeamGame
@ -188,6 +188,23 @@ public class HideSeek extends TeamGame
private ArrayList<Material> _allowedBlocks;
private ArrayList<EntityType> _allowedEnts;
private IPacketHandler preventSpawnSent = new IPacketHandler() {
@Override
public void handle(PacketInfo packetInfo)
{
if (packetInfo.getPacket() instanceof PacketPlayOutSpawnEntity)
{
Entity passenger = packetInfo.getPlayer().getPassenger();
if (passenger != null && passenger.getType() == EntityType.FALLING_BLOCK) {
if (passenger.getEntityId() == ((PacketPlayOutSpawnEntity) packetInfo.getPacket()).a){
packetInfo.setCancelled(true);
}
}
}
}
};
public HideSeek(ArcadeManager manager)
{
@ -250,6 +267,20 @@ public class HideSeek extends TeamGame
);
}
@EventHandler
public void onBombsPacketListener(GameStateChangeEvent event)
{
if (event.GetState() == GameState.Live)
{
this.getArcadeManager().getPacketHandler().addPacketHandler(preventSpawnSent);
}
else if (event.GetState() == GameState.End)
{
this.getArcadeManager().getPacketHandler().removePacketHandler(preventSpawnSent);
}
}
public Material GetItemEquivilent(Material mat)
{
if (mat == Material.CAULDRON) return Material.CAULDRON_ITEM;