Added Party and Cupid set (arrow, jump, death, particle + full set

effect)
This commit is contained in:
xGamingDudex 2016-01-09 14:07:40 +01:00
parent 5be91de006
commit f8e8669b5c
44 changed files with 1674 additions and 621 deletions

View File

@ -0,0 +1,145 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- WARNING: Eclipse auto-generated file.
Any modifications will be overwritten.
To include a user specific buildfile here, simply create one in the same
directory with the processing instruction <?eclipse.ant.import?>
as the first entry and export the buildfile again. --><project basedir="." default="build" name="Mineplex.Core">
<property environment="env"/>
<property name="REPO_DIR" value="../../"/>
<property name="Mineplex.BungeeRotator.location" value="../Mineplex.BungeeRotator"/>
<property name="Mineplex.Hub.location" value="../Mineplex.Hub"/>
<property name="Mineplex.Minecraft.Game.ClassCombat.location" value="../Mineplex.Minecraft.Game.ClassCombat"/>
<property name="Mineplex.Minecraft.Game.Core.location" value="../Mineplex.Minecraft.Game.Core"/>
<property name="Mineplex.StaffServer.location" value="../Mineplex.StaffServer"/>
<property name="Nautilus.Game.Arcade.location" value="../Nautilus.Game.Arcade"/>
<property name="ECLIPSE_HOME" value="../../../../../Filer/eclipse/"/>
<property name="Mineplex.Core.Common.location" value="../Mineplex.Core.Common"/>
<property name="Mineplex.Database.location" value="../Mineplex.Database"/>
<property name="Mineplex.ServerData.location" value="../Mineplex.ServerData"/>
<property name="debuglevel" value="source,lines,vars"/>
<property name="target" value="1.7"/>
<property name="source" value="1.7"/>
<path id="Mineplex.ServerData.classpath">
<pathelement location="${Mineplex.ServerData.location}/bin"/>
<pathelement location="${REPO_DIR}/Plugins/Libraries/jedis-2.4.2.jar"/>
<pathelement location="${REPO_DIR}/Plugins/Libraries/gson-2.2.1.jar"/>
<pathelement location="${REPO_DIR}/Plugins/Libraries/commons-pool2-2.2.jar"/>
</path>
<path id="Mineplex.Database.classpath">
<pathelement location="${Mineplex.Database.location}/bin"/>
<pathelement location="${REPO_DIR}/Plugins/Libraries/jooq-meta-3.5.2.jar"/>
<pathelement location="${REPO_DIR}/Plugins/Libraries/jooq-codegen-3.5.2.jar"/>
<pathelement location="${REPO_DIR}/Plugins/Libraries/jooq-3.5.2.jar"/>
</path>
<path id="Mineplex.Core.Common.classpath">
<pathelement location="${Mineplex.Core.Common.location}/bin"/>
<pathelement location="${REPO_DIR}/Plugins/Libraries/craftbukkit.jar"/>
</path>
<path id="Mineplex.Core.classpath">
<pathelement location="bin"/>
<pathelement location="${REPO_DIR}/Plugins/Libraries/httpcore-4.2.jar"/>
<pathelement location="${REPO_DIR}/Plugins/Libraries/httpclient-4.2.jar"/>
<pathelement location="${REPO_DIR}/Plugins/Libraries/commons-codec-1.6.jar"/>
<path refid="Mineplex.ServerData.classpath"/>
<pathelement location="${REPO_DIR}/Plugins/Libraries/jedis-2.4.2.jar"/>
<pathelement location="${REPO_DIR}/Plugins/Libraries/commons-pool2-2.2.jar"/>
<pathelement location="${REPO_DIR}/Plugins/Libraries/commons-dbcp2-2.0.1.jar"/>
<path refid="Mineplex.Database.classpath"/>
<pathelement location="${REPO_DIR}/Plugins/Libraries/jooq-3.5.2.jar"/>
<pathelement location="${REPO_DIR}/Plugins/Libraries/craftbukkit.jar"/>
<path refid="Mineplex.Core.Common.classpath"/>
<pathelement location="${REPO_DIR}/Plugins/Libraries/NoCheatPlus.jar"/>
</path>
<target name="init">
<mkdir dir="bin"/>
<copy includeemptydirs="false" todir="bin">
<fileset dir="src">
<exclude name="**/*.java"/>
</fileset>
</copy>
</target>
<target name="clean">
<delete dir="bin"/>
</target>
<target depends="clean" name="cleanall">
<ant antfile="build.xml" dir="${Mineplex.Core.Common.location}" inheritAll="false" target="clean"/>
<ant antfile="build.xml" dir="${Mineplex.Database.location}" inheritAll="false" target="clean"/>
<ant antfile="build.xml" dir="${Mineplex.ServerData.location}" inheritAll="false" target="clean"/>
</target>
<target depends="build-subprojects,build-project" name="build"/>
<target name="build-subprojects">
<ant antfile="build.xml" dir="${Mineplex.Core.Common.location}" inheritAll="false" target="build-project">
<propertyset>
<propertyref name="build.compiler"/>
</propertyset>
</ant>
<ant antfile="build.xml" dir="${Mineplex.Database.location}" inheritAll="false" target="build-project">
<propertyset>
<propertyref name="build.compiler"/>
</propertyset>
</ant>
<ant antfile="build.xml" dir="${Mineplex.ServerData.location}" inheritAll="false" target="build-project">
<propertyset>
<propertyref name="build.compiler"/>
</propertyset>
</ant>
</target>
<target depends="init" name="build-project">
<echo message="${ant.project.name}: ${ant.file}"/>
<javac debug="true" debuglevel="${debuglevel}" destdir="bin" includeantruntime="false" source="${source}" target="${target}">
<src path="src"/>
<classpath refid="Mineplex.Core.classpath"/>
</javac>
</target>
<target description="Build all projects which reference this project. Useful to propagate changes." name="build-refprojects">
<ant antfile="build.xml" dir="${Mineplex.BungeeRotator.location}" inheritAll="false" target="clean"/>
<ant antfile="build.xml" dir="${Mineplex.BungeeRotator.location}" inheritAll="false" target="build">
<propertyset>
<propertyref name="build.compiler"/>
</propertyset>
</ant>
<ant antfile="build.xml" dir="${Mineplex.Hub.location}" inheritAll="false" target="clean"/>
<ant antfile="build.xml" dir="${Mineplex.Hub.location}" inheritAll="false" target="build">
<propertyset>
<propertyref name="build.compiler"/>
</propertyset>
</ant>
<ant antfile="build.xml" dir="${Mineplex.Minecraft.Game.ClassCombat.location}" inheritAll="false" target="clean"/>
<ant antfile="build.xml" dir="${Mineplex.Minecraft.Game.ClassCombat.location}" inheritAll="false" target="build">
<propertyset>
<propertyref name="build.compiler"/>
</propertyset>
</ant>
<ant antfile="build.xml" dir="${Mineplex.Minecraft.Game.Core.location}" inheritAll="false" target="clean"/>
<ant antfile="build.xml" dir="${Mineplex.Minecraft.Game.Core.location}" inheritAll="false" target="build">
<propertyset>
<propertyref name="build.compiler"/>
</propertyset>
</ant>
<ant antfile="build.xml" dir="${Mineplex.StaffServer.location}" inheritAll="false" target="clean"/>
<ant antfile="build.xml" dir="${Mineplex.StaffServer.location}" inheritAll="false" target="build">
<propertyset>
<propertyref name="build.compiler"/>
</propertyset>
</ant>
<ant antfile="build.xml" dir="${Nautilus.Game.Arcade.location}" inheritAll="false" target="clean"/>
<ant antfile="build.xml" dir="${Nautilus.Game.Arcade.location}" inheritAll="false" target="build">
<propertyset>
<propertyref name="build.compiler"/>
</propertyset>
</ant>
</target>
<target description="copy Eclipse compiler jars to ant lib directory" name="init-eclipse-compiler">
<copy todir="${ant.library.dir}">
<fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/>
</copy>
<unzip dest="${ant.library.dir}">
<patternset includes="jdtCompilerAdapter.jar"/>
<fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/>
</unzip>
</target>
<target description="compile project with Eclipse compiler" name="build-eclipse-compiler">
<property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
<antcall target="build"/>
</target>
</project>

View File

@ -0,0 +1,10 @@
package mineplex.core.common.shape;
import org.bukkit.Location;
public interface ICosmeticShape
{
public void display(Location loc);
}

View File

@ -0,0 +1,166 @@
package mineplex.core.common.shape;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.bukkit.util.Vector;
public class Shape
{
protected final static double DefaultDencity = 1;
protected HashSet<Vector> _points = new HashSet<Vector>();
public Shape(){}
public Shape(Collection<Vector> points){
this._points.addAll(points);
}
public Shape(Vector...points)
{
for(Vector v : points) this._points.add(v);
}
public void rotateOnXAxis(double radians)
{
for(Vector v : _points)
{
double y = v.getY();
double z = v.getZ();
v.setY(y * Math.cos(radians) - z * Math.sin(radians));
v.setZ(y * Math.sin(radians) + z * Math.cos(radians));
}
}
public void rotateOnYAxis(double radians)
{
for(Vector v : _points)
{
double x = v.getX();
double z = v.getZ();
v.setX(x * Math.cos(radians) - z * Math.sin(radians));
v.setZ(x * Math.sin(radians) + z * Math.cos(radians));
}
}
public void rotateOnZAxis(double radians)
{
for(Vector v : _points)
{
double x = v.getX();
double y = v.getY();
v.setX(x * Math.cos(radians) - y * Math.sin(radians));
v.setY(x * Math.sin(radians) + y * Math.cos(radians));
}
}
/**
* Offsets all the points based on the given vector
* @param v
*/
public void add(Vector v)
{
for(Vector p : _points) p.add(v);
}
public void addPoint(Vector v)
{
_points.add(v);
}
public boolean removePoint(Vector v)
{
return _points.remove(v);
}
public Set<Vector> getPoints()
{
return new HashSet<Vector>(_points);
}
/**
* Multiply all the points by m.
* If m > 1 then the shape will become larger.
* If m < 1 then the shape will become smaller.
* If m = 1 then the shape will stay the same.
* If m < 0 then the shape will become inverted.
* @param m
*/
public void multiply(double m)
{
for(Vector v : _points) v.multiply(m);
}
public Shape clone() {
List<Vector> list = new ArrayList<Vector>();
for(Vector p : _points)
{
list.add(p.clone());
}
return new Shape(list);
}
public Vector getMidPoint()
{
return getMaxAABBCorner().subtract(getMinAABBCorner()).multiply(0.5);
}
public Vector getMaxAABBCorner()
{
Vector max = null;
for(Vector v : _points)
{
if(max == null)
{
max = v.clone();
continue;
}
if(v.getX() > max.getX()) max.setX(v.getX());
if(v.getY() > max.getY()) max.setY(v.getY());
if(v.getZ() > max.getZ()) max.setZ(v.getZ());
}
return max;
}
public Vector getMinAABBCorner()
{
Vector min = null;
for(Vector v : _points)
{
if(min == null)
{
min = v.clone();
continue;
}
if(v.getX() < min.getX()) min.setX(v.getX());
if(v.getY() < min.getY()) min.setY(v.getY());
if(v.getZ() < min.getZ()) min.setZ(v.getZ());
}
return min;
}
/*
* Returns the smallest possible BoundingBox containing this shape
* @return
* TODO
*/
public static double getRoundFactor(double length, double max)
{
return max/Math.ceil(length/max);
}
public static Vector getVectorFactor(Vector length, double maxLength)
{
return length.multiply(getRoundFactor(length.length(), maxLength));
}
}

