From 5781009f4e3f405bd84756834aeed959d5cf939e Mon Sep 17 00:00:00 2001 From: Sarah Date: Mon, 10 Aug 2015 14:00:40 +0200 Subject: [PATCH] Improving animations and some text. --- .../mineplex/core/bonuses/BonusManager.java | 5 +- .../bonuses/animations/AnimationCarl.java | 50 +++++++++++++------ .../bonuses/commands/AnimationCommand.java | 3 ++ .../mineplex/core/bonuses/gui/BonusGui.java | 2 +- .../bonuses/gui/buttons/DailyBonusButton.java | 5 +- .../core/bonuses/gui/buttons/PollButton.java | 9 +++- .../bonuses/gui/buttons/RankBonusButton.java | 3 +- .../core/bonuses/gui/buttons/VoteButton.java | 4 +- 8 files changed, 58 insertions(+), 23 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java index d309308bd..2ad67f4b9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java @@ -251,7 +251,10 @@ public class BonusManager extends MiniClientPlugin implements I if (!_enabled) return; - if(_pendingExplosions.get(0) instanceof String) + if(_pendingExplosions.get(0) instanceof String + && !((String)_pendingExplosions.get(0)).contentEquals("RANK") + && !((String)_pendingExplosions.get(0)).contentEquals("DAILY") + && !((String)_pendingExplosions.get(0)).contentEquals("VOTE")) { String name = (String)_pendingExplosions.get(0); Bukkit.broadcastMessage("Recieved Vote: " + name); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/animations/AnimationCarl.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/animations/AnimationCarl.java index 89ec4d85d..3f1d4a43c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/animations/AnimationCarl.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/animations/AnimationCarl.java @@ -1,6 +1,7 @@ package mineplex.core.bonuses.animations; import mineplex.core.common.util.UtilAction; +import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.reward.Reward; import mineplex.core.reward.RewardData; import mineplex.core.treasure.animation.Animation; @@ -32,22 +33,43 @@ public class AnimationCarl extends Animation { if(_type instanceof String) { - if (getTicks() < 40) - { - Item gem = _creeper.getWorld().dropItem(_creeper.getLocation().add(0.5, 2, 0.5), new ItemStack(Material.EMERALD)); - - //Velocity - long passed = System.currentTimeMillis() - _startTime; - Vector vel = new Vector(Math.sin(passed/5d), 0, Math.cos(passed/5d)); - - UtilAction.velocity(gem, vel, Math.abs(Math.sin(passed/3000d)), false, 0, 0.2 + Math.abs(Math.cos(passed/3000d))*0.6, 1, false); - - gem.setTicksLived(1170); - } - else + if(((String) _type).contentEquals("DAILY")) { - finish(); + for (int i = 1; i < 60; i++) + { + Item gem = _creeper.getWorld().dropItem(_creeper.getLocation().add(0.5, 2, 0.5), ItemStackFactory.Instance.CreateStack(Material.EMERALD, (byte) 0, 1, "" + i)); + Item coin = _creeper.getWorld().dropItem(_creeper.getLocation().add(0.5, 2, 0.5), ItemStackFactory.Instance.CreateStack(Material.DOUBLE_PLANT, (byte) 0, 1, "" + i)); + Vector vel = new Vector(Math.sin(i * 7/5d), 0, Math.cos(i * 7/5d)); + UtilAction.velocity(gem, vel, Math.abs(Math.sin(i * 7/3000d)), false, 0, 0.2 + Math.abs(Math.cos(i * 7/3000d))*0.6, 1, false); + UtilAction.velocity(coin, vel, Math.abs(Math.sin(i * 8/3000d)), false, 0, 0.2 + Math.abs(Math.cos(i * 8/3000d))*0.6, 1, false); + coin.setTicksLived(1160); + gem.setTicksLived(1160); + } } + if(((String) _type).contentEquals("RANK")) + { + for (int i = 1; i < 100; i++) + { + Item coin = _creeper.getWorld().dropItem(_creeper.getLocation().add(0.5, 2, 0.5), ItemStackFactory.Instance.CreateStack(Material.DOUBLE_PLANT, (byte) 0, 1, "" + i)); + Vector vel = new Vector(Math.sin(i * 7/5d), 0, Math.cos(i * 7/5d)); + UtilAction.velocity(coin, vel, Math.abs(Math.sin(i * 7/3000d)), false, 0, 0.2 + Math.abs(Math.cos(i * 7/3000d))*0.6, 1, false); + coin.setTicksLived(1160); + } + } + if(!((String) _type).contentEquals("DAILY")&& !((String) _type).contentEquals("RANK")) + { + for (int i = 1; i < 60; i++) + { + Item gem = _creeper.getWorld().dropItem(_creeper.getLocation().add(0.5, 2, 0.5), ItemStackFactory.Instance.CreateStack(Material.EMERALD, (byte) 0, 1, "" + i)); + Item paper = _creeper.getWorld().dropItem(_creeper.getLocation().add(0.5, 2, 0.5), ItemStackFactory.Instance.CreateStack(Material.PAPER, (byte) 0, 1, "" + i)); + Vector vel = new Vector(Math.sin(i * 7/5d), 0, Math.cos(i * 7/5d)); + UtilAction.velocity(gem, vel, Math.abs(Math.sin(i * 7/3000d)), false, 0, 0.2 + Math.abs(Math.cos(i + 7/3000d))*0.6, 1, false); + UtilAction.velocity(paper, vel, Math.abs(Math.sin(i * 8/3000d)), false, 0, 0.2 + Math.abs(Math.cos(i + 8/3000d))*0.6, 1, false); + paper.setTicksLived(1160); + gem.setTicksLived(1160); + } + } + finish(); } if(_type instanceof Reward) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/commands/AnimationCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/commands/AnimationCommand.java index 0494fc2f0..262dbff1c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/commands/AnimationCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/commands/AnimationCommand.java @@ -23,6 +23,9 @@ public class AnimationCommand extends CommandBase{ _plugin.addPendingExplosion(caller, "Chiss"); _plugin.addPendingExplosion(caller, "Phinary"); _plugin.addPendingExplosion(caller, "xXVevzZXx"); + + _plugin.addPendingExplosion(caller, "RANK"); + _plugin.addPendingExplosion(caller, "DAILY"); } } \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/BonusGui.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/BonusGui.java index 48b2e0a6e..e54887dc8 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/BonusGui.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/BonusGui.java @@ -29,7 +29,7 @@ public class BonusGui extends SimpleGui setItem(14, new DailyBonusButton(getPlugin(), player, this, manager)); - setItem(16, new PollButton(getPlugin(), player, manager.getPollManager(), manager.getClientManager(), this)); + setItem(16, new PollButton(getPlugin(), player, manager.getPollManager(), manager.getClientManager(), this, manager)); setItem(31, new CarlSpinButton(getPlugin(), player, manager, rewardManager)); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/DailyBonusButton.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/DailyBonusButton.java index 897852d8d..8efb10fa5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/DailyBonusButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/DailyBonusButton.java @@ -86,6 +86,7 @@ public class DailyBonusButton implements GuiItem, Listener } else { UtilPlayer.message(getPlayer(), F.main("Bonus", "Bonus collected!")); } + _bonusManager.addPendingExplosion(getPlayer(), "DAILY"); getPlayer().playSound(getPlayer().getLocation(), Sound.NOTE_PLING, 1, 1.6f); } else { if (getPlayer().getOpenInventory() != null) { @@ -120,7 +121,7 @@ public class DailyBonusButton implements GuiItem, Listener if (isAvailable()) { material = Material.CHEST; - itemName = C.cGreen + C.Bold + "Daily Bonus"; + itemName = C.cGreen + C.Bold + "Daily Reward"; lore.add(" "); lore.add(ChatColor.RESET + "Click to Claim!"); @@ -128,7 +129,7 @@ public class DailyBonusButton implements GuiItem, Listener else { material = Material.REDSTONE_BLOCK; - itemName = C.cRed + C.Bold + "Daily Bonus"; + itemName = C.cRed + C.Bold + "Daily Reward"; lore.add(" "); lore.add(ChatColor.RESET + "Next reward in " + UtilTime.convertString(timeLeft(), 0, TimeUnit.FIT) + "!"); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/PollButton.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/PollButton.java index e669f2ad3..417a6b556 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/PollButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/PollButton.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.HashMap; import mineplex.core.account.CoreClientManager; +import mineplex.core.bonuses.BonusManager; import mineplex.core.common.util.C; import mineplex.core.common.util.UtilText; import mineplex.core.gui.GuiInventory; @@ -29,6 +30,7 @@ public class PollButton extends SimpleGui implements GuiItem { protected boolean _create; private PollManager _pollManager; + private BonusManager _bonusManager; private CoreClientManager _clientManager; private GuiInventory _master; @@ -36,7 +38,7 @@ public class PollButton extends SimpleGui implements GuiItem { private Poll _poll; - public PollButton(Plugin plugin, Player player, PollManager pollManager, CoreClientManager clientManager, GuiInventory master) + public PollButton(Plugin plugin, Player player, PollManager pollManager, CoreClientManager clientManager, GuiInventory master, BonusManager bonusManager) { super(plugin, player, "Poll:", 6 * 9); this._create = true; @@ -44,6 +46,7 @@ public class PollButton extends SimpleGui implements GuiItem { this._clientManager = clientManager; this._pollManager = pollManager; hard.put(0, new BackBotton(master)); + _bonusManager = bonusManager; } @Override @@ -75,7 +78,8 @@ public class PollButton extends SimpleGui implements GuiItem { ArrayList lore = new ArrayList<>(); if (_poll == null) { - lore.add(C.cRed + "You've voted on all of the polls!"); + lore.add(""); + lore.add(C.cWhite + "You've voted on all of the polls!"); return ItemStackFactory.Instance.CreateStack(Material.REDSTONE_BLOCK, (byte) 0, 1, ChatColor.RED + C.Bold + "Vote on Poll", lore); } else @@ -190,6 +194,7 @@ public class PollButton extends SimpleGui implements GuiItem { getPlayer().playSound(getPlayer().getLocation(), Sound.NOTE_PLING, 1, 1.6f); new TimedMessageWindow(getPlugin(), getPlayer(), ItemStackFactory.Instance.CreateStack(Material.EMERALD_BLOCK, (byte) 0, 1, ChatColor.GREEN + "Your anwser:", wrap(getPoll().getAnswers()[num])), ChatColor.GREEN + "Moo", 6 * 9, 50, getMaster()).openInventory(); + _bonusManager.addPendingExplosion(getPlayer(), "VOTE"); getPlayer().closeInventory(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/RankBonusButton.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/RankBonusButton.java index 21e6fd318..501840411 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/RankBonusButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/RankBonusButton.java @@ -99,6 +99,7 @@ public class RankBonusButton implements GuiItem, Listener { { UtilPlayer.message(getPlayer(), F.main("Bonus", "Bonus collected!")); } + _bonusManager.addPendingExplosion(getPlayer(), "RANK"); getPlayer().playSound(getPlayer().getLocation(), Sound.NOTE_PLING, 1, 1.6f); } else @@ -144,7 +145,7 @@ public class RankBonusButton implements GuiItem, Listener { if (!hasRank) { - material = Material.COAL_BLOCK; + material = Material.REDSTONE_BLOCK; itemName = C.cRed + ChatColor.BOLD + "Rank Monthly Bonus"; lore.add(" "); lore.add(ChatColor.WHITE + "Players with a Rank get a Monthly Bonus!"); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/VoteButton.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/VoteButton.java index da9360afc..b05c3dad0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/VoteButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/VoteButton.java @@ -108,7 +108,7 @@ public class VoteButton implements GuiItem, Listener { if (isAvailable()) { material = Material.JUKEBOX; - itemName = C.cGreen + C.Bold + "Vote Bonus"; + itemName = C.cGreen + C.Bold + "Vote for Mineplex"; lore.add(" "); lore.add(ChatColor.RESET + "Click to Vote!"); @@ -116,7 +116,7 @@ public class VoteButton implements GuiItem, Listener { else { material = Material.REDSTONE_BLOCK; - itemName = C.cRed + C.Bold + "Vote Bonus"; + itemName = C.cRed + C.Bold + "Vote for Mineplex"; lore.add(" "); lore.add(ChatColor.RESET + "Next vote in " + UtilTime.convertString(timeLeft(), 0, TimeUnit.FIT) + "!");