Merge branch 'master' of ssh://dev1.mineplex.com:7999/min/mineplex

This commit is contained in:
Chiss 2014-03-10 13:32:52 +11:00
commit 8593eb326e
4 changed files with 50 additions and 15 deletions

View File

@ -37,7 +37,7 @@ public abstract class ShopBase<PluginType extends MiniPlugin> implements Listene
protected String Name;
protected NautHashMap<String, ShopPageBase<PluginType, ? extends ShopBase<PluginType>>> PlayerPageMap;
private HashSet<String> _openedShop = new HashSet<String>();
protected HashSet<String> OpenedShop = new HashSet<String>();
public ShopBase(PluginType plugin, CoreClientManager clientManager, DonationManager donationManager, String name, CurrencyType...currencyTypes)
{
@ -88,13 +88,13 @@ public abstract class ShopBase<PluginType extends MiniPlugin> implements Listene
private boolean AttemptShopOpen(Player player, LivingEntity entity)
{
if (!_openedShop.contains(player.getName()) && entity.isCustomNameVisible() && entity.getCustomName() != null && ChatColor.stripColor(entity.getCustomName()).equalsIgnoreCase(ChatColor.stripColor(Name)))
if (!OpenedShop.contains(player.getName()) && entity.isCustomNameVisible() && entity.getCustomName() != null && ChatColor.stripColor(entity.getCustomName()).equalsIgnoreCase(ChatColor.stripColor(Name)))
{
if (!CanOpenShop(player))
return false;
_openedShop.add(player.getName());
OpenedShop.add(player.getName());
OpenShopForPlayer(player);
if (!PlayerPageMap.containsKey(player.getName()))
@ -112,12 +112,12 @@ public abstract class ShopBase<PluginType extends MiniPlugin> implements Listene
public boolean attemptShopOpen(Player player)
{
if (!_openedShop.contains(player.getName()))
if (!OpenedShop.contains(player.getName()))
{
if (!CanOpenShop(player))
return false;
_openedShop.add(player.getName());
OpenedShop.add(player.getName());
OpenShopForPlayer(player);
if (!PlayerPageMap.containsKey(player.getName()))
@ -132,7 +132,7 @@ public abstract class ShopBase<PluginType extends MiniPlugin> implements Listene
return false;
}
protected ShopPageBase<PluginType, ? extends ShopBase<PluginType>> GetOpeningPageForPlayer(Player player)
{
return PlayerPageMap.get(player.getName());
@ -160,7 +160,7 @@ public abstract class ShopBase<PluginType extends MiniPlugin> implements Listene
CloseShopForPlayer((Player)event.getPlayer());
_openedShop.remove(event.getPlayer().getName());
OpenedShop.remove(event.getPlayer().getName());
}
}
@ -186,7 +186,7 @@ public abstract class ShopBase<PluginType extends MiniPlugin> implements Listene
PlayerPageMap.remove(event.getPlayer().getName());
_openedShop.remove(event.getPlayer().getName());
OpenedShop.remove(event.getPlayer().getName());
}
}

View File

@ -11,6 +11,7 @@ import mineplex.core.shop.page.ShopPageBase;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.util.NautHashMap;
import mineplex.minecraft.game.classcombat.Class.ClientClass;
import mineplex.minecraft.game.classcombat.Class.IPvpClass;
import mineplex.minecraft.game.classcombat.shop.page.ArmorPage;
import mineplex.minecraft.game.classcombat.shop.page.CustomBuildPage;
@ -39,6 +40,39 @@ public class ClassCombatShop extends ShopBase<ClassShopManager>
return new ArmorPage(Plugin, this, ClientManager, DonationManager, player, Purchasing);
}
public boolean attemptShopOpen(Player player, IPvpClass pvpClass)
{
if (!OpenedShop.contains(player.getName()))
{
if (!CanOpenShop(player))
return false;
OpenedShop.add(player.getName());
OpenShopForPlayer(player);
if (!PlayerPageMap.containsKey(player.getName()))
{
PlayerPageMap.put(player.getName(), BuildPagesFor(player));
}
ClientClass clientClass = Plugin.GetClassManager().Get(player);
player.getInventory().clear();
clientClass.SetGameClass(pvpClass);
pvpClass.ApplyArmor(player);
clientClass.ClearDefaults();
OpenPageForPlayer(player, new CustomBuildPage(Plugin, this, ClientManager, DonationManager, player));
OpenPageForPlayer(player, GetOpeningPageForPlayer(player));
return true;
}
return false;
}
@Override
protected void OpenShopForPlayer(Player player)
{

View File

@ -552,7 +552,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
public void openClassShop(Player player, IPvpClass pvpClass)
{
_classCustomBuildShop.attemptShopOpen(player);
_classCustomBuildShop.attemptShopOpen(player, pvpClass);
}
@EventHandler

View File

@ -15,6 +15,7 @@ import mineplex.core.common.util.UtilPlayer;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.classcombat.shop.ClassCombatCustomBuildShop;
import mineplex.minecraft.game.classcombat.shop.ClassShopManager;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
@ -54,12 +55,11 @@ public class Champions extends TeamGame
new Kit[]
{
new KitWitherSkeleton(manager),
new KitBrute(manager),
new KitRanger(manager),
new KitKnight(manager),
new KitGolem(manager),
new KitSlime(manager),
new KitChicken(manager),
new KitSpider(manager),
new KitMage(manager),
new KitAssassin(manager),
},
new String[]
@ -76,7 +76,8 @@ public class Champions extends TeamGame
this.DeathSpectateSecs = 8;
_shop = new ClassCombatCustomBuildShop(null, null, manager.GetDonation(), "Class Setup");
_shop = manager.getClassShop();
}
@Override