Fix memory leak in CompassModule

This commit is contained in:
samczsun 2017-03-19 14:55:16 -04:00 committed by cnr
parent b88f9fc642
commit ef21106da0
3 changed files with 11 additions and 7 deletions

View File

@ -4,6 +4,8 @@ import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.itemstack.ItemBuilder; import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.lifetimes.Lifetime;
import mineplex.core.lifetimes.Lifetimed;
import mineplex.core.shop.ShopBase; import mineplex.core.shop.ShopBase;
import mineplex.core.shop.item.IButton; import mineplex.core.shop.item.IButton;
@ -12,7 +14,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
public abstract class ShopPageInventory<PluginType extends MiniPlugin, ShopType extends ShopBase<PluginType>> extends public abstract class ShopPageInventory<PluginType extends Lifetimed, ShopType extends ShopBase<PluginType>> extends
ShopPageBase ShopPageBase
{ {
private int _page; private int _page;

View File

@ -6,28 +6,29 @@ import mineplex.core.shop.ShopBase;
import mineplex.core.shop.page.ShopPageBase; import mineplex.core.shop.page.ShopPageBase;
import nautilus.game.arcade.ArcadeManager; 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.CompassModule;
import nautilus.game.arcade.game.modules.compass.menu.page.CompassPage; import nautilus.game.arcade.game.modules.compass.menu.page.CompassPage;
public class CompassMenu extends ShopBase<ArcadeManager> public class CompassMenu extends ShopBase<Game>
{ {
private CompassModule _compassModule; private CompassModule _compassModule;
public CompassMenu(CompassModule module) 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; this._compassModule = module;
} }
@Override @Override
protected ShopPageBase<ArcadeManager, ? extends ShopBase<ArcadeManager>> buildPagesFor(Player player) protected ShopPageBase<Game, ? extends ShopBase<Game>> buildPagesFor(Player player)
{ {
return new CompassPage(this, _compassModule, player); return new CompassPage(this, _compassModule, player);
} }
public void update() public void update()
{ {
for (ShopPageBase<ArcadeManager, ? extends ShopBase<ArcadeManager>> shopPage : getPlayerPageMap().values()) for (ShopPageBase<Game, ? extends ShopBase<Game>> shopPage : getPlayerPageMap().values())
{ {
shopPage.refresh(); shopPage.refresh();
} }

View File

@ -21,6 +21,7 @@ import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.page.ShopPageInventory; import mineplex.core.shop.page.ShopPageInventory;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.modules.compass.CompassEntry; import nautilus.game.arcade.game.modules.compass.CompassEntry;
import nautilus.game.arcade.game.modules.compass.CompassModule; 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; import nautilus.game.arcade.game.modules.compass.menu.button.CompassButton;
public class CompassPage extends public class CompassPage extends
ShopPageInventory<ArcadeManager, CompassMenu> ShopPageInventory<Game, CompassMenu>
{ {
private CompassModule _compassModule; private CompassModule _compassModule;
private IButton[] _buttons; private IButton[] _buttons;
@ -36,7 +37,7 @@ public class CompassPage extends
public CompassPage(CompassMenu menu, CompassModule compassModule, Player player) public CompassPage(CompassMenu menu, CompassModule compassModule, Player player)
{ {
super(compassModule.getGame().getArcadeManager(), super(compassModule.getGame(),
menu, menu,
compassModule.getGame().getArcadeManager().GetClients(), compassModule.getGame().getArcadeManager().GetClients(),
compassModule.getGame().getArcadeManager().GetDonation(), compassModule.getGame().getArcadeManager().GetDonation(),