- Fixed permanent dwarf toss bug

- Fixed skills being active while player is editing class
This commit is contained in:
AlexTheCoder 2015-10-27 01:38:41 -04:00
parent 9d6a361602
commit 0ab3213b7b
11 changed files with 131 additions and 39 deletions

View File

@ -28,9 +28,9 @@ public class TeamArmorAddon extends MiniPlugin
@EventHandler
public void GiveArmor(PlayerKitGiveEvent event)
{
Player player = event.GetPlayer();
Player player = event.getPlayer();
if (event.GetGame().TeamArmor)
if (event.getGame().TeamArmor)
{
ItemStack helm = new ItemStack(Material.LEATHER_HELMET);
LeatherArmorMeta metaHelm = (LeatherArmorMeta)helm.getItemMeta();
@ -57,7 +57,7 @@ public class TeamArmorAddon extends MiniPlugin
player.getInventory().setBoots(boots);
}
if (event.GetGame().TeamArmorHotbar && event.GetGame().InProgress())
if (event.getGame().TeamArmorHotbar && event.getGame().InProgress())
{
ItemStack armor = new ItemStack(Material.LEATHER_CHESTPLATE);
LeatherArmorMeta meta = (LeatherArmorMeta)armor.getItemMeta();

View File

@ -34,17 +34,17 @@ public class PlayerKitApplyEvent extends Event implements Cancellable
return handlers;
}
public Game GetGame()
public Game getGame()
{
return _game;
}
public Kit GetKit()
public Kit getKit()
{
return _kit;
}
public Player GetPlayer()
public Player getPlayer()
{
return _player;
}

View File

@ -32,17 +32,17 @@ public class PlayerKitGiveEvent extends Event
return handlers;
}
public Game GetGame()
public Game getGame()
{
return _game;
}
public Kit GetKit()
public Kit getKit()
{
return _kit;
}
public Player GetPlayer()
public Player getPlayer()
{
return _player;
}

View File

@ -1,11 +1,5 @@
package nautilus.game.arcade.game.games.champions;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.inventory.InventoryType;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.updater.UpdateType;
@ -15,6 +9,7 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.champions.kits.SkillFixer;
import nautilus.game.arcade.game.games.champions.kits.KitAssassin;
import nautilus.game.arcade.game.games.champions.kits.KitBrute;
import nautilus.game.arcade.game.games.champions.kits.KitKnight;
@ -29,6 +24,12 @@ import nautilus.game.arcade.stats.KillReasonStatTracker;
import nautilus.game.arcade.stats.SeismicSlamStatTracker;
import nautilus.game.arcade.stats.TheLongestShotStatTracker;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.inventory.InventoryType;
public class ChampionsCTF extends CaptureTheFlag
{
public ChampionsCTF(ArcadeManager manager)
@ -78,6 +79,8 @@ public class ChampionsCTF extends CaptureTheFlag
new CapturesStatTracker(this, "Captures"),
new ClutchStatTracker(this, "Clutch")
);
new SkillFixer(this);
}
@Override

View File

@ -9,6 +9,7 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.champions.kits.SkillFixer;
import nautilus.game.arcade.game.games.champions.kits.KitAssassin;
import nautilus.game.arcade.game.games.champions.kits.KitBrute;
import nautilus.game.arcade.game.games.champions.kits.KitKnight;
@ -16,8 +17,8 @@ import nautilus.game.arcade.game.games.champions.kits.KitMage;
import nautilus.game.arcade.game.games.champions.kits.KitRanger;
import nautilus.game.arcade.game.games.common.Domination;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.stats.KillReasonStatTracker;
import nautilus.game.arcade.stats.ElectrocutionStatTracker;
import nautilus.game.arcade.stats.KillReasonStatTracker;
import nautilus.game.arcade.stats.SeismicSlamStatTracker;
import nautilus.game.arcade.stats.TheLongestShotStatTracker;
@ -76,6 +77,8 @@ public class ChampionsDominate extends Domination
new TheLongestShotStatTracker(this),
new SeismicSlamStatTracker(this)
);
new SkillFixer(this);
}
@Override

View File

@ -1,11 +1,5 @@
package nautilus.game.arcade.game.games.champions;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.inventory.InventoryType;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.updater.UpdateType;
@ -15,6 +9,7 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.champions.kits.SkillFixer;
import nautilus.game.arcade.game.games.champions.kits.KitAssassin;
import nautilus.game.arcade.game.games.champions.kits.KitBrute;
import nautilus.game.arcade.game.games.champions.kits.KitKnight;
@ -22,13 +17,19 @@ import nautilus.game.arcade.game.games.champions.kits.KitMage;
import nautilus.game.arcade.game.games.champions.kits.KitRanger;
import nautilus.game.arcade.game.games.common.TeamDeathmatch;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.stats.KillReasonStatTracker;
import nautilus.game.arcade.stats.ElectrocutionStatTracker;
import nautilus.game.arcade.stats.KillAllOpposingStatTracker;
import nautilus.game.arcade.stats.KillReasonStatTracker;
import nautilus.game.arcade.stats.SeismicSlamStatTracker;
import nautilus.game.arcade.stats.TheLongestShotStatTracker;
import nautilus.game.arcade.stats.WinWithoutLosingTeammateStatTracker;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.inventory.InventoryType;
public class ChampionsTDM extends TeamDeathmatch
{
public ChampionsTDM(ArcadeManager manager)
@ -76,6 +77,8 @@ public class ChampionsTDM extends TeamDeathmatch
new TheLongestShotStatTracker(this),
new SeismicSlamStatTracker(this)
);
new SkillFixer(this);
}
@Override

