From 5316dfe0c6cda880669dc5a297e3f63ea9856fc0 Mon Sep 17 00:00:00 2001 From: TadahTech Date: Sun, 19 Jun 2016 02:09:17 -0500 Subject: [PATCH] Remove Spammy "Loaded default kit message". Fixed SSM kits not closing the GUI when the central item is clicked. Fixed Smash Crystals being carried over into the next game. --- .../src/nautilus/game/arcade/game/Game.java | 8 +-- .../arcade/game/games/smash/SuperSmash.java | 49 +++---------------- .../nautilus/game/arcade/kit/SmashKit.java | 14 ++++++ 3 files changed, 25 insertions(+), 46 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index 5f358ddd0..aa6fe3de0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java @@ -880,10 +880,6 @@ public abstract class Game implements Listener if (announce) { player.playSound(player.getLocation(), Sound.ORB_PICKUP, 2f, 1f); - if (kit instanceof ProgressingKit && ((ProgressingKit) kit).isDefault(player.getUniqueId())) - { - player.sendMessage(F.main("Kit", "Loaded default kit " + F.elem(kit.GetFormattedName()))); - } UtilPlayer.message(player, F.main("Kit", "You equipped " + F.elem(kit.GetFormattedName() + " Kit") + ".")); } @@ -891,6 +887,10 @@ public abstract class Game implements Listener { kit.ApplyKit(player); } + else + { + player.closeInventory(); + } } public Kit GetKit(Player player) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java index 75c3bf46d..2ce62d81c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java @@ -1,17 +1,7 @@ package nautilus.game.arcade.game.games.smash; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; - import mineplex.core.common.block.BlockData; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilFirework; -import mineplex.core.common.util.UtilInv; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.*; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; @@ -24,40 +14,11 @@ import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.GameTeam.PlayerState; -import nautilus.game.arcade.game.games.smash.kits.KitBlaze; -import nautilus.game.arcade.game.games.smash.kits.KitChicken; -import nautilus.game.arcade.game.games.smash.kits.KitCow; -import nautilus.game.arcade.game.games.smash.kits.KitCreeper; -import nautilus.game.arcade.game.games.smash.kits.KitEnderman; -import nautilus.game.arcade.game.games.smash.kits.KitGolem; -import nautilus.game.arcade.game.games.smash.kits.KitMagmaCube; -import nautilus.game.arcade.game.games.smash.kits.KitPig; -import nautilus.game.arcade.game.games.smash.kits.KitSheep; -import nautilus.game.arcade.game.games.smash.kits.KitSkeletalHorse; -import nautilus.game.arcade.game.games.smash.kits.KitSkeleton; -import nautilus.game.arcade.game.games.smash.kits.KitSkySquid; -import nautilus.game.arcade.game.games.smash.kits.KitSlime; -import nautilus.game.arcade.game.games.smash.kits.KitSnowman; -import nautilus.game.arcade.game.games.smash.kits.KitSpider; -import nautilus.game.arcade.game.games.smash.kits.KitWitch; -import nautilus.game.arcade.game.games.smash.kits.KitWitherSkeleton; -import nautilus.game.arcade.game.games.smash.kits.KitWolf; -import nautilus.game.arcade.game.games.smash.kits.KitZombie; +import nautilus.game.arcade.game.games.smash.kits.*; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.SmashKit; -import nautilus.game.arcade.stats.FreeKitWinStatTracker; -import nautilus.game.arcade.stats.KillFastStatTracker; -import nautilus.game.arcade.stats.OneVThreeStatTracker; -import nautilus.game.arcade.stats.RecoveryMasterStatTracker; -import nautilus.game.arcade.stats.WinWithoutDyingStatTracker; - -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.Color; +import org.bukkit.*; import org.bukkit.FireworkEffect.Type; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.Sound; import org.bukkit.block.BlockFace; import org.bukkit.entity.EnderCrystal; import org.bukkit.entity.Player; @@ -72,6 +33,9 @@ import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.PlayerInteractEvent; +import java.util.HashMap; +import java.util.HashSet; + public abstract class SuperSmash extends Game { private HashMap _lives = new HashMap(); @@ -375,6 +339,7 @@ public abstract class SuperSmash extends Game if (announce) { + player.closeInventory(); player.playSound(player.getLocation(), Sound.ORB_PICKUP, 2f, 1f); UtilPlayer.message(player, F.main("Kit", "You equipped " + F.elem(kit.GetFormattedName() + " Kit") + ".")); kit.ApplyKit(player); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/SmashKit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/SmashKit.java index 139b0c22f..a277c147e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/SmashKit.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/SmashKit.java @@ -5,6 +5,7 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeFormat; import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.events.GameStateChangeEvent; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.Sound; @@ -117,6 +118,19 @@ public abstract class SmashKit extends ProgressingKit UtilTextMiddle.display("Smash Crystal", event.getPlayer().getName() + " used " + C.cGreen + _superName, 5, 50, 5, UtilServer.getPlayers()); } } + + @EventHandler + public void onEnd(GameStateChangeEvent event) + { + Iterator superIter = _superActive.keySet().iterator(); + + while (superIter.hasNext()) + { + Player player = superIter.next(); + superIter.remove(); + deactivateSuper(player); + } + } @EventHandler public void expireSuper(UpdateEvent event)