Merge branch 'master' of ssh://184.154.0.242:7999/min/mineplex
This commit is contained in:
commit
3fd312ff95
@ -0,0 +1,25 @@
|
||||
package mineplex.core.cosmetic.ui.button;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.cosmetic.ui.page.Menu;
|
||||
import mineplex.core.shop.item.SingleButton;
|
||||
|
||||
/**
|
||||
* Created by shaun on 14-09-15.
|
||||
*/
|
||||
public class OpenCostumes extends SingleButton
|
||||
{
|
||||
private Menu _menu;
|
||||
|
||||
public OpenCostumes(Menu menu)
|
||||
{
|
||||
_menu = menu;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Clicked(Player player)
|
||||
{
|
||||
_menu.openCostumes(player);
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package mineplex.core.cosmetic.ui.button;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.cosmetic.ui.page.Menu;
|
||||
import mineplex.core.shop.item.SingleButton;
|
||||
|
||||
/**
|
||||
* Created by shaun on 14-09-15.
|
||||
*/
|
||||
public class OpenMusic extends SingleButton
|
||||
{
|
||||
private Menu _menu;
|
||||
|
||||
public OpenMusic(Menu menu)
|
||||
{
|
||||
_menu = menu;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Clicked(Player player)
|
||||
{
|
||||
_menu.openMusic(player);
|
||||
}
|
||||
}
|
@ -3,12 +3,10 @@ package mineplex.core.cosmetic.ui.button;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.cosmetic.ui.page.Menu;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import mineplex.core.shop.item.SingleButton;
|
||||
|
||||
public class TreasureButton extends SingleButton
|
||||
{
|
||||
|
||||
private Menu _menu;
|
||||
|
||||
public TreasureButton(Menu menu)
|
||||
@ -16,11 +14,10 @@ public class TreasureButton extends SingleButton
|
||||
_menu = menu;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void Clicked(Player player)
|
||||
{
|
||||
_menu.openTreasure(player);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,114 @@
|
||||
package mineplex.core.cosmetic.ui.page;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.cosmetic.CosmeticManager;
|
||||
import mineplex.core.cosmetic.ui.CosmeticShop;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import mineplex.core.gadget.types.GadgetType;
|
||||
import mineplex.core.gadget.types.ItemGadget;
|
||||
import mineplex.core.gadget.types.OutfitGadget;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
import mineplex.core.shop.item.SingleButton;
|
||||
|
||||
/**
|
||||
* Created by shaun on 14-09-15.
|
||||
*/
|
||||
public class CostumePage extends GadgetPage
|
||||
{
|
||||
public CostumePage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player)
|
||||
{
|
||||
super(plugin, shop, clientManager, donationManager, name, player);
|
||||
|
||||
BuildPage();
|
||||
}
|
||||
|
||||
protected void BuildPage()
|
||||
{
|
||||
int slot;
|
||||
|
||||
List<Class> costumeClasses = new ArrayList<Class>();
|
||||
|
||||
for (Gadget gadget : Plugin.getGadgetManager().getGadgets(GadgetType.Costume))
|
||||
{
|
||||
OutfitGadget outfitGadget = ((OutfitGadget) gadget);
|
||||
Class clazz = gadget.getClass();
|
||||
|
||||
if (!costumeClasses.contains(clazz))
|
||||
{
|
||||
costumeClasses.add(clazz);
|
||||
}
|
||||
|
||||
slot = (costumeClasses.indexOf(clazz) * 2) + 3 + 18;
|
||||
|
||||
if (outfitGadget.GetSlot() == OutfitGadget.ArmorSlot.Chest)
|
||||
slot += 9;
|
||||
else if (outfitGadget.GetSlot() == OutfitGadget.ArmorSlot.Legs)
|
||||
slot += 18;
|
||||
else if (outfitGadget.GetSlot() == OutfitGadget.ArmorSlot.Boots)
|
||||
slot += 27;
|
||||
|
||||
addGadget(gadget, slot);
|
||||
|
||||
if (gadget.IsActive(Player))
|
||||
addGlow(slot);
|
||||
}
|
||||
|
||||
AddButton(8, new ShopItem(Material.TNT, C.cRed + C.Bold + "Remove all Clothing", new String[] { }, 1, false), new SingleButton()
|
||||
{
|
||||
@Override
|
||||
public void Clicked(Player player)
|
||||
{
|
||||
boolean gadgetDisabled = false;
|
||||
for (Gadget gadget : Plugin.getGadgetManager().getGadgets(GadgetType.Costume))
|
||||
{
|
||||
if (gadget.IsActive(player))
|
||||
{
|
||||
gadgetDisabled = true;
|
||||
gadget.Disable(player);
|
||||
}
|
||||
}
|
||||
|
||||
if (gadgetDisabled)
|
||||
{
|
||||
BuildPage();
|
||||
player.playSound(player.getEyeLocation(), Sound.SPLASH, 1, 1);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
AddButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[] { }, 1, false), new SingleButton()
|
||||
{
|
||||
@Override
|
||||
public void Clicked(Player player)
|
||||
{
|
||||
Shop.OpenPageForPlayer(Player, new Menu(Plugin, Shop, ClientManager, DonationManager, player));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void activateGadget(Player player, Gadget gadget)
|
||||
{
|
||||
if (gadget instanceof ItemGadget)
|
||||
{
|
||||
if (Plugin.getInventoryManager().Get(player).getItemCount(gadget.GetName()) <= 0)
|
||||
{
|
||||
purchaseGadget(player, gadget);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
PlayAcceptSound(player);
|
||||
gadget.Enable(player);
|
||||
|
||||
BuildPage();
|
||||
}
|
||||
}
|
@ -3,19 +3,19 @@ package mineplex.core.cosmetic.ui.page;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftItemStack;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.CurrencyType;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.cosmetic.CosmeticManager;
|
||||
import mineplex.core.cosmetic.event.ActivateGemBoosterEvent;
|
||||
import mineplex.core.cosmetic.ui.CosmeticShop;
|
||||
import mineplex.core.cosmetic.ui.button.OpenCostumes;
|
||||
import mineplex.core.cosmetic.ui.button.OpenGadgets;
|
||||
import mineplex.core.cosmetic.ui.button.OpenMorphs;
|
||||
import mineplex.core.cosmetic.ui.button.OpenMounts;
|
||||
import mineplex.core.cosmetic.ui.button.OpenMusic;
|
||||
import mineplex.core.cosmetic.ui.button.OpenParticles;
|
||||
import mineplex.core.cosmetic.ui.button.OpenPets;
|
||||
import mineplex.core.cosmetic.ui.button.TreasureButton;
|
||||
@ -42,29 +42,29 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
@Override
|
||||
protected void BuildPage()
|
||||
{
|
||||
AddItem(11, new ShopItem(175, DonationManager.Get(Player.getName()).getCoins() + " Coins", 1, false));
|
||||
AddItem(2, new ShopItem(175, DonationManager.Get(Player.getName()).getCoins() + " Coins", 1, false));
|
||||
|
||||
int treasureChestCount = Plugin.getInventoryManager().Get(Player).getItemCount("Treasure Chest");
|
||||
|
||||
if (treasureChestCount <= 0 && Player.getName().equals("Chiss"))
|
||||
if (treasureChestCount <= 0 && Player.getName().equals("Phinary"))
|
||||
{
|
||||
Plugin.getInventoryManager().addItemToInventory(Player, "Utility", "Treasure Chest", 1);
|
||||
treasureChestCount = Plugin.getInventoryManager().Get(Player).getItemCount("Treasure Chest");
|
||||
}
|
||||
|
||||
// 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));
|
||||
//}
|
||||
if (treasureChestCount > 0)
|
||||
{
|
||||
AddButton(4, 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(4, 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"));
|
||||
|
||||
|
||||
AddButton(15, new ShopItem(
|
||||
AddButton(6, new ShopItem(
|
||||
gemBoosterItem.GetDisplayMaterial(),
|
||||
gemBoosterItem.GetDisplayName(),
|
||||
gemBoosterItem.GetDescription(),
|
||||
@ -111,17 +111,20 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
false));
|
||||
}
|
||||
|
||||
AddButton(27, new ShopItem(Material.NETHER_STAR, "Particle Effects", 1, false), new OpenParticles(this));
|
||||
AddButton(29, new ShopItem(Material.BOW, "Gadgets", 1, false), new OpenGadgets(this));
|
||||
AddButton(31, new ShopItem(Material.LEATHER, "Morphs", 1, false), new OpenMorphs(this));
|
||||
AddButton(33, new ShopItem(Material.IRON_BARDING, "Mounts", 1, false), new OpenMounts(this));
|
||||
AddButton(35, new ShopItem(Material.BONE, "Pets", 1, false), new OpenPets(this));
|
||||
AddButton(18, new ShopItem(Material.NETHER_STAR, "Particle Effects", 1, false), new OpenParticles(this));
|
||||
AddButton(20, new ShopItem(Material.BOW, "Gadgets", 1, false), new OpenGadgets(this));
|
||||
AddButton(22, new ShopItem(Material.LEATHER, "Morphs", 1, false), new OpenMorphs(this));
|
||||
AddButton(24, new ShopItem(Material.IRON_BARDING, "Mounts", 1, false), new OpenMounts(this));
|
||||
AddButton(26, new ShopItem(Material.BONE, "Pets", 1, false), new OpenPets(this));
|
||||
//
|
||||
AddButton(48, new ShopItem(Material.GOLD_CHESTPLATE, "Costumes", 1, false), new OpenCostumes(this));
|
||||
AddButton(50, new ShopItem(Material.GREEN_RECORD, "Music", 1, false), new OpenMusic(this));
|
||||
|
||||
if (Plugin.getGadgetManager().getActive(Player, GadgetType.Particle) != null)
|
||||
{
|
||||
final Gadget gadget = Plugin.getGadgetManager().getActive(Player, GadgetType.Particle);
|
||||
|
||||
AddButton(36,
|
||||
AddButton(18 + 9,
|
||||
new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), ChatColor.RESET + C.mItem + gadget.GetName(), new String[] {}, 1, false, false),
|
||||
new SingleButton()
|
||||
{
|
||||
@ -139,7 +142,7 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
{
|
||||
final Gadget gadget = Plugin.getGadgetManager().getActive(Player, GadgetType.Item);
|
||||
|
||||
AddButton(38,
|
||||
AddButton(20 + 9,
|
||||
new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), ChatColor.RESET + C.mItem + gadget.GetName(), new String[] {}, 1, false, false),
|
||||
new SingleButton()
|
||||
{
|
||||
@ -157,7 +160,7 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
{
|
||||
final Gadget gadget = Plugin.getGadgetManager().getActive(Player, GadgetType.Morph);
|
||||
|
||||
AddButton(40,
|
||||
AddButton(22 + 9,
|
||||
new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), ChatColor.RESET + C.mItem + gadget.GetName(), new String[] {}, 1, false, false),
|
||||
new SingleButton()
|
||||
{
|
||||
@ -175,7 +178,7 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
{
|
||||
final Mount<?> mount = Plugin.getMountManager().getActive(Player);
|
||||
|
||||
AddButton(42,
|
||||
AddButton(24 + 9,
|
||||
new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), ChatColor.RESET + C.mItem + mount.GetName(), new String[] {}, 1, false, false),
|
||||
new SingleButton()
|
||||
{
|
||||
@ -191,7 +194,7 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
|
||||
if (Plugin.getPetManager().hasActivePet(Player.getName()))
|
||||
{
|
||||
AddButton(44, new ShopItem(Material.MONSTER_EGG, (byte)Plugin.getPetManager().getActivePet(Player.getName()).getType().getTypeId(), ChatColor.RESET + C.mItem + Plugin.getPetManager().getActivePet(Player.getName()).getCustomName(), new String[] {}, 1, false, false),
|
||||
AddButton(26 + 9, new ShopItem(Material.MONSTER_EGG, (byte)Plugin.getPetManager().getActivePet(Player.getName()).getType().getTypeId(), ChatColor.RESET + C.mItem + Plugin.getPetManager().getActivePet(Player.getName()).getCustomName(), new String[] {}, 1, false, false),
|
||||
new SingleButton()
|
||||
{
|
||||
@Override
|
||||
@ -222,11 +225,6 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
Shop.OpenPageForPlayer(player, new ParticlePage(Plugin, Shop, ClientManager, DonationManager, "Particles", player));
|
||||
}
|
||||
|
||||
public void openTreasure(Player player)
|
||||
{
|
||||
Shop.OpenPageForPlayer(player, new TreasurePage(Plugin, Shop, ClientManager, DonationManager, "Open Treasure Chest", player));
|
||||
}
|
||||
|
||||
public void openGadgets(Player player)
|
||||
{
|
||||
Shop.OpenPageForPlayer(player, new GadgetPage(Plugin, Shop, ClientManager, DonationManager, "Gadgets", player));
|
||||
@ -246,4 +244,14 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
{
|
||||
Shop.OpenPageForPlayer(player, new PetPage(Plugin, Shop, ClientManager, DonationManager, "Pets", player));
|
||||
}
|
||||
|
||||
public void openCostumes(Player player)
|
||||
{
|
||||
Shop.OpenPageForPlayer(player, new CostumePage(Plugin, Shop, ClientManager, DonationManager, "Costumes", player));
|
||||
}
|
||||
|
||||
public void openMusic(Player player)
|
||||
{
|
||||
Shop.OpenPageForPlayer(player, new MusicPage(Plugin, Shop, ClientManager, DonationManager, "Music", player));
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,56 @@
|
||||
package mineplex.core.cosmetic.ui.page;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.cosmetic.CosmeticManager;
|
||||
import mineplex.core.cosmetic.ui.CosmeticShop;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import mineplex.core.gadget.types.GadgetType;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
import mineplex.core.shop.item.SingleButton;
|
||||
|
||||
/**
|
||||
* Created by shaun on 14-09-15.
|
||||
*/
|
||||
public class MusicPage extends GadgetPage
|
||||
{
|
||||
public MusicPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player)
|
||||
{
|
||||
super(plugin, shop, clientManager, donationManager, name, player);
|
||||
}
|
||||
|
||||
protected void BuildPage()
|
||||
{
|
||||
int slot = 19;
|
||||
|
||||
for (Gadget gadget : Plugin.getGadgetManager().getGadgets(GadgetType.MusicDisc))
|
||||
{
|
||||
addGadget(gadget, slot);
|
||||
|
||||
slot++;
|
||||
|
||||
if (slot == 26)
|
||||
slot = 28;
|
||||
}
|
||||
|
||||
AddButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[] { }, 1, false), new SingleButton()
|
||||
{
|
||||
@Override
|
||||
public void Clicked(Player player)
|
||||
{
|
||||
Shop.OpenPageForPlayer(Player, new Menu(Plugin, Shop, ClientManager, DonationManager, player));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activateGadget(Player player, Gadget gadget)
|
||||
{
|
||||
super.activateGadget(player, gadget);
|
||||
player.closeInventory();
|
||||
}
|
||||
}
|
@ -5,7 +5,6 @@ import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
@ -26,13 +25,13 @@ import mineplex.core.disguise.DisguiseManager;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.gadget.event.GadgetCollideEntityEvent;
|
||||
import mineplex.core.gadget.gadgets.*;
|
||||
import mineplex.core.gadget.types.OutfitGadget.ArmorSlot;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import mineplex.core.gadget.types.GadgetType;
|
||||
import mineplex.core.gadget.types.ItemGadget;
|
||||
import mineplex.core.gadget.types.MorphGadget;
|
||||
import mineplex.core.gadget.types.OutfitGadget;
|
||||
import mineplex.core.gadget.types.MusicGadget;
|
||||
import mineplex.core.gadget.types.OutfitGadget;
|
||||
import mineplex.core.gadget.types.OutfitGadget.ArmorSlot;
|
||||
import mineplex.core.gadget.types.ParticleGadget;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
import mineplex.core.mount.MountManager;
|
||||
@ -178,7 +177,7 @@ public class GadgetManager extends MiniPlugin
|
||||
{
|
||||
for (Gadget gadget : _gadgets.get(gadgetType))
|
||||
{
|
||||
if (gadget instanceof MorphGadget)
|
||||
if (gadget instanceof OutfitGadget)
|
||||
{
|
||||
OutfitGadget armor = (OutfitGadget) gadget;
|
||||
|
||||
|
@ -5,17 +5,17 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
import mineplex.core.reward.rewards.CoinReward;
|
||||
import mineplex.core.reward.rewards.InventoryReward;
|
||||
import mineplex.core.reward.rewards.UnknownPackageReward;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
/**
|
||||
* Created by shaun on 2014-09-04.
|
||||
*/
|
||||
@ -44,9 +44,9 @@ public class RewardManager
|
||||
_doubleGadgetValue = doubleGadgetValue;
|
||||
|
||||
addCommon(donationManager, inventoryManager, commonValueMin, commonValueMax);
|
||||
addUncommon(donationManager, inventoryManager, commonValueMin, commonValueMax);
|
||||
addRare(donationManager, inventoryManager, commonValueMin, commonValueMax);
|
||||
addLegendary(donationManager, inventoryManager, commonValueMin, commonValueMax);
|
||||
addUncommon(donationManager, inventoryManager, uncommonValueMin, uncommonValueMax);
|
||||
addRare(donationManager, inventoryManager, rareValueMin, rareValueMax);
|
||||
addLegendary(donationManager, inventoryManager, legendValueMin, legendValueMax);
|
||||
}
|
||||
|
||||
public void addCommon(DonationManager donationManager, InventoryManager inventoryManager, double minValue, double maxValue)
|
||||
@ -261,12 +261,12 @@ public class RewardManager
|
||||
double rand = _random.nextDouble();
|
||||
RewardRarity rarity;
|
||||
|
||||
if (isChestOpening ? rand <= 0.01 : rand <= 0.0001)
|
||||
if (isChestOpening ? rand <= 0.91 : rand <= 0.0001)
|
||||
{
|
||||
// 1% or 0.01%
|
||||
rarity = RewardRarity.LEGENDARY;
|
||||
}
|
||||
else if (isChestOpening ? rand <= 0.05 : rand <= 0.001)
|
||||
else if (isChestOpening ? rand <= 0.95 : rand <= 0.001)
|
||||
{
|
||||
// 4% or 0.09%
|
||||
rarity = RewardRarity.RARE;
|
||||
|
@ -16,6 +16,7 @@ import org.bukkit.craftbukkit.v1_7_R4.util.CraftMagicNumbers;
|
||||
import org.bukkit.entity.Player;
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayOutBlockAction;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.reward.IReward;
|
||||
@ -264,12 +265,12 @@ public class Treasure
|
||||
else if (data.getReward().getRarity() == RewardRarity.RARE)
|
||||
{
|
||||
_animations.add(new RareAnimation(this, data.getBlock().getLocation().add(0.5, 1.5, 0.5)));
|
||||
Bukkit.broadcastMessage(F.main("Treasure", F.name(_player.getName()) + " opened the Rare treasure " + text));
|
||||
Bukkit.broadcastMessage(F.main("Treasure", F.name(_player.getName()) + " found " + C.cGold + "Rare " + text));
|
||||
}
|
||||
else if (data.getReward().getRarity() == RewardRarity.LEGENDARY)
|
||||
{
|
||||
_animations.add(new LegendaryAnimation(this, data.getBlock()));
|
||||
Bukkit.broadcastMessage(F.main("Treasure", F.name(_player.getName()) + " opened the Legendary treasure " + text));
|
||||
Bukkit.broadcastMessage(F.main("Treasure", F.name(_player.getName()) + " found " + C.cRed + "Legendary " + text));
|
||||
}
|
||||
|
||||
if (isFinished())
|
||||
@ -293,7 +294,6 @@ public class Treasure
|
||||
for (Player player : players)
|
||||
{
|
||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
|
||||
System.out.println("sending chest open packet");
|
||||
}
|
||||
|
||||
}
|
||||
@ -365,7 +365,7 @@ public class Treasure
|
||||
|
||||
if (block.getType().equals(Material.CHEST))
|
||||
{
|
||||
UtilParticle.PlayParticle(UtilParticle.ParticleType.EXPLODE, block.getLocation().add(0.5, 0.5, 0.5), 0F, 0F, 0F, 0F, 1);
|
||||
UtilParticle.PlayParticle(UtilParticle.ParticleType.LARGE_SMOKE, block.getLocation().add(0.5, 0.5, 0.5), 0.5F, 0.5F, 0.5F, 0.1F, 10);
|
||||
// block.getLocation().getWorld().createExplosion(block.getLocation().add(0.5, 0.5, 0.5), 0F);
|
||||
}
|
||||
block.getLocation().getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId());
|
||||
|
@ -9,6 +9,7 @@ import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.treasure.Treasure;
|
||||
|
||||
/**
|
||||
@ -38,13 +39,27 @@ public class LegendaryAnimation extends Animation
|
||||
// _chestBlock.getLocation().getWorld().playSound(_chestBlock.getLocation().add(0.5, 0.5, 0.5), Sound.WITHER_SPAWN, 10F, 1.2F);
|
||||
_chestBlock.getLocation().getWorld().playSound(_chestBlock.getLocation().add(0.5, 0.5, 0.5), Sound.ENDERDRAGON_DEATH, 10F, 2.0F);
|
||||
}
|
||||
if (getTicks() == 10)
|
||||
if (getTicks() == 20)
|
||||
{
|
||||
FireworkEffect effect = FireworkEffect.builder().with(FireworkEffect.Type.BALL_LARGE).withColor(Color.RED).withFade(Color.BLACK).build();
|
||||
UtilFirework.playFirework(_chestBlock.getLocation().add(0.5, 0.5, 0.5), effect);
|
||||
// ((CraftWorld) _chestBlock.getWorld()).getHandle().triggerEffect(1005, _chestBlock.getX(), _chestBlock.getY(), _chestBlock.getZ(), 2257);
|
||||
}
|
||||
else if (getTicks() < 10)
|
||||
else if (getTicks() < 15)
|
||||
{
|
||||
double radius = 2 - (getTicks() / 10D * 2);
|
||||
int particleAmount = 20 - (getTicks() * 2);
|
||||
Location _centerLocation = _chestBlock.getLocation().add(0.5, 0.1, 0.5);
|
||||
for (int i = 0; i < particleAmount; i++)
|
||||
{
|
||||
double xDiff = Math.sin(i/(double)particleAmount * 2 * Math.PI) * radius;
|
||||
double zDiff = Math.cos(i/(double)particleAmount * 2 * Math.PI) * radius;
|
||||
|
||||
Location location = _centerLocation.clone().add(xDiff, 0, zDiff);
|
||||
UtilParticle.PlayParticle(UtilParticle.ParticleType.CLOUD, location, 0, 0, 0, 0, 1);
|
||||
}
|
||||
}
|
||||
else if (getTicks() < 20)
|
||||
{
|
||||
double xDif = _random.nextGaussian() * 0.5;
|
||||
double zDif = _random.nextGaussian() * 0.5;
|
||||
|
@ -4,7 +4,6 @@ import org.bukkit.Color;
|
||||
import org.bukkit.FireworkEffect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
@ -41,6 +40,7 @@ public class RareAnimation extends Animation
|
||||
finish();
|
||||
}
|
||||
|
||||
{
|
||||
double currentRotation = getTicks() / 20D;
|
||||
double radius = currentRotation;
|
||||
double yDiff = currentRotation;
|
||||
@ -52,6 +52,18 @@ public class RareAnimation extends Animation
|
||||
UtilParticle.PlayParticle(UtilParticle.ParticleType.FLAME, location, 0, 0, 0, 0, 1);
|
||||
}
|
||||
|
||||
double radius = getTicks() / 20D;
|
||||
int particleAmount = getTicks() / 2;
|
||||
for (int i = 0; i < particleAmount; i++)
|
||||
{
|
||||
double xDiff = Math.sin(i/(double)particleAmount * 2 * Math.PI) * radius;
|
||||
double zDiff = Math.cos(i/(double)particleAmount * 2 * Math.PI) * radius;
|
||||
|
||||
Location location = _centerLocation.clone().add(xDiff, -1.3, zDiff);
|
||||
UtilParticle.PlayParticle(UtilParticle.ParticleType.FLAME, location, 0, 0, 0, 0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFinish()
|
||||
{
|
||||
|
@ -2,21 +2,12 @@ package mineplex.core.treasure.animation;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.FireworkEffect;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftFirework;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Firework;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityStatus;
|
||||
|
||||
import mineplex.core.common.util.FireworkUtil;
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.treasure.Treasure;
|
||||
|
||||
/**
|
||||
@ -41,22 +32,26 @@ public class UncommonAnimation extends Animation
|
||||
@Override
|
||||
protected void tick()
|
||||
{
|
||||
if (getTicks() >= 1)
|
||||
if (getTicks() >= 10)
|
||||
finish();
|
||||
|
||||
if (getTicks() % 10 == 0)
|
||||
if (getTicks() == 10)
|
||||
{
|
||||
double xDif = 0;//_random.nextGaussian() * 1;
|
||||
double zDif = 0;//_random.nextGaussian() * 1;
|
||||
double yDif = 2;//(_random.nextInt(3) * _random.nextDouble()) + 2;
|
||||
|
||||
FireworkEffect effect = FireworkEffect.builder().withColor(Color.fromRGB(_random.nextInt(255), _random.nextInt(255), _random.nextInt(255)))
|
||||
FireworkEffect effect = FireworkEffect.builder().withColor(Color.RED)
|
||||
.withFade(Color.fromRGB(_random.nextInt(255), _random.nextInt(255), _random.nextInt(255)))
|
||||
.with(FireworkEffect.Type.STAR)
|
||||
.build();
|
||||
|
||||
UtilFirework.playFirework(_block.getLocation().add(0.5, 0.5, 0.5).add(xDif, yDif, zDif), effect);
|
||||
}
|
||||
else if (getTicks() % 2 == 0)
|
||||
{
|
||||
UtilParticle.PlayParticle(UtilParticle.ParticleType.HEART, _block.getLocation().add(0.5, 1.2, 0.5), 0.5F, 0.2F, 0.5F, 0, 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user