View File

@ -0,0 +1,46 @@
package mineplex.core.common.shape;
import org.bukkit.util.Vector;
public class ShapeBox extends Shape
{
public ShapeBox(Vector localx, Vector localy, Vector localz)
{
this(localx, localy, localz, false, DefaultDencity);
}
public ShapeBox(Vector localx, Vector localy, Vector localz, boolean hollow)
{
this(localx, localy, localz, hollow, DefaultDencity);
}
public ShapeBox(Vector localx, Vector localy, Vector localz, boolean hollow, double dencity)
{
Vector x = Shape.getVectorFactor(localx, dencity);
Vector y = Shape.getVectorFactor(localx, dencity);
Vector z = Shape.getVectorFactor(localx, dencity);
int xm = (int) Math.sqrt(localx.lengthSquared()/x.lengthSquared());
int ym = (int) Math.sqrt(localy.lengthSquared()/y.lengthSquared());
int zm = (int) Math.sqrt(localz.lengthSquared()/z.lengthSquared());
for(int ix = 0; ix < xm; ix++)
{
for(int iy = 0; iy < ym; iy++)
{
for(int iz = 0; iz < zm; iz++)
{
if(hollow)
{
if(ix != 0 && ix != xm) continue;
if(iy != 0 && iy != ym) continue;
if(iz != 0 && iz != zm) continue;
}
_points.add(x.clone().multiply(ix).add(y.clone().multiply(iy)).add(z.clone().multiply(iz)));
}
}
}
}
}

View File

@ -0,0 +1,43 @@
package mineplex.core.common.shape;
import org.bukkit.util.Vector;
public class ShapeGrid extends Shape
{
/**
* Each string in the array represents a layer on the XY-plane, meaning the layers moves towards positive Z.
* Each line in the string represents a line on parallel with the X-axis, where the first line is on the top of the shape.
* Use '#' for each point and anything else for each "non-point".
* The finished shape will then be centered afterwards.
*/
public ShapeGrid(String...input)
{
this(DefaultDencity, input);
}
/**
* Each string in the array represents a layer on the XY-plane, meaning the layers moves towards positive Z.
* Each line in the string represents a line on parallel with the X-axis.
* Use '#' for each point and '_' for each "non-point".
* The finished shape will then be centered afterwards.
*/
public ShapeGrid(double dencity, String...input)
{
for(int y = 0; y < input.length; y++)
{
String[] lines = input[y].split("\n");
for(int z = 0; z < lines.length; z++)
{
String line = lines[z];
for(int x = 0; x < line.length(); x++)
{
if(line.charAt(x) == '#') addPoint(new Vector(x,-y+input.length,z).multiply(dencity));
}
}
}
add(getMidPoint().multiply(-1));
}
}

View File

@ -0,0 +1,24 @@
package mineplex.core.common.shape;
import java.util.Collection;
import org.bukkit.util.Vector;
public class ShapeMulti extends Shape
{
public ShapeMulti(Collection<Shape> shapes)
{
for(Shape shape : shapes) addShape(shape);
}
public ShapeMulti(Shape... shapes)
{
for(Shape shape : shapes) addShape(shape);
}
public void addShape(Shape shape) {
for(Vector v : shape._points) add(v);
}
}

View File

@ -0,0 +1,38 @@
package mineplex.core.common.shape;
import org.bukkit.util.Vector;
public class ShapeSphere extends Shape
{
public ShapeSphere(double r)
{
this(r,r,r);
}
public ShapeSphere(double x, double y, double z)
{
this(x, y, z, false, DefaultDencity);
}
public ShapeSphere(double x, double y, double z, boolean hollow)
{
this(x, y, z, hollow, DefaultDencity);
}
public ShapeSphere(double x, double y, double z, boolean hollow, double dencity)
{
for(double px = -x; px <= x; x += Shape.getRoundFactor(2*x, dencity))
{
for(double py = -y; py <= y; y += Shape.getRoundFactor(2*y, dencity))
{
for(double pz = -z; pz <= z; z += Shape.getRoundFactor(2*z, dencity))
{
if( hollow && px*px/x*x + py*py/y*y + pz*pz/z*z == 1) _points.add(new Vector(px,py,pz));
else if(!hollow && px*px/x*x + py*py/y*y + pz*pz/z*z <= 1) _points.add(new Vector(px,py,pz));
}
}
}
}
}

View File

@ -0,0 +1,65 @@
package mineplex.core.common.shape;
import org.bukkit.Location;
import org.bukkit.util.Vector;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
public class ShapeWings extends ShapeGrid implements ICosmeticShape
{
private String _particle;
private Vector _offsetData;
private float _speed;
private int _count;
public ShapeWings()
{
this(ParticleType.RED_DUST.particleName);
}
public ShapeWings(String particle)
{
this(particle, null, 0, 1);
}
public ShapeWings(String particle, Vector offsetData, float speed, int count)
{
super(0.15,
"##0000000000000000##",
"0##00000000000000##0",
"00##000000000000##00",
"00###0000000000###00",
"000####000000####000",
"000######00#####0000",
"0000############0000",
"00000##########00000",
"00000##########00000",
"00000####000###00000",
"00000###0000###00000",
"00000##000000##00000"
);
_particle = particle;
_offsetData = offsetData;
_speed = speed;
_count = count;
rotateOnXAxis(Math.PI/0.05);
}
@Override
public void display(Location loc)
{
Shape clone = clone();
clone.rotateOnYAxis(Math.toRadians(loc.getYaw()));
for(Vector v : clone._points)
{
Location ploc = loc.clone().add(v);
UtilParticle.PlayParticleToAll(_particle, ploc, _offsetData, _speed, _count, ViewDist.NORMAL);
}
}
}

View File

@ -1,6 +1,8 @@
package mineplex.core.common.util;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.util.Vector;
/**
* Created by Shaun on 11/12/2014.
@ -66,4 +68,9 @@ public class UtilColor
return 0;
}
}
public static Vector colorToVector(Color color)
{
return new Vector((color.getRed()/255.0)-1, color.getGreen()/255.0, color.getBlue()/255.0);
}
}

View File

@ -9,12 +9,19 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import mineplex.core.common.structs.ItemContainer;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.NBTTagLong;
public class UtilItem
{
@ -1125,4 +1132,73 @@ public class UtilItem
i.setItemMeta(im);
return i;
}
/**
*
* @param item The item stack to use as source for this Item entity
* @param loc Location of where to spawn the Item entity
* @param dropNaturaly If false then no velocity is applied. If true then it drops with random velocity like from when blocks break.
* @param allowPickup If false then it will disable pickup of this item.
* @param ticksToLive Ticks before this item should be removed from the ground. (default 6000 ticks = 5min, -1 to never remove it)
* @param allowMerge If false then the item will not merge with any other items.
* @return
*/
public static Item dropItem(ItemStack item, Location loc, boolean dropNaturaly, boolean allowPickup, int ticksToLive, boolean allowMerge)
{
Item ent;
if(dropNaturaly)
{
ent = loc.getWorld().dropItemNaturally(loc, item);
} else {
ent = loc.getWorld().dropItem(loc, item);
}
if(!allowPickup)
{
ent.setPickupDelay(32767);
}
if(ticksToLive == -1)
{
ent.setTicksLived(32768);
}
else
{
int maxAge = ((CraftWorld)loc.getWorld()).getHandle().spigotConfig.itemDespawnRate;
if(Bukkit.getPluginManager().getPlugin("Hub") != null)
{
/*
* Quick hack to bypass the hubs rough 1min entity removal.
* Have to use some reflections to reach parts of the core api.
*/
maxAge = 1200;
try
{
Class c = Class.forName("mineplex.core.updater.UpdateType");
Object seconds = c.getEnumConstants()[18];
maxAge -= (long) seconds.getClass().getDeclaredMethod("getTicksTillNextCall").invoke(seconds);
}
catch (Exception e)
{
e.printStackTrace();
}
}
ent.setTicksLived(maxAge-ticksToLive);
}
if(!allowMerge)
{
net.minecraft.server.v1_8_R3.ItemStack stack = CraftItemStack.asNMSCopy(ent.getItemStack());
NBTTagCompound tag = stack.getTag();
if(!stack.hasTag())
{
stack.setTag(new NBTTagCompound());
tag = stack.getTag();
}
tag.set("Pickup_" + UtilMath.r(Integer.MAX_VALUE), new NBTTagLong(UtilMath.random.nextLong()));
ent.setItemStack(CraftItemStack.asBukkitCopy(stack));
}
return ent;
}
}

View File

@ -12,7 +12,26 @@ public class UtilParticle
{
public enum ViewDist
{
SHORT(8), NORMAL(24), LONG(48), LONGER(96), MAX(256);
/**
* 8 blocks
*/
SHORT(8),
/**
* 24 blocks
*/
NORMAL(24),
/**
* 48 blocks
*/
LONG(48),
/**
* 96 blocks
*/
LONGER(96),
/**
* 256 blocks
*/
MAX(256);
private int _dist;

File diff suppressed because one or more lines are too long

View File

@ -37,6 +37,8 @@ public class ParticlePage extends GadgetPage
if (slot == 26)
slot = 28;
if(slot == 35)
slot = 37;
}
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton()

View File

@ -41,7 +41,9 @@ import mineplex.core.gadget.gadgets.morph.*;
import mineplex.core.gadget.gadgets.outfit.*;
import mineplex.core.gadget.gadgets.particle.*;
import mineplex.core.gadget.set.SetCandyCane;
import mineplex.core.gadget.set.SetCupidsWings;
import mineplex.core.gadget.set.SetFrostLord;
import mineplex.core.gadget.set.SetParty;
import mineplex.core.gadget.set.SetRaveSuit;
import mineplex.core.gadget.set.SetSpaceSuit;
import mineplex.core.gadget.set.SetTitan;
@ -115,6 +117,8 @@ public class GadgetManager extends MiniPlugin
//Costumes
addSet(new SetRaveSuit(this));
addSet(new SetSpaceSuit(this));
addSet(new SetParty(this));
addSet(new SetCupidsWings(this));
}
private void CreateGadgets()
@ -184,21 +188,29 @@ public class GadgetManager extends MiniPlugin
addGadget(new ParticleTitan(this));
addGadget(new ParticleCandyCane(this));
addGadget(new ParticleCoalFumes(this));
addGadget(new ParticlePartyTime(this));
addGadget(new ParticleIHeartYou(this));
// Arrow Trails
addGadget(new ArrowTrailFrostLord(this));
addGadget(new ArrowTrailTitan(this));
addGadget(new ArrowTrailCandyCane(this));
addGadget(new ArrowTrailConfetti(this));
addGadget(new ArrowTrailCupid(this));
// Death Effect
addGadget(new DeathFrostLord(this));
addGadget(new DeathTitan(this));
addGadget(new DeathCandyCane(this));
addGadget(new DeathPinataBurst(this));
addGadget(new DeathCupidsBorkenHeart(this));
// Double Jump
addGadget(new DoubleJumpFrostLord(this));
addGadget(new DoubleJumpTitan(this));
addGadget(new DoubleJumpCandyCane(this));
addGadget(new DoubleJumpFirecracker(this));
addGadget(new DoubleJumpCupidsWings(this));
// Hat
addGadget(new HatSanta(this));

