Fixed taunts, using armorstands instead of items

Removed minestrike chest (not being released this month)
This commit is contained in:
LCastr0 2016-12-13 22:39:01 -02:00 committed by cnr
parent 69f7f025a1
commit f9c71c481f
13 changed files with 363 additions and 136 deletions

View File

@ -16,6 +16,6 @@ public class OpenTaunts extends OpenPageButton
@Override @Override
protected void leftClick(Player player) protected void leftClick(Player player)
{ {
getMenu().getShop().openPageForPlayer(player, new TauntPage(getMenu().getPlugin(), getMenu().getShop(), getMenu().getClientManager(), getMenu().getDonationManager(), "Particles", player)); getMenu().getShop().openPageForPlayer(player, new TauntPage(getMenu().getPlugin(), getMenu().getShop(), getMenu().getClientManager(), getMenu().getDonationManager(), "Taunts", player));
} }
} }

View File

@ -37,7 +37,7 @@ public class TauntPage extends GadgetPage
{ {
addGadget(gadget, slot); addGadget(gadget, slot);
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.MORPH) == gadget) if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.TAUNT) == gadget)
addGlow(slot); addGlow(slot);
slot++; slot++;

View File

@ -169,6 +169,7 @@ import mineplex.core.gadget.gadgets.particle.shadow.ParticleFoot;
import mineplex.core.gadget.gadgets.particle.titan.ParticleTitan; import mineplex.core.gadget.gadgets.particle.titan.ParticleTitan;
import mineplex.core.gadget.gadgets.particle.vampire.ParticleBlood; import mineplex.core.gadget.gadgets.particle.vampire.ParticleBlood;
import mineplex.core.gadget.gadgets.particle.wisdom.ParticleEnchant; import mineplex.core.gadget.gadgets.particle.wisdom.ParticleEnchant;
import mineplex.core.gadget.gadgets.taunts.EternalTaunt;
import mineplex.core.gadget.gadgets.wineffect.WinEffectBabyChicken; import mineplex.core.gadget.gadgets.wineffect.WinEffectBabyChicken;
import mineplex.core.gadget.gadgets.wineffect.WinEffectFlames; import mineplex.core.gadget.gadgets.wineffect.WinEffectFlames;
import mineplex.core.gadget.gadgets.wineffect.WinEffectHalloween; import mineplex.core.gadget.gadgets.wineffect.WinEffectHalloween;
@ -532,6 +533,9 @@ public class GadgetManager extends MiniPlugin
// Balloons // Balloons
//addGadget(new BabyCowBalloon(this)); //addGadget(new BabyCowBalloon(this));
// TAUNTS!!!
addGadget(new EternalTaunt(this));
for (GadgetType gadgetType : GadgetType.values()) for (GadgetType gadgetType : GadgetType.values())
{ {
if (!_gadgets.containsKey(gadgetType)) if (!_gadgets.containsKey(gadgetType))
@ -766,7 +770,10 @@ public class GadgetManager extends MiniPlugin
if (gadget instanceof WinEffectGadget) if (gadget instanceof WinEffectGadget)
continue; continue;
if(gadget instanceof GameModifierGadget) if (gadget instanceof GameModifierGadget)
continue;
if (gadget instanceof TauntGadget)
continue; continue;
for (Player player : UtilServer.getPlayers()) for (Player player : UtilServer.getPlayers())
@ -1250,21 +1257,35 @@ public class GadgetManager extends MiniPlugin
{ {
Player player = event.getPlayer(); Player player = event.getPlayer();
if (getActive(player, GadgetType.TAUNT) == null) Gadget gadget = getActive(player, GadgetType.TAUNT);
if (gadget == null)
{
event.setState(TauntCommandEvent.TauntState.NO_TAUNT); event.setState(TauntCommandEvent.TauntState.NO_TAUNT);
UtilPlayer.message(player, F.main("Taunt", event.getState().getMessage()));
return;
}
TauntGadget taunt = (TauntGadget) getActive(player, GadgetType.TAUNT); if (!(gadget instanceof TauntGadget))
{
event.setState(TauntCommandEvent.TauntState.NO_TAUNT);
UtilPlayer.message(player, F.main("Taunt", event.getState().getMessage()));
return;
}
if (!event.isGameInProgress()) TauntGadget taunt = (TauntGadget) gadget;
if (!event.isGameInProgress() && event.getState().equals(TauntCommandEvent.TauntState.NONE))
event.setState(TauntCommandEvent.TauntState.NOT_IN_GAME); event.setState(TauntCommandEvent.TauntState.NOT_IN_GAME);
if (!event.isAlive()) if (!event.isAlive() && event.getState().equals(TauntCommandEvent.TauntState.NONE))
event.setState(TauntCommandEvent.TauntState.NOT_ALIVE); event.setState(TauntCommandEvent.TauntState.NOT_ALIVE);
if (event.isSpectator()) if (event.isSpectator() && event.getState().equals(TauntCommandEvent.TauntState.NONE))
event.setState(TauntCommandEvent.TauntState.SPECTATOR); event.setState(TauntCommandEvent.TauntState.SPECTATOR);
if (event.isInPvp() && !taunt.canPlayWithPvp()) if (event.isInPvp(taunt.getPvpCooldown()) && !taunt.canPlayWithPvp()
&& event.getState().equals(TauntCommandEvent.TauntState.NONE))
event.setState(TauntCommandEvent.TauntState.PVP); event.setState(TauntCommandEvent.TauntState.PVP);
if (event.getState() != TauntCommandEvent.TauntState.NONE) if (event.getState() != TauntCommandEvent.TauntState.NONE)
@ -1273,6 +1294,6 @@ public class GadgetManager extends MiniPlugin
return; return;
} }
taunt.start(); taunt.start(player);
} }
} }

