Fixed eternal taunt

Added description for taunts
Added eternal taunt description and icon
Removed minestrike chest for now
Removed debug commans permissions
This commit is contained in:
LCastr0 2016-12-17 19:15:25 -02:00 committed by cnr
parent f2aef9a873
commit e8d698ac37
6 changed files with 70 additions and 137 deletions

View File

@ -186,17 +186,8 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
addButton(musicSlot, new ShopItem(Material.GREEN_RECORD, "Music", lore, 1, false), new OpenMusic(this, enabled.get(type))); addButton(musicSlot, new ShopItem(Material.GREEN_RECORD, "Music", lore, 1, false), new OpenMusic(this, enabled.get(type)));
if (enabled.containsKey(type)) addGlow(musicSlot); if (enabled.containsKey(type)) addGlow(musicSlot);
/*addButton(tauntSlot, new ShopItem(Material.NAME_TAG, "Taunts", new String[]{C.Bold + "", C.cDGreen + C.Italics + "Coming soon!"}, 1, false), new IButton()
{
@Override
public void onClick(Player player, ClickType clickType)
{
player.sendMessage(F.main("Shop", "Coming soon!"));
}
});*/
type = GadgetType.TAUNT; type = GadgetType.TAUNT;
lore = getLore(ownedCount.get(type), maxCount.get(type), "Placeholder", "Visible in Games", enabled.get(type)); lore = getLore(ownedCount.get(type), maxCount.get(type), "Taunt your enemies or just show off. Use /taunt to have a good time!", "Visible in Games", enabled.get(type));
addButton(tauntSlot, new ShopItem(Material.NAME_TAG, "Taunts", lore, 1, false), new OpenTaunts(this, enabled.get(type))); addButton(tauntSlot, new ShopItem(Material.NAME_TAG, "Taunts", lore, 1, false), new OpenTaunts(this, enabled.get(type)));
if (enabled.containsKey(type)) addGlow(tauntSlot); if (enabled.containsKey(type)) addGlow(tauntSlot);

View File