View File

@ -0,0 +1,43 @@
package mineplex.core.gadget.gadgets.arrowtrail;
import org.bukkit.Material;
import org.bukkit.entity.Arrow;
import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
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.UtilText;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.ArrowEffectGadget;
public class ArrowTrailConfetti extends ArrowEffectGadget
{
private byte[] _data = new byte[]{1,2,4,5,6,9,10,11,12,13,14,15};
public ArrowTrailConfetti(GadgetManager manager)
{
super(manager, "Arrow Confetti",
UtilText.splitLineToArray(C.cGray + "Party like a rockstar!... With Arrows!", LineFormat.LORE),
1, Material.FIREWORK, (byte)0);
}
@Override
public void doTrail(Arrow arrow)
{
String particle = ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, _data[arrow.getTicksLived()%_data.length]);
UtilParticle.PlayParticleToAll(particle, arrow.getLocation(), null, 0, 3, ViewDist.LONGER);
}
@Override
public void doHitEffect(Arrow arrow)
{
for(byte data : _data) {
String particle = ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, data);
UtilParticle.PlayParticleToAll(particle, arrow.getLocation(), null, 0.2f, 5, ViewDist.LONGER);
}
}
}

View File

@ -0,0 +1,41 @@
package mineplex.core.gadget.gadgets.arrowtrail;
import org.bukkit.Color;
import org.bukkit.Material;
import org.bukkit.entity.Arrow;
import org.bukkit.util.Vector;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilColor;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilText;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.ArrowEffectGadget;
public class ArrowTrailCupid extends ArrowEffectGadget
{
public ArrowTrailCupid(GadgetManager manager)
{
super(manager, "Cupid's Arrows",
UtilText.splitLineToArray("❤ Spread the love with your arrows ❤", LineFormat.LORE),
1, Material.APPLE, (byte)0);
}
@Override
public void doTrail(Arrow arrow)
{
arrow.setCritical(false);
Vector color = arrow.getTicksLived()%2 == 0? UtilColor.colorToVector(Color.RED) : UtilColor.colorToVector(Color.fromRGB(16738740));
UtilParticle.PlayParticleToAll(ParticleType.RED_DUST, arrow.getLocation(), color, 1, 0, ViewDist.LONG);
}
@Override
public void doHitEffect(Arrow arrow)
{
UtilParticle.PlayParticleToAll(ParticleType.HEART, arrow.getLocation(), 0.4f, 0, 0.4f, 0.5f, 4, ViewDist.LONG);
}
}

View File

@ -2,17 +2,17 @@ package mineplex.core.gadget.gadgets.death;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.entity.Player;
import mineplex.core.blood.BloodEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilText;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.gadget.types.DeathEffectGadget;
import mineplex.core.common.util.UtilText;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.DeathEffectGadget;
public class DeathCandyCane extends DeathEffectGadget
{
@ -24,18 +24,9 @@ public class DeathCandyCane extends DeathEffectGadget
Material.SNOW_BALL, (byte)0);
}
@EventHandler
public void death(BloodEvent event)
@Override
public void onBlood(Player player, BloodEvent event)
{
if (event.getPlayer() == null)
return;
if (!IsActive(event.getPlayer()))
return;
if (!shouldDisplay(event.getPlayer()))
return;
event.setCancelled(true);
event.setItem(Material.INK_SACK, (byte) 15);

View File

@ -0,0 +1,32 @@
package mineplex.core.gadget.gadgets.death;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import mineplex.core.blood.BloodEvent;
import mineplex.core.common.util.LineFormat;
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.UtilText;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.DeathEffectGadget;
public class DeathCupidsBorkenHeart extends DeathEffectGadget
{
public DeathCupidsBorkenHeart(GadgetManager manager)
{
super(manager, "Cupid's Broken Heart",
UtilText.splitLineToArray("Make love, not war. Explode into a cloud of hearts.", LineFormat.LORE),
1, Material.APPLE, (byte) 0);
}
@Override
public void onBlood(Player player, BloodEvent event)
{
event.setCancelled(true);
UtilParticle.PlayParticleToAll(ParticleType.HEART, player.getLocation().add(0, 0.9, 0), 0.3f, 0.9f, 0.3f, 0, 40, ViewDist.NORMAL);
}
}

View File

@ -1,14 +1,14 @@
package mineplex.core.gadget.gadgets.death;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.entity.Player;
import mineplex.core.blood.BloodEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilText;
import mineplex.core.gadget.types.DeathEffectGadget;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.DeathEffectGadget;
public class DeathFrostLord extends DeathEffectGadget
{
@ -20,18 +20,9 @@ public class DeathFrostLord extends DeathEffectGadget
Material.SNOW_BALL, (byte)0, "Frost Lord");
}
@EventHandler
public void death(BloodEvent event)
@Override
public void onBlood(Player player, BloodEvent event)
{
if (event.getPlayer() == null)
return;
if (!IsActive(event.getPlayer()))
return;
if (!shouldDisplay(event.getPlayer()))
return;
event.setItem(Material.SNOW_BALL, (byte)0);
}
}

View File

@ -0,0 +1,64 @@
package mineplex.core.gadget.gadgets.death;
import org.bukkit.Color;
import org.bukkit.FireworkEffect;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.entity.Player;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.inventory.ItemStack;
import mineplex.core.blood.BloodEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilItem;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilText;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.DeathEffectGadget;
public class DeathPinataBurst extends DeathEffectGadget
{
private byte[] _data = new byte[]{1,2,4,5,6,9,10,11,12,13,14,15};
public DeathPinataBurst(GadgetManager manager)
{
super(manager, "Piñata Burst",
UtilText.splitLineToArray(C.cGray + "Oh man, I shouldn't have eaten all that candy yesterday...", LineFormat.LORE),
1, Material.SUGAR_CANE, (byte)0);
}
@Override
public void onBlood(Player player, BloodEvent event)
{
event.setCancelled(true);
Color[] colors = new Color[10];
for(int i = 0; i < colors.length; i++) {
colors[i] = Color.fromRGB(UtilMath.r(255*255*255));
}
UtilFirework.playFirework(event.getLocation(),
FireworkEffect.builder().flicker(true).trail(true).withColor(colors).with(Type.BURST).build());
for(int i = 0; i < colors.length; i++) {
colors[i] = Color.fromRGB(UtilMath.r(255*255*255));
}
UtilFirework.playFirework(event.getLocation().add(0, 1, 0),
FireworkEffect.builder().flicker(true).trail(true).withColor(colors).with(Type.BURST).build());
for(byte data : _data)
{
UtilItem.dropItem(new ItemStack(Material.WOOL, 1, (short)0, data), event.getLocation(), true, false, 20*3, false);
}
for(Material m : new Material[]{Material.SUGAR, Material.PUMPKIN_PIE, Material.CAKE})
{
for(int i = 0; i < 3; i++)
{
UtilItem.dropItem(new ItemStack(m), event.getLocation(), true, false, 20*3, false);
}
}
}
}

View File

@ -1,6 +1,7 @@
package mineplex.core.gadget.gadgets.death;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerJoinEvent;
@ -22,18 +23,9 @@ public class DeathTitan extends DeathEffectGadget
Material.FIREBALL, (byte)0);
}
@EventHandler
public void death(BloodEvent event)
@Override
public void onBlood(Player player, BloodEvent event)
{
if (event.getPlayer() == null)
return;
if (!IsActive(event.getPlayer()))
return;
if (!shouldDisplay(event.getPlayer()))
return;
event.setItem(Material.FIREBALL, (byte)0);
}
@ -45,4 +37,5 @@ public class DeathTitan extends DeathEffectGadget
Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName());
}
}
}

View File

@ -0,0 +1,72 @@
package mineplex.core.gadget.gadgets.doublejump;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map.Entry;
import org.bukkit.Color;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.util.Vector;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilColor;
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.UtilText;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.DoubleJumpEffectGadget;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class DoubleJumpCupidsWings extends DoubleJumpEffectGadget
{
private HashMap<Player, Long> _playerMap = new HashMap<>();
public DoubleJumpCupidsWings(GadgetManager manager)
{
super(manager, "Cupid's Wings",
UtilText.splitLineToArray("Spread the love, one jump at a time", LineFormat.LORE),
1, Material.APPLE, (byte)0);
}
@Override
public void doEffect(Player player)
{
_playerMap.put(player, System.currentTimeMillis()+1000);
for(int amount = 30; amount > 0; amount--)
{
Vector r = Vector.getRandom().subtract(Vector.getRandom()).normalize().multiply(2).setY(Math.random()*0.4);
Location loc = player.getLocation().add(r).add(0, 0.3, 0);
UtilParticle.PlayParticleToAll(ParticleType.RED_DUST, loc, UtilColor.colorToVector(Color.RED), 1, 0, ViewDist.NORMAL);
r = Vector.getRandom().subtract(Vector.getRandom()).normalize().multiply(2).setY(Math.random()*0.4);
loc = player.getLocation().add(r).add(0, 0.3, 0);
UtilParticle.PlayParticleToAll(ParticleType.RED_DUST, loc, UtilColor.colorToVector(Color.fromRGB(16738740)), 1, 0, ViewDist.NORMAL);
}
UtilParticle.PlayParticleToAll(ParticleType.HEART, player.getLocation().add(0, 0.4, 0), 0.8f, 0.4f, 0.8f, 0, 10, ViewDist.NORMAL);
}
@EventHandler
public void onUpdate(UpdateEvent event)
{
if(event.getType() != UpdateType.FASTEST) return;
for(Iterator<Entry<Player, Long>> it = _playerMap.entrySet().iterator(); it.hasNext();)
{
Entry<Player, Long> e = it.next();
if(e.getValue() >= System.currentTimeMillis())
{
it.remove();
continue;
}
UtilParticle.PlayParticleToAll(ParticleType.HEART, e.getKey().getLocation(), 0.3f, 0.3f, 0.3f, 0, 1, ViewDist.NORMAL);
}
}
}

