Merge branch 'master' of ssh://184.154.0.242:7999/min/Mineplex

This commit is contained in:
Jonathan Williams 2014-09-12 22:00:18 -10:00
commit 7ad7dd939d
5 changed files with 177 additions and 63 deletions

View File

@ -18,6 +18,7 @@ import mineplex.core.cosmetic.ui.button.OpenMorphs;
import mineplex.core.cosmetic.ui.button.OpenMounts;
import mineplex.core.cosmetic.ui.button.OpenParticles;
import mineplex.core.cosmetic.ui.button.OpenPets;
import mineplex.core.cosmetic.ui.button.TreasureButton;
import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType;
@ -44,15 +45,20 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
AddItem(11, new ShopItem(175, DonationManager.Get(Player.getName()).getCoins() + " Coins", 1, false));
int treasureChestCount = Plugin.getInventoryManager().Get(Player).getItemCount("Treasure Chest");
/*
if (treasureChestCount >= 0)
if (treasureChestCount <= 0 && Player.getName().equals("Chiss"))
{
AddButton(13, new ShopItem(Material.CHEST, C.cGold + treasureChestCount + " Treasure Chests", new String[] { ChatColor.RESET + "Click to Open Treasure Chest" }, 1, false), new TreasureButton(this));
Plugin.getInventoryManager().addItemToInventory(Player, "Utility", "Treasure Chest", 1);
treasureChestCount = Plugin.getInventoryManager().Get(Player).getItemCount("Treasure Chest");
}
else
{
*/
AddItem(13, new ShopItem(Material.CHEST, ChatColor.RESET + C.cGold + treasureChestCount + " Treasure Chests (COMING SOON!)" + ChatColor.RESET, 1, false));
// if (treasureChestCount > 0)
// {
// AddButton(13, new ShopItem(Material.CHEST, C.cGold + treasureChestCount + " Treasure Chests", new String[] { ChatColor.RESET + "Click to Open Treasure Chest" }, 1, false), new TreasureButton(this));
// }
// else
// {
AddItem(13, new ShopItem(Material.CHEST, ChatColor.RESET + C.cGold + treasureChestCount + " Treasure Chests" + ChatColor.RESET, new String[] { ChatColor.RESET + "Coming soon..." }, 1, false));
//}
final GemBooster gemBoosterItem = new GemBooster(Shop.getBoosterEnabled(), Plugin.getInventoryManager().Get(Player).getItemCount("Gem Booster"));

View File

