Fix Infestor kit

Fix rare occurrence of players getting a GUI they shouldn't (reported)
This commit is contained in:
TadahTech 2016-06-16 19:35:36 -05:00 committed by cnr
parent e28d411ee4
commit 2e0965a064
7 changed files with 56 additions and 164 deletions

View File

@ -1,74 +1,9 @@
package nautilus.game.arcade.game.games.hideseek; package nautilus.game.arcade.game.games.hideseek;
import java.util.ArrayList; import mineplex.core.common.util.*;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map.Entry;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.FireworkEffect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Chicken;
import org.bukkit.entity.Cow;
import org.bukkit.entity.Creature;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.FallingSand;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Pig;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.entity.Sheep;
import org.bukkit.entity.Slime;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.HandlerList;
import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.event.entity.EntityChangeBlockEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.vehicle.VehicleExitEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.FireworkMeta;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
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.itemstack.ItemStackFactory;
import mineplex.core.packethandler.IPacketHandler; import mineplex.core.packethandler.IPacketHandler;
import mineplex.core.packethandler.PacketInfo; import mineplex.core.packethandler.PacketInfo;
@ -83,8 +18,8 @@ import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.events.PlayerPrepareTeleportEvent; import nautilus.game.arcade.events.PlayerPrepareTeleportEvent;
import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.GameTeam.PlayerState; import nautilus.game.arcade.game.GameTeam.PlayerState;
import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.games.hideseek.forms.BlockForm; import nautilus.game.arcade.game.games.hideseek.forms.BlockForm;
import nautilus.game.arcade.game.games.hideseek.forms.CreatureForm; import nautilus.game.arcade.game.games.hideseek.forms.CreatureForm;
import nautilus.game.arcade.game.games.hideseek.forms.Form; import nautilus.game.arcade.game.games.hideseek.forms.Form;
@ -96,13 +31,36 @@ import nautilus.game.arcade.stats.BadHiderStatTracker;
import nautilus.game.arcade.stats.HunterKillerStatTracker; import nautilus.game.arcade.stats.HunterKillerStatTracker;
import nautilus.game.arcade.stats.HunterOfTheYearStatTracker; import nautilus.game.arcade.stats.HunterOfTheYearStatTracker;
import nautilus.game.arcade.stats.MeowStatTracker; import nautilus.game.arcade.stats.MeowStatTracker;
import net.minecraft.server.v1_8_R3.EntityCreature; import net.minecraft.server.v1_8_R3.*;
import net.minecraft.server.v1_8_R3.Navigation; import org.bukkit.*;
import net.minecraft.server.v1_8_R3.NavigationAbstract; import org.bukkit.FireworkEffect.Type;
import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity; import org.bukkit.Material;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy; import org.bukkit.block.Block;
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntity; import org.bukkit.block.BlockFace;
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.*;
import org.bukkit.entity.Entity;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.HandlerList;
import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.event.entity.*;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.vehicle.VehicleExitEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.FireworkMeta;
import org.bukkit.util.Vector;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map.Entry;
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public class HideSeek extends TeamGame public class HideSeek extends TeamGame
@ -1613,7 +1571,7 @@ public class HideSeek extends TeamGame
// Invisible // Invisible
for (Player player : GetPlayers(true)) for (Player player : GetPlayers(true))
{ {
if (!(GetKit(player) instanceof KitHiderTeleporter)) if (!(GetKit(player) instanceof KitHiderInfestor))
continue; continue;
if (_infested.containsKey(player) || player.getVehicle() != null) if (_infested.containsKey(player) || player.getVehicle() != null)

View File

@ -8,7 +8,6 @@ import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.ProgressingKit; import nautilus.game.arcade.kit.ProgressingKit;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
public abstract class KitHider extends ProgressingKit public abstract class KitHider extends ProgressingKit
@ -28,9 +27,4 @@ public abstract class KitHider extends ProgressingKit
super(manager, name, "hideseek" + name.toLowerCase().replace(" ", ""), kitAvailability, cost, kitDesc, kitPerks, entityType, itemInHand); super(manager, name, "hideseek" + name.toLowerCase().replace(" ", ""), kitAvailability, cost, kitDesc, kitPerks, entityType, itemInHand);
} }
@Override
public void GiveItems(Player player)
{
player.getInventory().setItem(3, PLAYER_ITEM);
}
} }

View File