View File

@ -0,0 +1,32 @@
package mineplex.core.gadget.gadgets.doublejump;
import org.bukkit.Color;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilText;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.DoubleJumpEffectGadget;
public class DoubleJumpFirecracker extends DoubleJumpEffectGadget
{
public DoubleJumpFirecracker(GadgetManager manager)
{
super(manager, "Firecracker Leap",
UtilText.splitLineToArray(C.cGray + "Oh shoot! There is a live firework at my Feet!!!", LineFormat.LORE),
1, Material.FIREWORK, (byte)0);
}
@Override
public void doEffect(Player player)
{
UtilFirework.playFirework(player.getLocation(), Type.BALL, Color.fromRGB(UtilMath.r(255*255*255)), false, false);
}
}

View File

@ -23,75 +23,67 @@ import mineplex.core.updater.event.UpdateEvent;
public class ParticleCandyCane extends ParticleGadget
{
private HashMap<UUID, Double> _map = new HashMap<UUID, Double>();
public ParticleCandyCane(GadgetManager manager)
{
super(manager, "Crushed Candy Cane",
UtilText.splitLineToArray(C.cGray + "Theres no such thing as too much Christmas Candy. Dont listen to your dentist.", LineFormat.LORE),
-3, Material.CHEST, (byte)0);
super(manager, "Crushed Candy Cane", UtilText
.splitLineToArray(C.cGray + "Theres no such thing as too much Christmas Candy. Dont listen to your dentist.", LineFormat.LORE),
-3, Material.CHEST, (byte) 0);
}
@EventHandler
public void onUpdate(UpdateEvent event)
@Override
public void playParticle(Player player, UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for(Player player : GetActive())
if (event.getType() != UpdateType.TICK) return;
boolean moving = Manager.isMoving(player);
Location loc = player.getLocation();
float y = moving ? 0.2f : 0.15f;
double yadd = getY(player);
if (!moving && yadd < 2.1)
{
if (!shouldDisplay(player))
continue;
boolean moving = Manager.isMoving(player);
Location loc = player.getLocation();
float y = moving? 0.2f : 0.15f;
double yadd = getY(player);
if(!moving && yadd < 2.1)
{
yadd += 0.05;
setY(player, yadd);
}
if(moving && yadd > 0.7)
{
yadd = 0.7;
setY(player, yadd);
}
loc.add(0, yadd, 0);
float w = 0.2f;
int a = moving? 2 : 6;
if(!moving)
{
double d = Math.PI*2 * (event.getTick()/50.0);
Vector v = new Vector(Math.sin(d), 0, Math.cos(d));
loc.add(v);
}
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 15), loc, w, y, w, 0, a, ViewDist.NORMAL);
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 1), loc, w, y, w, 0, a, ViewDist.NORMAL);
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 2), loc, w, y, w, 0, a, ViewDist.NORMAL);
yadd += 0.05;
setY(player, yadd);
}
if (moving && yadd > 0.7)
{
yadd = 0.7;
setY(player, yadd);
}
loc.add(0, yadd, 0);
float w = 0.2f;
int a = moving ? 2 : 6;
if (!moving)
{
double d = Math.PI * 2 * (event.getTick() / 50.0);
Vector v = new Vector(Math.sin(d), 0, Math.cos(d));
loc.add(v);
}
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 15), loc, w, y, w, 0, a, ViewDist.NORMAL);
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 1), loc, w, y, w, 0, a, ViewDist.NORMAL);
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 2), loc, w, y, w, 0, a, ViewDist.NORMAL);
}
@EventHandler
public void onQuit(PlayerQuitEvent event)
{
_map.remove(event.getPlayer().getUniqueId());
}
private void setY(Player p, double y)
{
_map.put(p.getUniqueId(), y);
}
private double getY(Player p)
{
Double y = _map.get(p.getUniqueId());
if(y == null) return 3;
if (y == null) return 3;
return y.doubleValue();
}

View File

@ -25,23 +25,14 @@ public class ParticleCoalFumes extends ParticleGadget
-1, Material.COAL, (byte) 0);
}
@EventHandler
public void onUpdate(UpdateEvent event)
@Override
public void playParticle(Player player, UpdateEvent event)
{
if(event.getType() != UpdateType.TICK) return;
// int dur = 200;
// int tick = Math.abs(event.getTick()%dur);
// double d = tick/(double)dur;
// float xz = (float) Math.sin(d*Math.PI);
float xz = 2;
for(Player p : GetActive())
{
UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, p.getLocation(), xz, 0, xz, 0, 5, ViewDist.NORMAL);
}
UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, player.getLocation(), xz, 0, xz, 0, 5, ViewDist.NORMAL);
}
}

View File

@ -1,53 +1,45 @@
package mineplex.core.gadget.gadgets.particle;
import org.bukkit.GameMode;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilText;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilText;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.ParticleGadget;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.gadget.GadgetManager;
public class ParticleEnchant extends ParticleGadget
{
public ParticleEnchant(GadgetManager manager)
{
super(manager, "Enchanted",
UtilText.splitLineToArray(C.cGray + "The wisdom of the universe suddenly find you extremely attractive, and wants to \'enchant\' you.", LineFormat.LORE),
-2,
Material.BOOK, (byte)0);
super(manager, "Enchanted",
UtilText.splitLineToArray(
C.cGray + "The wisdom of the universe suddenly find you extremely attractive, and wants to \'enchant\' you.",
LineFormat.LORE),
-2, Material.BOOK, (byte) 0);
}
@EventHandler
public void playParticle(UpdateEvent event)
@Override
public void playParticle(Player player, UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
if (event.getType() != UpdateType.TICK) return;
for (Player player : GetActive())
if (Manager.isMoving(player))
{
if (!shouldDisplay(player))
continue;
if (Manager.isMoving(player))
{
UtilParticle.PlayParticle(ParticleType.ENCHANTMENT_TABLE, player.getLocation().add(0, 1, 0), 0.2f, 0.2f, 0.2f, 0, 4,
ViewDist.NORMAL, UtilServer.getPlayers());
}
else
{
UtilParticle.PlayParticle(ParticleType.ENCHANTMENT_TABLE, player.getLocation().add(0, 1.4, 0), 0f, 0f, 0f, 1, 4,
ViewDist.NORMAL, UtilServer.getPlayers());
}
UtilParticle.PlayParticle(ParticleType.ENCHANTMENT_TABLE, player.getLocation().add(0, 1, 0), 0.2f, 0.2f, 0.2f, 0, 4, ViewDist.NORMAL,
UtilServer.getPlayers());
}
else
{
UtilParticle.PlayParticle(ParticleType.ENCHANTMENT_TABLE, player.getLocation().add(0, 1.4, 0), 0f, 0f, 0f, 1, 4, ViewDist.NORMAL,
UtilServer.getPlayers());
}
}
}

View File

@ -21,41 +21,25 @@ public class ParticleFairy extends ParticleGadget
public ParticleFairy(GadgetManager manager)
{
super(manager, "Flame Fairy", new String[]
{
C.cGray + "HEY! LISTEN!",
C.cGray + "HEY! LISTEN!",
C.cGray + "HEY! LISTEN!",
},
-2,
Material.BLAZE_POWDER, (byte)0);
super(manager, "Flame Fairy", new String[]{ C.cGray + "HEY! LISTEN!", C.cGray + "HEY! LISTEN!", C.cGray + "HEY! LISTEN!", }, -2,
Material.BLAZE_POWDER, (byte) 0);
}
@EventHandler
public void playParticle(UpdateEvent event)
public void playParticle(Player player, UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
if (event.getType() != UpdateType.TICK) return;
//Launch
for (Player player : GetActive())
{
if (!shouldDisplay(player))
continue;
// Create
if (!_fairy.containsKey(player)) _fairy.put(player, new ParticleFairyData(player));
//Create
if (!_fairy.containsKey(player))
_fairy.put(player, new ParticleFairyData(player));
_fairy.get(player).Update();
}
_fairy.get(player).Update();
}
@Override
public void DisableCustom(Player player)
{
if (_active.remove(player))
UtilPlayer.message(player, F.main("Gadget", "You unsummoned " + F.elem(GetName()) + "."));
if (_active.remove(player)) UtilPlayer.message(player, F.main("Gadget", "You unsummoned " + F.elem(GetName()) + "."));
clean(player);
}

View File

@ -23,59 +23,51 @@ public class ParticleFireRings extends ParticleGadget
public ParticleFireRings(GadgetManager manager)
{
super(manager, "Flame Rings",
UtilText.splitLineToArray(C.cGray + "Forged from the blazing rods of 1000 Blazes by the infamous Nether King.", LineFormat.LORE),
-2,
Material.BLAZE_POWDER, (byte)0);
super(manager, "Flame Rings",
UtilText.splitLineToArray(C.cGray + "Forged from the blazing rods of 1000 Blazes by the infamous Nether King.", LineFormat.LORE),
-2, Material.BLAZE_POWDER, (byte) 0);
}
@EventHandler
public void playParticle(UpdateEvent event)
@Override
public void playParticle(Player player, UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
if (event.getType() != UpdateType.TICK) return;
for (Player player : GetActive())
if (Manager.isMoving(player))
{
if (!shouldDisplay(player))
continue;
if (Manager.isMoving(player))
UtilParticle.PlayParticle(ParticleType.FLAME, player.getLocation().add(0, 1f, 0), 0.2f, 0.2f, 0.2f, 0, 1, ViewDist.NORMAL,
UtilServer.getPlayers());
}
else
{
for (int i = 0; i < 1; i++)
{
UtilParticle.PlayParticle(ParticleType.FLAME, player.getLocation().add(0, 1f, 0), 0.2f, 0.2f, 0.2f, 0, 1,
ViewDist.NORMAL, UtilServer.getPlayers());
double lead = i * ((2d * Math.PI) / 2);
float x = (float) (Math.sin(player.getTicksLived() / 5d + lead) * 1f);
float z = (float) (Math.cos(player.getTicksLived() / 5d + lead) * 1f);
float y = (float) (Math.sin(player.getTicksLived() / 5d + lead) + 1f);
UtilParticle.PlayParticle(ParticleType.FLAME, player.getLocation().add(x, y, z), 0f, 0f, 0f, 0, 1, ViewDist.NORMAL,
UtilServer.getPlayers());
}
else
for (int i = 0; i < 1; i++)
{
for (int i=0 ; i < 1 ; i++)
{
double lead = i * ((2d * Math.PI)/2);
double lead = i * ((2d * Math.PI) / 2);
float x = (float) (Math.sin(player.getTicksLived()/5d + lead) * 1f);
float z = (float) (Math.cos(player.getTicksLived()/5d + lead) * 1f);
float x = (float) -(Math.sin(player.getTicksLived() / 5d + lead) * 1f);
float z = (float) (Math.cos(player.getTicksLived() / 5d + lead) * 1f);
float y = (float) (Math.sin(player.getTicksLived()/5d + lead) + 1f);
float y = (float) (Math.sin(player.getTicksLived() / 5d + lead) + 1f);
UtilParticle.PlayParticle(ParticleType.FLAME, player.getLocation().add(x, y, z), 0f, 0f, 0f, 0, 1,
ViewDist.NORMAL, UtilServer.getPlayers());
}
for (int i=0 ; i < 1 ; i++)
{
double lead = i * ((2d * Math.PI)/2);
float x = (float) -(Math.sin(player.getTicksLived()/5d + lead) * 1f);
float z = (float) (Math.cos(player.getTicksLived()/5d + lead) * 1f);
float y = (float) (Math.sin(player.getTicksLived()/5d + lead) + 1f);
UtilParticle.PlayParticle(ParticleType.FLAME, player.getLocation().add(x, y, z), 0f, 0f, 0f, 0, 1,
ViewDist.NORMAL, UtilServer.getPlayers());
}
//Sound
player.getWorld().playSound(player.getLocation(), Sound.FIRE, 0.2f, 1f);
UtilParticle.PlayParticle(ParticleType.FLAME, player.getLocation().add(x, y, z), 0f, 0f, 0f, 0, 1, ViewDist.NORMAL,
UtilServer.getPlayers());
}
// Sound
player.getWorld().playSound(player.getLocation(), Sound.FIRE, 0.2f, 1f);
}
}
}