@ -10,21 +10,27 @@ import org.bukkit.Bukkit;
import org.bukkit.Color; import org.bukkit.Color;
import org.bukkit.FireworkEffect; import org.bukkit.FireworkEffect;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.util.Vector;
import mineplex.core.common.Rank; import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
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.UtilFirework;
import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilText;
import mineplex.core.disguise.disguises.DisguiseSkeleton; import mineplex.core.disguise.disguises.DisguiseSkeleton;
import mineplex.core.events.EnableArcadeSpawnEvent; import mineplex.core.events.EnableArcadeSpawnEvent;
import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import mineplex.core.gadget.gadgets.morph.managers.UtilMorph;
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.recharge.Recharge;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
@ -32,19 +38,22 @@ public class EternalTaunt extends TauntGadget
{ {
private static final int COOLDOWN = 30000; private static final int COOLDOWN = 30000;
private static final int PVP_COOLDOWN = 10000;
private Map<UUID, List<EternalClock>> _clocks = new HashMap<>(); private Map<UUID, List<Item>> _clocks = 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[]{C.cGray + "Although the Eternal has been around forever, he waited to long for a worthy opponent he turned to bones.",
-15, Material.GLASS, (byte) 0); "",
C.cWhite + "Use /taunt in game to show how long you've been waiting.",
C.cRed + "Cannot be used while in PvP!"}, LineFormat.LORE),
-15, Material.WATCH, (byte) 0);
setCanPlayWithPvp(false); setCanPlayWithPvp(false);
setPvpCooldown(10000); setPvpCooldown(PVP_COOLDOWN);
setShouldPlay(true); setShouldPlay(true);
setEventType(UpdateType.FAST); setEventType(UpdateType.FAST);
addDisabledGames(GameType.SMASH, GameType.SMASHTEAMS, GameType.SMASHDOMINATION); addDisabledGames(GameType.SMASH, GameType.SMASHTEAMS, GameType.SMASHDOMINATION);
setImmovable(20);
} }
@Override @Override
@ -53,7 +62,7 @@ public class EternalTaunt extends TauntGadget
if (!Recharge.Instance.use(player, getName(), COOLDOWN, true, false, "Cosmetics")) if (!Recharge.Instance.use(player, getName(), COOLDOWN, true, false, "Cosmetics"))
return; return;
UtilFirework.playFirework(player.getLocation(), FireworkEffect.builder().with(FireworkEffect.Type.BALL_LARGE).withColor(Color.fromRGB(255, 175, 175)).withFade(Color.RED).build()); 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<>(); /*List<EternalClock> clocks = new ArrayList<>();
EnableArcadeSpawnEvent enableArcadeSpawnEvent = new EnableArcadeSpawnEvent(true); EnableArcadeSpawnEvent enableArcadeSpawnEvent = new EnableArcadeSpawnEvent(true);
Bukkit.getPluginManager().callEvent(enableArcadeSpawnEvent); Bukkit.getPluginManager().callEvent(enableArcadeSpawnEvent);
@ -61,7 +70,7 @@ public class EternalTaunt extends TauntGadget
// Creates armor stands // Creates armor stands
for (EternalClock.ClockPosition clockPosition : EternalClock.ClockPosition.values()) for (EternalClock.ClockPosition clockPosition : EternalClock.ClockPosition.values())
{ {
EternalClock eternalClock = new EternalClock(player, clockPosition); EternalClock eternalClock = new EternalClock(player, clockPosition, this);
eternalClock.createStand(); eternalClock.createStand();
clocks.add(eternalClock); clocks.add(eternalClock);
} }
@ -69,7 +78,9 @@ public class EternalTaunt extends TauntGadget
_clocks.put(player.getUniqueId(), clocks); _clocks.put(player.getUniqueId(), clocks);
enableArcadeSpawnEvent = new EnableArcadeSpawnEvent(false); enableArcadeSpawnEvent = new EnableArcadeSpawnEvent(false);
Bukkit.getPluginManager().callEvent(enableArcadeSpawnEvent); Bukkit.getPluginManager().callEvent(enableArcadeSpawnEvent);*/
_clocks.put(player.getUniqueId(), new ArrayList<>());
Bukkit.broadcastMessage(F.main("Taunt", F.name(player.getName()) + " waited so long they turned to bones.")); Bukkit.broadcastMessage(F.main("Taunt", F.name(player.getName()) + " waited so long they turned to bones."));
@ -83,13 +94,34 @@ public class EternalTaunt extends TauntGadget
if (!_clocks.containsKey(player.getUniqueId())) if (!_clocks.containsKey(player.getUniqueId()))
return; return;
// Keps armorstand close to player int i = getPlayerTicks(player);
for (EternalClock eternalClock : _clocks.get(player.getUniqueId()))
EnableArcadeSpawnEvent enableArcadeSpawnEvent = new EnableArcadeSpawnEvent(true);
Bukkit.getPluginManager().callEvent(enableArcadeSpawnEvent);
Item clock = player.getWorld().dropItem(player.getLocation().add(0.5, 1.5, 0.5),
ItemStackFactory.Instance.CreateStack(Material.WATCH, (byte) 0, 1, " " + i));
enableArcadeSpawnEvent = new EnableArcadeSpawnEvent(false);
Bukkit.getPluginManager().callEvent(enableArcadeSpawnEvent);
Vector vel = new Vector(Math.sin(i * 9/5d), 0, Math.cos(i * 9/5d));
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);
_clocks.get(player.getUniqueId()).add(clock);
if (_clocks.get(player.getUniqueId()).size() >= 5)
{ {
eternalClock.moveStand(); _clocks.get(player.getUniqueId()).get(0).remove();
_clocks.get(player.getUniqueId()).remove(0);
} }
if (getPlayerTicks(player) >= 60) if (i % 2 == 0)
player.playSound(player.getLocation(), Sound.CLICK, 1f, 1f);
else
player.playSound(player.getLocation(), Sound.CLICK, 0.5f, 0.5f);
if (i >= 15)
{ {
finish(player); finish(player);
} }
@ -101,7 +133,7 @@ public class EternalTaunt extends TauntGadget
UtilMorph.undisguise(player, Manager.getDisguiseManager()); UtilMorph.undisguise(player, Manager.getDisguiseManager());
if (_clocks.containsKey(player.getUniqueId())) if (_clocks.containsKey(player.getUniqueId()))
{ {
_clocks.get(player.getUniqueId()).forEach(eternalClock -> eternalClock.removeStand()); _clocks.get(player.getUniqueId()).forEach(c -> c.remove());
_clocks.get(player.getUniqueId()).clear(); _clocks.get(player.getUniqueId()).clear();
_clocks.remove(player.getUniqueId()); _clocks.remove(player.getUniqueId());
} }
@ -112,7 +144,20 @@ public class EternalTaunt extends TauntGadget
{ {
if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.ETERNAL)) if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.ETERNAL))
{ {
Manager.getDonationManager().Get(event.getPlayer()).AddUnknownSalesPackagesOwned(getName()); Manager.getDonationManager().Get(event.getPlayer()).addOwnedUnknownSalesPackage(getName());
}
}
@EventHandler
public void onClockPickup(PlayerPickupItemEvent event)
{
for (List<Item> clocks : _clocks.values())
{
for (Item item : clocks)
{
if (event.getItem().equals(item))
event.setCancelled(true);
}
} }
} }

View File