@ -6,6 +6,7 @@ import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
@ -58,63 +59,158 @@ public class TreasureManager extends MiniPlugin
_inventoryManager = inventoryManager;
// Very Rare
_rewardManager.addReward(new CoinReward(donationManager, 1000, 2000, 1000, RewardRarity.VERY_RARE));
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Helix Particles", "Blood Helix",
new ItemStack(Material.REDSTONE), RewardRarity.VERY_RARE, 100));
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Enchant Particles", "Enchanted",
new ItemStack(Material.BOOK), RewardRarity.VERY_RARE, 1000));
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Fire Rings Particles", "Flame Rings",
new ItemStack(Material.BLAZE_POWDER), RewardRarity.VERY_RARE, 600));
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Foot Particles", "Shadow Walk",
new ItemStack(Material.LEATHER_BOOTS), RewardRarity.VERY_RARE, 1200));
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Green Particles", "Green Ring",
new ItemStack(Material.EMERALD), RewardRarity.VERY_RARE, 200));
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Rain Particles", "Rain Cloud",
new ItemStack(Material.INK_SACK), RewardRarity.VERY_RARE, 300));
// _rewardManager.addReward(new UnknownPackageReward(donationManager, "Notch Morph", "Notch",
// new ItemStack(Material.INK_SACK), RewardRarity.VERY_RARE, 10));
_rewardManager.addReward(new InventoryReward(inventoryManager, "Gem Boosters", "Gem Booster", 50, 100,
new ItemStack(Material.EMERALD_BLOCK), RewardRarity.VERY_RARE, 500));
{
// Coins
{
_rewardManager.addReward(new CoinReward(donationManager, 2000, 5000, 25, RewardRarity.VERY_RARE));
}
// Mounts
{
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Infernal Horror", "Infernal Horror",
new ItemStack(Material.BONE), RewardRarity.VERY_RARE, 33));
}
// Morphs
{
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Block Morph", "Block Morph",
new ItemStack(Material.EMERALD_BLOCK), RewardRarity.VERY_RARE, 20));
}
// Particles
{
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Shadow Walk Particles", "Shadow Walk",
new ItemStack(Material.LEATHER_BOOTS), RewardRarity.VERY_RARE, 33));
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Enchanted Particles", "Enchanted",
new ItemStack(Material.BOOK), RewardRarity.VERY_RARE, 25));
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Flame Rings Particles", "Flame Rings",
new ItemStack(Material.BLAZE_POWDER), RewardRarity.VERY_RARE, 17));
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Rain Cloud Particles", "Rain Cloud",
new ItemStack(Material.INK_SACK, 1, (short) 0, (byte) 4), RewardRarity.VERY_RARE, 13));
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Blood Helix Particles", "Blood Helix",
new ItemStack(Material.REDSTONE), RewardRarity.VERY_RARE, 10));
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Emerald Twirl Particles", "Green Ring",
new ItemStack(Material.EMERALD), RewardRarity.VERY_RARE, 8));
}
}
// Rare
_rewardManager.addReward(new CoinReward(donationManager, 500, 1000, 1000, RewardRarity.RARE));
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Bat Morph", "Bat Morph",
new ItemStack(Material.SKULL_ITEM, 1, (short) 0, (byte) 1), RewardRarity.RARE, 100));
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Block Morph", "Block Morph",
new ItemStack(Material.EMERALD_BLOCK), RewardRarity.RARE, 200));
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Chicken Morph", "Chicken Morph",
new ItemStack(Material.FEATHER), RewardRarity.RARE, 300));
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Cow Morph", "Cow Morph",
new ItemStack(Material.LEATHER), RewardRarity.RARE, 500));
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Enderman Morph", "Enderman Morph",
new ItemStack(Material.ENDER_PEARL), RewardRarity.RARE, 200));
_rewardManager.addReward(new InventoryReward(inventoryManager, "Gem Boosters", "Gem Booster", 10, 20,
new ItemStack(Material.EMERALD_BLOCK), RewardRarity.RARE, 500));
{
// Coins
{
_rewardManager.addReward(new CoinReward(donationManager, 1000, 2000, 100, RewardRarity.RARE));
}
// Gadgets
{
_rewardManager.addReward(new InventoryReward(inventoryManager, "Paintball Gun Ammo", "Paintball Gun", 200, 400,
new ItemStack(Material.GOLD_BARDING), RewardRarity.RARE, 100));
_rewardManager.addReward(new InventoryReward(inventoryManager, "Fireworks", "Fireworks",100, 200,
new ItemStack(Material.FIREWORK), RewardRarity.RARE, 100));
_rewardManager.addReward(new InventoryReward(inventoryManager, "Melon Launcher Ammo", "Melon Launcher", 100, 200,
new ItemStack(Material.MELON_BLOCK), RewardRarity.RARE, 100));
_rewardManager.addReward(new InventoryReward(inventoryManager, "Flesh Hook Ammo", "Flesh Hook", 80, 160,
new ItemStack(Material.getMaterial(131)), RewardRarity.RARE, 100));
_rewardManager.addReward(new InventoryReward(inventoryManager, "Ethereal Pearls", "Ethereal Pearl", 60, 120,
new ItemStack(Material.ENDER_PEARL), RewardRarity.RARE, 100));
_rewardManager.addReward(new InventoryReward(inventoryManager, "Bat Blaster Ammo", "Bat Blaster", 40, 80,
new ItemStack(Material.IRON_BARDING), RewardRarity.RARE, 100));
_rewardManager.addReward(new InventoryReward(inventoryManager, "TNT", "TNT", 40, 80,
new ItemStack(Material.TNT), RewardRarity.RARE, 100));
_rewardManager.addReward(new InventoryReward(inventoryManager, "Coin Party Bomb", "Coin Party Bomb", 1, 1,
new ItemStack(Material.getMaterial(175)), RewardRarity.RARE, 100));
}
// Pets
{
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Chicken Pet", "Chicken",
new ItemStack(Material.MONSTER_EGG, 1, EntityType.CHICKEN.getTypeId()), RewardRarity.RARE, 143));
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Wolf Pet", "Wolf",
new ItemStack(Material.MONSTER_EGG, 1, EntityType.WOLF.getTypeId()), RewardRarity.RARE, 125));
}
// Mounts
{
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Mount Mule", "Mount Mule",
new ItemStack(Material.HAY_BLOCK), RewardRarity.RARE, 200));
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Minecart Mount", "Minecart",
new ItemStack(Material.MINECART), RewardRarity.RARE, 100));
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Slime Mount", "Slime Mount",
new ItemStack(Material.SLIME_BALL), RewardRarity.RARE, 67));
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Glacial Steed", "Glacial Steed",
new ItemStack(Material.SNOW_BALL), RewardRarity.RARE, 50));
}
// Morphs
{
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Cow Morph", "Cow Morph",
new ItemStack(Material.LEATHER), RewardRarity.RARE, 167));
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Villager Morph", "Villager Morph",
new ItemStack(Material.EMERALD), RewardRarity.RARE, 83));
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Chicken Morph", "Chicken Morph",
new ItemStack(Material.FEATHER), RewardRarity.RARE, 50));
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Enderman Morph", "Enderman Morph",
new ItemStack(Material.ENDER_PEARL), RewardRarity.RARE, 33));
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Bat Morph", "Bat Morph",
new ItemStack(Material.SKULL_ITEM, 1, (short) 0, (byte) 1), RewardRarity.RARE, 25));
}
}
// Uncommon
_rewardManager.addReward(new CoinReward(donationManager, 100, 500, 2000, RewardRarity.UNCOMMON));
_rewardManager.addReward(new InventoryReward(inventoryManager, "Ender Pearls", "Ethereal Pearl", 75, 150,
new ItemStack(Material.ENDER_PEARL), RewardRarity.UNCOMMON, 1000));
_rewardManager.addReward(new InventoryReward(inventoryManager, "Fireworks", "Fireworks", 75, 150,
new ItemStack(Material.FIREWORK), RewardRarity.UNCOMMON, 1000));
_rewardManager.addReward(new InventoryReward(inventoryManager, "TNT", "TNT", 30, 60,
new ItemStack(Material.TNT), RewardRarity.UNCOMMON, 1000));
_rewardManager.addReward(new InventoryReward(inventoryManager, "Melons", "Melon Launcher", 150, 300,
new ItemStack(Material.MELON_BLOCK), RewardRarity.UNCOMMON, 1000));
_rewardManager.addReward(new InventoryReward(inventoryManager, "Gem Boosters", "Gem Booster", 1, 10,
new ItemStack(Material.EMERALD_BLOCK), RewardRarity.UNCOMMON, 500));
{
// Coins
{
_rewardManager.addReward(new CoinReward(donationManager, 500, 1000, 250, RewardRarity.UNCOMMON));
}
// Gadgets
{
_rewardManager.addReward(new InventoryReward(inventoryManager, "Paintball Gun Ammo", "Paintball Gun", 100, 200,
new ItemStack(Material.GOLD_BARDING), RewardRarity.UNCOMMON, 250));
_rewardManager.addReward(new InventoryReward(inventoryManager, "Fireworks", "Fireworks", 50, 100,
new ItemStack(Material.FIREWORK), RewardRarity.UNCOMMON, 250));
_rewardManager.addReward(new InventoryReward(inventoryManager, "Melon Launcher Ammo", "Melon Launcher", 50, 100,
new ItemStack(Material.MELON_BLOCK), RewardRarity.UNCOMMON, 250));
_rewardManager.addReward(new InventoryReward(inventoryManager, "Flesh Hook Ammo", "Flesh Hook", 40, 80,
new ItemStack(Material.getMaterial(131)), RewardRarity.UNCOMMON, 250));
_rewardManager.addReward(new InventoryReward(inventoryManager, "Ethereal Pearls", "Ethereal Pearl", 30, 60,
new ItemStack(Material.ENDER_PEARL), RewardRarity.UNCOMMON, 250));
_rewardManager.addReward(new InventoryReward(inventoryManager, "Bat Blaster Ammo", "Bat Blaster", 20, 40,
new ItemStack(Material.IRON_BARDING), RewardRarity.UNCOMMON, 250));
_rewardManager.addReward(new InventoryReward(inventoryManager, "TNT", "TNT", 20, 40,
new ItemStack(Material.TNT), RewardRarity.UNCOMMON, 250));
}
// Pets
{
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Cow Pet", "Cow",
new ItemStack(Material.MONSTER_EGG, 1, EntityType.COW.getTypeId()), RewardRarity.UNCOMMON, 500));
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Sheep Pet", "Sheep",
new ItemStack(Material.MONSTER_EGG, 1, EntityType.SHEEP.getTypeId()), RewardRarity.UNCOMMON, 333));
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Mooshroom Pet", "Mooshroom",
new ItemStack(Material.MONSTER_EGG, 1, EntityType.MUSHROOM_COW.getTypeId()), RewardRarity.UNCOMMON, 200));
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Pig Pet", "Pig",
new ItemStack(Material.MONSTER_EGG, 1, EntityType.PIG.getTypeId()), RewardRarity.UNCOMMON, 200));
_rewardManager.addReward(new UnknownPackageReward(donationManager, "Ocelot Pet", "Ocelot",
new ItemStack(Material.MONSTER_EGG, 1, EntityType.OCELOT.getTypeId()), RewardRarity.UNCOMMON, 167));
}
}
// Common
_rewardManager.addReward(new CoinReward(donationManager, 0, 100, 2000, RewardRarity.COMMON));
_rewardManager.addReward(new InventoryReward(inventoryManager, "Ender Pearls", "Ethereal Pearl", 25, 75,
new ItemStack(Material.ENDER_PEARL), RewardRarity.COMMON, 1000));
_rewardManager.addReward(new InventoryReward(inventoryManager, "Fireworks", "Fireworks", 25, 75,
new ItemStack(Material.FIREWORK), RewardRarity.COMMON, 1000));
_rewardManager.addReward(new InventoryReward(inventoryManager, "TNT", "TNT", 10, 30,
new ItemStack(Material.TNT), RewardRarity.COMMON, 1000));
_rewardManager.addReward(new InventoryReward(inventoryManager, "Melons", "Melon Launcher", 50, 150,
new ItemStack(Material.MELON_BLOCK), RewardRarity.COMMON, 1000));
{
// Coins
{
_rewardManager.addReward(new CoinReward(donationManager, 250, 500, 1, RewardRarity.COMMON));
}
// Gadgets
{
_rewardManager.addReward(new InventoryReward(inventoryManager, "Paintball Gun Ammo", "Paintball Gun", 50, 100,
new ItemStack(Material.GOLD_BARDING), RewardRarity.COMMON, 1));
_rewardManager.addReward(new InventoryReward(inventoryManager, "Fireworks", "Fireworks", 25, 50,
new ItemStack(Material.FIREWORK), RewardRarity.COMMON, 1));
_rewardManager.addReward(new InventoryReward(inventoryManager, "Melon Launcher Ammo", "Melon Launcher", 25, 50,
new ItemStack(Material.MELON_BLOCK), RewardRarity.COMMON, 1));
_rewardManager.addReward(new InventoryReward(inventoryManager, "Flesh Hook Ammo", "Flesh Hook", 20, 40,
new ItemStack(Material.getMaterial(131)), RewardRarity.COMMON, 1));
_rewardManager.addReward(new InventoryReward(inventoryManager, "Ethereal Pearls", "Ethereal Pearl", 15, 30,
new ItemStack(Material.ENDER_PEARL), RewardRarity.COMMON, 1));
_rewardManager.addReward(new InventoryReward(inventoryManager, "Bat Blaster Ammo", "Bat Blaster", 10, 20,
new ItemStack(Material.IRON_BARDING), RewardRarity.COMMON, 1));
_rewardManager.addReward(new InventoryReward(inventoryManager, "TNT", "TNT", 10, 20,
new ItemStack(Material.TNT), RewardRarity.COMMON, 1));
}
}
}
@Override
@ -295,8 +391,11 @@ public class TreasureManager extends MiniPlugin
@EventHandler
public void command(PlayerCommandPreprocessEvent event)
{
if (!event.getPlayer().isOp())
return;
//TODO Remove
if (event.getMessage().startsWith("/treasure"))
if (event.getMessage().startsWith("/treasuredebug"))
{
event.getPlayer().sendMessage("Attempting to open treasure...");
attemptOpenTreasure(event.getPlayer());

View File

@ -55,7 +55,7 @@ public class FireworksAnimation extends Animation
.with(FireworkEffect.Type.STAR)
.build();
UtilFirework.playFirework(_block.getLocation().add(xDif, yDif, zDif), effect);
UtilFirework.playFirework(_block.getLocation().add(0.5, 0.5, 0.5).add(xDif, yDif, zDif), effect);
}
}

View File

@ -25,9 +25,9 @@ public class CoinReward extends AbstractReward
private int _minCoinCount;
private int _maxCoinCount;
public CoinReward(DonationManager donationManager, int minGemCount, int maxGemCount, int weight, RewardRarity rarity)
public CoinReward(DonationManager donationManager, int minCoinCount, int maxCoinCount, int weight, RewardRarity rarity)
{
this(donationManager, minGemCount, maxGemCount, weight, rarity, RANDOM);
this(donationManager, minCoinCount, maxCoinCount, weight, rarity, RANDOM);
}
public CoinReward(DonationManager donationManager, int minCoinCount, int maxCoinCount, int weight, RewardRarity rarity, Random random)

View File

@ -43,7 +43,16 @@ public class InventoryReward extends AbstractReward
@Override
public String giveReward(Player player)
{
int amountToGive = _random.nextInt(_maxAmount - _minAmount) + _minAmount;
int amountToGive;
if (_minAmount > _maxAmount)
{
amountToGive = _random.nextInt(_maxAmount - _minAmount) + _minAmount;
}
else
{
amountToGive = _minAmount;
}
_inventoryManager.addItemToInventory(player, "Item", _packageName, amountToGive);