View File

@ -32,95 +32,80 @@ import mineplex.core.gadget.GadgetManager;
public class ParticleFoot extends ParticleGadget
{
private boolean _foot = false;
private HashMap<Location, Long> _steps = new HashMap<Location, Long>();
public ParticleFoot(GadgetManager manager)
{
super(manager, "Shadow Walk",
UtilText.splitLineToArray(C.cGray + "In a world where footprints do not exist, leaving your shadow behind is the next best thing!", LineFormat.LORE),
-2,
Material.LEATHER_BOOTS, (byte)0);
super(manager, "Shadow Walk",
UtilText.splitLineToArray(C.cGray + "In a world where footprints do not exist, leaving your shadow behind is the next best thing!",
LineFormat.LORE),
-2, Material.LEATHER_BOOTS, (byte) 0);
}
@EventHandler
public void playParticle(UpdateEvent event)
@Override
public void playParticle(Player player, UpdateEvent event)
{
if (event.getType() != UpdateType.FASTEST)
return;
if (event.getType() != UpdateType.FASTEST) return;
_foot = !_foot;
cleanSteps();
for (Player player : GetActive())
{
if (!shouldDisplay(player))
continue;
if (!Manager.isMoving(player))
continue;
if (!UtilEnt.isGrounded(player))
continue;
Vector offset;
Vector dir = player.getLocation().getDirection();
dir.setY(0);
dir.normalize();
if (_foot)
{
offset = new Vector(dir.getZ() * -1, 0.1, dir.getX());
}
else
{
offset = new Vector(dir.getZ(), 0.1, dir.getX() * -1);
}
Location loc = player.getLocation().add(offset.multiply(0.2));
if (nearStep(loc))
continue;
if (!UtilBlock.solid(loc.getBlock().getRelative(BlockFace.DOWN)))
continue;
_steps.put(loc, System.currentTimeMillis());
UtilParticle.PlayParticle(ParticleType.FOOTSTEP, loc, 0f, 0f, 0f, 0, 1,
ViewDist.NORMAL, UtilServer.getPlayers());
UtilParticle.PlayParticle(ParticleType.LARGE_SMOKE, loc.clone().add(0, 0.1, 0), 0f, 0f, 0f, 0, 1,
ViewDist.NORMAL, UtilServer.getPlayers());
if (!Manager.isMoving(player)) return;
if (!UtilEnt.isGrounded(player)) return;
Vector offset;
Vector dir = player.getLocation().getDirection();
dir.setY(0);
dir.normalize();
if (_foot)
{
offset = new Vector(dir.getZ() * -1, 0.1, dir.getX());
}
else
{
offset = new Vector(dir.getZ(), 0.1, dir.getX() * -1);
}
Location loc = player.getLocation().add(offset.multiply(0.2));
if (nearStep(loc)) return;
if (!UtilBlock.solid(loc.getBlock().getRelative(BlockFace.DOWN))) return;
_steps.put(loc, System.currentTimeMillis());
UtilParticle.PlayParticle(ParticleType.FOOTSTEP, loc, 0f, 0f, 0f, 0, 1, ViewDist.NORMAL, UtilServer.getPlayers());
UtilParticle.PlayParticle(ParticleType.LARGE_SMOKE, loc.clone().add(0, 0.1, 0), 0f, 0f, 0f, 0, 1, ViewDist.NORMAL,
UtilServer.getPlayers());
}
public void cleanSteps()
{
if (_steps.isEmpty())
return;
if (_steps.isEmpty()) return;
Iterator<Entry<Location, Long>> stepIterator = _steps.entrySet().iterator();
while (stepIterator.hasNext())
{
Entry<Location, Long> entry = stepIterator.next();
if (UtilTime.elapsed(entry.getValue(), 10000))
stepIterator.remove();
if (UtilTime.elapsed(entry.getValue(), 10000)) stepIterator.remove();
}
}
public boolean nearStep(Location loc)
{
for (Location other : _steps.keySet())
{
if (UtilMath.offset(loc, other) < 0.3)
return true;
if (UtilMath.offset(loc, other) < 0.3) return true;
}
return false;
}
}

View File

@ -1,23 +1,17 @@
package mineplex.core.gadget.gadgets.particle;
import java.util.HashSet;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilText;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilText;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.set.SetFrostLord;
import mineplex.core.gadget.types.GadgetSet;
import mineplex.core.gadget.types.ParticleGadget;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
@ -27,57 +21,47 @@ public class ParticleFrostLord extends ParticleGadget
{
public ParticleFrostLord(GadgetManager manager)
{
super(manager, "Wind of the Frost Lord",
UtilText.splitLineToArray(C.cGray + "Hes not passing wind okay? HE HAS A CONDITION!", LineFormat.LORE),
-3,
Material.SNOW_BALL, (byte)0, "Frost Lord");
super(manager, "Wind of the Frost Lord",
UtilText.splitLineToArray(C.cGray + "Hes not passing wind okay? HE HAS A CONDITION!", LineFormat.LORE), -3, Material.SNOW_BALL,
(byte) 0, "Frost Lord");
}
@EventHandler
public void playParticle(UpdateEvent event)
public void playParticle(Player player, UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
if (event.getType() != UpdateType.TICK) return;
for (Player player : GetActive())
if (Manager.isMoving(player))
{
if (!shouldDisplay(player))
continue;
if (Manager.isMoving(player))
UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, player.getLocation().add(0, 1, 0), 0.2f, 0.2f, 0.2f, 0, 4, ViewDist.NORMAL,
UtilServer.getPlayers());
}
else
{
player.getWorld().playSound(player.getLocation(), Sound.AMBIENCE_RAIN, 0.015f, 0.2f);
double scale = (double) (player.getTicksLived() % 50) / 50d;
int amount = 4;
if (getSet() != null && getSet().isActive(player)) amount = 6;
double ang = Math.PI * 2 / amount;
for (int i = 0; i < amount; i++)
{
UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, player.getLocation().add(0, 1, 0), 0.2f, 0.2f, 0.2f, 0, 4,
ViewDist.NORMAL, UtilServer.getPlayers());
}
else
{
player.getWorld().playSound(player.getLocation(), Sound.AMBIENCE_RAIN, 0.015f, 0.2f);
double scale = (double)(player.getTicksLived() % 50) / 50d;
int amount = 4;
if(getSet() != null && getSet().isActive(player))
amount = 6;
double ang = Math.PI*2/amount;
for (int i = 0 ; i < amount ; i++)
double r = (1d - scale) * Math.PI * 2;
double x = Math.sin(r + (i * ang)) * (r % (Math.PI * 4)) * 0.4;
double z = Math.cos(r + (i * ang)) * (r % (Math.PI * 4)) * 0.4;
UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, player.getLocation().add(x, scale * 3, z), 0f, 0f, 0f, 0, 1, ViewDist.NORMAL,
UtilServer.getPlayers());
if (scale > 0.95 && Recharge.Instance.use(player, GetName(), 1000, false, false))
{
double r = (1d-scale) * Math.PI * 2;
double x = Math.sin(r + (i * ang)) * (r%(Math.PI * 4)) * 0.4;
double z = Math.cos(r + (i * ang)) * (r%(Math.PI * 4)) * 0.4;
UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, player.getLocation().add(x, scale * 3, z), 0f, 0f, 0f, 0, 1,
ViewDist.NORMAL, UtilServer.getPlayers());
if (scale > 0.95 && Recharge.Instance.use(player, GetName(), 1000, false, false))
{
UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, player.getLocation().add(0, scale * 3.5, 0), 0f, 0f, 0f, 0.2f, 60,
ViewDist.NORMAL, UtilServer.getPlayers());
player.getWorld().playSound(player.getLocation(), Sound.STEP_SNOW, 1f, 1.5f);
}
UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, player.getLocation().add(0, scale * 3.5, 0), 0f, 0f, 0f, 0.2f, 60,
ViewDist.NORMAL, UtilServer.getPlayers());
player.getWorld().playSound(player.getLocation(), Sound.STEP_SNOW, 1f, 1.5f);
}
}
}

View File