@ -1,78 +0,0 @@
package mineplex.core.gadget.gadgets.taunts.eternal;
import org.bukkit.Location;
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()
{
Location clockLocation = _player.getLocation().clone().add(_player.getLocation().getDirection().multiply(-1))
.add(0, _clockPosition.getY(), 0);
_armorStand = _player.getWorld().spawn(clockLocation, 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;
}
Location clockLocation = _player.getLocation().clone().add(_player.getLocation().getDirection().multiply(-1))
.add(0, _clockPosition.getY(), 0);
_armorStand.teleport(clockLocation);
}
public void removeStand()
{
_armorStand.remove();
}
public enum ClockPosition
{
A(0.5),
B(1),
C(1.5),
D(2);
private double _y;
ClockPosition(double y)
{
_y = y;
}
public double getY()
{
return _y;
}
}
}

View File

@ -11,7 +11,6 @@ import java.util.UUID;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerMoveEvent;
import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.gadgets.taunts.GameType; import mineplex.core.gadget.gadgets.taunts.GameType;
@ -32,8 +31,6 @@ public abstract class TauntGadget extends Gadget
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;
/** Sets the amount of time in ticks the player won't be able to move */
private int _immovable = 0;
/** List of games where this item is disabled */ /** List of games where this item is disabled */
private List<GameType> _disabledGames = new ArrayList<>(); private List<GameType> _disabledGames = new ArrayList<>();
/** The ticks that passed since the player started the effect */ /** The ticks that passed since the player started the effect */
@ -81,7 +78,7 @@ public abstract class TauntGadget extends Gadget
public void play(Player player) public void play(Player player)
{ {
onPlay(player); onPlay(player);
int ticks = _ticksPerPlayer.get(player.getUniqueId()) + 1; int ticks = getPlayerTicks(player) + 1;
_ticksPerPlayer.put(player.getUniqueId(), ticks); _ticksPerPlayer.put(player.getUniqueId(), ticks);
} }
@ -120,11 +117,6 @@ public abstract class TauntGadget extends Gadget
_disabledGames.addAll(Arrays.asList(disabledGames)); _disabledGames.addAll(Arrays.asList(disabledGames));
} }
public void setImmovable(int ticks)
{
_immovable = ticks;
}
public boolean canPlayWithPvp() public boolean canPlayWithPvp()
{ {
return _canPlayWithPvp; return _canPlayWithPvp;
@ -156,25 +148,9 @@ public abstract class TauntGadget extends Gadget
for (Player player : getActive()) for (Player player : getActive())
{ {
if (_ticksPerPlayer.containsKey(player.getUniqueId()))
play(player); play(player);
} }
} }
@EventHandler
public void onPlayerMove(PlayerMoveEvent event)
{
if (!_ticksPerPlayer.containsKey(event.getPlayer().getUniqueId()))
return;
if (!isActive(event.getPlayer()))
return;
int ticks = _ticksPerPlayer.get(event.getPlayer().getUniqueId());
if (ticks < _immovable)
{
event.setCancelled(true);
}
}
} }

View File