View File

@ -4,6 +4,8 @@ import org.bukkit.entity.Player;
import org.bukkit.event.Event; import org.bukkit.event.Event;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import mineplex.core.common.util.UtilTime;
public class TauntCommandEvent extends Event public class TauntCommandEvent extends Event
{ {
@ -13,16 +15,16 @@ public class TauntCommandEvent extends Event
private boolean _gameInProgress; private boolean _gameInProgress;
private boolean _alive; private boolean _alive;
private boolean _spectator; private boolean _spectator;
private boolean _inPvp; private long _lastPvp;
private TauntState _state; private TauntState _state = TauntState.NONE;
public TauntCommandEvent(Player player, boolean gameInProgress, boolean alive, boolean spectator, boolean inPvp) public TauntCommandEvent(Player player, boolean gameInProgress, boolean alive, boolean spectator, long lastPvp)
{ {
_player = player; _player = player;
_gameInProgress = gameInProgress; _gameInProgress = gameInProgress;
_alive = alive; _alive = alive;
_spectator = spectator; _spectator = spectator;
_inPvp = inPvp; _lastPvp = lastPvp;
} }
public Player getPlayer() public Player getPlayer()
@ -45,9 +47,9 @@ public class TauntCommandEvent extends Event
return _spectator; return _spectator;
} }
public boolean isInPvp() public boolean isInPvp(long cooldown)
{ {
return _inPvp; return !UtilTime.elapsed(_lastPvp, cooldown);
} }
public TauntState getState() public TauntState getState()

View File