@ -1,22 +1,19 @@
package mineplex.core.gadget.gadgets.particle;
import org.bukkit.GameMode;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilText;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilText;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.ParticleGadget;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.gadget.GadgetManager;
public class ParticleGreen extends ParticleGadget
{
@ -24,48 +21,39 @@ public class ParticleGreen extends ParticleGadget
public ParticleGreen(GadgetManager manager)
{
super(manager, "Green Ring",
UtilText.splitLineToArray(C.cGray + "With these sparkles, you can sparkle while sparkle with CaptainSparklez!", LineFormat.LORE),
-2,
Material.EMERALD, (byte)0);
UtilText.splitLineToArray(C.cGray + "With these sparkles, you can sparkle while sparkle with CaptainSparklez!", LineFormat.LORE),
-2, Material.EMERALD, (byte) 0);
}
@EventHandler
public void playParticle(UpdateEvent event)
public void playParticle(Player player, UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
if (event.getType() != UpdateType.TICK) return;
for (Player player : GetActive())
{
if (!shouldDisplay(player))
continue;
float x = (float) (Math.sin(player.getTicksLived()/7d) * 1f);
float z = (float) (Math.cos(player.getTicksLived()/7d) * 1f);
float y = (float) (Math.cos(player.getTicksLived()/17d) * 1f + 1f);
UtilParticle.PlayParticle(ParticleType.HAPPY_VILLAGER, player.getLocation().add(x, y, z), 0f, 0f, 0f, 0, 1,
ViewDist.NORMAL, UtilServer.getPlayers());
// if (Manager.isMoving(player))
// {
// UtilParticle.PlayParticle(ParticleType.HAPPY_VILLAGER, player.getLocation().add(0, 1f, 0), 0f, 0f, 0f, 0, 1);
// }
// else
// {
// float scale = Math.abs((float) (Math.sin(player.getTicksLived()/30d) * 2f)) + 1;
// // float vertical = (float) (Math.cos(player.getTicksLived()/50d) * 1f);
//
// int dir = player.isSneaking() ? 1 : -1;
//
// for (double i=0 ; i<Math.PI * 2 ; i += 0.2)
// {
// double x = Math.sin(i + (dir * player.getTicksLived()/50d)) * (i%(Math.PI/2d));
// double z = Math.cos(i + (dir * player.getTicksLived()/50d)) * (i%(Math.PI/2d));
//
// UtilParticle.PlayParticle(ParticleType.HAPPY_VILLAGER, player.getLocation().add(x, 1, z), 0f, 0f, 0f, 0, 1);
// }
// }
}
float x = (float) (Math.sin(player.getTicksLived() / 7d) * 1f);
float z = (float) (Math.cos(player.getTicksLived() / 7d) * 1f);
float y = (float) (Math.cos(player.getTicksLived() / 17d) * 1f + 1f);
UtilParticle.PlayParticle(ParticleType.HAPPY_VILLAGER, player.getLocation().add(x, y, z), 0f, 0f, 0f, 0, 1, ViewDist.NORMAL,
UtilServer.getPlayers());
// if (Manager.isMoving(player))
// {
// UtilParticle.PlayParticle(ParticleType.HAPPY_VILLAGER, player.getLocation().add(0, 1f, 0), 0f, 0f, 0f, 0, 1);
// }
// else
// {
// float scale = Math.abs((float) (Math.sin(player.getTicksLived()/30d) * 2f)) + 1;
// // float vertical = (float) (Math.cos(player.getTicksLived()/50d) * 1f);
//
// int dir = player.isSneaking() ? 1 : -1;
//
// for (double i=0 ; i<Math.PI * 2 ; i += 0.2)
// {
// double x = Math.sin(i + (dir * player.getTicksLived()/50d)) * (i%(Math.PI/2d));
// double z = Math.cos(i + (dir * player.getTicksLived()/50d)) * (i%(Math.PI/2d));
//
// UtilParticle.PlayParticle(ParticleType.HAPPY_VILLAGER, player.getLocation().add(x, 1, z), 0f, 0f, 0f, 0, 1);
// }
// }
}
}

View File

@ -4,7 +4,6 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.Map.Entry;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Player;
@ -17,76 +16,59 @@ import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilMath;
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.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilText;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.ParticleGadget;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.gadget.GadgetManager;
public class ParticleHeart extends ParticleGadget {
public class ParticleHeart extends ParticleGadget
{
private HashMap<Player, HashMap<Player, Location>> _target = new HashMap<Player, HashMap<Player, Location>>();
public ParticleHeart(GadgetManager manager)
{
super(manager, "I Heart You",
UtilText.splitLineToArray(C.cGray + "Show off how much you love Mineplex and everyone on it!", LineFormat.LORE),
-2,
Material.APPLE, (byte)0);
super(manager, "I Heart You",
UtilText.splitLineToArray(C.cGray + "Show off how much you love Mineplex and everyone on it!", LineFormat.LORE), -2,
Material.APPLE, (byte) 0);
}
@EventHandler
public void playParticle(UpdateEvent event)
@Override
public void playParticle(Player player, UpdateEvent event)
{
if (event.getType() != UpdateType.FASTEST)
return;
if (event.getType() != UpdateType.FASTEST) return;
//Launch
for (Player player : GetActive())
if (!_target.containsKey(player)) _target.put(player, new HashMap<Player, Location>());
if (Recharge.Instance.use(player, GetName(), 500, false, false))
{
if (!shouldDisplay(player))
continue;
if (!_target.containsKey(player))
_target.put(player, new HashMap<Player, Location>());
if (Recharge.Instance.use(player, GetName(), 500, false, false))
for (Player other : UtilServer.getPlayers())
{
for (Player other : UtilServer.getPlayers())
{
if (other.equals(player))
continue;
if (other.equals(player)) continue;
if (!UtilPlayer.isSpectator(other))
continue;
if (!UtilPlayer.isSpectator(other)) continue;
if (_target.get(player).containsKey(other))
continue;
if (_target.get(player).containsKey(other)) continue;
if (UtilMath.offset(player, other) > 6)
continue;
if (UtilMath.offset(player, other) > 6) continue;
_target.get(player).put(other, player.getLocation().add(0, 1, 0));
_target.get(player).put(other, player.getLocation().add(0, 1, 0));
break;
}
break;
}
if (Manager.isMoving(player))
UtilParticle.PlayParticle(ParticleType.HEART, player.getLocation().add(0, 1, 0), 0f, 0f, 0f, 0, 1,
ViewDist.NORMAL, UtilServer.getPlayers());
else
UtilParticle.PlayParticle(ParticleType.HEART, player.getLocation().add(0, 1, 0), 0.5f, 0.5f, 0.5f, 0, 1,
ViewDist.NORMAL, UtilServer.getPlayers());
}
if (Manager.isMoving(player)) UtilParticle.PlayParticle(ParticleType.HEART, player.getLocation().add(0, 1, 0), 0f, 0f, 0f, 0, 1,
ViewDist.NORMAL, UtilServer.getPlayers());
else UtilParticle.PlayParticle(ParticleType.HEART, player.getLocation().add(0, 1, 0), 0.5f, 0.5f, 0.5f, 0, 1, ViewDist.NORMAL,
UtilServer.getPlayers());
//Particle
// Particle
for (HashMap<Player, Location> heart : _target.values())
{
Iterator<Entry<Player, Location>> heartIterator = heart.entrySet().iterator();
@ -97,11 +79,9 @@ public class ParticleHeart extends ParticleGadget {
entry.getValue().add(UtilAlg.getTrajectory(entry.getValue(), entry.getKey().getEyeLocation()).multiply(0.6));
UtilParticle.PlayParticle(ParticleType.HEART, entry.getValue(), 0, 0, 0, 0, 1,
ViewDist.NORMAL, UtilServer.getPlayers());
UtilParticle.PlayParticle(ParticleType.HEART, entry.getValue(), 0, 0, 0, 0, 1, ViewDist.NORMAL, UtilServer.getPlayers());
if (UtilMath.offset(entry.getValue(), entry.getKey().getEyeLocation()) < 0.6)
heartIterator.remove();
if (UtilMath.offset(entry.getValue(), entry.getKey().getEyeLocation()) < 0.6) heartIterator.remove();
}
}
}
@ -109,8 +89,7 @@ public class ParticleHeart extends ParticleGadget {
@Override
public void DisableCustom(Player player)
{
if (_active.remove(player))
UtilPlayer.message(player, F.main("Gadget", "You unsummoned " + F.elem(GetName()) + "."));
if (_active.remove(player)) UtilPlayer.message(player, F.main("Gadget", "You unsummoned " + F.elem(GetName()) + "."));
clean(player);
}

View File

@ -3,16 +3,15 @@ package mineplex.core.gadget.gadgets.particle;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilText;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilText;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.ParticleGadget;
import mineplex.core.updater.UpdateType;
@ -23,106 +22,97 @@ public class ParticleHelix extends ParticleGadget
public ParticleHelix(GadgetManager manager)
{
super(manager, "Blood Helix",
UtilText.splitLineToArray(C.cGray + "Blood magic is very dangerous... but also very cool!", LineFormat.LORE),
-2,
Material.REDSTONE, (byte)0);
super(manager, "Blood Helix", UtilText.splitLineToArray(C.cGray + "Blood magic is very dangerous... but also very cool!", LineFormat.LORE),
-2, Material.REDSTONE, (byte) 0);
}
@EventHandler
public void playParticle(UpdateEvent event)
@Override
public void playParticle(Player player, UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
if (event.getType() != UpdateType.TICK) return;
for (Player player : GetActive())
if (Manager.isMoving(player))
{
if (!shouldDisplay(player))
continue;
if (Manager.isMoving(player))
UtilParticle.PlayParticle(ParticleType.RED_DUST, player.getLocation().add(0, 1, 0), 0.2f, 0.2f, 0.2f, 0, 4, ViewDist.NORMAL,
UtilServer.getPlayers());
}
else
{
int ticks = 10;
int hticks = 40;
boolean up = player.getTicksLived() % (hticks * 2) < hticks;
int tick = player.getTicksLived() % ticks;
double htick = player.getTicksLived() % hticks;
int splits = 4;
Location loc = player.getLocation().add(0, 2, 0);
for (double d = tick * (Math.PI * 2 / splits) / ticks; d < Math.PI * 2; d += Math.PI * 2 / splits)
{
UtilParticle.PlayParticle(ParticleType.RED_DUST, player.getLocation().add(0, 1, 0), 0.2f, 0.2f, 0.2f, 0, 4,
ViewDist.NORMAL, UtilServer.getPlayers());
Vector v = new Vector(Math.sin(d), 0, Math.cos(d));
v.normalize().multiply(Math.max(0.2, Math.sin((htick / hticks) * Math.PI) * 1.0));
v.setY((htick / hticks) * -2);
if (up) v.setY(-2 + 2 * (htick / hticks));
// v.multiply(2).subtract(v.clone().multiply(htick/hticks));
// v.multiply(2*(htick/hticks));
Location lloc = loc.clone().add(v);
UtilParticle.PlayParticleToAll(ParticleType.RED_DUST, lloc, null, 0f, 2, ViewDist.NORMAL);
}
else
{
int ticks = 10;
int hticks = 40;
boolean up = player.getTicksLived()%(hticks*2) < hticks;
int tick = player.getTicksLived()%ticks;
double htick = player.getTicksLived()%hticks;
int splits = 4;
Location loc = player.getLocation().add(0, 2, 0);
for(double d = tick*(Math.PI*2/splits)/ticks; d < Math.PI*2; d += Math.PI*2/splits)
{
Vector v = new Vector(Math.sin(d), 0, Math.cos(d));
v.normalize().multiply(Math.max(0.2, Math.sin((htick/hticks)*Math.PI)*1.0));
v.setY((htick/hticks) * -2);
if(up) v.setY(-2 + 2*(htick/hticks));
// v.multiply(2).subtract(v.clone().multiply(htick/hticks));
// v.multiply(2*(htick/hticks));
Location lloc = loc.clone().add(v);
UtilParticle.PlayParticleToAll(ParticleType.RED_DUST, lloc, null, 0f, 2, ViewDist.NORMAL);
}
// UtilParticle.PlayParticle(ParticleType.RED_DUST, player.getLocation().add(0, 0.1, 0), 0.5f, 0.1f, 0.5f, 0, 20,
// ViewDist.NORMAL, UtilServer.getPlayers());
/*
* With Flame
int ticks = 10;
int tick = player.getTicksLived()%ticks;
int splits = 3;
Location loc = player.getLocation().add(0, 3, 0);
for(double d = tick*(Math.PI*2/splits)/ticks; d < Math.PI*2; d += Math.PI*2/splits)
{
Vector v = new Vector(Math.sin(d), 0, Math.cos(d));
v.setY(-1.5);
UtilParticle.PlayParticleToAll(ParticleType.FLAME, loc, v, 0.1f, 0, ViewDist.NORMAL);
}
UtilParticle.PlayParticle(ParticleType.RED_DUST, player.getLocation().add(0, 0.1, 0), 0.5f, 0.1f, 0.5f, 0, 20,
ViewDist.NORMAL, UtilServer.getPlayers());
*/
/*
for (int height=0 ; height <= 20 ; height++)
{
for (int i=0 ; i < 2 ; i++)
{
double lead = i * ((2d * Math.PI)/2);
double heightLead = height * ((2d * Math.PI)/20);
float x = (float) (Math.sin(player.getTicksLived()/20d + lead + heightLead) * 1.2f);
float z = (float) (Math.cos(player.getTicksLived()/20d + lead + heightLead) * 1.2f);
// UtilParticle.PlayParticle(ParticleType.RED_DUST, player.getLocation().add(0, 0.1, 0), 0.5f, 0.1f, 0.5f, 0, 20,
// ViewDist.NORMAL, UtilServer.getPlayers());
float y = 0.15f * height;
UtilParticle.PlayParticle(ParticleType.RED_DUST, player.getLocation().add(x * (1d - height/22d), y, z * (1d - height/22d)), 0f, 0f, 0f, 0, 1,
ViewDist.NORMAL, UtilServer.getPlayers());
}
}
//UtilParticle.PlayParticle(ParticleType.LAVA, player.getLocation().add(0, 3, 0), 0f, 0f, 0f, 0, 2);
//Sound
player.getWorld().playSound(player.getLocation(), Sound.LAVA, 0.3f, 1f);
*/
}
/*
* With Flame
* int ticks = 10;
* int tick = player.getTicksLived()%ticks;
* int splits = 3;
*
* Location loc = player.getLocation().add(0, 3, 0);
*
* for(double d = tick*(Math.PI*2/splits)/ticks; d < Math.PI*2; d += Math.PI*2/splits)
* {
* Vector v = new Vector(Math.sin(d), 0, Math.cos(d));
*
* v.setY(-1.5);
*
* UtilParticle.PlayParticleToAll(ParticleType.FLAME, loc, v, 0.1f, 0, ViewDist.NORMAL);
* }
*
* UtilParticle.PlayParticle(ParticleType.RED_DUST, player.getLocation().add(0, 0.1, 0), 0.5f, 0.1f, 0.5f, 0, 20,
* ViewDist.NORMAL, UtilServer.getPlayers());
*/
/*
* for (int height=0 ; height <= 20 ; height++)
* {
* for (int i=0 ; i < 2 ; i++)
* {
* double lead = i * ((2d * Math.PI)/2);
*
* double heightLead = height * ((2d * Math.PI)/20);
*
* float x = (float) (Math.sin(player.getTicksLived()/20d + lead + heightLead) * 1.2f);
* float z = (float) (Math.cos(player.getTicksLived()/20d + lead + heightLead) * 1.2f);
*
* float y = 0.15f * height;
*
* UtilParticle.PlayParticle(ParticleType.RED_DUST, player.getLocation().add(x * (1d - height/22d), y, z * (1d - height/22d)), 0f, 0f,
* 0f, 0, 1,
* ViewDist.NORMAL, UtilServer.getPlayers());
*
*
* }
* }
*
* //UtilParticle.PlayParticle(ParticleType.LAVA, player.getLocation().add(0, 3, 0), 0f, 0f, 0f, 0, 2);
*
* //Sound
* player.getWorld().playSound(player.getLocation(), Sound.LAVA, 0.3f, 1f);
*/
}
}
}

View File

@ -0,0 +1,101 @@
package mineplex.core.gadget.gadgets.particle;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import mineplex.core.common.shape.ShapeWings;
import mineplex.core.common.util.LineFormat;
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.UtilPlayer;
import mineplex.core.common.util.UtilText;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.ParticleGadget;
import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class ParticleIHeartYou extends ParticleGadget implements IThrown
{
private ShapeWings _wings = new ShapeWings();
public ParticleIHeartYou(GadgetManager manager)
{
super(manager, "I ❤ You!",
UtilText.splitLineToArray("Lots and lots of love. I mean, why not ❤", LineFormat.LORE),
1, Material.APPLE, (byte)0);
}
@Override
public void playParticle(Player player, UpdateEvent event)
{
if(event.getType() == UpdateType.SEC)
{
ArmorStand stand = player.getWorld().spawn(player.getLocation().add(0, 1000, 0), ArmorStand.class);
stand.setSmall(true);
stand.setVisible(false);
stand.teleport(player.getEyeLocation().add(0, 0.3, 0));
stand.setFallDistance(-1000000);
Manager.getProjectileManager().AddThrow(stand, player, this, 2000, true, false, false, false, null, 0, 0, ParticleType.HEART, UpdateType.TICK, 0);
Vector v = null;
Player closest = UtilPlayer.getClosest(player.getLocation(), player);
if(closest != null && closest.getLocation().distanceSquared(player.getLocation()) > 12*12)
{
v = closest.getLocation().subtract(player.getLocation()).toVector().normalize();
v.setY(v.getY()+0.5);
}
else
{
v = Vector.getRandom().subtract(Vector.getRandom()).setY(0).normalize().multiply(0.3).setY(0.5);
}
stand.setVelocity(v);
}
if(getSet() != null && getSet().isActive(player))
{
Location loc = player.getLocation().add(0, 1.2, 0).add(player.getLocation().getDirection().multiply(-0.2));
if(Manager.isMoving(player))
{
if(event.getType() == UpdateType.FASTEST)
UtilParticle.PlayParticleToAll(ParticleType.RED_DUST, loc, 0.3f, 0.3f, 0.3f, 0, 10, ViewDist.NORMAL);
return;
}
if(event.getType() == UpdateType.FAST) _wings.display(loc);
}
}
@Override
public void Collide(LivingEntity target, Block block, ProjectileUser data)
{
if(target.getType() == EntityType.PLAYER)
{
UtilParticle.PlayParticleToAll(ParticleType.HEART, data.GetThrown().getLocation(), 0.2f, 0.2f, 0.2f, 0, 10, ViewDist.NORMAL);
target.getWorld().playSound(data.GetThrown().getLocation(), Sound.CHICKEN_EGG_POP, 0.5f, 1f);
}
}
@Override
public void Idle(ProjectileUser data)
{
}
@Override
public void Expire(ProjectileUser data)
{
}
}

View File

@ -36,23 +36,18 @@ public class ParticleKronos extends ParticleGadget
Material.EYE_OF_ENDER, (byte)0);
}
@EventHandler
public void playParticle(UpdateEvent event)
@Override
public void playParticle(Player player, 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

View File

@ -10,12 +10,12 @@ import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilText;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.ParticleGadget;
import mineplex.core.inventory.ClientItem;
import mineplex.core.inventory.data.Item;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.gadget.GadgetManager;
public class ParticleLegend extends ParticleGadget
{
@ -27,19 +27,13 @@ public class ParticleLegend extends ParticleGadget
Material.ENDER_PORTAL_FRAME, (byte)0);
}
@EventHandler
public void playParticle(UpdateEvent event)
@Override
public void playParticle(Player player, UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Player player : GetActive())
{
if (!shouldDisplay(player))
continue;
player.getWorld().playEffect(player.getLocation().add(0, 1, 0), Effect.ENDER_SIGNAL, 0);
}
}
@EventHandler

