From ef21106da02577e23fd54911977d358e8c2744c6 Mon Sep 17 00:00:00 2001 From: samczsun Date: Sun, 19 Mar 2017 14:55:16 -0400 Subject: [PATCH] Fix memory leak in CompassModule --- .../src/mineplex/core/shop/page/ShopPageInventory.java | 4 +++- .../arcade/game/modules/compass/menu/CompassMenu.java | 9 +++++---- .../game/modules/compass/menu/page/CompassPage.java | 5 +++-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/shop/page/ShopPageInventory.java b/Plugins/Mineplex.Core/src/mineplex/core/shop/page/ShopPageInventory.java index 0546c0de6..1d631af56 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/shop/page/ShopPageInventory.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/shop/page/ShopPageInventory.java @@ -4,6 +4,8 @@ import mineplex.core.MiniPlugin; import mineplex.core.account.CoreClientManager; import mineplex.core.donation.DonationManager; import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.lifetimes.Lifetime; +import mineplex.core.lifetimes.Lifetimed; import mineplex.core.shop.ShopBase; import mineplex.core.shop.item.IButton; @@ -12,7 +14,7 @@ import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; import org.bukkit.inventory.ItemStack; -public abstract class ShopPageInventory> extends +public abstract class ShopPageInventory> extends ShopPageBase { private int _page; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/compass/menu/CompassMenu.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/compass/menu/CompassMenu.java index 81114a0b8..2c11196c9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/compass/menu/CompassMenu.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/compass/menu/CompassMenu.java @@ -6,28 +6,29 @@ import mineplex.core.shop.ShopBase; import mineplex.core.shop.page.ShopPageBase; import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.game.modules.compass.menu.page.CompassPage; -public class CompassMenu extends ShopBase +public class CompassMenu extends ShopBase { private CompassModule _compassModule; public CompassMenu(CompassModule module) { - super(module.getGame().getArcadeManager(), module.getGame().getArcadeManager().GetClients(), module.getGame().getArcadeManager().GetDonation(), "Spectate Menu"); + super(module.getGame(), module.getGame().getArcadeManager().GetClients(), module.getGame().getArcadeManager().GetDonation(), "Spectate Menu"); this._compassModule = module; } @Override - protected ShopPageBase> buildPagesFor(Player player) + protected ShopPageBase> buildPagesFor(Player player) { return new CompassPage(this, _compassModule, player); } public void update() { - for (ShopPageBase> shopPage : getPlayerPageMap().values()) + for (ShopPageBase> shopPage : getPlayerPageMap().values()) { shopPage.refresh(); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/compass/menu/page/CompassPage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/compass/menu/page/CompassPage.java index c126adb79..a4f88d31a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/compass/menu/page/CompassPage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/compass/menu/page/CompassPage.java @@ -21,6 +21,7 @@ import mineplex.core.shop.item.ShopItem; import mineplex.core.shop.page.ShopPageInventory; import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.modules.compass.CompassEntry; import nautilus.game.arcade.game.modules.compass.CompassModule; @@ -28,7 +29,7 @@ import nautilus.game.arcade.game.modules.compass.menu.CompassMenu; import nautilus.game.arcade.game.modules.compass.menu.button.CompassButton; public class CompassPage extends - ShopPageInventory + ShopPageInventory { private CompassModule _compassModule; private IButton[] _buttons; @@ -36,7 +37,7 @@ public class CompassPage extends public CompassPage(CompassMenu menu, CompassModule compassModule, Player player) { - super(compassModule.getGame().getArcadeManager(), + super(compassModule.getGame(), menu, compassModule.getGame().getArcadeManager().GetClients(), compassModule.getGame().getArcadeManager().GetDonation(),