@ -1,62 +1,115 @@
package mineplex.core.gadget.gadgets.taunts; package mineplex.core.gadget.gadgets.taunts;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.Color;
import org.bukkit.FireworkEffect;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Item; import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilText;
import mineplex.core.events.EnableArcadeSpawnEvent;
import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.gadgets.taunts.eternal.EternalClock;
import mineplex.core.gadget.types.TauntGadget; import mineplex.core.gadget.types.TauntGadget;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
public class EternalTaunt extends TauntGadget public class EternalTaunt extends TauntGadget
{ {
private List<Item> _clocks = new ArrayList<>(); private static final int COOLDOWN = 30000;
private Map<UUID, List<EternalClock>> _clocks = new HashMap<>();
private Map<UUID, Integer> _ticksPerPlayer = new HashMap<>();
public EternalTaunt(GadgetManager manager) public EternalTaunt(GadgetManager manager)
{ {
super(manager, "Eternal Taunt", UtilText.splitLinesToArray(new String[]{"Placeholder"}, LineFormat.LORE), super(manager, "Eternal Taunt", UtilText.splitLinesToArray(new String[]{"Placeholder"}, LineFormat.LORE),
-15, Material.GLASS, (byte) 0); -15, Material.GLASS, (byte) 0);
setCanPlayWithPvp(false); setCanPlayWithPvp(false);
setPvpCooldown(5000);
setShouldPlay(true); setShouldPlay(true);
setEventType(UpdateType.FAST); setEventType(UpdateType.TICK);
} }
@Override @Override
public void start() public void start(Player player)
{ {
// TODO PARTICLE EFFECT if (!Recharge.Instance.use(player, getName(), COOLDOWN, true, false, "Cosmetics"))
} return;
UtilFirework.playFirework(player.getLocation(), FireworkEffect.builder().with(FireworkEffect.Type.BALL_LARGE).withColor(Color.fromRGB(255, 175, 175)).withFade(Color.RED).build());
List<EternalClock> clocks = new ArrayList<>();
@Override EnableArcadeSpawnEvent enableArcadeSpawnEvent = new EnableArcadeSpawnEvent(true);
public void play() Bukkit.getPluginManager().callEvent(enableArcadeSpawnEvent);
{
Item clock = _player.getWorld().dropItem(_player.getLocation().add(0, 3, 0), ItemStackFactory.Instance.CreateStack(Material.WATCH, (byte) 0, 1, "" + System.currentTimeMillis()));
_clocks.add(clock);
int i = getTicks(); // Creates armor stands
Vector vel = new Vector(Math.sin(i * 9/5d), 0, Math.cos(i * 9/5d)); for (EternalClock.ClockPosition clockPosition : EternalClock.ClockPosition.values())
UtilAction.velocity(clock, vel, Math.abs(Math.sin(i * 12/3000d)), false, 0, 0.2 + Math.abs(Math.cos(i * 12/3000d))*0.6, 1, false);
if (getTicks() >= 40)
{ {
finish(); EternalClock eternalClock = new EternalClock(player, clockPosition);
eternalClock.createStand();
clocks.add(eternalClock);
}
_clocks.put(player.getUniqueId(), clocks);
enableArcadeSpawnEvent = new EnableArcadeSpawnEvent(false);
Bukkit.getPluginManager().callEvent(enableArcadeSpawnEvent);
_ticksPerPlayer.put(player.getUniqueId(), 0);
}
@Override
public void play(Player player)
{
if (!_clocks.containsKey(player.getUniqueId()))
return;
// Keps armorstand close to player
for (EternalClock eternalClock : _clocks.get(player.getUniqueId()))
{
eternalClock.moveStand();
}
if (getTicks(player) >= 60)
{
finish(player);
}
else
{
increaseTicks(player);
} }
} }
@Override @Override
public void finish() public void finish(Player player)
{ {
setShouldPlay(false); if (_clocks.containsKey(player.getUniqueId()))
_clocks.forEach(c -> c.remove()); {
_clocks.clear(); _clocks.get(player.getUniqueId()).forEach(eternalClock -> eternalClock.removeStand());
_clocks.get(player.getUniqueId()).clear();
_clocks.remove(player.getUniqueId());
}
}
private int getTicks(Player player)
{
return _ticksPerPlayer.get(player.getUniqueId());
}
private void increaseTicks(Player player)
{
int ticks = getTicks(player);
ticks++;
_ticksPerPlayer.put(player.getUniqueId(), ticks);
} }
} }

View File