View File

@ -0,0 +1,109 @@
package mineplex.core.gadget.gadgets.particle;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilItem;
import mineplex.core.common.util.UtilMath;
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.UtilText;
import mineplex.core.disguise.disguises.DisguiseArmorStand;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.ParticleGadget;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class ParticlePartyTime extends ParticleGadget
{
private Set<Item> _hiddenDrops = new HashSet<>();
private Byte[] _data = new Byte[]{1,2,4,5,6,9,10,11,12,13,14,15};
public ParticlePartyTime(GadgetManager manager)
{
super(manager, "Party Time",
UtilText.splitLineToArray(C.cWhite + "It is " + C.cPurple + "PARTY TIME!", LineFormat.LORE),
-3, Material.FIREWORK, (byte)-1);
}
@Override
public void playParticle(Player player, UpdateEvent event)
{
if(event.getType() != UpdateType.TICK) return;
Location loc = player.getLocation().add(Math.random()*2-1, 3, Math.random()*2-1);
List<Byte> list = Arrays.asList(_data);
Collections.shuffle(list);
for(int i = 0; i < 1; i++)
{
String particle = ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, list.get(i));
UtilParticle.PlayParticleToAll(particle, loc, null, 0.08f, 10, ViewDist.NORMAL);
// loc.getWorld().playSound(loc, Sound.FIREWORK_BLAST, 0.03f, 1.4f);
}
if(getSet() != null && getSet().isActive(player))
{
if(player.getTicksLived()%10 == 0)
{
Location spawnLoc = player.getLocation().add(0, 2.5, 0);
Vector v = Vector.getRandom().subtract(Vector.getRandom()).setY(0).normalize().multiply(0.3).setY(0.3+0.3*Math.random());
byte data = _data[UtilMath.r(_data.length)];
ItemStack stack = new ItemStack(Material.INK_SACK, 1, (short)0, data);
Item item = UtilItem.dropItem(stack, spawnLoc, false, false, 10, true);
item.setVelocity(v);
_hiddenDrops.add(item);
DisguiseArmorStand stand = new DisguiseArmorStand(item);
stand.setInvisible(true);
Manager.getDisguiseManager().disguise(stand);
String particle = ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, data);
UtilParticle.PlayParticleToAll(particle, spawnLoc, null, 0.08f, 30, ViewDist.NORMAL);
spawnLoc.getWorld().playSound(spawnLoc, Sound.FIREWORK_LAUNCH, 0.05f, 0.4f);
}
}
}
@EventHandler
public void onUpdate(UpdateEvent event)
{
if(event.getType() != UpdateType.TICK) return;
for(Iterator<Item> it = _hiddenDrops.iterator(); it.hasNext();)
{
Item item = it.next();
if(!item.isValid()) {
it.remove();
return;
}
String particle = ParticleType.ICON_CRACK.getParticle(item.getItemStack().getType(), item.getItemStack().getData().getData());
UtilParticle.PlayParticleToAll(particle, item.getLocation(), null, 0, 3, ViewDist.NORMAL);
}
}
}

