Merge branch 'Bonus' of ssh://184.154.0.242:7999/min/mineplex into Bonus

This commit is contained in:
Mini-Chiss 2015-08-10 14:51:39 +02:00
commit db70df1bf4
8 changed files with 58 additions and 23 deletions

View File

@ -251,7 +251,10 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> 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);

View File

@ -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)
{

View File

@ -23,6 +23,9 @@ public class AnimationCommand extends CommandBase<BonusManager>{
_plugin.addPendingExplosion(caller, "Chiss");
_plugin.addPendingExplosion(caller, "Phinary");
_plugin.addPendingExplosion(caller, "xXVevzZXx");
_plugin.addPendingExplosion(caller, "RANK");
_plugin.addPendingExplosion(caller, "DAILY");
}
}

View File

@ -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));
}

View File

@ -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) + "!");

View File

@ -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<String> 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();
}

View File

@ -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!");

View File

@ -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) + "!");