@ -6,6 +6,7 @@ import nautilus.game.arcade.kit.Perk;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Slime; import org.bukkit.entity.Slime;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@ -26,7 +27,13 @@ public class KitHiderQuick extends KitHider
{ {
super(manager, "Instant Hider", KitAvailability.Gem, DESCRIPTION, PERKS, EntityType.SLIME, IN_HAND); super(manager, "Instant Hider", KitAvailability.Gem, DESCRIPTION, PERKS, EntityType.SLIME, IN_HAND);
} }
@Override
public void GiveItems(Player player)
{
player.getInventory().setItem(3, PLAYER_ITEM);
}
@Override @Override
public void SpawnCustom(LivingEntity ent) public void SpawnCustom(LivingEntity ent)
{ {

View File

@ -7,6 +7,7 @@ import nautilus.game.arcade.kit.perks.PerkShockingStrike;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Slime; import org.bukkit.entity.Slime;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@ -27,6 +28,12 @@ public class KitHiderShocker extends KitHider
{ {
super(manager, "Shocking Hider", KitAvailability.Gem, 5000, DESCRIPTION, PERKS, EntityType.SLIME, IN_HAND); super(manager, "Shocking Hider", KitAvailability.Gem, 5000, DESCRIPTION, PERKS, EntityType.SLIME, IN_HAND);
} }
@Override
public void GiveItems(Player player)
{
player.getInventory().setItem(3, PLAYER_ITEM);
}
@Override @Override
public void SpawnCustom(LivingEntity ent) public void SpawnCustom(LivingEntity ent)

View File

@ -6,6 +6,7 @@ import nautilus.game.arcade.kit.Perk;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Slime; import org.bukkit.entity.Slime;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@ -25,7 +26,13 @@ public class KitHiderSwapper extends KitHider
{ {
super(manager, "Swapper Hider", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.SLIME, IN_HAND); super(manager, "Swapper Hider", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.SLIME, IN_HAND);
} }
@Override
public void GiveItems(Player player)
{
player.getInventory().setItem(3, PLAYER_ITEM);
}
@Override @Override
public void SpawnCustom(LivingEntity ent) public void SpawnCustom(LivingEntity ent)
{ {

View File

@ -1,67 +0,0 @@
package nautilus.game.arcade.game.games.hideseek.kits;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Slime;
import org.bukkit.inventory.ItemStack;
import mineplex.core.achievement.Achievement;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilServer;
import mineplex.core.disguise.disguises.DisguiseSlime;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
public class KitHiderTeleporter extends Kit
{
public KitHiderTeleporter(ArcadeManager manager)
{
super(manager, "Infestor Hider", KitAvailability.Achievement,
new String[]
{
"Can instantly infest a target block.",
"This is the only way you can hide."
},
new Perk[]
{
},
EntityType.SLIME,
new ItemStack(Material.SLIME_BALL));
this.setAchievementRequirements(new Achievement[]
{
Achievement.BLOCK_HUNT_BAD_HIDER,
Achievement.BLOCK_HUNT_HUNTER_KILLER,
Achievement.BLOCK_HUNT_HUNTER_OF_THE_YEAR,
Achievement.BLOCK_HUNT_MEOW,
Achievement.BLOCK_HUNT_WINS,
});
}
@Override
public void GiveItems(Player player)
{
//Swap
player.getInventory().setItem(3, ItemStackFactory.Instance.CreateStack(Material.MAGMA_CREAM, (byte)0, 1, C.cYellow + C.Bold + "Click Block" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Infest Block/Animal"));
DisguiseSlime slime = new DisguiseSlime(player);
slime.SetSize(2);
slime.setName(C.cAqua + player.getName());
Manager.GetDisguise().disguise(slime);
}
@Override
public void SpawnCustom(LivingEntity ent)
{
((Slime)ent).setSize(2);
}
}

View File

@ -170,15 +170,6 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit
@Override @Override
public void onSelected(UUID player) public void onSelected(UUID player)
{ {
if(!canEquipKit(Bukkit.getPlayer(player)))
{
return;
}
if(Manager.GetGame().GetType() == GameType.Evolution)
{
Evolution evolution = (Evolution) Manager.GetGame();
evolution.select(player, this);
}
_dataManager.get(player).setCurrentKit(getInternalName()); _dataManager.get(player).setCurrentKit(getInternalName());
Manager.GetGame().SetKit(Bukkit.getPlayer(player), this, true); Manager.GetGame().SetKit(Bukkit.getPlayer(player), this, true);
Manager.getProgressionKitManager().displayParticles(this, player); Manager.getProgressionKitManager().displayParticles(this, player);
@ -187,11 +178,6 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit
@Override @Override
public void onSetDefault(UUID player) public void onSetDefault(UUID player)
{ {
if(!canEquipKit(Bukkit.getPlayer(player)))
{
return;
}
setDefault(!isDefault(player), player); setDefault(!isDefault(player), player);
Player bukkitPlayer = Bukkit.getPlayer(player); Player bukkitPlayer = Bukkit.getPlayer(player);