View File

@ -1,66 +1,54 @@
package mineplex.core.gadget.gadgets.particle;
import org.bukkit.GameMode;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilText;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilText;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.ParticleGadget;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.gadget.GadgetManager;
public class ParticleRain extends ParticleGadget
{
public ParticleRain(GadgetManager manager)
{
super(manager, "Rain Cloud",
UtilText.splitLineToArray(C.cGray + "Bring your sadness wherever you go, with your very own portable rain cloud!", LineFormat.LORE),
-2,
Material.INK_SACK, (byte)4);
super(manager, "Rain Cloud", UtilText
.splitLineToArray(C.cGray + "Bring your sadness wherever you go, with your very own portable rain cloud!", LineFormat.LORE), -2,
Material.INK_SACK, (byte) 4);
}
@EventHandler
public void playParticle(UpdateEvent event)
@Override
public void playParticle(Player player, UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
if (event.getType() != UpdateType.TICK) return;
for (Player player : GetActive())
if (Manager.isMoving(player))
{
if (!shouldDisplay(player))
continue;
if (Manager.isMoving(player))
{
UtilParticle.PlayParticle(ParticleType.SPLASH, player.getLocation().add(0, 1, 0), 0.2f, 0.2f, 0.2f, 0, 4,
ViewDist.NORMAL, UtilServer.getPlayers());
}
else
{
UtilParticle.PlayParticle(ParticleType.EXPLODE, player.getLocation().add(0, 3.5, 0), 0.6f, 0f, 0.6f, 0, 8,
ViewDist.NORMAL, player);
for (Player other : UtilServer.getPlayers())
if (!player.equals(other))
UtilParticle.PlayParticle(ParticleType.CLOUD, player.getLocation().add(0, 3.5, 0), 0.6f, 0.1f, 0.6f, 0, 8,
ViewDist.NORMAL, other);
UtilParticle.PlayParticle(ParticleType.DRIP_WATER, player.getLocation().add(0, 3.5, 0), 0.4f, 0.1f, 0.4f, 0, 2,
ViewDist.NORMAL, UtilServer.getPlayers());
//Sound
player.getWorld().playSound(player.getLocation(), Sound.AMBIENCE_RAIN, 0.1f, 1f);
}
UtilParticle.PlayParticle(ParticleType.SPLASH, player.getLocation().add(0, 1, 0), 0.2f, 0.2f, 0.2f, 0, 4, ViewDist.NORMAL,
UtilServer.getPlayers());
}
else
{
UtilParticle.PlayParticle(ParticleType.EXPLODE, player.getLocation().add(0, 3.5, 0), 0.6f, 0f, 0.6f, 0, 8, ViewDist.NORMAL, player);
for (Player other : UtilServer.getPlayers())
if (!player.equals(other)) UtilParticle.PlayParticle(ParticleType.CLOUD, player.getLocation().add(0, 3.5, 0), 0.6f, 0.1f, 0.6f, 0,
8, ViewDist.NORMAL, other);
UtilParticle.PlayParticle(ParticleType.DRIP_WATER, player.getLocation().add(0, 3.5, 0), 0.4f, 0.1f, 0.4f, 0, 2, ViewDist.NORMAL,
UtilServer.getPlayers());
// Sound
player.getWorld().playSound(player.getLocation(), Sound.AMBIENCE_RAIN, 0.1f, 1f);
}
}
}

View File

@ -22,88 +22,75 @@ import mineplex.core.updater.event.UpdateEvent;
public class ParticleTitan extends ParticleGadget
{
private int _tick;
public ParticleTitan(GadgetManager manager)
{
super(manager, "Flame of the Titans",
UtilText.splitLineToArray(C.cGray + "These flames are said to be the spirit of a Titan.", LineFormat.LORE),
-1,
Material.FIREBALL, (byte)0);
super(manager, "Flame of the Titans",
UtilText.splitLineToArray(C.cGray + "These flames are said to be the spirit of a Titan.", LineFormat.LORE), -1, Material.FIREBALL,
(byte) 0);
}
@EventHandler
public void onUpdate(UpdateEvent event)
@Override
public void playParticle(Player player, UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
_tick++;
_tick = _tick%620;
for(Player player : GetActive())
{
if (!shouldDisplay(player))
continue;
double total = 3;
if(getSet() != null && getSet().isActive(player))
total = 4;
double step = (1/total)*Math.PI*2;
double offset1 = (step/20)*_tick%20;
double offset2 = (step/31)*_tick%31;
double r = 3;
boolean redstone = false;
if(Manager.isMoving(player))
{
UtilParticle.PlayParticleToAll(ParticleType.FLAME, player.getLocation().add(0, 0.1, 0), 0.2f, 0.1f, 0.2f, 0.015f, 3, ViewDist.NORMAL);
continue;
}
return;
for(int i = 0; i < total; i++)
{
double rad = step*i + offset1;
double x = Math.sin(rad);
double y = 0;
double z = Math.cos(rad);
Vector v = new Vector(x,y,z).normalize();
v.multiply(r);
Location loc = player.getLocation();
loc.add(0, 0.1, 0);
loc.add(v);
if(redstone) UtilParticle.PlayParticleToAll(ParticleType.RED_DUST, loc, 1, 0, 0, 1, 0, ViewDist.NORMAL);
v.multiply(-1);
UtilParticle.PlayParticleToAll(ParticleType.FLAME, loc, v, 0.05f, 0, ViewDist.NORMAL);
rad = -(step*i + offset2);
x = Math.sin(rad);
z = Math.cos(rad);
v = new Vector(x,y,z).normalize();
v.multiply(r);
loc = player.getLocation();
loc.add(0, 0.1, 0);
loc.add(v);
if(redstone) UtilParticle.PlayParticleToAll(ParticleType.RED_DUST, loc, 1, 0, 0, 1, 0, ViewDist.NORMAL);
v.multiply(-1);
UtilParticle.PlayParticleToAll(ParticleType.FLAME, loc, v, 0.05f, 0, ViewDist.NORMAL);
}
int tick = player.getTicksLived() % 620;
double total = 3;
if (getSet() != null && getSet().isActive(player)) total = 4;
double step = (1 / total) * Math.PI * 2;
double offset1 = (step / 20) * tick % 20;
double offset2 = (step / 31) * tick % 31;
double r = 3;
boolean redstone = false;
if (Manager.isMoving(player))
{
UtilParticle.PlayParticleToAll(ParticleType.FLAME, player.getLocation().add(0, 0.1, 0), 0.2f, 0.1f, 0.2f, 0.015f, 3, ViewDist.NORMAL);
return;
}
for (int i = 0; i < total; i++)
{
double rad = step * i + offset1;
double x = Math.sin(rad);
double y = 0;
double z = Math.cos(rad);
Vector v = new Vector(x, y, z).normalize();
v.multiply(r);
Location loc = player.getLocation();
loc.add(0, 0.1, 0);
loc.add(v);
if (redstone) UtilParticle.PlayParticleToAll(ParticleType.RED_DUST, loc, 1, 0, 0, 1, 0, ViewDist.NORMAL);
v.multiply(-1);
UtilParticle.PlayParticleToAll(ParticleType.FLAME, loc, v, 0.05f, 0, ViewDist.NORMAL);
rad = -(step * i + offset2);
x = Math.sin(rad);
z = Math.cos(rad);
v = new Vector(x, y, z).normalize();
v.multiply(r);
loc = player.getLocation();
loc.add(0, 0.1, 0);
loc.add(v);
if (redstone) UtilParticle.PlayParticleToAll(ParticleType.RED_DUST, loc, 1, 0, 0, 1, 0, ViewDist.NORMAL);
v.multiply(-1);
UtilParticle.PlayParticleToAll(ParticleType.FLAME, loc, v, 0.05f, 0, ViewDist.NORMAL);
}
}
@EventHandler
public void titanOwner(PlayerJoinEvent event)
{

View File

@ -0,0 +1,23 @@
package mineplex.core.gadget.set;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailCupid;
import mineplex.core.gadget.gadgets.death.DeathCupidsBorkenHeart;
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpCupidsWings;
import mineplex.core.gadget.gadgets.particle.ParticleIHeartYou;
import mineplex.core.gadget.types.GadgetSet;
public class SetCupidsWings extends GadgetSet
{
public SetCupidsWings(GadgetManager manager)
{
super(manager, "Cupid's Wings", "Get wings when standing still",
manager.getGadget(ArrowTrailCupid.class),
manager.getGadget(DeathCupidsBorkenHeart.class),
manager.getGadget(DoubleJumpCupidsWings.class),
manager.getGadget(ParticleIHeartYou.class),
manager.getGadget(ArrowTrailCupid.class));
}
}

View File

@ -0,0 +1,22 @@
package mineplex.core.gadget.set;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailConfetti;
import mineplex.core.gadget.gadgets.death.DeathPinataBurst;
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpFirecracker;
import mineplex.core.gadget.gadgets.particle.ParticlePartyTime;
import mineplex.core.gadget.types.GadgetSet;
public class SetParty extends GadgetSet
{
public SetParty(GadgetManager manager)
{
super(manager, "Party", "Improved Party Time",
manager.getGadget(ArrowTrailConfetti.class),
manager.getGadget(DeathPinataBurst.class),
manager.getGadget(DoubleJumpFirecracker.class),
manager.getGadget(ParticlePartyTime.class));
}
}

View File

@ -2,7 +2,9 @@ package mineplex.core.gadget.types;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import mineplex.core.blood.BloodEvent;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.gadget.GadgetManager;
@ -41,4 +43,22 @@ public abstract class DeathEffectGadget extends Gadget
return true;
}
@EventHandler
public void callDeath(BloodEvent event)
{
if (event.getPlayer() == null)
return;
if (!IsActive(event.getPlayer()))
return;
if (!shouldDisplay(event.getPlayer()))
return;
onBlood(event.getPlayer(), event);
}
public abstract void onBlood(Player player, BloodEvent event);
}

View File

@ -2,10 +2,12 @@ package mineplex.core.gadget.types;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.updater.event.UpdateEvent;
public abstract class ParticleGadget extends Gadget
{
@ -41,4 +43,17 @@ public abstract class ParticleGadget extends Gadget
return true;
}
@EventHandler
public void Caller(UpdateEvent event)
{
for (Player player : GetActive())
{
if (!shouldDisplay(player))
continue;
playParticle(player, event);
}
}
public abstract void playParticle(Player player, UpdateEvent event);
}

View File

@ -114,6 +114,13 @@ public enum UpdateType
return false;
}
public long getTicksTillNextCall()
{
long diff = System.currentTimeMillis()-_last;
if(diff >= _time) return 0;
return -diff/50;
}
public void StartTime()
{