Titan Giveaway:
- Added Titan pumpkin animation Titan Perks (For later, Removed from Menu): - Added Kronos Particle
This commit is contained in:
parent
36fabf93b6
commit
67a1f4ce8d
@ -3,19 +3,6 @@ package mineplex.core.gadget;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.achievement.AchievementManager;
|
||||
@ -28,7 +15,42 @@ import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.disguise.DisguiseManager;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.gadget.event.GadgetCollideEntityEvent;
|
||||
import mineplex.core.gadget.gadgets.*;
|
||||
import mineplex.core.gadget.gadgets.ItemBatGun;
|
||||
import mineplex.core.gadget.gadgets.ItemCoinBomb;
|
||||
import mineplex.core.gadget.gadgets.ItemDuelingSword;
|
||||
import mineplex.core.gadget.gadgets.ItemEtherealPearl;
|
||||
import mineplex.core.gadget.gadgets.ItemFirework;
|
||||
import mineplex.core.gadget.gadgets.ItemFleshHook;
|
||||
import mineplex.core.gadget.gadgets.ItemMelonLauncher;
|
||||
import mineplex.core.gadget.gadgets.ItemPaintballGun;
|
||||
import mineplex.core.gadget.gadgets.ItemPaintbrush;
|
||||
import mineplex.core.gadget.gadgets.ItemTNT;
|
||||
import mineplex.core.gadget.gadgets.MorphBat;
|
||||
import mineplex.core.gadget.gadgets.MorphBlaze;
|
||||
import mineplex.core.gadget.gadgets.MorphBlock;
|
||||
import mineplex.core.gadget.gadgets.MorphBunny;
|
||||
import mineplex.core.gadget.gadgets.MorphChicken;
|
||||
import mineplex.core.gadget.gadgets.MorphCow;
|
||||
import mineplex.core.gadget.gadgets.MorphCreeper;
|
||||
import mineplex.core.gadget.gadgets.MorphEnderman;
|
||||
import mineplex.core.gadget.gadgets.MorphPig;
|
||||
import mineplex.core.gadget.gadgets.MorphPumpkinKing;
|
||||
import mineplex.core.gadget.gadgets.MorphSlime;
|
||||
import mineplex.core.gadget.gadgets.MorphVillager;
|
||||
import mineplex.core.gadget.gadgets.MorphWither;
|
||||
import mineplex.core.gadget.gadgets.OutfitRaveSuit;
|
||||
import mineplex.core.gadget.gadgets.OutfitSpaceSuit;
|
||||
import mineplex.core.gadget.gadgets.OutfitTeam;
|
||||
import mineplex.core.gadget.gadgets.ParticleBlizzard;
|
||||
import mineplex.core.gadget.gadgets.ParticleEnchant;
|
||||
import mineplex.core.gadget.gadgets.ParticleFairy;
|
||||
import mineplex.core.gadget.gadgets.ParticleFireRings;
|
||||
import mineplex.core.gadget.gadgets.ParticleFoot;
|
||||
import mineplex.core.gadget.gadgets.ParticleGreen;
|
||||
import mineplex.core.gadget.gadgets.ParticleHeart;
|
||||
import mineplex.core.gadget.gadgets.ParticleHelix;
|
||||
import mineplex.core.gadget.gadgets.ParticleLegend;
|
||||
import mineplex.core.gadget.gadgets.ParticleRain;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import mineplex.core.gadget.types.GadgetType;
|
||||
import mineplex.core.gadget.types.ItemGadget;
|
||||
@ -43,6 +65,19 @@ import mineplex.core.pet.PetManager;
|
||||
import mineplex.core.preferences.PreferencesManager;
|
||||
import mineplex.core.projectile.ProjectileManager;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class GadgetManager extends MiniPlugin
|
||||
{
|
||||
private CoreClientManager _clientManager;
|
||||
@ -140,6 +175,7 @@ public class GadgetManager extends MiniPlugin
|
||||
addGadget(new ParticleFairy(this));
|
||||
addGadget(new ParticleLegend(this));
|
||||
addGadget(new ParticleBlizzard(this));
|
||||
//addGadget(new ParticleKronos(this));
|
||||
|
||||
// Music
|
||||
addGadget(new MusicGadget(this, "13 Disc", new String[] {""}, -2, 2256, 178000));
|
||||
|
@ -0,0 +1,87 @@
|
||||
package mineplex.core.gadget.gadgets;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.types.ParticleGadget;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
public class ParticleKronos extends ParticleGadget
|
||||
{
|
||||
private HashMap<Player, ParticleKronosData> _glass = new HashMap<Player, ParticleKronosData>();
|
||||
|
||||
public ParticleKronos(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Titanic Aura", new String[]
|
||||
{
|
||||
C.cWhite + "A symbol of Titan power",
|
||||
C.cWhite + "whos ancestry traces back to Kronos,",
|
||||
C.cWhite + "Titan Lord of Time.",
|
||||
" ",
|
||||
C.cRed + "???"
|
||||
//When purchasable: C.cRed + "Unlocked with Titan Rank"
|
||||
},
|
||||
-2,
|
||||
Material.EYE_OF_ENDER, (byte)0);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void playParticle(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
for (Player player : GetActive())
|
||||
{
|
||||
if (!shouldDisplay(player))
|
||||
continue;
|
||||
|
||||
//Create
|
||||
if (!_glass.containsKey(player))
|
||||
_glass.put(player, new ParticleKronosData(player));
|
||||
|
||||
_glass.get(player).update(Manager.isMoving(player));
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void titanOwner(PlayerJoinEvent event)
|
||||
{
|
||||
/*Until it becomes purchasable*/if (Manager.getClientManager().Get(event.getPlayer()).GetRank().equals(Rank.TITAN))
|
||||
//if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.TITAN))
|
||||
{
|
||||
Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void DisableCustom(Player player)
|
||||
{
|
||||
if (_active.remove(player))
|
||||
UtilPlayer.message(player, F.main("Gadget", "You unsummoned " + F.elem(GetName()) + "."));
|
||||
|
||||
clean(player);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void quit(PlayerQuitEvent event)
|
||||
{
|
||||
clean(event.getPlayer());
|
||||
}
|
||||
|
||||
private void clean(Player player)
|
||||
{
|
||||
_glass.remove(player);
|
||||
}
|
||||
}
|
@ -0,0 +1,112 @@
|
||||
package mineplex.core.gadget.gadgets;
|
||||
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class ParticleKronosData
|
||||
{
|
||||
private static class Sin
|
||||
{
|
||||
static final float[] table = new float[16384];
|
||||
|
||||
static
|
||||
{
|
||||
for (int i = 0; i < 16384; i++)
|
||||
{
|
||||
table[i] = ((float)Math.sin((i + 0.5F) / 16384.0F * 6.283186F));
|
||||
}
|
||||
for (int i = 0; i < 360; i += 90)
|
||||
{
|
||||
table[((int)(i * 45.511112F) & 0x3FFF)] = ((float)Math.sin(i * 0.01745329F));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int _step;
|
||||
private Player _player;
|
||||
|
||||
public ParticleKronosData(Player player)
|
||||
{
|
||||
_player = player;
|
||||
}
|
||||
|
||||
public void update(boolean moving)
|
||||
{
|
||||
if (moving)
|
||||
UtilParticle.PlayParticle(ParticleType.ENCHANTMENT_TABLE, _player.getLocation().add(0, 1f, 0), 0.2f, 0.2f, 0.2f, 0, 1,
|
||||
ViewDist.NORMAL, UtilServer.getPlayers());
|
||||
else
|
||||
{
|
||||
Vector v = new Vector();
|
||||
Location loc = _player.getLocation().clone();
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
_step += 1;
|
||||
|
||||
float f1 = 3.141593F / 120 * _step;
|
||||
float f2 = sinFloat(f1 * 2.718282F * 8 / 120) * 1F;
|
||||
float f3 = f2 * 3.141593F * f1;
|
||||
|
||||
v.setX(1F * f2 * -cosFloat(f3));
|
||||
v.setZ(1F * f2 * -sinFloat(f3));
|
||||
v.setY(0.6F * f2 + 0.6F + 2.0F);
|
||||
|
||||
rotateVector(v, 0, 0, 0);
|
||||
|
||||
UtilParticle.PlayParticle(ParticleType.ENCHANTMENT_TABLE, loc.add(v), 0, 0, 0, 0, 1,
|
||||
ViewDist.NORMAL, UtilServer.getPlayers());
|
||||
|
||||
loc.subtract(v);
|
||||
}
|
||||
|
||||
//Sound
|
||||
_player.getWorld().playSound(_player.getLocation(), Sound.CAT_HISS, 0.2f, 1f);
|
||||
}
|
||||
}
|
||||
|
||||
private void rotateVector(Vector vector, double x, double y, double z)
|
||||
{
|
||||
double cos;
|
||||
double sin;
|
||||
double new1;
|
||||
double new2;
|
||||
|
||||
//x-axis
|
||||
cos = Math.cos(x);
|
||||
sin = Math.sin(x);
|
||||
new1 = vector.getY() * cos - vector.getZ() * sin;
|
||||
new2 = vector.getY() * sin + vector.getZ() * cos;
|
||||
vector.setY(new1).setZ(new2);
|
||||
|
||||
//y-axis
|
||||
cos = Math.cos(y);
|
||||
sin = Math.sin(y);
|
||||
new1 = vector.getX() * cos - vector.getZ() * sin;
|
||||
new2 = vector.getX() * sin + vector.getZ() * cos;
|
||||
vector.setX(new1).setZ(new2);
|
||||
|
||||
//z-axis
|
||||
cos = Math.cos(z);
|
||||
sin = Math.sin(z);
|
||||
new1 = vector.getX() * cos - vector.getY() * sin;
|
||||
new2 = vector.getX() * sin + vector.getY() * cos;
|
||||
vector.setX(new1).setY(new2);
|
||||
}
|
||||
|
||||
private float sinFloat(float f)
|
||||
{
|
||||
return Sin.table[((int)(f * 2607.5945F) & 0x3FFF)];
|
||||
}
|
||||
|
||||
private float cosFloat(float f)
|
||||
{
|
||||
return Sin.table[((int)((f + 1.570796F) * 2607.5945F) & 0x3FFF)];
|
||||
}
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
package mineplex.core.titangiveaway;
|
||||
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.FireworkEffect.Type;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
public class TitanGiveawayAnimation implements Listener
|
||||
{
|
||||
private Location _location;
|
||||
private Long _duration, _startTime, _worldTime;
|
||||
|
||||
public TitanGiveawayAnimation(TitanGiveawayManager manager, Location start, Long duration)
|
||||
{
|
||||
_location = start.clone();
|
||||
_duration = duration;
|
||||
_startTime = System.currentTimeMillis();
|
||||
_worldTime = start.getWorld().getTime();
|
||||
Bukkit.getPluginManager().registerEvents(this, manager.getPlugin());
|
||||
}
|
||||
|
||||
public TitanGiveawayAnimation(TitanGiveawayManager manager, Location start)
|
||||
{
|
||||
this(manager, start, 11111L);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void tick(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
if (UtilTime.elapsed(_startTime, _duration))
|
||||
{
|
||||
remove();
|
||||
return;
|
||||
}
|
||||
|
||||
_location.getWorld().setTime(UtilMath.random.nextLong());
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
player.playSound(player.getLocation(), Sound.ORB_PICKUP, 5, 5);
|
||||
UtilFirework.packetPlayFirework(player, player.getLocation(), Type.BURST, Color.RED, true, false);
|
||||
}
|
||||
}
|
||||
|
||||
private void remove()
|
||||
{
|
||||
_location.getWorld().setTime(_worldTime);
|
||||
HandlerList.unregisterAll(this);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user