Added Cosmetics to Arcade
Set prices on cosmetics
This commit is contained in:
parent
951e1df3d5
commit
ff6ea3c798
@ -3,6 +3,7 @@ package mineplex.core.cosmetic;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
@ -30,7 +31,8 @@ public class CosmeticManager extends MiniPlugin
|
||||
|
||||
private CosmeticShop _shop;
|
||||
|
||||
boolean _showInterface = true;
|
||||
private boolean _showInterface = true;
|
||||
private int _interfaceSlot = 4;
|
||||
|
||||
public CosmeticManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, GadgetManager gadgetManager, MountManager mountManager, PetManager petManager)
|
||||
{
|
||||
@ -55,9 +57,9 @@ public class CosmeticManager extends MiniPlugin
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
if (_showInterface)
|
||||
player.getInventory().setItem(4, ItemStackFactory.Instance.CreateStack(Material.CHEST, (byte)0, 1, ChatColor.RESET + C.cGreen + "Cosmetic Menu"));
|
||||
player.getInventory().setItem(_interfaceSlot, ItemStackFactory.Instance.CreateStack(Material.CHEST, (byte)0, 1, ChatColor.RESET + C.cGreen + "Cosmetic Menu"));
|
||||
else
|
||||
player.getInventory().setItem(4, null);
|
||||
player.getInventory().setItem(_interfaceSlot, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -68,7 +70,12 @@ public class CosmeticManager extends MiniPlugin
|
||||
if (!_showInterface)
|
||||
return;
|
||||
|
||||
event.getPlayer().getInventory().setItem(4, ItemStackFactory.Instance.CreateStack(Material.CHEST, (byte)0, 1, ChatColor.RESET + C.cGreen + "Cosmetic Menu"));
|
||||
giveInterfaceItem(event.getPlayer());
|
||||
}
|
||||
|
||||
public void giveInterfaceItem(Player player)
|
||||
{
|
||||
player.getInventory().setItem(_interfaceSlot, ItemStackFactory.Instance.CreateStack(Material.CHEST, (byte)0, 1, ChatColor.RESET + C.cGreen + "Cosmetic Menu"));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -86,7 +93,7 @@ public class CosmeticManager extends MiniPlugin
|
||||
if (event.getPlayer().isOnline())
|
||||
{
|
||||
event.getPlayer().getInventory().remove(Material.CHEST);
|
||||
event.getPlayer().getInventory().setItem(4, ItemStackFactory.Instance.CreateStack(Material.CHEST, (byte)0, 1, ChatColor.RESET + C.cGreen + "Inventory Menu"));
|
||||
event.getPlayer().getInventory().setItem(_interfaceSlot, ItemStackFactory.Instance.CreateStack(Material.CHEST, (byte)0, 1, ChatColor.RESET + C.cGreen + "Inventory Menu"));
|
||||
event.getPlayer().updateInventory();
|
||||
}
|
||||
}
|
||||
@ -127,4 +134,21 @@ public class CosmeticManager extends MiniPlugin
|
||||
{
|
||||
return _inventoryManager;
|
||||
}
|
||||
|
||||
public void setInterfaceSlot(int i)
|
||||
{
|
||||
_interfaceSlot = i;
|
||||
}
|
||||
|
||||
public void setShowInterface(boolean b)
|
||||
{
|
||||
_showInterface = b;
|
||||
}
|
||||
|
||||
public void disableItemsForGame()
|
||||
{
|
||||
_gadgetManager.DisableAll();
|
||||
_mountManager.DisableAll();
|
||||
_petManager.DisableAll();
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
@ -180,6 +181,9 @@ public class GadgetManager extends MiniPlugin
|
||||
{
|
||||
for (Gadget gadget : _gadgets.get(gadgetType))
|
||||
{
|
||||
if (gadget instanceof ParticleGadget)
|
||||
continue;
|
||||
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
gadget.Disable(player);
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ public class MorphChicken extends MorphGadget
|
||||
C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "Egg Shot",
|
||||
C.cYellow + "Double Jump" + C.cGray + " to use " + C.cGreen + "Flap",
|
||||
},
|
||||
-1,
|
||||
20000,
|
||||
ArmorSlot.Helmet, Material.FEATHER, (byte)0);
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ public class ParticleEnchant extends ParticleGadget
|
||||
C.cWhite + "attractive, and wants to",
|
||||
C.cWhite + "\'enchant\' you.",
|
||||
},
|
||||
-1,
|
||||
-2,
|
||||
Material.BOOK, (byte)0);
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ public class ParticleFireRings extends ParticleGadget
|
||||
C.cWhite + "of 1000 Blazes by the infamous",
|
||||
C.cWhite + "Flame King of the Nether realm.",
|
||||
},
|
||||
-1,
|
||||
-2,
|
||||
Material.BLAZE_POWDER, (byte)0);
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ public class ParticleFoot extends ParticleGadget
|
||||
C.cWhite + "shadow behind is the next",
|
||||
C.cWhite + "best thing.",
|
||||
},
|
||||
-1,
|
||||
-2,
|
||||
Material.LEATHER_BOOTS, (byte)0);
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ public class ParticleGreen extends ParticleGadget
|
||||
C.cWhite + "can now sparkle while you",
|
||||
C.cWhite + "sparkle with CaptainSparklez.",
|
||||
},
|
||||
-1,
|
||||
-2,
|
||||
Material.EMERALD, (byte)0);
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ public class ParticleHelix extends ParticleGadget
|
||||
C.cWhite + "empowers the blood of its user,",
|
||||
C.cWhite + "giving them godly powers.",
|
||||
},
|
||||
-1,
|
||||
-2,
|
||||
Material.REDSTONE, (byte)0);
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ public class ParticleRain extends ParticleGadget
|
||||
C.cWhite + "Now you never have to worry",
|
||||
C.cWhite + "about not being wet. Woo...",
|
||||
},
|
||||
-1,
|
||||
-2,
|
||||
Material.INK_SACK, (byte)4);
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Horse;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
@ -33,7 +33,7 @@ public class Frost extends HorseMount
|
||||
},
|
||||
Material.SNOW_BALL,
|
||||
(byte)0,
|
||||
30000,
|
||||
15000,
|
||||
Color.WHITE, Style.WHITE, Variant.HORSE, 1, null);
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ public class Mule extends HorseMount
|
||||
},
|
||||
Material.HAY_BLOCK,
|
||||
(byte)0,
|
||||
15000,
|
||||
3000,
|
||||
Color.BLACK, Style.BLACK_DOTS, Variant.MULE, 1.0, null);
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ public class Undead extends HorseMount
|
||||
},
|
||||
Material.BONE,
|
||||
(byte)0,
|
||||
30000,
|
||||
20000,
|
||||
Color.BLACK, Style.BLACK_DOTS, Variant.SKELETON_HORSE, 0.8, null);
|
||||
}
|
||||
|
||||
|
@ -30,13 +30,13 @@ public class PetFactory
|
||||
|
||||
private void CreatePets()
|
||||
{
|
||||
_pets.put(EntityType.PIG, new Pet("Pig", EntityType.PIG, 3000));
|
||||
_pets.put(EntityType.PIG, new Pet("Pig", EntityType.PIG, 5000));
|
||||
_pets.put(EntityType.SHEEP, new Pet("Sheep", EntityType.SHEEP, 3000));
|
||||
_pets.put(EntityType.COW, new Pet("Cow", EntityType.COW, 3000));
|
||||
_pets.put(EntityType.CHICKEN, new Pet("Chicken", EntityType.CHICKEN, 4000));
|
||||
_pets.put(EntityType.WOLF, new Pet("Dog", EntityType.WOLF, 5000));
|
||||
_pets.put(EntityType.OCELOT, new Pet("Cat", EntityType.OCELOT, 5000));
|
||||
_pets.put(EntityType.MUSHROOM_COW, new Pet("Mooshroom", EntityType.MUSHROOM_COW, 3000));
|
||||
_pets.put(EntityType.COW, new Pet("Cow", EntityType.COW, 2000));
|
||||
_pets.put(EntityType.CHICKEN, new Pet("Chicken", EntityType.CHICKEN, 7000));
|
||||
_pets.put(EntityType.WOLF, new Pet("Dog", EntityType.WOLF, 8000));
|
||||
_pets.put(EntityType.OCELOT, new Pet("Cat", EntityType.OCELOT, 6000));
|
||||
_pets.put(EntityType.MUSHROOM_COW, new Pet("Mooshroom", EntityType.MUSHROOM_COW, 5000));
|
||||
|
||||
List<PetSalesToken> petTokens = new ArrayList<PetSalesToken>();
|
||||
|
||||
|
@ -15,6 +15,7 @@ import mineplex.core.account.event.RetrieveClientInformationEvent;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import net.minecraft.server.v1_7_R3.EntityCreature;
|
||||
@ -384,4 +385,10 @@ public class PetManager extends MiniClientPlugin<PetClient>
|
||||
protected void loadClientInformation(RetrieveClientInformationEvent event)
|
||||
{
|
||||
}
|
||||
|
||||
public void DisableAll()
|
||||
{
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
RemovePet(player, true);
|
||||
}
|
||||
}
|
||||
|
@ -103,15 +103,16 @@ public class Arcade extends JavaPlugin
|
||||
AntiHack.Initialize(this, punish, portal);
|
||||
|
||||
BlockRestore blockRestore = new BlockRestore(this);
|
||||
|
||||
//Inventory
|
||||
InventoryManager inventoryManager = new InventoryManager(this);
|
||||
PetManager petManager = new PetManager(this, _clientManager, _donationManager, creature, webServerAddress);
|
||||
MountManager mountManager = new MountManager(this, _clientManager, _donationManager, blockRestore);
|
||||
|
||||
InventoryManager inventoryManager = new InventoryManager(this);
|
||||
GadgetManager gadgetManager = new GadgetManager(this, _clientManager, _donationManager, inventoryManager, mountManager, petManager, preferenceManager, disguiseManager, blockRestore);
|
||||
new CosmeticManager(this, _clientManager, _donationManager, inventoryManager, gadgetManager, mountManager, petManager);
|
||||
CosmeticManager cosmeticManager = new CosmeticManager(this, _clientManager, _donationManager, inventoryManager, gadgetManager, mountManager, petManager);
|
||||
|
||||
//Arcade Manager
|
||||
_gameManager = new ArcadeManager(this, serverStatusManager, ReadServerConfig(), _clientManager, _donationManager, _damageManager, disguiseManager, creature, teleport, new Blood(this), antistack, portal, packetHandler, preferenceManager, inventoryManager, webServerAddress);
|
||||
//Arcade Manager
|
||||
_gameManager = new ArcadeManager(this, serverStatusManager, ReadServerConfig(), _clientManager, _donationManager, _damageManager, disguiseManager, creature, teleport, new Blood(this), antistack, portal, packetHandler, preferenceManager, inventoryManager, cosmeticManager, webServerAddress);
|
||||
|
||||
new MemoryFix(this);
|
||||
|
||||
|
@ -61,6 +61,7 @@ import mineplex.core.blood.Blood;
|
||||
import mineplex.core.chat.Chat;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.*;
|
||||
import mineplex.core.cosmetic.CosmeticManager;
|
||||
import mineplex.core.creature.Creature;
|
||||
import mineplex.core.disguise.DisguiseManager;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
@ -107,6 +108,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
private GameWorldManager _gameWorldManager;
|
||||
private ServerStatusManager _serverStatusManager;
|
||||
private InventoryManager _inventoryManager;
|
||||
private CosmeticManager _cosmeticManager;
|
||||
|
||||
private AchievementManager _achievementManager;
|
||||
private StatsManager _statsManager;
|
||||
@ -117,8 +119,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
|
||||
private EloManager _eloManager;
|
||||
|
||||
private MiscManager _miscManager;
|
||||
|
||||
// Observers
|
||||
private HashSet<Player> _specList = new HashSet<Player>();
|
||||
|
||||
@ -131,7 +131,8 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
public ArcadeManager(Arcade plugin, ServerStatusManager serverStatusManager, GameServerConfig serverConfig,
|
||||
CoreClientManager clientManager, DonationManager donationManager, DamageManager damageManager,
|
||||
DisguiseManager disguiseManager, Creature creature, Teleport teleport, Blood blood, AntiStack antistack,
|
||||
Portal portal, PacketHandler packetHandler, PreferencesManager preferences, InventoryManager inventoryManager, String webAddress)
|
||||
Portal portal, PacketHandler packetHandler, PreferencesManager preferences, InventoryManager inventoryManager,
|
||||
CosmeticManager cosmeticManager, String webAddress)
|
||||
{
|
||||
super("Game Manager", plugin);
|
||||
|
||||
@ -203,6 +204,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
_statsManager = new StatsManager(plugin);
|
||||
_achievementManager = new AchievementManager(_statsManager);
|
||||
_inventoryManager = inventoryManager;
|
||||
_cosmeticManager = cosmeticManager;
|
||||
_portal = portal;
|
||||
|
||||
// Shop
|
||||
@ -221,7 +223,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
new GamePlayerManager(this);
|
||||
new GameAchievementManager(this);
|
||||
_gameWorldManager = new GameWorldManager(this);
|
||||
_miscManager = new MiscManager(this);
|
||||
new MiscManager(this);
|
||||
new IdleManager(this);
|
||||
|
||||
// Game Addons
|
||||
@ -287,6 +289,11 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
return _creature;
|
||||
}
|
||||
|
||||
public CosmeticManager getCosmeticManager()
|
||||
{
|
||||
return _cosmeticManager;
|
||||
}
|
||||
|
||||
public DisguiseManager GetDisguise()
|
||||
{
|
||||
return _disguiseManager;
|
||||
@ -803,4 +810,19 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
{
|
||||
return _inventoryManager;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void cosmeticState(GameStateChangeEvent event)
|
||||
{
|
||||
//Disable
|
||||
if (event.GetState() == GameState.Recruit)
|
||||
{
|
||||
getCosmeticManager().setShowInterface(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
getCosmeticManager().setShowInterface(false);
|
||||
getCosmeticManager().disableItemsForGame();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ public class KitChicken extends SmashKit
|
||||
{
|
||||
public KitChicken(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Chicken", KitAvailability.Green, 10000,
|
||||
super(manager, "Chicken", KitAvailability.Green, 8000,
|
||||
|
||||
new String[]
|
||||
{
|
||||
|
@ -34,7 +34,7 @@ public class KitEnderman extends SmashKit
|
||||
|
||||
public KitEnderman(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Enderman", KitAvailability.Green, 4000,
|
||||
super(manager, "Enderman", KitAvailability.Green, 3000,
|
||||
|
||||
new String[]
|
||||
{
|
||||
|
@ -22,7 +22,7 @@ public class KitSkySquid extends SmashKit
|
||||
{
|
||||
public KitSkySquid(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Sky Squid", KitAvailability.Green, 5000,
|
||||
super(manager, "Sky Squid", KitAvailability.Green, 3000,
|
||||
|
||||
new String[]
|
||||
{
|
||||
@ -41,7 +41,7 @@ public class KitSkySquid extends SmashKit
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
{
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1,
|
||||
C.cYellow + C.Bold + "Hold/Release Block" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Super Squid",
|
||||
new String[]
|
||||
|
@ -26,7 +26,7 @@ public class KitWitch extends SmashKit
|
||||
{
|
||||
public KitWitch(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Witch", KitAvailability.Green, 5000,
|
||||
super(manager, "Witch", KitAvailability.Green, 6000,
|
||||
|
||||
new String[]
|
||||
{
|
||||
|
@ -22,7 +22,7 @@ public class KitWolf extends SmashKit
|
||||
{
|
||||
public KitWolf(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Wolf", KitAvailability.Green, 3000,
|
||||
super(manager, "Wolf", KitAvailability.Green, 4000,
|
||||
|
||||
new String[]
|
||||
{
|
||||
|
@ -105,7 +105,7 @@ public class PerkInkBlast extends Perk implements IThrown
|
||||
DamageCause.PROJECTILE, 2.5, true, true, false,
|
||||
UtilEnt.getName(data.GetThrower()), GetName());
|
||||
|
||||
Manager.GetCondition().Factory().Blind(GetName(), target, data.GetThrower(), 2.5, 0, false, false, false);
|
||||
Manager.GetCondition().Factory().Blind(GetName(), target, data.GetThrower(), 1.5, 0, false, false, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -29,6 +29,7 @@ import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityCombustEvent;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.scoreboard.DisplaySlot;
|
||||
@ -678,9 +679,6 @@ public class GameLobbyManager implements IPacketRunnable, Listener
|
||||
if (event.getType() == UpdateType.FASTEST)
|
||||
UpdateFirework();
|
||||
|
||||
if (event.getType() == UpdateType.SEC)
|
||||
RemoveInvalidEnts();
|
||||
|
||||
if (event.getType() == UpdateType.SLOW)
|
||||
UpdateAdvertise();
|
||||
|
||||
@ -688,8 +686,12 @@ public class GameLobbyManager implements IPacketRunnable, Listener
|
||||
ScoreboardSet(event);
|
||||
}
|
||||
|
||||
private void RemoveInvalidEnts()
|
||||
@EventHandler
|
||||
private void RemoveInvalidEnts(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.Recruit)
|
||||
return;
|
||||
|
||||
for (Entity ent : UtilWorld.getWorld("world").getEntities())
|
||||
{
|
||||
if (ent instanceof Creature || ent instanceof Slime)
|
||||
@ -1108,27 +1110,28 @@ public class GameLobbyManager implements IPacketRunnable, Listener
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void gemBoosterMovement(InventoryClickEvent event)
|
||||
public void disallowInventoryClick(InventoryClickEvent event)
|
||||
{
|
||||
if (Manager.IsTournamentServer())
|
||||
return;
|
||||
|
||||
if (Manager.GetGame() == null)
|
||||
return;
|
||||
|
||||
if (Manager.GetGame().GetState() != GameState.Recruit)
|
||||
return;
|
||||
|
||||
UtilInv.DisallowMovementOf(event, C.cGreen + "Gem Booster", Material.EMERALD, (byte)0, true);
|
||||
if (event.getInventory().getType() == InventoryType.CRAFTING)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
event.getWhoClicked().closeInventory();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void GemBoosterUpdate(UpdateEvent event)
|
||||
public void InventoryUpdate(UpdateEvent event)
|
||||
{
|
||||
if (Manager.IsTournamentServer())
|
||||
return;
|
||||
|
||||
if (event.getType() != UpdateType.SEC)
|
||||
if (event.getType() != UpdateType.FASTER)
|
||||
return;
|
||||
|
||||
if (Manager.GetGame() == null)
|
||||
@ -1139,10 +1142,13 @@ public class GameLobbyManager implements IPacketRunnable, Listener
|
||||
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
int boosters = Manager.getInventoryManager().Get(player).getItemCount("Gem Booster");
|
||||
//Cosmetic Menu
|
||||
Manager.getCosmeticManager().giveInterfaceItem(player);
|
||||
|
||||
//Emerald
|
||||
int boosters = Manager.getInventoryManager().Get(player).getItemCount("Gem Booster");
|
||||
player.getInventory().setItem(
|
||||
7,
|
||||
6,
|
||||
ItemStackFactory.Instance.CreateStack(Material.EMERALD, (byte) 0, Math.max(1, boosters), (short) 0, C.cGreen
|
||||
+ boosters + " Gem Boosters" +
|
||||
(Manager.GetGame().GemBoosters.size() < 4 && boosters > 0 ?
|
||||
|
Loading…
Reference in New Issue
Block a user