@ -162,7 +162,7 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable
int trickOrTreatChestsReceived = 0; int trickOrTreatChestsReceived = 0;
int thankfulChestsReceived = 0; int thankfulChestsReceived = 0;
int gingerbreadChestsReceived = 0; int gingerbreadChestsReceived = 0;
int minestrikeChestsReceived = 0; //int minestrikeChestsReceived = 0;
for (CoinTransactionToken transaction : donor.getCoinTransactions()) for (CoinTransactionToken transaction : donor.getCoinTransactions())
{ {
@ -296,7 +296,7 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable
} }
} }
if (transaction.SalesPackageName.startsWith("Minestrike Chest")) /*if (transaction.SalesPackageName.startsWith("Minestrike Chest"))
{ {
if (transaction.Coins == 0 && transaction.Gems == 0) if (transaction.Coins == 0 && transaction.Gems == 0)
{ {
@ -305,7 +305,7 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable
else if (transaction.SalesPackageName.split(" ").length == 2) else if (transaction.SalesPackageName.split(" ").length == 2)
minestrikeChestsReceived += 1; minestrikeChestsReceived += 1;
} }
} }*/
if (transaction.SalesPackageName.startsWith("Valentines Gift")) if (transaction.SalesPackageName.startsWith("Valentines Gift"))
{ {
if (transaction.Coins == 0 && transaction.Gems == 0) if (transaction.Coins == 0 && transaction.Gems == 0)
@ -378,7 +378,7 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable
caller.sendMessage(C.cBlue + "Trick or Treat Chests Received: " + C.cYellow + trickOrTreatChestsReceived); caller.sendMessage(C.cBlue + "Trick or Treat Chests Received: " + C.cYellow + trickOrTreatChestsReceived);
caller.sendMessage(C.cBlue + "Thankful Chests Received: " + C.cYellow + thankfulChestsReceived); caller.sendMessage(C.cBlue + "Thankful Chests Received: " + C.cYellow + thankfulChestsReceived);
caller.sendMessage(C.cBlue + "Gingerbread Chests Received: " + C.cYellow + gingerbreadChestsReceived); caller.sendMessage(C.cBlue + "Gingerbread Chests Received: " + C.cYellow + gingerbreadChestsReceived);
caller.sendMessage(C.cBlue + "Minestrike Chests Received: " + C.cYellow + minestrikeChestsReceived); //caller.sendMessage(C.cBlue + "Minestrike Chests Received: " + C.cYellow + minestrikeChestsReceived);
caller.sendMessage(C.cBlue + "Game Amplifiers Received: " + C.cYellow + boostersReceived); caller.sendMessage(C.cBlue + "Game Amplifiers Received: " + C.cYellow + boostersReceived);
caller.sendMessage(C.cBlue + "Rune Amplifiers (20 min) Received: " + C.cYellow + runeAmplifier20); caller.sendMessage(C.cBlue + "Rune Amplifiers (20 min) Received: " + C.cYellow + runeAmplifier20);
caller.sendMessage(C.cBlue + "Rune Amplifiers (60 min) Received: " + C.cYellow + runeAmplifier60); caller.sendMessage(C.cBlue + "Rune Amplifiers (60 min) Received: " + C.cYellow + runeAmplifier60);

View File

@ -30,7 +30,6 @@ import mineplex.staffServer.salespackage.salespackages.LifetimeHero;
import mineplex.staffServer.salespackage.salespackages.LifetimeLegend; import mineplex.staffServer.salespackage.salespackages.LifetimeLegend;
import mineplex.staffServer.salespackage.salespackages.LifetimeTitan; import mineplex.staffServer.salespackage.salespackages.LifetimeTitan;
import mineplex.staffServer.salespackage.salespackages.LifetimeUltra; import mineplex.staffServer.salespackage.salespackages.LifetimeUltra;
import mineplex.staffServer.salespackage.salespackages.MinestrikeChest;
import mineplex.staffServer.salespackage.salespackages.MythicalChest; import mineplex.staffServer.salespackage.salespackages.MythicalChest;
import mineplex.staffServer.salespackage.salespackages.OldChest; import mineplex.staffServer.salespackage.salespackages.OldChest;
import mineplex.staffServer.salespackage.salespackages.OmegaChest; import mineplex.staffServer.salespackage.salespackages.OmegaChest;
@ -97,7 +96,7 @@ public class SalesPackageManager extends MiniPlugin
AddSalesPackage(new PowerPlayClub(this, true)); AddSalesPackage(new PowerPlayClub(this, true));
AddSalesPackage(new OmegaChest(this)); AddSalesPackage(new OmegaChest(this));
AddSalesPackage(new HauntedChest(this)); AddSalesPackage(new HauntedChest(this));
AddSalesPackage(new MinestrikeChest(this)); //AddSalesPackage(new MinestrikeChest(this));
AddSalesPackage(new TrickOrTreatChest(this)); AddSalesPackage(new TrickOrTreatChest(this));
AddSalesPackage(new ThankfulChest(this)); AddSalesPackage(new ThankfulChest(this));
@ -169,7 +168,7 @@ public class SalesPackageManager extends MiniPlugin
coinBuilder = coinBuilder.extra("[").color("gray").extra(salesPackage.getName()).color("green").click("run_command", "/display " + playerName + " " + salesPackage.getName()).extra("] ").color("gray"); coinBuilder = coinBuilder.extra("[").color("gray").extra(salesPackage.getName()).color("green").click("run_command", "/display " + playerName + " " + salesPackage.getName()).extra("] ").color("gray");
} }
else if (salesPackage instanceof MythicalChest || salesPackage instanceof AncientChest || salesPackage instanceof OldChest || salesPackage instanceof IlluminatedChest || salesPackage instanceof FreedomChest || salesPackage instanceof HauntedChest || salesPackage instanceof TrickOrTreatChest else if (salesPackage instanceof MythicalChest || salesPackage instanceof AncientChest || salesPackage instanceof OldChest || salesPackage instanceof IlluminatedChest || salesPackage instanceof FreedomChest || salesPackage instanceof HauntedChest || salesPackage instanceof TrickOrTreatChest
|| salesPackage instanceof GingerbreadChest || salesPackage instanceof MinestrikeChest) || salesPackage instanceof GingerbreadChest /*|| salesPackage instanceof MinestrikeChest*/)
{ {
chestBuilder = chestBuilder.extra("[").color("gray").extra(salesPackage.getName()).color("green").click("run_command", "/display " + playerName + " " + salesPackage.getName()).extra("] ").color("gray"); chestBuilder = chestBuilder.extra("[").color("gray").extra(salesPackage.getName()).color("green").click("run_command", "/display " + playerName + " " + salesPackage.getName()).extra("] ").color("gray");
} }