Valentines changes
This commit is contained in:
parent
4f0f81c8df
commit
dfd61833b7
@ -136,6 +136,7 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cBlue + "Purchased from shop.mineplex.com");
|
||||
}
|
||||
|
||||
//Rank Unlocks
|
||||
else if (gadget.GetCost(CurrencyType.Coins) == -10)
|
||||
{
|
||||
|
@ -33,7 +33,7 @@ public class MountValentinesSheep extends HorseMount
|
||||
{
|
||||
super(manager, "Loving Sheeples",
|
||||
UtilText.splitLineToArray(C.cGray + "This symbol of love will live on with you forever! Mainly because we couldn't attach the cupid wings to it. I guess duct tape can't fix everything!", LineFormat.LORE),
|
||||
Material.WOOL, (byte) 6, 1, Horse.Color.BLACK, Horse.Style.NONE, Horse.Variant.HORSE, 1.0, null);
|
||||
Material.WOOL, (byte) 6, -1, Horse.Color.BLACK, Horse.Style.NONE, Horse.Variant.HORSE, 1.0, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -0,0 +1,134 @@
|
||||
package mineplex.core.valentines;
|
||||
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.FireworkEffect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
|
||||
public class GiftEffect
|
||||
{
|
||||
private static final int ANIMATION_LENGTH = 20 * 5;
|
||||
private static final double CIRCLE_RADIUS = 3;
|
||||
private static final double CIRCLE_HEIGHT = 3;
|
||||
|
||||
private Player _from;
|
||||
private Player _to;
|
||||
private String _fromGift;
|
||||
private String _toGift;
|
||||
private Location _centerLocation;
|
||||
private boolean _finished;
|
||||
private int _ticks;
|
||||
|
||||
public GiftEffect(Player from, Player to, String fromGift, String toGift, Location centerLocation)
|
||||
{
|
||||
_from = from;
|
||||
_to = to;
|
||||
_fromGift = fromGift;
|
||||
_toGift = toGift;
|
||||
_centerLocation = centerLocation;
|
||||
_finished = false;
|
||||
_ticks = 0;
|
||||
|
||||
_to.setWalkSpeed(0.0F);
|
||||
_from.setWalkSpeed(0.0F);
|
||||
}
|
||||
|
||||
public void tick()
|
||||
{
|
||||
_ticks++;
|
||||
|
||||
if (_ticks == 20)
|
||||
{
|
||||
if (_to.isOnline())
|
||||
{
|
||||
UtilTextMiddle.display("", C.cPurple + _from.getName() + " shared a Gift with you", _to);
|
||||
_to.playSound(_to.getLocation(), Sound.NOTE_PLING, 1f, 1f);;
|
||||
}
|
||||
if (_from.isOnline())
|
||||
{
|
||||
UtilTextMiddle.display("", C.cPurple + "You shared a Gift with " + _to.getName(), _from);
|
||||
_from.playSound(_from.getLocation(), Sound.NOTE_PLING, 1f, 1f);
|
||||
}
|
||||
}
|
||||
else if (_ticks == 40)
|
||||
{
|
||||
if (_to.isOnline())
|
||||
{
|
||||
UtilTextMiddle.display("", C.cRed + "3", _to);
|
||||
_to.playSound(_to.getEyeLocation(), Sound.NOTE_PLING, 1F, 1F - 0.3f);
|
||||
}
|
||||
if (_from.isOnline())
|
||||
{
|
||||
UtilTextMiddle.display("", C.cRed + "3", _from);
|
||||
_from.playSound(_from.getEyeLocation(), Sound.NOTE_PLING, 1F, 1F - 0.3f);
|
||||
}
|
||||
}
|
||||
else if (_ticks == 60)
|
||||
{
|
||||
if (_to.isOnline())
|
||||
{
|
||||
UtilTextMiddle.display("", C.cGold + "2", _to);
|
||||
_to.playSound(_to.getEyeLocation(), Sound.NOTE_PLING, 1F, 1F - 0.2f);
|
||||
}
|
||||
if (_from.isOnline())
|
||||
{
|
||||
UtilTextMiddle.display("", C.cGold + "2", _from);
|
||||
_from.playSound(_from.getEyeLocation(), Sound.NOTE_PLING, 1F, 1F - 0.2f);
|
||||
}
|
||||
}
|
||||
else if (_ticks == 80)
|
||||
{
|
||||
if (_to.isOnline())
|
||||
{
|
||||
UtilTextMiddle.display("", C.cGreen + "1", _to);
|
||||
_to.playSound(_to.getEyeLocation(), Sound.NOTE_PLING, 1F, 1F - 0.1f);
|
||||
}
|
||||
if (_from.isOnline())
|
||||
{
|
||||
UtilTextMiddle.display("", C.cGreen + "1", _from);
|
||||
_from.playSound(_from.getEyeLocation(), Sound.NOTE_PLING, 1F, 1F - 0.1f);
|
||||
}
|
||||
}
|
||||
else if (_ticks == 100)
|
||||
{
|
||||
if (_to.isOnline())
|
||||
{
|
||||
UtilTextMiddle.display("", C.cPurple + "You received " + _toGift, _to);
|
||||
_to.playSound(_to.getEyeLocation(), Sound.LEVEL_UP, 1F, 1F);
|
||||
}
|
||||
if (_from.isOnline())
|
||||
{
|
||||
UtilTextMiddle.display("", C.cPurple + "You received " + _fromGift, _from);
|
||||
_from.playSound(_from.getEyeLocation(), Sound.LEVEL_UP, 1F, 1F);
|
||||
}
|
||||
}
|
||||
|
||||
double yAdd = CIRCLE_HEIGHT * ((double) _ticks) / ANIMATION_LENGTH;
|
||||
double xAdd = CIRCLE_RADIUS * Math.sin(_ticks / 10.0 * Math.PI);
|
||||
double zAdd = CIRCLE_RADIUS * Math.cos(_ticks / 10.0 * Math.PI);
|
||||
|
||||
UtilParticle.PlayParticleToAll(UtilParticle.ParticleType.HEART, _centerLocation.clone().add(xAdd, yAdd, zAdd), 0.5f, 0.5f, 0.5f, 0, 5, UtilParticle.ViewDist.NORMAL);
|
||||
|
||||
if (_ticks % 10 == 0)
|
||||
UtilParticle.PlayParticleToAll(UtilParticle.ParticleType.FIREWORKS_SPARK, _centerLocation.clone().add(0, 1, 0), 3f, 3f, 3f, 0, 10, UtilParticle.ViewDist.NORMAL);
|
||||
|
||||
if (_ticks >= ANIMATION_LENGTH)
|
||||
{
|
||||
UtilFirework.playFirework(_centerLocation.clone().add(0, 3, 0), FireworkEffect.builder().with(FireworkEffect.Type.STAR).withColor(Color.RED).withFade(Color.WHITE).withFlicker().build());
|
||||
_finished = true;
|
||||
if (_to.isOnline()) _to.setWalkSpeed(0.2F);
|
||||
if (_from.isOnline()) _from.setWalkSpeed(0.2F);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isFinished()
|
||||
{
|
||||
return _finished;
|
||||
}
|
||||
}
|
@ -1,5 +1,8 @@
|
||||
package mineplex.core.valentines;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.util.*;
|
||||
@ -7,8 +10,13 @@ import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.reward.*;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.core.valentines.event.AttemptGiftEvent;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
@ -24,6 +32,7 @@ public class ValentinesGiftManager extends MiniPlugin
|
||||
private GadgetManager _gadgetManager;
|
||||
|
||||
private ValentinesGiftRepository _repository;
|
||||
private LinkedList<GiftEffect> _effects;
|
||||
|
||||
public ValentinesGiftManager(JavaPlugin plugin, CoreClientManager clientManager, RewardManager rewardManager, InventoryManager inventoryManager, GadgetManager gadgetManager)
|
||||
{
|
||||
@ -35,6 +44,7 @@ public class ValentinesGiftManager extends MiniPlugin
|
||||
_gadgetManager = gadgetManager;
|
||||
|
||||
_repository = new ValentinesGiftRepository(plugin);
|
||||
_effects = new LinkedList<>();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -67,21 +77,19 @@ public class ValentinesGiftManager extends MiniPlugin
|
||||
_rewardManager.nextReward(to, RewardPool.Type.VALENTINES_GIFT, null, false, RewardType.ValentinesGift, false).giveReward(RewardType.ValentinesGift, to, new Callback<RewardData>()
|
||||
{
|
||||
@Override
|
||||
public void run(RewardData data)
|
||||
public void run(RewardData toData)
|
||||
{
|
||||
UtilTextMiddle.display(data.getRarity().getColor() + data.getFriendlyName(), C.cPurple + "Gift from " + from.getName(), to);
|
||||
UtilPlayer.message(to, F.main("Gift", F.name(from.getName()) + " gave you " + data.getRarity().getColor() + data.getFriendlyName()));
|
||||
UtilPlayer.message(from, F.main("Gift", "You gave " + F.name(to.getName()) + " " + data.getRarity().getColor() + data.getFriendlyName()));
|
||||
}
|
||||
});
|
||||
String toGift = ChatColor.stripColor(toData.getFriendlyName());
|
||||
|
||||
_rewardManager.nextReward(from, RewardPool.Type.VALENTINES_GIFT, null, false, RewardType.ValentinesGift, false).giveReward(RewardType.ValentinesGift, from, new Callback<RewardData>()
|
||||
{
|
||||
@Override
|
||||
public void run(RewardData data)
|
||||
{
|
||||
UtilTextMiddle.display(data.getRarity().getColor() + data.getFriendlyName(), C.cPurple + "Gift in Return", from);
|
||||
UtilPlayer.message(from, F.main("Gift", "You found " + F.elem(data.getRarity().getColor() + data.getFriendlyName()) + " for your good karma"));
|
||||
_rewardManager.nextReward(from, RewardPool.Type.VALENTINES_GIFT, null, false, RewardType.ValentinesGift, false).giveReward(RewardType.ValentinesGift, from, new Callback<RewardData>()
|
||||
{
|
||||
@Override
|
||||
public void run(RewardData fromData)
|
||||
{
|
||||
String fromGift = ChatColor.stripColor(fromData.getFriendlyName());
|
||||
_effects.add(new GiftEffect(from, to, fromGift, toGift, UtilAlg.getMidpoint(to.getLocation(), from.getLocation())));
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@ -100,4 +108,22 @@ public class ValentinesGiftManager extends MiniPlugin
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void updateEffects(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
Iterator<GiftEffect> iterator = _effects.iterator();
|
||||
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
GiftEffect effect = iterator.next();
|
||||
if (effect.isFinished())
|
||||
iterator.remove();
|
||||
else
|
||||
effect.tick();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,24 @@
|
||||
package mineplex.staffServer.salespackage.salespackages;
|
||||
|
||||
import mineplex.staffServer.salespackage.SalesPackageManager;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class LifetimeTitan extends SalesPackageBase
|
||||
{
|
||||
public LifetimeTitan(SalesPackageManager manager)
|
||||
{
|
||||
super(manager, "Lifetime Titan");
|
||||
}
|
||||
|
||||
public void displayToAgent(Player agent, String playerName)
|
||||
{
|
||||
addButton(agent, "/sales rank " + playerName + " TITAN true", " Lifetime Titan.");
|
||||
addButton(agent, "/sales item " + playerName + " 1 Molten Snake", "Gives Molten Snake Mount.");
|
||||
addButton(agent, "/sales item " + playerName + " 1 Elder Guardian Morph", "Gives Elder Guardian Morph.");
|
||||
addButton(agent, "/sales item " + playerName + " 1 Flame of the Titans", "Gives Titan Particle.");
|
||||
addButton(agent, "Apply All", "/sales lifetimelegend " + playerName, " Apply all above.");
|
||||
agent.sendMessage(" ");
|
||||
addBackButton(agent, playerName);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user