View File

@ -0,0 +1,84 @@
package nautilus.game.arcade.game.games.champions.kits;
import mineplex.core.common.util.UtilServer;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.classcombat.Skill.Skill;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.events.PlayerKitApplyEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.Game.GameState;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryType;
public class SkillFixer implements Listener
{
private Game _host;
public SkillFixer(Game game)
{
_host = game;
Bukkit.getPluginManager().registerEvents(this, _host.getArcadeManager().getPlugin());
}
@EventHandler
public void disable(GameStateChangeEvent event)
{
if (event.GetGame() != _host)
return;
if (event.GetState() == GameState.End)
HandlerList.unregisterAll(this);
}
@EventHandler(priority = EventPriority.HIGHEST)
public void fixDwarf(PlayerKitApplyEvent event)
{
if (!_host.IsLive())
return;
if (event.isCancelled())
return;
if (event.getPlayer().getPassenger() == null)
return;
event.setCancelled(true);
event.setCancelMessage("You cannot change kits while holding someone in Dwarf Toss!");
}
@EventHandler(priority = EventPriority.HIGHEST)
public void fixBlizzard(PlayerKitApplyEvent event)
{
if (!_host.IsLive())
return;
if (event.isCancelled())
return;
_host.getArcadeManager().getClassManager().GetSkillFactory().GetSkill("Blizzard").Reset(event.getPlayer());
}
@EventHandler
public void onUpdate(UpdateEvent event)
{
if (!_host.IsLive())
return;
for (Player player : UtilServer.getPlayers())
{
if (player.getOpenInventory() == null || player.getOpenInventory().getTopInventory() == null)
continue;
if (player.getOpenInventory().getTopInventory().getType() == InventoryType.CHEST)
for (Skill skill : _host.getArcadeManager().getClassManager().GetSkillFactory().GetAllSkills())
skill.Reset(player);
}
}
}

View File

@ -587,7 +587,7 @@ public class CaptureTheFlag extends TeamGame
for (Flag flag : _flags)
if (!flag.isAtHome())
if (flag.getCarrier() != null)
if (flag.getCarrier().getName().equals(event.GetPlayer().getName()))
if (flag.getCarrier().getName().equals(event.getPlayer().getName()))
{
event.setCancelled(true);
event.setCancelMessage("You cannot change kits while holding a flag!");

View File

@ -4,10 +4,10 @@ import java.util.concurrent.ConcurrentHashMap;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextBottom;
@ -21,7 +21,6 @@ import nautilus.game.arcade.game.games.common.CaptureTheFlag;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.FireworkEffect;
import org.bukkit.Sound;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.Location;
import org.bukkit.Material;

View File

@ -200,7 +200,7 @@ public class DragonEscape extends SoloGame
@EventHandler
public void Invisibility(PlayerKitGiveEvent event)
{
Manager.GetCondition().Factory().Invisible(GetName(), event.GetPlayer(), event.GetPlayer(), 40, 0, false, false, false);
Manager.GetCondition().Factory().Invisible(GetName(), event.getPlayer(), event.getPlayer(), 40, 0, false, false, false);
}
@EventHandler

View File

@ -341,45 +341,45 @@ public class MineStrike extends TeamGame
@EventHandler
public void giveStartEquipment(PlayerKitGiveEvent event)
{
GameTeam team = GetTeam(event.GetPlayer());
GameTeam team = GetTeam(event.getPlayer());
if (team == null)
return;
if (team.GetColor() == ChatColor.RED)
{
if (IsAlive(event.GetPlayer()))
if (IsAlive(event.getPlayer()))
{
//Pistol
Gun gun = new Gun(GunStats.GLOCK_18);
registerGun(gun, event.GetPlayer());
gun.giveToPlayer(event.GetPlayer(), true);
registerGun(gun, event.getPlayer());
gun.giveToPlayer(event.getPlayer(), true);
//Knife
event.GetPlayer().getInventory().setItem(2, ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, "Knife"));
event.getPlayer().getInventory().setItem(2, ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, "Knife"));
//Armor
giveTeamArmor(event.GetPlayer(), Color.fromRGB(255, 0, 0));
giveTeamArmor(event.getPlayer(), Color.fromRGB(255, 0, 0));
}
}
else if (team.GetColor() == ChatColor.AQUA)
{
if (IsAlive(event.GetPlayer()))
if (IsAlive(event.getPlayer()))
{
//Pistol
Gun gun = new Gun(GunStats.P2000);
registerGun(gun, event.GetPlayer());
gun.giveToPlayer(event.GetPlayer(), true);
registerGun(gun, event.getPlayer());
gun.giveToPlayer(event.getPlayer(), true);
//Knife
event.GetPlayer().getInventory().setItem(2, ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1, "Knife"));
event.getPlayer().getInventory().setItem(2, ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1, "Knife"));
//Armor
giveTeamArmor(event.GetPlayer(), Color.fromRGB(0, 0, 255));
giveTeamArmor(event.getPlayer(), Color.fromRGB(0, 0, 255));
}
}
//Enter Shop
_shopManager.enterShop(event.GetPlayer());
_shopManager.enterShop(event.getPlayer());
}
@EventHandler(priority = EventPriority.MONITOR)