@ -0,0 +1,80 @@
package mineplex.core.gadget.gadgets.taunts.eternal;
import org.bukkit.Material;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class EternalClock
{
private Player _player;
private ClockPosition _clockPosition;
private ArmorStand _armorStand;
public EternalClock(Player player, ClockPosition clockPosition)
{
_player = player;
_clockPosition = clockPosition;
}
public void createStand()
{
_armorStand = _player.getWorld().spawn(_player.getLocation().clone().add(_clockPosition.getX(), .5,
_clockPosition.getZ()), ArmorStand.class);
_armorStand.setItemInHand(new ItemStack(Material.WATCH));
_armorStand.setVisible(false);
_armorStand.setGravity(false);
}
public void moveStand()
{
switch (_clockPosition)
{
case A:
_clockPosition = ClockPosition.B;
break;
case B:
_clockPosition = ClockPosition.C;
break;
case C:
_clockPosition = ClockPosition.D;
break;
case D:
_clockPosition = ClockPosition.A;
}
_armorStand.teleport(_player.getLocation().clone().add(_clockPosition.getX(), .5, _clockPosition.getZ()));
}
public void removeStand()
{
_armorStand.remove();
}
public enum ClockPosition
{
A(1, 0),
B(0, 1),
C(-1, 0),
D(0, -1);
private int _x, _z;
ClockPosition(int x, int z)
{
_x = x;
_z = z;
}
public int getX()
{
return _x;
}
public int getZ()
{
return _z;
}
}
}

View File

@ -16,21 +16,14 @@ import mineplex.core.updater.event.UpdateEvent;
public abstract class TauntGadget extends Gadget public abstract class TauntGadget extends Gadget
{ {
/** The player that ran the taunt command */
protected Player _player;
/** The milliseconds time the taunt started playing */
protected long _started;
/** Has the taunt effect started yet? */
protected boolean _hasStarted = false;
/** Sets if this specific taunt can be used while in PvP */ /** Sets if this specific taunt can be used while in PvP */
private boolean _canPlayWithPvp = false; private boolean _canPlayWithPvp = false;
/** Sets the cooldown for pvp */
private long _pvpCooldown = 0;
/** Sets if this taunt needs to run on updates */ /** Sets if this taunt needs to run on updates */
private boolean _shouldPlay = false; private boolean _shouldPlay = false;
/** Sets when the taunt will run, if set above */ /** Sets when the taunt will run, if set above */
private UpdateType _updateType = UpdateType.TICK; private UpdateType _updateType = UpdateType.TICK;
/** The number of ticks that have passed since the start */
private int _ticks = 0;
/** /**
* @param manager The normal GadgetManager * @param manager The normal GadgetManager
@ -63,17 +56,22 @@ public abstract class TauntGadget extends Gadget
super(manager, GadgetType.TAUNT, name, desc, cost, mat, data, yearMonth, 1, alternativeSalesPackageNames); super(manager, GadgetType.TAUNT, name, desc, cost, mat, data, yearMonth, 1, alternativeSalesPackageNames);
} }
public abstract void start(); public abstract void start(Player player);
public abstract void play(); public abstract void play(Player player);
public abstract void finish(); public abstract void finish(Player player);
public void setCanPlayWithPvp(boolean canPlayWithPvp) public void setCanPlayWithPvp(boolean canPlayWithPvp)
{ {
_canPlayWithPvp = canPlayWithPvp; _canPlayWithPvp = canPlayWithPvp;
} }
public void setPvpCooldown(long pvpCooldown)
{
_pvpCooldown = pvpCooldown;
}
public void setShouldPlay(boolean shouldPlay) public void setShouldPlay(boolean shouldPlay)
{ {
_shouldPlay = shouldPlay; _shouldPlay = shouldPlay;
@ -89,25 +87,24 @@ public abstract class TauntGadget extends Gadget
return _canPlayWithPvp; return _canPlayWithPvp;
} }
public int getTicks() public long getPvpCooldown()
{ {
return _ticks; return _pvpCooldown;
} }
@EventHandler @EventHandler
public void onUpdate(UpdateEvent event) public void onUpdate(UpdateEvent event)
{ {
if (!_hasStarted)
return;
if (!_shouldPlay) if (!_shouldPlay)
return; return;
if (event.getType() != _updateType) if (event.getType() != _updateType)
return; return;
play(); for (Player player : getActive())
_ticks++; {
play(player);
}
} }
} }

View File

@ -4,6 +4,7 @@ import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.common.util.Callback; import mineplex.core.common.util.Callback;
import mineplex.core.particleeffects.events.EffectStopEvent;
public abstract class Effect public abstract class Effect
{ {
@ -50,6 +51,8 @@ public abstract class Effect
{ {
_running = false; _running = false;
Bukkit.getScheduler().cancelTask(_task); Bukkit.getScheduler().cancelTask(_task);
EffectStopEvent effectStopEvent = new EffectStopEvent(this);
Bukkit.getPluginManager().callEvent(effectStopEvent);
if (_callback != null) if (_callback != null)
_callback.run(this); _callback.run(this);
onStop(); onStop();

View File

@ -0,0 +1,51 @@
package mineplex.core.particleeffects;
import org.bukkit.Color;
import org.bukkit.Location;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.particles.ColoredParticle;
import mineplex.core.common.util.particles.DustSpellColor;
public class LineEffect extends Effect
{
private int _particles = 100;
private Color _color;
private int _count = 0;
private Vector _vector;
private Location _fixedLoc;
public LineEffect(JavaPlugin plugin, Location location, Location target, Color color)
{
super(-1, new EffectLocation(location), plugin);
setTargetLocation(new EffectLocation(target));
_color = color;
}
@Override
public void runEffect()
{
Location location = _effectLocation.getFixedLocation().clone().add(0, 1, 0);
if (_vector == null)
{
Location targetLoc = getTargetLocation().getFixedLocation().clone();
Vector link = targetLoc.toVector().subtract(location.toVector());
float length = (float) link.length();
link.normalize();
Vector vector = link.multiply(length / _particles);
_vector = vector;
_fixedLoc = location.clone().subtract(_vector);
}
ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST,
new DustSpellColor(_color), _effectLocation.getLocation().clone());
_fixedLoc.add(_vector);
if (_count == _particles)
{
stop();
}
}
}

View File

@ -375,7 +375,7 @@ public class RewardManager
addGadget(Type.NORMAL, getGadget(ParticlePartyTime.class), rarity, 12); addGadget(Type.NORMAL, getGadget(ParticlePartyTime.class), rarity, 12);
//Game Modifiers MineStrike //Game Modifiers MineStrike
/*addMineStrikeSkin(Type.NORMAL, MineStrikeSkin.AWP_Asiimov, rarity, 200); addMineStrikeSkin(Type.NORMAL, MineStrikeSkin.AWP_Asiimov, rarity, 200);
addMineStrikeSkin(Type.NORMAL, MineStrikeSkin.P90_Asiimov, rarity, 200); addMineStrikeSkin(Type.NORMAL, MineStrikeSkin.P90_Asiimov, rarity, 200);
addMineStrikeSkin(Type.NORMAL, MineStrikeSkin.SSG_08_Blood_in_the_Water, rarity, 50); addMineStrikeSkin(Type.NORMAL, MineStrikeSkin.SSG_08_Blood_in_the_Water, rarity, 50);
addMineStrikeSkin(Type.NORMAL, MineStrikeSkin.Galil_AR_Eco, rarity, 20); addMineStrikeSkin(Type.NORMAL, MineStrikeSkin.Galil_AR_Eco, rarity, 20);
@ -386,12 +386,7 @@ public class RewardManager
addMineStrikeSkin(Type.NORMAL, MineStrikeSkin.PP_Bizon_Streak, rarity, 40); addMineStrikeSkin(Type.NORMAL, MineStrikeSkin.PP_Bizon_Streak, rarity, 40);
addMineStrikeSkin(Type.NORMAL, MineStrikeSkin.CZ75_Auto_Tigris, rarity, 100); addMineStrikeSkin(Type.NORMAL, MineStrikeSkin.CZ75_Auto_Tigris, rarity, 100);
addMineStrikeSkin(Type.NORMAL, MineStrikeSkin.Steyr_AUG_Torque, rarity, 30); addMineStrikeSkin(Type.NORMAL, MineStrikeSkin.Steyr_AUG_Torque, rarity, 30);
addMineStrikeSkin(Type.NORMAL, MineStrikeSkin.XM1014_Tranquility, rarity, 30);*/ addMineStrikeSkin(Type.NORMAL, MineStrikeSkin.XM1014_Tranquility, rarity, 30);
for (MineStrikeSkin skin : MineStrikeSkin.values())
{
addMineStrikeSkin(Type.MINESTRIKE, skin, rarity, 200);
}
// VALENTINES // VALENTINES
@ -556,7 +551,7 @@ public class RewardManager
addGadget(Type.NORMAL, getGadget(WinEffectRiseOfTheElderGuardian.class), rarity, 4); addGadget(Type.NORMAL, getGadget(WinEffectRiseOfTheElderGuardian.class), rarity, 4);
//GameModifier MineStrike //GameModifier MineStrike
/*addMineStrikeSkin(Type.NORMAL, MineStrikeSkin.AWP_Asiimov, rarity, 8); addMineStrikeSkin(Type.NORMAL, MineStrikeSkin.AWP_Asiimov, rarity, 8);
addMineStrikeSkin(Type.NORMAL, MineStrikeSkin.P90_Asiimov, rarity, 8); addMineStrikeSkin(Type.NORMAL, MineStrikeSkin.P90_Asiimov, rarity, 8);
addMineStrikeSkin(Type.NORMAL, MineStrikeSkin.Desert_Eagle_Blaze, rarity, 10); addMineStrikeSkin(Type.NORMAL, MineStrikeSkin.Desert_Eagle_Blaze, rarity, 10);
addMineStrikeSkin(Type.NORMAL, MineStrikeSkin.Glock_18_Fade, rarity, 20); addMineStrikeSkin(Type.NORMAL, MineStrikeSkin.Glock_18_Fade, rarity, 20);
@ -565,7 +560,7 @@ public class RewardManager
addMineStrikeSkin(Type.NORMAL, MineStrikeSkin.P250_Muertos, rarity, 20); addMineStrikeSkin(Type.NORMAL, MineStrikeSkin.P250_Muertos, rarity, 20);
addMineStrikeSkin(Type.NORMAL, MineStrikeSkin.FAMAS_Pulse, rarity, 33); addMineStrikeSkin(Type.NORMAL, MineStrikeSkin.FAMAS_Pulse, rarity, 33);
addMineStrikeSkin(Type.NORMAL, MineStrikeSkin.SG553_Pulse, rarity, 33); addMineStrikeSkin(Type.NORMAL, MineStrikeSkin.SG553_Pulse, rarity, 33);
addMineStrikeSkin(Type.NORMAL, MineStrikeSkin.AK_47_Vulcan, rarity, 5);*/ addMineStrikeSkin(Type.NORMAL, MineStrikeSkin.AK_47_Vulcan, rarity, 5);
//WINTER //WINTER

View File

@ -356,7 +356,8 @@ public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop>
gingerbreadLore.add(ChatColor.RESET + "or Purchase at: " + C.cYellow + "www.mineplex.com/shop"); gingerbreadLore.add(ChatColor.RESET + "or Purchase at: " + C.cYellow + "www.mineplex.com/shop");
} }
List<String> minestrikeLore = Lists.newArrayList(); // Minestrike Chests not being released in this update!
/*List<String> minestrikeLore = Lists.newArrayList();
minestrikeLore.add(" "); minestrikeLore.add(" ");
minestrikeLore.add(F.value("Minestrike Chests Owned", "" + minestrikeCount)); minestrikeLore.add(F.value("Minestrike Chests Owned", "" + minestrikeCount));
minestrikeLore.add(" "); minestrikeLore.add(" ");
@ -371,7 +372,7 @@ public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop>
minestrikeLore.add(ChatColor.RESET + "Click to craft for " + C.cAqua + "20000 Treasure Shards"); minestrikeLore.add(ChatColor.RESET + "Click to craft for " + C.cAqua + "20000 Treasure Shards");
minestrikeLore.add(" "); minestrikeLore.add(" ");
minestrikeLore.add(ChatColor.RESET + "or Purchase at: " + C.cYellow + "www.mineplex.com/shop"); minestrikeLore.add(ChatColor.RESET + "or Purchase at: " + C.cYellow + "www.mineplex.com/shop");
} }*/
ShopItem shards = new ShopItem(Material.PRISMARINE_SHARD, C.cAqua + C.Bold + treasureShards + " Treasure Shards", shardLore.toArray(new String[0]), 0, false); ShopItem shards = new ShopItem(Material.PRISMARINE_SHARD, C.cAqua + C.Bold + treasureShards + " Treasure Shards", shardLore.toArray(new String[0]), 0, false);
@ -381,7 +382,7 @@ public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop>
ShopItem legendary = new ShopItem(Material.ENDER_CHEST, C.cRed + C.Bold + "Mythical Treasure", legendaryLore.toArray(new String[0]), 0, false, false); ShopItem legendary = new ShopItem(Material.ENDER_CHEST, C.cRed + C.Bold + "Mythical Treasure", legendaryLore.toArray(new String[0]), 0, false, false);
ItemStack illuminated = new ShopItem(Material.SEA_LANTERN, C.cDAqua + C.Bold + "Illuminated Treasure", illuminatedLore.toArray(new String[0]), 0, false, false); ItemStack illuminated = new ShopItem(Material.SEA_LANTERN, C.cDAqua + C.Bold + "Illuminated Treasure", illuminatedLore.toArray(new String[0]), 0, false, false);
ItemStack omega = SkinData.OMEGA_CHEST.getSkull(C.cAquaB + "Omega Treasure", omegaLore); ItemStack omega = SkinData.OMEGA_CHEST.getSkull(C.cAquaB + "Omega Treasure", omegaLore);
ItemStack minestrike = new ShopItem(Material.GLASS, C.cGoldB + "Minestrike Treasure", minestrikeLore.toArray(new String[0]), 0, false, false); //ItemStack minestrike = new ShopItem(Material.GLASS, C.cGoldB + "Minestrike Treasure", minestrikeLore.toArray(new String[0]), 0, false, false);
// Seasonal chests // Seasonal chests
ItemStack christmas = SkinData.PRESENT.getSkull(C.cDGreen + C.Bold + "Winter Holiday Treasure", christmasLore); ItemStack christmas = SkinData.PRESENT.getSkull(C.cDGreen + C.Bold + "Winter Holiday Treasure", christmasLore);
@ -402,7 +403,7 @@ public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop>
TreasurePageItem mythicalTreasureItem = new TreasurePageItem(legendary, legendaryCount, TreasureType.MYTHICAL); TreasurePageItem mythicalTreasureItem = new TreasurePageItem(legendary, legendaryCount, TreasureType.MYTHICAL);
TreasurePageItem illuminatedTreasureItem = new TreasurePageItem(illuminated, illuminatedCount, TreasureType.ILLUMINATED); TreasurePageItem illuminatedTreasureItem = new TreasurePageItem(illuminated, illuminatedCount, TreasureType.ILLUMINATED);
TreasurePageItem omegaTreasureItem = new TreasurePageItem(omega, omegaCount, TreasureType.OMEGA); TreasurePageItem omegaTreasureItem = new TreasurePageItem(omega, omegaCount, TreasureType.OMEGA);
TreasurePageItem minestrikeTreasureItem = new TreasurePageItem(minestrike, minestrikeCount, TreasureType.MINESTRIKE); //TreasurePageItem minestrikeTreasureItem = new TreasurePageItem(minestrike, minestrikeCount, TreasureType.MINESTRIKE);
// Seasonal chests // Seasonal chests
TreasurePageItem winterTreasureItem = new TreasurePageItem(christmas, christmasCount, TreasureType.CHRISTMAS); TreasurePageItem winterTreasureItem = new TreasurePageItem(christmas, christmasCount, TreasureType.CHRISTMAS);
@ -417,7 +418,7 @@ public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop>
_normalTreasures.add(mythicalTreasureItem); _normalTreasures.add(mythicalTreasureItem);
_normalTreasures.add(illuminatedTreasureItem); _normalTreasures.add(illuminatedTreasureItem);
_normalTreasures.add(omegaTreasureItem); _normalTreasures.add(omegaTreasureItem);
_normalTreasures.add(minestrikeTreasureItem); //_normalTreasures.add(minestrikeTreasureItem);
_seasonalTreasures.add(winterTreasureItem); _seasonalTreasures.add(winterTreasureItem);
_seasonalTreasures.add(freedomTreasureItem); _seasonalTreasures.add(freedomTreasureItem);
@ -442,7 +443,7 @@ public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop>
i = 0; i = 0;
} }
int[] normalDisplayPositions = new int[]{19, 22, 25, 38, 40, 42}; int[] normalDisplayPositions = getNormalDisplayOrder();
for (TreasurePageItem treasurePageItem : _normalTreasures) for (TreasurePageItem treasurePageItem : _normalTreasures)
{ {
addChest(treasurePageItem, normalDisplayPositions[i]); addChest(treasurePageItem, normalDisplayPositions[i]);
@ -505,6 +506,29 @@ public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop>
return new int[]{4}; return new int[]{4};
} }
private int[] getNormalDisplayOrder()
{
int seasonalTreasuresSize = _seasonalTreasures.size();
switch (seasonalTreasuresSize)
{
case 5:
return new int[]{20, 22, 24, 39, 41};
case 6:
return new int[]{19, 21, 23, 25, 38, 42};
case 7:
return new int[]{19, 21, 23, 25, 38, 40, 42};
case 8:
return new int[]{19, 21, 23, 25, 37, 39, 41, 43};
case 9:
return new int[]{19, 21, 23, 25, 31, 37, 39, 41, 43};
case 10:
return new int[]{19, 21, 23, 25, 29, 33, 37, 39, 41, 43};
case 11:
return new int[]{19, 21, 23, 25, 29, 31, 33, 37, 39, 32, 43};
}
return new int[]{20, 22, 24, 39, 41};
}
private int[] getSeasonalDisplayOrder() private int[] getSeasonalDisplayOrder()
{ {
int seasonalTreasuresSize = _seasonalTreasures.size(); int seasonalTreasuresSize = _seasonalTreasures.size();

View File

@ -4,14 +4,14 @@ import java.util.HashMap;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilTime;
import mineplex.minecraft.game.core.damage.DamageChange;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilTime;
import mineplex.minecraft.game.core.damage.DamageChange;
public class CombatLog public class CombatLog
{ {
private LinkedList<CombatComponent> _damager = new LinkedList<CombatComponent>(); private LinkedList<CombatComponent> _damager = new LinkedList<CombatComponent>();
@ -34,6 +34,7 @@ public class CombatLog
{ {
_expireTime = expireTime; _expireTime = expireTime;
_player = new CombatComponent(player.getName(), player); _player = new CombatComponent(player.getName(), player);
_lastCombatEngaged = 0; // Just so taunts can be used before pvp
} }
public LinkedList<CombatComponent> GetAttackers() public LinkedList<CombatComponent> GetAttackers()

View File

@ -34,7 +34,7 @@ public class TauntCommand extends CommandBase<ArcadeManager>
pvp = UtilTime.elapsed(combatManager.Get(player).GetLastCombatEngaged(), 5000 * 60); pvp = UtilTime.elapsed(combatManager.Get(player).GetLastCombatEngaged(), 5000 * 60);
} }
TauntCommandEvent event = new TauntCommandEvent(player, _arcadeManager.isGameInProgress(), TauntCommandEvent event = new TauntCommandEvent(player, _arcadeManager.isGameInProgress(),
_arcadeManager.GetGame().IsAlive(player), UtilPlayer.isSpectator(player), pvp); _arcadeManager.GetGame().IsAlive(player), UtilPlayer.isSpectator(player), combatManager.Get(player).GetLastCombatEngaged());
Bukkit.getPluginManager().callEvent(event); Bukkit.getPluginManager().callEvent(event);
} }